kanna-code 0.18.0 → 0.20.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,606 @@
1
+ var TO=Object.defineProperty;var XS=e=>{throw TypeError(e)};var MO=(e,t,n)=>t in e?TO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pn=(e,t,n)=>MO(e,typeof t!="symbol"?t+"":t,n),ZS=(e,t,n)=>t.has(e)||XS("Cannot "+n);var Fc=(e,t,n)=>(ZS(e,t,"read from private field"),n?n.call(e):t.get(e)),QS=(e,t,n)=>t.has(e)?XS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),JS=(e,t,n,r)=>(ZS(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function NO(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function hp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var av={exports:{}},Uc={};/**
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 eC;function AO(){if(eC)return Uc;eC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,a){var l=null;if(a!==void 0&&(l=""+a),s.key!==void 0&&(l=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:l,ref:s!==void 0?s:null,props:a}}return Uc.Fragment=t,Uc.jsx=n,Uc.jsxs=n,Uc}var tC;function DO(){return tC||(tC=1,av.exports=AO()),av.exports}var p=DO(),lv={exports:{}},We={};/**
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 nC;function OO(){if(nC)return We;nC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),_=Symbol.iterator;function b(I){return I===null||typeof I!="object"?null:(I=_&&I[_]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(I,Z,L){this.props=I,this.context=Z,this.refs=C,this.updater=L||w}k.prototype.isReactComponent={},k.prototype.setState=function(I,Z){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,Z,"setState")},k.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function T(){}T.prototype=k.prototype;function R(I,Z,L){this.props=I,this.context=Z,this.refs=C,this.updater=L||w}var M=R.prototype=new T;M.constructor=R,S(M,k.prototype),M.isPureReactComponent=!0;var O=Array.isArray;function D(){}var j={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function G(I,Z,L){var de=L.ref;return{$$typeof:e,type:I,key:Z,ref:de!==void 0?de:null,props:L}}function B(I,Z){return G(I.type,Z,I.props)}function H(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function P(I){var Z={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(L){return Z[L]})}var U=/\/+/g;function q(I,Z){return typeof I=="object"&&I!==null&&I.key!=null?P(""+I.key):Z.toString(36)}function W(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(D,D):(I.status="pending",I.then(function(Z){I.status==="pending"&&(I.status="fulfilled",I.value=Z)},function(Z){I.status==="pending"&&(I.status="rejected",I.reason=Z)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function z(I,Z,L,de,me){var ue=typeof I;(ue==="undefined"||ue==="boolean")&&(I=null);var he=!1;if(I===null)he=!0;else switch(ue){case"bigint":case"string":case"number":he=!0;break;case"object":switch(I.$$typeof){case e:case t:he=!0;break;case m:return he=I._init,z(he(I._payload),Z,L,de,me)}}if(he)return me=me(I),he=de===""?"."+q(I,0):de,O(me)?(L="",he!=null&&(L=he.replace(U,"$&/")+"/"),z(me,Z,L,"",function(xe){return xe})):me!=null&&(H(me)&&(me=B(me,L+(me.key==null||I&&I.key===me.key?"":(""+me.key).replace(U,"$&/")+"/")+he)),Z.push(me)),1;he=0;var we=de===""?".":de+":";if(O(I))for(var le=0;le<I.length;le++)de=I[le],ue=we+q(de,le),he+=z(de,Z,L,ue,me);else if(le=b(I),typeof le=="function")for(I=le.call(I),le=0;!(de=I.next()).done;)de=de.value,ue=we+q(de,le++),he+=z(de,Z,L,ue,me);else if(ue==="object"){if(typeof I.then=="function")return z(W(I),Z,L,de,me);throw Z=String(I),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return he}function $(I,Z,L){if(I==null)return I;var de=[],me=0;return z(I,de,"","",function(ue){return Z.call(L,ue,me++)}),de}function V(I){if(I._status===-1){var Z=I._result;Z=Z(),Z.then(function(L){(I._status===0||I._status===-1)&&(I._status=1,I._result=L)},function(L){(I._status===0||I._status===-1)&&(I._status=2,I._result=L)}),I._status===-1&&(I._status=0,I._result=Z)}if(I._status===1)return I._result.default;throw I._result}var Q=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},N={map:$,forEach:function(I,Z,L){$(I,function(){Z.apply(this,arguments)},L)},count:function(I){var Z=0;return $(I,function(){Z++}),Z},toArray:function(I){return $(I,function(Z){return Z})||[]},only:function(I){if(!H(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return We.Activity=g,We.Children=N,We.Component=k,We.Fragment=n,We.Profiler=s,We.PureComponent=R,We.StrictMode=r,We.Suspense=h,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,We.__COMPILER_RUNTIME={__proto__:null,c:function(I){return j.H.useMemoCache(I)}},We.cache=function(I){return function(){return I.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(I,Z,L){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var de=S({},I.props),me=I.key;if(Z!=null)for(ue in Z.key!==void 0&&(me=""+Z.key),Z)!F.call(Z,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&Z.ref===void 0||(de[ue]=Z[ue]);var ue=arguments.length-2;if(ue===1)de.children=L;else if(1<ue){for(var he=Array(ue),we=0;we<ue;we++)he[we]=arguments[we+2];de.children=he}return G(I.type,me,de)},We.createContext=function(I){return I={$$typeof:l,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:a,_context:I},I},We.createElement=function(I,Z,L){var de,me={},ue=null;if(Z!=null)for(de in Z.key!==void 0&&(ue=""+Z.key),Z)F.call(Z,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(me[de]=Z[de]);var he=arguments.length-2;if(he===1)me.children=L;else if(1<he){for(var we=Array(he),le=0;le<he;le++)we[le]=arguments[le+2];me.children=we}if(I&&I.defaultProps)for(de in he=I.defaultProps,he)me[de]===void 0&&(me[de]=he[de]);return G(I,ue,me)},We.createRef=function(){return{current:null}},We.forwardRef=function(I){return{$$typeof:u,render:I}},We.isValidElement=H,We.lazy=function(I){return{$$typeof:m,_payload:{_status:-1,_result:I},_init:V}},We.memo=function(I,Z){return{$$typeof:d,type:I,compare:Z===void 0?null:Z}},We.startTransition=function(I){var Z=j.T,L={};j.T=L;try{var de=I(),me=j.S;me!==null&&me(L,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(D,Q)}catch(ue){Q(ue)}finally{Z!==null&&L.types!==null&&(Z.types=L.types),j.T=Z}},We.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},We.use=function(I){return j.H.use(I)},We.useActionState=function(I,Z,L){return j.H.useActionState(I,Z,L)},We.useCallback=function(I,Z){return j.H.useCallback(I,Z)},We.useContext=function(I){return j.H.useContext(I)},We.useDebugValue=function(){},We.useDeferredValue=function(I,Z){return j.H.useDeferredValue(I,Z)},We.useEffect=function(I,Z){return j.H.useEffect(I,Z)},We.useEffectEvent=function(I){return j.H.useEffectEvent(I)},We.useId=function(){return j.H.useId()},We.useImperativeHandle=function(I,Z,L){return j.H.useImperativeHandle(I,Z,L)},We.useInsertionEffect=function(I,Z){return j.H.useInsertionEffect(I,Z)},We.useLayoutEffect=function(I,Z){return j.H.useLayoutEffect(I,Z)},We.useMemo=function(I,Z){return j.H.useMemo(I,Z)},We.useOptimistic=function(I,Z){return j.H.useOptimistic(I,Z)},We.useReducer=function(I,Z,L){return j.H.useReducer(I,Z,L)},We.useRef=function(I){return j.H.useRef(I)},We.useState=function(I){return j.H.useState(I)},We.useSyncExternalStore=function(I,Z,L){return j.H.useSyncExternalStore(I,Z,L)},We.useTransition=function(){return j.H.useTransition()},We.version="19.2.1",We}var rC;function ab(){return rC||(rC=1,lv.exports=OO()),lv.exports}var y=ab();const jt=hp(y),lR=NO({__proto__:null,default:jt},[y]);var cv={exports:{}},$c={},uv={exports:{}},dv={};/**
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 iC;function jO(){return iC||(iC=1,(function(e){function t(z,$){var V=z.length;z.push($);e:for(;0<V;){var Q=V-1>>>1,N=z[Q];if(0<s(N,$))z[Q]=$,z[V]=N,V=Q;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var $=z[0],V=z.pop();if(V!==$){z[0]=V;e:for(var Q=0,N=z.length,I=N>>>1;Q<I;){var Z=2*(Q+1)-1,L=z[Z],de=Z+1,me=z[de];if(0>s(L,V))de<N&&0>s(me,L)?(z[Q]=me,z[de]=V,Q=de):(z[Q]=L,z[Z]=V,Q=Z);else if(de<N&&0>s(me,V))z[Q]=me,z[de]=V,Q=de;else break e}}return $}function s(z,$){var V=z.sortIndex-$.sortIndex;return V!==0?V:z.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],d=[],m=1,g=null,_=3,b=!1,w=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function M(z){for(var $=n(d);$!==null;){if($.callback===null)r(d);else if($.startTime<=z)r(d),$.sortIndex=$.expirationTime,t(h,$);else break;$=n(d)}}function O(z){if(S=!1,M(z),!w)if(n(h)!==null)w=!0,D||(D=!0,P());else{var $=n(d);$!==null&&W(O,$.startTime-z)}}var D=!1,j=-1,F=5,G=-1;function B(){return C?!0:!(e.unstable_now()-G<F)}function H(){if(C=!1,D){var z=e.unstable_now();G=z;var $=!0;try{e:{w=!1,S&&(S=!1,T(j),j=-1),b=!0;var V=_;try{t:{for(M(z),g=n(h);g!==null&&!(g.expirationTime>z&&B());){var Q=g.callback;if(typeof Q=="function"){g.callback=null,_=g.priorityLevel;var N=Q(g.expirationTime<=z);if(z=e.unstable_now(),typeof N=="function"){g.callback=N,M(z),$=!0;break t}g===n(h)&&r(h),M(z)}else r(h);g=n(h)}if(g!==null)$=!0;else{var I=n(d);I!==null&&W(O,I.startTime-z),$=!1}}break e}finally{g=null,_=V,b=!1}$=void 0}}finally{$?P():D=!1}}}var P;if(typeof R=="function")P=function(){R(H)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,q=U.port2;U.port1.onmessage=H,P=function(){q.postMessage(null)}}else P=function(){k(H,0)};function W(z,$){j=k(function(){z(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(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(z){switch(_){case 1:case 2:case 3:var $=3;break;default:$=_}var V=_;_=$;try{return z()}finally{_=V}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(z,$){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var V=_;_=z;try{return $()}finally{_=V}},e.unstable_scheduleCallback=function(z,$,V){var Q=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?Q+V:Q):V=Q,z){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=V+N,z={id:m++,callback:$,priorityLevel:z,startTime:V,expirationTime:N,sortIndex:-1},V>Q?(z.sortIndex=V,t(d,z),n(h)===null&&z===n(d)&&(S?(T(j),j=-1):S=!0,W(O,V-Q))):(z.sortIndex=N,t(h,z),w||b||(w=!0,D||(D=!0,P()))),z},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(z){var $=_;return function(){var V=_;_=$;try{return z.apply(this,arguments)}finally{_=V}}}})(dv)),dv}var sC;function LO(){return sC||(sC=1,uv.exports=jO()),uv.exports}var hv={exports:{}},$n={};/**
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 oC;function zO(){if(oC)return $n;oC=1;var e=ab();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)d+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(h,d,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:h,containerInfo:d,implementation:m}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return $n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,$n.createPortal=function(h,d){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return a(h,d,null,m)},$n.flushSync=function(h){var d=l.T,m=r.p;try{if(l.T=null,r.p=2,h)return h()}finally{l.T=d,r.p=m,r.d.f()}},$n.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))},$n.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},$n.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var m=d.as,g=u(m,d.crossOrigin),_=typeof d.integrity=="string"?d.integrity:void 0,b=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;m==="style"?r.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:_,fetchPriority:b}):m==="script"&&r.d.X(h,{crossOrigin:g,integrity:_,fetchPriority:b,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},$n.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var m=u(d.as,d.crossOrigin);r.d.M(h,{crossOrigin:m,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)},$n.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var m=d.as,g=u(m,d.crossOrigin);r.d.L(h,m,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},$n.preloadModule=function(h,d){if(typeof h=="string")if(d){var m=u(d.as,d.crossOrigin);r.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(h)},$n.requestFormReset=function(h){r.d.r(h)},$n.unstable_batchedUpdates=function(h,d){return h(d)},$n.useFormState=function(h,d,m){return l.H.useFormState(h,d,m)},$n.useFormStatus=function(){return l.H.useHostTransitionStatus()},$n.version="19.2.1",$n}var aC;function cR(){if(aC)return hv.exports;aC=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(),hv.exports=zO(),hv.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 lC;function PO(){if(lC)return $c;lC=1;var e=LO(),t=ab(),n=cR();function r(i){var o="https://react.dev/errors/"+i;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function a(i){var o=i,c=i;if(i.alternate)for(;o.return;)o=o.return;else{i=o;do o=i,(o.flags&4098)!==0&&(c=o.return),i=o.return;while(i)}return o.tag===3?c:null}function l(i){if(i.tag===13){var o=i.memoizedState;if(o===null&&(i=i.alternate,i!==null&&(o=i.memoizedState)),o!==null)return o.dehydrated}return null}function u(i){if(i.tag===31){var o=i.memoizedState;if(o===null&&(i=i.alternate,i!==null&&(o=i.memoizedState)),o!==null)return o.dehydrated}return null}function h(i){if(a(i)!==i)throw Error(r(188))}function d(i){var o=i.alternate;if(!o){if(o=a(i),o===null)throw Error(r(188));return o!==i?null:i}for(var c=i,f=o;;){var v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(f=v.return,f!==null){c=f;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return h(v),i;if(x===f)return h(v),o;x=x.sibling}throw Error(r(188))}if(c.return!==f.return)c=v,f=x;else{for(var E=!1,A=v.child;A;){if(A===c){E=!0,c=v,f=x;break}if(A===f){E=!0,f=v,c=x;break}A=A.sibling}if(!E){for(A=x.child;A;){if(A===c){E=!0,c=x,f=v;break}if(A===f){E=!0,f=x,c=v;break}A=A.sibling}if(!E)throw Error(r(189))}}if(c.alternate!==f)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?i:o}function m(i){var o=i.tag;if(o===5||o===26||o===27||o===6)return i;for(i=i.child;i!==null;){if(o=m(i),o!==null)return o;i=i.sibling}return null}var g=Object.assign,_=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"),T=Symbol.for("react.consumer"),R=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function P(i){return i===null||typeof i!="object"?null:(i=H&&i[H]||i["@@iterator"],typeof i=="function"?i:null)}var U=Symbol.for("react.client.reference");function q(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===U?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case O:return"Suspense";case D:return"SuspenseList";case G:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case R:return i.displayName||"Context";case T:return(i._context.displayName||"Context")+".Consumer";case M:var o=i.render;return i=i.displayName,i||(i=o.displayName||o.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case j:return o=i.displayName||null,o!==null?o:q(i.type)||"Memo";case F:o=i._payload,i=i._init;try{return q(i(o))}catch{}}return null}var W=Array.isArray,z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},Q=[],N=-1;function I(i){return{current:i}}function Z(i){0>N||(i.current=Q[N],Q[N]=null,N--)}function L(i,o){N++,Q[N]=i.current,i.current=o}var de=I(null),me=I(null),ue=I(null),he=I(null);function we(i,o){switch(L(ue,o),L(me,i),L(de,null),o.nodeType){case 9:case 11:i=(i=o.documentElement)&&(i=i.namespaceURI)?yS(i):0;break;default:if(i=o.tagName,o=o.namespaceURI)o=yS(o),i=bS(o,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}Z(de),L(de,i)}function le(){Z(de),Z(me),Z(ue)}function xe(i){i.memoizedState!==null&&L(he,i);var o=de.current,c=bS(o,i.type);o!==c&&(L(me,i),L(de,c))}function Ne(i){me.current===i&&(Z(de),Z(me)),he.current===i&&(Z(he),Pc._currentValue=V)}var ae,pe;function Re(i){if(ae===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);ae=o&&o[1]||"",pe=-1<c.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ae+i+pe}var $e=!1;function at(i,o){if(!i||$e)return"";$e=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(o){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch(ce){var se=ce}Reflect.construct(i,[],_e)}else{try{_e.call()}catch(ce){se=ce}i.call(_e.prototype)}}else{try{throw Error()}catch(ce){se=ce}(_e=i())&&typeof _e.catch=="function"&&_e.catch(function(){})}}catch(ce){if(ce&&se&&typeof ce.stack=="string")return[ce.stack,se.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=f.DetermineComponentFrameRoot(),E=x[0],A=x[1];if(E&&A){var K=E.split(`
44
+ `),ne=A.split(`
45
+ `);for(v=f=0;f<K.length&&!K[f].includes("DetermineComponentFrameRoot");)f++;for(;v<ne.length&&!ne[v].includes("DetermineComponentFrameRoot");)v++;if(f===K.length||v===ne.length)for(f=K.length-1,v=ne.length-1;1<=f&&0<=v&&K[f]!==ne[v];)v--;for(;1<=f&&0<=v;f--,v--)if(K[f]!==ne[v]){if(f!==1||v!==1)do if(f--,v--,0>v||K[f]!==ne[v]){var fe=`
46
+ `+K[f].replace(" at new "," at ");return i.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",i.displayName)),fe}while(1<=f&&0<=v);break}}}finally{$e=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?Re(c):""}function Lt(i,o){switch(i.tag){case 26:case 27:case 5:return Re(i.type);case 16:return Re("Lazy");case 13:return i.child!==o&&o!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("SuspenseList");case 0:case 15:return at(i.type,!1);case 11:return at(i.type.render,!1);case 1:return at(i.type,!0);case 31:return Re("Activity");default:return""}}function zt(i){try{var o="",c=null;do o+=Lt(i,c),c=i,i=i.return;while(i);return o}catch(f){return`
47
+ Error generating stack: `+f.message+`
48
+ `+f.stack}}var ut=Object.prototype.hasOwnProperty,yt=e.unstable_scheduleCallback,un=e.unstable_cancelCallback,en=e.unstable_shouldYield,bn=e.unstable_requestPaint,Nt=e.unstable_now,Yn=e.unstable_getCurrentPriorityLevel,Y=e.unstable_ImmediatePriority,oe=e.unstable_UserBlockingPriority,Ee=e.unstable_NormalPriority,ze=e.unstable_LowPriority,Fe=e.unstable_IdlePriority,dt=e.log,ee=e.unstable_setDisableYieldValue,Ge=null,pt=null;function ie(i){if(typeof dt=="function"&&ee(i),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(Ge,i)}catch{}}var Te=Math.clz32?Math.clz32:dn,lt=Math.log,bt=Math.LN2;function dn(i){return i>>>=0,i===0?32:31-(lt(i)/bt|0)|0}var Xn=256,Zn=262144,xt=4194304;function Ct(i){var o=i&42;if(o!==0)return o;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Pt(i,o,c){var f=i.pendingLanes;if(f===0)return 0;var v=0,x=i.suspendedLanes,E=i.pingedLanes;i=i.warmLanes;var A=f&134217727;return A!==0?(f=A&~x,f!==0?v=Ct(f):(E&=A,E!==0?v=Ct(E):c||(c=A&~i,c!==0&&(v=Ct(c))))):(A=f&~x,A!==0?v=Ct(A):E!==0?v=Ct(E):c||(c=f&~i,c!==0&&(v=Ct(c)))),v===0?0:o!==0&&o!==v&&(o&x)===0&&(x=v&-v,c=o&-o,x>=c||x===32&&(c&4194048)!==0)?o:v}function Un(i,o){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&o)===0}function Dn(i,o){switch(i){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hn(){var i=xt;return xt<<=1,(xt&62914560)===0&&(xt=4194304),i}function On(i){for(var o=[],c=0;31>c;c++)o.push(i);return o}function re(i,o){i.pendingLanes|=o,o!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function ve(i,o,c,f,v,x){var E=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var A=i.entanglements,K=i.expirationTimes,ne=i.hiddenUpdates;for(c=E&~c;0<c;){var fe=31-Te(c),_e=1<<fe;A[fe]=0,K[fe]=-1;var se=ne[fe];if(se!==null)for(ne[fe]=null,fe=0;fe<se.length;fe++){var ce=se[fe];ce!==null&&(ce.lane&=-536870913)}c&=~_e}f!==0&&Ue(i,f,0),x!==0&&v===0&&i.tag!==0&&(i.suspendedLanes|=x&~(E&~o))}function Ue(i,o,c){i.pendingLanes|=o,i.suspendedLanes&=~o;var f=31-Te(o);i.entangledLanes|=o,i.entanglements[f]=i.entanglements[f]|1073741824|c&261930}function Ye(i,o){var c=i.entangledLanes|=o;for(i=i.entanglements;c;){var f=31-Te(c),v=1<<f;v&o|i[f]&o&&(i[f]|=o),c&=~v}}function mt(i,o){var c=o&-o;return c=(c&42)!==0?1:yr(c),(c&(i.suspendedLanes|o))!==0?0:c}function yr(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Hi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function ni(){var i=$.p;return i!==0?i:(i=window.event,i===void 0?32:$S(i.type))}function Ss(i,o){var c=$.p;try{return $.p=i,o()}finally{$.p=c}}var jr=Math.random().toString(36).slice(2),jn="__reactFiber$"+jr,ar="__reactProps$"+jr,_a="__reactContainer$"+jr,Qp="__reactEvents$"+jr,v3="__reactListeners$"+jr,_3="__reactHandles$"+jr,ox="__reactResources$"+jr,Ql="__reactMarker$"+jr;function Jp(i){delete i[jn],delete i[ar],delete i[Qp],delete i[v3],delete i[_3]}function ya(i){var o=i[jn];if(o)return o;for(var c=i.parentNode;c;){if(o=c[_a]||c[jn]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(i=RS(i);i!==null;){if(c=i[jn])return c;i=RS(i)}return o}i=c,c=i.parentNode}return null}function ba(i){if(i=i[jn]||i[_a]){var o=i.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return i}return null}function Jl(i){var o=i.tag;if(o===5||o===26||o===27||o===6)return i.stateNode;throw Error(r(33))}function xa(i){var o=i[ox];return o||(o=i[ox]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function xn(i){i[Ql]=!0}var ax=new Set,lx={};function xo(i,o){wa(i,o),wa(i+"Capture",o)}function wa(i,o){for(lx[i]=o,i=0;i<o.length;i++)ax.add(o[i])}var y3=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]*$"),cx={},ux={};function b3(i){return ut.call(ux,i)?!0:ut.call(cx,i)?!1:y3.test(i)?ux[i]=!0:(cx[i]=!0,!1)}function vd(i,o,c){if(b3(o))if(c===null)i.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(o);return;case"boolean":var f=o.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){i.removeAttribute(o);return}}i.setAttribute(o,""+c)}}function _d(i,o,c){if(c===null)i.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(o);return}i.setAttribute(o,""+c)}}function Fi(i,o,c,f){if(f===null)i.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(o,c,""+f)}}function Lr(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function dx(i){var o=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function x3(i,o,c){var f=Object.getOwnPropertyDescriptor(i.constructor.prototype,o);if(!i.hasOwnProperty(o)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var v=f.get,x=f.set;return Object.defineProperty(i,o,{configurable:!0,get:function(){return v.call(this)},set:function(E){c=""+E,x.call(this,E)}}),Object.defineProperty(i,o,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){i._valueTracker=null,delete i[o]}}}}function em(i){if(!i._valueTracker){var o=dx(i)?"checked":"value";i._valueTracker=x3(i,o,""+i[o])}}function hx(i){if(!i)return!1;var o=i._valueTracker;if(!o)return!0;var c=o.getValue(),f="";return i&&(f=dx(i)?i.checked?"true":"false":i.value),i=f,i!==c?(o.setValue(i),!0):!1}function yd(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var w3=/[\n"\\]/g;function zr(i){return i.replace(w3,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function tm(i,o,c,f,v,x,E,A){i.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?i.type=E:i.removeAttribute("type"),o!=null?E==="number"?(o===0&&i.value===""||i.value!=o)&&(i.value=""+Lr(o)):i.value!==""+Lr(o)&&(i.value=""+Lr(o)):E!=="submit"&&E!=="reset"||i.removeAttribute("value"),o!=null?nm(i,E,Lr(o)):c!=null?nm(i,E,Lr(c)):f!=null&&i.removeAttribute("value"),v==null&&x!=null&&(i.defaultChecked=!!x),v!=null&&(i.checked=v&&typeof v!="function"&&typeof v!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?i.name=""+Lr(A):i.removeAttribute("name")}function fx(i,o,c,f,v,x,E,A){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(i.type=x),o!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||o!=null)){em(i);return}c=c!=null?""+Lr(c):"",o=o!=null?""+Lr(o):c,A||o===i.value||(i.value=o),i.defaultValue=o}f=f??v,f=typeof f!="function"&&typeof f!="symbol"&&!!f,i.checked=A?i.checked:!!f,i.defaultChecked=!!f,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(i.name=E),em(i)}function nm(i,o,c){o==="number"&&yd(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function Sa(i,o,c,f){if(i=i.options,o){o={};for(var v=0;v<c.length;v++)o["$"+c[v]]=!0;for(c=0;c<i.length;c++)v=o.hasOwnProperty("$"+i[c].value),i[c].selected!==v&&(i[c].selected=v),v&&f&&(i[c].defaultSelected=!0)}else{for(c=""+Lr(c),o=null,v=0;v<i.length;v++){if(i[v].value===c){i[v].selected=!0,f&&(i[v].defaultSelected=!0);return}o!==null||i[v].disabled||(o=i[v])}o!==null&&(o.selected=!0)}}function px(i,o,c){if(o!=null&&(o=""+Lr(o),o!==i.value&&(i.value=o),c==null)){i.defaultValue!==o&&(i.defaultValue=o);return}i.defaultValue=c!=null?""+Lr(c):""}function mx(i,o,c,f){if(o==null){if(f!=null){if(c!=null)throw Error(r(92));if(W(f)){if(1<f.length)throw Error(r(93));f=f[0]}c=f}c==null&&(c=""),o=c}c=Lr(o),i.defaultValue=c,f=i.textContent,f===c&&f!==""&&f!==null&&(i.value=f),em(i)}function Ca(i,o){if(o){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=o;return}}i.textContent=o}var S3=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 gx(i,o,c){var f=o.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?i.setProperty(o,""):o==="float"?i.cssFloat="":i[o]="":f?i.setProperty(o,c):typeof c!="number"||c===0||S3.has(o)?o==="float"?i.cssFloat=c:i[o]=(""+c).trim():i[o]=c+"px"}function vx(i,o,c){if(o!=null&&typeof o!="object")throw Error(r(62));if(i=i.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||o!=null&&o.hasOwnProperty(f)||(f.indexOf("--")===0?i.setProperty(f,""):f==="float"?i.cssFloat="":i[f]="");for(var v in o)f=o[v],o.hasOwnProperty(v)&&c[v]!==f&&gx(i,v,f)}else for(var x in o)o.hasOwnProperty(x)&&gx(i,x,o[x])}function rm(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var C3=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"]]),k3=/^[\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 bd(i){return k3.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ui(){}var im=null;function sm(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ka=null,Ea=null;function _x(i){var o=ba(i);if(o&&(i=o.stateNode)){var c=i[ar]||null;e:switch(i=o.stateNode,o.type){case"input":if(tm(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),o=c.name,c.type==="radio"&&o!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+zr(""+o)+'"][type="radio"]'),o=0;o<c.length;o++){var f=c[o];if(f!==i&&f.form===i.form){var v=f[ar]||null;if(!v)throw Error(r(90));tm(f,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(o=0;o<c.length;o++)f=c[o],f.form===i.form&&hx(f)}break e;case"textarea":px(i,c.value,c.defaultValue);break e;case"select":o=c.value,o!=null&&Sa(i,!!c.multiple,o,!1)}}}var om=!1;function yx(i,o,c){if(om)return i(o,c);om=!0;try{var f=i(o);return f}finally{if(om=!1,(ka!==null||Ea!==null)&&(ah(),ka&&(o=ka,i=Ea,Ea=ka=null,_x(o),i)))for(o=0;o<i.length;o++)_x(i[o])}}function ec(i,o){var c=i.stateNode;if(c===null)return null;var f=c[ar]||null;if(f===null)return null;c=f[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(r(231,o,typeof c));return c}var $i=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),am=!1;if($i)try{var tc={};Object.defineProperty(tc,"passive",{get:function(){am=!0}}),window.addEventListener("test",tc,tc),window.removeEventListener("test",tc,tc)}catch{am=!1}var Cs=null,lm=null,xd=null;function bx(){if(xd)return xd;var i,o=lm,c=o.length,f,v="value"in Cs?Cs.value:Cs.textContent,x=v.length;for(i=0;i<c&&o[i]===v[i];i++);var E=c-i;for(f=1;f<=E&&o[c-f]===v[x-f];f++);return xd=v.slice(i,1<f?1-f:void 0)}function wd(i){var o=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&o===13&&(i=13)):i=o,i===10&&(i=13),32<=i||i===13?i:0}function Sd(){return!0}function xx(){return!1}function lr(i){function o(c,f,v,x,E){this._reactName=c,this._targetInst=v,this.type=f,this.nativeEvent=x,this.target=E,this.currentTarget=null;for(var A in i)i.hasOwnProperty(A)&&(c=i[A],this[A]=c?c(x):x[A]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Sd:xx,this.isPropagationStopped=xx,this}return g(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Sd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Sd)},persist:function(){},isPersistent:Sd}),o}var wo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cd=lr(wo),nc=g({},wo,{view:0,detail:0}),E3=lr(nc),cm,um,rc,kd=g({},nc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hm,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==rc&&(rc&&i.type==="mousemove"?(cm=i.screenX-rc.screenX,um=i.screenY-rc.screenY):um=cm=0,rc=i),cm)},movementY:function(i){return"movementY"in i?i.movementY:um}}),wx=lr(kd),R3=g({},kd,{dataTransfer:0}),T3=lr(R3),M3=g({},nc,{relatedTarget:0}),dm=lr(M3),N3=g({},wo,{animationName:0,elapsedTime:0,pseudoElement:0}),A3=lr(N3),D3=g({},wo,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),O3=lr(D3),j3=g({},wo,{data:0}),Sx=lr(j3),L3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},z3={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"},P3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function B3(i){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(i):(i=P3[i])?!!o[i]:!1}function hm(){return B3}var I3=g({},nc,{key:function(i){if(i.key){var o=L3[i.key]||i.key;if(o!=="Unidentified")return o}return i.type==="keypress"?(i=wd(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?z3[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hm,charCode:function(i){return i.type==="keypress"?wd(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?wd(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),H3=lr(I3),F3=g({},kd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cx=lr(F3),U3=g({},nc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hm}),$3=lr(U3),W3=g({},wo,{propertyName:0,elapsedTime:0,pseudoElement:0}),V3=lr(W3),q3=g({},kd,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),K3=lr(q3),G3=g({},wo,{newState:0,oldState:0}),Y3=lr(G3),X3=[9,13,27,32],fm=$i&&"CompositionEvent"in window,ic=null;$i&&"documentMode"in document&&(ic=document.documentMode);var Z3=$i&&"TextEvent"in window&&!ic,kx=$i&&(!fm||ic&&8<ic&&11>=ic),Ex=" ",Rx=!1;function Tx(i,o){switch(i){case"keyup":return X3.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mx(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ra=!1;function Q3(i,o){switch(i){case"compositionend":return Mx(o);case"keypress":return o.which!==32?null:(Rx=!0,Ex);case"textInput":return i=o.data,i===Ex&&Rx?null:i;default:return null}}function J3(i,o){if(Ra)return i==="compositionend"||!fm&&Tx(i,o)?(i=bx(),xd=lm=Cs=null,Ra=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return kx&&o.locale!=="ko"?null:o.data;default:return null}}var e4={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 Nx(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o==="input"?!!e4[i.type]:o==="textarea"}function Ax(i,o,c,f){ka?Ea?Ea.push(f):Ea=[f]:ka=f,o=ph(o,"onChange"),0<o.length&&(c=new Cd("onChange","change",null,c,f),i.push({event:c,listeners:o}))}var sc=null,oc=null;function t4(i){fS(i,0)}function Ed(i){var o=Jl(i);if(hx(o))return i}function Dx(i,o){if(i==="change")return o}var Ox=!1;if($i){var pm;if($i){var mm="oninput"in document;if(!mm){var jx=document.createElement("div");jx.setAttribute("oninput","return;"),mm=typeof jx.oninput=="function"}pm=mm}else pm=!1;Ox=pm&&(!document.documentMode||9<document.documentMode)}function Lx(){sc&&(sc.detachEvent("onpropertychange",zx),oc=sc=null)}function zx(i){if(i.propertyName==="value"&&Ed(oc)){var o=[];Ax(o,oc,i,sm(i)),yx(t4,o)}}function n4(i,o,c){i==="focusin"?(Lx(),sc=o,oc=c,sc.attachEvent("onpropertychange",zx)):i==="focusout"&&Lx()}function r4(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ed(oc)}function i4(i,o){if(i==="click")return Ed(o)}function s4(i,o){if(i==="input"||i==="change")return Ed(o)}function o4(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var br=typeof Object.is=="function"?Object.is:o4;function ac(i,o){if(br(i,o))return!0;if(typeof i!="object"||i===null||typeof o!="object"||o===null)return!1;var c=Object.keys(i),f=Object.keys(o);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var v=c[f];if(!ut.call(o,v)||!br(i[v],o[v]))return!1}return!0}function Px(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Bx(i,o){var c=Px(i);i=0;for(var f;c;){if(c.nodeType===3){if(f=i+c.textContent.length,i<=o&&f>=o)return{node:c,offset:o-i};i=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Px(c)}}function Ix(i,o){return i&&o?i===o?!0:i&&i.nodeType===3?!1:o&&o.nodeType===3?Ix(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1:!1}function Hx(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var o=yd(i.document);o instanceof i.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)i=o.contentWindow;else break;o=yd(i.document)}return o}function gm(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}var a4=$i&&"documentMode"in document&&11>=document.documentMode,Ta=null,vm=null,lc=null,_m=!1;function Fx(i,o,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;_m||Ta==null||Ta!==yd(f)||(f=Ta,"selectionStart"in f&&gm(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),lc&&ac(lc,f)||(lc=f,f=ph(vm,"onSelect"),0<f.length&&(o=new Cd("onSelect","select",null,o,c),i.push({event:o,listeners:f}),o.target=Ta)))}function So(i,o){var c={};return c[i.toLowerCase()]=o.toLowerCase(),c["Webkit"+i]="webkit"+o,c["Moz"+i]="moz"+o,c}var Ma={animationend:So("Animation","AnimationEnd"),animationiteration:So("Animation","AnimationIteration"),animationstart:So("Animation","AnimationStart"),transitionrun:So("Transition","TransitionRun"),transitionstart:So("Transition","TransitionStart"),transitioncancel:So("Transition","TransitionCancel"),transitionend:So("Transition","TransitionEnd")},ym={},Ux={};$i&&(Ux=document.createElement("div").style,"AnimationEvent"in window||(delete Ma.animationend.animation,delete Ma.animationiteration.animation,delete Ma.animationstart.animation),"TransitionEvent"in window||delete Ma.transitionend.transition);function Co(i){if(ym[i])return ym[i];if(!Ma[i])return i;var o=Ma[i],c;for(c in o)if(o.hasOwnProperty(c)&&c in Ux)return ym[i]=o[c];return i}var $x=Co("animationend"),Wx=Co("animationiteration"),Vx=Co("animationstart"),l4=Co("transitionrun"),c4=Co("transitionstart"),u4=Co("transitioncancel"),qx=Co("transitionend"),Kx=new Map,bm="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(" ");bm.push("scrollEnd");function ri(i,o){Kx.set(i,o),xo(o,[i])}var Rd=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Pr=[],Na=0,xm=0;function Td(){for(var i=Na,o=xm=Na=0;o<i;){var c=Pr[o];Pr[o++]=null;var f=Pr[o];Pr[o++]=null;var v=Pr[o];Pr[o++]=null;var x=Pr[o];if(Pr[o++]=null,f!==null&&v!==null){var E=f.pending;E===null?v.next=v:(v.next=E.next,E.next=v),f.pending=v}x!==0&&Gx(c,v,x)}}function Md(i,o,c,f){Pr[Na++]=i,Pr[Na++]=o,Pr[Na++]=c,Pr[Na++]=f,xm|=f,i.lanes|=f,i=i.alternate,i!==null&&(i.lanes|=f)}function wm(i,o,c,f){return Md(i,o,c,f),Nd(i)}function ko(i,o){return Md(i,null,null,o),Nd(i)}function Gx(i,o,c){i.lanes|=c;var f=i.alternate;f!==null&&(f.lanes|=c);for(var v=!1,x=i.return;x!==null;)x.childLanes|=c,f=x.alternate,f!==null&&(f.childLanes|=c),x.tag===22&&(i=x.stateNode,i===null||i._visibility&1||(v=!0)),i=x,x=x.return;return i.tag===3?(x=i.stateNode,v&&o!==null&&(v=31-Te(c),i=x.hiddenUpdates,f=i[v],f===null?i[v]=[o]:f.push(o),o.lane=c|536870912),x):null}function Nd(i){if(50<Nc)throw Nc=0,Ag=null,Error(r(185));for(var o=i.return;o!==null;)i=o,o=i.return;return i.tag===3?i.stateNode:null}var Aa={};function d4(i,o,c,f){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xr(i,o,c,f){return new d4(i,o,c,f)}function Sm(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Wi(i,o){var c=i.alternate;return c===null?(c=xr(i.tag,o,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=o,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,o=i.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function Yx(i,o){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=o,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,o=c.dependencies,i.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),i}function Ad(i,o,c,f,v,x){var E=0;if(f=i,typeof i=="function")Sm(i)&&(E=1);else if(typeof i=="string")E=gO(i,c,de.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case G:return i=xr(31,c,o,v),i.elementType=G,i.lanes=x,i;case S:return Eo(c.children,v,x,o);case C:E=8,v|=24;break;case k:return i=xr(12,c,o,v|2),i.elementType=k,i.lanes=x,i;case O:return i=xr(13,c,o,v),i.elementType=O,i.lanes=x,i;case D:return i=xr(19,c,o,v),i.elementType=D,i.lanes=x,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case R:E=10;break e;case T:E=9;break e;case M:E=11;break e;case j:E=14;break e;case F:E=16,f=null;break e}E=29,c=Error(r(130,i===null?"null":typeof i,"")),f=null}return o=xr(E,c,o,v),o.elementType=i,o.type=f,o.lanes=x,o}function Eo(i,o,c,f){return i=xr(7,i,f,o),i.lanes=c,i}function Cm(i,o,c){return i=xr(6,i,null,o),i.lanes=c,i}function Xx(i){var o=xr(18,null,null,0);return o.stateNode=i,o}function km(i,o,c){return o=xr(4,i.children!==null?i.children:[],i.key,o),o.lanes=c,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}var Zx=new WeakMap;function Br(i,o){if(typeof i=="object"&&i!==null){var c=Zx.get(i);return c!==void 0?c:(o={value:i,source:o,stack:zt(o)},Zx.set(i,o),o)}return{value:i,source:o,stack:zt(o)}}var Da=[],Oa=0,Dd=null,cc=0,Ir=[],Hr=0,ks=null,yi=1,bi="";function Vi(i,o){Da[Oa++]=cc,Da[Oa++]=Dd,Dd=i,cc=o}function Qx(i,o,c){Ir[Hr++]=yi,Ir[Hr++]=bi,Ir[Hr++]=ks,ks=i;var f=yi;i=bi;var v=32-Te(f)-1;f&=~(1<<v),c+=1;var x=32-Te(o)+v;if(30<x){var E=v-v%5;x=(f&(1<<E)-1).toString(32),f>>=E,v-=E,yi=1<<32-Te(o)+v|c<<v|f,bi=x+i}else yi=1<<x|c<<v|f,bi=i}function Em(i){i.return!==null&&(Vi(i,1),Qx(i,1,0))}function Rm(i){for(;i===Dd;)Dd=Da[--Oa],Da[Oa]=null,cc=Da[--Oa],Da[Oa]=null;for(;i===ks;)ks=Ir[--Hr],Ir[Hr]=null,bi=Ir[--Hr],Ir[Hr]=null,yi=Ir[--Hr],Ir[Hr]=null}function Jx(i,o){Ir[Hr++]=yi,Ir[Hr++]=bi,Ir[Hr++]=ks,yi=o.id,bi=o.overflow,ks=i}var Ln=null,Bt=null,ot=!1,Es=null,Fr=!1,Tm=Error(r(519));function Rs(i){var o=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw uc(Br(o,i)),Tm}function e1(i){var o=i.stateNode,c=i.type,f=i.memoizedProps;switch(o[jn]=i,o[ar]=f,c){case"dialog":tt("cancel",o),tt("close",o);break;case"iframe":case"object":case"embed":tt("load",o);break;case"video":case"audio":for(c=0;c<Dc.length;c++)tt(Dc[c],o);break;case"source":tt("error",o);break;case"img":case"image":case"link":tt("error",o),tt("load",o);break;case"details":tt("toggle",o);break;case"input":tt("invalid",o),fx(o,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":tt("invalid",o);break;case"textarea":tt("invalid",o),mx(o,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||o.textContent===""+c||f.suppressHydrationWarning===!0||vS(o.textContent,c)?(f.popover!=null&&(tt("beforetoggle",o),tt("toggle",o)),f.onScroll!=null&&tt("scroll",o),f.onScrollEnd!=null&&tt("scrollend",o),f.onClick!=null&&(o.onclick=Ui),o=!0):o=!1,o||Rs(i,!0)}function t1(i){for(Ln=i.return;Ln;)switch(Ln.tag){case 5:case 31:case 13:Fr=!1;return;case 27:case 3:Fr=!0;return;default:Ln=Ln.return}}function ja(i){if(i!==Ln)return!1;if(!ot)return t1(i),ot=!0,!1;var o=i.tag,c;if((c=o!==3&&o!==27)&&((c=o===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||qg(i.type,i.memoizedProps)),c=!c),c&&Bt&&Rs(i),t1(i),o===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Bt=ES(i)}else if(o===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Bt=ES(i)}else o===27?(o=Bt,Fs(i.type)?(i=Zg,Zg=null,Bt=i):Bt=o):Bt=Ln?$r(i.stateNode.nextSibling):null;return!0}function Ro(){Bt=Ln=null,ot=!1}function Mm(){var i=Es;return i!==null&&(hr===null?hr=i:hr.push.apply(hr,i),Es=null),i}function uc(i){Es===null?Es=[i]:Es.push(i)}var Nm=I(null),To=null,qi=null;function Ts(i,o,c){L(Nm,o._currentValue),o._currentValue=c}function Ki(i){i._currentValue=Nm.current,Z(Nm)}function Am(i,o,c){for(;i!==null;){var f=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,f!==null&&(f.childLanes|=o)):f!==null&&(f.childLanes&o)!==o&&(f.childLanes|=o),i===c)break;i=i.return}}function Dm(i,o,c,f){var v=i.child;for(v!==null&&(v.return=i);v!==null;){var x=v.dependencies;if(x!==null){var E=v.child;x=x.firstContext;e:for(;x!==null;){var A=x;x=v;for(var K=0;K<o.length;K++)if(A.context===o[K]){x.lanes|=c,A=x.alternate,A!==null&&(A.lanes|=c),Am(x.return,c,i),f||(E=null);break e}x=A.next}}else if(v.tag===18){if(E=v.return,E===null)throw Error(r(341));E.lanes|=c,x=E.alternate,x!==null&&(x.lanes|=c),Am(E,c,i),E=null}else E=v.child;if(E!==null)E.return=v;else for(E=v;E!==null;){if(E===i){E=null;break}if(v=E.sibling,v!==null){v.return=E.return,E=v;break}E=E.return}v=E}}function La(i,o,c,f){i=null;for(var v=o,x=!1;v!==null;){if(!x){if((v.flags&524288)!==0)x=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var E=v.alternate;if(E===null)throw Error(r(387));if(E=E.memoizedProps,E!==null){var A=v.type;br(v.pendingProps.value,E.value)||(i!==null?i.push(A):i=[A])}}else if(v===he.current){if(E=v.alternate,E===null)throw Error(r(387));E.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(i!==null?i.push(Pc):i=[Pc])}v=v.return}i!==null&&Dm(o,i,c,f),o.flags|=262144}function Od(i){for(i=i.firstContext;i!==null;){if(!br(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Mo(i){To=i,qi=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function zn(i){return n1(To,i)}function jd(i,o){return To===null&&Mo(i),n1(i,o)}function n1(i,o){var c=o._currentValue;if(o={context:o,memoizedValue:c,next:null},qi===null){if(i===null)throw Error(r(308));qi=o,i.dependencies={lanes:0,firstContext:o},i.flags|=524288}else qi=qi.next=o;return c}var h4=typeof AbortController<"u"?AbortController:function(){var i=[],o=this.signal={aborted:!1,addEventListener:function(c,f){i.push(f)}};this.abort=function(){o.aborted=!0,i.forEach(function(c){return c()})}},f4=e.unstable_scheduleCallback,p4=e.unstable_NormalPriority,tn={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Om(){return{controller:new h4,data:new Map,refCount:0}}function dc(i){i.refCount--,i.refCount===0&&f4(p4,function(){i.controller.abort()})}var hc=null,jm=0,za=0,Pa=null;function m4(i,o){if(hc===null){var c=hc=[];jm=0,za=Pg(),Pa={status:"pending",value:void 0,then:function(f){c.push(f)}}}return jm++,o.then(r1,r1),o}function r1(){if(--jm===0&&hc!==null){Pa!==null&&(Pa.status="fulfilled");var i=hc;hc=null,za=0,Pa=null;for(var o=0;o<i.length;o++)(0,i[o])()}}function g4(i,o){var c=[],f={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return i.then(function(){f.status="fulfilled",f.value=o;for(var v=0;v<c.length;v++)(0,c[v])(o)},function(v){for(f.status="rejected",f.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),f}var i1=z.S;z.S=function(i,o){Fw=Nt(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&m4(i,o),i1!==null&&i1(i,o)};var No=I(null);function Lm(){var i=No.current;return i!==null?i:At.pooledCache}function Ld(i,o){o===null?L(No,No.current):L(No,o.pool)}function s1(){var i=Lm();return i===null?null:{parent:tn._currentValue,pool:i}}var Ba=Error(r(460)),zm=Error(r(474)),zd=Error(r(542)),Pd={then:function(){}};function o1(i){return i=i.status,i==="fulfilled"||i==="rejected"}function a1(i,o,c){switch(c=i[c],c===void 0?i.push(o):c!==o&&(o.then(Ui,Ui),o=c),o.status){case"fulfilled":return o.value;case"rejected":throw i=o.reason,c1(i),i;default:if(typeof o.status=="string")o.then(Ui,Ui);else{if(i=At,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=o,i.status="pending",i.then(function(f){if(o.status==="pending"){var v=o;v.status="fulfilled",v.value=f}},function(f){if(o.status==="pending"){var v=o;v.status="rejected",v.reason=f}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw i=o.reason,c1(i),i}throw Do=o,Ba}}function Ao(i){try{var o=i._init;return o(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Do=c,Ba):c}}var Do=null;function l1(){if(Do===null)throw Error(r(459));var i=Do;return Do=null,i}function c1(i){if(i===Ba||i===zd)throw Error(r(483))}var Ia=null,fc=0;function Bd(i){var o=fc;return fc+=1,Ia===null&&(Ia=[]),a1(Ia,i,o)}function pc(i,o){o=o.props.ref,i.ref=o!==void 0?o:null}function Id(i,o){throw o.$$typeof===_?Error(r(525)):(i=Object.prototype.toString.call(o),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":i)))}function u1(i){function o(J,X){if(i){var te=J.deletions;te===null?(J.deletions=[X],J.flags|=16):te.push(X)}}function c(J,X){if(!i)return null;for(;X!==null;)o(J,X),X=X.sibling;return null}function f(J){for(var X=new Map;J!==null;)J.key!==null?X.set(J.key,J):X.set(J.index,J),J=J.sibling;return X}function v(J,X){return J=Wi(J,X),J.index=0,J.sibling=null,J}function x(J,X,te){return J.index=te,i?(te=J.alternate,te!==null?(te=te.index,te<X?(J.flags|=67108866,X):te):(J.flags|=67108866,X)):(J.flags|=1048576,X)}function E(J){return i&&J.alternate===null&&(J.flags|=67108866),J}function A(J,X,te,ge){return X===null||X.tag!==6?(X=Cm(te,J.mode,ge),X.return=J,X):(X=v(X,te),X.return=J,X)}function K(J,X,te,ge){var Pe=te.type;return Pe===S?fe(J,X,te.props.children,ge,te.key):X!==null&&(X.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===F&&Ao(Pe)===X.type)?(X=v(X,te.props),pc(X,te),X.return=J,X):(X=Ad(te.type,te.key,te.props,null,J.mode,ge),pc(X,te),X.return=J,X)}function ne(J,X,te,ge){return X===null||X.tag!==4||X.stateNode.containerInfo!==te.containerInfo||X.stateNode.implementation!==te.implementation?(X=km(te,J.mode,ge),X.return=J,X):(X=v(X,te.children||[]),X.return=J,X)}function fe(J,X,te,ge,Pe){return X===null||X.tag!==7?(X=Eo(te,J.mode,ge,Pe),X.return=J,X):(X=v(X,te),X.return=J,X)}function _e(J,X,te){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=Cm(""+X,J.mode,te),X.return=J,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case b:return te=Ad(X.type,X.key,X.props,null,J.mode,te),pc(te,X),te.return=J,te;case w:return X=km(X,J.mode,te),X.return=J,X;case F:return X=Ao(X),_e(J,X,te)}if(W(X)||P(X))return X=Eo(X,J.mode,te,null),X.return=J,X;if(typeof X.then=="function")return _e(J,Bd(X),te);if(X.$$typeof===R)return _e(J,jd(J,X),te);Id(J,X)}return null}function se(J,X,te,ge){var Pe=X!==null?X.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Pe!==null?null:A(J,X,""+te,ge);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case b:return te.key===Pe?K(J,X,te,ge):null;case w:return te.key===Pe?ne(J,X,te,ge):null;case F:return te=Ao(te),se(J,X,te,ge)}if(W(te)||P(te))return Pe!==null?null:fe(J,X,te,ge,null);if(typeof te.then=="function")return se(J,X,Bd(te),ge);if(te.$$typeof===R)return se(J,X,jd(J,te),ge);Id(J,te)}return null}function ce(J,X,te,ge,Pe){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return J=J.get(te)||null,A(X,J,""+ge,Pe);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case b:return J=J.get(ge.key===null?te:ge.key)||null,K(X,J,ge,Pe);case w:return J=J.get(ge.key===null?te:ge.key)||null,ne(X,J,ge,Pe);case F:return ge=Ao(ge),ce(J,X,te,ge,Pe)}if(W(ge)||P(ge))return J=J.get(te)||null,fe(X,J,ge,Pe,null);if(typeof ge.then=="function")return ce(J,X,te,Bd(ge),Pe);if(ge.$$typeof===R)return ce(J,X,te,jd(X,ge),Pe);Id(X,ge)}return null}function De(J,X,te,ge){for(var Pe=null,ht=null,Le=X,qe=X=0,st=null;Le!==null&&qe<te.length;qe++){Le.index>qe?(st=Le,Le=null):st=Le.sibling;var ft=se(J,Le,te[qe],ge);if(ft===null){Le===null&&(Le=st);break}i&&Le&&ft.alternate===null&&o(J,Le),X=x(ft,X,qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft,Le=st}if(qe===te.length)return c(J,Le),ot&&Vi(J,qe),Pe;if(Le===null){for(;qe<te.length;qe++)Le=_e(J,te[qe],ge),Le!==null&&(X=x(Le,X,qe),ht===null?Pe=Le:ht.sibling=Le,ht=Le);return ot&&Vi(J,qe),Pe}for(Le=f(Le);qe<te.length;qe++)st=ce(Le,J,qe,te[qe],ge),st!==null&&(i&&st.alternate!==null&&Le.delete(st.key===null?qe:st.key),X=x(st,X,qe),ht===null?Pe=st:ht.sibling=st,ht=st);return i&&Le.forEach(function(qs){return o(J,qs)}),ot&&Vi(J,qe),Pe}function Ie(J,X,te,ge){if(te==null)throw Error(r(151));for(var Pe=null,ht=null,Le=X,qe=X=0,st=null,ft=te.next();Le!==null&&!ft.done;qe++,ft=te.next()){Le.index>qe?(st=Le,Le=null):st=Le.sibling;var qs=se(J,Le,ft.value,ge);if(qs===null){Le===null&&(Le=st);break}i&&Le&&qs.alternate===null&&o(J,Le),X=x(qs,X,qe),ht===null?Pe=qs:ht.sibling=qs,ht=qs,Le=st}if(ft.done)return c(J,Le),ot&&Vi(J,qe),Pe;if(Le===null){for(;!ft.done;qe++,ft=te.next())ft=_e(J,ft.value,ge),ft!==null&&(X=x(ft,X,qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft);return ot&&Vi(J,qe),Pe}for(Le=f(Le);!ft.done;qe++,ft=te.next())ft=ce(Le,J,qe,ft.value,ge),ft!==null&&(i&&ft.alternate!==null&&Le.delete(ft.key===null?qe:ft.key),X=x(ft,X,qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft);return i&&Le.forEach(function(RO){return o(J,RO)}),ot&&Vi(J,qe),Pe}function Rt(J,X,te,ge){if(typeof te=="object"&&te!==null&&te.type===S&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case b:e:{for(var Pe=te.key;X!==null;){if(X.key===Pe){if(Pe=te.type,Pe===S){if(X.tag===7){c(J,X.sibling),ge=v(X,te.props.children),ge.return=J,J=ge;break e}}else if(X.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===F&&Ao(Pe)===X.type){c(J,X.sibling),ge=v(X,te.props),pc(ge,te),ge.return=J,J=ge;break e}c(J,X);break}else o(J,X);X=X.sibling}te.type===S?(ge=Eo(te.props.children,J.mode,ge,te.key),ge.return=J,J=ge):(ge=Ad(te.type,te.key,te.props,null,J.mode,ge),pc(ge,te),ge.return=J,J=ge)}return E(J);case w:e:{for(Pe=te.key;X!==null;){if(X.key===Pe)if(X.tag===4&&X.stateNode.containerInfo===te.containerInfo&&X.stateNode.implementation===te.implementation){c(J,X.sibling),ge=v(X,te.children||[]),ge.return=J,J=ge;break e}else{c(J,X);break}else o(J,X);X=X.sibling}ge=km(te,J.mode,ge),ge.return=J,J=ge}return E(J);case F:return te=Ao(te),Rt(J,X,te,ge)}if(W(te))return De(J,X,te,ge);if(P(te)){if(Pe=P(te),typeof Pe!="function")throw Error(r(150));return te=Pe.call(te),Ie(J,X,te,ge)}if(typeof te.then=="function")return Rt(J,X,Bd(te),ge);if(te.$$typeof===R)return Rt(J,X,jd(J,te),ge);Id(J,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,X!==null&&X.tag===6?(c(J,X.sibling),ge=v(X,te),ge.return=J,J=ge):(c(J,X),ge=Cm(te,J.mode,ge),ge.return=J,J=ge),E(J)):c(J,X)}return function(J,X,te,ge){try{fc=0;var Pe=Rt(J,X,te,ge);return Ia=null,Pe}catch(Le){if(Le===Ba||Le===zd)throw Le;var ht=xr(29,Le,null,J.mode);return ht.lanes=ge,ht.return=J,ht}finally{}}}var Oo=u1(!0),d1=u1(!1),Ms=!1;function Pm(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bm(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ns(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function As(i,o,c){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(gt&2)!==0){var v=f.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),f.pending=o,o=Nd(i),Gx(i,null,c),o}return Md(i,f,o,c),Nd(i)}function mc(i,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194048)!==0)){var f=o.lanes;f&=i.pendingLanes,c|=f,o.lanes=c,Ye(i,c)}}function Im(i,o){var c=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var E={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?v=x=E:x=x.next=E,c=c.next}while(c!==null);x===null?v=x=o:x=x.next=o}else v=x=o;c={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:f.shared,callbacks:f.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=o:i.next=o,c.lastBaseUpdate=o}var Hm=!1;function gc(){if(Hm){var i=Pa;if(i!==null)throw i}}function vc(i,o,c,f){Hm=!1;var v=i.updateQueue;Ms=!1;var x=v.firstBaseUpdate,E=v.lastBaseUpdate,A=v.shared.pending;if(A!==null){v.shared.pending=null;var K=A,ne=K.next;K.next=null,E===null?x=ne:E.next=ne,E=K;var fe=i.alternate;fe!==null&&(fe=fe.updateQueue,A=fe.lastBaseUpdate,A!==E&&(A===null?fe.firstBaseUpdate=ne:A.next=ne,fe.lastBaseUpdate=K))}if(x!==null){var _e=v.baseState;E=0,fe=ne=K=null,A=x;do{var se=A.lane&-536870913,ce=se!==A.lane;if(ce?(it&se)===se:(f&se)===se){se!==0&&se===za&&(Hm=!0),fe!==null&&(fe=fe.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var De=i,Ie=A;se=o;var Rt=c;switch(Ie.tag){case 1:if(De=Ie.payload,typeof De=="function"){_e=De.call(Rt,_e,se);break e}_e=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Ie.payload,se=typeof De=="function"?De.call(Rt,_e,se):De,se==null)break e;_e=g({},_e,se);break e;case 2:Ms=!0}}se=A.callback,se!==null&&(i.flags|=64,ce&&(i.flags|=8192),ce=v.callbacks,ce===null?v.callbacks=[se]:ce.push(se))}else ce={lane:se,tag:A.tag,payload:A.payload,callback:A.callback,next:null},fe===null?(ne=fe=ce,K=_e):fe=fe.next=ce,E|=se;if(A=A.next,A===null){if(A=v.shared.pending,A===null)break;ce=A,A=ce.next,ce.next=null,v.lastBaseUpdate=ce,v.shared.pending=null}}while(!0);fe===null&&(K=_e),v.baseState=K,v.firstBaseUpdate=ne,v.lastBaseUpdate=fe,x===null&&(v.shared.lanes=0),zs|=E,i.lanes=E,i.memoizedState=_e}}function h1(i,o){if(typeof i!="function")throw Error(r(191,i));i.call(o)}function f1(i,o){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)h1(c[i],o)}var Ha=I(null),Hd=I(0);function p1(i,o){i=ns,L(Hd,i),L(Ha,o),ns=i|o.baseLanes}function Fm(){L(Hd,ns),L(Ha,Ha.current)}function Um(){ns=Hd.current,Z(Ha),Z(Hd)}var wr=I(null),Ur=null;function Ds(i){var o=i.alternate;L(Zt,Zt.current&1),L(wr,i),Ur===null&&(o===null||Ha.current!==null||o.memoizedState!==null)&&(Ur=i)}function $m(i){L(Zt,Zt.current),L(wr,i),Ur===null&&(Ur=i)}function m1(i){i.tag===22?(L(Zt,Zt.current),L(wr,i),Ur===null&&(Ur=i)):Os()}function Os(){L(Zt,Zt.current),L(wr,wr.current)}function Sr(i){Z(wr),Ur===i&&(Ur=null),Z(Zt)}var Zt=I(0);function Fd(i){for(var o=i;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Yg(c)||Xg(c)))return o}else if(o.tag===19&&(o.memoizedProps.revealOrder==="forwards"||o.memoizedProps.revealOrder==="backwards"||o.memoizedProps.revealOrder==="unstable_legacy-backwards"||o.memoizedProps.revealOrder==="together")){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Gi=0,Ve=null,kt=null,nn=null,Ud=!1,Fa=!1,jo=!1,$d=0,_c=0,Ua=null,v4=0;function qt(){throw Error(r(321))}function Wm(i,o){if(o===null)return!1;for(var c=0;c<o.length&&c<i.length;c++)if(!br(i[c],o[c]))return!1;return!0}function Vm(i,o,c,f,v,x){return Gi=x,Ve=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,z.H=i===null||i.memoizedState===null?Q1:og,jo=!1,x=c(f,v),jo=!1,Fa&&(x=v1(o,c,f,v)),g1(i),x}function g1(i){z.H=xc;var o=kt!==null&&kt.next!==null;if(Gi=0,nn=kt=Ve=null,Ud=!1,_c=0,Ua=null,o)throw Error(r(300));i===null||rn||(i=i.dependencies,i!==null&&Od(i)&&(rn=!0))}function v1(i,o,c,f){Ve=i;var v=0;do{if(Fa&&(Ua=null),_c=0,Fa=!1,25<=v)throw Error(r(301));if(v+=1,nn=kt=null,i.updateQueue!=null){var x=i.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}z.H=J1,x=o(c,f)}while(Fa);return x}function _4(){var i=z.H,o=i.useState()[0];return o=typeof o.then=="function"?yc(o):o,i=i.useState()[0],(kt!==null?kt.memoizedState:null)!==i&&(Ve.flags|=1024),o}function qm(){var i=$d!==0;return $d=0,i}function Km(i,o,c){o.updateQueue=i.updateQueue,o.flags&=-2053,i.lanes&=~c}function Gm(i){if(Ud){for(i=i.memoizedState;i!==null;){var o=i.queue;o!==null&&(o.pending=null),i=i.next}Ud=!1}Gi=0,nn=kt=Ve=null,Fa=!1,_c=$d=0,Ua=null}function Qn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nn===null?Ve.memoizedState=nn=i:nn=nn.next=i,nn}function Qt(){if(kt===null){var i=Ve.alternate;i=i!==null?i.memoizedState:null}else i=kt.next;var o=nn===null?Ve.memoizedState:nn.next;if(o!==null)nn=o,kt=i;else{if(i===null)throw Ve.alternate===null?Error(r(467)):Error(r(310));kt=i,i={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},nn===null?Ve.memoizedState=nn=i:nn=nn.next=i}return nn}function Wd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yc(i){var o=_c;return _c+=1,Ua===null&&(Ua=[]),i=a1(Ua,i,o),o=Ve,(nn===null?o.memoizedState:nn.next)===null&&(o=o.alternate,z.H=o===null||o.memoizedState===null?Q1:og),i}function Vd(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return yc(i);if(i.$$typeof===R)return zn(i)}throw Error(r(438,String(i)))}function Ym(i){var o=null,c=Ve.updateQueue;if(c!==null&&(o=c.memoCache),o==null){var f=Ve.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(o={data:f.data.map(function(v){return v.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),c===null&&(c=Wd(),Ve.updateQueue=c),c.memoCache=o,c=o.data[o.index],c===void 0)for(c=o.data[o.index]=Array(i),f=0;f<i;f++)c[f]=B;return o.index++,c}function Yi(i,o){return typeof o=="function"?o(i):o}function qd(i){var o=Qt();return Xm(o,kt,i)}function Xm(i,o,c){var f=i.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=c;var v=i.baseQueue,x=f.pending;if(x!==null){if(v!==null){var E=v.next;v.next=x.next,x.next=E}o.baseQueue=v=x,f.pending=null}if(x=i.baseState,v===null)i.memoizedState=x;else{o=v.next;var A=E=null,K=null,ne=o,fe=!1;do{var _e=ne.lane&-536870913;if(_e!==ne.lane?(it&_e)===_e:(Gi&_e)===_e){var se=ne.revertLane;if(se===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),_e===za&&(fe=!0);else if((Gi&se)===se){ne=ne.next,se===za&&(fe=!0);continue}else _e={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},K===null?(A=K=_e,E=x):K=K.next=_e,Ve.lanes|=se,zs|=se;_e=ne.action,jo&&c(x,_e),x=ne.hasEagerState?ne.eagerState:c(x,_e)}else se={lane:_e,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},K===null?(A=K=se,E=x):K=K.next=se,Ve.lanes|=_e,zs|=_e;ne=ne.next}while(ne!==null&&ne!==o);if(K===null?E=x:K.next=A,!br(x,i.memoizedState)&&(rn=!0,fe&&(c=Pa,c!==null)))throw c;i.memoizedState=x,i.baseState=E,i.baseQueue=K,f.lastRenderedState=x}return v===null&&(f.lanes=0),[i.memoizedState,f.dispatch]}function Zm(i){var o=Qt(),c=o.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=i;var f=c.dispatch,v=c.pending,x=o.memoizedState;if(v!==null){c.pending=null;var E=v=v.next;do x=i(x,E.action),E=E.next;while(E!==v);br(x,o.memoizedState)||(rn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,f]}function _1(i,o,c){var f=Ve,v=Qt(),x=ot;if(x){if(c===void 0)throw Error(r(407));c=c()}else c=o();var E=!br((kt||v).memoizedState,c);if(E&&(v.memoizedState=c,rn=!0),v=v.queue,eg(x1.bind(null,f,v,i),[i]),v.getSnapshot!==o||E||nn!==null&&nn.memoizedState.tag&1){if(f.flags|=2048,$a(9,{destroy:void 0},b1.bind(null,f,v,c,o),null),At===null)throw Error(r(349));x||(Gi&127)!==0||y1(f,o,c)}return c}function y1(i,o,c){i.flags|=16384,i={getSnapshot:o,value:c},o=Ve.updateQueue,o===null?(o=Wd(),Ve.updateQueue=o,o.stores=[i]):(c=o.stores,c===null?o.stores=[i]:c.push(i))}function b1(i,o,c,f){o.value=c,o.getSnapshot=f,w1(o)&&S1(i)}function x1(i,o,c){return c(function(){w1(o)&&S1(i)})}function w1(i){var o=i.getSnapshot;i=i.value;try{var c=o();return!br(i,c)}catch{return!0}}function S1(i){var o=ko(i,2);o!==null&&fr(o,i,2)}function Qm(i){var o=Qn();if(typeof i=="function"){var c=i;if(i=c(),jo){ie(!0);try{c()}finally{ie(!1)}}}return o.memoizedState=o.baseState=i,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:i},o}function C1(i,o,c,f){return i.baseState=c,Xm(i,kt,typeof f=="function"?f:Yi)}function y4(i,o,c,f,v){if(Yd(i))throw Error(r(485));if(i=o.action,i!==null){var x={payload:v,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){x.listeners.push(E)}};z.T!==null?c(!0):x.isTransition=!1,f(x),c=o.pending,c===null?(x.next=o.pending=x,k1(o,x)):(x.next=c.next,o.pending=c.next=x)}}function k1(i,o){var c=o.action,f=o.payload,v=i.state;if(o.isTransition){var x=z.T,E={};z.T=E;try{var A=c(v,f),K=z.S;K!==null&&K(E,A),E1(i,o,A)}catch(ne){Jm(i,o,ne)}finally{x!==null&&E.types!==null&&(x.types=E.types),z.T=x}}else try{x=c(v,f),E1(i,o,x)}catch(ne){Jm(i,o,ne)}}function E1(i,o,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){R1(i,o,f)},function(f){return Jm(i,o,f)}):R1(i,o,c)}function R1(i,o,c){o.status="fulfilled",o.value=c,T1(o),i.state=c,o=i.pending,o!==null&&(c=o.next,c===o?i.pending=null:(c=c.next,o.next=c,k1(i,c)))}function Jm(i,o,c){var f=i.pending;if(i.pending=null,f!==null){f=f.next;do o.status="rejected",o.reason=c,T1(o),o=o.next;while(o!==f)}i.action=null}function T1(i){i=i.listeners;for(var o=0;o<i.length;o++)(0,i[o])()}function M1(i,o){return o}function N1(i,o){if(ot){var c=At.formState;if(c!==null){e:{var f=Ve;if(ot){if(Bt){t:{for(var v=Bt,x=Fr;v.nodeType!==8;){if(!x){v=null;break t}if(v=$r(v.nextSibling),v===null){v=null;break t}}x=v.data,v=x==="F!"||x==="F"?v:null}if(v){Bt=$r(v.nextSibling),f=v.data==="F!";break e}}Rs(f)}f=!1}f&&(o=c[0])}}return c=Qn(),c.memoizedState=c.baseState=o,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:M1,lastRenderedState:o},c.queue=f,c=Y1.bind(null,Ve,f),f.dispatch=c,f=Qm(!1),x=sg.bind(null,Ve,!1,f.queue),f=Qn(),v={state:o,dispatch:null,action:i,pending:null},f.queue=v,c=y4.bind(null,Ve,v,x,c),v.dispatch=c,f.memoizedState=i,[o,c,!1]}function A1(i){var o=Qt();return D1(o,kt,i)}function D1(i,o,c){if(o=Xm(i,o,M1)[0],i=qd(Yi)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var f=yc(o)}catch(E){throw E===Ba?zd:E}else f=o;o=Qt();var v=o.queue,x=v.dispatch;return c!==o.memoizedState&&(Ve.flags|=2048,$a(9,{destroy:void 0},b4.bind(null,v,c),null)),[f,x,i]}function b4(i,o){i.action=o}function O1(i){var o=Qt(),c=kt;if(c!==null)return D1(o,c,i);Qt(),o=o.memoizedState,c=Qt();var f=c.queue.dispatch;return c.memoizedState=i,[o,f,!1]}function $a(i,o,c,f){return i={tag:i,create:c,deps:f,inst:o,next:null},o=Ve.updateQueue,o===null&&(o=Wd(),Ve.updateQueue=o),c=o.lastEffect,c===null?o.lastEffect=i.next=i:(f=c.next,c.next=i,i.next=f,o.lastEffect=i),i}function j1(){return Qt().memoizedState}function Kd(i,o,c,f){var v=Qn();Ve.flags|=i,v.memoizedState=$a(1|o,{destroy:void 0},c,f===void 0?null:f)}function Gd(i,o,c,f){var v=Qt();f=f===void 0?null:f;var x=v.memoizedState.inst;kt!==null&&f!==null&&Wm(f,kt.memoizedState.deps)?v.memoizedState=$a(o,x,c,f):(Ve.flags|=i,v.memoizedState=$a(1|o,x,c,f))}function L1(i,o){Kd(8390656,8,i,o)}function eg(i,o){Gd(2048,8,i,o)}function x4(i){Ve.flags|=4;var o=Ve.updateQueue;if(o===null)o=Wd(),Ve.updateQueue=o,o.events=[i];else{var c=o.events;c===null?o.events=[i]:c.push(i)}}function z1(i){var o=Qt().memoizedState;return x4({ref:o,nextImpl:i}),function(){if((gt&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}function P1(i,o){return Gd(4,2,i,o)}function B1(i,o){return Gd(4,4,i,o)}function I1(i,o){if(typeof o=="function"){i=i();var c=o(i);return function(){typeof c=="function"?c():o(null)}}if(o!=null)return i=i(),o.current=i,function(){o.current=null}}function H1(i,o,c){c=c!=null?c.concat([i]):null,Gd(4,4,I1.bind(null,o,i),c)}function tg(){}function F1(i,o){var c=Qt();o=o===void 0?null:o;var f=c.memoizedState;return o!==null&&Wm(o,f[1])?f[0]:(c.memoizedState=[i,o],i)}function U1(i,o){var c=Qt();o=o===void 0?null:o;var f=c.memoizedState;if(o!==null&&Wm(o,f[1]))return f[0];if(f=i(),jo){ie(!0);try{i()}finally{ie(!1)}}return c.memoizedState=[f,o],f}function ng(i,o,c){return c===void 0||(Gi&1073741824)!==0&&(it&261930)===0?i.memoizedState=o:(i.memoizedState=c,i=$w(),Ve.lanes|=i,zs|=i,c)}function $1(i,o,c,f){return br(c,o)?c:Ha.current!==null?(i=ng(i,c,f),br(i,o)||(rn=!0),i):(Gi&42)===0||(Gi&1073741824)!==0&&(it&261930)===0?(rn=!0,i.memoizedState=c):(i=$w(),Ve.lanes|=i,zs|=i,o)}function W1(i,o,c,f,v){var x=$.p;$.p=x!==0&&8>x?x:8;var E=z.T,A={};z.T=A,sg(i,!1,o,c);try{var K=v(),ne=z.S;if(ne!==null&&ne(A,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var fe=g4(K,f);bc(i,o,fe,Er(i))}else bc(i,o,f,Er(i))}catch(_e){bc(i,o,{then:function(){},status:"rejected",reason:_e},Er())}finally{$.p=x,E!==null&&A.types!==null&&(E.types=A.types),z.T=E}}function w4(){}function rg(i,o,c,f){if(i.tag!==5)throw Error(r(476));var v=V1(i).queue;W1(i,v,o,V,c===null?w4:function(){return q1(i),c(f)})}function V1(i){var o=i.memoizedState;if(o!==null)return o;o={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:V},next:null};var c={};return o.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:c},next:null},i.memoizedState=o,i=i.alternate,i!==null&&(i.memoizedState=o),o}function q1(i){var o=V1(i);o.next===null&&(o=i.alternate.memoizedState),bc(i,o.next.queue,{},Er())}function ig(){return zn(Pc)}function K1(){return Qt().memoizedState}function G1(){return Qt().memoizedState}function S4(i){for(var o=i.return;o!==null;){switch(o.tag){case 24:case 3:var c=Er();i=Ns(c);var f=As(o,i,c);f!==null&&(fr(f,o,c),mc(f,o,c)),o={cache:Om()},i.payload=o;return}o=o.return}}function C4(i,o,c){var f=Er();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Yd(i)?X1(o,c):(c=wm(i,o,c,f),c!==null&&(fr(c,i,f),Z1(c,o,f)))}function Y1(i,o,c){var f=Er();bc(i,o,c,f)}function bc(i,o,c,f){var v={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Yd(i))X1(o,v);else{var x=i.alternate;if(i.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var E=o.lastRenderedState,A=x(E,c);if(v.hasEagerState=!0,v.eagerState=A,br(A,E))return Md(i,o,v,0),At===null&&Td(),!1}catch{}finally{}if(c=wm(i,o,v,f),c!==null)return fr(c,i,f),Z1(c,o,f),!0}return!1}function sg(i,o,c,f){if(f={lane:2,revertLane:Pg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Yd(i)){if(o)throw Error(r(479))}else o=wm(i,c,f,2),o!==null&&fr(o,i,2)}function Yd(i){var o=i.alternate;return i===Ve||o!==null&&o===Ve}function X1(i,o){Fa=Ud=!0;var c=i.pending;c===null?o.next=o:(o.next=c.next,c.next=o),i.pending=o}function Z1(i,o,c){if((c&4194048)!==0){var f=o.lanes;f&=i.pendingLanes,c|=f,o.lanes=c,Ye(i,c)}}var xc={readContext:zn,use:Vd,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};xc.useEffectEvent=qt;var Q1={readContext:zn,use:Vd,useCallback:function(i,o){return Qn().memoizedState=[i,o===void 0?null:o],i},useContext:zn,useEffect:L1,useImperativeHandle:function(i,o,c){c=c!=null?c.concat([i]):null,Kd(4194308,4,I1.bind(null,o,i),c)},useLayoutEffect:function(i,o){return Kd(4194308,4,i,o)},useInsertionEffect:function(i,o){Kd(4,2,i,o)},useMemo:function(i,o){var c=Qn();o=o===void 0?null:o;var f=i();if(jo){ie(!0);try{i()}finally{ie(!1)}}return c.memoizedState=[f,o],f},useReducer:function(i,o,c){var f=Qn();if(c!==void 0){var v=c(o);if(jo){ie(!0);try{c(o)}finally{ie(!1)}}}else v=o;return f.memoizedState=f.baseState=v,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:v},f.queue=i,i=i.dispatch=C4.bind(null,Ve,i),[f.memoizedState,i]},useRef:function(i){var o=Qn();return i={current:i},o.memoizedState=i},useState:function(i){i=Qm(i);var o=i.queue,c=Y1.bind(null,Ve,o);return o.dispatch=c,[i.memoizedState,c]},useDebugValue:tg,useDeferredValue:function(i,o){var c=Qn();return ng(c,i,o)},useTransition:function(){var i=Qm(!1);return i=W1.bind(null,Ve,i.queue,!0,!1),Qn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,o,c){var f=Ve,v=Qn();if(ot){if(c===void 0)throw Error(r(407));c=c()}else{if(c=o(),At===null)throw Error(r(349));(it&127)!==0||y1(f,o,c)}v.memoizedState=c;var x={value:c,getSnapshot:o};return v.queue=x,L1(x1.bind(null,f,x,i),[i]),f.flags|=2048,$a(9,{destroy:void 0},b1.bind(null,f,x,c,o),null),c},useId:function(){var i=Qn(),o=At.identifierPrefix;if(ot){var c=bi,f=yi;c=(f&~(1<<32-Te(f)-1)).toString(32)+c,o="_"+o+"R_"+c,c=$d++,0<c&&(o+="H"+c.toString(32)),o+="_"}else c=v4++,o="_"+o+"r_"+c.toString(32)+"_";return i.memoizedState=o},useHostTransitionStatus:ig,useFormState:N1,useActionState:N1,useOptimistic:function(i){var o=Qn();o.memoizedState=o.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=c,o=sg.bind(null,Ve,!0,c),c.dispatch=o,[i,o]},useMemoCache:Ym,useCacheRefresh:function(){return Qn().memoizedState=S4.bind(null,Ve)},useEffectEvent:function(i){var o=Qn(),c={impl:i};return o.memoizedState=c,function(){if((gt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},og={readContext:zn,use:Vd,useCallback:F1,useContext:zn,useEffect:eg,useImperativeHandle:H1,useInsertionEffect:P1,useLayoutEffect:B1,useMemo:U1,useReducer:qd,useRef:j1,useState:function(){return qd(Yi)},useDebugValue:tg,useDeferredValue:function(i,o){var c=Qt();return $1(c,kt.memoizedState,i,o)},useTransition:function(){var i=qd(Yi)[0],o=Qt().memoizedState;return[typeof i=="boolean"?i:yc(i),o]},useSyncExternalStore:_1,useId:K1,useHostTransitionStatus:ig,useFormState:A1,useActionState:A1,useOptimistic:function(i,o){var c=Qt();return C1(c,kt,i,o)},useMemoCache:Ym,useCacheRefresh:G1};og.useEffectEvent=z1;var J1={readContext:zn,use:Vd,useCallback:F1,useContext:zn,useEffect:eg,useImperativeHandle:H1,useInsertionEffect:P1,useLayoutEffect:B1,useMemo:U1,useReducer:Zm,useRef:j1,useState:function(){return Zm(Yi)},useDebugValue:tg,useDeferredValue:function(i,o){var c=Qt();return kt===null?ng(c,i,o):$1(c,kt.memoizedState,i,o)},useTransition:function(){var i=Zm(Yi)[0],o=Qt().memoizedState;return[typeof i=="boolean"?i:yc(i),o]},useSyncExternalStore:_1,useId:K1,useHostTransitionStatus:ig,useFormState:O1,useActionState:O1,useOptimistic:function(i,o){var c=Qt();return kt!==null?C1(c,kt,i,o):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:Ym,useCacheRefresh:G1};J1.useEffectEvent=z1;function ag(i,o,c,f){o=i.memoizedState,c=c(f,o),c=c==null?o:g({},o,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var lg={enqueueSetState:function(i,o,c){i=i._reactInternals;var f=Er(),v=Ns(f);v.payload=o,c!=null&&(v.callback=c),o=As(i,v,f),o!==null&&(fr(o,i,f),mc(o,i,f))},enqueueReplaceState:function(i,o,c){i=i._reactInternals;var f=Er(),v=Ns(f);v.tag=1,v.payload=o,c!=null&&(v.callback=c),o=As(i,v,f),o!==null&&(fr(o,i,f),mc(o,i,f))},enqueueForceUpdate:function(i,o){i=i._reactInternals;var c=Er(),f=Ns(c);f.tag=2,o!=null&&(f.callback=o),o=As(i,f,c),o!==null&&(fr(o,i,c),mc(o,i,c))}};function ew(i,o,c,f,v,x,E){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,x,E):o.prototype&&o.prototype.isPureReactComponent?!ac(c,f)||!ac(v,x):!0}function tw(i,o,c,f){i=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,f),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,f),o.state!==i&&lg.enqueueReplaceState(o,o.state,null)}function Lo(i,o){var c=o;if("ref"in o){c={};for(var f in o)f!=="ref"&&(c[f]=o[f])}if(i=i.defaultProps){c===o&&(c=g({},c));for(var v in i)c[v]===void 0&&(c[v]=i[v])}return c}function nw(i){Rd(i)}function rw(i){console.error(i)}function iw(i){Rd(i)}function Xd(i,o){try{var c=i.onUncaughtError;c(o.value,{componentStack:o.stack})}catch(f){setTimeout(function(){throw f})}}function sw(i,o,c){try{var f=i.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function cg(i,o,c){return c=Ns(c),c.tag=3,c.payload={element:null},c.callback=function(){Xd(i,o)},c}function ow(i){return i=Ns(i),i.tag=3,i}function aw(i,o,c,f){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var x=f.value;i.payload=function(){return v(x)},i.callback=function(){sw(o,c,f)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(i.callback=function(){sw(o,c,f),typeof v!="function"&&(Ps===null?Ps=new Set([this]):Ps.add(this));var A=f.stack;this.componentDidCatch(f.value,{componentStack:A!==null?A:""})})}function k4(i,o,c,f,v){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(o=c.alternate,o!==null&&La(o,c,v,!0),c=wr.current,c!==null){switch(c.tag){case 31:case 13:return Ur===null?lh():c.alternate===null&&Kt===0&&(Kt=3),c.flags&=-257,c.flags|=65536,c.lanes=v,f===Pd?c.flags|=16384:(o=c.updateQueue,o===null?c.updateQueue=new Set([f]):o.add(f),jg(i,f,v)),!1;case 22:return c.flags|=65536,f===Pd?c.flags|=16384:(o=c.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=o):(c=o.retryQueue,c===null?o.retryQueue=new Set([f]):c.add(f)),jg(i,f,v)),!1}throw Error(r(435,c.tag))}return jg(i,f,v),lh(),!1}if(ot)return o=wr.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=v,f!==Tm&&(i=Error(r(422),{cause:f}),uc(Br(i,c)))):(f!==Tm&&(o=Error(r(423),{cause:f}),uc(Br(o,c))),i=i.current.alternate,i.flags|=65536,v&=-v,i.lanes|=v,f=Br(f,c),v=cg(i.stateNode,f,v),Im(i,v),Kt!==4&&(Kt=2)),!1;var x=Error(r(520),{cause:f});if(x=Br(x,c),Mc===null?Mc=[x]:Mc.push(x),Kt!==4&&(Kt=2),o===null)return!0;f=Br(f,c),c=o;do{switch(c.tag){case 3:return c.flags|=65536,i=v&-v,c.lanes|=i,i=cg(c.stateNode,f,i),Im(c,i),!1;case 1:if(o=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ps===null||!Ps.has(x))))return c.flags|=65536,v&=-v,c.lanes|=v,v=ow(v),aw(v,i,c,f),Im(c,v),!1}c=c.return}while(c!==null);return!1}var ug=Error(r(461)),rn=!1;function Pn(i,o,c,f){o.child=i===null?d1(o,null,c,f):Oo(o,i.child,c,f)}function lw(i,o,c,f,v){c=c.render;var x=o.ref;if("ref"in f){var E={};for(var A in f)A!=="ref"&&(E[A]=f[A])}else E=f;return Mo(o),f=Vm(i,o,c,E,x,v),A=qm(),i!==null&&!rn?(Km(i,o,v),Xi(i,o,v)):(ot&&A&&Em(o),o.flags|=1,Pn(i,o,f,v),o.child)}function cw(i,o,c,f,v){if(i===null){var x=c.type;return typeof x=="function"&&!Sm(x)&&x.defaultProps===void 0&&c.compare===null?(o.tag=15,o.type=x,uw(i,o,x,f,v)):(i=Ad(c.type,null,f,o,o.mode,v),i.ref=o.ref,i.return=o,o.child=i)}if(x=i.child,!_g(i,v)){var E=x.memoizedProps;if(c=c.compare,c=c!==null?c:ac,c(E,f)&&i.ref===o.ref)return Xi(i,o,v)}return o.flags|=1,i=Wi(x,f),i.ref=o.ref,i.return=o,o.child=i}function uw(i,o,c,f,v){if(i!==null){var x=i.memoizedProps;if(ac(x,f)&&i.ref===o.ref)if(rn=!1,o.pendingProps=f=x,_g(i,v))(i.flags&131072)!==0&&(rn=!0);else return o.lanes=i.lanes,Xi(i,o,v)}return dg(i,o,c,f,v)}function dw(i,o,c,f){var v=f.children,x=i!==null?i.memoizedState:null;if(i===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((o.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,i!==null){for(f=o.child=i.child,v=0;f!==null;)v=v|f.lanes|f.childLanes,f=f.sibling;f=v&~x}else f=0,o.child=null;return hw(i,o,x,c,f)}if((c&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},i!==null&&Ld(o,x!==null?x.cachePool:null),x!==null?p1(o,x):Fm(),m1(o);else return f=o.lanes=536870912,hw(i,o,x!==null?x.baseLanes|c:c,c,f)}else x!==null?(Ld(o,x.cachePool),p1(o,x),Os(),o.memoizedState=null):(i!==null&&Ld(o,null),Fm(),Os());return Pn(i,o,v,c),o.child}function wc(i,o){return i!==null&&i.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function hw(i,o,c,f,v){var x=Lm();return x=x===null?null:{parent:tn._currentValue,pool:x},o.memoizedState={baseLanes:c,cachePool:x},i!==null&&Ld(o,null),Fm(),m1(o),i!==null&&La(i,o,f,!0),o.childLanes=v,null}function Zd(i,o){return o=Jd({mode:o.mode,children:o.children},i.mode),o.ref=i.ref,i.child=o,o.return=i,o}function fw(i,o,c){return Oo(o,i.child,null,c),i=Zd(o,o.pendingProps),i.flags|=2,Sr(o),o.memoizedState=null,i}function E4(i,o,c){var f=o.pendingProps,v=(o.flags&128)!==0;if(o.flags&=-129,i===null){if(ot){if(f.mode==="hidden")return i=Zd(o,f),o.lanes=536870912,wc(null,i);if($m(o),(i=Bt)?(i=kS(i,Fr),i=i!==null&&i.data==="&"?i:null,i!==null&&(o.memoizedState={dehydrated:i,treeContext:ks!==null?{id:yi,overflow:bi}:null,retryLane:536870912,hydrationErrors:null},c=Xx(i),c.return=o,o.child=c,Ln=o,Bt=null)):i=null,i===null)throw Rs(o);return o.lanes=536870912,null}return Zd(o,f)}var x=i.memoizedState;if(x!==null){var E=x.dehydrated;if($m(o),v)if(o.flags&256)o.flags&=-257,o=fw(i,o,c);else if(o.memoizedState!==null)o.child=i.child,o.flags|=128,o=null;else throw Error(r(558));else if(rn||La(i,o,c,!1),v=(c&i.childLanes)!==0,rn||v){if(f=At,f!==null&&(E=mt(f,c),E!==0&&E!==x.retryLane))throw x.retryLane=E,ko(i,E),fr(f,i,E),ug;lh(),o=fw(i,o,c)}else i=x.treeContext,Bt=$r(E.nextSibling),Ln=o,ot=!0,Es=null,Fr=!1,i!==null&&Jx(o,i),o=Zd(o,f),o.flags|=4096;return o}return i=Wi(i.child,{mode:f.mode,children:f.children}),i.ref=o.ref,o.child=i,i.return=o,i}function Qd(i,o){var c=o.ref;if(c===null)i!==null&&i.ref!==null&&(o.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(i===null||i.ref!==c)&&(o.flags|=4194816)}}function dg(i,o,c,f,v){return Mo(o),c=Vm(i,o,c,f,void 0,v),f=qm(),i!==null&&!rn?(Km(i,o,v),Xi(i,o,v)):(ot&&f&&Em(o),o.flags|=1,Pn(i,o,c,v),o.child)}function pw(i,o,c,f,v,x){return Mo(o),o.updateQueue=null,c=v1(o,f,c,v),g1(i),f=qm(),i!==null&&!rn?(Km(i,o,x),Xi(i,o,x)):(ot&&f&&Em(o),o.flags|=1,Pn(i,o,c,x),o.child)}function mw(i,o,c,f,v){if(Mo(o),o.stateNode===null){var x=Aa,E=c.contextType;typeof E=="object"&&E!==null&&(x=zn(E)),x=new c(f,x),o.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=lg,o.stateNode=x,x._reactInternals=o,x=o.stateNode,x.props=f,x.state=o.memoizedState,x.refs={},Pm(o),E=c.contextType,x.context=typeof E=="object"&&E!==null?zn(E):Aa,x.state=o.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(ag(o,c,E,f),x.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(E=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),E!==x.state&&lg.enqueueReplaceState(x,x.state,null),vc(o,f,x,v),gc(),x.state=o.memoizedState),typeof x.componentDidMount=="function"&&(o.flags|=4194308),f=!0}else if(i===null){x=o.stateNode;var A=o.memoizedProps,K=Lo(c,A);x.props=K;var ne=x.context,fe=c.contextType;E=Aa,typeof fe=="object"&&fe!==null&&(E=zn(fe));var _e=c.getDerivedStateFromProps;fe=typeof _e=="function"||typeof x.getSnapshotBeforeUpdate=="function",A=o.pendingProps!==A,fe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A||ne!==E)&&tw(o,x,f,E),Ms=!1;var se=o.memoizedState;x.state=se,vc(o,f,x,v),gc(),ne=o.memoizedState,A||se!==ne||Ms?(typeof _e=="function"&&(ag(o,c,_e,f),ne=o.memoizedState),(K=Ms||ew(o,c,K,f,se,ne,E))?(fe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(o.flags|=4194308)):(typeof x.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=f,o.memoizedState=ne),x.props=f,x.state=ne,x.context=E,f=K):(typeof x.componentDidMount=="function"&&(o.flags|=4194308),f=!1)}else{x=o.stateNode,Bm(i,o),E=o.memoizedProps,fe=Lo(c,E),x.props=fe,_e=o.pendingProps,se=x.context,ne=c.contextType,K=Aa,typeof ne=="object"&&ne!==null&&(K=zn(ne)),A=c.getDerivedStateFromProps,(ne=typeof A=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(E!==_e||se!==K)&&tw(o,x,f,K),Ms=!1,se=o.memoizedState,x.state=se,vc(o,f,x,v),gc();var ce=o.memoizedState;E!==_e||se!==ce||Ms||i!==null&&i.dependencies!==null&&Od(i.dependencies)?(typeof A=="function"&&(ag(o,c,A,f),ce=o.memoizedState),(fe=Ms||ew(o,c,fe,f,se,ce,K)||i!==null&&i.dependencies!==null&&Od(i.dependencies))?(ne||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,ce,K),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,ce,K)),typeof x.componentDidUpdate=="function"&&(o.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof x.componentDidUpdate!="function"||E===i.memoizedProps&&se===i.memoizedState||(o.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||E===i.memoizedProps&&se===i.memoizedState||(o.flags|=1024),o.memoizedProps=f,o.memoizedState=ce),x.props=f,x.state=ce,x.context=K,f=fe):(typeof x.componentDidUpdate!="function"||E===i.memoizedProps&&se===i.memoizedState||(o.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||E===i.memoizedProps&&se===i.memoizedState||(o.flags|=1024),f=!1)}return x=f,Qd(i,o),f=(o.flags&128)!==0,x||f?(x=o.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:x.render(),o.flags|=1,i!==null&&f?(o.child=Oo(o,i.child,null,v),o.child=Oo(o,null,c,v)):Pn(i,o,c,v),o.memoizedState=x.state,i=o.child):i=Xi(i,o,v),i}function gw(i,o,c,f){return Ro(),o.flags|=256,Pn(i,o,c,f),o.child}var hg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fg(i){return{baseLanes:i,cachePool:s1()}}function pg(i,o,c){return i=i!==null?i.childLanes&~c:0,o&&(i|=kr),i}function vw(i,o,c){var f=o.pendingProps,v=!1,x=(o.flags&128)!==0,E;if((E=x)||(E=i!==null&&i.memoizedState===null?!1:(Zt.current&2)!==0),E&&(v=!0,o.flags&=-129),E=(o.flags&32)!==0,o.flags&=-33,i===null){if(ot){if(v?Ds(o):Os(),(i=Bt)?(i=kS(i,Fr),i=i!==null&&i.data!=="&"?i:null,i!==null&&(o.memoizedState={dehydrated:i,treeContext:ks!==null?{id:yi,overflow:bi}:null,retryLane:536870912,hydrationErrors:null},c=Xx(i),c.return=o,o.child=c,Ln=o,Bt=null)):i=null,i===null)throw Rs(o);return Xg(i)?o.lanes=32:o.lanes=536870912,null}var A=f.children;return f=f.fallback,v?(Os(),v=o.mode,A=Jd({mode:"hidden",children:A},v),f=Eo(f,v,c,null),A.return=o,f.return=o,A.sibling=f,o.child=A,f=o.child,f.memoizedState=fg(c),f.childLanes=pg(i,E,c),o.memoizedState=hg,wc(null,f)):(Ds(o),mg(o,A))}var K=i.memoizedState;if(K!==null&&(A=K.dehydrated,A!==null)){if(x)o.flags&256?(Ds(o),o.flags&=-257,o=gg(i,o,c)):o.memoizedState!==null?(Os(),o.child=i.child,o.flags|=128,o=null):(Os(),A=f.fallback,v=o.mode,f=Jd({mode:"visible",children:f.children},v),A=Eo(A,v,c,null),A.flags|=2,f.return=o,A.return=o,f.sibling=A,o.child=f,Oo(o,i.child,null,c),f=o.child,f.memoizedState=fg(c),f.childLanes=pg(i,E,c),o.memoizedState=hg,o=wc(null,f));else if(Ds(o),Xg(A)){if(E=A.nextSibling&&A.nextSibling.dataset,E)var ne=E.dgst;E=ne,f=Error(r(419)),f.stack="",f.digest=E,uc({value:f,source:null,stack:null}),o=gg(i,o,c)}else if(rn||La(i,o,c,!1),E=(c&i.childLanes)!==0,rn||E){if(E=At,E!==null&&(f=mt(E,c),f!==0&&f!==K.retryLane))throw K.retryLane=f,ko(i,f),fr(E,i,f),ug;Yg(A)||lh(),o=gg(i,o,c)}else Yg(A)?(o.flags|=192,o.child=i.child,o=null):(i=K.treeContext,Bt=$r(A.nextSibling),Ln=o,ot=!0,Es=null,Fr=!1,i!==null&&Jx(o,i),o=mg(o,f.children),o.flags|=4096);return o}return v?(Os(),A=f.fallback,v=o.mode,K=i.child,ne=K.sibling,f=Wi(K,{mode:"hidden",children:f.children}),f.subtreeFlags=K.subtreeFlags&65011712,ne!==null?A=Wi(ne,A):(A=Eo(A,v,c,null),A.flags|=2),A.return=o,f.return=o,f.sibling=A,o.child=f,wc(null,f),f=o.child,A=i.child.memoizedState,A===null?A=fg(c):(v=A.cachePool,v!==null?(K=tn._currentValue,v=v.parent!==K?{parent:K,pool:K}:v):v=s1(),A={baseLanes:A.baseLanes|c,cachePool:v}),f.memoizedState=A,f.childLanes=pg(i,E,c),o.memoizedState=hg,wc(i.child,f)):(Ds(o),c=i.child,i=c.sibling,c=Wi(c,{mode:"visible",children:f.children}),c.return=o,c.sibling=null,i!==null&&(E=o.deletions,E===null?(o.deletions=[i],o.flags|=16):E.push(i)),o.child=c,o.memoizedState=null,c)}function mg(i,o){return o=Jd({mode:"visible",children:o},i.mode),o.return=i,i.child=o}function Jd(i,o){return i=xr(22,i,null,o),i.lanes=0,i}function gg(i,o,c){return Oo(o,i.child,null,c),i=mg(o,o.pendingProps.children),i.flags|=2,o.memoizedState=null,i}function _w(i,o,c){i.lanes|=o;var f=i.alternate;f!==null&&(f.lanes|=o),Am(i.return,o,c)}function vg(i,o,c,f,v,x){var E=i.memoizedState;E===null?i.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:v,treeForkCount:x}:(E.isBackwards=o,E.rendering=null,E.renderingStartTime=0,E.last=f,E.tail=c,E.tailMode=v,E.treeForkCount=x)}function yw(i,o,c){var f=o.pendingProps,v=f.revealOrder,x=f.tail;f=f.children;var E=Zt.current,A=(E&2)!==0;if(A?(E=E&1|2,o.flags|=128):E&=1,L(Zt,E),Pn(i,o,f,c),f=ot?cc:0,!A&&i!==null&&(i.flags&128)!==0)e:for(i=o.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&_w(i,c,o);else if(i.tag===19)_w(i,c,o);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break e;for(;i.sibling===null;){if(i.return===null||i.return===o)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(v){case"forwards":for(c=o.child,v=null;c!==null;)i=c.alternate,i!==null&&Fd(i)===null&&(v=c),c=c.sibling;c=v,c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null),vg(o,!1,v,c,x,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,v=o.child,o.child=null;v!==null;){if(i=v.alternate,i!==null&&Fd(i)===null){o.child=v;break}i=v.sibling,v.sibling=c,c=v,v=i}vg(o,!0,c,null,x,f);break;case"together":vg(o,!1,null,null,void 0,f);break;default:o.memoizedState=null}return o.child}function Xi(i,o,c){if(i!==null&&(o.dependencies=i.dependencies),zs|=o.lanes,(c&o.childLanes)===0)if(i!==null){if(La(i,o,c,!1),(c&o.childLanes)===0)return null}else return null;if(i!==null&&o.child!==i.child)throw Error(r(153));if(o.child!==null){for(i=o.child,c=Wi(i,i.pendingProps),o.child=c,c.return=o;i.sibling!==null;)i=i.sibling,c=c.sibling=Wi(i,i.pendingProps),c.return=o;c.sibling=null}return o.child}function _g(i,o){return(i.lanes&o)!==0?!0:(i=i.dependencies,!!(i!==null&&Od(i)))}function R4(i,o,c){switch(o.tag){case 3:we(o,o.stateNode.containerInfo),Ts(o,tn,i.memoizedState.cache),Ro();break;case 27:case 5:xe(o);break;case 4:we(o,o.stateNode.containerInfo);break;case 10:Ts(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,$m(o),null;break;case 13:var f=o.memoizedState;if(f!==null)return f.dehydrated!==null?(Ds(o),o.flags|=128,null):(c&o.child.childLanes)!==0?vw(i,o,c):(Ds(o),i=Xi(i,o,c),i!==null?i.sibling:null);Ds(o);break;case 19:var v=(i.flags&128)!==0;if(f=(c&o.childLanes)!==0,f||(La(i,o,c,!1),f=(c&o.childLanes)!==0),v){if(f)return yw(i,o,c);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),L(Zt,Zt.current),f)break;return null;case 22:return o.lanes=0,dw(i,o,c,o.pendingProps);case 24:Ts(o,tn,i.memoizedState.cache)}return Xi(i,o,c)}function bw(i,o,c){if(i!==null)if(i.memoizedProps!==o.pendingProps)rn=!0;else{if(!_g(i,c)&&(o.flags&128)===0)return rn=!1,R4(i,o,c);rn=(i.flags&131072)!==0}else rn=!1,ot&&(o.flags&1048576)!==0&&Qx(o,cc,o.index);switch(o.lanes=0,o.tag){case 16:e:{var f=o.pendingProps;if(i=Ao(o.elementType),o.type=i,typeof i=="function")Sm(i)?(f=Lo(i,f),o.tag=1,o=mw(null,o,i,f,c)):(o.tag=0,o=dg(null,o,i,f,c));else{if(i!=null){var v=i.$$typeof;if(v===M){o.tag=11,o=lw(null,o,i,f,c);break e}else if(v===j){o.tag=14,o=cw(null,o,i,f,c);break e}}throw o=q(i)||i,Error(r(306,o,""))}}return o;case 0:return dg(i,o,o.type,o.pendingProps,c);case 1:return f=o.type,v=Lo(f,o.pendingProps),mw(i,o,f,v,c);case 3:e:{if(we(o,o.stateNode.containerInfo),i===null)throw Error(r(387));f=o.pendingProps;var x=o.memoizedState;v=x.element,Bm(i,o),vc(o,f,null,c);var E=o.memoizedState;if(f=E.cache,Ts(o,tn,f),f!==x.cache&&Dm(o,[tn],c,!0),gc(),f=E.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:E.cache},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){o=gw(i,o,f,c);break e}else if(f!==v){v=Br(Error(r(424)),o),uc(v),o=gw(i,o,f,c);break e}else{switch(i=o.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Bt=$r(i.firstChild),Ln=o,ot=!0,Es=null,Fr=!0,c=d1(o,null,f,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Ro(),f===v){o=Xi(i,o,c);break e}Pn(i,o,f,c)}o=o.child}return o;case 26:return Qd(i,o),i===null?(c=AS(o.type,null,o.pendingProps,null))?o.memoizedState=c:ot||(c=o.type,i=o.pendingProps,f=mh(ue.current).createElement(c),f[jn]=o,f[ar]=i,Bn(f,c,i),xn(f),o.stateNode=f):o.memoizedState=AS(o.type,i.memoizedProps,o.pendingProps,i.memoizedState),null;case 27:return xe(o),i===null&&ot&&(f=o.stateNode=TS(o.type,o.pendingProps,ue.current),Ln=o,Fr=!0,v=Bt,Fs(o.type)?(Zg=v,Bt=$r(f.firstChild)):Bt=v),Pn(i,o,o.pendingProps.children,c),Qd(i,o),i===null&&(o.flags|=4194304),o.child;case 5:return i===null&&ot&&((v=f=Bt)&&(f=rO(f,o.type,o.pendingProps,Fr),f!==null?(o.stateNode=f,Ln=o,Bt=$r(f.firstChild),Fr=!1,v=!0):v=!1),v||Rs(o)),xe(o),v=o.type,x=o.pendingProps,E=i!==null?i.memoizedProps:null,f=x.children,qg(v,x)?f=null:E!==null&&qg(v,E)&&(o.flags|=32),o.memoizedState!==null&&(v=Vm(i,o,_4,null,null,c),Pc._currentValue=v),Qd(i,o),Pn(i,o,f,c),o.child;case 6:return i===null&&ot&&((i=c=Bt)&&(c=iO(c,o.pendingProps,Fr),c!==null?(o.stateNode=c,Ln=o,Bt=null,i=!0):i=!1),i||Rs(o)),null;case 13:return vw(i,o,c);case 4:return we(o,o.stateNode.containerInfo),f=o.pendingProps,i===null?o.child=Oo(o,null,f,c):Pn(i,o,f,c),o.child;case 11:return lw(i,o,o.type,o.pendingProps,c);case 7:return Pn(i,o,o.pendingProps,c),o.child;case 8:return Pn(i,o,o.pendingProps.children,c),o.child;case 12:return Pn(i,o,o.pendingProps.children,c),o.child;case 10:return f=o.pendingProps,Ts(o,o.type,f.value),Pn(i,o,f.children,c),o.child;case 9:return v=o.type._context,f=o.pendingProps.children,Mo(o),v=zn(v),f=f(v),o.flags|=1,Pn(i,o,f,c),o.child;case 14:return cw(i,o,o.type,o.pendingProps,c);case 15:return uw(i,o,o.type,o.pendingProps,c);case 19:return yw(i,o,c);case 31:return E4(i,o,c);case 22:return dw(i,o,c,o.pendingProps);case 24:return Mo(o),f=zn(tn),i===null?(v=Lm(),v===null&&(v=At,x=Om(),v.pooledCache=x,x.refCount++,x!==null&&(v.pooledCacheLanes|=c),v=x),o.memoizedState={parent:f,cache:v},Pm(o),Ts(o,tn,v)):((i.lanes&c)!==0&&(Bm(i,o),vc(o,null,null,c),gc()),v=i.memoizedState,x=o.memoizedState,v.parent!==f?(v={parent:f,cache:f},o.memoizedState=v,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=v),Ts(o,tn,f)):(f=x.cache,Ts(o,tn,f),f!==v.cache&&Dm(o,[tn],c,!0))),Pn(i,o,o.pendingProps.children,c),o.child;case 29:throw o.pendingProps}throw Error(r(156,o.tag))}function Zi(i){i.flags|=4}function yg(i,o,c,f,v){if((o=(i.mode&32)!==0)&&(o=!1),o){if(i.flags|=16777216,(v&335544128)===v)if(i.stateNode.complete)i.flags|=8192;else if(Kw())i.flags|=8192;else throw Do=Pd,zm}else i.flags&=-16777217}function xw(i,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!zS(o))if(Kw())i.flags|=8192;else throw Do=Pd,zm}function eh(i,o){o!==null&&(i.flags|=4),i.flags&16384&&(o=i.tag!==22?hn():536870912,i.lanes|=o,Ka|=o)}function Sc(i,o){if(!ot)switch(i.tailMode){case"hidden":o=i.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?o||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function It(i){var o=i.alternate!==null&&i.alternate.child===i.child,c=0,f=0;if(o)for(var v=i.child;v!==null;)c|=v.lanes|v.childLanes,f|=v.subtreeFlags&65011712,f|=v.flags&65011712,v.return=i,v=v.sibling;else for(v=i.child;v!==null;)c|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=i,v=v.sibling;return i.subtreeFlags|=f,i.childLanes=c,o}function T4(i,o,c){var f=o.pendingProps;switch(Rm(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return It(o),null;case 1:return It(o),null;case 3:return c=o.stateNode,f=null,i!==null&&(f=i.memoizedState.cache),o.memoizedState.cache!==f&&(o.flags|=2048),Ki(tn),le(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(ja(o)?Zi(o):i===null||i.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Mm())),It(o),null;case 26:var v=o.type,x=o.memoizedState;return i===null?(Zi(o),x!==null?(It(o),xw(o,x)):(It(o),yg(o,v,null,f,c))):x?x!==i.memoizedState?(Zi(o),It(o),xw(o,x)):(It(o),o.flags&=-16777217):(i=i.memoizedProps,i!==f&&Zi(o),It(o),yg(o,v,i,f,c)),null;case 27:if(Ne(o),c=ue.current,v=o.type,i!==null&&o.stateNode!=null)i.memoizedProps!==f&&Zi(o);else{if(!f){if(o.stateNode===null)throw Error(r(166));return It(o),null}i=de.current,ja(o)?e1(o):(i=TS(v,f,c),o.stateNode=i,Zi(o))}return It(o),null;case 5:if(Ne(o),v=o.type,i!==null&&o.stateNode!=null)i.memoizedProps!==f&&Zi(o);else{if(!f){if(o.stateNode===null)throw Error(r(166));return It(o),null}if(x=de.current,ja(o))e1(o);else{var E=mh(ue.current);switch(x){case 1:x=E.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:x=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":x=E.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":x=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":x=E.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof f.is=="string"?E.createElement("select",{is:f.is}):E.createElement("select"),f.multiple?x.multiple=!0:f.size&&(x.size=f.size);break;default:x=typeof f.is=="string"?E.createElement(v,{is:f.is}):E.createElement(v)}}x[jn]=o,x[ar]=f;e:for(E=o.child;E!==null;){if(E.tag===5||E.tag===6)x.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===o)break e;for(;E.sibling===null;){if(E.return===null||E.return===o)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}o.stateNode=x;e:switch(Bn(x,v,f),v){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Zi(o)}}return It(o),yg(o,o.type,i===null?null:i.memoizedProps,o.pendingProps,c),null;case 6:if(i&&o.stateNode!=null)i.memoizedProps!==f&&Zi(o);else{if(typeof f!="string"&&o.stateNode===null)throw Error(r(166));if(i=ue.current,ja(o)){if(i=o.stateNode,c=o.memoizedProps,f=null,v=Ln,v!==null)switch(v.tag){case 27:case 5:f=v.memoizedProps}i[jn]=o,i=!!(i.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||vS(i.nodeValue,c)),i||Rs(o,!0)}else i=mh(i).createTextNode(f),i[jn]=o,o.stateNode=i}return It(o),null;case 31:if(c=o.memoizedState,i===null||i.memoizedState!==null){if(f=ja(o),c!==null){if(i===null){if(!f)throw Error(r(318));if(i=o.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[jn]=o}else Ro(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;It(o),i=!1}else c=Mm(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return o.flags&256?(Sr(o),o):(Sr(o),null);if((o.flags&128)!==0)throw Error(r(558))}return It(o),null;case 13:if(f=o.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(v=ja(o),f!==null&&f.dehydrated!==null){if(i===null){if(!v)throw Error(r(318));if(v=o.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[jn]=o}else Ro(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;It(o),v=!1}else v=Mm(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=v),v=!0;if(!v)return o.flags&256?(Sr(o),o):(Sr(o),null)}return Sr(o),(o.flags&128)!==0?(o.lanes=c,o):(c=f!==null,i=i!==null&&i.memoizedState!==null,c&&(f=o.child,v=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(v=f.alternate.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==v&&(f.flags|=2048)),c!==i&&c&&(o.child.flags|=8192),eh(o,o.updateQueue),It(o),null);case 4:return le(),i===null&&Fg(o.stateNode.containerInfo),It(o),null;case 10:return Ki(o.type),It(o),null;case 19:if(Z(Zt),f=o.memoizedState,f===null)return It(o),null;if(v=(o.flags&128)!==0,x=f.rendering,x===null)if(v)Sc(f,!1);else{if(Kt!==0||i!==null&&(i.flags&128)!==0)for(i=o.child;i!==null;){if(x=Fd(i),x!==null){for(o.flags|=128,Sc(f,!1),i=x.updateQueue,o.updateQueue=i,eh(o,i),o.subtreeFlags=0,i=c,c=o.child;c!==null;)Yx(c,i),c=c.sibling;return L(Zt,Zt.current&1|2),ot&&Vi(o,f.treeForkCount),o.child}i=i.sibling}f.tail!==null&&Nt()>sh&&(o.flags|=128,v=!0,Sc(f,!1),o.lanes=4194304)}else{if(!v)if(i=Fd(x),i!==null){if(o.flags|=128,v=!0,i=i.updateQueue,o.updateQueue=i,eh(o,i),Sc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!x.alternate&&!ot)return It(o),null}else 2*Nt()-f.renderingStartTime>sh&&c!==536870912&&(o.flags|=128,v=!0,Sc(f,!1),o.lanes=4194304);f.isBackwards?(x.sibling=o.child,o.child=x):(i=f.last,i!==null?i.sibling=x:o.child=x,f.last=x)}return f.tail!==null?(i=f.tail,f.rendering=i,f.tail=i.sibling,f.renderingStartTime=Nt(),i.sibling=null,c=Zt.current,L(Zt,v?c&1|2:c&1),ot&&Vi(o,f.treeForkCount),i):(It(o),null);case 22:case 23:return Sr(o),Um(),f=o.memoizedState!==null,i!==null?i.memoizedState!==null!==f&&(o.flags|=8192):f&&(o.flags|=8192),f?(c&536870912)!==0&&(o.flags&128)===0&&(It(o),o.subtreeFlags&6&&(o.flags|=8192)):It(o),c=o.updateQueue,c!==null&&eh(o,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==c&&(o.flags|=2048),i!==null&&Z(No),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),o.memoizedState.cache!==c&&(o.flags|=2048),Ki(tn),It(o),null;case 25:return null;case 30:return null}throw Error(r(156,o.tag))}function M4(i,o){switch(Rm(o),o.tag){case 1:return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return Ki(tn),le(),i=o.flags,(i&65536)!==0&&(i&128)===0?(o.flags=i&-65537|128,o):null;case 26:case 27:case 5:return Ne(o),null;case 31:if(o.memoizedState!==null){if(Sr(o),o.alternate===null)throw Error(r(340));Ro()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 13:if(Sr(o),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(r(340));Ro()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return Z(Zt),null;case 4:return le(),null;case 10:return Ki(o.type),null;case 22:case 23:return Sr(o),Um(),i!==null&&Z(No),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 24:return Ki(tn),null;case 25:return null;default:return null}}function ww(i,o){switch(Rm(o),o.tag){case 3:Ki(tn),le();break;case 26:case 27:case 5:Ne(o);break;case 4:le();break;case 31:o.memoizedState!==null&&Sr(o);break;case 13:Sr(o);break;case 19:Z(Zt);break;case 10:Ki(o.type);break;case 22:case 23:Sr(o),Um(),i!==null&&Z(No);break;case 24:Ki(tn)}}function Cc(i,o){try{var c=o.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var v=f.next;c=v;do{if((c.tag&i)===i){f=void 0;var x=c.create,E=c.inst;f=x(),E.destroy=f}c=c.next}while(c!==v)}}catch(A){St(o,o.return,A)}}function js(i,o,c){try{var f=o.updateQueue,v=f!==null?f.lastEffect:null;if(v!==null){var x=v.next;f=x;do{if((f.tag&i)===i){var E=f.inst,A=E.destroy;if(A!==void 0){E.destroy=void 0,v=o;var K=c,ne=A;try{ne()}catch(fe){St(v,K,fe)}}}f=f.next}while(f!==x)}}catch(fe){St(o,o.return,fe)}}function Sw(i){var o=i.updateQueue;if(o!==null){var c=i.stateNode;try{f1(o,c)}catch(f){St(i,i.return,f)}}}function Cw(i,o,c){c.props=Lo(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(f){St(i,o,f)}}function kc(i,o){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var f=i.stateNode;break;case 30:f=i.stateNode;break;default:f=i.stateNode}typeof c=="function"?i.refCleanup=c(f):c.current=f}}catch(v){St(i,o,v)}}function xi(i,o){var c=i.ref,f=i.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(v){St(i,o,v)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){St(i,o,v)}else c.current=null}function kw(i){var o=i.type,c=i.memoizedProps,f=i.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(v){St(i,i.return,v)}}function bg(i,o,c){try{var f=i.stateNode;Z4(f,i.type,c,o),f[ar]=o}catch(v){St(i,i.return,v)}}function Ew(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Fs(i.type)||i.tag===4}function xg(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Ew(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Fs(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function wg(i,o,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,o?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,o):(o=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,o.appendChild(i),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=Ui));else if(f!==4&&(f===27&&Fs(i.type)&&(c=i.stateNode,o=null),i=i.child,i!==null))for(wg(i,o,c),i=i.sibling;i!==null;)wg(i,o,c),i=i.sibling}function th(i,o,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,o?c.insertBefore(i,o):c.appendChild(i);else if(f!==4&&(f===27&&Fs(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(th(i,o,c),i=i.sibling;i!==null;)th(i,o,c),i=i.sibling}function Rw(i){var o=i.stateNode,c=i.memoizedProps;try{for(var f=i.type,v=o.attributes;v.length;)o.removeAttributeNode(v[0]);Bn(o,f,c),o[jn]=i,o[ar]=c}catch(x){St(i,i.return,x)}}var Qi=!1,sn=!1,Sg=!1,Tw=typeof WeakSet=="function"?WeakSet:Set,wn=null;function N4(i,o){if(i=i.containerInfo,Wg=wh,i=Hx(i),gm(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var v=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var E=0,A=-1,K=-1,ne=0,fe=0,_e=i,se=null;t:for(;;){for(var ce;_e!==c||v!==0&&_e.nodeType!==3||(A=E+v),_e!==x||f!==0&&_e.nodeType!==3||(K=E+f),_e.nodeType===3&&(E+=_e.nodeValue.length),(ce=_e.firstChild)!==null;)se=_e,_e=ce;for(;;){if(_e===i)break t;if(se===c&&++ne===v&&(A=E),se===x&&++fe===f&&(K=E),(ce=_e.nextSibling)!==null)break;_e=se,se=_e.parentNode}_e=ce}c=A===-1||K===-1?null:{start:A,end:K}}else c=null}c=c||{start:0,end:0}}else c=null;for(Vg={focusedElem:i,selectionRange:c},wh=!1,wn=o;wn!==null;)if(o=wn,i=o.child,(o.subtreeFlags&1028)!==0&&i!==null)i.return=o,wn=i;else for(;wn!==null;){switch(o=wn,x=o.alternate,i=o.flags,o.tag){case 0:if((i&4)!==0&&(i=o.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)v=i[c],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&x!==null){i=void 0,c=o,v=x.memoizedProps,x=x.memoizedState,f=c.stateNode;try{var De=Lo(c.type,v);i=f.getSnapshotBeforeUpdate(De,x),f.__reactInternalSnapshotBeforeUpdate=i}catch(Ie){St(c,c.return,Ie)}}break;case 3:if((i&1024)!==0){if(i=o.stateNode.containerInfo,c=i.nodeType,c===9)Gg(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Gg(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=o.sibling,i!==null){i.return=o.return,wn=i;break}wn=o.return}}function Mw(i,o,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:es(i,c),f&4&&Cc(5,c);break;case 1:if(es(i,c),f&4)if(i=c.stateNode,o===null)try{i.componentDidMount()}catch(E){St(c,c.return,E)}else{var v=Lo(c.type,o.memoizedProps);o=o.memoizedState;try{i.componentDidUpdate(v,o,i.__reactInternalSnapshotBeforeUpdate)}catch(E){St(c,c.return,E)}}f&64&&Sw(c),f&512&&kc(c,c.return);break;case 3:if(es(i,c),f&64&&(i=c.updateQueue,i!==null)){if(o=null,c.child!==null)switch(c.child.tag){case 27:case 5:o=c.child.stateNode;break;case 1:o=c.child.stateNode}try{f1(i,o)}catch(E){St(c,c.return,E)}}break;case 27:o===null&&f&4&&Rw(c);case 26:case 5:es(i,c),o===null&&f&4&&kw(c),f&512&&kc(c,c.return);break;case 12:es(i,c);break;case 31:es(i,c),f&4&&Dw(i,c);break;case 13:es(i,c),f&4&&Ow(i,c),f&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=I4.bind(null,c),sO(i,c))));break;case 22:if(f=c.memoizedState!==null||Qi,!f){o=o!==null&&o.memoizedState!==null||sn,v=Qi;var x=sn;Qi=f,(sn=o)&&!x?ts(i,c,(c.subtreeFlags&8772)!==0):es(i,c),Qi=v,sn=x}break;case 30:break;default:es(i,c)}}function Nw(i){var o=i.alternate;o!==null&&(i.alternate=null,Nw(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&Jp(o)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Ft=null,cr=!1;function Ji(i,o,c){for(c=c.child;c!==null;)Aw(i,o,c),c=c.sibling}function Aw(i,o,c){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(Ge,c)}catch{}switch(c.tag){case 26:sn||xi(c,o),Ji(i,o,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:sn||xi(c,o);var f=Ft,v=cr;Fs(c.type)&&(Ft=c.stateNode,cr=!1),Ji(i,o,c),jc(c.stateNode),Ft=f,cr=v;break;case 5:sn||xi(c,o);case 6:if(f=Ft,v=cr,Ft=null,Ji(i,o,c),Ft=f,cr=v,Ft!==null)if(cr)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(c.stateNode)}catch(x){St(c,o,x)}else try{Ft.removeChild(c.stateNode)}catch(x){St(c,o,x)}break;case 18:Ft!==null&&(cr?(i=Ft,SS(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),tl(i)):SS(Ft,c.stateNode));break;case 4:f=Ft,v=cr,Ft=c.stateNode.containerInfo,cr=!0,Ji(i,o,c),Ft=f,cr=v;break;case 0:case 11:case 14:case 15:js(2,c,o),sn||js(4,c,o),Ji(i,o,c);break;case 1:sn||(xi(c,o),f=c.stateNode,typeof f.componentWillUnmount=="function"&&Cw(c,o,f)),Ji(i,o,c);break;case 21:Ji(i,o,c);break;case 22:sn=(f=sn)||c.memoizedState!==null,Ji(i,o,c),sn=f;break;default:Ji(i,o,c)}}function Dw(i,o){if(o.memoizedState===null&&(i=o.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{tl(i)}catch(c){St(o,o.return,c)}}}function Ow(i,o){if(o.memoizedState===null&&(i=o.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{tl(i)}catch(c){St(o,o.return,c)}}function A4(i){switch(i.tag){case 31:case 13:case 19:var o=i.stateNode;return o===null&&(o=i.stateNode=new Tw),o;case 22:return i=i.stateNode,o=i._retryCache,o===null&&(o=i._retryCache=new Tw),o;default:throw Error(r(435,i.tag))}}function nh(i,o){var c=A4(i);o.forEach(function(f){if(!c.has(f)){c.add(f);var v=H4.bind(null,i,f);f.then(v,v)}})}function ur(i,o){var c=o.deletions;if(c!==null)for(var f=0;f<c.length;f++){var v=c[f],x=i,E=o,A=E;e:for(;A!==null;){switch(A.tag){case 27:if(Fs(A.type)){Ft=A.stateNode,cr=!1;break e}break;case 5:Ft=A.stateNode,cr=!1;break e;case 3:case 4:Ft=A.stateNode.containerInfo,cr=!0;break e}A=A.return}if(Ft===null)throw Error(r(160));Aw(x,E,v),Ft=null,cr=!1,x=v.alternate,x!==null&&(x.return=null),v.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)jw(o,i),o=o.sibling}var ii=null;function jw(i,o){var c=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:ur(o,i),dr(i),f&4&&(js(3,i,i.return),Cc(3,i),js(5,i,i.return));break;case 1:ur(o,i),dr(i),f&512&&(sn||c===null||xi(c,c.return)),f&64&&Qi&&(i=i.updateQueue,i!==null&&(f=i.callbacks,f!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var v=ii;if(ur(o,i),dr(i),f&512&&(sn||c===null||xi(c,c.return)),f&4){var x=c!==null?c.memoizedState:null;if(f=i.memoizedState,c===null)if(f===null)if(i.stateNode===null){e:{f=i.type,c=i.memoizedProps,v=v.ownerDocument||v;t:switch(f){case"title":x=v.getElementsByTagName("title")[0],(!x||x[Ql]||x[jn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=v.createElement(f),v.head.insertBefore(x,v.querySelector("head > title"))),Bn(x,f,c),x[jn]=i,xn(x),f=x;break e;case"link":var E=jS("link","href",v).get(f+(c.href||""));if(E){for(var A=0;A<E.length;A++)if(x=E[A],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){E.splice(A,1);break t}}x=v.createElement(f),Bn(x,f,c),v.head.appendChild(x);break;case"meta":if(E=jS("meta","content",v).get(f+(c.content||""))){for(A=0;A<E.length;A++)if(x=E[A],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){E.splice(A,1);break t}}x=v.createElement(f),Bn(x,f,c),v.head.appendChild(x);break;default:throw Error(r(468,f))}x[jn]=i,xn(x),f=x}i.stateNode=f}else LS(v,i.type,i.stateNode);else i.stateNode=OS(v,f,i.memoizedProps);else x!==f?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,f===null?LS(v,i.type,i.stateNode):OS(v,f,i.memoizedProps)):f===null&&i.stateNode!==null&&bg(i,i.memoizedProps,c.memoizedProps)}break;case 27:ur(o,i),dr(i),f&512&&(sn||c===null||xi(c,c.return)),c!==null&&f&4&&bg(i,i.memoizedProps,c.memoizedProps);break;case 5:if(ur(o,i),dr(i),f&512&&(sn||c===null||xi(c,c.return)),i.flags&32){v=i.stateNode;try{Ca(v,"")}catch(De){St(i,i.return,De)}}f&4&&i.stateNode!=null&&(v=i.memoizedProps,bg(i,v,c!==null?c.memoizedProps:v)),f&1024&&(Sg=!0);break;case 6:if(ur(o,i),dr(i),f&4){if(i.stateNode===null)throw Error(r(162));f=i.memoizedProps,c=i.stateNode;try{c.nodeValue=f}catch(De){St(i,i.return,De)}}break;case 3:if(_h=null,v=ii,ii=gh(o.containerInfo),ur(o,i),ii=v,dr(i),f&4&&c!==null&&c.memoizedState.isDehydrated)try{tl(o.containerInfo)}catch(De){St(i,i.return,De)}Sg&&(Sg=!1,Lw(i));break;case 4:f=ii,ii=gh(i.stateNode.containerInfo),ur(o,i),dr(i),ii=f;break;case 12:ur(o,i),dr(i);break;case 31:ur(o,i),dr(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,nh(i,f)));break;case 13:ur(o,i),dr(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(ih=Nt()),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,nh(i,f)));break;case 22:v=i.memoizedState!==null;var K=c!==null&&c.memoizedState!==null,ne=Qi,fe=sn;if(Qi=ne||v,sn=fe||K,ur(o,i),sn=fe,Qi=ne,dr(i),f&8192)e:for(o=i.stateNode,o._visibility=v?o._visibility&-2:o._visibility|1,v&&(c===null||K||Qi||sn||zo(i)),c=null,o=i;;){if(o.tag===5||o.tag===26){if(c===null){K=c=o;try{if(x=K.stateNode,v)E=x.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{A=K.stateNode;var _e=K.memoizedProps.style,se=_e!=null&&_e.hasOwnProperty("display")?_e.display:null;A.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(De){St(K,K.return,De)}}}else if(o.tag===6){if(c===null){K=o;try{K.stateNode.nodeValue=v?"":K.memoizedProps}catch(De){St(K,K.return,De)}}}else if(o.tag===18){if(c===null){K=o;try{var ce=K.stateNode;v?CS(ce,!0):CS(K.stateNode,!1)}catch(De){St(K,K.return,De)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===i)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break e;for(;o.sibling===null;){if(o.return===null||o.return===i)break e;c===o&&(c=null),o=o.return}c===o&&(c=null),o.sibling.return=o.return,o=o.sibling}f&4&&(f=i.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,nh(i,c))));break;case 19:ur(o,i),dr(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,nh(i,f)));break;case 30:break;case 21:break;default:ur(o,i),dr(i)}}function dr(i){var o=i.flags;if(o&2){try{for(var c,f=i.return;f!==null;){if(Ew(f)){c=f;break}f=f.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var v=c.stateNode,x=xg(i);th(i,x,v);break;case 5:var E=c.stateNode;c.flags&32&&(Ca(E,""),c.flags&=-33);var A=xg(i);th(i,A,E);break;case 3:case 4:var K=c.stateNode.containerInfo,ne=xg(i);wg(i,ne,K);break;default:throw Error(r(161))}}catch(fe){St(i,i.return,fe)}i.flags&=-3}o&4096&&(i.flags&=-4097)}function Lw(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var o=i;Lw(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),i=i.sibling}}function es(i,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)Mw(i,o.alternate,o),o=o.sibling}function zo(i){for(i=i.child;i!==null;){var o=i;switch(o.tag){case 0:case 11:case 14:case 15:js(4,o,o.return),zo(o);break;case 1:xi(o,o.return);var c=o.stateNode;typeof c.componentWillUnmount=="function"&&Cw(o,o.return,c),zo(o);break;case 27:jc(o.stateNode);case 26:case 5:xi(o,o.return),zo(o);break;case 22:o.memoizedState===null&&zo(o);break;case 30:zo(o);break;default:zo(o)}i=i.sibling}}function ts(i,o,c){for(c=c&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var f=o.alternate,v=i,x=o,E=x.flags;switch(x.tag){case 0:case 11:case 15:ts(v,x,c),Cc(4,x);break;case 1:if(ts(v,x,c),f=x,v=f.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ne){St(f,f.return,ne)}if(f=x,v=f.updateQueue,v!==null){var A=f.stateNode;try{var K=v.shared.hiddenCallbacks;if(K!==null)for(v.shared.hiddenCallbacks=null,v=0;v<K.length;v++)h1(K[v],A)}catch(ne){St(f,f.return,ne)}}c&&E&64&&Sw(x),kc(x,x.return);break;case 27:Rw(x);case 26:case 5:ts(v,x,c),c&&f===null&&E&4&&kw(x),kc(x,x.return);break;case 12:ts(v,x,c);break;case 31:ts(v,x,c),c&&E&4&&Dw(v,x);break;case 13:ts(v,x,c),c&&E&4&&Ow(v,x);break;case 22:x.memoizedState===null&&ts(v,x,c),kc(x,x.return);break;case 30:break;default:ts(v,x,c)}o=o.sibling}}function Cg(i,o){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(i=o.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&dc(c))}function kg(i,o){i=null,o.alternate!==null&&(i=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==i&&(o.refCount++,i!=null&&dc(i))}function si(i,o,c,f){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)zw(i,o,c,f),o=o.sibling}function zw(i,o,c,f){var v=o.flags;switch(o.tag){case 0:case 11:case 15:si(i,o,c,f),v&2048&&Cc(9,o);break;case 1:si(i,o,c,f);break;case 3:si(i,o,c,f),v&2048&&(i=null,o.alternate!==null&&(i=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==i&&(o.refCount++,i!=null&&dc(i)));break;case 12:if(v&2048){si(i,o,c,f),i=o.stateNode;try{var x=o.memoizedProps,E=x.id,A=x.onPostCommit;typeof A=="function"&&A(E,o.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(K){St(o,o.return,K)}}else si(i,o,c,f);break;case 31:si(i,o,c,f);break;case 13:si(i,o,c,f);break;case 23:break;case 22:x=o.stateNode,E=o.alternate,o.memoizedState!==null?x._visibility&2?si(i,o,c,f):Ec(i,o):x._visibility&2?si(i,o,c,f):(x._visibility|=2,Wa(i,o,c,f,(o.subtreeFlags&10256)!==0||!1)),v&2048&&Cg(E,o);break;case 24:si(i,o,c,f),v&2048&&kg(o.alternate,o);break;default:si(i,o,c,f)}}function Wa(i,o,c,f,v){for(v=v&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var x=i,E=o,A=c,K=f,ne=E.flags;switch(E.tag){case 0:case 11:case 15:Wa(x,E,A,K,v),Cc(8,E);break;case 23:break;case 22:var fe=E.stateNode;E.memoizedState!==null?fe._visibility&2?Wa(x,E,A,K,v):Ec(x,E):(fe._visibility|=2,Wa(x,E,A,K,v)),v&&ne&2048&&Cg(E.alternate,E);break;case 24:Wa(x,E,A,K,v),v&&ne&2048&&kg(E.alternate,E);break;default:Wa(x,E,A,K,v)}o=o.sibling}}function Ec(i,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var c=i,f=o,v=f.flags;switch(f.tag){case 22:Ec(c,f),v&2048&&Cg(f.alternate,f);break;case 24:Ec(c,f),v&2048&&kg(f.alternate,f);break;default:Ec(c,f)}o=o.sibling}}var Rc=8192;function Va(i,o,c){if(i.subtreeFlags&Rc)for(i=i.child;i!==null;)Pw(i,o,c),i=i.sibling}function Pw(i,o,c){switch(i.tag){case 26:Va(i,o,c),i.flags&Rc&&i.memoizedState!==null&&vO(c,ii,i.memoizedState,i.memoizedProps);break;case 5:Va(i,o,c);break;case 3:case 4:var f=ii;ii=gh(i.stateNode.containerInfo),Va(i,o,c),ii=f;break;case 22:i.memoizedState===null&&(f=i.alternate,f!==null&&f.memoizedState!==null?(f=Rc,Rc=16777216,Va(i,o,c),Rc=f):Va(i,o,c));break;default:Va(i,o,c)}}function Bw(i){var o=i.alternate;if(o!==null&&(i=o.child,i!==null)){o.child=null;do o=i.sibling,i.sibling=null,i=o;while(i!==null)}}function Tc(i){var o=i.deletions;if((i.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var f=o[c];wn=f,Hw(f,i)}Bw(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Iw(i),i=i.sibling}function Iw(i){switch(i.tag){case 0:case 11:case 15:Tc(i),i.flags&2048&&js(9,i,i.return);break;case 3:Tc(i);break;case 12:Tc(i);break;case 22:var o=i.stateNode;i.memoizedState!==null&&o._visibility&2&&(i.return===null||i.return.tag!==13)?(o._visibility&=-3,rh(i)):Tc(i);break;default:Tc(i)}}function rh(i){var o=i.deletions;if((i.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var f=o[c];wn=f,Hw(f,i)}Bw(i)}for(i=i.child;i!==null;){switch(o=i,o.tag){case 0:case 11:case 15:js(8,o,o.return),rh(o);break;case 22:c=o.stateNode,c._visibility&2&&(c._visibility&=-3,rh(o));break;default:rh(o)}i=i.sibling}}function Hw(i,o){for(;wn!==null;){var c=wn;switch(c.tag){case 0:case 11:case 15:js(8,c,o);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:dc(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,wn=f;else e:for(c=i;wn!==null;){f=wn;var v=f.sibling,x=f.return;if(Nw(f),f===c){wn=null;break e}if(v!==null){v.return=x,wn=v;break e}wn=x}}}var D4={getCacheForType:function(i){var o=zn(tn),c=o.data.get(i);return c===void 0&&(c=i(),o.data.set(i,c)),c},cacheSignal:function(){return zn(tn).controller.signal}},O4=typeof WeakMap=="function"?WeakMap:Map,gt=0,At=null,et=null,it=0,wt=0,Cr=null,Ls=!1,qa=!1,Eg=!1,ns=0,Kt=0,zs=0,Po=0,Rg=0,kr=0,Ka=0,Mc=null,hr=null,Tg=!1,ih=0,Fw=0,sh=1/0,oh=null,Ps=null,fn=0,Bs=null,Ga=null,rs=0,Mg=0,Ng=null,Uw=null,Nc=0,Ag=null;function Er(){return(gt&2)!==0&&it!==0?it&-it:z.T!==null?Pg():ni()}function $w(){if(kr===0)if((it&536870912)===0||ot){var i=Zn;Zn<<=1,(Zn&3932160)===0&&(Zn=262144),kr=i}else kr=536870912;return i=wr.current,i!==null&&(i.flags|=32),kr}function fr(i,o,c){(i===At&&(wt===2||wt===9)||i.cancelPendingCommit!==null)&&(Ya(i,0),Is(i,it,kr,!1)),re(i,c),((gt&2)===0||i!==At)&&(i===At&&((gt&2)===0&&(Po|=c),Kt===4&&Is(i,it,kr,!1)),wi(i))}function Ww(i,o,c){if((gt&6)!==0)throw Error(r(327));var f=!c&&(o&127)===0&&(o&i.expiredLanes)===0||Un(i,o),v=f?z4(i,o):Og(i,o,!0),x=f;do{if(v===0){qa&&!f&&Is(i,o,0,!1);break}else{if(c=i.current.alternate,x&&!j4(c)){v=Og(i,o,!1),x=!1;continue}if(v===2){if(x=o,i.errorRecoveryDisabledLanes&x)var E=0;else E=i.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){o=E;e:{var A=i;v=Mc;var K=A.current.memoizedState.isDehydrated;if(K&&(Ya(A,E).flags|=256),E=Og(A,E,!1),E!==2){if(Eg&&!K){A.errorRecoveryDisabledLanes|=x,Po|=x,v=4;break e}x=hr,hr=v,x!==null&&(hr===null?hr=x:hr.push.apply(hr,x))}v=E}if(x=!1,v!==2)continue}}if(v===1){Ya(i,0),Is(i,o,0,!0);break}e:{switch(f=i,x=v,x){case 0:case 1:throw Error(r(345));case 4:if((o&4194048)!==o)break;case 6:Is(f,o,kr,!Ls);break e;case 2:hr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((o&62914560)===o&&(v=ih+300-Nt(),10<v)){if(Is(f,o,kr,!Ls),Pt(f,0,!0)!==0)break e;rs=o,f.timeoutHandle=xS(Vw.bind(null,f,c,hr,oh,Tg,o,kr,Po,Ka,Ls,x,"Throttled",-0,0),v);break e}Vw(f,c,hr,oh,Tg,o,kr,Po,Ka,Ls,x,null,-0,0)}}break}while(!0);wi(i)}function Vw(i,o,c,f,v,x,E,A,K,ne,fe,_e,se,ce){if(i.timeoutHandle=-1,_e=o.subtreeFlags,_e&8192||(_e&16785408)===16785408){_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ui},Pw(o,x,_e);var De=(x&62914560)===x?ih-Nt():(x&4194048)===x?Fw-Nt():0;if(De=_O(_e,De),De!==null){rs=x,i.cancelPendingCommit=De(Jw.bind(null,i,o,x,c,f,v,E,A,K,fe,_e,null,se,ce)),Is(i,x,E,!ne);return}}Jw(i,o,x,c,f,v,E,A,K)}function j4(i){for(var o=i;;){var c=o.tag;if((c===0||c===11||c===15)&&o.flags&16384&&(c=o.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var v=c[f],x=v.getSnapshot;v=v.value;try{if(!br(x(),v))return!1}catch{return!1}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Is(i,o,c,f){o&=~Rg,o&=~Po,i.suspendedLanes|=o,i.pingedLanes&=~o,f&&(i.warmLanes|=o),f=i.expirationTimes;for(var v=o;0<v;){var x=31-Te(v),E=1<<x;f[x]=-1,v&=~E}c!==0&&Ue(i,c,o)}function ah(){return(gt&6)===0?(Ac(0),!1):!0}function Dg(){if(et!==null){if(wt===0)var i=et.return;else i=et,qi=To=null,Gm(i),Ia=null,fc=0,i=et;for(;i!==null;)ww(i.alternate,i),i=i.return;et=null}}function Ya(i,o){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,eO(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),rs=0,Dg(),At=i,et=c=Wi(i.current,null),it=o,wt=0,Cr=null,Ls=!1,qa=Un(i,o),Eg=!1,Ka=kr=Rg=Po=zs=Kt=0,hr=Mc=null,Tg=!1,(o&8)!==0&&(o|=o&32);var f=i.entangledLanes;if(f!==0)for(i=i.entanglements,f&=o;0<f;){var v=31-Te(f),x=1<<v;o|=i[v],f&=~x}return ns=o,Td(),c}function qw(i,o){Ve=null,z.H=xc,o===Ba||o===zd?(o=l1(),wt=3):o===zm?(o=l1(),wt=4):wt=o===ug?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Cr=o,et===null&&(Kt=1,Xd(i,Br(o,i.current)))}function Kw(){var i=wr.current;return i===null?!0:(it&4194048)===it?Ur===null:(it&62914560)===it||(it&536870912)!==0?i===Ur:!1}function Gw(){var i=z.H;return z.H=xc,i===null?xc:i}function Yw(){var i=z.A;return z.A=D4,i}function lh(){Kt=4,Ls||(it&4194048)!==it&&wr.current!==null||(qa=!0),(zs&134217727)===0&&(Po&134217727)===0||At===null||Is(At,it,kr,!1)}function Og(i,o,c){var f=gt;gt|=2;var v=Gw(),x=Yw();(At!==i||it!==o)&&(oh=null,Ya(i,o)),o=!1;var E=Kt;e:do try{if(wt!==0&&et!==null){var A=et,K=Cr;switch(wt){case 8:Dg(),E=6;break e;case 3:case 2:case 9:case 6:wr.current===null&&(o=!0);var ne=wt;if(wt=0,Cr=null,Xa(i,A,K,ne),c&&qa){E=0;break e}break;default:ne=wt,wt=0,Cr=null,Xa(i,A,K,ne)}}L4(),E=Kt;break}catch(fe){qw(i,fe)}while(!0);return o&&i.shellSuspendCounter++,qi=To=null,gt=f,z.H=v,z.A=x,et===null&&(At=null,it=0,Td()),E}function L4(){for(;et!==null;)Xw(et)}function z4(i,o){var c=gt;gt|=2;var f=Gw(),v=Yw();At!==i||it!==o?(oh=null,sh=Nt()+500,Ya(i,o)):qa=Un(i,o);e:do try{if(wt!==0&&et!==null){o=et;var x=Cr;t:switch(wt){case 1:wt=0,Cr=null,Xa(i,o,x,1);break;case 2:case 9:if(o1(x)){wt=0,Cr=null,Zw(o);break}o=function(){wt!==2&&wt!==9||At!==i||(wt=7),wi(i)},x.then(o,o);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:o1(x)?(wt=0,Cr=null,Zw(o)):(wt=0,Cr=null,Xa(i,o,x,7));break;case 5:var E=null;switch(et.tag){case 26:E=et.memoizedState;case 5:case 27:var A=et;if(E?zS(E):A.stateNode.complete){wt=0,Cr=null;var K=A.sibling;if(K!==null)et=K;else{var ne=A.return;ne!==null?(et=ne,ch(ne)):et=null}break t}}wt=0,Cr=null,Xa(i,o,x,5);break;case 6:wt=0,Cr=null,Xa(i,o,x,6);break;case 8:Dg(),Kt=6;break e;default:throw Error(r(462))}}P4();break}catch(fe){qw(i,fe)}while(!0);return qi=To=null,z.H=f,z.A=v,gt=c,et!==null?0:(At=null,it=0,Td(),Kt)}function P4(){for(;et!==null&&!en();)Xw(et)}function Xw(i){var o=bw(i.alternate,i,ns);i.memoizedProps=i.pendingProps,o===null?ch(i):et=o}function Zw(i){var o=i,c=o.alternate;switch(o.tag){case 15:case 0:o=pw(c,o,o.pendingProps,o.type,void 0,it);break;case 11:o=pw(c,o,o.pendingProps,o.type.render,o.ref,it);break;case 5:Gm(o);default:ww(c,o),o=et=Yx(o,ns),o=bw(c,o,ns)}i.memoizedProps=i.pendingProps,o===null?ch(i):et=o}function Xa(i,o,c,f){qi=To=null,Gm(o),Ia=null,fc=0;var v=o.return;try{if(k4(i,v,o,c,it)){Kt=1,Xd(i,Br(c,i.current)),et=null;return}}catch(x){if(v!==null)throw et=v,x;Kt=1,Xd(i,Br(c,i.current)),et=null;return}o.flags&32768?(ot||f===1?i=!0:qa||(it&536870912)!==0?i=!1:(Ls=i=!0,(f===2||f===9||f===3||f===6)&&(f=wr.current,f!==null&&f.tag===13&&(f.flags|=16384))),Qw(o,i)):ch(o)}function ch(i){var o=i;do{if((o.flags&32768)!==0){Qw(o,Ls);return}i=o.return;var c=T4(o.alternate,o,ns);if(c!==null){et=c;return}if(o=o.sibling,o!==null){et=o;return}et=o=i}while(o!==null);Kt===0&&(Kt=5)}function Qw(i,o){do{var c=M4(i.alternate,i);if(c!==null){c.flags&=32767,et=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!o&&(i=i.sibling,i!==null)){et=i;return}et=i=c}while(i!==null);Kt=6,et=null}function Jw(i,o,c,f,v,x,E,A,K){i.cancelPendingCommit=null;do uh();while(fn!==0);if((gt&6)!==0)throw Error(r(327));if(o!==null){if(o===i.current)throw Error(r(177));if(x=o.lanes|o.childLanes,x|=xm,ve(i,c,x,E,A,K),i===At&&(et=At=null,it=0),Ga=o,Bs=i,rs=c,Mg=x,Ng=v,Uw=f,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,F4(Ee,function(){return iS(),null})):(i.callbackNode=null,i.callbackPriority=0),f=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||f){f=z.T,z.T=null,v=$.p,$.p=2,E=gt,gt|=4;try{N4(i,o,c)}finally{gt=E,$.p=v,z.T=f}}fn=1,eS(),tS(),nS()}}function eS(){if(fn===1){fn=0;var i=Bs,o=Ga,c=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||c){c=z.T,z.T=null;var f=$.p;$.p=2;var v=gt;gt|=4;try{jw(o,i);var x=Vg,E=Hx(i.containerInfo),A=x.focusedElem,K=x.selectionRange;if(E!==A&&A&&A.ownerDocument&&Ix(A.ownerDocument.documentElement,A)){if(K!==null&&gm(A)){var ne=K.start,fe=K.end;if(fe===void 0&&(fe=ne),"selectionStart"in A)A.selectionStart=ne,A.selectionEnd=Math.min(fe,A.value.length);else{var _e=A.ownerDocument||document,se=_e&&_e.defaultView||window;if(se.getSelection){var ce=se.getSelection(),De=A.textContent.length,Ie=Math.min(K.start,De),Rt=K.end===void 0?Ie:Math.min(K.end,De);!ce.extend&&Ie>Rt&&(E=Rt,Rt=Ie,Ie=E);var J=Bx(A,Ie),X=Bx(A,Rt);if(J&&X&&(ce.rangeCount!==1||ce.anchorNode!==J.node||ce.anchorOffset!==J.offset||ce.focusNode!==X.node||ce.focusOffset!==X.offset)){var te=_e.createRange();te.setStart(J.node,J.offset),ce.removeAllRanges(),Ie>Rt?(ce.addRange(te),ce.extend(X.node,X.offset)):(te.setEnd(X.node,X.offset),ce.addRange(te))}}}}for(_e=[],ce=A;ce=ce.parentNode;)ce.nodeType===1&&_e.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<_e.length;A++){var ge=_e[A];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}wh=!!Wg,Vg=Wg=null}finally{gt=v,$.p=f,z.T=c}}i.current=o,fn=2}}function tS(){if(fn===2){fn=0;var i=Bs,o=Ga,c=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||c){c=z.T,z.T=null;var f=$.p;$.p=2;var v=gt;gt|=4;try{Mw(i,o.alternate,o)}finally{gt=v,$.p=f,z.T=c}}fn=3}}function nS(){if(fn===4||fn===3){fn=0,bn();var i=Bs,o=Ga,c=rs,f=Uw;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?fn=5:(fn=0,Ga=Bs=null,rS(i,i.pendingLanes));var v=i.pendingLanes;if(v===0&&(Ps=null),Hi(c),o=o.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(Ge,o,void 0,(o.current.flags&128)===128)}catch{}if(f!==null){o=z.T,v=$.p,$.p=2,z.T=null;try{for(var x=i.onRecoverableError,E=0;E<f.length;E++){var A=f[E];x(A.value,{componentStack:A.stack})}}finally{z.T=o,$.p=v}}(rs&3)!==0&&uh(),wi(i),v=i.pendingLanes,(c&261930)!==0&&(v&42)!==0?i===Ag?Nc++:(Nc=0,Ag=i):Nc=0,Ac(0)}}function rS(i,o){(i.pooledCacheLanes&=o)===0&&(o=i.pooledCache,o!=null&&(i.pooledCache=null,dc(o)))}function uh(){return eS(),tS(),nS(),iS()}function iS(){if(fn!==5)return!1;var i=Bs,o=Mg;Mg=0;var c=Hi(rs),f=z.T,v=$.p;try{$.p=32>c?32:c,z.T=null,c=Ng,Ng=null;var x=Bs,E=rs;if(fn=0,Ga=Bs=null,rs=0,(gt&6)!==0)throw Error(r(331));var A=gt;if(gt|=4,Iw(x.current),zw(x,x.current,E,c),gt=A,Ac(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(Ge,x)}catch{}return!0}finally{$.p=v,z.T=f,rS(i,o)}}function sS(i,o,c){o=Br(c,o),o=cg(i.stateNode,o,2),i=As(i,o,2),i!==null&&(re(i,2),wi(i))}function St(i,o,c){if(i.tag===3)sS(i,i,c);else for(;o!==null;){if(o.tag===3){sS(o,i,c);break}else if(o.tag===1){var f=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ps===null||!Ps.has(f))){i=Br(c,i),c=ow(2),f=As(o,c,2),f!==null&&(aw(c,f,o,i),re(f,2),wi(f));break}}o=o.return}}function jg(i,o,c){var f=i.pingCache;if(f===null){f=i.pingCache=new O4;var v=new Set;f.set(o,v)}else v=f.get(o),v===void 0&&(v=new Set,f.set(o,v));v.has(c)||(Eg=!0,v.add(c),i=B4.bind(null,i,o,c),o.then(i,i))}function B4(i,o,c){var f=i.pingCache;f!==null&&f.delete(o),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,At===i&&(it&c)===c&&(Kt===4||Kt===3&&(it&62914560)===it&&300>Nt()-ih?(gt&2)===0&&Ya(i,0):Rg|=c,Ka===it&&(Ka=0)),wi(i)}function oS(i,o){o===0&&(o=hn()),i=ko(i,o),i!==null&&(re(i,o),wi(i))}function I4(i){var o=i.memoizedState,c=0;o!==null&&(c=o.retryLane),oS(i,c)}function H4(i,o){var c=0;switch(i.tag){case 31:case 13:var f=i.stateNode,v=i.memoizedState;v!==null&&(c=v.retryLane);break;case 19:f=i.stateNode;break;case 22:f=i.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(o),oS(i,c)}function F4(i,o){return yt(i,o)}var dh=null,Za=null,Lg=!1,hh=!1,zg=!1,Hs=0;function wi(i){i!==Za&&i.next===null&&(Za===null?dh=Za=i:Za=Za.next=i),hh=!0,Lg||(Lg=!0,$4())}function Ac(i,o){if(!zg&&hh){zg=!0;do for(var c=!1,f=dh;f!==null;){if(i!==0){var v=f.pendingLanes;if(v===0)var x=0;else{var E=f.suspendedLanes,A=f.pingedLanes;x=(1<<31-Te(42|i)+1)-1,x&=v&~(E&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,uS(f,x))}else x=it,x=Pt(f,f===At?x:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(x&3)===0||Un(f,x)||(c=!0,uS(f,x));f=f.next}while(c);zg=!1}}function U4(){aS()}function aS(){hh=Lg=!1;var i=0;Hs!==0&&J4()&&(i=Hs);for(var o=Nt(),c=null,f=dh;f!==null;){var v=f.next,x=lS(f,o);x===0?(f.next=null,c===null?dh=v:c.next=v,v===null&&(Za=c)):(c=f,(i!==0||(x&3)!==0)&&(hh=!0)),f=v}fn!==0&&fn!==5||Ac(i),Hs!==0&&(Hs=0)}function lS(i,o){for(var c=i.suspendedLanes,f=i.pingedLanes,v=i.expirationTimes,x=i.pendingLanes&-62914561;0<x;){var E=31-Te(x),A=1<<E,K=v[E];K===-1?((A&c)===0||(A&f)!==0)&&(v[E]=Dn(A,o)):K<=o&&(i.expiredLanes|=A),x&=~A}if(o=At,c=it,c=Pt(i,i===o?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f=i.callbackNode,c===0||i===o&&(wt===2||wt===9)||i.cancelPendingCommit!==null)return f!==null&&f!==null&&un(f),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||Un(i,c)){if(o=c&-c,o===i.callbackPriority)return o;switch(f!==null&&un(f),Hi(c)){case 2:case 8:c=oe;break;case 32:c=Ee;break;case 268435456:c=Fe;break;default:c=Ee}return f=cS.bind(null,i),c=yt(c,f),i.callbackPriority=o,i.callbackNode=c,o}return f!==null&&f!==null&&un(f),i.callbackPriority=2,i.callbackNode=null,2}function cS(i,o){if(fn!==0&&fn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(uh()&&i.callbackNode!==c)return null;var f=it;return f=Pt(i,i===At?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f===0?null:(Ww(i,f,o),lS(i,Nt()),i.callbackNode!=null&&i.callbackNode===c?cS.bind(null,i):null)}function uS(i,o){if(uh())return null;Ww(i,o,!0)}function $4(){tO(function(){(gt&6)!==0?yt(Y,U4):aS()})}function Pg(){if(Hs===0){var i=za;i===0&&(i=Xn,Xn<<=1,(Xn&261888)===0&&(Xn=256)),Hs=i}return Hs}function dS(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:bd(""+i)}function hS(i,o){var c=o.ownerDocument.createElement("input");return c.name=o.name,c.value=o.value,i.id&&c.setAttribute("form",i.id),o.parentNode.insertBefore(c,o),i=new FormData(i),c.parentNode.removeChild(c),i}function W4(i,o,c,f,v){if(o==="submit"&&c&&c.stateNode===v){var x=dS((v[ar]||null).action),E=f.submitter;E&&(o=(o=E[ar]||null)?dS(o.formAction):E.getAttribute("formAction"),o!==null&&(x=o,E=null));var A=new Cd("action","action",null,f,v);i.push({event:A,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Hs!==0){var K=E?hS(v,E):new FormData(v);rg(c,{pending:!0,data:K,method:v.method,action:x},null,K)}}else typeof x=="function"&&(A.preventDefault(),K=E?hS(v,E):new FormData(v),rg(c,{pending:!0,data:K,method:v.method,action:x},x,K))},currentTarget:v}]})}}for(var Bg=0;Bg<bm.length;Bg++){var Ig=bm[Bg],V4=Ig.toLowerCase(),q4=Ig[0].toUpperCase()+Ig.slice(1);ri(V4,"on"+q4)}ri($x,"onAnimationEnd"),ri(Wx,"onAnimationIteration"),ri(Vx,"onAnimationStart"),ri("dblclick","onDoubleClick"),ri("focusin","onFocus"),ri("focusout","onBlur"),ri(l4,"onTransitionRun"),ri(c4,"onTransitionStart"),ri(u4,"onTransitionCancel"),ri(qx,"onTransitionEnd"),wa("onMouseEnter",["mouseout","mouseover"]),wa("onMouseLeave",["mouseout","mouseover"]),wa("onPointerEnter",["pointerout","pointerover"]),wa("onPointerLeave",["pointerout","pointerover"]),xo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xo("onBeforeInput",["compositionend","keypress","textInput","paste"]),xo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dc="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(" "),K4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Dc));function fS(i,o){o=(o&4)!==0;for(var c=0;c<i.length;c++){var f=i[c],v=f.event;f=f.listeners;e:{var x=void 0;if(o)for(var E=f.length-1;0<=E;E--){var A=f[E],K=A.instance,ne=A.currentTarget;if(A=A.listener,K!==x&&v.isPropagationStopped())break e;x=A,v.currentTarget=ne;try{x(v)}catch(fe){Rd(fe)}v.currentTarget=null,x=K}else for(E=0;E<f.length;E++){if(A=f[E],K=A.instance,ne=A.currentTarget,A=A.listener,K!==x&&v.isPropagationStopped())break e;x=A,v.currentTarget=ne;try{x(v)}catch(fe){Rd(fe)}v.currentTarget=null,x=K}}}}function tt(i,o){var c=o[Qp];c===void 0&&(c=o[Qp]=new Set);var f=i+"__bubble";c.has(f)||(pS(o,i,2,!1),c.add(f))}function Hg(i,o,c){var f=0;o&&(f|=4),pS(c,i,f,o)}var fh="_reactListening"+Math.random().toString(36).slice(2);function Fg(i){if(!i[fh]){i[fh]=!0,ax.forEach(function(c){c!=="selectionchange"&&(K4.has(c)||Hg(c,!1,i),Hg(c,!0,i))});var o=i.nodeType===9?i:i.ownerDocument;o===null||o[fh]||(o[fh]=!0,Hg("selectionchange",!1,o))}}function pS(i,o,c,f){switch($S(o)){case 2:var v=xO;break;case 8:v=wO;break;default:v=nv}c=v.bind(null,o,c,i),v=void 0,!am||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),f?v!==void 0?i.addEventListener(o,c,{capture:!0,passive:v}):i.addEventListener(o,c,!0):v!==void 0?i.addEventListener(o,c,{passive:v}):i.addEventListener(o,c,!1)}function Ug(i,o,c,f,v){var x=f;if((o&1)===0&&(o&2)===0&&f!==null)e:for(;;){if(f===null)return;var E=f.tag;if(E===3||E===4){var A=f.stateNode.containerInfo;if(A===v)break;if(E===4)for(E=f.return;E!==null;){var K=E.tag;if((K===3||K===4)&&E.stateNode.containerInfo===v)return;E=E.return}for(;A!==null;){if(E=ya(A),E===null)return;if(K=E.tag,K===5||K===6||K===26||K===27){f=x=E;continue e}A=A.parentNode}}f=f.return}yx(function(){var ne=x,fe=sm(c),_e=[];e:{var se=Kx.get(i);if(se!==void 0){var ce=Cd,De=i;switch(i){case"keypress":if(wd(c)===0)break e;case"keydown":case"keyup":ce=H3;break;case"focusin":De="focus",ce=dm;break;case"focusout":De="blur",ce=dm;break;case"beforeblur":case"afterblur":ce=dm;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=wx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=T3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=$3;break;case $x:case Wx:case Vx:ce=A3;break;case qx:ce=V3;break;case"scroll":case"scrollend":ce=E3;break;case"wheel":ce=K3;break;case"copy":case"cut":case"paste":ce=O3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=Cx;break;case"toggle":case"beforetoggle":ce=Y3}var Ie=(o&4)!==0,Rt=!Ie&&(i==="scroll"||i==="scrollend"),J=Ie?se!==null?se+"Capture":null:se;Ie=[];for(var X=ne,te;X!==null;){var ge=X;if(te=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||te===null||J===null||(ge=ec(X,J),ge!=null&&Ie.push(Oc(X,ge,te))),Rt)break;X=X.return}0<Ie.length&&(se=new ce(se,De,null,c,fe),_e.push({event:se,listeners:Ie}))}}if((o&7)===0){e:{if(se=i==="mouseover"||i==="pointerover",ce=i==="mouseout"||i==="pointerout",se&&c!==im&&(De=c.relatedTarget||c.fromElement)&&(ya(De)||De[_a]))break e;if((ce||se)&&(se=fe.window===fe?fe:(se=fe.ownerDocument)?se.defaultView||se.parentWindow:window,ce?(De=c.relatedTarget||c.toElement,ce=ne,De=De?ya(De):null,De!==null&&(Rt=a(De),Ie=De.tag,De!==Rt||Ie!==5&&Ie!==27&&Ie!==6)&&(De=null)):(ce=null,De=ne),ce!==De)){if(Ie=wx,ge="onMouseLeave",J="onMouseEnter",X="mouse",(i==="pointerout"||i==="pointerover")&&(Ie=Cx,ge="onPointerLeave",J="onPointerEnter",X="pointer"),Rt=ce==null?se:Jl(ce),te=De==null?se:Jl(De),se=new Ie(ge,X+"leave",ce,c,fe),se.target=Rt,se.relatedTarget=te,ge=null,ya(fe)===ne&&(Ie=new Ie(J,X+"enter",De,c,fe),Ie.target=te,Ie.relatedTarget=Rt,ge=Ie),Rt=ge,ce&&De)t:{for(Ie=G4,J=ce,X=De,te=0,ge=J;ge;ge=Ie(ge))te++;ge=0;for(var Pe=X;Pe;Pe=Ie(Pe))ge++;for(;0<te-ge;)J=Ie(J),te--;for(;0<ge-te;)X=Ie(X),ge--;for(;te--;){if(J===X||X!==null&&J===X.alternate){Ie=J;break t}J=Ie(J),X=Ie(X)}Ie=null}else Ie=null;ce!==null&&mS(_e,se,ce,Ie,!1),De!==null&&Rt!==null&&mS(_e,Rt,De,Ie,!0)}}e:{if(se=ne?Jl(ne):window,ce=se.nodeName&&se.nodeName.toLowerCase(),ce==="select"||ce==="input"&&se.type==="file")var ht=Dx;else if(Nx(se))if(Ox)ht=s4;else{ht=r4;var Le=n4}else ce=se.nodeName,!ce||ce.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ne&&rm(ne.elementType)&&(ht=Dx):ht=i4;if(ht&&(ht=ht(i,ne))){Ax(_e,ht,c,fe);break e}Le&&Le(i,se,ne),i==="focusout"&&ne&&se.type==="number"&&ne.memoizedProps.value!=null&&nm(se,"number",se.value)}switch(Le=ne?Jl(ne):window,i){case"focusin":(Nx(Le)||Le.contentEditable==="true")&&(Ta=Le,vm=ne,lc=null);break;case"focusout":lc=vm=Ta=null;break;case"mousedown":_m=!0;break;case"contextmenu":case"mouseup":case"dragend":_m=!1,Fx(_e,c,fe);break;case"selectionchange":if(a4)break;case"keydown":case"keyup":Fx(_e,c,fe)}var qe;if(fm)e:{switch(i){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else Ra?Tx(i,c)&&(st="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(st="onCompositionStart");st&&(kx&&c.locale!=="ko"&&(Ra||st!=="onCompositionStart"?st==="onCompositionEnd"&&Ra&&(qe=bx()):(Cs=fe,lm="value"in Cs?Cs.value:Cs.textContent,Ra=!0)),Le=ph(ne,st),0<Le.length&&(st=new Sx(st,i,null,c,fe),_e.push({event:st,listeners:Le}),qe?st.data=qe:(qe=Mx(c),qe!==null&&(st.data=qe)))),(qe=Z3?Q3(i,c):J3(i,c))&&(st=ph(ne,"onBeforeInput"),0<st.length&&(Le=new Sx("onBeforeInput","beforeinput",null,c,fe),_e.push({event:Le,listeners:st}),Le.data=qe)),W4(_e,i,ne,c,fe)}fS(_e,o)})}function Oc(i,o,c){return{instance:i,listener:o,currentTarget:c}}function ph(i,o){for(var c=o+"Capture",f=[];i!==null;){var v=i,x=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||x===null||(v=ec(i,c),v!=null&&f.unshift(Oc(i,v,x)),v=ec(i,o),v!=null&&f.push(Oc(i,v,x))),i.tag===3)return f;i=i.return}return[]}function G4(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function mS(i,o,c,f,v){for(var x=o._reactName,E=[];c!==null&&c!==f;){var A=c,K=A.alternate,ne=A.stateNode;if(A=A.tag,K!==null&&K===f)break;A!==5&&A!==26&&A!==27||ne===null||(K=ne,v?(ne=ec(c,x),ne!=null&&E.unshift(Oc(c,ne,K))):v||(ne=ec(c,x),ne!=null&&E.push(Oc(c,ne,K)))),c=c.return}E.length!==0&&i.push({event:o,listeners:E})}var Y4=/\r\n?/g,X4=/\u0000|\uFFFD/g;function gS(i){return(typeof i=="string"?i:""+i).replace(Y4,`
49
+ `).replace(X4,"")}function vS(i,o){return o=gS(o),gS(i)===o}function Et(i,o,c,f,v,x){switch(c){case"children":typeof f=="string"?o==="body"||o==="textarea"&&f===""||Ca(i,f):(typeof f=="number"||typeof f=="bigint")&&o!=="body"&&Ca(i,""+f);break;case"className":_d(i,"class",f);break;case"tabIndex":_d(i,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":_d(i,c,f);break;case"style":vx(i,f,x);break;case"data":if(o!=="object"){_d(i,"data",f);break}case"src":case"href":if(f===""&&(o!=="a"||c!=="href")){i.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=bd(""+f),i.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){i.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(o!=="input"&&Et(i,o,"name",v.name,v,null),Et(i,o,"formEncType",v.formEncType,v,null),Et(i,o,"formMethod",v.formMethod,v,null),Et(i,o,"formTarget",v.formTarget,v,null)):(Et(i,o,"encType",v.encType,v,null),Et(i,o,"method",v.method,v,null),Et(i,o,"target",v.target,v,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=bd(""+f),i.setAttribute(c,f);break;case"onClick":f!=null&&(i.onclick=Ui);break;case"onScroll":f!=null&&tt("scroll",i);break;case"onScrollEnd":f!=null&&tt("scrollend",i);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(c=f.__html,c!=null){if(v.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"multiple":i.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":i.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){i.removeAttribute("xlink:href");break}c=bd(""+f),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""+f):i.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":f===!0?i.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,f):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?i.setAttribute(c,f):i.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?i.removeAttribute(c):i.setAttribute(c,f);break;case"popover":tt("beforetoggle",i),tt("toggle",i),vd(i,"popover",f);break;case"xlinkActuate":Fi(i,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Fi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Fi(i,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Fi(i,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Fi(i,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Fi(i,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Fi(i,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Fi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Fi(i,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":vd(i,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=C3.get(c)||c,vd(i,c,f))}}function $g(i,o,c,f,v,x){switch(c){case"style":vx(i,f,x);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(c=f.__html,c!=null){if(v.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"children":typeof f=="string"?Ca(i,f):(typeof f=="number"||typeof f=="bigint")&&Ca(i,""+f);break;case"onScroll":f!=null&&tt("scroll",i);break;case"onScrollEnd":f!=null&&tt("scrollend",i);break;case"onClick":f!=null&&(i.onclick=Ui);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!lx.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(v=c.endsWith("Capture"),o=c.slice(2,v?c.length-7:void 0),x=i[ar]||null,x=x!=null?x[c]:null,typeof x=="function"&&i.removeEventListener(o,x,v),typeof f=="function")){typeof x!="function"&&x!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(o,f,v);break e}c in i?i[c]=f:f===!0?i.setAttribute(c,""):vd(i,c,f)}}}function Bn(i,o,c){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",i),tt("load",i);var f=!1,v=!1,x;for(x in c)if(c.hasOwnProperty(x)){var E=c[x];if(E!=null)switch(x){case"src":f=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:Et(i,o,x,E,c,null)}}v&&Et(i,o,"srcSet",c.srcSet,c,null),f&&Et(i,o,"src",c.src,c,null);return;case"input":tt("invalid",i);var A=x=E=v=null,K=null,ne=null;for(f in c)if(c.hasOwnProperty(f)){var fe=c[f];if(fe!=null)switch(f){case"name":v=fe;break;case"type":E=fe;break;case"checked":K=fe;break;case"defaultChecked":ne=fe;break;case"value":x=fe;break;case"defaultValue":A=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,o));break;default:Et(i,o,f,fe,c,null)}}fx(i,x,A,K,ne,E,v,!1);return;case"select":tt("invalid",i),f=E=x=null;for(v in c)if(c.hasOwnProperty(v)&&(A=c[v],A!=null))switch(v){case"value":x=A;break;case"defaultValue":E=A;break;case"multiple":f=A;default:Et(i,o,v,A,c,null)}o=x,c=E,i.multiple=!!f,o!=null?Sa(i,!!f,o,!1):c!=null&&Sa(i,!!f,c,!0);return;case"textarea":tt("invalid",i),x=v=f=null;for(E in c)if(c.hasOwnProperty(E)&&(A=c[E],A!=null))switch(E){case"value":f=A;break;case"defaultValue":v=A;break;case"children":x=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:Et(i,o,E,A,c,null)}mx(i,f,v,x);return;case"option":for(K in c)if(c.hasOwnProperty(K)&&(f=c[K],f!=null))switch(K){case"selected":i.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Et(i,o,K,f,c,null)}return;case"dialog":tt("beforetoggle",i),tt("toggle",i),tt("cancel",i),tt("close",i);break;case"iframe":case"object":tt("load",i);break;case"video":case"audio":for(f=0;f<Dc.length;f++)tt(Dc[f],i);break;case"image":tt("error",i),tt("load",i);break;case"details":tt("toggle",i);break;case"embed":case"source":case"link":tt("error",i),tt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in c)if(c.hasOwnProperty(ne)&&(f=c[ne],f!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:Et(i,o,ne,f,c,null)}return;default:if(rm(o)){for(fe in c)c.hasOwnProperty(fe)&&(f=c[fe],f!==void 0&&$g(i,o,fe,f,c,void 0));return}}for(A in c)c.hasOwnProperty(A)&&(f=c[A],f!=null&&Et(i,o,A,f,c,null))}function Z4(i,o,c,f){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,x=null,E=null,A=null,K=null,ne=null,fe=null;for(ce in c){var _e=c[ce];if(c.hasOwnProperty(ce)&&_e!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":K=_e;default:f.hasOwnProperty(ce)||Et(i,o,ce,null,f,_e)}}for(var se in f){var ce=f[se];if(_e=c[se],f.hasOwnProperty(se)&&(ce!=null||_e!=null))switch(se){case"type":x=ce;break;case"name":v=ce;break;case"checked":ne=ce;break;case"defaultChecked":fe=ce;break;case"value":E=ce;break;case"defaultValue":A=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,o));break;default:ce!==_e&&Et(i,o,se,ce,f,_e)}}tm(i,E,A,K,ne,fe,x,v);return;case"select":ce=E=A=se=null;for(x in c)if(K=c[x],c.hasOwnProperty(x)&&K!=null)switch(x){case"value":break;case"multiple":ce=K;default:f.hasOwnProperty(x)||Et(i,o,x,null,f,K)}for(v in f)if(x=f[v],K=c[v],f.hasOwnProperty(v)&&(x!=null||K!=null))switch(v){case"value":se=x;break;case"defaultValue":A=x;break;case"multiple":E=x;default:x!==K&&Et(i,o,v,x,f,K)}o=A,c=E,f=ce,se!=null?Sa(i,!!c,se,!1):!!f!=!!c&&(o!=null?Sa(i,!!c,o,!0):Sa(i,!!c,c?[]:"",!1));return;case"textarea":ce=se=null;for(A in c)if(v=c[A],c.hasOwnProperty(A)&&v!=null&&!f.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Et(i,o,A,null,f,v)}for(E in f)if(v=f[E],x=c[E],f.hasOwnProperty(E)&&(v!=null||x!=null))switch(E){case"value":se=v;break;case"defaultValue":ce=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==x&&Et(i,o,E,v,f,x)}px(i,se,ce);return;case"option":for(var De in c)if(se=c[De],c.hasOwnProperty(De)&&se!=null&&!f.hasOwnProperty(De))switch(De){case"selected":i.selected=!1;break;default:Et(i,o,De,null,f,se)}for(K in f)if(se=f[K],ce=c[K],f.hasOwnProperty(K)&&se!==ce&&(se!=null||ce!=null))switch(K){case"selected":i.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Et(i,o,K,se,f,ce)}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 Ie in c)se=c[Ie],c.hasOwnProperty(Ie)&&se!=null&&!f.hasOwnProperty(Ie)&&Et(i,o,Ie,null,f,se);for(ne in f)if(se=f[ne],ce=c[ne],f.hasOwnProperty(ne)&&se!==ce&&(se!=null||ce!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,o));break;default:Et(i,o,ne,se,f,ce)}return;default:if(rm(o)){for(var Rt in c)se=c[Rt],c.hasOwnProperty(Rt)&&se!==void 0&&!f.hasOwnProperty(Rt)&&$g(i,o,Rt,void 0,f,se);for(fe in f)se=f[fe],ce=c[fe],!f.hasOwnProperty(fe)||se===ce||se===void 0&&ce===void 0||$g(i,o,fe,se,f,ce);return}}for(var J in c)se=c[J],c.hasOwnProperty(J)&&se!=null&&!f.hasOwnProperty(J)&&Et(i,o,J,null,f,se);for(_e in f)se=f[_e],ce=c[_e],!f.hasOwnProperty(_e)||se===ce||se==null&&ce==null||Et(i,o,_e,se,f,ce)}function _S(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Q4(){if(typeof performance.getEntriesByType=="function"){for(var i=0,o=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var v=c[f],x=v.transferSize,E=v.initiatorType,A=v.duration;if(x&&A&&_S(E)){for(E=0,A=v.responseEnd,f+=1;f<c.length;f++){var K=c[f],ne=K.startTime;if(ne>A)break;var fe=K.transferSize,_e=K.initiatorType;fe&&_S(_e)&&(K=K.responseEnd,E+=fe*(K<A?1:(A-ne)/(K-ne)))}if(--f,o+=8*(x+E)/(v.duration/1e3),i++,10<i)break}}if(0<i)return o/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Wg=null,Vg=null;function mh(i){return i.nodeType===9?i:i.ownerDocument}function yS(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function bS(i,o){if(i===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&o==="foreignObject"?0:i}function qg(i,o){return i==="textarea"||i==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Kg=null;function J4(){var i=window.event;return i&&i.type==="popstate"?i===Kg?!1:(Kg=i,!0):(Kg=null,!1)}var xS=typeof setTimeout=="function"?setTimeout:void 0,eO=typeof clearTimeout=="function"?clearTimeout:void 0,wS=typeof Promise=="function"?Promise:void 0,tO=typeof queueMicrotask=="function"?queueMicrotask:typeof wS<"u"?function(i){return wS.resolve(null).then(i).catch(nO)}:xS;function nO(i){setTimeout(function(){throw i})}function Fs(i){return i==="head"}function SS(i,o){var c=o,f=0;do{var v=c.nextSibling;if(i.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"||c==="/&"){if(f===0){i.removeChild(v),tl(o);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")jc(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,jc(c);for(var x=c.firstChild;x;){var E=x.nextSibling,A=x.nodeName;x[Ql]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=E}}else c==="body"&&jc(i.ownerDocument.body);c=v}while(c);tl(o)}function CS(i,o){var c=i;i=0;do{var f=c.nextSibling;if(c.nodeType===1?o?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(o?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=f}while(c)}function Gg(i){var o=i.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var c=o;switch(o=o.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Gg(c),Jp(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function rO(i,o,c,f){for(;i.nodeType===1;){var v=c;if(i.nodeName.toLowerCase()!==o.toLowerCase()){if(!f&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(f){if(!i[Ql])switch(o){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(x=i.getAttribute("rel"),x==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(x!==v.rel||i.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||i.getAttribute("title")!==(v.title==null?null:v.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(x=i.getAttribute("src"),(x!==(v.src==null?null:v.src)||i.getAttribute("type")!==(v.type==null?null:v.type)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&x&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(o==="input"&&i.type==="hidden"){var x=v.name==null?null:""+v.name;if(v.type==="hidden"&&i.getAttribute("name")===x)return i}else return i;if(i=$r(i.nextSibling),i===null)break}return null}function iO(i,o,c){if(o==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=$r(i.nextSibling),i===null))return null;return i}function kS(i,o){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!o||(i=$r(i.nextSibling),i===null))return null;return i}function Yg(i){return i.data==="$?"||i.data==="$~"}function Xg(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function sO(i,o){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=o;else if(i.data!=="$?"||c.readyState!=="loading")o();else{var f=function(){o(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),i._reactRetry=f}}function $r(i){for(;i!=null;i=i.nextSibling){var o=i.nodeType;if(o===1||o===3)break;if(o===8){if(o=i.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return i}var Zg=null;function ES(i){i=i.nextSibling;for(var o=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(o===0)return $r(i.nextSibling);o--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||o++}i=i.nextSibling}return null}function RS(i){i=i.previousSibling;for(var o=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(o===0)return i;o--}else c!=="/$"&&c!=="/&"||o++}i=i.previousSibling}return null}function TS(i,o,c){switch(o=mh(c),i){case"html":if(i=o.documentElement,!i)throw Error(r(452));return i;case"head":if(i=o.head,!i)throw Error(r(453));return i;case"body":if(i=o.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function jc(i){for(var o=i.attributes;o.length;)i.removeAttributeNode(o[0]);Jp(i)}var Wr=new Map,MS=new Set;function gh(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var is=$.d;$.d={f:oO,r:aO,D:lO,C:cO,L:uO,m:dO,X:fO,S:hO,M:pO};function oO(){var i=is.f(),o=ah();return i||o}function aO(i){var o=ba(i);o!==null&&o.tag===5&&o.type==="form"?q1(o):is.r(i)}var Qa=typeof document>"u"?null:document;function NS(i,o,c){var f=Qa;if(f&&typeof o=="string"&&o){var v=zr(o);v='link[rel="'+i+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),MS.has(v)||(MS.add(v),i={rel:i,crossOrigin:c,href:o},f.querySelector(v)===null&&(o=f.createElement("link"),Bn(o,"link",i),xn(o),f.head.appendChild(o)))}}function lO(i){is.D(i),NS("dns-prefetch",i,null)}function cO(i,o){is.C(i,o),NS("preconnect",i,o)}function uO(i,o,c){is.L(i,o,c);var f=Qa;if(f&&i&&o){var v='link[rel="preload"][as="'+zr(o)+'"]';o==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+zr(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+zr(c.imageSizes)+'"]')):v+='[href="'+zr(i)+'"]';var x=v;switch(o){case"style":x=Ja(i);break;case"script":x=el(i)}Wr.has(x)||(i=g({rel:"preload",href:o==="image"&&c&&c.imageSrcSet?void 0:i,as:o},c),Wr.set(x,i),f.querySelector(v)!==null||o==="style"&&f.querySelector(Lc(x))||o==="script"&&f.querySelector(zc(x))||(o=f.createElement("link"),Bn(o,"link",i),xn(o),f.head.appendChild(o)))}}function dO(i,o){is.m(i,o);var c=Qa;if(c&&i){var f=o&&typeof o.as=="string"?o.as:"script",v='link[rel="modulepreload"][as="'+zr(f)+'"][href="'+zr(i)+'"]',x=v;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=el(i)}if(!Wr.has(x)&&(i=g({rel:"modulepreload",href:i},o),Wr.set(x,i),c.querySelector(v)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(zc(x)))return}f=c.createElement("link"),Bn(f,"link",i),xn(f),c.head.appendChild(f)}}}function hO(i,o,c){is.S(i,o,c);var f=Qa;if(f&&i){var v=xa(f).hoistableStyles,x=Ja(i);o=o||"default";var E=v.get(x);if(!E){var A={loading:0,preload:null};if(E=f.querySelector(Lc(x)))A.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":o},c),(c=Wr.get(x))&&Qg(i,c);var K=E=f.createElement("link");xn(K),Bn(K,"link",i),K._p=new Promise(function(ne,fe){K.onload=ne,K.onerror=fe}),K.addEventListener("load",function(){A.loading|=1}),K.addEventListener("error",function(){A.loading|=2}),A.loading|=4,vh(E,o,f)}E={type:"stylesheet",instance:E,count:1,state:A},v.set(x,E)}}}function fO(i,o){is.X(i,o);var c=Qa;if(c&&i){var f=xa(c).hoistableScripts,v=el(i),x=f.get(v);x||(x=c.querySelector(zc(v)),x||(i=g({src:i,async:!0},o),(o=Wr.get(v))&&Jg(i,o),x=c.createElement("script"),xn(x),Bn(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(v,x))}}function pO(i,o){is.M(i,o);var c=Qa;if(c&&i){var f=xa(c).hoistableScripts,v=el(i),x=f.get(v);x||(x=c.querySelector(zc(v)),x||(i=g({src:i,async:!0,type:"module"},o),(o=Wr.get(v))&&Jg(i,o),x=c.createElement("script"),xn(x),Bn(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(v,x))}}function AS(i,o,c,f){var v=(v=ue.current)?gh(v):null;if(!v)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(o=Ja(c.href),c=xa(v).hoistableStyles,f=c.get(o),f||(f={type:"style",instance:null,count:0,state:null},c.set(o,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=Ja(c.href);var x=xa(v).hoistableStyles,E=x.get(i);if(E||(v=v.ownerDocument||v,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(i,E),(x=v.querySelector(Lc(i)))&&!x._p&&(E.instance=x,E.state.loading=5),Wr.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Wr.set(i,c),x||mO(v,i,c,E.state))),o&&f===null)throw Error(r(528,""));return E}if(o&&f!==null)throw Error(r(529,""));return null;case"script":return o=c.async,c=c.src,typeof c=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=el(c),c=xa(v).hoistableScripts,f=c.get(o),f||(f={type:"script",instance:null,count:0,state:null},c.set(o,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ja(i){return'href="'+zr(i)+'"'}function Lc(i){return'link[rel="stylesheet"]['+i+"]"}function DS(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function mO(i,o,c,f){i.querySelector('link[rel="preload"][as="style"]['+o+"]")?f.loading=1:(o=i.createElement("link"),f.preload=o,o.addEventListener("load",function(){return f.loading|=1}),o.addEventListener("error",function(){return f.loading|=2}),Bn(o,"link",c),xn(o),i.head.appendChild(o))}function el(i){return'[src="'+zr(i)+'"]'}function zc(i){return"script[async]"+i}function OS(i,o,c){if(o.count++,o.instance===null)switch(o.type){case"style":var f=i.querySelector('style[data-href~="'+zr(c.href)+'"]');if(f)return o.instance=f,xn(f),f;var v=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(i.ownerDocument||i).createElement("style"),xn(f),Bn(f,"style",v),vh(f,c.precedence,i),o.instance=f;case"stylesheet":v=Ja(c.href);var x=i.querySelector(Lc(v));if(x)return o.state.loading|=4,o.instance=x,xn(x),x;f=DS(c),(v=Wr.get(v))&&Qg(f,v),x=(i.ownerDocument||i).createElement("link"),xn(x);var E=x;return E._p=new Promise(function(A,K){E.onload=A,E.onerror=K}),Bn(x,"link",f),o.state.loading|=4,vh(x,c.precedence,i),o.instance=x;case"script":return x=el(c.src),(v=i.querySelector(zc(x)))?(o.instance=v,xn(v),v):(f=c,(v=Wr.get(x))&&(f=g({},c),Jg(f,v)),i=i.ownerDocument||i,v=i.createElement("script"),xn(v),Bn(v,"link",f),i.head.appendChild(v),o.instance=v);case"void":return null;default:throw Error(r(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(f=o.instance,o.state.loading|=4,vh(f,c.precedence,i));return o.instance}function vh(i,o,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=f.length?f[f.length-1]:null,x=v,E=0;E<f.length;E++){var A=f[E];if(A.dataset.precedence===o)x=A;else if(x!==v)break}x?x.parentNode.insertBefore(i,x.nextSibling):(o=c.nodeType===9?c.head:c,o.insertBefore(i,o.firstChild))}function Qg(i,o){i.crossOrigin==null&&(i.crossOrigin=o.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=o.referrerPolicy),i.title==null&&(i.title=o.title)}function Jg(i,o){i.crossOrigin==null&&(i.crossOrigin=o.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=o.referrerPolicy),i.integrity==null&&(i.integrity=o.integrity)}var _h=null;function jS(i,o,c){if(_h===null){var f=new Map,v=_h=new Map;v.set(c,f)}else v=_h,f=v.get(c),f||(f=new Map,v.set(c,f));if(f.has(i))return f;for(f.set(i,null),c=c.getElementsByTagName(i),v=0;v<c.length;v++){var x=c[v];if(!(x[Ql]||x[jn]||i==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var E=x.getAttribute(o)||"";E=i+E;var A=f.get(E);A?A.push(x):f.set(E,[x])}}return f}function LS(i,o,c){i=i.ownerDocument||i,i.head.insertBefore(c,o==="title"?i.querySelector("head > title"):null)}function gO(i,o,c){if(c===1||o.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return i=o.disabled,typeof o.precedence=="string"&&i==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function zS(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function vO(i,o,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var v=Ja(f.href),x=o.querySelector(Lc(v));if(x){o=x._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(i.count++,i=yh.bind(i),o.then(i,i)),c.state.loading|=4,c.instance=x,xn(x);return}x=o.ownerDocument||o,f=DS(f),(v=Wr.get(v))&&Qg(f,v),x=x.createElement("link"),xn(x);var E=x;E._p=new Promise(function(A,K){E.onload=A,E.onerror=K}),Bn(x,"link",f),c.instance=x}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,o),(o=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=yh.bind(i),o.addEventListener("load",c),o.addEventListener("error",c))}}var ev=0;function _O(i,o){return i.stylesheets&&i.count===0&&xh(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var f=setTimeout(function(){if(i.stylesheets&&xh(i,i.stylesheets),i.unsuspend){var x=i.unsuspend;i.unsuspend=null,x()}},6e4+o);0<i.imgBytes&&ev===0&&(ev=62500*Q4());var v=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&xh(i,i.stylesheets),i.unsuspend)){var x=i.unsuspend;i.unsuspend=null,x()}},(i.imgBytes>ev?50:800)+o);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(f),clearTimeout(v)}}:null}function yh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var bh=null;function xh(i,o){i.stylesheets=null,i.unsuspend!==null&&(i.count++,bh=new Map,o.forEach(yO,i),bh=null,yh.call(i))}function yO(i,o){if(!(o.state.loading&4)){var c=bh.get(i);if(c)var f=c.get(null);else{c=new Map,bh.set(i,c);for(var v=i.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<v.length;x++){var E=v[x];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(c.set(E.dataset.precedence,E),f=E)}f&&c.set(null,f)}v=o.instance,E=v.getAttribute("data-precedence"),x=c.get(E)||f,x===f&&c.set(null,v),c.set(E,v),this.count++,f=yh.bind(this),v.addEventListener("load",f),v.addEventListener("error",f),x?x.parentNode.insertBefore(v,x.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(v,i.firstChild)),o.state.loading|=4}}var Pc={$$typeof:R,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function bO(i,o,c,f,v,x,E,A,K){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=On(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=On(0),this.hiddenUpdates=On(null),this.identifierPrefix=f,this.onUncaughtError=v,this.onCaughtError=x,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function PS(i,o,c,f,v,x,E,A,K,ne,fe,_e){return i=new bO(i,o,c,E,K,ne,fe,_e,A),o=1,x===!0&&(o|=24),x=xr(3,null,null,o),i.current=x,x.stateNode=i,o=Om(),o.refCount++,i.pooledCache=o,o.refCount++,x.memoizedState={element:f,isDehydrated:c,cache:o},Pm(x),i}function BS(i){return i?(i=Aa,i):Aa}function IS(i,o,c,f,v,x){v=BS(v),f.context===null?f.context=v:f.pendingContext=v,f=Ns(o),f.payload={element:c},x=x===void 0?null:x,x!==null&&(f.callback=x),c=As(i,f,o),c!==null&&(fr(c,i,o),mc(c,i,o))}function HS(i,o){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<o?c:o}}function tv(i,o){HS(i,o),(i=i.alternate)&&HS(i,o)}function FS(i){if(i.tag===13||i.tag===31){var o=ko(i,67108864);o!==null&&fr(o,i,67108864),tv(i,67108864)}}function US(i){if(i.tag===13||i.tag===31){var o=Er();o=yr(o);var c=ko(i,o);c!==null&&fr(c,i,o),tv(i,o)}}var wh=!0;function xO(i,o,c,f){var v=z.T;z.T=null;var x=$.p;try{$.p=2,nv(i,o,c,f)}finally{$.p=x,z.T=v}}function wO(i,o,c,f){var v=z.T;z.T=null;var x=$.p;try{$.p=8,nv(i,o,c,f)}finally{$.p=x,z.T=v}}function nv(i,o,c,f){if(wh){var v=rv(f);if(v===null)Ug(i,o,f,Sh,c),WS(i,f);else if(CO(v,i,o,c,f))f.stopPropagation();else if(WS(i,f),o&4&&-1<SO.indexOf(i)){for(;v!==null;){var x=ba(v);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var E=Ct(x.pendingLanes);if(E!==0){var A=x;for(A.pendingLanes|=2,A.entangledLanes|=2;E;){var K=1<<31-Te(E);A.entanglements[1]|=K,E&=~K}wi(x),(gt&6)===0&&(sh=Nt()+500,Ac(0))}}break;case 31:case 13:A=ko(x,2),A!==null&&fr(A,x,2),ah(),tv(x,2)}if(x=rv(f),x===null&&Ug(i,o,f,Sh,c),x===v)break;v=x}v!==null&&f.stopPropagation()}else Ug(i,o,f,null,c)}}function rv(i){return i=sm(i),iv(i)}var Sh=null;function iv(i){if(Sh=null,i=ya(i),i!==null){var o=a(i);if(o===null)i=null;else{var c=o.tag;if(c===13){if(i=l(o),i!==null)return i;i=null}else if(c===31){if(i=u(o),i!==null)return i;i=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;i=null}else o!==i&&(i=null)}}return Sh=i,null}function $S(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Yn()){case Y:return 2;case oe:return 8;case Ee:case ze:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var sv=!1,Us=null,$s=null,Ws=null,Bc=new Map,Ic=new Map,Vs=[],SO="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 WS(i,o){switch(i){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":$s=null;break;case"mouseover":case"mouseout":Ws=null;break;case"pointerover":case"pointerout":Bc.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ic.delete(o.pointerId)}}function Hc(i,o,c,f,v,x){return i===null||i.nativeEvent!==x?(i={blockedOn:o,domEventName:c,eventSystemFlags:f,nativeEvent:x,targetContainers:[v]},o!==null&&(o=ba(o),o!==null&&FS(o)),i):(i.eventSystemFlags|=f,o=i.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),i)}function CO(i,o,c,f,v){switch(o){case"focusin":return Us=Hc(Us,i,o,c,f,v),!0;case"dragenter":return $s=Hc($s,i,o,c,f,v),!0;case"mouseover":return Ws=Hc(Ws,i,o,c,f,v),!0;case"pointerover":var x=v.pointerId;return Bc.set(x,Hc(Bc.get(x)||null,i,o,c,f,v)),!0;case"gotpointercapture":return x=v.pointerId,Ic.set(x,Hc(Ic.get(x)||null,i,o,c,f,v)),!0}return!1}function VS(i){var o=ya(i.target);if(o!==null){var c=a(o);if(c!==null){if(o=c.tag,o===13){if(o=l(c),o!==null){i.blockedOn=o,Ss(i.priority,function(){US(c)});return}}else if(o===31){if(o=u(c),o!==null){i.blockedOn=o,Ss(i.priority,function(){US(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Ch(i){if(i.blockedOn!==null)return!1;for(var o=i.targetContainers;0<o.length;){var c=rv(i.nativeEvent);if(c===null){c=i.nativeEvent;var f=new c.constructor(c.type,c);im=f,c.target.dispatchEvent(f),im=null}else return o=ba(c),o!==null&&FS(o),i.blockedOn=c,!1;o.shift()}return!0}function qS(i,o,c){Ch(i)&&c.delete(o)}function kO(){sv=!1,Us!==null&&Ch(Us)&&(Us=null),$s!==null&&Ch($s)&&($s=null),Ws!==null&&Ch(Ws)&&(Ws=null),Bc.forEach(qS),Ic.forEach(qS)}function kh(i,o){i.blockedOn===o&&(i.blockedOn=null,sv||(sv=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,kO)))}var Eh=null;function KS(i){Eh!==i&&(Eh=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Eh===i&&(Eh=null);for(var o=0;o<i.length;o+=3){var c=i[o],f=i[o+1],v=i[o+2];if(typeof f!="function"){if(iv(f||c)===null)continue;break}var x=ba(c);x!==null&&(i.splice(o,3),o-=3,rg(x,{pending:!0,data:v,method:c.method,action:f},f,v))}}))}function tl(i){function o(K){return kh(K,i)}Us!==null&&kh(Us,i),$s!==null&&kh($s,i),Ws!==null&&kh(Ws,i),Bc.forEach(o),Ic.forEach(o);for(var c=0;c<Vs.length;c++){var f=Vs[c];f.blockedOn===i&&(f.blockedOn=null)}for(;0<Vs.length&&(c=Vs[0],c.blockedOn===null);)VS(c),c.blockedOn===null&&Vs.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var v=c[f],x=c[f+1],E=v[ar]||null;if(typeof x=="function")E||KS(c);else if(E){var A=null;if(x&&x.hasAttribute("formAction")){if(v=x,E=x[ar]||null)A=E.formAction;else if(iv(v)!==null)continue}else A=E.action;typeof A=="function"?c[f+1]=A:(c.splice(f,3),f-=3),KS(c)}}}function GS(){function i(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(E){return v=E})},focusReset:"manual",scroll:"manual"})}function o(){v!==null&&(v(),v=null),f||setTimeout(c,20)}function c(){if(!f&&!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 f=!1,v=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),v!==null&&(v(),v=null)}}}function ov(i){this._internalRoot=i}Rh.prototype.render=ov.prototype.render=function(i){var o=this._internalRoot;if(o===null)throw Error(r(409));var c=o.current,f=Er();IS(c,f,i,o,null,null)},Rh.prototype.unmount=ov.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var o=i.containerInfo;IS(i.current,2,null,i,null,null),ah(),o[_a]=null}};function Rh(i){this._internalRoot=i}Rh.prototype.unstable_scheduleHydration=function(i){if(i){var o=ni();i={blockedOn:null,target:i,priority:o};for(var c=0;c<Vs.length&&o!==0&&o<Vs[c].priority;c++);Vs.splice(c,0,i),c===0&&VS(i)}};var YS=t.version;if(YS!=="19.2.1")throw Error(r(527,YS,"19.2.1"));$.findDOMNode=function(i){var o=i._reactInternals;if(o===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=d(o),i=i!==null?m(i):null,i=i===null?null:i.stateNode,i};var EO={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Th=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Th.isDisabled&&Th.supportsFiber)try{Ge=Th.inject(EO),pt=Th}catch{}}return $c.createRoot=function(i,o){if(!s(i))throw Error(r(299));var c=!1,f="",v=nw,x=rw,E=iw;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(f=o.identifierPrefix),o.onUncaughtError!==void 0&&(v=o.onUncaughtError),o.onCaughtError!==void 0&&(x=o.onCaughtError),o.onRecoverableError!==void 0&&(E=o.onRecoverableError)),o=PS(i,1,!1,null,null,c,f,null,v,x,E,GS),i[_a]=o.current,Fg(i),new ov(o)},$c.hydrateRoot=function(i,o,c){if(!s(i))throw Error(r(299));var f=!1,v="",x=nw,E=rw,A=iw,K=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(A=c.onRecoverableError),c.formState!==void 0&&(K=c.formState)),o=PS(i,1,!0,o,c??null,f,v,K,x,E,A,GS),o.context=BS(null),c=o.current,f=Er(),f=yr(f),v=Ns(f),v.callback=null,As(c,v,f),c=f,o.current.lanes=c,re(o,c),wi(o),i[_a]=o.current,Fg(i),new Rh(o)},$c.version="19.2.1",$c}var cC;function BO(){if(cC)return cv.exports;cC=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(),cv.exports=PO(),cv.exports}var IO=BO();/**
50
+ * react-router v7.13.1
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var uC="popstate";function dC(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function HO(e={}){function t(r,s){var d;let a=(d=s.state)==null?void 0:d.masked,{pathname:l,search:u,hash:h}=a||r.location;return S_("",{pathname:l,search:u,hash:h},s.state&&s.state.usr||null,s.state&&s.state.key||"default",a?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:Mu(s)}return UO(t,n,null,e)}function Ut(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function di(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function FO(){return Math.random().toString(36).substring(2,10)}function hC(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 S_(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?jl(t):t,state:n,key:t&&t.key||r||FO(),unstable_mask:s}}function Mu({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 jl(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 UO(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:a=!1}=r,l=s.history,u="POP",h=null,d=m();d==null&&(d=0,l.replaceState({...l.state,idx:d},""));function m(){return(l.state||{idx:null}).idx}function g(){u="POP";let C=m(),k=C==null?null:C-d;d=C,h&&h({action:u,location:S.location,delta:k})}function _(C,k){u="PUSH";let T=dC(C)?C:S_(S.location,C,k);d=m()+1;let R=hC(T,d),M=S.createHref(T.unstable_mask||T);try{l.pushState(R,"",M)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;s.location.assign(M)}a&&h&&h({action:u,location:S.location,delta:1})}function b(C,k){u="REPLACE";let T=dC(C)?C:S_(S.location,C,k);d=m();let R=hC(T,d),M=S.createHref(T.unstable_mask||T);l.replaceState(R,"",M),a&&h&&h({action:u,location:S.location,delta:0})}function w(C){return $O(C)}let S={get action(){return u},get location(){return e(s,l)},listen(C){if(h)throw new Error("A history only accepts one active listener");return s.addEventListener(uC,g),h=C,()=>{s.removeEventListener(uC,g),h=null}},createHref(C){return t(s,C)},createURL:w,encodeLocation(C){let k=w(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:_,replace:b,go(C){return l.go(C)}};return S}function $O(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Ut(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Mu(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function uR(e,t,n="/"){return WO(e,t,n,!1)}function WO(e,t,n,r){let s=typeof t=="string"?jl(t):t,a=hs(s.pathname||"/",n);if(a==null)return null;let l=dR(e);VO(l);let u=null;for(let h=0;u==null&&h<l.length;++h){let d=nj(a);u=ej(l[h],d,r)}return u}function dR(e,t=[],n=[],r="",s=!1){let a=(l,u,h=s,d)=>{let m={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&h)return;Ut(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let g=Oi([r,m.relativePath]),_=n.concat(m);l.children&&l.children.length>0&&(Ut(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),dR(l.children,t,_,g,h)),!(l.path==null&&!l.index)&&t.push({path:g,score:QO(g,l.index),routesMeta:_})};return e.forEach((l,u)=>{var h;if(l.path===""||!((h=l.path)!=null&&h.includes("?")))a(l,u);else for(let d of hR(l.path))a(l,u,!0,d)}),t}function hR(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return s?[a,""]:[a];let l=hR(r.join("/")),u=[];return u.push(...l.map(h=>h===""?a:[a,h].join("/"))),s&&u.push(...l),u.map(h=>e.startsWith("/")&&h===""?"/":h)}function VO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:JO(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var qO=/^:[\w-]+$/,KO=3,GO=2,YO=1,XO=10,ZO=-2,fC=e=>e==="*";function QO(e,t){let n=e.split("/"),r=n.length;return n.some(fC)&&(r+=ZO),t&&(r+=GO),n.filter(s=>!fC(s)).reduce((s,a)=>s+(qO.test(a)?KO:a===""?YO:XO),r)}function JO(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function ej(e,t,n=!1){let{routesMeta:r}=e,s={},a="/",l=[];for(let u=0;u<r.length;++u){let h=r[u],d=u===r.length-1,m=a==="/"?t:t.slice(a.length)||"/",g=Af({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},m),_=h.route;if(!g&&d&&n&&!r[r.length-1].route.index&&(g=Af({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},m)),!g)return null;Object.assign(s,g.params),l.push({params:s,pathname:Oi([a,g.pathname]),pathnameBase:oj(Oi([a,g.pathnameBase])),route:_}),g.pathnameBase!=="/"&&(a=Oi([a,g.pathnameBase]))}return l}function Af(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=tj(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let a=s[0],l=a.replace(/(.)\/+$/,"$1"),u=s.slice(1);return{params:r.reduce((d,{paramName:m,isOptional:g},_)=>{if(m==="*"){let w=u[_]||"";l=a.slice(0,a.length-w.length).replace(/(.)\/+$/,"$1")}const b=u[_];return g&&!b?d[m]=void 0:d[m]=(b||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:l,pattern:e}}function tj(e,t=!1,n=!0){di(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,h,d,m)=>{if(r.push({paramName:u,isOptional:h!=null}),h){let g=m.charAt(d+l.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function nj(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return di(!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 hs(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 rj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function ij(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?jl(e):e,a;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?a=pC(n.substring(1),"/"):a=pC(n,t)):a=t,{pathname:a,search:aj(r),hash:lj(s)}}function pC(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function fv(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 sj(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function lb(e){let t=sj(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function fp(e,t,n,r=!1){let s;typeof e=="string"?s=jl(e):(s={...e},Ut(!s.pathname||!s.pathname.includes("?"),fv("?","pathname","search",s)),Ut(!s.pathname||!s.pathname.includes("#"),fv("#","pathname","hash",s)),Ut(!s.search||!s.search.includes("#"),fv("#","search","hash",s)));let a=e===""||s.pathname==="",l=a?"/":s.pathname,u;if(l==null)u=n;else{let g=t.length-1;if(!r&&l.startsWith("..")){let _=l.split("/");for(;_[0]==="..";)_.shift(),g-=1;s.pathname=_.join("/")}u=g>=0?t[g]:"/"}let h=ij(s,u),d=l&&l!=="/"&&l.endsWith("/"),m=(a||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(d||m)&&(h.pathname+="/"),h}var Oi=e=>e.join("/").replace(/\/\/+/g,"/"),oj=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),aj=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,lj=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,cj=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 uj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function dj(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var fR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function pR(e,t){let n=e;if(typeof n!="string"||!rj.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(fR)try{let a=new URL(window.location.href),l=n.startsWith("//")?new URL(a.protocol+n):new URL(n),u=hs(l.pathname,t);l.origin===a.origin&&u!=null?n=u+l.search+l.hash:s=!0}catch{di(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var mR=["POST","PUT","PATCH","DELETE"];new Set(mR);var hj=["GET",...mR];new Set(hj);var Ll=y.createContext(null);Ll.displayName="DataRouter";var pp=y.createContext(null);pp.displayName="DataRouterState";var fj=y.createContext(!1),gR=y.createContext({isTransitioning:!1});gR.displayName="ViewTransition";var pj=y.createContext(new Map);pj.displayName="Fetchers";var mj=y.createContext(null);mj.displayName="Await";var Or=y.createContext(null);Or.displayName="Navigation";var Ku=y.createContext(null);Ku.displayName="Location";var ei=y.createContext({outlet:null,matches:[],isDataRoute:!1});ei.displayName="Route";var cb=y.createContext(null);cb.displayName="RouteError";var vR="REACT_ROUTER_ERROR",gj="REDIRECT",vj="ROUTE_ERROR_RESPONSE";function _j(e){if(e.startsWith(`${vR}:${gj}:{`))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 yj(e){if(e.startsWith(`${vR}:${vj}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new cj(t.status,t.statusText,t.data)}catch{}}function bj(e,{relative:t}={}){Ut(zl(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=y.useContext(Or),{hash:s,pathname:a,search:l}=Gu(e,{relative:t}),u=a;return n!=="/"&&(u=a==="/"?n:Oi([n,a])),r.createHref({pathname:u,search:l,hash:s})}function zl(){return y.useContext(Ku)!=null}function vi(){return Ut(zl(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Ku).location}var _R="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function yR(e){y.useContext(Or).static||y.useLayoutEffect(e)}function Pl(){let{isDataRoute:e}=y.useContext(ei);return e?jj():xj()}function xj(){Ut(zl(),"useNavigate() may be used only in the context of a <Router> component.");let e=y.useContext(Ll),{basename:t,navigator:n}=y.useContext(Or),{matches:r}=y.useContext(ei),{pathname:s}=vi(),a=JSON.stringify(lb(r)),l=y.useRef(!1);return yR(()=>{l.current=!0}),y.useCallback((h,d={})=>{if(di(l.current,_R),!l.current)return;if(typeof h=="number"){n.go(h);return}let m=fp(h,JSON.parse(a),s,d.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Oi([t,m.pathname])),(d.replace?n.replace:n.push)(m,d.state,d)},[t,n,a,s,e])}var bR=y.createContext(null);function ub(){return y.useContext(bR)}function wj(e){let t=y.useContext(ei).outlet;return y.useMemo(()=>t&&y.createElement(bR.Provider,{value:e},t),[t,e])}function xR(){let{matches:e}=y.useContext(ei),t=e[e.length-1];return t?t.params:{}}function Gu(e,{relative:t}={}){let{matches:n}=y.useContext(ei),{pathname:r}=vi(),s=JSON.stringify(lb(n));return y.useMemo(()=>fp(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function Sj(e,t){return wR(e,t)}function wR(e,t,n){var C;Ut(zl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Or),{matches:s}=y.useContext(ei),a=s[s.length-1],l=a?a.params:{},u=a?a.pathname:"/",h=a?a.pathnameBase:"/",d=a&&a.route;{let k=d&&d.path||"";CR(u,!d||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let m=vi(),g;if(t){let k=typeof t=="string"?jl(t):t;Ut(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.`),g=k}else g=m;let _=g.pathname||"/",b=_;if(h!=="/"){let k=h.replace(/^\//,"").split("/");b="/"+_.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=uR(e,{pathname:b});di(d||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),di(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 "${g.pathname}${g.search}${g.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=Tj(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Oi([h,r.encodeLocation?r.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:Oi([h,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,n);return t&&S?y.createElement(Ku.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},S):S}function Cj(){let e=Oj(),t=uj(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:a},"ErrorBoundary")," or"," ",y.createElement("code",{style:a},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),n?y.createElement("pre",{style:s},n):null,l)}var kj=y.createElement(Cj,null),SR=class extends y.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=yj(e.digest);n&&(e=n)}let t=e!==void 0?y.createElement(ei.Provider,{value:this.props.routeContext},y.createElement(cb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(Ej,{error:e},t):t}};SR.contextType=fj;var pv=new WeakMap;function Ej({children:e,error:t}){let{basename:n}=y.useContext(Or);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=_j(t.digest);if(r){let s=pv.get(t);if(s)throw s;let a=pR(r.location,n);if(fR&&!pv.get(t))if(a.isExternal||r.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:r.replace}));throw pv.set(t,l),l}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function Rj({routeContext:e,match:t,children:n}){let r=y.useContext(Ll);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(ei.Provider,{value:e},n)}function Tj(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,a=r==null?void 0:r.errors;if(a!=null){let m=s.findIndex(g=>g.route.id&&(a==null?void 0:a[g.route.id])!==void 0);Ut(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),s=s.slice(0,Math.min(s.length,m+1))}let l=!1,u=-1;if(n&&r){l=r.renderFallback;for(let m=0;m<s.length;m++){let g=s[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=m),g.route.id){let{loaderData:_,errors:b}=r,w=g.route.loader&&!_.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||w){n.isStatic&&(l=!0),u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}}let h=n==null?void 0:n.onError,d=r&&h?(m,g)=>{var _,b;h(m,{location:r.location,params:((b=(_=r.matches)==null?void 0:_[0])==null?void 0:b.params)??{},unstable_pattern:dj(r.matches),errorInfo:g})}:void 0;return s.reduceRight((m,g,_)=>{let b,w=!1,S=null,C=null;r&&(b=a&&g.route.id?a[g.route.id]:void 0,S=g.route.errorElement||kj,l&&(u<0&&_===0?(CR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):u===_&&(w=!0,C=g.route.hydrateFallbackElement||null)));let k=t.concat(s.slice(0,_+1)),T=()=>{let R;return b?R=S:w?R=C:g.route.Component?R=y.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=m,y.createElement(Rj,{match:g,routeContext:{outlet:m,matches:k,isDataRoute:r!=null},children:R})};return r&&(g.route.ErrorBoundary||g.route.errorElement||_===0)?y.createElement(SR,{location:r.location,revalidation:r.revalidation,component:S,error:b,children:T(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:d}):T()},null)}function db(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mj(e){let t=y.useContext(Ll);return Ut(t,db(e)),t}function Nj(e){let t=y.useContext(pp);return Ut(t,db(e)),t}function Aj(e){let t=y.useContext(ei);return Ut(t,db(e)),t}function hb(e){let t=Aj(e),n=t.matches[t.matches.length-1];return Ut(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Dj(){return hb("useRouteId")}function Oj(){var r;let e=y.useContext(cb),t=Nj("useRouteError"),n=hb("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function jj(){let{router:e}=Mj("useNavigate"),t=hb("useNavigate"),n=y.useRef(!1);return yR(()=>{n.current=!0}),y.useCallback(async(s,a={})=>{di(n.current,_R),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...a}))},[e,t])}var mC={};function CR(e,t,n){!t&&!mC[e]&&(mC[e]=!0,di(!1,n))}y.memo(Lj);function Lj({routes:e,future:t,state:n,isStatic:r,onError:s}){return wR(e,void 0,{state:n,isStatic:r,onError:s})}function zj({to:e,replace:t,state:n,relative:r}){Ut(zl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=y.useContext(Or);di(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=y.useContext(ei),{pathname:l}=vi(),u=Pl(),h=fp(e,lb(a),l,r==="path"),d=JSON.stringify(h);return y.useEffect(()=>{u(JSON.parse(d),{replace:t,state:n,relative:r})},[u,d,r,t,n]),null}function Pj(e){return wj(e.context)}function hl(e){Ut(!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 Bj({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:a=!1,unstable_useTransitions:l}){Ut(!zl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:u,navigator:s,static:a,unstable_useTransitions:l,future:{}}),[u,s,a,l]);typeof n=="string"&&(n=jl(n));let{pathname:d="/",search:m="",hash:g="",state:_=null,key:b="default",unstable_mask:w}=n,S=y.useMemo(()=>{let C=hs(d,u);return C==null?null:{location:{pathname:C,search:m,hash:g,state:_,key:b,unstable_mask:w},navigationType:r}},[u,d,m,g,_,b,r,w]);return di(S!=null,`<Router basename="${u}"> is not able to match the URL "${d}${m}${g}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:y.createElement(Or.Provider,{value:h},y.createElement(Ku.Provider,{children:t,value:S}))}function Ij({children:e,location:t}){return Sj(C_(e),t)}function C_(e,t=[]){let n=[];return y.Children.forEach(e,(r,s)=>{if(!y.isValidElement(r))return;let a=[...t,s];if(r.type===y.Fragment){n.push.apply(n,C_(r.props.children,a));return}Ut(r.type===hl,`[${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>`),Ut(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=C_(r.props.children,a)),n.push(l)}),n}var df="get",hf="application/x-www-form-urlencoded";function mp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Hj(e){return mp(e)&&e.tagName.toLowerCase()==="button"}function Fj(e){return mp(e)&&e.tagName.toLowerCase()==="form"}function Uj(e){return mp(e)&&e.tagName.toLowerCase()==="input"}function $j(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Wj(e,t){return e.button===0&&(!t||t==="_self")&&!$j(e)}var Mh=null;function Vj(){if(Mh===null)try{new FormData(document.createElement("form"),0),Mh=!1}catch{Mh=!0}return Mh}var qj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function mv(e){return e!=null&&!qj.has(e)?(di(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${hf}"`),null):e}function Kj(e,t){let n,r,s,a,l;if(Fj(e)){let u=e.getAttribute("action");r=u?hs(u,t):null,n=e.getAttribute("method")||df,s=mv(e.getAttribute("enctype"))||hf,a=new FormData(e)}else if(Hj(e)||Uj(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||u.getAttribute("action");if(r=h?hs(h,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||df,s=mv(e.getAttribute("formenctype"))||mv(u.getAttribute("enctype"))||hf,a=new FormData(u,e),!Vj()){let{name:d,type:m,value:g}=e;if(m==="image"){let _=d?`${d}.`:"";a.append(`${_}x`,"0"),a.append(`${_}y`,"0")}else d&&a.append(d,g)}}else{if(mp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=df,r=null,s=hf,l=e}return a&&s==="text/plain"&&(l=a,a=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:a,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function fb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Gj(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&hs(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${r}`,s}async function Yj(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 Xj(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 Zj(e,t,n){let r=await Promise.all(e.map(async s=>{let a=t.routes[s.route.id];if(a){let l=await Yj(a,n);return l.links?l.links():[]}return[]}));return tL(r.flat(1).filter(Xj).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function gC(e,t,n,r,s,a){let l=(h,d)=>n[d]?h.route.id!==n[d].route.id:!0,u=(h,d)=>{var m;return n[d].pathname!==h.pathname||((m=n[d].route.path)==null?void 0:m.endsWith("*"))&&n[d].params["*"]!==h.params["*"]};return a==="assets"?t.filter((h,d)=>l(h,d)||u(h,d)):a==="data"?t.filter((h,d)=>{var g;let m=r.routes[h.route.id];if(!m||!m.hasLoader)return!1;if(l(h,d)||u(h,d))return!0;if(h.route.shouldRevalidate){let _=h.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function Qj(e,t,{includeHydrateFallback:n}={}){return Jj(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let a=[s.module];return s.clientActionModule&&(a=a.concat(s.clientActionModule)),s.clientLoaderModule&&(a=a.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(a=a.concat(s.hydrateFallbackModule)),s.imports&&(a=a.concat(s.imports)),a}).flat(1))}function Jj(e){return[...new Set(e)]}function eL(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function tL(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let a=JSON.stringify(eL(s));return n.has(a)||(n.add(a),r.push({key:a,link:s})),r},[])}function kR(){let e=y.useContext(Ll);return fb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function nL(){let e=y.useContext(pp);return fb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var pb=y.createContext(void 0);pb.displayName="FrameworkContext";function ER(){let e=y.useContext(pb);return fb(e,"You must render this element inside a <HydratedRouter> element"),e}function rL(e,t){let n=y.useContext(pb),[r,s]=y.useState(!1),[a,l]=y.useState(!1),{onFocus:u,onBlur:h,onMouseEnter:d,onMouseLeave:m,onTouchStart:g}=t,_=y.useRef(null);y.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let S=k=>{k.forEach(T=>{l(T.isIntersecting)})},C=new IntersectionObserver(S,{threshold:.5});return _.current&&C.observe(_.current),()=>{C.disconnect()}}},[e]),y.useEffect(()=>{if(r){let S=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(S)}}},[r]);let b=()=>{s(!0)},w=()=>{s(!1),l(!1)};return n?e!=="intent"?[a,_,{}]:[a,_,{onFocus:Wc(u,b),onBlur:Wc(h,w),onMouseEnter:Wc(d,b),onMouseLeave:Wc(m,w),onTouchStart:Wc(g,b)}]:[!1,_,{}]}function Wc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function iL({page:e,...t}){let{router:n}=kR(),r=y.useMemo(()=>uR(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?y.createElement(oL,{page:e,matches:r,...t}):null}function sL(e){let{manifest:t,routeModules:n}=ER(),[r,s]=y.useState([]);return y.useEffect(()=>{let a=!1;return Zj(e,t,n).then(l=>{a||s(l)}),()=>{a=!0}},[e,t,n]),r}function oL({page:e,matches:t,...n}){let r=vi(),{future:s,manifest:a,routeModules:l}=ER(),{basename:u}=kR(),{loaderData:h,matches:d}=nL(),m=y.useMemo(()=>gC(e,t,d,a,r,"data"),[e,t,d,a,r]),g=y.useMemo(()=>gC(e,t,d,a,r,"assets"),[e,t,d,a,r]),_=y.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let S=new Set,C=!1;if(t.forEach(T=>{var M;let R=a.routes[T.route.id];!R||!R.hasLoader||(!m.some(O=>O.route.id===T.route.id)&&T.route.id in h&&((M=l[T.route.id])!=null&&M.shouldRevalidate)||R.hasClientLoader?C=!0:S.add(T.route.id))}),S.size===0)return[];let k=Gj(e,u,s.unstable_trailingSlashAwareDataRequests,"data");return C&&S.size>0&&k.searchParams.set("_routes",t.filter(T=>S.has(T.route.id)).map(T=>T.route.id).join(",")),[k.pathname+k.search]},[u,s.unstable_trailingSlashAwareDataRequests,h,r,a,m,t,e,l]),b=y.useMemo(()=>Qj(g,a),[g,a]),w=sL(g);return y.createElement(y.Fragment,null,_.map(S=>y.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),b.map(S=>y.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),w.map(({key:S,link:C})=>y.createElement("link",{key:S,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function aL(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var lL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{lL&&(window.__reactRouterVersion="7.13.1")}catch{}function cL({basename:e,children:t,unstable_useTransitions:n,window:r}){let s=y.useRef();s.current==null&&(s.current=HO({window:r,v5Compat:!0}));let a=s.current,[l,u]=y.useState({action:a.action,location:a.location}),h=y.useCallback(d=>{n===!1?u(d):y.startTransition(()=>u(d))},[n]);return y.useLayoutEffect(()=>a.listen(h),[a,h]),y.createElement(Bj,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:a,unstable_useTransitions:n})}var RR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,TR=y.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:a,replace:l,unstable_mask:u,state:h,target:d,to:m,preventScrollReset:g,viewTransition:_,unstable_defaultShouldRevalidate:b,...w},S){let{basename:C,navigator:k,unstable_useTransitions:T}=y.useContext(Or),R=typeof m=="string"&&RR.test(m),M=pR(m,C);m=M.to;let O=bj(m,{relative:s}),D=vi(),j=null;if(u){let W=fp(u,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);C!=="/"&&(W.pathname=W.pathname==="/"?C:Oi([C,W.pathname])),j=k.createHref(W)}let[F,G,B]=rL(r,w),H=fL(m,{replace:l,unstable_mask:u,state:h,target:d,preventScrollReset:g,relative:s,viewTransition:_,unstable_defaultShouldRevalidate:b,unstable_useTransitions:T});function P(W){t&&t(W),W.defaultPrevented||H(W)}let U=!(M.isExternal||a),q=y.createElement("a",{...w,...B,href:(U?j:void 0)||M.absoluteURL||O,onClick:U?P:t,ref:aL(S,G),target:d,"data-discover":!R&&n==="render"?"true":void 0});return F&&!R?y.createElement(y.Fragment,null,q,y.createElement(iL,{page:O})):q});TR.displayName="Link";var uL=y.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:a,to:l,viewTransition:u,children:h,...d},m){let g=Gu(l,{relative:d.relative}),_=vi(),b=y.useContext(pp),{navigator:w,basename:S}=y.useContext(Or),C=b!=null&&_L(g)&&u===!0,k=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,T=_.pathname,R=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(T=T.toLowerCase(),R=R?R.toLowerCase():null,k=k.toLowerCase()),R&&S&&(R=hs(R,S)||R);const M=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let O=T===k||!s&&T.startsWith(k)&&T.charAt(M)==="/",D=R!=null&&(R===k||!s&&R.startsWith(k)&&R.charAt(k.length)==="/"),j={isActive:O,isPending:D,isTransitioning:C},F=O?t:void 0,G;typeof r=="function"?G=r(j):G=[r,O?"active":null,D?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let B=typeof a=="function"?a(j):a;return y.createElement(TR,{...d,"aria-current":F,className:G,ref:m,style:B,to:l,viewTransition:u},typeof h=="function"?h(j):h)});uL.displayName="NavLink";var dL=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:a,method:l=df,action:u,onSubmit:h,relative:d,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:_,...b},w)=>{let{unstable_useTransitions:S}=y.useContext(Or),C=gL(),k=vL(u,{relative:d}),T=l.toLowerCase()==="get"?"get":"post",R=typeof u=="string"&&RR.test(u),M=O=>{if(h&&h(O),O.defaultPrevented)return;O.preventDefault();let D=O.nativeEvent.submitter,j=(D==null?void 0:D.getAttribute("formmethod"))||l,F=()=>C(D||O.currentTarget,{fetcherKey:t,method:j,navigate:n,replace:s,state:a,relative:d,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:_});S&&n!==!1?y.startTransition(()=>F()):F()};return y.createElement("form",{ref:w,method:T,action:k,onSubmit:r?h:M,...b,"data-discover":!R&&e==="render"?"true":void 0})});dL.displayName="Form";function hL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function MR(e){let t=y.useContext(Ll);return Ut(t,hL(e)),t}function fL(e,{target:t,replace:n,unstable_mask:r,state:s,preventScrollReset:a,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let m=Pl(),g=vi(),_=Gu(e,{relative:l});return y.useCallback(b=>{if(Wj(b,t)){b.preventDefault();let w=n!==void 0?n:Mu(g)===Mu(_),S=()=>m(e,{replace:w,unstable_mask:r,state:s,preventScrollReset:a,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:h});d?y.startTransition(()=>S()):S()}},[g,m,_,n,r,s,t,e,a,l,u,h,d])}var pL=0,mL=()=>`__${String(++pL)}__`;function gL(){let{router:e}=MR("useSubmit"),{basename:t}=y.useContext(Or),n=Dj(),r=e.fetch,s=e.navigate;return y.useCallback(async(a,l={})=>{let{action:u,method:h,encType:d,formData:m,body:g}=Kj(a,t);if(l.navigate===!1){let _=l.fetcherKey||mL();await r(_,n,l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:m,body:g,formMethod:l.method||h,formEncType:l.encType||d,flushSync:l.flushSync})}else await s(l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:m,body:g,formMethod:l.method||h,formEncType:l.encType||d,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[r,s,t,n])}function vL(e,{relative:t}={}){let{basename:n}=y.useContext(Or),r=y.useContext(ei);Ut(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),a={...Gu(e||".",{relative:t})},l=vi();if(e==null){a.search=l.search;let u=new URLSearchParams(a.search),h=u.getAll("index");if(h.some(m=>m==="")){u.delete("index"),h.filter(g=>g).forEach(g=>u.append("index",g));let m=u.toString();a.search=m?`?${m}`:""}}return(!e||e===".")&&s.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:Oi([n,a.pathname])),Mu(a)}function _L(e,{relative:t}={}){let n=y.useContext(gR);Ut(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=MR("useViewTransitionState"),s=Gu(e,{relative:t});if(!n.isTransitioning)return!1;let a=hs(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=hs(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Af(s.pathname,l)!=null||Af(s.pathname,a)!=null}var Mi=cR();const yL=hp(Mi);function NR(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=NR(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function AR(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=NR(e))&&(r&&(r+=" "),r+=t);return r}const vC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_C=AR,bL=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return _C(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:a}=t,l=Object.keys(s).map(d=>{const m=n==null?void 0:n[d],g=a==null?void 0:a[d];if(m===null)return null;const _=vC(m)||vC(g);return s[d][_]}),u=n&&Object.entries(n).reduce((d,m)=>{let[g,_]=m;return _===void 0||(d[g]=_),d},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,m)=>{let{class:g,className:_,...b}=m;return Object.entries(b).every(w=>{let[S,C]=w;return Array.isArray(C)?C.includes({...a,...u}[S]):{...a,...u}[S]===C})?[...d,g,_]:d},[]);return _C(e,l,h,n==null?void 0:n.class,n==null?void 0:n.className)},xL=(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},wL=(e,t)=>({classGroupId:e,validator:t}),DR=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Df="-",yC=[],SL="arbitrary..",CL=e=>{const t=EL(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return kL(l);const u=l.split(Df),h=u[0]===""&&u.length>1?1:0;return OR(u,h,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const h=r[l],d=n[l];return h?d?xL(d,h):h:d||yC}return n[l]||yC}}},OR=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const d=OR(e,t+1,a);if(d)return d}const l=n.validators;if(l===null)return;const u=t===0?e.join(Df):e.slice(t).join(Df),h=l.length;for(let d=0;d<h;d++){const m=l[d];if(m.validator(u))return m.classGroupId}},kL=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?SL+r:void 0})(),EL=e=>{const{theme:t,classGroups:n}=e;return RL(n,t)},RL=(e,t)=>{const n=DR();for(const r in e){const s=e[r];mb(s,n,r,t)}return n},mb=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const l=e[a];TL(l,t,n,r)}},TL=(e,t,n,r)=>{if(typeof e=="string"){ML(e,t,n);return}if(typeof e=="function"){NL(e,t,n,r);return}AL(e,t,n,r)},ML=(e,t,n)=>{const r=e===""?t:jR(t,e);r.classGroupId=n},NL=(e,t,n,r)=>{if(DL(e)){mb(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(wL(n,e))},AL=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let l=0;l<a;l++){const[u,h]=s[l];mb(h,jR(t,u),n,r)}},jR=(e,t)=>{let n=e;const r=t.split(Df),s=r.length;for(let a=0;a<s;a++){const l=r[a];let u=n.nextPart.get(l);u||(u=DR(),n.nextPart.set(l,u)),n=u}return n},DL=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,OL=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,l)=>{n[a]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let l=n[a];if(l!==void 0)return l;if((l=r[a])!==void 0)return s(a,l),l},set(a,l){a in n?n[a]=l:s(a,l)}}},k_="!",bC=":",jL=[],xC=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),LL=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let l=0,u=0,h=0,d;const m=s.length;for(let S=0;S<m;S++){const C=s[S];if(l===0&&u===0){if(C===bC){a.push(s.slice(h,S)),h=S+1;continue}if(C==="/"){d=S;continue}}C==="["?l++:C==="]"?l--:C==="("?u++:C===")"&&u--}const g=a.length===0?s:s.slice(h);let _=g,b=!1;g.endsWith(k_)?(_=g.slice(0,-1),b=!0):g.startsWith(k_)&&(_=g.slice(1),b=!0);const w=d&&d>h?d-h:void 0;return xC(a,b,_,w)};if(t){const s=t+bC,a=r;r=l=>l.startsWith(s)?a(l.slice(s.length)):xC(jL,!1,l,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},zL=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const l=n[a],u=l[0]==="[",h=t.has(l);u||h?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},PL=e=>({cache:OL(e.cacheSize),parseClassName:LL(e),sortModifiers:zL(e),...CL(e)}),BL=/\s+/,IL=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,l=[],u=e.trim().split(BL);let h="";for(let d=u.length-1;d>=0;d-=1){const m=u[d],{isExternal:g,modifiers:_,hasImportantModifier:b,baseClassName:w,maybePostfixModifierPosition:S}=n(m);if(g){h=m+(h.length>0?" "+h:h);continue}let C=!!S,k=r(C?w.substring(0,S):w);if(!k){if(!C){h=m+(h.length>0?" "+h:h);continue}if(k=r(w),!k){h=m+(h.length>0?" "+h:h);continue}C=!1}const T=_.length===0?"":_.length===1?_[0]:a(_).join(":"),R=b?T+k_:T,M=R+k;if(l.indexOf(M)>-1)continue;l.push(M);const O=s(k,C);for(let D=0;D<O.length;++D){const j=O[D];l.push(R+j)}h=m+(h.length>0?" "+h:h)}return h},HL=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=LR(n))&&(s&&(s+=" "),s+=r);return s},LR=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=LR(e[r]))&&(n&&(n+=" "),n+=t);return n},FL=(e,...t)=>{let n,r,s,a;const l=h=>{const d=t.reduce((m,g)=>g(m),e());return n=PL(d),r=n.cache.get,s=n.cache.set,a=u,u(h)},u=h=>{const d=r(h);if(d)return d;const m=IL(h,n);return s(h,m),m};return a=l,(...h)=>a(HL(...h))},UL=[],mn=e=>{const t=n=>n[e]||UL;return t.isThemeGetter=!0,t},zR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,PR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$L=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,WL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,VL=/\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$/,qL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,KL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,GL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ks=e=>$L.test(e),Ze=e=>!!e&&!Number.isNaN(Number(e)),Gs=e=>!!e&&Number.isInteger(Number(e)),gv=e=>e.endsWith("%")&&Ze(e.slice(0,-1)),ss=e=>WL.test(e),BR=()=>!0,YL=e=>VL.test(e)&&!qL.test(e),gb=()=>!1,XL=e=>KL.test(e),ZL=e=>GL.test(e),QL=e=>!Oe(e)&&!je(e),JL=e=>po(e,FR,gb),Oe=e=>zR.test(e),Bo=e=>po(e,UR,YL),wC=e=>po(e,az,Ze),ez=e=>po(e,WR,BR),tz=e=>po(e,$R,gb),SC=e=>po(e,IR,gb),nz=e=>po(e,HR,ZL),Nh=e=>po(e,VR,XL),je=e=>PR.test(e),Vc=e=>ca(e,UR),rz=e=>ca(e,$R),CC=e=>ca(e,IR),iz=e=>ca(e,FR),sz=e=>ca(e,HR),Ah=e=>ca(e,VR,!0),oz=e=>ca(e,WR,!0),po=(e,t,n)=>{const r=zR.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ca=(e,t,n=!1)=>{const r=PR.exec(e);return r?r[1]?t(r[1]):n:!1},IR=e=>e==="position"||e==="percentage",HR=e=>e==="image"||e==="url",FR=e=>e==="length"||e==="size"||e==="bg-size",UR=e=>e==="length",az=e=>e==="number",$R=e=>e==="family-name",WR=e=>e==="number"||e==="weight",VR=e=>e==="shadow",lz=()=>{const e=mn("color"),t=mn("font"),n=mn("text"),r=mn("font-weight"),s=mn("tracking"),a=mn("leading"),l=mn("breakpoint"),u=mn("container"),h=mn("spacing"),d=mn("radius"),m=mn("shadow"),g=mn("inset-shadow"),_=mn("text-shadow"),b=mn("drop-shadow"),w=mn("blur"),S=mn("perspective"),C=mn("aspect"),k=mn("ease"),T=mn("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...M(),je,Oe],D=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],F=()=>[je,Oe,h],G=()=>[Ks,"full","auto",...F()],B=()=>[Gs,"none","subgrid",je,Oe],H=()=>["auto",{span:["full",Gs,je,Oe]},Gs,je,Oe],P=()=>[Gs,"auto",je,Oe],U=()=>["auto","min","max","fr",je,Oe],q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...F()],$=()=>[Ks,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...F()],V=()=>[Ks,"screen","full","dvw","lvw","svw","min","max","fit",...F()],Q=()=>[Ks,"screen","full","lh","dvh","lvh","svh","min","max","fit",...F()],N=()=>[e,je,Oe],I=()=>[...M(),CC,SC,{position:[je,Oe]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",iz,JL,{size:[je,Oe]}],de=()=>[gv,Vc,Bo],me=()=>["","none","full",d,je,Oe],ue=()=>["",Ze,Vc,Bo],he=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[Ze,gv,CC,SC],xe=()=>["","none",w,je,Oe],Ne=()=>["none",Ze,je,Oe],ae=()=>["none",Ze,je,Oe],pe=()=>[Ze,je,Oe],Re=()=>[Ks,"full",...F()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ss],breakpoint:[ss],color:[BR],container:[ss],"drop-shadow":[ss],ease:["in","out","in-out"],font:[QL],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ss],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ss],shadow:[ss],spacing:["px",Ze],text:[ss],"text-shadow":[ss],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ks,Oe,je,C]}],container:["container"],columns:[{columns:[Ze,Oe,je,u]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"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:O()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{"inset-s":G(),start:G()}],end:[{"inset-e":G(),end:G()}],"inset-bs":[{"inset-bs":G()}],"inset-be":[{"inset-be":G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[Gs,"auto",je,Oe]}],basis:[{basis:[Ks,"full","auto",u,...F()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ze,Ks,"auto","initial","none",Oe]}],grow:[{grow:["",Ze,je,Oe]}],shrink:[{shrink:["",Ze,je,Oe]}],order:[{order:[Gs,"first","last","none",je,Oe]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:F()}],"gap-x":[{"gap-x":F()}],"gap-y":[{"gap-y":F()}],"justify-content":[{justify:[...q(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...q()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":q()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:F()}],px:[{px:F()}],py:[{py:F()}],ps:[{ps:F()}],pe:[{pe:F()}],pbs:[{pbs:F()}],pbe:[{pbe:F()}],pt:[{pt:F()}],pr:[{pr:F()}],pb:[{pb:F()}],pl:[{pl:F()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":F()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":F()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...Q()]}],"min-block-size":[{"min-block":["auto",...Q()]}],"max-block-size":[{"max-block":["none",...Q()]}],w:[{w:[u,"screen",...$()]}],"min-w":[{"min-w":[u,"screen","none",...$()]}],"max-w":[{"max-w":[u,"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,Vc,Bo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,oz,ez]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gv,Oe]}],"font-family":[{font:[rz,tz,t]}],"font-features":[{"font-features":[Oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,je,Oe]}],"line-clamp":[{"line-clamp":[Ze,"none",je,wC]}],leading:[{leading:[a,...F()]}],"list-image":[{"list-image":["none",je,Oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",je,Oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ze,"from-font","auto",je,Bo]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Ze,"auto",je,Oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je,Oe]}],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",je,Oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gs,je,Oe],radial:["",je,Oe],conic:[Gs,je,Oe]},sz,nz]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:de()}],"gradient-via-pos":[{via:de()}],"gradient-to-pos":[{to:de()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:me()}],"rounded-s":[{"rounded-s":me()}],"rounded-e":[{"rounded-e":me()}],"rounded-t":[{"rounded-t":me()}],"rounded-r":[{"rounded-r":me()}],"rounded-b":[{"rounded-b":me()}],"rounded-l":[{"rounded-l":me()}],"rounded-ss":[{"rounded-ss":me()}],"rounded-se":[{"rounded-se":me()}],"rounded-ee":[{"rounded-ee":me()}],"rounded-es":[{"rounded-es":me()}],"rounded-tl":[{"rounded-tl":me()}],"rounded-tr":[{"rounded-tr":me()}],"rounded-br":[{"rounded-br":me()}],"rounded-bl":[{"rounded-bl":me()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ze,je,Oe]}],"outline-w":[{outline:["",Ze,Vc,Bo]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",m,Ah,Nh]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",g,Ah,Nh]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Ze,Bo]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",_,Ah,Nh]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Ze,je,Oe]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"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":[Ze]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[je,Oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[Ze]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",je,Oe]}],filter:[{filter:["","none",je,Oe]}],blur:[{blur:xe()}],brightness:[{brightness:[Ze,je,Oe]}],contrast:[{contrast:[Ze,je,Oe]}],"drop-shadow":[{"drop-shadow":["","none",b,Ah,Nh]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Ze,je,Oe]}],"hue-rotate":[{"hue-rotate":[Ze,je,Oe]}],invert:[{invert:["",Ze,je,Oe]}],saturate:[{saturate:[Ze,je,Oe]}],sepia:[{sepia:["",Ze,je,Oe]}],"backdrop-filter":[{"backdrop-filter":["","none",je,Oe]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Ze,je,Oe]}],"backdrop-contrast":[{"backdrop-contrast":[Ze,je,Oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ze,je,Oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ze,je,Oe]}],"backdrop-invert":[{"backdrop-invert":["",Ze,je,Oe]}],"backdrop-opacity":[{"backdrop-opacity":[Ze,je,Oe]}],"backdrop-saturate":[{"backdrop-saturate":[Ze,je,Oe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ze,je,Oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":F()}],"border-spacing-x":[{"border-spacing-x":F()}],"border-spacing-y":[{"border-spacing-y":F()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",je,Oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ze,"initial",je,Oe]}],ease:[{ease:["linear","initial",k,je,Oe]}],delay:[{delay:[Ze,je,Oe]}],animate:[{animate:["none",T,je,Oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,je,Oe]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[je,Oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",je,Oe]}],"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":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mbs":[{"scroll-mbs":F()}],"scroll-mbe":[{"scroll-mbe":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pbs":[{"scroll-pbs":F()}],"scroll-pbe":[{"scroll-pbe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"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",je,Oe]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Ze,Vc,Bo,wC]}],stroke:[{stroke:["none",...N()]}],"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"]}},cz=FL(lz);function be(...e){return cz(AR(e))}function vv(){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 kC(e){return e.startsWith("chatId:")?e.slice(7):e}const vb=bL("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 disabled:bg-transparent disabled:text-foreground/50 border-inpu 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"}}),Je=y.forwardRef(({className:e,variant:t,size:n,...r},s)=>p.jsx("button",{className:be(vb({variant:t,size:n,className:e})),ref:s,...r}));Je.displayName="Button";function Ae(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function EC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _b(...e){return t=>{let n=!1;const r=e.map(s=>{const a=EC(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():EC(e[s],null)}}}}function _t(...e){return y.useCallback(_b(...e),e)}function uz(e,t){const n=y.createContext(t),r=a=>{const{children:l,...u}=a,h=y.useMemo(()=>u,Object.values(u));return p.jsx(n.Provider,{value:h,children:l})};r.displayName=e+"Provider";function s(a){const l=y.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,s]}function vs(e,t=[]){let n=[];function r(a,l){const u=y.createContext(l),h=n.length;n=[...n,l];const d=g=>{var k;const{scope:_,children:b,...w}=g,S=((k=_==null?void 0:_[e])==null?void 0:k[h])||u,C=y.useMemo(()=>w,Object.values(w));return p.jsx(S.Provider,{value:C,children:b})};d.displayName=a+"Provider";function m(g,_){var S;const b=((S=_==null?void 0:_[e])==null?void 0:S[h])||u,w=y.useContext(b);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${g}\` must be used within \`${a}\``)}return[d,m]}const s=()=>{const a=n.map(l=>y.createContext(l));return function(u){const h=(u==null?void 0:u[e])||a;return y.useMemo(()=>({[`__scope${e}`]:{...u,[e]:h}}),[u,h])}};return s.scopeName=e,[r,dz(s,...t)]}function dz(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const l=r.reduce((u,{useScope:h,scopeName:d})=>{const g=h(a)[`__scope${d}`];return{...u,...g}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Kn=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},hz=lR[" useId ".trim().toString()]||(()=>{}),fz=0;function ds(e){const[t,n]=y.useState(hz());return Kn(()=>{n(r=>r??String(fz++))},[e]),t?`radix-${t}`:""}var pz=lR[" useInsertionEffect ".trim().toString()]||Kn;function Rl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,a,l]=mz({defaultProp:t,onChange:n}),u=e!==void 0,h=u?e:s;{const m=y.useRef(e!==void 0);y.useEffect(()=>{const g=m.current;g!==u&&console.warn(`${r} is changing from ${g?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=u},[u,r])}const d=y.useCallback(m=>{var g;if(u){const _=gz(m)?m(e):m;_!==e&&((g=l.current)==null||g.call(l,_))}else a(m)},[u,e,a,l]);return[h,d]}function mz({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),s=y.useRef(n),a=y.useRef(t);return pz(()=>{a.current=t},[t]),y.useEffect(()=>{var l;s.current!==n&&((l=a.current)==null||l.call(a,n),s.current=n)},[n,s]),[n,r,a]}function gz(e){return typeof e=="function"}function Qo(e){const t=vz(e),n=y.forwardRef((r,s)=>{const{children:a,...l}=r,u=y.Children.toArray(a),h=u.find(yz);if(h){const d=h.props.children,m=u.map(g=>g===h?y.Children.count(d)>1?y.Children.only(null):y.isValidElement(d)?d.props.children:null:g);return p.jsx(t,{...l,ref:s,children:y.isValidElement(d)?y.cloneElement(d,void 0,m):null})}return p.jsx(t,{...l,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function vz(e){const t=y.forwardRef((n,r)=>{const{children:s,...a}=n;if(y.isValidElement(s)){const l=xz(s),u=bz(a,s.props);return s.type!==y.Fragment&&(u.ref=r?_b(r,l):l),y.cloneElement(s,u)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qR=Symbol("radix.slottable");function _z(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=qR,t}function yz(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qR}function bz(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...u)=>{const h=a(...u);return s(...u),h}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function xz(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rt=wz.reduce((e,t)=>{const n=Qo(`Primitive.${t}`),r=y.forwardRef((s,a)=>{const{asChild:l,...u}=s,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(h,{...u,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function KR(e,t){e&&Mi.flushSync(()=>e.dispatchEvent(t))}function hi(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Sz(e,t=globalThis==null?void 0:globalThis.document){const n=hi(e);y.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Cz="DismissableLayer",E_="dismissableLayer.update",kz="dismissableLayer.pointerDownOutside",Ez="dismissableLayer.focusOutside",RC,GR=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Bl=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:l,onDismiss:u,...h}=e,d=y.useContext(GR),[m,g]=y.useState(null),_=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=y.useState({}),w=_t(t,j=>g(j)),S=Array.from(d.layers),[C]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=S.indexOf(C),T=m?S.indexOf(m):-1,R=d.layersWithOutsidePointerEventsDisabled.size>0,M=T>=k,O=Mz(j=>{const F=j.target,G=[...d.branches].some(B=>B.contains(F));!M||G||(s==null||s(j),l==null||l(j),j.defaultPrevented||u==null||u())},_),D=Nz(j=>{const F=j.target;[...d.branches].some(B=>B.contains(F))||(a==null||a(j),l==null||l(j),j.defaultPrevented||u==null||u())},_);return Sz(j=>{T===d.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&u&&(j.preventDefault(),u()))},_),y.useEffect(()=>{if(m)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(RC=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),TC(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=RC)}},[m,_,n,d]),y.useEffect(()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),TC())},[m,d]),y.useEffect(()=>{const j=()=>b({});return document.addEventListener(E_,j),()=>document.removeEventListener(E_,j)},[]),p.jsx(rt.div,{...h,ref:w,style:{pointerEvents:R?M?"auto":"none":void 0,...e.style},onFocusCapture:Ae(e.onFocusCapture,D.onFocusCapture),onBlurCapture:Ae(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Ae(e.onPointerDownCapture,O.onPointerDownCapture)})});Bl.displayName=Cz;var Rz="DismissableLayerBranch",Tz=y.forwardRef((e,t)=>{const n=y.useContext(GR),r=y.useRef(null),s=_t(t,r);return y.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),p.jsx(rt.div,{...e,ref:s})});Tz.displayName=Rz;function Mz(e,t=globalThis==null?void 0:globalThis.document){const n=hi(e),r=y.useRef(!1),s=y.useRef(()=>{});return y.useEffect(()=>{const a=u=>{if(u.target&&!r.current){let h=function(){YR(kz,n,d,{discrete:!0})};const d={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=h,t.addEventListener("click",s.current,{once:!0})):h()}else t.removeEventListener("click",s.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Nz(e,t=globalThis==null?void 0:globalThis.document){const n=hi(e),r=y.useRef(!1);return y.useEffect(()=>{const s=a=>{a.target&&!r.current&&YR(Ez,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function TC(){const e=new CustomEvent(E_);document.dispatchEvent(e)}function YR(e,t,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?KR(s,a):s.dispatchEvent(a)}var _v="focusScope.autoFocusOnMount",yv="focusScope.autoFocusOnUnmount",MC={bubbles:!1,cancelable:!0},Az="FocusScope",Yu=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=e,[u,h]=y.useState(null),d=hi(s),m=hi(a),g=y.useRef(null),_=_t(t,S=>h(S)),b=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let S=function(R){if(b.paused||!u)return;const M=R.target;u.contains(M)?g.current=M:Js(g.current,{select:!0})},C=function(R){if(b.paused||!u)return;const M=R.relatedTarget;M!==null&&(u.contains(M)||Js(g.current,{select:!0}))},k=function(R){if(document.activeElement===document.body)for(const O of R)O.removedNodes.length>0&&Js(u)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const T=new MutationObserver(k);return u&&T.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),T.disconnect()}}},[r,u,b.paused]),y.useEffect(()=>{if(u){AC.add(b);const S=document.activeElement;if(!u.contains(S)){const k=new CustomEvent(_v,MC);u.addEventListener(_v,d),u.dispatchEvent(k),k.defaultPrevented||(Dz(Pz(XR(u)),{select:!0}),document.activeElement===S&&Js(u))}return()=>{u.removeEventListener(_v,d),setTimeout(()=>{const k=new CustomEvent(yv,MC);u.addEventListener(yv,m),u.dispatchEvent(k),k.defaultPrevented||Js(S??document.body,{select:!0}),u.removeEventListener(yv,m),AC.remove(b)},0)}}},[u,d,m,b]);const w=y.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 T=S.currentTarget,[R,M]=Oz(T);R&&M?!S.shiftKey&&k===M?(S.preventDefault(),n&&Js(R,{select:!0})):S.shiftKey&&k===R&&(S.preventDefault(),n&&Js(M,{select:!0})):k===T&&S.preventDefault()}},[n,r,b.paused]);return p.jsx(rt.div,{tabIndex:-1,...l,ref:_,onKeyDown:w})});Yu.displayName=Az;function Dz(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Js(r,{select:t}),document.activeElement!==n)return}function Oz(e){const t=XR(e),n=NC(t,e),r=NC(t.reverse(),e);return[n,r]}function XR(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function NC(e,t){for(const n of e)if(!jz(n,{upTo:t}))return n}function jz(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 Lz(e){return e instanceof HTMLInputElement&&"select"in e}function Js(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Lz(e)&&t&&e.select()}}var AC=zz();function zz(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=DC(e,t),e.unshift(t)},remove(t){var n;e=DC(e,t),(n=e[0])==null||n.resume()}}}function DC(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Pz(e){return e.filter(t=>t.tagName!=="A")}var Bz="Portal",Il=y.forwardRef((e,t)=>{var u;const{container:n,...r}=e,[s,a]=y.useState(!1);Kn(()=>a(!0),[]);const l=n||s&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?yL.createPortal(p.jsx(rt.div,{...r,ref:t}),l):null});Il.displayName=Bz;function Iz(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var ti=e=>{const{present:t,children:n}=e,r=Hz(t),s=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),a=_t(r.ref,Fz(s));return typeof n=="function"||r.isPresent?y.cloneElement(s,{ref:a}):null};ti.displayName="Presence";function Hz(e){const[t,n]=y.useState(),r=y.useRef(null),s=y.useRef(e),a=y.useRef("none"),l=e?"mounted":"unmounted",[u,h]=Iz(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const d=Dh(r.current);a.current=u==="mounted"?d:"none"},[u]),Kn(()=>{const d=r.current,m=s.current;if(m!==e){const _=a.current,b=Dh(d);e?h("MOUNT"):b==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(m&&_!==b?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),Kn(()=>{if(t){let d;const m=t.ownerDocument.defaultView??window,g=b=>{const S=Dh(r.current).includes(CSS.escape(b.animationName));if(b.target===t&&S&&(h("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",d=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},_=b=>{b.target===t&&(a.current=Dh(r.current))};return t.addEventListener("animationstart",_),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{m.clearTimeout(d),t.removeEventListener("animationstart",_),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:y.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Dh(e){return(e==null?void 0:e.animationName)||"none"}function Fz(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bv=0;function gp(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??OC()),document.body.insertAdjacentElement("beforeend",e[1]??OC()),bv++,()=>{bv===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),bv--}},[])}function OC(){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 Ti=function(){return Ti=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Ti.apply(this,arguments)};function ZR(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Uz(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,a;r<s;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ff="right-scroll-bar-position",pf="width-before-scroll-bar",$z="with-scroll-bars-hidden",Wz="--removed-body-scroll-bar-size";function xv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Vz(e,t){var n=y.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var qz=typeof window<"u"?y.useLayoutEffect:y.useEffect,jC=new WeakMap;function Kz(e,t){var n=Vz(null,function(r){return e.forEach(function(s){return xv(s,r)})});return qz(function(){var r=jC.get(n);if(r){var s=new Set(r),a=new Set(e),l=n.current;s.forEach(function(u){a.has(u)||xv(u,null)}),a.forEach(function(u){s.has(u)||xv(u,l)})}jC.set(n,e)},[e]),n}function Gz(e){return e}function Yz(e,t){t===void 0&&(t=Gz);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,r);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(r=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(u){return a(u)},filter:function(){return n}}},assignMedium:function(a){r=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(a),l=n}var h=function(){var m=l;l=[],m.forEach(a)},d=function(){return Promise.resolve().then(h)};d(),n={push:function(m){l.push(m),d()},filter:function(m){return l=l.filter(m),n}}}};return s}function Xz(e){e===void 0&&(e={});var t=Yz(null);return t.options=Ti({async:!0,ssr:!1},e),t}var QR=function(e){var t=e.sideCar,n=ZR(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 y.createElement(r,Ti({},n))};QR.isSideCarExport=!0;function Zz(e,t){return e.useMedium(t),QR}var JR=Xz(),wv=function(){},vp=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:wv,onWheelCapture:wv,onTouchMoveCapture:wv}),s=r[0],a=r[1],l=e.forwardProps,u=e.children,h=e.className,d=e.removeScrollBar,m=e.enabled,g=e.shards,_=e.sideCar,b=e.noRelative,w=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,T=k===void 0?"div":k,R=e.gapMode,M=ZR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=_,D=Kz([n,t]),j=Ti(Ti({},M),s);return y.createElement(y.Fragment,null,m&&y.createElement(O,{sideCar:JR,removeScrollBar:d,shards:g,noRelative:b,noIsolation:w,inert:S,setCallbacks:a,allowPinchZoom:!!C,lockRef:n,gapMode:R}),l?y.cloneElement(y.Children.only(u),Ti(Ti({},j),{ref:D})):y.createElement(T,Ti({},j,{className:h,ref:D}),u))});vp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vp.classNames={fullWidth:pf,zeroRight:ff};var Qz=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Jz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Qz();return t&&e.setAttribute("nonce",t),e}function e6(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function t6(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var n6=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Jz())&&(e6(t,n),t6(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},r6=function(){var e=n6();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},eT=function(){var e=r6(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},i6={left:0,top:0,right:0,gap:0},Sv=function(e){return parseInt(e||"",10)||0},s6=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Sv(n),Sv(r),Sv(s)]},o6=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return i6;var t=s6(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])}},a6=eT(),xl="data-scroll-locked",l6=function(e,t,n,r){var s=e.left,a=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
61
+ .`.concat($z,` {
62
+ overflow: hidden `).concat(r,`;
63
+ padding-right: `).concat(u,"px ").concat(r,`;
64
+ }
65
+ body[`).concat(xl,`] {
66
+ overflow: hidden `).concat(r,`;
67
+ overscroll-behavior: contain;
68
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
69
+ padding-left: `.concat(s,`px;
70
+ padding-top: `).concat(a,`px;
71
+ padding-right: `).concat(l,`px;
72
+ margin-left:0;
73
+ margin-top:0;
74
+ margin-right: `).concat(u,"px ").concat(r,`;
75
+ `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),`
76
+ }
77
+
78
+ .`).concat(ff,` {
79
+ right: `).concat(u,"px ").concat(r,`;
80
+ }
81
+
82
+ .`).concat(pf,` {
83
+ margin-right: `).concat(u,"px ").concat(r,`;
84
+ }
85
+
86
+ .`).concat(ff," .").concat(ff,` {
87
+ right: 0 `).concat(r,`;
88
+ }
89
+
90
+ .`).concat(pf," .").concat(pf,` {
91
+ margin-right: 0 `).concat(r,`;
92
+ }
93
+
94
+ body[`).concat(xl,`] {
95
+ `).concat(Wz,": ").concat(u,`px;
96
+ }
97
+ `)},LC=function(){var e=parseInt(document.body.getAttribute(xl)||"0",10);return isFinite(e)?e:0},c6=function(){y.useEffect(function(){return document.body.setAttribute(xl,(LC()+1).toString()),function(){var e=LC()-1;e<=0?document.body.removeAttribute(xl):document.body.setAttribute(xl,e.toString())}},[])},u6=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;c6();var a=y.useMemo(function(){return o6(s)},[s]);return y.createElement(a6,{styles:l6(a,!t,s,n?"":"!important")})},R_=!1;if(typeof window<"u")try{var Oh=Object.defineProperty({},"passive",{get:function(){return R_=!0,!0}});window.addEventListener("test",Oh,Oh),window.removeEventListener("test",Oh,Oh)}catch{R_=!1}var nl=R_?{passive:!1}:!1,d6=function(e){return e.tagName==="TEXTAREA"},tT=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!d6(e)&&n[t]==="visible")},h6=function(e){return tT(e,"overflowY")},f6=function(e){return tT(e,"overflowX")},zC=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=nT(e,r);if(s){var a=rT(e,r),l=a[1],u=a[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},p6=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},m6=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},nT=function(e,t){return e==="v"?h6(t):f6(t)},rT=function(e,t){return e==="v"?p6(t):m6(t)},g6=function(e,t){return e==="h"&&t==="rtl"?-1:1},v6=function(e,t,n,r,s){var a=g6(e,window.getComputedStyle(t).direction),l=a*r,u=n.target,h=t.contains(u),d=!1,m=l>0,g=0,_=0;do{if(!u)break;var b=rT(e,u),w=b[0],S=b[1],C=b[2],k=S-C-a*w;(w||k)&&nT(e,u)&&(g+=k,_+=w);var T=u.parentNode;u=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!h&&u!==document.body||h&&(t.contains(u)||t===u));return(m&&Math.abs(g)<1||!m&&Math.abs(_)<1)&&(d=!0),d},jh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},PC=function(e){return[e.deltaX,e.deltaY]},BC=function(e){return e&&"current"in e?e.current:e},_6=function(e,t){return e[0]===t[0]&&e[1]===t[1]},y6=function(e){return`
98
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
99
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
100
+ `)},b6=0,rl=[];function x6(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),s=y.useState(b6++)[0],a=y.useState(eT)[0],l=y.useRef(e);y.useEffect(function(){l.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var S=Uz([e.lockRef.current],(e.shards||[]).map(BC),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var u=y.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var k=jh(S),T=n.current,R="deltaX"in S?S.deltaX:T[0]-k[0],M="deltaY"in S?S.deltaY:T[1]-k[1],O,D=S.target,j=Math.abs(R)>Math.abs(M)?"h":"v";if("touches"in S&&j==="h"&&D.type==="range")return!1;var F=window.getSelection(),G=F&&F.anchorNode,B=G?G===D||G.contains(D):!1;if(B)return!1;var H=zC(j,D);if(!H)return!0;if(H?O=j:(O=j==="v"?"h":"v",H=zC(j,D)),!H)return!1;if(!r.current&&"changedTouches"in S&&(R||M)&&(r.current=O),!O)return!0;var P=r.current||O;return v6(P,C,S,P==="h"?R:M)},[]),h=y.useCallback(function(S){var C=S;if(!(!rl.length||rl[rl.length-1]!==a)){var k="deltaY"in C?PC(C):jh(C),T=t.current.filter(function(O){return O.name===C.type&&(O.target===C.target||C.target===O.shadowParent)&&_6(O.delta,k)})[0];if(T&&T.should){C.cancelable&&C.preventDefault();return}if(!T){var R=(l.current.shards||[]).map(BC).filter(Boolean).filter(function(O){return O.contains(C.target)}),M=R.length>0?u(C,R[0]):!l.current.noIsolation;M&&C.cancelable&&C.preventDefault()}}},[]),d=y.useCallback(function(S,C,k,T){var R={name:S,delta:C,target:k,should:T,shadowParent:w6(k)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(M){return M!==R})},1)},[]),m=y.useCallback(function(S){n.current=jh(S),r.current=void 0},[]),g=y.useCallback(function(S){d(S.type,PC(S),S.target,u(S,e.lockRef.current))},[]),_=y.useCallback(function(S){d(S.type,jh(S),S.target,u(S,e.lockRef.current))},[]);y.useEffect(function(){return rl.push(a),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:_}),document.addEventListener("wheel",h,nl),document.addEventListener("touchmove",h,nl),document.addEventListener("touchstart",m,nl),function(){rl=rl.filter(function(S){return S!==a}),document.removeEventListener("wheel",h,nl),document.removeEventListener("touchmove",h,nl),document.removeEventListener("touchstart",m,nl)}},[]);var b=e.removeScrollBar,w=e.inert;return y.createElement(y.Fragment,null,w?y.createElement(a,{styles:y6(s)}):null,b?y.createElement(u6,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function w6(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const S6=Zz(JR,x6);var Xu=y.forwardRef(function(e,t){return y.createElement(vp,Ti({},e,{ref:t,sideCar:S6}))});Xu.classNames=vp.classNames;var C6=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},il=new WeakMap,Lh=new WeakMap,zh={},Cv=0,iT=function(e){return e&&(e.host||iT(e.parentNode))},k6=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=iT(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})},E6=function(e,t,n,r){var s=k6(t,Array.isArray(e)?e:[e]);zh[n]||(zh[n]=new WeakMap);var a=zh[n],l=[],u=new Set,h=new Set(s),d=function(g){!g||u.has(g)||(u.add(g),d(g.parentNode))};s.forEach(d);var m=function(g){!g||h.has(g)||Array.prototype.forEach.call(g.children,function(_){if(u.has(_))m(_);else try{var b=_.getAttribute(r),w=b!==null&&b!=="false",S=(il.get(_)||0)+1,C=(a.get(_)||0)+1;il.set(_,S),a.set(_,C),l.push(_),S===1&&w&&Lh.set(_,!0),C===1&&_.setAttribute(n,"true"),w||_.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",_,k)}})};return m(t),u.clear(),Cv++,function(){l.forEach(function(g){var _=il.get(g)-1,b=a.get(g)-1;il.set(g,_),a.set(g,b),_||(Lh.has(g)||g.removeAttribute(r),Lh.delete(g)),b||g.removeAttribute(n)}),Cv--,Cv||(il=new WeakMap,il=new WeakMap,Lh=new WeakMap,zh={})}},_p=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=C6(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),E6(r,s,n,"aria-hidden")):function(){return null}},yp="Dialog",[sT]=vs(yp),[R6,_i]=sT(yp),oT=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,u=y.useRef(null),h=y.useRef(null),[d,m]=Rl({prop:r,defaultProp:s??!1,onChange:a,caller:yp});return p.jsx(R6,{scope:t,triggerRef:u,contentRef:h,contentId:ds(),titleId:ds(),descriptionId:ds(),open:d,onOpenChange:m,onOpenToggle:y.useCallback(()=>m(g=>!g),[m]),modal:l,children:n})};oT.displayName=yp;var aT="DialogTrigger",T6=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=_i(aT,n),a=_t(t,s.triggerRef);return p.jsx(rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":xb(s.open),...r,ref:a,onClick:Ae(e.onClick,s.onOpenToggle)})});T6.displayName=aT;var yb="DialogPortal",[M6,lT]=sT(yb,{forceMount:void 0}),cT=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,a=_i(yb,t);return p.jsx(M6,{scope:t,forceMount:n,children:y.Children.map(r,l=>p.jsx(ti,{present:n||a.open,children:p.jsx(Il,{asChild:!0,container:s,children:l})}))})};cT.displayName=yb;var Of="DialogOverlay",uT=y.forwardRef((e,t)=>{const n=lT(Of,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=_i(Of,e.__scopeDialog);return a.modal?p.jsx(ti,{present:r||a.open,children:p.jsx(A6,{...s,ref:t})}):null});uT.displayName=Of;var N6=Qo("DialogOverlay.RemoveScroll"),A6=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=_i(Of,n);return p.jsx(Xu,{as:N6,allowPinchZoom:!0,shards:[s.contentRef],children:p.jsx(rt.div,{"data-state":xb(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Jo="DialogContent",dT=y.forwardRef((e,t)=>{const n=lT(Jo,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=_i(Jo,e.__scopeDialog);return p.jsx(ti,{present:r||a.open,children:a.modal?p.jsx(D6,{...s,ref:t}):p.jsx(O6,{...s,ref:t})})});dT.displayName=Jo;var D6=y.forwardRef((e,t)=>{const n=_i(Jo,e.__scopeDialog),r=y.useRef(null),s=_t(t,n.contentRef,r);return y.useEffect(()=>{const a=r.current;if(a)return _p(a)},[]),p.jsx(hT,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ae(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Ae(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:Ae(e.onFocusOutside,a=>a.preventDefault())})}),O6=y.forwardRef((e,t)=>{const n=_i(Jo,e.__scopeDialog),r=y.useRef(!1),s=y.useRef(!1);return p.jsx(hT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),hT=y.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...l}=e,u=_i(Jo,n),h=y.useRef(null),d=_t(t,h);return gp(),p.jsxs(p.Fragment,{children:[p.jsx(Yu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:p.jsx(Bl,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":xb(u.open),...l,ref:d,onDismiss:()=>u.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(j6,{titleId:u.titleId}),p.jsx(z6,{contentRef:h,descriptionId:u.descriptionId})]})]})}),bb="DialogTitle",fT=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=_i(bb,n);return p.jsx(rt.h2,{id:s.titleId,...r,ref:t})});fT.displayName=bb;var pT="DialogDescription",mT=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=_i(pT,n);return p.jsx(rt.p,{id:s.descriptionId,...r,ref:t})});mT.displayName=pT;var gT="DialogClose",vT=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=_i(gT,n);return p.jsx(rt.button,{type:"button",...r,ref:t,onClick:Ae(e.onClick,()=>s.onOpenChange(!1))})});vT.displayName=gT;function xb(e){return e?"open":"closed"}var _T="DialogTitleWarning",[Hne,yT]=uz(_T,{contentName:Jo,titleName:bb,docsSlug:"dialog"}),j6=({titleId:e})=>{const t=yT(_T),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 y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},L6="DialogDescriptionWarning",z6=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yT(L6).contentName}}.`;return y.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},P6=oT,B6=cT,bT=uT,xT=dT,I6=fT,H6=mT,F6=vT;/**
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 U6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),IC=e=>{const t=$6(e);return t.charAt(0).toUpperCase()+t.slice(1)},wT=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),W6=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 V6={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 q6=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:l,...u},h)=>y.createElement("svg",{ref:h,...V6,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:wT("lucide",s),...!a&&!W6(u)&&{"aria-hidden":"true"},...u},[...l.map(([d,m])=>y.createElement(d,m)),...Array.isArray(a)?a:[a]]));/**
120
+ * @license lucide-react v0.562.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */const ke=(e,t)=>{const n=y.forwardRef(({className:r,...s},a)=>y.createElement(q6,{ref:a,iconNode:t,className:wT(`lucide-${U6(IC(e))}`,`lucide-${e}`,r),...s}));return n.displayName=IC(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 K6=[["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"}]],G6=ke("archive",K6);/**
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 Y6=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],X6=ke("arrow-down-to-line",Y6);/**
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"}]],Q6=ke("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 J6=[["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"}]],eP=ke("arrow-left-right",J6);/**
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 tP=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],nP=ke("arrow-up",tP);/**
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 rP=[["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"}]],iP=ke("asterisk",rP);/**
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 sP=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]],oP=ke("book-text",sP);/**
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 aP=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],HC=ke("box",aP);/**
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 lP=[["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"}]],kv=ke("brain",lP);/**
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 cP=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],uP=ke("check-check",cP);/**
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 dP=[["path",{d:"M20 4L9 15",key:"1qkx8z"}],["path",{d:"M21 19L3 19",key:"100sma"}],["path",{d:"M9 15L4 10",key:"9zxff7"}]],hP=ke("check-line",dP);/**
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 fP=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],co=ke("check",fP);/**
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 pP=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],wb=ke("chevron-down",pP);/**
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 mP=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],gP=ke("chevron-left",mP);/**
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 vP=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fs=ke("chevron-right",vP);/**
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 _P=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yP=ke("chevron-up",_P);/**
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 bP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],xP=ke("circle-slash",bP);/**
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 wP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],SP=ke("circle",wP);/**
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 CP=[["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"}]],kP=ke("cloud-download",CP);/**
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 EP=[["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"}]],FC=ke("code-xml",EP);/**
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 RP=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Sb=ke("code",RP);/**
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 TP=[["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"}]],MP=ke("command",TP);/**
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 NP=[["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"}]],Zu=ke("copy",NP);/**
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 AP=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],DP=ke("corner-down-left",AP);/**
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 OP=[["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"}]],jP=ke("eraser",OP);/**
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 LP=[["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"}]],zP=ke("external-link",LP);/**
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 PP=[["path",{d:"M13.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 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],BP=ke("file-archive",PP);/**
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 IP=[["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 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],HP=ke("file-braces",IP);/**
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 FP=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],UP=ke("file-code-corner",FP);/**
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 $P=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],WP=ke("file-headphone",$P);/**
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 VP=[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],ST=ke("file-image",VP);/**
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 qP=[["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"}]],KP=ke("file-pen",qP);/**
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 GP=[["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"}]],YP=ke("file-plus-corner",GP);/**
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 XP=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],ZP=ke("file-spreadsheet",XP);/**
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 QP=[["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"}]],JP=ke("file-text",QP);/**
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 eB=[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m10 17.843 3.033-1.755a.64.64 0 0 1 .967.56v4.704a.65.65 0 0 1-.967.56L10 20.157",key:"17aeo9"}],["rect",{width:"7",height:"6",x:"3",y:"16",rx:"1",key:"s27ndx"}]],tB=ke("file-video-camera",eB);/**
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 nB=[["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"}]],CT=ke("file",nB);/**
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 rB=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]],yu=ke("flower",rB);/**
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 iB=[["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"}]],Cb=ke("folder-open",iB);/**
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 sB=[["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"}]],oB=ke("folder",sB);/**
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 aB=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Ph=ke("gauge",aB);/**
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 lB=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],cB=ke("info",lB);/**
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 uB=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],dB=ke("link-2",uB);/**
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 hB=[["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"}]],fB=ke("list-checks",hB);/**
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 pB=[["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"}]],jf=ke("list-todo",pB);/**
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 mB=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],fi=ke("loader-circle",mB);/**
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 gB=[["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"}]],UC=ke("lock-open",gB);/**
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 vB=[["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"}]],$C=ke("map",vB);/**
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 _B=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],kb=ke("menu",_B);/**
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 yB=[["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"}]],kT=ke("message-circle-question-mark",yB);/**
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 bB=[["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"}]],xB=ke("message-square-quote",bB);/**
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 wB=[["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"}]],ET=ke("minimize",wB);/**
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 SB=[["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"}]],Eb=ke("monitor",SB);/**
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 CB=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],kB=ke("moon",CB);/**
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 EB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],T_=ke("panel-left",EB);/**
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 RB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],TB=ke("panel-right",RB);/**
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 MB=[["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"}]],NB=ke("paperclip",MB);/**
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 AB=[["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"}]],RT=ke("pencil",AB);/**
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 DB=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Rb=ke("plus",DB);/**
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 OB=[["path",{d:"M13 16H8",key:"wsln4y"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z",key:"ycz6yz"}]],jB=ke("receipt-text",OB);/**
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 LB=[["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"}]],zB=ke("refresh-cw",LB);/**
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 PB=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],BB=ke("scroll-text",PB);/**
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 IB=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ev=ke("search",IB);/**
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 HB=[["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"}]],FB=ke("send",HB);/**
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 UB=[["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"}]],$B=ke("settings",UB);/**
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 WB=[["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"}]],VB=ke("settings-2",WB);/**
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 qB=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],KB=ke("slash",qB);/**
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 GB=[["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"}]],YB=ke("sparkles",GB);/**
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 XB=[["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"}]],WC=ke("square-menu",XB);/**
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 ZB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]],VC=ke("square-minus",ZB);/**
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 QB=[["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"}]],Tb=ke("square-pen",QB);/**
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 JB=[["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"}]],eI=ke("square-x",JB);/**
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 tI=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],nI=ke("sun",tI);/**
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 rI=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Mb=ke("terminal",rI);/**
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 iI=[["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"}]],sI=ke("toy-brick",iI);/**
500
+ * @license lucide-react v0.562.0 - ISC
501
+ *
502
+ * This source code is licensed under the ISC license.
503
+ * See the LICENSE file in the root directory of this source tree.
504
+ */const oI=[["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"}]],aI=ke("trash-2",oI);/**
505
+ * @license lucide-react v0.562.0 - ISC
506
+ *
507
+ * This source code is licensed under the ISC license.
508
+ * See the LICENSE file in the root directory of this source tree.
509
+ */const lI=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],cI=ke("upload",lI);/**
510
+ * @license lucide-react v0.562.0 - ISC
511
+ *
512
+ * This source code is licensed under the ISC license.
513
+ * See the LICENSE file in the root directory of this source tree.
514
+ */const uI=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Nb=ke("user-round",uI);/**
515
+ * @license lucide-react v0.562.0 - ISC
516
+ *
517
+ * This source code is licensed under the ISC license.
518
+ * See the LICENSE file in the root directory of this source tree.
519
+ */const dI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],mo=ke("x",dI),Nu="data-focus-fallback-ignore",TT="data-allow-focus-retain",Lf="kanna:restore-chat-input-focus",Ab="data-chat-input",zf="data-chat-selection-zone";function Ko(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function MT(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:Ko(e,TT):!1}function hI(e){const t=e;return t!=null&&t.matches?MT(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Ko(e,TT):!1}function qC(e){return!!e.querySelector(`[${Nu}][data-state='open']`)}function fI(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function pI(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Ab}]`)).filter(l=>!l.disabled);if(n.length===0)return!1;const r=n.indexOf(e),s=r>=0?(r+1)%n.length:0,a=n[s];return a?(a.focus({preventScroll:!0}),!0):!1}function KC(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||Ko(t,Ab)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:s,pointerEndTarget:a,root:l,hasActiveSelection:u}=e,h=a??s;return!l||!h||!l.contains(h)||Ko(h,Nu)||Ko(t,Nu)||u&&(Ko(s,zf)||Ko(h,zf))||MT(t)?"none":t&&t===h?"restore":hI(t)?"none":"restore"}const Db=P6,mI=B6,NT=y.forwardRef(({className:e,...t},n)=>p.jsx(bT,{ref:n,className:be("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}));NT.displayName=bT.displayName;const gI={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},bp=y.forwardRef(({className:e,children:t,size:n="md",...r},s)=>p.jsxs(mI,{children:[p.jsx(NT,{}),p.jsxs(xT,{ref:s,[Nu]:"",onCloseAutoFocus:a=>{var l;a.preventDefault(),window.dispatchEvent(new Event(Lf)),(l=r.onCloseAutoFocus)==null||l.call(r,a)},className:be("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 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",gI[n],e),...r,children:[t,p.jsxs(F6,{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:[p.jsx(mo,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));bp.displayName=xT.displayName;function vI({className:e,...t}){return p.jsx("div",{className:be("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function Ob({className:e,...t}){return p.jsx(I6,{className:be("text-lg font-medium leading-none tracking-tight",e),...t})}function AT({className:e,...t}){return p.jsx(H6,{className:be("text-sm text-muted-foreground",e),...t})}function jb({className:e,...t}){return p.jsx("div",{className:be("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function Lb({className:e,...t}){return p.jsx("div",{className:be("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function _I({className:e,...t}){return p.jsx("button",{className:be("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}const so=y.forwardRef(({className:e,type:t,...n},r)=>p.jsx("input",{ref:r,type:t,className:be("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}));so.displayName="Input";const DT=y.createContext(null);function yI({children:e}){const[t,n]=y.useState(null),[r,s]=y.useState(""),a=y.useRef(null);y.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(s(t.options.initialValue??""),setTimeout(()=>{var b,w;(b=a.current)==null||b.focus(),(w=a.current)==null||w.select()},0))},[t]);const l=y.useCallback(()=>{n(null),s("")},[]),u=y.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),l())},[l,t]),h=y.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),l())},[l,t,r]),d=y.useCallback(b=>new Promise(w=>{n({kind:"confirm",options:b,resolve:w})}),[]),m=y.useCallback(b=>new Promise(w=>{n({kind:"prompt",options:b,resolve:w})}),[]),g=y.useCallback(b=>new Promise(w=>{n({kind:"alert",options:b,resolve:w})}),[]),_=y.useMemo(()=>({confirm:d,prompt:m,alert:g}),[g,d,m]);return p.jsxs(DT.Provider,{value:_,children:[e,p.jsx(Db,{open:t!==null,onOpenChange:b=>{b||!t||u()},children:p.jsx(bp,{size:"sm",onKeyDown:b=>{b.key!=="Enter"||b.shiftKey||!t||t.kind!=="confirm"||(b.preventDefault(),h())},children:t?p.jsxs(p.Fragment,{children:[p.jsxs(jb,{className:"space-y-4",children:[p.jsx(Ob,{children:t.options.title}),t.options.description?p.jsx(AT,{children:t.options.description}):null,t.kind==="prompt"?p.jsx(so,{ref:a,type:"text",value:r,onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),h())},placeholder:t.options.placeholder}):null]}),p.jsxs(Lb,{children:[p.jsx(Je,{variant:"ghost",size:"sm",onClick:u,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),p.jsx(Je,{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 bI(){const e=y.useContext(DT);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const xI=["top","right","bottom","left"],uo=Math.min,Nr=Math.max,Pf=Math.round,Bh=Math.floor,ji=e=>({x:e,y:e}),wI={left:"right",right:"left",bottom:"top",top:"bottom"};function M_(e,t,n){return Nr(e,uo(t,n))}function ps(e,t){return typeof e=="function"?e(t):e}function ms(e){return e.split("-")[0]}function Hl(e){return e.split("-")[1]}function zb(e){return e==="x"?"y":"x"}function Pb(e){return e==="y"?"height":"width"}function Ni(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Bb(e){return zb(Ni(e))}function SI(e,t,n){n===void 0&&(n=!1);const r=Hl(e),s=Bb(e),a=Pb(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=Bf(l)),[l,Bf(l)]}function CI(e){const t=Bf(e);return[N_(e),t,N_(t)]}function N_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const GC=["left","right"],YC=["right","left"],kI=["top","bottom"],EI=["bottom","top"];function RI(e,t,n){switch(e){case"top":case"bottom":return n?t?YC:GC:t?GC:YC;case"left":case"right":return t?kI:EI;default:return[]}}function TI(e,t,n,r){const s=Hl(e);let a=RI(ms(e),n==="start",r);return s&&(a=a.map(l=>l+"-"+s),t&&(a=a.concat(a.map(N_)))),a}function Bf(e){const t=ms(e);return wI[t]+e.slice(t.length)}function MI(e){return{top:0,right:0,bottom:0,left:0,...e}}function OT(e){return typeof e!="number"?MI(e):{top:e,right:e,bottom:e,left:e}}function If(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function XC(e,t,n){let{reference:r,floating:s}=e;const a=Ni(t),l=Bb(t),u=Pb(l),h=ms(t),d=a==="y",m=r.x+r.width/2-s.width/2,g=r.y+r.height/2-s.height/2,_=r[u]/2-s[u]/2;let b;switch(h){case"top":b={x:m,y:r.y-s.height};break;case"bottom":b={x:m,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:g};break;case"left":b={x:r.x-s.width,y:g};break;default:b={x:r.x,y:r.y}}switch(Hl(t)){case"start":b[l]-=_*(n&&d?-1:1);break;case"end":b[l]+=_*(n&&d?-1:1);break}return b}async function NI(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:a,rects:l,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:m="viewport",elementContext:g="floating",altBoundary:_=!1,padding:b=0}=ps(t,e),w=OT(b),C=u[_?g==="floating"?"reference":"floating":g],k=If(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(C)))==null||n?C:C.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:d,rootBoundary:m,strategy:h})),T=g==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,R=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),M=await(a.isElement==null?void 0:a.isElement(R))?await(a.getScale==null?void 0:a.getScale(R))||{x:1,y:1}:{x:1,y:1},O=If(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:T,offsetParent:R,strategy:h}):T);return{top:(k.top-O.top+w.top)/M.y,bottom:(O.bottom-k.bottom+w.bottom)/M.y,left:(k.left-O.left+w.left)/M.x,right:(O.right-k.right+w.right)/M.x}}const AI=50,DI=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:NI},h=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:m,y:g}=XC(d,r,h),_=r,b=0;const w={};for(let S=0;S<a.length;S++){const C=a[S];if(!C)continue;const{name:k,fn:T}=C,{x:R,y:M,data:O,reset:D}=await T({x:m,y:g,initialPlacement:r,placement:_,strategy:s,middlewareData:w,rects:d,platform:u,elements:{reference:e,floating:t}});m=R??m,g=M??g,w[k]={...w[k],...O},D&&b<AI&&(b++,typeof D=="object"&&(D.placement&&(_=D.placement),D.rects&&(d=D.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):D.rects),{x:m,y:g}=XC(d,_,h)),S=-1)}return{x:m,y:g,placement:_,strategy:s,middlewareData:w}},OI=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:a,platform:l,elements:u,middlewareData:h}=t,{element:d,padding:m=0}=ps(e,t)||{};if(d==null)return{};const g=OT(m),_={x:n,y:r},b=Bb(s),w=Pb(b),S=await l.getDimensions(d),C=b==="y",k=C?"top":"left",T=C?"bottom":"right",R=C?"clientHeight":"clientWidth",M=a.reference[w]+a.reference[b]-_[b]-a.floating[w],O=_[b]-a.reference[b],D=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let j=D?D[R]:0;(!j||!await(l.isElement==null?void 0:l.isElement(D)))&&(j=u.floating[R]||a.floating[w]);const F=M/2-O/2,G=j/2-S[w]/2-1,B=uo(g[k],G),H=uo(g[T],G),P=B,U=j-S[w]-H,q=j/2-S[w]/2+F,W=M_(P,q,U),z=!h.arrow&&Hl(s)!=null&&q!==W&&a.reference[w]/2-(q<P?B:H)-S[w]/2<0,$=z?q<P?q-P:q-U:0;return{[b]:_[b]+$,data:{[b]:W,centerOffset:q-W-$,...z&&{alignmentOffset:$}},reset:z}}}),jI=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:a,rects:l,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:m=!0,crossAxis:g=!0,fallbackPlacements:_,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=ps(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const k=ms(s),T=Ni(u),R=ms(u)===u,M=await(h.isRTL==null?void 0:h.isRTL(d.floating)),O=_||(R||!S?[Bf(u)]:CI(u)),D=w!=="none";!_&&D&&O.push(...TI(u,S,w,M));const j=[u,...O],F=await h.detectOverflow(t,C),G=[];let B=((r=a.flip)==null?void 0:r.overflows)||[];if(m&&G.push(F[k]),g){const q=SI(s,l,M);G.push(F[q[0]],F[q[1]])}if(B=[...B,{placement:s,overflows:G}],!G.every(q=>q<=0)){var H,P;const q=(((H=a.flip)==null?void 0:H.index)||0)+1,W=j[q];if(W&&(!(g==="alignment"?T!==Ni(W):!1)||B.every(V=>Ni(V.placement)===T?V.overflows[0]>0:!0)))return{data:{index:q,overflows:B},reset:{placement:W}};let z=(P=B.filter($=>$.overflows[0]<=0).sort(($,V)=>$.overflows[1]-V.overflows[1])[0])==null?void 0:P.placement;if(!z)switch(b){case"bestFit":{var U;const $=(U=B.filter(V=>{if(D){const Q=Ni(V.placement);return Q===T||Q==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(Q=>Q>0).reduce((Q,N)=>Q+N,0)]).sort((V,Q)=>V[1]-Q[1])[0])==null?void 0:U[0];$&&(z=$);break}case"initialPlacement":z=u;break}if(s!==z)return{reset:{placement:z}}}return{}}}};function ZC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function QC(e){return xI.some(t=>e[t]>=0)}const LI=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...a}=ps(e,t);switch(s){case"referenceHidden":{const l=await r.detectOverflow(t,{...a,elementContext:"reference"}),u=ZC(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:QC(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...a,altBoundary:!0}),u=ZC(l,n.floating);return{data:{escapedOffsets:u,escaped:QC(u)}}}default:return{}}}}},jT=new Set(["left","top"]);async function zI(e,t){const{placement:n,platform:r,elements:s}=e,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=ms(n),u=Hl(n),h=Ni(n)==="y",d=jT.has(l)?-1:1,m=a&&h?-1:1,g=ps(t,e);let{mainAxis:_,crossAxis:b,alignmentAxis:w}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof w=="number"&&(b=u==="end"?w*-1:w),h?{x:b*m,y:_*d}:{x:_*d,y:b*m}}const PI=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:a,placement:l,middlewareData:u}=t,h=await zI(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:a+h.y,data:{...h,placement:l}}}}},BI=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:a}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:T,y:R}=k;return{x:T,y:R}}},...d}=ps(e,t),m={x:n,y:r},g=await a.detectOverflow(t,d),_=Ni(ms(s)),b=zb(_);let w=m[b],S=m[_];if(l){const k=b==="y"?"top":"left",T=b==="y"?"bottom":"right",R=w+g[k],M=w-g[T];w=M_(R,w,M)}if(u){const k=_==="y"?"top":"left",T=_==="y"?"bottom":"right",R=S+g[k],M=S-g[T];S=M_(R,S,M)}const C=h.fn({...t,[b]:w,[_]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[b]:l,[_]:u}}}}}},II=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:a,middlewareData:l}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=ps(e,t),m={x:n,y:r},g=Ni(s),_=zb(g);let b=m[_],w=m[g];const S=ps(u,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const R=_==="y"?"height":"width",M=a.reference[_]-a.floating[R]+C.mainAxis,O=a.reference[_]+a.reference[R]-C.mainAxis;b<M?b=M:b>O&&(b=O)}if(d){var k,T;const R=_==="y"?"width":"height",M=jT.has(ms(s)),O=a.reference[g]-a.floating[R]+(M&&((k=l.offset)==null?void 0:k[g])||0)+(M?0:C.crossAxis),D=a.reference[g]+a.reference[R]+(M?0:((T=l.offset)==null?void 0:T[g])||0)-(M?C.crossAxis:0);w<O?w=O:w>D&&(w=D)}return{[_]:b,[g]:w}}}},HI=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:a,platform:l,elements:u}=t,{apply:h=()=>{},...d}=ps(e,t),m=await l.detectOverflow(t,d),g=ms(s),_=Hl(s),b=Ni(s)==="y",{width:w,height:S}=a.floating;let C,k;g==="top"||g==="bottom"?(C=g,k=_===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,C=_==="end"?"top":"bottom");const T=S-m.top-m.bottom,R=w-m.left-m.right,M=uo(S-m[C],T),O=uo(w-m[k],R),D=!t.middlewareData.shift;let j=M,F=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(F=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=T),D&&!_){const B=Nr(m.left,0),H=Nr(m.right,0),P=Nr(m.top,0),U=Nr(m.bottom,0);b?F=w-2*(B!==0||H!==0?B+H:Nr(m.left,m.right)):j=S-2*(P!==0||U!==0?P+U:Nr(m.top,m.bottom))}await h({...t,availableWidth:F,availableHeight:j});const G=await l.getDimensions(u.floating);return w!==G.width||S!==G.height?{reset:{rects:!0}}:{}}}};function xp(){return typeof window<"u"}function Fl(e){return LT(e)?(e.nodeName||"").toLowerCase():"#document"}function Ar(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bi(e){var t;return(t=(LT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function LT(e){return xp()?e instanceof Node||e instanceof Ar(e).Node:!1}function pi(e){return xp()?e instanceof Element||e instanceof Ar(e).Element:!1}function _s(e){return xp()?e instanceof HTMLElement||e instanceof Ar(e).HTMLElement:!1}function JC(e){return!xp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ar(e).ShadowRoot}function Qu(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=mi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function FI(e){return/^(table|td|th)$/.test(Fl(e))}function wp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const UI=/transform|translate|scale|rotate|perspective|filter/,$I=/paint|layout|strict|content/,Io=e=>!!e&&e!=="none";let Rv;function Ib(e){const t=pi(e)?mi(e):e;return Io(t.transform)||Io(t.translate)||Io(t.scale)||Io(t.rotate)||Io(t.perspective)||!Hb()&&(Io(t.backdropFilter)||Io(t.filter))||UI.test(t.willChange||"")||$I.test(t.contain||"")}function WI(e){let t=ho(e);for(;_s(t)&&!Tl(t);){if(Ib(t))return t;if(wp(t))return null;t=ho(t)}return null}function Hb(){return Rv==null&&(Rv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Rv}function Tl(e){return/^(html|body|#document)$/.test(Fl(e))}function mi(e){return Ar(e).getComputedStyle(e)}function Sp(e){return pi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ho(e){if(Fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||JC(e)&&e.host||Bi(e);return JC(t)?t.host:t}function zT(e){const t=ho(e);return Tl(t)?e.ownerDocument?e.ownerDocument.body:e.body:_s(t)&&Qu(t)?t:zT(t)}function Au(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=zT(e),a=s===((r=e.ownerDocument)==null?void 0:r.body),l=Ar(s);if(a){const u=A_(l);return t.concat(l,l.visualViewport||[],Qu(s)?s:[],u&&n?Au(u):[])}else return t.concat(s,Au(s,[],n))}function A_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function PT(e){const t=mi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=_s(e),a=s?e.offsetWidth:n,l=s?e.offsetHeight:r,u=Pf(n)!==a||Pf(r)!==l;return u&&(n=a,r=l),{width:n,height:r,$:u}}function Fb(e){return pi(e)?e:e.contextElement}function wl(e){const t=Fb(e);if(!_s(t))return ji(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:a}=PT(t);let l=(a?Pf(n.width):n.width)/r,u=(a?Pf(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const VI=ji(0);function BT(e){const t=Ar(e);return!Hb()||!t.visualViewport?VI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ar(e)?!1:t}function ea(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=Fb(e);let l=ji(1);t&&(r?pi(r)&&(l=wl(r)):l=wl(e));const u=qI(a,n,r)?BT(a):ji(0);let h=(s.left+u.x)/l.x,d=(s.top+u.y)/l.y,m=s.width/l.x,g=s.height/l.y;if(a){const _=Ar(a),b=r&&pi(r)?Ar(r):r;let w=_,S=A_(w);for(;S&&r&&b!==w;){const C=wl(S),k=S.getBoundingClientRect(),T=mi(S),R=k.left+(S.clientLeft+parseFloat(T.paddingLeft))*C.x,M=k.top+(S.clientTop+parseFloat(T.paddingTop))*C.y;h*=C.x,d*=C.y,m*=C.x,g*=C.y,h+=R,d+=M,w=Ar(S),S=A_(w)}}return If({width:m,height:g,x:h,y:d})}function Cp(e,t){const n=Sp(e).scrollLeft;return t?t.left+n:ea(Bi(e)).left+n}function IT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Cp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function KI(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const a=s==="fixed",l=Bi(r),u=t?wp(t.floating):!1;if(r===l||u&&a)return n;let h={scrollLeft:0,scrollTop:0},d=ji(1);const m=ji(0),g=_s(r);if((g||!g&&!a)&&((Fl(r)!=="body"||Qu(l))&&(h=Sp(r)),g)){const b=ea(r);d=wl(r),m.x=b.x+r.clientLeft,m.y=b.y+r.clientTop}const _=l&&!g&&!a?IT(l,h):ji(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+m.x+_.x,y:n.y*d.y-h.scrollTop*d.y+m.y+_.y}}function GI(e){return Array.from(e.getClientRects())}function YI(e){const t=Bi(e),n=Sp(e),r=e.ownerDocument.body,s=Nr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Nr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Cp(e);const u=-n.scrollTop;return mi(r).direction==="rtl"&&(l+=Nr(t.clientWidth,r.clientWidth)-s),{width:s,height:a,x:l,y:u}}const e2=25;function XI(e,t){const n=Ar(e),r=Bi(e),s=n.visualViewport;let a=r.clientWidth,l=r.clientHeight,u=0,h=0;if(s){a=s.width,l=s.height;const m=Hb();(!m||m&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=Cp(r);if(d<=0){const m=r.ownerDocument,g=m.body,_=getComputedStyle(g),b=m.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,w=Math.abs(r.clientWidth-g.clientWidth-b);w<=e2&&(a-=w)}else d<=e2&&(a+=d);return{width:a,height:l,x:u,y:h}}function ZI(e,t){const n=ea(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,a=_s(e)?wl(e):ji(1),l=e.clientWidth*a.x,u=e.clientHeight*a.y,h=s*a.x,d=r*a.y;return{width:l,height:u,x:h,y:d}}function t2(e,t,n){let r;if(t==="viewport")r=XI(e,n);else if(t==="document")r=YI(Bi(e));else if(pi(t))r=ZI(t,n);else{const s=BT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return If(r)}function HT(e,t){const n=ho(e);return n===t||!pi(n)||Tl(n)?!1:mi(n).position==="fixed"||HT(n,t)}function QI(e,t){const n=t.get(e);if(n)return n;let r=Au(e,[],!1).filter(u=>pi(u)&&Fl(u)!=="body"),s=null;const a=mi(e).position==="fixed";let l=a?ho(e):e;for(;pi(l)&&!Tl(l);){const u=mi(l),h=Ib(l);!h&&u.position==="fixed"&&(s=null),(a?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Qu(l)&&!h&&HT(e,l))?r=r.filter(m=>m!==l):s=u,l=ho(l)}return t.set(e,r),r}function JI(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const l=[...n==="clippingAncestors"?wp(t)?[]:QI(t,this._c):[].concat(n),r],u=t2(t,l[0],s);let h=u.top,d=u.right,m=u.bottom,g=u.left;for(let _=1;_<l.length;_++){const b=t2(t,l[_],s);h=Nr(b.top,h),d=uo(b.right,d),m=uo(b.bottom,m),g=Nr(b.left,g)}return{width:d-g,height:m-h,x:g,y:h}}function e8(e){const{width:t,height:n}=PT(e);return{width:t,height:n}}function t8(e,t,n){const r=_s(t),s=Bi(t),a=n==="fixed",l=ea(e,!0,a,t);let u={scrollLeft:0,scrollTop:0};const h=ji(0);function d(){h.x=Cp(s)}if(r||!r&&!a)if((Fl(t)!=="body"||Qu(s))&&(u=Sp(t)),r){const b=ea(t,!0,a,t);h.x=b.x+t.clientLeft,h.y=b.y+t.clientTop}else s&&d();a&&!r&&s&&d();const m=s&&!r&&!a?IT(s,u):ji(0),g=l.left+u.scrollLeft-h.x-m.x,_=l.top+u.scrollTop-h.y-m.y;return{x:g,y:_,width:l.width,height:l.height}}function Tv(e){return mi(e).position==="static"}function n2(e,t){if(!_s(e)||mi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Bi(e)===n&&(n=n.ownerDocument.body),n}function FT(e,t){const n=Ar(e);if(wp(e))return n;if(!_s(e)){let s=ho(e);for(;s&&!Tl(s);){if(pi(s)&&!Tv(s))return s;s=ho(s)}return n}let r=n2(e,t);for(;r&&FI(r)&&Tv(r);)r=n2(r,t);return r&&Tl(r)&&Tv(r)&&!Ib(r)?n:r||WI(e)||n}const n8=async function(e){const t=this.getOffsetParent||FT,n=this.getDimensions,r=await n(e.floating);return{reference:t8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function r8(e){return mi(e).direction==="rtl"}const i8={convertOffsetParentRelativeRectToViewportRelativeRect:KI,getDocumentElement:Bi,getClippingRect:JI,getOffsetParent:FT,getElementRects:n8,getClientRects:GI,getDimensions:e8,getScale:wl,isElement:pi,isRTL:r8};function UT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function s8(e,t){let n=null,r;const s=Bi(e);function a(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),a();const d=e.getBoundingClientRect(),{left:m,top:g,width:_,height:b}=d;if(u||t(),!_||!b)return;const w=Bh(g),S=Bh(s.clientWidth-(m+_)),C=Bh(s.clientHeight-(g+b)),k=Bh(m),R={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:Nr(0,uo(1,h))||1};let M=!0;function O(D){const j=D[0].intersectionRatio;if(j!==h){if(!M)return l();j?l(!1,j):r=setTimeout(()=>{l(!1,1e-7)},1e3)}j===1&&!UT(d,e.getBoundingClientRect())&&l(),M=!1}try{n=new IntersectionObserver(O,{...R,root:s.ownerDocument})}catch{n=new IntersectionObserver(O,R)}n.observe(e)}return l(!0),a}function o8(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=Fb(e),m=s||a?[...d?Au(d):[],...t?Au(t):[]]:[];m.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const g=d&&u?s8(d,n):null;let _=-1,b=null;l&&(b=new ResizeObserver(k=>{let[T]=k;T&&T.target===d&&b&&t&&(b.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var R;(R=b)==null||R.observe(t)})),n()}),d&&!h&&b.observe(d),t&&b.observe(t));let w,S=h?ea(e):null;h&&C();function C(){const k=ea(e);S&&!UT(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;m.forEach(T=>{s&&T.removeEventListener("scroll",n),a&&T.removeEventListener("resize",n)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,h&&cancelAnimationFrame(w)}}const a8=PI,l8=BI,c8=jI,u8=HI,d8=LI,r2=OI,h8=II,f8=(e,t,n)=>{const r=new Map,s={platform:i8,...n},a={...s.platform,_c:r};return DI(e,t,{...s,platform:a})};var p8=typeof document<"u",m8=function(){},mf=p8?y.useLayoutEffect:m8;function Hf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Hf(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&e.$$typeof)&&!Hf(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function $T(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function i2(e,t){const n=$T(e);return Math.round(t*n)/n}function Mv(e){const t=y.useRef(e);return mf(()=>{t.current=e}),t}function g8(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:l}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[m,g]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,b]=y.useState(r);Hf(_,r)||b(r);const[w,S]=y.useState(null),[C,k]=y.useState(null),T=y.useCallback(V=>{V!==D.current&&(D.current=V,S(V))},[]),R=y.useCallback(V=>{V!==j.current&&(j.current=V,k(V))},[]),M=a||w,O=l||C,D=y.useRef(null),j=y.useRef(null),F=y.useRef(m),G=h!=null,B=Mv(h),H=Mv(s),P=Mv(d),U=y.useCallback(()=>{if(!D.current||!j.current)return;const V={placement:t,strategy:n,middleware:_};H.current&&(V.platform=H.current),f8(D.current,j.current,V).then(Q=>{const N={...Q,isPositioned:P.current!==!1};q.current&&!Hf(F.current,N)&&(F.current=N,Mi.flushSync(()=>{g(N)}))})},[_,t,n,H,P]);mf(()=>{d===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,g(V=>({...V,isPositioned:!1})))},[d]);const q=y.useRef(!1);mf(()=>(q.current=!0,()=>{q.current=!1}),[]),mf(()=>{if(M&&(D.current=M),O&&(j.current=O),M&&O){if(B.current)return B.current(M,O,U);U()}},[M,O,U,B,G]);const W=y.useMemo(()=>({reference:D,floating:j,setReference:T,setFloating:R}),[T,R]),z=y.useMemo(()=>({reference:M,floating:O}),[M,O]),$=y.useMemo(()=>{const V={position:n,left:0,top:0};if(!z.floating)return V;const Q=i2(z.floating,m.x),N=i2(z.floating,m.y);return u?{...V,transform:"translate("+Q+"px, "+N+"px)",...$T(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:N}},[n,u,z.floating,m.x,m.y]);return y.useMemo(()=>({...m,update:U,refs:W,elements:z,floatingStyles:$}),[m,U,W,z,$])}const v8=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?r2({element:r.current,padding:s}).fn(n):{}:r?r2({element:r,padding:s}).fn(n):{}}}},_8=(e,t)=>{const n=a8(e);return{name:n.name,fn:n.fn,options:[e,t]}},y8=(e,t)=>{const n=l8(e);return{name:n.name,fn:n.fn,options:[e,t]}},b8=(e,t)=>({fn:h8(e).fn,options:[e,t]}),x8=(e,t)=>{const n=c8(e);return{name:n.name,fn:n.fn,options:[e,t]}},w8=(e,t)=>{const n=u8(e);return{name:n.name,fn:n.fn,options:[e,t]}},S8=(e,t)=>{const n=d8(e);return{name:n.name,fn:n.fn,options:[e,t]}},C8=(e,t)=>{const n=v8(e);return{name:n.name,fn:n.fn,options:[e,t]}};var k8="Arrow",WT=y.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...a}=e;return p.jsx(rt.svg,{...a,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});WT.displayName=k8;var E8=WT;function R8(e){const[t,n]=y.useState(void 0);return Kn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let l,u;if("borderBoxSize"in a){const h=a.borderBoxSize,d=Array.isArray(h)?h[0]:h;l=d.inlineSize,u=d.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Ub="Popper",[VT,go]=vs(Ub),[T8,qT]=VT(Ub),KT=e=>{const{__scopePopper:t,children:n}=e,[r,s]=y.useState(null);return p.jsx(T8,{scope:t,anchor:r,onAnchorChange:s,children:n})};KT.displayName=Ub;var GT="PopperAnchor",YT=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,a=qT(GT,n),l=y.useRef(null),u=_t(t,l),h=y.useRef(null);return y.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||l.current,d!==h.current&&a.onAnchorChange(h.current)}),r?null:p.jsx(rt.div,{...s,ref:u})});YT.displayName=GT;var $b="PopperContent",[M8,N8]=VT($b),XT=y.forwardRef((e,t)=>{var he,we,le,xe,Ne,ae;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:m=0,sticky:g="partial",hideWhenDetached:_=!1,updatePositionStrategy:b="optimized",onPlaced:w,...S}=e,C=qT($b,n),[k,T]=y.useState(null),R=_t(t,pe=>T(pe)),[M,O]=y.useState(null),D=R8(M),j=(D==null?void 0:D.width)??0,F=(D==null?void 0:D.height)??0,G=r+(a!=="center"?"-"+a:""),B=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},H=Array.isArray(d)?d:[d],P=H.length>0,U={padding:B,boundary:H.filter(D8),altBoundary:P},{refs:q,floatingStyles:W,placement:z,isPositioned:$,middlewareData:V}=g8({strategy:"fixed",placement:G,whileElementsMounted:(...pe)=>o8(...pe,{animationFrame:b==="always"}),elements:{reference:C.anchor},middleware:[_8({mainAxis:s+F,alignmentAxis:l}),h&&y8({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?b8():void 0,...U}),h&&x8({...U}),w8({...U,apply:({elements:pe,rects:Re,availableWidth:$e,availableHeight:at})=>{const{width:Lt,height:zt}=Re.reference,ut=pe.floating.style;ut.setProperty("--radix-popper-available-width",`${$e}px`),ut.setProperty("--radix-popper-available-height",`${at}px`),ut.setProperty("--radix-popper-anchor-width",`${Lt}px`),ut.setProperty("--radix-popper-anchor-height",`${zt}px`)}}),M&&C8({element:M,padding:u}),O8({arrowWidth:j,arrowHeight:F}),_&&S8({strategy:"referenceHidden",...U})]}),[Q,N]=JT(z),I=hi(w);Kn(()=>{$&&(I==null||I())},[$,I]);const Z=(he=V.arrow)==null?void 0:he.x,L=(we=V.arrow)==null?void 0:we.y,de=((le=V.arrow)==null?void 0:le.centerOffset)!==0,[me,ue]=y.useState();return Kn(()=>{k&&ue(window.getComputedStyle(k).zIndex)},[k]),p.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:$?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[(xe=V.transformOrigin)==null?void 0:xe.x,(Ne=V.transformOrigin)==null?void 0:Ne.y].join(" "),...((ae=V.hide)==null?void 0:ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(M8,{scope:n,placedSide:Q,onArrowChange:O,arrowX:Z,arrowY:L,shouldHideArrow:de,children:p.jsx(rt.div,{"data-side":Q,"data-align":N,...S,ref:R,style:{...S.style,animation:$?void 0:"none"}})})})});XT.displayName=$b;var ZT="PopperArrow",A8={top:"bottom",right:"left",bottom:"top",left:"right"},QT=y.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,a=N8(ZT,r),l=A8[a.placedSide];return p.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:p.jsx(E8,{...s,ref:n,style:{...s.style,display:"block"}})})});QT.displayName=ZT;function D8(e){return e!==null}var O8=e=>({name:"transformOrigin",options:e,fn(t){var C,k,T;const{placement:n,rects:r,middlewareData:s}=t,l=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[d,m]=JT(n),g={start:"0%",center:"50%",end:"100%"}[m],_=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,b=(((T=s.arrow)==null?void 0:T.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=l?g:`${_}px`,S=`${-h}px`):d==="top"?(w=l?g:`${_}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=l?g:`${b}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=l?g:`${b}px`),{data:{x:w,y:S}}}});function JT(e){const[t,n="center"]=e.split("-");return[t,n]}var kp=KT,Ju=YT,Ep=XT,Rp=QT,eM=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"}),j8="VisuallyHidden",tM=y.forwardRef((e,t)=>p.jsx(rt.span,{...e,ref:t,style:{...eM,...e.style}}));tM.displayName=j8;var L8=tM,[Tp]=vs("Tooltip",[go]),Mp=go(),nM="TooltipProvider",z8=700,D_="tooltip.open",[P8,Wb]=Tp(nM),rM=e=>{const{__scopeTooltip:t,delayDuration:n=z8,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:a}=e,l=y.useRef(!0),u=y.useRef(!1),h=y.useRef(0);return y.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),p.jsx(P8,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:y.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:a})};rM.displayName=nM;var Du="Tooltip",[B8,ed]=Tp(Du),iM=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:a,disableHoverableContent:l,delayDuration:u}=e,h=Wb(Du,e.__scopeTooltip),d=Mp(t),[m,g]=y.useState(null),_=ds(),b=y.useRef(0),w=l??h.disableHoverableContent,S=u??h.delayDuration,C=y.useRef(!1),[k,T]=Rl({prop:r,defaultProp:s??!1,onChange:j=>{j?(h.onOpen(),document.dispatchEvent(new CustomEvent(D_))):h.onClose(),a==null||a(j)},caller:Du}),R=y.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),M=y.useCallback(()=>{window.clearTimeout(b.current),b.current=0,C.current=!1,T(!0)},[T]),O=y.useCallback(()=>{window.clearTimeout(b.current),b.current=0,T(!1)},[T]),D=y.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{C.current=!0,T(!0),b.current=0},S)},[S,T]);return y.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),p.jsx(kp,{...d,children:p.jsx(B8,{scope:t,contentId:_,open:k,stateAttribute:R,trigger:m,onTriggerChange:g,onTriggerEnter:y.useCallback(()=>{h.isOpenDelayedRef.current?D():M()},[h.isOpenDelayedRef,D,M]),onTriggerLeave:y.useCallback(()=>{w?O():(window.clearTimeout(b.current),b.current=0)},[O,w]),onOpen:M,onClose:O,disableHoverableContent:w,children:n})})};iM.displayName=Du;var O_="TooltipTrigger",sM=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=ed(O_,n),a=Wb(O_,n),l=Mp(n),u=y.useRef(null),h=_t(t,u,s.onTriggerChange),d=y.useRef(!1),m=y.useRef(!1),g=y.useCallback(()=>d.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),p.jsx(Ju,{asChild:!0,...l,children:p.jsx(rt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:Ae(e.onPointerMove,_=>{_.pointerType!=="touch"&&!m.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ae(e.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:Ae(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Ae(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Ae(e.onBlur,s.onClose),onClick:Ae(e.onClick,s.onClose)})})});sM.displayName=O_;var Vb="TooltipPortal",[I8,H8]=Tp(Vb,{forceMount:void 0}),oM=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,a=ed(Vb,t);return p.jsx(I8,{scope:t,forceMount:n,children:p.jsx(ti,{present:n||a.open,children:p.jsx(Il,{asChild:!0,container:s,children:r})})})};oM.displayName=Vb;var Ml="TooltipContent",aM=y.forwardRef((e,t)=>{const n=H8(Ml,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...a}=e,l=ed(Ml,e.__scopeTooltip);return p.jsx(ti,{present:r||l.open,children:l.disableHoverableContent?p.jsx(lM,{side:s,...a,ref:t}):p.jsx(F8,{side:s,...a,ref:t})})}),F8=y.forwardRef((e,t)=>{const n=ed(Ml,e.__scopeTooltip),r=Wb(Ml,e.__scopeTooltip),s=y.useRef(null),a=_t(t,s),[l,u]=y.useState(null),{trigger:h,onClose:d}=n,m=s.current,{onPointerInTransitChange:g}=r,_=y.useCallback(()=>{u(null),g(!1)},[g]),b=y.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},T=q8(k,C.getBoundingClientRect()),R=K8(k,T),M=G8(S.getBoundingClientRect()),O=X8([...R,...M]);u(O),g(!0)},[g]);return y.useEffect(()=>()=>_(),[_]),y.useEffect(()=>{if(h&&m){const w=C=>b(C,m),S=C=>b(C,h);return h.addEventListener("pointerleave",w),m.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),m.removeEventListener("pointerleave",S)}}},[h,m,b,_]),y.useEffect(()=>{if(l){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},T=(h==null?void 0:h.contains(C))||(m==null?void 0:m.contains(C)),R=!Y8(k,l);T?_():R&&(_(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,m,l,d,_]),p.jsx(lM,{...e,ref:a})}),[U8,$8]=Tp(Du,{isInside:!1}),W8=_z("TooltipContent"),lM=y.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:l,...u}=e,h=ed(Ml,n),d=Mp(n),{onClose:m}=h;return y.useEffect(()=>(document.addEventListener(D_,m),()=>document.removeEventListener(D_,m)),[m]),y.useEffect(()=>{if(h.trigger){const g=_=>{const b=_.target;b!=null&&b.contains(h.trigger)&&m()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[h.trigger,m]),p.jsx(Bl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:g=>g.preventDefault(),onDismiss:m,children:p.jsxs(Ep,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(W8,{children:r}),p.jsx(U8,{scope:n,isInside:!0,children:p.jsx(L8,{id:h.contentId,role:"tooltip",children:s||r})})]})})});aM.displayName=Ml;var cM="TooltipArrow",V8=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Mp(n);return $8(cM,n).isInside?null:p.jsx(Rp,{...s,...r,ref:t})});V8.displayName=cM;function q8(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,s,a)){case a:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function K8(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 G8(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function Y8(e,t){const{x:n,y:r}=e;let s=!1;for(let a=0,l=t.length-1;a<t.length;l=a++){const u=t[a],h=t[l],d=u.x,m=u.y,g=h.x,_=h.y;m>r!=_>r&&n<(g-d)*(r-m)/(_-m)+d&&(s=!s)}return s}function X8(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),Z8(t)}function Z8(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const a=t[t.length-1],l=t[t.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const a=n[n.length-1],l=n[n.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Q8=rM,uM=iM,dM=sM,hM=oM,qb=aM;function J8({className:e,...t}){return p.jsx("kbd",{className:be("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 e7({className:e,...t}){return p.jsx("span",{className:be("inline-flex items-center gap-0.5",e),...t})}const t7="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",n7=Q8,Ff=uM,Uf=dM,Ou=y.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(hM,{children:p.jsx(qb,{ref:r,sideOffset:t,className:be("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border 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})}));Ou.displayName=qb.displayName;const iu=uM,su=dM;function fM(e){return e.toUpperCase()}function r7(e){const t=e.split("+");return p.jsx(e7,{children:t.map((n,r)=>p.jsx(J8,{children:fM(n)},`${n}-${r}`))})}const ml=y.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},a)=>{const l=r===void 0?null:Array.isArray(r)?r[0]??null:r;return p.jsx(hM,{children:p.jsx(qb,{ref:a,sideOffset:t,className:be(t7,e),...s,children:l?r7(l):p.jsx("span",{children:typeof n=="string"?fM(n):n})})})});ml.displayName="HotkeyTooltipContent";const i7="0.20.0",s7={version:i7},ln="Kanna",s2="kanna",o7=".kanna",a7=".kanna-dev",l7="KANNA_RUNTIME_PROFILE",Kb=`kanna/${s7.version}`,c7="[kanna]",u7=`~/${ln}`;function Np(){var t;return(t=globalThis.process)==null?void 0:t.env}function d7(e=Np()){var t;return((t=e==null?void 0:e[l7])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function h7(e=Np()){return d7(e)==="dev"?a7:o7}function f7(e=Np()){return`~/${h7(e)}`}function p7(e=Np()){return`${f7(e)}/keybindings.json`}function Ih(e){return e?`${s2} ${e}`:s2}const o2=e=>{let t;const n=new Set,r=(d,m)=>{const g=typeof d=="function"?d(t):d;if(!Object.is(g,t)){const _=t;t=m??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(b=>b(t,_))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>h,subscribe:d=>(n.add(d),()=>n.delete(d))},h=t=e(r,s,u);return u},m7=(e=>e?o2(e):o2),g7=e=>e;function v7(e,t=g7){const n=jt.useSyncExternalStore(e.subscribe,jt.useCallback(()=>t(e.getState()),[e,t]),jt.useCallback(()=>t(e.getInitialState()),[e,t]));return jt.useDebugValue(n),n}const _7=e=>{const t=m7(e),n=r=>v7(t,r);return Object.assign(n,t),n},ua=(e=>_7);function y7(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var a;const l=h=>h===null?null:JSON.parse(h,void 0),u=(a=n.getItem(s))!=null?a:null;return u instanceof Promise?u.then(l):l(u)},setItem:(s,a)=>n.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>n.removeItem(s)}}const j_=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return j_(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return j_(r)(n)}}}},b7=(e,t)=>(n,r,s)=>{let a={storage:y7(()=>window.localStorage),partialize:C=>C,version:0,merge:(C,k)=>({...k,...C}),...t},l=!1,u=0;const h=new Set,d=new Set;let m=a.storage;if(!m)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...C)},r,s);const g=()=>{const C=a.partialize({...r()});return m.setItem(a.name,{state:C,version:a.version})},_=s.setState;s.setState=(C,k)=>(_(C,k),g());const b=e((...C)=>(n(...C),g()),r,s);s.getInitialState=()=>b;let w;const S=()=>{var C,k;if(!m)return;const T=++u;l=!1,h.forEach(M=>{var O;return M((O=r())!=null?O:b)});const R=((k=a.onRehydrateStorage)==null?void 0:k.call(a,(C=r())!=null?C:b))||void 0;return j_(m.getItem.bind(m))(a.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==a.version){if(a.migrate){const O=a.migrate(M.state,M.version);return O instanceof Promise?O.then(D=>[!0,D]):[!0,O]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var O;if(T!==u)return;const[D,j]=M;if(w=a.merge(j,(O=r())!=null?O:b),n(w,!0),D)return g()}).then(()=>{T===u&&(R==null||R(w,void 0),w=r(),l=!0,d.forEach(M=>M(w)))}).catch(M=>{T===u&&(R==null||R(void 0,M))})};return s.persist={setOptions:C=>{a={...a,...C},C.storage&&(m=C.storage)},clearStorage:()=>{m==null||m.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:C=>(h.add(C),()=>{h.delete(C)}),onFinishHydration:C=>(d.add(C),()=>{d.delete(C)})},a.skipHydration||S(),w||b},da=b7,pM="always",mM="funk",x7=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function a2(e){switch(e){case"never":case"unfocused":case"always":return e;default:return pM}}function l2(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return mM}}const gl=ua()(da(e=>({chatSoundPreference:pM,chatSoundId:mM,setChatSoundPreference:t=>e({chatSoundPreference:a2(t)}),setChatSoundId:t=>e({chatSoundId:l2(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:a2(t==null?void 0:t.chatSoundPreference),chatSoundId:l2(t==null?void 0:t.chatSoundId)}}})),w7={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function S7(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function C7(e){const t=new Audio(w7[e]);return t.preload="auto",t.play()}async function L_(e,t){if(t<=0)return;const n=Array.from({length:t},(r,s)=>new Promise(a=>{window.setTimeout(()=>{C7(e).catch(()=>{}).finally(()=>a())},s*90)}));await Promise.all(n)}function k7(e,t=document){return e==="never"?!1:e==="always"?!0:S7(t)}const td=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>p.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:be("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...s,children:e});function z_(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const E7=[/^(?:\/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 R7(e){const t=e.trim();for(const n of E7){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function gM(e){return e.split("/").pop()||e}function T7(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,a=24*s,l=7*a;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<a?`${Math.floor(n/s)}h`:n<l?`${Math.floor(n/a)}d`:`${Math.floor(n/l)}w`}const M7=new Set(["starting","running"]);function N7({chat:e,activeChatId:t,nowMs:n,onSelectChat:r,onDeleteChat:s}){const a=T7(e.lastMessageAt,n);return p.jsxs("div",{"data-chat-id":kC(e.chatId),className:be("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===kC(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>r(e.chatId),children:[M7.has(e.status)?p.jsx(fi,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?p.jsx("div",{className:"relative ",children:p.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[p.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),p.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?p.jsx("div",{className:"relative ",children:p.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[p.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),p.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,p.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?p.jsx(td,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),p.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[a?p.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:a}):null,p.jsx(Je,{variant:"ghost",size:"icon",className:be("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",a?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),onClick:l=>{l.stopPropagation(),s(e.chatId)},title:"Delete chat",children:p.jsx(G6,{className:"size-3.5"})})]})]},e._id)}function A7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const Ap=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ul(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Gb(e){return"nodeType"in e}function vr(e){var t,n;return e?Ul(e)?e:Gb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Yb(e){const{Document:t}=vr(e);return e instanceof t}function nd(e){return Ul(e)?!1:e instanceof vr(e).HTMLElement}function vM(e){return e instanceof vr(e).SVGElement}function $l(e){return e?Ul(e)?e.document:Gb(e)?Yb(e)?e:nd(e)||vM(e)?e.ownerDocument:document:document:document}const zi=Ap?y.useLayoutEffect:y.useEffect;function Xb(e){const t=y.useRef(e);return zi(()=>{t.current=e}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function D7(){const e=y.useRef(null),t=y.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ju(e,t){t===void 0&&(t=[e]);const n=y.useRef(e);return zi(()=>{n.current!==e&&(n.current=e)},t),n}function rd(e,t){const n=y.useRef();return y.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function $f(e){const t=Xb(e),n=y.useRef(null),r=y.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function P_(e){const t=y.useRef();return y.useEffect(()=>{t.current=e},[e]),t.current}let Nv={};function id(e,t){return y.useMemo(()=>{if(t)return t;const n=Nv[e]==null?0:Nv[e]+1;return Nv[e]=n,e+"-"+n},[e,t])}function _M(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((a,l)=>{const u=Object.entries(l);for(const[h,d]of u){const m=a[h];m!=null&&(a[h]=m+e*d)}return a},{...t})}}const Sl=_M(1),Wf=_M(-1);function O7(e){return"clientX"in e&&"clientY"in e}function Zb(e){if(!e)return!1;const{KeyboardEvent:t}=vr(e.target);return t&&e instanceof t}function j7(e){if(!e)return!1;const{TouchEvent:t}=vr(e.target);return t&&e instanceof t}function B_(e){if(j7(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 O7(e)?{x:e.clientX,y:e.clientY}:null}const Lu=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[Lu.Translate.toString(e),Lu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),c2="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function L7(e){return e.matches(c2)?e:e.querySelector(c2)}const z7={display:"none"};function P7(e){let{id:t,value:n}=e;return jt.createElement("div",{id:t,style:z7},n)}function B7(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return jt.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function I7(){const[e,t]=y.useState("");return{announce:y.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const yM=y.createContext(null);function H7(e){const t=y.useContext(yM);y.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function F7(){const[e]=y.useState(()=>new Set),t=y.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[y.useCallback(r=>{let{type:s,event:a}=r;e.forEach(l=>{var u;return(u=l[s])==null?void 0:u.call(l,a)})},[e]),t]}const U7={draggable:`
520
+ To pick up a draggable item, press the space bar.
521
+ While dragging, use the arrow keys to move the item.
522
+ Press space again to drop the item in its new position, or press escape to cancel.
523
+ `},$7={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 W7(e){let{announcements:t=$7,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=U7}=e;const{announce:a,announcement:l}=I7(),u=id("DndLiveRegion"),[h,d]=y.useState(!1);if(y.useEffect(()=>{d(!0)},[]),H7(y.useMemo(()=>({onDragStart(g){let{active:_}=g;a(t.onDragStart({active:_}))},onDragMove(g){let{active:_,over:b}=g;t.onDragMove&&a(t.onDragMove({active:_,over:b}))},onDragOver(g){let{active:_,over:b}=g;a(t.onDragOver({active:_,over:b}))},onDragEnd(g){let{active:_,over:b}=g;a(t.onDragEnd({active:_,over:b}))},onDragCancel(g){let{active:_,over:b}=g;a(t.onDragCancel({active:_,over:b}))}}),[a,t])),!h)return null;const m=jt.createElement(jt.Fragment,null,jt.createElement(P7,{id:r,value:s.draggable}),jt.createElement(B7,{id:u,announcement:l}));return n?Mi.createPortal(m,n):m}var _n;(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"})(_n||(_n={}));function Vf(){}function u2(e,t){return y.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function V7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const gi=Object.freeze({x:0,y:0});function q7(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K7(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function G7(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Y7(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function d2(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 X7=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=d2(t,t.left,t.top),a=[];for(const l of r){const{id:u}=l,h=n.get(u);if(h){const d=q7(d2(h),s);a.push({id:u,data:{droppableContainer:l,value:d}})}}return a.sort(K7)};function Z7(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=s-r,u=a-n;if(r<s&&n<a){const h=t.width*t.height,d=e.width*e.height,m=l*u,g=m/(h+d-m);return Number(g.toFixed(4))}return 0}const Q7=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const h=Z7(u,t);h>0&&s.push({id:l,data:{droppableContainer:a,value:h}})}}return s.sort(G7)};function J7(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function bM(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:gi}function e9(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return s.reduce((l,u)=>({...l,top:l.top+e*u.y,bottom:l.bottom+e*u.y,left:l.left+e*u.x,right:l.right+e*u.x}),{...n})}}const t9=e9(1);function n9(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 r9(e,t,n){const r=n9(t);if(!r)return e;const{scaleX:s,scaleY:a,x:l,y:u}=r,h=e.left-l-(1-s)*parseFloat(n),d=e.top-u-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),m=s?e.width/s:e.width,g=a?e.height/a:e.height;return{width:m,height:g,top:d,right:h+m,bottom:d+g,left:h}}const i9={ignoreTransform:!1};function Wl(e,t){t===void 0&&(t=i9);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:m}=vr(e).getComputedStyle(e);d&&(n=r9(n,d,m))}const{top:r,left:s,width:a,height:l,bottom:u,right:h}=n;return{top:r,left:s,width:a,height:l,bottom:u,right:h}}function h2(e){return Wl(e,{ignoreTransform:!0})}function s9(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function o9(e,t){return t===void 0&&(t=vr(e).getComputedStyle(e)),t.position==="fixed"}function a9(e,t){t===void 0&&(t=vr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?n.test(a):!1})}function Qb(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(Yb(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!nd(s)||vM(s)||n.includes(s))return n;const a=vr(e).getComputedStyle(s);return s!==e&&a9(s,a)&&n.push(s),o9(s,a)?n:r(s.parentNode)}return e?r(e):n}function xM(e){const[t]=Qb(e,1);return t??null}function Av(e){return!Ap||!e?null:Ul(e)?e:Gb(e)?Yb(e)||e===$l(e).scrollingElement?window:nd(e)?e:null:null}function wM(e){return Ul(e)?e.scrollX:e.scrollLeft}function SM(e){return Ul(e)?e.scrollY:e.scrollTop}function I_(e){return{x:wM(e),y:SM(e)}}var Cn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Cn||(Cn={}));function CM(e){return!Ap||!e?!1:e===document.scrollingElement}function kM(e){const t={x:0,y:0},n=CM(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,u=e.scrollLeft>=r.x;return{isTop:s,isLeft:a,isBottom:l,isRight:u,maxScroll:r,minScroll:t}}const l9={x:.2,y:.2};function c9(e,t,n,r,s){let{top:a,left:l,right:u,bottom:h}=n;r===void 0&&(r=10),s===void 0&&(s=l9);const{isTop:d,isBottom:m,isLeft:g,isRight:_}=kM(e),b={x:0,y:0},w={x:0,y:0},S={height:t.height*s.y,width:t.width*s.x};return!d&&a<=t.top+S.height?(b.y=Cn.Backward,w.y=r*Math.abs((t.top+S.height-a)/S.height)):!m&&h>=t.bottom-S.height&&(b.y=Cn.Forward,w.y=r*Math.abs((t.bottom-S.height-h)/S.height)),!_&&u>=t.right-S.width?(b.x=Cn.Forward,w.x=r*Math.abs((t.right-S.width-u)/S.width)):!g&&l<=t.left+S.width&&(b.x=Cn.Backward,w.x=r*Math.abs((t.left+S.width-l)/S.width)),{direction:b,speed:w}}function u9(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:l}=window;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function EM(e){return e.reduce((t,n)=>Sl(t,I_(n)),gi)}function d9(e){return e.reduce((t,n)=>t+wM(n),0)}function h9(e){return e.reduce((t,n)=>t+SM(n),0)}function f9(e,t){if(t===void 0&&(t=Wl),!e)return;const{top:n,left:r,bottom:s,right:a}=t(e);xM(e)&&(s<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const p9=[["x",["left","right"],d9],["y",["top","bottom"],h9]];class Jb{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=Qb(n),s=EM(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,l,u]of p9)for(const h of l)Object.defineProperty(this,h,{get:()=>{const d=u(r),m=s[a]-d;return this.rect[h]+m},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class bu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function m9(e){const{EventTarget:t}=vr(e);return e instanceof t?e:$l(e)}function Dv(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 Yr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Yr||(Yr={}));function f2(e){e.preventDefault()}function g9(e){e.stopPropagation()}var vt;(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"})(vt||(vt={}));const RM={start:[vt.Space,vt.Enter],cancel:[vt.Esc],end:[vt.Space,vt.Enter,vt.Tab]},v9=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case vt.Right:return{...n,x:n.x+25};case vt.Left:return{...n,x:n.x-25};case vt.Down:return{...n,y:n.y+25};case vt.Up:return{...n,y:n.y-25}}};class e0{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 bu($l(n)),this.windowListeners=new bu(vr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Yr.Resize,this.handleCancel),this.windowListeners.add(Yr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Yr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&f9(r),n(gi)}handleKeyDown(t){if(Zb(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:a=RM,coordinateGetter:l=v9,scrollBehavior:u="smooth"}=s,{code:h}=t;if(a.end.includes(h)){this.handleEnd(t);return}if(a.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:d}=r.current,m=d?{x:d.left,y:d.top}:gi;this.referenceCoordinates||(this.referenceCoordinates=m);const g=l(t,{active:n,context:r.current,currentCoordinates:m});if(g){const _=Wf(g,m),b={x:0,y:0},{scrollableAncestors:w}=r.current;for(const S of w){const C=t.code,{isTop:k,isRight:T,isLeft:R,isBottom:M,maxScroll:O,minScroll:D}=kM(S),j=u9(S),F={x:Math.min(C===vt.Right?j.right-j.width/2:j.right,Math.max(C===vt.Right?j.left:j.left+j.width/2,g.x)),y:Math.min(C===vt.Down?j.bottom-j.height/2:j.bottom,Math.max(C===vt.Down?j.top:j.top+j.height/2,g.y))},G=C===vt.Right&&!T||C===vt.Left&&!R,B=C===vt.Down&&!M||C===vt.Up&&!k;if(G&&F.x!==g.x){const H=S.scrollLeft+_.x,P=C===vt.Right&&H<=O.x||C===vt.Left&&H>=D.x;if(P&&!_.y){S.scrollTo({left:H,behavior:u});return}P?b.x=S.scrollLeft-H:b.x=C===vt.Right?S.scrollLeft-O.x:S.scrollLeft-D.x,b.x&&S.scrollBy({left:-b.x,behavior:u});break}else if(B&&F.y!==g.y){const H=S.scrollTop+_.y,P=C===vt.Down&&H<=O.y||C===vt.Up&&H>=D.y;if(P&&!_.x){S.scrollTo({top:H,behavior:u});return}P?b.y=S.scrollTop-H:b.y=C===vt.Down?S.scrollTop-O.y:S.scrollTop-D.y,b.y&&S.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,Sl(Wf(g,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()}}e0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=RM,onActivation:s}=t,{active:a}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const u=a.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function p2(e){return!!(e&&"distance"in e)}function m2(e){return!!(e&&"delay"in e)}class t0{constructor(t,n,r){var s;r===void 0&&(r=m9(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:a}=t,{target:l}=a;this.props=t,this.events=n,this.document=$l(l),this.documentListeners=new bu(this.document),this.listeners=new bu(r),this.windowListeners=new bu(vr(l)),this.initialCoordinates=(s=B_(a))!=null?s:gi,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(Yr.Resize,this.handleCancel),this.windowListeners.add(Yr.DragStart,f2),this.windowListeners.add(Yr.VisibilityChange,this.handleCancel),this.windowListeners.add(Yr.ContextMenu,f2),this.documentListeners.add(Yr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(m2(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(p2(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Yr.Click,g9,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Yr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:a}=this,{onMove:l,options:{activationConstraint:u}}=a;if(!s)return;const h=(n=B_(t))!=null?n:gi,d=Wf(s,h);if(!r&&u){if(p2(u)){if(u.tolerance!=null&&Dv(d,u.tolerance))return this.handleCancel();if(Dv(d,u.distance))return this.handleStart()}if(m2(u)&&Dv(d,u.tolerance))return this.handleCancel();this.handlePending(u,d);return}t.cancelable&&t.preventDefault(),l(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===vt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const _9={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class n0 extends t0{constructor(t){const{event:n}=t,r=$l(n.target);super(t,_9,r)}}n0.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 y9={move:{name:"mousemove"},end:{name:"mouseup"}};var H_;(function(e){e[e.RightClick=2]="RightClick"})(H_||(H_={}));class b9 extends t0{constructor(t){super(t,y9,$l(t.event.target))}}b9.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===H_.RightClick?!1:(r==null||r({event:n}),!0)}}];const Ov={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class x9 extends t0{constructor(t){super(t,Ov)}static setup(){return window.addEventListener(Ov.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ov.move.name,t)};function t(){}}}x9.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var xu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(xu||(xu={}));var qf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(qf||(qf={}));function w9(e){let{acceleration:t,activator:n=xu.Pointer,canScroll:r,draggingRect:s,enabled:a,interval:l=5,order:u=qf.TreeOrder,pointerCoordinates:h,scrollableAncestors:d,scrollableAncestorRects:m,delta:g,threshold:_}=e;const b=C9({delta:g,disabled:!a}),[w,S]=D7(),C=y.useRef({x:0,y:0}),k=y.useRef({x:0,y:0}),T=y.useMemo(()=>{switch(n){case xu.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case xu.DraggableRect:return s}},[n,s,h]),R=y.useRef(null),M=y.useCallback(()=>{const D=R.current;if(!D)return;const j=C.current.x*k.current.x,F=C.current.y*k.current.y;D.scrollBy(j,F)},[]),O=y.useMemo(()=>u===qf.TreeOrder?[...d].reverse():d,[u,d]);y.useEffect(()=>{if(!a||!d.length||!T){S();return}for(const D of O){if((r==null?void 0:r(D))===!1)continue;const j=d.indexOf(D),F=m[j];if(!F)continue;const{direction:G,speed:B}=c9(D,F,T,t,_);for(const H of["x","y"])b[H][G[H]]||(B[H]=0,G[H]=0);if(B.x>0||B.y>0){S(),R.current=D,w(M,l),C.current=B,k.current=G;return}}C.current={x:0,y:0},k.current={x:0,y:0},S()},[t,M,r,S,a,l,JSON.stringify(T),JSON.stringify(b),w,d,O,m,JSON.stringify(_)])}const S9={x:{[Cn.Backward]:!1,[Cn.Forward]:!1},y:{[Cn.Backward]:!1,[Cn.Forward]:!1}};function C9(e){let{delta:t,disabled:n}=e;const r=P_(t);return rd(s=>{if(n||!r||!s)return S9;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Cn.Backward]:s.x[Cn.Backward]||a.x===-1,[Cn.Forward]:s.x[Cn.Forward]||a.x===1},y:{[Cn.Backward]:s.y[Cn.Backward]||a.y===-1,[Cn.Forward]:s.y[Cn.Forward]||a.y===1}}},[n,t,r])}function k9(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return rd(s=>{var a;return t==null?null:(a=r??s)!=null?a:null},[r,t])}function E9(e,t){return y.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,a=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...a]},[]),[e,t])}var zu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zu||(zu={}));var F_;(function(e){e.Optimized="optimized"})(F_||(F_={}));const g2=new Map;function R9(e,t){let{dragging:n,dependencies:r,config:s}=t;const[a,l]=y.useState(null),{frequency:u,measure:h,strategy:d}=s,m=y.useRef(e),g=C(),_=ju(g),b=y.useCallback(function(k){k===void 0&&(k=[]),!_.current&&l(T=>T===null?k:T.concat(k.filter(R=>!T.includes(R))))},[_]),w=y.useRef(null),S=rd(k=>{if(g&&!n)return g2;if(!k||k===g2||m.current!==e||a!=null){const T=new Map;for(let R of e){if(!R)continue;if(a&&a.length>0&&!a.includes(R.id)&&R.rect.current){T.set(R.id,R.rect.current);continue}const M=R.node.current,O=M?new Jb(h(M),M):null;R.rect.current=O,O&&T.set(R.id,O)}return T}return k},[e,a,n,g,h]);return y.useEffect(()=>{m.current=e},[e]),y.useEffect(()=>{g||b()},[n,g]),y.useEffect(()=>{a&&a.length>0&&l(null)},[JSON.stringify(a)]),y.useEffect(()=>{g||typeof u!="number"||w.current!==null||(w.current=setTimeout(()=>{b(),w.current=null},u))},[u,g,b,...r]),{droppableRects:S,measureDroppableContainers:b,measuringScheduled:a!=null};function C(){switch(d){case zu.Always:return!1;case zu.BeforeDragging:return n;default:return!n}}}function TM(e,t){return rd(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function T9(e,t){return TM(e,t)}function M9(e){let{callback:t,disabled:n}=e;const r=Xb(t),s=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return y.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Dp(e){let{callback:t,disabled:n}=e;const r=Xb(t),s=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return y.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function N9(e){return new Jb(Wl(e),e)}function v2(e,t,n){t===void 0&&(t=N9);const[r,s]=y.useState(null);function a(){s(h=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=h??n)!=null?d:null}const m=t(e);return JSON.stringify(h)===JSON.stringify(m)?h:m})}const l=M9({callback(h){if(e)for(const d of h){const{type:m,target:g}=d;if(m==="childList"&&g instanceof HTMLElement&&g.contains(e)){a();break}}}}),u=Dp({callback:a});return zi(()=>{a(),e?(u==null||u.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),l==null||l.disconnect())},[e]),r}function A9(e){const t=TM(e);return bM(e,t)}const _2=[];function D9(e){const t=y.useRef(e),n=rd(r=>e?r&&r!==_2&&e&&t.current&&e.parentNode===t.current.parentNode?r:Qb(e):_2,[e]);return y.useEffect(()=>{t.current=e},[e]),n}function O9(e){const[t,n]=y.useState(null),r=y.useRef(e),s=y.useCallback(a=>{const l=Av(a.target);l&&n(u=>u?(u.set(l,I_(l)),new Map(u)):null)},[]);return y.useEffect(()=>{const a=r.current;if(e!==a){l(a);const u=e.map(h=>{const d=Av(h);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,I_(d)]):null}).filter(h=>h!=null);n(u.length?new Map(u):null),r.current=e}return()=>{l(e),l(a)};function l(u){u.forEach(h=>{const d=Av(h);d==null||d.removeEventListener("scroll",s)})}},[s,e]),y.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,l)=>Sl(a,l),gi):EM(e):gi,[e,t])}function y2(e,t){t===void 0&&(t=[]);const n=y.useRef(null);return y.useEffect(()=>{n.current=null},t),y.useEffect(()=>{const r=e!==gi;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Wf(e,n.current):gi}function j9(e){y.useEffect(()=>{if(!Ap)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 L9(e,t){return y.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:a}=r;return n[s]=l=>{a(l,t)},n},{}),[e,t])}function MM(e){return y.useMemo(()=>e?s9(e):null,[e])}const b2=[];function z9(e,t){t===void 0&&(t=Wl);const[n]=e,r=MM(n?vr(n):null),[s,a]=y.useState(b2);function l(){a(()=>e.length?e.map(h=>CM(h)?r:new Jb(t(h),h)):b2)}const u=Dp({callback:l});return zi(()=>{u==null||u.disconnect(),l(),e.forEach(h=>u==null?void 0:u.observe(h))},[e]),s}function P9(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nd(t)?t:e}function B9(e){let{measure:t}=e;const[n,r]=y.useState(null),s=y.useCallback(d=>{for(const{target:m}of d)if(nd(m)){r(g=>{const _=t(m);return g?{...g,width:_.width,height:_.height}:_});break}},[t]),a=Dp({callback:s}),l=y.useCallback(d=>{const m=P9(d);a==null||a.disconnect(),m&&(a==null||a.observe(m)),r(m?t(m):null)},[t,a]),[u,h]=$f(l);return y.useMemo(()=>({nodeRef:u,rect:n,setRef:h}),[n,u,h])}const I9=[{sensor:n0,options:{}},{sensor:e0,options:{}}],H9={current:{}},gf={draggable:{measure:h2},droppable:{measure:h2,strategy:zu.WhileDragging,frequency:F_.Optimized},dragOverlay:{measure:Wl}};class wu 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 F9={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new wu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Vf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gf,measureDroppableContainers:Vf,windowRect:null,measuringScheduled:!1},U9={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Vf,draggableNodes:new Map,over:null,measureDroppableContainers:Vf},Op=y.createContext(U9),NM=y.createContext(F9);function $9(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new wu}}}function W9(e,t){switch(t.type){case _n.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case _n.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 _n.DragEnd:case _n.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case _n.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new wu(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case _n.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const l=new wu(e.droppable.containers);return l.set(n,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case _n.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new wu(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function V9(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=y.useContext(Op),a=P_(r),l=P_(n==null?void 0:n.id);return y.useEffect(()=>{if(!t&&!r&&a&&l!=null){if(!Zb(a)||document.activeElement===a.target)return;const u=s.get(l);if(!u)return;const{activatorNode:h,node:d}=u;if(!h.current&&!d.current)return;requestAnimationFrame(()=>{for(const m of[h.current,d.current]){if(!m)continue;const g=L7(m);if(g){g.focus();break}}})}},[r,t,s,l,a]),null}function q9(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...r}),n):n}function K9(e){return y.useMemo(()=>({draggable:{...gf.draggable,...e==null?void 0:e.draggable},droppable:{...gf.droppable,...e==null?void 0:e.droppable},dragOverlay:{...gf.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 G9(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const a=y.useRef(!1),{x:l,y:u}=typeof s=="boolean"?{x:s,y:s}:s;zi(()=>{if(!l&&!u||!t){a.current=!1;return}if(a.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const m=n(d),g=bM(m,r);if(l||(g.x=0),u||(g.y=0),a.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const _=xM(d);_&&_.scrollBy({top:g.y,left:g.x})}},[t,l,u,r,n])}const AM=y.createContext({...gi,scaleX:1,scaleY:1});var to;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(to||(to={}));const Y9=y.memo(function(t){var n,r,s,a;let{id:l,accessibility:u,autoScroll:h=!0,children:d,sensors:m=I9,collisionDetection:g=Q7,measuring:_,modifiers:b,...w}=t;const S=y.useReducer(W9,void 0,$9),[C,k]=S,[T,R]=F7(),[M,O]=y.useState(to.Uninitialized),D=M===to.Initialized,{draggable:{active:j,nodes:F,translate:G},droppable:{containers:B}}=C,H=j!=null?F.get(j):null,P=y.useRef({initial:null,translated:null}),U=y.useMemo(()=>{var xt;return j!=null?{id:j,data:(xt=H==null?void 0:H.data)!=null?xt:H9,rect:P}:null},[j,H]),q=y.useRef(null),[W,z]=y.useState(null),[$,V]=y.useState(null),Q=ju(w,Object.values(w)),N=id("DndDescribedBy",l),I=y.useMemo(()=>B.getEnabled(),[B]),Z=K9(_),{droppableRects:L,measureDroppableContainers:de,measuringScheduled:me}=R9(I,{dragging:D,dependencies:[G.x,G.y],config:Z.droppable}),ue=k9(F,j),he=y.useMemo(()=>$?B_($):null,[$]),we=Zn(),le=T9(ue,Z.draggable.measure);G9({activeNode:j!=null?F.get(j):null,config:we.layoutShiftCompensation,initialRect:le,measure:Z.draggable.measure});const xe=v2(ue,Z.draggable.measure,le),Ne=v2(ue?ue.parentElement:null),ae=y.useRef({activatorEvent:null,active:null,activeNode:ue,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:F,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pe=B.getNodeFor((n=ae.current.over)==null?void 0:n.id),Re=B9({measure:Z.dragOverlay.measure}),$e=(r=Re.nodeRef.current)!=null?r:ue,at=D?(s=Re.rect)!=null?s:xe:null,Lt=!!(Re.nodeRef.current&&Re.rect),zt=A9(Lt?null:xe),ut=MM($e?vr($e):null),yt=D9(D?pe??ue:null),un=z9(yt),en=q9(b,{transform:{x:G.x-zt.x,y:G.y-zt.y,scaleX:1,scaleY:1},activatorEvent:$,active:U,activeNodeRect:xe,containerNodeRect:Ne,draggingNodeRect:at,over:ae.current.over,overlayNodeRect:Re.rect,scrollableAncestors:yt,scrollableAncestorRects:un,windowRect:ut}),bn=he?Sl(he,G):null,Nt=O9(yt),Yn=y2(Nt),Y=y2(Nt,[xe]),oe=Sl(en,Yn),Ee=at?t9(at,en):null,ze=U&&Ee?g({active:U,collisionRect:Ee,droppableRects:L,droppableContainers:I,pointerCoordinates:bn}):null,Fe=Y7(ze,"id"),[dt,ee]=y.useState(null),Ge=Lt?en:Sl(en,Y),pt=J7(Ge,(a=dt==null?void 0:dt.rect)!=null?a:null,xe),ie=y.useRef(null),Te=y.useCallback((xt,Ct)=>{let{sensor:Pt,options:Un}=Ct;if(q.current==null)return;const Dn=F.get(q.current);if(!Dn)return;const hn=xt.nativeEvent,On=new Pt({active:q.current,activeNode:Dn,event:hn,options:Un,context:ae,onAbort(ve){if(!F.get(ve))return;const{onDragAbort:Ye}=Q.current,mt={id:ve};Ye==null||Ye(mt),T({type:"onDragAbort",event:mt})},onPending(ve,Ue,Ye,mt){if(!F.get(ve))return;const{onDragPending:Hi}=Q.current,ni={id:ve,constraint:Ue,initialCoordinates:Ye,offset:mt};Hi==null||Hi(ni),T({type:"onDragPending",event:ni})},onStart(ve){const Ue=q.current;if(Ue==null)return;const Ye=F.get(Ue);if(!Ye)return;const{onDragStart:mt}=Q.current,yr={activatorEvent:hn,active:{id:Ue,data:Ye.data,rect:P}};Mi.unstable_batchedUpdates(()=>{mt==null||mt(yr),O(to.Initializing),k({type:_n.DragStart,initialCoordinates:ve,active:Ue}),T({type:"onDragStart",event:yr}),z(ie.current),V(hn)})},onMove(ve){k({type:_n.DragMove,coordinates:ve})},onEnd:re(_n.DragEnd),onCancel:re(_n.DragCancel)});ie.current=On;function re(ve){return async function(){const{active:Ye,collisions:mt,over:yr,scrollAdjustedTranslate:Hi}=ae.current;let ni=null;if(Ye&&Hi){const{cancelDrop:Ss}=Q.current;ni={activatorEvent:hn,active:Ye,collisions:mt,delta:Hi,over:yr},ve===_n.DragEnd&&typeof Ss=="function"&&await Promise.resolve(Ss(ni))&&(ve=_n.DragCancel)}q.current=null,Mi.unstable_batchedUpdates(()=>{k({type:ve}),O(to.Uninitialized),ee(null),z(null),V(null),ie.current=null;const Ss=ve===_n.DragEnd?"onDragEnd":"onDragCancel";if(ni){const jr=Q.current[Ss];jr==null||jr(ni),T({type:Ss,event:ni})}})}}},[F]),lt=y.useCallback((xt,Ct)=>(Pt,Un)=>{const Dn=Pt.nativeEvent,hn=F.get(Un);if(q.current!==null||!hn||Dn.dndKit||Dn.defaultPrevented)return;const On={active:hn};xt(Pt,Ct.options,On)===!0&&(Dn.dndKit={capturedBy:Ct.sensor},q.current=Un,Te(Pt,Ct))},[F,Te]),bt=E9(m,lt);j9(m),zi(()=>{xe&&M===to.Initializing&&O(to.Initialized)},[xe,M]),y.useEffect(()=>{const{onDragMove:xt}=Q.current,{active:Ct,activatorEvent:Pt,collisions:Un,over:Dn}=ae.current;if(!Ct||!Pt)return;const hn={active:Ct,activatorEvent:Pt,collisions:Un,delta:{x:oe.x,y:oe.y},over:Dn};Mi.unstable_batchedUpdates(()=>{xt==null||xt(hn),T({type:"onDragMove",event:hn})})},[oe.x,oe.y]),y.useEffect(()=>{const{active:xt,activatorEvent:Ct,collisions:Pt,droppableContainers:Un,scrollAdjustedTranslate:Dn}=ae.current;if(!xt||q.current==null||!Ct||!Dn)return;const{onDragOver:hn}=Q.current,On=Un.get(Fe),re=On&&On.rect.current?{id:On.id,rect:On.rect.current,data:On.data,disabled:On.disabled}:null,ve={active:xt,activatorEvent:Ct,collisions:Pt,delta:{x:Dn.x,y:Dn.y},over:re};Mi.unstable_batchedUpdates(()=>{ee(re),hn==null||hn(ve),T({type:"onDragOver",event:ve})})},[Fe]),zi(()=>{ae.current={activatorEvent:$,active:U,activeNode:ue,collisionRect:Ee,collisions:ze,droppableRects:L,draggableNodes:F,draggingNode:$e,draggingNodeRect:at,droppableContainers:B,over:dt,scrollableAncestors:yt,scrollAdjustedTranslate:oe},P.current={initial:at,translated:Ee}},[U,ue,ze,Ee,F,$e,at,L,B,dt,yt,oe]),w9({...we,delta:G,draggingRect:Ee,pointerCoordinates:bn,scrollableAncestors:yt,scrollableAncestorRects:un});const dn=y.useMemo(()=>({active:U,activeNode:ue,activeNodeRect:xe,activatorEvent:$,collisions:ze,containerNodeRect:Ne,dragOverlay:Re,draggableNodes:F,droppableContainers:B,droppableRects:L,over:dt,measureDroppableContainers:de,scrollableAncestors:yt,scrollableAncestorRects:un,measuringConfiguration:Z,measuringScheduled:me,windowRect:ut}),[U,ue,xe,$,ze,Ne,Re,F,B,L,dt,de,yt,un,Z,me,ut]),Xn=y.useMemo(()=>({activatorEvent:$,activators:bt,active:U,activeNodeRect:xe,ariaDescribedById:{draggable:N},dispatch:k,draggableNodes:F,over:dt,measureDroppableContainers:de}),[$,bt,U,xe,k,N,F,dt,de]);return jt.createElement(yM.Provider,{value:R},jt.createElement(Op.Provider,{value:Xn},jt.createElement(NM.Provider,{value:dn},jt.createElement(AM.Provider,{value:pt},d)),jt.createElement(V9,{disabled:(u==null?void 0:u.restoreFocus)===!1})),jt.createElement(W7,{...u,hiddenTextDescribedById:N}));function Zn(){const xt=(W==null?void 0:W.autoScrollEnabled)===!1,Ct=typeof h=="object"?h.enabled===!1:h===!1,Pt=D&&!xt&&!Ct;return typeof h=="object"?{...h,enabled:Pt}:{enabled:Pt}}}),X9=y.createContext(null),x2="button",Z9="Draggable";function Q9(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const a=id(Z9),{activators:l,activatorEvent:u,active:h,activeNodeRect:d,ariaDescribedById:m,draggableNodes:g,over:_}=y.useContext(Op),{role:b=x2,roleDescription:w="draggable",tabIndex:S=0}=s??{},C=(h==null?void 0:h.id)===t,k=y.useContext(C?AM:X9),[T,R]=$f(),[M,O]=$f(),D=L9(l,t),j=ju(n);zi(()=>(g.set(t,{id:t,key:a,node:T,activatorNode:M,data:j}),()=>{const G=g.get(t);G&&G.key===a&&g.delete(t)}),[g,t]);const F=y.useMemo(()=>({role:b,tabIndex:S,"aria-disabled":r,"aria-pressed":C&&b===x2?!0:void 0,"aria-roledescription":w,"aria-describedby":m.draggable}),[r,b,S,C,w,m.draggable]);return{active:h,activatorEvent:u,activeNodeRect:d,attributes:F,isDragging:C,listeners:r?void 0:D,node:T,over:_,setNodeRef:R,setActivatorNodeRef:O,transform:k}}function J9(){return y.useContext(NM)}const eH="Droppable",tH={timeout:25};function nH(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const a=id(eH),{active:l,dispatch:u,over:h,measureDroppableContainers:d}=y.useContext(Op),m=y.useRef({disabled:n}),g=y.useRef(!1),_=y.useRef(null),b=y.useRef(null),{disabled:w,updateMeasurementsFor:S,timeout:C}={...tH,...s},k=ju(S??r),T=y.useCallback(()=>{if(!g.current){g.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]),R=Dp({callback:T,disabled:w||!l}),M=y.useCallback((F,G)=>{R&&(G&&(R.unobserve(G),g.current=!1),F&&R.observe(F))},[R]),[O,D]=$f(M),j=ju(t);return y.useEffect(()=>{!R||!O.current||(R.disconnect(),g.current=!1,R.observe(O.current))},[O,R]),y.useEffect(()=>(u({type:_n.RegisterDroppable,element:{id:r,key:a,disabled:n,node:O,rect:_,data:j}}),()=>u({type:_n.UnregisterDroppable,key:a,id:r})),[r]),y.useEffect(()=>{n!==m.current.disabled&&(u({type:_n.SetDroppableDisabled,id:r,key:a,disabled:n}),m.current.disabled=n)},[r,a,n,u]),{active:l,rect:_,isOver:(h==null?void 0:h.id)===r,node:O,over:h,setNodeRef:D}}function r0(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function rH(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function Hh(e){return e!==null&&e>=0}function iH(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 sH(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const DM=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=r0(t,r,n),l=t[s],u=a[s];return!u||!l?null:{x:u.left-l.left,y:u.top-l.top,scaleX:u.width/l.width,scaleY:u.height/l.height}},Fh={scaleX:1,scaleY:1},oH=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:l}=e;const u=(t=a[n])!=null?t:r;if(!u)return null;if(s===n){const d=a[l];return d?{x:0,y:n<l?d.top+d.height-(u.top+u.height):d.top-u.top,...Fh}:null}const h=aH(a,s,n);return s>n&&s<=l?{x:0,y:-u.height-h,...Fh}:s<n&&s>=l?{x:0,y:u.height+h,...Fh}:{x:0,y:0,...Fh}};function aH(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const OM="Sortable",jM=jt.createContext({activeIndex:-1,containerId:OM,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:DM,disabled:{draggable:!1,droppable:!1}});function lH(e){let{children:t,id:n,items:r,strategy:s=DM,disabled:a=!1}=e;const{active:l,dragOverlay:u,droppableRects:h,over:d,measureDroppableContainers:m}=J9(),g=id(OM,n),_=u.rect!==null,b=y.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),w=l!=null,S=l?b.indexOf(l.id):-1,C=d?b.indexOf(d.id):-1,k=y.useRef(b),T=!iH(b,k.current),R=C!==-1&&S===-1||T,M=sH(a);zi(()=>{T&&w&&m(b)},[T,b,w,m]),y.useEffect(()=>{k.current=b},[b]);const O=y.useMemo(()=>({activeIndex:S,containerId:g,disabled:M,disableTransforms:R,items:b,overIndex:C,useDragOverlay:_,sortedRects:rH(b,h),strategy:s}),[S,g,M.draggable,M.droppable,R,b,C,h,_,s]);return jt.createElement(jM.Provider,{value:O},t)}const cH=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return r0(n,r,s).indexOf(t)},uH=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:l,previousItems:u,previousContainerId:h,transition:d}=e;return!d||!r||u!==a&&s===l?!1:n?!0:l!==s&&t===h},dH={duration:200,easing:"ease"},LM="transform",hH=Lu.Transition.toString({property:LM,duration:0,easing:"linear"}),fH={roleDescription:"sortable"};function pH(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,l]=y.useState(null),u=y.useRef(n);return zi(()=>{if(!t&&n!==u.current&&r.current){const h=s.current;if(h){const d=Wl(r.current,{ignoreTransform:!0}),m={x:h.left-d.left,y:h.top-d.top,scaleX:h.width/d.width,scaleY:h.height/d.height};(m.x||m.y)&&l(m)}}n!==u.current&&(u.current=n)},[t,n,r,s]),y.useEffect(()=>{a&&l(null)},[a]),a}function mH(e){let{animateLayoutChanges:t=uH,attributes:n,disabled:r,data:s,getNewIndex:a=cH,id:l,strategy:u,resizeObserverConfig:h,transition:d=dH}=e;const{items:m,containerId:g,activeIndex:_,disabled:b,disableTransforms:w,sortedRects:S,overIndex:C,useDragOverlay:k,strategy:T}=y.useContext(jM),R=gH(r,b),M=m.indexOf(l),O=y.useMemo(()=>({sortable:{containerId:g,index:M,items:m},...s}),[g,s,M,m]),D=y.useMemo(()=>m.slice(m.indexOf(l)),[m,l]),{rect:j,node:F,isOver:G,setNodeRef:B}=nH({id:l,data:O,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...h}}),{active:H,activatorEvent:P,activeNodeRect:U,attributes:q,setNodeRef:W,listeners:z,isDragging:$,over:V,setActivatorNodeRef:Q,transform:N}=Q9({id:l,data:O,attributes:{...fH,...n},disabled:R.draggable}),I=A7(B,W),Z=!!H,L=Z&&!w&&Hh(_)&&Hh(C),de=!k&&$,me=de&&L?N:null,he=L?me??(u??T)({rects:S,activeNodeRect:U,activeIndex:_,overIndex:C,index:M}):null,we=Hh(_)&&Hh(C)?a({id:l,items:m,activeIndex:_,overIndex:C}):M,le=H==null?void 0:H.id,xe=y.useRef({activeId:le,items:m,newIndex:we,containerId:g}),Ne=m!==xe.current.items,ae=t({active:H,containerId:g,isDragging:$,isSorting:Z,id:l,index:M,items:m,newIndex:xe.current.newIndex,previousItems:xe.current.items,previousContainerId:xe.current.containerId,transition:d,wasDragging:xe.current.activeId!=null}),pe=pH({disabled:!ae,index:M,node:F,rect:j});return y.useEffect(()=>{Z&&xe.current.newIndex!==we&&(xe.current.newIndex=we),g!==xe.current.containerId&&(xe.current.containerId=g),m!==xe.current.items&&(xe.current.items=m)},[Z,we,g,m]),y.useEffect(()=>{if(le===xe.current.activeId)return;if(le!=null&&xe.current.activeId==null){xe.current.activeId=le;return}const $e=setTimeout(()=>{xe.current.activeId=le},50);return()=>clearTimeout($e)},[le]),{active:H,activeIndex:_,attributes:q,data:O,rect:j,index:M,newIndex:we,items:m,isOver:G,isSorting:Z,isDragging:$,listeners:z,node:F,overIndex:C,over:V,setNodeRef:I,setActivatorNodeRef:Q,setDroppableNodeRef:B,setDraggableNodeRef:W,transform:pe??he,transition:Re()};function Re(){if(pe||Ne&&xe.current.newIndex===M)return hH;if(!(de&&!Zb(P)||!d)&&(Z||ae))return Lu.Transition.toString({...d,property:LM})}}function gH(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}}vt.Down,vt.Right,vt.Up,vt.Left;function i0(e){const t=e+"CollectionProvider",[n,r]=vs(t),[s,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=S=>{const{scope:C,children:k}=S,T=jt.useRef(null),R=jt.useRef(new Map).current;return p.jsx(s,{scope:C,itemMap:R,collectionRef:T,children:k})};l.displayName=t;const u=e+"CollectionSlot",h=Qo(u),d=jt.forwardRef((S,C)=>{const{scope:k,children:T}=S,R=a(u,k),M=_t(C,R.collectionRef);return p.jsx(h,{ref:M,children:T})});d.displayName=u;const m=e+"CollectionItemSlot",g="data-radix-collection-item",_=Qo(m),b=jt.forwardRef((S,C)=>{const{scope:k,children:T,...R}=S,M=jt.useRef(null),O=_t(C,M),D=a(m,k);return jt.useEffect(()=>(D.itemMap.set(M,{ref:M,...R}),()=>void D.itemMap.delete(M))),p.jsx(_,{[g]:"",ref:O,children:T})});b.displayName=m;function w(S){const C=a(e+"CollectionConsumer",S);return jt.useCallback(()=>{const T=C.collectionRef.current;if(!T)return[];const R=Array.from(T.querySelectorAll(`[${g}]`));return Array.from(C.itemMap.values()).sort((D,j)=>R.indexOf(D.ref.current)-R.indexOf(j.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:l,Slot:d,ItemSlot:b},w,r]}var vH=y.createContext(void 0);function s0(e){const t=y.useContext(vH);return e||t||"ltr"}var jv="rovingFocusGroup.onEntryFocus",_H={bubbles:!1,cancelable:!0},sd="RovingFocusGroup",[U_,zM,yH]=i0(sd),[bH,PM]=vs(sd,[yH]),[xH,wH]=bH(sd),BM=y.forwardRef((e,t)=>p.jsx(U_.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(U_.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(SH,{...e,ref:t})})}));BM.displayName=sd;var SH=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:h,onEntryFocus:d,preventScrollOnEntryFocus:m=!1,...g}=e,_=y.useRef(null),b=_t(t,_),w=s0(a),[S,C]=Rl({prop:l,defaultProp:u??null,onChange:h,caller:sd}),[k,T]=y.useState(!1),R=hi(d),M=zM(n),O=y.useRef(!1),[D,j]=y.useState(0);return y.useEffect(()=>{const F=_.current;if(F)return F.addEventListener(jv,R),()=>F.removeEventListener(jv,R)},[R]),p.jsx(xH,{scope:n,orientation:r,dir:w,loop:s,currentTabStopId:S,onItemFocus:y.useCallback(F=>C(F),[C]),onItemShiftTab:y.useCallback(()=>T(!0),[]),onFocusableItemAdd:y.useCallback(()=>j(F=>F+1),[]),onFocusableItemRemove:y.useCallback(()=>j(F=>F-1),[]),children:p.jsx(rt.div,{tabIndex:k||D===0?-1:0,"data-orientation":r,...g,ref:b,style:{outline:"none",...e.style},onMouseDown:Ae(e.onMouseDown,()=>{O.current=!0}),onFocus:Ae(e.onFocus,F=>{const G=!O.current;if(F.target===F.currentTarget&&G&&!k){const B=new CustomEvent(jv,_H);if(F.currentTarget.dispatchEvent(B),!B.defaultPrevented){const H=M().filter(z=>z.focusable),P=H.find(z=>z.active),U=H.find(z=>z.id===S),W=[P,U,...H].filter(Boolean).map(z=>z.ref.current);FM(W,m)}}O.current=!1}),onBlur:Ae(e.onBlur,()=>T(!1))})})}),IM="RovingFocusGroupItem",HM=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:l,...u}=e,h=ds(),d=a||h,m=wH(IM,n),g=m.currentTabStopId===d,_=zM(n),{onFocusableItemAdd:b,onFocusableItemRemove:w,currentTabStopId:S}=m;return y.useEffect(()=>{if(r)return b(),()=>w()},[r,b,w]),p.jsx(U_.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:p.jsx(rt.span,{tabIndex:g?0:-1,"data-orientation":m.orientation,...u,ref:t,onMouseDown:Ae(e.onMouseDown,C=>{r?m.onItemFocus(d):C.preventDefault()}),onFocus:Ae(e.onFocus,()=>m.onItemFocus(d)),onKeyDown:Ae(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){m.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const k=EH(C,m.orientation,m.dir);if(k!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let R=_().filter(M=>M.focusable).map(M=>M.ref.current);if(k==="last")R.reverse();else if(k==="prev"||k==="next"){k==="prev"&&R.reverse();const M=R.indexOf(C.currentTarget);R=m.loop?RH(R,M+1):R.slice(M+1)}setTimeout(()=>FM(R))}}),children:typeof l=="function"?l({isCurrentTabStop:g,hasTabStop:S!=null}):l})})});HM.displayName=IM;var CH={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function kH(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function EH(e,t,n){const r=kH(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return CH[r]}function FM(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function RH(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var TH=BM,MH=HM,$_=["Enter"," "],NH=["ArrowDown","PageUp","Home"],UM=["ArrowUp","PageDown","End"],AH=[...NH,...UM],DH={ltr:[...$_,"ArrowRight"],rtl:[...$_,"ArrowLeft"]},OH={ltr:["ArrowLeft"],rtl:["ArrowRight"]},od="Menu",[Pu,jH,LH]=i0(od),[ha,$M]=vs(od,[LH,go,PM]),jp=go(),WM=PM(),[zH,fa]=ha(od),[PH,ad]=ha(od),VM=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:a,modal:l=!0}=e,u=jp(t),[h,d]=y.useState(null),m=y.useRef(!1),g=hi(a),_=s0(s);return y.useEffect(()=>{const b=()=>{m.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>m.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})}},[]),p.jsx(kp,{...u,children:p.jsx(zH,{scope:t,open:n,onOpenChange:g,content:h,onContentChange:d,children:p.jsx(PH,{scope:t,onClose:y.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:m,dir:_,modal:l,children:r})})})};VM.displayName=od;var BH="MenuAnchor",o0=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=jp(n);return p.jsx(Ju,{...s,...r,ref:t})});o0.displayName=BH;var a0="MenuPortal",[IH,qM]=ha(a0,{forceMount:void 0}),KM=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,a=fa(a0,t);return p.jsx(IH,{scope:t,forceMount:n,children:p.jsx(ti,{present:n||a.open,children:p.jsx(Il,{asChild:!0,container:s,children:r})})})};KM.displayName=a0;var Qr="MenuContent",[HH,l0]=ha(Qr),GM=y.forwardRef((e,t)=>{const n=qM(Qr,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,a=fa(Qr,e.__scopeMenu),l=ad(Qr,e.__scopeMenu);return p.jsx(Pu.Provider,{scope:e.__scopeMenu,children:p.jsx(ti,{present:r||a.open,children:p.jsx(Pu.Slot,{scope:e.__scopeMenu,children:l.modal?p.jsx(FH,{...s,ref:t}):p.jsx(UH,{...s,ref:t})})})})}),FH=y.forwardRef((e,t)=>{const n=fa(Qr,e.__scopeMenu),r=y.useRef(null),s=_t(t,r);return y.useEffect(()=>{const a=r.current;if(a)return _p(a)},[]),p.jsx(c0,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ae(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),UH=y.forwardRef((e,t)=>{const n=fa(Qr,e.__scopeMenu);return p.jsx(c0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),$H=Qo("MenuContent.ScrollLock"),c0=y.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:h,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:_,onDismiss:b,disableOutsideScroll:w,...S}=e,C=fa(Qr,n),k=ad(Qr,n),T=jp(n),R=WM(n),M=jH(n),[O,D]=y.useState(null),j=y.useRef(null),F=_t(t,j,C.onContentChange),G=y.useRef(0),B=y.useRef(""),H=y.useRef(0),P=y.useRef(null),U=y.useRef("right"),q=y.useRef(0),W=w?Xu:y.Fragment,z=w?{as:$H,allowPinchZoom:!0}:void 0,$=Q=>{var he,we;const N=B.current+Q,I=M().filter(le=>!le.disabled),Z=document.activeElement,L=(he=I.find(le=>le.ref.current===Z))==null?void 0:he.textValue,de=I.map(le=>le.textValue),me=tF(de,N,L),ue=(we=I.find(le=>le.textValue===me))==null?void 0:we.ref.current;(function le(xe){B.current=xe,window.clearTimeout(G.current),xe!==""&&(G.current=window.setTimeout(()=>le(""),1e3))})(N),ue&&setTimeout(()=>ue.focus())};y.useEffect(()=>()=>window.clearTimeout(G.current),[]),gp();const V=y.useCallback(Q=>{var I,Z;return U.current===((I=P.current)==null?void 0:I.side)&&rF(Q,(Z=P.current)==null?void 0:Z.area)},[]);return p.jsx(HH,{scope:n,searchRef:B,onItemEnter:y.useCallback(Q=>{V(Q)&&Q.preventDefault()},[V]),onItemLeave:y.useCallback(Q=>{var N;V(Q)||((N=j.current)==null||N.focus(),D(null))},[V]),onTriggerLeave:y.useCallback(Q=>{V(Q)&&Q.preventDefault()},[V]),pointerGraceTimerRef:H,onPointerGraceIntentChange:y.useCallback(Q=>{P.current=Q},[]),children:p.jsx(W,{...z,children:p.jsx(Yu,{asChild:!0,trapped:s,onMountAutoFocus:Ae(a,Q=>{var N;Q.preventDefault(),(N=j.current)==null||N.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:p.jsx(Bl,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:_,onDismiss:b,children:p.jsx(TH,{asChild:!0,...R,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:D,onEntryFocus:Ae(h,Q=>{k.isUsingKeyboardRef.current||Q.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(Ep,{role:"menu","aria-orientation":"vertical","data-state":uN(C.open),"data-radix-menu-content":"",dir:k.dir,...T,...S,ref:F,style:{outline:"none",...S.style},onKeyDown:Ae(S.onKeyDown,Q=>{const I=Q.target.closest("[data-radix-menu-content]")===Q.currentTarget,Z=Q.ctrlKey||Q.altKey||Q.metaKey,L=Q.key.length===1;I&&(Q.key==="Tab"&&Q.preventDefault(),!Z&&L&&$(Q.key));const de=j.current;if(Q.target!==de||!AH.includes(Q.key))return;Q.preventDefault();const ue=M().filter(he=>!he.disabled).map(he=>he.ref.current);UM.includes(Q.key)&&ue.reverse(),JH(ue)}),onBlur:Ae(e.onBlur,Q=>{Q.currentTarget.contains(Q.target)||(window.clearTimeout(G.current),B.current="")}),onPointerMove:Ae(e.onPointerMove,Bu(Q=>{const N=Q.target,I=q.current!==Q.clientX;if(Q.currentTarget.contains(N)&&I){const Z=Q.clientX>q.current?"right":"left";U.current=Z,q.current=Q.clientX}}))})})})})})})});GM.displayName=Qr;var WH="MenuGroup",u0=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(rt.div,{role:"group",...r,ref:t})});u0.displayName=WH;var VH="MenuLabel",YM=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(rt.div,{...r,ref:t})});YM.displayName=VH;var Kf="MenuItem",w2="menu.itemSelect",Lp=y.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,a=y.useRef(null),l=ad(Kf,e.__scopeMenu),u=l0(Kf,e.__scopeMenu),h=_t(t,a),d=y.useRef(!1),m=()=>{const g=a.current;if(!n&&g){const _=new CustomEvent(w2,{bubbles:!0,cancelable:!0});g.addEventListener(w2,b=>r==null?void 0:r(b),{once:!0}),KR(g,_),_.defaultPrevented?d.current=!1:l.onClose()}};return p.jsx(XM,{...s,ref:h,disabled:n,onClick:Ae(e.onClick,m),onPointerDown:g=>{var _;(_=e.onPointerDown)==null||_.call(e,g),d.current=!0},onPointerUp:Ae(e.onPointerUp,g=>{var _;d.current||(_=g.currentTarget)==null||_.click()}),onKeyDown:Ae(e.onKeyDown,g=>{const _=u.searchRef.current!=="";n||_&&g.key===" "||$_.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});Lp.displayName=Kf;var XM=y.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...a}=e,l=l0(Kf,n),u=WM(n),h=y.useRef(null),d=_t(t,h),[m,g]=y.useState(!1),[_,b]=y.useState("");return y.useEffect(()=>{const w=h.current;w&&b((w.textContent??"").trim())},[a.children]),p.jsx(Pu.ItemSlot,{scope:n,disabled:r,textValue:s??_,children:p.jsx(MH,{asChild:!0,...u,focusable:!r,children:p.jsx(rt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:d,onPointerMove:Ae(e.onPointerMove,Bu(w=>{r?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ae(e.onPointerLeave,Bu(w=>l.onItemLeave(w))),onFocus:Ae(e.onFocus,()=>g(!0)),onBlur:Ae(e.onBlur,()=>g(!1))})})})}),qH="MenuCheckboxItem",ZM=y.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return p.jsx(nN,{scope:e.__scopeMenu,checked:n,children:p.jsx(Lp,{role:"menuitemcheckbox","aria-checked":Gf(n)?"mixed":n,...s,ref:t,"data-state":h0(n),onSelect:Ae(s.onSelect,()=>r==null?void 0:r(Gf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ZM.displayName=qH;var QM="MenuRadioGroup",[KH,GH]=ha(QM,{value:void 0,onValueChange:()=>{}}),JM=y.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,a=hi(r);return p.jsx(KH,{scope:e.__scopeMenu,value:n,onValueChange:a,children:p.jsx(u0,{...s,ref:t})})});JM.displayName=QM;var eN="MenuRadioItem",tN=y.forwardRef((e,t)=>{const{value:n,...r}=e,s=GH(eN,e.__scopeMenu),a=n===s.value;return p.jsx(nN,{scope:e.__scopeMenu,checked:a,children:p.jsx(Lp,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":h0(a),onSelect:Ae(r.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,n)},{checkForDefaultPrevented:!1})})})});tN.displayName=eN;var d0="MenuItemIndicator",[nN,YH]=ha(d0,{checked:!1}),rN=y.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,a=YH(d0,n);return p.jsx(ti,{present:r||Gf(a.checked)||a.checked===!0,children:p.jsx(rt.span,{...s,ref:t,"data-state":h0(a.checked)})})});rN.displayName=d0;var XH="MenuSeparator",iN=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(rt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});iN.displayName=XH;var ZH="MenuArrow",sN=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=jp(n);return p.jsx(Rp,{...s,...r,ref:t})});sN.displayName=ZH;var QH="MenuSub",[Fne,oN]=ha(QH),ou="MenuSubTrigger",aN=y.forwardRef((e,t)=>{const n=fa(ou,e.__scopeMenu),r=ad(ou,e.__scopeMenu),s=oN(ou,e.__scopeMenu),a=l0(ou,e.__scopeMenu),l=y.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:h}=a,d={__scopeMenu:e.__scopeMenu},m=y.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return y.useEffect(()=>m,[m]),y.useEffect(()=>{const g=u.current;return()=>{window.clearTimeout(g),h(null)}},[u,h]),p.jsx(o0,{asChild:!0,...d,children:p.jsx(XM,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":uN(n.open),...e,ref:_b(t,s.onTriggerChange),onClick:g=>{var _;(_=e.onClick)==null||_.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ae(e.onPointerMove,Bu(g=>{a.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(a.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ae(e.onPointerLeave,Bu(g=>{var b,w;m();const _=(b=n.content)==null?void 0:b.getBoundingClientRect();if(_){const S=(w=n.content)==null?void 0:w.dataset.side,C=S==="right",k=C?-5:5,T=_[C?"left":"right"],R=_[C?"right":"left"];a.onPointerGraceIntentChange({area:[{x:g.clientX+k,y:g.clientY},{x:T,y:_.top},{x:R,y:_.top},{x:R,y:_.bottom},{x:T,y:_.bottom}],side:S}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(g),g.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Ae(e.onKeyDown,g=>{var b;const _=a.searchRef.current!=="";e.disabled||_&&g.key===" "||DH[r.dir].includes(g.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),g.preventDefault())})})})});aN.displayName=ou;var lN="MenuSubContent",cN=y.forwardRef((e,t)=>{const n=qM(Qr,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,a=fa(Qr,e.__scopeMenu),l=ad(Qr,e.__scopeMenu),u=oN(lN,e.__scopeMenu),h=y.useRef(null),d=_t(t,h);return p.jsx(Pu.Provider,{scope:e.__scopeMenu,children:p.jsx(ti,{present:r||a.open,children:p.jsx(Pu.Slot,{scope:e.__scopeMenu,children:p.jsx(c0,{id:u.contentId,"aria-labelledby":u.triggerId,...s,ref:d,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{var g;l.isUsingKeyboardRef.current&&((g=h.current)==null||g.focus()),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ae(e.onFocusOutside,m=>{m.target!==u.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Ae(e.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:Ae(e.onKeyDown,m=>{var b;const g=m.currentTarget.contains(m.target),_=OH[l.dir].includes(m.key);g&&_&&(a.onOpenChange(!1),(b=u.trigger)==null||b.focus(),m.preventDefault())})})})})})});cN.displayName=lN;function uN(e){return e?"open":"closed"}function Gf(e){return e==="indeterminate"}function h0(e){return Gf(e)?"indeterminate":e?"checked":"unchecked"}function JH(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function eF(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function tF(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=eF(e,Math.max(a,0));s.length===1&&(l=l.filter(d=>d!==n));const h=l.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return h!==n?h:void 0}function nF(e,t){const{x:n,y:r}=e;let s=!1;for(let a=0,l=t.length-1;a<t.length;l=a++){const u=t[a],h=t[l],d=u.x,m=u.y,g=h.x,_=h.y;m>r!=_>r&&n<(g-d)*(r-m)/(_-m)+d&&(s=!s)}return s}function rF(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return nF(n,t)}function Bu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var iF=VM,sF=o0,oF=KM,aF=GM,lF=u0,cF=YM,uF=Lp,dF=ZM,hF=JM,fF=tN,pF=rN,mF=iN,gF=sN,vF=aN,_F=cN,f0="ContextMenu",[yF]=vs(f0,[$M]),ir=$M(),[bF,dN]=yF(f0),hN=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:s,modal:a=!0}=e,[l,u]=y.useState(!1),h=ir(t),d=hi(r),m=y.useCallback(g=>{u(g),d(g)},[d]);return p.jsx(bF,{scope:t,open:l,onOpenChange:m,modal:a,children:p.jsx(iF,{...h,dir:s,open:l,onOpenChange:m,modal:a,children:n})})};hN.displayName=f0;var fN="ContextMenuTrigger",pN=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=e,a=dN(fN,n),l=ir(n),u=y.useRef({x:0,y:0}),h=y.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...u.current})}),d=y.useRef(0),m=y.useCallback(()=>window.clearTimeout(d.current),[]),g=_=>{u.current={x:_.clientX,y:_.clientY},a.onOpenChange(!0)};return y.useEffect(()=>m,[m]),y.useEffect(()=>void(r&&m()),[r,m]),p.jsxs(p.Fragment,{children:[p.jsx(sF,{...l,virtualRef:h}),p.jsx(rt.span,{"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Ae(e.onContextMenu,_=>{m(),g(_),_.preventDefault()}),onPointerDown:r?e.onPointerDown:Ae(e.onPointerDown,Uh(_=>{m(),d.current=window.setTimeout(()=>g(_),700)})),onPointerMove:r?e.onPointerMove:Ae(e.onPointerMove,Uh(m)),onPointerCancel:r?e.onPointerCancel:Ae(e.onPointerCancel,Uh(m)),onPointerUp:r?e.onPointerUp:Ae(e.onPointerUp,Uh(m))})]})});pN.displayName=fN;var xF="ContextMenuPortal",mN=e=>{const{__scopeContextMenu:t,...n}=e,r=ir(t);return p.jsx(oF,{...r,...n})};mN.displayName=xF;var gN="ContextMenuContent",vN=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=dN(gN,n),a=ir(n),l=y.useRef(!1);return p.jsx(aF,{...a,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:u=>{var h;(h=e.onCloseAutoFocus)==null||h.call(e,u),!u.defaultPrevented&&l.current&&u.preventDefault(),l.current=!1},onInteractOutside:u=>{var h;(h=e.onInteractOutside)==null||h.call(e,u),!u.defaultPrevented&&!s.modal&&(l.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});vN.displayName=gN;var wF="ContextMenuGroup",SF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(lF,{...s,...r,ref:t})});SF.displayName=wF;var CF="ContextMenuLabel",kF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(cF,{...s,...r,ref:t})});kF.displayName=CF;var EF="ContextMenuItem",_N=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(uF,{...s,...r,ref:t})});_N.displayName=EF;var RF="ContextMenuCheckboxItem",TF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(dF,{...s,...r,ref:t})});TF.displayName=RF;var MF="ContextMenuRadioGroup",NF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(hF,{...s,...r,ref:t})});NF.displayName=MF;var AF="ContextMenuRadioItem",DF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(fF,{...s,...r,ref:t})});DF.displayName=AF;var OF="ContextMenuItemIndicator",jF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(pF,{...s,...r,ref:t})});jF.displayName=OF;var LF="ContextMenuSeparator",zF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(mF,{...s,...r,ref:t})});zF.displayName=LF;var PF="ContextMenuArrow",BF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(gF,{...s,...r,ref:t})});BF.displayName=PF;var IF="ContextMenuSubTrigger",HF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(vF,{...s,...r,ref:t})});HF.displayName=IF;var FF="ContextMenuSubContent",UF=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=ir(n);return p.jsx(_F,{...s,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});UF.displayName=FF;function Uh(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var $F=hN,WF=pN,VF=mN,yN=vN,bN=_N;const qF=$F,KF=WF,xN=y.forwardRef(({className:e,...t},n)=>p.jsx(VF,{children:p.jsx(yN,{ref:n,className:be("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg 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})}));xN.displayName=yN.displayName;const au=y.forwardRef(({className:e,...t},n)=>p.jsx(bN,{ref:n,className:be("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));au.displayName=bN.displayName;function GF({editorLabel:e,onCopyPath:t,onOpenInFinder:n,onOpenInEditor:r,onRemove:s,children:a}){return p.jsxs(qF,{children:[p.jsx(KF,{asChild:!0,children:a}),p.jsxs(xN,{children:[p.jsxs(au,{onSelect:l=>{l.stopPropagation(),t()},children:[p.jsx(Zu,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),p.jsxs(au,{onSelect:l=>{l.stopPropagation(),n()},children:[p.jsx(Cb,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),p.jsxs(au,{onSelect:l=>{l.stopPropagation(),r()},children:[p.jsx(Sb,{className:"h-3.5 w-3.5"}),p.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),p.jsxs(au,{onSelect:l=>{l.stopPropagation(),s()},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:[p.jsx(aI,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"text-xs font-medium",children:"Remove"})]})]})]})}function YF({group:e,editorLabel:t,collapsedSections:n,expandedGroups:r,onToggleSection:s,onToggleExpandedGroup:a,renderChatRow:l,chatsPerProject:u,onNewLocalChat:h,onCopyPath:d,onOpenExternalPath:m,onRemoveProject:g,isConnected:_,startingLocalPath:b}){const{groupKey:w,localPath:S,chats:C}=e,k=r.has(w),T=k?C:C.slice(0,u),R=C.length>u,{attributes:M,listeners:O,setNodeRef:D,setActivatorNodeRef:j,transform:F,transition:G,isDragging:B}=mH({id:w}),H={transform:Lu.Translate.toString(F),transition:G},P=p.jsxs("div",{ref:j,className:be("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between","cursor-grab active:cursor-grabbing",B&&"cursor-grabbing"),onClick:()=>s(w),...O,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:n.has(w)?p.jsx(fs,{className:"translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-all duration-200"}):p.jsxs(p.Fragment,{children:[p.jsx(Cb,{className:"absolute inset-0 translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500 transition-all duration-200 group-hover/section:opacity-0"}),p.jsx(fs,{className:"absolute inset-0 translate-y-[1px] size-3.5 shrink-0 rotate-90 text-slate-400 opacity-0 transition-all duration-200 group-hover/section:opacity-100"})]})}),p.jsxs(Ff,{children:[p.jsx(Uf,{asChild:!0,children:p.jsx("span",{className:"truncate max-w-[150px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:gM(S)})}),p.jsx(Ou,{side:"right",sideOffset:4,children:S})]})]}),h&&p.jsxs(Ff,{children:[p.jsx(Uf,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"icon",className:be("h-5.5 w-5.5 absolute right-2 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!_||b===S)&&"opacity-50 cursor-not-allowed"),disabled:!_||b===S,onClick:U=>{U.stopPropagation(),h(S)},children:b===S?p.jsx(fi,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):p.jsx(Tb,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),p.jsx(Ou,{side:"right",sideOffset:4,children:_?"New chat":`Start ${ln} to connect`})]})]});return p.jsxs("div",{ref:D,style:H,className:be("group/section",B&&"opacity-50 shadow-lg z-50 relative"),...M,children:[g&&d&&m?p.jsx(GF,{editorLabel:t,onCopyPath:()=>d(S),onOpenInFinder:()=>m("open_finder",S),onOpenInEditor:()=>m("open_editor",S),onRemove:()=>g(w),children:P}):P,!n.has(w)&&(T.length>0||R)&&p.jsxs("div",{className:"space-y-[2px] mb-2 ",children:[T.map(l),R&&p.jsx("button",{onClick:()=>a(w),className:"pl-2.5 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:k?"Show less":`Show more (${C.length-u})`})]})]})}function XF({projectGroups:e,editorLabel:t,collapsedSections:n,expandedGroups:r,onToggleSection:s,onToggleExpandedGroup:a,renderChatRow:l,chatsPerProject:u,onNewLocalChat:h,onCopyPath:d,onOpenExternalPath:m,onRemoveProject:g,onReorderGroups:_,isConnected:b,startingLocalPath:w}){const S=V7(u2(n0,{activationConstraint:{distance:8}}),u2(e0)),C=y.useMemo(()=>e.map(M=>M.groupKey),[e]),k=y.useRef(null);function T(M){const O=M.active.id;n.has(O)?k.current=null:(k.current=O,s(O))}function R(M){const{active:O,over:D}=M;if(D&&O.id!==D.id&&_){const j=C.indexOf(O.id),F=C.indexOf(D.id);if(j!==-1&&F!==-1){const G=r0(C,j,F);_(G)}}if(k.current){const j=k.current;k.current=null,requestAnimationFrame(()=>s(j))}}return p.jsx(Y9,{sensors:S,collisionDetection:X7,onDragStart:T,onDragEnd:R,children:p.jsx(lH,{items:C,strategy:oH,children:e.map(M=>p.jsx(YF,{group:M,editorLabel:t,collapsedSections:n,expandedGroups:r,onToggleSection:s,onToggleExpandedGroup:a,renderChatRow:l,chatsPerProject:u,onNewLocalChat:h,onCopyPath:d,onOpenExternalPath:m,onRemoveProject:g,isConnected:b,startingLocalPath:w},M.groupKey))})})}const S2=ua()(da(e=>({order:[],setOrder:t=>e({order:t})}),{name:"project-group-order"}));function ZF({data:e,activeChatId:t,connectionStatus:n,ready:r,open:s,collapsed:a,showMobileOpenButton:l,onOpen:u,onClose:h,onCollapse:d,onExpand:m,onCreateChat:g,onDeleteChat:_,onCopyPath:b,onOpenExternalPath:w,onRemoveProject:S,editorLabel:C,updateSnapshot:k,onInstallUpdate:T}){const R=vi(),M=Pl(),O=y.useRef(null),[D,j]=y.useState(new Set),[F,G]=y.useState(new Set),[B,H]=y.useState(()=>Date.now()),P=10,U=S2(ae=>ae.order),q=S2(ae=>ae.setOrder),W=y.useMemo(()=>{if(U.length===0)return e.projectGroups;const ae=new Map(e.projectGroups.map($e=>[$e.groupKey,$e])),pe=U.filter($e=>ae.has($e)).map($e=>ae.get($e)),Re=new Set(U);for(const $e of e.projectGroups)Re.has($e.groupKey)||pe.push($e);return pe},[e.projectGroups,U]),z=y.useCallback(ae=>q(ae),[q]),$=y.useMemo(()=>new Map(e.projectGroups.map(ae=>[ae.localPath,ae.groupKey])),[e.projectGroups]),V=y.useMemo(()=>e.projectGroups.reduce((ae,pe)=>ae+pe.chats.length,0),[e.projectGroups]),Q=y.useCallback(ae=>{j(pe=>{const Re=new Set(pe);return Re.has(ae)?Re.delete(ae):Re.add(ae),Re})},[]),N=y.useCallback(ae=>{G(pe=>{const Re=new Set(pe);return Re.has(ae)?Re.delete(ae):Re.add(ae),Re})},[]),I=y.useCallback(ae=>p.jsx(N7,{chat:ae,activeChatId:t,nowMs:B,onSelectChat:pe=>{M(`/chat/${pe}`),h()},onDeleteChat:()=>_(ae)},ae._id),[t,M,B,h,_]);y.useEffect(()=>{const ae=window.setInterval(()=>{H(Date.now())},3e4);return()=>window.clearInterval(ae)},[]),y.useEffect(()=>{!t||!O.current||requestAnimationFrame(()=>{const ae=O.current,pe=ae==null?void 0:ae.querySelector(`[data-chat-id="${t}"]`);if(!pe||!ae)return;const Re=pe.getBoundingClientRect(),$e=ae.getBoundingClientRect();if(Re.top<$e.top+38){const at=Re.top-$e.top+ae.scrollTop;ae.scrollTo({top:at-38,behavior:"smooth"})}else if(Re.bottom>$e.bottom){const at=Re.top+Re.height/2-$e.top+ae.scrollTop,Lt=ae.clientHeight/2;ae.scrollTo({top:at-Lt,behavior:"smooth"})}})},[t,V]);const Z=V>0,L=R.pathname==="/",de=R.pathname.startsWith("/settings"),me=L||de,ue=n==="connecting"||!r,he=ue?"Connecting":n==="connected"?"Connected":"Disconnected",we=n==="connected"?"bg-emerald-500":"bg-amber-500",le=(k==null?void 0:k.updateAvailable)===!0,xe=k?k.latestVersion===`${k.currentVersion}-dev`:!1,Ne=(k==null?void 0:k.status)==="updating"||(k==null?void 0:k.status)==="restart_pending";return p.jsxs(p.Fragment,{children:[!s&&l&&p.jsx(Je,{variant:"ghost",size:"icon",className:"fixed top-3 left-3 z-50 md:hidden",onClick:u,children:p.jsx(kb,{className:"h-5 w-5"})}),a&&me&&p.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:p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(yu,{className:"size-6 text-logo"}),p.jsx(Je,{variant:"ghost",size:"icon",onClick:m,title:"Expand sidebar",children:p.jsx(T_,{className:"h-5 w-5"})})]})}),p.jsxs("div",{"data-sidebar":"open",className:be("fixed inset-0 z-50 bg-background dark:bg-card flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:w-[275px] md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",s?"flex":"hidden md:flex",a&&"md:hidden"),children:[p.jsxs("div",{className:" pl-3 pr-[7px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("button",{type:"button",onClick:d,title:"Collapse sidebar",className:"hidden md:flex group/sidebar-collapse relative items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[p.jsx(yu,{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"}),p.jsx(T_,{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"})]}),p.jsx(yu,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),p.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:ln})]}),p.jsxs("div",{className:"flex items-center",children:[xe?p.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"}):le?p.jsxs(Je,{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:T,disabled:Ne,title:k!=null&&k.latestVersion?`Update to ${k.latestVersion}`:"Update Kanna",children:[Ne?p.jsx(fi,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,p.jsx(Je,{variant:"ghost",size:"icon",onClick:()=>{M("/"),h()},className:"size-10 rounded-lg",title:"New project",children:p.jsx(Rb,{className:"size-4"})}),p.jsx(Je,{variant:"ghost",size:"icon",className:"md:hidden",onClick:h,children:p.jsx(mo,{className:"h-5 w-5"})})]})]}),p.jsx("div",{ref:O,className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",style:{WebkitOverflowScrolling:"touch"},children:p.jsxs("div",{className:"p-[7px]",children:[!Z&&ue?p.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(ae=>p.jsxs("div",{className:"space-y-2 animate-pulse",children:[p.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),p.jsx("div",{className:"space-y-1",children:[0,1,2].map(pe=>p.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[p.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),p.jsx("div",{className:be("h-3.5 rounded bg-muted",pe===0?"w-32":pe===1?"w-40":"w-28")})]},pe))})]},ae))}):null,!Z&&!ue&&e.projectGroups.length===0?p.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,p.jsx(XF,{projectGroups:W,editorLabel:C,onReorderGroups:z,collapsedSections:D,expandedGroups:F,onToggleSection:Q,onToggleExpandedGroup:N,renderChatRow:I,chatsPerProject:P,onNewLocalChat:ae=>{const pe=$.get(ae);pe&&g(pe)},onCopyPath:b,onOpenExternalPath:w,onRemoveProject:S,isConnected:n==="connected"})]})}),p.jsx("div",{className:"border-t border-border p-2",children:p.jsx("button",{type:"button",onClick:()=>{M("/settings/general"),h()},className:be("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",de?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:p.jsxs("div",{className:"flex items- justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx($B,{className:"h-4 w-4 text-muted-foreground"}),p.jsx("span",{className:"text-sm",children:"Settings"})]}),p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx("span",{children:he}),ue?p.jsx(fi,{className:"h-2 w-2 animate-spin"}):p.jsx("span",{className:be("h-2 w-2 rounded-full",we)})]})]})})})]}),s?p.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:h}):null]})}const Yf=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],W_=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Iu={reasoningEffort:"high",contextWindow:"200k"},V_={reasoningEffort:"high",fastMode:!1};function C2(e){return Yf.some(t=>t.id===e)}function k2(e){return W_.some(t=>t.id===e)}const q_=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}],Su=[{id:"claude",label:"Claude",defaultModel:"sonnet",defaultEffort:"high",supportsPlanMode:!0,models:[{id:"opus",label:"Opus",supportsEffort:!0,contextWindowOptions:[...q_]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...q_]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...Yf]},{id:"codex",label:"Codex",defaultModel:"gpt-5.4",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:[]}];function QF(e){const t=Su.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function JF(e){return QF("claude").models.find(t=>t.id===e)}function eU(e){var t;return((t=JF(e))==null?void 0:t.contextWindowOptions)??[]}function wN(e,t){const n=eU(e);return n.length===0?Iu.contextWindow:n.some(r=>r.id===t)?t:Iu.contextWindow}const ro={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+/"]},SN=y.forwardRef(({className:e,...t},n)=>p.jsx("textarea",{"data-gramm":"false","data-gramm_editor":"false","data-enable-grammarly":"false","data-1p-ignore":!0,autoComplete:"off",className:be("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}));SN.displayName="Textarea";const p0=y.forwardRef(({className:e,children:t,...n},r)=>p.jsx("div",{ref:r,className:be("relative overflow-y-auto overscroll-contain touch-pan-y scrollbar-hide",e),style:{WebkitOverflowScrolling:"touch"},...n,children:t}));p0.displayName="ScrollArea";function tU(){const[e,t]=y.useState(()=>{if(typeof window>"u")return!1;const n=navigator.standalone===!0,r=window.matchMedia("(display-mode: standalone)").matches;return n||r});return y.useEffect(()=>{const n=window.matchMedia("(display-mode: standalone)"),r=s=>{t(s.matches||navigator.standalone===!0)};return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const nU=ua()(da((e,t)=>({drafts:{},attachmentDrafts:{},setDraft:(n,r)=>e(s=>{if(!r){const{[n]:a,...l}=s.drafts;return{drafts:l}}return{drafts:{...s.drafts,[n]:r}}}),clearDraft:n=>e(r=>{const{[n]:s,...a}=r.drafts;return{drafts:a}}),getDraft:n=>t().drafts[n]??"",setAttachmentDrafts:(n,r)=>e(s=>{if(r.length===0){const{[n]:a,...l}=s.attachmentDrafts;return{attachmentDrafts:l}}return{attachmentDrafts:{...s.attachmentDrafts,[n]:r}}}),clearAttachmentDrafts:n=>e(r=>{const{[n]:s,...a}=r.attachmentDrafts;return{attachmentDrafts:a}}),getAttachmentDrafts:n=>t().attachmentDrafts[n]??[]}),{name:"chat-input-drafts"})),K_="__new__",CN=!0;function rU(e){return e==="gpt-5-codex"?"gpt-5.3-codex":e??"gpt-5.4"}function iU(e){return e==="claude"||e==="codex"?e:"last_used"}function Go(e){var a,l;const t=(a=e==null?void 0:e.modelOptions)==null?void 0:a.reasoningEffort,n=C2(t)?t:C2(e==null?void 0:e.effort)?e.effort:Iu.reasoningEffort,r=(e==null?void 0:e.model)??"opus",s=wN(r,(l=e==null?void 0:e.modelOptions)==null?void 0:l.contextWindow);return{model:r,modelOptions:{reasoningEffort:r!=="opus"&&n==="max"?"high":n,contextWindow:s},planMode:!!(e!=null&&e.planMode)}}function Yo(e){var n,r;const t=(n=e==null?void 0:e.modelOptions)==null?void 0:n.reasoningEffort;return{model:rU(e==null?void 0:e.model),modelOptions:{reasoningEffort:k2(t)?t:k2(e==null?void 0:e.effort)?e.effort:V_.reasoningEffort,fastMode:typeof((r=e==null?void 0:e.modelOptions)==null?void 0:r.fastMode)=="boolean"?e.modelOptions.fastMode:V_.fastMode},planMode:!!(e!=null&&e.planMode)}}function sU(){return{claude:{model:"opus",modelOptions:{...Iu},planMode:!1},codex:{model:"gpt-5.4",modelOptions:{...V_},planMode:!1}}}function oU(e){return{claude:Go(e==null?void 0:e.claude),codex:Yo(e==null?void 0:e.codex)}}function aU(e,t){if(t===void 0){console.info(`[chat-preferences] ${e}`);return}console.info(`[chat-preferences] ${e}`,t)}function Hu(e,t){if(e==="claude"){const r=t.claude;return{provider:"claude",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 Xf(e){return e.provider==="claude"?{provider:"claude",model:e.model,modelOptions:{...e.modelOptions},planMode:e.planMode}:{provider:"codex",model:e.model,modelOptions:{...e.modelOptions},planMode:e.planMode}}function m0(e,t,n,r){if((e==null?void 0:e.provider)==="claude"){const s=Go(e);return{provider:"claude",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if((e==null?void 0:e.provider)==="codex"){const s=Yo(e);return{provider:"codex",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="claude"){const s=Go(r==null?void 0:r.claude);return{provider:"claude",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="codex"){const s=Yo(r==null?void 0:r.codex);return{provider:"codex",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}return Hu("claude",t)}function lU(e,t){return e?m0(e,t):null}function cU(e,t){return e?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,m0(r,t)])):{}}function kN(e){return e.defaultProvider==="last_used"?e.sourceState?Xf(e.sourceState):e.legacyComposerState?Xf(e.legacyComposerState):Hu("claude",e.providerDefaults):Hu(e.defaultProvider,e.providerDefaults)}function EN(e,t){const n=e.chatStates[t];return n||kN({defaultProvider:e.defaultProvider,providerDefaults:e.providerDefaults,legacyComposerState:e.legacyComposerState})}function $h(e,t,n){const r=EN(e,t);return{chatStates:{...e.chatStates,[t]:n(r)}}}function uU(e){const t=oU(e==null?void 0:e.providerDefaults),n=lU((e==null?void 0:e.legacyComposerState)??(e==null?void 0:e.composerState),t);return{defaultProvider:iU(e==null?void 0:e.defaultProvider),providerDefaults:t,chatStates:cU(e==null?void 0:e.chatStates,t),showTranscriptToc:typeof(e==null?void 0:e.showTranscriptToc)=="boolean"?e.showTranscriptToc:CN,legacyComposerState:n??m0(void 0,t,e==null?void 0:e.liveProvider,e==null?void 0:e.livePreferences)}}const tr=ua()(da((e,t)=>({defaultProvider:"last_used",providerDefaults:sU(),chatStates:{},showTranscriptToc:CN,legacyComposerState:{provider:"claude",model:"opus",modelOptions:{...Iu},planMode:!1},setDefaultProvider:n=>e({defaultProvider:n}),setShowTranscriptToc:n=>e({showTranscriptToc:n}),setProviderDefaultModel:(n,r)=>e(s=>({providerDefaults:{...s.providerDefaults,[n]:n==="claude"?Go({...s.providerDefaults.claude,model:r}):Yo({...s.providerDefaults.codex,model:r})}})),setProviderDefaultModelOptions:(n,r)=>e(s=>({providerDefaults:{...s.providerDefaults,[n]:n==="claude"?Go({...s.providerDefaults.claude,modelOptions:{...s.providerDefaults.claude.modelOptions,...r}}):Yo({...s.providerDefaults.codex,modelOptions:{...s.providerDefaults.codex.modelOptions,...r}})}})),setProviderDefaultPlanMode:(n,r)=>e(s=>({providerDefaults:{...s.providerDefaults,[n]:{...s.providerDefaults[n],planMode:r}}})),getComposerState:n=>Xf(EN(t(),n)),initializeComposerForChat:(n,r)=>e(s=>{if(s.chatStates[n])return s;const a=kN({defaultProvider:s.defaultProvider,providerDefaults:s.providerDefaults,sourceState:r==null?void 0:r.sourceState,legacyComposerState:s.legacyComposerState});return aU("initializeComposerForChat",{chatId:n,composerState:a}),{chatStates:{...s.chatStates,[n]:a}}}),setComposerState:(n,r)=>e(s=>({chatStates:{...s.chatStates,[n]:Xf(r)}})),setChatComposerProvider:(n,r)=>e(s=>$h(s,n,()=>Hu(r,s.providerDefaults))),setChatComposerModel:(n,r)=>e(s=>$h(s,n,a=>a.provider==="claude"?{provider:"claude",model:r,modelOptions:Go({...a,model:r}).modelOptions,planMode:a.planMode}:{provider:"codex",model:r,modelOptions:Yo({...a,model:r}).modelOptions,planMode:a.planMode})),setChatComposerModelOptions:(n,r)=>e(s=>$h(s,n,a=>a.provider==="claude"?{provider:"claude",model:a.model,modelOptions:Go({...a,modelOptions:{...a.modelOptions,...r}}).modelOptions,planMode:a.planMode}:{provider:"codex",model:a.model,modelOptions:Yo({...a,modelOptions:{...a.modelOptions,...r}}).modelOptions,planMode:a.planMode})),setChatComposerPlanMode:(n,r)=>e(s=>$h(s,n,a=>({...a,planMode:r}))),resetChatComposerFromProvider:(n,r)=>e(s=>({chatStates:{...s.chatStates,[n]:Hu(r,s.providerDefaults)}}))}),{name:"chat-preferences",version:5,migrate:e=>uU(e)}));var zp="Popover",[RN]=vs(zp,[go]),ld=go(),[dU,vo]=RN(zp),TN=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:l=!1}=e,u=ld(t),h=y.useRef(null),[d,m]=y.useState(!1),[g,_]=Rl({prop:r,defaultProp:s??!1,onChange:a,caller:zp});return p.jsx(kp,{...u,children:p.jsx(dU,{scope:t,contentId:ds(),triggerRef:h,open:g,onOpenChange:_,onOpenToggle:y.useCallback(()=>_(b=>!b),[_]),hasCustomAnchor:d,onCustomAnchorAdd:y.useCallback(()=>m(!0),[]),onCustomAnchorRemove:y.useCallback(()=>m(!1),[]),modal:l,children:n})})};TN.displayName=zp;var MN="PopoverAnchor",hU=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=vo(MN,n),a=ld(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=s;return y.useEffect(()=>(l(),()=>u()),[l,u]),p.jsx(Ju,{...a,...r,ref:t})});hU.displayName=MN;var NN="PopoverTrigger",AN=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=vo(NN,n),a=ld(n),l=_t(t,s.triggerRef),u=p.jsx(rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":zN(s.open),...r,ref:l,onClick:Ae(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:p.jsx(Ju,{asChild:!0,...a,children:u})});AN.displayName=NN;var g0="PopoverPortal",[fU,pU]=RN(g0,{forceMount:void 0}),DN=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,a=vo(g0,t);return p.jsx(fU,{scope:t,forceMount:n,children:p.jsx(ti,{present:n||a.open,children:p.jsx(Il,{asChild:!0,container:s,children:r})})})};DN.displayName=g0;var Nl="PopoverContent",ON=y.forwardRef((e,t)=>{const n=pU(Nl,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,a=vo(Nl,e.__scopePopover);return p.jsx(ti,{present:r||a.open,children:a.modal?p.jsx(gU,{...s,ref:t}):p.jsx(vU,{...s,ref:t})})});ON.displayName=Nl;var mU=Qo("PopoverContent.RemoveScroll"),gU=y.forwardRef((e,t)=>{const n=vo(Nl,e.__scopePopover),r=y.useRef(null),s=_t(t,r),a=y.useRef(!1);return y.useEffect(()=>{const l=r.current;if(l)return _p(l)},[]),p.jsx(Xu,{as:mU,allowPinchZoom:!0,children:p.jsx(jN,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ae(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),a.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Ae(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,h=u.button===0&&u.ctrlKey===!0,d=u.button===2||h;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Ae(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),vU=y.forwardRef((e,t)=>{const n=vo(Nl,e.__scopePopover),r=y.useRef(!1),s=y.useRef(!1);return p.jsx(jN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),jN=y.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:m,...g}=e,_=vo(Nl,n),b=ld(n);return gp(),p.jsx(Yu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:p.jsx(Bl,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onDismiss:()=>_.onOpenChange(!1),children:p.jsx(Ep,{"data-state":zN(_.open),role:"dialog",id:_.contentId,...b,...g,ref:t,style:{...g.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)"}})})})}),LN="PopoverClose",_U=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=vo(LN,n);return p.jsx(rt.button,{type:"button",...r,ref:t,onClick:Ae(e.onClick,()=>s.onOpenChange(!1))})});_U.displayName=LN;var yU="PopoverArrow",bU=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ld(n);return p.jsx(Rp,{...s,...r,ref:t})});bU.displayName=yU;function zN(e){return e?"open":"closed"}var xU=TN,wU=AN,SU=DN,PN=ON;const CU=xU,kU=wU,BN=y.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>p.jsx(SU,{children:p.jsx(PN,{ref:s,align:t,sideOffset:n,[Nu]:"",onCloseAutoFocus:a=>{var l;a.preventDefault(),window.dispatchEvent(new Event(Lf)),(l=r.onCloseAutoFocus)==null||l.call(r,a)},className:be("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg 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})}));BN.displayName=PN.displayName;function EU({className:e,...t}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:be("shrink-0",e),...t,children:p.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 RU({className:e,...t}){return p.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:be("shrink-0",e),...t,children:p.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"})})}const E2={claude:EU,codex:RU};function os({onClick:e,selected:t,icon:n,label:r,description:s,disabled:a}){return p.jsxs("button",{onClick:e,disabled:a,className:be("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",t?"bg-muted border-border":"hover:opacity-60",a&&"opacity-40 cursor-not-allowed"),children:[n,p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:r}),s?p.jsx("div",{className:"text-xs text-muted-foreground",children:s}):null]})]})}function sl({trigger:e,triggerClassName:t,disabled:n=!1,children:r}){const[s,a]=y.useState(!1);return n?p.jsx("button",{disabled:!0,className:be("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default [&>span]:whitespace-nowrap",t),children:e}):p.jsxs(CU,{open:s,onOpenChange:a,children:[p.jsx(kU,{asChild:!0,children:p.jsx("button",{className:be("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0 [&>span]:whitespace-nowrap","hover:bg-muted/50",t),children:e})}),p.jsx(BN,{align:"center",className:"w-64 p-1",children:p.jsx("div",{className:"space-y-1",children:typeof r=="function"?r(()=>a(!1)):r})})]})}function G_({availableProviders:e,selectedProvider:t,showProviderPicker:n=!0,providerLocked:r=!1,model:s,modelOptions:a,onProviderChange:l,onModelChange:u,onModelOptionChange:h,planMode:d=!1,onPlanModeChange:m,includePlanMode:g=!0,className:_}){var D,j,F,G,B;const b=e.find(H=>H.id===t)??e[0],w=E2[t],S=HC,C=g&&(b==null?void 0:b.supportsPlanMode)&&m,k=t==="claude"?a:null,T=t==="codex"?a:null,R=((D=b.models.find(H=>H.id===s))==null?void 0:D.contextWindowOptions)??[],M=(k==null?void 0:k.contextWindow)??q_[0].id,O=M==="1m"?WC:VC;return p.jsxs("div",{className:be("flex md:justify-center items-center gap-0.5",_),children:[n?p.jsx(sl,{disabled:r||!l,trigger:p.jsxs(p.Fragment,{children:[p.jsx(w,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:(b==null?void 0:b.label)??t})]}),children:H=>e.map(P=>{const U=E2[P.id];return p.jsx(os,{onClick:()=>{l==null||l(P.id),H()},selected:t===P.id,icon:p.jsx(U,{className:"h-4 w-4 text-muted-foreground"}),label:P.label},P.id)})}):null,p.jsx(sl,{trigger:p.jsxs(p.Fragment,{children:[p.jsx(S,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:((j=b.models.find(H=>H.id===s))==null?void 0:j.label)??s})]}),children:H=>b.models.map(P=>{const U=HC;return p.jsx(os,{onClick:()=>{u(t,P.id),H()},selected:s===P.id,icon:p.jsx(U,{className:"h-4 w-4 text-muted-foreground"}),label:P.label},P.id)})}),p.jsx(sl,{trigger:p.jsxs(p.Fragment,{children:[p.jsx(kv,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:t==="claude"?((F=Yf.find(H=>H.id===a.reasoningEffort))==null?void 0:F.label)??a.reasoningEffort:((G=W_.find(H=>H.id===a.reasoningEffort))==null?void 0:G.label)??a.reasoningEffort})]}),children:H=>t==="claude"?Yf.map(P=>p.jsx(os,{onClick:()=>{h({type:"claudeReasoningEffort",effort:P.id}),H()},selected:a.reasoningEffort===P.id,icon:p.jsx(kv,{className:"h-4 w-4 text-muted-foreground"}),label:P.label,disabled:P.id==="max"&&s!=="opus"},P.id)):W_.map(P=>p.jsx(os,{onClick:()=>{h({type:"codexReasoningEffort",effort:P.id}),H()},selected:a.reasoningEffort===P.id,icon:p.jsx(kv,{className:"h-4 w-4 text-muted-foreground"}),label:P.label},P.id))}),t==="claude"&&R.length>1?p.jsx(sl,{trigger:p.jsxs(p.Fragment,{children:[p.jsx(O,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:((B=R.find(H=>H.id===M))==null?void 0:B.label)??M})]}),children:H=>R.map(P=>p.jsx(os,{onClick:()=>{h({type:"contextWindow",contextWindow:P.id}),H()},selected:M===P.id,icon:P.id==="1m"?p.jsx(WC,{className:"h-4 w-4 text-muted-foreground"}):p.jsx(VC,{className:"h-4 w-4 text-muted-foreground"}),label:P.label,description:P.id==="1m"?"Expanded context window":"Standard context window"},P.id))}):null,t==="codex"?p.jsx(sl,{trigger:p.jsxs(p.Fragment,{children:[T!=null&&T.fastMode?p.jsx(Ph,{className:"h-3.5 w-3.5"}):p.jsx(Ph,{className:"h-3.5 w-3.5 -scale-x-100"}),p.jsx("span",{children:T!=null&&T.fastMode?"Fast Mode":"Standard"})]}),triggerClassName:T!=null&&T.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:H=>p.jsxs(p.Fragment,{children:[p.jsx(os,{onClick:()=>{h({type:"fastMode",fastMode:!1}),H()},selected:!(T!=null&&T.fastMode),icon:p.jsx(Ph,{className:"h-4 w-4 text-muted-foreground -scale-x-100"}),label:"Standard"}),p.jsx(os,{onClick:()=>{h({type:"fastMode",fastMode:!0}),H()},selected:!!(T!=null&&T.fastMode),icon:p.jsx(Ph,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,C?p.jsx(sl,{trigger:p.jsxs(p.Fragment,{children:[d?p.jsx(jf,{className:"h-3.5 w-3.5"}):p.jsx(UC,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:d?"Plan Mode":"Full Access"})]}),triggerClassName:d?"text-blue-400 dark:text-blue-300":void 0,children:H=>p.jsxs(p.Fragment,{children:[p.jsx(os,{onClick:()=>{m(!1),H()},selected:!d,icon:p.jsx(UC,{className:"h-4 w-4 text-muted-foreground"}),label:"Full Access",description:"Execution without approval"}),p.jsx(os,{onClick:()=>{m(!0),H()},selected:d,icon:p.jsx(jf,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan Mode",description:"Review a plan before execution"})]})}):null]})}const TU=1024*1024,MU=256*1024,R2=200,Y_=20,IN=new Set([".c",".cc",".cfg",".conf",".cpp",".cs",".css",".env",".go",".graphql",".h",".hpp",".html",".ini",".java",".js",".jsonc",".jsx",".kt",".lua",".mjs",".php",".pl",".properties",".py",".rb",".rs",".scss",".sh",".sql",".swift",".toml",".ts",".tsx",".txt",".vue",".xml",".yaml",".yml",".zsh"]),NU=new Set([".7z",".bz2",".gz",".rar",".tar",".tgz",".xz",".zip"]),AU=new Set([".aac",".flac",".m4a",".mp3",".ogg",".wav"]),DU=new Set([".avi",".m4v",".mov",".mp4",".mkv",".webm"]);function v0(e){const t=e.mimeType.toLowerCase(),n=HN(e.displayName);return t.startsWith("image/")?{kind:"image",openInNewTab:!1}:t==="application/pdf"?{kind:"pdf",openInNewTab:!1}:t==="application/json"?e.size<=MU?{kind:"json",openInNewTab:!1}:{kind:"external",openInNewTab:!0}:n===".md"?{kind:"markdown",openInNewTab:!1}:t==="text/csv"||t==="text/tab-separated-values"?{kind:"table",openInNewTab:!1}:t.startsWith("text/")?{kind:"text",openInNewTab:!1}:IN.has(n)?{kind:"text",openInNewTab:!1}:{kind:"external",openInNewTab:!0}}function OU(e){const t=e.mimeType.toLowerCase(),n=HN(e.displayName);return t.startsWith("image/")?"image":t==="application/pdf"||n===".pdf"?"pdf":t==="application/json"||n===".json"||n===".jsonc"?"json":n===".md"?"markdown":t==="text/csv"||t==="text/tab-separated-values"||n===".csv"||n===".tsv"?"table":t.startsWith("audio/")||AU.has(n)?"audio":t.startsWith("video/")||DU.has(n)?"video":t.includes("zip")||t.includes("archive")||NU.has(n)?"archive":IN.has(n)?n===".txt"?"text":"code":t.startsWith("text/")?"text":"file"}async function jU(e,t){const n=typeof AbortController<"u"?new AbortController:null,r=typeof window<"u"&&n?window.setTimeout(()=>n.abort("preview-timeout"),15e3):null;try{const s=await fetch(PU(e),{signal:n==null?void 0:n.signal,headers:{Accept:"text/plain, text/markdown, application/json, text/csv, text/tab-separated-values, */*"}});if(!s.ok)throw new Error(`Preview request failed with status ${s.status}`);if(!s.body){const g=await s.text(),_=new TextEncoder().encode(g),b=_.length>t;return{content:b?new TextDecoder().decode(_.slice(0,t)):g,truncated:b}}const a=s.body.getReader(),l=[];let u=0,h=!1;for(;;){const{done:g,value:_}=await a.read();if(g)break;if(!_)continue;const b=t-u;if(b<=0){h=!0,await a.cancel();break}if(_.byteLength>b){l.push(_.slice(0,b)),u+=b,h=!0,await a.cancel();break}l.push(_),u+=_.byteLength}const d=new Uint8Array(u);let m=0;for(const g of l)d.set(g,m),m+=g.byteLength;return{content:new TextDecoder().decode(d),truncated:h}}catch(s){throw BU(s)?new Error("Preview request timed out"):s}finally{r!==null&&window.clearTimeout(r)}}function LU(e){try{return`${JSON.stringify(JSON.parse(e),null,2)}
524
+ `}catch{return e}}function zU(e,t){const n=IU(e,t),r=n.length,s=n.reduce((u,h)=>Math.max(u,h.length),0),a=r>R2,l=s>Y_;return{rows:n.slice(0,R2).map(u=>u.slice(0,Y_)),rowCount:r,columnCount:s,truncatedRows:a,truncatedColumns:l}}function HN(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function PU(e){return typeof window>"u"?e:new URL(e,window.location.origin).toString()}function BU(e){return e instanceof DOMException&&e.name==="AbortError"?!0:typeof e=="string"&&e==="preview-timeout"}function IU(e,t){const n=[];let r=[],s="",a=!1;for(let l=0;l<e.length;l+=1){const u=e[l],h=e[l+1];if(u==='"'){a&&h==='"'?(s+='"',l+=1):a=!a;continue}if(!a&&u===t){r.push(s),s="";continue}if(!a&&(u===`
525
+ `||u==="\r")){u==="\r"&&h===`
526
+ `&&(l+=1),r.push(s),n.push(r),r=[],s="";continue}s+=u}return(s.length>0||r.length>0)&&(r.push(s),n.push(r)),n}function FN({attachment:e,previewUrl:t,onClick:n,onRemove:r,className:s,size:a="transcript"}){const l=e.contentUrl||t,u=a==="composer";return p.jsxs("div",{className:be("group relative flex flex-row items-end",s),children:[p.jsxs("button",{type:"button",onClick:n,className:be("group/image relative overflow-hidden rounded-xl border border-border/80 bg-background/85 shadow-sm backdrop-blur-md",u?"min-w-[80px]":"min-w-[200px]"),children:[l?p.jsx("img",{src:l,alt:e.displayName,className:be("rounded-xl object-contain bg-muted",u?"min-h-[50px] min-w-[80px] max-h-[120px] max-w-[200px]":"min-h-[100px] min-w-[200px] max-h-[300px] max-w-[300px]")}):p.jsx("div",{className:be("flex items-center justify-center rounded-xl bg-muted text-muted-foreground",u?"min-h-[64px] min-w-[80px]":"min-h-[160px] min-w-[200px]"),children:p.jsx(ST,{className:be(u?"size-6":"size-8")})}),p.jsxs("div",{className:be("pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/75 via-black/30 to-transparent text-left opacity-0 transition-opacity duration-200 group-hover/image:opacity-100",u?"px-2.5 pb-2 pt-6":"px-4 pb-3 pt-10"),children:[p.jsx("div",{className:be("truncate font-medium text-white",u?"text-xs":"text-sm"),children:e.displayName}),p.jsxs("div",{className:"truncate text-xs text-white/80",children:[e.mimeType," · ",_0(e.size)]})]})]}),r?p.jsx($N,{displayName:e.displayName,onRemove:r}):null]})}function UN({attachment:e,onClick:t,onRemove:n,className:r}){const s=HU(OU(e));return p.jsxs("div",{className:be("group relative",r),children:[p.jsxs("button",{type:"button",onClick:t,className:"flex w-[200px] items-center gap-2 rounded-xl border border-border bg-background/85 p-1 pr-3 text-left transition-colors hover:bg-accent/50",children:[p.jsx("div",{className:"flex min-h-10 min-w-10 items-center justify-center rounded-lg border border-border bg-muted text-muted-foreground",children:p.jsx(s,{className:"size-5"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"max-w-[150px] truncate text-[13px] font-medium text-foreground",children:e.displayName}),p.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[e.mimeType," · ",_0(e.size)]})]})]}),n?p.jsx($N,{displayName:e.displayName,onRemove:n}):null]})}function $N({displayName:e,onRemove:t}){return p.jsx("button",{type:"button",className:"absolute right-2 top-2 rounded-full bg-background/90 p-1 text-muted-foreground shadow-sm transition hover:bg-muted hover:text-foreground",onClick:n=>{n.preventDefault(),n.stopPropagation(),t()},"aria-label":`Remove ${e}`,children:p.jsx(mo,{className:"h-3.5 w-3.5"})})}function HU(e){switch(e){case"image":return ST;case"pdf":return jB;case"markdown":return BB;case"json":return HP;case"table":return ZP;case"code":return UP;case"text":return JP;case"archive":return BP;case"audio":return WP;case"video":return tB;default:return CT}}function _0(e){return e<1024?`${e} B`:e<1024*1024?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function FU(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const UU=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$U=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,WU={};function T2(e,t){return(WU.jsx?$U:UU).test(e)}const VU=/[ \t\n\f\r]/g;function qU(e){return typeof e=="object"?e.type==="text"?M2(e.value):!1:M2(e)}function M2(e){return e.replace(VU,"")===""}class cd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}cd.prototype.normal={};cd.prototype.property={};cd.prototype.space=void 0;function WN(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new cd(n,r,t)}function X_(e){return e.toLowerCase()}class _r{constructor(t,n){this.attribute=n,this.property=t}}_r.prototype.attribute="";_r.prototype.booleanish=!1;_r.prototype.boolean=!1;_r.prototype.commaOrSpaceSeparated=!1;_r.prototype.commaSeparated=!1;_r.prototype.defined=!1;_r.prototype.mustUseProperty=!1;_r.prototype.number=!1;_r.prototype.overloadedBoolean=!1;_r.prototype.property="";_r.prototype.spaceSeparated=!1;_r.prototype.space=void 0;let KU=0;const Ke=pa(),on=pa(),Z_=pa(),Se=pa(),Ot=pa(),Cl=pa(),Mr=pa();function pa(){return 2**++KU}const Q_=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ke,booleanish:on,commaOrSpaceSeparated:Mr,commaSeparated:Cl,number:Se,overloadedBoolean:Z_,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),Lv=Object.keys(Q_);class y0 extends _r{constructor(t,n,r,s){let a=-1;if(super(t,n),N2(this,"space",s),typeof r=="number")for(;++a<Lv.length;){const l=Lv[a];N2(this,Lv[a],(r&Q_[l])===Q_[l])}}}y0.prototype.defined=!0;function N2(e,t,n){n&&(e[t]=n)}function Vl(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new y0(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[X_(r)]=r,n[X_(a.attribute)]=r}return new cd(t,n,e.space)}const VN=Vl({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Ot,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:Se,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Ot,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:on,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function qN(e,t){return t in e?e[t]:t}function KN(e,t){return qN(e,t.toLowerCase())}const GU=Vl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Cl,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:Ke,allowPaymentRequest:Ke,allowUserMedia:Ke,alt:null,as:null,async:Ke,autoCapitalize:null,autoComplete:Ot,autoFocus:Ke,autoPlay:Ke,blocking:Ot,capture:null,charSet:null,checked:Ke,cite:null,className:Ot,cols:Se,colSpan:null,content:null,contentEditable:on,controls:Ke,controlsList:Ot,coords:Se|Cl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ke,defer:Ke,dir:null,dirName:null,disabled:Ke,download:Z_,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ke,formTarget:null,headers:Ot,height:Se,hidden:Z_,high:Se,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:Ke,inputMode:null,integrity:null,is:null,isMap:Ke,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:Ke,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ke,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ke,muted:Ke,name:null,nonce:null,noModule:Ke,noValidate:Ke,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:Ke,optimum:Se,pattern:null,ping:Ot,placeholder:null,playsInline:Ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ke,referrerPolicy:null,rel:Ot,required:Ke,reversed:Ke,rows:Se,rowSpan:Se,sandbox:Ot,scope:null,scoped:Ke,seamless:Ke,selected:Ke,shadowRootClonable:Ke,shadowRootDelegatesFocus:Ke,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:on,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ke,useMap:null,value:on,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ke,declare:Ke,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ke,noHref:Ke,noShade:Ke,noWrap:Ke,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:on,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ke,disableRemotePlayback:Ke,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:KN}),YU=Vl({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:Mr,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Ot,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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Ke,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:Cl,g2:Cl,glyphName:Cl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:Mr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,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:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mr,rev:Mr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mr,requiredFeatures:Mr,requiredFonts:Mr,requiredFormats:Mr,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:Mr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mr,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:qN}),GN=Vl({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()}}),YN=Vl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:KN}),XN=Vl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),XU={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"},ZU=/[A-Z]/g,A2=/-[a-z]/g,QU=/^data[-\w.:]+$/i;function JU(e,t){const n=X_(t);let r=t,s=_r;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&QU.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(A2,t$);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!A2.test(a)){let l=a.replace(ZU,e$);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}s=y0}return new s(r,t)}function e$(e){return"-"+e.toLowerCase()}function t$(e){return e.charAt(1).toUpperCase()}const n$=WN([VN,GU,GN,YN,XN],"html"),b0=WN([VN,YU,GN,YN,XN],"svg");function r$(e){return e.join(" ").trim()}var ol={},zv,D2;function i$(){if(D2)return zv;D2=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,h=`
527
+ `,d="/",m="*",g="",_="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 T=1,R=1;function M(q){var W=q.match(t);W&&(T+=W.length);var z=q.lastIndexOf(h);R=~z?q.length-z:R+q.length}function O(){var q={line:T,column:R};return function(W){return W.position=new D(q),G(),W}}function D(q){this.start=q,this.end={line:T,column:R},this.source=k.source}D.prototype.content=C;function j(q){var W=new Error(k.source+":"+T+":"+R+": "+q);if(W.reason=q,W.filename=k.source,W.line=T,W.column=R,W.source=C,!k.silent)throw W}function F(q){var W=q.exec(C);if(W){var z=W[0];return M(z),C=C.slice(z.length),W}}function G(){F(n)}function B(q){var W;for(q=q||[];W=H();)W!==!1&&q.push(W);return q}function H(){var q=O();if(!(d!=C.charAt(0)||m!=C.charAt(1))){for(var W=2;g!=C.charAt(W)&&(m!=C.charAt(W)||d!=C.charAt(W+1));)++W;if(W+=2,g===C.charAt(W-1))return j("End of comment missing");var z=C.slice(2,W-2);return R+=2,M(z),C=C.slice(W),R+=2,q({type:_,comment:z})}}function P(){var q=O(),W=F(r);if(W){if(H(),!F(s))return j("property missing ':'");var z=F(a),$=q({type:b,property:S(W[0].replace(e,g)),value:z?S(z[0].replace(e,g)):g});return F(l),$}}function U(){var q=[];B(q);for(var W;W=P();)W!==!1&&(q.push(W),B(q));return q}return G(),U()}function S(C){return C?C.replace(u,g):g}return zv=w,zv}var O2;function s$(){if(O2)return ol;O2=1;var e=ol&&ol.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ol,"__esModule",{value:!0}),ol.default=n;const t=e(i$());function n(r,s){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),u=typeof s=="function";return l.forEach(h=>{if(h.type!=="declaration")return;const{property:d,value:m}=h;u?s(d,m,h):m&&(a=a||{},a[d]=m)}),a}return ol}var qc={},j2;function o$(){if(j2)return qc;j2=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(d){return!d||n.test(d)||e.test(d)},l=function(d,m){return m.toUpperCase()},u=function(d,m){return"".concat(m,"-")},h=function(d,m){return m===void 0&&(m={}),a(d)?d:(d=d.toLowerCase(),m.reactCompat?d=d.replace(s,u):d=d.replace(r,u),d.replace(t,l))};return qc.camelCase=h,qc}var Kc,L2;function a$(){if(L2)return Kc;L2=1;var e=Kc&&Kc.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(s$()),n=o$();function r(s,a){var l={};return!s||typeof s!="string"||(0,t.default)(s,function(u,h){u&&h&&(l[(0,n.camelCase)(u,a)]=h)}),l}return r.default=r,Kc=r,Kc}var l$=a$();const c$=hp(l$),ZN=QN("end"),x0=QN("start");function QN(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 u$(e){const t=x0(e),n=ZN(e);if(t&&n)return{start:t,end:n}}function Cu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?z2(e.position):"start"in e||"end"in e?z2(e):"line"in e||"column"in e?J_(e):""}function J_(e){return P2(e&&e.line)+":"+P2(e&&e.column)}function z2(e){return J_(e&&e.start)+"-"+J_(e&&e.end)}function P2(e){return e&&typeof e=="number"?e:1}class Gn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?s=t:!a.cause&&t&&(l=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?a.ruleId=r:(a.source=r.slice(0,h),a.ruleId=r.slice(h+1))}if(!a.place&&a.ancestors&&a.ancestors){const h=a.ancestors[a.ancestors.length-1];h&&(a.place=h.position)}const u=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=u?u.line:void 0,this.name=Cu(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gn.prototype.file="";Gn.prototype.name="";Gn.prototype.reason="";Gn.prototype.message="";Gn.prototype.stack="";Gn.prototype.column=void 0;Gn.prototype.line=void 0;Gn.prototype.ancestors=void 0;Gn.prototype.cause=void 0;Gn.prototype.fatal=void 0;Gn.prototype.place=void 0;Gn.prototype.ruleId=void 0;Gn.prototype.source=void 0;const w0={}.hasOwnProperty,d$=new Map,h$=/[A-Z]/g,f$=new Set(["table","tbody","thead","tfoot","tr"]),p$=new Set(["td","th"]),JN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m$(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=S$(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=w$(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?b0:n$,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=eA(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function eA(e,t,n){if(t.type==="element")return g$(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return v$(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return y$(e,t,n);if(t.type==="mdxjsEsm")return _$(e,t);if(t.type==="root")return b$(e,t,n);if(t.type==="text")return x$(e,t)}function g$(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=b0,e.schema=s),e.ancestors.push(t);const a=nA(e,t.tagName,!1),l=C$(e,t);let u=C0(e,t);return f$.has(t.tagName)&&(u=u.filter(function(h){return typeof h=="string"?!qU(h):!0})),tA(e,l,a,t),S0(l,u),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function v$(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)}Fu(e,t.position)}function _$(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Fu(e,t.position)}function y$(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=b0,e.schema=s),e.ancestors.push(t);const a=t.name===null?e.Fragment:nA(e,t.name,!0),l=k$(e,t),u=C0(e,t);return tA(e,l,a,t),S0(l,u),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function b$(e,t,n){const r={};return S0(r,C0(e,t)),e.create(t,e.Fragment,r,n)}function x$(e,t){return t.value}function tA(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function S0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function w$(e,t,n){return r;function r(s,a,l,u){const d=Array.isArray(l.children)?n:t;return u?d(a,l,u):d(a,l)}}function S$(e,t){return n;function n(r,s,a,l){const u=Array.isArray(a.children),h=x0(r);return t(s,a,l,u,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function C$(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&w0.call(t.properties,s)){const a=E$(e,s,t.properties[s]);if(a){const[l,u]=a;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&p$.has(t.tagName)?r=u:n[l]=u}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function k$(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Fu(e,t.position);else{const s=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const u=r.value.data.estree.body[0];u.type,a=e.evaluater.evaluateExpression(u.expression)}else Fu(e,t.position);else a=r.value===null?!0:r.value;n[s]=a}return n}function C0(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:d$;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const h=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(h){const d=s.get(h)||0;l=h+"-"+d,s.set(h,d+1)}}const u=eA(e,a,l);u!==void 0&&n.push(u)}return n}function E$(e,t,n){const r=JU(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?FU(n):r$(n)),r.property==="style"){let s=typeof n=="object"?n:R$(e,String(n));return e.stylePropertyNameCase==="css"&&(s=T$(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?XU[r.property]||r.property:r.attribute,n]}}function R$(e,t){try{return c$(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Gn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=JN+"#cannot-parse-style-attribute",s}}function nA(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let a=-1,l;for(;++a<s.length;){const u=T2(s[a])?{type:"Identifier",name:s[a]}:{type:"Literal",value:s[a]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(a&&u.type==="Literal"),optional:!1}:u}r=l}else r=T2(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return w0.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Fu(e)}function Fu(e,t){const n=new Gn("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=JN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function T$(e){const t={};let n;for(n in e)w0.call(e,n)&&(t[M$(n)]=e[n]);return t}function M$(e){let t=e.replace(h$,N$);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function N$(e){return"-"+e.toLowerCase()}const Pv={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"]},A$={};function k0(e,t){const n=A$,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return rA(e,r,s)}function rA(e,t,n){if(D$(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 B2(e.children,t,n)}return Array.isArray(e)?B2(e,t,n):""}function B2(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=rA(e[s],t,n);return r.join("")}function D$(e){return!!(e&&typeof e=="object")}const I2=document.createElement("i");function E0(e){const t="&"+e+";";I2.innerHTML=t;const n=I2.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Dr(e,t,n,r){const s=e.length;let a=0,l;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Zr(e,t){return e.length>0?(Dr(e,e.length,0,t),e):t}const H2={}.hasOwnProperty;function iA(e){const t={};let n=-1;for(;++n<e.length;)O$(t,e[n]);return t}function O$(e,t){let n;for(n in t){const s=(H2.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){H2.call(s,l)||(s[l]=[]);const u=a[l];j$(s[l],Array.isArray(u)?u:u?[u]:[])}}}function j$(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Dr(e,0,0,r)}function sA(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ui(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rr=_o(/[A-Za-z]/),qn=_o(/[\dA-Za-z]/),L$=_o(/[#-'*+\--9=?A-Z^-~]/);function Zf(e){return e!==null&&(e<32||e===127)}const ey=_o(/\d/),z$=_o(/[\dA-Fa-f]/),P$=_o(/[!-/:-@[-`{-~]/);function Be(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function nt(e){return e===-2||e===-1||e===32}const Pp=_o(new RegExp("\\p{P}|\\p{S}","u")),ta=_o(/\s/);function _o(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ql(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&qn(e.charCodeAt(n+1))&&qn(e.charCodeAt(n+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const u=e.charCodeAt(n+1);a<56320&&u>56319&&u<57344?(l=String.fromCharCode(a,u),s=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function ct(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(h){return nt(h)?(e.enter(n),u(h)):t(h)}function u(h){return nt(h)&&a++<s?(e.consume(h),u):(e.exit(n),t(h))}}const B$={tokenize:I$};function I$(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),ct(e,t,"linePrefix")}function s(u){return e.enter("paragraph"),a(u)}function a(u){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return Be(u)?(e.consume(u),e.exit("chunkText"),a):(e.consume(u),l)}}const H$={tokenize:F$},F2={tokenize:U$};function F$(e){const t=this,n=[];let r=0,s,a,l;return u;function u(R){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,h,d)(R)}return d(R)}function h(R){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const M=t.events.length;let O=M,D;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){D=t.events[O][1].end;break}k(r);let j=M;for(;j<t.events.length;)t.events[j][1].end={...D},j++;return Dr(t.events,O+1,0,t.events.slice(M)),t.events.length=j,d(R)}return u(R)}function d(R){if(r===n.length){if(!s)return _(R);if(s.currentConstruct&&s.currentConstruct.concrete)return w(R);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(F2,m,g)(R)}function m(R){return s&&T(),k(r),_(R)}function g(R){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,w(R)}function _(R){return t.containerState={},e.attempt(F2,b,w)(R)}function b(R){return r++,n.push([t.currentConstruct,t.containerState]),_(R)}function w(R){if(R===null){s&&T(),k(0),e.consume(R);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),S(R)}function S(R){if(R===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(R);return}return Be(R)?(e.consume(R),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(R),S)}function C(R,M){const O=t.sliceStream(R);if(M&&O.push(null),R.previous=a,a&&(a.next=R),a=R,s.defineSkip(R.start),s.write(O),t.parser.lazy[R.start.line]){let D=s.events.length;for(;D--;)if(s.events[D][1].start.offset<l&&(!s.events[D][1].end||s.events[D][1].end.offset>l))return;const j=t.events.length;let F=j,G,B;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(G){B=t.events[F][1].end;break}G=!0}for(k(r),D=j;D<t.events.length;)t.events[D][1].end={...B},D++;Dr(t.events,F+1,0,t.events.slice(j)),t.events.length=D}}function k(R){let M=n.length;for(;M-- >R;){const O=n[M];t.containerState=O[1],O[0].exit.call(t,e)}n.length=R}function T(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function U$(e,t,n){return ct(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Al(e){if(e===null||Dt(e)||ta(e))return 1;if(Pp(e))return 2}function Bp(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const ty={name:"attention",resolveAll:$$,tokenize:W$};function $$(e,t){let n=-1,r,s,a,l,u,h,d,m;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 g={...e[r][1].end},_={...e[n][1].start};U2(g,-h),U2(_,h),l={type:h>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},u={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:_},a={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:h>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},e[r][1].end={...l.start},e[n][1].start={...u.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Zr(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Zr(d,[["enter",s,t],["enter",l,t],["exit",l,t],["enter",a,t]]),d=Zr(d,Bp(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Zr(d,[["exit",a,t],["enter",u,t],["exit",u,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,d=Zr(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Dr(e,r-1,n-r+3,d),n=r+d.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function W$(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Al(r);let a;return l;function l(h){return a=h,e.enter("attentionSequence"),u(h)}function u(h){if(h===a)return e.consume(h),u;const d=e.exit("attentionSequence"),m=Al(h),g=!m||m===2&&s||n.includes(h),_=!s||s===2&&m||n.includes(r);return d._open=!!(a===42?g:g&&(s||!_)),d._close=!!(a===42?_:_&&(m||!g)),t(h)}}function U2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const V$={name:"autolink",tokenize:q$};function q$(e,t,n){let r=0;return s;function s(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(b){return rr(b)?(e.consume(b),l):b===64?n(b):d(b)}function l(b){return b===43||b===45||b===46||qn(b)?(r=1,u(b)):d(b)}function u(b){return b===58?(e.consume(b),r=0,h):(b===43||b===45||b===46||qn(b))&&r++<32?(e.consume(b),u):(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||Zf(b)?n(b):(e.consume(b),h)}function d(b){return b===64?(e.consume(b),m):L$(b)?(e.consume(b),d):n(b)}function m(b){return qn(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),r=0,m):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):_(b)}function _(b){if((b===45||qn(b))&&r++<63){const w=b===45?_:g;return e.consume(b),w}return n(b)}}const ud={partial:!0,tokenize:K$};function K$(e,t,n){return r;function r(a){return nt(a)?ct(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||Be(a)?t(a):n(a)}}const oA={continuation:{tokenize:Y$},exit:X$,name:"blockQuote",tokenize:G$};function G$(e,t,n){const r=this;return s;function s(l){if(l===62){const u=r.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return nt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function Y$(e,t,n){const r=this;return s;function s(l){return nt(l)?ct(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(oA,t,n)(l)}}function X$(e){e.exit("blockQuote")}const aA={name:"characterEscape",tokenize:Z$};function Z$(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return P$(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const lA={name:"characterReference",tokenize:Q$};function Q$(e,t,n){const r=this;let s=0,a,l;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),h}function h(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),a=31,l=qn,m(g))}function d(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=z$,m):(e.enter("characterReferenceValue"),a=7,l=ey,m(g))}function m(g){if(g===59&&s){const _=e.exit("characterReferenceValue");return l===qn&&!E0(r.sliceSerialize(_))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&s++<a?(e.consume(g),m):n(g)}}const $2={partial:!0,tokenize:eW},W2={concrete:!0,name:"codeFenced",tokenize:J$};function J$(e,t,n){const r=this,s={partial:!0,tokenize:O};let a=0,l=0,u;return h;function h(D){return d(D)}function d(D){const j=r.events[r.events.length-1];return a=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,u=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(D)}function m(D){return D===u?(l++,e.consume(D),m):l<3?n(D):(e.exit("codeFencedFenceSequence"),nt(D)?ct(e,g,"whitespace")(D):g(D))}function g(D){return D===null||Be(D)?(e.exit("codeFencedFence"),r.interrupt?t(D):e.check($2,S,M)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),_(D))}function _(D){return D===null||Be(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(D)):nt(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ct(e,b,"whitespace")(D)):D===96&&D===u?n(D):(e.consume(D),_)}function b(D){return D===null||Be(D)?g(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(D))}function w(D){return D===null||Be(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(D)):D===96&&D===u?n(D):(e.consume(D),w)}function S(D){return e.attempt(s,M,C)(D)}function C(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),k}function k(D){return a>0&&nt(D)?ct(e,T,"linePrefix",a+1)(D):T(D)}function T(D){return D===null||Be(D)?e.check($2,S,M)(D):(e.enter("codeFlowValue"),R(D))}function R(D){return D===null||Be(D)?(e.exit("codeFlowValue"),T(D)):(e.consume(D),R)}function M(D){return e.exit("codeFenced"),t(D)}function O(D,j,F){let G=0;return B;function B(W){return D.enter("lineEnding"),D.consume(W),D.exit("lineEnding"),H}function H(W){return D.enter("codeFencedFence"),nt(W)?ct(D,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):P(W)}function P(W){return W===u?(D.enter("codeFencedFenceSequence"),U(W)):F(W)}function U(W){return W===u?(G++,D.consume(W),U):G>=l?(D.exit("codeFencedFenceSequence"),nt(W)?ct(D,q,"whitespace")(W):q(W)):F(W)}function q(W){return W===null||Be(W)?(D.exit("codeFencedFence"),j(W)):F(W)}}}function eW(e,t,n){const r=this;return s;function s(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Bv={name:"codeIndented",tokenize:nW},tW={partial:!0,tokenize:rW};function nW(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),ct(e,a,"linePrefix",5)(d)}function a(d){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):n(d)}function l(d){return d===null?h(d):Be(d)?e.attempt(tW,l,h)(d):(e.enter("codeFlowValue"),u(d))}function u(d){return d===null||Be(d)?(e.exit("codeFlowValue"),l(d)):(e.consume(d),u)}function h(d){return e.exit("codeIndented"),t(d)}}function rW(e,t,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Be(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):ct(e,a,"linePrefix",5)(l)}function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):Be(l)?s(l):n(l)}}const iW={name:"codeText",previous:oW,resolve:sW,tokenize:aW};function sW(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function oW(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function aW(e,t,n){let r=0,s,a;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),r++,u):(e.exit("codeTextSequence"),h(g))}function h(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),h):g===96?(a=e.enter("codeTextSequence"),s=0,m(g)):Be(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),h):(e.enter("codeTextData"),d(g))}function d(g){return g===null||g===32||g===96||Be(g)?(e.exit("codeTextData"),h(g)):(e.consume(g),d)}function m(g){return g===96?(e.consume(g),s++,m):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(a.type="codeTextData",d(g))}}class lW{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Gc(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Gc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Gc(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);Gc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Gc(this.left,n.reverse())}}}function Gc(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 cA(e){const t={};let n=-1,r,s,a,l,u,h,d;const m=new lW(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(r=m.get(n),n&&r[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,a=0,a<h.length&&h[a][1].type==="lineEndingBlank"&&(a+=2),a<h.length&&h[a][1].type==="content"))for(;++a<h.length&&h[a][1].type!=="content";)h[a][1].type==="chunkText"&&(h[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,cW(m,n)),n=t[n],d=!0);else if(r[1]._container){for(a=n,s=void 0;a--;)if(l=m.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(m.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(r[1].end={...m.get(s)[1].start},u=m.slice(s,n),u.unshift(r),m.splice(s,n-s+1,u))}}return Dr(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!d}function cW(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,h=[],d={};let m,g,_=-1,b=n,w=0,S=0;const C=[S];for(;b;){for(;e.get(++s)[1]!==b;);a.push(s),b._tokenizer||(m=r.sliceStream(b),b.next||m.push(null),g&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++_<u.length;)u[_][0]==="exit"&&u[_-1][0]==="enter"&&u[_][1].type===u[_-1][1].type&&u[_][1].start.line!==u[_][1].end.line&&(S=_+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(),_=C.length;_--;){const k=u.slice(C[_],C[_+1]),T=a.pop();h.push([T,T+k.length-1]),e.splice(T,2,k)}for(h.reverse(),_=-1;++_<h.length;)d[w+h[_][0]]=w+h[_][1],w+=h[_][1]-h[_][0]-1;return d}const uW={resolve:hW,tokenize:fW},dW={partial:!0,tokenize:pW};function hW(e){return cA(e),e}function fW(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(u)}function s(u){return u===null?a(u):Be(u)?e.check(dW,l,a)(u):(e.consume(u),s)}function a(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function pW(e,t,n){const r=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ct(e,a,"linePrefix")}function a(l){if(l===null||Be(l))return n(l);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function uA(e,t,n,r,s,a,l,u,h){const d=h||Number.POSITIVE_INFINITY;let m=0;return g;function g(k){return k===60?(e.enter(r),e.enter(s),e.enter(a),e.consume(k),e.exit(a),_):k===null||k===32||k===41||Zf(k)?n(k):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),S(k))}function _(k){return k===62?(e.enter(a),e.consume(k),e.exit(a),e.exit(s),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(u),_(k)):k===null||k===60||Be(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!m&&(k===null||k===41||Dt(k))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(k)):m<d&&k===40?(e.consume(k),m++,S):k===41?(e.consume(k),m--,S):k===null||k===32||k===40||Zf(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 dA(e,t,n,r,s,a){const l=this;let u=0,h;return d;function d(b){return e.enter(r),e.enter(s),e.consume(b),e.exit(s),e.enter(a),m}function m(b){return u>999||b===null||b===91||b===93&&!h||b===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(b):b===93?(e.exit(a),e.enter(s),e.consume(b),e.exit(s),e.exit(r),t):Be(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||Be(b)||u++>999?(e.exit("chunkString"),m(b)):(e.consume(b),h||(h=!nt(b)),b===92?_:g)}function _(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function hA(e,t,n,r,s,a){let l;return u;function u(_){return _===34||_===39||_===40?(e.enter(r),e.enter(s),e.consume(_),e.exit(s),l=_===40?41:_,h):n(_)}function h(_){return _===l?(e.enter(s),e.consume(_),e.exit(s),e.exit(r),t):(e.enter(a),d(_))}function d(_){return _===l?(e.exit(a),h(l)):_===null?n(_):Be(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),ct(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===l||_===null||Be(_)?(e.exit("chunkString"),d(_)):(e.consume(_),_===92?g:m)}function g(_){return _===l||_===92?(e.consume(_),m):m(_)}}function ku(e,t){let n;return r;function r(s){return Be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):nt(s)?ct(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const mW={name:"definition",tokenize:vW},gW={partial:!0,tokenize:_W};function vW(e,t,n){const r=this;let s;return a;function a(b){return e.enter("definition"),l(b)}function l(b){return dA.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return s=ui(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 Dt(b)?ku(e,d)(b):d(b)}function d(b){return uA(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function m(b){return e.attempt(gW,g,g)(b)}function g(b){return nt(b)?ct(e,_,"whitespace")(b):_(b)}function _(b){return b===null||Be(b)?(e.exit("definition"),r.parser.defined.push(s),t(b)):n(b)}}function _W(e,t,n){return r;function r(u){return Dt(u)?ku(e,s)(u):n(u)}function s(u){return hA(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function a(u){return nt(u)?ct(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Be(u)?t(u):n(u)}}const yW={name:"hardBreakEscape",tokenize:bW};function bW(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return Be(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const xW={name:"headingAtx",resolve:wW,tokenize:SW};function wW(e,t){let n=e.length-2,r=3,s,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Dr(e,r,n-r+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function SW(e,t,n){let r=0;return s;function s(m){return e.enter("atxHeading"),a(m)}function a(m){return e.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(e.consume(m),l):m===null||Dt(m)?(e.exit("atxHeadingSequence"),u(m)):n(m)}function u(m){return m===35?(e.enter("atxHeadingSequence"),h(m)):m===null||Be(m)?(e.exit("atxHeading"),t(m)):nt(m)?ct(e,u,"whitespace")(m):(e.enter("atxHeadingText"),d(m))}function h(m){return m===35?(e.consume(m),h):(e.exit("atxHeadingSequence"),u(m))}function d(m){return m===null||m===35||Dt(m)?(e.exit("atxHeadingText"),u(m)):(e.consume(m),d)}}const CW=["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"],V2=["pre","script","style","textarea"],kW={concrete:!0,name:"htmlFlow",resolveTo:TW,tokenize:MW},EW={partial:!0,tokenize:AW},RW={partial:!0,tokenize:NW};function TW(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 MW(e,t,n){const r=this;let s,a,l,u,h;return d;function d(L){return m(L)}function m(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),g}function g(L){return L===33?(e.consume(L),_):L===47?(e.consume(L),a=!0,S):L===63?(e.consume(L),s=3,r.interrupt?t:N):rr(L)?(e.consume(L),l=String.fromCharCode(L),C):n(L)}function _(L){return L===45?(e.consume(L),s=2,b):L===91?(e.consume(L),s=5,u=0,w):rr(L)?(e.consume(L),s=4,r.interrupt?t:N):n(L)}function b(L){return L===45?(e.consume(L),r.interrupt?t:N):n(L)}function w(L){const de="CDATA[";return L===de.charCodeAt(u++)?(e.consume(L),u===de.length?r.interrupt?t:P:w):n(L)}function S(L){return rr(L)?(e.consume(L),l=String.fromCharCode(L),C):n(L)}function C(L){if(L===null||L===47||L===62||Dt(L)){const de=L===47,me=l.toLowerCase();return!de&&!a&&V2.includes(me)?(s=1,r.interrupt?t(L):P(L)):CW.includes(l.toLowerCase())?(s=6,de?(e.consume(L),k):r.interrupt?t(L):P(L)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):a?T(L):R(L))}return L===45||qn(L)?(e.consume(L),l+=String.fromCharCode(L),C):n(L)}function k(L){return L===62?(e.consume(L),r.interrupt?t:P):n(L)}function T(L){return nt(L)?(e.consume(L),T):B(L)}function R(L){return L===47?(e.consume(L),B):L===58||L===95||rr(L)?(e.consume(L),M):nt(L)?(e.consume(L),R):B(L)}function M(L){return L===45||L===46||L===58||L===95||qn(L)?(e.consume(L),M):O(L)}function O(L){return L===61?(e.consume(L),D):nt(L)?(e.consume(L),O):R(L)}function D(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),h=L,j):nt(L)?(e.consume(L),D):F(L)}function j(L){return L===h?(e.consume(L),h=null,G):L===null||Be(L)?n(L):(e.consume(L),j)}function F(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||Dt(L)?O(L):(e.consume(L),F)}function G(L){return L===47||L===62||nt(L)?R(L):n(L)}function B(L){return L===62?(e.consume(L),H):n(L)}function H(L){return L===null||Be(L)?P(L):nt(L)?(e.consume(L),H):n(L)}function P(L){return L===45&&s===2?(e.consume(L),z):L===60&&s===1?(e.consume(L),$):L===62&&s===4?(e.consume(L),I):L===63&&s===3?(e.consume(L),N):L===93&&s===5?(e.consume(L),Q):Be(L)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(EW,Z,U)(L)):L===null||Be(L)?(e.exit("htmlFlowData"),U(L)):(e.consume(L),P)}function U(L){return e.check(RW,q,Z)(L)}function q(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),W}function W(L){return L===null||Be(L)?U(L):(e.enter("htmlFlowData"),P(L))}function z(L){return L===45?(e.consume(L),N):P(L)}function $(L){return L===47?(e.consume(L),l="",V):P(L)}function V(L){if(L===62){const de=l.toLowerCase();return V2.includes(de)?(e.consume(L),I):P(L)}return rr(L)&&l.length<8?(e.consume(L),l+=String.fromCharCode(L),V):P(L)}function Q(L){return L===93?(e.consume(L),N):P(L)}function N(L){return L===62?(e.consume(L),I):L===45&&s===2?(e.consume(L),N):P(L)}function I(L){return L===null||Be(L)?(e.exit("htmlFlowData"),Z(L)):(e.consume(L),I)}function Z(L){return e.exit("htmlFlow"),t(L)}}function NW(e,t,n){const r=this;return s;function s(l){return Be(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function AW(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(ud,t,n)}}const DW={name:"htmlText",tokenize:OW};function OW(e,t,n){const r=this;let s,a,l;return u;function u(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),h}function h(N){return N===33?(e.consume(N),d):N===47?(e.consume(N),O):N===63?(e.consume(N),R):rr(N)?(e.consume(N),F):n(N)}function d(N){return N===45?(e.consume(N),m):N===91?(e.consume(N),a=0,w):rr(N)?(e.consume(N),T):n(N)}function m(N){return N===45?(e.consume(N),b):n(N)}function g(N){return N===null?n(N):N===45?(e.consume(N),_):Be(N)?(l=g,$(N)):(e.consume(N),g)}function _(N){return N===45?(e.consume(N),b):g(N)}function b(N){return N===62?z(N):N===45?_(N):g(N)}function w(N){const I="CDATA[";return N===I.charCodeAt(a++)?(e.consume(N),a===I.length?S:w):n(N)}function S(N){return N===null?n(N):N===93?(e.consume(N),C):Be(N)?(l=S,$(N)):(e.consume(N),S)}function C(N){return N===93?(e.consume(N),k):S(N)}function k(N){return N===62?z(N):N===93?(e.consume(N),k):S(N)}function T(N){return N===null||N===62?z(N):Be(N)?(l=T,$(N)):(e.consume(N),T)}function R(N){return N===null?n(N):N===63?(e.consume(N),M):Be(N)?(l=R,$(N)):(e.consume(N),R)}function M(N){return N===62?z(N):R(N)}function O(N){return rr(N)?(e.consume(N),D):n(N)}function D(N){return N===45||qn(N)?(e.consume(N),D):j(N)}function j(N){return Be(N)?(l=j,$(N)):nt(N)?(e.consume(N),j):z(N)}function F(N){return N===45||qn(N)?(e.consume(N),F):N===47||N===62||Dt(N)?G(N):n(N)}function G(N){return N===47?(e.consume(N),z):N===58||N===95||rr(N)?(e.consume(N),B):Be(N)?(l=G,$(N)):nt(N)?(e.consume(N),G):z(N)}function B(N){return N===45||N===46||N===58||N===95||qn(N)?(e.consume(N),B):H(N)}function H(N){return N===61?(e.consume(N),P):Be(N)?(l=H,$(N)):nt(N)?(e.consume(N),H):G(N)}function P(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),s=N,U):Be(N)?(l=P,$(N)):nt(N)?(e.consume(N),P):(e.consume(N),q)}function U(N){return N===s?(e.consume(N),s=void 0,W):N===null?n(N):Be(N)?(l=U,$(N)):(e.consume(N),U)}function q(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||Dt(N)?G(N):(e.consume(N),q)}function W(N){return N===47||N===62||Dt(N)?G(N):n(N)}function z(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function $(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),V}function V(N){return nt(N)?ct(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):Q(N)}function Q(N){return e.enter("htmlTextData"),l(N)}}const R0={name:"labelEnd",resolveAll:PW,resolveTo:BW,tokenize:IW},jW={tokenize:HW},LW={tokenize:FW},zW={tokenize:UW};function PW(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Dr(e,0,e.length,n),e}function BW(e,t){let n=e.length,r=0,s,a,l,u;for(;n--;)if(s=e[n][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(l=n);const h={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},m={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return u=[["enter",h,t],["enter",d,t]],u=Zr(u,e.slice(a+1,a+r+3)),u=Zr(u,[["enter",m,t]]),u=Zr(u,Bp(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),u=Zr(u,[["exit",m,t],e[l-2],e[l-1],["exit",d,t]]),u=Zr(u,e.slice(l+1)),u=Zr(u,[["exit",h,t]]),Dr(e,a,e.length,u),e}function IW(e,t,n){const r=this;let s=r.events.length,a,l;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){a=r.events[s][1];break}return u;function u(_){return a?a._inactive?g(_):(l=r.parser.defined.includes(ui(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(_),e.exit("labelMarker"),e.exit("labelEnd"),h):n(_)}function h(_){return _===40?e.attempt(jW,m,l?m:g)(_):_===91?e.attempt(LW,m,l?d:g)(_):l?m(_):g(_)}function d(_){return e.attempt(zW,m,g)(_)}function m(_){return t(_)}function g(_){return a._balanced=!0,n(_)}}function HW(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return Dt(g)?ku(e,a)(g):a(g)}function a(g){return g===41?m(g):uA(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return Dt(g)?ku(e,h)(g):m(g)}function u(g){return n(g)}function h(g){return g===34||g===39||g===40?hA(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function d(g){return Dt(g)?ku(e,m)(g):m(g)}function m(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function FW(e,t,n){const r=this;return s;function s(u){return dA.call(r,e,a,l,"reference","referenceMarker","referenceString")(u)}function a(u){return r.parser.defined.includes(ui(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function UW(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const $W={name:"labelStartImage",resolveAll:R0.resolveAll,tokenize:WW};function WW(e,t,n){const r=this;return s;function s(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),a}function a(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),l):n(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const VW={name:"labelStartLink",resolveAll:R0.resolveAll,tokenize:qW};function qW(e,t,n){const r=this;return s;function s(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Iv={name:"lineEnding",tokenize:KW};function KW(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ct(e,t,"linePrefix")}}const vf={name:"thematicBreak",tokenize:GW};function GW(e,t,n){let r=0,s;return a;function a(d){return e.enter("thematicBreak"),l(d)}function l(d){return s=d,u(d)}function u(d){return d===s?(e.enter("thematicBreakSequence"),h(d)):r>=3&&(d===null||Be(d))?(e.exit("thematicBreak"),t(d)):n(d)}function h(d){return d===s?(e.consume(d),r++,h):(e.exit("thematicBreakSequence"),nt(d)?ct(e,u,"whitespace")(d):u(d))}}const mr={continuation:{tokenize:QW},exit:eV,name:"list",tokenize:ZW},YW={partial:!0,tokenize:tV},XW={partial:!0,tokenize:JW};function ZW(e,t,n){const r=this,s=r.events[r.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return u;function u(b){const w=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:ey(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(vf,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 ey(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(ud,r.interrupt?n:m,e.attempt(YW,_,g))}function m(b){return r.containerState.initialBlankLine=!0,a++,_(b)}function g(b){return nt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),_):n(b)}function _(b){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function QW(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ud,s,a);function s(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ct(e,t,"listItemIndent",r.containerState.size+1)(u)}function a(u){return r.containerState.furtherBlankLines||!nt(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(XW,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,ct(e,e.attempt(mr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function JW(e,t,n){const r=this;return ct(e,s,"listItemIndent",r.containerState.size+1);function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function eV(e){e.exit(this.containerState.type)}function tV(e,t,n){const r=this;return ct(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const l=r.events[r.events.length-1];return!nt(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const q2={name:"setextUnderline",resolveTo:nV,tokenize:rV};function nV(e,t){let n=e.length,r,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function rV(e,t,n){const r=this;let s;return a;function a(d){let m=r.events.length,g;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){g=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),s=d,l(d)):n(d)}function l(d){return e.enter("setextHeadingLineSequence"),u(d)}function u(d){return d===s?(e.consume(d),u):(e.exit("setextHeadingLineSequence"),nt(d)?ct(e,h,"lineSuffix")(d):h(d))}function h(d){return d===null||Be(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const iV={tokenize:sV};function sV(e){const t=this,n=e.attempt(ud,r,e.attempt(this.parser.constructs.flowInitial,s,ct(e,e.attempt(this.parser.constructs.flow,s,e.attempt(uW,s)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const oV={resolveAll:pA()},aV=fA("string"),lV=fA("text");function fA(e){return{resolveAll:pA(e==="text"?cV:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],a=n.attempt(s,l,u);return l;function l(m){return d(m)?a(m):u(m)}function u(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),h}function h(m){return d(m)?(n.exit("data"),a(m)):(n.consume(m),h)}function d(m){if(m===null)return!0;const g=s[m];let _=-1;if(g)for(;++_<g.length;){const b=g[_];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function pA(e){return t;function t(n,r){let s=-1,a;for(;++s<=n.length;)a===void 0?n[s]&&n[s][1].type==="data"&&(a=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==a+2&&(n[a][1].end=n[s-1][1].end,n.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(n,r):n}}function cV(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let a=s.length,l=-1,u=0,h;for(;a--;){const d=s[a];if(typeof d=="string"){for(l=d.length;d.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(d===-2)h=!0,u++;else if(d!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const d={type:n===e.length||h||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const uV={42:mr,43:mr,45:mr,48:mr,49:mr,50:mr,51:mr,52:mr,53:mr,54:mr,55:mr,56:mr,57:mr,62:oA},dV={91:mW},hV={[-2]:Bv,[-1]:Bv,32:Bv},fV={35:xW,42:vf,45:[q2,vf],60:kW,61:q2,95:vf,96:W2,126:W2},pV={38:lA,92:aA},mV={[-5]:Iv,[-4]:Iv,[-3]:Iv,33:$W,38:lA,42:ty,60:[V$,DW],91:VW,92:[yW,aA],93:R0,95:ty,96:iW},gV={null:[ty,oV]},vV={null:[42,95]},_V={null:[]},yV=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vV,contentInitial:dV,disable:_V,document:uV,flow:fV,flowInitial:hV,insideSpan:gV,string:pV,text:mV},Symbol.toStringTag,{value:"Module"}));function bV(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},a=[];let l=[],u=[];const h={attempt:j(O),check:j(D),consume:T,enter:R,exit:M,interrupt:j(D,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:_,sliceStream:b,write:g};let m=t.tokenize.call(d,h);return t.resolveAll&&a.push(t),d;function g(H){return l=Zr(l,H),C(),l[l.length-1]!==null?[]:(F(t,0),d.events=Bp(a,d.events,d),d.events)}function _(H,P){return wV(b(H),P)}function b(H){return xV(l,H)}function w(){const{_bufferIndex:H,_index:P,line:U,column:q,offset:W}=r;return{_bufferIndex:H,_index:P,line:U,column:q,offset:W}}function S(H){s[H.line]=H.column,B()}function C(){let H;for(;r._index<l.length;){const P=l[r._index];if(typeof P=="string")for(H=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===H&&r._bufferIndex<P.length;)k(P.charCodeAt(r._bufferIndex));else k(P)}}function k(H){m=m(H)}function T(H){Be(H)?(r.line++,r.column=1,r.offset+=H===-3?2:1,B()):H!==-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=H}function R(H,P){const U=P||{};return U.type=H,U.start=w(),d.events.push(["enter",U,d]),u.push(U),U}function M(H){const P=u.pop();return P.end=w(),d.events.push(["exit",P,d]),P}function O(H,P){F(H,P.from)}function D(H,P){P.restore()}function j(H,P){return U;function U(q,W,z){let $,V,Q,N;return Array.isArray(q)?Z(q):"tokenize"in q?Z([q]):I(q);function I(ue){return he;function he(we){const le=we!==null&&ue[we],xe=we!==null&&ue.null,Ne=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(xe)?xe:xe?[xe]:[]];return Z(Ne)(we)}}function Z(ue){return $=ue,V=0,ue.length===0?z:L(ue[V])}function L(ue){return he;function he(we){return N=G(),Q=ue,ue.partial||(d.currentConstruct=ue),ue.name&&d.parser.constructs.disable.null.includes(ue.name)?me():ue.tokenize.call(P?Object.assign(Object.create(d),P):d,h,de,me)(we)}}function de(ue){return H(Q,N),W}function me(ue){return N.restore(),++V<$.length?L($[V]):z}}}function F(H,P){H.resolveAll&&!a.includes(H)&&a.push(H),H.resolve&&Dr(d.events,P,d.events.length-P,H.resolve(d.events.slice(P),d)),H.resolveTo&&(d.events=H.resolveTo(d.events,d))}function G(){const H=w(),P=d.previous,U=d.currentConstruct,q=d.events.length,W=Array.from(u);return{from:q,restore:z};function z(){r=H,d.previous=P,d.currentConstruct=U,d.events.length=q,u=W,B()}}function B(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function xV(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,a=t.end._bufferIndex;let l;if(n===s)l=[e[n].slice(r,a)];else{if(l=e.slice(n,s),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}a>0&&l.push(e[s].slice(0,a))}return l}function wV(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
528
+ `;break}case-3:{l=`\r
529
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&s)continue;l=" ";break}default:l=String.fromCharCode(a)}s=a===-2,r.push(l)}return r.join("")}function SV(e){const r={constructs:iA([yV,...(e||{}).extensions||[]]),content:s(B$),defined:[],document:s(H$),flow:s(iV),lazy:{},string:s(aV),text:s(lV)};return r;function s(a){return l;function l(u){return bV(r,a,u)}}}function CV(e){for(;!cA(e););return e}const K2=/[\0\t\n\r]/g;function kV(){let e=1,t="",n=!0,r;return s;function s(a,l,u){const h=[];let d,m,g,_,b;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),g=0,t="",n&&(a.charCodeAt(0)===65279&&g++,n=void 0);g<a.length;){if(K2.lastIndex=g,d=K2.exec(a),_=d&&d.index!==void 0?d.index:a.length,b=a.charCodeAt(_),!d){t=a.slice(g);break}if(b===10&&g===_&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),g<_&&(h.push(a.slice(g,_)),e+=_-g),b){case 0:{h.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,h.push(-2);e++<m;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}g=_+1}return u&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const EV=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function RV(e){return e.replace(EV,TV)}function TV(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),a=s===120||s===88;return sA(n.slice(a?2:1),a?16:10)}return E0(n)||e}const mA={}.hasOwnProperty;function MV(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),NV(n)(CV(SV(n).document().write(kV()(e,t,!0))))}function NV(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ut),autolinkProtocol:G,autolinkEmail:G,atxHeading:a($e),blockQuote:a(xe),characterEscape:G,characterReference:G,codeFenced:a(Ne),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Ne,l),codeText:a(ae,l),codeTextData:G,data:G,codeFlowValue:G,definition:a(pe),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(Re),hardBreakEscape:a(at),hardBreakTrailing:a(at),htmlFlow:a(Lt,l),htmlFlowData:G,htmlText:a(Lt,l),htmlTextData:G,image:a(zt),label:l,link:a(ut),listItem:a(un),listItemValue:_,listOrdered:a(yt,g),listUnordered:a(yt),paragraph:a(en),reference:L,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a($e),strong:a(bn),thematicBreak:a(Yn)},exit:{atxHeading:h(),atxHeadingSequence:O,autolink:h(),autolinkEmail:le,autolinkProtocol:we,blockQuote:h(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:ue,characterReference:he,codeFenced:h(C),codeFencedFence:S,codeFencedFenceInfo:b,codeFencedFenceMeta:w,codeFlowValue:B,codeIndented:h(k),codeText:h(W),codeTextData:B,data:B,definition:h(),definitionDestinationString:M,definitionLabelString:T,definitionTitleString:R,emphasis:h(),hardBreakEscape:h(P),hardBreakTrailing:h(P),htmlFlow:h(U),htmlFlowData:B,htmlText:h(q),htmlTextData:B,image:h($),label:Q,labelText:V,lineEnding:H,link:h(z),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:de,resourceDestinationString:N,resourceTitleString:I,resource:Z,setextHeading:h(F),setextHeadingLineSequence:j,setextHeadingText:D,strong:h(),thematicBreak:h()}};gA(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let oe={type:"root",children:[]};const Ee={stack:[oe],tokenStack:[],config:t,enter:u,exit:d,buffer:l,resume:m,data:n},ze=[];let Fe=-1;for(;++Fe<Y.length;)if(Y[Fe][1].type==="listOrdered"||Y[Fe][1].type==="listUnordered")if(Y[Fe][0]==="enter")ze.push(Fe);else{const dt=ze.pop();Fe=s(Y,dt,Fe)}for(Fe=-1;++Fe<Y.length;){const dt=t[Y[Fe][0]];mA.call(dt,Y[Fe][1].type)&&dt[Y[Fe][1].type].call(Object.assign({sliceSerialize:Y[Fe][2].sliceSerialize},Ee),Y[Fe][1])}if(Ee.tokenStack.length>0){const dt=Ee.tokenStack[Ee.tokenStack.length-1];(dt[1]||G2).call(Ee,void 0,dt[0])}for(oe.position={start:Ys(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:Ys(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)oe=t.transforms[Fe](oe)||oe;return oe}function s(Y,oe,Ee){let ze=oe-1,Fe=-1,dt=!1,ee,Ge,pt,ie;for(;++ze<=Ee;){const Te=Y[ze];switch(Te[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Te[0]==="enter"?Fe++:Fe--,ie=void 0;break}case"lineEndingBlank":{Te[0]==="enter"&&(ee&&!ie&&!Fe&&!pt&&(pt=ze),ie=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ie=void 0}if(!Fe&&Te[0]==="enter"&&Te[1].type==="listItemPrefix"||Fe===-1&&Te[0]==="exit"&&(Te[1].type==="listUnordered"||Te[1].type==="listOrdered")){if(ee){let lt=ze;for(Ge=void 0;lt--;){const bt=Y[lt];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;Ge&&(Y[Ge][1].type="lineEndingBlank",dt=!0),bt[1].type="lineEnding",Ge=lt}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}pt&&(!Ge||pt<Ge)&&(ee._spread=!0),ee.end=Object.assign({},Ge?Y[Ge][1].start:Te[1].end),Y.splice(Ge||ze,0,["exit",ee,Te[2]]),ze++,Ee++}if(Te[1].type==="listItemPrefix"){const lt={type:"listItem",_spread:!1,start:Object.assign({},Te[1].start),end:void 0};ee=lt,Y.splice(ze,0,["enter",lt,Te[2]]),ze++,Ee++,pt=void 0,ie=!0}}}return Y[oe][1]._spread=dt,Ee}function a(Y,oe){return Ee;function Ee(ze){u.call(this,Y(ze),ze),oe&&oe.call(this,ze)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(Y,oe,Ee){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([oe,Ee||void 0]),Y.position={start:Ys(oe.start),end:void 0}}function h(Y){return oe;function oe(Ee){Y&&Y.call(this,Ee),d.call(this,Ee)}}function d(Y,oe){const Ee=this.stack.pop(),ze=this.tokenStack.pop();if(ze)ze[0].type!==Y.type&&(oe?oe.call(this,Y,ze[0]):(ze[1]||G2).call(this,Y,ze[0]));else throw new Error("Cannot close `"+Y.type+"` ("+Cu({start:Y.start,end:Y.end})+"): it’s not open");Ee.position.end=Ys(Y.end)}function m(){return k0(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function _(Y){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function b(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Y}function w(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Y}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y.replace(/(\r?\n|\r)$/g,"")}function T(Y){const oe=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=oe,Ee.identifier=ui(this.sliceSerialize(Y)).toLowerCase()}function R(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Y}function M(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Y}function O(Y){const oe=this.stack[this.stack.length-1];if(!oe.depth){const Ee=this.sliceSerialize(Y).length;oe.depth=Ee}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function j(Y){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function G(Y){const Ee=this.stack[this.stack.length-1].children;let ze=Ee[Ee.length-1];(!ze||ze.type!=="text")&&(ze=Nt(),ze.position={start:Ys(Y.start),end:void 0},Ee.push(ze)),this.stack.push(ze)}function B(Y){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Y),oe.position.end=Ys(Y.end)}function H(Y){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ee=oe.children[oe.children.length-1];Ee.position.end=Ys(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(G.call(this,Y),B.call(this,Y))}function P(){this.data.atHardBreak=!0}function U(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function q(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function W(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function z(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=oe,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function $(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=oe,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function V(Y){const oe=this.sliceSerialize(Y),Ee=this.stack[this.stack.length-2];Ee.label=RV(oe),Ee.identifier=ui(oe).toLowerCase()}function Q(){const Y=this.stack[this.stack.length-1],oe=this.resume(),Ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ee.type==="link"){const ze=Y.children;Ee.children=ze}else Ee.alt=oe}function N(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Y}function I(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Y}function Z(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function de(Y){const oe=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=oe,Ee.identifier=ui(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function me(Y){this.data.characterReferenceType=Y.type}function ue(Y){const oe=this.sliceSerialize(Y),Ee=this.data.characterReferenceType;let ze;Ee?(ze=sA(oe,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=E0(oe);const Fe=this.stack[this.stack.length-1];Fe.value+=ze}function he(Y){const oe=this.stack.pop();oe.position.end=Ys(Y.end)}function we(Y){B.call(this,Y);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Y)}function le(Y){B.call(this,Y);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Y)}function xe(){return{type:"blockquote",children:[]}}function Ne(){return{type:"code",lang:null,meta:null,value:""}}function ae(){return{type:"inlineCode",value:""}}function pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Re(){return{type:"emphasis",children:[]}}function $e(){return{type:"heading",depth:0,children:[]}}function at(){return{type:"break"}}function Lt(){return{type:"html",value:""}}function zt(){return{type:"image",title:null,url:"",alt:null}}function ut(){return{type:"link",title:null,url:"",children:[]}}function yt(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function un(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function en(){return{type:"paragraph",children:[]}}function bn(){return{type:"strong",children:[]}}function Nt(){return{type:"text",value:""}}function Yn(){return{type:"thematicBreak"}}}function Ys(e){return{line:e.line,column:e.column,offset:e.offset}}function gA(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?gA(e,r):AV(e,r)}}function AV(e,t){let n;for(n in t)if(mA.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 G2(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Cu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Cu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Cu({start:t.start,end:t.end})+") is still open")}function DV(e){const t=this;t.parser=n;function n(r){return MV(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function OV(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 jV(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
530
+ `}]}function LV(e,t){const n=t.value?t.value+`
531
+ `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function zV(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PV(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BV(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=ql(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let l,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=a+1,u+=1,e.footnoteCounts.set(r,u);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,h);const d={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,d),e.applyData(t,d)}function IV(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 HV(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function vA(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function FV(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vA(e,t);const s={src:ql(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,a),e.applyData(t,a)}function UV(e,t){const n={src:ql(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 $V(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 WV(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vA(e,t);const s={href:ql(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function VV(e,t){const n={href:ql(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 qV(e,t,n){const r=e.all(t),s=n?KV(n):_A(t),a={},l=[];if(typeof t.checked=="boolean"){const m=r[0];let g;m&&m.type==="element"&&m.tagName==="p"?g=m:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const m=r[u];(s||u!==0||m.type!=="element"||m.tagName!=="p")&&l.push({type:"text",value:`
532
+ `}),m.type==="element"&&m.tagName==="p"&&!s?l.push(...m.children):l.push(m)}const h=r[r.length-1];h&&(s||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
533
+ `});const d={type:"element",tagName:"li",properties:a,children:l};return e.patch(t,d),e.applyData(t,d)}function KV(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=_A(n[r])}return t}function _A(e){const t=e.spread;return t??e.children.length>1}function GV(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const l=r[s];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function YV(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XV(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ZV(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QV(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),s.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=x0(t.children[1]),h=ZN(t.children[t.children.length-1]);u&&h&&(l.position={start:u,end:h}),s.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,a),e.applyData(t,a)}function JV(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let h=-1;const d=[];for(;++h<u;){const g=t.children[h],_={},b=l?l[h]:void 0;b&&(_.align=b);let w={type:"element",tagName:a,properties:_,children:[]};g&&(w.children=e.all(g),e.patch(g,w),w=e.applyData(g,w)),d.push(w)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,m),e.applyData(t,m)}function eq(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Y2=9,X2=32;function tq(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const a=[];for(;r;)a.push(Z2(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return a.push(Z2(t.slice(s),s>0,!1)),a.join("")}function Z2(e,t,n){let r=0,s=e.length;if(t){let a=e.codePointAt(r);for(;a===Y2||a===X2;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(s-1);for(;a===Y2||a===X2;)s--,a=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function nq(e,t){const n={type:"text",value:tq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function rq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const iq={blockquote:OV,break:jV,code:LV,delete:zV,emphasis:PV,footnoteReference:BV,heading:IV,html:HV,imageReference:FV,image:UV,inlineCode:$V,linkReference:WV,link:VV,listItem:qV,list:GV,paragraph:YV,root:XV,strong:ZV,table:QV,tableCell:eq,tableRow:JV,text:nq,thematicBreak:rq,toml:Wh,yaml:Wh,definition:Wh,footnoteDefinition:Wh};function Wh(){}const yA=-1,Ip=0,Eu=1,Qf=2,T0=3,M0=4,N0=5,A0=6,bA=7,xA=8,Q2=typeof self=="object"?self:globalThis,sq=(e,t)=>{const n=(s,a)=>(e.set(a,s),s),r=s=>{if(e.has(s))return e.get(s);const[a,l]=t[s];switch(a){case Ip:case yA:return n(l,s);case Eu:{const u=n([],s);for(const h of l)u.push(r(h));return u}case Qf:{const u=n({},s);for(const[h,d]of l)u[r(h)]=r(d);return u}case T0:return n(new Date(l),s);case M0:{const{source:u,flags:h}=l;return n(new RegExp(u,h),s)}case N0:{const u=n(new Map,s);for(const[h,d]of l)u.set(r(h),r(d));return u}case A0:{const u=n(new Set,s);for(const h of l)u.add(r(h));return u}case bA:{const{name:u,message:h}=l;return n(new Q2[u](h),s)}case xA:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}}return n(new Q2[a](l),s)};return r},J2=e=>sq(new Map,e)(0),al="",{toString:oq}={},{keys:aq}=Object,Yc=e=>{const t=typeof e;if(t!=="object"||!e)return[Ip,t];const n=oq.call(e).slice(8,-1);switch(n){case"Array":return[Eu,al];case"Object":return[Qf,al];case"Date":return[T0,al];case"RegExp":return[M0,al];case"Map":return[N0,al];case"Set":return[A0,al];case"DataView":return[Eu,n]}return n.includes("Array")?[Eu,n]:n.includes("Error")?[bA,n]:[Qf,n]},Vh=([e,t])=>e===Ip&&(t==="function"||t==="symbol"),lq=(e,t,n,r)=>{const s=(l,u)=>{const h=r.push(l)-1;return n.set(u,h),h},a=l=>{if(n.has(l))return n.get(l);let[u,h]=Yc(l);switch(u){case Ip:{let m=l;switch(h){case"bigint":u=xA,m=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);m=null;break;case"undefined":return s([yA],l)}return s([u,m],l)}case Eu:{if(h){let _=l;return h==="DataView"?_=new Uint8Array(l.buffer):h==="ArrayBuffer"&&(_=new Uint8Array(l)),s([h,[..._]],l)}const m=[],g=s([u,m],l);for(const _ of l)m.push(a(_));return g}case Qf:{if(h)switch(h){case"BigInt":return s([h,l.toString()],l);case"Boolean":case"Number":case"String":return s([h,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const m=[],g=s([u,m],l);for(const _ of aq(l))(e||!Vh(Yc(l[_])))&&m.push([a(_),a(l[_])]);return g}case T0:return s([u,l.toISOString()],l);case M0:{const{source:m,flags:g}=l;return s([u,{source:m,flags:g}],l)}case N0:{const m=[],g=s([u,m],l);for(const[_,b]of l)(e||!(Vh(Yc(_))||Vh(Yc(b))))&&m.push([a(_),a(b)]);return g}case A0:{const m=[],g=s([u,m],l);for(const _ of l)(e||!Vh(Yc(_)))&&m.push(a(_));return g}}const{message:d}=l;return s([u,{name:h,message:d}],l)};return a},ek=(e,{json:t,lossy:n}={})=>{const r=[];return lq(!(t||n),!!t,new Map,r)(e),r},Jf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?J2(ek(e,t)):structuredClone(e):(e,t)=>J2(ek(e,t));function cq(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 uq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function dq(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||cq,r=e.options.footnoteBackLabel||uq,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let h=-1;for(;++h<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[h]);if(!d)continue;const m=e.all(d),g=String(d.identifier).toUpperCase(),_=ql(g.toLowerCase());let b=0;const w=[],S=e.footnoteCounts.get(g);for(;S!==void 0&&++b<=S;){w.length>0&&w.push({type:"text",value:" "});let T=typeof n=="string"?n:n(h,b);typeof T=="string"&&(T={type:"text",value:T}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,b),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const C=m[m.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const T=C.children[C.children.length-1];T&&T.type==="text"?T.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else m.push(...w);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(m,!0)};e.patch(d,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Jf(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
534
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
535
+ `}]}}const Hp=(function(e){if(e==null)return mq;if(typeof e=="function")return Fp(e);if(typeof e=="object")return Array.isArray(e)?hq(e):fq(e);if(typeof e=="string")return pq(e);throw new Error("Expected function, string, or object as test")});function hq(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Hp(e[n]);return Fp(r);function r(...s){let a=-1;for(;++a<t.length;)if(t[a].apply(this,s))return!0;return!1}}function fq(e){const t=e;return Fp(n);function n(r){const s=r;let a;for(a in e)if(s[a]!==t[a])return!1;return!0}}function pq(e){return Fp(t);function t(n){return n&&n.type===e}}function Fp(e){return t;function t(n,r,s){return!!(gq(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function mq(){return!0}function gq(e){return e!==null&&typeof e=="object"&&"type"in e}const wA=[],vq=!0,ny=!1,_q="skip";function SA(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const a=Hp(s),l=r?-1:1;u(e,void 0,[])();function u(h,d,m){const g=h&&typeof h=="object"?h:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(_,"name",{value:"node ("+(h.type+(b?"<"+b+">":""))+")"})}return _;function _(){let b=wA,w,S,C;if((!t||a(h,d,m[m.length-1]||void 0))&&(b=yq(n(h,m)),b[0]===ny))return b;if("children"in h&&h.children){const k=h;if(k.children&&b[0]!==_q)for(S=(r?k.children.length:-1)+l,C=m.concat(k);S>-1&&S<k.children.length;){const T=k.children[S];if(w=u(T,S,C)(),w[0]===ny)return w;S=typeof w[1]=="number"?w[1]:S+l}}return b}}}function yq(e){return Array.isArray(e)?e:typeof e=="number"?[vq,e]:e==null?wA:[e]}function D0(e,t,n,r){let s,a,l;typeof t=="function"&&typeof n!="function"?(a=void 0,l=t,s=n):(a=t,l=n,s=r),SA(e,a,u,s);function u(h,d){const m=d[d.length-1],g=m?m.children.indexOf(h):void 0;return l(h,g,m)}}const ry={}.hasOwnProperty,bq={};function xq(e,t){const n=t||bq,r=new Map,s=new Map,a=new Map,l={...iq,...n.handlers},u={all:d,applyData:Sq,definitionById:r,footnoteById:s,footnoteCounts:a,footnoteOrder:[],handlers:l,one:h,options:n,patch:wq,wrap:kq};return D0(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const g=m.type==="definition"?r:s,_=String(m.identifier).toUpperCase();g.has(_)||g.set(_,m)}}),u;function h(m,g){const _=m.type,b=u.handlers[_];if(ry.call(u.handlers,_)&&b)return b(u,m,g);if(u.options.passThrough&&u.options.passThrough.includes(_)){if("children"in m){const{children:S,...C}=m,k=Jf(C);return k.children=u.all(m),k}return Jf(m)}return(u.options.unknownHandler||Cq)(u,m,g)}function d(m){const g=[];if("children"in m){const _=m.children;let b=-1;for(;++b<_.length;){const w=u.one(_[b],m);if(w){if(b&&_[b-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=tk(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=tk(S.value))}Array.isArray(w)?g.push(...w):g.push(w)}}}return g}}function wq(e,t){e.position&&(t.position=u$(e))}function Sq(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,Jf(a)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Cq(e,t){const n=t.data||{},r="value"in t&&!(ry.call(n,"hProperties")||ry.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 kq(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
536
+ `});++r<e.length;)r&&n.push({type:"text",value:`
537
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
538
+ `}),n}function tk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function nk(e,t){const n=xq(e,t),r=n.one(e,void 0),s=dq(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
539
+ `},s),a}function Eq(e,t){return e&&"run"in e?async function(n,r){const s=nk(n,{file:r,...t});await e.run(s,r)}:function(n,r){return nk(n,{file:r,...e||t})}}function rk(e){if(e)throw e}var Hv,ik;function Rq(){if(ik)return Hv;ik=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},a=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var m=e.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!m&&!g)return!1;var _;for(_ in d);return typeof _>"u"||e.call(d,_)},l=function(d,m){n&&m.name==="__proto__"?n(d,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):d[m.name]=m.newValue},u=function(d,m){if(m==="__proto__")if(e.call(d,m)){if(r)return r(d,m).value}else return;return d[m]};return Hv=function h(){var d,m,g,_,b,w,S=arguments[0],C=1,k=arguments.length,T=!1;for(typeof S=="boolean"&&(T=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(m in d)g=u(S,m),_=u(d,m),S!==_&&(T&&_&&(a(_)||(b=s(_)))?(b?(b=!1,w=g&&s(g)?g:[]):w=g&&a(g)?g:{},l(S,{name:m,newValue:h(T,w,_)})):typeof _<"u"&&l(S,{name:m,newValue:_}));return S},Hv}var Tq=Rq();const Fv=hp(Tq);function iy(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 Mq(){const e=[],t={run:n,use:r};return t;function n(...s){let a=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...s);function u(h,...d){const m=e[++a];let g=-1;if(h){l(h);return}for(;++g<s.length;)(d[g]===null||d[g]===void 0)&&(d[g]=s[g]);s=d,m?Nq(m,u)(...d):l(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function Nq(e,t){let n;return r;function r(...l){const u=e.length>l.length;let h;u&&l.push(s);try{h=e.apply(this,l)}catch(d){const m=d;if(u&&n)throw m;return s(m)}u||(h&&h.then&&typeof h.then=="function"?h.then(a,s):h instanceof Error?s(h):a(h))}function s(l,...u){n||(n=!0,t(l,...u))}function a(l){s(null,l)}}const Ei={basename:Aq,dirname:Dq,extname:Oq,join:jq,sep:"/"};function Aq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');dd(e);let n=0,r=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else r<0&&(a=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else l<0&&(a=!0,l=s+1),u>-1&&(e.codePointAt(s)===t.codePointAt(u--)?u<0&&(r=s):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function Dq(e){if(dd(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 Oq(e){dd(e);let t=e.length,n=-1,r=0,s=-1,a=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function jq(...e){let t=-1,n;for(;++t<e.length;)dd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Lq(n)}function Lq(e){dd(e);const t=e.codePointAt(0)===47;let n=zq(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function zq(e,t){let n="",r=0,s=-1,a=0,l=-1,u,h;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(s===l-1||a===1))if(s!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",r=0):(n=n.slice(0,h),r=n.length-1-n.lastIndexOf("/")),s=l,a=0;continue}}else if(n.length>0){n="",r=0,s=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),r=l-s-1;s=l,a=0}else u===46&&a>-1?a++:a=-1}return n}function dd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Pq={cwd:Bq};function Bq(){return"/"}function sy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Iq(e){if(typeof e=="string")e=new URL(e);else if(!sy(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 Hq(e)}function Hq(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Uv=["history","path","basename","stem","extname","dirname"];class CA{constructor(t){let n;t?sy(t)?n={path:t}:typeof t=="string"||Fq(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Pq.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Uv.length;){const a=Uv[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let s;for(s in n)Uv.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ei.basename(this.path):void 0}set basename(t){Wv(t,"basename"),$v(t,"basename"),this.path=Ei.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ei.dirname(this.path):void 0}set dirname(t){sk(this.basename,"dirname"),this.path=Ei.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ei.extname(this.path):void 0}set extname(t){if($v(t,"extname"),sk(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=Ei.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){sy(t)&&(t=Iq(t)),Wv(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ei.basename(this.path,this.extname):void 0}set stem(t){Wv(t,"stem"),$v(t,"stem"),this.path=Ei.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Gn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function $v(e,t){if(e&&e.includes(Ei.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ei.sep+"`")}function Wv(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function sk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Fq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Uq=(function(e){const r=this.constructor.prototype,s=r[e],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),$q={}.hasOwnProperty;class O0 extends Uq{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=Mq()}copy(){const t=new O0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Fv(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Kv("data",this.frozen),this.namespace[t]=n,this):$q.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Kv("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=qh(t),r=this.parser||this.Parser;return Vv("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Vv("process",this.parser||this.Parser),qv("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(a,l){const u=qh(t),h=r.parse(u);r.run(h,u,function(m,g,_){if(m||!g||!_)return d(m);const b=g,w=r.stringify(b,_);qq(w)?_.value=w:_.result=w,d(m,_)});function d(m,g){m||!g?l(m):a?a(g):n(void 0,g)}}}processSync(t){let n=!1,r;return this.freeze(),Vv("processSync",this.parser||this.Parser),qv("processSync",this.compiler||this.Compiler),this.process(t,s),ak("processSync","process",n),r;function s(a,l){n=!0,rk(a),r=l}}run(t,n,r){ok(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,u){const h=qh(n);s.run(t,h,d);function d(m,g,_){const b=g||t;m?u(m):l?l(b):r(void 0,b,_)}}}runSync(t,n){let r=!1,s;return this.run(t,n,a),ak("runSync","run",r),s;function a(l,u){rk(l),s=u,r=!0}}stringify(t,n){this.freeze();const r=qh(n),s=this.compiler||this.Compiler;return qv("stringify",s),ok(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Kv("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(d){if(typeof d=="function")h(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[m,...g]=d;h(m,g)}else l(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function l(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(d.plugins),d.settings&&(s.settings=Fv(!0,s.settings,d.settings))}function u(d){let m=-1;if(d!=null)if(Array.isArray(d))for(;++m<d.length;){const g=d[m];a(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function h(d,m){let g=-1,_=-1;for(;++g<r.length;)if(r[g][0]===d){_=g;break}if(_===-1)r.push([d,...m]);else if(m.length>0){let[b,...w]=m;const S=r[_][1];iy(S)&&iy(b)&&(b=Fv(!0,S,b)),r[_]=[d,b,...w]}}}}const Wq=new O0().freeze();function Vv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function qv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Kv(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 ok(e){if(!iy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ak(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qh(e){return Vq(e)?e:new CA(e)}function Vq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function qq(e){return typeof e=="string"||Kq(e)}function Kq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Gq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",lk=[],ck={allowDangerousHtml:!0},Yq=/^(https?|ircs?|mailto|xmpp)$/i,Xq=[{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 Kl(e){const t=Zq(e),n=Qq(e);return Jq(t.runSync(t.parse(n),n),e)}function Zq(e){const t=e.rehypePlugins||lk,n=e.remarkPlugins||lk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ck}:ck;return Wq().use(DV).use(n).use(Eq,r).use(t)}function Qq(e){const t=e.children||"",n=new CA;return typeof t=="string"&&(n.value=t),n}function Jq(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,a=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,h=t.urlTransform||eK;for(const m of Xq)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Gq+m.id,void 0);return D0(e,d),m$(e,{Fragment:p.Fragment,components:s,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function d(m,g,_){if(m.type==="raw"&&_&&typeof g=="number")return l?_.children.splice(g,1):_.children[g]={type:"text",value:m.value},g;if(m.type==="element"){let b;for(b in Pv)if(Object.hasOwn(Pv,b)&&Object.hasOwn(m.properties,b)){const w=m.properties[b],S=Pv[b];(S===null||S.includes(m.tagName))&&(m.properties[b]=h(String(w||""),b,m))}}if(m.type==="element"){let b=n?!n.includes(m.tagName):a?a.includes(m.tagName):!1;if(!b&&r&&typeof g=="number"&&(b=!r(m,g,_)),b&&_&&typeof g=="number")return u&&m.children?_.children.splice(g,1,...m.children):_.children.splice(g,1),g}}}function eK(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||Yq.test(e.slice(0,t))?e:""}function uk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function tK(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nK(e,t,n){const s=Hp((n||{}).ignore||[]),a=rK(t);let l=-1;for(;++l<a.length;)SA(e,"text",u);function u(d,m){let g=-1,_;for(;++g<m.length;){const b=m[g],w=_?_.children:void 0;if(s(b,w?w.indexOf(b):void 0,_))return;_=b}if(_)return h(d,m)}function h(d,m){const g=m[m.length-1],_=a[l][0],b=a[l][1];let w=0;const C=g.children.indexOf(d);let k=!1,T=[];_.lastIndex=0;let R=_.exec(d.value);for(;R;){const M=R.index,O={index:R.index,input:R.input,stack:[...m,d]};let D=b(...R,O);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?_.lastIndex=M+1:(w!==M&&T.push({type:"text",value:d.value.slice(w,M)}),Array.isArray(D)?T.push(...D):D&&T.push(D),w=M+R[0].length,k=!0),!_.global)break;R=_.exec(d.value)}return k?(w<d.value.length&&T.push({type:"text",value:d.value.slice(w)}),g.children.splice(C,1,...T)):T=[d],C+T.length}}function rK(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([iK(s[0]),sK(s[1])])}return t}function iK(e){return typeof e=="string"?new RegExp(tK(e),"g"):e}function sK(e){return typeof e=="function"?e:function(){return e}}const Gv="phrasing",Yv=["autolink","link","image","label"];function oK(){return{transforms:[fK],enter:{literalAutolink:lK,literalAutolinkEmail:Xv,literalAutolinkHttp:Xv,literalAutolinkWww:Xv},exit:{literalAutolink:hK,literalAutolinkEmail:dK,literalAutolinkHttp:cK,literalAutolinkWww:uK}}}function aK(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gv,notInConstruct:Yv},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gv,notInConstruct:Yv},{character:":",before:"[ps]",after:"\\/",inConstruct:Gv,notInConstruct:Yv}]}}function lK(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Xv(e){this.config.enter.autolinkProtocol.call(this,e)}function cK(e){this.config.exit.autolinkProtocol.call(this,e)}function uK(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 dK(e){this.config.exit.autolinkEmail.call(this,e)}function hK(e){this.exit(e)}function fK(e){nK(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pK],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),mK]],{ignore:["link","linkReference"]})}function pK(e,t,n,r,s){let a="";if(!kA(s)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!gK(n)))return!1;const l=vK(n+r);if(!l[0])return!1;const u={type:"link",title:null,url:a+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function mK(e,t,n,r){return!kA(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function gK(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 vK(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=uk(e,"(");let a=uk(e,")");for(;r!==-1&&s>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function kA(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ta(n)||Pp(n))&&(!t||n!==47)}EA.peek=EK;function _K(){this.buffer()}function yK(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bK(){this.buffer()}function xK(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function wK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ui(this.sliceSerialize(e)).toLowerCase(),n.label=t}function SK(e){this.exit(e)}function CK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ui(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kK(e){this.exit(e)}function EK(){return"["}function EA(e,t,n,r){const s=n.createTracker(r);let a=s.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return a+=s.move(n.safe(n.associationId(e),{after:"]",before:a})),u(),l(),a+=s.move("]"),a}function RK(){return{enter:{gfmFootnoteCallString:_K,gfmFootnoteCall:yK,gfmFootnoteDefinitionLabelString:bK,gfmFootnoteDefinition:xK},exit:{gfmFootnoteCallString:wK,gfmFootnoteCall:SK,gfmFootnoteDefinitionLabelString:CK,gfmFootnoteDefinition:kK}}}function TK(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:EA},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,a,l){const u=a.createTracker(l);let h=u.move("[^");const d=a.enter("footnoteDefinition"),m=a.enter("label");return h+=u.move(a.safe(a.associationId(r),{before:h,after:"]"})),m(),h+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),h+=u.move((t?`
540
+ `:" ")+a.indentLines(a.containerFlow(r,u.current()),t?RA:MK))),d(),h}}function MK(e,t,n){return t===0?e:RA(e,t,n)}function RA(e,t,n){return(n?"":" ")+e}const NK=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];TA.peek=LK;function AK(){return{canContainEols:["delete"],enter:{strikethrough:OK},exit:{strikethrough:jK}}}function DK(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:NK}],handlers:{delete:TA}}}function OK(e){this.enter({type:"delete",children:[]},e)}function jK(e){this.exit(e)}function TA(e,t,n,r){const s=n.createTracker(r),a=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(e,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),a(),l}function LK(){return"~"}function zK(e){return e.length}function PK(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||zK,a=[],l=[],u=[],h=[];let d=0,m=-1;for(;++m<e.length;){const S=[],C=[];let k=-1;for(e[m].length>d&&(d=e[m].length);++k<e[m].length;){const T=BK(e[m][k]);if(n.alignDelimiters!==!1){const R=s(T);C[k]=R,(h[k]===void 0||R>h[k])&&(h[k]=R)}S.push(T)}l[m]=S,u[m]=C}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<d;)a[g]=dk(r[g]);else{const S=dk(r);for(;++g<d;)a[g]=S}g=-1;const _=[],b=[];for(;++g<d;){const S=a[g];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let T=n.alignDelimiters===!1?1:Math.max(1,h[g]-C.length-k.length);const R=C+"-".repeat(T)+k;n.alignDelimiters!==!1&&(T=C.length+T+k.length,T>h[g]&&(h[g]=T),b[g]=T),_[g]=R}l.splice(1,0,_),u.splice(1,0,b),m=-1;const w=[];for(;++m<l.length;){const S=l[m],C=u[m];g=-1;const k=[];for(;++g<d;){const T=S[g]||"";let R="",M="";if(n.alignDelimiters!==!1){const O=h[g]-(C[g]||0),D=a[g];D===114?R=" ".repeat(O):D===99?O%2?(R=" ".repeat(O/2+.5),M=" ".repeat(O/2-.5)):(R=" ".repeat(O/2),M=R):M=" ".repeat(O)}n.delimiterStart!==!1&&!g&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||g)&&k.push(" "),n.alignDelimiters!==!1&&k.push(R),k.push(T),n.alignDelimiters!==!1&&k.push(M),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||g!==d-1)&&k.push("|")}w.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
541
+ `)}function BK(e){return e==null?"":String(e)}function dk(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 IK(e,t,n,r){const s=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const l=n.indentLines(n.containerFlow(e,a.current()),HK);return s(),l}function HK(e,t,n){return">"+(n?"":" ")+e}function FK(e,t){return hk(e,t.inConstruct,!0)&&!hk(e,t.notInConstruct,!1)}function hk(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 fk(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
542
+ `&&FK(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
543
+ `}function UK(e,t){const n=String(e);let r=n.indexOf(t),s=r,a=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++a>l&&(l=a):a=1,s=r+t.length,r=n.indexOf(t,s);return l}function $K(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 WK(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 VK(e,t,n,r){const s=WK(n),a=e.value||"",l=s==="`"?"GraveAccent":"Tilde";if($K(e,n)){const g=n.enter("codeIndented"),_=n.indentLines(a,qK);return g(),_}const u=n.createTracker(r),h=s.repeat(Math.max(UK(a,s)+1,3)),d=n.enter("codeFenced");let m=u.move(h);if(e.lang){const g=n.enter(`codeFencedLang${l}`);m+=u.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...u.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${l}`);m+=u.move(" "),m+=u.move(n.safe(e.meta,{before:m,after:`
544
+ `,encode:["`"],...u.current()})),g()}return m+=u.move(`
545
+ `),a&&(m+=u.move(a+`
546
+ `)),m+=u.move(h),d(),m}function qK(e,t,n){return(n?"":" ")+e}function j0(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 KK(e,t,n,r){const s=j0(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const h=n.createTracker(r);let d=h.move("[");return d+=h.move(n.safe(n.associationId(e),{before:d,after:"]",...h.current()})),d+=h.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(u=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":`
547
+ `,...h.current()}))),u(),e.title&&(u=n.enter(`title${a}`),d+=h.move(" "+s),d+=h.move(n.safe(e.title,{before:d,after:s,...h.current()})),d+=h.move(s),u()),l(),d}function GK(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 Uu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ep(e,t,n){const r=Al(e),s=Al(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}MA.peek=YK;function MA(e,t,n,r){const s=GK(n),a=n.enter("emphasis"),l=n.createTracker(r),u=l.move(s);let h=l.move(n.containerPhrasing(e,{after:s,before:u,...l.current()}));const d=h.charCodeAt(0),m=ep(r.before.charCodeAt(r.before.length-1),d,s);m.inside&&(h=Uu(d)+h.slice(1));const g=h.charCodeAt(h.length-1),_=ep(r.after.charCodeAt(0),g,s);_.inside&&(h=h.slice(0,-1)+Uu(g));const b=l.move(s);return a(),n.attentionEncodeSurroundingInfo={after:_.outside,before:m.outside},u+h+b}function YK(e,t,n){return n.options.emphasis||"*"}function XK(e,t){let n=!1;return D0(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ny}),!!((!e.depth||e.depth<3)&&k0(e)&&(t.options.setext||n))}function ZK(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(XK(e,n)){const m=n.enter("headingSetext"),g=n.enter("phrasing"),_=n.containerPhrasing(e,{...a.current(),before:`
548
+ `,after:`
549
+ `});return g(),m(),_+`
550
+ `+(s===1?"=":"-").repeat(_.length-(Math.max(_.lastIndexOf("\r"),_.lastIndexOf(`
551
+ `))+1))}const l="#".repeat(s),u=n.enter("headingAtx"),h=n.enter("phrasing");a.move(l+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
552
+ `,...a.current()});return/^[\t ]/.test(d)&&(d=Uu(d.charCodeAt(0))+d.slice(1)),d=d?l+" "+d:l,n.options.closeAtx&&(d+=" "+l),h(),u(),d}NA.peek=QK;function NA(e){return e.value||""}function QK(){return"<"}AA.peek=JK;function AA(e,t,n,r){const s=j0(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const h=n.createTracker(r);let d=h.move("![");return d+=h.move(n.safe(e.alt,{before:d,after:"]",...h.current()})),d+=h.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(u=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":")",...h.current()}))),u(),e.title&&(u=n.enter(`title${a}`),d+=h.move(" "+s),d+=h.move(n.safe(e.title,{before:d,after:s,...h.current()})),d+=h.move(s),u()),d+=h.move(")"),l(),d}function JK(){return"!"}DA.peek=eG;function DA(e,t,n,r){const s=e.referenceType,a=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let h=u.move("![");const d=n.safe(e.alt,{before:h,after:"]",...u.current()});h+=u.move(d+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:h,after:"]",...u.current()});return l(),n.stack=m,a(),s==="full"||!d||d!==g?h+=u.move(g+"]"):s==="shortcut"?h=h.slice(0,-1):h+=u.move("]"),h}function eG(){return"!"}OA.peek=tG;function OA(e,t,n){let r=e.value||"",s="`",a=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const l=n.unsafe[a],u=n.compilePattern(l);let h;if(l.atBreak)for(;h=u.exec(r);){let d=h.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(h.index+1)}}return s+r+s}function tG(){return"`"}function jA(e,t){const n=k0(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))}LA.peek=nG;function LA(e,t,n,r){const s=j0(n),a=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let u,h;if(jA(e,n)){const m=n.stack;n.stack=[],u=n.enter("autolink");let g=l.move("<");return g+=l.move(n.containerPhrasing(e,{before:g,after:">",...l.current()})),g+=l.move(">"),u(),n.stack=m,g}u=n.enter("link"),h=n.enter("label");let d=l.move("[");return d+=l.move(n.containerPhrasing(e,{before:d,after:"](",...l.current()})),d+=l.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),d+=l.move("<"),d+=l.move(n.safe(e.url,{before:d,after:">",...l.current()})),d+=l.move(">")):(h=n.enter("destinationRaw"),d+=l.move(n.safe(e.url,{before:d,after:e.title?" ":")",...l.current()}))),h(),e.title&&(h=n.enter(`title${a}`),d+=l.move(" "+s),d+=l.move(n.safe(e.title,{before:d,after:s,...l.current()})),d+=l.move(s),h()),d+=l.move(")"),u(),d}function nG(e,t,n){return jA(e,n)?"<":"["}zA.peek=rG;function zA(e,t,n,r){const s=e.referenceType,a=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let h=u.move("[");const d=n.containerPhrasing(e,{before:h,after:"]",...u.current()});h+=u.move(d+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:h,after:"]",...u.current()});return l(),n.stack=m,a(),s==="full"||!d||d!==g?h+=u.move(g+"]"):s==="shortcut"?h=h.slice(0,-1):h+=u.move("]"),h}function rG(){return"["}function L0(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 iG(e){const t=L0(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 sG(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 PA(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 oG(e,t,n,r){const s=n.enter("list"),a=n.bulletCurrent;let l=e.ordered?sG(n):L0(n);const u=e.ordered?l==="."?")":".":iG(n);let h=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.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),PA(n)===l&&m){let g=-1;for(;++g<e.children.length;){const _=e.children[g];if(_&&_.type==="listItem"&&_.children&&_.children[0]&&_.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(l=u),n.bulletCurrent=l;const d=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=a,s(),d}function aG(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 lG(e,t,n,r){const s=aG(n);let a=n.bulletCurrent||L0(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let l=a.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(a+" ".repeat(l-a.length)),u.shift(l);const h=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),m);return h(),d;function m(g,_,b){return _?(b?"":" ".repeat(l))+g:(b?a:a+" ".repeat(l-a.length))+g}}function cG(e,t,n,r){const s=n.enter("paragraph"),a=n.enter("phrasing"),l=n.containerPhrasing(e,r);return a(),s(),l}const uG=Hp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function dG(e,t,n,r){return(e.children.some(function(l){return uG(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function hG(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}BA.peek=fG;function BA(e,t,n,r){const s=hG(n),a=n.enter("strong"),l=n.createTracker(r),u=l.move(s+s);let h=l.move(n.containerPhrasing(e,{after:s,before:u,...l.current()}));const d=h.charCodeAt(0),m=ep(r.before.charCodeAt(r.before.length-1),d,s);m.inside&&(h=Uu(d)+h.slice(1));const g=h.charCodeAt(h.length-1),_=ep(r.after.charCodeAt(0),g,s);_.inside&&(h=h.slice(0,-1)+Uu(g));const b=l.move(s+s);return a(),n.attentionEncodeSurroundingInfo={after:_.outside,before:m.outside},u+h+b}function fG(e,t,n){return n.options.strong||"*"}function pG(e,t,n,r){return n.safe(e.value,r)}function mG(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 gG(e,t,n){const r=(PA(n)+(n.options.ruleSpaces?" ":"")).repeat(mG(n));return n.options.ruleSpaces?r.slice(0,-1):r}const IA={blockquote:IK,break:fk,code:VK,definition:KK,emphasis:MA,hardBreak:fk,heading:ZK,html:NA,image:AA,imageReference:DA,inlineCode:OA,link:LA,linkReference:zA,list:oG,listItem:lG,paragraph:cG,root:dG,strong:BA,text:pG,thematicBreak:gG};function vG(){return{enter:{table:_G,tableData:pk,tableHeader:pk,tableRow:bG},exit:{codeText:xG,table:yG,tableData:Zv,tableHeader:Zv,tableRow:Zv}}}function _G(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 yG(e){this.exit(e),this.data.inTable=void 0}function bG(e){this.enter({type:"tableRow",children:[]},e)}function Zv(e){this.exit(e)}function pk(e){this.enter({type:"tableCell",children:[]},e)}function xG(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wG));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function wG(e,t){return t==="|"?t:e}function SG(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
553
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:l,tableCell:h,tableRow:u}};function l(b,w,S,C){return d(m(b,S,C),b.align)}function u(b,w,S,C){const k=g(b,S,C),T=d([k]);return T.slice(0,T.indexOf(`
554
+ `))}function h(b,w,S,C){const k=S.enter("tableCell"),T=S.enter("phrasing"),R=S.containerPhrasing(b,{...C,before:a,after:a});return T(),k(),R}function d(b,w){return PK(b,{align:w,alignDelimiters:r,padding:n,stringLength:s})}function m(b,w,S){const C=b.children;let k=-1;const T=[],R=w.enter("table");for(;++k<C.length;)T[k]=g(C[k],w,S);return R(),T}function g(b,w,S){const C=b.children;let k=-1;const T=[],R=w.enter("tableRow");for(;++k<C.length;)T[k]=h(C[k],b,w,S);return R(),T}function _(b,w,S){let C=IA.inlineCode(b,w,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function CG(){return{exit:{taskListCheckValueChecked:mk,taskListCheckValueUnchecked:mk,paragraph:EG}}}function kG(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:RG}}}function mk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function EG(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let a=-1,l;for(;++a<s.length;){const u=s[a];if(u.type==="paragraph"){l=u;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function RG(e,t,n,r){const s=e.children[0],a=typeof e.checked=="boolean"&&s&&s.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(l);let h=IA.listItem(e,t,n,{...r,...u.current()});return a&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),h;function d(m){return m+l}}function TG(){return[oK(),RK(),AK(),vG(),CG()]}function MG(e){return{extensions:[aK(),TK(e),DK(),SG(e),kG()]}}const NG={tokenize:zG,partial:!0},HA={tokenize:PG,partial:!0},FA={tokenize:BG,partial:!0},UA={tokenize:IG,partial:!0},AG={tokenize:HG,partial:!0},$A={name:"wwwAutolink",tokenize:jG,previous:VA},WA={name:"protocolAutolink",tokenize:LG,previous:qA},ys={name:"emailAutolink",tokenize:OG,previous:KA},Ii={};function DG(){return{text:Ii}}let Ho=48;for(;Ho<123;)Ii[Ho]=ys,Ho++,Ho===58?Ho=65:Ho===91&&(Ho=97);Ii[43]=ys;Ii[45]=ys;Ii[46]=ys;Ii[95]=ys;Ii[72]=[ys,WA];Ii[104]=[ys,WA];Ii[87]=[ys,$A];Ii[119]=[ys,$A];function OG(e,t,n){const r=this;let s,a;return l;function l(g){return!oy(g)||!KA.call(r,r.previous)||z0(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(g))}function u(g){return oy(g)?(e.consume(g),u):g===64?(e.consume(g),h):n(g)}function h(g){return g===46?e.check(AG,m,d)(g):g===45||g===95||qn(g)?(a=!0,e.consume(g),h):m(g)}function d(g){return e.consume(g),s=!0,h}function m(g){return a&&s&&rr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function jG(e,t,n){const r=this;return s;function s(l){return l!==87&&l!==119||!VA.call(r,r.previous)||z0(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(NG,e.attempt(HA,e.attempt(FA,a),n),n)(l))}function a(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function LG(e,t,n){const r=this;let s="",a=!1;return l;function l(g){return(g===72||g===104)&&qA.call(r,r.previous)&&!z0(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),u):n(g)}function u(g){if(rr(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),u;if(g===58){const _=s.toLowerCase();if(_==="http"||_==="https")return e.consume(g),h}return n(g)}function h(g){return g===47?(e.consume(g),a?d:(a=!0,h)):n(g)}function d(g){return g===null||Zf(g)||Dt(g)||ta(g)||Pp(g)?n(g):e.attempt(HA,e.attempt(FA,m),n)(g)}function m(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function zG(e,t,n){let r=0;return s;function s(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),s):l===46&&r===3?(e.consume(l),a):n(l)}function a(l){return l===null?n(l):t(l)}}function PG(e,t,n){let r,s,a;return l;function l(d){return d===46||d===95?e.check(UA,h,u)(d):d===null||Dt(d)||ta(d)||d!==45&&Pp(d)?h(d):(a=!0,e.consume(d),l)}function u(d){return d===95?r=!0:(s=r,r=void 0),e.consume(d),l}function h(d){return s||r||!a?n(d):t(d)}}function BG(e,t){let n=0,r=0;return s;function s(l){return l===40?(n++,e.consume(l),s):l===41&&r<n?a(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(UA,t,a)(l):l===null||Dt(l)||ta(l)?t(l):(e.consume(l),s)}function a(l){return l===41&&r++,e.consume(l),s}}function IG(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),a):u===93?(e.consume(u),s):u===60||u===null||Dt(u)||ta(u)?t(u):n(u)}function s(u){return u===null||u===40||u===91||Dt(u)||ta(u)?t(u):r(u)}function a(u){return rr(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):rr(u)?(e.consume(u),l):n(u)}}function HG(e,t,n){return r;function r(a){return e.consume(a),s}function s(a){return qn(a)?n(a):t(a)}}function VA(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dt(e)}function qA(e){return!rr(e)}function KA(e){return!(e===47||oy(e))}function oy(e){return e===43||e===45||e===46||e===95||qn(e)}function z0(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 FG={tokenize:YG,partial:!0};function UG(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:qG,continuation:{tokenize:KG},exit:GG}},text:{91:{name:"gfmFootnoteCall",tokenize:VG},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$G,resolveTo:WG}}}}function $G(e,t,n){const r=this;let s=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const h=r.events[s][1];if(h.type==="labelImage"){l=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return u;function u(h){if(!l||!l._balanced)return n(h);const d=ui(r.sliceSerialize({start:l.end,end:r.now()}));return d.codePointAt(0)!==94||!a.includes(d.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function WG(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function VG(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,l;return u;function u(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),h}function h(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(a>999||g===93&&!l||g===null||g===91||Dt(g))return n(g);if(g===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return s.includes(ui(r.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Dt(g)||(l=!0),a++,e.consume(g),g===92?m:d}function m(g){return g===91||g===92||g===93?(e.consume(g),a++,d):d(g)}}function qG(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,l=0,u;return h;function h(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(w)}function m(w){if(l>999||w===93&&!u||w===null||w===91||Dt(w))return n(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return a=ui(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return Dt(w)||(u=!0),l++,e.consume(w),w===92?g:m}function g(w){return w===91||w===92||w===93?(e.consume(w),l++,m):m(w)}function _(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),s.includes(a)||s.push(a),ct(e,b,"gfmFootnoteDefinitionWhitespace")):n(w)}function b(w){return t(w)}}function KG(e,t,n){return e.check(ud,t,e.attempt(FG,t,n))}function GG(e){e.exit("gfmFootnoteDefinition")}function YG(e,t,n){const r=this;return ct(e,s,"gfmFootnoteDefinitionIndent",5);function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(a):n(a)}}function XG(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,u){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let d=h;for(;d--;)if(l[d][0]==="exit"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[d][1].end.offset-l[d][1].start.offset){l[h][1].type="strikethroughSequence",l[d][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},l[d][1].start),end:Object.assign({},l[h][1].end)},g={type:"strikethroughText",start:Object.assign({},l[d][1].end),end:Object.assign({},l[h][1].start)},_=[["enter",m,u],["enter",l[d][1],u],["exit",l[d][1],u],["enter",g,u]],b=u.parser.constructs.insideSpan.null;b&&Dr(_,_.length,0,Bp(b,l.slice(d+1,h),u)),Dr(_,_.length,0,[["exit",g,u],["enter",l[h][1],u],["exit",l[h][1],u],["exit",m,u]]),Dr(l,d-1,h-d+3,_),h=d+_.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function a(l,u,h){const d=this.previous,m=this.events;let g=0;return _;function _(w){return d===126&&m[m.length-1][1].type!=="characterEscape"?h(w):(l.enter("strikethroughSequenceTemporary"),b(w))}function b(w){const S=Al(d);if(w===126)return g>1?h(w):(l.consume(w),g++,b);if(g<2&&!n)return h(w);const C=l.exit("strikethroughSequenceTemporary"),k=Al(w);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,u(w)}}}class ZG{constructor(){this.map=[]}add(t,n,r){QG(this,t,n,r)}consume(t){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const a of s)t.push(a);s=r.pop()}this.map.length=0}}function QG(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function JG(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function eY(){return{flow:{null:{name:"table",tokenize:tY,resolveAll:nY}}}}function tY(e,t,n){const r=this;let s=0,a=0,l;return u;function u(B){let H=r.events.length-1;for(;H>-1;){const q=r.events[H][1].type;if(q==="lineEnding"||q==="linePrefix")H--;else break}const P=H>-1?r.events[H][1].type:null,U=P==="tableHead"||P==="tableRow"?D:h;return U===D&&r.parser.lazy[r.now().line]?n(B):U(B)}function h(B){return e.enter("tableHead"),e.enter("tableRow"),d(B)}function d(B){return B===124||(l=!0,a+=1),m(B)}function m(B){return B===null?n(B):Be(B)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),b):n(B):nt(B)?ct(e,m,"whitespace")(B):(a+=1,l&&(l=!1,s+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),l=!0,m):(e.enter("data"),g(B)))}function g(B){return B===null||B===124||Dt(B)?(e.exit("data"),m(B)):(e.consume(B),B===92?_:g)}function _(B){return B===92||B===124?(e.consume(B),g):g(B)}function b(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(e.enter("tableDelimiterRow"),l=!1,nt(B)?ct(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):w(B))}function w(B){return B===45||B===58?C(B):B===124?(l=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),S):O(B)}function S(B){return nt(B)?ct(e,C,"whitespace")(B):C(B)}function C(B){return B===58?(a+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),k):B===45?(a+=1,k(B)):B===null||Be(B)?M(B):O(B)}function k(B){return B===45?(e.enter("tableDelimiterFiller"),T(B)):O(B)}function T(B){return B===45?(e.consume(B),T):B===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(B))}function R(B){return nt(B)?ct(e,M,"whitespace")(B):M(B)}function M(B){return B===124?w(B):B===null||Be(B)?!l||s!==a?O(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):O(B)}function O(B){return n(B)}function D(B){return e.enter("tableRow"),j(B)}function j(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),j):B===null||Be(B)?(e.exit("tableRow"),t(B)):nt(B)?ct(e,j,"whitespace")(B):(e.enter("data"),F(B))}function F(B){return B===null||B===124||Dt(B)?(e.exit("data"),j(B)):(e.consume(B),B===92?G:F)}function G(B){return B===92||B===124?(e.consume(B),F):F(B)}}function nY(e,t){let n=-1,r=!0,s=0,a=[0,0,0,0],l=[0,0,0,0],u=!1,h=0,d,m,g;const _=new ZG;for(;++n<e.length;){const b=e[n],w=b[1];b[0]==="enter"?w.type==="tableHead"?(u=!1,h!==0&&(gk(_,t,h,d,m),m=void 0,h=0),d={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},_.add(n,0,[["enter",d,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,g=void 0,a=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,m={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},_.add(n,0,[["enter",m,t]])),s=w.type==="tableDelimiterRow"?2:m?3:1):s&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(a[1]!==0&&(l[0]=l[1],g=Kh(_,t,a,s,void 0,g),a=[0,0,0,0]),l[2]=n)):w.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(l[0]=l[1],g=Kh(_,t,a,s,void 0,g)),a=l,l=[a[1],n,0,0])):w.type==="tableHead"?(u=!0,h=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=n,a[1]!==0?(l[0]=l[1],g=Kh(_,t,a,s,n,g)):l[1]!==0&&(g=Kh(_,t,l,s,n,g)),s=0):s&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&gk(_,t,h,d,m),_.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=JG(t.events,n))}return e}function Kh(e,t,n,r,s,a){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},fl(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const h=fl(t.events,n[1]);if(a={type:l,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const d=fl(t.events,n[2]),m=fl(t.events,n[3]),g={type:u,start:Object.assign({},d),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const _=t.events[n[2]],b=t.events[n[3]];if(_[1].end=Object.assign({},b[1].end),_[1].type="chunkText",_[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",g,t]])}return s!==void 0&&(a.end=Object.assign({},fl(t.events,s)),e.add(s,0,[["exit",a,t]]),a=void 0),a}function gk(e,t,n,r,s){const a=[],l=fl(t.events,n);s&&(s.end=Object.assign({},l),a.push(["exit",s,t])),r.end=Object.assign({},l),a.push(["exit",r,t]),e.add(n+1,0,a)}function fl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const rY={name:"tasklistCheck",tokenize:sY};function iY(){return{text:{91:rY}}}function sY(e,t,n){const r=this;return s;function s(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),a)}function a(h){return Dt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(h)}function u(h){return Be(h)?t(h):nt(h)?e.check({tokenize:oY},t,n)(h):n(h)}}function oY(e,t,n){return ct(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function aY(e){return iA([DG(),UG(),XG(e),eY(),iY()])}const lY={};function Gl(e){const t=this,n=e||lY,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(aY(n)),a.push(TG()),l.push(MG(n))}function vk(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function cY(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:vk(n.groups.line),column:vk(n.groups.column)}:{path:t}}function Qv(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 P0=()=>{},GA=y.createContext(P0);function uY({children:e,onOpenLocalLink:t}){return p.jsx(GA.Provider,{value:t??P0,children:e})}const ay={Task:jf,TaskOutput:jf,Bash:Mb,Glob:Ev,Grep:Ev,ExitPlanMode:$C,Read:CT,Edit:KP,Write:YP,NotebookEdit:RT,WebFetch:X6,TodoWrite:hP,WebSearch:Ev,KillShell:eI,AskUserQuestion:kT,Skill:YB,EnterPlanMode:$C},YA=sI;function XA(e){return ay[e]?ay[e]:YA}function bs({children:e,className:t}){return p.jsx("div",{className:be("flex gap-3 justify-start items-center",t),children:e})}function ZA({children:e,className:t}){return p.jsx("div",{className:be("flex items-center gap-1.5 text-xs",t),children:e})}function fo({children:e,className:t}){return p.jsx("span",{className:be("font-medium text-foreground/80",t),children:e})}function dY({children:e}){return p.jsx("span",{className:"text-muted-foreground",children:e})}function Up({children:e,expandedContent:t,defaultExpanded:n=!1}){const[r,s]=y.useState(n);return p.jsxs("div",{className:"flex flex-col w-full",children:[p.jsxs("button",{onClick:()=>s(!r),className:`group/expandable-row cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${r?"":"hover:opacity-60 transition-opacity"}`,children:[p.jsx("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:e}),p.jsx(fs,{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 _k({label:e,children:t,copyText:n}){const[r,s]=y.useState(!1),a=n??tp(t),l=y.useCallback(async()=>{await navigator.clipboard.writeText(a),s(!0),setTimeout(()=>s(!1),2e3)},[a]);return p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-muted-foreground",children:e}),p.jsxs("div",{className:"relative group/codeblock",children:[p.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}),p.jsx(Je,{variant:"ghost",size:"icon",className:be("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?p.jsx(co,{className:"h-3.5 w-3.5 text-green-400"}):p.jsx(Zu,{className:"h-4 w-4"})})]})]})}function QA({children:e,icon:t,className:n}){return p.jsxs("span",{className:be("inline-flex items-center gap-1 px-2 py-1 bg-muted border border-border rounded-full",n),children:[t&&p.jsx(t,{className:"h-3 w-3 text-muted-foreground"}),e]})}function $p({children:e,className:t}){return p.jsxs("div",{className:be("grid grid-cols-[auto_1fr] gap-2 min-w-0",t),children:[p.jsx("div",{className:" min-w-5 flex flex-col relative items-center justify-center",children:p.jsx("div",{className:"min-h-full w-[1px] bg-muted-foreground/20"})}),p.jsx("div",{className:"-ml-[1px] min-w-0 overflow-hidden",children:e})]})}function tp(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(tp).join("");if(e&&typeof e=="object"&&"props"in e){const t=e.props;return tp(t.children)}return""}function yk(e,t){return y.isValidElement(e)?y.cloneElement(e,{className:be(e.props.className,t)}):e}const B0={h1:({children:e})=>p.jsx("h1",{className:"text-[20px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h2:({children:e})=>p.jsx("h2",{className:"text-[18px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h3:({children:e})=>p.jsx("h3",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h4:({children:e})=>p.jsx("h4",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h5:({children:e})=>p.jsx("h5",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h6:({children:e})=>p.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]=y.useState(!1),s=tp(e),a=async()=>{await navigator.clipboard.writeText(s),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsxs("div",{className:"relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre",children:[p.jsx("pre",{className:"min-w-0 rounded-xl py-2.5 px-3.5 [.no-pre-highlight_&]:bg-background",...t,children:e}),p.jsx(Je,{variant:"ghost",size:"icon",className:be("absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-8 w-8 text-muted-foreground opacity-0 group-hover/pre:opacity-100 transition-opacity",!n&&"hover:text-foreground",n&&"hover:!bg-transparent hover:!border-transparent"),onClick:a,children:n?p.jsx(co,{className:"h-4 w-4 text-green-400"}):p.jsx(Zu,{className:"h-4 w-4"})})]})},code:({children:e,className:t,...n})=>t?p.jsx("code",{className:"block text-xs whitespace-pre",...n,children:e}):p.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})=>p.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:p.jsx("table",{className:"table-auto min-w-full divide-y divide-border bg-background",...t,children:e})}),tbody:({children:e,...t})=>p.jsx("tbody",{className:"divide-y divide-border",...t,children:e}),th:({children:e,...t})=>p.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})=>p.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal ",...t,children:e}),p:({children:e,...t})=>p.jsx("p",{className:"break-words mt-5 mb-3 first:mt-0 last:mb-0",...t,children:e}),blockquote:({children:e,...t})=>(()=>{const n=y.Children.toArray(e),r=n[0];r!==void 0&&(n[0]=yk(r,"mt-0"));const s=n.length-1,a=n[s];return a!==void 0&&(n[s]=yk(a,"mb-0")),p.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})=>p.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 hd(e){return{...B0,a:({children:t,href:n,onClick:r,...s})=>{const a=y.useContext(GA),l=cY(n);return p.jsx("a",{className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",href:n,target:l?void 0:"_blank",rel:l?void 0:"noopener noreferrer",onClick:u=>{r==null||r(u),!(u.defaultPrevented||!l||a===P0)&&(u.preventDefault(),a(l))},...s,children:t})}}}({...B0});function hY(e){const t=e.split(`
555
+ `),n=/^\s*(\d+)→(.*)$/;return t.map(r=>{const s=r.match(n);return s?{lineNumber:parseInt(s[1],10),content:s[2]}:{lineNumber:null,content:r}})}function fY(e){return e.replace(/<[^>]+>/g,"")}function pY(e,t){const n=e.split(`
556
+ `),r=t.split(`
557
+ `),s=mY(n,r),a=gY(n,r,s);return vY(a)}function mY(e,t){const n=e.length,r=t.length,s=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let l=1;l<=r;l++)s[a][l]=e[a-1]===t[l-1]?s[a-1][l-1]+1:Math.max(s[a-1][l],s[a][l-1]);return s}function gY(e,t,n){const r=[];let s=e.length,a=t.length;for(;s>0||a>0;)s>0&&a>0&&e[s-1]===t[a-1]?(r.push({type:"context",text:e[s-1],oldIdx:s,newIdx:a}),s--,a--):a>0&&(s===0||n[s][a-1]>=n[s-1][a])?(r.push({type:"added",text:t[a-1],oldIdx:s,newIdx:a}),a--):(r.push({type:"removed",text:e[s-1],oldIdx:s,newIdx:a}),s--);return r.reverse()}function vY(e){return e.map(t=>{const n=t.type==="removed"?"-":t.type==="added"?"+":" ";return{type:t.type,content:`${n}${t.text}`}})}function _f({content:e,isDiff:t=!1,oldString:n,newString:r}){const s=y.useMemo(()=>t&&n!==void 0&&r!==void 0?pY(n,r):[],[t,n,r]),a=y.useMemo(()=>t?[]:hY(e),[e,t]),l=y.useMemo(()=>a.some(u=>u.lineNumber!==null),[a]);return t&&s.length>0?p.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:p.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:p.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:p.jsx("tbody",{children:s.map((u,h)=>{const d=u.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":u.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",m=u.type==="removed"?"text-red-700 dark:text-red-400":u.type==="added"?"text-green-700 dark:text-green-400":"text-foreground";return p.jsxs("tr",{className:d,children:[p.jsx("td",{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${u.type==="removed"?"text-red-500/50":u.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:u.type==="removed"?"-":u.type==="added"?"+":" "}),p.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${m}`,children:u.content.slice(1)})]},h)})})})})}):p.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:p.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:p.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:p.jsx("tbody",{children:a.map((u,h)=>p.jsxs("tr",{children:[l&&p.jsx("td",{className:"px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right",children:u.lineNumber!==null?u.lineNumber:""}),p.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:fY(u.content)})]},h))})})})})}function JA({attachment:e,onOpenChange:t}){const[n,r]=y.useState({}),s=y.useMemo(()=>e?v0(e):null,[e]),a=e?n[e.id]:void 0,l=e!=null&&e.contentUrl?yY(e.contentUrl):"";y.useEffect(()=>{if(!e||!s||s.openInNewTab||s.kind==="image"||s.kind==="pdf"||s.kind==="external")return;const d=s.kind;if((a==null?void 0:a.status)==="loading"||(a==null?void 0:a.status)==="ready")return;let m=!1;return r(g=>({...g,[e.id]:{status:"loading"}})),jU(e.contentUrl,TU).then(({content:g,truncated:_})=>{if(m)return;if(d==="table"){const w=e.mimeType==="text/tab-separated-values"?" ":",";r(S=>({...S,[e.id]:{status:"ready",kind:"table",truncated:_,table:zU(g,w)}}));return}const b=d==="json"?LU(g):g;r(w=>({...w,[e.id]:{status:"ready",kind:d,content:b,truncated:_}}))}).catch(g=>{if(m)return;const _=g instanceof Error?g.message:"Unable to load preview.";r(b=>({...b,[e.id]:{status:"error",message:_}}))}),()=>{m=!0}},[e==null?void 0:e.id,e==null?void 0:e.contentUrl,e==null?void 0:e.mimeType,s==null?void 0:s.kind,s==null?void 0:s.openInNewTab]);async function u(){var d;!l||typeof navigator>"u"||!((d=navigator.clipboard)!=null&&d.writeText)||await navigator.clipboard.writeText(l)}function h(){!l||typeof window>"u"||window.open(l,"_blank","noopener,noreferrer")}return p.jsx(Db,{open:e!==null&&!(s!=null&&s.openInNewTab),onOpenChange:t,children:p.jsx(bp,{size:"lg",className:"max-w-[min(92vw,960px)] overflow-hidden p-0",children:e&&s&&!s.openInNewTab?p.jsxs(p.Fragment,{children:[p.jsx(vI,{className:"pr-12",children:p.jsx(Ob,{className:"text-md",children:e.displayName})}),p.jsx(jb,{className:"bg-muted/20 p-4",children:_Y(e,s.kind,a)}),p.jsxs(Lb,{className:"items-center justify-between gap-3 px-4 py-3",children:[p.jsxs(AT,{className:"truncate",children:[e.mimeType," · ",_0(e.size)]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(_I,{type:"button",onClick:u,children:[p.jsx(dB,{className:"mr-2 h-4 w-4"}),"Copy Link"]}),p.jsxs(Je,{type:"button",variant:"outline",onClick:h,children:[p.jsx(zP,{className:"mr-2 h-4 w-4"}),"Open In New Tab"]})]})]})]}):null})})}function _Y(e,t,n){if(t==="image")return p.jsx("div",{className:"flex items-center justify-center",children:p.jsx("img",{src:e.contentUrl,alt:e.displayName,className:"max-h-[70vh] w-auto max-w-full rounded-2xl object-contain"})});if(t==="pdf")return p.jsx("iframe",{src:e.contentUrl,title:e.displayName,className:"h-[70vh] w-full rounded-xl border border-border bg-background"});if(!n||n.status==="loading")return p.jsx("div",{className:"flex h-[50vh] items-center justify-center text-sm text-muted-foreground",children:"Loading preview…"});if(n.status==="error")return p.jsx("div",{className:"flex h-[50vh] items-center justify-center text-sm text-destructive",children:n.message});if(n.kind==="markdown"&&n.content!==void 0)return p.jsxs("div",{className:"space-y-3",children:[n.truncated?p.jsx(Jv,{message:"Preview truncated to 1024 KB."}):null,p.jsx("div",{className:"prose prose-sm max-w-none overflow-auto rounded-xl border border-border bg-background p-4 prose-invert",children:p.jsx(Kl,{remarkPlugins:[Gl],components:hd(),children:n.content})})]});if(n.kind==="table"&&n.table){const r=n.table.rows.length>0,[s,...a]=n.table.rows,l=[n.truncated?"Preview truncated to 1024 KB.":null,n.table.truncatedRows?`Showing first ${n.table.rows.length} of ${n.table.rowCount} rows.`:null,n.table.truncatedColumns?`Showing first ${Y_} of ${n.table.columnCount} columns.`:null].filter(Boolean);return p.jsxs("div",{className:"space-y-3",children:[l.length>0?p.jsx(Jv,{message:l.join(" ")}):null,p.jsx("div",{className:"max-h-[70vh] overflow-auto rounded-xl border border-border bg-background",children:p.jsxs("table",{className:"min-w-full border-collapse text-xs",children:[r?p.jsx("thead",{className:"sticky top-0 bg-muted",children:p.jsx("tr",{children:s.map((u,h)=>p.jsx("th",{className:"border-b border-border px-3 py-2 text-left font-medium text-foreground",children:u||" "},`${u}-${h}`))})}):null,p.jsx("tbody",{children:(r?a:n.table.rows).map((u,h)=>p.jsx("tr",{className:"odd:bg-background even:bg-muted/20",children:u.map((d,m)=>p.jsx("td",{className:"max-w-[320px] border-b border-border px-3 py-2 align-top text-foreground",children:p.jsx("div",{className:"whitespace-pre-wrap break-words",children:d||" "})},`${h}-${m}`))},h))})]})})]})}return p.jsxs("div",{className:"space-y-3",children:[n.truncated?p.jsx(Jv,{message:"Preview truncated to 1024 KB."}):null,p.jsx(_f,{content:n.content??""})]})}function Jv({message:e}){return p.jsx("div",{className:"rounded-xl border border-border bg-background px-3 py-2 text-sm text-muted-foreground",children:e})}function yY(e){return typeof window>"u"?e:new URL(e,window.location.origin).toString()}const e5=10,bY=3,xY={"image/gif":"gif","image/jpeg":"jpg","image/png":"png","image/webp":"webp"};function wY(e){const t=e.maxAttachments??e5;return e.currentAttachmentCount+e.queuedAttachmentCount+e.incomingAttachmentCount>t}function SY(e){return e?e.types.includes("text/plain")||e.types.includes("text/html"):!1}function t5(e){return xY[e.type]??"bin"}function CY(e){const t=e.name.trim().toLowerCase();if(!t)return!0;const n=t5(e);return t===`image.${n}`||t==="image.png"}function kY(e,t,n){if(e.name&&!CY(e))return e;const r=t5(e),s=t===0?"":`-${t}`,a=`clipboard-${n}${s}.${r}`;return Object.defineProperty(e,"name",{configurable:!0,value:a}),e}function EY(e,t){const n=[];for(const r of e){if(r.kind!=="file"||!r.type.startsWith("image/"))continue;const s=r.getAsFile();s&&n.push(kY(s,n.length,t))}return n}function bk(e,t){return e.provider!=="claude"?{...e,model:t}:{...e,model:t,modelOptions:{...e.modelOptions,contextWindow:wN(t,e.modelOptions.contextWindow)}}}function xk(e,t){if(t===void 0){console.info(`[ChatInput] ${e}`);return}console.info(`[ChatInput] ${e}`,t)}function RY(e,t,n){return!t||e.provider===t?e:t==="claude"?{provider:"claude",model:n.claude.model,modelOptions:{...n.claude.modelOptions},planMode:e.planMode}:{provider:"codex",model:n.codex.model,modelOptions:{...n.codex.modelOptions},planMode:e.planMode}}const TY=y.forwardRef(function({onSubmit:t,onCancel:n,disabled:r,canCancel:s,chatId:a,projectId:l,inputElementRef:u,activeProvider:h,availableProviders:d},m){const{getDraft:g,setDraft:_,clearDraft:b,getAttachmentDrafts:w,setAttachmentDrafts:S,clearAttachmentDrafts:C}=nU(),{providerDefaults:k,getComposerState:T,initializeComposerForChat:R,setChatComposerModel:M,setChatComposerPlanMode:O,resetChatComposerFromProvider:D}=tr(),j=a??K_,G=tr(ie=>ie.chatStates[j])??T(j),[B,H]=y.useState(()=>a?g(a):""),P=y.useRef(null),U=y.useRef(null),q=tU(),[W,z]=y.useState(()=>wk(a?w(a):[])),[$,V]=y.useState(null),[Q,N]=y.useState(null),I=y.useRef([]),Z=y.useRef(0),L=y.useRef([]),de=y.useRef(0),me=y.useRef(new Set),ue=y.useRef(l??null),he=y.useRef(a??null),we=h!==null,le=RY(G,h,k),xe=we?h:G.provider,Ne=d.find(ie=>ie.id===xe)??d[0],ae=(Ne==null?void 0:Ne.supportsPlanMode)??!1,pe=W.filter(ie=>ie.status==="uploaded"),Re=W.some(ie=>ie.status==="uploading"),$e=B.trim().length>0||pe.length>0,at=[...W].sort((ie,Te)=>ie.kind===Te.kind?0:ie.kind==="image"?-1:1),Lt=W.find(ie=>ie.id===$)??null,zt=y.useCallback(ie=>{ie.previewUrl&&URL.revokeObjectURL(ie.previewUrl)},[]),ut=y.useCallback(()=>{de.current+=1,me.current.clear(),z(ie=>(ie.forEach(zt),[])),I.current=[],Z.current=0,N(null)},[zt]),yt=y.useCallback(()=>{const ie=U.current;if(ie){if(ie.value.length===0){ie.style.height="";return}ie.style.height="auto",ie.style.height=`${ie.scrollHeight}px`}},[]),un=y.useCallback(ie=>{U.current=ie,u&&(typeof u=="function"?u(ie):u.current=ie)},[u]);y.useLayoutEffect(()=>{yt()},[B,yt]),y.useEffect(()=>(window.addEventListener("resize",yt),()=>window.removeEventListener("resize",yt)),[yt]),y.useEffect(()=>{var ie;(ie=U.current)==null||ie.focus()},[a]),y.useEffect(()=>{he.current=a??null},[a]),y.useEffect(()=>{R(j)},[j,R]),y.useEffect(()=>{de.current+=1,I.current=[],Z.current=0,me.current.clear(),V(null),N(null),z(ie=>(ie.forEach(zt),wk(a?w(a):[])))},[a,zt,w]),y.useEffect(()=>{const ie=ue.current;ue.current=l??null,!(ie===null||l===ie)&&(ut(),a&&C(a))},[l,a,ut,C]),y.useEffect(()=>{xk("resolved provider state",{chatId:a??null,activeProvider:h,composerProvider:G.provider,composerModel:G.model,effectiveProvider:le.provider,effectiveModel:le.model,selectedProvider:xe,providerLocked:we})},[h,a,G.model,G.provider,we,le.model,le.provider,xe]),y.useEffect(()=>{L.current=W},[W]),y.useEffect(()=>{if(!a)return;const ie=W.filter(Te=>Te.status==="uploaded").map(({previewUrl:Te,status:lt,...bt})=>bt);if(ie.length===0){C(a);return}S(a,ie)},[W,a,C,S]),y.useEffect(()=>()=>{L.current.forEach(zt)},[zt]);function en(ie){tr.getState().setComposerState(j,ie(le))}function bn(ie){en(Te=>({...Te,modelOptions:{...Te.modelOptions,reasoningEffort:ie}}))}function Nt(ie){en(Te=>Te.provider!=="claude"?Te:bk({...Te,modelOptions:{...Te.modelOptions,contextWindow:ie}},Te.model))}function Yn(ie){O(j,ie)}function Y(){Yn(!le.planMode)}const oe=y.useCallback(()=>{if(l)for(;Z.current<bY&&I.current.length>0;){const ie=I.current.shift();if(!ie)break;Z.current+=1;const Te=crypto.randomUUID(),lt=ie.type.startsWith("image/")?URL.createObjectURL(ie):void 0,bt=de.current;z(dn=>[...dn,{id:Te,kind:ie.type.startsWith("image/")?"image":"file",displayName:ie.name,absolutePath:"",relativePath:"",contentUrl:"",mimeType:ie.type||"application/octet-stream",size:ie.size,status:"uploading",previewUrl:lt}]),(async()=>{try{const dn=new FormData;dn.append("files",ie);const Xn=await fetch(`/api/projects/${l}/uploads`,{method:"POST",body:dn});if(!Xn.ok){const Ct=await Xn.json().catch(()=>({}));throw new Error(typeof Ct.error=="string"?Ct.error:"Upload failed")}const xt=(await Xn.json()).attachments[0];if(!xt)throw new Error("Upload failed");if(bt!==de.current){e_(xt),lt&&URL.revokeObjectURL(lt);return}if(me.current.has(Te)){me.current.delete(Te),lt&&URL.revokeObjectURL(lt),e_(xt);return}z(Ct=>Ct.map(Pt=>Pt.id!==Te?Pt:{...Pt,...xt,previewUrl:Pt.previewUrl,status:"uploaded"})),N(null)}catch(dn){if(bt!==de.current){lt&&URL.revokeObjectURL(lt);return}z(Xn=>Xn.map(Zn=>Zn.id===Te?{...Zn,status:"failed"}:Zn)),N(dn instanceof Error?dn.message:String(dn))}finally{Z.current=Math.max(0,Z.current-1),oe()}})()}},[l]),Ee=y.useCallback(ie=>{if(!l){N("Open a project before uploading files.");return}if(wY({currentAttachmentCount:L.current.length,queuedAttachmentCount:I.current.length,incomingAttachmentCount:ie.length})){N(`You can upload up to ${e5} files at a time.`);return}I.current.push(...ie),N(null),oe()},[oe,l]);y.useImperativeHandle(m,()=>({enqueueFiles:Ee}),[Ee]);async function ze(){if(!$e||Re)return;const ie=B,Te=pe.map(({previewUrl:dn,status:Xn,...Zn})=>Zn);let lt;le.provider==="claude"?lt={claude:{...le.modelOptions}}:lt={codex:{...le.modelOptions}};const bt={provider:xe,model:le.model,modelOptions:lt,planMode:ae?le.planMode:!1,attachments:Te};xk("submit settings",{chatId:a??null,activeProvider:h,composerProvider:le.provider,submitOptions:bt}),H(""),a&&b(a),U.current&&(U.current.style.height="auto");try{await t(ie,bt),ut(),he.current&&C(he.current)}catch(dn){console.error("[ChatInput] Submit failed:",dn),H(ie),a&&_(a,ie)}}function Fe(ie){if(ie.key==="Tab"&&!ie.shiftKey){ie.preventDefault(),pI(U.current,document);return}if(ie.key==="Tab"&&ie.shiftKey&&ae){ie.preventDefault(),Y();return}if(ie.key==="Escape"&&s){ie.preventDefault(),n==null||n();return}const Te="ontouchstart"in window||navigator.maxTouchPoints>0;ie.key==="Enter"&&!ie.shiftKey&&!s&&!Te&&(ie.preventDefault(),ze())}function dt(ie){const Te=EY(ie.clipboardData.items,Date.now());Te.length!==0&&(Ee(Te),SY(ie.clipboardData)||ie.preventDefault())}function ee(ie){if(v0(ie).openInNewTab){typeof window<"u"&&window.open(new URL(ie.contentUrl,window.location.origin).toString(),"_blank","noopener,noreferrer");return}V(ie.id)}function Ge(ie){me.current.add(ie.id),z(Te=>{const lt=Te.find(bt=>bt.id===ie.id);return lt&&zt(lt),Te.filter(bt=>bt.id!==ie.id)}),$===ie.id&&V(null),ie.status==="uploaded"&&(me.current.delete(ie.id),e_(ie))}function pt(){var ie;(ie=P.current)==null||ie.click()}return p.jsxs("div",{children:[p.jsxs("div",{className:be("px-3 pt-0",q&&"px-5"),children:[p.jsxs("div",{className:"max-w-[840px] mx-auto rounded-[32px]",children:[W.length>0?p.jsx(p0,{className:"overflow-x-auto overflow-y-hidden whitespace-nowrap px-2 pb-2",children:p.jsx("div",{className:"flex items-end gap-2 pt-2",children:at.map(ie=>p.jsx("div",{className:be("flex shrink-0 flex-col justify-end",ie.status==="failed"&&"text-destructive"),children:ie.kind==="image"?p.jsx(FN,{attachment:ie,previewUrl:ie.previewUrl,size:"composer",onClick:ie.status==="uploaded"?()=>ee(ie):void 0,onRemove:()=>Ge(ie)}):p.jsx(UN,{attachment:ie,onClick:ie.status==="uploaded"?()=>ee(ie):void 0,onRemove:()=>Ge(ie)})},ie.id))})}):null,p.jsxs("div",{className:"flex items-end max-w-[840px] mx-auto border dark:bg-card/40 backdrop-blur-lg border-border rounded-[29px] pr-1.5",children:[p.jsx("input",{ref:P,type:"file",multiple:!0,className:"hidden",onChange:ie=>{const Te=[...ie.target.files??[]];Te.length>0&&Ee(Te),ie.target.value=""}}),p.jsx(Je,{type:"button",variant:"ghost",size:"icon",onPointerDown:ie=>{ie.preventDefault(),pt()},disabled:r,className:"md:hidden flex-shrink-0 ml-1 mb-1 h-10 w-10 rounded-full text-muted-foreground hover:text-foreground",children:p.jsx(NB,{className:"h-5 w-5"})}),p.jsx(SN,{ref:un,placeholder:"Build something...",value:B,autoFocus:!0,[Ab]:"",rows:1,onChange:ie=>{H(ie.target.value),a&&_(a,ie.target.value),yt()},onPaste:dt,onKeyDown:Fe,disabled:r,className:"flex-1 text-base p-3 md:p-4 !pr-2 pl-0 md:pl-6 resize-none max-h-[200px] outline-none bg-transparent border-0 shadow-none"}),p.jsx(Je,{type:"button",onPointerDown:ie=>{ie.preventDefault(),s?n==null||n():!r&&$e&&!Re&&ze()},disabled:!s&&(r||!$e||Re),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 mb-1 -mr-0.5 md:mr-0 md:mb-1.5 touch-manipulation disabled:bg-white/60 disabled:text-slate-700",children:s?p.jsx("div",{className:"w-3 h-3 md:w-4 md:h-4 rounded-xs bg-current"}):p.jsx(nP,{className:"h-5 w-5 md:h-6 md:w-6"})})]})]}),Q?p.jsx("div",{className:"max-w-[840px] mx-auto mt-2 px-1 text-sm text-destructive",children:Q}):null]}),p.jsxs("div",{className:be("overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden py-3 flex flex-row",q&&"p-5 pt-3"),children:[p.jsx("div",{className:"min-w-3"}),p.jsx(G_,{availableProviders:d,selectedProvider:xe,providerLocked:we,model:le.model,modelOptions:le.modelOptions,onProviderChange:ie=>{we||D(j,ie)},onModelChange:(ie,Te)=>{if(we){en(lt=>bk(lt,Te));return}M(j,Te)},onModelOptionChange:ie=>{switch(ie.type){case"claudeReasoningEffort":bn(ie.effort);break;case"codexReasoningEffort":bn(ie.effort);break;case"contextWindow":Nt(ie.contextWindow);break;case"fastMode":en(Te=>Te.provider==="claude"?Te:{...Te,modelOptions:{...Te.modelOptions,fastMode:ie.fastMode}});break}},planMode:le.planMode,onPlanModeChange:Yn,includePlanMode:ae,className:"max-w-[840px] mx-auto"}),p.jsx("div",{className:"min-w-3"})]}),p.jsx(JA,{attachment:Lt,onOpenChange:ie=>!ie&&V(null)})]})}),MY=y.memo(TY);async function e_(e){if(!e.contentUrl)return;const t=e.contentUrl.replace(/\/content$/,"");await fetch(t,{method:"DELETE"}).catch(()=>{})}function wk(e){return e.map(t=>({...t,status:"uploaded"}))}const n5=y.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:be("bg-card text-card-foreground",e),...t}));n5.displayName="Card";const r5=y.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:be("flex flex-col space-y-1.5 p-2",e),...t}));r5.displayName="CardHeader";const NY=y.forwardRef(({className:e,...t},n)=>p.jsx("h3",{ref:n,className:be("text-2xl font-semibold leading-none tracking-tight",e),...t}));NY.displayName="CardTitle";const AY=y.forwardRef(({className:e,...t},n)=>p.jsx("p",{ref:n,className:be("text-sm text-muted-foreground",e),...t}));AY.displayName="CardDescription";const i5=y.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:be("p-6 pt-0",e),...t}));i5.displayName="CardContent";const DY=y.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:be("flex items-center p-6 pt-0",e),...t}));DY.displayName="CardFooter";function OY({sidebarCollapsed:e,onOpenSidebar:t,onExpandSidebar:n,onNewChat:r,localPath:s,embeddedTerminalVisible:a=!1,onToggleEmbeddedTerminal:l,rightSidebarVisible:u=!1,onToggleRightSidebar:h,onOpenExternal:d,editorLabel:m="Editor",finderShortcut:g,editorShortcut:_,terminalShortcut:b,rightSidebarShortcut:w}){return p.jsx(r5,{className:be("absolute top-0 left-0 right-0 z-10 md:pt-3 px-3 border-border/0 md:pb-0 flex items-center justify-center"," bg-gradient-to-b from-background/70"),children:p.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[p.jsxs("div",{className:`flex items-center gap-1 flex-shrink-0 border border-border rounded-full ${e?"px-1.5":""} p-1 backdrop-blur-lg`,children:[p.jsx(Je,{variant:"ghost",size:"icon",className:"md:hidden",onClick:t,children:p.jsx(kb,{className:"size-4.5"})}),e&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex items-center justify-center w-[36px] h-[36px]",children:p.jsx(yu,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"})}),p.jsx(Je,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:n,title:"Expand sidebar",children:p.jsx(T_,{className:"size-4.5"})})]}),p.jsx(Je,{variant:"ghost",size:"icon",onClick:r,title:"Compose",children:p.jsx(Tb,{className:"size-4.5"})})]}),p.jsx("div",{className:"flex-1 min-w-0"}),p.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 border border-border rounded-full px-1.5 py-1 backdrop-blur-lg",children:[s&&(d||l)&&p.jsxs(p.Fragment,{children:[d?p.jsxs(iu,{children:[p.jsx(su,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"icon",onClick:()=>d("open_finder"),title:"Open in Finder",className:"border border-border/0",children:p.jsx(Cb,{className:"h-4.5 w-4.5"})})}),p.jsx(ml,{side:"bottom",shortcut:g})]}):null,l?p.jsxs(iu,{children:[p.jsx(su,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"icon",onClick:l,className:be("border border-border/0",a&&"text-white"),children:p.jsx(Mb,{className:"h-4.5 w-4.5"})})}),p.jsx(ml,{side:"bottom",shortcut:b})]}):null,d?p.jsxs(iu,{children:[p.jsx(su,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"icon",onClick:()=>d("open_editor"),title:`Open in ${m}`,className:"border border-border/0",children:p.jsx(Sb,{className:"h-4.5 w-4.5"})})}),p.jsx(ml,{side:"bottom",shortcut:_})]}):null]}),h?p.jsxs(iu,{children:[p.jsx(su,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"icon",onClick:h,className:be("border border-border/0",u&&"text-white"),children:p.jsx(TB,{className:"h-4.5 w-4.5"})})}),p.jsx(ml,{side:"bottom",shortcut:w})]}):null]})]})})}function jY({onClose:e}){return p.jsx("div",{className:"h-full min-h-0 border-l border-border bg-background md:min-w-[300px]",children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[p.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[p.jsx("div",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:"Diffs"}),p.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:p.jsx(mo,{className:"h-4 w-4"})})]}),p.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:"diffs coming soon"})})]})})}function LY(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function zY(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function PY(e){return e/100*window.innerHeight}function BY(e){return e/100*window.innerWidth}function IY(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 lu({groupSize:e,panelElement:t,styleProp:n}){let r;const[s,a]=IY(n);switch(a){case"%":{r=s/100*e;break}case"px":{r=s;break}case"rem":{r=zY(t,s);break}case"em":{r=LY(t,s);break}case"vh":{r=PY(s);break}case"vw":{r=BY(s);break}}return r}function gr(e){return parseFloat(e.toFixed(3))}function Dl({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,s)=>(r+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,r),0)}function ly(e){const{panels:t}=e,n=Dl({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:s,panelConstraints:a}=r;let l=0;if(a.collapsedSize!==void 0){const m=lu({groupSize:n,panelElement:s,styleProp:a.collapsedSize});l=gr(m/n*100)}let u;if(a.defaultSize!==void 0){const m=lu({groupSize:n,panelElement:s,styleProp:a.defaultSize});u=gr(m/n*100)}let h=0;if(a.minSize!==void 0){const m=lu({groupSize:n,panelElement:s,styleProp:a.minSize});h=gr(m/n*100)}let d=100;if(a.maxSize!==void 0){const m=lu({groupSize:n,panelElement:s,styleProp:a.maxSize});d=gr(m/n*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:l,collapsible:a.collapsible===!0,defaultSize:u,disabled:a.disabled,minSize:h,maxSize:d,panelId:r.id}})}function Mt(e,t="Assertion error"){if(!e)throw Error(t)}function cy(e,t){return Array.from(t).sort(e==="horizontal"?HY:FY)}function HY(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function FY(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function s5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function o5(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 UY({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let s,a=Number.MAX_VALUE;for(const l of t){const{x:u,y:h}=o5(r,l),d=e==="horizontal"?u:h;d<a&&(a=d,s=l)}return Mt(s,"No rect found"),s}let Gh;function $Y(){return Gh===void 0&&(typeof matchMedia=="function"?Gh=!!matchMedia("(pointer:coarse)").matches:Gh=!1),Gh}function a5(e){const{element:t,orientation:n,panels:r,separators:s}=e,a=cy(n,Array.from(t.children).filter(s5).map(w=>({element:w}))).map(({element:w})=>w),l=[];let u=!1,h=!1,d=-1,m=-1,g=0,_,b=[];{let w=-1;for(const S of a)S.hasAttribute("data-panel")&&(w++,S.ariaDisabled===null&&(g++,d===-1&&(d=w),m=w))}if(g>1){let w=-1;for(const S of a)if(S.hasAttribute("data-panel")){w++;const C=r.find(k=>k.element===S);if(C){if(_){const k=_.element.getBoundingClientRect(),T=S.getBoundingClientRect();let R;if(h){const M=n==="horizontal"?new DOMRect(k.right,k.top,0,k.height):new DOMRect(k.left,k.bottom,k.width,0),O=n==="horizontal"?new DOMRect(T.left,T.top,0,T.height):new DOMRect(T.left,T.top,T.width,0);switch(b.length){case 0:{R=[M,O];break}case 1:{const D=b[0],j=UY({orientation:n,rects:[k,T],targetRect:D.element.getBoundingClientRect()});R=[D,j===k?O:M];break}default:{R=b;break}}}else b.length?R=b:R=[n==="horizontal"?new DOMRect(k.right,T.top,T.left-k.right,T.height):new DOMRect(T.left,k.bottom,T.width,T.top-k.bottom)];for(const M of R){let O="width"in M?M:M.element.getBoundingClientRect();const D=$Y()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(O.width<D){const F=D-O.width;O=new DOMRect(O.x-F/2,O.y,O.width+F,O.height)}if(O.height<D){const F=D-O.height;O=new DOMRect(O.x,O.y-F/2,O.width,O.height+F)}const j=w<=d||w>m;!u&&!j&&l.push({group:e,groupSize:Dl({group:e}),panels:[_,C],separator:"width"in M?void 0:M,rect:O}),u=!1}}h=!1,_=C,b=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(u=!0);const C=s.find(k=>k.element===S);C?b.push(C):(_=void 0,b=[])}else h=!0}return l}var io,iR;let l5=(iR=class{constructor(){QS(this,io,{})}addListener(t,n){const r=Fc(this,io)[t];return r===void 0?Fc(this,io)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Fc(this,io)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let s=!1,a=null;const l=Array.from(r);for(let u=0;u<l.length;u++){const h=l[u];try{h.call(null,n)}catch(d){a===null&&(s=!0,a=d)}}if(s)throw a}}removeAllListeners(){JS(this,io,{})}removeListener(t,n){const r=Fc(this,io)[t];if(r!==void 0){const s=r.indexOf(n);s>=0&&r.splice(s,1)}}},io=new WeakMap,iR),Ai=new Map;const c5=new l5;function WY(e){Ai=new Map(Ai),Ai.delete(e)}function Sk(e,t){for(const[n]of Ai)if(n.id===e)return n}function ao(e,t){for(const[n,r]of Ai)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ma(){return Ai}function I0(e,t){return c5.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function gs(e,t){const n=Ai.get(e);Ai=new Map(Ai),Ai.set(e,t),c5.emit("groupChange",{group:e,prev:n,next:t})}function VY(e,t,n){let r,s={x:1/0,y:1/0};for(const a of t){const l=o5(n,a.rect);switch(e){case"horizontal":{l.x<=s.x&&(r=a,s=l);break}case"vertical":{l.y<=s.y&&(r=a,s=l);break}}}return r?{distance:s,hitRegion:r}:void 0}function qY(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function KY(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Ek(e),b:Ek(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Mt(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:kk(Ck(n.a)),b:kk(Ck(n.b))};if(s.a===s.b){const a=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let u=a.length;for(;u--;){const h=a[u];if(h===l.a)return 1;if(h===l.b)return-1}}return Math.sign(s.a-s.b)}const GY=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function YY(e){const t=getComputedStyle(u5(e)??e).display;return t==="flex"||t==="inline-flex"}function XY(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||YY(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"||GY.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Ck(e){let t=e.length;for(;t--;){const n=e[t];if(Mt(n,"Missing node"),XY(n))return n}return null}function kk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ek(e){const t=[];for(;e;)t.push(e),e=u5(e);return t}function u5(e){const{parentNode:t}=e;return qY(t)?t.host:t}function ZY(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 QY({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!s5(n)||n.contains(e)||e.contains(n))return!0;if(KY(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ZY(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function H0(e,t){const n=[];return t.forEach((r,s)=>{if(s.disabled)return;const a=a5(s),l=VY(s.orientation,a,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&QY({groupElement:s.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function JY(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 nr(e,t,n=0){return Math.abs(gr(e)-gr(t))<=n}function Ri(e,t){return nr(e,t)?0:e>t?1:-1}function vl({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:s=0,collapsible:a,disabled:l,maxSize:u=100,minSize:h=0}=t;if(l&&!e)return n;if(Ri(r,h)<0)if(a){const d=(s+h)/2;Ri(r,d)<0?r=s:r=h}else r=h;return r=Math.min(u,r),r=gr(r),r}function $u({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:a}){if(nr(e,0))return t;const l=a==="imperative-api",u=Object.values(t),h=Object.values(s),d=[...u],[m,g]=r;Mt(m!=null,"Invalid first pivot index"),Mt(g!=null,"Invalid second pivot index");let _=0;switch(a){case"keyboard":{{const S=e<0?g:m,C=n[S];Mt(C,`Panel constraints not found for index ${S}`);const{collapsedSize:k=0,collapsible:T,minSize:R=0}=C;if(T){const M=u[S];if(Mt(M!=null,`Previous layout not found for panel index ${S}`),nr(M,k)){const O=R-M;Ri(O,Math.abs(e))>0&&(e=e<0?0-O:O)}}}{const S=e<0?m:g,C=n[S];Mt(C,`No panel constraints found for index ${S}`);const{collapsedSize:k=0,collapsible:T,minSize:R=0}=C;if(T){const M=u[S];if(Mt(M!=null,`Previous layout not found for panel index ${S}`),nr(M,R)){const O=M-k;Ri(O,Math.abs(e))>0&&(e=e<0?0-O:O)}}}break}default:{const S=e<0?g:m,C=n[S];Mt(C,`Panel constraints not found for index ${S}`);const k=u[S],{collapsible:T,collapsedSize:R,minSize:M}=C;if(T&&Ri(k,M)<0)if(e>0){const O=M-R,D=O/2,j=k+e;Ri(j,M)<0&&(e=Ri(e,D)<=0?0:O)}else{const O=M-R,D=100-O/2,j=k-e;Ri(j,M)<0&&(e=Ri(100+e,D)>0?0:-O)}break}}{const S=e<0?1:-1;let C=e<0?g:m,k=0;for(;;){const R=u[C];Mt(R!=null,`Previous layout not found for panel index ${C}`);const M=vl({overrideDisabledPanels:l,panelConstraints:n[C],prevSize:R,size:100})-R;if(k+=M,C+=S,C<0||C>=n.length)break}const T=Math.min(Math.abs(e),Math.abs(k));e=e<0?0-T:T}{let S=e<0?m:g;for(;S>=0&&S<n.length;){const C=Math.abs(e)-Math.abs(_),k=u[S];Mt(k!=null,`Previous layout not found for panel index ${S}`);const T=k-C,R=vl({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:k,size:T});if(!nr(k,R)&&(_+=k-R,d[S]=R,_.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?S--:S++}}if(JY(h,d))return s;{const S=e<0?g:m,C=u[S];Mt(C!=null,`Previous layout not found for panel index ${S}`);const k=C+_,T=vl({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:C,size:k});if(d[S]=T,!nr(T,k)){let R=k-T,M=e<0?g:m;for(;M>=0&&M<n.length;){const O=d[M];Mt(O!=null,`Previous layout not found for panel index ${M}`);const D=O+R,j=vl({overrideDisabledPanels:l,panelConstraints:n[M],prevSize:O,size:D});if(nr(O,j)||(R-=j-O,d[M]=j),nr(R,0))break;e>0?M--:M++}}}const b=Object.values(d).reduce((S,C)=>C+S,0);if(!nr(b,100,.1))return s;const w=Object.keys(s);return d.reduce((S,C,k)=>(S[w[k]]=C,S),{})}function na(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Ri(e[n],t[n])!==0)return!1;return!0}function ra({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],s=r.reduce((u,h)=>u+h,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(u=>`${u}%`).join(", ")}`);if(!nr(s,100)&&r.length>0)for(let u=0;u<t.length;u++){const h=r[u];Mt(h!=null,`No layout data found for index ${u}`);const d=100/s*h;r[u]=d}let a=0;for(let u=0;u<t.length;u++){const h=n[u];Mt(h!=null,`No layout data found for index ${u}`);const d=r[u];Mt(d!=null,`No layout data found for index ${u}`);const m=vl({overrideDisabledPanels:!0,panelConstraints:t[u],prevSize:h,size:d});d!=m&&(a+=d-m,r[u]=m)}if(!nr(a,0))for(let u=0;u<t.length;u++){const h=r[u];Mt(h!=null,`No layout data found for index ${u}`);const d=h+a,m=vl({overrideDisabledPanels:!0,panelConstraints:t[u],prevSize:h,size:d});if(h!==m&&(a-=m-h,r[u]=m,nr(a,0)))break}const l=Object.keys(e);return r.reduce((u,h,d)=>(u[l[d]]=h,u),{})}function d5({groupId:e,panelId:t}){const n=()=>{const u=ma();for(const[h,{defaultLayoutDeferred:d,derivedPanelConstraints:m,layout:g,groupSize:_,separatorToPanels:b}]of u)if(h.id===e)return{defaultLayoutDeferred:d,derivedPanelConstraints:m,group:h,groupSize:_,layout:g,separatorToPanels:b};throw Error(`Group ${e} not found`)},r=()=>{const u=n().derivedPanelConstraints.find(h=>h.panelId===t);if(u!==void 0)return u;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const u=n().group.panels.find(h=>h.id===t);if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const u=n().layout[t];if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},l=u=>{const h=a();if(u===h)return;const{defaultLayoutDeferred:d,derivedPanelConstraints:m,group:g,groupSize:_,layout:b,separatorToPanels:w}=n(),S=g.panels.findIndex(R=>R.id===t),C=S===g.panels.length-1,k=$u({delta:C?h-u:u-h,initialLayout:b,panelConstraints:m,pivotIndices:C?[S-1,S]:[S,S+1],prevLayout:b,trigger:"imperative-api"}),T=ra({layout:k,panelConstraints:m});na(b,T)||gs(g,{defaultLayoutDeferred:d,derivedPanelConstraints:m,groupSize:_,layout:T,separatorToPanels:w})};return{collapse:()=>{const{collapsible:u,collapsedSize:h}=r(),{mutableValues:d}=s(),m=a();u&&m!==h&&(d.expandToSize=m,l(h))},expand:()=>{const{collapsible:u,collapsedSize:h,minSize:d}=r(),{mutableValues:m}=s(),g=a();if(u&&g===h){let _=m.expandToSize??d;_===0&&(_=1),l(_)}},getSize:()=>{const{group:u}=n(),h=a(),{element:d}=s(),m=u.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:h,inPixels:m}},isCollapsed:()=>{const{collapsible:u,collapsedSize:h}=r(),d=a();return u&&nr(h,d)},resize:u=>{const{group:h}=n(),{element:d}=s(),m=Dl({group:h}),g=lu({groupSize:m,panelElement:d,styleProp:u}),_=gr(g/m*100);l(_)}}}function Rk(e){if(e.defaultPrevented)return;const t=ma();H0(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(r){const s=r.panelConstraints.defaultSize,a=d5({groupId:n.group.id,panelId:r.id});a&&s!==void 0&&(a.resize(s),e.preventDefault())}}})}function yf(e){const t=ma();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 h5({groupId:e}){const t=()=>{const n=ma();for(const[r,s]of n)if(r.id===e)return{group:r,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:s,group:a,groupSize:l,layout:u,separatorToPanels:h}=t(),d=ra({layout:n,panelConstraints:s});return r?u:(na(u,d)||gs(a,{defaultLayoutDeferred:r,derivedPanelConstraints:s,groupSize:l,layout:d,separatorToPanels:h}),d)}}}function Fo(e,t){const n=yf(e),r=ao(n.id,!0),s=n.separators.find(m=>m.element===e);Mt(s,"Matching separator not found");const a=r.separatorToPanels.get(s);Mt(a,"Matching panels not found");const l=a.map(m=>n.panels.indexOf(m)),u=h5({groupId:n.id}).getLayout(),h=$u({delta:t,initialLayout:u,panelConstraints:r.derivedPanelConstraints,pivotIndices:l,prevLayout:u,trigger:"keyboard"}),d=ra({layout:h,panelConstraints:r.derivedPanelConstraints});na(u,d)||gs(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:d,separatorToPanels:r.separatorToPanels})}function Tk(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=yf(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Fo(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Fo(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Fo(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Fo(t,-5);break}case"End":{e.preventDefault(),Fo(t,100);break}case"Enter":{e.preventDefault();const r=yf(t),s=ao(r.id,!0),{derivedPanelConstraints:a,layout:l,separatorToPanels:u}=s,h=r.separators.find(_=>_.element===t);Mt(h,"Matching separator not found");const d=u.get(h);Mt(d,"Matching panels not found");const m=d[0],g=a.find(_=>_.panelId===m.id);if(Mt(g,"Panel metadata not found"),g.collapsible){const _=l[m.id],b=g.collapsedSize===_?r.mutableState.expandedPanelSizes[m.id]??g.minSize:g.collapsedSize;Fo(t,b-_)}break}case"F6":{e.preventDefault();const r=yf(t).separators.map(l=>l.element),s=Array.from(r).findIndex(l=>l===e.currentTarget);Mt(s!==null,"Index not found");const a=e.shiftKey?s>0?s-1:r.length-1:s+1<r.length?s+1:0;r[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Fo(t,-100);break}}}let kl={cursorFlags:0,state:"inactive"};const F0=new l5;function ia(){return kl}function eX(e){return F0.addListener("change",e)}function tX(e){const t=kl,n={...kl};n.cursorFlags=e,kl=n,F0.emit("change",{prev:t,next:n})}function El(e){const t=kl;kl=e,F0.emit("change",{prev:t,next:e})}function Mk(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ma(),n=H0(e,t),r=new Map;let s=!1;n.forEach(a=>{a.separator&&(s||(s=!0,a.separator.element.focus({preventScroll:!0})));const l=t.get(a.group);l&&r.set(a.group,l.layout)}),El({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const nX=e=>e,t_=()=>{},f5=1,p5=2,m5=4,g5=8,Nk=3,Ak=12;let Yh;function Dk(){return Yh===void 0&&(Yh=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Yh=!0)),Yh}function rX({cursorFlags:e,groups:t,state:n}){let r=0,s=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{s++;break}}})}if(!(r===0&&s===0)){switch(n){case"active":{if(e&&Dk()){const a=(e&f5)!==0,l=(e&p5)!==0,u=(e&m5)!==0,h=(e&g5)!==0;if(a)return u?"se-resize":h?"ne-resize":"e-resize";if(l)return u?"sw-resize":h?"nw-resize":"w-resize";if(u)return"s-resize";if(h)return"n-resize"}break}}return Dk()?r>0&&s>0?"move":r>0?"ew-resize":"ns-resize":r>0&&s>0?"grab":r>0?"col-resize":"row-resize"}}const Ok=new WeakMap;function U0(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Ok.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=ia();switch(r.state){case"active":case"hover":{const s=rX({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(l=>l.group),state:r.state}),a=`*, *:hover {cursor: ${s} !important; }`;if(t===a)return;t=a,s?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Ok.set(e,{prevStyle:t,styleSheet:n})}function v5({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:a,prevCursorFlags:l}){let u=0;n.forEach(d=>{const{group:m,groupSize:g}=d,{orientation:_,panels:b}=m,{disableCursor:w}=m.mutableState;let S=0;a?_==="horizontal"?S=(t.clientX-a.x)/g*100:S=(t.clientY-a.y)/g*100:_==="horizontal"?S=t.clientX<0?-100:100:S=t.clientY<0?-100:100;const C=r.get(m),k=s.get(m);if(!C||!k)return;const{defaultLayoutDeferred:T,derivedPanelConstraints:R,groupSize:M,layout:O,separatorToPanels:D}=k;if(R&&O&&D){const j=$u({delta:S,initialLayout:C,panelConstraints:R,pivotIndices:d.panels.map(F=>b.indexOf(F)),prevLayout:O,trigger:"mouse-or-touch"});if(na(j,O)){if(S!==0&&!w)switch(_){case"horizontal":{u|=S<0?f5:p5;break}case"vertical":{u|=S<0?m5:g5;break}}}else gs(d.group,{defaultLayoutDeferred:T,derivedPanelConstraints:R,groupSize:M,layout:j,separatorToPanels:D})}});let h=0;t.movementX===0?h|=l&Nk:h|=u&Nk,t.movementY===0?h|=l&Ak:h|=u&Ak,tX(h),U0(e)}function jk(e){const t=ma(),n=ia();switch(n.state){case"active":v5({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Lk(e){if(e.defaultPrevented)return;const t=ia(),n=ma();switch(t.state){case"active":{if(e.buttons===0){El({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const s=ao(r.group.id,!0);gs(r.group,s)});return}v5({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=H0(e,n);r.length===0?t.state!=="inactive"&&El({cursorFlags:0,state:"inactive"}):El({cursorFlags:0,hitRegions:r,state:"hover"}),U0(e.currentTarget);break}}}function zk(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ia().state){case"hover":El({cursorFlags:0,state:"inactive"})}}function Pk(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ia();switch(t.state){case"active":El({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(U0(e.currentTarget),t.hitRegions.forEach(n=>{const r=ao(n.group.id,!0);gs(n.group,r)}),e.preventDefault())}}function Bk(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const l=gr(a.defaultSize);n+=l,r[a.panelId]=l}else r[a.panelId]=void 0;const s=e.length-t;if(s!==0){const a=gr((100-n)/s);for(const l of e)l.defaultSize===void 0&&(r[l.panelId]=a)}return r}function iX(e,t,n){if(!n[0])return;const r=e.panels.find(h=>h.element===t);if(!r||!r.onResize)return;const s=Dl({group:e}),a=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,u={asPercentage:gr(a/s*100),inPixels:a};r.mutableValues.prevSize=u,r.onResize(u,r.id,l)}function sX(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 oX({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let s=0,a=0,l=!1;const u=new Map,h=[];for(const g of e.panels){const _=r[g.id]??0;switch(g.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const b=_/100*n,w=gr(b/t*100);u.set(g.id,w),s+=w;break}case"preserve-relative-size":default:{h.push(g.id),a+=_;break}}}if(!l||h.length===0)return r;const d=100-s,m={...r};if(u.forEach((g,_)=>{m[_]=g}),a>0)for(const g of h){const _=r[g]??0;m[g]=gr(_/a*d)}else{const g=gr(d/h.length);for(const _ of h)m[_]=g}return m}function aX(e,t){const n=e.map(s=>s.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n)if(!r.includes(s))return!1;return!0}const ll=new Map;function lX(e){let t=!0;Mt(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,s=new Set,a=new n(w=>{for(const S of w){const{borderBoxSize:C,target:k}=S;if(k===e.element){if(t){const T=Dl({group:e});if(T===0)return;const R=ao(e.id);if(!R)return;const M=ly(e),O=R.defaultLayoutDeferred?Bk(M):R.layout,D=oX({group:e,nextGroupSize:T,prevGroupSize:R.groupSize,prevLayout:O}),j=ra({layout:D,panelConstraints:M});if(!R.defaultLayoutDeferred&&na(R.layout,j)&&sX(R.derivedPanelConstraints,M)&&R.groupSize===T)return;gs(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:M,groupSize:T,layout:j,separatorToPanels:R.separatorToPanels})}}else iX(e,k,C)}});a.observe(e.element),e.panels.forEach(w=>{Mt(!r.has(w.id),`Panel ids must be unique; id "${w.id}" was used more than once`),r.add(w.id),w.onResize&&a.observe(w.element)});const l=Dl({group:e}),u=ly(e),h=e.panels.map(({id:w})=>w).join(",");let d=e.mutableState.defaultLayout;d&&(aX(e.panels,d)||(d=void 0));const m=e.mutableState.layouts[h]??d??Bk(u),g=ra({layout:m,panelConstraints:u}),_=e.element.ownerDocument;ll.set(_,(ll.get(_)??0)+1);const b=new Map;return a5(e).forEach(w=>{w.separator&&b.set(w.separator,w.panels)}),gs(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:u,groupSize:l,layout:g,separatorToPanels:b}),e.separators.forEach(w=>{Mt(!s.has(w.id),`Separator ids must be unique; id "${w.id}" was used more than once`),s.add(w.id),w.element.addEventListener("keydown",Tk)}),ll.get(_)===1&&(_.addEventListener("dblclick",Rk,!0),_.addEventListener("pointerdown",Mk,!0),_.addEventListener("pointerleave",jk),_.addEventListener("pointermove",Lk),_.addEventListener("pointerout",zk),_.addEventListener("pointerup",Pk,!0)),function(){t=!1,ll.set(_,Math.max(0,(ll.get(_)??0)-1)),WY(e),e.separators.forEach(w=>{w.element.removeEventListener("keydown",Tk)}),ll.get(_)||(_.removeEventListener("dblclick",Rk,!0),_.removeEventListener("pointerdown",Mk,!0),_.removeEventListener("pointerleave",jk),_.removeEventListener("pointermove",Lk),_.removeEventListener("pointerout",zk),_.removeEventListener("pointerup",Pk,!0)),a.disconnect()}}function cX(){const[e,t]=y.useState({}),n=y.useCallback(()=>t({}),[]);return[e,n]}function $0(e){const t=y.useId();return`${e??t}`}const ga=typeof window<"u"?y.useLayoutEffect:y.useEffect;function Ru(e){const t=y.useRef(e);return ga(()=>{t.current=e},[e]),y.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function W0(...e){return Ru(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function V0(e){const t=y.useRef({...e});return ga(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const _5=y.createContext(null);function uX(e,t){const n=y.useRef({getLayout:()=>({}),setLayout:nX});y.useImperativeHandle(t,()=>n.current,[]),ga(()=>{Object.assign(n.current,h5({groupId:e}))})}function y5({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:s,elementRef:a,groupRef:l,id:u,onLayoutChange:h,onLayoutChanged:d,orientation:m="horizontal",resizeTargetMinimumSize:g={coarse:20,fine:10},style:_,...b}){const w=y.useRef({onLayoutChange:{},onLayoutChanged:{}}),S=Ru(H=>{na(w.current.onLayoutChange,H)||(w.current.onLayoutChange=H,h==null||h(H))}),C=Ru(H=>{na(w.current.onLayoutChanged,H)||(w.current.onLayoutChanged=H,d==null||d(H))}),k=$0(u),T=y.useRef(null),[R,M]=cX(),O=y.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:g,separators:[]}),D=W0(T,a);uX(k,l);const j=Ru((H,P)=>{const U=ia(),q=Sk(H),W=ao(H);if(W){let z=!1;switch(U.state){case"active":{z=U.hitRegions.some($=>$.group===q);break}}return{flexGrow:W.layout[P]??1,pointerEvents:z?"none":void 0}}return{flexGrow:(n==null?void 0:n[P])??1}}),F=V0({defaultLayout:n,disableCursor:r}),G=y.useMemo(()=>({get disableCursor(){return!!F.disableCursor},getPanelStyles:j,id:k,orientation:m,registerPanel:H=>{const P=O.current;return P.panels=cy(m,[...P.panels,H]),M(),()=>{P.panels=P.panels.filter(U=>U!==H),M()}},registerSeparator:H=>{const P=O.current;return P.separators=cy(m,[...P.separators,H]),M(),()=>{P.separators=P.separators.filter(U=>U!==H),M()}},togglePanelDisabled:(H,P)=>{const U=O.current.panels.find(z=>z.id===H);U&&(U.panelConstraints.disabled=P);const q=Sk(k),W=ao(k);q&&W&&gs(q,{...W,derivedPanelConstraints:ly(q)})},toggleSeparatorDisabled:(H,P)=>{const U=O.current.separators.find(q=>q.id===H);U&&(U.disabled=P)}}),[j,k,M,m,F]),B=y.useRef(null);return ga(()=>{const H=T.current;if(H===null)return;const P=O.current;let U;if(F.defaultLayout!==void 0&&Object.keys(F.defaultLayout).length===P.panels.length){U={};for(const N of P.panels){const I=F.defaultLayout[N.id];I!==void 0&&(U[N.id]=I)}}const q={disabled:!!s,element:H,id:k,mutableState:{defaultLayout:U,disableCursor:!!F.disableCursor,expandedPanelSizes:O.current.lastExpandedPanelSizes,layouts:O.current.layouts},orientation:m,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};B.current=q;const W=lX(q),{defaultLayoutDeferred:z,derivedPanelConstraints:$,layout:V}=ao(q.id,!0);!z&&$.length>0&&(S(V),C(V));const Q=I0(k,N=>{const{defaultLayoutDeferred:I,derivedPanelConstraints:Z,layout:L}=N.next;if(I||Z.length===0)return;const de=q.panels.map(({id:ue})=>ue).join(",");q.mutableState.layouts[de]=L,Z.forEach(ue=>{if(ue.collapsible){const{layout:he}=N.prev??{};if(he){const we=nr(ue.collapsedSize,L[ue.panelId]),le=nr(ue.collapsedSize,he[ue.panelId]);we&&!le&&(q.mutableState.expandedPanelSizes[ue.panelId]=he[ue.panelId])}}});const me=ia().state!=="active";S(L),me&&C(L)});return()=>{B.current=null,W(),Q()}},[s,k,C,S,m,R,F]),y.useEffect(()=>{const H=B.current;H&&(H.mutableState.defaultLayout=n,H.mutableState.disableCursor=!!r)}),p.jsx(_5.Provider,{value:G,children:p.jsx("div",{...b,className:t,"data-group":!0,"data-testid":k,id:k,ref:D,style:{height:"100%",width:"100%",overflow:"hidden",..._,display:"flex",flexDirection:m==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:m==="horizontal"?"pan-y":"pan-x"},children:e})})}y5.displayName="Group";function q0(){const e=y.useContext(_5);return Mt(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function dX(e,t){const{id:n}=q0(),r=y.useRef({collapse:t_,expand:t_,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:t_});y.useImperativeHandle(t,()=>r.current,[]),ga(()=>{Object.assign(r.current,d5({groupId:n,panelId:e}))})}function b5({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:s,disabled:a,elementRef:l,groupResizeBehavior:u="preserve-relative-size",id:h,maxSize:d="100%",minSize:m="0%",onResize:g,panelRef:_,style:b,...w}){const S=!!h,C=$0(h),k=V0({disabled:a}),T=y.useRef(null),R=W0(T,l),{getPanelStyles:M,id:O,orientation:D,registerPanel:j,togglePanelDisabled:F}=q0(),G=g!==null,B=Ru((P,U,q)=>{g==null||g(P,h,q)});ga(()=>{const P=T.current;if(P!==null){const U={element:P,id:C,idIsStable:S,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:G?B:void 0,panelConstraints:{groupResizeBehavior:u,collapsedSize:n,collapsible:r,defaultSize:s,disabled:k.disabled,maxSize:d,minSize:m}};return j(U)}},[u,n,r,s,G,C,S,d,m,B,j,k]),y.useEffect(()=>{F(C,!!a)},[a,C,F]),dX(C,_);const H=y.useSyncExternalStore(P=>I0(O,P),()=>JSON.stringify(M(O,C)),()=>JSON.stringify(M(O,C)));return p.jsx("div",{...w,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":C,id:C,ref:R,style:{...hX,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(H)},children:p.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...b,touchAction:D==="horizontal"?"pan-y":"pan-x"},children:e})})}b5.displayName="Panel";const hX={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function fX({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let s,a;const l=e[n],u=t.find(h=>h.panelId===n);if(u){const h=u.maxSize,d=u.collapsible?u.collapsedSize:u.minSize,m=[r,r+1];a=ra({layout:$u({delta:d-l,initialLayout:e,panelConstraints:t,pivotIndices:m,prevLayout:e}),panelConstraints:t})[n],s=ra({layout:$u({delta:h-l,initialLayout:e,panelConstraints:t,pivotIndices:m,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:a,valueNow:l}}function x5({children:e,className:t,disabled:n,elementRef:r,id:s,style:a,...l}){const u=$0(s),h=V0({disabled:n}),[d,m]=y.useState({}),[g,_]=y.useState("inactive"),b=y.useRef(null),w=W0(b,r),{disableCursor:S,id:C,orientation:k,registerSeparator:T,toggleSeparatorDisabled:R}=q0(),M=k==="horizontal"?"vertical":"horizontal";ga(()=>{const D=b.current;if(D!==null){const j={disabled:h.disabled,element:D,id:u},F=T(j),G=eX(H=>{_(H.next.state!=="inactive"&&H.next.hitRegions.some(P=>P.separator===j)?H.next.state:"inactive")}),B=I0(C,H=>{const{derivedPanelConstraints:P,layout:U,separatorToPanels:q}=H.next,W=q.get(j);if(W){const z=W[0],$=W.indexOf(z);m(fX({layout:U,panelConstraints:P,panelId:z.id,panelIndex:$}))}});return()=>{G(),B(),F()}}},[C,u,T,h]),y.useEffect(()=>{R(u,!!n)},[n,u,R]);let O;return n&&!S&&(O="not-allowed"),p.jsx("div",{...l,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":M,"aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":n?"disabled":g,"data-testid":u,id:u,ref:w,role:"separator",style:{flexBasis:"auto",cursor:O,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}x5.displayName="Separator";const bf=({className:e,...t})=>p.jsx(y5,{className:be("flex h-full w-full",e),...t}),Wo=e=>p.jsx(b5,{...e}),xf=({withHandle:e,orientation:t,disabled:n,className:r,...s})=>p.jsx(x5,{disabled:n,className:be("relative flex items-center justify-center bg-transparent focus-visible:outline-none",t==="vertical"?"h-2 w-full -my-1 cursor-row-resize before:absolute before:inset-x-0 before:top-1/2 before:h-0.5 before:-translate-y-1/2 before:bg-border":"h-full w-2 -mx-1 cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-border",r),...s,children:p.jsx("span",{className:"sr-only",children:t==="vertical"?"Resize rows":"Resize columns"})});/**
558
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
559
+ * @license MIT
560
+ *
561
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
562
+ * @license MIT
563
+ *
564
+ * Originally forked from (with the author's permission):
565
+ * Fabrice Bellard's javascript vt100 for jslinux:
566
+ * http://bellard.org/jslinux/
567
+ * Copyright (c) 2011 Fabrice Bellard
568
+ */var kn=0,En=0,Rn=0,Gt=0,Vn;(e=>{function t(s,a,l,u){return u!==void 0?`#${Uo(s)}${Uo(a)}${Uo(l)}${Uo(u)}`:`#${Uo(s)}${Uo(a)}${Uo(l)}`}e.toCss=t;function n(s,a,l,u=255){return(s<<24|a<<16|l<<8|u)>>>0}e.toRgba=n;function r(s,a,l,u){return{css:e.toCss(s,a,l,u),rgba:e.toRgba(s,a,l,u)}}e.toColor=r})(Vn||(Vn={}));var pX;(e=>{function t(h,d){if(Gt=(d.rgba&255)/255,Gt===1)return{css:d.css,rgba:d.rgba};let m=d.rgba>>24&255,g=d.rgba>>16&255,_=d.rgba>>8&255,b=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;kn=b+Math.round((m-b)*Gt),En=w+Math.round((g-w)*Gt),Rn=S+Math.round((_-S)*Gt);let C=Vn.toCss(kn,En,Rn),k=Vn.toRgba(kn,En,Rn);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,m){let g=wf.ensureContrastRatio(h.rgba,d.rgba,m);if(g)return Vn.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=r;function s(h){let d=(h.rgba|255)>>>0;return[kn,En,Rn]=wf.toChannels(d),{css:Vn.toCss(kn,En,Rn),rgba:d}}e.opaque=s;function a(h,d){return Gt=Math.round(d*255),[kn,En,Rn]=wf.toChannels(h.rgba),{css:Vn.toCss(kn,En,Rn,Gt),rgba:Vn.toRgba(kn,En,Rn,Gt)}}e.opacity=a;function l(h,d){return Gt=h.rgba&255,a(h,Gt*d/255)}e.multiplyOpacity=l;function u(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=u})(pX||(pX={}));var In;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let a=s.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return kn=parseInt(s.slice(1,2).repeat(2),16),En=parseInt(s.slice(2,3).repeat(2),16),Rn=parseInt(s.slice(3,4).repeat(2),16),Vn.toColor(kn,En,Rn);case 5:return kn=parseInt(s.slice(1,2).repeat(2),16),En=parseInt(s.slice(2,3).repeat(2),16),Rn=parseInt(s.slice(3,4).repeat(2),16),Gt=parseInt(s.slice(4,5).repeat(2),16),Vn.toColor(kn,En,Rn,Gt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let a=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return kn=parseInt(a[1]),En=parseInt(a[2]),Rn=parseInt(a[3]),Gt=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),Vn.toColor(kn,En,Rn,Gt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[kn,En,Rn,Gt]=t.getImageData(0,0,1,1).data,Gt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Vn.toRgba(kn,En,Rn,Gt),css:s}}e.toColor=r})(In||(In={}));var Jn;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,a){let l=r/255,u=s/255,h=a/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+m*.7152+g*.0722}e.relativeLuminance2=n})(Jn||(Jn={}));var wf;(e=>{function t(l,u){if(Gt=(u&255)/255,Gt===1)return u;let h=u>>24&255,d=u>>16&255,m=u>>8&255,g=l>>24&255,_=l>>16&255,b=l>>8&255;return kn=g+Math.round((h-g)*Gt),En=_+Math.round((d-_)*Gt),Rn=b+Math.round((m-b)*Gt),Vn.toRgba(kn,En,Rn)}e.blend=t;function n(l,u,h){let d=Jn.relativeLuminance(l>>8),m=Jn.relativeLuminance(u>>8);if(as(d,m)<h){if(m<d){let b=r(l,u,h),w=as(d,Jn.relativeLuminance(b>>8));if(w<h){let S=s(l,u,h),C=as(d,Jn.relativeLuminance(S>>8));return w>C?b:S}return b}let g=s(l,u,h),_=as(d,Jn.relativeLuminance(g>>8));if(_<h){let b=r(l,u,h),w=as(d,Jn.relativeLuminance(b>>8));return _>w?g:b}return g}}e.ensureContrastRatio=n;function r(l,u,h){let d=l>>24&255,m=l>>16&255,g=l>>8&255,_=u>>24&255,b=u>>16&255,w=u>>8&255,S=as(Jn.relativeLuminance2(_,b,w),Jn.relativeLuminance2(d,m,g));for(;S<h&&(_>0||b>0||w>0);)_-=Math.max(0,Math.ceil(_*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=as(Jn.relativeLuminance2(_,b,w),Jn.relativeLuminance2(d,m,g));return(_<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=r;function s(l,u,h){let d=l>>24&255,m=l>>16&255,g=l>>8&255,_=u>>24&255,b=u>>16&255,w=u>>8&255,S=as(Jn.relativeLuminance2(_,b,w),Jn.relativeLuminance2(d,m,g));for(;S<h&&(_<255||b<255||w<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=as(Jn.relativeLuminance2(_,b,w),Jn.relativeLuminance2(d,m,g));return(_<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=s;function a(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=a})(wf||(wf={}));function Uo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function as(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var mX=Object.freeze((()=>{let e=[In.toColor("#2e3436"),In.toColor("#cc0000"),In.toColor("#4e9a06"),In.toColor("#c4a000"),In.toColor("#3465a4"),In.toColor("#75507b"),In.toColor("#06989a"),In.toColor("#d3d7cf"),In.toColor("#555753"),In.toColor("#ef2929"),In.toColor("#8ae234"),In.toColor("#fce94f"),In.toColor("#729fcf"),In.toColor("#ad7fa8"),In.toColor("#34e2e2"),In.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],a=t[n%6];e.push({css:Vn.toCss(r,s,a),rgba:Vn.toRgba(r,s,a)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Vn.toCss(r,r,r),rgba:Vn.toRgba(r,r,r)})}return e})());function Ik(e,t,n){return Math.max(t,Math.min(e,n))}function gX(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var w5=class{constructor(t){this._buffer=t}serialize(t,n){let r=this._buffer.getNullCell(),s=this._buffer.getNullCell(),a=r,l=t.start.y,u=t.end.y,h=t.start.x,d=t.end.x;this._beforeSerialize(u-l,l,u);for(let m=l;m<=u;m++){let g=this._buffer.getLine(m);if(g){let _=m===t.start.y?h:0,b=m===t.end.y?d:g.length;for(let w=_;w<b;w++){let S=g.getCell(w,a===r?s:r);if(!S){console.warn(`Can't get cell at row=${m}, col=${w}`);continue}this._nextCell(S,a,m,w),a=S}}this._rowEnd(m,m===u)}return this._afterSerialize(),this._serializeString(n)}_nextCell(t,n,r,s){}_rowEnd(t,n){}_beforeSerialize(t,n,r){}_afterSerialize(){}_serializeString(t){return""}};function S5(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function cs(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function C5(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 vX=class extends w5{constructor(t,n){super(t),this._terminal=n,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,n,r){this._allRows=new Array(t),this._lastContentCursorRow=n,this._lastCursorRow=n,this._firstRow=n}_rowEnd(t,n){var s;this._nullCellCount>0&&!cs(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let r="";if(!n){t-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let a=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(!l.isWrapped)r=`\r
569
+ `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{r="";let u=a.getCell(a.length-1,this._thisRowLastChar),h=a.getCell(a.length-2,this._thisRowLastSecondChar),d=l.getCell(0,this._nextRowFirstChar),m=d.getWidth()>1,g=!1;(d.getChars()&&m?this._nullCellCount<=1:this._nullCellCount<=0)&&((u.getChars()||u.getWidth()===0)&&cs(u,d)&&(g=!0),m&&(h.getChars()||h.getWidth()===0)&&cs(u,d)&&cs(h,d)&&(g=!0)),g||(r="-".repeat(this._nullCellCount+1),r+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(r+="\x1B[A",r+=`\x1B[${a.length-this._nullCellCount}C`,r+=`\x1B[${this._nullCellCount}X`,r+=`\x1B[${a.length-this._nullCellCount}D`,r+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=r,this._currentRow="",this._nullCellCount=0}_diffStyle(t,n){let r=[],s=!S5(t,n),a=!cs(t,n),l=!C5(t,n);if(s||a||l)if(t.isAttributeDefault())n.isAttributeDefault()||r.push(0);else{if(s){let u=t.getFgColor();t.isFgRGB()?r.push(38,2,u>>>16&255,u>>>8&255,u&255):t.isFgPalette()?u>=16?r.push(38,5,u):r.push(u&8?90+(u&7):30+(u&7)):r.push(39)}if(a){let u=t.getBgColor();t.isBgRGB()?r.push(48,2,u>>>16&255,u>>>8&255,u&255):t.isBgPalette()?u>=16?r.push(48,5,u):r.push(u&8?100+(u&7):40+(u&7)):r.push(49)}l&&(t.isInverse()!==n.isInverse()&&r.push(t.isInverse()?7:27),t.isBold()!==n.isBold()&&r.push(t.isBold()?1:22),t.isUnderline()!==n.isUnderline()&&r.push(t.isUnderline()?4:24),t.isOverline()!==n.isOverline()&&r.push(t.isOverline()?53:55),t.isBlink()!==n.isBlink()&&r.push(t.isBlink()?5:25),t.isInvisible()!==n.isInvisible()&&r.push(t.isInvisible()?8:28),t.isItalic()!==n.isItalic()&&r.push(t.isItalic()?3:23),t.isDim()!==n.isDim()&&r.push(t.isDim()?2:22),t.isStrikethrough()!==n.isStrikethrough()&&r.push(t.isStrikethrough()?9:29))}return r}_nextCell(t,n,r,s){if(t.getWidth()===0)return;let a=t.getChars()==="",l=this._diffStyle(t,this._cursorStyle);if(a?!cs(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(cs(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${l.join(";")}m`;let u=this._buffer.getLine(r);u!==void 0&&(u.getCell(s,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=s)}a?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(cs(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s+t.getWidth())}_serializeString(t){let n=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(n=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let r="";for(let l=0;l<n;l++)r+=this._allRows[l],l+1<n&&(r+=this._allRowSeparators[l]);if(!t){let l=this._buffer.baseY+this._buffer.cursorY,u=this._buffer.cursorX,h=l!==this._lastCursorRow||u!==this._lastCursorCol,d=m=>{m>0?r+=`\x1B[${m}C`:m<0&&(r+=`\x1B[${-m}D`)};h&&((m=>{m>0?r+=`\x1B[${m}B`:m<0&&(r+=`\x1B[${-m}A`)})(l-this._lastCursorRow),d(u-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,a=this._diffStyle(s,this._cursorStyle);return a.length>0&&(r+=`\x1B[${a.join(";")}m`),r}},_X=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,n,r){let s=n.length,a=r===void 0?s:Ik(r+t.rows,0,s);return this._serializeBufferByRange(t,n,{start:s-a,end:s-1},!1)}_serializeBufferByRange(t,n,r,s){return new vX(n,t).serialize({start:{x:0,y:typeof r.start=="number"?r.start:r.start.line},end:{x:t.cols,y:typeof r.end=="number"?r.end:r.end.line}},s)}_serializeBufferAsHTML(t,n){var h;let r=t.buffer.active,s=new yX(r,t,n),a=n.onlySelection??!1,l=n.range;if(l)return s.serialize({start:{x:l.startCol,y:(l.startLine,l.startLine)},end:{x:t.cols,y:(l.endLine,l.endLine)}});if(!a){let d=r.length,m=n.scrollback,g=m===void 0?d:Ik(m+t.rows,0,d);return s.serialize({start:{x:0,y:d-g},end:{x:t.cols,y:d-1}})}let u=(h=this._terminal)==null?void 0:h.getSelectionPosition();return u!==void 0?s.serialize({start:{x:u.start.x,y:u.start.y},end:{x:u.end.x,y:u.end.y}}):""}_serializeModes(t){let n="",r=t.modes;if(r.applicationCursorKeysMode&&(n+="\x1B[?1h"),r.applicationKeypadMode&&(n+="\x1B[?66h"),r.bracketedPasteMode&&(n+="\x1B[?2004h"),r.insertMode&&(n+="\x1B[4h"),r.originMode&&(n+="\x1B[?6h"),r.reverseWraparoundMode&&(n+="\x1B[?45h"),r.sendFocusMode&&(n+="\x1B[?1004h"),r.wraparoundMode===!1&&(n+="\x1B[?7l"),r.mouseTrackingMode!=="none")switch(r.mouseTrackingMode){case"x10":n+="\x1B[?9h";break;case"vt200":n+="\x1B[?1000h";break;case"drag":n+="\x1B[?1002h";break;case"any":n+="\x1B[?1003h";break}return n}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let n=t!=null&&t.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t==null?void 0:t.scrollback);if(!(t!=null&&t.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let r=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);n+=`\x1B[?1049h\x1B[H${r}`}return t!=null&&t.excludeModes||(n+=this._serializeModes(this._terminal)),n}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t||{})}dispose(){}},yX=class extends w5{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=mX}_padStart(t,n,r){return n=n>>0,r=r??" ",t.length>n?t:(n-=t.length,n>r.length&&(r+=r.repeat(n/r.length)),r.slice(0,n)+t)}_beforeSerialize(t,n,r){var u,h;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",a="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((u=this._terminal.options.theme)==null?void 0:u.foreground)??"#ffffff",a=((h=this._terminal.options.theme)==null?void 0:h.background)??"#000000");let l=[];l.push("color: "+s+";"),l.push("background-color: "+a+";"),l.push("font-family: "+this._terminal.options.fontFamily+";"),l.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+l.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,n){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,n){let r=n?t.getFgColor():t.getBgColor();if(n?t.isFgRGB():t.isBgRGB())return"#"+[r>>16&255,r>>8&255,r&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(n?t.isFgPalette():t.isBgPalette())return this._ansiColors[r].css}_diffStyle(t,n){let r=[],s=!S5(t,n),a=!cs(t,n),l=!C5(t,n);if(s||a||l){let u=this._getHexColor(t,!0);u&&r.push("color: "+u+";");let h=this._getHexColor(t,!1);return h&&r.push("background-color: "+h+";"),t.isInverse()&&r.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&r.push("font-weight: bold;"),t.isUnderline()&&t.isOverline()?r.push("text-decoration: overline underline;"):t.isUnderline()?r.push("text-decoration: underline;"):t.isOverline()&&r.push("text-decoration: overline;"),t.isBlink()&&r.push("text-decoration: blink;"),t.isInvisible()&&r.push("visibility: hidden;"),t.isItalic()&&r.push("font-style: italic;"),t.isDim()&&r.push("opacity: 0.5;"),t.isStrikethrough()&&r.push("text-decoration: line-through;"),r}}_nextCell(t,n,r,s){if(t.getWidth()===0)return;let a=t.getChars()==="",l=this._diffStyle(t,n);l&&(this._currentRow+=l.length===0?"</span><span>":"</span><span style='"+l.join(" ")+"'>"),a?this._currentRow+=" ":this._currentRow+=gX(t.getChars())}_serializeString(){return this._htmlContent}};/**
570
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
571
+ * @license MIT
572
+ *
573
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
574
+ * @license MIT
575
+ *
576
+ * Originally forked from (with the author's permission):
577
+ * Fabrice Bellard's javascript vt100 for jslinux:
578
+ * http://bellard.org/jslinux/
579
+ * Copyright (c) 2011 Fabrice Bellard
580
+ */var bX=class{constructor(t,n,r,s={}){this._terminal=t,this._regex=n,this._handler=r,this._options=s}provideLinks(t,n){let r=wX.computeLink(t,this._regex,this._terminal,this._handler);n(this._addCallbacks(r))}_addCallbacks(t){return t.map(n=>(n.leave=this._options.leave,n.hover=(r,s)=>{if(this._options.hover){let{range:a}=n;this._options.hover(r,s,a)}},n))}};function xX(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 wX=class Sf{static computeLink(t,n,r,s){let a=new RegExp(n.source,(n.flags||"")+"g"),[l,u]=Sf._getWindowedLineStrings(t-1,r),h=l.join(""),d,m=[];for(;d=a.exec(h);){let g=d[0];if(!xX(g))continue;let[_,b]=Sf._mapStrIdx(r,u,0,d.index),[w,S]=Sf._mapStrIdx(r,_,b,g.length);if(_===-1||b===-1||w===-1||S===-1)continue;let C={start:{x:b+1,y:_+1},end:{x:S,y:w+1}};m.push({range:C,text:g,activate:s})}return m}static _getWindowedLineStrings(t,n){let r,s=t,a=t,l=0,u="",h=[];if(r=n.buffer.active.getLine(t)){let d=r.translateToString(!0);if(r.isWrapped&&d[0]!==" "){for(l=0;(r=n.buffer.active.getLine(--s))&&l<2048&&(u=r.translateToString(!0),l+=u.length,h.push(u),!(!r.isWrapped||u.indexOf(" ")!==-1)););h.reverse()}for(h.push(d),l=0;(r=n.buffer.active.getLine(++a))&&r.isWrapped&&l<2048&&(u=r.translateToString(!0),l+=u.length,h.push(u),u.indexOf(" ")===-1););}return[h,s]}static _mapStrIdx(t,n,r,s){let a=t.buffer.active,l=a.getNullCell(),u=r;for(;s;){let h=a.getLine(n);if(!h)return[-1,-1];for(let d=u;d<h.length;++d){h.getCell(d,l);let m=l.getChars();if(l.getWidth()&&(s-=m.length||1,d===h.length-1&&m==="")){let g=a.getLine(n+1);g&&g.isWrapped&&(g.getCell(0,l),l.getWidth()===2&&(s+=1))}if(s<0)return[n,d]}n++,u=0}return[n,u]}},SX=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function CX(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 kX=class{constructor(t=CX,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||SX;this._linkProvider=this._terminal.registerLinkProvider(new bX(this._terminal,r,this._handler,n))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
581
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
582
+ * @license MIT
583
+ *
584
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
585
+ * @license MIT
586
+ *
587
+ * Originally forked from (with the author's permission):
588
+ * Fabrice Bellard's javascript vt100 for jslinux:
589
+ * http://bellard.org/jslinux/
590
+ * Copyright (c) 2011 Fabrice Bellard
591
+ */var k5=Object.defineProperty,EX=Object.getOwnPropertyDescriptor,RX=(e,t)=>{for(var n in t)k5(e,n,{get:t[n],enumerable:!0})},Xt=(e,t,n,r)=>{for(var s=r>1?void 0:r?EX(t,n):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(r?l(t,n,s):l(s))||s);return r&&s&&k5(t,n,s),s},Me=(e,t)=>(n,r)=>t(n,r,e),Hk="Terminal input",uy={get:()=>Hk,set:e=>Hk=e},Fk="Too much output to announce, navigate to rows manually to read",dy={get:()=>Fk,set:e=>Fk=e};function TX(e){return e.replace(/\r?\n/g,"\r")}function MX(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function NX(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function AX(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");E5(s,t,n,r)}}function E5(e,t,n,r){e=TX(e),e=MX(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function R5(e,t,n){let r=n.getBoundingClientRect(),s=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function Uk(e,t,n,r,s){R5(e,t,n),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function no(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Wp(e,t=0,n=e.length){let r="";for(let s=t;s<n;++s){let a=e[s];a>65535?(a-=65536,r+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):r+=String.fromCharCode(a)}return r}var DX=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s=0;if(this._interim){let a=e.charCodeAt(s++);56320<=a&&a<=57343?t[r++]=(this._interim-55296)*1024+a-56320+65536:(t[r++]=this._interim,t[r++]=a),this._interim=0}for(let a=s;a<n;++a){let l=e.charCodeAt(a);if(55296<=l&&l<=56319){if(++a>=n)return this._interim=l,r;let u=e.charCodeAt(a);56320<=u&&u<=57343?t[r++]=(l-55296)*1024+u-56320+65536:(t[r++]=l,t[r++]=u);continue}l!==65279&&(t[r++]=l)}return r}},OX=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s,a,l,u,h=0,d=0;if(this.interim[0]){let _=!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--,_=!0;break}else this.interim[w++]=S,b<<=6,b|=S&63}_||(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 m=n-4,g=d;for(;g<n;){for(;g<m&&!((s=e[g])&128)&&!((a=e[g+1])&128)&&!((l=e[g+2])&128)&&!((u=e[g+3])&128);)t[r++]=s,t[r++]=a,t[r++]=l,t[r++]=u,g+=4;if(s=e[g++],s<128)t[r++]=s;else if((s&224)===192){if(g>=n)return this.interim[0]=s,r;if(a=e[g++],(a&192)!==128){g--;continue}if(h=(s&31)<<6|a&63,h<128){g--;continue}t[r++]=h}else if((s&240)===224){if(g>=n)return this.interim[0]=s,r;if(a=e[g++],(a&192)!==128){g--;continue}if(g>=n)return this.interim[0]=s,this.interim[1]=a,r;if(l=e[g++],(l&192)!==128){g--;continue}if(h=(s&15)<<12|(a&63)<<6|l&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((s&248)===240){if(g>=n)return this.interim[0]=s,r;if(a=e[g++],(a&192)!==128){g--;continue}if(g>=n)return this.interim[0]=s,this.interim[1]=a,r;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=n)return this.interim[0]=s,this.interim[1]=a,this.interim[2]=l,r;if(u=e[g++],(u&192)!==128){g--;continue}if(h=(s&7)<<18|(a&63)<<12|(l&63)<<6|u&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},T5="",oo=" ",fd=class M5{constructor(){this.fg=0,this.bg=0,this.extended=new np}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 M5;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}},np=class N5{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 N5(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Jr=class A5 extends fd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new np,this.combinedData=""}static fromCharData(t){let n=new A5;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?no(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},$k="di$target",hy="di$dependencies",n_=new Map;function jX(e){return e[hy]||[]}function An(e){if(n_.has(e))return n_.get(e);let t=function(n,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");LX(t,n,s)};return t._id=e,n_.set(e,t),t}function LX(e,t,n){t[$k]===t?t[hy].push({id:e,index:n}):(t[hy]=[{id:e,index:n}],t[$k]=t)}var sr=An("BufferService"),D5=An("CoreMouseService"),va=An("CoreService"),zX=An("CharsetService"),K0=An("InstantiationService"),O5=An("LogService"),or=An("OptionsService"),j5=An("OscLinkService"),PX=An("UnicodeService"),pd=An("DecorationService"),fy=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var m;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,a=new Jr,l=n.getTrimmedLength(),u=-1,h=-1,d=!1;for(let g=0;g<l;g++)if(!(h===-1&&!n.hasContent(g))){if(n.loadCell(g,a),a.hasExtendedAttrs()&&a.extended.urlId)if(h===-1){h=g,u=a.extended.urlId;continue}else d=a.extended.urlId!==u;else h!==-1&&(d=!0);if(d||h!==-1&&g===l-1){let _=(m=this._oscLinkService.getLinkData(u))==null?void 0:m.uri;if(_){let b={start:{x:h+1,y:e},end:{x:g+(!d&&g===l-1?1:0),y:e}},w=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let S=new URL(_);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||r.push({text:_,range:b,activate:(S,C)=>s?s.activate(S,C,b):BX(S,C),hover:(S,C)=>{var k;return(k=s==null?void 0:s.hover)==null?void 0:k.call(s,S,C,b)},leave:(S,C)=>{var k;return(k=s==null?void 0:s.leave)==null?void 0:k.call(s,S,C,b)}})}d=!1,a.hasExtendedAttrs()&&a.extended.urlId?(h=g,u=a.extended.urlId):(h=-1,u=-1)}}t(r)}};fy=Xt([Me(0,sr),Me(1,or),Me(2,j5)],fy);function BX(e,t){if(confirm(`Do you want to navigate to ${t}?
592
+
593
+ 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 Vp=An("CharSizeService"),xs=An("CoreBrowserService"),G0=An("MouseService"),ws=An("RenderService"),IX=An("SelectionService"),L5=An("CharacterJoinerService"),Yl=An("ThemeService"),z5=An("LinkProviderService"),HX=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Wk.isErrorNoTelemetry(e)?new Wk(e.message+`
594
+
595
+ `+e.stack):new Error(e.message+`
596
+
597
+ `+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)}},FX=new HX;function Cf(e){UX(e)||FX.onUnexpectedError(e)}var py="Canceled";function UX(e){return e instanceof $X?!0:e instanceof Error&&e.name===py&&e.message===py}var $X=class extends Error{constructor(){super(py),this.name=this.message}};function WX(e){return new Error(`Illegal argument: ${e}`)}var Wk=class my extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof my)return t;let n=new my;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},gy=class P5 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,P5.prototype)}};function Rr(e,t=0){return e[e.length-(1+t)]}var VX;(e=>{function t(a){return a<0}e.isLessThan=t;function n(a){return a<=0}e.isLessThanOrEqual=n;function r(a){return a>0}e.isGreaterThan=r;function s(a){return a===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(VX||(VX={}));function qX(e,t){let n=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(n,arguments))),s}}var B5;(e=>{function t(M){return M&&typeof M=="object"&&typeof M[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*s(M){yield M}e.single=s;function a(M){return t(M)?M:s(M)}e.wrap=a;function l(M){return M||n}e.from=l;function*u(M){for(let O=M.length-1;O>=0;O--)yield M[O]}e.reverse=u;function h(M){return!M||M[Symbol.iterator]().next().done===!0}e.isEmpty=h;function d(M){return M[Symbol.iterator]().next().value}e.first=d;function m(M,O){let D=0;for(let j of M)if(O(j,D++))return!0;return!1}e.some=m;function g(M,O){for(let D of M)if(O(D))return D}e.find=g;function*_(M,O){for(let D of M)O(D)&&(yield D)}e.filter=_;function*b(M,O){let D=0;for(let j of M)yield O(j,D++)}e.map=b;function*w(M,O){let D=0;for(let j of M)yield*O(j,D++)}e.flatMap=w;function*S(...M){for(let O of M)yield*O}e.concat=S;function C(M,O,D){let j=D;for(let F of M)j=O(j,F);return j}e.reduce=C;function*k(M,O,D=M.length){for(O<0&&(O+=M.length),D<0?D+=M.length:D>M.length&&(D=M.length);O<D;O++)yield M[O]}e.slice=k;function T(M,O=Number.POSITIVE_INFINITY){let D=[];if(O===0)return[D,M];let j=M[Symbol.iterator]();for(let F=0;F<O;F++){let G=j.next();if(G.done)return[D,e.empty()];D.push(G.value)}return[D,{[Symbol.iterator](){return j}}]}e.consume=T;async function R(M){let O=[];for await(let D of M)O.push(D);return Promise.resolve(O)}e.asyncToArray=R})(B5||(B5={}));function sa(e){if(B5.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 KX(...e){return $t(()=>sa(e))}function $t(e){return{dispose:qX(()=>{e()})}}var I5=class H5{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{sa(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?H5.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)}};I5.DISABLE_DISPOSED_WARNING=!1;var lo=I5,Qe=class{constructor(){this._store=new lo,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)}};Qe.None=Object.freeze({dispose(){}});var Ol=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}},us=typeof window=="object"?window:globalThis,vy=class _y{constructor(t){this.element=t,this.next=_y.Undefined,this.prev=_y.Undefined}};vy.Undefined=new vy(void 0);var Wt=vy,Vk=class{constructor(){this._first=Wt.Undefined,this._last=Wt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Wt.Undefined}clear(){let e=this._first;for(;e!==Wt.Undefined;){let t=e.next;e.prev=Wt.Undefined,e.next=Wt.Undefined,e=t}this._first=Wt.Undefined,this._last=Wt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Wt(e);if(this._first===Wt.Undefined)this._first=n,this._last=n;else if(t){let s=this._last;this._last=n,n.prev=s,s.next=n}else{let s=this._first;this._first=n,n.next=s,s.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Wt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Wt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Wt.Undefined&&e.next!==Wt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Wt.Undefined&&e.next===Wt.Undefined?(this._first=Wt.Undefined,this._last=Wt.Undefined):e.next===Wt.Undefined?(this._last=this._last.prev,this._last.next=Wt.Undefined):e.prev===Wt.Undefined&&(this._first=this._first.next,this._first.prev=Wt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Wt.Undefined;)yield e.element,e=e.next}},GX=globalThis.performance&&typeof globalThis.performance.now=="function",YX=class F5{static create(t){return new F5(t)}constructor(t){this._now=GX&&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}},Fn;(e=>{e.None=()=>Qe.None;function t(P,U){return g(P,()=>{},0,void 0,!0,void 0,U)}e.defer=t;function n(P){return(U,q=null,W)=>{let z=!1,$;return $=P(V=>{if(!z)return $?$.dispose():z=!0,U.call(q,V)},null,W),z&&$.dispose(),$}}e.once=n;function r(P,U,q){return d((W,z=null,$)=>P(V=>W.call(z,U(V)),null,$),q)}e.map=r;function s(P,U,q){return d((W,z=null,$)=>P(V=>{U(V),W.call(z,V)},null,$),q)}e.forEach=s;function a(P,U,q){return d((W,z=null,$)=>P(V=>U(V)&&W.call(z,V),null,$),q)}e.filter=a;function l(P){return P}e.signal=l;function u(...P){return(U,q=null,W)=>{let z=KX(...P.map($=>$(V=>U.call(q,V))));return m(z,W)}}e.any=u;function h(P,U,q,W){let z=q;return r(P,$=>(z=U(z,$),z),W)}e.reduce=h;function d(P,U){let q,W={onWillAddFirstListener(){q=P(z.fire,z)},onDidRemoveLastListener(){q==null||q.dispose()}},z=new Ce(W);return U==null||U.add(z),z.event}function m(P,U){return U instanceof Array?U.push(P):U&&U.add(P),P}function g(P,U,q=100,W=!1,z=!1,$,V){let Q,N,I,Z=0,L,de={leakWarningThreshold:$,onWillAddFirstListener(){Q=P(ue=>{Z++,N=U(N,ue),W&&!I&&(me.fire(N),N=void 0),L=()=>{let he=N;N=void 0,I=void 0,(!W||Z>1)&&me.fire(he),Z=0},typeof q=="number"?(clearTimeout(I),I=setTimeout(L,q)):I===void 0&&(I=0,queueMicrotask(L))})},onWillRemoveListener(){z&&Z>0&&(L==null||L())},onDidRemoveLastListener(){L=void 0,Q.dispose()}},me=new Ce(de);return V==null||V.add(me),me.event}e.debounce=g;function _(P,U=0,q){return e.debounce(P,(W,z)=>W?(W.push(z),W):[z],U,void 0,!0,void 0,q)}e.accumulate=_;function b(P,U=(W,z)=>W===z,q){let W=!0,z;return a(P,$=>{let V=W||!U($,z);return W=!1,z=$,V},q)}e.latch=b;function w(P,U,q){return[e.filter(P,U,q),e.filter(P,W=>!U(W),q)]}e.split=w;function S(P,U=!1,q=[],W){let z=q.slice(),$=P(N=>{z?z.push(N):Q.fire(N)});W&&W.add($);let V=()=>{z==null||z.forEach(N=>Q.fire(N)),z=null},Q=new Ce({onWillAddFirstListener(){$||($=P(N=>Q.fire(N)),W&&W.add($))},onDidAddFirstListener(){z&&(U?setTimeout(V):V())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return W&&W.add(Q),Q.event}e.buffer=S;function C(P,U){return(q,W,z)=>{let $=U(new T);return P(function(V){let Q=$.evaluate(V);Q!==k&&q.call(W,Q)},void 0,z)}}e.chain=C;let k=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(U){return this.steps.push(U),this}forEach(U){return this.steps.push(q=>(U(q),q)),this}filter(U){return this.steps.push(q=>U(q)?q:k),this}reduce(U,q){let W=q;return this.steps.push(z=>(W=U(W,z),W)),this}latch(U=(q,W)=>q===W){let q=!0,W;return this.steps.push(z=>{let $=q||!U(z,W);return q=!1,W=z,$?z:k}),this}evaluate(U){for(let q of this.steps)if(U=q(U),U===k)break;return U}}function R(P,U,q=W=>W){let W=(...Q)=>V.fire(q(...Q)),z=()=>P.on(U,W),$=()=>P.removeListener(U,W),V=new Ce({onWillAddFirstListener:z,onDidRemoveLastListener:$});return V.event}e.fromNodeEventEmitter=R;function M(P,U,q=W=>W){let W=(...Q)=>V.fire(q(...Q)),z=()=>P.addEventListener(U,W),$=()=>P.removeEventListener(U,W),V=new Ce({onWillAddFirstListener:z,onDidRemoveLastListener:$});return V.event}e.fromDOMEventEmitter=M;function O(P){return new Promise(U=>n(P)(U))}e.toPromise=O;function D(P){let U=new Ce;return P.then(q=>{U.fire(q)},()=>{U.fire(void 0)}).finally(()=>{U.dispose()}),U.event}e.fromPromise=D;function j(P,U){return P(q=>U.fire(q))}e.forward=j;function F(P,U,q){return U(q),P(W=>U(W))}e.runAndSubscribe=F;class G{constructor(U,q){this._observable=U,this._counter=0,this._hasChanged=!1;let W={onWillAddFirstListener:()=>{U.addObserver(this)},onDidRemoveLastListener:()=>{U.removeObserver(this)}};this.emitter=new Ce(W),q&&q.add(this.emitter)}beginUpdate(U){this._counter++}handlePossibleChange(U){}handleChange(U,q){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 B(P,U){return new G(P,U).emitter.event}e.fromObservable=B;function H(P){return(U,q,W)=>{let z=0,$=!1,V={beginUpdate(){z++},endUpdate(){z--,z===0&&(P.reportChanges(),$&&($=!1,U.call(q)))},handlePossibleChange(){},handleChange(){$=!0}};P.addObserver(V),P.reportChanges();let Q={dispose(){P.removeObserver(V)}};return W instanceof lo?W.add(Q):Array.isArray(W)&&W.push(Q),Q}}e.fromObservableLight=H})(Fn||(Fn={}));var yy=class by{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${by._idPool++}`,by.all.add(this)}start(t){this._stopWatch=new YX,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}}};yy.all=new Set,yy._idPool=0;var XX=yy,ZX=-1,U5=class $5{constructor(t,n,r=($5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[a,l]=this.getMostFrequentStack(),u=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(u),console.warn(a);let h=new eZ(u,a);this._errorHandler(h)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,s]of this._stacks)(!t||n<s)&&(t=[r,s],n=s);return t}};U5._idPool=1;var QX=U5,JX=class W5{constructor(t){this.value=t}static create(){let t=new Error;return new W5(t.stack??"")}print(){console.warn(this.value.split(`
598
+ `).slice(2).join(`
599
+ `))}},eZ=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},tZ=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},nZ=0,r_=class{constructor(e){this.value=e,this.id=nZ++}},rZ=2,iZ,Ce=class{constructor(e){var t,n,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new QX((e==null?void 0:e.onListenerError)??Cf,((n=this._options)==null?void 0:n.leakWarningThreshold)??ZX):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new XX(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var l,u,h,d,m;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],b=new tZ(`${g}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Cf)(b),Qe.None}if(this._disposed)return Qe.None;t&&(e=e.bind(t));let r=new r_(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=JX.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof r_?(this._deliveryQueue??(this._deliveryQueue=new sZ),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(u=this._options)==null?void 0:u.onWillAddFirstListener)==null||h.call(u,this),this._listeners=r,(m=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||m.call(d,this)),this._size++;let a=$t(()=>{s==null||s(),this._removeListener(r)});return n instanceof lo?n.add(a):Array.isArray(n)&&n.push(a),a}),this._event}_removeListener(e){var s,a,l,u;if((a=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||a.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(u=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||u.call(l,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*rZ<=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)||Cf;if(!n){e.value(t);return}try{e.value(t)}catch(s){n(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof r_)this._deliver(this._listeners,e);else{let a=this._deliveryQueue;a.enqueue(this,e,this._listeners.length),this._deliverQueue(a)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},sZ=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}},xy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Ce,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Ce,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}};xy.INSTANCE=new xy;var Y0=xy;function oZ(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Y0.INSTANCE.onDidChangeZoomLevel;function aZ(e){return Y0.INSTANCE.getZoomFactor(e)}Y0.INSTANCE.onDidChangeFullscreen;var Xl=typeof navigator=="object"?navigator.userAgent:"",wy=Xl.indexOf("Firefox")>=0,lZ=Xl.indexOf("AppleWebKit")>=0,X0=Xl.indexOf("Chrome")>=0,cZ=!X0&&Xl.indexOf("Safari")>=0;Xl.indexOf("Electron/")>=0;Xl.indexOf("Android")>=0;var i_=!1;if(typeof us.matchMedia=="function"){let e=us.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=us.matchMedia("(display-mode: fullscreen)");i_=e.matches,oZ(us,e,({matches:n})=>{i_&&t.matches||(i_=n)})}var _l="en",Sy=!1,Cy=!1,kf=!1,V5=!1,Xh,Ef=_l,qk=_l,uZ,li,Zo=globalThis,Hn,sR;typeof Zo.vscode<"u"&&typeof Zo.vscode.process<"u"?Hn=Zo.vscode.process:typeof process<"u"&&typeof((sR=process==null?void 0:process.versions)==null?void 0:sR.node)=="string"&&(Hn=process);var oR,dZ=typeof((oR=Hn==null?void 0:Hn.versions)==null?void 0:oR.electron)=="string",hZ=dZ&&(Hn==null?void 0:Hn.type)==="renderer",aR;if(typeof Hn=="object"){Sy=Hn.platform==="win32",Cy=Hn.platform==="darwin",kf=Hn.platform==="linux",kf&&Hn.env.SNAP&&Hn.env.SNAP_REVISION,Hn.env.CI||Hn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Xh=_l,Ef=_l;let e=Hn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Xh=t.userLocale,qk=t.osLocale,Ef=t.resolvedLanguage||_l,uZ=(aR=t.languagePack)==null?void 0:aR.translationsConfigFile}catch{}V5=!0}else typeof navigator=="object"&&!hZ?(li=navigator.userAgent,Sy=li.indexOf("Windows")>=0,Cy=li.indexOf("Macintosh")>=0,(li.indexOf("Macintosh")>=0||li.indexOf("iPad")>=0||li.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kf=li.indexOf("Linux")>=0,(li==null?void 0:li.indexOf("Mobi"))>=0,Ef=globalThis._VSCODE_NLS_LANGUAGE||_l,Xh=navigator.language.toLowerCase(),qk=Xh):console.error("Unable to resolve platform.");var q5=Sy,Li=Cy,fZ=kf,Kk=V5,Pi=li,Xs=Ef,pZ;(e=>{function t(){return Xs}e.value=t;function n(){return Xs.length===2?Xs==="en":Xs.length>=3?Xs[0]==="e"&&Xs[1]==="n"&&Xs[2]==="-":!1}e.isDefaultVariant=n;function r(){return Xs==="en"}e.isDefault=r})(pZ||(pZ={}));var mZ=typeof Zo.postMessage=="function"&&!Zo.importScripts;(()=>{if(mZ){let e=[];Zo.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let a=e[r];if(a.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),a.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Zo.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var gZ=!!(Pi&&Pi.indexOf("Chrome")>=0);Pi&&Pi.indexOf("Firefox")>=0;!gZ&&Pi&&Pi.indexOf("Safari")>=0;Pi&&Pi.indexOf("Edg/")>=0;Pi&&Pi.indexOf("Android")>=0;var cl=typeof navigator=="object"?navigator:{};Kk||document.queryCommandSupported&&document.queryCommandSupported("copy")||cl&&cl.clipboard&&cl.clipboard.writeText,Kk||cl&&cl.clipboard&&cl.clipboard.readText;var Z0=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}},s_=new Z0,Gk=new Z0,Yk=new Z0,vZ=new Array(230),K5;(e=>{function t(u){return s_.keyCodeToStr(u)}e.toString=t;function n(u){return s_.strToKeyCode(u)}e.fromString=n;function r(u){return Gk.keyCodeToStr(u)}e.toUserSettingsUS=r;function s(u){return Yk.keyCodeToStr(u)}e.toUserSettingsGeneral=s;function a(u){return Gk.strToKeyCode(u)||Yk.strToKeyCode(u)}e.fromUserSettings=a;function l(u){if(u>=98&&u<=113)return null;switch(u){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return s_.keyCodeToStr(u)}e.toElectronAccelerator=l})(K5||(K5={}));var _Z=class G5{constructor(t,n,r,s,a){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=s,this.keyCode=a}equals(t){return t instanceof G5&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${n}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new yZ([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},yZ=class{constructor(e){if(e.length===0)throw WX("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 bZ(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return K5.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(wy)switch(t){case 59:return 85;case 60:if(fZ)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Li)return 57;break}else if(lZ&&(Li&&t===93||!Li&&t===92))return 57;return vZ[t]||0}var xZ=Li?256:2048,wZ=512,SZ=1024,CZ=Li?2048:256,Xk=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=bZ(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|=xZ),this.altKey&&(t|=wZ),this.shiftKey&&(t|=SZ),this.metaKey&&(t|=CZ),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new _Z(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Zk=new WeakMap;function kZ(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 EZ=class{static getSameOriginWindowChain(e){let t=Zk.get(e);if(!t){t=[],Zk.set(e,t);let n=e,r;do r=kZ(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,s=this.getSameOriginWindowChain(e);for(let a of s){let l=a.window.deref();if(n+=(l==null?void 0:l.scrollY)??0,r+=(l==null?void 0:l.scrollX)??0,l===t||!a.iframeElement)break;let u=a.iframeElement.getBoundingClientRect();n+=u.top,r+=u.left}return{top:n,left:r}}},Zh=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=EZ.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Qk=class{constructor(e,t=0,n=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(X0){let a=navigator.userAgent.match(/Chrome\/(\d+)/);r=(a?parseInt(a[1]):123)<=122}if(e){let a=e,l=e,u=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")r?this.deltaY=a.wheelDeltaY/(120*u):this.deltaY=a.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?wy&&!Li?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")cZ&&q5?this.deltaX=-(a.wheelDeltaX/120):r?this.deltaX=a.wheelDeltaX/(120*u):this.deltaX=a.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?wy&&!Li?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Y5=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),RZ;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof TZ?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Fn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Y5})})(RZ||(RZ={}));var TZ=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?Y5:(this._emitter||(this._emitter=new Ce),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Q0=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 gy("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new gy("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},MZ=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 gy("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=$t(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},NZ;(e=>{async function t(r){let s,a=await Promise.all(r.map(l=>l.then(u=>u,u=>{s||(s=u)})));if(typeof s<"u")throw s;return a}e.settled=t;function n(r){return new Promise(async(s,a)=>{try{await r(s,a)}catch(l){a(l)}})}e.withAsyncBody=n})(NZ||(NZ={}));var Jk=class Kr{static fromArray(t){return new Kr(n=>{n.emitMany(t)})}static fromPromise(t){return new Kr(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Kr(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Kr(async n=>{await Promise.all(t.map(async r=>{for await(let s of r)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Ce,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Fn.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 Kr(async r=>{for await(let s of t)r.emitOne(n(s))})}map(t){return Kr.map(this,t)}static filter(t,n){return new Kr(async r=>{for await(let s of t)n(s)&&r.emitOne(s)})}filter(t){return Kr.filter(this,t)}static coalesce(t){return Kr.filter(t,n=>!!n)}coalesce(){return Kr.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Kr.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())}};Jk.EMPTY=Jk.fromArray([]);var{getWindow:Di,getWindowId:AZ,onDidRegisterWindow:DZ}=(function(){let e=new Map,t={window:us,disposables:new lo};e.set(us.vscodeWindowId,t);let n=new Ce,r=new Ce,s=new Ce;function a(l,u){return(typeof l=="number"?e.get(l):void 0)??(u?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(l){if(e.has(l.vscodeWindowId))return Qe.None;let u=new lo,h={window:l,disposables:u.add(new lo)};return e.set(l.vscodeWindowId,h),u.add($t(()=>{e.delete(l.vscodeWindowId),r.fire(l)})),u.add(He(l,Sn.BEFORE_UNLOAD,()=>{s.fire(l)})),n.fire(h),u},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:a,getWindow(l){var d;let u=l;if((d=u==null?void 0:u.ownerDocument)!=null&&d.defaultView)return u.ownerDocument.defaultView.window;let h=l;return h!=null&&h.view?h.view.window:us},getDocument(l){return Di(l).document}}})(),OZ=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 He(e,t,n,r){return new OZ(e,t,n,r)}var eE=function(e,t,n,r){return He(e,t,n,r)},J0,jZ=class extends MZ{constructor(e){super(),this.defaultTarget=e&&Di(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},tE=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){Cf(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,s=a=>{n.set(a,!1);let l=e.get(a)??[];for(t.set(a,l),e.set(a,[]),r.set(a,!0);l.length>0;)l.sort(tE.sort),l.shift().execute();r.set(a,!1)};J0=(a,l,u=0)=>{let h=AZ(a),d=new tE(l,u),m=e.get(h);return m||(m=[],e.set(h,m)),m.push(d),n.get(h)||(n.set(h,!0),a.requestAnimationFrame(()=>s(h))),d}})();function LZ(e){let t=e.getBoundingClientRect(),n=Di(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Sn={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"},zZ=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=pr(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=pr(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=pr(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=pr(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=pr(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=pr(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=pr(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=pr(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=pr(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=pr(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=pr(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=pr(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=pr(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=pr(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 pr(e){return typeof e=="number"?`${e}px`:e}function Tu(e){return new zZ(e)}var X5=class{constructor(){this._hooks=new lo,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let a=e;try{e.setPointerCapture(t),this._hooks.add($t(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Di(e)}this._hooks.add(He(a,Sn.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(He(a,Sn.POINTER_UP,l=>this.stopMonitoring(!0)))}};function PZ(e,t,n){let r=null,s=null;if(typeof n.value=="function"?(r="value",s=n.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",s=n.get),!s)throw new Error("not supported");let a=`$memoize$${t}`;n[r]=function(...l){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,l)}),this[a]}}var ki;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ki||(ki={}));var cu=class Wn extends Qe{constructor(){super(),this.dispatched=!1,this.targets=new Vk,this.ignoreTargets=new Vk,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Fn.runAndSubscribe(DZ,({window:t,disposables:n})=>{n.add(He(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(He(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(He(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:us,disposables:this._store}))}static addTarget(t){if(!Wn.isTouchDevice())return Qe.None;Wn.INSTANCE||(Wn.INSTANCE=new Wn);let n=Wn.INSTANCE.targets.push(t);return $t(n)}static ignoreTarget(t){if(!Wn.isTouchDevice())return Qe.None;Wn.INSTANCE||(Wn.INSTANCE=new Wn);let n=Wn.INSTANCE.ignoreTargets.push(t);return $t(n)}static isTouchDevice(){return"ontouchstart"in us||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let a=t.targetTouches.item(r);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:n,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[n],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let l=this.newGestureEvent(ki.Start,a.target);l.pageX=a.pageX,l.pageY=a.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let a=0,l=n.changedTouches.length;a<l;a++){let u=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(u.identifier))){console.warn("move of an UNKNOWN touch",u);continue}let h=this.activeTouches[u.identifier],d=Date.now()-h.initialTimeStamp;if(d<Wn.HOLD_DELAY&&Math.abs(h.initialPageX-Rr(h.rollingPageX))<30&&Math.abs(h.initialPageY-Rr(h.rollingPageY))<30){let m=this.newGestureEvent(ki.Tap,h.initialTarget);m.pageX=Rr(h.rollingPageX),m.pageY=Rr(h.rollingPageY),this.dispatchEvent(m)}else if(d>=Wn.HOLD_DELAY&&Math.abs(h.initialPageX-Rr(h.rollingPageX))<30&&Math.abs(h.initialPageY-Rr(h.rollingPageY))<30){let m=this.newGestureEvent(ki.Contextmenu,h.initialTarget);m.pageX=Rr(h.rollingPageX),m.pageY=Rr(h.rollingPageY),this.dispatchEvent(m)}else if(s===1){let m=Rr(h.rollingPageX),g=Rr(h.rollingPageY),_=Rr(h.rollingTimestamps)-h.rollingTimestamps[0],b=m-h.rollingPageX[0],w=g-h.rollingPageY[0],S=[...this.targets].filter(C=>h.initialTarget instanceof Node&&C.contains(h.initialTarget));this.inertia(t,S,r,Math.abs(b)/_,b>0?1:-1,m,Math.abs(w)/_,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(ki.End,h.initialTarget)),delete this.activeTouches[u.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===ki.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Wn.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===ki.Change||t.type===ki.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,a=t.initialTarget;for(;a&&a!==r;)s++,a=a.parentElement;n.push([s,r])}n.sort((r,s)=>r[0]-s[0]);for(let[r,s]of n)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,s,a,l,u,h,d){this.handle=J0(t,()=>{let m=Date.now(),g=m-r,_=0,b=0,w=!0;s+=Wn.SCROLL_FRICTION*g,u+=Wn.SCROLL_FRICTION*g,s>0&&(w=!1,_=a*s*g),u>0&&(w=!1,b=h*u*g);let S=this.newGestureEvent(ki.Change);S.translationX=_,S.translationY=b,n.forEach(C=>C.dispatchEvent(S)),w||this.inertia(t,n,m,s,a,l+_,u,h,d+b)})}onTouchMove(t){let n=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let a=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],u=this.newGestureEvent(ki.Change,l.initialTarget);u.translationX=a.pageX-Rr(l.rollingPageX),u.translationY=a.pageY-Rr(l.rollingPageY),u.pageX=a.pageX,u.pageY=a.pageY,this.dispatchEvent(u),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(a.pageX),l.rollingPageY.push(a.pageY),l.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};cu.SCROLL_FRICTION=-.005,cu.HOLD_DELAY=700,cu.CLEAR_TAP_COUNT_TIME=400,Xt([PZ],cu,"isTouchDevice",1);var BZ=cu,ex=class extends Qe{onclick(e,t){this._register(He(e,Sn.CLICK,n=>t(new Zh(Di(e),n))))}onmousedown(e,t){this._register(He(e,Sn.MOUSE_DOWN,n=>t(new Zh(Di(e),n))))}onmouseover(e,t){this._register(He(e,Sn.MOUSE_OVER,n=>t(new Zh(Di(e),n))))}onmouseleave(e,t){this._register(He(e,Sn.MOUSE_LEAVE,n=>t(new Zh(Di(e),n))))}onkeydown(e,t){this._register(He(e,Sn.KEY_DOWN,n=>t(new Xk(n))))}onkeyup(e,t){this._register(He(e,Sn.KEY_UP,n=>t(new Xk(n))))}oninput(e,t){this._register(He(e,Sn.INPUT,t))}onblur(e,t){this._register(He(e,Sn.BLUR,t))}onfocus(e,t){this._register(He(e,Sn.FOCUS,t))}onchange(e,t){this._register(He(e,Sn.CHANGE,t))}ignoreGesture(e){return BZ.ignoreTarget(e)}},nE=11,IZ=class extends ex{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=nE+"px",this.domNode.style.height=nE+"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 X5),this._register(eE(this.bgDomNode,Sn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(eE(this.domNode,Sn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new jZ),this._pointerdownScheduleRepeatTimer=this._register(new Q0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Di(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()}},HZ=class ky{constructor(t,n,r,s,a,l,u){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,s=s|0,a=a|0,l=l|0,u=u|0),this.rawScrollLeft=s,this.rawScrollTop=u,n<0&&(n=0),s+n>r&&(s=r-n),s<0&&(s=0),a<0&&(a=0),u+a>l&&(u=l-a),u<0&&(u=0),this.width=n,this.scrollWidth=r,this.scrollLeft=s,this.height=a,this.scrollHeight=l,this.scrollTop=u}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new ky(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 ky(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,l=this.height!==t.height,u=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:a,heightChanged:l,scrollHeightChanged:u,scrollTopChanged:h}}},FZ=class extends Qe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new HZ(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 iE(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=iE.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)))}},rE=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function o_(e,t){let n=t-e;return function(r){return e+n*WZ(r)}}function UZ(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var iE=class Ey{constructor(t,n,r,s){this.from=t,this.to=n,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let s,a;return t<n?(s=t+.75*r,a=n-.75*r):(s=t-.75*r,a=n+.75*r),UZ(o_(t,s),o_(a,n),.33)}return o_(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),s=this.scrollTop(n);return new rE(r,s,!1)}return new rE(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Ey.start(t,n,r)}static start(t,n,r){r=r+10;let s=Date.now()-10;return new Ey(t,n,s,r)}};function $Z(e){return Math.pow(e,3)}function WZ(e){return 1-$Z(1-e)}var VZ=class extends Qe{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 Q0)}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":"")))}},qZ=140,Z5=class extends ex{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new VZ(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new X5),this._shouldRender=!0,this.domNode=Tu(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(He(this.domNode.domNode,Sn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new IZ(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Tu(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(He(this.slider.domNode,Sn.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);n<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let s=LZ(this.domNode.domNode);t=e.pageX-s.left,n=e.pageY-s.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let a=this._sliderOrthogonalPointerPosition(s),l=Math.abs(a-n);if(q5&&l>qZ){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let u=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(u))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Q5=class Ry{constructor(t,n,r,s,a,l){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=a,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Ry(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,s,a){let l=Math.max(0,r-t),u=Math.max(0,l-2*n),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(u),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(r*u/s))),m=(u-d)/(s-r),g=a*m;return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(d),computedSliderRatio:m,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=Ry._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)}},KZ=class extends Z5{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Q5(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},GZ=class extends Z5{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Q5(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},YZ=500,sE=50,XZ=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Ty=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,s=this._rear;do{let a=s===this._front?t:Math.pow(2,-r);if(t-=a,n+=this._memory[s].score*a,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(X0){let n=Di(t.browserEvent),r=aZ(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let s=null,a=new XZ(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=a),a.score=this._computeScore(a,s)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let s=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.abs(n.deltaX),u=Math.abs(n.deltaY),h=Math.max(Math.min(s,l),1),d=Math.max(Math.min(a,u),1),m=Math.max(s,l),g=Math.max(a,u);m%h===0&&g%d===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ty.INSTANCE=new Ty;var ZZ=Ty,QZ=class extends ex{constructor(e,t,n){super(),this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Ce),this.onWillScroll=this._onWillScroll.event,this._options=eQ(t),this._scrollable=n,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new GZ(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new KZ(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=Tu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Tu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Tu(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new Q0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=sa(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,Li&&(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 Qk(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=sa(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Qk(n))};this._mouseWheelToDispose.push(He(this._listenOnDomNode,Sn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=ZZ.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+a===0?l=a=0:Math.abs(a)>=Math.abs(l)?l=0:a=0),this._options.flipAxes&&([a,l]=[l,a]);let u=!Li&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!l&&(l=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),d={};if(a){let m=sE*a,g=h.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(d,g)}if(l){let m=sE*l,g=h.scrollLeft-(m<0?Math.floor(m):Math.ceil(m));this._horizontalScrollbar.writeScrollPosition(d,g)}d=this._scrollable.validateScrollPosition(d),(h.scrollLeft!==d.scrollLeft||h.scrollTop!==d.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",s=t?" top":"",a=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),YZ)}},JZ=class extends QZ{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 eQ(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,Li&&(t.className+=" mac"),t}var My=class extends Qe{constructor(e,t,n,r,s,a,l,u){super(),this._bufferService=n,this._optionsService=l,this._renderService=u,this._onRequestScrollLines=this._register(new Ce),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new FZ({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>J0(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new JZ(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Fn.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register($t(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register($t(()=>this._styleElement.remove())),this._register(Fn.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
600
+ `)})),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}};My=Xt([Me(2,sr),Me(3,xs),Me(4,D5),Me(5,Yl),Me(6,or),Me(7,ws)],My);var Ny=class extends Qe{constructor(e,t,n,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(a=>this._removeDecoration(a))),this._register($t(()=>{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()}};Ny=Xt([Me(1,sr),Me(2,xs),Me(3,pd),Me(4,ws)],Ny);var tQ=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)}},Si={full:0,left:0,center:0,right:0},Zs={full:0,left:0,center:0,right:0},Xc={full:0,left:0,center:0,right:0},rp=class extends Qe{constructor(e,t,n,r,s,a,l,u){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=s,this._optionsService=a,this._themeService=l,this._coreBrowserService=u,this._colorZoneStore=new tQ,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($t(()=>{var m;return(m=this._canvas)==null?void 0:m.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);Zs.full=this._canvas.width,Zs.left=e,Zs.center=t,Zs.right=e,this._refreshDrawHeightConstants(),Xc.full=1,Xc.left=1,Xc.center=1+Zs.left,Xc.right=1+Zs.left+Zs.center}_refreshDrawHeightConstants(){Si.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);Si.left=t,Si.center=t,Si.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.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(Xc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Si[e.position||"full"]/2),Zs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Si[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}))}};rp=Xt([Me(2,sr),Me(3,pd),Me(4,ws),Me(5,or),Me(6,Yl),Me(7,xs)],rp);var ye;(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=`
601
+ `,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=""))(ye||(ye={}));var Rf;(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="Ÿ"))(Rf||(Rf={}));var J5;(e=>e.ST=`${ye.ESC}\\`)(J5||(J5={}));var Ay=class{constructor(e,t,n,r,s,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=s,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ye.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ay=Xt([Me(2,sr),Me(3,or),Me(4,va),Me(5,ws)],Ay);var Tn=0,Mn=0,Nn=0,Yt=0,oE={css:"#00000000",rgba:0},cn;(e=>{function t(s,a,l,u){return u!==void 0?`#${$o(s)}${$o(a)}${$o(l)}${$o(u)}`:`#${$o(s)}${$o(a)}${$o(l)}`}e.toCss=t;function n(s,a,l,u=255){return(s<<24|a<<16|l<<8|u)>>>0}e.toRgba=n;function r(s,a,l,u){return{css:e.toCss(s,a,l,u),rgba:e.toRgba(s,a,l,u)}}e.toColor=r})(cn||(cn={}));var Ht;(e=>{function t(h,d){if(Yt=(d.rgba&255)/255,Yt===1)return{css:d.css,rgba:d.rgba};let m=d.rgba>>24&255,g=d.rgba>>16&255,_=d.rgba>>8&255,b=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;Tn=b+Math.round((m-b)*Yt),Mn=w+Math.round((g-w)*Yt),Nn=S+Math.round((_-S)*Yt);let C=cn.toCss(Tn,Mn,Nn),k=cn.toRgba(Tn,Mn,Nn);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,m){let g=Tf.ensureContrastRatio(h.rgba,d.rgba,m);if(g)return cn.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=r;function s(h){let d=(h.rgba|255)>>>0;return[Tn,Mn,Nn]=Tf.toChannels(d),{css:cn.toCss(Tn,Mn,Nn),rgba:d}}e.opaque=s;function a(h,d){return Yt=Math.round(d*255),[Tn,Mn,Nn]=Tf.toChannels(h.rgba),{css:cn.toCss(Tn,Mn,Nn,Yt),rgba:cn.toRgba(Tn,Mn,Nn,Yt)}}e.opacity=a;function l(h,d){return Yt=h.rgba&255,a(h,Yt*d/255)}e.multiplyOpacity=l;function u(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=u})(Ht||(Ht={}));var Vt;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let a=s.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Tn=parseInt(s.slice(1,2).repeat(2),16),Mn=parseInt(s.slice(2,3).repeat(2),16),Nn=parseInt(s.slice(3,4).repeat(2),16),cn.toColor(Tn,Mn,Nn);case 5:return Tn=parseInt(s.slice(1,2).repeat(2),16),Mn=parseInt(s.slice(2,3).repeat(2),16),Nn=parseInt(s.slice(3,4).repeat(2),16),Yt=parseInt(s.slice(4,5).repeat(2),16),cn.toColor(Tn,Mn,Nn,Yt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let a=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return Tn=parseInt(a[1]),Mn=parseInt(a[2]),Nn=parseInt(a[3]),Yt=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),cn.toColor(Tn,Mn,Nn,Yt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Tn,Mn,Nn,Yt]=t.getImageData(0,0,1,1).data,Yt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:cn.toRgba(Tn,Mn,Nn,Yt),css:s}}e.toColor=r})(Vt||(Vt={}));var er;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,a){let l=r/255,u=s/255,h=a/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+m*.7152+g*.0722}e.relativeLuminance2=n})(er||(er={}));var Tf;(e=>{function t(l,u){if(Yt=(u&255)/255,Yt===1)return u;let h=u>>24&255,d=u>>16&255,m=u>>8&255,g=l>>24&255,_=l>>16&255,b=l>>8&255;return Tn=g+Math.round((h-g)*Yt),Mn=_+Math.round((d-_)*Yt),Nn=b+Math.round((m-b)*Yt),cn.toRgba(Tn,Mn,Nn)}e.blend=t;function n(l,u,h){let d=er.relativeLuminance(l>>8),m=er.relativeLuminance(u>>8);if(ls(d,m)<h){if(m<d){let b=r(l,u,h),w=ls(d,er.relativeLuminance(b>>8));if(w<h){let S=s(l,u,h),C=ls(d,er.relativeLuminance(S>>8));return w>C?b:S}return b}let g=s(l,u,h),_=ls(d,er.relativeLuminance(g>>8));if(_<h){let b=r(l,u,h),w=ls(d,er.relativeLuminance(b>>8));return _>w?g:b}return g}}e.ensureContrastRatio=n;function r(l,u,h){let d=l>>24&255,m=l>>16&255,g=l>>8&255,_=u>>24&255,b=u>>16&255,w=u>>8&255,S=ls(er.relativeLuminance2(_,b,w),er.relativeLuminance2(d,m,g));for(;S<h&&(_>0||b>0||w>0);)_-=Math.max(0,Math.ceil(_*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=ls(er.relativeLuminance2(_,b,w),er.relativeLuminance2(d,m,g));return(_<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=r;function s(l,u,h){let d=l>>24&255,m=l>>16&255,g=l>>8&255,_=u>>24&255,b=u>>16&255,w=u>>8&255,S=ls(er.relativeLuminance2(_,b,w),er.relativeLuminance2(d,m,g));for(;S<h&&(_<255||b<255||w<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=ls(er.relativeLuminance2(_,b,w),er.relativeLuminance2(d,m,g));return(_<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=s;function a(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=a})(Tf||(Tf={}));function $o(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ls(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var nQ=class extends fd{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()]}},ip=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Jr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),s=0,a=0,l=0,u=t.getFg(0),h=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==u||this._workCell.bg!==h){if(d-s>1){let m=this._getJoinedRanges(r,l,a,t,s);for(let g=0;g<m.length;g++)n.push(m[g])}s=d,l=a,u=this._workCell.fg,h=this._workCell.bg}a+=this._workCell.getChars().length||oo.length}if(this._bufferService.cols-s>1){let d=this._getJoinedRanges(r,l,a,t,s);for(let m=0;m<d.length;m++)n.push(d[m])}return n}_getJoinedRanges(e,t,n,r,s){let a=e.substring(t,n),l=[];try{l=this._characterJoiners[0].handler(a)}catch(u){console.error(u)}for(let u=1;u<this._characterJoiners.length;u++)try{let h=this._characterJoiners[u].handler(a);for(let d=0;d<h.length;d++)ip._mergeRanges(l,h[d])}catch(h){console.error(h)}return this._stringRangesToCellRanges(l,r,s),l}_stringRangesToCellRanges(e,t,n){let r=0,s=!1,a=0,l=e[r];if(l){for(let u=n;u<this._bufferService.cols;u++){let h=t.getWidth(u),d=t.getString(u).length||oo.length;if(h!==0){if(!s&&l[0]<=a&&(l[0]=u,s=!0),l[1]<=a){if(l[1]=u,l=e[++r],!l)break;l[0]<=a?(l[0]=u,s=!0):s=!1}a+=d}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(n){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};ip=Xt([Me(0,sr)],ip);function rQ(e){return 57508<=e&&e<=57558}function iQ(e){return 9472<=e&&e<=9631}function sQ(e){return rQ(e)||iQ(e)}function oQ(){return{css:{canvas:Qh(),cell:Qh()},device:{canvas:Qh(),cell:Qh(),char:{width:0,height:0,left:0,top:0}}}}function Qh(){return{width:0,height:0}}var Dy=class{constructor(e,t,n,r,s,a,l){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=s,this._decorationService=a,this._themeService=l,this._workCell=new Jr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,s,a,l,u,h,d,m){let g=[],_=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<a+1&&(w=a+1);let S,C=0,k="",T=0,R=0,M=0,O=0,D=!1,j=0,F=!1,G=0,B=0,H=[],P=d!==-1&&m!==-1;for(let U=0;U<w;U++){e.loadCell(U,this._workCell);let q=this._workCell.getWidth();if(q===0)continue;let W=!1,z=U>=B,$=U,V=this._workCell;if(_.length>0&&U===_[0][0]&&z){let pe=_.shift(),Re=this._isCellInSelection(pe[0],t);for(T=pe[0]+1;T<pe[1];T++)z&&(z=Re===this._isCellInSelection(T,t));z&&(z=!n||a<pe[0]||a>=pe[1]),z?(W=!0,V=new nQ(this._workCell,e.translateToString(!0,pe[0],pe[1]),pe[1]-pe[0]),$=pe[1]-1,q=V.getWidth()):B=pe[1]}let Q=this._isCellInSelection(U,t),N=n&&U===a,I=P&&U>=d&&U<=m,Z=!1;this._decorationService.forEachDecorationAtCell(U,t,void 0,pe=>{Z=!0});let L=V.getChars()||oo;if(L===" "&&(V.isUnderline()||V.isOverline())&&(L=" "),G=q*u-h.get(L,V.isBold(),V.isItalic()),!S)S=this._document.createElement("span");else if(C&&(Q&&F||!Q&&!F&&V.bg===R)&&(Q&&F&&b.selectionForeground||V.fg===M)&&V.extended.ext===O&&I===D&&G===j&&!N&&!W&&!Z&&z){V.isInvisible()?k+=oo:k+=L,C++;continue}else C&&(S.textContent=k),S=this._document.createElement("span"),C=0,k="";if(R=V.bg,M=V.fg,O=V.extended.ext,D=I,j=G,F=Q,W&&a>=U&&a<=$&&(a=U),!this._coreService.isCursorHidden&&N&&this._coreService.isCursorInitialized){if(H.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&H.push("xterm-cursor-blink"),H.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":H.push("xterm-cursor-outline");break;case"block":H.push("xterm-cursor-block");break;case"bar":H.push("xterm-cursor-bar");break;case"underline":H.push("xterm-cursor-underline");break}}if(V.isBold()&&H.push("xterm-bold"),V.isItalic()&&H.push("xterm-italic"),V.isDim()&&H.push("xterm-dim"),V.isInvisible()?k=oo:k=V.getChars()||oo,V.isUnderline()&&(H.push(`xterm-underline-${V.extended.underlineStyle}`),k===" "&&(k=" "),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${fd.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let pe=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&pe<8&&(pe+=8),S.style.textDecorationColor=b.ansi[pe].css}V.isOverline()&&(H.push("xterm-overline"),k===" "&&(k=" ")),V.isStrikethrough()&&H.push("xterm-strikethrough"),I&&(S.style.textDecoration="underline");let de=V.getFgColor(),me=V.getFgColorMode(),ue=V.getBgColor(),he=V.getBgColorMode(),we=!!V.isInverse();if(we){let pe=de;de=ue,ue=pe;let Re=me;me=he,he=Re}let le,xe,Ne=!1;this._decorationService.forEachDecorationAtCell(U,t,void 0,pe=>{pe.options.layer!=="top"&&Ne||(pe.backgroundColorRGB&&(he=50331648,ue=pe.backgroundColorRGB.rgba>>8&16777215,le=pe.backgroundColorRGB),pe.foregroundColorRGB&&(me=50331648,de=pe.foregroundColorRGB.rgba>>8&16777215,xe=pe.foregroundColorRGB),Ne=pe.options.layer==="top")}),!Ne&&Q&&(le=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,ue=le.rgba>>8&16777215,he=50331648,Ne=!0,b.selectionForeground&&(me=50331648,de=b.selectionForeground.rgba>>8&16777215,xe=b.selectionForeground)),Ne&&H.push("xterm-decoration-top");let ae;switch(he){case 16777216:case 33554432:ae=b.ansi[ue],H.push(`xterm-bg-${ue}`);break;case 50331648:ae=cn.toColor(ue>>16,ue>>8&255,ue&255),this._addStyle(S,`background-color:#${aE((ue>>>0).toString(16),"0",6)}`);break;case 0:default:we?(ae=b.foreground,H.push("xterm-bg-257")):ae=b.background}switch(le||V.isDim()&&(le=Ht.multiplyOpacity(ae,.5)),me){case 16777216:case 33554432:V.isBold()&&de<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(de+=8),this._applyMinimumContrast(S,ae,b.ansi[de],V,le,void 0)||H.push(`xterm-fg-${de}`);break;case 50331648:let pe=cn.toColor(de>>16&255,de>>8&255,de&255);this._applyMinimumContrast(S,ae,pe,V,le,xe)||this._addStyle(S,`color:#${aE(de.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,ae,b.foreground,V,le,xe)||we&&H.push("xterm-fg-257")}H.length&&(S.className=H.join(" "),H.length=0),!N&&!W&&!Z&&z?C++:S.textContent=k,G!==this.defaultSpacing&&(S.style.letterSpacing=`${G}px`),g.push(S),U=$}return S&&C&&(S.textContent=k),g}_applyMinimumContrast(e,t,n,r,s,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||sQ(r.getCode()))return!1;let l=this._getContrastCache(r),u;if(!s&&!a&&(u=l.getColor(t.rgba,n.rgba)),u===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);u=Ht.ensureContrastRatio(s||t,a||n,h),l.setColor((s||t).rgba,(a||n).rgba,u??null)}return u?(this._addStyle(e,`color:${u.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};Dy=Xt([Me(1,L5),Me(2,or),Me(3,xs),Me(4,va),Me(5,pd),Me(6,Yl)],Dy);function aE(e,t,n){for(;e.length<n;)e=t+e;return e}var aQ=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[n,r,s,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let s=e;t&&(s+="B"),n&&(s+="I");let a=this._holey.get(s);if(a===void 0){let l=0;t&&(l|=1),n&&(l|=2),a=this._measure(e,l),a>0&&this._holey.set(s,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},lQ=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let s=e.buffers.active.ydisp,a=t[1]-s,l=n[1]-s,u=Math.max(a,0),h=Math.min(l,e.rows-1);if(u>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=l,this.viewportCappedStartRow=u,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function cQ(){return new lQ}var a_="xterm-dom-renderer-owner-",Vr="xterm-rows",Jh="xterm-fg-",lE="xterm-bg-",Zc="xterm-focus",ef="xterm-selection",uQ=1,Oy=class extends Qe{constructor(e,t,n,r,s,a,l,u,h,d,m,g,_,b){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=s,this._helperContainer=a,this._linkifier2=l,this._charSizeService=h,this._optionsService=d,this._bufferService=m,this._coreService=g,this._coreBrowserService=_,this._themeService=b,this._terminalClass=uQ++,this._rowElements=[],this._selectionRenderModel=cQ(),this.onRequestRedraw=this._register(new Ce).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Vr),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(ef),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=oQ(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(Dy,document),this._element.classList.add(a_+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($t(()=>{this._element.classList.remove(a_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new aQ(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} .${Vr} 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} .${Vr} { 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} .${Vr} .xterm-dim { color: ${Ht.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Vr}.${Zc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Vr}.${Zc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Vr}.${Zc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Vr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Vr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Vr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Vr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Vr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ef} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ef} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ef} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Jh}${a} { color: ${l.css}; }${this._terminalSelector} .${Jh}${a}.xterm-dim { color: ${Ht.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${lE}${a} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Jh}257 { color: ${Ht.opaque(e.background).css}; }${this._terminalSelector} .${Jh}257.xterm-dim { color: ${Ht.multiplyOpacity(Ht.opaque(e.background),.5).css}; }${this._terminalSelector} .${lE}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(Zc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Zc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(n){let h=e[0]>t[0];u.appendChild(this._createSelectionElement(a,h?t[0]:e[0],h?e[0]:t[0],l-a+1))}else{let h=r===a?e[0]:0,d=a===s?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,h,d));let m=l-a-1;if(u.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,m)),a!==l){let g=s===l?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,0,g))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,t,n,r=1){let s=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-t);return a+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-a),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${a}px`,s.style.width=`${l}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,s=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let d=h+n.ydisp,m=this._rowElements[h],g=n.lines.get(d);if(!m||!g)break;m.replaceChildren(...this._rowFactory.createRow(g,d,d===r,l,u,s,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${a_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,s,a){n<0&&(e=0),r<0&&(t=0);let l=this._bufferService.rows-1;n=Math.max(Math.min(n,l),0),r=Math.max(Math.min(r,l),0),s=Math.min(s,this._bufferService.cols);let u=this._bufferService.buffer,h=u.ybase+u.y,d=Math.min(u.x,s-1),m=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let b=n;b<=r;++b){let w=b+u.ydisp,S=this._rowElements[b],C=u.lines.get(w);if(!S||!C)break;S.replaceChildren(...this._rowFactory.createRow(C,w,w===h,g,_,d,m,this.dimensions.css.cell.width,this._widthCache,a?b===n?e:0:-1,a?(b===r?t:s)-1:-1))}}};Oy=Xt([Me(7,K0),Me(8,Vp),Me(9,or),Me(10,sr),Me(11,va),Me(12,xs),Me(13,Yl)],Oy);var jy=class extends Qe{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Ce),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new hQ(this._optionsService))}catch{this._measureStrategy=this._register(new dQ(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())}};jy=Xt([Me(2,or)],jy);var eD=class extends Qe{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)}},dQ=class extends eD{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}},hQ=class extends eD{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}},fQ=class extends Qe{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 pQ(this._window)),this._onDprChange=this._register(new Ce),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Ce),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Fn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(He(this._textarea,"focus",()=>this._isFocused=!0)),this._register(He(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}},pQ=class extends Qe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ol),this._onDprChange=this._register(new Ce),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register($t(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=He(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)}},mQ=class extends Qe{constructor(){super(),this.linkProviders=[],this._register($t(()=>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 tx(e,t,n){let r=n.getBoundingClientRect(),s=e.getComputedStyle(n),a=parseInt(s.getPropertyValue("padding-left")),l=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-a,t.clientY-r.top-l]}function gQ(e,t,n,r,s,a,l,u,h){if(!a)return;let d=tx(e,t,n);if(d)return d[0]=Math.ceil((d[0]+(h?l/2:0))/l),d[1]=Math.ceil(d[1]/u),d[0]=Math.min(Math.max(d[0],1),r+(h?1:0)),d[1]=Math.min(Math.max(d[1],1),s),d}var Ly=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,s){return gQ(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let n=tx(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])}}};Ly=Xt([Me(0,ws),Me(1,Vp)],Ly);var vQ=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=[]}},tD={};RX(tD,{getSafariVersion:()=>yQ,isChromeOS:()=>sD,isFirefox:()=>nD,isIpad:()=>bQ,isIphone:()=>xQ,isLegacyEdge:()=>_Q,isLinux:()=>nx,isMac:()=>sp,isNode:()=>qp,isSafari:()=>rD,isWindows:()=>iD});var qp=typeof process<"u"&&"title"in process,md=qp?"node":navigator.userAgent,gd=qp?"node":navigator.platform,nD=md.includes("Firefox"),_Q=md.includes("Edge"),rD=/^((?!chrome|android).)*safari/i.test(md);function yQ(){if(!rD)return 0;let e=md.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var sp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(gd),bQ=gd==="iPad",xQ=gd==="iPhone",iD=["Windows","Win16","Win32","WinCE"].includes(gd),nx=gd.indexOf("Linux")>=0,sD=/\bCrOS\b/.test(md),oD=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),s=e.timeRemaining(),n*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},wQ=class extends oD{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},SQ=class extends oD{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},op=!qp&&"requestIdleCallback"in window?SQ:wQ,CQ=class{constructor(){this._queue=new op}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},zy=class extends Qe{constructor(e,t,n,r,s,a,l,u,h){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=s,this._coreBrowserService=u,this._renderer=this._register(new Ol),this._pausedResizeTask=new CQ,this._observerDisposable=this._register(new Ol),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 Ce),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Ce),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Ce),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Ce),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new vQ((d,m)=>this._renderRows(d,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new kQ(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register($t(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=$t(()=>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()}};zy=Xt([Me(2,or),Me(3,Vp),Me(4,va),Me(5,pd),Me(6,sr),Me(7,xs),Me(8,Yl)],zy);var kQ=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 EQ(e,t,n,r){let s=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return MQ(s,a,e,t,n,r)+Kp(a,t,n,r)+NQ(s,a,e,t,n,r);let l;if(a===t)return l=s>e?"D":"C",Vu(Math.abs(s-e),Wu(l,r));l=a>t?"D":"C";let u=Math.abs(a-t),h=TQ(a>t?e:s,n)+(u-1)*n.cols+1+RQ(a>t?s:e);return Vu(h,Wu(l,r))}function RQ(e,t){return e-1}function TQ(e,t){return t.cols-e}function MQ(e,t,n,r,s,a){return Kp(t,r,s,a).length===0?"":Vu(lD(e,t,e,t-oa(t,s),!1,s).length,Wu("D",a))}function Kp(e,t,n,r){let s=e-oa(e,n),a=t-oa(t,n),l=Math.abs(s-a)-AQ(e,t,n);return Vu(l,Wu(aD(e,t),r))}function NQ(e,t,n,r,s,a){let l;Kp(t,r,s,a).length>0?l=r-oa(r,s):l=t;let u=r,h=DQ(e,t,n,r,s,a);return Vu(lD(e,l,n,u,h==="C",s).length,Wu(h,a))}function AQ(e,t,n){var l;let r=0,s=e-oa(e,n),a=t-oa(t,n);for(let u=0;u<Math.abs(s-a);u++){let h=aD(e,t)==="A"?-1:1;(l=n.buffer.lines.get(s+h*u))!=null&&l.isWrapped&&r++}return r}function oa(e,t){let n=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return n}function DQ(e,t,n,r,s,a){let l;return Kp(n,r,s,a).length>0?l=r-oa(r,s):l=t,e<n&&l<=r||e>=n&&l<r?"C":"D"}function aD(e,t){return e>t?"A":"B"}function lD(e,t,n,r,s,a){let l=e,u=t,h="";for(;(l!==n||u!==r)&&u>=0&&u<a.buffer.lines.length;)l+=s?1:-1,s&&l>a.cols-1?(h+=a.buffer.translateBufferLineToString(u,!1,e,l),l=0,e=0,u++):!s&&l<0&&(h+=a.buffer.translateBufferLineToString(u,!1,0,e+1),l=a.cols-1,e=l,u--);return h+a.buffer.translateBufferLineToString(u,!1,e,l)}function Wu(e,t){let n=t?"O":"[";return ye.ESC+n+e}function Vu(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var OQ=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 cE(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 l_=50,jQ=15,LQ=50,zQ=500,PQ=" ",BQ=new RegExp(PQ,"g"),Py=class extends Qe{constructor(e,t,n,r,s,a,l,u,h){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=s,this._mouseService=a,this._optionsService=l,this._renderService=u,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Jr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Ce),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Ce),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Ce),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Ce),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 OQ(this._bufferService),this._activeSelectionMode=0,this._register($t(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let u=n.translateBufferLineToString(l,!0,s,a);r.push(u)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],s));for(let a=e[1]+1;a<=t[1]-1;a++){let l=n.lines.get(a),u=n.translateBufferLineToString(a,!0);l!=null&&l.isWrapped?r[r.length-1]+=u:r.push(u)}if(e[1]!==t[1]){let a=n.lines.get(t[1]),l=n.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(s=>s.replace(BQ," ")).join(iD?`\r
602
+ `:`
603
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),nx&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,a;let n=(a=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:a.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=cE(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=tx(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,-l_),l_),t/=l_,t/Math.abs(t)+Math.round(t*(jQ-1)))}shouldForceSelection(e){return sp?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(),LQ)}_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&&!(sp&&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<zQ&&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=EQ(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:s>1&&t!==r&&(n+=s-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,a=s.lines.get(e[1]);if(!a)return;let l=s.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(a,e[0]),h=u,d=e[0]-u,m=0,g=0,_=0,b=0;if(l.charAt(u)===" "){for(;u>0&&l.charAt(u-1)===" ";)u--;for(;h<l.length&&l.charAt(h+1)===" ";)h++}else{let C=e[0],k=e[0];a.getWidth(C)===0&&(m++,C--),a.getWidth(k)===2&&(g++,k++);let T=a.getString(k).length;for(T>1&&(b+=T-1,h+=T-1);C>0&&u>0&&!this._isCharWordSeparator(a.loadCell(C-1,this._workCell));){a.loadCell(C-1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,C--):R>1&&(_+=R-1,u-=R-1),u--,C--}for(;k<a.length&&h+1<l.length&&!this._isCharWordSeparator(a.loadCell(k+1,this._workCell));){a.loadCell(k+1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,k++):R>1&&(b+=R-1,h+=R-1),h++,k++}}h++;let w=u+d-m+_,S=Math.min(this._bufferService.cols,h-u+m+g-_-b);if(!(!t&&l.slice(u,h).trim()==="")){if(n&&w===0&&a.getCodePoint(0)!==32){let C=s.lines.get(e[1]-1);if(C&&a.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let T=this._bufferService.cols-k.start;w-=T,S+=T}}}if(r&&w+S===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let C=s.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(S+=k.length)}}return{start:w,length:S}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=cE(n,this._bufferService.cols)}};Py=Xt([Me(3,sr),Me(4,va),Me(5,G0),Me(6,or),Me(7,ws),Me(8,xs)],Py);var uE=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={}}},dE=class{constructor(){this._color=new uE,this._css=new uE}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()}},gn=Object.freeze((()=>{let e=[Vt.toColor("#2e3436"),Vt.toColor("#cc0000"),Vt.toColor("#4e9a06"),Vt.toColor("#c4a000"),Vt.toColor("#3465a4"),Vt.toColor("#75507b"),Vt.toColor("#06989a"),Vt.toColor("#d3d7cf"),Vt.toColor("#555753"),Vt.toColor("#ef2929"),Vt.toColor("#8ae234"),Vt.toColor("#fce94f"),Vt.toColor("#729fcf"),Vt.toColor("#ad7fa8"),Vt.toColor("#34e2e2"),Vt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],a=t[n%6];e.push({css:cn.toCss(r,s,a),rgba:cn.toRgba(r,s,a)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:cn.toCss(r,r,r),rgba:cn.toRgba(r,r,r)})}return e})()),Vo=Vt.toColor("#ffffff"),uu=Vt.toColor("#000000"),hE=Vt.toColor("#ffffff"),fE=uu,Qc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},IQ=Vo,By=class extends Qe{constructor(e){super(),this._optionsService=e,this._contrastCache=new dE,this._halfContrastCache=new dE,this._onChangeColors=this._register(new Ce),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Vo,background:uu,cursor:hE,cursorAccent:fE,selectionForeground:void 0,selectionBackgroundTransparent:Qc,selectionBackgroundOpaque:Ht.blend(uu,Qc),selectionInactiveBackgroundTransparent:Qc,selectionInactiveBackgroundOpaque:Ht.blend(uu,Qc),scrollbarSliderBackground:Ht.opacity(Vo,.2),scrollbarSliderHoverBackground:Ht.opacity(Vo,.4),scrollbarSliderActiveBackground:Ht.opacity(Vo,.5),overviewRulerBorder:Vo,ansi:gn.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=Tt(e.foreground,Vo),t.background=Tt(e.background,uu),t.cursor=Ht.blend(t.background,Tt(e.cursor,hE)),t.cursorAccent=Ht.blend(t.background,Tt(e.cursorAccent,fE)),t.selectionBackgroundTransparent=Tt(e.selectionBackground,Qc),t.selectionBackgroundOpaque=Ht.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Tt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Ht.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Tt(e.selectionForeground,oE):void 0,t.selectionForeground===oE&&(t.selectionForeground=void 0),Ht.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Ht.opacity(t.selectionBackgroundTransparent,.3)),Ht.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Ht.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Tt(e.scrollbarSliderBackground,Ht.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Tt(e.scrollbarSliderHoverBackground,Ht.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Tt(e.scrollbarSliderActiveBackground,Ht.opacity(t.foreground,.5)),t.overviewRulerBorder=Tt(e.overviewRulerBorder,IQ),t.ansi=gn.slice(),t.ansi[0]=Tt(e.black,gn[0]),t.ansi[1]=Tt(e.red,gn[1]),t.ansi[2]=Tt(e.green,gn[2]),t.ansi[3]=Tt(e.yellow,gn[3]),t.ansi[4]=Tt(e.blue,gn[4]),t.ansi[5]=Tt(e.magenta,gn[5]),t.ansi[6]=Tt(e.cyan,gn[6]),t.ansi[7]=Tt(e.white,gn[7]),t.ansi[8]=Tt(e.brightBlack,gn[8]),t.ansi[9]=Tt(e.brightRed,gn[9]),t.ansi[10]=Tt(e.brightGreen,gn[10]),t.ansi[11]=Tt(e.brightYellow,gn[11]),t.ansi[12]=Tt(e.brightBlue,gn[12]),t.ansi[13]=Tt(e.brightMagenta,gn[13]),t.ansi[14]=Tt(e.brightCyan,gn[14]),t.ansi[15]=Tt(e.brightWhite,gn[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]=Tt(e.extendedAnsi[r],gn[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()}}};By=Xt([Me(0,or)],By);function Tt(e,t){if(e!==void 0)try{return Vt.toColor(e)}catch{}return t}var HQ=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)}},FQ=class{constructor(){this._services=new HQ,this._services.set(K0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=jX(e).sort((a,l)=>a.index-l.index),r=[];for(let a of n){let l=this._services.get(a.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);r.push(l)}let s=n.length>0?n[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},UQ={trace:0,debug:1,info:2,warn:3,error:4,off:5},$Q="xterm.js: ",Iy=class extends Qe{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=UQ[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?"":$Q)+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)}};Iy=Xt([Me(0,or)],Iy);var pE=class extends Qe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Ce),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Ce),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Ce),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let s=t-1;s>=0;s--)this.set(e+s+n,this.get(e+s));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Xe=3,an=Object.freeze(new fd),tf=0,c_=2,du=class cD{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Xe);let s=n||Jr.fromCharData([0,T5,1,0]);for(let a=0;a<t;++a)this.setCell(a,s);this.length=t}get(t){let n=this._data[t*Xe+0],r=n&2097151;return[this._data[t*Xe+1],n&2097152?this._combined[t]:r?no(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*Xe+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Xe+0]=t|2097152|n[2]<<22):this._data[t*Xe+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Xe+0]>>22}hasWidth(t){return this._data[t*Xe+0]&12582912}getFg(t){return this._data[t*Xe+1]}getBg(t){return this._data[t*Xe+2]}hasContent(t){return this._data[t*Xe+0]&4194303}getCodePoint(t){let n=this._data[t*Xe+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Xe+0]&2097152}getString(t){let n=this._data[t*Xe+0];return n&2097152?this._combined[t]:n&2097151?no(n&2097151):""}isProtected(t){return this._data[t*Xe+2]&536870912}loadCell(t,n){return tf=t*Xe,n.content=this._data[tf+0],n.fg=this._data[tf+1],n.bg=this._data[tf+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*Xe+0]=n.content,this._data[t*Xe+1]=n.fg,this._data[t*Xe+2]=n.bg}setCellFromCodepoint(t,n,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Xe+0]=n|r<<22,this._data[t*Xe+1]=s.fg,this._data[t*Xe+2]=s.bg}addCodepointToCell(t,n,r){let s=this._data[t*Xe+0];s&2097152?this._combined[t]+=no(n):s&2097151?(this._combined[t]=no(s&2097151)+no(n),s&=-2097152,s|=2097152):s=n|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*Xe+0]=s}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let s=new Jr;for(let a=this.length-t-n-1;a>=0;--a)this.setCell(t+n+a,this.loadCell(t+a,s));for(let a=0;a<n;++a)this.setCell(t+a,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let s=new Jr;for(let a=0;a<this.length-t-n;++a)this.setCell(t+a,this.loadCell(t+n+a,s));for(let a=this.length-n;a<this.length;++a)this.setCell(a,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*c_<this._data.buffer.byteLength;let r=t*Xe;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let l=0;l<s.length;l++){let u=parseInt(s[l],10);u>=t&&delete this._combined[u]}let a=Object.keys(this._extendedAttrs);for(let l=0;l<a.length;l++){let u=parseInt(a[l],10);u>=t&&delete this._extendedAttrs[u]}}return this.length=t,r*4*c_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*c_<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 cD(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*Xe+0]&4194303)return t+(this._data[t*Xe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Xe+0]&4194303||this._data[t*Xe+2]&50331648)return t+(this._data[t*Xe+0]>>22);return 0}copyCellsFrom(t,n,r,s,a){let l=t._data;if(a)for(let h=s-1;h>=0;h--){for(let d=0;d<Xe;d++)this._data[(r+h)*Xe+d]=l[(n+h)*Xe+d];l[(n+h)*Xe+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}else for(let h=0;h<s;h++){for(let d=0;d<Xe;d++)this._data[(r+h)*Xe+d]=l[(n+h)*Xe+d];l[(n+h)*Xe+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}let u=Object.keys(t._combined);for(let h=0;h<u.length;h++){let d=parseInt(u[h],10);d>=n&&(this._combined[d-n+r]=t._combined[d])}}translateToString(t,n,r,s){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let a="";for(;n<r;){let l=this._data[n*Xe+0],u=l&2097151,h=l&2097152?this._combined[n]:u?no(u):oo;if(a+=h,s)for(let d=0;d<h.length;++d)s.push(n);n+=l>>22||1}return s&&s.push(n),a}};function WQ(e,t,n,r,s,a){let l=[];for(let u=0;u<e.length-1;u++){let h=u,d=e.get(++h);if(!d.isWrapped)continue;let m=[e.get(u)];for(;h<e.length&&d.isWrapped;)m.push(d),d=e.get(++h);if(!a&&r>=u&&r<h){u+=m.length-1;continue}let g=0,_=qu(m,g,t),b=1,w=0;for(;b<m.length;){let C=qu(m,b,t),k=C-w,T=n-_,R=Math.min(k,T);m[g].copyCellsFrom(m[b],w,_,R,!1),_+=R,_===n&&(g++,_=0),w+=R,w===C&&(b++,w=0),_===0&&g!==0&&m[g-1].getWidth(n-1)===2&&(m[g].copyCellsFrom(m[g-1],n-1,_++,1,!1),m[g-1].setCell(n-1,s))}m[g].replaceCells(_,n,s);let S=0;for(let C=m.length-1;C>0&&(C>g||m[C].getTrimmedLength()===0);C--)S++;S>0&&(l.push(u+m.length-S),l.push(S)),u+=m.length-1}return l}function VQ(e,t){let n=[],r=0,s=t[r],a=0;for(let l=0;l<e.length;l++)if(s===l){let u=t[++r];e.onDeleteEmitter.fire({index:l-a,amount:u}),l+=u-1,a+=u,s=t[++r]}else n.push(l);return{layout:n,countRemoved:a}}function qQ(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 KQ(e,t,n){let r=[],s=e.map((h,d)=>qu(e,d,t)).reduce((h,d)=>h+d),a=0,l=0,u=0;for(;u<s;){if(s-u<n){r.push(s-u);break}a+=n;let h=qu(e,l,t);a>h&&(a-=h,l++);let d=e[l].getWidth(a-1)===2;d&&a--;let m=d?n-1:n;r.push(m),u+=m}return r}function qu(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?n-1:n}var uD=class dD{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=dD._nextId++,this._onDispose=this.register(new Ce),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),sa(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};uD._nextId=1;var GQ=uD,yn={},qo=yn.B;yn[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:"≥","{":"π","|":"≠","}":"£","~":"·"};yn.A={"#":"£"};yn.B=void 0;yn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};yn.C=yn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};yn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};yn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};yn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};yn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};yn.E=yn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};yn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};yn.H=yn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};yn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var mE=4294967295,gE=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=an.clone(),this.savedCharset=qo,this.markers=[],this._nullCell=Jr.fromCharData([0,T5,1,0]),this._whitespaceCell=Jr.fromCharData([0,oo,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new op,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new pE(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 np),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 np),this._whitespaceCell}getBlankLine(e,t){return new du(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>mE?mE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=an);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 pE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(an),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)r+=+this.lines.get(l).resize(e,n);let a=0;if(this._rows<t)for(let l=this._rows;l<t;l++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new du(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new du(e,n)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let l=this.lines.length-s;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let a=0;a<this.lines.length;a++)r+=+this.lines.get(a).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=WQ(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(an),n);if(r.length>0){let s=VQ(this.lines,r);qQ(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(an),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new du(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(an),s=[],a=0;for(let l=this.lines.length-1;l>=0;l--){let u=this.lines.get(l);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let h=[u];for(;u.isWrapped&&l>0;)u=this.lines.get(--l),h.unshift(u);if(!n){let R=this.ybase+this.y;if(R>=l&&R<l+h.length)continue}let d=h[h.length-1].getTrimmedLength(),m=KQ(h,this._cols,e),g=m.length-h.length,_;this.ybase===0&&this.y!==this.lines.length-1?_=Math.max(0,this.y-this.lines.maxLength+g):_=Math.max(0,this.lines.length-this.lines.maxLength+g);let b=[];for(let R=0;R<g;R++){let M=this.getBlankLine(an,!0);b.push(M)}b.length>0&&(s.push({start:l+h.length+a,newLines:b}),a+=b.length),h.push(...b);let w=m.length-1,S=m[w];S===0&&(w--,S=m[w]);let C=h.length-g-1,k=d;for(;C>=0;){let R=Math.min(k,S);if(h[w]===void 0)break;if(h[w].copyCellsFrom(h[C],k-R,S-R,R,!0),S-=R,S===0&&(w--,S=m[w]),k-=R,k===0){C--;let M=Math.max(C,0);k=qu(h,M,this._cols)}}for(let R=0;R<h.length;R++)m[R]<e&&h[R].setCell(m[R],r);let T=g-_;for(;T-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(s.length>0){let l=[],u=[];for(let S=0;S<this.lines.length;S++)u.push(this.lines.get(S));let h=this.lines.length,d=h-1,m=0,g=s[m];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let _=0;for(let S=Math.min(this.lines.maxLength-1,h+a-1);S>=0;S--)if(g&&g.start>d+_){for(let C=g.newLines.length-1;C>=0;C--)this.lines.set(S--,g.newLines[C]);S++,l.push({index:d+1,amount:g.newLines.length}),_+=g.newLines.length,g=s[++m]}else this.lines.set(S,u[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+a-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,r){let s=this.lines.get(e);return s?s.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new GQ(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)}},YQ=class extends Qe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Ce),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 gE(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new gE(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},hD=2,fD=1,Hy=class extends Qe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Ce),this.onResize=this._onResize.event,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,hD),this.rows=Math.max(e.rawOptions.rows||0,fD),this.buffers=this._register(new YQ(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let s=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;a===n.lines.length-1?l?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=a-s+1;n.lines.shiftElements(s+1,l-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Hy=Xt([Me(0,or)],Hy);var ul={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:sp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},XQ=["normal","bold","100","200","300","400","500","600","700","800","900"],ZQ=class extends Qe{constructor(e){super(),this._onOptionChange=this._register(new Ce),this.onOptionChange=this._onOptionChange.event;let t={...ul};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($t(()=>{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 ul))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in ul))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=ul[e]),!QQ(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ul[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=XQ.includes(t)?t:ul[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 QQ(e){return e==="block"||e==="underline"||e==="bar"}function hu(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]&&hu(e[r],t-1);return n}var vE=Object.freeze({insertMode:!1}),_E=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Fy=class extends Qe{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 Ce),this.onData=this._onData.event,this._onUserInput=this._register(new Ce),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Ce),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Ce),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=hu(vE),this.decPrivateModes=hu(_E)}reset(){this.modes=hu(vE),this.decPrivateModes=hu(_E)}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))}};Fy=Xt([Me(0,sr),Me(1,O5),Me(2,or)],Fy);var yE={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 u_(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 d_=String.fromCharCode,bE={DEFAULT:e=>{let t=[u_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${d_(t[0])}${d_(t[1])}${d_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${u_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${u_(e,!0)};${e.x};${e.y}${t}`}},Uy=class extends Qe{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 Ce),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(yE))this.addProtocol(r,yE[r]);for(let r of Object.keys(bE))this.addEncoding(r,bE[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Uy=Xt([Me(0,sr),Me(1,va),Me(2,or)],Uy);var h_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],JQ=[[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]],vn;function eJ(e,t){let n=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(s=n+r>>1,e>t[s][1])n=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var tJ=class{constructor(){if(this.version="6",!vn){vn=new Uint8Array(65536),vn.fill(1),vn[0]=0,vn.fill(0,1,32),vn.fill(0,127,160),vn.fill(2,4352,4448),vn[9001]=2,vn[9002]=2,vn.fill(2,11904,42192),vn[12351]=1,vn.fill(2,44032,55204),vn.fill(2,63744,64256),vn.fill(2,65040,65050),vn.fill(2,65072,65136),vn.fill(2,65280,65377),vn.fill(2,65504,65511);for(let e=0;e<h_.length;++e)vn.fill(0,h_[e][0],h_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?vn[e]:eJ(e,JQ)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let s=Xo.extractWidth(t);s===0?r=!1:s>n&&(n=s)}return Xo.createPropertyValue(0,n,r)}},Xo=class Mf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ce,this.onChange=this._onChange.event;let t=new tJ;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,s=t.length;for(let a=0;a<s;++a){let l=t.charCodeAt(a);if(55296<=l&&l<=56319){if(++a>=s)return n+this.wcwidth(l);let d=t.charCodeAt(a);56320<=d&&d<=57343?l=(l-55296)*1024+d-56320+65536:n+=this.wcwidth(d)}let u=this.charProperties(l,r),h=Mf.extractWidth(u);Mf.extractShouldJoin(u)&&(h-=Mf.extractWidth(r)),n+=h,r=u}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},nJ=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 xE(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 Jc=2147483647,rJ=256,pD=class $y{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>rJ)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 $y;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[r];if(Array.isArray(s))for(let a=0;a<s.length;++a)n.addSubParam(s[a]);else n.addParam(s)}return n}clone(){let t=new $y(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Jc?Jc: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>Jc?Jc:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&(t[n]=this._subParams.slice(r,s))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[n-1];r[n-1]=~s?Math.min(s*10+t,Jc):t}},eu=[],iJ=class{constructor(){this._state=0,this._active=eu,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=eu}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=eu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||eu,!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",Wp(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=eu,this._id=-1,this._state=0}}},Tr=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+=Wp(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}},tu=[],sJ=class{constructor(){this._handlers=Object.create(null),this._active=tu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=tu}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=tu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||tu,!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",Wp(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=tu,this._ident=0}},fu=new pD;fu.addParam(0);var wE=class{constructor(e){this._handler=e,this._data="",this._params=fu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():fu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Wp(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=fu,this._data="",this._hitLimit=!1,n));return this._params=fu,this._data="",this._hitLimit=!1,t}},oJ=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=n<<4|r}},Xr=160,aJ=(function(){let e=new oJ(4095),t=Array.apply(null,Array(256)).map((u,h)=>h),n=(u,h)=>t.slice(u,h),r=n(32,127),s=n(0,24);s.push(25),s.push.apply(s,n(28,32));let a=n(0,14),l;e.setDefault(1,0),e.addMany(r,0,2,0);for(l in a)e.addMany([24,26,153,154],l,3,0),e.addMany(n(128,144),l,3,0),e.addMany(n(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Xr,0,2,0),e.add(Xr,8,5,8),e.add(Xr,6,0,6),e.add(Xr,11,0,11),e.add(Xr,13,13,13),e})(),lJ=class extends Qe{constructor(e=aJ){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 pD,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($t(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new iJ),this._dcsParser=this._register(new sJ),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let a=e.intermediates.charCodeAt(s);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,n){let r=0,s=0,a=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&h>-1){for(;h>=0&&(l=u[h](this._params),l!==!0);h--)if(l instanceof Promise)return this._parseStack.handlerPos=h,l}this._parseStack.handlers=[];break;case 4:if(n===!1&&h>-1){for(;h>=0&&(l=u[h](),l!==!0);h--)if(l instanceof Promise)return this._parseStack.handlerPos=h,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,n),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,n),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let u=a;u<t;++u){switch(r=e[u],s=this._transitions.table[this.currentState<<8|(r<160?r:Xr)],s>>4){case 2:for(let _=u+1;;++_){if(_>=t||(r=e[_])<32||r>126&&r<Xr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Xr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Xr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Xr){this._printHandler(e,u,_),u=_-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],d=h?h.length-1:-1;for(;d>=0&&(l=h[d](this._params),l!==!0);d--)if(l instanceof Promise)return this._preserveStack(3,h,d,s,u),l;d<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++u<t&&(r=e[u])>47&&r<60);u--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let m=this._escHandlers[this._collect<<8|r],g=m?m.length-1:-1;for(;g>=0&&(l=m[g](),l!==!0);g--)if(l instanceof Promise)return this._preserveStack(4,m,g,s,u),l;g<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let _=u+1;;++_)if(_>=t||(r=e[_])===24||r===26||r===27||r>127&&r<Xr){this._dcsParser.put(e,u,_),u=_-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,s,u),l;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let _=u+1;;_++)if(_>=t||(r=e[_])<32||r>127&&r<Xr){this._oscParser.put(e,u,_),u=_-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,s,u),l;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},cJ=/^([\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})$/,uJ=/^[\da-f]+$/;function SE(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=cJ.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),uJ.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let a=parseInt(t.slice(n*s,n*s+n),16);r[s]=n===1?a<<4:n===2?a:n===3?a>>4:a>>8}return r}}function f_(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function dJ(e,t=16){let[n,r,s]=e;return`rgb:${f_(n,t)}/${f_(r,t)}/${f_(s,t)}`}var hJ={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Qs=131072,CE=10;function kE(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 EE=5e3,RE=0,fJ=class extends Qe{constructor(e,t,n,r,s,a,l,u,h=new lJ){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=s,this._oscLinkService=a,this._coreMouseService=l,this._unicodeService=u,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new DX,this._utf8Decoder=new OX,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=an.clone(),this._eraseAttrDataInternal=an.clone(),this._onRequestBell=this._register(new Ce),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Ce),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Ce),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Ce),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Ce),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Ce),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Ce),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Ce),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Ce),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Ce),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Ce),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Ce),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 Wy(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,m)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:m.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,m,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:m,data:g})}),this._parser.setDcsHandlerFallback((d,m,g)=>{m==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:m,payload:g})}),this._parser.setPrintHandler((d,m,g)=>this.print(d,m,g)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(ye.BEL,()=>this.bell()),this._parser.setExecuteHandler(ye.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ye.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ye.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ye.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ye.BS,()=>this.backspace()),this._parser.setExecuteHandler(ye.HT,()=>this.tab()),this._parser.setExecuteHandler(ye.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ye.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Rf.IND,()=>this.index()),this._parser.setExecuteHandler(Rf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Rf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Tr(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Tr(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Tr(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Tr(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Tr(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Tr(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Tr(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Tr(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Tr(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Tr(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Tr(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Tr(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 yn)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 wE((d,m)=>this.requestStatusString(d,m)))}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"),EE))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${EE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,s=this._activeBuffer.y,a=0,l=this._parseStack.paused;if(l){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Qs&&(a=this._parseStack.position+Qs)}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<Qs&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Qs))),l||this._dirtyRowTracker.clearRange(),e.length>Qs)for(let d=a;d<e.length;d+=Qs){let m=d+Qs<e.length?d+Qs:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(d,m),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,m),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,g))return this._preserveStack(r,s,g,d),this._logSlowResolvingAsync(n),n}else if(!l){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,s,d,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let u=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(u,this._bufferService.rows-1)})}print(e,t,n){let r,s,a=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,u=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,m=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,m);let _=this._parser.precedingJoinState;for(let b=t;b<n;++b){if(r=e[b],r<127&&a){let k=a[String.fromCharCode(r)];k&&(r=k.charCodeAt(0))}let w=this._unicodeService.charProperties(r,_);s=Xo.extractWidth(w);let S=Xo.extractShouldJoin(w),C=S?Xo.extractWidth(_):0;if(_=w,l&&this._onA11yChar.fire(no(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-C>u){if(h){let k=g,T=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),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&g instanceof du&&g.copyCellsFrom(k,T,0,C,!1);T<u;)k.setCellFromCodepoint(T++,0,1,m)}else if(this._activeBuffer.x=u-1,s===2)continue}if(S&&this._activeBuffer.x){let k=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-k,r,s);for(let T=s-C;--T>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,m);continue}if(d&&(g.insertCells(this._activeBuffer.x,s-C,this._activeBuffer.getNullCell(m)),g.getWidth(u-1)===2&&g.setCellFromCodepoint(u-1,0,1,m)),g.setCellFromCodepoint(this._activeBuffer.x++,r,s,m),s>0)for(;--s;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,m)}this._parser.precedingJoinState=_,this._activeBuffer.x<u&&n-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,m),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>kE(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new wE(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Tr(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,s=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(an));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=Xo.extractWidth(t),s=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),l=new Uint32Array(a.length*n),u=0;for(let d=0;d<a.length;){let m=a.codePointAt(d)||0;l[u++]=m,d+=m>65535?2:1}let h=u;for(let d=1;d<n;++d)l.copyWithin(h,0,u),h+=u;return this.print(l,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ye.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ye.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ye.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ye.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ye.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,qo),this._charsetService.setgCharset(1,qo),this._charsetService.setgCharset(2,qo),this._charsetService.setgCharset(3,qo);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:a}=this._coreMouseService,l=this._coreService,{buffers:u,cols:h}=this._bufferService,{active:d,alt:m}=u,g=this._optionsService.rawOptions,_=(S,C)=>(l.triggerDataEvent(`${ye.ESC}[${t?"":"?"}${S};${C}$y`),!0),b=S=>S?1:2,w=e.params[0];return t?w===2?_(w,4):w===4?_(w,b(l.modes.insertMode)):w===12?_(w,3):w===20?_(w,b(g.convertEol)):_(w,0):w===1?_(w,b(r.applicationCursorKeys)):w===3?_(w,g.windowOptions.setWinLines?h===80?2:h===132?1:0:0):w===6?_(w,b(r.origin)):w===7?_(w,b(r.wraparound)):w===8?_(w,3):w===9?_(w,b(s==="X10")):w===12?_(w,b(g.cursorBlink)):w===25?_(w,b(!l.isCursorHidden)):w===45?_(w,b(r.reverseWraparound)):w===66?_(w,b(r.applicationKeypad)):w===67?_(w,4):w===1e3?_(w,b(s==="VT200")):w===1002?_(w,b(s==="DRAG")):w===1003?_(w,b(s==="ANY")):w===1004?_(w,b(r.sendFocus)):w===1005?_(w,4):w===1006?_(w,b(a==="SGR")):w===1015?_(w,4):w===1016?_(w,b(a==="SGR_PIXELS")):w===1048?_(w,1):w===47||w===1047||w===1049?_(w,b(d===m)):w===2004?_(w,b(r.bracketedPasteMode)):w===2026?_(w,b(r.synchronizedOutput)):_(w,0)}_updateAttrColor(e,t,n,r,s){return t===2?(e|=50331648,e&=-16777216,e|=fd.fromColorRGB([n,r,s])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],s=0,a=0;do{if(r[a+s]=e.params[t+a],e.hasSubParams(t+a)){let l=e.getSubParams(t+a),u=0;do r[1]===5&&(s=1),r[a+u+1+s]=l[u];while(++u<l.length&&u+a+1+s<r.length);break}if(r[1]===5&&a+s>=2||r[1]===2&&a+s>=5)break;r[1]&&(s=1)}while(++a+t<e.length&&a+s<r.length);for(let l=2;l<r.length;++l)r[l]===-1&&(r[l]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=an.fg,e.bg=an.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let s=0;s<t;s++)n=e.params[s],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=an.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=an.bg&16777215):n===38||n===48||n===58?s+=this._extractColor(e,s,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=an.fg&16777215,r.bg&=-67108864,r.bg|=an.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ye.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ye.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(`${ye.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=an.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(!kE(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(`${ye.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>CE&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>CE&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),s=n.shift();if(/^\d+$/.exec(r)){let a=parseInt(r);if(TE(a))if(s==="?")t.push({type:0,index:a});else{let l=SE(s);l&&t.push({type:1,index:a,color:l})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,s=n.findIndex(a=>a.startsWith("id="));return s!==-1&&(r=n[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=SE(n[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let s=parseInt(n[r]);TE(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,qo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(hJ[e[0]],yn[e[1]]||qo),!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=an.clone(),this._eraseAttrDataInternal=an.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 Jr;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(`${ye.ESC}${l}${ye.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Wy=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&&(RE=e,e=t,t=RE),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Wy=Xt([Me(0,sr)],Wy);function TE(e){return 0<=e&&e<256}var pJ=5e7,ME=12,mJ=50,gJ=class extends Qe{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 Ce),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>pJ)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let l=u=>performance.now()-n>=ME?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(n,u);s.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(l);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=ME)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>mJ&&(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()}},Vy=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let u=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(h,u)),this._dataByLinkId.set(h.id,h),h.id}let n=e,r=this._getEntryIdKey(n),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let a=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Vy=Xt([Me(0,sr)],Vy);var NE=!1,vJ=class extends Qe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ol),this._onBinary=this._register(new Ce),this.onBinary=this._onBinary.event,this._onData=this._register(new Ce),this.onData=this._onData.event,this._onLineFeed=this._register(new Ce),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Ce),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Ce),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Ce),this._instantiationService=new FQ,this.optionsService=this._register(new ZQ(e)),this._instantiationService.setService(or,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Hy)),this._instantiationService.setService(sr,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Iy)),this._instantiationService.setService(O5,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Fy)),this._instantiationService.setService(va,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Uy)),this._instantiationService.setService(D5,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Xo)),this._instantiationService.setService(PX,this.unicodeService),this._charsetService=this._instantiationService.createInstance(nJ),this._instantiationService.setService(zX,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Vy),this._instantiationService.setService(j5,this._oscLinkService),this._inputHandler=this._register(new fJ(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Fn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Fn.forward(this._bufferService.onResize,this._onResize)),this._register(Fn.forward(this.coreService.onData,this._onData)),this._register(Fn.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 gJ((t,n)=>this._inputHandler.parse(t,n))),this._register(Fn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Ce),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&&!NE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),NE=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,hD),t=Math.max(t,fD),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(xE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(xE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=$t(()=>{for(let t of e)t.dispose()})}}},_J={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 yJ(e,t,n,r){var l;let s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=ye.ESC+"OA":s.key=ye.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=ye.ESC+"OD":s.key=ye.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=ye.ESC+"OC":s.key=ye.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=ye.ESC+"OB":s.key=ye.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":ye.DEL,e.altKey&&(s.key=ye.ESC+s.key);break;case 9:if(e.shiftKey){s.key=ye.ESC+"[Z";break}s.key=ye.HT,s.cancel=!0;break;case 13:s.key=e.altKey?ye.ESC+ye.CR:ye.CR,s.cancel=!0;break;case 27:s.key=ye.ESC,e.altKey&&(s.key=ye.ESC+ye.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?s.key=ye.ESC+"[1;"+(a+1)+"D":t?s.key=ye.ESC+"OD":s.key=ye.ESC+"[D";break;case 39:if(e.metaKey)break;a?s.key=ye.ESC+"[1;"+(a+1)+"C":t?s.key=ye.ESC+"OC":s.key=ye.ESC+"[C";break;case 38:if(e.metaKey)break;a?s.key=ye.ESC+"[1;"+(a+1)+"A":t?s.key=ye.ESC+"OA":s.key=ye.ESC+"[A";break;case 40:if(e.metaKey)break;a?s.key=ye.ESC+"[1;"+(a+1)+"B":t?s.key=ye.ESC+"OB":s.key=ye.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=ye.ESC+"[2~");break;case 46:a?s.key=ye.ESC+"[3;"+(a+1)+"~":s.key=ye.ESC+"[3~";break;case 36:a?s.key=ye.ESC+"[1;"+(a+1)+"H":t?s.key=ye.ESC+"OH":s.key=ye.ESC+"[H";break;case 35:a?s.key=ye.ESC+"[1;"+(a+1)+"F":t?s.key=ye.ESC+"OF":s.key=ye.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=ye.ESC+"[5;"+(a+1)+"~":s.key=ye.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=ye.ESC+"[6;"+(a+1)+"~":s.key=ye.ESC+"[6~";break;case 112:a?s.key=ye.ESC+"[1;"+(a+1)+"P":s.key=ye.ESC+"OP";break;case 113:a?s.key=ye.ESC+"[1;"+(a+1)+"Q":s.key=ye.ESC+"OQ";break;case 114:a?s.key=ye.ESC+"[1;"+(a+1)+"R":s.key=ye.ESC+"OR";break;case 115:a?s.key=ye.ESC+"[1;"+(a+1)+"S":s.key=ye.ESC+"OS";break;case 116:a?s.key=ye.ESC+"[15;"+(a+1)+"~":s.key=ye.ESC+"[15~";break;case 117:a?s.key=ye.ESC+"[17;"+(a+1)+"~":s.key=ye.ESC+"[17~";break;case 118:a?s.key=ye.ESC+"[18;"+(a+1)+"~":s.key=ye.ESC+"[18~";break;case 119:a?s.key=ye.ESC+"[19;"+(a+1)+"~":s.key=ye.ESC+"[19~";break;case 120:a?s.key=ye.ESC+"[20;"+(a+1)+"~":s.key=ye.ESC+"[20~";break;case 121:a?s.key=ye.ESC+"[21;"+(a+1)+"~":s.key=ye.ESC+"[21~";break;case 122:a?s.key=ye.ESC+"[23;"+(a+1)+"~":s.key=ye.ESC+"[23~";break;case 123:a?s.key=ye.ESC+"[24;"+(a+1)+"~":s.key=ye.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=ye.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=ye.DEL:e.keyCode===219?s.key=ye.ESC:e.keyCode===220?s.key=ye.FS:e.keyCode===221&&(s.key=ye.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let u=(l=_J[e.keyCode])==null?void 0:l[e.shiftKey?1:0];if(u)s.key=ye.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,d=String.fromCharCode(h);e.shiftKey&&(d=d.toUpperCase()),s.key=ye.ESC+d}else if(e.keyCode===32)s.key=ye.ESC+(e.ctrlKey?ye.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),s.key=ye.ESC+h,s.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=ye.US),e.key==="@"&&(s.key=ye.NUL));break}return s}var Jt=0,bJ=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new op,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new op,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,a)=>this._getKey(s)-this._getKey(a)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[s]=e[t],t++):r[s]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Jt=this._search(t),Jt===-1)||this._getKey(this._array[Jt])!==t)return!1;do if(this._array[Jt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Jt),!0;while(++Jt<this._array.length&&this._getKey(this._array[Jt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,a)=>s-a),t=0,n=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:n[r++]=this._array[s];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Jt=this._search(e),!(Jt<0||Jt>=this._array.length)&&this._getKey(this._array[Jt])===e))do yield this._array[Jt];while(++Jt<this._array.length&&this._getKey(this._array[Jt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Jt=this._search(e),!(Jt<0||Jt>=this._array.length)&&this._getKey(this._array[Jt])===e))do t(this._array[Jt]);while(++Jt<this._array.length&&this._getKey(this._array[Jt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,s=this._getKey(this._array[r]);if(s>e)n=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},p_=0,AE=0,xJ=class extends Qe{constructor(){super(),this._decorations=new bJ(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Ce),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Ce),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register($t(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new wJ(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,s=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,s=r+(a.options.width??1),e>=r&&e<s&&(!n||(a.options.layer??"bottom")===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,s=>{p_=s.options.x??0,AE=p_+(s.options.width??1),e>=p_&&e<AE&&(!n||(s.options.layer??"bottom")===n)&&r(s)})}},wJ=class extends lo{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Ce),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Ce),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=Vt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Vt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},SJ=1e3,CJ=class{constructor(e,t=SJ){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,a=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},DE=20,ap=class extends Qe{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new CJ(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
604
+ `))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(He(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register($t(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<DE+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
605
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===DE+1&&(this._liveRegion.textContent+=dy.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let s=e;s<=t;s++){let a=n.lines.get(n.ydisp+s),l=[],u=(a==null?void 0:a.translateToString(!0,void 0,void 0,l))||"",h=(n.ydisp+s+1).toString(),d=this._rowElements[s];d&&(u.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=u,this._rowColumns.set(d,l)),d.setAttribute("aria-posinset",h),d.setAttribute("aria-setsize",r),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],s=n.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===a||e.relatedTarget!==r)return;let l,u;if(t===0?(l=n,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(l=this._rowElements.shift(),u=n,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var u;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((u=r.textContent)==null?void 0:u.length)??0}),!this._rowContainer.contains(n.node))return;let s=({node:h,offset:d})=>{let m=h instanceof Text?h.parentNode:h,g=parseInt(m==null?void 0:m.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(m);if(!_)return console.warn("columns is null. Race condition?"),null;let b=d<_.length?_[d]:_.slice(-1)[0]+1;return b>=this._terminal.cols&&(++g,b=0),{row:g,column:b}},a=s(t),l=s(n);if(!(!a||!l)){if(a.row>l.row||a.row===l.row&&a.column>=l.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(l.row-a.row)*this._terminal.cols-a.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,a;e.style.transform="";let t=e.getBoundingClientRect().width,n=(a=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:a[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};ap=Xt([Me(1,K0),Me(2,xs),Me(3,ws)],ap);var qy=class extends Qe{constructor(e,t,n,r,s){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Ce),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Ce),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register($t(()=>{var a;sa(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(He(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(He(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(He(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(He(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let s=n[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(a=>{a==null||a.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[a,l]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(a)&&(n=this._checkLinkProviderResult(a,e,n)):l.provideLinks(e.y,u=>{var d,m;if(this._isMouseOut)return;let h=u==null?void 0:u.map(g=>({link:g}));(d=this._activeProviderReplies)==null||d.set(a,h),n=this._checkLinkProviderResult(a,e,n),((m=this._activeProviderReplies)==null?void 0:m.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let a=0;a<s.length;a++){let l=s[a],u=l.link.range.start.y<e?0:l.link.range.start.x,h=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let d=u;d<=h;d++){if(n.has(d)){s.splice(a--,1);break}n.add(d)}}}}_checkLinkProviderResult(e,t,n){var a;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),s=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(s=!0);if(!s&&r){let l=r.find(u=>this._linkAtPosition(u.link,t));l&&(n=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let l=0;l<this._activeProviderReplies.size;l++){let u=(a=this._activeProviderReplies.get(l))==null?void 0:a.find(h=>this._linkAtPosition(h.link,t));if(u){n=!0,this._handleNewLink(u);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&kJ(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,sa(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,s,a;(r=this._currentLink)!=null&&r.state&&((a=(s=this._currentLink)==null?void 0:s.state)==null?void 0:a.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return n<=s&&s<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,s){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:s}}};qy=Xt([Me(1,G0),Me(2,ws),Me(3,sr),Me(4,z5)],qy);function kJ(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 EJ=class extends vJ{constructor(e={}){super(e),this._linkifier=this._register(new Ol),this.browser=tD,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ol),this._onCursorMove=this._register(new Ce),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Ce),this.onKey=this._onKey.event,this._onRender=this._register(new Ce),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Ce),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Ce),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Ce),this.onBell=this._onBell.event,this._onFocus=this._register(new Ce),this._onBlur=this._register(new Ce),this._onA11yCharEmitter=this._register(new Ce),this._onA11yTabEmitter=this._register(new Ce),this._onWillOpen=this._register(new Ce),this._setup(),this._decorationService=this._instantiationService.createInstance(xJ),this._instantiationService.setService(pd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(mQ),this._instantiationService.setService(z5,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(fy)),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(Fn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Fn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Fn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Fn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register($t(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let s=Ht.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ye.ESC}]${r};${dJ(s)}${J5.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=cn.toColor(...t.color));else{let a=n;this._themeService.modifyColors(l=>l[a]=cn.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(ap,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ye.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(ye.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*s,l=this.buffer.y*this._renderService.dimensions.css.cell.height,u=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=u+"px",this.textarea.style.top=l+"px",this.textarea.style.width=a+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(He(this.element,"copy",t=>{this.hasSelection()&&NX(t,this._selectionService)}));let e=t=>AX(t,this.textarea,this.coreService,this.optionsService);this._register(He(this.textarea,"paste",e)),this._register(He(this.element,"paste",e)),nD?this._register(He(this.element,"mousedown",t=>{t.button===2&&Uk(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(He(this.element,"contextmenu",t=>{Uk(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),nx&&this._register(He(this.element,"auxclick",t=>{t.button===1&&R5(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(He(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(He(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(He(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(He(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(He(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(He(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(He(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(He(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",uy.get()),sD||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(fQ,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(xs,this._coreBrowserService),this._register(He(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(He(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(jy,this._document,this._helperContainer),this._instantiationService.setService(Vp,this._charSizeService),this._themeService=this._instantiationService.createInstance(By),this._instantiationService.setService(Yl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ip),this._instantiationService.setService(L5,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(zy,this.rows,this.screenElement)),this._instantiationService.setService(ws,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Ay,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ly),this._instantiationService.setService(G0,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(qy,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(My,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Py,this.element,this.screenElement,r)),this._instantiationService.setService(IX,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(Fn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(Ny,this.screenElement)),this._register(He(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ap,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(rp,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(rp,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Oy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(a){var d,m,g,_,b;let l=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!l)return!1;let u,h;switch(a.overrideType||a.type){case"mousemove":h=32,a.buttons===void 0?(u=3,a.button!==void 0&&(u=a.button<3?a.button:3)):u=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":h=0,u=a.button<3?a.button:3;break;case"mousedown":h=1,u=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let w=a.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(a,(_=(g=(m=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:m.device)==null?void 0:g.cell)==null?void 0:_.height,(b=e._coreBrowserService)==null?void 0:b.dpr)===0)return!1;h=w<0?0:1,u=4;break;default:return!1}return h===void 0||u===void 0||u>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:u,action:h,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:a=>(n(a),a.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(a)),wheel:a=>(n(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&n(a)},mousemove:a=>{a.buttons||n(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),a&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),a&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),a&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),a&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(He(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return n(a),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(a)})),this._register(He(t,"wheel",a=>{var l,u,h,d,m;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(d=(h=(u=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:u.device)==null?void 0:h.cell)==null?void 0:d.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return this.cancel(a,!0);let g=ye.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){E5(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=yJ(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===ye.ETX||n.key===ye.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)&&(RJ(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(an));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(ye.ESC+"[I"):this.coreService.triggerDataEvent(ye.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(`${ye.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ye.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function RJ(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var TJ=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)}},MJ=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 Jr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},OE=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 MJ(t)}getNullCell(){return new Jr}},NJ=class extends Qe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Ce),this.onBufferChange=this._onBufferChange.event,this._normal=new OE(this._core.buffers.normal,"normal"),this._alternate=new OE(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)}},AJ=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)}},DJ=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}},OJ=["cols","rows"],Ci=0,jJ=class extends Qe{constructor(e){super(),this._core=this._register(new EJ(e)),this._addonManager=this._register(new TJ),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(OJ.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 AJ(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new DJ(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 NJ(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
606
+ `,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 uy.get()},set promptLabel(e){uy.set(e)},get tooMuchOutput(){return dy.get()},set tooMuchOutput(e){dy.set(e)}}}_verifyIntegers(...e){for(Ci of e)if(Ci===1/0||isNaN(Ci)||Ci%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ci of e)if(Ci&&(Ci===1/0||isNaN(Ci)||Ci%1!==0||Ci<0))throw new Error("This API only accepts positive integers")}};const mD="lever-theme",gD=y.createContext(void 0),LJ=e=>e==="light"||e==="dark"||e==="system",vD=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",jE=e=>{if(typeof document>"u")return;const t=e==="system"?vD():e;document.documentElement.classList.toggle("dark",t==="dark")},zJ=()=>{if(typeof window>"u")return"system";const e=window.localStorage.getItem(mD);return LJ(e)?e:"system"};function PJ({children:e}){const[t,n]=y.useState(zJ);y.useEffect(()=>{jE(t),typeof window<"u"&&window.localStorage.setItem(mD,t)},[t]),y.useEffect(()=>{if(t!=="system")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>jE("system");return s.addEventListener?(s.addEventListener("change",a),()=>s.removeEventListener("change",a)):(s.addListener(a),()=>s.removeListener(a))},[t]);const r=y.useMemo(()=>{const s=t==="system"?vD():t;return{theme:t,resolvedTheme:s,setTheme:n}},[t]);return p.jsx(gD.Provider,{value:r,children:e})}function _D(){const e=y.useContext(gD);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const BJ={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"},IJ={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 yD(e){return{cols:Math.max(1,e.cols||80),rows:Math.max(1,e.rows||24)}}function bD(e,t){var w,S,C,k,T;const n=e.element,r=(k=(C=(S=(w=e._core)==null?void 0:w._renderService)==null?void 0:S.dimensions)==null?void 0:C.css)==null?void 0:k.cell,s=(r==null?void 0:r.width)??0,a=(r==null?void 0:r.height)??0;if(!n||!Number.isFinite(s)||!Number.isFinite(a)||s<=0||a<=0)return null;const l=t.getBoundingClientRect(),u=window.getComputedStyle(t),h=window.getComputedStyle(n),d=e.options.scrollback===0?0:((T=e.options.overviewRuler)==null?void 0:T.width)??14,m=parseFloat(u.paddingLeft)+parseFloat(u.paddingRight)+parseFloat(h.paddingLeft)+parseFloat(h.paddingRight),g=parseFloat(u.paddingTop)+parseFloat(u.paddingBottom)+parseFloat(h.paddingTop)+parseFloat(h.paddingBottom),_=Math.max(0,l.width-m-d-1),b=Math.max(0,l.height-g);return{cols:Math.max(2,Math.floor(_/s)),rows:Math.max(1,Math.floor(b/a))}}function nf(e){e.refresh(0,Math.max(0,e.rows-1))}function rf(e,t,n,r,s){const a=bD(e,t)??yD(e);return n.current&&n.current.cols===a.cols&&n.current.rows===a.rows||(e.resize(a.cols,a.rows),n.current=a,r&&s(a.cols,a.rows)),a}function HJ({projectId:e,terminalId:t,socket:n,scrollback:r,connectionStatus:s,clearVersion:a=0,focusRequestVersion:l=0,onPathChange:u}){const{resolvedTheme:h}=_D(),d=y.useRef(null),m=y.useRef(null),g=y.useRef(null),_=y.useRef(!1),b=y.useRef(0),w=y.useRef(null),S=y.useRef(null),[C,k]=y.useState(null),[T,R]=y.useState(null),M=h==="dark"?IJ:BJ,O=(j,F)=>{n.command({type:"terminal.resize",terminalId:t,cols:j,rows:F}).catch(()=>{})},D=()=>{const j=()=>{const F=m.current,G=d.current;!F||!G||!_.current||rf(F,G,S,!0,O)};requestAnimationFrame(()=>{j(),setTimeout(j,0)})};return y.useEffect(()=>{const j=new jJ({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:M}),F=new _X;j.loadAddon(F),j.loadAddon(new kX),m.current=j;const G=d.current;G&&(j.open(G),g.current&&j.write(g.current),rf(j,G,S,!1,()=>{}),nf(j),D());const B=j.onData(U=>{n.command({type:"terminal.input",terminalId:t,data:U}).catch(q=>{R(q instanceof Error?q.message:String(q))})}),H=j.onResize(({cols:U,rows:q})=>{if(!_.current)return;const W={cols:U,rows:q};S.current&&S.current.cols===U&&S.current.rows===q||(S.current=W,O(U,q))}),P=new ResizeObserver(()=>{const U=m.current,q=d.current;!U||!q||rf(U,q,S,_.current,(W,z)=>{n.command({type:"terminal.resize",terminalId:t,cols:W,rows:z}).catch(()=>{})})});return G&&P.observe(G),()=>{P.disconnect(),H.dispose(),B.dispose(),g.current=F.serialize(),j.dispose(),m.current=null}},[r,n,t,M]),y.useEffect(()=>{const j=m.current;j&&(j.options.scrollback=r)},[r]),y.useEffect(()=>{const j=m.current;j&&(j.options.theme=M,nf(j))},[M]),y.useEffect(()=>{if(l===0)return;const j=m.current;j&&requestAnimationFrame(()=>{j.focus()})},[l]),y.useEffect(()=>{if(a===0)return;const j=m.current;j&&(_.current=!1,b.current+=1,w.current=null,g.current=null,k(null),R(null),j.reset(),nf(j),n.command({type:"terminal.close",terminalId:t}).catch(F=>{R(F instanceof Error?F.message:String(F))}))},[a,n,t]),y.useEffect(()=>{u==null||u((C==null?void 0:C.cwd)??null)},[C==null?void 0:C.cwd,u]),y.useEffect(()=>{const j=B=>{const H=m.current;if(!H)return;const P=JSON.stringify({cwd:B.cwd,shell:B.shell,cols:B.cols,rows:B.rows,scrollback:B.scrollback,status:B.status,exitCode:B.exitCode,serializedState:B.serializedState});if(w.current===P){k({cwd:B.cwd,shell:B.shell,status:B.status,exitCode:B.exitCode}),g.current=B.serializedState||null;return}w.current=P,k({cwd:B.cwd,shell:B.shell,status:B.status,exitCode:B.exitCode}),g.current=B.serializedState||null,H.options.scrollback=B.scrollback,H.reset(),B.serializedState&&H.write(B.serializedState),nf(H)},F=()=>{const B=m.current,H=d.current;if(!B||!H)return;const P=bD(B,H)??yD(B);B.resize(P.cols,P.rows),S.current=P,n.command({type:"terminal.create",projectId:e,terminalId:t,cols:P.cols,rows:P.rows,scrollback:r}).then(U=>{_.current=!0,R(null),U&&j(U),D()}).catch(U=>{R(U instanceof Error?U.message:String(U))})},G=()=>{const B=++b.current,H=()=>{if(b.current!==B)return;const P=m.current,U=d.current;if(!P||!U)return;rf(P,U,S,!1,()=>{});const q=U.getBoundingClientRect();if(q.width<=0||q.height<=0){requestAnimationFrame(H);return}F()};requestAnimationFrame(()=>{requestAnimationFrame(H)})};return G(),n.subscribeTerminal(t,{onSnapshot:B=>{if(!B){_.current=!1,w.current=null,s==="connected"&&G();return}_.current=!0,R(null),j(B),D()},onEvent:B=>{const H=m.current;if(H){if(B.type==="terminal.output"){H.write(B.data);return}B.type==="terminal.exit"&&k(P=>({cwd:(P==null?void 0:P.cwd)??"",shell:(P==null?void 0:P.shell)??"",status:"exited",exitCode:B.exitCode}))}}})},[s,e,r,n,t]),p.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden pb-4",children:[p.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden px-3 py-1",children:p.jsx("div",{ref:d,className:"kanna-terminal min-h-0 min-w-0 flex-1 overflow-hidden w-full"})}),T?p.jsxs("div",{className:"px-3 py-1 text-xs text-destructive",children:["Terminal error: ",T]}):null]})}const FJ=24;function xD(e){return e+FJ}function UJ(e,t){return Math.max(1,e)*xD(t)}function LE({projectId:e,layout:t,socket:n,connectionStatus:r,scrollback:s,minColumnWidth:a,focusRequestVersion:l=0,splitTerminalShortcut:u,onAddTerminal:h,onRemoveTerminal:d,onTerminalLayout:m}){const g=y.useRef(null),_=y.useRef({}),b=y.useRef([]),[w,S]=y.useState(0),[C,k]=y.useState({}),[T,R]=y.useState({});y.useLayoutEffect(()=>{const G=g.current;if(!G)return;const B=()=>{S(G.getBoundingClientRect().width)},H=new ResizeObserver(B);return H.observe(G),B(),()=>H.disconnect()},[]);const M=t.terminals.length,O=xD(a),D=UJ(M,a),j=Math.max(w,D),F=y.useMemo(()=>t.terminals.map(G=>G.id).join(":"),[t.terminals]);return y.useLayoutEffect(()=>{const G=b.current,B=t.terminals.map(U=>U.id),H=B.find(U=>!G.includes(U));if(b.current=B,!H||G.length===0)return;const P=_.current[H];P&&P.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[t.terminals]),p.jsx("div",{className:"flex h-full min-h-0 flex-col",children:p.jsx("div",{ref:g,className:"min-h-0 flex-1 overflow-x-auto overflow-y-hidden",children:p.jsx("div",{className:"h-full min-h-0",style:{width:j||"100%"},children:p.jsx(bf,{orientation:"horizontal",className:"h-full min-h-0",onLayoutChanged:G=>m(e,t.terminals.map(B=>G[B.id]??B.size)),children:t.terminals.map((G,B)=>p.jsxs(y.Fragment,{children:[p.jsx(Wo,{id:G.id,defaultSize:`${G.size}%`,minSize:`${O}px`,className:"min-h-0 overflow-hidden",style:{minWidth:O},children:p.jsxs("div",{ref:H=>{_.current[G.id]=H},className:"flex h-full min-h-0 min-w-0 flex-col border-r border-border bg-transparent last:border-r-0",style:{minWidth:O},children:[p.jsxs("div",{className:"flex items-center gap-2 px-3 pr-2 pt-2 pb-1",children:[p.jsx("div",{className:"min-w-0 flex-1 text-left",children:p.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[p.jsx("div",{className:"shrink-0 text-sm font-medium",children:"Terminal"}),p.jsx("div",{className:"min-w-0 truncate text-xs text-muted-foreground",children:C[G.id]??""})]})}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Je,{variant:"ghost",size:"icon-sm","aria-label":"Clear terminal",onClick:()=>R(H=>({...H,[G.id]:(H[G.id]??0)+1})),children:p.jsx(jP,{className:"size-3.5"})}),p.jsxs(iu,{children:[p.jsx(su,{asChild:!0,children:p.jsx(Je,{variant:"ghost",size:"icon-sm","aria-label":"Add terminal to the right",onClick:()=>h(e,G.id),children:p.jsx(Rb,{className:"size-3.5"})})}),p.jsx(ml,{side:"bottom",shortcut:u})]}),p.jsx(Je,{variant:"ghost",size:"icon-sm","aria-label":"Archive terminal",onClick:()=>d(e,G.id),children:p.jsx(mo,{className:"size-3.5"})})]})]}),p.jsx(HJ,{projectId:e,terminalId:G.id,socket:n,scrollback:s,connectionStatus:r,clearVersion:T[G.id]??0,focusRequestVersion:B===0?l:0,onPathChange:H=>k(P=>P[G.id]===H?P:{...P,[G.id]:H})})]})}),B<t.terminals.length-1?p.jsx(xf,{withHandle:!0,orientation:"horizontal"}):null]},G.id))},F)})})})}function $J({onStop:e}){return p.jsx(bs,{className:"ml-[1px]",children:p.jsx(ZA,{children:p.jsxs("div",{className:"group/draining relative flex items-center gap-1.5",children:[p.jsxs("div",{className:"flex items-center gap-1.5 group-hover/draining:opacity-0 transition-opacity",children:[p.jsx(fi,{className:"size-4.5 animate-spin text-muted-icon"}),p.jsx(td,{className:"ml-[1px] text-sm",shimmerWidth:44,children:"Running..."})]}),p.jsxs("button",{onClick:e,className:"absolute inset-0 flex items-center gap-1.5 opacity-0 group-hover/draining:opacity-100 transition-opacity cursor-pointer",children:[p.jsx(mo,{className:"size-4.5 text-muted-foreground"}),p.jsx("span",{className:"text-sm text-muted-foreground",children:"Stop"})]})]})})})}const WJ={connecting:"Connecting...",acquiring_sandbox:"Booting...",initializing:"Initializing...",starting:"Starting...",running:"Running...",waiting_for_user:"Waiting...",failed:"Failed"};function VJ({status:e}){const t=(e?WJ[e]:void 0)||"Processing...",n=e==="failed";return p.jsx(bs,{className:"ml-[1px]",children:p.jsxs(ZA,{children:[n?p.jsx(mo,{className:"size-4.5 text-red-500"}):p.jsx(fi,{className:"size-4.5 animate-spin text-muted-icon"}),p.jsx(td,{className:"ml-[1px] text-sm",shimmerWidth:44,children:t})]})})}const wD={toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal"};function m_(e){return(e??[]).join(", ")}function nu(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const qJ=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function KJ(e,t){const n=GJ(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 ru(e,t,n){return((e==null?void 0:e.bindings[t])??ro[t]).some(s=>KJ(s,n))}function SD(e){return{bindings:{toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??ro.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??ro.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??ro.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??ro.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??ro.addSplitTerminal},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function GJ(e){const t=e.split("+").map(r=>r.trim()).filter(Boolean);if(t.length===0)return null;const n={key:"",ctrl:!1,meta:!1,alt:!1,shift:!1};for(const r of t){const s=r.toLowerCase(),a=qJ.get(s);if(a==="ctrl"){n.ctrl=!0;continue}if(a==="meta"){n.meta=!0;continue}if(a==="alt"){n.alt=!0;continue}if(a==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=s}return n.key?n:null}const Gp=20,Ky=50,CD=30;function kD(e){return Number.isFinite(e)?Math.min(Ky,Math.max(Gp,e)):CD}function YJ(){return{isVisible:!1,size:Gp}}function g_(e,t){return e[t]??YJ()}function XJ(e){return!e||typeof e!="object"?{projects:{}}:{projects:Object.fromEntries(Object.entries(e.projects??{}).map(([r,s])=>[r,{isVisible:!1,size:kD(s.size??CD)}]))}}const Nf=ua()(da(e=>({projects:{},toggleVisibility:t=>e(n=>({projects:{...n.projects,[t]:{...g_(n.projects,t),isVisible:!g_(n.projects,t).isVisible}}})),setSize:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...g_(r.projects,t),size:kD(n)}}})),clearProject:t=>e(n=>{const{[t]:r,...s}=n.projects;return{projects:s}})}),{name:"right-sidebar-layouts",version:2,migrate:XJ})),ZJ={isVisible:!1,size:Gp},rx=[68,32];function QJ(){return{isVisible:!1,mainSizes:[...rx],terminals:[],nextTerminalIndex:0}}function JJ(e,t){return e[t]??QJ()}function v_(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 eee(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 tee(e){if(e.length===0)return e;const t=e.length+1;return e.map(n=>({...n,size:n.size*e.length/t}))}function dl(e,t,n){return{...e,[t]:n(JJ(e,t))}}const eo=ua()(da(e=>({projects:{},addTerminal:(t,n)=>e(r=>({projects:dl(r.projects,t,s=>{var h,d;const a=tee(s.terminals),l={id:((d=(h=globalThis.crypto)==null?void 0:h.randomUUID)==null?void 0:d.call(h))??`terminal-${Date.now()}-${s.nextTerminalIndex}`,title:eee(s.nextTerminalIndex),size:100/(a.length+1)},u=n?Math.max(a.findIndex(m=>m.id===n)+1,0):a.length;return{...s,isVisible:!0,nextTerminalIndex:s.nextTerminalIndex+1,terminals:[...a.slice(0,u),l,...a.slice(u)]}})})),removeTerminal:(t,n)=>e(r=>({projects:dl(r.projects,t,s=>{const a=s.terminals.filter(u=>u.id!==n);if(a.length===0)return{...s,isVisible:!1,terminals:[]};const l=v_(a.map(u=>u.size));return{...s,terminals:a.map((u,h)=>({...u,size:l[h]??100/a.length}))}})})),toggleVisibility:t=>e(n=>({projects:dl(n.projects,t,r=>({...r,isVisible:r.terminals.length>0?!r.isVisible:!1}))})),resetMainSizes:t=>e(n=>({projects:dl(n.projects,t,r=>({...r,mainSizes:[...rx]}))})),setMainSizes:(t,n)=>e(r=>{if(n.length!==2)return r;const s=v_(n);return{projects:dl(r.projects,t,a=>({...a,mainSizes:s}))}}),setTerminalSizes:(t,n)=>e(r=>({projects:dl(r.projects,t,s=>{if(n.length!==s.terminals.length)return s;const a=v_(n);return{...s,terminals:s.terminals.map((l,u)=>({...l,size:a[u]??l.size}))}})})),clearProject:t=>e(n=>{const{[t]:r,...s}=n.projects;return{projects:s}})}),{name:"terminal-layouts",version:1})),nee={isVisible:!1,mainSizes:[...rx],terminals:[],nextTerminalIndex:0},lp=1e3,Gy=500,Yy=5e3,cp=450,Xy=250,Zy=900,Qy="cursor";function Jy(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 ree(e){switch(e){case"vscode":return"VS Code";case"windsurf":return"Windsurf";case"custom":return"Custom";case"cursor":default:return"Cursor"}}function zE(e){return Number.isFinite(e)?Math.min(Yy,Math.max(Gy,Math.round(e))):lp}function PE(e){return Number.isFinite(e)?Math.min(Zy,Math.max(Xy,Math.round(e))):cp}function BE(e){switch(e){case"vscode":case"windsurf":case"custom":case"cursor":return e;default:return Qy}}function __(e,t){const n=e==null?void 0:e.trim();return n&&n.length>0?n:Jy(t)}const Gr=ua()(da(e=>({scrollbackLines:lp,minColumnWidth:cp,editorPreset:Qy,editorCommandTemplate:Jy(Qy),setScrollbackLines:t=>e({scrollbackLines:zE(t)}),setMinColumnWidth:t=>e({minColumnWidth:PE(t)}),setEditorPreset:t=>e(n=>{const r=BE(t);return{editorPreset:r,editorCommandTemplate:r==="custom"?__(n.editorCommandTemplate,r):Jy(r)}}),setEditorCommandTemplate:t=>e(n=>({editorCommandTemplate:__(t,n.editorPreset)}))}),{name:"terminal-preferences",version:3,migrate:e=>{const t=e,n=BE(t==null?void 0:t.editorPreset);return{scrollbackLines:zE((t==null?void 0:t.scrollbackLines)??lp),minColumnWidth:PE((t==null?void 0:t.minColumnWidth)??cp),editorPreset:n,editorCommandTemplate:__(t==null?void 0:t.editorCommandTemplate,n)}}})),iee=35;function see(e,t){return!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?0:e*(t/100)}function oee(e,t){const n=see(e,t);return n>=0&&n<iee}const yl=350,aee=[.4,0,.2,1],lee=8,IE=1e-6;function cee(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function uee(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function dee(e,t,n){const r=1-e;return 3*r*r*t+6*r*e*(n-t)+3*e*e*(1-n)}function hee(e,t,n){let r=e;for(let s=0;s<lee;s+=1){const a=cee(r,t,n)-e;if(Math.abs(a)<IE)return r;const l=dee(r,t,n);if(Math.abs(l)<IE)break;r-=a/l}return r}function fee(e){if(e<=0)return 0;if(e>=1)return 1;const[t,n,r,s]=aee,a=hee(e,t,r);return uee(a,n,s)}function ED(e,t,n){const r=fee(n);return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function pee({projectId:e,shouldRenderRightSidebarLayout:t,showRightSidebar:n,rightSidebarSize:r}){const s=y.useRef(null),a=y.useRef(null),l=y.useRef(null),u=y.useRef(null),h=y.useRef(null),d=y.useRef(!1),m=y.useRef(null),g=y.useRef(!1),_=y.useRef(!1);return y.useEffect(()=>()=>{u.current!==null&&window.cancelAnimationFrame(u.current),h.current!==null&&window.clearTimeout(h.current)},[]),y.useLayoutEffect(()=>{var j,F,G,B,H,P;if(!t){u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null),d.current=!1;return}const b=s.current;if(!b)return;u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null);const w=m.current,S=w!==null&&w!==e,C=n&&!_.current,k=!g.current,T=n?[100-r,r]:[100,0],R=S||k&&n,M=C||k?[100,0]:[b.getLayout().workspace??T[0],b.getLayout().rightSidebar??T[1]];if(m.current=e,g.current=t,_.current=n,R||Math.abs(M[0]-T[0])<.1&&Math.abs(M[1]-T[1])<.1){b.setLayout({workspace:T[0],rightSidebar:T[1]}),(j=a.current)==null||j.setAttribute("data-right-sidebar-open",n?"true":"false"),(F=l.current)==null||F.setAttribute("data-right-sidebar-open",n?"true":"false"),(G=l.current)==null||G.setAttribute("data-right-sidebar-animated","false");return}d.current=!0,(B=a.current)==null||B.setAttribute("data-right-sidebar-open",n?"true":"false"),(H=l.current)==null||H.setAttribute("data-right-sidebar-open",n?"true":"false"),(P=l.current)==null||P.setAttribute("data-right-sidebar-animated","true"),b.setLayout({workspace:M[0],rightSidebar:M[1]});const O=performance.now(),D=U=>{const q=Math.min(1,(U-O)/yl),W=ED(M,T,q);if(b.setLayout({workspace:W[0],rightSidebar:W[1]}),q<1){u.current=window.requestAnimationFrame(D);return}b.setLayout({workspace:T[0],rightSidebar:T[1]}),u.current=null,h.current=window.setTimeout(()=>{d.current=!1,h.current=null},0)};u.current=window.requestAnimationFrame(D)},[e,r,t,n]),y.useEffect(()=>{t||(g.current=!1,_.current=!1)},[t]),{isAnimating:d,panelGroupRef:s,sidebarPanelRef:a,sidebarVisualRef:l}}function mee(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 gee({previousProjectId:e,projectId:t,previousShouldRenderTerminalLayout:n,previousShowTerminalPane:r,showTerminalPane:s,terminalLayout:a,liveLayout:l}){const u=e!==null&&e!==t,h=s&&!r,d=!n,m=e===null&&t!==null,g=s?a.mainSizes:[100,0];return{currentLayout:h||d?[100,0]:l,shouldSkipAnimation:u||m&&d,targetLayout:g}}function vee({chatInputRef:e,projectId:t,shouldRenderTerminalLayout:n,showTerminalPane:r,terminalLayout:s}){const a=y.useRef(null),l=y.useRef(null),u=y.useRef(null),h=y.useRef(null),d=y.useRef(null),m=y.useRef(!1),g=y.useRef(null),_=y.useRef(!1),b=y.useRef(!1),w=y.useRef(!1),[S,C]=y.useState(0);return y.useEffect(()=>{var R;const k=g.current,T=w.current;mee({previousProjectId:k,projectId:t,showTerminalPane:r,wasTerminalVisible:T})&&C(M=>M+1),k!==null&&k===t&&!r&&T&&((R=e.current)==null||R.focus({preventScroll:!0})),w.current=r,g.current=t},[e,t,r]),y.useEffect(()=>()=>{h.current!==null&&window.cancelAnimationFrame(h.current),d.current!==null&&window.clearTimeout(d.current)},[]),y.useLayoutEffect(()=>{var F,G,B,H,P,U;if(!n){h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null),m.current=!1;return}const k=a.current;if(!k)return;h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null);const T=g.current,{currentLayout:R,shouldSkipAnimation:M,targetLayout:O}=gee({previousProjectId:T,projectId:t,previousShouldRenderTerminalLayout:_.current,previousShowTerminalPane:b.current,showTerminalPane:r,terminalLayout:s,liveLayout:[k.getLayout().chat??s.mainSizes[0],k.getLayout().terminal??s.mainSizes[1]]});if(_.current=n,b.current=r,M||Math.abs(R[0]-O[0])<.1&&Math.abs(R[1]-O[1])<.1){k.setLayout({chat:O[0],terminal:O[1]}),(F=l.current)==null||F.setAttribute("data-terminal-open",r?"true":"false"),(G=u.current)==null||G.setAttribute("data-terminal-open",r?"true":"false"),(B=u.current)==null||B.setAttribute("data-terminal-animated","false");return}m.current=!0,(H=l.current)==null||H.setAttribute("data-terminal-open",r?"true":"false"),(P=u.current)==null||P.setAttribute("data-terminal-open",r?"true":"false"),(U=u.current)==null||U.setAttribute("data-terminal-animated","true"),k.setLayout({chat:R[0],terminal:R[1]});const D=performance.now(),j=q=>{const W=Math.min(1,(q-D)/yl),z=ED(R,O,W);if(k.setLayout({chat:z[0],terminal:z[1]}),W<1){h.current=window.requestAnimationFrame(j);return}k.setLayout({chat:O[0],terminal:O[1]}),h.current=null,d.current=window.setTimeout(()=>{m.current=!1,d.current=null},0)};h.current=window.requestAnimationFrame(j)},[t,n,r,s.mainSizes]),y.useEffect(()=>{n||(_.current=!1,b.current=!1)},[n]),{isAnimating:m,mainPanelGroupRef:a,terminalFocusRequestVersion:S,terminalPanelRef:l,terminalVisualRef:u}}function _ee({content:e,attachments:t=[]}){const[n,r]=y.useState(null),s=y.useMemo(()=>t.filter(h=>h.kind==="image"&&h.contentUrl),[t]),a=y.useMemo(()=>t.filter(h=>h.kind!=="image"||!h.contentUrl),[t]),l=t.find(h=>h.id===n)??null;function u(h){if(v0(h).openInNewTab){typeof window<"u"&&window.open(new URL(h.contentUrl,window.location.origin).toString(),"_blank","noopener,noreferrer");return}r(h.id)}return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-col items-end gap-2",children:[s.length>0?p.jsx("div",{className:"flex max-w-[85%] sm:max-w-[80%] flex-wrap justify-end gap-3",children:s.map(h=>p.jsx(FN,{attachment:h,onClick:()=>u(h)},h.id))}):null,a.length>0?p.jsx("div",{className:"flex max-w-[85%] sm:max-w-[80%] flex-wrap justify-end gap-2",children:a.map(h=>p.jsx(UN,{attachment:h,onClick:()=>u(h)},h.id))}):null,e?p.jsx("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:p.jsx(Kl,{remarkPlugins:[Gl],components:hd(),children:e})}):null]}),p.jsx(JA,{attachment:l,onOpenChange:h=>!h&&r(null)})]})}function yee({json:e}){return p.jsx("div",{className:"flex gap-3 justify-start",children:p.jsx("div",{className:"flex-1 max-w-[90%]",children:p.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 RD({title:e,count:t,children:n,badge:r}){const[s,a]=y.useState(!1);return t===0?null:p.jsxs("div",{className:"flex flex-col gap-1.5",children:[p.jsxs("button",{onClick:()=>a(!s),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[p.jsx(fs,{className:be("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",s&&"rotate-90")}),p.jsx("span",{className:"text-muted-foreground font-medium",children:e}),p.jsx("span",{className:"text-muted-foreground/60",children:t}),r]}),s&&p.jsx("div",{className:"ml-5",children:n})]})}function y_({title:e,items:t,icon:n,getIcon:r}){return t.length===0?null:p.jsx(RD,{title:e,count:t.length,children:p.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(s=>p.jsx(QA,{icon:r?r(s):n,children:s},s))})})}function bee(e){const t=e.match(/^mcp__([^_]+)__(.+)$/);return t?{server:t[1],tool:t[2]}:null}function TD({status:e}){const t=e==="connected"?"bg-emerald-500":e==="pending"?"bg-yellow-500":"bg-red-500";return p.jsx("span",{className:be("inline-block h-2 w-2 rounded-full shrink-0",t)})}function xee(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 HE({server:e}){const[t,n]=y.useState(!1),r=e.status==="connected";return p.jsxs("div",{className:"flex flex-col gap-1.5",children:[p.jsxs("button",{onClick:()=>r&&e.tools.length>0&&n(!t),className:be("flex items-center gap-1.5",r&&e.tools.length>0&&"cursor-pointer hover:opacity-60 transition-opacity"),children:[r&&e.tools.length>0&&p.jsx(fs,{className:be("h-3 w-3 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),p.jsx(TD,{status:e.status}),p.jsx("span",{className:"text-muted-foreground font-medium",children:z_(e.name)}),r?p.jsxs("span",{className:"text-muted-foreground/50",children:[e.tools.length," tools"]}):p.jsx("span",{className:"text-muted-foreground/50",children:xee(e.status)})]}),!r&&e.error&&p.jsx("span",{className:"text-destructive ml-5",children:e.error}),t&&e.tools.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1.5 ml-5",children:e.tools.map(s=>p.jsx(QA,{icon:XA(`mcp__${e.name}__${s}`),children:s},s))})]})}function wee({servers:e}){if(e.length===0)return null;const t=e.filter(s=>s.status==="connected"),n=e.filter(s=>s.status!=="connected"),r=n.length>0?p.jsxs("span",{className:"flex items-center gap-1 ml-1",children:[p.jsx(TD,{status:"failed"}),p.jsxs("span",{className:"text-muted-foreground/60",children:[n.length," disconnected"]})]}):null;return p.jsx(RD,{title:"MCP Servers",count:e.length,badge:r,children:p.jsxs("div",{className:"flex flex-col gap-2",children:[t.map(s=>p.jsx(HE,{server:s},s.name)),n.map(s=>p.jsx(HE,{server:s},s.name))]})})}function See({rawJson:e}){const[t,n]=y.useState(!1);return p.jsxs("div",{className:"flex flex-col gap-1.5",children:[p.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[p.jsx(fs,{className:be("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),p.jsx("span",{className:"text-muted-foreground font-medium",children:"Raw Message"})]}),t&&p.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 Cee({message:e,rawJson:t}){const{coreTools:n,mcpServersWithTools:r}=y.useMemo(()=>{const s=new Map,a=[];for(const u of e.tools){const h=bee(u);if(h){const d=s.get(h.server)||[];d.push(h.tool),s.set(h.server,d)}else a.push(u)}const l=e.mcpServers.map(u=>({name:u.name,status:u.status,error:u.error,tools:s.get(u.name)||[]}));return{coreTools:a,mcpServersWithTools:l}},[e.tools,e.mcpServers]);return p.jsx(bs,{children:p.jsxs(Up,{expandedContent:p.jsx($p,{className:"my-4 text-xs",children:p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(dY,{children:e.model}),p.jsx(y_,{title:"Tools",items:n,getIcon:s=>ay[s]??YA}),p.jsx(y_,{title:"Agents",items:e.agents,icon:Nb}),p.jsx(y_,{title:"Commands",items:e.slashCommands,icon:KB}),p.jsx(wee,{servers:r}),t&&p.jsx(See,{rawJson:t})]})}),children:[p.jsx(iP,{className:"h-5 w-5 text-logo"}),p.jsx(fo,{children:"Session Started"})]})})}function kee({message:e}){return p.jsx(bs,{className:"hidden",children:p.jsxs(Up,{expandedContent:p.jsx($p,{className:"my-4 text-xs",children:p.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:[p.jsx("div",{className:"size-5 flex justify-center items-center ",children:p.jsx(Nb,{className:"h-4 w-4 text-muted-foreground"})}),p.jsx(fo,{children:"Account"})]})})}function Eee({message:e}){return p.jsx("div",{className:"text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-full space-y-4",children:p.jsx(Kl,{remarkPlugins:[Gl],components:hd(),children:e.text})})}function Ree({question:e,currentIndex:t,totalQuestions:n,onBack:r,children:s}){const a=r&&t>0;return p.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[p.jsxs("div",{className:"relative",children:[p.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border text-foreground flex flex-row items-center gap-2",children:[a?p.jsx("button",{onClick:r,className:" text-muted-foreground hover:opacity-60 transition-all flex items-center",children:p.jsx(gP,{className:"h-4 w-4 -ml-0.5",strokeWidth:3})}):n>1?p.jsxs("span",{className:"font-bold text-muted-foreground whitespace-nowrap",children:[t+1," of ",n]}):null,e]}),n>1&&p.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-border",children:p.jsx("div",{className:"h-full bg-muted-foreground/40 transition-all duration-300",style:{width:`${t/n*100}%`}})})]}),s]})}function FE({label:e,description:t}){return p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-foreground text-sm",children:e}),t&&p.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]})}function MD({selected:e,multiSelect:t,onClick:n}){return p.jsx("button",{type:"button",onClick:n,className:be("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&&p.jsx(co,{strokeWidth:3,className:"translate-y-[0.5px] h-3 w-3 text-white dark:text-background"})})}function Tee({option:e,selected:t,multiSelect:n,onClick:r,isLast:s}){const a="w-full text-left p-3 pt-2.5 pl-4 pr-5 bg-background",l=s?"":"border-b border-border";return r?p.jsx("button",{onClick:r,className:be(a,l,"transition-all cursor-pointer"),children:p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx(FE,{label:e.label,description:e.description})}),p.jsx(MD,{selected:t,multiSelect:n})]})}):p.jsx("div",{className:be(a,l),children:p.jsx(FE,{label:e.label,description:e.description})})}function Mee(e){return e==null?void 0:e.answers}function oi(e){return e.id||e.question}function Nee({message:e,onSubmit:t,isLatest:n}){var z,$;const r=e.input.questions,s=!!e.result,a=Mee(e.result),l=((z=e.result)==null?void 0:z.discarded)===!0,[u,h]=y.useState(0),[d,m]=y.useState({}),[g,_]=y.useState({}),[b,w]=y.useState(a??null),[S,C]=y.useState(s),k=(V,Q)=>{var de;const N=(de=g[V])==null?void 0:de.trim(),I=d[V]||"",Z=Q||r.find(me=>oi(me)===V);if(Z!=null&&Z.multiSelect)return[I,N].filter(Boolean).flatMap(me=>me.split(", ").filter(Boolean));const L=N||I;return L?[L]:[]},T=V=>{const Q=d[oi(V)]||"";return V.multiSelect?Q.split(", ").filter(Boolean):[Q]},R=(V,Q)=>{const N=oi(V);if(V.multiSelect){const I=d[N]?d[N].split(", ").filter(Boolean):[],Z=I.includes(Q)?I.filter(L=>L!==Q):[...I,Q];m({...d,[N]:Z.join(", ")})}else m({...d,[N]:Q}),_({...g,[N]:""}),u<r.length-1&&setTimeout(()=>h(u+1),150)},M=(V,Q)=>{const N=oi(V);_({...g,[N]:Q}),Q&&!V.multiSelect&&m({...d,[N]:""})},O=V=>{const Q=oi(V);V.multiSelect&&g[Q]&&_({...g,[Q]:""})},D=r.every(V=>k(oi(V),V).length>0),j=r[u],F=u===r.length-1,G=j&&k(oi(j),j).length>0,B=()=>{u<r.length-1&&h(u+1)},H=()=>{u>0&&h(u-1)},P=()=>{if(!D)return;const V={};for(const Q of r){const N=oi(Q);V[N]=k(N,Q)}w(V),C(!0),t(e.toolId,r,V)},U=V=>{if(V.key==="Enter"&&!(!j||!G)){if(V.preventDefault(),F){P();return}B()}};if(S||s){const V=a||b||{};return p.jsx("div",{className:"w-full",children:p.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[p.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:[p.jsxs("p",{children:["Question",r.length!==1?"s":""]}),p.jsx("p",{className:"",children:l?"Discarded":"Answers"})]}),r.map((Q,N)=>{const I=V[oi(Q)]||V[Q.question]||[],Z=N===r.length-1;return p.jsxs("div",{className:be("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:[p.jsx("div",{className:"text-sm text-pretty",children:Q.question}),I.length>0&&p.jsx("div",{className:"text-sm font-medium text-right max-w-[50%] text-pretty",children:I.join(", ")}),I.length===0&&p.jsx("div",{className:"text-sm font-medium text-right italic",children:l?"Discarded":"No Response"})]},oi(Q))})]})})}if(!n)return p.jsx("div",{className:"w-full py-2",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(kT,{className:"h-4 w-4 text-muted-foreground"}),p.jsx("span",{className:"text-sm text-muted-foreground",children:"Questions pending (newer question active)"})]})});if(!j)return null;const q=T(j),W=g[oi(j)]||"";return p.jsxs("div",{className:"w-full space-y-3",children:[p.jsxs(Ree,{question:j.question,currentIndex:u,totalQuestions:r.length,onBack:u>0?H:void 0,children:[($=j.options)==null?void 0:$.map(V=>p.jsx(Tee,{option:V,selected:q.includes(V.label),multiSelect:j.multiSelect,onClick:()=>R(j,V.label)},V.label)),p.jsx("div",{className:"transition-all bg-background",children:p.jsxs("div",{className:"flex pr-5 items-center justify-between gap-3",children:[p.jsx("input",{type:"text",value:W,onChange:V=>M(j,V.target.value),onKeyDown:U,placeholder:"Other...",className:"flex-1 px-3 !py-1 pl-4 min-h-[55px] min-w-0 text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),p.jsx(MD,{selected:!!W,multiSelect:j.multiSelect,onClick:j.multiSelect&&W?()=>O(j):void 0})]})})]}),p.jsxs("div",{className:"flex justify-end gap-2 mx-2",children:[!F&&G&&(j.multiSelect||!!W)&&p.jsx(Je,{size:"sm",onClick:B,children:"Next"}),F&&p.jsx(Je,{size:"sm",onClick:P,disabled:!D,className:be(!D&&"opacity-50 cursor-not-allowed","rounded-full"),children:"Submit"})]})]})}function Aee({message:e,onConfirm:t,isLatest:n}){const r=!!e.result,[s,a]=y.useState(!1),[l,u]=y.useState(!1),[h,d]=y.useState(!1),[m,g]=y.useState(""),_=y.useRef(null),b=e.input;y.useEffect(()=>{h&&_.current&&_.current.focus()},[h]);const w=async()=>{b!=null&&b.plan&&(await navigator.clipboard.writeText(b.plan),u(!0),setTimeout(()=>u(!1),2e3))},S=r?e.result:null,C=(S==null?void 0:S.discarded)===!0;return p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsxs("div",{className:"relative rounded-2xl border border-border overflow-hidden group/plan",children:[(b==null?void 0:b.plan)&&p.jsx(Je,{variant:"ghost",size:"icon",className:be("absolute top-2 right-2 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-0 group-hover/plan:opacity-100 transition-opacity",!l&&"hover:text-foreground",l&&"hover:!bg-transparent hover:!border-transparent"),onClick:w,children:l?p.jsx(co,{className:"h-4 w-4 text-green-400"}):p.jsx(Zu,{className:"h-4 w-4"})}),p.jsxs("div",{className:be("!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",r&&!s?"max-h-[min(400px,40vh)] ":"",r?"hover:!pb-[32px]":""),children:[r&&p.jsxs(Je,{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:()=>a(!s),children:[s?"Show Less":"Show More",p.jsx(wb,{className:`size-3.5 transition-transform ${s?"rotate-180":""}`})]}),b!=null&&b.plan?p.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[p.jsx(Kl,{remarkPlugins:[Gl],components:hd(),children:b.plan}),p.jsx("div",{className:"mt-5"})]}):p.jsx("p",{className:"text-sm text-muted-foreground",children:"No plan provided"})]})]}),r?p.jsx("div",{className:"flex justify-end mx-2",children:p.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:[p.jsx("em",{children:C?"Discarded":S!=null&&S.clearContext?"Approved & Cleared Context":S!=null&&S.confirmed?"Approved":S!=null&&S.message?`Adjusted: "${S.message}"`:"Adjusted Plan"}),p.jsx(DP,{className:"inline h-4 w-4 ml-1.5 -mt-0.5"})]})}):n?p.jsxs("div",{className:"flex flex-col gap-3",children:[!h&&p.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-end gap-2 mx-2",children:[p.jsxs(Je,{size:"sm",onClick:()=>t(e.toolId,!0,!0),className:"rounded-full bg-primary text-background pr-4 md:order-last",children:[p.jsx(uP,{className:"h-4 w-4 mr-1.5"}),"Approve & Clear"]}),p.jsxs("div",{className:"flex items-stretch md:items-center gap-2 md:contents",children:[p.jsxs(Je,{size:"sm",variant:"outline",onClick:()=>d(!0),className:"rounded-full border-border flex-1 md:flex-initial md:order-first",children:[p.jsx(RT,{className:"h-4 w-4 mr-1.5"}),"Suggest Edits"]}),p.jsxs(Je,{size:"sm",variant:"outline",onClick:()=>t(e.toolId,!0),className:"rounded-full border-border flex-1 md:flex-initial",children:[p.jsx(co,{className:"h-4 w-4 mr-1.5"}),"Approve"]})]})]}),h&&p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsx("textarea",{ref:_,value:m,onChange:k=>g(k.target.value),onKeyDown:k=>{k.key==="Enter"&&!k.shiftKey&&m.trim()&&(k.preventDefault(),t(e.toolId,!1,void 0,m.trim())),k.key==="Escape"&&(d(!1),g(""))},placeholder:"Describe what you'd like to change...",rows:3,className:"w-full rounded-2xl border border-border bg-muted dark:bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none"}),p.jsxs("div",{className:"flex items-center justify-end gap-2 mx-2",children:[p.jsx(Je,{size:"sm",variant:"ghost",onClick:()=>{d(!1),g("")},className:"rounded-full text-muted-foreground",children:"Cancel"}),p.jsxs(Je,{size:"sm",disabled:!m.trim(),onClick:()=>t(e.toolId,!1,void 0,m.trim()),className:"rounded-full bg-primary text-background disabled:opacity-50 disabled:pointer-events-none",children:[p.jsx(FB,{className:"h-4 w-4 mr-1.5"}),"Adjust Plan"]})]})]})]}):p.jsx("div",{className:"flex justify-end mx-2",children:p.jsx("span",{className:"inline text-sm text-muted-foreground italic",children:"Plan pending (newer prompt active)"})})]})}const Dee={completed:{Icon:co,iconClass:"text-emerald-500",textClass:"text-muted-foreground"},in_progress:{Icon:fi,iconClass:"text-foreground animate-spin",textClass:"text-foreground font-medium"},pending:{Icon:SP,iconClass:"text-muted-foreground",textClass:"text-muted-foreground"}};function Oee({message:e}){const t=e.input.todos;return t.length?p.jsx("div",{className:"w-full",children:p.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[p.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:[p.jsx(fB,{className:"h-4 w-4 text-muted-foreground"}),"Progress"]}),p.jsx("div",{children:t.map((n,r)=>{const s=r===t.length-1,{Icon:a,iconClass:l,textClass:u}=Dee[n.status];return p.jsxs("div",{className:be("flex items-center gap-3 px-4 py-2.5 bg-background",!s&&"border-b border-border"),children:[p.jsx(a,{className:be("h-4 w-4 flex-shrink-0",l)}),p.jsx("span",{className:be("text-sm",u),children:n.status==="in_progress"?n.activeForm:n.content})]},r)})})]})}):null}function UE(e){return(e&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)?e.content:Array.isArray(e)?e:[]).flatMap(n=>!n||typeof n!="object"||!("type"in n)||n.type!=="image"?[]:"data"in n&&typeof n.data=="string"?[{type:"image",data:n.data,mimeType:typeof n.mimeType=="string"?n.mimeType:void 0}]:"source"in n&&n.source&&typeof n.source=="object"&&"type"in n.source&&n.source.type==="base64"&&"data"in n.source&&typeof n.source.data=="string"?[{type:"image",data:n.source.data,mimeType:typeof n.source.media_type=="string"?n.source.media_type:void 0}]:[])}function jee({images:e}){return p.jsx("div",{className:"flex flex-col gap-3",children:e.map((t,n)=>{const r=t.mimeType||"image/png";return p.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-muted/20",children:p.jsx("img",{src:`data:${r};base64,${t.data}`,alt:`Read result ${n+1}`,className:"max-h-[50vh] w-full object-contain bg-background"})},`${r}:${n}`)})})}function ND({message:e,isLoading:t=!1,localPath:n}){var S;const r=e.result!==void 0,s=!r&&t,a=y.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 C=e.input.pattern,k=e.input.outputMode;return k==="count"?`Count \`${C}\` occurrences`:k==="content"?`Find \`${C}\` in text`:`Find \`${C}\` in files`}return e.toolKind==="bash"?e.input.description||(e.input.command?R7(e.input.command):"Bash"):e.toolKind==="web_search"?e.input.query||"Web Search":e.toolKind==="read_file"?`Read ${Qv(e.input.filePath,n)}`:e.toolKind==="write_file"?`Write ${Qv(e.input.filePath,n)}`:e.toolKind==="edit_file"?`Edit ${Qv(e.input.filePath,n)}`:e.toolKind==="mcp_generic"?`${z_(e.input.tool)} from ${z_(e.input.server)}`:e.toolKind==="subagent_task"&&e.input.subagentType||e.toolName},[e.input,e.toolName,n]),l=y.useMemo(()=>e.toolKind==="subagent_task",[e.toolKind]),u=y.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill},[e.input,e.toolKind]),h=e.toolKind==="bash",d=e.toolKind==="write_file",m=e.toolKind==="edit_file",g=e.toolKind==="read_file",_=y.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 C=e.result.content;if(typeof C=="string")return C}return JSON.stringify(e.result,null,2)},[e.result]),b=y.useMemo(()=>{if(!g)return[];if(e.result&&typeof e.result=="object"&&"blocks"in e.result){const C=e.result.blocks;if(Array.isArray(C)){const k=UE(C);if(k.length>0)return k}}return UE(e.rawResult)},[g,e.rawResult,e.result]),w=y.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 p.jsx(bs,{className:"w-full",children:p.jsxs(Up,{expandedContent:p.jsx($p,{className:"my-4 text-sm",children:p.jsxs("div",{className:"flex flex-col gap-2",children:[m?p.jsx(_f,{content:"",isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):!g&&!d&&p.jsx(_k,{label:h?p.jsxs("span",{className:"flex items-center gap-2 w-full",children:[p.jsx("span",{children:"Command"}),!!e.input.timeoutMs&&p.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeoutMs),"ms"]}),!!e.input.runInBackground&&p.jsx("span",{className:"text-muted-foreground",children:"background"})]}):d?"Contents":"Input",copyText:w,children:w}),r&&g&&!e.isError&&(b.length>0?p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-muted-foreground",children:"Image"}),p.jsx("div",{className:"mt-1",children:p.jsx(jee,{images:b})})]}):p.jsx(_f,{content:_})),d&&!e.isError&&p.jsx(_f,{content:e.input.content}),r&&!g&&!(d&&!e.isError)&&!(m&&!e.isError)&&p.jsx(_k,{label:e.isError?"Error":"Result",copyText:_,children:_})]})}),children:[p.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:(()=>{if(e.isError)return p.jsx(mo,{className:"size-4 text-destructive"});if(l)return p.jsx(Nb,{className:"size-4 text-muted-icon"});const C=XA(e.toolName);return p.jsx(C,{className:"size-4 text-muted-icon"})})()}),p.jsx(fo,{className:"text-left transition-opacity duration-200 truncate",children:p.jsx(td,{animate:s,shimmerWidth:Math.max(20,(((S=u||a)==null?void 0:S.length)??33)*3),children:u||a})})]})})}function Lee({message:e}){const t=n=>{if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3),s=Math.floor(r/3600),a=Math.floor(r%3600/60),l=r%60;return s>0?`${s}h${a>0?` ${a}m`:""}`:a>0?`${a}m${l>0?` ${l}s`:""}`:`${l}s`};return e.success?p.jsxs(bs,{className:`px-0.5 text-xs tracking-wide ${e.durationMs>6e4?"":"hidden"}`,children:[p.jsx("div",{className:"w-full h-[1px] bg-border"}),p.jsxs(fo,{className:"whitespace-nowrap text-[11px] tracking-widest text-muted-foreground/60 uppercase flex-shrink-0",children:["Worked for ",t(e.durationMs)]}),p.jsx("div",{className:"w-full h-[1px] bg-border"})]}):p.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 zee({message:e}){return p.jsx("div",{className:"flex items-center justify-end gap-2 text-sm text-muted-foreground my-3",children:p.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:[p.jsx(xP,{className:"h-4 w-4 ml-1.5"}),p.jsx("em",{children:"Interrupted"})]})})}function up({size:e=4}){return p.jsxs("svg",{className:"flex-1",viewBox:`0 0 100 ${e}`,preserveAspectRatio:"none",style:{height:`${e}px`},children:[p.jsx("pattern",{id:"zigzag",width:e,height:e,patternUnits:"userSpaceOnUse",children:p.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"}})}),p.jsx("rect",{width:"100%",height:e,fill:"url(#zigzag)",className:"text-muted-foreground/30"})]})}function Pee(){return p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(up,{}),p.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),p.jsx(up,{})]})}function Bee(){return p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(up,{}),p.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),p.jsx(up,{})]})}function Iee({message:e}){return p.jsx(bs,{children:p.jsxs(Up,{expandedContent:p.jsx($p,{className:"my-4 text-xs",children:p.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:p.jsx(Kl,{remarkPlugins:[Gl],components:hd(),children:e.summary})})}),children:[p.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:p.jsx(ET,{className:"h-4.5 w-4.5 text-muted-foreground"})}),p.jsx(fo,{children:"Summarized"})]})})}const Hee={compacting:"Compacting..."};function Fee({message:e}){const t=Hee[e.status]||e.status;return p.jsxs(bs,{className:"grid grid-cols-[auto_1fr] items-center gap-1.5 text-sm animate-pulse",children:[p.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:p.jsx(ET,{className:"h-4.5 w-4.5 text-muted-foreground"})}),p.jsx(fo,{className:"text-left transition-opacity duration-200 truncate",children:t})]})}const Uee={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"}},$ee={key:"other",singular:"tool call",plural:"tool calls"};function Wee(e){return Uee[e]??$ee}function Vee(e){const t=new Map,n=[];for(const r of e){const s=r.toolKind,a=Wee(s),l=t.get(a.key);l?l.count++:(t.set(a.key,{category:a,count:1}),n.push(a.key))}return n.map(r=>{const{category:s,count:a}=t.get(r);return`${a} ${a===1?s.singular:s.plural}`}).join(", ")}function qee({messages:e,isLoading:t,localPath:n}){const[r,s]=y.useState(!1),a=y.useMemo(()=>Vee(e),[e]),u=e.some(h=>h.result===void 0)&&t;return p.jsx(bs,{className:"w-full",children:p.jsxs("div",{className:"flex flex-col w-full",children:[p.jsx("button",{onClick:()=>s(!r),className:`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!r&&!u?"hover:opacity-60 transition-opacity":""}`,children:p.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[p.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:p.jsx(fs,{className:`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${r?"rotate-90":""}`})}),p.jsx(fo,{className:"text-left",children:p.jsx(td,{animate:u,children:a})})]})}),r&&p.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[e.map(h=>p.jsx(ND,{message:h,isLoading:t,localPath:n},h.id)),e.length>5&&p.jsx("button",{onClick:()=>s(!1),className:"cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-xs hover:opacity-80 transition-opacity",children:p.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[p.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:p.jsx(fs,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),p.jsx(fo,{className:"text-left",children:"Collapse"})]})})]})]})})}const Kee=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function $E(e){if(e.kind!=="tool")return!1;const t=e.toolName;return!Kee.has(t)}function Gee(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if($E(r)){const s=[r],a=n;for(n+=1;n<e.length&&$E(e[n]);)s.push(e[n]),n+=1;s.length>=2?t.push({type:"tool-group",messages:s,startIndex:a}):t.push({type:"single",message:r,index:a});continue}t.push({type:"single",message:r,index:n}),n+=1}return t}function Yee({messages:e,isLoading:t,localPath:n,latestToolIds:r,onOpenLocalLink:s,onAskUserQuestionSubmit:a,onExitPlanModeConfirm:l}){const u=y.useMemo(()=>Gee(e),[e]);function h(d,m){if(d.kind==="user_prompt")return p.jsx(_ee,{content:d.content,attachments:d.attachments},d.id);switch(d.kind){case"unknown":return p.jsx(yee,{json:d.json},d.id);case"system_init":return e.findIndex(_=>_.kind==="system_init")===m?p.jsx(Cee,{message:d,rawJson:d.debugRaw},d.id):null;case"account_info":return e.findIndex(_=>_.kind==="account_info")===m?p.jsx(kee,{message:d},d.id):null;case"assistant_text":return p.jsx(Eee,{message:d},d.id);case"tool":return d.toolKind==="ask_user_question"?p.jsx(Nee,{message:d,onSubmit:a,isLatest:d.id===r.AskUserQuestion},d.id):d.toolKind==="exit_plan_mode"?p.jsx(Aee,{message:d,onConfirm:l,isLatest:d.id===r.ExitPlanMode},d.id):d.toolKind==="todo_write"?d.id!==r.TodoWrite?null:p.jsx(Oee,{message:d},d.id):p.jsx(ND,{message:d,isLoading:t,localPath:n},d.id);case"result":{const g=e[m+1],_=e[m-1];return(g==null?void 0:g.kind)==="context_cleared"||(_==null?void 0:_.kind)==="context_cleared"?null:p.jsx(Lee,{message:d},d.id)}case"interrupted":return p.jsx(zee,{message:d},d.id);case"compact_boundary":return p.jsx(Pee,{},d.id);case"context_cleared":return p.jsx(Bee,{},d.id);case"compact_summary":return p.jsx(Iee,{message:d},d.id);case"status":return m===e.length-1?p.jsx(Fee,{message:d},d.id):null}}return p.jsx(uY,{onOpenLocalLink:s,children:u.map(d=>{if(d.type==="tool-group")return p.jsx("div",{className:"group relative",[zf]:"",children:p.jsx(qee,{messages:d.messages,isLoading:t,localPath:n})},`group-${d.startIndex}`);const m=h(d.message,d.index);return m?p.jsx("div",{id:`msg-${d.message.id}`,className:"group relative",[zf]:"",children:m},d.message.id):null})})}function Xee({rootRef:e,fallbackRef:t,enabled:n,canCancel:r}){y.useEffect(()=>{if(!n)return;let s=0,a=null;const l=g=>{const _=g instanceof Element?g:null,b=e.current,w=t.current;if(KC({trigger:"pointer",activeElement:document.activeElement,pointerStartTarget:a,pointerEndTarget:_,root:b,fallback:w,hasActiveOverlay:qC(document),hasActiveSelection:fI(window.getSelection())})!=="restore"){a=null;return}w==null||w.focus({preventScroll:!0}),a=null},u=g=>{cancelAnimationFrame(s),a=g.target instanceof Element?g.target:null},h=g=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{l(g.target)})},d=()=>{a=null;const g=t.current;!g||g.disabled||g.focus({preventScroll:!0})},m=g=>{if(g.key!=="Escape")return;const _=t.current;KC({trigger:"escape",activeElement:document.activeElement,fallback:_,hasActiveOverlay:qC(document),canCancel:r,defaultPrevented:g.defaultPrevented})==="escape-focus"&&(g.preventDefault(),_==null||_.focus({preventScroll:!0}))};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("keydown",m,!0),window.addEventListener(Lf,d),()=>{cancelAnimationFrame(s),window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("keydown",m,!0),window.removeEventListener(Lf,d)}},[r,n,t,e])}const sf="What are we building?",Zee=19,eb=72,Qee=120,Jee=1200;function ete(e){return e.split(/\r?\n/u).map(n=>n.trim()).find(n=>n.length>0)??"(attachment only)"}function tte(e){let t=0;return e.flatMap(n=>n.kind!=="user_prompt"||n.hidden?[]:(t+=1,[{id:n.id,label:ete(n.content),order:t}]))}function nte(e){return e.enabled&&e.layoutWidth>Jee&&e.itemCount>0}function rte(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=e.scrollTop+r.top-n.top-eb;e.scrollTo({top:Math.max(0,s),behavior:"smooth"})}function ite(e){return Array.from(e).includes("Files")}function ste(){var yt,un,en,bn,Nt,Yn;const e=ub(),t=y.useRef(null),n=y.useRef(null),r=y.useRef(null),s=y.useRef(null),[a,l]=y.useState(""),[u,h]=y.useState(!1),[d,m]=y.useState(0),[g,_]=y.useState(!1),[b,w]=y.useState(0),S=y.useRef(0),C=((yt=e.runtime)==null?void 0:yt.projectId)??null,T=eo(Y=>C?Y.projects[C]:void 0)??nee,M=Nf(Y=>C?Y.projects[C]:void 0)??ZJ,O=eo(Y=>Y.addTerminal),D=eo(Y=>Y.removeTerminal),j=eo(Y=>Y.toggleVisibility),F=eo(Y=>Y.resetMainSizes),G=eo(Y=>Y.setMainSizes),B=eo(Y=>Y.setTerminalSizes),H=Nf(Y=>Y.toggleVisibility),P=Nf(Y=>Y.setSize),U=Gr(Y=>Y.scrollbackLines),q=Gr(Y=>Y.minColumnWidth),W=tr(Y=>Y.showTranscriptToc),z=e.keybindings,$=y.useMemo(()=>SD(z),[z]),V=y.useMemo(()=>tte(e.messages),[e.messages]),Q=nte({enabled:W,layoutWidth:b,itemCount:V.length}),N=T.terminals.length>0,I=!!(C&&T.isVisible&&N),Z=!!(C&&N),L=!!(C&&M.isVisible),de=!!C,{isAnimating:me,mainPanelGroupRef:ue,terminalFocusRequestVersion:he,terminalPanelRef:we,terminalVisualRef:le}=vee({showTerminalPane:I,shouldRenderTerminalLayout:Z,projectId:C,terminalLayout:T,chatInputRef:r}),{isAnimating:xe,panelGroupRef:Ne,sidebarPanelRef:ae,sidebarVisualRef:pe}=pee({projectId:C,shouldRenderRightSidebarLayout:de,showRightSidebar:L,rightSidebarSize:M.size});Xee({rootRef:n,fallbackRef:r,enabled:e.hasSelectedProject&&((un=e.runtime)==null?void 0:un.status)!=="waiting_for_user",canCancel:e.canCancel});function Re(Y){var oe;return ite(((oe=Y.dataTransfer)==null?void 0:oe.types)??[])}function $e(Y){var oe;!e.hasSelectedProject||Y.length===0||(oe=s.current)==null||oe.enqueueFiles(Y)}const at=()=>{if(C){if(N){j(C);return}O(C)}},Lt=Y=>{var Fe;if(!C||!I||me.current)return;const oe=Y.chat,Ee=Y.terminal;if(!Number.isFinite(oe)||!Number.isFinite(Ee))return;const ze=((Fe=t.current)==null?void 0:Fe.getBoundingClientRect().height)??0;if(oee(ze,Ee)){F(C),j(C);return}G(C,[oe,Ee])};y.useEffect(()=>{if(e.messages.length!==0)return;l(""),h(!1);let Y=0;const oe=window.setInterval(()=>{Y+=1,l(sf.slice(0,Y)),Y>=sf.length&&(window.clearInterval(oe),h(!0))},Zee);return()=>window.clearInterval(oe)},[e.activeChatId,e.messages.length]),y.useEffect(()=>{function Y(oe){if(C){if(ru($,"toggleEmbeddedTerminal",oe)){oe.preventDefault(),at();return}if(ru($,"toggleRightSidebar",oe)){oe.preventDefault(),H(C);return}if(ru($,"openInFinder",oe)){oe.preventDefault(),e.handleOpenExternal("open_finder");return}if(ru($,"openInEditor",oe)){oe.preventDefault(),e.handleOpenExternal("open_editor");return}ru($,"addSplitTerminal",oe)&&(oe.preventDefault(),O(C))}}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[O,at,C,$,H,j]),y.useEffect(()=>{const Y=window.requestAnimationFrame(()=>{e.updateScrollState()}),oe=window.setTimeout(()=>{e.updateScrollState()},yl);return()=>{window.cancelAnimationFrame(Y),window.clearTimeout(oe)}},[Z,I,e.updateScrollState]),y.useEffect(()=>{function Y(){e.updateScrollState()}return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},[e.updateScrollState]),y.useEffect(()=>{const Y=t.current;if(!Y)return;const oe=()=>{const ze=Y.getBoundingClientRect().height,Fe=Y.getBoundingClientRect().width;if(w(ee=>Math.abs(ee-Fe)<1?ee:Fe),!Z||ze<=0)return;const dt=ze*(T.mainSizes[1]/100);dt<=0||m(ee=>Math.abs(ee-dt)<1?ee:dt)},Ee=new ResizeObserver(oe);return Ee.observe(Y),oe(),()=>Ee.disconnect()},[C,Z,T.mainSizes]);const zt=Y=>Number.isFinite(Y)?Math.min(Ky,Math.max(Gp,Y)):M.size,ut=p.jsxs(n5,{ref:n,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",onDragEnter:Y=>{!Re(Y)||!e.hasSelectedProject||(Y.preventDefault(),S.current+=1,_(!0))},onDragOver:Y=>{!Re(Y)||!e.hasSelectedProject||(Y.preventDefault(),Y.dataTransfer.dropEffect="copy",g||_(!0))},onDragLeave:Y=>{!Re(Y)||!e.hasSelectedProject||(Y.preventDefault(),S.current=Math.max(0,S.current-1),S.current===0&&_(!1))},onDrop:Y=>{!Re(Y)||!e.hasSelectedProject||(Y.preventDefault(),S.current=0,_(!1),$e([...Y.dataTransfer.files]))},children:[p.jsxs(i5,{className:"flex flex-1 min-h-0 flex-col p-0 overflow-hidden relative",children:[p.jsx(OY,{sidebarCollapsed:e.sidebarCollapsed,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,onNewChat:e.handleCompose,localPath:e.navbarLocalPath,embeddedTerminalVisible:I,onToggleEmbeddedTerminal:C?at:void 0,rightSidebarVisible:L,onToggleRightSidebar:C?()=>H(C):void 0,onOpenExternal:Y=>{e.handleOpenExternal(Y)},editorLabel:e.editorLabel,finderShortcut:$.bindings.openInFinder,editorShortcut:$.bindings.openInEditor,terminalShortcut:$.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:$.bindings.toggleRightSidebar}),p.jsxs(p0,{ref:e.scrollRef,onScroll:e.updateScrollState,className:"flex-1 min-h-0 px-4 scroll-pt-[72px]",children:[e.messages.length===0?p.jsx("div",{style:{height:e.transcriptPaddingBottom},"aria-hidden":"true"}):null,e.messages.length>0?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"animate-fade-in space-y-5 pt-[72px] max-w-[800px] mx-auto",children:[p.jsx(Yee,{messages:e.messages,isLoading:e.isProcessing,localPath:(en=e.runtime)==null?void 0:en.localPath,latestToolIds:e.latestToolIds,onOpenLocalLink:e.handleOpenLocalLink,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode}),e.isProcessing?p.jsx(VJ,{status:(bn=e.runtime)==null?void 0:bn.status}):null,!e.isProcessing&&e.isDraining?p.jsx($J,{onStop:()=>void e.handleStopDraining()}):null,e.commandError?p.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:e.commandError}):null]}),p.jsx("div",{style:{height:250},"aria-hidden":"true"})]}):null]}),Q?p.jsx("div",{className:"absolute right-4 z-20",style:{top:eb},children:p.jsx("div",{className:" px-1 backdrop-blur-md","data-testid":"transcript-toc",children:p.jsx("div",{className:"flex flex-col items-end gap-[1px]",children:V.map(Y=>p.jsx("button",{type:"button",className:"flex max-w-[175px] items-center justify-end gap-1 rounded-xl px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>{const oe=e.scrollRef.current,Ee=document.getElementById(`msg-${Y.id}`);!oe||!Ee||rte(oe,Ee)},title:Y.label,children:p.jsx("span",{className:"min-w-0 truncate",children:Y.label})},Y.id))})})}):null,e.messages.length===0?p.jsx("div",{className:"pointer-events-none absolute inset-x-4 animate-fade-in",style:{top:eb,bottom:e.transcriptPaddingBottom},children:p.jsx("div",{className:"mx-auto flex h-full max-w-[800px] items-center justify-center",children:p.jsxs("div",{className:"flex flex-col items-center justify-center text-muted-foreground gap-4 opacity-70",children:[p.jsx(yu,{strokeWidth:1.5,className:"size-8 text-muted-foreground kanna-empty-state-flower"}),p.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs flex items-center kanna-empty-state-text","aria-label":sf,children:p.jsxs("span",{className:"relative inline-grid place-items-start",children:[p.jsxs("span",{className:"invisible col-start-1 row-start-1 whitespace-pre flex items-center",children:[p.jsx("span",{children:sf}),p.jsx("span",{className:"kanna-typewriter-cursor-slot","aria-hidden":"true"})]}),p.jsxs("span",{className:"col-start-1 row-start-1 whitespace-pre flex items-center",children:[p.jsx("span",{children:a}),p.jsx("span",{className:"kanna-typewriter-cursor-slot","aria-hidden":"true",children:p.jsx("span",{className:"kanna-typewriter-cursor","data-typing-complete":u?"true":"false"})})]})]})})]})})},e.activeChatId??"new-chat"):null,g?p.jsxs("div",{className:"absolute inset-0 z-30 pointer-events-none",children:[p.jsx("div",{className:"absolute inset-0 backdrop-blur-sm"}),p.jsx("div",{className:"absolute inset-6 ",children:p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsxs("div",{className:"text-center flex flex-col items-center justify-center gap-3",children:[p.jsx(cI,{className:"mx-auto size-14 text-foreground",strokeWidth:1.75}),p.jsx("div",{className:"text-xl font-medium text-foreground",children:"Drop up to 10 files"})]})})})]}):null,p.jsx("div",{style:{bottom:Qee},className:be("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:p.jsx("button",{onClick:e.scrollToBottom,className:"flex items-center transition-colors gap-1.5 px-2 bg-white hover:bg-muted border border-border rounded-full aspect-square cursor-pointer text-sm text-primary hover:text-foreground dark:bg-slate-700 dark:hover:bg-slate-600 dark:text-slate-100 dark:border-slate-600",children:p.jsx(Q6,{className:"h-5 w-5"})})})]}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:p.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:e.inputRef,children:p.jsx(MY,{ref:s,inputElementRef:r,onSubmit:e.handleSend,onCancel:()=>{e.handleCancel()},disabled:!e.hasSelectedProject||((Nt=e.runtime)==null?void 0:Nt.status)==="waiting_for_user",canCancel:e.canCancel,chatId:e.activeChatId,projectId:C,activeProvider:((Yn=e.runtime)==null?void 0:Yn.provider)??null,availableProviders:e.availableProviders},e.activeChatId??"new-chat")})})]});return p.jsx("div",{ref:t,className:"flex-1 flex flex-col min-w-0 relative",children:de&&C?p.jsxs(bf,{groupRef:Ne,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:Y=>{var Ee;if(!L||xe.current)return;const oe=zt(Y.rightSidebar);Math.abs(oe-Y.rightSidebar)<.1||(Ee=Ne.current)==null||Ee.setLayout({workspace:100-oe,rightSidebar:oe})},onLayoutChanged:Y=>{!L||xe.current||P(C,zt(Y.rightSidebar))},children:[p.jsx(Wo,{id:"workspace",defaultSize:`${100-M.size}%`,minSize:"50%",className:"min-h-0 min-w-0",children:Z?p.jsxs(bf,{groupRef:ue,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:Lt,children:[p.jsx(Wo,{id:"chat",defaultSize:`${T.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:ut}),p.jsx(xf,{withHandle:!0,orientation:"vertical",disabled:!I,className:be(!I&&"pointer-events-none opacity-0")}),p.jsx(Wo,{id:"terminal",defaultSize:`${T.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:we,children:p.jsx("div",{ref:le,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":I?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${yl}ms`},children:p.jsx("div",{style:d>0?{height:`${d}px`}:void 0,children:p.jsx(LE,{projectId:C,layout:T,onAddTerminal:O,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:U,minColumnWidth:q,splitTerminalShortcut:$.bindings.addSplitTerminal,focusRequestVersion:he,onRemoveTerminal:(Y,oe)=>{e.socket.command({type:"terminal.close",terminalId:oe}).catch(()=>{}),D(Y,oe)},onTerminalLayout:B})})})})]},C):ut}),p.jsx(xf,{withHandle:!0,orientation:"horizontal",disabled:!L,className:be(!L&&"pointer-events-none opacity-0")}),p.jsx(Wo,{id:"rightSidebar",defaultSize:`${M.size}%`,maxSize:`${Ky}%`,className:"min-h-0 min-w-0",elementRef:ae,children:p.jsx("div",{ref:pe,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":L?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${yl}ms`},children:p.jsx(jY,{onClose:()=>H(C)})})})]},`${C}-right-sidebar`):Z&&C?p.jsxs(bf,{groupRef:ue,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:Lt,children:[p.jsx(Wo,{id:"chat",defaultSize:`${T.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:ut}),p.jsx(xf,{withHandle:!0,orientation:"vertical",disabled:!I,className:be(!I&&"pointer-events-none opacity-0")}),p.jsx(Wo,{id:"terminal",defaultSize:`${T.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:we,children:p.jsx("div",{ref:le,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":I?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${yl}ms`},children:p.jsx("div",{style:d>0?{height:`${d}px`}:void 0,children:p.jsx(LE,{projectId:C,layout:T,onAddTerminal:O,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:U,minColumnWidth:q,splitTerminalShortcut:$.bindings.addSplitTerminal,focusRequestVersion:he,onRemoveTerminal:(Y,oe)=>{e.socket.command({type:"terminal.close",terminalId:oe}).catch(()=>{}),D(Y,oe)},onTerminalLayout:B})})})})]},C):ut})}function WE({narrow:e=!1,title:t,subtitle:n,icon:r=Eb}){return p.jsxs("div",{className:be("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[p.jsxs("div",{className:be("flex items-center gap-1 mb-2",e&&"justify-center"),children:[p.jsx("div",{className:"p-2 pl-0 rounded-lg",children:p.jsx(r,{className:"h-6 w-6 text-muted-foreground"})}),p.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t})]}),n&&p.jsx("p",{className:be("text-muted-foreground",e&&"mb-10 text-center"),children:n})]})}const ote={sm:"text-sm px-2.5 py-1",md:"text-sm px-3 py-1.5"};function tb({value:e,onValueChange:t,options:n,size:r="md",className:s,optionClassName:a}){return p.jsx("div",{className:be("inline-flex items-center rounded-lg border border-border p-[3px] ",s),children:n.map(l=>{const u=l.value===e,h=l.icon,d=h?y.isValidElement(h)?h:(()=>{const g=h;return p.jsx(g,{className:r==="sm"?"h-3.5 w-3.5":"h-4 w-4"})})():null,m=p.jsxs("button",{type:"button",onClick:()=>t(l.value),disabled:l.disabled,"aria-pressed":u,className:be("rounded-[4px] border transition-colors",h?"grid grid-cols-[auto_auto] items-center gap-2":"inline-flex items-center gap-1.5",ote[r],u?"bg-white dark:bg-muted text-slate-900 dark:text-slate-200 border-slate-300 dark:border-white/10 bg-slate-200 ":"border-transparent text-slate-800 hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",l.disabled&&"opacity-50 pointer-events-none",a),children:[d,p.jsx("span",{children:l.label})]},l.value);return l.tooltip?p.jsxs(Ff,{children:[p.jsx(Uf,{asChild:!0,children:m}),p.jsx(Ou,{children:l.tooltip})]},l.value):m})})}function ate(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function lte({open:e,onOpenChange:t,onConfirm:n}){const[r,s]=y.useState("new"),[a,l]=y.useState(""),[u,h]=y.useState(""),d=y.useRef(null),m=y.useRef(null);y.useEffect(()=>{e&&(s("new"),l(""),h(""),setTimeout(()=>{var C;return(C=d.current)==null?void 0:C.focus()},0))},[e]),y.useEffect(()=>{e&&setTimeout(()=>{var C,k;r==="new"?(C=d.current)==null||C.focus():(k=m.current)==null||k.focus()},0)},[r,e]);const g=ate(a),_=g?`${u7}/${g}`:"",b=u.trim(),w=r==="new"?!!g:!!b,S=()=>{if(w){if(r==="new")n({mode:"new",localPath:_,title:a.trim()});else{const C=b.split("/").pop()||b;n({mode:"existing",localPath:b,title:C})}t(!1)}};return p.jsx(Db,{open:e,onOpenChange:t,children:p.jsxs(bp,{size:"sm",children:[p.jsxs(jb,{className:"space-y-4",children:[p.jsx(Ob,{children:"Add Project"}),p.jsx(tb,{value:r,onValueChange:s,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),r==="new"?p.jsxs("div",{className:"space-y-2",children:[p.jsx(so,{ref:d,type:"text",value:a,onChange:C=>l(C.target.value),onKeyDown:C=>{C.key==="Enter"&&S(),C.key==="Escape"&&t(!1)},placeholder:"Project name"}),_&&p.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:_})]}):p.jsxs("div",{className:"space-y-2",children:[p.jsx(so,{ref:m,type:"text",value:u,onChange:C=>h(C.target.value),onKeyDown:C=>{C.key==="Enter"&&S(),C.key==="Escape"&&t(!1)},placeholder:"~/Projects/my-app"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),p.jsxs(Lb,{children:[p.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),p.jsx(Je,{variant:"secondary",size:"sm",onClick:S,disabled:!w,children:"Create"})]})]})})}function cte({text:e}){const[t,n]=y.useState(!1);async function r(){await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return p.jsx(Je,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void r(),children:t?p.jsx(co,{className:"h-4 w-4 text-green-400"}):p.jsx(Zu,{className:"h-4 w-4"})})}function VE({children:e}){return p.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:[p.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[p.jsx(fs,{className:"inline h-4 w-4 opacity-40"}),p.jsx("code",{children:e})]}),p.jsx(cte,{text:e})]})}function of({children:e}){return p.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function b_({children:e}){return p.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function x_({icon:e,title:t,subtitle:n,iconClassName:r}){return p.jsxs("div",{className:"flex flex-col items-center gap-0",children:[p.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:p.jsx(e,{className:r||"h-8 w-8 text-muted-foreground"})}),p.jsx("span",{className:"text-sm font-medium",children:t}),p.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function qE(){return p.jsx(eP,{className:"h-4 w-4 text-muted-foreground"})}function KE({number:e,title:t,children:n}){return p.jsx("div",{className:"flex gap-4",children:p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[p.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),p.jsx("h3",{className:"font-medium text-foreground mb-2",children:t})]}),p.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:n})]})})}function ute({localPath:e,loading:t,onClick:n}){return p.jsxs(Ff,{children:[p.jsx(Uf,{asChild:!0,children:p.jsxs("button",{className:be("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",t&&"opacity-50 cursor-not-allowed"),disabled:t,onClick:n,children:[p.jsx(oB,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),p.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:gM(e)}),t?p.jsx(fi,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):p.jsx(Tb,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),p.jsx(Ou,{children:p.jsx("p",{children:e})})]})}function dte({connectionStatus:e,ready:t,snapshot:n,startingLocalPath:r,commandError:s,onOpenProject:a,onCreateProject:l}){const[u,h]=y.useState(!1),d=y.useMemo(()=>(n==null?void 0:n.projects)??[],[n==null?void 0:n.projects]),m=e==="connecting"||!t,g=e==="connected"&&t;return p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[g?p.jsxs(p.Fragment,{children:[p.jsx(WE,{title:(n==null?void 0:n.machine.displayName)??"Local Projects",subtitle:`${ln} is connected, choose a project below to get started.`}),p.jsxs("div",{className:"w-full px-6 mb-10",children:[p.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[p.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),p.jsxs(Je,{variant:"default",size:"sm",onClick:()=>h(!0),children:[p.jsx(Rb,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),d.length>0?p.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:d.map(_=>p.jsx(ute,{localPath:_.localPath,loading:r===_.localPath,onClick:()=>{a(_.localPath)}},_.localPath))}):p.jsx(of,{children:p.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),s?p.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:s}):null]})]}):p.jsxs(p.Fragment,{children:[p.jsx(WE,{narrow:!0,icon:FC,title:m?`Connecting ${ln}`:`Connect ${ln}`,subtitle:m?`${ln} is starting up and loading your local projects.`:`Run ${ln} directly on your machine with full access to your local files and agent project history.`}),p.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[p.jsx(b_,{children:"Status"}),p.jsx("div",{className:"mb-8",children:p.jsx(of,{children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(fi,{className:"h-4 w-4 text-muted-foreground animate-spin"}),p.jsx("span",{className:"text-sm text-muted-foreground",children:m?`Connecting to your local ${ln} server...`:p.jsxs(p.Fragment,{children:["Not connected. Run ",p.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:Ih()})," from any terminal on this machine."]})})]})})}),m?null:p.jsxs("div",{className:"mb-10",children:[p.jsx(b_,{children:"How it works"}),p.jsx(of,{children:p.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[p.jsx(x_,{icon:Mb,title:`${ln} CLI`,subtitle:"On Your Machine"}),p.jsx(qE,{}),p.jsx(x_,{icon:Eb,title:`${ln} Server`,subtitle:"Local WebSocket"}),p.jsx(qE,{}),p.jsx(x_,{icon:FC,title:`${ln} UI`,subtitle:"Project Chat"})]})})]}),m?null:p.jsxs("div",{className:"mb-10",children:[p.jsx(b_,{children:"Setup"}),p.jsx(of,{children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs(KE,{number:1,title:`Start ${ln}`,children:[p.jsx("p",{children:"Run this command in your terminal:"}),p.jsx(VE,{children:Ih()})]}),p.jsxs(KE,{number:2,title:"Open the local UI",children:[p.jsxs("p",{children:[ln," serves the app locally and opens the Local Projects page in an app-style browser window."]}),p.jsx(VE,{children:"http://localhost:3210/local"})]}),p.jsxs("div",{className:"mt-8",children:[p.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),p.jsxs("div",{className:"space-y-3 text-sm",children:[p.jsxs("div",{className:"flex gap-4",children:[p.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:Ih("").trim()}),p.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),p.jsxs("div",{className:"flex gap-4",children:[p.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:Ih("--no-open")}),p.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),p.jsx(lte,{open:u,onOpenChange:h,onConfirm:_=>{l(_)}}),p.jsx("div",{className:"py-4 text-center",children:p.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",Kb.split("/")[1]]})})]})}function hte(){const e=ub();return p.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:p.jsx(dte,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,onOpenProject:e.handleOpenLocalProject,onCreateProject:e.handleCreateProject})})}function GE({children:e,className:t,icon:n,type:r="button",variant:s="outline",...a}){return p.jsxs("button",{type:r,className:be(vb({variant:s,size:"sm"}),"h-auto gap-1.5 px-3 py-1.5",t),...a,children:[n,p.jsx("span",{children:e})]})}function YE(e,[t,n]){return Math.min(n,Math.max(t,e))}function fte(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var pte=[" ","Enter","ArrowUp","ArrowDown"],mte=[" ","Enter"],aa="Select",[Yp,Xp,gte]=i0(aa),[Zl]=vs(aa,[gte,go]),Zp=go(),[vte,yo]=Zl(aa),[_te,yte]=Zl(aa),AD=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:a,value:l,defaultValue:u,onValueChange:h,dir:d,name:m,autoComplete:g,disabled:_,required:b,form:w}=e,S=Zp(t),[C,k]=y.useState(null),[T,R]=y.useState(null),[M,O]=y.useState(!1),D=s0(d),[j,F]=Rl({prop:r,defaultProp:s??!1,onChange:a,caller:aa}),[G,B]=Rl({prop:l,defaultProp:u,onChange:h,caller:aa}),H=y.useRef(null),P=C?w||!!C.closest("form"):!0,[U,q]=y.useState(new Set),W=Array.from(U).map(z=>z.props.value).join(";");return p.jsx(kp,{...S,children:p.jsxs(vte,{required:b,scope:t,trigger:C,onTriggerChange:k,valueNode:T,onValueNodeChange:R,valueNodeHasChildren:M,onValueNodeHasChildrenChange:O,contentId:ds(),value:G,onValueChange:B,open:j,onOpenChange:F,dir:D,triggerPointerDownPosRef:H,disabled:_,children:[p.jsx(Yp.Provider,{scope:t,children:p.jsx(_te,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(z=>{q($=>new Set($).add(z))},[]),onNativeOptionRemove:y.useCallback(z=>{q($=>{const V=new Set($);return V.delete(z),V})},[]),children:n})}),P?p.jsxs(n3,{"aria-hidden":!0,required:b,tabIndex:-1,name:m,autoComplete:g,value:G,onChange:z=>B(z.target.value),disabled:_,form:w,children:[G===void 0?p.jsx("option",{value:""}):null,Array.from(U)]},W):null]})})};AD.displayName=aa;var DD="SelectTrigger",OD=y.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,a=Zp(n),l=yo(DD,n),u=l.disabled||r,h=_t(t,l.onTriggerChange),d=Xp(n),m=y.useRef("touch"),[g,_,b]=i3(S=>{const C=d().filter(R=>!R.disabled),k=C.find(R=>R.value===l.value),T=s3(C,S,k);T!==void 0&&l.onValueChange(T.value)}),w=S=>{u||(l.onOpenChange(!0),b()),S&&(l.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return p.jsx(Ju,{asChild:!0,...a,children:p.jsx(rt.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":r3(l.value)?"":void 0,...s,ref:h,onClick:Ae(s.onClick,S=>{S.currentTarget.focus(),m.current!=="mouse"&&w(S)}),onPointerDown:Ae(s.onPointerDown,S=>{m.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:Ae(s.onKeyDown,S=>{const C=g.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&_(S.key),!(C&&S.key===" ")&&pte.includes(S.key)&&(w(),S.preventDefault())})})})});OD.displayName=DD;var jD="SelectValue",LD=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:l="",...u}=e,h=yo(jD,n),{onValueNodeHasChildrenChange:d}=h,m=a!==void 0,g=_t(t,h.onValueNodeChange);return Kn(()=>{d(m)},[d,m]),p.jsx(rt.span,{...u,ref:g,style:{pointerEvents:"none"},children:r3(h.value)?p.jsx(p.Fragment,{children:l}):a})});LD.displayName=jD;var bte="SelectIcon",zD=y.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return p.jsx(rt.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});zD.displayName=bte;var xte="SelectPortal",PD=e=>p.jsx(Il,{asChild:!0,...e});PD.displayName=xte;var la="SelectContent",BD=y.forwardRef((e,t)=>{const n=yo(la,e.__scopeSelect),[r,s]=y.useState();if(Kn(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Mi.createPortal(p.jsx(ID,{scope:e.__scopeSelect,children:p.jsx(Yp.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),a):null}return p.jsx(HD,{...e,ref:t})});BD.displayName=la;var ci=10,[ID,bo]=Zl(la),wte="SelectContentImpl",Ste=Qo("SelectContent.RemoveScroll"),HD=y.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:l,side:u,sideOffset:h,align:d,alignOffset:m,arrowPadding:g,collisionBoundary:_,collisionPadding:b,sticky:w,hideWhenDetached:S,avoidCollisions:C,...k}=e,T=yo(la,n),[R,M]=y.useState(null),[O,D]=y.useState(null),j=_t(t,he=>M(he)),[F,G]=y.useState(null),[B,H]=y.useState(null),P=Xp(n),[U,q]=y.useState(!1),W=y.useRef(!1);y.useEffect(()=>{if(R)return _p(R)},[R]),gp();const z=y.useCallback(he=>{const[we,...le]=P().map(ae=>ae.ref.current),[xe]=le.slice(-1),Ne=document.activeElement;for(const ae of he)if(ae===Ne||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===we&&O&&(O.scrollTop=0),ae===xe&&O&&(O.scrollTop=O.scrollHeight),ae==null||ae.focus(),document.activeElement!==Ne))return},[P,O]),$=y.useCallback(()=>z([F,R]),[z,F,R]);y.useEffect(()=>{U&&$()},[U,$]);const{onOpenChange:V,triggerPointerDownPosRef:Q}=T;y.useEffect(()=>{if(R){let he={x:0,y:0};const we=xe=>{var Ne,ae;he={x:Math.abs(Math.round(xe.pageX)-(((Ne=Q.current)==null?void 0:Ne.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((ae=Q.current)==null?void 0:ae.y)??0))}},le=xe=>{he.x<=10&&he.y<=10?xe.preventDefault():R.contains(xe.target)||V(!1),document.removeEventListener("pointermove",we),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",we),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",we),document.removeEventListener("pointerup",le,{capture:!0})}}},[R,V,Q]),y.useEffect(()=>{const he=()=>V(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[V]);const[N,I]=i3(he=>{const we=P().filter(Ne=>!Ne.disabled),le=we.find(Ne=>Ne.ref.current===document.activeElement),xe=s3(we,he,le);xe&&setTimeout(()=>xe.ref.current.focus())}),Z=y.useCallback((he,we,le)=>{const xe=!W.current&&!le;(T.value!==void 0&&T.value===we||xe)&&(G(he),xe&&(W.current=!0))},[T.value]),L=y.useCallback(()=>R==null?void 0:R.focus(),[R]),de=y.useCallback((he,we,le)=>{const xe=!W.current&&!le;(T.value!==void 0&&T.value===we||xe)&&H(he)},[T.value]),me=r==="popper"?nb:FD,ue=me===nb?{side:u,sideOffset:h,align:d,alignOffset:m,arrowPadding:g,collisionBoundary:_,collisionPadding:b,sticky:w,hideWhenDetached:S,avoidCollisions:C}:{};return p.jsx(ID,{scope:n,content:R,viewport:O,onViewportChange:D,itemRefCallback:Z,selectedItem:F,onItemLeave:L,itemTextRefCallback:de,focusSelectedItem:$,selectedItemText:B,position:r,isPositioned:U,searchRef:N,children:p.jsx(Xu,{as:Ste,allowPinchZoom:!0,children:p.jsx(Yu,{asChild:!0,trapped:T.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:Ae(s,he=>{var we;(we=T.trigger)==null||we.focus({preventScroll:!0}),he.preventDefault()}),children:p.jsx(Bl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:p.jsx(me,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:he=>he.preventDefault(),...k,...ue,onPlaced:()=>q(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Ae(k.onKeyDown,he=>{const we=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!we&&he.key.length===1&&I(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let xe=P().filter(Ne=>!Ne.disabled).map(Ne=>Ne.ref.current);if(["ArrowUp","End"].includes(he.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const Ne=he.target,ae=xe.indexOf(Ne);xe=xe.slice(ae+1)}setTimeout(()=>z(xe)),he.preventDefault()}})})})})})})});HD.displayName=wte;var Cte="SelectItemAlignedPosition",FD=y.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,a=yo(la,n),l=bo(la,n),[u,h]=y.useState(null),[d,m]=y.useState(null),g=_t(t,j=>m(j)),_=Xp(n),b=y.useRef(!1),w=y.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:k,focusSelectedItem:T}=l,R=y.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&d&&S&&C&&k){const j=a.trigger.getBoundingClientRect(),F=d.getBoundingClientRect(),G=a.valueNode.getBoundingClientRect(),B=k.getBoundingClientRect();if(a.dir!=="rtl"){const Ne=B.left-F.left,ae=G.left-Ne,pe=j.left-ae,Re=j.width+pe,$e=Math.max(Re,F.width),at=window.innerWidth-ci,Lt=YE(ae,[ci,Math.max(ci,at-$e)]);u.style.minWidth=Re+"px",u.style.left=Lt+"px"}else{const Ne=F.right-B.right,ae=window.innerWidth-G.right-Ne,pe=window.innerWidth-j.right-ae,Re=j.width+pe,$e=Math.max(Re,F.width),at=window.innerWidth-ci,Lt=YE(ae,[ci,Math.max(ci,at-$e)]);u.style.minWidth=Re+"px",u.style.right=Lt+"px"}const H=_(),P=window.innerHeight-ci*2,U=S.scrollHeight,q=window.getComputedStyle(d),W=parseInt(q.borderTopWidth,10),z=parseInt(q.paddingTop,10),$=parseInt(q.borderBottomWidth,10),V=parseInt(q.paddingBottom,10),Q=W+z+U+V+$,N=Math.min(C.offsetHeight*5,Q),I=window.getComputedStyle(S),Z=parseInt(I.paddingTop,10),L=parseInt(I.paddingBottom,10),de=j.top+j.height/2-ci,me=P-de,ue=C.offsetHeight/2,he=C.offsetTop+ue,we=W+z+he,le=Q-we;if(we<=de){const Ne=H.length>0&&C===H[H.length-1].ref.current;u.style.bottom="0px";const ae=d.clientHeight-S.offsetTop-S.offsetHeight,pe=Math.max(me,ue+(Ne?L:0)+ae+$),Re=we+pe;u.style.height=Re+"px"}else{const Ne=H.length>0&&C===H[0].ref.current;u.style.top="0px";const pe=Math.max(de,W+S.offsetTop+(Ne?Z:0)+ue)+le;u.style.height=pe+"px",S.scrollTop=we-de+S.offsetTop}u.style.margin=`${ci}px 0`,u.style.minHeight=N+"px",u.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[_,a.trigger,a.valueNode,u,d,S,C,k,a.dir,r]);Kn(()=>R(),[R]);const[M,O]=y.useState();Kn(()=>{d&&O(window.getComputedStyle(d).zIndex)},[d]);const D=y.useCallback(j=>{j&&w.current===!0&&(R(),T==null||T(),w.current=!1)},[R,T]);return p.jsx(Ete,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:b,onScrollButtonChange:D,children:p.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:p.jsx(rt.div,{...s,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});FD.displayName=Cte;var kte="SelectPopperPosition",nb=y.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=ci,...a}=e,l=Zp(n);return p.jsx(Ep,{...l,...a,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});nb.displayName=kte;var[Ete,ix]=Zl(la,{}),rb="SelectViewport",UD=y.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,a=bo(rb,n),l=ix(rb,n),u=_t(t,a.onViewportChange),h=y.useRef(0);return p.jsxs(p.Fragment,{children:[p.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}),p.jsx(Yp.Slot,{scope:n,children:p.jsx(rt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ae(s.onScroll,d=>{const m=d.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:_}=l;if(_!=null&&_.current&&g){const b=Math.abs(h.current-m.scrollTop);if(b>0){const w=window.innerHeight-ci*2,S=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),k=Math.max(S,C);if(k<w){const T=k+b,R=Math.min(w,T),M=T-R;g.style.height=R+"px",g.style.bottom==="0px"&&(m.scrollTop=M>0?M:0,g.style.justifyContent="flex-end")}}}h.current=m.scrollTop})})})]})});UD.displayName=rb;var $D="SelectGroup",[Rte,Tte]=Zl($D),WD=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=ds();return p.jsx(Rte,{scope:n,id:s,children:p.jsx(rt.div,{role:"group","aria-labelledby":s,...r,ref:t})})});WD.displayName=$D;var VD="SelectLabel",qD=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Tte(VD,n);return p.jsx(rt.div,{id:s.id,...r,ref:t})});qD.displayName=VD;var dp="SelectItem",[Mte,KD]=Zl(dp),GD=y.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...l}=e,u=yo(dp,n),h=bo(dp,n),d=u.value===r,[m,g]=y.useState(a??""),[_,b]=y.useState(!1),w=_t(t,T=>{var R;return(R=h.itemRefCallback)==null?void 0:R.call(h,T,r,s)}),S=ds(),C=y.useRef("touch"),k=()=>{s||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(Mte,{scope:n,value:r,disabled:s,textId:S,isSelected:d,onItemTextChange:y.useCallback(T=>{g(R=>R||((T==null?void 0:T.textContent)??"").trim())},[]),children:p.jsx(Yp.ItemSlot,{scope:n,value:r,disabled:s,textValue:m,children:p.jsx(rt.div,{role:"option","aria-labelledby":S,"data-highlighted":_?"":void 0,"aria-selected":d&&_,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:w,onFocus:Ae(l.onFocus,()=>b(!0)),onBlur:Ae(l.onBlur,()=>b(!1)),onClick:Ae(l.onClick,()=>{C.current!=="mouse"&&k()}),onPointerUp:Ae(l.onPointerUp,()=>{C.current==="mouse"&&k()}),onPointerDown:Ae(l.onPointerDown,T=>{C.current=T.pointerType}),onPointerMove:Ae(l.onPointerMove,T=>{var R;C.current=T.pointerType,s?(R=h.onItemLeave)==null||R.call(h):C.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ae(l.onPointerLeave,T=>{var R;T.currentTarget===document.activeElement&&((R=h.onItemLeave)==null||R.call(h))}),onKeyDown:Ae(l.onKeyDown,T=>{var M;((M=h.searchRef)==null?void 0:M.current)!==""&&T.key===" "||(mte.includes(T.key)&&k(),T.key===" "&&T.preventDefault())})})})})});GD.displayName=dp;var pu="SelectItemText",YD=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...a}=e,l=yo(pu,n),u=bo(pu,n),h=KD(pu,n),d=yte(pu,n),[m,g]=y.useState(null),_=_t(t,k=>g(k),h.onItemTextChange,k=>{var T;return(T=u.itemTextRefCallback)==null?void 0:T.call(u,k,h.value,h.disabled)}),b=m==null?void 0:m.textContent,w=y.useMemo(()=>p.jsx("option",{value:h.value,disabled:h.disabled,children:b},h.value),[h.disabled,h.value,b]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=d;return Kn(()=>(S(w),()=>C(w)),[S,C,w]),p.jsxs(p.Fragment,{children:[p.jsx(rt.span,{id:h.textId,...a,ref:_}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Mi.createPortal(a.children,l.valueNode):null]})});YD.displayName=pu;var XD="SelectItemIndicator",ZD=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return KD(XD,n).isSelected?p.jsx(rt.span,{"aria-hidden":!0,...r,ref:t}):null});ZD.displayName=XD;var ib="SelectScrollUpButton",QD=y.forwardRef((e,t)=>{const n=bo(ib,e.__scopeSelect),r=ix(ib,e.__scopeSelect),[s,a]=y.useState(!1),l=_t(t,r.onScrollButtonChange);return Kn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=h.scrollTop>0;a(d)};const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?p.jsx(e3,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop-h.offsetHeight)}}):null});QD.displayName=ib;var sb="SelectScrollDownButton",JD=y.forwardRef((e,t)=>{const n=bo(sb,e.__scopeSelect),r=ix(sb,e.__scopeSelect),[s,a]=y.useState(!1),l=_t(t,r.onScrollButtonChange);return Kn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=h.scrollHeight-h.clientHeight,m=Math.ceil(h.scrollTop)<d;a(m)};const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?p.jsx(e3,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop+h.offsetHeight)}}):null});JD.displayName=sb;var e3=y.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,a=bo("SelectScrollButton",n),l=y.useRef(null),u=Xp(n),h=y.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return y.useEffect(()=>()=>h(),[h]),Kn(()=>{var m;const d=u().find(g=>g.ref.current===document.activeElement);(m=d==null?void 0:d.ref.current)==null||m.scrollIntoView({block:"nearest"})},[u]),p.jsx(rt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Ae(s.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Ae(s.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Ae(s.onPointerLeave,()=>{h()})})}),Nte="SelectSeparator",t3=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(rt.div,{"aria-hidden":!0,...r,ref:t})});t3.displayName=Nte;var ob="SelectArrow",Ate=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Zp(n),a=yo(ob,n),l=bo(ob,n);return a.open&&l.position==="popper"?p.jsx(Rp,{...s,...r,ref:t}):null});Ate.displayName=ob;var Dte="SelectBubbleInput",n3=y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=y.useRef(null),a=_t(r,s),l=fte(t);return y.useEffect(()=>{const u=s.current;if(!u)return;const h=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==t&&m){const g=new Event("change",{bubbles:!0});m.call(u,t),u.dispatchEvent(g)}},[l,t]),p.jsx(rt.select,{...n,style:{...eM,...n.style},ref:a,defaultValue:t})});n3.displayName=Dte;function r3(e){return e===""||e===void 0}function i3(e){const t=hi(e),n=y.useRef(""),r=y.useRef(0),s=y.useCallback(l=>{const u=n.current+l;t(u),(function h(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>h(""),1e3))})(u)},[t]),a=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function s3(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=Ote(e,Math.max(a,0));s.length===1&&(l=l.filter(d=>d!==n));const h=l.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return h!==n?h:void 0}function Ote(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var jte=AD,o3=OD,Lte=LD,zte=zD,Pte=PD,a3=BD,Bte=UD,Ite=WD,l3=qD,c3=GD,Hte=YD,Fte=ZD,u3=QD,d3=JD,h3=t3;const af=jte,lf=Ite,cf=Lte,mu=y.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(o3,{ref:r,className:be("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,p.jsx(zte,{asChild:!0,children:p.jsx(wb,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));mu.displayName=o3.displayName;const f3=y.forwardRef(({className:e,...t},n)=>p.jsx(u3,{ref:n,className:be("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(yP,{className:"h-4 w-4"})}));f3.displayName=u3.displayName;const p3=y.forwardRef(({className:e,...t},n)=>p.jsx(d3,{ref:n,className:be("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(wb,{className:"h-4 w-4"})}));p3.displayName=d3.displayName;const gu=y.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>p.jsx(Pte,{children:p.jsxs(a3,{ref:s,className:be("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-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:[p.jsx(f3,{}),p.jsx(Bte,{className:be("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),p.jsx(p3,{})]})}));gu.displayName=a3.displayName;const Ute=y.forwardRef(({className:e,...t},n)=>p.jsx(l3,{ref:n,className:be("px-2 py-1.5 text-sm font-semibold",e),...t}));Ute.displayName=l3.displayName;const pl=y.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(c3,{ref:r,className:be("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:[p.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(Fte,{children:p.jsx(co,{className:"h-4 w-4"})})}),p.jsx(Hte,{children:t})]}));pl.displayName=c3.displayName;const $te=y.forwardRef(({className:e,...t},n)=>p.jsx(h3,{ref:n,className:be("-mx-1 my-1 h-px bg-border",e),...t}));$te.displayName=h3.displayName;const vu=[{id:"general",label:"General",icon:VB,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"providers",label:"Providers",icon:xB,subtitle:"Manage the default chat provider and saved model defaults for Claude Code and Codex."},{id:"keybindings",label:"Keybindings",icon:MP,subtitle:"Edit global app shortcuts stored in the active keybindings file."},{id:"changelog",label:"Changelog",icon:oP,subtitle:"Release notes pulled from the public GitHub releases feed."}];function XE(e){return e&&vu.some(t=>t.id===e)?e:null}const Wte=[{value:"light",label:"Light",icon:nI},{value:"dark",label:"Dark",icon:kB},{value:"system",label:"System",icon:Eb}],Vte=[{value:"cursor",label:"Cursor"},{value:"vscode",label:"VS Code"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],qte=[{value:"never",label:"Never"},{value:"unfocused",label:"When Unfocused"},{value:"always",label:"Always"}],Kte=[{value:"enabled",label:"Enabled"},{value:"disabled",label:"Disabled"}],Gte="https://api.github.com/repos/jakemor/kanna/releases",Yte=300*1e3;let bl=null;const ZE=Object.keys(wD);function Xte(e){return`Edit global app shortcuts stored in ${e}.`}function Zte(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 QE(e,t){return e!==t}async function Qte(e=fetch){const t=await e(Gte,{headers:{Accept:"application/vnd.github+json"}});if(!t.ok)throw new Error(`GitHub releases request failed with status ${t.status}`);return(await t.json()).filter(r=>!r.draft)}function Jte(){return bl?Date.now()>=bl.expiresAt?(bl=null,null):bl.releases:null}function ene(e){bl={releases:e,expiresAt:Date.now()+Yte}}async function JE(e){const t=e!=null&&e.force?null:Jte();if(t)return t;const n=await Qte(e==null?void 0:e.fetchImpl);return ene(n),n}function tne(e){if(!e)return"Unpublished";const t=new Date(e);return Number.isNaN(t.getTime())?"Unknown date":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(t)}function nne({status:e,releases:t,error:n,onRetry:r}){return p.jsxs("div",{className:"space-y-4",children:[e==="loading"||e==="idle"?p.jsx("div",{className:"flex min-h-[180px] items-center justify-center rounded-2xl border border-border bg-card/40 px-6 py-8 text-sm text-muted-foreground",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(fi,{className:"h-4 w-4 animate-spin"}),p.jsx("span",{children:"Loading release notes…"})]})}):null,e==="error"?p.jsx("div",{className:"rounded-2xl border border-destructive/20 bg-destructive/5 px-6 py-5",children:p.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium text-foreground",children:"Could not load changelog"}),p.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:n??"Unable to load changelog."})]}),p.jsx("button",{type:"button",onClick:r,className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted",children:"Retry"})]})}):null,e==="success"&&t.length===0?p.jsxs("div",{className:"rounded-2xl border border-border bg-card/30 px-6 py-8",children:[p.jsx("div",{className:"text-sm font-medium text-foreground",children:"No releases yet"}),p.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:"GitHub did not return any published releases for this repository."})]}):null,e==="success"&&t.length>0?t.map(s=>{var a,l;return p.jsxs("article",{className:"rounded-xl border border-border bg-card/30 pl-6 pr-4 py-4",children:[p.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-3 ",children:[p.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-3 ",children:[p.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:((a=s.name)==null?void 0:a.trim())||s.tag_name}),p.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[p.jsx("span",{children:tne(s.published_at)}),s.prerelease?p.jsx("span",{className:"rounded-full border border-border px-2.5 py-1 uppercase tracking-wide",children:"Prerelease"}):null]})]}),p.jsxs("div",{className:"flex flex-row items-center justify-end min-w-0 flex-1 gap-3 ",children:[p.jsx("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted-foreground",children:p.jsx("span",{className:"rounded-full bg-muted px-2.5 py-1 font-mono text-foreground/80",children:s.tag_name})}),p.jsx("a",{href:s.html_url,target:"_blank",rel:"noopener noreferrer","aria-label":"View release on GitHub",className:be(vb({variant:"ghost",size:"icon-sm"}),"h-8 w-8 shrink-0 rounded-md"),children:p.jsx(rne,{className:"h-4 w-4"})})]})]}),(l=s.body)!=null&&l.trim()?p.jsx("div",{className:"prose prose-sm mt-5 max-w-none text-foreground dark:prose-invert",children:p.jsx(Kl,{remarkPlugins:[Gl],components:B0,children:s.body})}):p.jsx("div",{className:"mt-5 text-sm text-muted-foreground",children:"No release notes were provided."})]},s.id)}):null]})}function rne({className:e}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:p.jsx("path",{d:"M12 .5C5.649.5.5 5.649.5 12A11.5 11.5 0 0 0 8.36 22.04c.575.106.785-.25.785-.556 0-.274-.01-1-.015-1.962-3.181.691-3.853-1.532-3.853-1.532-.52-1.322-1.27-1.674-1.27-1.674-1.038-.71.08-.695.08-.695 1.148.08 1.752 1.178 1.752 1.178 1.02 1.748 2.676 1.243 3.328.95.103-.738.399-1.243.725-1.53-2.54-.289-5.211-1.27-5.211-5.65 0-1.248.446-2.27 1.177-3.07-.118-.288-.51-1.45.112-3.024 0 0 .96-.307 3.145 1.173A10.91 10.91 0 0 1 12 6.03c.973.004 1.954.132 2.87.387 2.182-1.48 3.14-1.173 3.14-1.173.625 1.573.233 2.736.115 3.024.734.8 1.175 1.822 1.175 3.07 0 4.39-2.676 5.358-5.224 5.642.41.353.776 1.05.776 2.117 0 1.528-.014 2.761-.014 3.136 0 .309.207.668.79.555A11.502 11.502 0 0 0 23.5 12C23.5 5.649 18.351.5 12 .5Z"})})}function qr({title:e,description:t,children:n,bordered:r=!0,alignStart:s=!1}){return p.jsx("div",{className:r?"border-t border-border":void 0,children:p.jsxs("div",{className:be("flex flex-col gap-4 py-5 md:flex-row md:justify-between md:gap-8",s?"md:items-start":"md:items-center"),children:[p.jsxs("div",{className:"min-w-0 max-w-xl",children:[p.jsx("div",{className:"text-sm font-medium text-foreground",children:e}),p.jsx("div",{className:"mt-1 text-[13px] text-muted-foreground",children:t})]}),p.jsx("div",{className:"flex items-center justify-start md:shrink-0 md:justify-end",children:n})]})})}function ine(){var Fe,dt;const e=Pl(),{sectionId:t}=xR(),n=ub(),{theme:r,setTheme:s}=_D(),[a,l]=y.useState("idle"),[u,h]=y.useState([]),[d,m]=y.useState(null),g=XE(t)??"general",_=n.connectionStatus==="connecting"||!n.localProjectsReady,b=((Fe=n.localProjects)==null?void 0:Fe.machine.displayName)??"Unavailable",w=((dt=n.localProjects)==null?void 0:dt.projects.length)??0,S=Kb.split("/")[1]??"unknown",C=Gr(ee=>ee.scrollbackLines),k=Gr(ee=>ee.minColumnWidth),T=Gr(ee=>ee.editorPreset),R=Gr(ee=>ee.editorCommandTemplate),M=Gr(ee=>ee.setScrollbackLines),O=Gr(ee=>ee.setMinColumnWidth),D=Gr(ee=>ee.setEditorPreset),j=Gr(ee=>ee.setEditorCommandTemplate),F=gl(ee=>ee.chatSoundPreference),G=gl(ee=>ee.chatSoundId),B=gl(ee=>ee.setChatSoundPreference),H=gl(ee=>ee.setChatSoundId),P=n.keybindings,U=tr(ee=>ee.defaultProvider),q=tr(ee=>ee.providerDefaults),W=tr(ee=>ee.showTranscriptToc),z=tr(ee=>ee.setDefaultProvider),$=tr(ee=>ee.setShowTranscriptToc),V=tr(ee=>ee.setProviderDefaultModel),Q=tr(ee=>ee.setProviderDefaultModelOptions),N=tr(ee=>ee.setProviderDefaultPlanMode),I=y.useMemo(()=>SD(P),[P]),Z=I.filePathDisplay||p7(),[L,de]=y.useState(String(C)),[me,ue]=y.useState(String(k)),[he,we]=y.useState(R),[le,xe]=y.useState({}),[Ne,ae]=y.useState(null),pe=n.updateSnapshot,Re=Zte(pe),$e=(pe==null?void 0:pe.status)==="checking"?"Checking for updates…":(pe==null?void 0:pe.status)==="updating"?"Installing update…":(pe==null?void 0:pe.status)==="restart_pending"?"Restarting Kanna…":(pe==null?void 0:pe.status)==="available"?`Update available${pe.latestVersion?`: ${pe.latestVersion}`:""}`:(pe==null?void 0:pe.status)==="up_to_date"?"Up to date":(pe==null?void 0:pe.status)==="error"?"Update check failed":"Not checked yet";y.useEffect(()=>{de(String(C))},[C]),y.useEffect(()=>{ue(String(k))},[k]),y.useEffect(()=>{we(R)},[R]),y.useEffect(()=>{xe(Object.fromEntries(ZE.map(ee=>[ee,m_(I.bindings[ee])])))},[I]),y.useEffect(()=>{t&&(XE(t)||e("/settings/general",{replace:!0}))},[e,t]),y.useEffect(()=>{if(g!=="changelog"||_)return;let ee=!1;return l("loading"),m(null),JE().then(Ge=>{ee||(h(Ge),l("success"))}).catch(Ge=>{ee||(m(Ge instanceof Error?Ge.message:"Unable to load changelog."),l("error"))}),()=>{ee=!0}},[_,g]);function at(){const ee=Number(L);if(!Number.isFinite(ee)){de(String(C));return}M(ee)}function Lt(){const ee=Number(me);if(!Number.isFinite(ee)){ue(String(k));return}O(ee)}function zt(ee,Ge){ee.key==="Enter"&&(Ge(),ee.currentTarget.blur())}function ut(ee,Ge){ee.key==="Enter"&&(Ge(),ee.currentTarget.blur())}function yt(){j(he)}function un(ee){QE(F,ee)&&(B(ee),L_(G,1).catch(()=>{}))}function en(ee){QE(G,ee)&&(H(ee),L_(ee,1).catch(()=>{}))}async function bn(){try{ae(null),await n.socket.command({type:"settings.writeKeybindings",bindings:eR(le)})}catch(ee){ae(ee instanceof Error?ee.message:"Unable to save keybindings.")}}async function Nt(ee){const Ge={...le,[ee]:m_(ro[ee])};xe(Ge);try{ae(null),await n.socket.command({type:"settings.writeKeybindings",bindings:eR(Ge)})}catch(pt){ae(pt instanceof Error?pt.message:"Unable to save keybindings.")}}function Yn(){bl=null,l("loading"),m(null),JE({force:!0}).then(ee=>{h(ee),l("success")}).catch(ee=>{m(ee instanceof Error?ee.message:"Unable to load changelog."),l("error")})}const Y=he.replaceAll("{path}","/Users/jake/Projects/kanna/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),oe=vu.find(ee=>ee.id===g)??vu[0],Ee=g==="keybindings"?Xte(Z):oe.subtitle,ze=!_;return p.jsxs("div",{className:"relative flex h-full flex-1 min-w-0 bg-background",children:[p.jsxs("div",{className:"flex min-w-0 flex-1",children:[p.jsx("aside",{className:`hidden w-[200px] shrink-0 md:block ${ze?"pb-[89px]":""}`,children:p.jsxs("div",{className:"flex flex-col gap-1 px-4 py-6",children:[p.jsx("div",{className:"px-3 pb-5 text-[22px] font-extrabold tracking-[-0.5px] text-foreground",children:"Settings"}),vu.map(ee=>p.jsx("button",{type:"button",onClick:()=>e(`/settings/${ee.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${ee.id===g?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx(ee.icon,{className:"h-4 w-4 shrink-0"}),p.jsx("span",{children:ee.label})]})},ee.label))]})}),p.jsxs("div",{className:"min-w-0 flex-1 overflow-y-auto",children:[p.jsx("div",{className:"border-b border-border py-2 md:hidden",children:p.jsx("div",{className:"overflow-x-auto pr-4 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:p.jsxs("div",{className:"flex min-w-max items-center gap-2",children:[p.jsx("div",{className:" sticky left-0 bg-gradient-to-r from-background via-background/80 to-transparent px-2 py-1",children:p.jsx("button",{type:"button",onClick:n.openSidebar,className:"flex shrink-0 items-center p-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground","aria-label":"Open sidebar",title:"Open sidebar",children:p.jsx(kb,{className:"h-4 w-4 shrink-0"})})}),vu.map(ee=>p.jsxs("button",{type:"button",onClick:()=>e(`/settings/${ee.id}`),className:be("flex shrink-0 items-center gap-2 rounded-full border px-3 py-2 text-sm transition-colors",ee.id===g?"border-transparent bg-muted font-medium text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[p.jsx(ee.icon,{className:"h-4 w-4 shrink-0"}),p.jsx("span",{className:"whitespace-nowrap",children:ee.label})]},ee.label))]})})}),p.jsxs("div",{className:"w-full px-4 pb-32 pt-8 md:px-6 md:pt-16",children:[_?p.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:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(fi,{className:"h-4 w-4 animate-spin"}),p.jsx("span",{children:"Loading machine settings…"})]})}):p.jsxs("div",{className:"mx-auto max-w-4xl",children:[p.jsxs("div",{className:"pb-6",children:[p.jsxs("div",{className:"flex items-center justify-between gap-4 min-h-[34px]",children:[p.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:oe.label}),g==="keybindings"?p.jsxs(GE,{onClick:()=>{n.handleOpenExternalPath("open_editor",Z)},icon:p.jsx(Sb,{className:"h-4 w-4"}),children:["Open in ",n.editorLabel]}):null,g==="general"?p.jsx("div",{className:"flex items-center gap-2",children:p.jsx(GE,{variant:Re.variant,onClick:()=>{if(Re.kind==="update"){n.handleInstallUpdate();return}n.handleCheckForUpdates({force:!0})},disabled:Re.disabled,icon:Re.kind==="check"?p.jsx(zB,{className:be("size-3.5",Re.spinning&&"animate-spin")}):Re.kind==="update"?p.jsx(kP,{className:be("size-3.5")}):void 0,children:Re.label})}):null]}),p.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:Ee})]}),g==="general"?p.jsx(p.Fragment,{children:p.jsxs("div",{className:"border-b border-border",children:[p.jsx(qr,{title:"Application Update",description:p.jsxs(p.Fragment,{children:[p.jsxs("span",{children:[$e,"."]}),pe!=null&&pe.lastCheckedAt?p.jsxs("span",{children:[" Last checked ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(pe.lastCheckedAt),"."]}):null,pe!=null&&pe.error?p.jsxs("span",{children:[" ",pe.error]}):null]}),bordered:!1,children:p.jsxs("div",{className:"text-right text-sm text-foreground",children:[p.jsxs("div",{children:["Current: ",(pe==null?void 0:pe.currentVersion)??S]}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(pe==null?void 0:pe.latestVersion)??"Unknown"]})]})}),p.jsx(qr,{title:"Theme",description:"Choose between light, dark, or system appearance",children:p.jsx(tb,{value:r,onValueChange:s,options:Wte,size:"sm"})}),p.jsx(qr,{title:"Chat Sounds",description:"Play a pop when a chat starts waiting on you or the unread chat count increases",children:p.jsxs(af,{value:F,onValueChange:ee=>un(ee),children:[p.jsx(mu,{className:"min-w-[180px]",children:p.jsx(cf,{})}),p.jsx(gu,{children:p.jsx(lf,{children:qte.map(ee=>p.jsx(pl,{value:ee.value,children:ee.label},ee.value))})})]})}),p.jsx(qr,{title:"Chat Sound",description:"The bundled sound used for chat notification playback and previews",children:p.jsxs(af,{value:G,onValueChange:ee=>en(ee),children:[p.jsx(mu,{className:"min-w-[180px]",children:p.jsx(cf,{})}),p.jsx(gu,{children:p.jsx(lf,{children:x7.map(ee=>p.jsx(pl,{value:ee.value,children:ee.label},ee.value))})})]})}),p.jsx(qr,{title:"Transcript Table of Contents",description:"Show a floating list of user messages in chat when the layout is wider than 1200 px",children:p.jsx(tb,{value:W?"enabled":"disabled",onValueChange:ee=>$(ee==="enabled"),options:Kte,size:"sm"})}),p.jsx(qr,{title:"Default Editor",description:"Used by the navbar code button and local file links in chat",alignStart:!0,children:p.jsxs(af,{value:T,onValueChange:ee=>D(ee),children:[p.jsx(mu,{className:"min-w-[180px]",children:p.jsx(cf,{})}),p.jsx(gu,{children:p.jsx(lf,{children:Vte.map(ee=>p.jsx(pl,{value:ee.value,children:ee.label},ee.value))})})]})}),T==="custom"?p.jsx("div",{className:"border-t border-border",children:p.jsxs("div",{className:"flex justify-between gap-8 py-5 pl-6",children:[p.jsxs("div",{className:"min-w-0 max-w-xl",children:[p.jsx("div",{className:"text-sm font-medium text-foreground",children:"Command Template"}),p.jsxs("div",{className:"mt-1 text-[13px] text-muted-foreground",children:["Include ","{path}"," and optionally ","{line}"," and ","{column}"," in your command."]})]}),p.jsxs("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:[p.jsx(so,{type:"text",value:he,onChange:ee=>we(ee.target.value),onBlur:yt,onKeyDown:ee=>ut(ee,yt),className:"font-mono"}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview: ",p.jsx("span",{className:"font-mono",children:Y})]})]})]})}):null,p.jsx(qr,{title:"Terminal Scrollback",description:"Lines retained for embedded terminal history",children:p.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[p.jsx(so,{type:"number",min:Gy,max:Yy,step:100,value:L,onChange:ee=>de(ee.target.value),onBlur:at,onKeyDown:ee=>zt(ee,at),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),p.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Gy,"-",Yy," lines",C===lp?" (default)":""]})]})}),p.jsx(qr,{title:"Terminal Min Column Width",description:"Minimum width for each terminal pane",children:p.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[p.jsx(so,{type:"number",min:Xy,max:Zy,step:10,value:me,onChange:ee=>ue(ee.target.value),onBlur:Lt,onKeyDown:ee=>zt(ee,Lt),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),p.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Xy,"-",Zy," px",k===cp?" (default)":""]})]})})]})}):g==="providers"?p.jsxs("div",{className:"border-b border-border",children:[p.jsx(qr,{title:"Default Provider",description:"The default harness used for new chats before a provider is locked by an existing session.",bordered:!1,children:p.jsxs(af,{value:U,onValueChange:ee=>z(ee),children:[p.jsx(mu,{className:"min-w-[180px]",children:p.jsx(cf,{})}),p.jsx(gu,{children:p.jsxs(lf,{children:[p.jsx(pl,{value:"last_used",children:"Last Used"}),Su.map(ee=>p.jsx(pl,{value:ee.id,children:ee.label},ee.id))]})})]})}),p.jsx(qr,{title:"Claude Code Defaults",description:"Saved defaults when using Claude Code.",alignStart:!0,children:p.jsx("div",{className:"max-w-[420px]",children:p.jsx(G_,{availableProviders:Su,selectedProvider:"claude",showProviderPicker:!1,providerLocked:!0,model:q.claude.model,modelOptions:q.claude.modelOptions,onModelChange:(ee,Ge)=>{V("claude",Ge)},onModelOptionChange:ee=>{ee.type==="claudeReasoningEffort"?Q("claude",{reasoningEffort:ee.effort}):ee.type==="contextWindow"&&Q("claude",{contextWindow:ee.contextWindow})},planMode:q.claude.planMode,onPlanModeChange:ee=>N("claude",ee),includePlanMode:!0,className:"justify-start flex-wrap"})})}),p.jsx(qr,{title:"Codex Defaults",description:"Saved defaults when using Codex.",alignStart:!0,children:p.jsx("div",{className:"max-w-[420px]",children:p.jsx(G_,{availableProviders:Su,selectedProvider:"codex",showProviderPicker:!1,providerLocked:!0,model:q.codex.model,modelOptions:q.codex.modelOptions,onModelChange:(ee,Ge)=>{V("codex",Ge)},onModelOptionChange:ee=>{ee.type==="codexReasoningEffort"?Q("codex",{reasoningEffort:ee.effort}):ee.type==="fastMode"&&Q("codex",{fastMode:ee.fastMode})},planMode:q.codex.planMode,onPlanModeChange:ee=>N("codex",ee),includePlanMode:!0,className:"justify-start flex-wrap"})})})]}):g==="keybindings"?p.jsxs("div",{className:"border-b border-border",children:[Ne?p.jsx("div",{className:"mb-4 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:Ne}):null,I.warning?p.jsx("div",{className:"mb-4 rounded-2xl border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:I.warning}):null,ZE.map((ee,Ge)=>{const pt=m_(ro[ee]),ie=le[ee]??"",Te=ie!==pt;return p.jsx(qr,{title:wD[ee],description:p.jsxs(p.Fragment,{children:[p.jsx("span",{children:"Comma-separated shortcuts."}),Te?p.jsxs(p.Fragment,{children:[p.jsx("span",{children:" "}),p.jsxs("button",{type:"button",onClick:()=>{Nt(ee)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",pt]})]}):null]}),bordered:Ge!==0,children:p.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:p.jsx(so,{type:"text",value:ie,onChange:lt=>{const bt=lt.target.value;xe(dn=>({...dn,[ee]:bt}))},onBlur:()=>{bn()},onKeyDown:lt=>ut(lt,()=>{bn()}),className:"font-mono"})})},ee)})]}):p.jsx(nne,{status:a,releases:u,error:d,onRetry:Yn})]}),n.commandError?p.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:[p.jsx(cB,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),p.jsx("span",{children:n.commandError})]}):null]})]})]}),ze?p.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:p.jsx("div",{className:"px-6 py-[14.25px]",children:p.jsxs("div",{className:"grid gap-3 text-xs text-muted-foreground grid-cols-2 lg:grid-cols-4",children:[p.jsxs("div",{children:[p.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Machine"}),p.jsx("div",{className:"text-foreground/80",children:b})]}),p.jsxs("div",{className:"hidden md:block",children:[p.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Connection"}),p.jsx("div",{className:"text-foreground/80",children:n.connectionStatus})]}),p.jsxs("div",{className:"hidden md:block",children:[p.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Projects Indexed"}),p.jsx("div",{className:"text-foreground/80",children:w})]}),p.jsxs("div",{children:[p.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"App Version"}),p.jsx("div",{className:"text-foreground/80",children:S})]})]})})}):null]})}function eR(e){return{toggleEmbeddedTerminal:nu(e.toggleEmbeddedTerminal??""),toggleRightSidebar:nu(e.toggleRightSidebar??""),openInFinder:nu(e.openInFinder??""),openInEditor:nu(e.openInEditor??""),addSplitTerminal:nu(e.addSplitTerminal??"")}}function uf(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function sne(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}function one(e){const t=e&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)?e.content:Array.isArray(e)?e:[],n=[];for(const r of t)if(!(!r||typeof r!="object"||!("type"in r))){if(r.type==="text"&&typeof r.text=="string"){n.push({type:"text",text:r.text});continue}if(r.type==="image"){if("data"in r&&typeof r.data=="string"){n.push({type:"image",data:r.data,mimeType:typeof r.mimeType=="string"?r.mimeType:void 0});continue}"source"in r&&r.source&&typeof r.source=="object"&&"type"in r.source&&r.source.type==="base64"&&"data"in r.source&&typeof r.source.data=="string"&&n.push({type:"image",data:r.source.data,mimeType:typeof r.source.media_type=="string"?r.source.media_type:void 0})}}return n}function ane(e,t){const n=sne(t);switch(e.toolKind){case"ask_user_question":{const a=uf(n),l=uf(a==null?void 0:a.answers)??(a||{});return{answers:Object.fromEntries(Object.entries(l).map(([u,h])=>Array.isArray(h)?[u,h.map(d=>String(d))]:h&&typeof h=="object"&&Array.isArray(h.answers)?[u,h.answers.map(d=>String(d))]:h==null||h===""?[u,[]]:[u,[String(h)]])),...(a==null?void 0:a.discarded)===!0?{discarded:!0}:{}}}case"exit_plan_mode":{const a=uf(n);return{confirmed:typeof(a==null?void 0:a.confirmed)=="boolean"?a.confirmed:void 0,clearContext:typeof(a==null?void 0:a.clearContext)=="boolean"?a.clearContext:void 0,message:typeof(a==null?void 0:a.message)=="string"?a.message:void 0,...(a==null?void 0:a.discarded)===!0?{discarded:!0}:{}}}case"read_file":if(typeof n=="string")return n;const r=one(n);if(r.length>0)return{content:r.flatMap(a=>a.type==="text"?[a.text]:[]).join(""),blocks:r};const s=uf(n);return{content:typeof(s==null?void 0:s.content)=="string"?s.content:JSON.stringify(n,null,2)};default:return n}}function m3(e){return new Date(e).toISOString()}function ai(e){return{id:e._id,messageId:e.messageId,timestamp:m3(e.createdAt),hidden:e.hidden}}function lne(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:m3(e.createdAt)}}function cne(e){if(e.debugRaw)try{return JSON.parse(e.debugRaw).tool_use_result}catch{return}}function une(e){const t=new Map,n=[];for(const r of e)switch(r.kind){case"user_prompt":n.push({...ai(r),kind:"user_prompt",content:r.content,attachments:r.attachments??[]});break;case"system_init":n.push({...ai(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({...ai(r),kind:"account_info",accountInfo:r.accountInfo});break;case"assistant_text":n.push({...ai(r),kind:"assistant_text",text:r.text});break;case"tool_call":{const s=lne(r);t.set(r.tool.toolId,{hydrated:s,normalized:r.tool}),n.push(s);break}case"tool_result":{const s=t.get(r.toolId);if(s){const a=s.normalized.toolKind==="ask_user_question"||s.normalized.toolKind==="exit_plan_mode"?cne(r)??r.content:r.content;s.hydrated.result=ane(s.normalized,a),s.hydrated.rawResult=a,s.hydrated.isError=r.isError}break}case"result":n.push({...ai(r),kind:"result",success:!r.isError,cancelled:r.subtype==="cancelled",result:r.result,durationMs:r.durationMs,costUsd:r.costUsd});break;case"status":n.push({...ai(r),kind:"status",status:r.status});break;case"compact_boundary":n.push({...ai(r),kind:"compact_boundary"});break;case"compact_summary":n.push({...ai(r),kind:"compact_summary",summary:r.summary});break;case"context_cleared":n.push({...ai(r),kind:"context_cleared"});break;case"interrupted":n.push({...ai(r),kind:"interrupted"});break;default:n.push({...ai(r),kind:"unknown",json:JSON.stringify(r,null,2)});break}return n}const dne=["AskUserQuestion","ExitPlanMode","TodoWrite"],hne=new Set(["TodoWrite"]);function fne(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const s=r;if(s.toolName===t&&!s.result)return s.id}return null}function pne(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const s=r;if(s.toolName===t)return s.id}return null}function mne(e){const t={};for(const n of dne)t[n]=hne.has(n)?pne(e,n):fne(e,n);return t}function gne(e){return e==="starting"||e==="running"||e==="waiting_for_user"}function vne(e){return e==="starting"||e==="running"||e==="waiting_for_user"}const _ne=25e3,yne=15e3,bne=4e3;class xne{constructor(t){pn(this,"url");pn(this,"ws",null);pn(this,"started",!1);pn(this,"reconnectTimer",null);pn(this,"reconnectDelayMs",750);pn(this,"subscriptions",new Map);pn(this,"pending",new Map);pn(this,"outboundQueue",[]);pn(this,"statusListeners",new Set);pn(this,"heartbeatTimer",null);pn(this,"pingTimeoutTimer",null);pn(this,"pingPromise",null);pn(this,"lastOpenAt",0);pn(this,"lastMessageAt",0);pn(this,"reconnectImmediatelyOnClose",!1);pn(this,"handleWindowFocus",()=>{this.ensureHealthyConnection()});pn(this,"handleVisibilityChange",()=>{if(document.visibilityState==="visible"){this.startHeartbeat(),this.ensureHealthyConnection();return}this.stopHeartbeat()});pn(this,"handleOnline",()=>{this.ensureHealthyConnection()});this.url=t}start(){this.started||(this.started=!0,window.addEventListener("focus",this.handleWindowFocus),window.addEventListener("online",this.handleOnline),document.addEventListener("visibilitychange",this.handleVisibilityChange),this.connect())}dispose(){var t;this.started=!1,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.clearPingState(),window.removeEventListener("focus",this.handleWindowFocus),window.removeEventListener("online",this.handleOnline),document.removeEventListener("visibilitychange",this.handleVisibilityChange),(t=this.ws)==null||t.close(),this.ws=null;for(const n of this.pending.values())n.reject(new Error("Socket disposed"));this.pending.clear()}onStatus(t){return this.statusListeners.add(t),t(this.getStatus()),()=>{this.statusListeners.delete(t)}}subscribe(t,n,r){const s=vv();return this.subscriptions.set(s,{topic:t,listener:n,eventListener:r}),this.enqueue({v:1,type:"subscribe",id:s,topic:t}),()=>{this.subscriptions.delete(s),this.enqueue({v:1,type:"unsubscribe",id:s})}}subscribeTerminal(t,n){const r=vv(),s={type:"terminal",terminalId:t};return this.subscriptions.set(r,{topic:s,listener:n.onSnapshot,eventListener:n.onEvent}),this.enqueue({v:1,type:"subscribe",id:r,topic:s}),()=>{this.subscriptions.delete(r),this.enqueue({v:1,type:"unsubscribe",id:r})}}command(t){const n=vv(),r={v:1,type:"command",id:n,command:t};return new Promise((s,a)=>{this.pending.set(n,{resolve:s,reject:a}),this.enqueue(r)})}ensureHealthyConnection(){return!this.ws||this.ws.readyState===WebSocket.CLOSED||this.ws.readyState===WebSocket.CLOSING?(this.reconnectNow(),Promise.resolve()):this.ws.readyState===WebSocket.CONNECTING||!this.isConnectionStale()?Promise.resolve():this.sendPing()}connect(){this.started&&(this.emitStatus("connecting"),this.ws=new WebSocket(this.url),this.ws.addEventListener("open",()=>{this.reconnectDelayMs=750,this.reconnectImmediatelyOnClose=!1,this.lastOpenAt=Date.now(),this.lastMessageAt=this.lastOpenAt,this.emitStatus("connected"),this.startHeartbeat();for(const[t,n]of this.subscriptions.entries())this.sendNow({v:1,type:"subscribe",id:t,topic:n.topic});for(;this.outboundQueue.length>0;){const t=this.outboundQueue.shift();t&&this.sendNow(t)}}),this.ws.addEventListener("message",t=>{var r;this.lastMessageAt=Date.now();let n;try{n=JSON.parse(String(t.data))}catch{return}if(n.type==="snapshot"){const s=this.subscriptions.get(n.id);s==null||s.listener(n.snapshot.data);return}if(n.type==="event"){const s=this.subscriptions.get(n.id);(r=s==null?void 0:s.eventListener)==null||r.call(s,n.event);return}if(n.type==="ack"){const s=this.pending.get(n.id);if(!s)return;this.pending.delete(n.id),s.resolve(n.result);return}if(n.type==="error"){if(!n.id){console.error(c7,n.message);return}const s=this.pending.get(n.id);if(!s)return;this.pending.delete(n.id),s.reject(new Error(n.message))}}),this.ws.addEventListener("close",()=>{if(!this.started)return;const t=this.reconnectImmediatelyOnClose;this.reconnectImmediatelyOnClose=!1,this.stopHeartbeat(),this.clearPingState(),this.emitStatus("disconnected");for(const n of this.pending.values())n.reject(new Error("Disconnected"));if(this.pending.clear(),t){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>=_ne}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()},bne),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()},yne))}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);return}this.outboundQueue.push(t)}sendNow(t){var n;(n=this.ws)==null||n.send(JSON.stringify(t))}}function wne(e,t){var r;const n=e.find(s=>s.chats.some(a=>a.chatId===t));return n?((r=n.chats.find(s=>s.chatId!==t))==null?void 0:r.chatId)??null:null}function Sne(e=document){return e.visibilityState==="visible"&&e.hasFocus()}function Cne(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function kne(){const e=y.useRef(null);return e.current||(e.current=new xne(Cne())),y.useEffect(()=>{const t=e.current;return t==null||t.start(),()=>{t==null||t.dispose()}},[]),e.current}function _u(e,t){if(t===void 0){console.info(`[useKannaState] ${e}`);return}console.info(`[useKannaState] ${e}`,t)}function Ene(e){var t,n;return(e==null?void 0:e.provider)==="claude"&&e.model&&((t=e.modelOptions)!=null&&t.claude)?{provider:"claude",model:e.model,modelOptions:{reasoningEffort:e.modelOptions.claude.reasoningEffort??"high",contextWindow:e.modelOptions.claude.contextWindow??"200k"},planMode:!!e.planMode}:(e==null?void 0:e.provider)==="codex"&&e.model&&((n=e.modelOptions)!=null&&n.codex)?{provider:"codex",model:e.model,modelOptions:{reasoningEffort:e.modelOptions.codex.reasoningEffort??"high",fastMode:e.modelOptions.codex.fastMode??!1},planMode:!!e.planMode}:null}function Rne(e){return e<24}function Tne(e,t){return e==="awaiting_disconnect"&&t==="disconnected"?"awaiting_reconnect":e==="awaiting_reconnect"&&t==="connected"?"navigate_changelog":"none"}const Mne=320,sx="kanna:ui-update-restart";function Nne(){return window.sessionStorage.getItem(sx)}function tR(e){window.sessionStorage.setItem(sx,e)}function w_(){window.sessionStorage.removeItem(sx)}function Ane(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 Dne(e,t){return!e||!t?null:e.runtime.chatId!==t?(_u("stale snapshot masked",{routeChatId:t,snapshotChatId:e.runtime.chatId,snapshotProvider:e.runtime.provider}),null):e}function One(e){var Dn,hn,On;const t=Pl(),n=kne(),r=bI(),[s,a]=y.useState({projectGroups:[]}),[l,u]=y.useState(null),[h,d]=y.useState(null),[m,g]=y.useState(null),[_,b]=y.useState(null),[w,S]=y.useState("connecting"),[C,k]=y.useState(!1),[T,R]=y.useState(!1),[M,O]=y.useState(!1),[D,j]=y.useState(null),[F,G]=y.useState(!1),[B,H]=y.useState(!1),[P,U]=y.useState(148),[q,W]=y.useState(!0),[z,$]=y.useState(null),[V,Q]=y.useState(null),[N,I]=y.useState(null),[Z,L]=y.useState(0),de=ree(Gr(re=>re.editorPreset)),me=y.useRef(null),ue=y.useRef(null),he=y.useRef(!1),we=y.useRef(null);y.useEffect(()=>n.onStatus(S),[n]),y.useEffect(()=>n.subscribe({type:"sidebar"},re=>{a(re),k(!0),$(null)}),[n]),y.useEffect(()=>n.subscribe({type:"local-projects"},re=>{u(re),R(!0),$(null)}),[n]),y.useEffect(()=>n.subscribe({type:"update"},re=>{d(re),$(null)}),[n]),y.useEffect(()=>{w==="connected"&&n.command({type:"update.check",force:!0}).catch(re=>{$(re instanceof Error?re.message:String(re))})},[w,n]),y.useEffect(()=>{const re=Nne(),ve=Tne(re,w);if(ve==="awaiting_reconnect"){tR("awaiting_reconnect");return}ve==="navigate_changelog"&&(w_(),t("/settings/changelog",{replace:!0}))},[w,t]),y.useEffect(()=>{function re(){h!=null&&h.lastCheckedAt&&(Date.now()-h.lastCheckedAt<=3600*1e3||n.command({type:"update.check"}).catch(ve=>{$(ve instanceof Error?ve.message:String(ve))}))}return window.addEventListener("focus",re),()=>{window.removeEventListener("focus",re)}},[n,h==null?void 0:h.lastCheckedAt]),y.useEffect(()=>n.subscribe({type:"keybindings"},re=>{b(re),$(null)}),[n]),y.useEffect(()=>{function re(){L(ve=>ve+1)}return window.addEventListener("focus",re),document.addEventListener("visibilitychange",re),()=>{window.removeEventListener("focus",re),document.removeEventListener("visibilitychange",re)}},[]),y.useEffect(()=>{if(!e){_u("clearing chat snapshot for non-chat route"),g(null),O(!0);return}return _u("subscribing to chat",{activeChatId:e}),g(null),O(!1),n.subscribe({type:"chat",chatId:e},re=>{_u("chat snapshot received",{activeChatId:e,snapshotChatId:(re==null?void 0:re.runtime.chatId)??null,snapshotProvider:(re==null?void 0:re.runtime.provider)??null,snapshotStatus:(re==null?void 0:re.runtime.status)??null}),g(re),O(!0),$(null)})},[e,n]),y.useEffect(()=>{if(D)return;const re=s.projectGroups[0];re&&j(re.groupKey)},[D,s.projectGroups]),y.useEffect(()=>{if(!e||!C||!M)return;if(s.projectGroups.some(ve=>ve.chats.some(Ue=>Ue.chatId===e))){N===e&&I(null);return}N!==e&&t("/")},[e,M,t,N,s.projectGroups,C]),y.useEffect(()=>{m&&(j(m.runtime.projectId),N===m.runtime.chatId&&I(null))},[m,N]),y.useEffect(()=>{if(!e||!C||!Sne())return;const re=s.projectGroups.flatMap(ve=>ve.chats).find(ve=>ve.chatId===e);re!=null&&re.unread&&n.command({type:"chat.markRead",chatId:e}).catch(ve=>{$(ve instanceof Error?ve.message:String(ve))})},[e,Z,s.projectGroups,C,n]),y.useEffect(()=>{he.current=!1,we.current!==null&&(window.cancelAnimationFrame(we.current),we.current=null),W(!0)},[e]),y.useEffect(()=>()=>{we.current!==null&&window.cancelAnimationFrame(we.current)},[]),y.useLayoutEffect(()=>{const re=ue.current;if(!re)return;const ve=new ResizeObserver(()=>{U(re.getBoundingClientRect().height)});return ve.observe(re),U(re.getBoundingClientRect().height),()=>ve.disconnect()},[]);const le=y.useMemo(()=>Dne(m,e),[e,m]);y.useEffect(()=>{_u("active snapshot resolved",{routeChatId:e,rawSnapshotChatId:(m==null?void 0:m.runtime.chatId)??null,rawSnapshotProvider:(m==null?void 0:m.runtime.provider)??null,activeSnapshotChatId:(le==null?void 0:le.runtime.chatId)??null,activeSnapshotProvider:(le==null?void 0:le.runtime.provider)??null,pendingChatId:N})},[e,le,m,N]);const xe=y.useMemo(()=>une((le==null?void 0:le.messages)??[]),[le==null?void 0:le.messages]),Ne=y.useMemo(()=>mne(xe),[xe]),ae=(le==null?void 0:le.runtime)??null,pe=(le==null?void 0:le.availableProviders)??Su,Re=vne(ae==null?void 0:ae.status),$e=gne(ae==null?void 0:ae.status),at=(ae==null?void 0:ae.isDraining)??!1,Lt=Mne,zt=!q&&xe.length>0,ut=((Dn=l==null?void 0:l.projects[0])==null?void 0:Dn.localPath)??null,yt=(ae==null?void 0:ae.localPath)??ut??((hn=s.projectGroups[0])==null?void 0:hn.localPath),un=!!(D??(ae==null?void 0:ae.projectId)??((On=s.projectGroups[0])==null?void 0:On.groupKey)??ut);y.useLayoutEffect(()=>{if(he.current)return;const re=me.current;re&&(e&&!ae||(re.scrollTo({top:re.scrollHeight,behavior:"auto"}),we.current!==null&&window.cancelAnimationFrame(we.current),we.current=window.requestAnimationFrame(()=>{const ve=me.current;ve&&(ve.scrollTo({top:ve.scrollHeight,behavior:"auto"}),we.current=null)}),he.current=!0))},[e,P,xe.length,ae]),y.useEffect(()=>{if(!he.current||!q)return;const re=window.requestAnimationFrame(()=>{const ve=me.current;!ve||!q||ve.scrollTo({top:ve.scrollHeight,behavior:"auto"})});return()=>window.cancelAnimationFrame(re)},[e,P,q,xe.length,ae==null?void 0:ae.status]);function en(){const re=me.current;if(!re)return;const ve=re.scrollHeight-re.scrollTop-re.clientHeight;W(Rne(ve))}function bn(re){const ve=me.current;W(!0),ve&&ve.scrollTo({top:ve.scrollHeight,behavior:re})}function Nt(){bn("smooth")}async function Yn(re){const ve=tr.getState(),Ue=e?ve.getComposerState(e):ve.getComposerState(K_),Ye=await n.command({type:"chat.create",projectId:re});ve.initializeComposerForChat(Ye.chatId,{sourceState:Ue}),j(re),I(Ye.chatId),t(`/chat/${Ye.chatId}`),G(!1),$(null)}async function Y(re){return re.kind==="project_id"?{projectId:re.projectId}:re.kind==="local_path"?{projectId:(await n.command({type:"project.open",localPath:re.localPath})).projectId,localPath:re.localPath}:{projectId:(await n.command(re.project.mode==="new"?{type:"project.create",localPath:re.project.localPath,title:re.project.title}:{type:"project.open",localPath:re.project.localPath})).projectId,localPath:re.project.localPath}}async function oe(re){try{const ve=re.kind==="project_id"?null:re.kind==="local_path"?re.localPath:re.project.localPath;ve&&Q(ve);const{projectId:Ue}=await Y(re);await Yn(Ue)}catch(ve){$(ve instanceof Error?ve.message:String(ve))}finally{Q(null)}}async function Ee(re){await oe({kind:"project_id",projectId:re})}async function ze(re){await oe({kind:"local_path",localPath:re})}async function Fe(re){await oe({kind:"project_request",project:re})}async function dt(re){try{await n.command({type:"update.check",force:re==null?void 0:re.force}),$(null)}catch(ve){$(ve instanceof Error?ve.message:String(ve))}}async function ee(){try{const re=await n.command({type:"update.install"});if(!re.ok){w_(),$(null),await r.alert({title:re.userTitle??"Update failed",description:re.userMessage??"Kanna could not install the update. Try again later.",closeLabel:"OK"});return}if(re.ok&&re.action==="reload"){window.location.reload();return}re.ok&&re.action==="restart"&&tR("awaiting_disconnect"),$(null)}catch(re){w_(),$(re instanceof Error?re.message:String(re))}}async function Ge(re,ve){var Ue;try{let Ye=D??((Ue=s.projectGroups[0])==null?void 0:Ue.groupKey)??null;if(!e&&!Ye&&ut&&(Ye=(await n.command({type:"project.open",localPath:ut})).projectId,j(Ye)),!e&&!Ye)throw new Error("Open a project first");bn("auto");const mt=await n.command({type:"chat.send",chatId:e??void 0,projectId:e?void 0:Ye??void 0,provider:ve==null?void 0:ve.provider,content:re,attachments:ve==null?void 0:ve.attachments,model:ve==null?void 0:ve.model,modelOptions:ve==null?void 0:ve.modelOptions,planMode:ve==null?void 0:ve.planMode});if(!e&&mt.chatId){const yr=tr.getState();yr.setComposerState(mt.chatId,Ene(ve)??yr.getComposerState(K_)),I(mt.chatId),t(`/chat/${mt.chatId}`)}$(null)}catch(Ye){throw $(Ye instanceof Error?Ye.message:String(Ye)),Ye}}async function pt(){if(e)try{await n.command({type:"chat.cancel",chatId:e})}catch(re){$(re instanceof Error?re.message:String(re))}}async function ie(){if(e)try{await n.command({type:"chat.stopDraining",chatId:e})}catch(re){$(re instanceof Error?re.message:String(re))}}async function Te(re){if(await r.confirm({title:"Delete Chat",description:`Delete "${re.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{if(await n.command({type:"chat.delete",chatId:re.chatId}),re.chatId===e){const Ue=wne(s.projectGroups,re.chatId);t(Ue?`/chat/${Ue}`:"/")}}catch(Ue){$(Ue instanceof Error?Ue.message:String(Ue))}}async function lt(re){const ve=s.projectGroups.find(mt=>mt.groupKey===re);if(!ve)return;const Ue=ve.localPath.split("/").filter(Boolean).pop()??ve.localPath;if(await r.confirm({title:"Remove",description:`Remove "${Ue}" from the sidebar? Existing chats will be removed from ${ln}.`,confirmLabel:"Remove",confirmVariant:"destructive"}))try{await n.command({type:"project.remove",projectId:re}),eo.getState().clearProject(re),Nf.getState().clearProject(re),(ae==null?void 0:ae.projectId)===re&&t("/"),$(null)}catch(mt){$(mt instanceof Error?mt.message:String(mt))}}async function bt(re){var Ue,Ye;const ve=(ae==null?void 0:ae.localPath)??((Ue=l==null?void 0:l.projects[0])==null?void 0:Ue.localPath)??((Ye=s.projectGroups[0])==null?void 0:Ye.localPath);if(ve)try{await xt({action:re,localPath:ve})}catch(mt){$(mt instanceof Error?mt.message:String(mt))}}async function dn(re){var ve;try{if(typeof navigator>"u"||!((ve=navigator.clipboard)!=null&&ve.writeText))throw new Error("Clipboard is not available");await navigator.clipboard.writeText(re),$(null)}catch(Ue){$(Ue instanceof Error?Ue.message:String(Ue))}}async function Xn(re){try{await xt({action:"open_editor",localPath:re.path,line:re.line,column:re.column})}catch(ve){$(ve instanceof Error?ve.message:String(ve))}}async function Zn(re,ve){try{await xt({action:re,localPath:ve})}catch(Ue){$(Ue instanceof Error?Ue.message:String(Ue))}}async function xt(re){const ve=Gr.getState();$(null),await n.command({type:"system.openExternal",...re,editor:re.action==="open_editor"?{preset:ve.editorPreset,commandTemplate:ve.editorCommandTemplate}:void 0})}function Ct(){var ve;const re=Ane({selectedProjectId:D,sidebarProjectId:(ve=s.projectGroups[0])==null?void 0:ve.groupKey,fallbackLocalProjectPath:ut});if(re){oe(re);return}t("/")}async function Pt(re,ve,Ue){if(e)try{await n.command({type:"chat.respondTool",chatId:e,toolUseId:re,result:{questions:ve,answers:Ue}})}catch(Ye){$(Ye instanceof Error?Ye.message:String(Ye))}}async function Un(re,ve,Ue,Ye){if(e){ve&&tr.getState().setChatComposerPlanMode(e,!1);try{await n.command({type:"chat.respondTool",chatId:e,toolUseId:re,result:{confirmed:ve,...Ue?{clearContext:!0}:{},...Ye?{message:Ye}:{}}})}catch(mt){$(mt instanceof Error?mt.message:String(mt))}}}return{socket:n,activeChatId:e,sidebarData:s,localProjects:l,updateSnapshot:h,chatSnapshot:m,keybindings:_,connectionStatus:w,sidebarReady:C,localProjectsReady:T,commandError:z,startingLocalPath:V,sidebarOpen:F,sidebarCollapsed:B,scrollRef:me,inputRef:ue,messages:xe,latestToolIds:Ne,runtime:ae,availableProviders:pe,isProcessing:Re,canCancel:$e,isDraining:at,transcriptPaddingBottom:Lt,showScrollButton:zt,navbarLocalPath:yt,editorLabel:de,hasSelectedProject:un,openSidebar:()=>G(!0),closeSidebar:()=>G(!1),collapseSidebar:()=>H(!0),expandSidebar:()=>H(!1),updateScrollState:en,scrollToBottom:Nt,handleCreateChat:Ee,handleOpenLocalProject:ze,handleCreateProject:Fe,handleCheckForUpdates:dt,handleInstallUpdate:ee,handleSend:Ge,handleCancel:pt,handleStopDraining:ie,handleDeleteChat:Te,handleRemoveProject:lt,handleCopyPath:dn,handleOpenExternal:bt,handleOpenExternalPath:Zn,handleOpenLocalLink:Xn,handleCompose:Ct,handleAskUserQuestion:Pt,handleExitPlanMode:Un}}const nR="kanna:last-seen-version";function jne(e,t,n){return e==="/"&&!!t&&n!==t}function Lne(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,s)=>r+(s.unread?1:0)+(s.status==="waiting_for_user"?1:0),0),0)}function rR(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const s of r.chats)s.unread&&(t+=1),s.status==="waiting_for_user"&&n.add(s.chatId);return{unreadCount:t,waitingChatIds:n}}function zne(e,t){if(!e)return 0;const n=rR(e),r=rR(t),s=Math.max(0,r.unreadCount-n.unreadCount);let a=0;for(const l of r.waitingChatIds)n.waitingChatIds.has(l)||(a+=1);return s+a}function Pne(){const e=vi(),t=Pl(),n=xR(),r=One(n.chatId??null),s=gl(d=>d.chatSoundPreference),a=gl(d=>d.chatSoundId),l=e.pathname==="/",u=Kb.split("/")[1]??"unknown",h=y.useRef(null);return y.useEffect(()=>{const d=window.localStorage.getItem(nR),m=jne(e.pathname,u,d);window.localStorage.setItem(nR,u),m&&t("/settings/changelog",{replace:!0})},[u,e.pathname,t]),y.useLayoutEffect(()=>{document.title=ln},[e.key]),y.useEffect(()=>{function d(){document.title=ln}function m(){document.title=ln}return window.addEventListener("pageshow",d),window.addEventListener("pagehide",m),()=>{window.removeEventListener("pageshow",d),window.removeEventListener("pagehide",m)}},[]),y.useEffect(()=>{const d=Lne(r.sidebarData);document.title=d>0?`[${d}] ${ln}`:ln},[r.sidebarData]),y.useEffect(()=>{const d=zne(h.current,r.sidebarData);h.current=r.sidebarData,!(d<=0)&&k7(s)&&L_(a,d).catch(()=>{})},[a,s,r.sidebarData]),p.jsxs("div",{className:"flex h-[100dvh] min-h-[100dvh] overflow-hidden",children:[p.jsx(ZF,{data:r.sidebarData,activeChatId:r.activeChatId,connectionStatus:r.connectionStatus,ready:r.sidebarReady,open:r.sidebarOpen,collapsed:r.sidebarCollapsed,showMobileOpenButton:l,onOpen:r.openSidebar,onClose:r.closeSidebar,onCollapse:r.collapseSidebar,onExpand:r.expandSidebar,onCreateChat:d=>{r.handleCreateChat(d)},onDeleteChat:d=>{r.handleDeleteChat(d)},onCopyPath:d=>{r.handleCopyPath(d)},onOpenExternalPath:(d,m)=>{r.handleOpenExternalPath(d,m)},onRemoveProject:d=>{r.handleRemoveProject(d)},editorLabel:r.editorLabel,updateSnapshot:r.updateSnapshot,onInstallUpdate:()=>{r.handleInstallUpdate()}}),p.jsx(Pj,{context:r})]})}function Bne(){return p.jsx(n7,{children:p.jsx(yI,{children:p.jsx(Ij,{children:p.jsxs(hl,{element:p.jsx(Pne,{}),children:[p.jsx(hl,{path:"/",element:p.jsx(hte,{})}),p.jsx(hl,{path:"/settings",element:p.jsx(zj,{to:"/settings/general",replace:!0})}),p.jsx(hl,{path:"/settings/:sectionId",element:p.jsx(ine,{})}),p.jsx(hl,{path:"/chat/:chatId",element:p.jsx(ste,{})})]})})})})}const g3=document.getElementById("root");if(!g3)throw new Error("Missing #root");IO.createRoot(g3).render(p.jsx(y.StrictMode,{children:p.jsx(cL,{children:p.jsx(PJ,{children:p.jsx(Bne,{})})})}));