kaizenai 0.1.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.
- package/LICENSE +22 -0
- package/README.md +246 -0
- package/bin/kaizen +15 -0
- package/dist/client/apple-touch-icon.png +0 -0
- package/dist/client/assets/index-D-ORCGrq.js +603 -0
- package/dist/client/assets/index-r28mcHqz.css +32 -0
- package/dist/client/favicon.png +0 -0
- package/dist/client/fonts/body-medium.woff2 +0 -0
- package/dist/client/fonts/body-regular-italic.woff2 +0 -0
- package/dist/client/fonts/body-regular.woff2 +0 -0
- package/dist/client/fonts/body-semibold.woff2 +0 -0
- package/dist/client/index.html +22 -0
- package/dist/client/manifest-dark.webmanifest +24 -0
- package/dist/client/manifest.webmanifest +24 -0
- package/dist/client/pwa-192.png +0 -0
- package/dist/client/pwa-512.png +0 -0
- package/dist/client/pwa-icon.svg +15 -0
- package/dist/client/pwa-splash.png +0 -0
- package/dist/client/pwa-splash.svg +15 -0
- package/package.json +103 -0
- package/src/server/acp-shared.ts +315 -0
- package/src/server/agent.ts +1120 -0
- package/src/server/attachments.ts +133 -0
- package/src/server/backgrounds.ts +74 -0
- package/src/server/cli-runtime.ts +333 -0
- package/src/server/cli-supervisor.ts +81 -0
- package/src/server/cli.ts +68 -0
- package/src/server/codex-app-server-protocol.ts +453 -0
- package/src/server/codex-app-server.ts +1350 -0
- package/src/server/cursor-acp.ts +819 -0
- package/src/server/discovery.ts +322 -0
- package/src/server/event-store.ts +1369 -0
- package/src/server/events.ts +244 -0
- package/src/server/external-open.ts +272 -0
- package/src/server/gemini-acp.ts +844 -0
- package/src/server/gemini-cli.ts +525 -0
- package/src/server/generate-title.ts +36 -0
- package/src/server/git-manager.ts +79 -0
- package/src/server/git-repository.ts +101 -0
- package/src/server/harness-types.ts +20 -0
- package/src/server/keybindings.ts +177 -0
- package/src/server/machine-name.ts +22 -0
- package/src/server/paths.ts +112 -0
- package/src/server/process-utils.ts +22 -0
- package/src/server/project-icon.ts +344 -0
- package/src/server/project-metadata.ts +10 -0
- package/src/server/provider-catalog.ts +85 -0
- package/src/server/provider-settings.ts +155 -0
- package/src/server/quick-response.ts +153 -0
- package/src/server/read-models.ts +275 -0
- package/src/server/recovery.ts +507 -0
- package/src/server/restart.ts +30 -0
- package/src/server/server.ts +244 -0
- package/src/server/terminal-manager.ts +350 -0
- package/src/server/theme-settings.ts +179 -0
- package/src/server/update-manager.ts +230 -0
- package/src/server/usage/base-provider-usage.ts +57 -0
- package/src/server/usage/claude-usage.ts +558 -0
- package/src/server/usage/codex-usage.ts +144 -0
- package/src/server/usage/cursor-browser.ts +120 -0
- package/src/server/usage/cursor-cookies.ts +390 -0
- package/src/server/usage/cursor-usage.ts +490 -0
- package/src/server/usage/gemini-usage.ts +24 -0
- package/src/server/usage/provider-usage.ts +61 -0
- package/src/server/usage/test-helpers.ts +9 -0
- package/src/server/usage/types.ts +54 -0
- package/src/server/usage/utils.ts +325 -0
- package/src/server/ws-router.ts +717 -0
- package/src/shared/branding.ts +83 -0
- package/src/shared/dev-ports.ts +43 -0
- package/src/shared/ports.ts +2 -0
- package/src/shared/protocol.ts +152 -0
- package/src/shared/tools.ts +251 -0
- package/src/shared/types.ts +1028 -0
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
var pO=Object.defineProperty;var OC=e=>{throw TypeError(e)};var gO=(e,t,n)=>t in e?pO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Hn=(e,t,n)=>gO(e,typeof t!="symbol"?t+"":t,n),LC=(e,t,n)=>t.has(e)||OC("Cannot "+n);var bu=(e,t,n)=>(LC(e,t,"read from private field"),n?n.call(e):t.get(e)),zC=(e,t,n)=>t.has(e)?OC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),PC=(e,t,n,r)=>(LC(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function vO(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 o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{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 o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Ym(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xv={exports:{}},yu={};/**
|
|
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 BC;function _O(){if(BC)return yu;BC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,o){var l=null;if(o!==void 0&&(l=""+o),s.key!==void 0&&(l=""+s.key),"key"in s){o={};for(var u in s)u!=="key"&&(o[u]=s[u])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:l,ref:s!==void 0?s:null,props:o}}return yu.Fragment=t,yu.jsx=n,yu.jsxs=n,yu}var IC;function bO(){return IC||(IC=1,Xv.exports=_O()),Xv.exports}var f=bO(),Zv={exports:{}},lt={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var HC;function yO(){if(HC)return lt;HC=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"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),v=Symbol.iterator;function y(B){return B===null||typeof B!="object"?null:(B=v&&B[v]||B["@@iterator"],typeof B=="function"?B:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(B,X,A){this.props=B,this.context=X,this.refs=C,this.updater=A||w}k.prototype.isReactComponent={},k.prototype.setState=function(B,X){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,X,"setState")},k.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function R(){}R.prototype=k.prototype;function E(B,X,A){this.props=B,this.context=X,this.refs=C,this.updater=A||w}var M=E.prototype=new R;M.constructor=E,S(M,k.prototype),M.isPureReactComponent=!0;var j=Array.isArray;function D(){}var L={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function Y(B,X,A){var ne=A.ref;return{$$typeof:e,type:B,key:X,ref:ne!==void 0?ne:null,props:A}}function P(B,X){return Y(B.type,X,B.props)}function V(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function I(B){var X={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(A){return X[A]})}var W=/\/+/g;function K(B,X){return typeof B=="object"&&B!==null&&B.key!=null?I(""+B.key):X.toString(36)}function q(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(D,D):(B.status="pending",B.then(function(X){B.status==="pending"&&(B.status="fulfilled",B.value=X)},function(X){B.status==="pending"&&(B.status="rejected",B.reason=X)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function O(B,X,A,ne,ae){var Z=typeof B;(Z==="undefined"||Z==="boolean")&&(B=null);var te=!1;if(B===null)te=!0;else switch(Z){case"bigint":case"string":case"number":te=!0;break;case"object":switch(B.$$typeof){case e:case t:te=!0;break;case g:return te=B._init,O(te(B._payload),X,A,ne,ae)}}if(te)return ae=ae(B),te=ne===""?"."+K(B,0):ne,j(ae)?(A="",te!=null&&(A=te.replace(W,"$&/")+"/"),O(ae,X,A,"",function(xe){return xe})):ae!=null&&(V(ae)&&(ae=P(ae,A+(ae.key==null||B&&B.key===ae.key?"":(""+ae.key).replace(W,"$&/")+"/")+te)),X.push(ae)),1;te=0;var le=ne===""?".":ne+":";if(j(B))for(var me=0;me<B.length;me++)ne=B[me],Z=le+K(ne,me),te+=O(ne,X,A,Z,ae);else if(me=y(B),typeof me=="function")for(B=me.call(B),me=0;!(ne=B.next()).done;)ne=ne.value,Z=le+K(ne,me++),te+=O(ne,X,A,Z,ae);else if(Z==="object"){if(typeof B.then=="function")return O(q(B),X,A,ne,ae);throw X=String(B),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return te}function H(B,X,A){if(B==null)return B;var ne=[],ae=0;return O(B,ne,"","",function(Z){return X.call(A,Z,ae++)}),ne}function U(B){if(B._status===-1){var X=B._result;X=X(),X.then(function(A){(B._status===0||B._status===-1)&&(B._status=1,B._result=A)},function(A){(B._status===0||B._status===-1)&&(B._status=2,B._result=A)}),B._status===-1&&(B._status=0,B._result=X)}if(B._status===1)return B._result.default;throw B._result}var F=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},N={map:H,forEach:function(B,X,A){H(B,function(){X.apply(this,arguments)},A)},count:function(B){var X=0;return H(B,function(){X++}),X},toArray:function(B){return H(B,function(X){return X})||[]},only:function(B){if(!V(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return lt.Activity=p,lt.Children=N,lt.Component=k,lt.Fragment=n,lt.Profiler=s,lt.PureComponent=E,lt.StrictMode=r,lt.Suspense=h,lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,lt.__COMPILER_RUNTIME={__proto__:null,c:function(B){return L.H.useMemoCache(B)}},lt.cache=function(B){return function(){return B.apply(null,arguments)}},lt.cacheSignal=function(){return null},lt.cloneElement=function(B,X,A){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var ne=S({},B.props),ae=B.key;if(X!=null)for(Z in X.key!==void 0&&(ae=""+X.key),X)!$.call(X,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&X.ref===void 0||(ne[Z]=X[Z]);var Z=arguments.length-2;if(Z===1)ne.children=A;else if(1<Z){for(var te=Array(Z),le=0;le<Z;le++)te[le]=arguments[le+2];ne.children=te}return Y(B.type,ae,ne)},lt.createContext=function(B){return B={$$typeof:l,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:o,_context:B},B},lt.createElement=function(B,X,A){var ne,ae={},Z=null;if(X!=null)for(ne in X.key!==void 0&&(Z=""+X.key),X)$.call(X,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ae[ne]=X[ne]);var te=arguments.length-2;if(te===1)ae.children=A;else if(1<te){for(var le=Array(te),me=0;me<te;me++)le[me]=arguments[me+2];ae.children=le}if(B&&B.defaultProps)for(ne in te=B.defaultProps,te)ae[ne]===void 0&&(ae[ne]=te[ne]);return Y(B,Z,ae)},lt.createRef=function(){return{current:null}},lt.forwardRef=function(B){return{$$typeof:u,render:B}},lt.isValidElement=V,lt.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:U}},lt.memo=function(B,X){return{$$typeof:d,type:B,compare:X===void 0?null:X}},lt.startTransition=function(B){var X=L.T,A={};L.T=A;try{var ne=B(),ae=L.S;ae!==null&&ae(A,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(D,F)}catch(Z){F(Z)}finally{X!==null&&A.types!==null&&(X.types=A.types),L.T=X}},lt.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},lt.use=function(B){return L.H.use(B)},lt.useActionState=function(B,X,A){return L.H.useActionState(B,X,A)},lt.useCallback=function(B,X){return L.H.useCallback(B,X)},lt.useContext=function(B){return L.H.useContext(B)},lt.useDebugValue=function(){},lt.useDeferredValue=function(B,X){return L.H.useDeferredValue(B,X)},lt.useEffect=function(B,X){return L.H.useEffect(B,X)},lt.useEffectEvent=function(B){return L.H.useEffectEvent(B)},lt.useId=function(){return L.H.useId()},lt.useImperativeHandle=function(B,X,A){return L.H.useImperativeHandle(B,X,A)},lt.useInsertionEffect=function(B,X){return L.H.useInsertionEffect(B,X)},lt.useLayoutEffect=function(B,X){return L.H.useLayoutEffect(B,X)},lt.useMemo=function(B,X){return L.H.useMemo(B,X)},lt.useOptimistic=function(B,X){return L.H.useOptimistic(B,X)},lt.useReducer=function(B,X,A){return L.H.useReducer(B,X,A)},lt.useRef=function(B){return L.H.useRef(B)},lt.useState=function(B){return L.H.useState(B)},lt.useSyncExternalStore=function(B,X,A){return L.H.useSyncExternalStore(B,X,A)},lt.useTransition=function(){return L.H.useTransition()},lt.version="19.2.1",lt}var FC;function r0(){return FC||(FC=1,Zv.exports=yO()),Zv.exports}var _=r0();const ye=Ym(_),tT=vO({__proto__:null,default:ye},[_]);var Qv={exports:{}},xu={},Jv={exports:{}},e_={};/**
|
|
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 UC;function xO(){return UC||(UC=1,(function(e){function t(O,H){var U=O.length;O.push(H);e:for(;0<U;){var F=U-1>>>1,N=O[F];if(0<s(N,H))O[F]=H,O[U]=N,U=F;else break e}}function n(O){return O.length===0?null:O[0]}function r(O){if(O.length===0)return null;var H=O[0],U=O.pop();if(U!==H){O[0]=U;e:for(var F=0,N=O.length,B=N>>>1;F<B;){var X=2*(F+1)-1,A=O[X],ne=X+1,ae=O[ne];if(0>s(A,U))ne<N&&0>s(ae,A)?(O[F]=ae,O[ne]=U,F=ne):(O[F]=A,O[X]=U,F=X);else if(ne<N&&0>s(ae,U))O[F]=ae,O[ne]=U,F=ne;else break e}}return H}function s(O,H){var U=O.sortIndex-H.sortIndex;return U!==0?U:O.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],d=[],g=1,p=null,v=3,y=!1,w=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function M(O){for(var H=n(d);H!==null;){if(H.callback===null)r(d);else if(H.startTime<=O)r(d),H.sortIndex=H.expirationTime,t(h,H);else break;H=n(d)}}function j(O){if(S=!1,M(O),!w)if(n(h)!==null)w=!0,D||(D=!0,I());else{var H=n(d);H!==null&&q(j,H.startTime-O)}}var D=!1,L=-1,$=5,Y=-1;function P(){return C?!0:!(e.unstable_now()-Y<$)}function V(){if(C=!1,D){var O=e.unstable_now();Y=O;var H=!0;try{e:{w=!1,S&&(S=!1,R(L),L=-1),y=!0;var U=v;try{t:{for(M(O),p=n(h);p!==null&&!(p.expirationTime>O&&P());){var F=p.callback;if(typeof F=="function"){p.callback=null,v=p.priorityLevel;var N=F(p.expirationTime<=O);if(O=e.unstable_now(),typeof N=="function"){p.callback=N,M(O),H=!0;break t}p===n(h)&&r(h),M(O)}else r(h);p=n(h)}if(p!==null)H=!0;else{var B=n(d);B!==null&&q(j,B.startTime-O),H=!1}}break e}finally{p=null,v=U,y=!1}H=void 0}}finally{H?I():D=!1}}}var I;if(typeof E=="function")I=function(){E(V)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,K=W.port2;W.port1.onmessage=V,I=function(){K.postMessage(null)}}else I=function(){k(V,0)};function q(O,H){L=k(function(){O(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(O){O.callback=null},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(O){switch(v){case 1:case 2:case 3:var H=3;break;default:H=v}var U=v;v=H;try{return O()}finally{v=U}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(O,H){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var U=v;v=O;try{return H()}finally{v=U}},e.unstable_scheduleCallback=function(O,H,U){var F=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?F+U:F):U=F,O){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=U+N,O={id:g++,callback:H,priorityLevel:O,startTime:U,expirationTime:N,sortIndex:-1},U>F?(O.sortIndex=U,t(d,O),n(h)===null&&O===n(d)&&(S?(R(L),L=-1):S=!0,q(j,U-F))):(O.sortIndex=N,t(h,O),w||y||(w=!0,D||(D=!0,I()))),O},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(O){var H=v;return function(){var U=v;v=H;try{return O.apply(this,arguments)}finally{v=U}}}})(e_)),e_}var $C;function wO(){return $C||($C=1,Jv.exports=xO()),Jv.exports}var t_={exports:{}},mr={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var WC;function SO(){if(WC)return mr;WC=1;var e=r0();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(h,d,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:h,containerInfo:d,implementation:g}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return mr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,mr.createPortal=function(h,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return o(h,d,null,g)},mr.flushSync=function(h){var d=l.T,g=r.p;try{if(l.T=null,r.p=2,h)return h()}finally{l.T=d,r.p=g,r.d.f()}},mr.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(h,d))},mr.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},mr.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var g=d.as,p=u(g,d.crossOrigin),v=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;g==="style"?r.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:v,fetchPriority:y}):g==="script"&&r.d.X(h,{crossOrigin:p,integrity:v,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},mr.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=u(d.as,d.crossOrigin);r.d.M(h,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(h)},mr.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,p=u(g,d.crossOrigin);r.d.L(h,g,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},mr.preloadModule=function(h,d){if(typeof h=="string")if(d){var g=u(d.as,d.crossOrigin);r.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(h)},mr.requestFormReset=function(h){r.d.r(h)},mr.unstable_batchedUpdates=function(h,d){return h(d)},mr.useFormState=function(h,d,g){return l.H.useFormState(h,d,g)},mr.useFormStatus=function(){return l.H.useHostTransitionStatus()},mr.version="19.2.1",mr}var VC;function nT(){if(VC)return t_.exports;VC=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(),t_.exports=SO(),t_.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 qC;function CO(){if(qC)return xu;qC=1;var e=wO(),t=r0(),n=nT();function r(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+a+" 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 o(i){var a=i,c=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(c=a.return),i=a.return;while(i)}return a.tag===3?c:null}function l(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function u(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function h(i){if(o(i)!==i)throw Error(r(188))}function d(i){var a=i.alternate;if(!a){if(a=o(i),a===null)throw Error(r(188));return a!==i?null:i}for(var c=i,m=a;;){var b=c.return;if(b===null)break;var x=b.alternate;if(x===null){if(m=b.return,m!==null){c=m;continue}break}if(b.child===x.child){for(x=b.child;x;){if(x===c)return h(b),i;if(x===m)return h(b),a;x=x.sibling}throw Error(r(188))}if(c.return!==m.return)c=b,m=x;else{for(var T=!1,z=b.child;z;){if(z===c){T=!0,c=b,m=x;break}if(z===m){T=!0,m=b,c=x;break}z=z.sibling}if(!T){for(z=x.child;z;){if(z===c){T=!0,c=x,m=b;break}if(z===m){T=!0,m=x,c=b;break}z=z.sibling}if(!T)throw Error(r(189))}}if(c.alternate!==m)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?i:a}function g(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=g(i),a!==null)return a;i=i.sibling}return null}var p=Object.assign,v=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),E=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function I(i){return i===null||typeof i!="object"?null:(i=V&&i[V]||i["@@iterator"],typeof i=="function"?i:null)}var W=Symbol.for("react.client.reference");function K(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===W?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case j:return"Suspense";case D:return"SuspenseList";case Y:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case E:return i.displayName||"Context";case R:return(i._context.displayName||"Context")+".Consumer";case M:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case L:return a=i.displayName||null,a!==null?a:K(i.type)||"Memo";case $:a=i._payload,i=i._init;try{return K(i(a))}catch{}}return null}var q=Array.isArray,O=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},F=[],N=-1;function B(i){return{current:i}}function X(i){0>N||(i.current=F[N],F[N]=null,N--)}function A(i,a){N++,F[N]=i.current,i.current=a}var ne=B(null),ae=B(null),Z=B(null),te=B(null);function le(i,a){switch(A(Z,a),A(ae,i),A(ne,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?rC(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=rC(a),i=iC(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}X(ne),A(ne,i)}function me(){X(ne),X(ae),X(Z)}function xe(i){i.memoizedState!==null&&A(te,i);var a=ne.current,c=iC(a,i.type);a!==c&&(A(ae,i),A(ne,c))}function Ae(i){ae.current===i&&(X(ne),X(ae)),te.current===i&&(X(te),pu._currentValue=U)}var Re,je;function Ye(i){if(Re===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",je=-1<c.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Re+i+je}var xt=!1;function ft(i,a){if(!i||xt)return"";xt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(a){var ve=function(){throw Error()};if(Object.defineProperty(ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ve,[])}catch(de){var ue=de}Reflect.construct(i,[],ve)}else{try{ve.call()}catch(de){ue=de}i.call(ve.prototype)}}else{try{throw Error()}catch(de){ue=de}(ve=i())&&typeof ve.catch=="function"&&ve.catch(function(){})}}catch(de){if(de&&ue&&typeof de.stack=="string")return[de.stack,ue.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=m.DetermineComponentFrameRoot(),T=x[0],z=x[1];if(T&&z){var Q=T.split(`
|
|
44
|
+
`),oe=z.split(`
|
|
45
|
+
`);for(b=m=0;m<Q.length&&!Q[m].includes("DetermineComponentFrameRoot");)m++;for(;b<oe.length&&!oe[b].includes("DetermineComponentFrameRoot");)b++;if(m===Q.length||b===oe.length)for(m=Q.length-1,b=oe.length-1;1<=m&&0<=b&&Q[m]!==oe[b];)b--;for(;1<=m&&0<=b;m--,b--)if(Q[m]!==oe[b]){if(m!==1||b!==1)do if(m--,b--,0>b||Q[m]!==oe[b]){var fe=`
|
|
46
|
+
`+Q[m].replace(" at new "," at ");return i.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",i.displayName)),fe}while(1<=m&&0<=b);break}}}finally{xt=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?Ye(c):""}function he(i,a){switch(i.tag){case 26:case 27:case 5:return Ye(i.type);case 16:return Ye("Lazy");case 13:return i.child!==a&&a!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return ft(i.type,!1);case 11:return ft(i.type.render,!1);case 1:return ft(i.type,!0);case 31:return Ye("Activity");default:return""}}function Pe(i){try{var a="",c=null;do a+=he(i,c),c=i,i=i.return;while(i);return a}catch(m){return`
|
|
47
|
+
Error generating stack: `+m.message+`
|
|
48
|
+
`+m.stack}}var Ne=Object.prototype.hasOwnProperty,tt=e.unstable_scheduleCallback,wt=e.unstable_cancelCallback,$e=e.unstable_shouldYield,pt=e.unstable_requestPaint,Se=e.unstable_now,De=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,Ve=e.unstable_LowPriority,we=e.unstable_IdlePriority,He=e.log,ot=e.unstable_setDisableYieldValue,rt=null,Le=null;function St(i){if(typeof He=="function"&&ot(i),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode(rt,i)}catch{}}var at=Math.clz32?Math.clz32:Nn,vn=Math.log,tn=Math.LN2;function Nn(i){return i>>>=0,i===0?32:31-(vn(i)/tn|0)|0}var xr=256,Kn=262144,jt=4194304;function zt(i){var a=i&42;if(a!==0)return a;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 Fe(i,a,c){var m=i.pendingLanes;if(m===0)return 0;var b=0,x=i.suspendedLanes,T=i.pingedLanes;i=i.warmLanes;var z=m&134217727;return z!==0?(m=z&~x,m!==0?b=zt(m):(T&=z,T!==0?b=zt(T):c||(c=z&~i,c!==0&&(b=zt(c))))):(z=m&~x,z!==0?b=zt(z):T!==0?b=zt(T):c||(c=m&~i,c!==0&&(b=zt(c)))),b===0?0:a!==0&&a!==b&&(a&x)===0&&(x=b&-b,c=a&-a,x>=c||x===32&&(c&4194048)!==0)?a:b}function ct(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function st(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function mt(){var i=jt;return jt<<=1,(jt&62914560)===0&&(jt=4194304),i}function an(i){for(var a=[],c=0;31>c;c++)a.push(i);return a}function Ce(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Te(i,a,c,m,b,x){var T=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var z=i.entanglements,Q=i.expirationTimes,oe=i.hiddenUpdates;for(c=T&~c;0<c;){var fe=31-at(c),ve=1<<fe;z[fe]=0,Q[fe]=-1;var ue=oe[fe];if(ue!==null)for(oe[fe]=null,fe=0;fe<ue.length;fe++){var de=ue[fe];de!==null&&(de.lane&=-536870913)}c&=~ve}m!==0&>(i,m,0),x!==0&&b===0&&i.tag!==0&&(i.suspendedLanes|=x&~(T&~a))}function gt(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var m=31-at(a);i.entangledLanes|=a,i.entanglements[m]=i.entanglements[m]|1073741824|c&261930}function Qe(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var m=31-at(c),b=1<<m;b&a|i[m]&a&&(i[m]|=a),c&=~b}}function vt(i,a){var c=a&-a;return c=(c&42)!==0?1:qt(c),(c&(i.suspendedLanes|a))!==0?0:c}function qt(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Ot(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function sn(){var i=H.p;return i!==0?i:(i=window.event,i===void 0?32:RC(i.type))}function G(i,a){var c=H.p;try{return H.p=i,a()}finally{H.p=c}}var Xe=Math.random().toString(36).slice(2),It="__reactFiber$"+Xe,Cn="__reactProps$"+Xe,li="__reactContainer$"+Xe,$t="__reactEvents$"+Xe,ir="__reactListeners$"+Xe,Nc="__reactHandles$"+Xe,Yd="__reactResources$"+Xe,sa="__reactMarker$"+Xe;function Ac(i){delete i[It],delete i[Cn],delete i[$t],delete i[ir],delete i[Nc]}function co(i){var a=i[It];if(a)return a;for(var c=i.parentNode;c;){if(a=c[li]||c[It]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=dC(i);i!==null;){if(c=i[It])return c;i=dC(i)}return a}i=c,c=i.parentNode}return null}function uo(i){if(i=i[It]||i[li]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function oa(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(r(33))}function Yi(i){var a=i[Yd];return a||(a=i[Yd]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function An(i){i[sa]=!0}var Xd=new Set,Zd={};function Xi(i,a){ws(i,a),ws(i+"Capture",a)}function ws(i,a){for(Zd[i]=a,i=0;i<a.length;i++)Xd.add(a[i])}var Qd=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),J={},ie={};function Ee(i){return Ne.call(ie,i)?!0:Ne.call(J,i)?!1:Qd.test(i)?ie[i]=!0:(J[i]=!0,!1)}function Ue(i,a,c){if(Ee(a))if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var m=a.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+c)}}function Mt(i,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+c)}}function Wt(i,a,c,m){if(m===null)i.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(a,c,""+m)}}function Vt(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Dr(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Jd(i,a,c){var m=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var b=m.get,x=m.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return b.call(this)},set:function(T){c=""+T,x.call(this,T)}}),Object.defineProperty(i,a,{enumerable:m.enumerable}),{getValue:function(){return c},setValue:function(T){c=""+T},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function sl(i){if(!i._valueTracker){var a=Dr(i)?"checked":"value";i._valueTracker=Jd(i,a,""+i[a])}}function Xx(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),m="";return i&&(m=Dr(i)?i.checked?"true":"false":i.value),i=m,i!==c?(a.setValue(i),!0):!1}function eh(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 c3=/[\n"\\]/g;function ci(i){return i.replace(c3,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Wp(i,a,c,m,b,x,T,z){i.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?i.type=T:i.removeAttribute("type"),a!=null?T==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+Vt(a)):i.value!==""+Vt(a)&&(i.value=""+Vt(a)):T!=="submit"&&T!=="reset"||i.removeAttribute("value"),a!=null?Vp(i,T,Vt(a)):c!=null?Vp(i,T,Vt(c)):m!=null&&i.removeAttribute("value"),b==null&&x!=null&&(i.defaultChecked=!!x),b!=null&&(i.checked=b&&typeof b!="function"&&typeof b!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?i.name=""+Vt(z):i.removeAttribute("name")}function Zx(i,a,c,m,b,x,T,z){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(i.type=x),a!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){sl(i);return}c=c!=null?""+Vt(c):"",a=a!=null?""+Vt(a):c,z||a===i.value||(i.value=a),i.defaultValue=a}m=m??b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,i.checked=z?i.checked:!!m,i.defaultChecked=!!m,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(i.name=T),sl(i)}function Vp(i,a,c){a==="number"&&eh(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function ol(i,a,c,m){if(i=i.options,a){a={};for(var b=0;b<c.length;b++)a["$"+c[b]]=!0;for(c=0;c<i.length;c++)b=a.hasOwnProperty("$"+i[c].value),i[c].selected!==b&&(i[c].selected=b),b&&m&&(i[c].defaultSelected=!0)}else{for(c=""+Vt(c),a=null,b=0;b<i.length;b++){if(i[b].value===c){i[b].selected=!0,m&&(i[b].defaultSelected=!0);return}a!==null||i[b].disabled||(a=i[b])}a!==null&&(a.selected=!0)}}function Qx(i,a,c){if(a!=null&&(a=""+Vt(a),a!==i.value&&(i.value=a),c==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=c!=null?""+Vt(c):""}function Jx(i,a,c,m){if(a==null){if(m!=null){if(c!=null)throw Error(r(92));if(q(m)){if(1<m.length)throw Error(r(93));m=m[0]}c=m}c==null&&(c=""),a=c}c=Vt(a),i.defaultValue=c,m=i.textContent,m===c&&m!==""&&m!==null&&(i.value=m),sl(i)}function al(i,a){if(a){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=a;return}}i.textContent=a}var u3=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 e1(i,a,c){var m=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?m?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":m?i.setProperty(a,c):typeof c!="number"||c===0||u3.has(a)?a==="float"?i.cssFloat=c:i[a]=(""+c).trim():i[a]=c+"px"}function t1(i,a,c){if(a!=null&&typeof a!="object")throw Error(r(62));if(i=i.style,c!=null){for(var m in c)!c.hasOwnProperty(m)||a!=null&&a.hasOwnProperty(m)||(m.indexOf("--")===0?i.setProperty(m,""):m==="float"?i.cssFloat="":i[m]="");for(var b in a)m=a[b],a.hasOwnProperty(b)&&c[b]!==m&&e1(i,b,m)}else for(var x in a)a.hasOwnProperty(x)&&e1(i,x,a[x])}function qp(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 d3=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"]]),h3=/^[\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 th(i){return h3.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ss(){}var Kp=null;function Gp(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ll=null,cl=null;function n1(i){var a=uo(i);if(a&&(i=a.stateNode)){var c=i[Cn]||null;e:switch(i=a.stateNode,a.type){case"input":if(Wp(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+ci(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var m=c[a];if(m!==i&&m.form===i.form){var b=m[Cn]||null;if(!b)throw Error(r(90));Wp(m,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(a=0;a<c.length;a++)m=c[a],m.form===i.form&&Xx(m)}break e;case"textarea":Qx(i,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&ol(i,!!c.multiple,a,!1)}}}var Yp=!1;function r1(i,a,c){if(Yp)return i(a,c);Yp=!0;try{var m=i(a);return m}finally{if(Yp=!1,(ll!==null||cl!==null)&&(Uh(),ll&&(a=ll,i=cl,cl=ll=null,n1(a),i)))for(a=0;a<i.length;a++)n1(i[a])}}function Dc(i,a){var c=i.stateNode;if(c===null)return null;var m=c[Cn]||null;if(m===null)return null;c=m[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(i=i.type,m=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!m;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(r(231,a,typeof c));return c}var Cs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xp=!1;if(Cs)try{var jc={};Object.defineProperty(jc,"passive",{get:function(){Xp=!0}}),window.addEventListener("test",jc,jc),window.removeEventListener("test",jc,jc)}catch{Xp=!1}var ho=null,Zp=null,nh=null;function i1(){if(nh)return nh;var i,a=Zp,c=a.length,m,b="value"in ho?ho.value:ho.textContent,x=b.length;for(i=0;i<c&&a[i]===b[i];i++);var T=c-i;for(m=1;m<=T&&a[c-m]===b[x-m];m++);return nh=b.slice(i,1<m?1-m:void 0)}function rh(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function ih(){return!0}function s1(){return!1}function jr(i){function a(c,m,b,x,T){this._reactName=c,this._targetInst=b,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var z in i)i.hasOwnProperty(z)&&(c=i[z],this[z]=c?c(x):x[z]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?ih:s1,this.isPropagationStopped=s1,this}return p(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=ih)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=ih)},persist:function(){},isPersistent:ih}),a}var aa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sh=jr(aa),Oc=p({},aa,{view:0,detail:0}),f3=jr(Oc),Qp,Jp,Lc,oh=p({},Oc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tg,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!==Lc&&(Lc&&i.type==="mousemove"?(Qp=i.screenX-Lc.screenX,Jp=i.screenY-Lc.screenY):Jp=Qp=0,Lc=i),Qp)},movementY:function(i){return"movementY"in i?i.movementY:Jp}}),o1=jr(oh),m3=p({},oh,{dataTransfer:0}),p3=jr(m3),g3=p({},Oc,{relatedTarget:0}),eg=jr(g3),v3=p({},aa,{animationName:0,elapsedTime:0,pseudoElement:0}),_3=jr(v3),b3=p({},aa,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),y3=jr(b3),x3=p({},aa,{data:0}),a1=jr(x3),w3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},S3={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"},C3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function k3(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=C3[i])?!!a[i]:!1}function tg(){return k3}var E3=p({},Oc,{key:function(i){if(i.key){var a=w3[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=rh(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?S3[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:tg,charCode:function(i){return i.type==="keypress"?rh(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?rh(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),R3=jr(E3),T3=p({},oh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),l1=jr(T3),M3=p({},Oc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tg}),N3=jr(M3),A3=p({},aa,{propertyName:0,elapsedTime:0,pseudoElement:0}),D3=jr(A3),j3=p({},oh,{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}),O3=jr(j3),L3=p({},aa,{newState:0,oldState:0}),z3=jr(L3),P3=[9,13,27,32],ng=Cs&&"CompositionEvent"in window,zc=null;Cs&&"documentMode"in document&&(zc=document.documentMode);var B3=Cs&&"TextEvent"in window&&!zc,c1=Cs&&(!ng||zc&&8<zc&&11>=zc),u1=" ",d1=!1;function h1(i,a){switch(i){case"keyup":return P3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function f1(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ul=!1;function I3(i,a){switch(i){case"compositionend":return f1(a);case"keypress":return a.which!==32?null:(d1=!0,u1);case"textInput":return i=a.data,i===u1&&d1?null:i;default:return null}}function H3(i,a){if(ul)return i==="compositionend"||!ng&&h1(i,a)?(i=i1(),nh=Zp=ho=null,ul=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return c1&&a.locale!=="ko"?null:a.data;default:return null}}var F3={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 m1(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!F3[i.type]:a==="textarea"}function p1(i,a,c,m){ll?cl?cl.push(m):cl=[m]:ll=m,a=Yh(a,"onChange"),0<a.length&&(c=new sh("onChange","change",null,c,m),i.push({event:c,listeners:a}))}var Pc=null,Bc=null;function U3(i){ZS(i,0)}function ah(i){var a=oa(i);if(Xx(a))return i}function g1(i,a){if(i==="change")return a}var v1=!1;if(Cs){var rg;if(Cs){var ig="oninput"in document;if(!ig){var _1=document.createElement("div");_1.setAttribute("oninput","return;"),ig=typeof _1.oninput=="function"}rg=ig}else rg=!1;v1=rg&&(!document.documentMode||9<document.documentMode)}function b1(){Pc&&(Pc.detachEvent("onpropertychange",y1),Bc=Pc=null)}function y1(i){if(i.propertyName==="value"&&ah(Bc)){var a=[];p1(a,Bc,i,Gp(i)),r1(U3,a)}}function $3(i,a,c){i==="focusin"?(b1(),Pc=a,Bc=c,Pc.attachEvent("onpropertychange",y1)):i==="focusout"&&b1()}function W3(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return ah(Bc)}function V3(i,a){if(i==="click")return ah(a)}function q3(i,a){if(i==="input"||i==="change")return ah(a)}function K3(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var qr=typeof Object.is=="function"?Object.is:K3;function Ic(i,a){if(qr(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var c=Object.keys(i),m=Object.keys(a);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var b=c[m];if(!Ne.call(a,b)||!qr(i[b],a[b]))return!1}return!0}function x1(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function w1(i,a){var c=x1(i);i=0;for(var m;c;){if(c.nodeType===3){if(m=i+c.textContent.length,i<=a&&m>=a)return{node:c,offset:a-i};i=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=x1(c)}}function S1(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?S1(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function C1(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=eh(i.document);a instanceof i.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)i=a.contentWindow;else break;a=eh(i.document)}return a}function sg(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var G3=Cs&&"documentMode"in document&&11>=document.documentMode,dl=null,og=null,Hc=null,ag=!1;function k1(i,a,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;ag||dl==null||dl!==eh(m)||(m=dl,"selectionStart"in m&&sg(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Hc&&Ic(Hc,m)||(Hc=m,m=Yh(og,"onSelect"),0<m.length&&(a=new sh("onSelect","select",null,a,c),i.push({event:a,listeners:m}),a.target=dl)))}function la(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var hl={animationend:la("Animation","AnimationEnd"),animationiteration:la("Animation","AnimationIteration"),animationstart:la("Animation","AnimationStart"),transitionrun:la("Transition","TransitionRun"),transitionstart:la("Transition","TransitionStart"),transitioncancel:la("Transition","TransitionCancel"),transitionend:la("Transition","TransitionEnd")},lg={},E1={};Cs&&(E1=document.createElement("div").style,"AnimationEvent"in window||(delete hl.animationend.animation,delete hl.animationiteration.animation,delete hl.animationstart.animation),"TransitionEvent"in window||delete hl.transitionend.transition);function ca(i){if(lg[i])return lg[i];if(!hl[i])return i;var a=hl[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in E1)return lg[i]=a[c];return i}var R1=ca("animationend"),T1=ca("animationiteration"),M1=ca("animationstart"),Y3=ca("transitionrun"),X3=ca("transitionstart"),Z3=ca("transitioncancel"),N1=ca("transitionend"),A1=new Map,cg="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(" ");cg.push("scrollEnd");function Di(i,a){A1.set(i,a),Xi(a,[i])}var lh=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=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(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},ui=[],fl=0,ug=0;function ch(){for(var i=fl,a=ug=fl=0;a<i;){var c=ui[a];ui[a++]=null;var m=ui[a];ui[a++]=null;var b=ui[a];ui[a++]=null;var x=ui[a];if(ui[a++]=null,m!==null&&b!==null){var T=m.pending;T===null?b.next=b:(b.next=T.next,T.next=b),m.pending=b}x!==0&&D1(c,b,x)}}function uh(i,a,c,m){ui[fl++]=i,ui[fl++]=a,ui[fl++]=c,ui[fl++]=m,ug|=m,i.lanes|=m,i=i.alternate,i!==null&&(i.lanes|=m)}function dg(i,a,c,m){return uh(i,a,c,m),dh(i)}function ua(i,a){return uh(i,null,null,a),dh(i)}function D1(i,a,c){i.lanes|=c;var m=i.alternate;m!==null&&(m.lanes|=c);for(var b=!1,x=i.return;x!==null;)x.childLanes|=c,m=x.alternate,m!==null&&(m.childLanes|=c),x.tag===22&&(i=x.stateNode,i===null||i._visibility&1||(b=!0)),i=x,x=x.return;return i.tag===3?(x=i.stateNode,b&&a!==null&&(b=31-at(c),i=x.hiddenUpdates,m=i[b],m===null?i[b]=[a]:m.push(a),a.lane=c|536870912),x):null}function dh(i){if(50<lu)throw lu=0,yv=null,Error(r(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var ml={};function Q3(i,a,c,m){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kr(i,a,c,m){return new Q3(i,a,c,m)}function hg(i){return i=i.prototype,!(!i||!i.isReactComponent)}function ks(i,a){var c=i.alternate;return c===null?(c=Kr(i.tag,a,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=a,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,a=i.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function j1(i,a){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=a,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,a=c.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function hh(i,a,c,m,b,x){var T=0;if(m=i,typeof i=="function")hg(i)&&(T=1);else if(typeof i=="string")T=rO(i,c,ne.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case Y:return i=Kr(31,c,a,b),i.elementType=Y,i.lanes=x,i;case S:return da(c.children,b,x,a);case C:T=8,b|=24;break;case k:return i=Kr(12,c,a,b|2),i.elementType=k,i.lanes=x,i;case j:return i=Kr(13,c,a,b),i.elementType=j,i.lanes=x,i;case D:return i=Kr(19,c,a,b),i.elementType=D,i.lanes=x,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case E:T=10;break e;case R:T=9;break e;case M:T=11;break e;case L:T=14;break e;case $:T=16,m=null;break e}T=29,c=Error(r(130,i===null?"null":typeof i,"")),m=null}return a=Kr(T,c,a,b),a.elementType=i,a.type=m,a.lanes=x,a}function da(i,a,c,m){return i=Kr(7,i,m,a),i.lanes=c,i}function fg(i,a,c){return i=Kr(6,i,null,a),i.lanes=c,i}function O1(i){var a=Kr(18,null,null,0);return a.stateNode=i,a}function mg(i,a,c){return a=Kr(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var L1=new WeakMap;function di(i,a){if(typeof i=="object"&&i!==null){var c=L1.get(i);return c!==void 0?c:(a={value:i,source:a,stack:Pe(a)},L1.set(i,a),a)}return{value:i,source:a,stack:Pe(a)}}var pl=[],gl=0,fh=null,Fc=0,hi=[],fi=0,fo=null,Zi=1,Qi="";function Es(i,a){pl[gl++]=Fc,pl[gl++]=fh,fh=i,Fc=a}function z1(i,a,c){hi[fi++]=Zi,hi[fi++]=Qi,hi[fi++]=fo,fo=i;var m=Zi;i=Qi;var b=32-at(m)-1;m&=~(1<<b),c+=1;var x=32-at(a)+b;if(30<x){var T=b-b%5;x=(m&(1<<T)-1).toString(32),m>>=T,b-=T,Zi=1<<32-at(a)+b|c<<b|m,Qi=x+i}else Zi=1<<x|c<<b|m,Qi=i}function pg(i){i.return!==null&&(Es(i,1),z1(i,1,0))}function gg(i){for(;i===fh;)fh=pl[--gl],pl[gl]=null,Fc=pl[--gl],pl[gl]=null;for(;i===fo;)fo=hi[--fi],hi[fi]=null,Qi=hi[--fi],hi[fi]=null,Zi=hi[--fi],hi[fi]=null}function P1(i,a){hi[fi++]=Zi,hi[fi++]=Qi,hi[fi++]=fo,Zi=a.id,Qi=a.overflow,fo=i}var sr=null,ln=null,Dt=!1,mo=null,mi=!1,vg=Error(r(519));function po(i){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Uc(di(a,i)),vg}function B1(i){var a=i.stateNode,c=i.type,m=i.memoizedProps;switch(a[It]=i,a[Cn]=m,c){case"dialog":kt("cancel",a),kt("close",a);break;case"iframe":case"object":case"embed":kt("load",a);break;case"video":case"audio":for(c=0;c<uu.length;c++)kt(uu[c],a);break;case"source":kt("error",a);break;case"img":case"image":case"link":kt("error",a),kt("load",a);break;case"details":kt("toggle",a);break;case"input":kt("invalid",a),Zx(a,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":kt("invalid",a);break;case"textarea":kt("invalid",a),Jx(a,m.value,m.defaultValue,m.children)}c=m.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||m.suppressHydrationWarning===!0||tC(a.textContent,c)?(m.popover!=null&&(kt("beforetoggle",a),kt("toggle",a)),m.onScroll!=null&&kt("scroll",a),m.onScrollEnd!=null&&kt("scrollend",a),m.onClick!=null&&(a.onclick=Ss),a=!0):a=!1,a||po(i,!0)}function I1(i){for(sr=i.return;sr;)switch(sr.tag){case 5:case 31:case 13:mi=!1;return;case 27:case 3:mi=!0;return;default:sr=sr.return}}function vl(i){if(i!==sr)return!1;if(!Dt)return I1(i),Dt=!0,!1;var a=i.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||Lv(i.type,i.memoizedProps)),c=!c),c&&ln&&po(i),I1(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));ln=uC(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));ln=uC(i)}else a===27?(a=ln,Mo(i.type)?(i=Hv,Hv=null,ln=i):ln=a):ln=sr?gi(i.stateNode.nextSibling):null;return!0}function ha(){ln=sr=null,Dt=!1}function _g(){var i=mo;return i!==null&&(Pr===null?Pr=i:Pr.push.apply(Pr,i),mo=null),i}function Uc(i){mo===null?mo=[i]:mo.push(i)}var bg=B(null),fa=null,Rs=null;function go(i,a,c){A(bg,a._currentValue),a._currentValue=c}function Ts(i){i._currentValue=bg.current,X(bg)}function yg(i,a,c){for(;i!==null;){var m=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),i===c)break;i=i.return}}function xg(i,a,c,m){var b=i.child;for(b!==null&&(b.return=i);b!==null;){var x=b.dependencies;if(x!==null){var T=b.child;x=x.firstContext;e:for(;x!==null;){var z=x;x=b;for(var Q=0;Q<a.length;Q++)if(z.context===a[Q]){x.lanes|=c,z=x.alternate,z!==null&&(z.lanes|=c),yg(x.return,c,i),m||(T=null);break e}x=z.next}}else if(b.tag===18){if(T=b.return,T===null)throw Error(r(341));T.lanes|=c,x=T.alternate,x!==null&&(x.lanes|=c),yg(T,c,i),T=null}else T=b.child;if(T!==null)T.return=b;else for(T=b;T!==null;){if(T===i){T=null;break}if(b=T.sibling,b!==null){b.return=T.return,T=b;break}T=T.return}b=T}}function _l(i,a,c,m){i=null;for(var b=a,x=!1;b!==null;){if(!x){if((b.flags&524288)!==0)x=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var T=b.alternate;if(T===null)throw Error(r(387));if(T=T.memoizedProps,T!==null){var z=b.type;qr(b.pendingProps.value,T.value)||(i!==null?i.push(z):i=[z])}}else if(b===te.current){if(T=b.alternate,T===null)throw Error(r(387));T.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(i!==null?i.push(pu):i=[pu])}b=b.return}i!==null&&xg(a,i,c,m),a.flags|=262144}function mh(i){for(i=i.firstContext;i!==null;){if(!qr(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function ma(i){fa=i,Rs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function or(i){return H1(fa,i)}function ph(i,a){return fa===null&&ma(i),H1(i,a)}function H1(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},Rs===null){if(i===null)throw Error(r(308));Rs=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else Rs=Rs.next=a;return c}var J3=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(c,m){i.push(m)}};this.abort=function(){a.aborted=!0,i.forEach(function(c){return c()})}},e4=e.unstable_scheduleCallback,t4=e.unstable_NormalPriority,Dn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wg(){return{controller:new J3,data:new Map,refCount:0}}function $c(i){i.refCount--,i.refCount===0&&e4(t4,function(){i.controller.abort()})}var Wc=null,Sg=0,bl=0,yl=null;function n4(i,a){if(Wc===null){var c=Wc=[];Sg=0,bl=Ev(),yl={status:"pending",value:void 0,then:function(m){c.push(m)}}}return Sg++,a.then(F1,F1),a}function F1(){if(--Sg===0&&Wc!==null){yl!==null&&(yl.status="fulfilled");var i=Wc;Wc=null,bl=0,yl=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function r4(i,a){var c=[],m={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return i.then(function(){m.status="fulfilled",m.value=a;for(var b=0;b<c.length;b++)(0,c[b])(a)},function(b){for(m.status="rejected",m.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),m}var U1=O.S;O.S=function(i,a){kS=Se(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&n4(i,a),U1!==null&&U1(i,a)};var pa=B(null);function Cg(){var i=pa.current;return i!==null?i:nn.pooledCache}function gh(i,a){a===null?A(pa,pa.current):A(pa,a.pool)}function $1(){var i=Cg();return i===null?null:{parent:Dn._currentValue,pool:i}}var xl=Error(r(460)),kg=Error(r(474)),vh=Error(r(542)),_h={then:function(){}};function W1(i){return i=i.status,i==="fulfilled"||i==="rejected"}function V1(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(Ss,Ss),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,K1(i),i;default:if(typeof a.status=="string")a.then(Ss,Ss);else{if(i=nn,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=a,i.status="pending",i.then(function(m){if(a.status==="pending"){var b=a;b.status="fulfilled",b.value=m}},function(m){if(a.status==="pending"){var b=a;b.status="rejected",b.reason=m}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,K1(i),i}throw va=a,xl}}function ga(i){try{var a=i._init;return a(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(va=c,xl):c}}var va=null;function q1(){if(va===null)throw Error(r(459));var i=va;return va=null,i}function K1(i){if(i===xl||i===vh)throw Error(r(483))}var wl=null,Vc=0;function bh(i){var a=Vc;return Vc+=1,wl===null&&(wl=[]),V1(wl,i,a)}function qc(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function yh(i,a){throw a.$$typeof===v?Error(r(525)):(i=Object.prototype.toString.call(a),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function G1(i){function a(re,ee){if(i){var se=re.deletions;se===null?(re.deletions=[ee],re.flags|=16):se.push(ee)}}function c(re,ee){if(!i)return null;for(;ee!==null;)a(re,ee),ee=ee.sibling;return null}function m(re){for(var ee=new Map;re!==null;)re.key!==null?ee.set(re.key,re):ee.set(re.index,re),re=re.sibling;return ee}function b(re,ee){return re=ks(re,ee),re.index=0,re.sibling=null,re}function x(re,ee,se){return re.index=se,i?(se=re.alternate,se!==null?(se=se.index,se<ee?(re.flags|=67108866,ee):se):(re.flags|=67108866,ee)):(re.flags|=1048576,ee)}function T(re){return i&&re.alternate===null&&(re.flags|=67108866),re}function z(re,ee,se,ge){return ee===null||ee.tag!==6?(ee=fg(se,re.mode,ge),ee.return=re,ee):(ee=b(ee,se),ee.return=re,ee)}function Q(re,ee,se,ge){var Ze=se.type;return Ze===S?fe(re,ee,se.props.children,ge,se.key):ee!==null&&(ee.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===$&&ga(Ze)===ee.type)?(ee=b(ee,se.props),qc(ee,se),ee.return=re,ee):(ee=hh(se.type,se.key,se.props,null,re.mode,ge),qc(ee,se),ee.return=re,ee)}function oe(re,ee,se,ge){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==se.containerInfo||ee.stateNode.implementation!==se.implementation?(ee=mg(se,re.mode,ge),ee.return=re,ee):(ee=b(ee,se.children||[]),ee.return=re,ee)}function fe(re,ee,se,ge,Ze){return ee===null||ee.tag!==7?(ee=da(se,re.mode,ge,Ze),ee.return=re,ee):(ee=b(ee,se),ee.return=re,ee)}function ve(re,ee,se){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=fg(""+ee,re.mode,se),ee.return=re,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return se=hh(ee.type,ee.key,ee.props,null,re.mode,se),qc(se,ee),se.return=re,se;case w:return ee=mg(ee,re.mode,se),ee.return=re,ee;case $:return ee=ga(ee),ve(re,ee,se)}if(q(ee)||I(ee))return ee=da(ee,re.mode,se,null),ee.return=re,ee;if(typeof ee.then=="function")return ve(re,bh(ee),se);if(ee.$$typeof===E)return ve(re,ph(re,ee),se);yh(re,ee)}return null}function ue(re,ee,se,ge){var Ze=ee!==null?ee.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return Ze!==null?null:z(re,ee,""+se,ge);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case y:return se.key===Ze?Q(re,ee,se,ge):null;case w:return se.key===Ze?oe(re,ee,se,ge):null;case $:return se=ga(se),ue(re,ee,se,ge)}if(q(se)||I(se))return Ze!==null?null:fe(re,ee,se,ge,null);if(typeof se.then=="function")return ue(re,ee,bh(se),ge);if(se.$$typeof===E)return ue(re,ee,ph(re,se),ge);yh(re,se)}return null}function de(re,ee,se,ge,Ze){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return re=re.get(se)||null,z(ee,re,""+ge,Ze);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case y:return re=re.get(ge.key===null?se:ge.key)||null,Q(ee,re,ge,Ze);case w:return re=re.get(ge.key===null?se:ge.key)||null,oe(ee,re,ge,Ze);case $:return ge=ga(ge),de(re,ee,se,ge,Ze)}if(q(ge)||I(ge))return re=re.get(se)||null,fe(ee,re,ge,Ze,null);if(typeof ge.then=="function")return de(re,ee,se,bh(ge),Ze);if(ge.$$typeof===E)return de(re,ee,se,ph(ee,ge),Ze);yh(ee,ge)}return null}function We(re,ee,se,ge){for(var Ze=null,Pt=null,Ge=ee,dt=ee=0,At=null;Ge!==null&&dt<se.length;dt++){Ge.index>dt?(At=Ge,Ge=null):At=Ge.sibling;var Bt=ue(re,Ge,se[dt],ge);if(Bt===null){Ge===null&&(Ge=At);break}i&&Ge&&Bt.alternate===null&&a(re,Ge),ee=x(Bt,ee,dt),Pt===null?Ze=Bt:Pt.sibling=Bt,Pt=Bt,Ge=At}if(dt===se.length)return c(re,Ge),Dt&&Es(re,dt),Ze;if(Ge===null){for(;dt<se.length;dt++)Ge=ve(re,se[dt],ge),Ge!==null&&(ee=x(Ge,ee,dt),Pt===null?Ze=Ge:Pt.sibling=Ge,Pt=Ge);return Dt&&Es(re,dt),Ze}for(Ge=m(Ge);dt<se.length;dt++)At=de(Ge,re,dt,se[dt],ge),At!==null&&(i&&At.alternate!==null&&Ge.delete(At.key===null?dt:At.key),ee=x(At,ee,dt),Pt===null?Ze=At:Pt.sibling=At,Pt=At);return i&&Ge.forEach(function(Oo){return a(re,Oo)}),Dt&&Es(re,dt),Ze}function nt(re,ee,se,ge){if(se==null)throw Error(r(151));for(var Ze=null,Pt=null,Ge=ee,dt=ee=0,At=null,Bt=se.next();Ge!==null&&!Bt.done;dt++,Bt=se.next()){Ge.index>dt?(At=Ge,Ge=null):At=Ge.sibling;var Oo=ue(re,Ge,Bt.value,ge);if(Oo===null){Ge===null&&(Ge=At);break}i&&Ge&&Oo.alternate===null&&a(re,Ge),ee=x(Oo,ee,dt),Pt===null?Ze=Oo:Pt.sibling=Oo,Pt=Oo,Ge=At}if(Bt.done)return c(re,Ge),Dt&&Es(re,dt),Ze;if(Ge===null){for(;!Bt.done;dt++,Bt=se.next())Bt=ve(re,Bt.value,ge),Bt!==null&&(ee=x(Bt,ee,dt),Pt===null?Ze=Bt:Pt.sibling=Bt,Pt=Bt);return Dt&&Es(re,dt),Ze}for(Ge=m(Ge);!Bt.done;dt++,Bt=se.next())Bt=de(Ge,re,dt,Bt.value,ge),Bt!==null&&(i&&Bt.alternate!==null&&Ge.delete(Bt.key===null?dt:Bt.key),ee=x(Bt,ee,dt),Pt===null?Ze=Bt:Pt.sibling=Bt,Pt=Bt);return i&&Ge.forEach(function(mO){return a(re,mO)}),Dt&&Es(re,dt),Ze}function Zt(re,ee,se,ge){if(typeof se=="object"&&se!==null&&se.type===S&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case y:e:{for(var Ze=se.key;ee!==null;){if(ee.key===Ze){if(Ze=se.type,Ze===S){if(ee.tag===7){c(re,ee.sibling),ge=b(ee,se.props.children),ge.return=re,re=ge;break e}}else if(ee.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===$&&ga(Ze)===ee.type){c(re,ee.sibling),ge=b(ee,se.props),qc(ge,se),ge.return=re,re=ge;break e}c(re,ee);break}else a(re,ee);ee=ee.sibling}se.type===S?(ge=da(se.props.children,re.mode,ge,se.key),ge.return=re,re=ge):(ge=hh(se.type,se.key,se.props,null,re.mode,ge),qc(ge,se),ge.return=re,re=ge)}return T(re);case w:e:{for(Ze=se.key;ee!==null;){if(ee.key===Ze)if(ee.tag===4&&ee.stateNode.containerInfo===se.containerInfo&&ee.stateNode.implementation===se.implementation){c(re,ee.sibling),ge=b(ee,se.children||[]),ge.return=re,re=ge;break e}else{c(re,ee);break}else a(re,ee);ee=ee.sibling}ge=mg(se,re.mode,ge),ge.return=re,re=ge}return T(re);case $:return se=ga(se),Zt(re,ee,se,ge)}if(q(se))return We(re,ee,se,ge);if(I(se)){if(Ze=I(se),typeof Ze!="function")throw Error(r(150));return se=Ze.call(se),nt(re,ee,se,ge)}if(typeof se.then=="function")return Zt(re,ee,bh(se),ge);if(se.$$typeof===E)return Zt(re,ee,ph(re,se),ge);yh(re,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,ee!==null&&ee.tag===6?(c(re,ee.sibling),ge=b(ee,se),ge.return=re,re=ge):(c(re,ee),ge=fg(se,re.mode,ge),ge.return=re,re=ge),T(re)):c(re,ee)}return function(re,ee,se,ge){try{Vc=0;var Ze=Zt(re,ee,se,ge);return wl=null,Ze}catch(Ge){if(Ge===xl||Ge===vh)throw Ge;var Pt=Kr(29,Ge,null,re.mode);return Pt.lanes=ge,Pt.return=re,Pt}finally{}}}var _a=G1(!0),Y1=G1(!1),vo=!1;function Eg(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rg(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function _o(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function bo(i,a,c){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(Ht&2)!==0){var b=m.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),m.pending=a,a=dh(i),D1(i,null,c),a}return uh(i,m,a,c),dh(i)}function Kc(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var m=a.lanes;m&=i.pendingLanes,c|=m,a.lanes=c,Qe(i,c)}}function Tg(i,a){var c=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var b=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var T={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?b=x=T:x=x.next=T,c=c.next}while(c!==null);x===null?b=x=a:x=x.next=a}else b=x=a;c={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:x,shared:m.shared,callbacks:m.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}var Mg=!1;function Gc(){if(Mg){var i=yl;if(i!==null)throw i}}function Yc(i,a,c,m){Mg=!1;var b=i.updateQueue;vo=!1;var x=b.firstBaseUpdate,T=b.lastBaseUpdate,z=b.shared.pending;if(z!==null){b.shared.pending=null;var Q=z,oe=Q.next;Q.next=null,T===null?x=oe:T.next=oe,T=Q;var fe=i.alternate;fe!==null&&(fe=fe.updateQueue,z=fe.lastBaseUpdate,z!==T&&(z===null?fe.firstBaseUpdate=oe:z.next=oe,fe.lastBaseUpdate=Q))}if(x!==null){var ve=b.baseState;T=0,fe=oe=Q=null,z=x;do{var ue=z.lane&-536870913,de=ue!==z.lane;if(de?(Nt&ue)===ue:(m&ue)===ue){ue!==0&&ue===bl&&(Mg=!0),fe!==null&&(fe=fe.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var We=i,nt=z;ue=a;var Zt=c;switch(nt.tag){case 1:if(We=nt.payload,typeof We=="function"){ve=We.call(Zt,ve,ue);break e}ve=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=nt.payload,ue=typeof We=="function"?We.call(Zt,ve,ue):We,ue==null)break e;ve=p({},ve,ue);break e;case 2:vo=!0}}ue=z.callback,ue!==null&&(i.flags|=64,de&&(i.flags|=8192),de=b.callbacks,de===null?b.callbacks=[ue]:de.push(ue))}else de={lane:ue,tag:z.tag,payload:z.payload,callback:z.callback,next:null},fe===null?(oe=fe=de,Q=ve):fe=fe.next=de,T|=ue;if(z=z.next,z===null){if(z=b.shared.pending,z===null)break;de=z,z=de.next,de.next=null,b.lastBaseUpdate=de,b.shared.pending=null}}while(!0);fe===null&&(Q=ve),b.baseState=Q,b.firstBaseUpdate=oe,b.lastBaseUpdate=fe,x===null&&(b.shared.lanes=0),Co|=T,i.lanes=T,i.memoizedState=ve}}function X1(i,a){if(typeof i!="function")throw Error(r(191,i));i.call(a)}function Z1(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)X1(c[i],a)}var Sl=B(null),xh=B(0);function Q1(i,a){i=Ps,A(xh,i),A(Sl,a),Ps=i|a.baseLanes}function Ng(){A(xh,Ps),A(Sl,Sl.current)}function Ag(){Ps=xh.current,X(Sl),X(xh)}var Gr=B(null),pi=null;function yo(i){var a=i.alternate;A(kn,kn.current&1),A(Gr,i),pi===null&&(a===null||Sl.current!==null||a.memoizedState!==null)&&(pi=i)}function Dg(i){A(kn,kn.current),A(Gr,i),pi===null&&(pi=i)}function J1(i){i.tag===22?(A(kn,kn.current),A(Gr,i),pi===null&&(pi=i)):xo()}function xo(){A(kn,kn.current),A(Gr,Gr.current)}function Yr(i){X(Gr),pi===i&&(pi=null),X(kn)}var kn=B(0);function wh(i){for(var a=i;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Bv(c)||Iv(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ms=0,ut=null,Yt=null,jn=null,Sh=!1,Cl=!1,ba=!1,Ch=0,Xc=0,kl=null,i4=0;function _n(){throw Error(r(321))}function jg(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!qr(i[c],a[c]))return!1;return!0}function Og(i,a,c,m,b,x){return Ms=x,ut=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,O.H=i===null||i.memoizedState===null?zw:Yg,ba=!1,x=c(m,b),ba=!1,Cl&&(x=tw(a,c,m,b)),ew(i),x}function ew(i){O.H=Jc;var a=Yt!==null&&Yt.next!==null;if(Ms=0,jn=Yt=ut=null,Sh=!1,Xc=0,kl=null,a)throw Error(r(300));i===null||On||(i=i.dependencies,i!==null&&mh(i)&&(On=!0))}function tw(i,a,c,m){ut=i;var b=0;do{if(Cl&&(kl=null),Xc=0,Cl=!1,25<=b)throw Error(r(301));if(b+=1,jn=Yt=null,i.updateQueue!=null){var x=i.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}O.H=Pw,x=a(c,m)}while(Cl);return x}function s4(){var i=O.H,a=i.useState()[0];return a=typeof a.then=="function"?Zc(a):a,i=i.useState()[0],(Yt!==null?Yt.memoizedState:null)!==i&&(ut.flags|=1024),a}function Lg(){var i=Ch!==0;return Ch=0,i}function zg(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function Pg(i){if(Sh){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Sh=!1}Ms=0,jn=Yt=ut=null,Cl=!1,Xc=Ch=0,kl=null}function wr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jn===null?ut.memoizedState=jn=i:jn=jn.next=i,jn}function En(){if(Yt===null){var i=ut.alternate;i=i!==null?i.memoizedState:null}else i=Yt.next;var a=jn===null?ut.memoizedState:jn.next;if(a!==null)jn=a,Yt=i;else{if(i===null)throw ut.alternate===null?Error(r(467)):Error(r(310));Yt=i,i={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},jn===null?ut.memoizedState=jn=i:jn=jn.next=i}return jn}function kh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Zc(i){var a=Xc;return Xc+=1,kl===null&&(kl=[]),i=V1(kl,i,a),a=ut,(jn===null?a.memoizedState:jn.next)===null&&(a=a.alternate,O.H=a===null||a.memoizedState===null?zw:Yg),i}function Eh(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Zc(i);if(i.$$typeof===E)return or(i)}throw Error(r(438,String(i)))}function Bg(i){var a=null,c=ut.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var m=ut.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(a={data:m.data.map(function(b){return b.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=kh(),ut.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),m=0;m<i;m++)c[m]=P;return a.index++,c}function Ns(i,a){return typeof a=="function"?a(i):a}function Rh(i){var a=En();return Ig(a,Yt,i)}function Ig(i,a,c){var m=i.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=c;var b=i.baseQueue,x=m.pending;if(x!==null){if(b!==null){var T=b.next;b.next=x.next,x.next=T}a.baseQueue=b=x,m.pending=null}if(x=i.baseState,b===null)i.memoizedState=x;else{a=b.next;var z=T=null,Q=null,oe=a,fe=!1;do{var ve=oe.lane&-536870913;if(ve!==oe.lane?(Nt&ve)===ve:(Ms&ve)===ve){var ue=oe.revertLane;if(ue===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),ve===bl&&(fe=!0);else if((Ms&ue)===ue){oe=oe.next,ue===bl&&(fe=!0);continue}else ve={lane:0,revertLane:oe.revertLane,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},Q===null?(z=Q=ve,T=x):Q=Q.next=ve,ut.lanes|=ue,Co|=ue;ve=oe.action,ba&&c(x,ve),x=oe.hasEagerState?oe.eagerState:c(x,ve)}else ue={lane:ve,revertLane:oe.revertLane,gesture:oe.gesture,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},Q===null?(z=Q=ue,T=x):Q=Q.next=ue,ut.lanes|=ve,Co|=ve;oe=oe.next}while(oe!==null&&oe!==a);if(Q===null?T=x:Q.next=z,!qr(x,i.memoizedState)&&(On=!0,fe&&(c=yl,c!==null)))throw c;i.memoizedState=x,i.baseState=T,i.baseQueue=Q,m.lastRenderedState=x}return b===null&&(m.lanes=0),[i.memoizedState,m.dispatch]}function Hg(i){var a=En(),c=a.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=i;var m=c.dispatch,b=c.pending,x=a.memoizedState;if(b!==null){c.pending=null;var T=b=b.next;do x=i(x,T.action),T=T.next;while(T!==b);qr(x,a.memoizedState)||(On=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),c.lastRenderedState=x}return[x,m]}function nw(i,a,c){var m=ut,b=En(),x=Dt;if(x){if(c===void 0)throw Error(r(407));c=c()}else c=a();var T=!qr((Yt||b).memoizedState,c);if(T&&(b.memoizedState=c,On=!0),b=b.queue,$g(sw.bind(null,m,b,i),[i]),b.getSnapshot!==a||T||jn!==null&&jn.memoizedState.tag&1){if(m.flags|=2048,El(9,{destroy:void 0},iw.bind(null,m,b,c,a),null),nn===null)throw Error(r(349));x||(Ms&127)!==0||rw(m,a,c)}return c}function rw(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=ut.updateQueue,a===null?(a=kh(),ut.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function iw(i,a,c,m){a.value=c,a.getSnapshot=m,ow(a)&&aw(i)}function sw(i,a,c){return c(function(){ow(a)&&aw(i)})}function ow(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!qr(i,c)}catch{return!0}}function aw(i){var a=ua(i,2);a!==null&&Br(a,i,2)}function Fg(i){var a=wr();if(typeof i=="function"){var c=i;if(i=c(),ba){St(!0);try{c()}finally{St(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ns,lastRenderedState:i},a}function lw(i,a,c,m){return i.baseState=c,Ig(i,Yt,typeof m=="function"?m:Ns)}function o4(i,a,c,m,b){if(Nh(i))throw Error(r(485));if(i=a.action,i!==null){var x={payload:b,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){x.listeners.push(T)}};O.T!==null?c(!0):x.isTransition=!1,m(x),c=a.pending,c===null?(x.next=a.pending=x,cw(a,x)):(x.next=c.next,a.pending=c.next=x)}}function cw(i,a){var c=a.action,m=a.payload,b=i.state;if(a.isTransition){var x=O.T,T={};O.T=T;try{var z=c(b,m),Q=O.S;Q!==null&&Q(T,z),uw(i,a,z)}catch(oe){Ug(i,a,oe)}finally{x!==null&&T.types!==null&&(x.types=T.types),O.T=x}}else try{x=c(b,m),uw(i,a,x)}catch(oe){Ug(i,a,oe)}}function uw(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(m){dw(i,a,m)},function(m){return Ug(i,a,m)}):dw(i,a,c)}function dw(i,a,c){a.status="fulfilled",a.value=c,hw(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,cw(i,c)))}function Ug(i,a,c){var m=i.pending;if(i.pending=null,m!==null){m=m.next;do a.status="rejected",a.reason=c,hw(a),a=a.next;while(a!==m)}i.action=null}function hw(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function fw(i,a){return a}function mw(i,a){if(Dt){var c=nn.formState;if(c!==null){e:{var m=ut;if(Dt){if(ln){t:{for(var b=ln,x=mi;b.nodeType!==8;){if(!x){b=null;break t}if(b=gi(b.nextSibling),b===null){b=null;break t}}x=b.data,b=x==="F!"||x==="F"?b:null}if(b){ln=gi(b.nextSibling),m=b.data==="F!";break e}}po(m)}m=!1}m&&(a=c[0])}}return c=wr(),c.memoizedState=c.baseState=a,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fw,lastRenderedState:a},c.queue=m,c=jw.bind(null,ut,m),m.dispatch=c,m=Fg(!1),x=Gg.bind(null,ut,!1,m.queue),m=wr(),b={state:a,dispatch:null,action:i,pending:null},m.queue=b,c=o4.bind(null,ut,b,x,c),b.dispatch=c,m.memoizedState=i,[a,c,!1]}function pw(i){var a=En();return gw(a,Yt,i)}function gw(i,a,c){if(a=Ig(i,a,fw)[0],i=Rh(Ns)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var m=Zc(a)}catch(T){throw T===xl?vh:T}else m=a;a=En();var b=a.queue,x=b.dispatch;return c!==a.memoizedState&&(ut.flags|=2048,El(9,{destroy:void 0},a4.bind(null,b,c),null)),[m,x,i]}function a4(i,a){i.action=a}function vw(i){var a=En(),c=Yt;if(c!==null)return gw(a,c,i);En(),a=a.memoizedState,c=En();var m=c.queue.dispatch;return c.memoizedState=i,[a,m,!1]}function El(i,a,c,m){return i={tag:i,create:c,deps:m,inst:a,next:null},a=ut.updateQueue,a===null&&(a=kh(),ut.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=i.next=i:(m=c.next,c.next=i,i.next=m,a.lastEffect=i),i}function _w(){return En().memoizedState}function Th(i,a,c,m){var b=wr();ut.flags|=i,b.memoizedState=El(1|a,{destroy:void 0},c,m===void 0?null:m)}function Mh(i,a,c,m){var b=En();m=m===void 0?null:m;var x=b.memoizedState.inst;Yt!==null&&m!==null&&jg(m,Yt.memoizedState.deps)?b.memoizedState=El(a,x,c,m):(ut.flags|=i,b.memoizedState=El(1|a,x,c,m))}function bw(i,a){Th(8390656,8,i,a)}function $g(i,a){Mh(2048,8,i,a)}function l4(i){ut.flags|=4;var a=ut.updateQueue;if(a===null)a=kh(),ut.updateQueue=a,a.events=[i];else{var c=a.events;c===null?a.events=[i]:c.push(i)}}function yw(i){var a=En().memoizedState;return l4({ref:a,nextImpl:i}),function(){if((Ht&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function xw(i,a){return Mh(4,2,i,a)}function ww(i,a){return Mh(4,4,i,a)}function Sw(i,a){if(typeof a=="function"){i=i();var c=a(i);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function Cw(i,a,c){c=c!=null?c.concat([i]):null,Mh(4,4,Sw.bind(null,a,i),c)}function Wg(){}function kw(i,a){var c=En();a=a===void 0?null:a;var m=c.memoizedState;return a!==null&&jg(a,m[1])?m[0]:(c.memoizedState=[i,a],i)}function Ew(i,a){var c=En();a=a===void 0?null:a;var m=c.memoizedState;if(a!==null&&jg(a,m[1]))return m[0];if(m=i(),ba){St(!0);try{i()}finally{St(!1)}}return c.memoizedState=[m,a],m}function Vg(i,a,c){return c===void 0||(Ms&1073741824)!==0&&(Nt&261930)===0?i.memoizedState=a:(i.memoizedState=c,i=RS(),ut.lanes|=i,Co|=i,c)}function Rw(i,a,c,m){return qr(c,a)?c:Sl.current!==null?(i=Vg(i,c,m),qr(i,a)||(On=!0),i):(Ms&42)===0||(Ms&1073741824)!==0&&(Nt&261930)===0?(On=!0,i.memoizedState=c):(i=RS(),ut.lanes|=i,Co|=i,a)}function Tw(i,a,c,m,b){var x=H.p;H.p=x!==0&&8>x?x:8;var T=O.T,z={};O.T=z,Gg(i,!1,a,c);try{var Q=b(),oe=O.S;if(oe!==null&&oe(z,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=r4(Q,m);Qc(i,a,fe,Qr(i))}else Qc(i,a,m,Qr(i))}catch(ve){Qc(i,a,{then:function(){},status:"rejected",reason:ve},Qr())}finally{H.p=x,T!==null&&z.types!==null&&(T.types=z.types),O.T=T}}function c4(){}function qg(i,a,c,m){if(i.tag!==5)throw Error(r(476));var b=Mw(i).queue;Tw(i,b,a,U,c===null?c4:function(){return Nw(i),c(m)})}function Mw(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ns,lastRenderedState:U},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ns,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function Nw(i){var a=Mw(i);a.next===null&&(a=i.alternate.memoizedState),Qc(i,a.next.queue,{},Qr())}function Kg(){return or(pu)}function Aw(){return En().memoizedState}function Dw(){return En().memoizedState}function u4(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=Qr();i=_o(c);var m=bo(a,i,c);m!==null&&(Br(m,a,c),Kc(m,a,c)),a={cache:wg()},i.payload=a;return}a=a.return}}function d4(i,a,c){var m=Qr();c={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Nh(i)?Ow(a,c):(c=dg(i,a,c,m),c!==null&&(Br(c,i,m),Lw(c,a,m)))}function jw(i,a,c){var m=Qr();Qc(i,a,c,m)}function Qc(i,a,c,m){var b={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Nh(i))Ow(a,b);else{var x=i.alternate;if(i.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var T=a.lastRenderedState,z=x(T,c);if(b.hasEagerState=!0,b.eagerState=z,qr(z,T))return uh(i,a,b,0),nn===null&&ch(),!1}catch{}finally{}if(c=dg(i,a,b,m),c!==null)return Br(c,i,m),Lw(c,a,m),!0}return!1}function Gg(i,a,c,m){if(m={lane:2,revertLane:Ev(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Nh(i)){if(a)throw Error(r(479))}else a=dg(i,c,m,2),a!==null&&Br(a,i,2)}function Nh(i){var a=i.alternate;return i===ut||a!==null&&a===ut}function Ow(i,a){Cl=Sh=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function Lw(i,a,c){if((c&4194048)!==0){var m=a.lanes;m&=i.pendingLanes,c|=m,a.lanes=c,Qe(i,c)}}var Jc={readContext:or,use:Eh,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useLayoutEffect:_n,useInsertionEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useSyncExternalStore:_n,useId:_n,useHostTransitionStatus:_n,useFormState:_n,useActionState:_n,useOptimistic:_n,useMemoCache:_n,useCacheRefresh:_n};Jc.useEffectEvent=_n;var zw={readContext:or,use:Eh,useCallback:function(i,a){return wr().memoizedState=[i,a===void 0?null:a],i},useContext:or,useEffect:bw,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,Th(4194308,4,Sw.bind(null,a,i),c)},useLayoutEffect:function(i,a){return Th(4194308,4,i,a)},useInsertionEffect:function(i,a){Th(4,2,i,a)},useMemo:function(i,a){var c=wr();a=a===void 0?null:a;var m=i();if(ba){St(!0);try{i()}finally{St(!1)}}return c.memoizedState=[m,a],m},useReducer:function(i,a,c){var m=wr();if(c!==void 0){var b=c(a);if(ba){St(!0);try{c(a)}finally{St(!1)}}}else b=a;return m.memoizedState=m.baseState=b,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:b},m.queue=i,i=i.dispatch=d4.bind(null,ut,i),[m.memoizedState,i]},useRef:function(i){var a=wr();return i={current:i},a.memoizedState=i},useState:function(i){i=Fg(i);var a=i.queue,c=jw.bind(null,ut,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:Wg,useDeferredValue:function(i,a){var c=wr();return Vg(c,i,a)},useTransition:function(){var i=Fg(!1);return i=Tw.bind(null,ut,i.queue,!0,!1),wr().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var m=ut,b=wr();if(Dt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=a(),nn===null)throw Error(r(349));(Nt&127)!==0||rw(m,a,c)}b.memoizedState=c;var x={value:c,getSnapshot:a};return b.queue=x,bw(sw.bind(null,m,x,i),[i]),m.flags|=2048,El(9,{destroy:void 0},iw.bind(null,m,x,c,a),null),c},useId:function(){var i=wr(),a=nn.identifierPrefix;if(Dt){var c=Qi,m=Zi;c=(m&~(1<<32-at(m)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Ch++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=i4++,a="_"+a+"r_"+c.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:Kg,useFormState:mw,useActionState:mw,useOptimistic:function(i){var a=wr();a.memoizedState=a.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Gg.bind(null,ut,!0,c),c.dispatch=a,[i,a]},useMemoCache:Bg,useCacheRefresh:function(){return wr().memoizedState=u4.bind(null,ut)},useEffectEvent:function(i){var a=wr(),c={impl:i};return a.memoizedState=c,function(){if((Ht&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},Yg={readContext:or,use:Eh,useCallback:kw,useContext:or,useEffect:$g,useImperativeHandle:Cw,useInsertionEffect:xw,useLayoutEffect:ww,useMemo:Ew,useReducer:Rh,useRef:_w,useState:function(){return Rh(Ns)},useDebugValue:Wg,useDeferredValue:function(i,a){var c=En();return Rw(c,Yt.memoizedState,i,a)},useTransition:function(){var i=Rh(Ns)[0],a=En().memoizedState;return[typeof i=="boolean"?i:Zc(i),a]},useSyncExternalStore:nw,useId:Aw,useHostTransitionStatus:Kg,useFormState:pw,useActionState:pw,useOptimistic:function(i,a){var c=En();return lw(c,Yt,i,a)},useMemoCache:Bg,useCacheRefresh:Dw};Yg.useEffectEvent=yw;var Pw={readContext:or,use:Eh,useCallback:kw,useContext:or,useEffect:$g,useImperativeHandle:Cw,useInsertionEffect:xw,useLayoutEffect:ww,useMemo:Ew,useReducer:Hg,useRef:_w,useState:function(){return Hg(Ns)},useDebugValue:Wg,useDeferredValue:function(i,a){var c=En();return Yt===null?Vg(c,i,a):Rw(c,Yt.memoizedState,i,a)},useTransition:function(){var i=Hg(Ns)[0],a=En().memoizedState;return[typeof i=="boolean"?i:Zc(i),a]},useSyncExternalStore:nw,useId:Aw,useHostTransitionStatus:Kg,useFormState:vw,useActionState:vw,useOptimistic:function(i,a){var c=En();return Yt!==null?lw(c,Yt,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:Bg,useCacheRefresh:Dw};Pw.useEffectEvent=yw;function Xg(i,a,c,m){a=i.memoizedState,c=c(m,a),c=c==null?a:p({},a,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Zg={enqueueSetState:function(i,a,c){i=i._reactInternals;var m=Qr(),b=_o(m);b.payload=a,c!=null&&(b.callback=c),a=bo(i,b,m),a!==null&&(Br(a,i,m),Kc(a,i,m))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var m=Qr(),b=_o(m);b.tag=1,b.payload=a,c!=null&&(b.callback=c),a=bo(i,b,m),a!==null&&(Br(a,i,m),Kc(a,i,m))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=Qr(),m=_o(c);m.tag=2,a!=null&&(m.callback=a),a=bo(i,m,c),a!==null&&(Br(a,i,c),Kc(a,i,c))}};function Bw(i,a,c,m,b,x,T){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(m,x,T):a.prototype&&a.prototype.isPureReactComponent?!Ic(c,m)||!Ic(b,x):!0}function Iw(i,a,c,m){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,m),a.state!==i&&Zg.enqueueReplaceState(a,a.state,null)}function ya(i,a){var c=a;if("ref"in a){c={};for(var m in a)m!=="ref"&&(c[m]=a[m])}if(i=i.defaultProps){c===a&&(c=p({},c));for(var b in i)c[b]===void 0&&(c[b]=i[b])}return c}function Hw(i){lh(i)}function Fw(i){console.error(i)}function Uw(i){lh(i)}function Ah(i,a){try{var c=i.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(m){setTimeout(function(){throw m})}}function $w(i,a,c){try{var m=i.onCaughtError;m(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Qg(i,a,c){return c=_o(c),c.tag=3,c.payload={element:null},c.callback=function(){Ah(i,a)},c}function Ww(i){return i=_o(i),i.tag=3,i}function Vw(i,a,c,m){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var x=m.value;i.payload=function(){return b(x)},i.callback=function(){$w(a,c,m)}}var T=c.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(i.callback=function(){$w(a,c,m),typeof b!="function"&&(ko===null?ko=new Set([this]):ko.add(this));var z=m.stack;this.componentDidCatch(m.value,{componentStack:z!==null?z:""})})}function h4(i,a,c,m,b){if(c.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(a=c.alternate,a!==null&&_l(a,c,b,!0),c=Gr.current,c!==null){switch(c.tag){case 31:case 13:return pi===null?$h():c.alternate===null&&bn===0&&(bn=3),c.flags&=-257,c.flags|=65536,c.lanes=b,m===_h?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([m]):a.add(m),Sv(i,m,b)),!1;case 22:return c.flags|=65536,m===_h?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([m])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([m]):c.add(m)),Sv(i,m,b)),!1}throw Error(r(435,c.tag))}return Sv(i,m,b),$h(),!1}if(Dt)return a=Gr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=b,m!==vg&&(i=Error(r(422),{cause:m}),Uc(di(i,c)))):(m!==vg&&(a=Error(r(423),{cause:m}),Uc(di(a,c))),i=i.current.alternate,i.flags|=65536,b&=-b,i.lanes|=b,m=di(m,c),b=Qg(i.stateNode,m,b),Tg(i,b),bn!==4&&(bn=2)),!1;var x=Error(r(520),{cause:m});if(x=di(x,c),au===null?au=[x]:au.push(x),bn!==4&&(bn=2),a===null)return!0;m=di(m,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=b&-b,c.lanes|=i,i=Qg(c.stateNode,m,i),Tg(c,i),!1;case 1:if(a=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ko===null||!ko.has(x))))return c.flags|=65536,b&=-b,c.lanes|=b,b=Ww(b),Vw(b,i,c,m),Tg(c,b),!1}c=c.return}while(c!==null);return!1}var Jg=Error(r(461)),On=!1;function ar(i,a,c,m){a.child=i===null?Y1(a,null,c,m):_a(a,i.child,c,m)}function qw(i,a,c,m,b){c=c.render;var x=a.ref;if("ref"in m){var T={};for(var z in m)z!=="ref"&&(T[z]=m[z])}else T=m;return ma(a),m=Og(i,a,c,T,x,b),z=Lg(),i!==null&&!On?(zg(i,a,b),As(i,a,b)):(Dt&&z&&pg(a),a.flags|=1,ar(i,a,m,b),a.child)}function Kw(i,a,c,m,b){if(i===null){var x=c.type;return typeof x=="function"&&!hg(x)&&x.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=x,Gw(i,a,x,m,b)):(i=hh(c.type,null,m,a,a.mode,b),i.ref=a.ref,i.return=a,a.child=i)}if(x=i.child,!av(i,b)){var T=x.memoizedProps;if(c=c.compare,c=c!==null?c:Ic,c(T,m)&&i.ref===a.ref)return As(i,a,b)}return a.flags|=1,i=ks(x,m),i.ref=a.ref,i.return=a,a.child=i}function Gw(i,a,c,m,b){if(i!==null){var x=i.memoizedProps;if(Ic(x,m)&&i.ref===a.ref)if(On=!1,a.pendingProps=m=x,av(i,b))(i.flags&131072)!==0&&(On=!0);else return a.lanes=i.lanes,As(i,a,b)}return ev(i,a,c,m,b)}function Yw(i,a,c,m){var b=m.children,x=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,i!==null){for(m=a.child=i.child,b=0;m!==null;)b=b|m.lanes|m.childLanes,m=m.sibling;m=b&~x}else m=0,a.child=null;return Xw(i,a,x,c,m)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&gh(a,x!==null?x.cachePool:null),x!==null?Q1(a,x):Ng(),J1(a);else return m=a.lanes=536870912,Xw(i,a,x!==null?x.baseLanes|c:c,c,m)}else x!==null?(gh(a,x.cachePool),Q1(a,x),xo(),a.memoizedState=null):(i!==null&&gh(a,null),Ng(),xo());return ar(i,a,b,c),a.child}function eu(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Xw(i,a,c,m,b){var x=Cg();return x=x===null?null:{parent:Dn._currentValue,pool:x},a.memoizedState={baseLanes:c,cachePool:x},i!==null&&gh(a,null),Ng(),J1(a),i!==null&&_l(i,a,m,!0),a.childLanes=b,null}function Dh(i,a){return a=Oh({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function Zw(i,a,c){return _a(a,i.child,null,c),i=Dh(a,a.pendingProps),i.flags|=2,Yr(a),a.memoizedState=null,i}function f4(i,a,c){var m=a.pendingProps,b=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(Dt){if(m.mode==="hidden")return i=Dh(a,m),a.lanes=536870912,eu(null,i);if(Dg(a),(i=ln)?(i=cC(i,mi),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:fo!==null?{id:Zi,overflow:Qi}:null,retryLane:536870912,hydrationErrors:null},c=O1(i),c.return=a,a.child=c,sr=a,ln=null)):i=null,i===null)throw po(a);return a.lanes=536870912,null}return Dh(a,m)}var x=i.memoizedState;if(x!==null){var T=x.dehydrated;if(Dg(a),b)if(a.flags&256)a.flags&=-257,a=Zw(i,a,c);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(r(558));else if(On||_l(i,a,c,!1),b=(c&i.childLanes)!==0,On||b){if(m=nn,m!==null&&(T=vt(m,c),T!==0&&T!==x.retryLane))throw x.retryLane=T,ua(i,T),Br(m,i,T),Jg;$h(),a=Zw(i,a,c)}else i=x.treeContext,ln=gi(T.nextSibling),sr=a,Dt=!0,mo=null,mi=!1,i!==null&&P1(a,i),a=Dh(a,m),a.flags|=4096;return a}return i=ks(i.child,{mode:m.mode,children:m.children}),i.ref=a.ref,a.child=i,i.return=a,i}function jh(i,a){var c=a.ref;if(c===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(i===null||i.ref!==c)&&(a.flags|=4194816)}}function ev(i,a,c,m,b){return ma(a),c=Og(i,a,c,m,void 0,b),m=Lg(),i!==null&&!On?(zg(i,a,b),As(i,a,b)):(Dt&&m&&pg(a),a.flags|=1,ar(i,a,c,b),a.child)}function Qw(i,a,c,m,b,x){return ma(a),a.updateQueue=null,c=tw(a,m,c,b),ew(i),m=Lg(),i!==null&&!On?(zg(i,a,x),As(i,a,x)):(Dt&&m&&pg(a),a.flags|=1,ar(i,a,c,x),a.child)}function Jw(i,a,c,m,b){if(ma(a),a.stateNode===null){var x=ml,T=c.contextType;typeof T=="object"&&T!==null&&(x=or(T)),x=new c(m,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Zg,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=m,x.state=a.memoizedState,x.refs={},Eg(a),T=c.contextType,x.context=typeof T=="object"&&T!==null?or(T):ml,x.state=a.memoizedState,T=c.getDerivedStateFromProps,typeof T=="function"&&(Xg(a,c,T,m),x.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(T=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),T!==x.state&&Zg.enqueueReplaceState(x,x.state,null),Yc(a,m,x,b),Gc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),m=!0}else if(i===null){x=a.stateNode;var z=a.memoizedProps,Q=ya(c,z);x.props=Q;var oe=x.context,fe=c.contextType;T=ml,typeof fe=="object"&&fe!==null&&(T=or(fe));var ve=c.getDerivedStateFromProps;fe=typeof ve=="function"||typeof x.getSnapshotBeforeUpdate=="function",z=a.pendingProps!==z,fe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(z||oe!==T)&&Iw(a,x,m,T),vo=!1;var ue=a.memoizedState;x.state=ue,Yc(a,m,x,b),Gc(),oe=a.memoizedState,z||ue!==oe||vo?(typeof ve=="function"&&(Xg(a,c,ve,m),oe=a.memoizedState),(Q=vo||Bw(a,c,Q,m,ue,oe,T))?(fe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=oe),x.props=m,x.state=oe,x.context=T,m=Q):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{x=a.stateNode,Rg(i,a),T=a.memoizedProps,fe=ya(c,T),x.props=fe,ve=a.pendingProps,ue=x.context,oe=c.contextType,Q=ml,typeof oe=="object"&&oe!==null&&(Q=or(oe)),z=c.getDerivedStateFromProps,(oe=typeof z=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==ve||ue!==Q)&&Iw(a,x,m,Q),vo=!1,ue=a.memoizedState,x.state=ue,Yc(a,m,x,b),Gc();var de=a.memoizedState;T!==ve||ue!==de||vo||i!==null&&i.dependencies!==null&&mh(i.dependencies)?(typeof z=="function"&&(Xg(a,c,z,m),de=a.memoizedState),(fe=vo||Bw(a,c,fe,m,ue,de,Q)||i!==null&&i.dependencies!==null&&mh(i.dependencies))?(oe||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(m,de,Q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(m,de,Q)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=de),x.props=m,x.state=de,x.context=Q,m=fe):(typeof x.componentDidUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(a.flags|=1024),m=!1)}return x=m,jh(i,a),m=(a.flags&128)!==0,x||m?(x=a.stateNode,c=m&&typeof c.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,i!==null&&m?(a.child=_a(a,i.child,null,b),a.child=_a(a,null,c,b)):ar(i,a,c,b),a.memoizedState=x.state,i=a.child):i=As(i,a,b),i}function eS(i,a,c,m){return ha(),a.flags|=256,ar(i,a,c,m),a.child}var tv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function nv(i){return{baseLanes:i,cachePool:$1()}}function rv(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=Zr),i}function tS(i,a,c){var m=a.pendingProps,b=!1,x=(a.flags&128)!==0,T;if((T=x)||(T=i!==null&&i.memoizedState===null?!1:(kn.current&2)!==0),T&&(b=!0,a.flags&=-129),T=(a.flags&32)!==0,a.flags&=-33,i===null){if(Dt){if(b?yo(a):xo(),(i=ln)?(i=cC(i,mi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:fo!==null?{id:Zi,overflow:Qi}:null,retryLane:536870912,hydrationErrors:null},c=O1(i),c.return=a,a.child=c,sr=a,ln=null)):i=null,i===null)throw po(a);return Iv(i)?a.lanes=32:a.lanes=536870912,null}var z=m.children;return m=m.fallback,b?(xo(),b=a.mode,z=Oh({mode:"hidden",children:z},b),m=da(m,b,c,null),z.return=a,m.return=a,z.sibling=m,a.child=z,m=a.child,m.memoizedState=nv(c),m.childLanes=rv(i,T,c),a.memoizedState=tv,eu(null,m)):(yo(a),iv(a,z))}var Q=i.memoizedState;if(Q!==null&&(z=Q.dehydrated,z!==null)){if(x)a.flags&256?(yo(a),a.flags&=-257,a=sv(i,a,c)):a.memoizedState!==null?(xo(),a.child=i.child,a.flags|=128,a=null):(xo(),z=m.fallback,b=a.mode,m=Oh({mode:"visible",children:m.children},b),z=da(z,b,c,null),z.flags|=2,m.return=a,z.return=a,m.sibling=z,a.child=m,_a(a,i.child,null,c),m=a.child,m.memoizedState=nv(c),m.childLanes=rv(i,T,c),a.memoizedState=tv,a=eu(null,m));else if(yo(a),Iv(z)){if(T=z.nextSibling&&z.nextSibling.dataset,T)var oe=T.dgst;T=oe,m=Error(r(419)),m.stack="",m.digest=T,Uc({value:m,source:null,stack:null}),a=sv(i,a,c)}else if(On||_l(i,a,c,!1),T=(c&i.childLanes)!==0,On||T){if(T=nn,T!==null&&(m=vt(T,c),m!==0&&m!==Q.retryLane))throw Q.retryLane=m,ua(i,m),Br(T,i,m),Jg;Bv(z)||$h(),a=sv(i,a,c)}else Bv(z)?(a.flags|=192,a.child=i.child,a=null):(i=Q.treeContext,ln=gi(z.nextSibling),sr=a,Dt=!0,mo=null,mi=!1,i!==null&&P1(a,i),a=iv(a,m.children),a.flags|=4096);return a}return b?(xo(),z=m.fallback,b=a.mode,Q=i.child,oe=Q.sibling,m=ks(Q,{mode:"hidden",children:m.children}),m.subtreeFlags=Q.subtreeFlags&65011712,oe!==null?z=ks(oe,z):(z=da(z,b,c,null),z.flags|=2),z.return=a,m.return=a,m.sibling=z,a.child=m,eu(null,m),m=a.child,z=i.child.memoizedState,z===null?z=nv(c):(b=z.cachePool,b!==null?(Q=Dn._currentValue,b=b.parent!==Q?{parent:Q,pool:Q}:b):b=$1(),z={baseLanes:z.baseLanes|c,cachePool:b}),m.memoizedState=z,m.childLanes=rv(i,T,c),a.memoizedState=tv,eu(i.child,m)):(yo(a),c=i.child,i=c.sibling,c=ks(c,{mode:"visible",children:m.children}),c.return=a,c.sibling=null,i!==null&&(T=a.deletions,T===null?(a.deletions=[i],a.flags|=16):T.push(i)),a.child=c,a.memoizedState=null,c)}function iv(i,a){return a=Oh({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function Oh(i,a){return i=Kr(22,i,null,a),i.lanes=0,i}function sv(i,a,c){return _a(a,i.child,null,c),i=iv(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function nS(i,a,c){i.lanes|=a;var m=i.alternate;m!==null&&(m.lanes|=a),yg(i.return,a,c)}function ov(i,a,c,m,b,x){var T=i.memoizedState;T===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:b,treeForkCount:x}:(T.isBackwards=a,T.rendering=null,T.renderingStartTime=0,T.last=m,T.tail=c,T.tailMode=b,T.treeForkCount=x)}function rS(i,a,c){var m=a.pendingProps,b=m.revealOrder,x=m.tail;m=m.children;var T=kn.current,z=(T&2)!==0;if(z?(T=T&1|2,a.flags|=128):T&=1,A(kn,T),ar(i,a,m,c),m=Dt?Fc:0,!z&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&nS(i,c,a);else if(i.tag===19)nS(i,c,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(b){case"forwards":for(c=a.child,b=null;c!==null;)i=c.alternate,i!==null&&wh(i)===null&&(b=c),c=c.sibling;c=b,c===null?(b=a.child,a.child=null):(b=c.sibling,c.sibling=null),ov(a,!1,b,c,x,m);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=a.child,a.child=null;b!==null;){if(i=b.alternate,i!==null&&wh(i)===null){a.child=b;break}i=b.sibling,b.sibling=c,c=b,b=i}ov(a,!0,c,null,x,m);break;case"together":ov(a,!1,null,null,void 0,m);break;default:a.memoizedState=null}return a.child}function As(i,a,c){if(i!==null&&(a.dependencies=i.dependencies),Co|=a.lanes,(c&a.childLanes)===0)if(i!==null){if(_l(i,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(r(153));if(a.child!==null){for(i=a.child,c=ks(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=ks(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function av(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&mh(i)))}function m4(i,a,c){switch(a.tag){case 3:le(a,a.stateNode.containerInfo),go(a,Dn,i.memoizedState.cache),ha();break;case 27:case 5:xe(a);break;case 4:le(a,a.stateNode.containerInfo);break;case 10:go(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Dg(a),null;break;case 13:var m=a.memoizedState;if(m!==null)return m.dehydrated!==null?(yo(a),a.flags|=128,null):(c&a.child.childLanes)!==0?tS(i,a,c):(yo(a),i=As(i,a,c),i!==null?i.sibling:null);yo(a);break;case 19:var b=(i.flags&128)!==0;if(m=(c&a.childLanes)!==0,m||(_l(i,a,c,!1),m=(c&a.childLanes)!==0),b){if(m)return rS(i,a,c);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),A(kn,kn.current),m)break;return null;case 22:return a.lanes=0,Yw(i,a,c,a.pendingProps);case 24:go(a,Dn,i.memoizedState.cache)}return As(i,a,c)}function iS(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)On=!0;else{if(!av(i,c)&&(a.flags&128)===0)return On=!1,m4(i,a,c);On=(i.flags&131072)!==0}else On=!1,Dt&&(a.flags&1048576)!==0&&z1(a,Fc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var m=a.pendingProps;if(i=ga(a.elementType),a.type=i,typeof i=="function")hg(i)?(m=ya(i,m),a.tag=1,a=Jw(null,a,i,m,c)):(a.tag=0,a=ev(null,a,i,m,c));else{if(i!=null){var b=i.$$typeof;if(b===M){a.tag=11,a=qw(null,a,i,m,c);break e}else if(b===L){a.tag=14,a=Kw(null,a,i,m,c);break e}}throw a=K(i)||i,Error(r(306,a,""))}}return a;case 0:return ev(i,a,a.type,a.pendingProps,c);case 1:return m=a.type,b=ya(m,a.pendingProps),Jw(i,a,m,b,c);case 3:e:{if(le(a,a.stateNode.containerInfo),i===null)throw Error(r(387));m=a.pendingProps;var x=a.memoizedState;b=x.element,Rg(i,a),Yc(a,m,null,c);var T=a.memoizedState;if(m=T.cache,go(a,Dn,m),m!==x.cache&&xg(a,[Dn],c,!0),Gc(),m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=eS(i,a,m,c);break e}else if(m!==b){b=di(Error(r(424)),a),Uc(b),a=eS(i,a,m,c);break e}else{switch(i=a.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(ln=gi(i.firstChild),sr=a,Dt=!0,mo=null,mi=!0,c=Y1(a,null,m,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ha(),m===b){a=As(i,a,c);break e}ar(i,a,m,c)}a=a.child}return a;case 26:return jh(i,a),i===null?(c=pC(a.type,null,a.pendingProps,null))?a.memoizedState=c:Dt||(c=a.type,i=a.pendingProps,m=Xh(Z.current).createElement(c),m[It]=a,m[Cn]=i,lr(m,c,i),An(m),a.stateNode=m):a.memoizedState=pC(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return xe(a),i===null&&Dt&&(m=a.stateNode=hC(a.type,a.pendingProps,Z.current),sr=a,mi=!0,b=ln,Mo(a.type)?(Hv=b,ln=gi(m.firstChild)):ln=b),ar(i,a,a.pendingProps.children,c),jh(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&Dt&&((b=m=ln)&&(m=W4(m,a.type,a.pendingProps,mi),m!==null?(a.stateNode=m,sr=a,ln=gi(m.firstChild),mi=!1,b=!0):b=!1),b||po(a)),xe(a),b=a.type,x=a.pendingProps,T=i!==null?i.memoizedProps:null,m=x.children,Lv(b,x)?m=null:T!==null&&Lv(b,T)&&(a.flags|=32),a.memoizedState!==null&&(b=Og(i,a,s4,null,null,c),pu._currentValue=b),jh(i,a),ar(i,a,m,c),a.child;case 6:return i===null&&Dt&&((i=c=ln)&&(c=V4(c,a.pendingProps,mi),c!==null?(a.stateNode=c,sr=a,ln=null,i=!0):i=!1),i||po(a)),null;case 13:return tS(i,a,c);case 4:return le(a,a.stateNode.containerInfo),m=a.pendingProps,i===null?a.child=_a(a,null,m,c):ar(i,a,m,c),a.child;case 11:return qw(i,a,a.type,a.pendingProps,c);case 7:return ar(i,a,a.pendingProps,c),a.child;case 8:return ar(i,a,a.pendingProps.children,c),a.child;case 12:return ar(i,a,a.pendingProps.children,c),a.child;case 10:return m=a.pendingProps,go(a,a.type,m.value),ar(i,a,m.children,c),a.child;case 9:return b=a.type._context,m=a.pendingProps.children,ma(a),b=or(b),m=m(b),a.flags|=1,ar(i,a,m,c),a.child;case 14:return Kw(i,a,a.type,a.pendingProps,c);case 15:return Gw(i,a,a.type,a.pendingProps,c);case 19:return rS(i,a,c);case 31:return f4(i,a,c);case 22:return Yw(i,a,c,a.pendingProps);case 24:return ma(a),m=or(Dn),i===null?(b=Cg(),b===null&&(b=nn,x=wg(),b.pooledCache=x,x.refCount++,x!==null&&(b.pooledCacheLanes|=c),b=x),a.memoizedState={parent:m,cache:b},Eg(a),go(a,Dn,b)):((i.lanes&c)!==0&&(Rg(i,a),Yc(a,null,null,c),Gc()),b=i.memoizedState,x=a.memoizedState,b.parent!==m?(b={parent:m,cache:m},a.memoizedState=b,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=b),go(a,Dn,m)):(m=x.cache,go(a,Dn,m),m!==b.cache&&xg(a,[Dn],c,!0))),ar(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Ds(i){i.flags|=4}function lv(i,a,c,m,b){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(b&335544128)===b)if(i.stateNode.complete)i.flags|=8192;else if(AS())i.flags|=8192;else throw va=_h,kg}else i.flags&=-16777217}function sS(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!yC(a))if(AS())i.flags|=8192;else throw va=_h,kg}function Lh(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?mt():536870912,i.lanes|=a,Nl|=a)}function tu(i,a){if(!Dt)switch(i.tailMode){case"hidden":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:m.sibling=null}}function cn(i){var a=i.alternate!==null&&i.alternate.child===i.child,c=0,m=0;if(a)for(var b=i.child;b!==null;)c|=b.lanes|b.childLanes,m|=b.subtreeFlags&65011712,m|=b.flags&65011712,b.return=i,b=b.sibling;else for(b=i.child;b!==null;)c|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=i,b=b.sibling;return i.subtreeFlags|=m,i.childLanes=c,a}function p4(i,a,c){var m=a.pendingProps;switch(gg(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(a),null;case 1:return cn(a),null;case 3:return c=a.stateNode,m=null,i!==null&&(m=i.memoizedState.cache),a.memoizedState.cache!==m&&(a.flags|=2048),Ts(Dn),me(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(vl(a)?Ds(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,_g())),cn(a),null;case 26:var b=a.type,x=a.memoizedState;return i===null?(Ds(a),x!==null?(cn(a),sS(a,x)):(cn(a),lv(a,b,null,m,c))):x?x!==i.memoizedState?(Ds(a),cn(a),sS(a,x)):(cn(a),a.flags&=-16777217):(i=i.memoizedProps,i!==m&&Ds(a),cn(a),lv(a,b,i,m,c)),null;case 27:if(Ae(a),c=Z.current,b=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==m&&Ds(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return cn(a),null}i=ne.current,vl(a)?B1(a):(i=hC(b,m,c),a.stateNode=i,Ds(a))}return cn(a),null;case 5:if(Ae(a),b=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==m&&Ds(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return cn(a),null}if(x=ne.current,vl(a))B1(a);else{var T=Xh(Z.current);switch(x){case 1:x=T.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:x=T.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":x=T.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":x=T.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":x=T.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof m.is=="string"?T.createElement("select",{is:m.is}):T.createElement("select"),m.multiple?x.multiple=!0:m.size&&(x.size=m.size);break;default:x=typeof m.is=="string"?T.createElement(b,{is:m.is}):T.createElement(b)}}x[It]=a,x[Cn]=m;e:for(T=a.child;T!==null;){if(T.tag===5||T.tag===6)x.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===a)break e;for(;T.sibling===null;){if(T.return===null||T.return===a)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}a.stateNode=x;e:switch(lr(x,b,m),b){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&Ds(a)}}return cn(a),lv(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,c),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==m&&Ds(a);else{if(typeof m!="string"&&a.stateNode===null)throw Error(r(166));if(i=Z.current,vl(a)){if(i=a.stateNode,c=a.memoizedProps,m=null,b=sr,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}i[It]=a,i=!!(i.nodeValue===c||m!==null&&m.suppressHydrationWarning===!0||tC(i.nodeValue,c)),i||po(a,!0)}else i=Xh(i).createTextNode(m),i[It]=a,a.stateNode=i}return cn(a),null;case 31:if(c=a.memoizedState,i===null||i.memoizedState!==null){if(m=vl(a),c!==null){if(i===null){if(!m)throw Error(r(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[It]=a}else ha(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;cn(a),i=!1}else c=_g(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return a.flags&256?(Yr(a),a):(Yr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return cn(a),null;case 13:if(m=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(b=vl(a),m!==null&&m.dehydrated!==null){if(i===null){if(!b)throw Error(r(318));if(b=a.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[It]=a}else ha(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;cn(a),b=!1}else b=_g(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=b),b=!0;if(!b)return a.flags&256?(Yr(a),a):(Yr(a),null)}return Yr(a),(a.flags&128)!==0?(a.lanes=c,a):(c=m!==null,i=i!==null&&i.memoizedState!==null,c&&(m=a.child,b=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(b=m.alternate.memoizedState.cachePool.pool),x=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(x=m.memoizedState.cachePool.pool),x!==b&&(m.flags|=2048)),c!==i&&c&&(a.child.flags|=8192),Lh(a,a.updateQueue),cn(a),null);case 4:return me(),i===null&&Nv(a.stateNode.containerInfo),cn(a),null;case 10:return Ts(a.type),cn(a),null;case 19:if(X(kn),m=a.memoizedState,m===null)return cn(a),null;if(b=(a.flags&128)!==0,x=m.rendering,x===null)if(b)tu(m,!1);else{if(bn!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(x=wh(i),x!==null){for(a.flags|=128,tu(m,!1),i=x.updateQueue,a.updateQueue=i,Lh(a,i),a.subtreeFlags=0,i=c,c=a.child;c!==null;)j1(c,i),c=c.sibling;return A(kn,kn.current&1|2),Dt&&Es(a,m.treeForkCount),a.child}i=i.sibling}m.tail!==null&&Se()>Hh&&(a.flags|=128,b=!0,tu(m,!1),a.lanes=4194304)}else{if(!b)if(i=wh(x),i!==null){if(a.flags|=128,b=!0,i=i.updateQueue,a.updateQueue=i,Lh(a,i),tu(m,!0),m.tail===null&&m.tailMode==="hidden"&&!x.alternate&&!Dt)return cn(a),null}else 2*Se()-m.renderingStartTime>Hh&&c!==536870912&&(a.flags|=128,b=!0,tu(m,!1),a.lanes=4194304);m.isBackwards?(x.sibling=a.child,a.child=x):(i=m.last,i!==null?i.sibling=x:a.child=x,m.last=x)}return m.tail!==null?(i=m.tail,m.rendering=i,m.tail=i.sibling,m.renderingStartTime=Se(),i.sibling=null,c=kn.current,A(kn,b?c&1|2:c&1),Dt&&Es(a,m.treeForkCount),i):(cn(a),null);case 22:case 23:return Yr(a),Ag(),m=a.memoizedState!==null,i!==null?i.memoizedState!==null!==m&&(a.flags|=8192):m&&(a.flags|=8192),m?(c&536870912)!==0&&(a.flags&128)===0&&(cn(a),a.subtreeFlags&6&&(a.flags|=8192)):cn(a),c=a.updateQueue,c!==null&&Lh(a,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==c&&(a.flags|=2048),i!==null&&X(pa),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Ts(Dn),cn(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function g4(i,a){switch(gg(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return Ts(Dn),me(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return Ae(a),null;case 31:if(a.memoizedState!==null){if(Yr(a),a.alternate===null)throw Error(r(340));ha()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(Yr(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(r(340));ha()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return X(kn),null;case 4:return me(),null;case 10:return Ts(a.type),null;case 22:case 23:return Yr(a),Ag(),i!==null&&X(pa),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return Ts(Dn),null;case 25:return null;default:return null}}function oS(i,a){switch(gg(a),a.tag){case 3:Ts(Dn),me();break;case 26:case 27:case 5:Ae(a);break;case 4:me();break;case 31:a.memoizedState!==null&&Yr(a);break;case 13:Yr(a);break;case 19:X(kn);break;case 10:Ts(a.type);break;case 22:case 23:Yr(a),Ag(),i!==null&&X(pa);break;case 24:Ts(Dn)}}function nu(i,a){try{var c=a.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var b=m.next;c=b;do{if((c.tag&i)===i){m=void 0;var x=c.create,T=c.inst;m=x(),T.destroy=m}c=c.next}while(c!==b)}}catch(z){Gt(a,a.return,z)}}function wo(i,a,c){try{var m=a.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var x=b.next;m=x;do{if((m.tag&i)===i){var T=m.inst,z=T.destroy;if(z!==void 0){T.destroy=void 0,b=a;var Q=c,oe=z;try{oe()}catch(fe){Gt(b,Q,fe)}}}m=m.next}while(m!==x)}}catch(fe){Gt(a,a.return,fe)}}function aS(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{Z1(a,c)}catch(m){Gt(i,i.return,m)}}}function lS(i,a,c){c.props=ya(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(m){Gt(i,a,m)}}function ru(i,a){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var m=i.stateNode;break;case 30:m=i.stateNode;break;default:m=i.stateNode}typeof c=="function"?i.refCleanup=c(m):c.current=m}}catch(b){Gt(i,a,b)}}function Ji(i,a){var c=i.ref,m=i.refCleanup;if(c!==null)if(typeof m=="function")try{m()}catch(b){Gt(i,a,b)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){Gt(i,a,b)}else c.current=null}function cS(i){var a=i.type,c=i.memoizedProps,m=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&m.focus();break e;case"img":c.src?m.src=c.src:c.srcSet&&(m.srcset=c.srcSet)}}catch(b){Gt(i,i.return,b)}}function cv(i,a,c){try{var m=i.stateNode;B4(m,i.type,c,a),m[Cn]=a}catch(b){Gt(i,i.return,b)}}function uS(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Mo(i.type)||i.tag===4}function uv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||uS(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&&Mo(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 dv(i,a,c){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(i),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Ss));else if(m!==4&&(m===27&&Mo(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(dv(i,a,c),i=i.sibling;i!==null;)dv(i,a,c),i=i.sibling}function zh(i,a,c){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(m!==4&&(m===27&&Mo(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(zh(i,a,c),i=i.sibling;i!==null;)zh(i,a,c),i=i.sibling}function dS(i){var a=i.stateNode,c=i.memoizedProps;try{for(var m=i.type,b=a.attributes;b.length;)a.removeAttributeNode(b[0]);lr(a,m,c),a[It]=i,a[Cn]=c}catch(x){Gt(i,i.return,x)}}var js=!1,Ln=!1,hv=!1,hS=typeof WeakSet=="function"?WeakSet:Set,Gn=null;function v4(i,a){if(i=i.containerInfo,jv=rf,i=C1(i),sg(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var b=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var T=0,z=-1,Q=-1,oe=0,fe=0,ve=i,ue=null;t:for(;;){for(var de;ve!==c||b!==0&&ve.nodeType!==3||(z=T+b),ve!==x||m!==0&&ve.nodeType!==3||(Q=T+m),ve.nodeType===3&&(T+=ve.nodeValue.length),(de=ve.firstChild)!==null;)ue=ve,ve=de;for(;;){if(ve===i)break t;if(ue===c&&++oe===b&&(z=T),ue===x&&++fe===m&&(Q=T),(de=ve.nextSibling)!==null)break;ve=ue,ue=ve.parentNode}ve=de}c=z===-1||Q===-1?null:{start:z,end:Q}}else c=null}c=c||{start:0,end:0}}else c=null;for(Ov={focusedElem:i,selectionRange:c},rf=!1,Gn=a;Gn!==null;)if(a=Gn,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,Gn=i;else for(;Gn!==null;){switch(a=Gn,x=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)b=i[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&x!==null){i=void 0,c=a,b=x.memoizedProps,x=x.memoizedState,m=c.stateNode;try{var We=ya(c.type,b);i=m.getSnapshotBeforeUpdate(We,x),m.__reactInternalSnapshotBeforeUpdate=i}catch(nt){Gt(c,c.return,nt)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,c=i.nodeType,c===9)Pv(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Pv(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=a.sibling,i!==null){i.return=a.return,Gn=i;break}Gn=a.return}}function fS(i,a,c){var m=c.flags;switch(c.tag){case 0:case 11:case 15:Ls(i,c),m&4&&nu(5,c);break;case 1:if(Ls(i,c),m&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(T){Gt(c,c.return,T)}else{var b=ya(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(b,a,i.__reactInternalSnapshotBeforeUpdate)}catch(T){Gt(c,c.return,T)}}m&64&&aS(c),m&512&&ru(c,c.return);break;case 3:if(Ls(i,c),m&64&&(i=c.updateQueue,i!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{Z1(i,a)}catch(T){Gt(c,c.return,T)}}break;case 27:a===null&&m&4&&dS(c);case 26:case 5:Ls(i,c),a===null&&m&4&&cS(c),m&512&&ru(c,c.return);break;case 12:Ls(i,c);break;case 31:Ls(i,c),m&4&&gS(i,c);break;case 13:Ls(i,c),m&4&&vS(i,c),m&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=E4.bind(null,c),q4(i,c))));break;case 22:if(m=c.memoizedState!==null||js,!m){a=a!==null&&a.memoizedState!==null||Ln,b=js;var x=Ln;js=m,(Ln=a)&&!x?zs(i,c,(c.subtreeFlags&8772)!==0):Ls(i,c),js=b,Ln=x}break;case 30:break;default:Ls(i,c)}}function mS(i){var a=i.alternate;a!==null&&(i.alternate=null,mS(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&Ac(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var dn=null,Or=!1;function Os(i,a,c){for(c=c.child;c!==null;)pS(i,a,c),c=c.sibling}function pS(i,a,c){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount(rt,c)}catch{}switch(c.tag){case 26:Ln||Ji(c,a),Os(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Ln||Ji(c,a);var m=dn,b=Or;Mo(c.type)&&(dn=c.stateNode,Or=!1),Os(i,a,c),hu(c.stateNode),dn=m,Or=b;break;case 5:Ln||Ji(c,a);case 6:if(m=dn,b=Or,dn=null,Os(i,a,c),dn=m,Or=b,dn!==null)if(Or)try{(dn.nodeType===9?dn.body:dn.nodeName==="HTML"?dn.ownerDocument.body:dn).removeChild(c.stateNode)}catch(x){Gt(c,a,x)}else try{dn.removeChild(c.stateNode)}catch(x){Gt(c,a,x)}break;case 18:dn!==null&&(Or?(i=dn,aC(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Bl(i)):aC(dn,c.stateNode));break;case 4:m=dn,b=Or,dn=c.stateNode.containerInfo,Or=!0,Os(i,a,c),dn=m,Or=b;break;case 0:case 11:case 14:case 15:wo(2,c,a),Ln||wo(4,c,a),Os(i,a,c);break;case 1:Ln||(Ji(c,a),m=c.stateNode,typeof m.componentWillUnmount=="function"&&lS(c,a,m)),Os(i,a,c);break;case 21:Os(i,a,c);break;case 22:Ln=(m=Ln)||c.memoizedState!==null,Os(i,a,c),Ln=m;break;default:Os(i,a,c)}}function gS(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Bl(i)}catch(c){Gt(a,a.return,c)}}}function vS(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Bl(i)}catch(c){Gt(a,a.return,c)}}function _4(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new hS),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new hS),a;default:throw Error(r(435,i.tag))}}function Ph(i,a){var c=_4(i);a.forEach(function(m){if(!c.has(m)){c.add(m);var b=R4.bind(null,i,m);m.then(b,b)}})}function Lr(i,a){var c=a.deletions;if(c!==null)for(var m=0;m<c.length;m++){var b=c[m],x=i,T=a,z=T;e:for(;z!==null;){switch(z.tag){case 27:if(Mo(z.type)){dn=z.stateNode,Or=!1;break e}break;case 5:dn=z.stateNode,Or=!1;break e;case 3:case 4:dn=z.stateNode.containerInfo,Or=!0;break e}z=z.return}if(dn===null)throw Error(r(160));pS(x,T,b),dn=null,Or=!1,x=b.alternate,x!==null&&(x.return=null),b.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)_S(a,i),a=a.sibling}var ji=null;function _S(i,a){var c=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Lr(a,i),zr(i),m&4&&(wo(3,i,i.return),nu(3,i),wo(5,i,i.return));break;case 1:Lr(a,i),zr(i),m&512&&(Ln||c===null||Ji(c,c.return)),m&64&&js&&(i=i.updateQueue,i!==null&&(m=i.callbacks,m!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?m:c.concat(m))));break;case 26:var b=ji;if(Lr(a,i),zr(i),m&512&&(Ln||c===null||Ji(c,c.return)),m&4){var x=c!==null?c.memoizedState:null;if(m=i.memoizedState,c===null)if(m===null)if(i.stateNode===null){e:{m=i.type,c=i.memoizedProps,b=b.ownerDocument||b;t:switch(m){case"title":x=b.getElementsByTagName("title")[0],(!x||x[sa]||x[It]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=b.createElement(m),b.head.insertBefore(x,b.querySelector("head > title"))),lr(x,m,c),x[It]=i,An(x),m=x;break e;case"link":var T=_C("link","href",b).get(m+(c.href||""));if(T){for(var z=0;z<T.length;z++)if(x=T[z],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){T.splice(z,1);break t}}x=b.createElement(m),lr(x,m,c),b.head.appendChild(x);break;case"meta":if(T=_C("meta","content",b).get(m+(c.content||""))){for(z=0;z<T.length;z++)if(x=T[z],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){T.splice(z,1);break t}}x=b.createElement(m),lr(x,m,c),b.head.appendChild(x);break;default:throw Error(r(468,m))}x[It]=i,An(x),m=x}i.stateNode=m}else bC(b,i.type,i.stateNode);else i.stateNode=vC(b,m,i.memoizedProps);else x!==m?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,m===null?bC(b,i.type,i.stateNode):vC(b,m,i.memoizedProps)):m===null&&i.stateNode!==null&&cv(i,i.memoizedProps,c.memoizedProps)}break;case 27:Lr(a,i),zr(i),m&512&&(Ln||c===null||Ji(c,c.return)),c!==null&&m&4&&cv(i,i.memoizedProps,c.memoizedProps);break;case 5:if(Lr(a,i),zr(i),m&512&&(Ln||c===null||Ji(c,c.return)),i.flags&32){b=i.stateNode;try{al(b,"")}catch(We){Gt(i,i.return,We)}}m&4&&i.stateNode!=null&&(b=i.memoizedProps,cv(i,b,c!==null?c.memoizedProps:b)),m&1024&&(hv=!0);break;case 6:if(Lr(a,i),zr(i),m&4){if(i.stateNode===null)throw Error(r(162));m=i.memoizedProps,c=i.stateNode;try{c.nodeValue=m}catch(We){Gt(i,i.return,We)}}break;case 3:if(Jh=null,b=ji,ji=Zh(a.containerInfo),Lr(a,i),ji=b,zr(i),m&4&&c!==null&&c.memoizedState.isDehydrated)try{Bl(a.containerInfo)}catch(We){Gt(i,i.return,We)}hv&&(hv=!1,bS(i));break;case 4:m=ji,ji=Zh(i.stateNode.containerInfo),Lr(a,i),zr(i),ji=m;break;case 12:Lr(a,i),zr(i);break;case 31:Lr(a,i),zr(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,Ph(i,m)));break;case 13:Lr(a,i),zr(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Ih=Se()),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,Ph(i,m)));break;case 22:b=i.memoizedState!==null;var Q=c!==null&&c.memoizedState!==null,oe=js,fe=Ln;if(js=oe||b,Ln=fe||Q,Lr(a,i),Ln=fe,js=oe,zr(i),m&8192)e:for(a=i.stateNode,a._visibility=b?a._visibility&-2:a._visibility|1,b&&(c===null||Q||js||Ln||xa(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){Q=c=a;try{if(x=Q.stateNode,b)T=x.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{z=Q.stateNode;var ve=Q.memoizedProps.style,ue=ve!=null&&ve.hasOwnProperty("display")?ve.display:null;z.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(We){Gt(Q,Q.return,We)}}}else if(a.tag===6){if(c===null){Q=a;try{Q.stateNode.nodeValue=b?"":Q.memoizedProps}catch(We){Gt(Q,Q.return,We)}}}else if(a.tag===18){if(c===null){Q=a;try{var de=Q.stateNode;b?lC(de,!0):lC(Q.stateNode,!1)}catch(We){Gt(Q,Q.return,We)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}m&4&&(m=i.updateQueue,m!==null&&(c=m.retryQueue,c!==null&&(m.retryQueue=null,Ph(i,c))));break;case 19:Lr(a,i),zr(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,Ph(i,m)));break;case 30:break;case 21:break;default:Lr(a,i),zr(i)}}function zr(i){var a=i.flags;if(a&2){try{for(var c,m=i.return;m!==null;){if(uS(m)){c=m;break}m=m.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var b=c.stateNode,x=uv(i);zh(i,x,b);break;case 5:var T=c.stateNode;c.flags&32&&(al(T,""),c.flags&=-33);var z=uv(i);zh(i,z,T);break;case 3:case 4:var Q=c.stateNode.containerInfo,oe=uv(i);dv(i,oe,Q);break;default:throw Error(r(161))}}catch(fe){Gt(i,i.return,fe)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function bS(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;bS(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function Ls(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)fS(i,a.alternate,a),a=a.sibling}function xa(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:wo(4,a,a.return),xa(a);break;case 1:Ji(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&lS(a,a.return,c),xa(a);break;case 27:hu(a.stateNode);case 26:case 5:Ji(a,a.return),xa(a);break;case 22:a.memoizedState===null&&xa(a);break;case 30:xa(a);break;default:xa(a)}i=i.sibling}}function zs(i,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var m=a.alternate,b=i,x=a,T=x.flags;switch(x.tag){case 0:case 11:case 15:zs(b,x,c),nu(4,x);break;case 1:if(zs(b,x,c),m=x,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(oe){Gt(m,m.return,oe)}if(m=x,b=m.updateQueue,b!==null){var z=m.stateNode;try{var Q=b.shared.hiddenCallbacks;if(Q!==null)for(b.shared.hiddenCallbacks=null,b=0;b<Q.length;b++)X1(Q[b],z)}catch(oe){Gt(m,m.return,oe)}}c&&T&64&&aS(x),ru(x,x.return);break;case 27:dS(x);case 26:case 5:zs(b,x,c),c&&m===null&&T&4&&cS(x),ru(x,x.return);break;case 12:zs(b,x,c);break;case 31:zs(b,x,c),c&&T&4&&gS(b,x);break;case 13:zs(b,x,c),c&&T&4&&vS(b,x);break;case 22:x.memoizedState===null&&zs(b,x,c),ru(x,x.return);break;case 30:break;default:zs(b,x,c)}a=a.sibling}}function fv(i,a){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&$c(c))}function mv(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&$c(i))}function Oi(i,a,c,m){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)yS(i,a,c,m),a=a.sibling}function yS(i,a,c,m){var b=a.flags;switch(a.tag){case 0:case 11:case 15:Oi(i,a,c,m),b&2048&&nu(9,a);break;case 1:Oi(i,a,c,m);break;case 3:Oi(i,a,c,m),b&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&$c(i)));break;case 12:if(b&2048){Oi(i,a,c,m),i=a.stateNode;try{var x=a.memoizedProps,T=x.id,z=x.onPostCommit;typeof z=="function"&&z(T,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(Q){Gt(a,a.return,Q)}}else Oi(i,a,c,m);break;case 31:Oi(i,a,c,m);break;case 13:Oi(i,a,c,m);break;case 23:break;case 22:x=a.stateNode,T=a.alternate,a.memoizedState!==null?x._visibility&2?Oi(i,a,c,m):iu(i,a):x._visibility&2?Oi(i,a,c,m):(x._visibility|=2,Rl(i,a,c,m,(a.subtreeFlags&10256)!==0||!1)),b&2048&&fv(T,a);break;case 24:Oi(i,a,c,m),b&2048&&mv(a.alternate,a);break;default:Oi(i,a,c,m)}}function Rl(i,a,c,m,b){for(b=b&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=i,T=a,z=c,Q=m,oe=T.flags;switch(T.tag){case 0:case 11:case 15:Rl(x,T,z,Q,b),nu(8,T);break;case 23:break;case 22:var fe=T.stateNode;T.memoizedState!==null?fe._visibility&2?Rl(x,T,z,Q,b):iu(x,T):(fe._visibility|=2,Rl(x,T,z,Q,b)),b&&oe&2048&&fv(T.alternate,T);break;case 24:Rl(x,T,z,Q,b),b&&oe&2048&&mv(T.alternate,T);break;default:Rl(x,T,z,Q,b)}a=a.sibling}}function iu(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=i,m=a,b=m.flags;switch(m.tag){case 22:iu(c,m),b&2048&&fv(m.alternate,m);break;case 24:iu(c,m),b&2048&&mv(m.alternate,m);break;default:iu(c,m)}a=a.sibling}}var su=8192;function Tl(i,a,c){if(i.subtreeFlags&su)for(i=i.child;i!==null;)xS(i,a,c),i=i.sibling}function xS(i,a,c){switch(i.tag){case 26:Tl(i,a,c),i.flags&su&&i.memoizedState!==null&&iO(c,ji,i.memoizedState,i.memoizedProps);break;case 5:Tl(i,a,c);break;case 3:case 4:var m=ji;ji=Zh(i.stateNode.containerInfo),Tl(i,a,c),ji=m;break;case 22:i.memoizedState===null&&(m=i.alternate,m!==null&&m.memoizedState!==null?(m=su,su=16777216,Tl(i,a,c),su=m):Tl(i,a,c));break;default:Tl(i,a,c)}}function wS(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function ou(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var m=a[c];Gn=m,CS(m,i)}wS(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)SS(i),i=i.sibling}function SS(i){switch(i.tag){case 0:case 11:case 15:ou(i),i.flags&2048&&wo(9,i,i.return);break;case 3:ou(i);break;case 12:ou(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,Bh(i)):ou(i);break;default:ou(i)}}function Bh(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var m=a[c];Gn=m,CS(m,i)}wS(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:wo(8,a,a.return),Bh(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Bh(a));break;default:Bh(a)}i=i.sibling}}function CS(i,a){for(;Gn!==null;){var c=Gn;switch(c.tag){case 0:case 11:case 15:wo(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var m=c.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:$c(c.memoizedState.cache)}if(m=c.child,m!==null)m.return=c,Gn=m;else e:for(c=i;Gn!==null;){m=Gn;var b=m.sibling,x=m.return;if(mS(m),m===c){Gn=null;break e}if(b!==null){b.return=x,Gn=b;break e}Gn=x}}}var b4={getCacheForType:function(i){var a=or(Dn),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c},cacheSignal:function(){return or(Dn).controller.signal}},y4=typeof WeakMap=="function"?WeakMap:Map,Ht=0,nn=null,Ct=null,Nt=0,Kt=0,Xr=null,So=!1,Ml=!1,pv=!1,Ps=0,bn=0,Co=0,wa=0,gv=0,Zr=0,Nl=0,au=null,Pr=null,vv=!1,Ih=0,kS=0,Hh=1/0,Fh=null,ko=null,In=0,Eo=null,Al=null,Bs=0,_v=0,bv=null,ES=null,lu=0,yv=null;function Qr(){return(Ht&2)!==0&&Nt!==0?Nt&-Nt:O.T!==null?Ev():sn()}function RS(){if(Zr===0)if((Nt&536870912)===0||Dt){var i=Kn;Kn<<=1,(Kn&3932160)===0&&(Kn=262144),Zr=i}else Zr=536870912;return i=Gr.current,i!==null&&(i.flags|=32),Zr}function Br(i,a,c){(i===nn&&(Kt===2||Kt===9)||i.cancelPendingCommit!==null)&&(Dl(i,0),Ro(i,Nt,Zr,!1)),Ce(i,c),((Ht&2)===0||i!==nn)&&(i===nn&&((Ht&2)===0&&(wa|=c),bn===4&&Ro(i,Nt,Zr,!1)),es(i))}function TS(i,a,c){if((Ht&6)!==0)throw Error(r(327));var m=!c&&(a&127)===0&&(a&i.expiredLanes)===0||ct(i,a),b=m?S4(i,a):wv(i,a,!0),x=m;do{if(b===0){Ml&&!m&&Ro(i,a,0,!1);break}else{if(c=i.current.alternate,x&&!x4(c)){b=wv(i,a,!1),x=!1;continue}if(b===2){if(x=a,i.errorRecoveryDisabledLanes&x)var T=0;else T=i.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){a=T;e:{var z=i;b=au;var Q=z.current.memoizedState.isDehydrated;if(Q&&(Dl(z,T).flags|=256),T=wv(z,T,!1),T!==2){if(pv&&!Q){z.errorRecoveryDisabledLanes|=x,wa|=x,b=4;break e}x=Pr,Pr=b,x!==null&&(Pr===null?Pr=x:Pr.push.apply(Pr,x))}b=T}if(x=!1,b!==2)continue}}if(b===1){Dl(i,0),Ro(i,a,0,!0);break}e:{switch(m=i,x=b,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Ro(m,a,Zr,!So);break e;case 2:Pr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(b=Ih+300-Se(),10<b)){if(Ro(m,a,Zr,!So),Fe(m,0,!0)!==0)break e;Bs=a,m.timeoutHandle=sC(MS.bind(null,m,c,Pr,Fh,vv,a,Zr,wa,Nl,So,x,"Throttled",-0,0),b);break e}MS(m,c,Pr,Fh,vv,a,Zr,wa,Nl,So,x,null,-0,0)}}break}while(!0);es(i)}function MS(i,a,c,m,b,x,T,z,Q,oe,fe,ve,ue,de){if(i.timeoutHandle=-1,ve=a.subtreeFlags,ve&8192||(ve&16785408)===16785408){ve={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ss},xS(a,x,ve);var We=(x&62914560)===x?Ih-Se():(x&4194048)===x?kS-Se():0;if(We=sO(ve,We),We!==null){Bs=x,i.cancelPendingCommit=We(PS.bind(null,i,a,x,c,m,b,T,z,Q,fe,ve,null,ue,de)),Ro(i,x,T,!oe);return}}PS(i,a,x,c,m,b,T,z,Q)}function x4(i){for(var a=i;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var m=0;m<c.length;m++){var b=c[m],x=b.getSnapshot;b=b.value;try{if(!qr(x(),b))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ro(i,a,c,m){a&=~gv,a&=~wa,i.suspendedLanes|=a,i.pingedLanes&=~a,m&&(i.warmLanes|=a),m=i.expirationTimes;for(var b=a;0<b;){var x=31-at(b),T=1<<x;m[x]=-1,b&=~T}c!==0&>(i,c,a)}function Uh(){return(Ht&6)===0?(cu(0),!1):!0}function xv(){if(Ct!==null){if(Kt===0)var i=Ct.return;else i=Ct,Rs=fa=null,Pg(i),wl=null,Vc=0,i=Ct;for(;i!==null;)oS(i.alternate,i),i=i.return;Ct=null}}function Dl(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,F4(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),Bs=0,xv(),nn=i,Ct=c=ks(i.current,null),Nt=a,Kt=0,Xr=null,So=!1,Ml=ct(i,a),pv=!1,Nl=Zr=gv=wa=Co=bn=0,Pr=au=null,vv=!1,(a&8)!==0&&(a|=a&32);var m=i.entangledLanes;if(m!==0)for(i=i.entanglements,m&=a;0<m;){var b=31-at(m),x=1<<b;a|=i[b],m&=~x}return Ps=a,ch(),c}function NS(i,a){ut=null,O.H=Jc,a===xl||a===vh?(a=q1(),Kt=3):a===kg?(a=q1(),Kt=4):Kt=a===Jg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Xr=a,Ct===null&&(bn=1,Ah(i,di(a,i.current)))}function AS(){var i=Gr.current;return i===null?!0:(Nt&4194048)===Nt?pi===null:(Nt&62914560)===Nt||(Nt&536870912)!==0?i===pi:!1}function DS(){var i=O.H;return O.H=Jc,i===null?Jc:i}function jS(){var i=O.A;return O.A=b4,i}function $h(){bn=4,So||(Nt&4194048)!==Nt&&Gr.current!==null||(Ml=!0),(Co&134217727)===0&&(wa&134217727)===0||nn===null||Ro(nn,Nt,Zr,!1)}function wv(i,a,c){var m=Ht;Ht|=2;var b=DS(),x=jS();(nn!==i||Nt!==a)&&(Fh=null,Dl(i,a)),a=!1;var T=bn;e:do try{if(Kt!==0&&Ct!==null){var z=Ct,Q=Xr;switch(Kt){case 8:xv(),T=6;break e;case 3:case 2:case 9:case 6:Gr.current===null&&(a=!0);var oe=Kt;if(Kt=0,Xr=null,jl(i,z,Q,oe),c&&Ml){T=0;break e}break;default:oe=Kt,Kt=0,Xr=null,jl(i,z,Q,oe)}}w4(),T=bn;break}catch(fe){NS(i,fe)}while(!0);return a&&i.shellSuspendCounter++,Rs=fa=null,Ht=m,O.H=b,O.A=x,Ct===null&&(nn=null,Nt=0,ch()),T}function w4(){for(;Ct!==null;)OS(Ct)}function S4(i,a){var c=Ht;Ht|=2;var m=DS(),b=jS();nn!==i||Nt!==a?(Fh=null,Hh=Se()+500,Dl(i,a)):Ml=ct(i,a);e:do try{if(Kt!==0&&Ct!==null){a=Ct;var x=Xr;t:switch(Kt){case 1:Kt=0,Xr=null,jl(i,a,x,1);break;case 2:case 9:if(W1(x)){Kt=0,Xr=null,LS(a);break}a=function(){Kt!==2&&Kt!==9||nn!==i||(Kt=7),es(i)},x.then(a,a);break e;case 3:Kt=7;break e;case 4:Kt=5;break e;case 7:W1(x)?(Kt=0,Xr=null,LS(a)):(Kt=0,Xr=null,jl(i,a,x,7));break;case 5:var T=null;switch(Ct.tag){case 26:T=Ct.memoizedState;case 5:case 27:var z=Ct;if(T?yC(T):z.stateNode.complete){Kt=0,Xr=null;var Q=z.sibling;if(Q!==null)Ct=Q;else{var oe=z.return;oe!==null?(Ct=oe,Wh(oe)):Ct=null}break t}}Kt=0,Xr=null,jl(i,a,x,5);break;case 6:Kt=0,Xr=null,jl(i,a,x,6);break;case 8:xv(),bn=6;break e;default:throw Error(r(462))}}C4();break}catch(fe){NS(i,fe)}while(!0);return Rs=fa=null,O.H=m,O.A=b,Ht=c,Ct!==null?0:(nn=null,Nt=0,ch(),bn)}function C4(){for(;Ct!==null&&!$e();)OS(Ct)}function OS(i){var a=iS(i.alternate,i,Ps);i.memoizedProps=i.pendingProps,a===null?Wh(i):Ct=a}function LS(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=Qw(c,a,a.pendingProps,a.type,void 0,Nt);break;case 11:a=Qw(c,a,a.pendingProps,a.type.render,a.ref,Nt);break;case 5:Pg(a);default:oS(c,a),a=Ct=j1(a,Ps),a=iS(c,a,Ps)}i.memoizedProps=i.pendingProps,a===null?Wh(i):Ct=a}function jl(i,a,c,m){Rs=fa=null,Pg(a),wl=null,Vc=0;var b=a.return;try{if(h4(i,b,a,c,Nt)){bn=1,Ah(i,di(c,i.current)),Ct=null;return}}catch(x){if(b!==null)throw Ct=b,x;bn=1,Ah(i,di(c,i.current)),Ct=null;return}a.flags&32768?(Dt||m===1?i=!0:Ml||(Nt&536870912)!==0?i=!1:(So=i=!0,(m===2||m===9||m===3||m===6)&&(m=Gr.current,m!==null&&m.tag===13&&(m.flags|=16384))),zS(a,i)):Wh(a)}function Wh(i){var a=i;do{if((a.flags&32768)!==0){zS(a,So);return}i=a.return;var c=p4(a.alternate,a,Ps);if(c!==null){Ct=c;return}if(a=a.sibling,a!==null){Ct=a;return}Ct=a=i}while(a!==null);bn===0&&(bn=5)}function zS(i,a){do{var c=g4(i.alternate,i);if(c!==null){c.flags&=32767,Ct=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){Ct=i;return}Ct=i=c}while(i!==null);bn=6,Ct=null}function PS(i,a,c,m,b,x,T,z,Q){i.cancelPendingCommit=null;do Vh();while(In!==0);if((Ht&6)!==0)throw Error(r(327));if(a!==null){if(a===i.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=ug,Te(i,c,x,T,z,Q),i===nn&&(Ct=nn=null,Nt=0),Al=a,Eo=i,Bs=c,_v=x,bv=b,ES=m,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,T4(Oe,function(){return US(),null})):(i.callbackNode=null,i.callbackPriority=0),m=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||m){m=O.T,O.T=null,b=H.p,H.p=2,T=Ht,Ht|=4;try{v4(i,a,c)}finally{Ht=T,H.p=b,O.T=m}}In=1,BS(),IS(),HS()}}function BS(){if(In===1){In=0;var i=Eo,a=Al,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=O.T,O.T=null;var m=H.p;H.p=2;var b=Ht;Ht|=4;try{_S(a,i);var x=Ov,T=C1(i.containerInfo),z=x.focusedElem,Q=x.selectionRange;if(T!==z&&z&&z.ownerDocument&&S1(z.ownerDocument.documentElement,z)){if(Q!==null&&sg(z)){var oe=Q.start,fe=Q.end;if(fe===void 0&&(fe=oe),"selectionStart"in z)z.selectionStart=oe,z.selectionEnd=Math.min(fe,z.value.length);else{var ve=z.ownerDocument||document,ue=ve&&ve.defaultView||window;if(ue.getSelection){var de=ue.getSelection(),We=z.textContent.length,nt=Math.min(Q.start,We),Zt=Q.end===void 0?nt:Math.min(Q.end,We);!de.extend&&nt>Zt&&(T=Zt,Zt=nt,nt=T);var re=w1(z,nt),ee=w1(z,Zt);if(re&&ee&&(de.rangeCount!==1||de.anchorNode!==re.node||de.anchorOffset!==re.offset||de.focusNode!==ee.node||de.focusOffset!==ee.offset)){var se=ve.createRange();se.setStart(re.node,re.offset),de.removeAllRanges(),nt>Zt?(de.addRange(se),de.extend(ee.node,ee.offset)):(se.setEnd(ee.node,ee.offset),de.addRange(se))}}}}for(ve=[],de=z;de=de.parentNode;)de.nodeType===1&&ve.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<ve.length;z++){var ge=ve[z];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}rf=!!jv,Ov=jv=null}finally{Ht=b,H.p=m,O.T=c}}i.current=a,In=2}}function IS(){if(In===2){In=0;var i=Eo,a=Al,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=O.T,O.T=null;var m=H.p;H.p=2;var b=Ht;Ht|=4;try{fS(i,a.alternate,a)}finally{Ht=b,H.p=m,O.T=c}}In=3}}function HS(){if(In===4||In===3){In=0,pt();var i=Eo,a=Al,c=Bs,m=ES;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?In=5:(In=0,Al=Eo=null,FS(i,i.pendingLanes));var b=i.pendingLanes;if(b===0&&(ko=null),Ot(c),a=a.stateNode,Le&&typeof Le.onCommitFiberRoot=="function")try{Le.onCommitFiberRoot(rt,a,void 0,(a.current.flags&128)===128)}catch{}if(m!==null){a=O.T,b=H.p,H.p=2,O.T=null;try{for(var x=i.onRecoverableError,T=0;T<m.length;T++){var z=m[T];x(z.value,{componentStack:z.stack})}}finally{O.T=a,H.p=b}}(Bs&3)!==0&&Vh(),es(i),b=i.pendingLanes,(c&261930)!==0&&(b&42)!==0?i===yv?lu++:(lu=0,yv=i):lu=0,cu(0)}}function FS(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,$c(a)))}function Vh(){return BS(),IS(),HS(),US()}function US(){if(In!==5)return!1;var i=Eo,a=_v;_v=0;var c=Ot(Bs),m=O.T,b=H.p;try{H.p=32>c?32:c,O.T=null,c=bv,bv=null;var x=Eo,T=Bs;if(In=0,Al=Eo=null,Bs=0,(Ht&6)!==0)throw Error(r(331));var z=Ht;if(Ht|=4,SS(x.current),yS(x,x.current,T,c),Ht=z,cu(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(rt,x)}catch{}return!0}finally{H.p=b,O.T=m,FS(i,a)}}function $S(i,a,c){a=di(c,a),a=Qg(i.stateNode,a,2),i=bo(i,a,2),i!==null&&(Ce(i,2),es(i))}function Gt(i,a,c){if(i.tag===3)$S(i,i,c);else for(;a!==null;){if(a.tag===3){$S(a,i,c);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(ko===null||!ko.has(m))){i=di(c,i),c=Ww(2),m=bo(a,c,2),m!==null&&(Vw(c,m,a,i),Ce(m,2),es(m));break}}a=a.return}}function Sv(i,a,c){var m=i.pingCache;if(m===null){m=i.pingCache=new y4;var b=new Set;m.set(a,b)}else b=m.get(a),b===void 0&&(b=new Set,m.set(a,b));b.has(c)||(pv=!0,b.add(c),i=k4.bind(null,i,a,c),a.then(i,i))}function k4(i,a,c){var m=i.pingCache;m!==null&&m.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,nn===i&&(Nt&c)===c&&(bn===4||bn===3&&(Nt&62914560)===Nt&&300>Se()-Ih?(Ht&2)===0&&Dl(i,0):gv|=c,Nl===Nt&&(Nl=0)),es(i)}function WS(i,a){a===0&&(a=mt()),i=ua(i,a),i!==null&&(Ce(i,a),es(i))}function E4(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),WS(i,c)}function R4(i,a){var c=0;switch(i.tag){case 31:case 13:var m=i.stateNode,b=i.memoizedState;b!==null&&(c=b.retryLane);break;case 19:m=i.stateNode;break;case 22:m=i.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(a),WS(i,c)}function T4(i,a){return tt(i,a)}var qh=null,Ol=null,Cv=!1,Kh=!1,kv=!1,To=0;function es(i){i!==Ol&&i.next===null&&(Ol===null?qh=Ol=i:Ol=Ol.next=i),Kh=!0,Cv||(Cv=!0,N4())}function cu(i,a){if(!kv&&Kh){kv=!0;do for(var c=!1,m=qh;m!==null;){if(i!==0){var b=m.pendingLanes;if(b===0)var x=0;else{var T=m.suspendedLanes,z=m.pingedLanes;x=(1<<31-at(42|i)+1)-1,x&=b&~(T&~z),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,GS(m,x))}else x=Nt,x=Fe(m,m===nn?x:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(x&3)===0||ct(m,x)||(c=!0,GS(m,x));m=m.next}while(c);kv=!1}}function M4(){VS()}function VS(){Kh=Cv=!1;var i=0;To!==0&&H4()&&(i=To);for(var a=Se(),c=null,m=qh;m!==null;){var b=m.next,x=qS(m,a);x===0?(m.next=null,c===null?qh=b:c.next=b,b===null&&(Ol=c)):(c=m,(i!==0||(x&3)!==0)&&(Kh=!0)),m=b}In!==0&&In!==5||cu(i),To!==0&&(To=0)}function qS(i,a){for(var c=i.suspendedLanes,m=i.pingedLanes,b=i.expirationTimes,x=i.pendingLanes&-62914561;0<x;){var T=31-at(x),z=1<<T,Q=b[T];Q===-1?((z&c)===0||(z&m)!==0)&&(b[T]=st(z,a)):Q<=a&&(i.expiredLanes|=z),x&=~z}if(a=nn,c=Nt,c=Fe(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m=i.callbackNode,c===0||i===a&&(Kt===2||Kt===9)||i.cancelPendingCommit!==null)return m!==null&&m!==null&&wt(m),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||ct(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(m!==null&&wt(m),Ot(c)){case 2:case 8:c=be;break;case 32:c=Oe;break;case 268435456:c=we;break;default:c=Oe}return m=KS.bind(null,i),c=tt(c,m),i.callbackPriority=a,i.callbackNode=c,a}return m!==null&&m!==null&&wt(m),i.callbackPriority=2,i.callbackNode=null,2}function KS(i,a){if(In!==0&&In!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(Vh()&&i.callbackNode!==c)return null;var m=Nt;return m=Fe(i,i===nn?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m===0?null:(TS(i,m,a),qS(i,Se()),i.callbackNode!=null&&i.callbackNode===c?KS.bind(null,i):null)}function GS(i,a){if(Vh())return null;TS(i,a,!0)}function N4(){U4(function(){(Ht&6)!==0?tt(ce,M4):VS()})}function Ev(){if(To===0){var i=bl;i===0&&(i=xr,xr<<=1,(xr&261888)===0&&(xr=256)),To=i}return To}function YS(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:th(""+i)}function XS(i,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,i.id&&c.setAttribute("form",i.id),a.parentNode.insertBefore(c,a),i=new FormData(i),c.parentNode.removeChild(c),i}function A4(i,a,c,m,b){if(a==="submit"&&c&&c.stateNode===b){var x=YS((b[Cn]||null).action),T=m.submitter;T&&(a=(a=T[Cn]||null)?YS(a.formAction):T.getAttribute("formAction"),a!==null&&(x=a,T=null));var z=new sh("action","action",null,m,b);i.push({event:z,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(To!==0){var Q=T?XS(b,T):new FormData(b);qg(c,{pending:!0,data:Q,method:b.method,action:x},null,Q)}}else typeof x=="function"&&(z.preventDefault(),Q=T?XS(b,T):new FormData(b),qg(c,{pending:!0,data:Q,method:b.method,action:x},x,Q))},currentTarget:b}]})}}for(var Rv=0;Rv<cg.length;Rv++){var Tv=cg[Rv],D4=Tv.toLowerCase(),j4=Tv[0].toUpperCase()+Tv.slice(1);Di(D4,"on"+j4)}Di(R1,"onAnimationEnd"),Di(T1,"onAnimationIteration"),Di(M1,"onAnimationStart"),Di("dblclick","onDoubleClick"),Di("focusin","onFocus"),Di("focusout","onBlur"),Di(Y3,"onTransitionRun"),Di(X3,"onTransitionStart"),Di(Z3,"onTransitionCancel"),Di(N1,"onTransitionEnd"),ws("onMouseEnter",["mouseout","mouseover"]),ws("onMouseLeave",["mouseout","mouseover"]),ws("onPointerEnter",["pointerout","pointerover"]),ws("onPointerLeave",["pointerout","pointerover"]),Xi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var uu="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(" "),O4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(uu));function ZS(i,a){a=(a&4)!==0;for(var c=0;c<i.length;c++){var m=i[c],b=m.event;m=m.listeners;e:{var x=void 0;if(a)for(var T=m.length-1;0<=T;T--){var z=m[T],Q=z.instance,oe=z.currentTarget;if(z=z.listener,Q!==x&&b.isPropagationStopped())break e;x=z,b.currentTarget=oe;try{x(b)}catch(fe){lh(fe)}b.currentTarget=null,x=Q}else for(T=0;T<m.length;T++){if(z=m[T],Q=z.instance,oe=z.currentTarget,z=z.listener,Q!==x&&b.isPropagationStopped())break e;x=z,b.currentTarget=oe;try{x(b)}catch(fe){lh(fe)}b.currentTarget=null,x=Q}}}}function kt(i,a){var c=a[$t];c===void 0&&(c=a[$t]=new Set);var m=i+"__bubble";c.has(m)||(QS(a,i,2,!1),c.add(m))}function Mv(i,a,c){var m=0;a&&(m|=4),QS(c,i,m,a)}var Gh="_reactListening"+Math.random().toString(36).slice(2);function Nv(i){if(!i[Gh]){i[Gh]=!0,Xd.forEach(function(c){c!=="selectionchange"&&(O4.has(c)||Mv(c,!1,i),Mv(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[Gh]||(a[Gh]=!0,Mv("selectionchange",!1,a))}}function QS(i,a,c,m){switch(RC(a)){case 2:var b=lO;break;case 8:b=cO;break;default:b=Vv}c=b.bind(null,a,c,i),b=void 0,!Xp||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),m?b!==void 0?i.addEventListener(a,c,{capture:!0,passive:b}):i.addEventListener(a,c,!0):b!==void 0?i.addEventListener(a,c,{passive:b}):i.addEventListener(a,c,!1)}function Av(i,a,c,m,b){var x=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var z=m.stateNode.containerInfo;if(z===b)break;if(T===4)for(T=m.return;T!==null;){var Q=T.tag;if((Q===3||Q===4)&&T.stateNode.containerInfo===b)return;T=T.return}for(;z!==null;){if(T=co(z),T===null)return;if(Q=T.tag,Q===5||Q===6||Q===26||Q===27){m=x=T;continue e}z=z.parentNode}}m=m.return}r1(function(){var oe=x,fe=Gp(c),ve=[];e:{var ue=A1.get(i);if(ue!==void 0){var de=sh,We=i;switch(i){case"keypress":if(rh(c)===0)break e;case"keydown":case"keyup":de=R3;break;case"focusin":We="focus",de=eg;break;case"focusout":We="blur",de=eg;break;case"beforeblur":case"afterblur":de=eg;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=o1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=p3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=N3;break;case R1:case T1:case M1:de=_3;break;case N1:de=D3;break;case"scroll":case"scrollend":de=f3;break;case"wheel":de=O3;break;case"copy":case"cut":case"paste":de=y3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=l1;break;case"toggle":case"beforetoggle":de=z3}var nt=(a&4)!==0,Zt=!nt&&(i==="scroll"||i==="scrollend"),re=nt?ue!==null?ue+"Capture":null:ue;nt=[];for(var ee=oe,se;ee!==null;){var ge=ee;if(se=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||se===null||re===null||(ge=Dc(ee,re),ge!=null&&nt.push(du(ee,ge,se))),Zt)break;ee=ee.return}0<nt.length&&(ue=new de(ue,We,null,c,fe),ve.push({event:ue,listeners:nt}))}}if((a&7)===0){e:{if(ue=i==="mouseover"||i==="pointerover",de=i==="mouseout"||i==="pointerout",ue&&c!==Kp&&(We=c.relatedTarget||c.fromElement)&&(co(We)||We[li]))break e;if((de||ue)&&(ue=fe.window===fe?fe:(ue=fe.ownerDocument)?ue.defaultView||ue.parentWindow:window,de?(We=c.relatedTarget||c.toElement,de=oe,We=We?co(We):null,We!==null&&(Zt=o(We),nt=We.tag,We!==Zt||nt!==5&&nt!==27&&nt!==6)&&(We=null)):(de=null,We=oe),de!==We)){if(nt=o1,ge="onMouseLeave",re="onMouseEnter",ee="mouse",(i==="pointerout"||i==="pointerover")&&(nt=l1,ge="onPointerLeave",re="onPointerEnter",ee="pointer"),Zt=de==null?ue:oa(de),se=We==null?ue:oa(We),ue=new nt(ge,ee+"leave",de,c,fe),ue.target=Zt,ue.relatedTarget=se,ge=null,co(fe)===oe&&(nt=new nt(re,ee+"enter",We,c,fe),nt.target=se,nt.relatedTarget=Zt,ge=nt),Zt=ge,de&&We)t:{for(nt=L4,re=de,ee=We,se=0,ge=re;ge;ge=nt(ge))se++;ge=0;for(var Ze=ee;Ze;Ze=nt(Ze))ge++;for(;0<se-ge;)re=nt(re),se--;for(;0<ge-se;)ee=nt(ee),ge--;for(;se--;){if(re===ee||ee!==null&&re===ee.alternate){nt=re;break t}re=nt(re),ee=nt(ee)}nt=null}else nt=null;de!==null&&JS(ve,ue,de,nt,!1),We!==null&&Zt!==null&&JS(ve,Zt,We,nt,!0)}}e:{if(ue=oe?oa(oe):window,de=ue.nodeName&&ue.nodeName.toLowerCase(),de==="select"||de==="input"&&ue.type==="file")var Pt=g1;else if(m1(ue))if(v1)Pt=q3;else{Pt=W3;var Ge=$3}else de=ue.nodeName,!de||de.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?oe&&qp(oe.elementType)&&(Pt=g1):Pt=V3;if(Pt&&(Pt=Pt(i,oe))){p1(ve,Pt,c,fe);break e}Ge&&Ge(i,ue,oe),i==="focusout"&&oe&&ue.type==="number"&&oe.memoizedProps.value!=null&&Vp(ue,"number",ue.value)}switch(Ge=oe?oa(oe):window,i){case"focusin":(m1(Ge)||Ge.contentEditable==="true")&&(dl=Ge,og=oe,Hc=null);break;case"focusout":Hc=og=dl=null;break;case"mousedown":ag=!0;break;case"contextmenu":case"mouseup":case"dragend":ag=!1,k1(ve,c,fe);break;case"selectionchange":if(G3)break;case"keydown":case"keyup":k1(ve,c,fe)}var dt;if(ng)e:{switch(i){case"compositionstart":var At="onCompositionStart";break e;case"compositionend":At="onCompositionEnd";break e;case"compositionupdate":At="onCompositionUpdate";break e}At=void 0}else ul?h1(i,c)&&(At="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(At="onCompositionStart");At&&(c1&&c.locale!=="ko"&&(ul||At!=="onCompositionStart"?At==="onCompositionEnd"&&ul&&(dt=i1()):(ho=fe,Zp="value"in ho?ho.value:ho.textContent,ul=!0)),Ge=Yh(oe,At),0<Ge.length&&(At=new a1(At,i,null,c,fe),ve.push({event:At,listeners:Ge}),dt?At.data=dt:(dt=f1(c),dt!==null&&(At.data=dt)))),(dt=B3?I3(i,c):H3(i,c))&&(At=Yh(oe,"onBeforeInput"),0<At.length&&(Ge=new a1("onBeforeInput","beforeinput",null,c,fe),ve.push({event:Ge,listeners:At}),Ge.data=dt)),A4(ve,i,oe,c,fe)}ZS(ve,a)})}function du(i,a,c){return{instance:i,listener:a,currentTarget:c}}function Yh(i,a){for(var c=a+"Capture",m=[];i!==null;){var b=i,x=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||x===null||(b=Dc(i,c),b!=null&&m.unshift(du(i,b,x)),b=Dc(i,a),b!=null&&m.push(du(i,b,x))),i.tag===3)return m;i=i.return}return[]}function L4(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function JS(i,a,c,m,b){for(var x=a._reactName,T=[];c!==null&&c!==m;){var z=c,Q=z.alternate,oe=z.stateNode;if(z=z.tag,Q!==null&&Q===m)break;z!==5&&z!==26&&z!==27||oe===null||(Q=oe,b?(oe=Dc(c,x),oe!=null&&T.unshift(du(c,oe,Q))):b||(oe=Dc(c,x),oe!=null&&T.push(du(c,oe,Q)))),c=c.return}T.length!==0&&i.push({event:a,listeners:T})}var z4=/\r\n?/g,P4=/\u0000|\uFFFD/g;function eC(i){return(typeof i=="string"?i:""+i).replace(z4,`
|
|
49
|
+
`).replace(P4,"")}function tC(i,a){return a=eC(a),eC(i)===a}function Xt(i,a,c,m,b,x){switch(c){case"children":typeof m=="string"?a==="body"||a==="textarea"&&m===""||al(i,m):(typeof m=="number"||typeof m=="bigint")&&a!=="body"&&al(i,""+m);break;case"className":Mt(i,"class",m);break;case"tabIndex":Mt(i,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Mt(i,c,m);break;case"style":t1(i,m,x);break;case"data":if(a!=="object"){Mt(i,"data",m);break}case"src":case"href":if(m===""&&(a!=="a"||c!=="href")){i.removeAttribute(c);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(c);break}m=th(""+m),i.setAttribute(c,m);break;case"action":case"formAction":if(typeof m=="function"){i.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(a!=="input"&&Xt(i,a,"name",b.name,b,null),Xt(i,a,"formEncType",b.formEncType,b,null),Xt(i,a,"formMethod",b.formMethod,b,null),Xt(i,a,"formTarget",b.formTarget,b,null)):(Xt(i,a,"encType",b.encType,b,null),Xt(i,a,"method",b.method,b,null),Xt(i,a,"target",b.target,b,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(c);break}m=th(""+m),i.setAttribute(c,m);break;case"onClick":m!=null&&(i.onclick=Ss);break;case"onScroll":m!=null&&kt("scroll",i);break;case"onScrollEnd":m!=null&&kt("scrollend",i);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(c=m.__html,c!=null){if(b.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"multiple":i.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":i.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){i.removeAttribute("xlink:href");break}c=th(""+m),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,""+m):i.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":m===!0?i.setAttribute(c,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,m):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?i.setAttribute(c,m):i.removeAttribute(c);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?i.removeAttribute(c):i.setAttribute(c,m);break;case"popover":kt("beforetoggle",i),kt("toggle",i),Ue(i,"popover",m);break;case"xlinkActuate":Wt(i,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Wt(i,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Wt(i,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Wt(i,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Wt(i,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Wt(i,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Wt(i,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Wt(i,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Wt(i,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Ue(i,"is",m);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=d3.get(c)||c,Ue(i,c,m))}}function Dv(i,a,c,m,b,x){switch(c){case"style":t1(i,m,x);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(c=m.__html,c!=null){if(b.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"children":typeof m=="string"?al(i,m):(typeof m=="number"||typeof m=="bigint")&&al(i,""+m);break;case"onScroll":m!=null&&kt("scroll",i);break;case"onScrollEnd":m!=null&&kt("scrollend",i);break;case"onClick":m!=null&&(i.onclick=Ss);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zd.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),a=c.slice(2,b?c.length-7:void 0),x=i[Cn]||null,x=x!=null?x[c]:null,typeof x=="function"&&i.removeEventListener(a,x,b),typeof m=="function")){typeof x!="function"&&x!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(a,m,b);break e}c in i?i[c]=m:m===!0?i.setAttribute(c,""):Ue(i,c,m)}}}function lr(i,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kt("error",i),kt("load",i);var m=!1,b=!1,x;for(x in c)if(c.hasOwnProperty(x)){var T=c[x];if(T!=null)switch(x){case"src":m=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Xt(i,a,x,T,c,null)}}b&&Xt(i,a,"srcSet",c.srcSet,c,null),m&&Xt(i,a,"src",c.src,c,null);return;case"input":kt("invalid",i);var z=x=T=b=null,Q=null,oe=null;for(m in c)if(c.hasOwnProperty(m)){var fe=c[m];if(fe!=null)switch(m){case"name":b=fe;break;case"type":T=fe;break;case"checked":Q=fe;break;case"defaultChecked":oe=fe;break;case"value":x=fe;break;case"defaultValue":z=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,a));break;default:Xt(i,a,m,fe,c,null)}}Zx(i,x,z,Q,oe,T,b,!1);return;case"select":kt("invalid",i),m=T=x=null;for(b in c)if(c.hasOwnProperty(b)&&(z=c[b],z!=null))switch(b){case"value":x=z;break;case"defaultValue":T=z;break;case"multiple":m=z;default:Xt(i,a,b,z,c,null)}a=x,c=T,i.multiple=!!m,a!=null?ol(i,!!m,a,!1):c!=null&&ol(i,!!m,c,!0);return;case"textarea":kt("invalid",i),x=b=m=null;for(T in c)if(c.hasOwnProperty(T)&&(z=c[T],z!=null))switch(T){case"value":m=z;break;case"defaultValue":b=z;break;case"children":x=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(91));break;default:Xt(i,a,T,z,c,null)}Jx(i,m,b,x);return;case"option":for(Q in c)if(c.hasOwnProperty(Q)&&(m=c[Q],m!=null))switch(Q){case"selected":i.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Xt(i,a,Q,m,c,null)}return;case"dialog":kt("beforetoggle",i),kt("toggle",i),kt("cancel",i),kt("close",i);break;case"iframe":case"object":kt("load",i);break;case"video":case"audio":for(m=0;m<uu.length;m++)kt(uu[m],i);break;case"image":kt("error",i),kt("load",i);break;case"details":kt("toggle",i);break;case"embed":case"source":case"link":kt("error",i),kt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(oe in c)if(c.hasOwnProperty(oe)&&(m=c[oe],m!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Xt(i,a,oe,m,c,null)}return;default:if(qp(a)){for(fe in c)c.hasOwnProperty(fe)&&(m=c[fe],m!==void 0&&Dv(i,a,fe,m,c,void 0));return}}for(z in c)c.hasOwnProperty(z)&&(m=c[z],m!=null&&Xt(i,a,z,m,c,null))}function B4(i,a,c,m){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,x=null,T=null,z=null,Q=null,oe=null,fe=null;for(de in c){var ve=c[de];if(c.hasOwnProperty(de)&&ve!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":Q=ve;default:m.hasOwnProperty(de)||Xt(i,a,de,null,m,ve)}}for(var ue in m){var de=m[ue];if(ve=c[ue],m.hasOwnProperty(ue)&&(de!=null||ve!=null))switch(ue){case"type":x=de;break;case"name":b=de;break;case"checked":oe=de;break;case"defaultChecked":fe=de;break;case"value":T=de;break;case"defaultValue":z=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,a));break;default:de!==ve&&Xt(i,a,ue,de,m,ve)}}Wp(i,T,z,Q,oe,fe,x,b);return;case"select":de=T=z=ue=null;for(x in c)if(Q=c[x],c.hasOwnProperty(x)&&Q!=null)switch(x){case"value":break;case"multiple":de=Q;default:m.hasOwnProperty(x)||Xt(i,a,x,null,m,Q)}for(b in m)if(x=m[b],Q=c[b],m.hasOwnProperty(b)&&(x!=null||Q!=null))switch(b){case"value":ue=x;break;case"defaultValue":z=x;break;case"multiple":T=x;default:x!==Q&&Xt(i,a,b,x,m,Q)}a=z,c=T,m=de,ue!=null?ol(i,!!c,ue,!1):!!m!=!!c&&(a!=null?ol(i,!!c,a,!0):ol(i,!!c,c?[]:"",!1));return;case"textarea":de=ue=null;for(z in c)if(b=c[z],c.hasOwnProperty(z)&&b!=null&&!m.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:Xt(i,a,z,null,m,b)}for(T in m)if(b=m[T],x=c[T],m.hasOwnProperty(T)&&(b!=null||x!=null))switch(T){case"value":ue=b;break;case"defaultValue":de=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==x&&Xt(i,a,T,b,m,x)}Qx(i,ue,de);return;case"option":for(var We in c)if(ue=c[We],c.hasOwnProperty(We)&&ue!=null&&!m.hasOwnProperty(We))switch(We){case"selected":i.selected=!1;break;default:Xt(i,a,We,null,m,ue)}for(Q in m)if(ue=m[Q],de=c[Q],m.hasOwnProperty(Q)&&ue!==de&&(ue!=null||de!=null))switch(Q){case"selected":i.selected=ue&&typeof ue!="function"&&typeof ue!="symbol";break;default:Xt(i,a,Q,ue,m,de)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var nt in c)ue=c[nt],c.hasOwnProperty(nt)&&ue!=null&&!m.hasOwnProperty(nt)&&Xt(i,a,nt,null,m,ue);for(oe in m)if(ue=m[oe],de=c[oe],m.hasOwnProperty(oe)&&ue!==de&&(ue!=null||de!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,a));break;default:Xt(i,a,oe,ue,m,de)}return;default:if(qp(a)){for(var Zt in c)ue=c[Zt],c.hasOwnProperty(Zt)&&ue!==void 0&&!m.hasOwnProperty(Zt)&&Dv(i,a,Zt,void 0,m,ue);for(fe in m)ue=m[fe],de=c[fe],!m.hasOwnProperty(fe)||ue===de||ue===void 0&&de===void 0||Dv(i,a,fe,ue,m,de);return}}for(var re in c)ue=c[re],c.hasOwnProperty(re)&&ue!=null&&!m.hasOwnProperty(re)&&Xt(i,a,re,null,m,ue);for(ve in m)ue=m[ve],de=c[ve],!m.hasOwnProperty(ve)||ue===de||ue==null&&de==null||Xt(i,a,ve,ue,m,de)}function nC(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function I4(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,c=performance.getEntriesByType("resource"),m=0;m<c.length;m++){var b=c[m],x=b.transferSize,T=b.initiatorType,z=b.duration;if(x&&z&&nC(T)){for(T=0,z=b.responseEnd,m+=1;m<c.length;m++){var Q=c[m],oe=Q.startTime;if(oe>z)break;var fe=Q.transferSize,ve=Q.initiatorType;fe&&nC(ve)&&(Q=Q.responseEnd,T+=fe*(Q<z?1:(z-oe)/(Q-oe)))}if(--m,a+=8*(x+T)/(b.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var jv=null,Ov=null;function Xh(i){return i.nodeType===9?i:i.ownerDocument}function rC(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 iC(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function Lv(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var zv=null;function H4(){var i=window.event;return i&&i.type==="popstate"?i===zv?!1:(zv=i,!0):(zv=null,!1)}var sC=typeof setTimeout=="function"?setTimeout:void 0,F4=typeof clearTimeout=="function"?clearTimeout:void 0,oC=typeof Promise=="function"?Promise:void 0,U4=typeof queueMicrotask=="function"?queueMicrotask:typeof oC<"u"?function(i){return oC.resolve(null).then(i).catch($4)}:sC;function $4(i){setTimeout(function(){throw i})}function Mo(i){return i==="head"}function aC(i,a){var c=a,m=0;do{var b=c.nextSibling;if(i.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(m===0){i.removeChild(b),Bl(a);return}m--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")m++;else if(c==="html")hu(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,hu(c);for(var x=c.firstChild;x;){var T=x.nextSibling,z=x.nodeName;x[sa]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=T}}else c==="body"&&hu(i.ownerDocument.body);c=b}while(c);Bl(a)}function lC(i,a){var c=i;i=0;do{var m=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),m&&m.nodeType===8)if(c=m.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=m}while(c)}function Pv(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Pv(c),Ac(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function W4(i,a,c,m){for(;i.nodeType===1;){var b=c;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!m&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(m){if(!i[sa])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(x=i.getAttribute("rel"),x==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(x!==b.rel||i.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||i.getAttribute("title")!==(b.title==null?null:b.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(x=i.getAttribute("src"),(x!==(b.src==null?null:b.src)||i.getAttribute("type")!==(b.type==null?null:b.type)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&x&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var x=b.name==null?null:""+b.name;if(b.type==="hidden"&&i.getAttribute("name")===x)return i}else return i;if(i=gi(i.nextSibling),i===null)break}return null}function V4(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=gi(i.nextSibling),i===null))return null;return i}function cC(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=gi(i.nextSibling),i===null))return null;return i}function Bv(i){return i.data==="$?"||i.data==="$~"}function Iv(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function q4(i,a){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||c.readyState!=="loading")a();else{var m=function(){a(),c.removeEventListener("DOMContentLoaded",m)};c.addEventListener("DOMContentLoaded",m),i._reactRetry=m}}function gi(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var Hv=null;function uC(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(a===0)return gi(i.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}i=i.nextSibling}return null}function dC(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return i;a--}else c!=="/$"&&c!=="/&"||a++}i=i.previousSibling}return null}function hC(i,a,c){switch(a=Xh(c),i){case"html":if(i=a.documentElement,!i)throw Error(r(452));return i;case"head":if(i=a.head,!i)throw Error(r(453));return i;case"body":if(i=a.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function hu(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);Ac(i)}var vi=new Map,fC=new Set;function Zh(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Is=H.d;H.d={f:K4,r:G4,D:Y4,C:X4,L:Z4,m:Q4,X:eO,S:J4,M:tO};function K4(){var i=Is.f(),a=Uh();return i||a}function G4(i){var a=uo(i);a!==null&&a.tag===5&&a.type==="form"?Nw(a):Is.r(i)}var Ll=typeof document>"u"?null:document;function mC(i,a,c){var m=Ll;if(m&&typeof a=="string"&&a){var b=ci(a);b='link[rel="'+i+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),fC.has(b)||(fC.add(b),i={rel:i,crossOrigin:c,href:a},m.querySelector(b)===null&&(a=m.createElement("link"),lr(a,"link",i),An(a),m.head.appendChild(a)))}}function Y4(i){Is.D(i),mC("dns-prefetch",i,null)}function X4(i,a){Is.C(i,a),mC("preconnect",i,a)}function Z4(i,a,c){Is.L(i,a,c);var m=Ll;if(m&&i&&a){var b='link[rel="preload"][as="'+ci(a)+'"]';a==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+ci(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+ci(c.imageSizes)+'"]')):b+='[href="'+ci(i)+'"]';var x=b;switch(a){case"style":x=zl(i);break;case"script":x=Pl(i)}vi.has(x)||(i=p({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),vi.set(x,i),m.querySelector(b)!==null||a==="style"&&m.querySelector(fu(x))||a==="script"&&m.querySelector(mu(x))||(a=m.createElement("link"),lr(a,"link",i),An(a),m.head.appendChild(a)))}}function Q4(i,a){Is.m(i,a);var c=Ll;if(c&&i){var m=a&&typeof a.as=="string"?a.as:"script",b='link[rel="modulepreload"][as="'+ci(m)+'"][href="'+ci(i)+'"]',x=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Pl(i)}if(!vi.has(x)&&(i=p({rel:"modulepreload",href:i},a),vi.set(x,i),c.querySelector(b)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(mu(x)))return}m=c.createElement("link"),lr(m,"link",i),An(m),c.head.appendChild(m)}}}function J4(i,a,c){Is.S(i,a,c);var m=Ll;if(m&&i){var b=Yi(m).hoistableStyles,x=zl(i);a=a||"default";var T=b.get(x);if(!T){var z={loading:0,preload:null};if(T=m.querySelector(fu(x)))z.loading=5;else{i=p({rel:"stylesheet",href:i,"data-precedence":a},c),(c=vi.get(x))&&Fv(i,c);var Q=T=m.createElement("link");An(Q),lr(Q,"link",i),Q._p=new Promise(function(oe,fe){Q.onload=oe,Q.onerror=fe}),Q.addEventListener("load",function(){z.loading|=1}),Q.addEventListener("error",function(){z.loading|=2}),z.loading|=4,Qh(T,a,m)}T={type:"stylesheet",instance:T,count:1,state:z},b.set(x,T)}}}function eO(i,a){Is.X(i,a);var c=Ll;if(c&&i){var m=Yi(c).hoistableScripts,b=Pl(i),x=m.get(b);x||(x=c.querySelector(mu(b)),x||(i=p({src:i,async:!0},a),(a=vi.get(b))&&Uv(i,a),x=c.createElement("script"),An(x),lr(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(b,x))}}function tO(i,a){Is.M(i,a);var c=Ll;if(c&&i){var m=Yi(c).hoistableScripts,b=Pl(i),x=m.get(b);x||(x=c.querySelector(mu(b)),x||(i=p({src:i,async:!0,type:"module"},a),(a=vi.get(b))&&Uv(i,a),x=c.createElement("script"),An(x),lr(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(b,x))}}function pC(i,a,c,m){var b=(b=Z.current)?Zh(b):null;if(!b)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=zl(c.href),c=Yi(b).hoistableStyles,m=c.get(a),m||(m={type:"style",instance:null,count:0,state:null},c.set(a,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=zl(c.href);var x=Yi(b).hoistableStyles,T=x.get(i);if(T||(b=b.ownerDocument||b,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(i,T),(x=b.querySelector(fu(i)))&&!x._p&&(T.instance=x,T.state.loading=5),vi.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},vi.set(i,c),x||nO(b,i,c,T.state))),a&&m===null)throw Error(r(528,""));return T}if(a&&m!==null)throw Error(r(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Pl(c),c=Yi(b).hoistableScripts,m=c.get(a),m||(m={type:"script",instance:null,count:0,state:null},c.set(a,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function zl(i){return'href="'+ci(i)+'"'}function fu(i){return'link[rel="stylesheet"]['+i+"]"}function gC(i){return p({},i,{"data-precedence":i.precedence,precedence:null})}function nO(i,a,c,m){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?m.loading=1:(a=i.createElement("link"),m.preload=a,a.addEventListener("load",function(){return m.loading|=1}),a.addEventListener("error",function(){return m.loading|=2}),lr(a,"link",c),An(a),i.head.appendChild(a))}function Pl(i){return'[src="'+ci(i)+'"]'}function mu(i){return"script[async]"+i}function vC(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var m=i.querySelector('style[data-href~="'+ci(c.href)+'"]');if(m)return a.instance=m,An(m),m;var b=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return m=(i.ownerDocument||i).createElement("style"),An(m),lr(m,"style",b),Qh(m,c.precedence,i),a.instance=m;case"stylesheet":b=zl(c.href);var x=i.querySelector(fu(b));if(x)return a.state.loading|=4,a.instance=x,An(x),x;m=gC(c),(b=vi.get(b))&&Fv(m,b),x=(i.ownerDocument||i).createElement("link"),An(x);var T=x;return T._p=new Promise(function(z,Q){T.onload=z,T.onerror=Q}),lr(x,"link",m),a.state.loading|=4,Qh(x,c.precedence,i),a.instance=x;case"script":return x=Pl(c.src),(b=i.querySelector(mu(x)))?(a.instance=b,An(b),b):(m=c,(b=vi.get(x))&&(m=p({},c),Uv(m,b)),i=i.ownerDocument||i,b=i.createElement("script"),An(b),lr(b,"link",m),i.head.appendChild(b),a.instance=b);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(m=a.instance,a.state.loading|=4,Qh(m,c.precedence,i));return a.instance}function Qh(i,a,c){for(var m=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=m.length?m[m.length-1]:null,x=b,T=0;T<m.length;T++){var z=m[T];if(z.dataset.precedence===a)x=z;else if(x!==b)break}x?x.parentNode.insertBefore(i,x.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(i,a.firstChild))}function Fv(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function Uv(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var Jh=null;function _C(i,a,c){if(Jh===null){var m=new Map,b=Jh=new Map;b.set(c,m)}else b=Jh,m=b.get(c),m||(m=new Map,b.set(c,m));if(m.has(i))return m;for(m.set(i,null),c=c.getElementsByTagName(i),b=0;b<c.length;b++){var x=c[b];if(!(x[sa]||x[It]||i==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var T=x.getAttribute(a)||"";T=i+T;var z=m.get(T);z?z.push(x):m.set(T,[x])}}return m}function bC(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function rO(i,a,c){if(c===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return i=a.disabled,typeof a.precedence=="string"&&i==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function yC(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function iO(i,a,c,m){if(c.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=zl(m.href),x=a.querySelector(fu(b));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=ef.bind(i),a.then(i,i)),c.state.loading|=4,c.instance=x,An(x);return}x=a.ownerDocument||a,m=gC(m),(b=vi.get(b))&&Fv(m,b),x=x.createElement("link"),An(x);var T=x;T._p=new Promise(function(z,Q){T.onload=z,T.onerror=Q}),lr(x,"link",m),c.instance=x}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=ef.bind(i),a.addEventListener("load",c),a.addEventListener("error",c))}}var $v=0;function sO(i,a){return i.stylesheets&&i.count===0&&nf(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var m=setTimeout(function(){if(i.stylesheets&&nf(i,i.stylesheets),i.unsuspend){var x=i.unsuspend;i.unsuspend=null,x()}},6e4+a);0<i.imgBytes&&$v===0&&($v=62500*I4());var b=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&nf(i,i.stylesheets),i.unsuspend)){var x=i.unsuspend;i.unsuspend=null,x()}},(i.imgBytes>$v?50:800)+a);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(m),clearTimeout(b)}}:null}function ef(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nf(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var tf=null;function nf(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,tf=new Map,a.forEach(oO,i),tf=null,ef.call(i))}function oO(i,a){if(!(a.state.loading&4)){var c=tf.get(i);if(c)var m=c.get(null);else{c=new Map,tf.set(i,c);for(var b=i.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<b.length;x++){var T=b[x];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(c.set(T.dataset.precedence,T),m=T)}m&&c.set(null,m)}b=a.instance,T=b.getAttribute("data-precedence"),x=c.get(T)||m,x===m&&c.set(null,b),c.set(T,b),this.count++,m=ef.bind(this),b.addEventListener("load",m),b.addEventListener("error",m),x?x.parentNode.insertBefore(b,x.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(b,i.firstChild)),a.state.loading|=4}}var pu={$$typeof:E,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function aO(i,a,c,m,b,x,T,z,Q){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=an(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=an(0),this.hiddenUpdates=an(null),this.identifierPrefix=m,this.onUncaughtError=b,this.onCaughtError=x,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function xC(i,a,c,m,b,x,T,z,Q,oe,fe,ve){return i=new aO(i,a,c,T,Q,oe,fe,ve,z),a=1,x===!0&&(a|=24),x=Kr(3,null,null,a),i.current=x,x.stateNode=i,a=wg(),a.refCount++,i.pooledCache=a,a.refCount++,x.memoizedState={element:m,isDehydrated:c,cache:a},Eg(x),i}function wC(i){return i?(i=ml,i):ml}function SC(i,a,c,m,b,x){b=wC(b),m.context===null?m.context=b:m.pendingContext=b,m=_o(a),m.payload={element:c},x=x===void 0?null:x,x!==null&&(m.callback=x),c=bo(i,m,a),c!==null&&(Br(c,i,a),Kc(c,i,a))}function CC(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function Wv(i,a){CC(i,a),(i=i.alternate)&&CC(i,a)}function kC(i){if(i.tag===13||i.tag===31){var a=ua(i,67108864);a!==null&&Br(a,i,67108864),Wv(i,67108864)}}function EC(i){if(i.tag===13||i.tag===31){var a=Qr();a=qt(a);var c=ua(i,a);c!==null&&Br(c,i,a),Wv(i,a)}}var rf=!0;function lO(i,a,c,m){var b=O.T;O.T=null;var x=H.p;try{H.p=2,Vv(i,a,c,m)}finally{H.p=x,O.T=b}}function cO(i,a,c,m){var b=O.T;O.T=null;var x=H.p;try{H.p=8,Vv(i,a,c,m)}finally{H.p=x,O.T=b}}function Vv(i,a,c,m){if(rf){var b=qv(m);if(b===null)Av(i,a,m,sf,c),TC(i,m);else if(dO(b,i,a,c,m))m.stopPropagation();else if(TC(i,m),a&4&&-1<uO.indexOf(i)){for(;b!==null;){var x=uo(b);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var T=zt(x.pendingLanes);if(T!==0){var z=x;for(z.pendingLanes|=2,z.entangledLanes|=2;T;){var Q=1<<31-at(T);z.entanglements[1]|=Q,T&=~Q}es(x),(Ht&6)===0&&(Hh=Se()+500,cu(0))}}break;case 31:case 13:z=ua(x,2),z!==null&&Br(z,x,2),Uh(),Wv(x,2)}if(x=qv(m),x===null&&Av(i,a,m,sf,c),x===b)break;b=x}b!==null&&m.stopPropagation()}else Av(i,a,m,null,c)}}function qv(i){return i=Gp(i),Kv(i)}var sf=null;function Kv(i){if(sf=null,i=co(i),i!==null){var a=o(i);if(a===null)i=null;else{var c=a.tag;if(c===13){if(i=l(a),i!==null)return i;i=null}else if(c===31){if(i=u(a),i!==null)return i;i=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return sf=i,null}function RC(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(De()){case ce:return 2;case be:return 8;case Oe:case Ve:return 32;case we:return 268435456;default:return 32}default:return 32}}var Gv=!1,No=null,Ao=null,Do=null,gu=new Map,vu=new Map,jo=[],uO="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 TC(i,a){switch(i){case"focusin":case"focusout":No=null;break;case"dragenter":case"dragleave":Ao=null;break;case"mouseover":case"mouseout":Do=null;break;case"pointerover":case"pointerout":gu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":vu.delete(a.pointerId)}}function _u(i,a,c,m,b,x){return i===null||i.nativeEvent!==x?(i={blockedOn:a,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[b]},a!==null&&(a=uo(a),a!==null&&kC(a)),i):(i.eventSystemFlags|=m,a=i.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),i)}function dO(i,a,c,m,b){switch(a){case"focusin":return No=_u(No,i,a,c,m,b),!0;case"dragenter":return Ao=_u(Ao,i,a,c,m,b),!0;case"mouseover":return Do=_u(Do,i,a,c,m,b),!0;case"pointerover":var x=b.pointerId;return gu.set(x,_u(gu.get(x)||null,i,a,c,m,b)),!0;case"gotpointercapture":return x=b.pointerId,vu.set(x,_u(vu.get(x)||null,i,a,c,m,b)),!0}return!1}function MC(i){var a=co(i.target);if(a!==null){var c=o(a);if(c!==null){if(a=c.tag,a===13){if(a=l(c),a!==null){i.blockedOn=a,G(i.priority,function(){EC(c)});return}}else if(a===31){if(a=u(c),a!==null){i.blockedOn=a,G(i.priority,function(){EC(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function of(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var c=qv(i.nativeEvent);if(c===null){c=i.nativeEvent;var m=new c.constructor(c.type,c);Kp=m,c.target.dispatchEvent(m),Kp=null}else return a=uo(c),a!==null&&kC(a),i.blockedOn=c,!1;a.shift()}return!0}function NC(i,a,c){of(i)&&c.delete(a)}function hO(){Gv=!1,No!==null&&of(No)&&(No=null),Ao!==null&&of(Ao)&&(Ao=null),Do!==null&&of(Do)&&(Do=null),gu.forEach(NC),vu.forEach(NC)}function af(i,a){i.blockedOn===a&&(i.blockedOn=null,Gv||(Gv=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,hO)))}var lf=null;function AC(i){lf!==i&&(lf=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){lf===i&&(lf=null);for(var a=0;a<i.length;a+=3){var c=i[a],m=i[a+1],b=i[a+2];if(typeof m!="function"){if(Kv(m||c)===null)continue;break}var x=uo(c);x!==null&&(i.splice(a,3),a-=3,qg(x,{pending:!0,data:b,method:c.method,action:m},m,b))}}))}function Bl(i){function a(Q){return af(Q,i)}No!==null&&af(No,i),Ao!==null&&af(Ao,i),Do!==null&&af(Do,i),gu.forEach(a),vu.forEach(a);for(var c=0;c<jo.length;c++){var m=jo[c];m.blockedOn===i&&(m.blockedOn=null)}for(;0<jo.length&&(c=jo[0],c.blockedOn===null);)MC(c),c.blockedOn===null&&jo.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(m=0;m<c.length;m+=3){var b=c[m],x=c[m+1],T=b[Cn]||null;if(typeof x=="function")T||AC(c);else if(T){var z=null;if(x&&x.hasAttribute("formAction")){if(b=x,T=x[Cn]||null)z=T.formAction;else if(Kv(b)!==null)continue}else z=T.action;typeof z=="function"?c[m+1]=z:(c.splice(m,3),m-=3),AC(c)}}}function DC(){function i(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(T){return b=T})},focusReset:"manual",scroll:"manual"})}function a(){b!==null&&(b(),b=null),m||setTimeout(c,20)}function c(){if(!m&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,b=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){m=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),b!==null&&(b(),b=null)}}}function Yv(i){this._internalRoot=i}cf.prototype.render=Yv.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(r(409));var c=a.current,m=Qr();SC(c,m,i,a,null,null)},cf.prototype.unmount=Yv.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;SC(i.current,2,null,i,null,null),Uh(),a[li]=null}};function cf(i){this._internalRoot=i}cf.prototype.unstable_scheduleHydration=function(i){if(i){var a=sn();i={blockedOn:null,target:i,priority:a};for(var c=0;c<jo.length&&a!==0&&a<jo[c].priority;c++);jo.splice(c,0,i),c===0&&MC(i)}};var jC=t.version;if(jC!=="19.2.1")throw Error(r(527,jC,"19.2.1"));H.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=d(a),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var fO={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uf.isDisabled&&uf.supportsFiber)try{rt=uf.inject(fO),Le=uf}catch{}}return xu.createRoot=function(i,a){if(!s(i))throw Error(r(299));var c=!1,m="",b=Hw,x=Fw,T=Uw;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onUncaughtError!==void 0&&(b=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),a=xC(i,1,!1,null,null,c,m,null,b,x,T,DC),i[li]=a.current,Nv(i),new Yv(a)},xu.hydrateRoot=function(i,a,c){if(!s(i))throw Error(r(299));var m=!1,b="",x=Hw,T=Fw,z=Uw,Q=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(T=c.onCaughtError),c.onRecoverableError!==void 0&&(z=c.onRecoverableError),c.formState!==void 0&&(Q=c.formState)),a=xC(i,1,!0,a,c??null,m,b,Q,x,T,z,DC),a.context=wC(null),c=a.current,m=Qr(),m=qt(m),b=_o(m),b.callback=null,bo(c,b,m),c=m,a.current.lanes=c,Ce(a,c),es(a),i[li]=a.current,Nv(i),new cf(a)},xu.version="19.2.1",xu}var KC;function kO(){if(KC)return Qv.exports;KC=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(),Qv.exports=CO(),Qv.exports}var EO=kO();/**
|
|
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 GC="popstate";function YC(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function RO(e={}){function t(r,s){var d;let o=(d=s.state)==null?void 0:d.masked,{pathname:l,search:u,hash:h}=o||r.location;return _b("",{pathname:l,search:u,hash:h},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:rd(s)}return MO(t,n,null,e)}function hn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Fi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function TO(){return Math.random().toString(36).substring(2,10)}function XC(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function _b(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?pc(t):t,state:n,key:t&&t.key||r||TO(),unstable_mask:s}}function rd({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function pc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function MO(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:o=!1}=r,l=s.history,u="POP",h=null,d=g();d==null&&(d=0,l.replaceState({...l.state,idx:d},""));function g(){return(l.state||{idx:null}).idx}function p(){u="POP";let C=g(),k=C==null?null:C-d;d=C,h&&h({action:u,location:S.location,delta:k})}function v(C,k){u="PUSH";let R=YC(C)?C:_b(S.location,C,k);d=g()+1;let E=XC(R,d),M=S.createHref(R.unstable_mask||R);try{l.pushState(E,"",M)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(M)}o&&h&&h({action:u,location:S.location,delta:1})}function y(C,k){u="REPLACE";let R=YC(C)?C:_b(S.location,C,k);d=g();let E=XC(R,d),M=S.createHref(R.unstable_mask||R);l.replaceState(E,"",M),o&&h&&h({action:u,location:S.location,delta:0})}function w(C){return NO(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(GC,p),h=C,()=>{s.removeEventListener(GC,p),h=null}},createHref(C){return t(s,C)},createURL:w,encodeLocation(C){let k=w(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:v,replace:y,go(C){return l.go(C)}};return S}function NO(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),hn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:rd(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function rT(e,t,n="/"){return AO(e,t,n,!1)}function AO(e,t,n,r){let s=typeof t=="string"?pc(t):t,o=Ys(s.pathname||"/",n);if(o==null)return null;let l=iT(e);DO(l);let u=null;for(let h=0;u==null&&h<l.length;++h){let d=$O(o);u=FO(l[h],d,r)}return u}function iT(e,t=[],n=[],r="",s=!1){let o=(l,u,h=s,d)=>{let g={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&h)return;hn(g.relativePath.startsWith(r),`Absolute route path "${g.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(r.length)}let p=ps([r,g.relativePath]),v=n.concat(g);l.children&&l.children.length>0&&(hn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),iT(l.children,t,v,p,h)),!(l.path==null&&!l.index)&&t.push({path:p,score:IO(p,l.index),routesMeta:v})};return e.forEach((l,u)=>{var h;if(l.path===""||!((h=l.path)!=null&&h.includes("?")))o(l,u);else for(let d of sT(l.path))o(l,u,!0,d)}),t}function sT(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let l=sT(r.join("/")),u=[];return u.push(...l.map(h=>h===""?o:[o,h].join("/"))),s&&u.push(...l),u.map(h=>e.startsWith("/")&&h===""?"/":h)}function DO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:HO(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var jO=/^:[\w-]+$/,OO=3,LO=2,zO=1,PO=10,BO=-2,ZC=e=>e==="*";function IO(e,t){let n=e.split("/"),r=n.length;return n.some(ZC)&&(r+=BO),t&&(r+=LO),n.filter(s=>!ZC(s)).reduce((s,o)=>s+(jO.test(o)?OO:o===""?zO:PO),r)}function HO(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 FO(e,t,n=!1){let{routesMeta:r}=e,s={},o="/",l=[];for(let u=0;u<r.length;++u){let h=r[u],d=u===r.length-1,g=o==="/"?t:t.slice(o.length)||"/",p=hm({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},g),v=h.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=hm({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!p)return null;Object.assign(s,p.params),l.push({params:s,pathname:ps([o,p.pathname]),pathnameBase:KO(ps([o,p.pathnameBase])),route:v}),p.pathnameBase!=="/"&&(o=ps([o,p.pathnameBase]))}return l}function hm(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=UO(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],l=o.replace(/(.)\/+$/,"$1"),u=s.slice(1);return{params:r.reduce((d,{paramName:g,isOptional:p},v)=>{if(g==="*"){let w=u[v]||"";l=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const y=u[v];return p&&!y?d[g]=void 0:d[g]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:l,pattern:e}}function UO(e,t=!1,n=!0){Fi(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,h,d,g)=>{if(r.push({paramName:u,isOptional:h!=null}),h){let p=g.charAt(d+l.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function $O(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Fi(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ys(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var WO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function VO(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?pc(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=QC(n.substring(1),"/"):o=QC(n,t)):o=t,{pathname:o,search:GO(r),hash:YO(s)}}function QC(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 n_(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 qO(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function i0(e){let t=qO(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Xm(e,t,n,r=!1){let s;typeof e=="string"?s=pc(e):(s={...e},hn(!s.pathname||!s.pathname.includes("?"),n_("?","pathname","search",s)),hn(!s.pathname||!s.pathname.includes("#"),n_("#","pathname","hash",s)),hn(!s.search||!s.search.includes("#"),n_("#","search","hash",s)));let o=e===""||s.pathname==="",l=o?"/":s.pathname,u;if(l==null)u=n;else{let p=t.length-1;if(!r&&l.startsWith("..")){let v=l.split("/");for(;v[0]==="..";)v.shift(),p-=1;s.pathname=v.join("/")}u=p>=0?t[p]:"/"}let h=VO(s,u),d=l&&l!=="/"&&l.endsWith("/"),g=(o||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(d||g)&&(h.pathname+="/"),h}var ps=e=>e.join("/").replace(/\/\/+/g,"/"),KO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),GO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,YO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,XO=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 ZO(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function QO(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var oT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function aT(e,t){let n=e;if(typeof n!="string"||!WO.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(oT)try{let o=new URL(window.location.href),l=n.startsWith("//")?new URL(o.protocol+n):new URL(n),u=Ys(l.pathname,t);l.origin===o.origin&&u!=null?n=u+l.search+l.hash:s=!0}catch{Fi(!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 lT=["POST","PUT","PATCH","DELETE"];new Set(lT);var JO=["GET",...lT];new Set(JO);var gc=_.createContext(null);gc.displayName="DataRouter";var Zm=_.createContext(null);Zm.displayName="DataRouterState";var eL=_.createContext(!1),cT=_.createContext({isTransitioning:!1});cT.displayName="ViewTransition";var tL=_.createContext(new Map);tL.displayName="Fetchers";var nL=_.createContext(null);nL.displayName="Await";var ai=_.createContext(null);ai.displayName="Navigation";var yd=_.createContext(null);yd.displayName="Location";var Ni=_.createContext({outlet:null,matches:[],isDataRoute:!1});Ni.displayName="Route";var s0=_.createContext(null);s0.displayName="RouteError";var uT="REACT_ROUTER_ERROR",rL="REDIRECT",iL="ROUTE_ERROR_RESPONSE";function sL(e){if(e.startsWith(`${uT}:${rL}:{`))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 oL(e){if(e.startsWith(`${uT}:${iL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new XO(t.status,t.statusText,t.data)}catch{}}function aL(e,{relative:t}={}){hn(vc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=_.useContext(ai),{hash:s,pathname:o,search:l}=wd(e,{relative:t}),u=o;return n!=="/"&&(u=o==="/"?n:ps([n,o])),r.createHref({pathname:u,search:l,hash:s})}function vc(){return _.useContext(yd)!=null}function Ki(){return hn(vc(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(yd).location}var dT="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function hT(e){_.useContext(ai).static||_.useLayoutEffect(e)}function xd(){let{isDataRoute:e}=_.useContext(Ni);return e?xL():lL()}function lL(){hn(vc(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(gc),{basename:t,navigator:n}=_.useContext(ai),{matches:r}=_.useContext(Ni),{pathname:s}=Ki(),o=JSON.stringify(i0(r)),l=_.useRef(!1);return hT(()=>{l.current=!0}),_.useCallback((h,d={})=>{if(Fi(l.current,dT),!l.current)return;if(typeof h=="number"){n.go(h);return}let g=Xm(h,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:ps([t,g.pathname])),(d.replace?n.replace:n.push)(g,d.state,d)},[t,n,o,s,e])}var fT=_.createContext(null);function o0(){return _.useContext(fT)}function cL(e){let t=_.useContext(Ni).outlet;return _.useMemo(()=>t&&_.createElement(fT.Provider,{value:e},t),[t,e])}function mT(){let{matches:e}=_.useContext(Ni),t=e[e.length-1];return t?t.params:{}}function wd(e,{relative:t}={}){let{matches:n}=_.useContext(Ni),{pathname:r}=Ki(),s=JSON.stringify(i0(n));return _.useMemo(()=>Xm(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function uL(e,t){return pT(e,t)}function pT(e,t,n){var C;hn(vc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=_.useContext(ai),{matches:s}=_.useContext(Ni),o=s[s.length-1],l=o?o.params:{},u=o?o.pathname:"/",h=o?o.pathnameBase:"/",d=o&&o.route;{let k=d&&d.path||"";vT(u,!d||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
|
|
60
|
+
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let g=Ki(),p;if(t){let k=typeof t=="string"?pc(t):t;hn(h==="/"||((C=k.pathname)==null?void 0:C.startsWith(h)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${k.pathname}" was given in the \`location\` prop.`),p=k}else p=g;let v=p.pathname||"/",y=v;if(h!=="/"){let k=h.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=rT(e,{pathname:y});Fi(d||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Fi(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=pL(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:ps([h,r.encodeLocation?r.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:ps([h,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,n);return t&&S?_.createElement(yd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},S):S}function dL(){let e=yL(),t=ZO(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},o={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:o},"ErrorBoundary")," or"," ",_.createElement("code",{style:o},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),n?_.createElement("pre",{style:s},n):null,l)}var hL=_.createElement(dL,null),gT=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=oL(e.digest);n&&(e=n)}let t=e!==void 0?_.createElement(Ni.Provider,{value:this.props.routeContext},_.createElement(s0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?_.createElement(fL,{error:e},t):t}};gT.contextType=eL;var r_=new WeakMap;function fL({children:e,error:t}){let{basename:n}=_.useContext(ai);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=sL(t.digest);if(r){let s=r_.get(t);if(s)throw s;let o=aT(r.location,n);if(oT&&!r_.get(t))if(o.isExternal||r.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw r_.set(t,l),l}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function mL({routeContext:e,match:t,children:n}){let r=_.useContext(gc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(Ni.Provider,{value:e},n)}function pL(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,o=r==null?void 0:r.errors;if(o!=null){let g=s.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);hn(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let l=!1,u=-1;if(n&&r){l=r.renderFallback;for(let g=0;g<s.length;g++){let p=s[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(u=g),p.route.id){let{loaderData:v,errors:y}=r,w=p.route.loader&&!v.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||w){n.isStatic&&(l=!0),u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}}let h=n==null?void 0:n.onError,d=r&&h?(g,p)=>{var v,y;h(g,{location:r.location,params:((y=(v=r.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:QO(r.matches),errorInfo:p})}:void 0;return s.reduceRight((g,p,v)=>{let y,w=!1,S=null,C=null;r&&(y=o&&p.route.id?o[p.route.id]:void 0,S=p.route.errorElement||hL,l&&(u<0&&v===0?(vT("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):u===v&&(w=!0,C=p.route.hydrateFallbackElement||null)));let k=t.concat(s.slice(0,v+1)),R=()=>{let E;return y?E=S:w?E=C:p.route.Component?E=_.createElement(p.route.Component,null):p.route.element?E=p.route.element:E=g,_.createElement(mL,{match:p,routeContext:{outlet:g,matches:k,isDataRoute:r!=null},children:E})};return r&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?_.createElement(gT,{location:r.location,revalidation:r.revalidation,component:S,error:y,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:d}):R()},null)}function a0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gL(e){let t=_.useContext(gc);return hn(t,a0(e)),t}function vL(e){let t=_.useContext(Zm);return hn(t,a0(e)),t}function _L(e){let t=_.useContext(Ni);return hn(t,a0(e)),t}function l0(e){let t=_L(e),n=t.matches[t.matches.length-1];return hn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function bL(){return l0("useRouteId")}function yL(){var r;let e=_.useContext(s0),t=vL("useRouteError"),n=l0("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function xL(){let{router:e}=gL("useNavigate"),t=l0("useNavigate"),n=_.useRef(!1);return hT(()=>{n.current=!0}),_.useCallback(async(s,o={})=>{Fi(n.current,dT),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var JC={};function vT(e,t,n){!t&&!JC[e]&&(JC[e]=!0,Fi(!1,n))}_.memo(wL);function wL({routes:e,future:t,state:n,isStatic:r,onError:s}){return pT(e,void 0,{state:n,isStatic:r,onError:s})}function SL({to:e,replace:t,state:n,relative:r}){hn(vc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=_.useContext(ai);Fi(!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:o}=_.useContext(Ni),{pathname:l}=Ki(),u=xd(),h=Xm(e,i0(o),l,r==="path"),d=JSON.stringify(h);return _.useEffect(()=>{u(JSON.parse(d),{replace:t,state:n,relative:r})},[u,d,r,t,n]),null}function CL(e){return cL(e.context)}function Gl(e){hn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function kL({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:o=!1,unstable_useTransitions:l}){hn(!vc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),h=_.useMemo(()=>({basename:u,navigator:s,static:o,unstable_useTransitions:l,future:{}}),[u,s,o,l]);typeof n=="string"&&(n=pc(n));let{pathname:d="/",search:g="",hash:p="",state:v=null,key:y="default",unstable_mask:w}=n,S=_.useMemo(()=>{let C=Ys(d,u);return C==null?null:{location:{pathname:C,search:g,hash:p,state:v,key:y,unstable_mask:w},navigationType:r}},[u,d,g,p,v,y,r,w]);return Fi(S!=null,`<Router basename="${u}"> is not able to match the URL "${d}${g}${p}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:_.createElement(ai.Provider,{value:h},_.createElement(yd.Provider,{children:t,value:S}))}function EL({children:e,location:t}){return uL(bb(e),t)}function bb(e,t=[]){let n=[];return _.Children.forEach(e,(r,s)=>{if(!_.isValidElement(r))return;let o=[...t,s];if(r.type===_.Fragment){n.push.apply(n,bb(r.props.children,o));return}hn(r.type===Gl,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),hn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=bb(r.props.children,o)),n.push(l)}),n}var qf="get",Kf="application/x-www-form-urlencoded";function Qm(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function RL(e){return Qm(e)&&e.tagName.toLowerCase()==="button"}function TL(e){return Qm(e)&&e.tagName.toLowerCase()==="form"}function ML(e){return Qm(e)&&e.tagName.toLowerCase()==="input"}function NL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function AL(e,t){return e.button===0&&(!t||t==="_self")&&!NL(e)}var df=null;function DL(){if(df===null)try{new FormData(document.createElement("form"),0),df=!1}catch{df=!0}return df}var jL=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function i_(e){return e!=null&&!jL.has(e)?(Fi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Kf}"`),null):e}function OL(e,t){let n,r,s,o,l;if(TL(e)){let u=e.getAttribute("action");r=u?Ys(u,t):null,n=e.getAttribute("method")||qf,s=i_(e.getAttribute("enctype"))||Kf,o=new FormData(e)}else if(RL(e)||ML(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||u.getAttribute("action");if(r=h?Ys(h,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||qf,s=i_(e.getAttribute("formenctype"))||i_(u.getAttribute("enctype"))||Kf,o=new FormData(u,e),!DL()){let{name:d,type:g,value:p}=e;if(g==="image"){let v=d?`${d}.`:"";o.append(`${v}x`,"0"),o.append(`${v}y`,"0")}else d&&o.append(d,p)}}else{if(Qm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=qf,r=null,s=Kf,l=e}return o&&s==="text/plain"&&(l=o,o=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:o,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function c0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function LL(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&Ys(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${r}`,s}async function zL(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 PL(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 BL(e,t,n){let r=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let l=await zL(o,n);return l.links?l.links():[]}return[]}));return UL(r.flat(1).filter(PL).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function ek(e,t,n,r,s,o){let l=(h,d)=>n[d]?h.route.id!==n[d].route.id:!0,u=(h,d)=>{var g;return n[d].pathname!==h.pathname||((g=n[d].route.path)==null?void 0:g.endsWith("*"))&&n[d].params["*"]!==h.params["*"]};return o==="assets"?t.filter((h,d)=>l(h,d)||u(h,d)):o==="data"?t.filter((h,d)=>{var p;let g=r.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(l(h,d)||u(h,d))return!0;if(h.route.shouldRevalidate){let v=h.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function IL(e,t,{includeHydrateFallback:n}={}){return HL(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function HL(e){return[...new Set(e)]}function FL(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function UL(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let o=JSON.stringify(FL(s));return n.has(o)||(n.add(o),r.push({key:o,link:s})),r},[])}function _T(){let e=_.useContext(gc);return c0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function $L(){let e=_.useContext(Zm);return c0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var u0=_.createContext(void 0);u0.displayName="FrameworkContext";function bT(){let e=_.useContext(u0);return c0(e,"You must render this element inside a <HydratedRouter> element"),e}function WL(e,t){let n=_.useContext(u0),[r,s]=_.useState(!1),[o,l]=_.useState(!1),{onFocus:u,onBlur:h,onMouseEnter:d,onMouseLeave:g,onTouchStart:p}=t,v=_.useRef(null);_.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let S=k=>{k.forEach(R=>{l(R.isIntersecting)})},C=new IntersectionObserver(S,{threshold:.5});return v.current&&C.observe(v.current),()=>{C.disconnect()}}},[e]),_.useEffect(()=>{if(r){let S=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(S)}}},[r]);let y=()=>{s(!0)},w=()=>{s(!1),l(!1)};return n?e!=="intent"?[o,v,{}]:[o,v,{onFocus:wu(u,y),onBlur:wu(h,w),onMouseEnter:wu(d,y),onMouseLeave:wu(g,w),onTouchStart:wu(p,y)}]:[!1,v,{}]}function wu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function VL({page:e,...t}){let{router:n}=_T(),r=_.useMemo(()=>rT(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?_.createElement(KL,{page:e,matches:r,...t}):null}function qL(e){let{manifest:t,routeModules:n}=bT(),[r,s]=_.useState([]);return _.useEffect(()=>{let o=!1;return BL(e,t,n).then(l=>{o||s(l)}),()=>{o=!0}},[e,t,n]),r}function KL({page:e,matches:t,...n}){let r=Ki(),{future:s,manifest:o,routeModules:l}=bT(),{basename:u}=_T(),{loaderData:h,matches:d}=$L(),g=_.useMemo(()=>ek(e,t,d,o,r,"data"),[e,t,d,o,r]),p=_.useMemo(()=>ek(e,t,d,o,r,"assets"),[e,t,d,o,r]),v=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let S=new Set,C=!1;if(t.forEach(R=>{var M;let E=o.routes[R.route.id];!E||!E.hasLoader||(!g.some(j=>j.route.id===R.route.id)&&R.route.id in h&&((M=l[R.route.id])!=null&&M.shouldRevalidate)||E.hasClientLoader?C=!0:S.add(R.route.id))}),S.size===0)return[];let k=LL(e,u,s.unstable_trailingSlashAwareDataRequests,"data");return C&&S.size>0&&k.searchParams.set("_routes",t.filter(R=>S.has(R.route.id)).map(R=>R.route.id).join(",")),[k.pathname+k.search]},[u,s.unstable_trailingSlashAwareDataRequests,h,r,o,g,t,e,l]),y=_.useMemo(()=>IL(p,o),[p,o]),w=qL(p);return _.createElement(_.Fragment,null,v.map(S=>_.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),y.map(S=>_.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),w.map(({key:S,link:C})=>_.createElement("link",{key:S,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function GL(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var YL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{YL&&(window.__reactRouterVersion="7.13.1")}catch{}function XL({basename:e,children:t,unstable_useTransitions:n,window:r}){let s=_.useRef();s.current==null&&(s.current=RO({window:r,v5Compat:!0}));let o=s.current,[l,u]=_.useState({action:o.action,location:o.location}),h=_.useCallback(d=>{n===!1?u(d):_.startTransition(()=>u(d))},[n]);return _.useLayoutEffect(()=>o.listen(h),[o,h]),_.createElement(kL,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,unstable_useTransitions:n})}var yT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xT=_.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:o,replace:l,unstable_mask:u,state:h,target:d,to:g,preventScrollReset:p,viewTransition:v,unstable_defaultShouldRevalidate:y,...w},S){let{basename:C,navigator:k,unstable_useTransitions:R}=_.useContext(ai),E=typeof g=="string"&&yT.test(g),M=aT(g,C);g=M.to;let j=aL(g,{relative:s}),D=Ki(),L=null;if(u){let q=Xm(u,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);C!=="/"&&(q.pathname=q.pathname==="/"?C:ps([C,q.pathname])),L=k.createHref(q)}let[$,Y,P]=WL(r,w),V=ez(g,{replace:l,unstable_mask:u,state:h,target:d,preventScrollReset:p,relative:s,viewTransition:v,unstable_defaultShouldRevalidate:y,unstable_useTransitions:R});function I(q){t&&t(q),q.defaultPrevented||V(q)}let W=!(M.isExternal||o),K=_.createElement("a",{...w,...P,href:(W?L:void 0)||M.absoluteURL||j,onClick:W?I:t,ref:GL(S,Y),target:d,"data-discover":!E&&n==="render"?"true":void 0});return $&&!E?_.createElement(_.Fragment,null,K,_.createElement(VL,{page:j})):K});xT.displayName="Link";var ZL=_.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:o,to:l,viewTransition:u,children:h,...d},g){let p=wd(l,{relative:d.relative}),v=Ki(),y=_.useContext(Zm),{navigator:w,basename:S}=_.useContext(ai),C=y!=null&&sz(p)&&u===!0,k=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,R=v.pathname,E=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(R=R.toLowerCase(),E=E?E.toLowerCase():null,k=k.toLowerCase()),E&&S&&(E=Ys(E,S)||E);const M=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let j=R===k||!s&&R.startsWith(k)&&R.charAt(M)==="/",D=E!=null&&(E===k||!s&&E.startsWith(k)&&E.charAt(k.length)==="/"),L={isActive:j,isPending:D,isTransitioning:C},$=j?t:void 0,Y;typeof r=="function"?Y=r(L):Y=[r,j?"active":null,D?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let P=typeof o=="function"?o(L):o;return _.createElement(xT,{...d,"aria-current":$,className:Y,ref:g,style:P,to:l,viewTransition:u},typeof h=="function"?h(L):h)});ZL.displayName="NavLink";var QL=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:o,method:l=qf,action:u,onSubmit:h,relative:d,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:v,...y},w)=>{let{unstable_useTransitions:S}=_.useContext(ai),C=rz(),k=iz(u,{relative:d}),R=l.toLowerCase()==="get"?"get":"post",E=typeof u=="string"&&yT.test(u),M=j=>{if(h&&h(j),j.defaultPrevented)return;j.preventDefault();let D=j.nativeEvent.submitter,L=(D==null?void 0:D.getAttribute("formmethod"))||l,$=()=>C(D||j.currentTarget,{fetcherKey:t,method:L,navigate:n,replace:s,state:o,relative:d,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:v});S&&n!==!1?_.startTransition(()=>$()):$()};return _.createElement("form",{ref:w,method:R,action:k,onSubmit:r?h:M,...y,"data-discover":!E&&e==="render"?"true":void 0})});QL.displayName="Form";function JL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wT(e){let t=_.useContext(gc);return hn(t,JL(e)),t}function ez(e,{target:t,replace:n,unstable_mask:r,state:s,preventScrollReset:o,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let g=xd(),p=Ki(),v=wd(e,{relative:l});return _.useCallback(y=>{if(AL(y,t)){y.preventDefault();let w=n!==void 0?n:rd(p)===rd(v),S=()=>g(e,{replace:w,unstable_mask:r,state:s,preventScrollReset:o,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:h});d?_.startTransition(()=>S()):S()}},[p,g,v,n,r,s,t,e,o,l,u,h,d])}var tz=0,nz=()=>`__${String(++tz)}__`;function rz(){let{router:e}=wT("useSubmit"),{basename:t}=_.useContext(ai),n=bL(),r=e.fetch,s=e.navigate;return _.useCallback(async(o,l={})=>{let{action:u,method:h,encType:d,formData:g,body:p}=OL(o,t);if(l.navigate===!1){let v=l.fetcherKey||nz();await r(v,n,l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:g,body:p,formMethod:l.method||h,formEncType:l.encType||d,flushSync:l.flushSync})}else await s(l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:g,body:p,formMethod:l.method||h,formEncType:l.encType||d,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[r,s,t,n])}function iz(e,{relative:t}={}){let{basename:n}=_.useContext(ai),r=_.useContext(Ni);hn(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),o={...wd(e||".",{relative:t})},l=Ki();if(e==null){o.search=l.search;let u=new URLSearchParams(o.search),h=u.getAll("index");if(h.some(g=>g==="")){u.delete("index"),h.filter(p=>p).forEach(p=>u.append("index",p));let g=u.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:ps([n,o.pathname])),rd(o)}function sz(e,{relative:t}={}){let n=_.useContext(cT);hn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=wT("useViewTransitionState"),s=wd(e,{relative:t});if(!n.isTransitioning)return!1;let o=Ys(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Ys(n.nextLocation.pathname,r)||n.nextLocation.pathname;return hm(s.pathname,l)!=null||hm(s.pathname,o)!=null}var Bi=nT();const ST=Ym(Bi);function oz(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const az=e=>{switch(e){case"success":return uz;case"info":return hz;case"warning":return dz;case"error":return fz;default:return null}},lz=Array(12).fill(0),cz=({visible:e,className:t})=>ye.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ye.createElement("div",{className:"sonner-spinner"},lz.map((n,r)=>ye.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),uz=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),dz=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),hz=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),fz=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),mz=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ye.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ye.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),pz=()=>{const[e,t]=ye.useState(document.hidden);return ye.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let yb=1;class gz{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:yb++,l=this.toasts.find(h=>h.id===o),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),l?this.toasts=this.toasts.map(h=>h.id===o?(this.publish({...h,...t,id:o,title:r}),{...h,...t,id:o,dismissible:u,title:r}):h):this.addToast({title:r,...s,dismissible:u,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,l;const u=s.then(async d=>{if(l=["resolve",d],ye.isValidElement(d))o=!1,this.create({id:r,type:"default",message:d});else if(_z(d)&&!d.ok){o=!1;const p=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,v=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:v,...w})}else if(d instanceof Error){o=!1;const p=typeof n.error=="function"?await n.error(d):n.error,v=typeof n.description=="function"?await n.description(d):n.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:v,...w})}else if(n.success!==void 0){o=!1;const p=typeof n.success=="function"?await n.success(d):n.success,v=typeof n.description=="function"?await n.description(d):n.description,w=typeof p=="object"&&!ye.isValidElement(p)?p:{message:p};this.create({id:r,type:"success",description:v,...w})}}).catch(async d=>{if(l=["reject",d],n.error!==void 0){o=!1;const g=typeof n.error=="function"?await n.error(d):n.error,p=typeof n.description=="function"?await n.description(d):n.description,y=typeof g=="object"&&!ye.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:p,...y})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),h=()=>new Promise((d,g)=>u.then(()=>l[0]==="reject"?g(l[1]):d(l[1])).catch(g));return typeof r!="string"&&typeof r!="number"?{unwrap:h}:Object.assign(r,{unwrap:h})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||yb++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ur=new gz,vz=(e,t)=>{const n=(t==null?void 0:t.id)||yb++;return Ur.addToast({title:e,...t,id:n}),n},_z=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",bz=vz,yz=()=>Ur.toasts,xz=()=>Ur.getActiveToasts(),hf=Object.assign(bz,{success:Ur.success,info:Ur.info,warning:Ur.warning,error:Ur.error,custom:Ur.custom,message:Ur.message,promise:Ur.promise,dismiss:Ur.dismiss,loading:Ur.loading},{getHistory:yz,getToasts:xz});oz("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ff(e){return e.label!==void 0}const wz=3,Sz="24px",Cz="16px",tk=4e3,kz=356,Ez=14,Rz=45,Tz=200;function ts(...e){return e.filter(Boolean).join(" ")}function Mz(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const Nz=e=>{var t,n,r,s,o,l,u,h,d;const{invert:g,toast:p,unstyled:v,interacting:y,setHeights:w,visibleToasts:S,heights:C,index:k,toasts:R,expanded:E,removeToast:M,defaultRichColors:j,closeButton:D,style:L,cancelButtonStyle:$,actionButtonStyle:Y,className:P="",descriptionClassName:V="",duration:I,position:W,gap:K,expandByDefault:q,classNames:O,icons:H,closeButtonAriaLabel:U="Close toast"}=e,[F,N]=ye.useState(null),[B,X]=ye.useState(null),[A,ne]=ye.useState(!1),[ae,Z]=ye.useState(!1),[te,le]=ye.useState(!1),[me,xe]=ye.useState(!1),[Ae,Re]=ye.useState(!1),[je,Ye]=ye.useState(0),[xt,ft]=ye.useState(0),he=ye.useRef(p.duration||I||tk),Pe=ye.useRef(null),Ne=ye.useRef(null),tt=k===0,wt=k+1<=S,$e=p.type,pt=p.dismissible!==!1,Se=p.className||"",De=p.descriptionClassName||"",ce=ye.useMemo(()=>C.findIndex(Fe=>Fe.toastId===p.id)||0,[C,p.id]),be=ye.useMemo(()=>{var Fe;return(Fe=p.closeButton)!=null?Fe:D},[p.closeButton,D]),Oe=ye.useMemo(()=>p.duration||I||tk,[p.duration,I]),Ve=ye.useRef(0),we=ye.useRef(0),He=ye.useRef(0),ot=ye.useRef(null),[rt,Le]=W.split("-"),St=ye.useMemo(()=>C.reduce((Fe,ct,st)=>st>=ce?Fe:Fe+ct.height,0),[C,ce]),at=pz(),vn=p.invert||g,tn=$e==="loading";we.current=ye.useMemo(()=>ce*K+St,[ce,St]),ye.useEffect(()=>{he.current=Oe},[Oe]),ye.useEffect(()=>{ne(!0)},[]),ye.useEffect(()=>{const Fe=Ne.current;if(Fe){const ct=Fe.getBoundingClientRect().height;return ft(ct),w(st=>[{toastId:p.id,height:ct,position:p.position},...st]),()=>w(st=>st.filter(mt=>mt.toastId!==p.id))}},[w,p.id]),ye.useLayoutEffect(()=>{if(!A)return;const Fe=Ne.current,ct=Fe.style.height;Fe.style.height="auto";const st=Fe.getBoundingClientRect().height;Fe.style.height=ct,ft(st),w(mt=>mt.find(Ce=>Ce.toastId===p.id)?mt.map(Ce=>Ce.toastId===p.id?{...Ce,height:st}:Ce):[{toastId:p.id,height:st,position:p.position},...mt])},[A,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const Nn=ye.useCallback(()=>{Z(!0),Ye(we.current),w(Fe=>Fe.filter(ct=>ct.toastId!==p.id)),setTimeout(()=>{M(p)},Tz)},[p,M,w,we]);ye.useEffect(()=>{if(p.promise&&$e==="loading"||p.duration===1/0||p.type==="loading")return;let Fe;return E||y||at?(()=>{if(He.current<Ve.current){const mt=new Date().getTime()-Ve.current;he.current=he.current-mt}He.current=new Date().getTime()})():(()=>{he.current!==1/0&&(Ve.current=new Date().getTime(),Fe=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Nn()},he.current))})(),()=>clearTimeout(Fe)},[E,y,p,$e,at,Nn]),ye.useEffect(()=>{p.delete&&(Nn(),p.onDismiss==null||p.onDismiss.call(p,p))},[Nn,p.delete]);function xr(){var Fe;if(H!=null&&H.loading){var ct;return ye.createElement("div",{className:ts(O==null?void 0:O.loader,p==null||(ct=p.classNames)==null?void 0:ct.loader,"sonner-loader"),"data-visible":$e==="loading"},H.loading)}return ye.createElement(cz,{className:ts(O==null?void 0:O.loader,p==null||(Fe=p.classNames)==null?void 0:Fe.loader),visible:$e==="loading"})}const Kn=p.icon||(H==null?void 0:H[$e])||az($e);var jt,zt;return ye.createElement("li",{tabIndex:0,ref:Ne,className:ts(P,Se,O==null?void 0:O.toast,p==null||(t=p.classNames)==null?void 0:t.toast,O==null?void 0:O.default,O==null?void 0:O[$e],p==null||(n=p.classNames)==null?void 0:n[$e]),"data-sonner-toast":"","data-rich-colors":(jt=p.richColors)!=null?jt:j,"data-styled":!(p.jsx||p.unstyled||v),"data-mounted":A,"data-promise":!!p.promise,"data-swiped":Ae,"data-removed":ae,"data-visible":wt,"data-y-position":rt,"data-x-position":Le,"data-index":k,"data-front":tt,"data-swiping":te,"data-dismissible":pt,"data-type":$e,"data-invert":vn,"data-swipe-out":me,"data-swipe-direction":B,"data-expanded":!!(E||q&&A),"data-testid":p.testId,style:{"--index":k,"--toasts-before":k,"--z-index":R.length-k,"--offset":`${ae?je:we.current}px`,"--initial-height":q?"auto":`${xt}px`,...L,...p.style},onDragEnd:()=>{le(!1),N(null),ot.current=null},onPointerDown:Fe=>{Fe.button!==2&&(tn||!pt||(Pe.current=new Date,Ye(we.current),Fe.target.setPointerCapture(Fe.pointerId),Fe.target.tagName!=="BUTTON"&&(le(!0),ot.current={x:Fe.clientX,y:Fe.clientY})))},onPointerUp:()=>{var Fe,ct,st;if(me||!pt)return;ot.current=null;const mt=Number(((Fe=Ne.current)==null?void 0:Fe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),an=Number(((ct=Ne.current)==null?void 0:ct.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ce=new Date().getTime()-((st=Pe.current)==null?void 0:st.getTime()),Te=F==="x"?mt:an,gt=Math.abs(Te)/Ce;if(Math.abs(Te)>=Rz||gt>.11){Ye(we.current),p.onDismiss==null||p.onDismiss.call(p,p),X(F==="x"?mt>0?"right":"left":an>0?"down":"up"),Nn(),xe(!0);return}else{var Qe,vt;(Qe=Ne.current)==null||Qe.style.setProperty("--swipe-amount-x","0px"),(vt=Ne.current)==null||vt.style.setProperty("--swipe-amount-y","0px")}Re(!1),le(!1),N(null)},onPointerMove:Fe=>{var ct,st,mt;if(!ot.current||!pt||((ct=window.getSelection())==null?void 0:ct.toString().length)>0)return;const Ce=Fe.clientY-ot.current.y,Te=Fe.clientX-ot.current.x;var gt;const Qe=(gt=e.swipeDirections)!=null?gt:Mz(W);!F&&(Math.abs(Te)>1||Math.abs(Ce)>1)&&N(Math.abs(Te)>Math.abs(Ce)?"x":"y");let vt={x:0,y:0};const qt=Ot=>1/(1.5+Math.abs(Ot)/20);if(F==="y"){if(Qe.includes("top")||Qe.includes("bottom"))if(Qe.includes("top")&&Ce<0||Qe.includes("bottom")&&Ce>0)vt.y=Ce;else{const Ot=Ce*qt(Ce);vt.y=Math.abs(Ot)<Math.abs(Ce)?Ot:Ce}}else if(F==="x"&&(Qe.includes("left")||Qe.includes("right")))if(Qe.includes("left")&&Te<0||Qe.includes("right")&&Te>0)vt.x=Te;else{const Ot=Te*qt(Te);vt.x=Math.abs(Ot)<Math.abs(Te)?Ot:Te}(Math.abs(vt.x)>0||Math.abs(vt.y)>0)&&Re(!0),(st=Ne.current)==null||st.style.setProperty("--swipe-amount-x",`${vt.x}px`),(mt=Ne.current)==null||mt.style.setProperty("--swipe-amount-y",`${vt.y}px`)}},be&&!p.jsx&&$e!=="loading"?ye.createElement("button",{"aria-label":U,"data-disabled":tn,"data-close-button":!0,onClick:tn||!pt?()=>{}:()=>{Nn(),p.onDismiss==null||p.onDismiss.call(p,p)},className:ts(O==null?void 0:O.closeButton,p==null||(r=p.classNames)==null?void 0:r.closeButton)},(zt=H==null?void 0:H.close)!=null?zt:mz):null,($e||p.icon||p.promise)&&p.icon!==null&&((H==null?void 0:H[$e])!==null||p.icon)?ye.createElement("div",{"data-icon":"",className:ts(O==null?void 0:O.icon,p==null||(s=p.classNames)==null?void 0:s.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||xr():null,p.type!=="loading"?Kn:null):null,ye.createElement("div",{"data-content":"",className:ts(O==null?void 0:O.content,p==null||(o=p.classNames)==null?void 0:o.content)},ye.createElement("div",{"data-title":"",className:ts(O==null?void 0:O.title,p==null||(l=p.classNames)==null?void 0:l.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?ye.createElement("div",{"data-description":"",className:ts(V,De,O==null?void 0:O.description,p==null||(u=p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),ye.isValidElement(p.cancel)?p.cancel:p.cancel&&ff(p.cancel)?ye.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||$,onClick:Fe=>{ff(p.cancel)&&pt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Fe),Nn())},className:ts(O==null?void 0:O.cancelButton,p==null||(h=p.classNames)==null?void 0:h.cancelButton)},p.cancel.label):null,ye.isValidElement(p.action)?p.action:p.action&&ff(p.action)?ye.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||Y,onClick:Fe=>{ff(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Fe),!Fe.defaultPrevented&&Nn())},className:ts(O==null?void 0:O.actionButton,p==null||(d=p.classNames)==null?void 0:d.actionButton)},p.action.label):null)};function nk(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Az(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,l=o?"--mobile-offset":"--offset",u=o?Cz:Sz;function h(d){["top","right","bottom","left"].forEach(g=>{n[`${l}-${g}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?h(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${l}-${d}`]=u:n[`${l}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):h(u)}),n}const Dz=ye.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:u,closeButton:h,className:d,offset:g,mobileOffset:p,theme:v="light",richColors:y,duration:w,style:S,visibleToasts:C=wz,toastOptions:k,dir:R=nk(),gap:E=Ez,icons:M,containerAriaLabel:j="Notifications"}=t,[D,L]=ye.useState([]),$=ye.useMemo(()=>r?D.filter(A=>A.toasterId===r):D.filter(A=>!A.toasterId),[D,r]),Y=ye.useMemo(()=>Array.from(new Set([o].concat($.filter(A=>A.position).map(A=>A.position)))),[$,o]),[P,V]=ye.useState([]),[I,W]=ye.useState(!1),[K,q]=ye.useState(!1),[O,H]=ye.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),U=ye.useRef(null),F=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=ye.useRef(null),B=ye.useRef(!1),X=ye.useCallback(A=>{L(ne=>{var ae;return(ae=ne.find(Z=>Z.id===A.id))!=null&&ae.delete||Ur.dismiss(A.id),ne.filter(({id:Z})=>Z!==A.id)})},[]);return ye.useEffect(()=>Ur.subscribe(A=>{if(A.dismiss){requestAnimationFrame(()=>{L(ne=>ne.map(ae=>ae.id===A.id?{...ae,delete:!0}:ae))});return}setTimeout(()=>{ST.flushSync(()=>{L(ne=>{const ae=ne.findIndex(Z=>Z.id===A.id);return ae!==-1?[...ne.slice(0,ae),{...ne[ae],...A},...ne.slice(ae+1)]:[A,...ne]})})})}),[D]),ye.useEffect(()=>{if(v!=="system"){H(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window>"u")return;const A=window.matchMedia("(prefers-color-scheme: dark)");try{A.addEventListener("change",({matches:ne})=>{H(ne?"dark":"light")})}catch{A.addListener(({matches:ae})=>{try{H(ae?"dark":"light")}catch(Z){console.error(Z)}})}},[v]),ye.useEffect(()=>{D.length<=1&&W(!1)},[D]),ye.useEffect(()=>{const A=ne=>{var ae;if(l.every(le=>ne[le]||ne.code===le)){var te;W(!0),(te=U.current)==null||te.focus()}ne.code==="Escape"&&(document.activeElement===U.current||(ae=U.current)!=null&&ae.contains(document.activeElement))&&W(!1)};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[l]),ye.useEffect(()=>{if(U.current)return()=>{N.current&&(N.current.focus({preventScroll:!0}),N.current=null,B.current=!1)}},[U.current]),ye.createElement("section",{ref:n,"aria-label":`${j} ${F}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Y.map((A,ne)=>{var ae;const[Z,te]=A.split("-");return $.length?ye.createElement("ol",{key:A,dir:R==="auto"?nk():R,tabIndex:-1,ref:U,className:d,"data-sonner-toaster":!0,"data-sonner-theme":O,"data-y-position":Z,"data-x-position":te,style:{"--front-toast-height":`${((ae=P[0])==null?void 0:ae.height)||0}px`,"--width":`${kz}px`,"--gap":`${E}px`,...S,...Az(g,p)},onBlur:le=>{B.current&&!le.currentTarget.contains(le.relatedTarget)&&(B.current=!1,N.current&&(N.current.focus({preventScroll:!0}),N.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||B.current||(B.current=!0,N.current=le.relatedTarget)},onMouseEnter:()=>W(!0),onMouseMove:()=>W(!0),onMouseLeave:()=>{K||W(!1)},onDragEnd:()=>W(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||q(!0)},onPointerUp:()=>q(!1)},$.filter(le=>!le.position&&ne===0||le.position===A).map((le,me)=>{var xe,Ae;return ye.createElement(Nz,{key:le.id,icons:M,index:me,toast:le,defaultRichColors:y,duration:(xe=k==null?void 0:k.duration)!=null?xe:w,className:k==null?void 0:k.className,descriptionClassName:k==null?void 0:k.descriptionClassName,invert:s,visibleToasts:C,closeButton:(Ae=k==null?void 0:k.closeButton)!=null?Ae:h,interacting:K,position:A,style:k==null?void 0:k.style,unstyled:k==null?void 0:k.unstyled,classNames:k==null?void 0:k.classNames,cancelButtonStyle:k==null?void 0:k.cancelButtonStyle,actionButtonStyle:k==null?void 0:k.actionButtonStyle,closeButtonAriaLabel:k==null?void 0:k.closeButtonAriaLabel,removeToast:X,toasts:$.filter(Re=>Re.position==le.position),heights:P.filter(Re=>Re.position==le.position),setHeights:V,expandByDefault:u,gap:E,expanded:I,swipeDirections:t.swipeDirections})})):null}))});function CT(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=CT(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function kT(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=CT(e))&&(r&&(r+=" "),r+=t);return r}const rk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ik=kT,jz=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ik(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,l=Object.keys(s).map(d=>{const g=n==null?void 0:n[d],p=o==null?void 0:o[d];if(g===null)return null;const v=rk(g)||rk(p);return s[d][v]}),u=n&&Object.entries(n).reduce((d,g)=>{let[p,v]=g;return v===void 0||(d[p]=v),d},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,g)=>{let{class:p,className:v,...y}=g;return Object.entries(y).every(w=>{let[S,C]=w;return Array.isArray(C)?C.includes({...o,...u}[S]):{...o,...u}[S]===C})?[...d,p,v]:d},[]);return ik(e,l,h,n==null?void 0:n.class,n==null?void 0:n.className)},Oz=(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},Lz=(e,t)=>({classGroupId:e,validator:t}),ET=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),fm="-",sk=[],zz="arbitrary..",Pz=e=>{const t=Iz(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return Bz(l);const u=l.split(fm),h=u[0]===""&&u.length>1?1:0;return RT(u,h,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const h=r[l],d=n[l];return h?d?Oz(d,h):h:d||sk}return n[l]||sk}}},RT=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const d=RT(e,t+1,o);if(d)return d}const l=n.validators;if(l===null)return;const u=t===0?e.join(fm):e.slice(t).join(fm),h=l.length;for(let d=0;d<h;d++){const g=l[d];if(g.validator(u))return g.classGroupId}},Bz=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?zz+r:void 0})(),Iz=e=>{const{theme:t,classGroups:n}=e;return Hz(n,t)},Hz=(e,t)=>{const n=ET();for(const r in e){const s=e[r];d0(s,n,r,t)}return n},d0=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const l=e[o];Fz(l,t,n,r)}},Fz=(e,t,n,r)=>{if(typeof e=="string"){Uz(e,t,n);return}if(typeof e=="function"){$z(e,t,n,r);return}Wz(e,t,n,r)},Uz=(e,t,n)=>{const r=e===""?t:TT(t,e);r.classGroupId=n},$z=(e,t,n,r)=>{if(Vz(e)){d0(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Lz(n,e))},Wz=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let l=0;l<o;l++){const[u,h]=s[l];d0(h,TT(t,u),n,r)}},TT=(e,t)=>{let n=e;const r=t.split(fm),s=r.length;for(let o=0;o<s;o++){const l=r[o];let u=n.nextPart.get(l);u||(u=ET(),n.nextPart.set(l,u)),n=u}return n},Vz=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,qz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,l)=>{n[o]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let l=n[o];if(l!==void 0)return l;if((l=r[o])!==void 0)return s(o,l),l},set(o,l){o in n?n[o]=l:s(o,l)}}},xb="!",ok=":",Kz=[],ak=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Gz=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let l=0,u=0,h=0,d;const g=s.length;for(let S=0;S<g;S++){const C=s[S];if(l===0&&u===0){if(C===ok){o.push(s.slice(h,S)),h=S+1;continue}if(C==="/"){d=S;continue}}C==="["?l++:C==="]"?l--:C==="("?u++:C===")"&&u--}const p=o.length===0?s:s.slice(h);let v=p,y=!1;p.endsWith(xb)?(v=p.slice(0,-1),y=!0):p.startsWith(xb)&&(v=p.slice(1),y=!0);const w=d&&d>h?d-h:void 0;return ak(o,y,v,w)};if(t){const s=t+ok,o=r;r=l=>l.startsWith(s)?o(l.slice(s.length)):ak(Kz,!1,l,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},Yz=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const l=n[o],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}},Xz=e=>({cache:qz(e.cacheSize),parseClassName:Gz(e),sortModifiers:Yz(e),...Pz(e)}),Zz=/\s+/,Qz=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o}=t,l=[],u=e.trim().split(Zz);let h="";for(let d=u.length-1;d>=0;d-=1){const g=u[d],{isExternal:p,modifiers:v,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:S}=n(g);if(p){h=g+(h.length>0?" "+h:h);continue}let C=!!S,k=r(C?w.substring(0,S):w);if(!k){if(!C){h=g+(h.length>0?" "+h:h);continue}if(k=r(w),!k){h=g+(h.length>0?" "+h:h);continue}C=!1}const R=v.length===0?"":v.length===1?v[0]:o(v).join(":"),E=y?R+xb:R,M=E+k;if(l.indexOf(M)>-1)continue;l.push(M);const j=s(k,C);for(let D=0;D<j.length;++D){const L=j[D];l.push(E+L)}h=g+(h.length>0?" "+h:h)}return h},Jz=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=MT(n))&&(s&&(s+=" "),s+=r);return s},MT=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=MT(e[r]))&&(n&&(n+=" "),n+=t);return n},eP=(e,...t)=>{let n,r,s,o;const l=h=>{const d=t.reduce((g,p)=>p(g),e());return n=Xz(d),r=n.cache.get,s=n.cache.set,o=u,u(h)},u=h=>{const d=r(h);if(d)return d;const g=Qz(h,n);return s(h,g),g};return o=l,(...h)=>o(Jz(...h))},tP=[],Fn=e=>{const t=n=>n[e]||tP;return t.isThemeGetter=!0,t},NT=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,AT=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nP=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,rP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,iP=/\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$/,sP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lo=e=>nP.test(e),bt=e=>!!e&&!Number.isNaN(Number(e)),zo=e=>!!e&&Number.isInteger(Number(e)),s_=e=>e.endsWith("%")&&bt(e.slice(0,-1)),Hs=e=>rP.test(e),DT=()=>!0,lP=e=>iP.test(e)&&!sP.test(e),h0=()=>!1,cP=e=>oP.test(e),uP=e=>aP.test(e),dP=e=>!qe(e)&&!Ke(e),hP=e=>Jo(e,LT,h0),qe=e=>NT.test(e),Sa=e=>Jo(e,zT,lP),lk=e=>Jo(e,yP,bt),fP=e=>Jo(e,BT,DT),mP=e=>Jo(e,PT,h0),ck=e=>Jo(e,jT,h0),pP=e=>Jo(e,OT,uP),mf=e=>Jo(e,IT,cP),Ke=e=>AT.test(e),Su=e=>Qa(e,zT),gP=e=>Qa(e,PT),uk=e=>Qa(e,jT),vP=e=>Qa(e,LT),_P=e=>Qa(e,OT),pf=e=>Qa(e,IT,!0),bP=e=>Qa(e,BT,!0),Jo=(e,t,n)=>{const r=NT.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Qa=(e,t,n=!1)=>{const r=AT.exec(e);return r?r[1]?t(r[1]):n:!1},jT=e=>e==="position"||e==="percentage",OT=e=>e==="image"||e==="url",LT=e=>e==="length"||e==="size"||e==="bg-size",zT=e=>e==="length",yP=e=>e==="number",PT=e=>e==="family-name",BT=e=>e==="number"||e==="weight",IT=e=>e==="shadow",xP=()=>{const e=Fn("color"),t=Fn("font"),n=Fn("text"),r=Fn("font-weight"),s=Fn("tracking"),o=Fn("leading"),l=Fn("breakpoint"),u=Fn("container"),h=Fn("spacing"),d=Fn("radius"),g=Fn("shadow"),p=Fn("inset-shadow"),v=Fn("text-shadow"),y=Fn("drop-shadow"),w=Fn("blur"),S=Fn("perspective"),C=Fn("aspect"),k=Fn("ease"),R=Fn("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...M(),Ke,qe],D=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],$=()=>[Ke,qe,h],Y=()=>[Lo,"full","auto",...$()],P=()=>[zo,"none","subgrid",Ke,qe],V=()=>["auto",{span:["full",zo,Ke,qe]},zo,Ke,qe],I=()=>[zo,"auto",Ke,qe],W=()=>["auto","min","max","fr",Ke,qe],K=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...$()],H=()=>[Lo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],U=()=>[Lo,"screen","full","dvw","lvw","svw","min","max","fit",...$()],F=()=>[Lo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...$()],N=()=>[e,Ke,qe],B=()=>[...M(),uk,ck,{position:[Ke,qe]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",vP,hP,{size:[Ke,qe]}],ne=()=>[s_,Su,Sa],ae=()=>["","none","full",d,Ke,qe],Z=()=>["",bt,Su,Sa],te=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[bt,s_,uk,ck],xe=()=>["","none",w,Ke,qe],Ae=()=>["none",bt,Ke,qe],Re=()=>["none",bt,Ke,qe],je=()=>[bt,Ke,qe],Ye=()=>[Lo,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Hs],breakpoint:[Hs],color:[DT],container:[Hs],"drop-shadow":[Hs],ease:["in","out","in-out"],font:[dP],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Hs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Hs],shadow:[Hs],spacing:["px",bt],text:[Hs],"text-shadow":[Hs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Lo,qe,Ke,C]}],container:["container"],columns:[{columns:[bt,qe,Ke,u]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{"inset-s":Y(),start:Y()}],end:[{"inset-e":Y(),end:Y()}],"inset-bs":[{"inset-bs":Y()}],"inset-be":[{"inset-be":Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[zo,"auto",Ke,qe]}],basis:[{basis:[Lo,"full","auto",u,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[bt,Lo,"auto","initial","none",qe]}],grow:[{grow:["",bt,Ke,qe]}],shrink:[{shrink:["",bt,Ke,qe]}],order:[{order:[zo,"first","last","none",Ke,qe]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...K(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...K()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":K()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pbs:[{pbs:$()}],pbe:[{pbe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[u,"screen",...H()]}],"min-w":[{"min-w":[u,"screen","none",...H()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",n,Su,Sa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,bP,fP]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",s_,qe]}],"font-family":[{font:[gP,mP,t]}],"font-features":[{"font-features":[qe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ke,qe]}],"line-clamp":[{"line-clamp":[bt,"none",Ke,lk]}],leading:[{leading:[o,...$()]}],"list-image":[{"list-image":["none",Ke,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ke,qe]}],"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:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[bt,"from-font","auto",Ke,Sa]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[bt,"auto",Ke,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke,qe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ke,qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},zo,Ke,qe],radial:["",Ke,qe],conic:[zo,Ke,qe]},_P,pP]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border: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:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[bt,Ke,qe]}],"outline-w":[{outline:["",bt,Su,Sa]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",g,pf,mf]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",p,pf,mf]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[bt,Sa]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",v,pf,mf]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[bt,Ke,qe]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[bt]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"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":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"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":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"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":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"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":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"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":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"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":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[Ke,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"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":[bt]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"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:B()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ke,qe]}],filter:[{filter:["","none",Ke,qe]}],blur:[{blur:xe()}],brightness:[{brightness:[bt,Ke,qe]}],contrast:[{contrast:[bt,Ke,qe]}],"drop-shadow":[{"drop-shadow":["","none",y,pf,mf]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",bt,Ke,qe]}],"hue-rotate":[{"hue-rotate":[bt,Ke,qe]}],invert:[{invert:["",bt,Ke,qe]}],saturate:[{saturate:[bt,Ke,qe]}],sepia:[{sepia:["",bt,Ke,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ke,qe]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[bt,Ke,qe]}],"backdrop-contrast":[{"backdrop-contrast":[bt,Ke,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",bt,Ke,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[bt,Ke,qe]}],"backdrop-invert":[{"backdrop-invert":["",bt,Ke,qe]}],"backdrop-opacity":[{"backdrop-opacity":[bt,Ke,qe]}],"backdrop-saturate":[{"backdrop-saturate":[bt,Ke,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",bt,Ke,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ke,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[bt,"initial",Ke,qe]}],ease:[{ease:["linear","initial",k,Ke,qe]}],delay:[{delay:[bt,Ke,qe]}],animate:[{animate:["none",R,Ke,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ke,qe]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:Ae()}],"rotate-x":[{"rotate-x":Ae()}],"rotate-y":[{"rotate-y":Ae()}],"rotate-z":[{"rotate-z":Ae()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[Ke,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ye()}],"translate-x":[{"translate-x":Ye()}],"translate-y":[{"translate-y":Ye()}],"translate-z":[{"translate-z":Ye()}],"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",Ke,qe]}],"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":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mbs":[{"scroll-mbs":$()}],"scroll-mbe":[{"scroll-mbe":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pbs":[{"scroll-pbs":$()}],"scroll-pbe":[{"scroll-pbe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ke,qe]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[bt,Su,Sa,lk]}],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"]}},wP=eP(xP);function pe(...e){return wP(kT(e))}function Gf(){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 dk(e){return e.startsWith("chatId:")?e.slice(7):e}const HT=jz("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{default:"bg-primary text-primary-foreground disabled:bg-primary/50 disabled:text-primary-foreground/90 hover:bg-primary/90",juicy:"bg-logo text-primary-foreground disabled:text-primary-foreground/50 hover:bg-logo/90",destructive:"bg-destructive/80 dark:text-white",outline:"border border-input disabled:bg-transparent disabled:text-foreground/50 disabled:border-input/90 bg-card hover:bg-muted hover:text-accent-foreground",secondary:"bg-transparent border border-border text-secondary-foreground hover:text-secondary-foreground/60 disabled:text-secondary-foreground/50",ghost:"hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground disabled:text-muted-foreground/50 border border-border/0 hover:border-border",link:"text-primary disabled:text-primary/50 underline-offset-4 hover:underline",none:""},size:{default:"h-10 px-4 rounded-full py-2",sm:"h-9 rounded-full px-3",lg:"h-11 rounded-full px-8",icon:"h-9 w-9 rounded-full","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),Je=_.forwardRef(({className:e,variant:t,size:n,...r},s)=>f.jsx("button",{className:pe(HT({variant:t,size:n,className:e})),ref:s,...r}));Je.displayName="Button";function Be(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function hk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function f0(...e){return t=>{let n=!1;const r=e.map(s=>{const o=hk(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():hk(e[s],null)}}}}function Ut(...e){return _.useCallback(f0(...e),e)}function SP(e,t){const n=_.createContext(t),r=o=>{const{children:l,...u}=o,h=_.useMemo(()=>u,Object.values(u));return f.jsx(n.Provider,{value:h,children:l})};r.displayName=e+"Provider";function s(o){const l=_.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function to(e,t=[]){let n=[];function r(o,l){const u=_.createContext(l),h=n.length;n=[...n,l];const d=p=>{var k;const{scope:v,children:y,...w}=p,S=((k=v==null?void 0:v[e])==null?void 0:k[h])||u,C=_.useMemo(()=>w,Object.values(w));return f.jsx(S.Provider,{value:C,children:y})};d.displayName=o+"Provider";function g(p,v){var S;const y=((S=v==null?void 0:v[e])==null?void 0:S[h])||u,w=_.useContext(y);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[d,g]}const s=()=>{const o=n.map(l=>_.createContext(l));return function(u){const h=(u==null?void 0:u[e])||o;return _.useMemo(()=>({[`__scope${e}`]:{...u,[e]:h}}),[u,h])}};return s.scopeName=e,[r,CP(s,...t)]}function CP(...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(o){const l=r.reduce((u,{useScope:h,scopeName:d})=>{const p=h(o)[`__scope${d}`];return{...u,...p}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var br=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},kP=tT[" useId ".trim().toString()]||(()=>{}),EP=0;function Gs(e){const[t,n]=_.useState(kP());return br(()=>{n(r=>r??String(EP++))},[e]),t?`radix-${t}`:""}var RP=tT[" useInsertionEffect ".trim().toString()]||br;function lc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,l]=TP({defaultProp:t,onChange:n}),u=e!==void 0,h=u?e:s;{const g=_.useRef(e!==void 0);_.useEffect(()=>{const p=g.current;p!==u&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=u},[u,r])}const d=_.useCallback(g=>{var p;if(u){const v=MP(g)?g(e):g;v!==e&&((p=l.current)==null||p.call(l,v))}else o(g)},[u,e,o,l]);return[h,d]}function TP({defaultProp:e,onChange:t}){const[n,r]=_.useState(e),s=_.useRef(n),o=_.useRef(t);return RP(()=>{o.current=t},[t]),_.useEffect(()=>{var l;s.current!==n&&((l=o.current)==null||l.call(o,n),s.current=n)},[n,s]),[n,r,o]}function MP(e){return typeof e=="function"}function Fa(e){const t=NP(e),n=_.forwardRef((r,s)=>{const{children:o,...l}=r,u=_.Children.toArray(o),h=u.find(DP);if(h){const d=h.props.children,g=u.map(p=>p===h?_.Children.count(d)>1?_.Children.only(null):_.isValidElement(d)?d.props.children:null:p);return f.jsx(t,{...l,ref:s,children:_.isValidElement(d)?_.cloneElement(d,void 0,g):null})}return f.jsx(t,{...l,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function NP(e){const t=_.forwardRef((n,r)=>{const{children:s,...o}=n;if(_.isValidElement(s)){const l=OP(s),u=jP(o,s.props);return s.type!==_.Fragment&&(u.ref=r?f0(r,l):l),_.cloneElement(s,u)}return _.Children.count(s)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var FT=Symbol("radix.slottable");function AP(e){const t=({children:n})=>f.jsx(f.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=FT,t}function DP(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===FT}function jP(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...u)=>{const h=o(...u);return s(...u),h}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function OP(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 LP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tt=LP.reduce((e,t)=>{const n=Fa(`Primitive.${t}`),r=_.forwardRef((s,o)=>{const{asChild:l,...u}=s,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...u,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function UT(e,t){e&&Bi.flushSync(()=>e.dispatchEvent(t))}function Ui(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function zP(e,t=globalThis==null?void 0:globalThis.document){const n=Ui(e);_.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var PP="DismissableLayer",wb="dismissableLayer.update",BP="dismissableLayer.pointerDownOutside",IP="dismissableLayer.focusOutside",fk,$T=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_c=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:l,onDismiss:u,...h}=e,d=_.useContext($T),[g,p]=_.useState(null),v=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=_.useState({}),w=Ut(t,L=>p(L)),S=Array.from(d.layers),[C]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=S.indexOf(C),R=g?S.indexOf(g):-1,E=d.layersWithOutsidePointerEventsDisabled.size>0,M=R>=k,j=UP(L=>{const $=L.target,Y=[...d.branches].some(P=>P.contains($));!M||Y||(s==null||s(L),l==null||l(L),L.defaultPrevented||u==null||u())},v),D=$P(L=>{const $=L.target;[...d.branches].some(P=>P.contains($))||(o==null||o(L),l==null||l(L),L.defaultPrevented||u==null||u())},v);return zP(L=>{R===d.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&u&&(L.preventDefault(),u()))},v),_.useEffect(()=>{if(g)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(fk=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(g)),d.layers.add(g),mk(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=fk)}},[g,v,n,d]),_.useEffect(()=>()=>{g&&(d.layers.delete(g),d.layersWithOutsidePointerEventsDisabled.delete(g),mk())},[g,d]),_.useEffect(()=>{const L=()=>y({});return document.addEventListener(wb,L),()=>document.removeEventListener(wb,L)},[]),f.jsx(Tt.div,{...h,ref:w,style:{pointerEvents:E?M?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,D.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,j.onPointerDownCapture)})});_c.displayName=PP;var HP="DismissableLayerBranch",FP=_.forwardRef((e,t)=>{const n=_.useContext($T),r=_.useRef(null),s=Ut(t,r);return _.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),f.jsx(Tt.div,{...e,ref:s})});FP.displayName=HP;function UP(e,t=globalThis==null?void 0:globalThis.document){const n=Ui(e),r=_.useRef(!1),s=_.useRef(()=>{});return _.useEffect(()=>{const o=u=>{if(u.target&&!r.current){let h=function(){WT(BP,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",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function $P(e,t=globalThis==null?void 0:globalThis.document){const n=Ui(e),r=_.useRef(!1);return _.useEffect(()=>{const s=o=>{o.target&&!r.current&&WT(IP,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function mk(){const e=new CustomEvent(wb);document.dispatchEvent(e)}function WT(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?UT(s,o):s.dispatchEvent(o)}var o_="focusScope.autoFocusOnMount",a_="focusScope.autoFocusOnUnmount",pk={bubbles:!1,cancelable:!0},WP="FocusScope",Sd=_.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...l}=e,[u,h]=_.useState(null),d=Ui(s),g=Ui(o),p=_.useRef(null),v=Ut(t,S=>h(S)),y=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let S=function(E){if(y.paused||!u)return;const M=E.target;u.contains(M)?p.current=M:Uo(p.current,{select:!0})},C=function(E){if(y.paused||!u)return;const M=E.relatedTarget;M!==null&&(u.contains(M)||Uo(p.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const j of E)j.removedNodes.length>0&&Uo(u)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const R=new MutationObserver(k);return u&&R.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),R.disconnect()}}},[r,u,y.paused]),_.useEffect(()=>{if(u){vk.add(y);const S=document.activeElement;if(!u.contains(S)){const k=new CustomEvent(o_,pk);u.addEventListener(o_,d),u.dispatchEvent(k),k.defaultPrevented||(VP(XP(VT(u)),{select:!0}),document.activeElement===S&&Uo(u))}return()=>{u.removeEventListener(o_,d),setTimeout(()=>{const k=new CustomEvent(a_,pk);u.addEventListener(a_,g),u.dispatchEvent(k),k.defaultPrevented||Uo(S??document.body,{select:!0}),u.removeEventListener(a_,g),vk.remove(y)},0)}}},[u,d,g,y]);const w=_.useCallback(S=>{if(!n&&!r||y.paused)return;const C=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,k=document.activeElement;if(C&&k){const R=S.currentTarget,[E,M]=qP(R);E&&M?!S.shiftKey&&k===M?(S.preventDefault(),n&&Uo(E,{select:!0})):S.shiftKey&&k===E&&(S.preventDefault(),n&&Uo(M,{select:!0})):k===R&&S.preventDefault()}},[n,r,y.paused]);return f.jsx(Tt.div,{tabIndex:-1,...l,ref:v,onKeyDown:w})});Sd.displayName=WP;function VP(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Uo(r,{select:t}),document.activeElement!==n)return}function qP(e){const t=VT(e),n=gk(t,e),r=gk(t.reverse(),e);return[n,r]}function VT(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 gk(e,t){for(const n of e)if(!KP(n,{upTo:t}))return n}function KP(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 GP(e){return e instanceof HTMLInputElement&&"select"in e}function Uo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&GP(e)&&t&&e.select()}}var vk=YP();function YP(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=_k(e,t),e.unshift(t)},remove(t){var n;e=_k(e,t),(n=e[0])==null||n.resume()}}}function _k(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function XP(e){return e.filter(t=>t.tagName!=="A")}var ZP="Portal",bc=_.forwardRef((e,t)=>{var u;const{container:n,...r}=e,[s,o]=_.useState(!1);br(()=>o(!0),[]);const l=n||s&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?ST.createPortal(f.jsx(Tt.div,{...r,ref:t}),l):null});bc.displayName=ZP;function QP(e,t){return _.useReducer((n,r)=>t[n][r]??n,e)}var Ai=e=>{const{present:t,children:n}=e,r=JP(t),s=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),o=Ut(r.ref,eB(s));return typeof n=="function"||r.isPresent?_.cloneElement(s,{ref:o}):null};Ai.displayName="Presence";function JP(e){const[t,n]=_.useState(),r=_.useRef(null),s=_.useRef(e),o=_.useRef("none"),l=e?"mounted":"unmounted",[u,h]=QP(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const d=gf(r.current);o.current=u==="mounted"?d:"none"},[u]),br(()=>{const d=r.current,g=s.current;if(g!==e){const v=o.current,y=gf(d);e?h("MOUNT"):y==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(g&&v!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),br(()=>{if(t){let d;const g=t.ownerDocument.defaultView??window,p=y=>{const S=gf(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&S&&(h("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",d=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},v=y=>{y.target===t&&(o.current=gf(r.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{g.clearTimeout(d),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:_.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function gf(e){return(e==null?void 0:e.animationName)||"none"}function eB(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 l_=0;function Jm(){_.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??bk()),document.body.insertAdjacentElement("beforeend",e[1]??bk()),l_++,()=>{l_===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),l_--}},[])}function bk(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var cs=function(){return cs=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},cs.apply(this,arguments)};function qT(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 tB(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Yf="right-scroll-bar-position",Xf="width-before-scroll-bar",nB="with-scroll-bars-hidden",rB="--removed-body-scroll-bar-size";function c_(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function iB(e,t){var n=_.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var sB=typeof window<"u"?_.useLayoutEffect:_.useEffect,yk=new WeakMap;function oB(e,t){var n=iB(null,function(r){return e.forEach(function(s){return c_(s,r)})});return sB(function(){var r=yk.get(n);if(r){var s=new Set(r),o=new Set(e),l=n.current;s.forEach(function(u){o.has(u)||c_(u,null)}),o.forEach(function(u){s.has(u)||c_(u,l)})}yk.set(n,e)},[e]),n}function aB(e){return e}function lB(e,t){t===void 0&&(t=aB);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(o){var l=t(o,r);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(o){for(r=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(u){return o(u)},filter:function(){return n}}},assignMedium:function(o){r=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(o),l=n}var h=function(){var g=l;l=[],g.forEach(o)},d=function(){return Promise.resolve().then(h)};d(),n={push:function(g){l.push(g),d()},filter:function(g){return l=l.filter(g),n}}}};return s}function cB(e){e===void 0&&(e={});var t=lB(null);return t.options=cs({async:!0,ssr:!1},e),t}var KT=function(e){var t=e.sideCar,n=qT(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return _.createElement(r,cs({},n))};KT.isSideCarExport=!0;function uB(e,t){return e.useMedium(t),KT}var GT=cB(),u_=function(){},ep=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:u_,onWheelCapture:u_,onTouchMoveCapture:u_}),s=r[0],o=r[1],l=e.forwardProps,u=e.children,h=e.className,d=e.removeScrollBar,g=e.enabled,p=e.shards,v=e.sideCar,y=e.noRelative,w=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,R=k===void 0?"div":k,E=e.gapMode,M=qT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=v,D=oB([n,t]),L=cs(cs({},M),s);return _.createElement(_.Fragment,null,g&&_.createElement(j,{sideCar:GT,removeScrollBar:d,shards:p,noRelative:y,noIsolation:w,inert:S,setCallbacks:o,allowPinchZoom:!!C,lockRef:n,gapMode:E}),l?_.cloneElement(_.Children.only(u),cs(cs({},L),{ref:D})):_.createElement(R,cs({},L,{className:h,ref:D}),u))});ep.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ep.classNames={fullWidth:Xf,zeroRight:Yf};var dB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function hB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=dB();return t&&e.setAttribute("nonce",t),e}function fB(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function mB(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pB=function(){var e=0,t=null;return{add:function(n){e==0&&(t=hB())&&(fB(t,n),mB(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gB=function(){var e=pB();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},YT=function(){var e=gB(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},vB={left:0,top:0,right:0,gap:0},d_=function(e){return parseInt(e||"",10)||0},_B=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[d_(n),d_(r),d_(s)]},bB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return vB;var t=_B(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])}},yB=YT(),nc="data-scroll-locked",xB=function(e,t,n,r){var s=e.left,o=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
61
|
+
.`.concat(nB,` {
|
|
62
|
+
overflow: hidden `).concat(r,`;
|
|
63
|
+
padding-right: `).concat(u,"px ").concat(r,`;
|
|
64
|
+
}
|
|
65
|
+
body[`).concat(nc,`] {
|
|
66
|
+
overflow: hidden `).concat(r,`;
|
|
67
|
+
overscroll-behavior: contain;
|
|
68
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
69
|
+
padding-left: `.concat(s,`px;
|
|
70
|
+
padding-top: `).concat(o,`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(Yf,` {
|
|
79
|
+
right: `).concat(u,"px ").concat(r,`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.`).concat(Xf,` {
|
|
83
|
+
margin-right: `).concat(u,"px ").concat(r,`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.`).concat(Yf," .").concat(Yf,` {
|
|
87
|
+
right: 0 `).concat(r,`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.`).concat(Xf," .").concat(Xf,` {
|
|
91
|
+
margin-right: 0 `).concat(r,`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
body[`).concat(nc,`] {
|
|
95
|
+
`).concat(rB,": ").concat(u,`px;
|
|
96
|
+
}
|
|
97
|
+
`)},xk=function(){var e=parseInt(document.body.getAttribute(nc)||"0",10);return isFinite(e)?e:0},wB=function(){_.useEffect(function(){return document.body.setAttribute(nc,(xk()+1).toString()),function(){var e=xk()-1;e<=0?document.body.removeAttribute(nc):document.body.setAttribute(nc,e.toString())}},[])},SB=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;wB();var o=_.useMemo(function(){return bB(s)},[s]);return _.createElement(yB,{styles:xB(o,!t,s,n?"":"!important")})},Sb=!1;if(typeof window<"u")try{var vf=Object.defineProperty({},"passive",{get:function(){return Sb=!0,!0}});window.addEventListener("test",vf,vf),window.removeEventListener("test",vf,vf)}catch{Sb=!1}var Il=Sb?{passive:!1}:!1,CB=function(e){return e.tagName==="TEXTAREA"},XT=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!CB(e)&&n[t]==="visible")},kB=function(e){return XT(e,"overflowY")},EB=function(e){return XT(e,"overflowX")},wk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=ZT(e,r);if(s){var o=QT(e,r),l=o[1],u=o[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},RB=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},TB=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},ZT=function(e,t){return e==="v"?kB(t):EB(t)},QT=function(e,t){return e==="v"?RB(t):TB(t)},MB=function(e,t){return e==="h"&&t==="rtl"?-1:1},NB=function(e,t,n,r,s){var o=MB(e,window.getComputedStyle(t).direction),l=o*r,u=n.target,h=t.contains(u),d=!1,g=l>0,p=0,v=0;do{if(!u)break;var y=QT(e,u),w=y[0],S=y[1],C=y[2],k=S-C-o*w;(w||k)&&ZT(e,u)&&(p+=k,v+=w);var R=u.parentNode;u=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!h&&u!==document.body||h&&(t.contains(u)||t===u));return(g&&Math.abs(p)<1||!g&&Math.abs(v)<1)&&(d=!0),d},_f=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Sk=function(e){return[e.deltaX,e.deltaY]},Ck=function(e){return e&&"current"in e?e.current:e},AB=function(e,t){return e[0]===t[0]&&e[1]===t[1]},DB=function(e){return`
|
|
98
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
99
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
100
|
+
`)},jB=0,Hl=[];function OB(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),s=_.useState(jB++)[0],o=_.useState(YT)[0],l=_.useRef(e);_.useEffect(function(){l.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var S=tB([e.lockRef.current],(e.shards||[]).map(Ck),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var u=_.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var k=_f(S),R=n.current,E="deltaX"in S?S.deltaX:R[0]-k[0],M="deltaY"in S?S.deltaY:R[1]-k[1],j,D=S.target,L=Math.abs(E)>Math.abs(M)?"h":"v";if("touches"in S&&L==="h"&&D.type==="range")return!1;var $=window.getSelection(),Y=$&&$.anchorNode,P=Y?Y===D||Y.contains(D):!1;if(P)return!1;var V=wk(L,D);if(!V)return!0;if(V?j=L:(j=L==="v"?"h":"v",V=wk(L,D)),!V)return!1;if(!r.current&&"changedTouches"in S&&(E||M)&&(r.current=j),!j)return!0;var I=r.current||j;return NB(I,C,S,I==="h"?E:M)},[]),h=_.useCallback(function(S){var C=S;if(!(!Hl.length||Hl[Hl.length-1]!==o)){var k="deltaY"in C?Sk(C):_f(C),R=t.current.filter(function(j){return j.name===C.type&&(j.target===C.target||C.target===j.shadowParent)&&AB(j.delta,k)})[0];if(R&&R.should){C.cancelable&&C.preventDefault();return}if(!R){var E=(l.current.shards||[]).map(Ck).filter(Boolean).filter(function(j){return j.contains(C.target)}),M=E.length>0?u(C,E[0]):!l.current.noIsolation;M&&C.cancelable&&C.preventDefault()}}},[]),d=_.useCallback(function(S,C,k,R){var E={name:S,delta:C,target:k,should:R,shadowParent:LB(k)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(M){return M!==E})},1)},[]),g=_.useCallback(function(S){n.current=_f(S),r.current=void 0},[]),p=_.useCallback(function(S){d(S.type,Sk(S),S.target,u(S,e.lockRef.current))},[]),v=_.useCallback(function(S){d(S.type,_f(S),S.target,u(S,e.lockRef.current))},[]);_.useEffect(function(){return Hl.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",h,Il),document.addEventListener("touchmove",h,Il),document.addEventListener("touchstart",g,Il),function(){Hl=Hl.filter(function(S){return S!==o}),document.removeEventListener("wheel",h,Il),document.removeEventListener("touchmove",h,Il),document.removeEventListener("touchstart",g,Il)}},[]);var y=e.removeScrollBar,w=e.inert;return _.createElement(_.Fragment,null,w?_.createElement(o,{styles:DB(s)}):null,y?_.createElement(SB,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function LB(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const zB=uB(GT,OB);var Cd=_.forwardRef(function(e,t){return _.createElement(ep,cs({},e,{ref:t,sideCar:zB}))});Cd.classNames=ep.classNames;var PB=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fl=new WeakMap,bf=new WeakMap,yf={},h_=0,JT=function(e){return e&&(e.host||JT(e.parentNode))},BB=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=JT(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})},IB=function(e,t,n,r){var s=BB(t,Array.isArray(e)?e:[e]);yf[n]||(yf[n]=new WeakMap);var o=yf[n],l=[],u=new Set,h=new Set(s),d=function(p){!p||u.has(p)||(u.add(p),d(p.parentNode))};s.forEach(d);var g=function(p){!p||h.has(p)||Array.prototype.forEach.call(p.children,function(v){if(u.has(v))g(v);else try{var y=v.getAttribute(r),w=y!==null&&y!=="false",S=(Fl.get(v)||0)+1,C=(o.get(v)||0)+1;Fl.set(v,S),o.set(v,C),l.push(v),S===1&&w&&bf.set(v,!0),C===1&&v.setAttribute(n,"true"),w||v.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",v,k)}})};return g(t),u.clear(),h_++,function(){l.forEach(function(p){var v=Fl.get(p)-1,y=o.get(p)-1;Fl.set(p,v),o.set(p,y),v||(bf.has(p)||p.removeAttribute(r),bf.delete(p)),y||p.removeAttribute(n)}),h_--,h_||(Fl=new WeakMap,Fl=new WeakMap,bf=new WeakMap,yf={})}},tp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=PB(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),IB(r,s,n,"aria-hidden")):function(){return null}},np="Dialog",[eM]=to(np),[HB,Gi]=eM(np),tM=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:l=!0}=e,u=_.useRef(null),h=_.useRef(null),[d,g]=lc({prop:r,defaultProp:s??!1,onChange:o,caller:np});return f.jsx(HB,{scope:t,triggerRef:u,contentRef:h,contentId:Gs(),titleId:Gs(),descriptionId:Gs(),open:d,onOpenChange:g,onOpenToggle:_.useCallback(()=>g(p=>!p),[g]),modal:l,children:n})};tM.displayName=np;var nM="DialogTrigger",FB=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(nM,n),o=Ut(t,s.triggerRef);return f.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":g0(s.open),...r,ref:o,onClick:Be(e.onClick,s.onOpenToggle)})});FB.displayName=nM;var m0="DialogPortal",[UB,rM]=eM(m0,{forceMount:void 0}),iM=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Gi(m0,t);return f.jsx(UB,{scope:t,forceMount:n,children:_.Children.map(r,l=>f.jsx(Ai,{present:n||o.open,children:f.jsx(bc,{asChild:!0,container:s,children:l})}))})};iM.displayName=m0;var mm="DialogOverlay",sM=_.forwardRef((e,t)=>{const n=rM(mm,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Gi(mm,e.__scopeDialog);return o.modal?f.jsx(Ai,{present:r||o.open,children:f.jsx(WB,{...s,ref:t})}):null});sM.displayName=mm;var $B=Fa("DialogOverlay.RemoveScroll"),WB=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(mm,n);return f.jsx(Cd,{as:$B,allowPinchZoom:!0,shards:[s.contentRef],children:f.jsx(Tt.div,{"data-state":g0(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ua="DialogContent",oM=_.forwardRef((e,t)=>{const n=rM(Ua,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Gi(Ua,e.__scopeDialog);return f.jsx(Ai,{present:r||o.open,children:o.modal?f.jsx(VB,{...s,ref:t}):f.jsx(qB,{...s,ref:t})})});oM.displayName=Ua;var VB=_.forwardRef((e,t)=>{const n=Gi(Ua,e.__scopeDialog),r=_.useRef(null),s=Ut(t,n.contentRef,r);return _.useEffect(()=>{const o=r.current;if(o)return tp(o)},[]),f.jsx(aM,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&o.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,o=>o.preventDefault())})}),qB=_.forwardRef((e,t)=>{const n=Gi(Ua,e.__scopeDialog),r=_.useRef(!1),s=_.useRef(!1);return f.jsx(aM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),aM=_.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...l}=e,u=Gi(Ua,n),h=_.useRef(null),d=Ut(t,h);return Jm(),f.jsxs(f.Fragment,{children:[f.jsx(Sd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:f.jsx(_c,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":g0(u.open),...l,ref:d,onDismiss:()=>u.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(KB,{titleId:u.titleId}),f.jsx(YB,{contentRef:h,descriptionId:u.descriptionId})]})]})}),p0="DialogTitle",lM=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(p0,n);return f.jsx(Tt.h2,{id:s.titleId,...r,ref:t})});lM.displayName=p0;var cM="DialogDescription",uM=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(cM,n);return f.jsx(Tt.p,{id:s.descriptionId,...r,ref:t})});uM.displayName=cM;var dM="DialogClose",hM=_.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Gi(dM,n);return f.jsx(Tt.button,{type:"button",...r,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});hM.displayName=dM;function g0(e){return e?"open":"closed"}var fM="DialogTitleWarning",[dre,mM]=SP(fM,{contentName:Ua,titleName:p0,docsSlug:"dialog"}),KB=({titleId:e})=>{const t=mM(fM),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
101
|
+
|
|
102
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
103
|
+
|
|
104
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},GB="DialogDescriptionWarning",YB=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mM(GB).contentName}}.`;return _.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},XB=tM,ZB=iM,pM=sM,gM=oM,QB=lM,JB=uM,e6=hM;/**
|
|
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 t6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),kk=e=>{const t=n6(e);return t.charAt(0).toUpperCase()+t.slice(1)},vM=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),r6=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 i6={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 s6=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:l,...u},h)=>_.createElement("svg",{ref:h,...i6,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:vM("lucide",s),...!o&&!r6(u)&&{"aria-hidden":"true"},...u},[...l.map(([d,g])=>_.createElement(d,g)),...Array.isArray(o)?o:[o]]));/**
|
|
120
|
+
* @license lucide-react v0.562.0 - ISC
|
|
121
|
+
*
|
|
122
|
+
* This source code is licensed under the ISC license.
|
|
123
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
+
*/const Ie=(e,t)=>{const n=_.forwardRef(({className:r,...s},o)=>_.createElement(s6,{ref:o,iconNode:t,className:vM(`lucide-${t6(kk(e))}`,`lucide-${e}`,r),...s}));return n.displayName=kk(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 o6=[["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"}]],a6=Ie("archive",o6);/**
|
|
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 l6=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],c6=Ie("arrow-down-to-line",l6);/**
|
|
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 u6=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],d6=Ie("arrow-down",u6);/**
|
|
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 h6=[["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"}]],f6=Ie("arrow-left-right",h6);/**
|
|
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 m6=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],p6=Ie("arrow-up",m6);/**
|
|
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 g6=[["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"}]],v6=Ie("asterisk",g6);/**
|
|
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 _6=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ti=Ie("brain",_6);/**
|
|
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 b6=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],y6=Ie("check-check",b6);/**
|
|
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 x6=[["path",{d:"M20 4L9 15",key:"1qkx8z"}],["path",{d:"M21 19L3 19",key:"100sma"}],["path",{d:"M9 15L4 10",key:"9zxff7"}]],w6=Ie("check-line",x6);/**
|
|
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 S6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],$i=Ie("check",S6);/**
|
|
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 C6=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rp=Ie("chevron-down",C6);/**
|
|
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 k6=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_M=Ie("chevron-left",k6);/**
|
|
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 E6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tr=Ie("chevron-right",E6);/**
|
|
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 R6=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],T6=Ie("chevron-up",R6);/**
|
|
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 M6=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],N6=Ie("chevrons-up",M6);/**
|
|
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 A6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],D6=Ie("circle-slash",A6);/**
|
|
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 j6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],O6=Ie("circle",j6);/**
|
|
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 L6=[["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"}]],z6=Ie("cloud-download",L6);/**
|
|
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 P6=[["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"}]],Ek=Ie("code-xml",P6);/**
|
|
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 B6=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],bM=Ie("code",B6);/**
|
|
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 I6=[["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"}]],H6=Ie("command",I6);/**
|
|
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 F6=[["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"}]],kd=Ie("copy",F6);/**
|
|
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 U6=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],$6=Ie("corner-down-left",U6);/**
|
|
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 W6=[["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"}]],V6=Ie("eraser",W6);/**
|
|
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 q6=[["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"}]],K6=Ie("file-pen",q6);/**
|
|
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 G6=[["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"}]],Y6=Ie("file-plus-corner",G6);/**
|
|
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 X6=[["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"}]],Z6=Ie("file",X6);/**
|
|
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 Q6=[["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"}]],Ku=Ie("flower",Q6);/**
|
|
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 J6=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],f_=Ie("folder-git-2",J6);/**
|
|
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 eI=[["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"}]],yM=Ie("folder-open",eI);/**
|
|
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 tI=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],nI=Ie("folder-plus",tI);/**
|
|
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 rI=[["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"}]],xM=Ie("folder",rI);/**
|
|
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 iI=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Fs=Ie("gauge",iI);/**
|
|
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 sI=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],oI=Ie("git-branch",sI);/**
|
|
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 aI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],lI=Ie("info",aI);/**
|
|
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 cI=[["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"}]],uI=Ie("list-checks",cI);/**
|
|
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 dI=[["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"}]],pm=Ie("list-todo",dI);/**
|
|
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 hI=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],oi=Ie("loader-circle",hI);/**
|
|
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 fI=[["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"}]],Rk=Ie("lock-open",fI);/**
|
|
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 mI=[["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"}]],Tk=Ie("map",mI);/**
|
|
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 pI=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],wM=Ie("menu",pI);/**
|
|
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 gI=[["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"}]],SM=Ie("message-circle-question-mark",gI);/**
|
|
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 vI=[["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"}]],_I=Ie("message-square-quote",vI);/**
|
|
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 bI=[["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"}]],CM=Ie("minimize",bI);/**
|
|
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 yI=[["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"}]],kM=Ie("monitor",yI);/**
|
|
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 xI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Cb=Ie("panel-left",xI);/**
|
|
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 wI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],SI=Ie("panel-right",wI);/**
|
|
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 CI=[["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"}]],kI=Ie("paperclip",CI);/**
|
|
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 EI=[["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"}]],gm=Ie("pencil",EI);/**
|
|
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 RI=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ip=Ie("plus",RI);/**
|
|
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 TI=[["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"}]],v0=Ie("refresh-cw",TI);/**
|
|
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 MI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],m_=Ie("search",MI);/**
|
|
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 NI=[["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"}]],AI=Ie("send",NI);/**
|
|
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 DI=[["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"}]],jI=Ie("settings",DI);/**
|
|
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 OI=[["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"}]],LI=Ie("settings-2",OI);/**
|
|
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 zI=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],PI=Ie("slash",zI);/**
|
|
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 BI=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Tn=Ie("sparkles",BI);/**
|
|
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 II=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]],Mk=Ie("square-menu",II);/**
|
|
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 HI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Nk=Ie("square-minus",HI);/**
|
|
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 FI=[["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"}]],_0=Ie("square-pen",FI);/**
|
|
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 UI=[["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"}]],$I=Ie("square-x",UI);/**
|
|
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 WI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],VI=Ie("square",WI);/**
|
|
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 qI=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],b0=Ie("terminal",qI);/**
|
|
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 KI=[["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"}]],GI=Ie("toy-brick",KI);/**
|
|
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 YI=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],id=Ie("trash-2",YI);/**
|
|
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 XI=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],y0=Ie("user-round",XI);/**
|
|
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 ZI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xs=Ie("x",ZI);/**
|
|
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 QI=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ls=Ie("zap",QI),sd="data-focus-fallback-ignore",EM="data-allow-focus-retain",vm="kaizen:restore-chat-input-focus",x0="data-chat-input",_m="data-chat-selection-zone";function ja(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function kb(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:ja(e,EM):!1}function JI(e){const t=e;return t!=null&&t.matches?kb(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:ja(e,EM):!1}function Ak(e){return!!e.querySelector(`[${sd}][data-state='open']`)}function e8(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function t8(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${x0}]`)).filter(l=>!l.disabled);if(n.length===0)return!1;const r=n.indexOf(e),s=r>=0?(r+1)%n.length:0,o=n[s];return o?(o.focus({preventScroll:!0}),!0):!1}function Dk(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||ja(t,x0)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:s,pointerEndTarget:o,root:l,hasActiveSelection:u}=e,h=o??s;return!l||!h||!l.contains(h)||ja(h,sd)||ja(t,sd)||kb(h)||u&&(ja(s,_m)||ja(h,_m))||kb(t)?"none":t&&t===h?"restore":JI(t)?"none":"restore"}const sp=XB,n8=ZB,RM=_.forwardRef(({className:e,...t},n)=>f.jsx(pM,{ref:n,className:pe("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}));RM.displayName=pM.displayName;const r8={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},Ed=_.forwardRef(({className:e,children:t,size:n="md",...r},s)=>f.jsxs(n8,{children:[f.jsx(RM,{}),f.jsxs(gM,{ref:s,[sd]:"",onCloseAutoFocus:o=>{var l;o.preventDefault(),window.dispatchEvent(new Event(vm)),(l=r.onCloseAutoFocus)==null||l.call(r,o)},className:pe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl backdrop-blur-md duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",r8[n],e),...r,children:[t,f.jsxs(e6,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(Xs,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ed.displayName=gM.displayName;function op({className:e,...t}){return f.jsx(QB,{className:pe("text-lg font-medium leading-none tracking-tight",e),...t})}function w0({className:e,...t}){return f.jsx(JB,{className:pe("text-sm text-muted-foreground",e),...t})}function ap({className:e,...t}){return f.jsx("div",{className:pe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function lp({className:e,...t}){return f.jsx("div",{className:pe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}const Si=_.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{ref:r,type:t,className:pe("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Si.displayName="Input";const TM=_.createContext(null);function i8({children:e}){const[t,n]=_.useState(null),[r,s]=_.useState(""),o=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(s(t.options.initialValue??""),setTimeout(()=>{var y,w;(y=o.current)==null||y.focus(),(w=o.current)==null||w.select()},0))},[t]);const l=_.useCallback(()=>{n(null),s("")},[]),u=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),l())},[l,t]),h=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),l())},[l,t,r]),d=_.useCallback(y=>new Promise(w=>{n({kind:"confirm",options:y,resolve:w})}),[]),g=_.useCallback(y=>new Promise(w=>{n({kind:"prompt",options:y,resolve:w})}),[]),p=_.useCallback(y=>new Promise(w=>{n({kind:"alert",options:y,resolve:w})}),[]),v=_.useMemo(()=>({confirm:d,prompt:g,alert:p}),[p,d,g]);return f.jsxs(TM.Provider,{value:v,children:[e,f.jsx(sp,{open:t!==null,onOpenChange:y=>{y||!t||u()},children:f.jsx(Ed,{size:"sm",onKeyDown:y=>{y.key!=="Enter"||y.shiftKey||!t||t.kind!=="confirm"||(y.preventDefault(),h())},children:t?f.jsxs(f.Fragment,{children:[f.jsxs(ap,{className:"space-y-4",children:[f.jsx(op,{children:t.options.title}),t.options.description?f.jsx(w0,{children:t.options.description}):null,t.kind==="prompt"?f.jsx(Si,{ref:o,type:"text",value:r,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),h())},placeholder:t.options.placeholder}):null]}),f.jsxs(lp,{children:[f.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"}),f.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 s8(){const e=_.useContext(TM);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const cp=_.forwardRef(({className:e,...t},n)=>f.jsx("textarea",{"data-gramm":"false","data-gramm_editor":"false","data-enable-grammarly":"false","data-1p-ignore":!0,autoComplete:"off",className:pe("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}));cp.displayName="Textarea";function o8(e){return e.trim().length>0}function a8({open:e,onOpenChange:t,onConfirm:n}){const[r,s]=_.useState(""),[o,l]=_.useState(""),u=_.useRef(null);_.useEffect(()=>{e&&(s(""),l(""),setTimeout(()=>{var g;return(g=u.current)==null?void 0:g.focus()},0))},[e]);const h=o8(r),d=()=>{h&&n({title:r.trim(),description:o.trim()})};return f.jsx(sp,{open:e,onOpenChange:t,children:f.jsx(Ed,{size:"sm",onKeyDown:g=>{(g.metaKey||g.ctrlKey)&&g.key==="Enter"&&(g.preventDefault(),d())},children:f.jsxs("form",{onSubmit:g=>{g.preventDefault(),d()},children:[f.jsxs(ap,{className:"space-y-4",children:[f.jsx(op,{children:"Create Feature"}),f.jsx(w0,{children:"Name the feature folder and optionally add a short description for the initial `overview.md`."}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("label",{htmlFor:"feature-title",className:"text-sm font-medium",children:"Feature name"}),f.jsx(Si,{id:"feature-title",ref:u,type:"text",value:r,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),d())},placeholder:"Feature name"})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{htmlFor:"feature-description",className:"text-sm font-medium",children:["Description ",f.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),f.jsx(cp,{id:"feature-description",value:o,onChange:g=>l(g.target.value),rows:5,placeholder:"Leave blank to add it later"})]})]}),f.jsxs(lp,{children:[f.jsx(Je,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(Je,{type:"submit",variant:"secondary",size:"sm",disabled:!h,children:"Create"})]})]})})})}const jk=`1. Sign in on the opened Cursor spending page.
|
|
465
|
+
2. Open DevTools > Network.
|
|
466
|
+
3. Refresh the page.
|
|
467
|
+
4. Right-click the get-current-period-usage request.
|
|
468
|
+
5. Copy > Copy as cURL.
|
|
469
|
+
6. Paste it here.`;function l8({open:e,onOpenChange:t,onSubmit:n}){const r=_.useRef(null),[s,o]=_.useState(""),[l,u]=_.useState(!1);_.useEffect(()=>{e&&(o(""),setTimeout(()=>{var p;return(p=r.current)==null?void 0:p.focus()},0))},[e]);async function h(){const p=await navigator.clipboard.readText();o(p)}async function d(){await navigator.clipboard.writeText(jk),u(!0),setTimeout(()=>u(!1),2e3)}const g=s.trim().length>0;return f.jsx(sp,{open:e,onOpenChange:t,children:f.jsx(Ed,{size:"lg",children:f.jsxs("form",{onSubmit:p=>{p.preventDefault(),g&&n(s.trim())},children:[f.jsxs(ap,{className:"space-y-4",children:[f.jsx(op,{children:"Import Cursor Session"}),f.jsxs(w0,{children:["Paste the copied ",f.jsx("code",{children:"get-current-period-usage"})," curl command and Kaizen will import the session for you."]}),f.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground whitespace-pre-line",children:jk}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Je,{type:"button",variant:"ghost",size:"sm",onClick:()=>void h(),children:"Paste Clipboard"}),f.jsxs(Je,{type:"button",variant:"ghost",size:"sm",onClick:()=>void d(),children:[l?f.jsx($i,{className:"h-4 w-4"}):f.jsx(kd,{className:"h-4 w-4"}),f.jsx("span",{className:"ml-1",children:l?"Copied":"Copy Steps"})]})]}),f.jsx(cp,{ref:r,value:s,onChange:p=>o(p.target.value),rows:10,placeholder:"Paste the copied curl command here",className:"font-mono text-xs"})]}),f.jsxs(lp,{children:[f.jsx(Je,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(Je,{type:"submit",variant:"secondary",size:"sm",disabled:!g,children:"Import Session"})]})]})})})}const c8=["top","right","bottom","left"],Zo=Math.min,ri=Math.max,bm=Math.round,xf=Math.floor,gs=e=>({x:e,y:e}),u8={left:"right",right:"left",bottom:"top",top:"bottom"};function Eb(e,t,n){return ri(e,Zo(t,n))}function Zs(e,t){return typeof e=="function"?e(t):e}function Qs(e){return e.split("-")[0]}function yc(e){return e.split("-")[1]}function S0(e){return e==="x"?"y":"x"}function C0(e){return e==="y"?"height":"width"}function us(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function k0(e){return S0(us(e))}function d8(e,t,n){n===void 0&&(n=!1);const r=yc(e),s=k0(e),o=C0(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=ym(l)),[l,ym(l)]}function h8(e){const t=ym(e);return[Rb(e),t,Rb(t)]}function Rb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ok=["left","right"],Lk=["right","left"],f8=["top","bottom"],m8=["bottom","top"];function p8(e,t,n){switch(e){case"top":case"bottom":return n?t?Lk:Ok:t?Ok:Lk;case"left":case"right":return t?f8:m8;default:return[]}}function g8(e,t,n,r){const s=yc(e);let o=p8(Qs(e),n==="start",r);return s&&(o=o.map(l=>l+"-"+s),t&&(o=o.concat(o.map(Rb)))),o}function ym(e){const t=Qs(e);return u8[t]+e.slice(t.length)}function v8(e){return{top:0,right:0,bottom:0,left:0,...e}}function MM(e){return typeof e!="number"?v8(e):{top:e,right:e,bottom:e,left:e}}function xm(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 zk(e,t,n){let{reference:r,floating:s}=e;const o=us(t),l=k0(t),u=C0(l),h=Qs(t),d=o==="y",g=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:g,y:r.y-s.height};break;case"bottom":y={x:g,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}switch(yc(t)){case"start":y[l]-=v*(n&&d?-1:1);break;case"end":y[l]+=v*(n&&d?-1:1);break}return y}async function _8(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:l,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:v=!1,padding:y=0}=Zs(t,e),w=MM(y),C=u[v?p==="floating"?"reference":"floating":p],k=xm(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(C)))==null||n?C:C.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:d,rootBoundary:g,strategy:h})),R=p==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),M=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},j=xm(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:E,strategy:h}):R);return{top:(k.top-j.top+w.top)/M.y,bottom:(j.bottom-k.bottom+w.bottom)/M.y,left:(k.left-j.left+w.left)/M.x,right:(j.right-k.right+w.right)/M.x}}const b8=50,y8=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:_8},h=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:g,y:p}=zk(d,r,h),v=r,y=0;const w={};for(let S=0;S<o.length;S++){const C=o[S];if(!C)continue;const{name:k,fn:R}=C,{x:E,y:M,data:j,reset:D}=await R({x:g,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:w,rects:d,platform:u,elements:{reference:e,floating:t}});g=E??g,p=M??p,w[k]={...w[k],...j},D&&y<b8&&(y++,typeof D=="object"&&(D.placement&&(v=D.placement),D.rects&&(d=D.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):D.rects),{x:g,y:p}=zk(d,v,h)),S=-1)}return{x:g,y:p,placement:v,strategy:s,middlewareData:w}},x8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:l,elements:u,middlewareData:h}=t,{element:d,padding:g=0}=Zs(e,t)||{};if(d==null)return{};const p=MM(g),v={x:n,y:r},y=k0(s),w=C0(y),S=await l.getDimensions(d),C=y==="y",k=C?"top":"left",R=C?"bottom":"right",E=C?"clientHeight":"clientWidth",M=o.reference[w]+o.reference[y]-v[y]-o.floating[w],j=v[y]-o.reference[y],D=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let L=D?D[E]:0;(!L||!await(l.isElement==null?void 0:l.isElement(D)))&&(L=u.floating[E]||o.floating[w]);const $=M/2-j/2,Y=L/2-S[w]/2-1,P=Zo(p[k],Y),V=Zo(p[R],Y),I=P,W=L-S[w]-V,K=L/2-S[w]/2+$,q=Eb(I,K,W),O=!h.arrow&&yc(s)!=null&&K!==q&&o.reference[w]/2-(K<I?P:V)-S[w]/2<0,H=O?K<I?K-I:K-W:0;return{[y]:v[y]+H,data:{[y]:q,centerOffset:K-q-H,...O&&{alignmentOffset:H}},reset:O}}}),w8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:l,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=Zs(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const k=Qs(s),R=us(u),E=Qs(u)===u,M=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=v||(E||!S?[ym(u)]:h8(u)),D=w!=="none";!v&&D&&j.push(...g8(u,S,w,M));const L=[u,...j],$=await h.detectOverflow(t,C),Y=[];let P=((r=o.flip)==null?void 0:r.overflows)||[];if(g&&Y.push($[k]),p){const K=d8(s,l,M);Y.push($[K[0]],$[K[1]])}if(P=[...P,{placement:s,overflows:Y}],!Y.every(K=>K<=0)){var V,I;const K=(((V=o.flip)==null?void 0:V.index)||0)+1,q=L[K];if(q&&(!(p==="alignment"?R!==us(q):!1)||P.every(U=>us(U.placement)===R?U.overflows[0]>0:!0)))return{data:{index:K,overflows:P},reset:{placement:q}};let O=(I=P.filter(H=>H.overflows[0]<=0).sort((H,U)=>H.overflows[1]-U.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(y){case"bestFit":{var W;const H=(W=P.filter(U=>{if(D){const F=us(U.placement);return F===R||F==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(F=>F>0).reduce((F,N)=>F+N,0)]).sort((U,F)=>U[1]-F[1])[0])==null?void 0:W[0];H&&(O=H);break}case"initialPlacement":O=u;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function Pk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Bk(e){return c8.some(t=>e[t]>=0)}const S8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Zs(e,t);switch(s){case"referenceHidden":{const l=await r.detectOverflow(t,{...o,elementContext:"reference"}),u=Pk(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Bk(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...o,altBoundary:!0}),u=Pk(l,n.floating);return{data:{escapedOffsets:u,escaped:Bk(u)}}}default:return{}}}}},NM=new Set(["left","top"]);async function C8(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=Qs(n),u=yc(n),h=us(n)==="y",d=NM.has(l)?-1:1,g=o&&h?-1:1,p=Zs(t,e);let{mainAxis:v,crossAxis:y,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),h?{x:y*g,y:v*d}:{x:v*d,y:y*g}}const k8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:l,middlewareData:u}=t,h=await C8(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:o+h.y,data:{...h,placement:l}}}}},E8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:R,y:E}=k;return{x:R,y:E}}},...d}=Zs(e,t),g={x:n,y:r},p=await o.detectOverflow(t,d),v=us(Qs(s)),y=S0(v);let w=g[y],S=g[v];if(l){const k=y==="y"?"top":"left",R=y==="y"?"bottom":"right",E=w+p[k],M=w-p[R];w=Eb(E,w,M)}if(u){const k=v==="y"?"top":"left",R=v==="y"?"bottom":"right",E=S+p[k],M=S-p[R];S=Eb(E,S,M)}const C=h.fn({...t,[y]:w,[v]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:l,[v]:u}}}}}},R8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:l}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=Zs(e,t),g={x:n,y:r},p=us(s),v=S0(p);let y=g[v],w=g[p];const S=Zs(u,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const E=v==="y"?"height":"width",M=o.reference[v]-o.floating[E]+C.mainAxis,j=o.reference[v]+o.reference[E]-C.mainAxis;y<M?y=M:y>j&&(y=j)}if(d){var k,R;const E=v==="y"?"width":"height",M=NM.has(Qs(s)),j=o.reference[p]-o.floating[E]+(M&&((k=l.offset)==null?void 0:k[p])||0)+(M?0:C.crossAxis),D=o.reference[p]+o.reference[E]+(M?0:((R=l.offset)==null?void 0:R[p])||0)-(M?C.crossAxis:0);w<j?w=j:w>D&&(w=D)}return{[v]:y,[p]:w}}}},T8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:l,elements:u}=t,{apply:h=()=>{},...d}=Zs(e,t),g=await l.detectOverflow(t,d),p=Qs(s),v=yc(s),y=us(s)==="y",{width:w,height:S}=o.floating;let C,k;p==="top"||p==="bottom"?(C=p,k=v===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(k=p,C=v==="end"?"top":"bottom");const R=S-g.top-g.bottom,E=w-g.left-g.right,M=Zo(S-g[C],R),j=Zo(w-g[k],E),D=!t.middlewareData.shift;let L=M,$=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),D&&!v){const P=ri(g.left,0),V=ri(g.right,0),I=ri(g.top,0),W=ri(g.bottom,0);y?$=w-2*(P!==0||V!==0?P+V:ri(g.left,g.right)):L=S-2*(I!==0||W!==0?I+W:ri(g.top,g.bottom))}await h({...t,availableWidth:$,availableHeight:L});const Y=await l.getDimensions(u.floating);return w!==Y.width||S!==Y.height?{reset:{rects:!0}}:{}}}};function up(){return typeof window<"u"}function xc(e){return AM(e)?(e.nodeName||"").toLowerCase():"#document"}function ii(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ys(e){var t;return(t=(AM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function AM(e){return up()?e instanceof Node||e instanceof ii(e).Node:!1}function Wi(e){return up()?e instanceof Element||e instanceof ii(e).Element:!1}function no(e){return up()?e instanceof HTMLElement||e instanceof ii(e).HTMLElement:!1}function Ik(e){return!up()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ii(e).ShadowRoot}function Rd(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Vi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function M8(e){return/^(table|td|th)$/.test(xc(e))}function dp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const N8=/transform|translate|scale|rotate|perspective|filter/,A8=/paint|layout|strict|content/,Ca=e=>!!e&&e!=="none";let p_;function E0(e){const t=Wi(e)?Vi(e):e;return Ca(t.transform)||Ca(t.translate)||Ca(t.scale)||Ca(t.rotate)||Ca(t.perspective)||!R0()&&(Ca(t.backdropFilter)||Ca(t.filter))||N8.test(t.willChange||"")||A8.test(t.contain||"")}function D8(e){let t=Qo(e);for(;no(t)&&!cc(t);){if(E0(t))return t;if(dp(t))return null;t=Qo(t)}return null}function R0(){return p_==null&&(p_=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),p_}function cc(e){return/^(html|body|#document)$/.test(xc(e))}function Vi(e){return ii(e).getComputedStyle(e)}function hp(e){return Wi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qo(e){if(xc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ik(e)&&e.host||ys(e);return Ik(t)?t.host:t}function DM(e){const t=Qo(e);return cc(t)?e.ownerDocument?e.ownerDocument.body:e.body:no(t)&&Rd(t)?t:DM(t)}function od(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=DM(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),l=ii(s);if(o){const u=Tb(l);return t.concat(l,l.visualViewport||[],Rd(s)?s:[],u&&n?od(u):[])}else return t.concat(s,od(s,[],n))}function Tb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jM(e){const t=Vi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=no(e),o=s?e.offsetWidth:n,l=s?e.offsetHeight:r,u=bm(n)!==o||bm(r)!==l;return u&&(n=o,r=l),{width:n,height:r,$:u}}function T0(e){return Wi(e)?e:e.contextElement}function rc(e){const t=T0(e);if(!no(t))return gs(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=jM(t);let l=(o?bm(n.width):n.width)/r,u=(o?bm(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const j8=gs(0);function OM(e){const t=ii(e);return!R0()||!t.visualViewport?j8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function O8(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ii(e)?!1:t}function $a(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=T0(e);let l=gs(1);t&&(r?Wi(r)&&(l=rc(r)):l=rc(e));const u=O8(o,n,r)?OM(o):gs(0);let h=(s.left+u.x)/l.x,d=(s.top+u.y)/l.y,g=s.width/l.x,p=s.height/l.y;if(o){const v=ii(o),y=r&&Wi(r)?ii(r):r;let w=v,S=Tb(w);for(;S&&r&&y!==w;){const C=rc(S),k=S.getBoundingClientRect(),R=Vi(S),E=k.left+(S.clientLeft+parseFloat(R.paddingLeft))*C.x,M=k.top+(S.clientTop+parseFloat(R.paddingTop))*C.y;h*=C.x,d*=C.y,g*=C.x,p*=C.y,h+=E,d+=M,w=ii(S),S=Tb(w)}}return xm({width:g,height:p,x:h,y:d})}function fp(e,t){const n=hp(e).scrollLeft;return t?t.left+n:$a(ys(e)).left+n}function LM(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-fp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function L8(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",l=ys(r),u=t?dp(t.floating):!1;if(r===l||u&&o)return n;let h={scrollLeft:0,scrollTop:0},d=gs(1);const g=gs(0),p=no(r);if((p||!p&&!o)&&((xc(r)!=="body"||Rd(l))&&(h=hp(r)),p)){const y=$a(r);d=rc(r),g.x=y.x+r.clientLeft,g.y=y.y+r.clientTop}const v=l&&!p&&!o?LM(l,h):gs(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+g.x+v.x,y:n.y*d.y-h.scrollTop*d.y+g.y+v.y}}function z8(e){return Array.from(e.getClientRects())}function P8(e){const t=ys(e),n=hp(e),r=e.ownerDocument.body,s=ri(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ri(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+fp(e);const u=-n.scrollTop;return Vi(r).direction==="rtl"&&(l+=ri(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:l,y:u}}const Hk=25;function B8(e,t){const n=ii(e),r=ys(e),s=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,u=0,h=0;if(s){o=s.width,l=s.height;const g=R0();(!g||g&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=fp(r);if(d<=0){const g=r.ownerDocument,p=g.body,v=getComputedStyle(p),y=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,w=Math.abs(r.clientWidth-p.clientWidth-y);w<=Hk&&(o-=w)}else d<=Hk&&(o+=d);return{width:o,height:l,x:u,y:h}}function I8(e,t){const n=$a(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=no(e)?rc(e):gs(1),l=e.clientWidth*o.x,u=e.clientHeight*o.y,h=s*o.x,d=r*o.y;return{width:l,height:u,x:h,y:d}}function Fk(e,t,n){let r;if(t==="viewport")r=B8(e,n);else if(t==="document")r=P8(ys(e));else if(Wi(t))r=I8(t,n);else{const s=OM(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return xm(r)}function zM(e,t){const n=Qo(e);return n===t||!Wi(n)||cc(n)?!1:Vi(n).position==="fixed"||zM(n,t)}function H8(e,t){const n=t.get(e);if(n)return n;let r=od(e,[],!1).filter(u=>Wi(u)&&xc(u)!=="body"),s=null;const o=Vi(e).position==="fixed";let l=o?Qo(e):e;for(;Wi(l)&&!cc(l);){const u=Vi(l),h=E0(l);!h&&u.position==="fixed"&&(s=null),(o?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Rd(l)&&!h&&zM(e,l))?r=r.filter(g=>g!==l):s=u,l=Qo(l)}return t.set(e,r),r}function F8(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const l=[...n==="clippingAncestors"?dp(t)?[]:H8(t,this._c):[].concat(n),r],u=Fk(t,l[0],s);let h=u.top,d=u.right,g=u.bottom,p=u.left;for(let v=1;v<l.length;v++){const y=Fk(t,l[v],s);h=ri(y.top,h),d=Zo(y.right,d),g=Zo(y.bottom,g),p=ri(y.left,p)}return{width:d-p,height:g-h,x:p,y:h}}function U8(e){const{width:t,height:n}=jM(e);return{width:t,height:n}}function $8(e,t,n){const r=no(t),s=ys(t),o=n==="fixed",l=$a(e,!0,o,t);let u={scrollLeft:0,scrollTop:0};const h=gs(0);function d(){h.x=fp(s)}if(r||!r&&!o)if((xc(t)!=="body"||Rd(s))&&(u=hp(t)),r){const y=$a(t,!0,o,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();o&&!r&&s&&d();const g=s&&!r&&!o?LM(s,u):gs(0),p=l.left+u.scrollLeft-h.x-g.x,v=l.top+u.scrollTop-h.y-g.y;return{x:p,y:v,width:l.width,height:l.height}}function g_(e){return Vi(e).position==="static"}function Uk(e,t){if(!no(e)||Vi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ys(e)===n&&(n=n.ownerDocument.body),n}function PM(e,t){const n=ii(e);if(dp(e))return n;if(!no(e)){let s=Qo(e);for(;s&&!cc(s);){if(Wi(s)&&!g_(s))return s;s=Qo(s)}return n}let r=Uk(e,t);for(;r&&M8(r)&&g_(r);)r=Uk(r,t);return r&&cc(r)&&g_(r)&&!E0(r)?n:r||D8(e)||n}const W8=async function(e){const t=this.getOffsetParent||PM,n=this.getDimensions,r=await n(e.floating);return{reference:$8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function V8(e){return Vi(e).direction==="rtl"}const q8={convertOffsetParentRelativeRectToViewportRelativeRect:L8,getDocumentElement:ys,getClippingRect:F8,getOffsetParent:PM,getElementRects:W8,getClientRects:z8,getDimensions:U8,getScale:rc,isElement:Wi,isRTL:V8};function BM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function K8(e,t){let n=null,r;const s=ys(e);function o(){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),o();const d=e.getBoundingClientRect(),{left:g,top:p,width:v,height:y}=d;if(u||t(),!v||!y)return;const w=xf(p),S=xf(s.clientWidth-(g+v)),C=xf(s.clientHeight-(p+y)),k=xf(g),E={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:ri(0,Zo(1,h))||1};let M=!0;function j(D){const L=D[0].intersectionRatio;if(L!==h){if(!M)return l();L?l(!1,L):r=setTimeout(()=>{l(!1,1e-7)},1e3)}L===1&&!BM(d,e.getBoundingClientRect())&&l(),M=!1}try{n=new IntersectionObserver(j,{...E,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,E)}n.observe(e)}return l(!0),o}function G8(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=T0(e),g=s||o?[...d?od(d):[],...t?od(t):[]]:[];g.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),o&&k.addEventListener("resize",n)});const p=d&&u?K8(d,n):null;let v=-1,y=null;l&&(y=new ResizeObserver(k=>{let[R]=k;R&&R.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let w,S=h?$a(e):null;h&&C();function C(){const k=$a(e);S&&!BM(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;g.forEach(R=>{s&&R.removeEventListener("scroll",n),o&&R.removeEventListener("resize",n)}),p==null||p(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(w)}}const Y8=k8,X8=E8,Z8=w8,Q8=T8,J8=S8,$k=x8,e9=R8,t9=(e,t,n)=>{const r=new Map,s={platform:q8,...n},o={...s.platform,_c:r};return y8(e,t,{...s,platform:o})};var n9=typeof document<"u",r9=function(){},Zf=n9?_.useLayoutEffect:r9;function wm(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(!wm(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 o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!wm(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function IM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wk(e,t){const n=IM(e);return Math.round(t*n)/n}function v_(e){const t=_.useRef(e);return Zf(()=>{t.current=e}),t}function i9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:l}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[g,p]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,y]=_.useState(r);wm(v,r)||y(r);const[w,S]=_.useState(null),[C,k]=_.useState(null),R=_.useCallback(U=>{U!==D.current&&(D.current=U,S(U))},[]),E=_.useCallback(U=>{U!==L.current&&(L.current=U,k(U))},[]),M=o||w,j=l||C,D=_.useRef(null),L=_.useRef(null),$=_.useRef(g),Y=h!=null,P=v_(h),V=v_(s),I=v_(d),W=_.useCallback(()=>{if(!D.current||!L.current)return;const U={placement:t,strategy:n,middleware:v};V.current&&(U.platform=V.current),t9(D.current,L.current,U).then(F=>{const N={...F,isPositioned:I.current!==!1};K.current&&!wm($.current,N)&&($.current=N,Bi.flushSync(()=>{p(N)}))})},[v,t,n,V,I]);Zf(()=>{d===!1&&$.current.isPositioned&&($.current.isPositioned=!1,p(U=>({...U,isPositioned:!1})))},[d]);const K=_.useRef(!1);Zf(()=>(K.current=!0,()=>{K.current=!1}),[]),Zf(()=>{if(M&&(D.current=M),j&&(L.current=j),M&&j){if(P.current)return P.current(M,j,W);W()}},[M,j,W,P,Y]);const q=_.useMemo(()=>({reference:D,floating:L,setReference:R,setFloating:E}),[R,E]),O=_.useMemo(()=>({reference:M,floating:j}),[M,j]),H=_.useMemo(()=>{const U={position:n,left:0,top:0};if(!O.floating)return U;const F=Wk(O.floating,g.x),N=Wk(O.floating,g.y);return u?{...U,transform:"translate("+F+"px, "+N+"px)",...IM(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:N}},[n,u,O.floating,g.x,g.y]);return _.useMemo(()=>({...g,update:W,refs:q,elements:O,floatingStyles:H}),[g,W,q,O,H])}const s9=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?$k({element:r.current,padding:s}).fn(n):{}:r?$k({element:r,padding:s}).fn(n):{}}}},o9=(e,t)=>{const n=Y8(e);return{name:n.name,fn:n.fn,options:[e,t]}},a9=(e,t)=>{const n=X8(e);return{name:n.name,fn:n.fn,options:[e,t]}},l9=(e,t)=>({fn:e9(e).fn,options:[e,t]}),c9=(e,t)=>{const n=Z8(e);return{name:n.name,fn:n.fn,options:[e,t]}},u9=(e,t)=>{const n=Q8(e);return{name:n.name,fn:n.fn,options:[e,t]}},d9=(e,t)=>{const n=J8(e);return{name:n.name,fn:n.fn,options:[e,t]}},h9=(e,t)=>{const n=s9(e);return{name:n.name,fn:n.fn,options:[e,t]}};var f9="Arrow",HM=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return f.jsx(Tt.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});HM.displayName=f9;var m9=HM;function p9(e){const[t,n]=_.useState(void 0);return br(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let l,u;if("borderBoxSize"in o){const h=o.borderBoxSize,d=Array.isArray(h)?h[0]:h;l=d.inlineSize,u=d.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var M0="Popper",[FM,ea]=to(M0),[g9,UM]=FM(M0),$M=e=>{const{__scopePopper:t,children:n}=e,[r,s]=_.useState(null);return f.jsx(g9,{scope:t,anchor:r,onAnchorChange:s,children:n})};$M.displayName=M0;var WM="PopperAnchor",VM=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=UM(WM,n),l=_.useRef(null),u=Ut(t,l),h=_.useRef(null);return _.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||l.current,d!==h.current&&o.onAnchorChange(h.current)}),r?null:f.jsx(Tt.div,{...s,ref:u})});VM.displayName=WM;var N0="PopperContent",[v9,_9]=FM(N0),qM=_.forwardRef((e,t)=>{var te,le,me,xe,Ae,Re;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,C=UM(N0,n),[k,R]=_.useState(null),E=Ut(t,je=>R(je)),[M,j]=_.useState(null),D=p9(M),L=(D==null?void 0:D.width)??0,$=(D==null?void 0:D.height)??0,Y=r+(o!=="center"?"-"+o:""),P=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},V=Array.isArray(d)?d:[d],I=V.length>0,W={padding:P,boundary:V.filter(y9),altBoundary:I},{refs:K,floatingStyles:q,placement:O,isPositioned:H,middlewareData:U}=i9({strategy:"fixed",placement:Y,whileElementsMounted:(...je)=>G8(...je,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[o9({mainAxis:s+$,alignmentAxis:l}),h&&a9({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?l9():void 0,...W}),h&&c9({...W}),u9({...W,apply:({elements:je,rects:Ye,availableWidth:xt,availableHeight:ft})=>{const{width:he,height:Pe}=Ye.reference,Ne=je.floating.style;Ne.setProperty("--radix-popper-available-width",`${xt}px`),Ne.setProperty("--radix-popper-available-height",`${ft}px`),Ne.setProperty("--radix-popper-anchor-width",`${he}px`),Ne.setProperty("--radix-popper-anchor-height",`${Pe}px`)}}),M&&h9({element:M,padding:u}),x9({arrowWidth:L,arrowHeight:$}),v&&d9({strategy:"referenceHidden",...W})]}),[F,N]=YM(O),B=Ui(w);br(()=>{H&&(B==null||B())},[H,B]);const X=(te=U.arrow)==null?void 0:te.x,A=(le=U.arrow)==null?void 0:le.y,ne=((me=U.arrow)==null?void 0:me.centerOffset)!==0,[ae,Z]=_.useState();return br(()=>{k&&Z(window.getComputedStyle(k).zIndex)},[k]),f.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:H?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(xe=U.transformOrigin)==null?void 0:xe.x,(Ae=U.transformOrigin)==null?void 0:Ae.y].join(" "),...((Re=U.hide)==null?void 0:Re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(v9,{scope:n,placedSide:F,onArrowChange:j,arrowX:X,arrowY:A,shouldHideArrow:ne,children:f.jsx(Tt.div,{"data-side":F,"data-align":N,...S,ref:E,style:{...S.style,animation:H?void 0:"none"}})})})});qM.displayName=N0;var KM="PopperArrow",b9={top:"bottom",right:"left",bottom:"top",left:"right"},GM=_.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=_9(KM,r),l=b9[o.placedSide];return f.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:f.jsx(m9,{...s,ref:n,style:{...s.style,display:"block"}})})});GM.displayName=KM;function y9(e){return e!==null}var x9=e=>({name:"transformOrigin",options:e,fn(t){var C,k,R;const{placement:n,rects:r,middlewareData:s}=t,l=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[d,g]=YM(n),p={start:"0%",center:"50%",end:"100%"}[g],v=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((R=s.arrow)==null?void 0:R.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=l?p:`${v}px`,S=`${-h}px`):d==="top"?(w=l?p:`${v}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=l?p:`${y}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=l?p:`${y}px`),{data:{x:w,y:S}}}});function YM(e){const[t,n="center"]=e.split("-");return[t,n]}var mp=$M,Td=VM,pp=qM,gp=GM,XM=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"}),w9="VisuallyHidden",ZM=_.forwardRef((e,t)=>f.jsx(Tt.span,{...e,ref:t,style:{...XM,...e.style}}));ZM.displayName=w9;var S9=ZM,[vp]=to("Tooltip",[ea]),_p=ea(),QM="TooltipProvider",C9=700,Mb="tooltip.open",[k9,A0]=vp(QM),JM=e=>{const{__scopeTooltip:t,delayDuration:n=C9,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,l=_.useRef(!0),u=_.useRef(!1),h=_.useRef(0);return _.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),f.jsx(k9,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:_.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:o})};JM.displayName=QM;var ad="Tooltip",[E9,Md]=vp(ad),eN=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:l,delayDuration:u}=e,h=A0(ad,e.__scopeTooltip),d=_p(t),[g,p]=_.useState(null),v=Gs(),y=_.useRef(0),w=l??h.disableHoverableContent,S=u??h.delayDuration,C=_.useRef(!1),[k,R]=lc({prop:r,defaultProp:s??!1,onChange:L=>{L?(h.onOpen(),document.dispatchEvent(new CustomEvent(Mb))):h.onClose(),o==null||o(L)},caller:ad}),E=_.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),M=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,R(!0)},[R]),j=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,R(!1)},[R]),D=_.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,R(!0),y.current=0},S)},[S,R]);return _.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),f.jsx(mp,{...d,children:f.jsx(E9,{scope:t,contentId:v,open:k,stateAttribute:E,trigger:g,onTriggerChange:p,onTriggerEnter:_.useCallback(()=>{h.isOpenDelayedRef.current?D():M()},[h.isOpenDelayedRef,D,M]),onTriggerLeave:_.useCallback(()=>{w?j():(window.clearTimeout(y.current),y.current=0)},[j,w]),onOpen:M,onClose:j,disableHoverableContent:w,children:n})})};eN.displayName=ad;var Nb="TooltipTrigger",tN=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Md(Nb,n),o=A0(Nb,n),l=_p(n),u=_.useRef(null),h=Ut(t,u,s.onTriggerChange),d=_.useRef(!1),g=_.useRef(!1),p=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),f.jsx(Td,{asChild:!0,...l,children:f.jsx(Tt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:Be(e.onPointerMove,v=>{v.pointerType!=="touch"&&!g.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),g.current=!0)}),onPointerLeave:Be(e.onPointerLeave,()=>{s.onTriggerLeave(),g.current=!1}),onPointerDown:Be(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Be(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Be(e.onBlur,s.onClose),onClick:Be(e.onClick,s.onClose)})})});tN.displayName=Nb;var D0="TooltipPortal",[R9,T9]=vp(D0,{forceMount:void 0}),nN=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=Md(D0,t);return f.jsx(R9,{scope:t,forceMount:n,children:f.jsx(Ai,{present:n||o.open,children:f.jsx(bc,{asChild:!0,container:s,children:r})})})};nN.displayName=D0;var uc="TooltipContent",rN=_.forwardRef((e,t)=>{const n=T9(uc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,l=Md(uc,e.__scopeTooltip);return f.jsx(Ai,{present:r||l.open,children:l.disableHoverableContent?f.jsx(iN,{side:s,...o,ref:t}):f.jsx(M9,{side:s,...o,ref:t})})}),M9=_.forwardRef((e,t)=>{const n=Md(uc,e.__scopeTooltip),r=A0(uc,e.__scopeTooltip),s=_.useRef(null),o=Ut(t,s),[l,u]=_.useState(null),{trigger:h,onClose:d}=n,g=s.current,{onPointerInTransitChange:p}=r,v=_.useCallback(()=>{u(null),p(!1)},[p]),y=_.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},R=O9(k,C.getBoundingClientRect()),E=L9(k,R),M=z9(S.getBoundingClientRect()),j=B9([...E,...M]);u(j),p(!0)},[p]);return _.useEffect(()=>()=>v(),[v]),_.useEffect(()=>{if(h&&g){const w=C=>y(C,g),S=C=>y(C,h);return h.addEventListener("pointerleave",w),g.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),g.removeEventListener("pointerleave",S)}}},[h,g,y,v]),_.useEffect(()=>{if(l){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},R=(h==null?void 0:h.contains(C))||(g==null?void 0:g.contains(C)),E=!P9(k,l);R?v():E&&(v(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,g,l,d,v]),f.jsx(iN,{...e,ref:o})}),[N9,A9]=vp(ad,{isInside:!1}),D9=AP("TooltipContent"),iN=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:l,...u}=e,h=Md(uc,n),d=_p(n),{onClose:g}=h;return _.useEffect(()=>(document.addEventListener(Mb,g),()=>document.removeEventListener(Mb,g)),[g]),_.useEffect(()=>{if(h.trigger){const p=v=>{const y=v.target;y!=null&&y.contains(h.trigger)&&g()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[h.trigger,g]),f.jsx(_c,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:g,children:f.jsxs(pp,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(D9,{children:r}),f.jsx(N9,{scope:n,isInside:!0,children:f.jsx(S9,{id:h.contentId,role:"tooltip",children:s||r})})]})})});rN.displayName=uc;var sN="TooltipArrow",j9=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=_p(n);return A9(sN,n).isInside?null:f.jsx(gp,{...s,...r,ref:t})});j9.displayName=sN;function O9(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function L9(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 z9(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 P9(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const u=t[o],h=t[l],d=u.x,g=u.y,p=h.x,v=h.y;g>r!=v>r&&n<(p-d)*(r-g)/(v-g)+d&&(s=!s)}return s}function B9(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),I9(t)}function I9(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 o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.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 o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.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 H9=JM,oN=eN,aN=tN,lN=nN,j0=rN;function F9({className:e,...t}){return f.jsx("kbd",{className:pe("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 U9({className:e,...t}){return f.jsx("span",{className:pe("inline-flex items-center gap-0.5",e),...t})}const $9="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",W9=H9,ds=oN,hs=aN,Ii=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(lN,{children:f.jsx(j0,{ref:r,sideOffset:t,className:pe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border backdrop-blur-md px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Ii.displayName=j0.displayName;const Ou=oN,Lu=aN;function cN(e){return e.toUpperCase()}function V9(e){const t=e.split("+");return f.jsx(U9,{children:t.map((n,r)=>f.jsx(F9,{children:cN(n)},`${n}-${r}`))})}const Zl=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},o)=>{const l=r===void 0?null:Array.isArray(r)?r[0]??null:r;return f.jsx(lN,{children:f.jsx(j0,{ref:o,sideOffset:t,className:pe($9,e),...s,children:l?V9(l):f.jsx("span",{children:typeof n=="string"?cN(n):n})})})});Zl.displayName="HotkeyTooltipContent";const q9="0.1.0",K9={version:q9},Mn="Kaizen",Vk="kaizen",G9=".kaizen",Y9=".kaizen-dev",__=".kaizen",X9="KAIZEN_RUNTIME_PROFILE",O0=`kaizen/${K9.version}`,Z9="[kaizen]",Q9=`~/${Mn}`,bp="kaizen:";function yp(){var t;return(t=globalThis.process)==null?void 0:t.env}function J9(e=yp()){const t=e==null?void 0:e[X9];return(t==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function e7(e=yp()){return J9(e)==="dev"?Y9:G9}function t7(e=yp()){return`~/${e7(e)}`}function n7(e=yp()){return`${t7(e)}/keybindings.json`}function wf(e){return e?`${Vk} ${e}`:Vk}const Sm=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],Ab=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Db=[{id:"off",label:"Off"},{id:"standard",label:"Standard"},{id:"high",label:"High"}],jb="claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",uN=[{id:"composer-2[fast=true]",label:"Composer 2",supportsEffort:!1},{id:"composer-1.5[]",label:"Composer 1.5",supportsEffort:!1},{id:"gpt-5.3-codex[reasoning=medium,fast=false]",label:"Codex 5.3",supportsEffort:!1},{id:"gpt-5.4[reasoning=medium,context=272k,fast=false]",label:"GPT-5.4",supportsEffort:!1},{id:"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]",label:"Sonnet 4.6",supportsEffort:!1},{id:"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",label:"Opus 4.6",supportsEffort:!1},{id:"claude-opus-4-5[thinking=true]",label:"Opus 4.5",supportsEffort:!1},{id:"gpt-5.2[reasoning=medium,fast=false]",label:"GPT-5.2",supportsEffort:!1},{id:"gemini-3.1-pro[]",label:"Gemini 3.1 Pro",supportsEffort:!1},{id:"gpt-5.4-mini[reasoning=medium]",label:"GPT-5.4 Mini",supportsEffort:!1},{id:"gpt-5.4-nano[reasoning=medium]",label:"GPT-5.4 Nano",supportsEffort:!1},{id:"claude-haiku-4-5[thinking=true]",label:"Haiku 4.5",supportsEffort:!1},{id:"gpt-5.3-codex-spark[reasoning=medium]",label:"Codex 5.3 Spark",supportsEffort:!1},{id:"grok-4-20[thinking=true]",label:"Grok 4.20",supportsEffort:!1},{id:"claude-sonnet-4-5[thinking=true,context=200k]",label:"Sonnet 4.5",supportsEffort:!1},{id:"gpt-5.2-codex[reasoning=medium,fast=false]",label:"Codex 5.2",supportsEffort:!1},{id:"gemini-3-flash[]",label:"Gemini 3 Flash",supportsEffort:!1},{id:"claude-sonnet-4[thinking=false,context=200k]",label:"Sonnet 4",supportsEffort:!1},{id:"kimi-k2.5[]",label:"Kimi K2.5",supportsEffort:!1}],r7={"composer-2-fast":"composer-2[fast=true]","composer-1.5":"composer-1.5[]","gpt-5.3-codex":"gpt-5.3-codex[reasoning=medium,fast=false]","gpt-5.4":"gpt-5.4[reasoning=medium,context=272k,fast=false]","gpt-5.4-medium":"gpt-5.4[reasoning=medium,context=272k,fast=false]","claude-4.6-sonnet-medium-thinking":"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]","claude-4.6-opus-high-thinking":"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]","claude-4.5-opus-high-thinking":"claude-opus-4-5[thinking=true]","gpt-5.2":"gpt-5.2[reasoning=medium,fast=false]","gemini-3.1-pro":"gemini-3.1-pro[]","gpt-5.4-mini":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-mini-medium":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-nano":"gpt-5.4-nano[reasoning=medium]","gpt-5.4-nano-medium":"gpt-5.4-nano[reasoning=medium]","claude-haiku-4.5":"claude-haiku-4-5[thinking=true]","gpt-5.3-codex-spark-preview":"gpt-5.3-codex-spark[reasoning=medium]","grok-4-20":"grok-4-20[thinking=true]","grok-4-20-thinking":"grok-4-20[thinking=true]","claude-4.5-sonnet-thinking":"claude-sonnet-4-5[thinking=true,context=200k]","gpt-5.2-codex":"gpt-5.2-codex[reasoning=medium,fast=false]","gemini-3-flash":"gemini-3-flash[]","claude-4-sonnet":"claude-sonnet-4[thinking=false,context=200k]","kimi-k2.5":"kimi-k2.5[]"};function i7(e){return e?uN.some(t=>t.id===e)?e:r7[e]??jb:jb}function qk(e){const t=e.indexOf("[");return t>=0?e.slice(0,t):e}function Yl(e){const t=e.match(/\bfast=(true|false)\b/);return t?t[1]==="true"?"fast":"standard":null}function Kk(e){return Sm.some(t=>t.id===e)}function Gk(e){return Ab.some(t=>t.id===e)}const Ob=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}];function s7(e){return Db.some(t=>t.id===e)}const Ko=[{id:"claude",label:"Claude",systemActive:!0,defaultModel:"sonnet",defaultEffort:"high",defaultModelOptions:{reasoningEffort:"high",contextWindow:"200k"},supportsPlanMode:!0,models:[{id:"opus",label:"Opus",supportsEffort:!0,contextWindowOptions:[...Ob]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...Ob]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...Sm]},{id:"codex",label:"Codex",systemActive:!0,defaultModel:"gpt-5.4",defaultModelOptions:{reasoningEffort:"high",fastMode:!1},supportsPlanMode:!0,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]},{id:"gemini",label:"Gemini",systemActive:!1,defaultModel:"auto-gemini-2.5",defaultModelOptions:{thinkingMode:"standard"},supportsPlanMode:!0,models:[{id:"auto-gemini-3",label:"Auto (Gemini 3)",supportsEffort:!1},{id:"auto-gemini-2.5",label:"Auto (Gemini 2.5)",supportsEffort:!1},{id:"gemini-3.1-pro-preview",label:"3.1 Pro Preview",supportsEffort:!1},{id:"gemini-3-pro-preview",label:"3 Pro Preview",supportsEffort:!1},{id:"gemini-3-flash-preview",label:"3 Flash Preview",supportsEffort:!1},{id:"gemini-2.5-pro",label:"2.5 Pro",supportsEffort:!1},{id:"gemini-2.5-flash",label:"2.5 Flash",supportsEffort:!1},{id:"gemini-2.5-flash-lite",label:"2.5 Flash Lite",supportsEffort:!1}],efforts:[]},{id:"cursor",label:"Cursor",systemActive:!0,defaultModel:jb,defaultModelOptions:{},supportsPlanMode:!0,models:[...uN],efforts:[]}],Wn={claude:{active:!0},codex:{active:!0},gemini:{active:!0},cursor:{active:!0}};function Jt(e){const t=Ko.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function L0(e,t){const n=Wn[t],r=e==null?void 0:e[t];return{active:(r==null?void 0:r.active)??n.active}}function o7(e,t){const n=Jt(e),r=L0(t,e);return n.systemActive&&r.active?null:`Provider ${n.label} is currently not active.`}function Yk(e,t){const n=Jt(e),r=L0(t,e);return n.systemActive&&r.active}function a7(e){return Ko.map(t=>{const n=L0(e,t.id),r=t.systemActive&&n.active;return{...t,active:n.active,isSelectable:r,isUsageEnabled:r,isInactive:!r,inactiveMessage:o7(t.id,e)}})}function z0(e){return a7(e).filter(t=>t.isSelectable).map(({active:t,isSelectable:n,isUsageEnabled:r,isInactive:s,inactiveMessage:o,...l})=>l)}function Ri(e){return Jt(e).defaultModelOptions}const dN=Ri("claude");Ri("codex");Ri("gemini");Ri("cursor");function l7(e){return Jt("claude").models.find(t=>t.id===e)}function c7(e){var t;return((t=l7(e))==null?void 0:t.contextWindowOptions)??[]}function u7(e,t){const n=c7(e);if(n.length!==0)return n.some(r=>r.id===t)?t:dN.contextWindow}const d7=["idea","todo","progress","testing","done"],Xk={idea:"IDEA",todo:"TODO",progress:"PROGRESS",testing:"TESTING",done:"DONE"},os={submitChatMessage:["enter"],toggleProjectsSidebar:["ctrl+a"],toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"]},Zk=8,h7=10*1024*1024,Qk=["image/png","image/jpeg","image/webp","image/gif"];var xp="Popover",[hN]=to(xp,[ea]),Nd=ea(),[f7,ta]=hN(xp),fN=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:l=!1}=e,u=Nd(t),h=_.useRef(null),[d,g]=_.useState(!1),[p,v]=lc({prop:r,defaultProp:s??!1,onChange:o,caller:xp});return f.jsx(mp,{...u,children:f.jsx(f7,{scope:t,contentId:Gs(),triggerRef:h,open:p,onOpenChange:v,onOpenToggle:_.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:d,onCustomAnchorAdd:_.useCallback(()=>g(!0),[]),onCustomAnchorRemove:_.useCallback(()=>g(!1),[]),modal:l,children:n})})};fN.displayName=xp;var mN="PopoverAnchor",pN=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(mN,n),o=Nd(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=s;return _.useEffect(()=>(l(),()=>u()),[l,u]),f.jsx(Td,{...o,...r,ref:t})});pN.displayName=mN;var gN="PopoverTrigger",vN=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(gN,n),o=Nd(n),l=Ut(t,s.triggerRef),u=f.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":wN(s.open),...r,ref:l,onClick:Be(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:f.jsx(Td,{asChild:!0,...o,children:u})});vN.displayName=gN;var P0="PopoverPortal",[m7,p7]=hN(P0,{forceMount:void 0}),_N=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=ta(P0,t);return f.jsx(m7,{scope:t,forceMount:n,children:f.jsx(Ai,{present:n||o.open,children:f.jsx(bc,{asChild:!0,container:s,children:r})})})};_N.displayName=P0;var dc="PopoverContent",bN=_.forwardRef((e,t)=>{const n=p7(dc,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,o=ta(dc,e.__scopePopover);return f.jsx(Ai,{present:r||o.open,children:o.modal?f.jsx(v7,{...s,ref:t}):f.jsx(_7,{...s,ref:t})})});bN.displayName=dc;var g7=Fa("PopoverContent.RemoveScroll"),v7=_.forwardRef((e,t)=>{const n=ta(dc,e.__scopePopover),r=_.useRef(null),s=Ut(t,r),o=_.useRef(!1);return _.useEffect(()=>{const l=r.current;if(l)return tp(l)},[]),f.jsx(Cd,{as:g7,allowPinchZoom:!0,children:f.jsx(yN,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),o.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,h=u.button===0&&u.ctrlKey===!0,d=u.button===2||h;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Be(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),_7=_.forwardRef((e,t)=>{const n=ta(dc,e.__scopePopover),r=_.useRef(!1),s=_.useRef(!1);return f.jsx(yN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),yN=_.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:g,...p}=e,v=ta(dc,n),y=Nd(n);return Jm(),f.jsx(Sd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:f.jsx(_c,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:g,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onDismiss:()=>v.onOpenChange(!1),children:f.jsx(pp,{"data-state":wN(v.open),role:"dialog",id:v.contentId,...y,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),xN="PopoverClose",b7=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ta(xN,n);return f.jsx(Tt.button,{type:"button",...r,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});b7.displayName=xN;var y7="PopoverArrow",x7=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Nd(n);return f.jsx(gp,{...s,...r,ref:t})});x7.displayName=y7;function wN(e){return e?"open":"closed"}var SN=fN,w7=pN,S7=vN,CN=_N,B0=bN;const kN=SN,EN=S7,I0=_.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>f.jsx(CN,{children:f.jsx(B0,{ref:s,align:t,sideOffset:n,[sd]:"",onCloseAutoFocus:o=>{var l;o.preventDefault(),window.dispatchEvent(new Event(vm)),(l=r.onCloseAutoFocus)==null||l.call(r,o)},className:pe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));I0.displayName=B0.displayName;function C7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function k7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"})})}function E7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0C12 0 12 8 8 12C4 16 0 12 0 12C0 12 4 12 8 12C12 12 12 16 12 24C12 24 12 16 16 12C20 8 24 12 24 12C24 12 16 12 16 12C12 12 12 4 12 0Z"})})}function R7({className:e,...t}){return f.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:pe("shrink-0",e),...t,children:f.jsx("path",{d:"M12 0 2.4 5.5v13L12 24l9.6-5.5v-13Zm0 3.1 6.8 3.9v5.1L15 14.3V9.7L12 8l-3 1.7v4.6l-3.8-2.2V7Zm-6.8 9.8 3.8 2.2v4.5l3 1.8 3-1.8v-4.5l3.8-2.2v3.8L12 20.9l-6.8-3.9Z"})})}function T7(e){return!(e.startsWith("gemini-3")||e==="auto-gemini-3")}const M7=["Composer","GPT","Claude","Gemini","Grok","Kimi"];function N7(e){return e.startsWith("composer-")?"Composer":e.startsWith("gpt-")?"GPT":e.startsWith("claude-")?"Claude":e.startsWith("gemini-")?"Gemini":e.startsWith("grok-")?"Grok":"Kimi"}function b_(e,t){const n=Yl(t);return!n||n==="standard"?e:`${e} (${n==="fast"?"Fast":"Standard"})`}const Cm={claude:C7,codex:k7,gemini:E7,cursor:R7},Sf={auto:Tn,opus:ti,sonnet:Tn,haiku:ls,"gpt-5.4":ti,"gpt-5.4[reasoning=medium,context=272k,fast=false]":ti,"gpt-5.4-mini[reasoning=medium]":Tn,"gpt-5.4-nano[reasoning=medium]":ls,"gpt-5.3-codex":Tn,"gpt-5.3-codex[reasoning=medium,fast=false]":Tn,"gpt-5.3-codex-spark[reasoning=medium]":ls,"gpt-5.2[reasoning=medium,fast=false]":Tn,"gpt-5.2-codex[reasoning=medium,fast=false]":Tn,"gpt-5.3-codex-spark":ls,"gemini-2.5-pro":ti,"gemini-2.5-flash":Tn,"gemini-2.5-flash-lite":ls,"auto-gemini-3":ti,"auto-gemini-2.5":Tn,"gemini-3.1-pro-preview":ti,"gemini-3.1-pro[]":ti,"gemini-3-flash[]":Tn,"gemini-3-pro-preview":ti,"gemini-3-flash-preview":Tn,"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]":ti,"claude-opus-4-5[thinking=true]":ti,"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]":Tn,"claude-sonnet-4-5[thinking=true,context=200k]":Tn,"claude-sonnet-4[thinking=false,context=200k]":Tn,"claude-haiku-4-5[thinking=true]":ls,"grok-4-20[thinking=true]":ti,"kimi-k2.5[]":Tn,"composer-2[fast=true]":ti,"composer-1.5[]":Tn};function Ir({onClick:e,selected:t,icon:n,label:r,description:s,disabled:o}){return f.jsxs("button",{onClick:e,disabled:o,className:pe("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",t?"bg-muted border-border":"hover:opacity-60",o&&"opacity-40 cursor-not-allowed"),children:[n,f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium",children:r}),s?f.jsx("div",{className:"text-xs text-muted-foreground",children:s}):null]})]})}function Po({trigger:e,triggerClassName:t,disabled:n=!1,children:r}){const[s,o]=_.useState(!1);return n?f.jsx("button",{disabled:!0,className:pe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default",t),children:e}):f.jsxs(kN,{open:s,onOpenChange:o,children:[f.jsx(EN,{asChild:!0,children:f.jsx("button",{className:pe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",t),children:e})}),f.jsx(I0,{align:"center",className:"w-64 p-1",children:f.jsx("div",{className:"max-h-[min(24rem,60vh)] space-y-1 overflow-y-auto pr-1",children:typeof r=="function"?r(()=>o(!1)):r})})]})}function zu({availableProviders:e,selectedProvider:t,disabled:n=!1,showProviderPicker:r=!0,providerLocked:s=!1,model:o,modelOptions:l,onProviderChange:u,onModelChange:h,onClaudeReasoningEffortChange:d,onClaudeContextWindowChange:g,onCodexReasoningEffortChange:p,onGeminiThinkingModeChange:v,onCodexFastModeChange:y,planMode:w=!1,onPlanModeChange:S,includePlanMode:C=!0,className:k}){var F,N,B,X,A,ne,ae;const[R,E]=_.useState(null),M=e.find(Z=>Z.id===t)??Jt(t),j=Cm[t],D=Sf[o]??Tn,L=C&&(M==null?void 0:M.supportsPlanMode)&&S,$=t==="claude"?l:null,Y=t==="codex"?l:null,P=t==="gemini"?l:null,V=((F=M.models.find(Z=>Z.id===o))==null?void 0:F.contextWindowOptions)??[],I=($==null?void 0:$.contextWindow)??Ob[0].id,W=I==="1m"?Mk:Nk,K=t==="claude"||t==="codex",q=t==="cursor"?Yl(o):null,O=M.id==="cursor"?M.models.filter(Z=>qk(Z.id)===qk(o)):[],H=t==="cursor"&&O.some(Z=>Yl(Z.id)==="fast")&&O.some(Z=>Yl(Z.id)==="standard"),U=M.id==="cursor"?M7.map(Z=>({family:Z,models:M.models.filter(te=>N7(te.id)===Z)})).filter(Z=>Z.models.length>0):[];return _.useEffect(()=>{E(null)},[t]),f.jsx("div",{className:pe("max-w-full overflow-x-auto scrollbar-hide",n&&"pointer-events-none opacity-60",k),children:f.jsxs("div",{className:"flex w-max items-center justify-center gap-0.5 mx-auto",children:[r?f.jsx(Po,{disabled:s||!u,trigger:f.jsxs(f.Fragment,{children:[f.jsx(j,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:(M==null?void 0:M.label)??t})]}),children:Z=>e.map(te=>{const le=Cm[te.id];return f.jsx(Ir,{onClick:()=>{u==null||u(te.id),Z()},selected:t===te.id,icon:f.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),label:te.label},te.id)})}):null,f.jsx(Po,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(D,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:M.id==="cursor"?b_(((N=M.models.find(Z=>Z.id===o))==null?void 0:N.label)??o,o):((B=M.models.find(Z=>Z.id===o))==null?void 0:B.label)??o})]}),children:Z=>{var te;return M.id==="cursor"?R?f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:()=>E(null),className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-muted-foreground transition-opacity hover:opacity-70",children:[f.jsx(_M,{className:"h-4 w-4"}),f.jsx("span",{children:R})]}),(te=U.find(le=>le.family===R))==null?void 0:te.models.map(le=>{const me=Sf[le.id]??Tn;return f.jsx(Ir,{onClick:()=>{h(t,le.id),E(null),Z()},selected:o===le.id,icon:f.jsx(me,{className:"h-4 w-4 text-muted-foreground"}),label:b_(le.label,le.id)},le.id)})]}):U.map(le=>{var Ae;const me=le.models.some(Re=>Re.id===o),xe=Sf[((Ae=le.models[0])==null?void 0:Ae.id)??""]??Tn;return f.jsxs("div",{className:"relative",children:[f.jsx(Ir,{onClick:()=>E(le.family),selected:me,icon:f.jsx(xe,{className:"h-4 w-4 text-muted-foreground"}),label:le.family,description:`${le.models.length} model${le.models.length===1?"":"s"}`}),f.jsx(Tr,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"})]},le.family)}):M.models.map(le=>{const me=Sf[le.id]??Tn;return f.jsx(Ir,{onClick:()=>{h(t,le.id),Z()},selected:o===le.id,icon:f.jsx(me,{className:"h-4 w-4 text-muted-foreground"}),label:M.id==="cursor"?b_(le.label,le.id):le.label},le.id)})}}),H?f.jsx(Po,{trigger:f.jsxs(f.Fragment,{children:[q==="fast"?f.jsx(ls,{className:"h-3.5 w-3.5"}):f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:q==="fast"?"Fast":"Standard"})]}),triggerClassName:q==="fast"?"text-emerald-500 dark:text-emerald-400":void 0,children:Z=>f.jsxs(f.Fragment,{children:[O.filter(te=>Yl(te.id)==="standard").map(te=>f.jsx(Ir,{onClick:()=>{h(t,te.id),Z()},selected:o===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"},te.id)),O.filter(te=>Yl(te.id)==="fast").map(te=>f.jsx(Ir,{onClick:()=>{h(t,te.id),Z()},selected:o===te.id,icon:f.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast"},te.id))]})}):null,K?f.jsx(Po,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:t==="claude"?((X=Sm.find(Z=>Z.id===l.reasoningEffort))==null?void 0:X.label)??l.reasoningEffort:((A=Ab.find(Z=>Z.id===l.reasoningEffort))==null?void 0:A.label)??l.reasoningEffort})]}),children:Z=>t==="claude"?Sm.map(te=>f.jsx(Ir,{onClick:()=>{d(te.id),Z()},selected:l.reasoningEffort===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,disabled:te.id==="max"&&o!=="opus"},te.id)):Ab.map(te=>f.jsx(Ir,{onClick:()=>{p(te.id),Z()},selected:l.reasoningEffort===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label},te.id))}):null,t==="claude"&&V.length>1?f.jsx(Po,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(W,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((ne=V.find(Z=>Z.id===I))==null?void 0:ne.label)??I})]}),children:Z=>V.map(te=>f.jsx(Ir,{onClick:()=>{g(te.id),Z()},selected:I===te.id,icon:te.id==="1m"?f.jsx(Mk,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(Nk,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,description:te.id==="1m"?"Expanded context window":"Standard context window"},te.id))}):null,t==="gemini"?f.jsx(Po,{trigger:f.jsxs(f.Fragment,{children:[f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:((ae=Db.find(Z=>Z.id===(P==null?void 0:P.thinkingMode)))==null?void 0:ae.label)??(P==null?void 0:P.thinkingMode)??"Standard"})]}),children:Z=>Db.map(te=>f.jsx(Ir,{onClick:()=>{v(te.id),Z()},selected:(P==null?void 0:P.thinkingMode)===te.id,icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:te.label,disabled:te.id==="off"&&!T7(o)},te.id))}):null,t==="codex"?f.jsx(Po,{trigger:f.jsxs(f.Fragment,{children:[Y!=null&&Y.fastMode?f.jsx(ls,{className:"h-3.5 w-3.5"}):f.jsx(Fs,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:Y!=null&&Y.fastMode?"Fast Mode":"Standard"})]}),triggerClassName:Y!=null&&Y.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:Z=>f.jsxs(f.Fragment,{children:[f.jsx(Ir,{onClick:()=>{y(!1),Z()},selected:!(Y!=null&&Y.fastMode),icon:f.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),f.jsx(Ir,{onClick:()=>{y(!0),Z()},selected:!!(Y!=null&&Y.fastMode),icon:f.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,L?f.jsx(Po,{trigger:f.jsxs(f.Fragment,{children:[w?f.jsx(pm,{className:"h-3.5 w-3.5"}):f.jsx(Rk,{className:"h-3.5 w-3.5"}),f.jsx("span",{className:"hidden md:inline",children:w?"Plan":"Implement"}),f.jsx("span",{className:"md:hidden",children:w?"Plan":"Impl"})]}),triggerClassName:w?"text-blue-400 dark:text-blue-300":void 0,children:Z=>f.jsxs(f.Fragment,{children:[f.jsx(Ir,{onClick:()=>{S(!1),Z()},selected:!w,icon:f.jsx(Rk,{className:"h-4 w-4 text-muted-foreground"}),label:"Implement",description:"Start execution"}),f.jsx(Ir,{onClick:()=>{S(!0),Z()},selected:w,icon:f.jsx(pm,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan",description:"Review a plan before execution"})]})}):null]})})}const wp=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>f.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:pe("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 Lb(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const A7=[/^(?:\/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 D7(e){const t=e.trim();for(const n of A7){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function km(e){return e.split("/").pop()||e}function j7(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,o=24*s,l=7*o;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<o?`${Math.floor(n/s)}h`:n<l?`${Math.floor(n/o)}d`:`${Math.floor(n/l)}w`}const O7='button, select, input, textarea, [role="combobox"], [role="listbox"], [data-no-touch-drag]';function Jk(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e)}catch{}}function H0({enabled:e,visualElementRef:t,onTap:n,onContextMenu:r,onDragStart:s,onDragMove:o,onDragEnd:l,holdDelay:u=300,contextMenuDelay:h=2500,scrollThreshold:d=8,dragMoveThreshold:g=5}){const[p,v]=_.useState(!1),[y,w]=_.useState(!1),[S,C]=_.useState(null),[k,R]=_.useState(null),E=_.useCallback(O=>{R(O)},[]),M=_.useRef("idle"),j=_.useRef({x:0,y:0}),D=_.useRef(null),L=_.useRef(null),$=_.useRef(n),Y=_.useRef(r),P=_.useRef(s),V=_.useRef(o),I=_.useRef(l);$.current=n,Y.current=r,P.current=s,V.current=o,I.current=l;const W=_.useCallback((O,H)=>{const U=(t==null?void 0:t.current)??k;if(!U)return document.elementFromPoint(O,H);const F=U.style.pointerEvents;U.style.pointerEvents="none";const N=document.elementFromPoint(O,H);return U.style.pointerEvents=F,N},[t,k]),K=_.useCallback(()=>{D.current&&(clearTimeout(D.current),D.current=null),L.current&&(clearTimeout(L.current),L.current=null)},[]),q=_.useCallback(()=>{K(),M.current="idle",w(!1),v(!1),C(null)},[K]);return _.useEffect(()=>{if(!k||!e)return;const O=N=>{if(N.target.closest(O7))return;const B=N.touches[0];B&&(j.current={x:B.clientX,y:B.clientY},M.current="holding",D.current=setTimeout(()=>{D.current=null,M.current==="holding"&&(M.current="armed",w(!0),Jk(30),L.current=setTimeout(()=>{var A;if(L.current=null,M.current!=="armed")return;Jk(100);const X={...j.current};M.current="idle",w(!1),(A=Y.current)==null||A.call(Y,X)},h))},u))},H=N=>{var Z,te;const B=M.current;if(B==="idle")return;const X=N.touches[0];if(!X)return;const A=X.clientX-j.current.x,ne=X.clientY-j.current.y,ae=Math.sqrt(A*A+ne*ne);if(B==="holding"){ae>d&&(K(),M.current="idle");return}if(B==="armed"){ae>g&&(L.current&&(clearTimeout(L.current),L.current=null),M.current="dragging",w(!1),v(!0),C({x:X.clientX,y:X.clientY}),N.preventDefault(),(Z=P.current)==null||Z.call(P,{x:X.clientX,y:X.clientY}));return}if(B==="dragging"){N.preventDefault(),C({x:X.clientX,y:X.clientY});const le=W(X.clientX,X.clientY);(te=V.current)==null||te.call(V,{x:X.clientX,y:X.clientY,elementBelow:le})}},U=N=>{var X,A;const B=M.current;if(B==="holding"){K(),M.current="idle",w(!1),v(!1),N.preventDefault(),(X=$.current)==null||X.call($);return}if(B==="armed"){q();return}if(B==="dragging"){const ne=N.changedTouches[0];if(ne){const ae=W(ne.clientX,ne.clientY);(A=I.current)==null||A.call(I,{x:ne.clientX,y:ne.clientY,elementBelow:ae})}q()}},F=()=>{var N;M.current==="dragging"&&((N=I.current)==null||N.call(I,{x:0,y:0,elementBelow:null})),q()};return k.addEventListener("touchstart",O,{passive:!1}),k.addEventListener("touchmove",H,{passive:!1}),k.addEventListener("touchend",U),k.addEventListener("touchcancel",F),()=>{k.removeEventListener("touchstart",O),k.removeEventListener("touchmove",H),k.removeEventListener("touchend",U),k.removeEventListener("touchcancel",F),K(),M.current="idle"}},[k,e,u,h,d,g,K,q,W]),{touchRef:E,isDragging:p,isArmed:y,dragPosition:S}}function RN({position:e,children:t,className:n}){return e?Bi.createPortal(f.jsx("div",{style:{position:"fixed",left:e.x,top:e.y,transform:"translate(-50%, calc(-100% - 14px))",zIndex:9999,pointerEvents:"none",willChange:"transform"},className:pe("flex items-center gap-2 rounded-xl border-2 border-primary/60 bg-card px-3 py-2","shadow-[0_8px_32px_rgba(0,0,0,0.25)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.5)]","min-w-[120px] max-w-[240px]","scale-[1.04]",n),children:t}),document.body):null}const L7=new Set(["starting","running"]);function z7({chat:e,activeChatId:t,nowMs:n,showProviderIcon:r=!1,isCompleted:s=!1,onSelectChat:o,onDeleteChat:l,draggable:u=!1,onDragStart:h,onDragEnd:d,isTouchDevice:g=!1,onTouchDragMove:p,onTouchDragEnd:v}){const y=j7(e.lastMessageAt,n),w=g&&u,S=e.provider?Cm[e.provider]:null,{touchRef:C,isArmed:k,isDragging:R,dragPosition:E}=H0({enabled:w,onTap:()=>o(e.chatId),onDragStart:()=>h==null?void 0:h(e),onDragMove:({x:M,y:j,elementBelow:D})=>p==null?void 0:p(M,j,D),onDragEnd:({x:M,y:j,elementBelow:D})=>{v==null||v(M,j,D),d==null||d()}});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{ref:w?C:void 0,"data-chat-id":dk(e.chatId),className:pe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border transition-all duration-150 select-none",t===dk(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 hover:border-border hover:bg-muted/20 dark:hover:border-slate-400/10",k&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card border-primary/40",R&&!k&&"opacity-20 scale-[0.98]"),draggable:u&&!g,onDragStart:u&&!g?()=>h==null?void 0:h(e):void 0,onDragEnd:u&&!g?d:void 0,onClick:g?void 0:()=>o(e.chatId),children:[L7.has(e.status)?f.jsx(oi,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):s?f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[f.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),f.jsx("div",{className:"rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,r&&S?f.jsx(S,{className:"size-3.5 flex-shrink-0 text-muted-foreground/80","aria-label":`${e.provider} provider`}):null,f.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?f.jsx(wp,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),f.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[y?f.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:y}):null,f.jsx(Je,{variant:"ghost",size:"icon",className:pe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",y?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),"data-no-touch-drag":!0,onClick:M=>{M.stopPropagation(),l(e.chatId)},title:"Delete chat",children:f.jsx(a6,{className:"size-3.5"})})]})]},e._id),f.jsx(RN,{position:E,children:f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})})]})}function P7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const Sp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wc(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function F0(e){return"nodeType"in e}function Wr(e){var t,n;return e?wc(e)?e:F0(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function U0(e){const{Document:t}=Wr(e);return e instanceof t}function Ad(e){return wc(e)?!1:e instanceof Wr(e).HTMLElement}function TN(e){return e instanceof Wr(e).SVGElement}function Sc(e){return e?wc(e)?e.document:F0(e)?U0(e)?e:Ad(e)||TN(e)?e.ownerDocument:document:document:document}const _s=Sp?_.useLayoutEffect:_.useEffect;function $0(e){const t=_.useRef(e);return _s(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function B7(){const e=_.useRef(null),t=_.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ld(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return _s(()=>{n.current!==e&&(n.current=e)},t),n}function Dd(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Em(e){const t=$0(e),n=_.useRef(null),r=_.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function zb(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let y_={};function jd(e,t){return _.useMemo(()=>{if(t)return t;const n=y_[e]==null?0:y_[e]+1;return y_[e]=n,e+"-"+n},[e,t])}function MN(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((o,l)=>{const u=Object.entries(l);for(const[h,d]of u){const g=o[h];g!=null&&(o[h]=g+e*d)}return o},{...t})}}const ic=MN(1),Rm=MN(-1);function I7(e){return"clientX"in e&&"clientY"in e}function W0(e){if(!e)return!1;const{KeyboardEvent:t}=Wr(e.target);return t&&e instanceof t}function H7(e){if(!e)return!1;const{TouchEvent:t}=Wr(e.target);return t&&e instanceof t}function Pb(e){if(H7(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 I7(e)?{x:e.clientX,y:e.clientY}:null}const cd=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[cd.Translate.toString(e),cd.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),e2="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function F7(e){return e.matches(e2)?e:e.querySelector(e2)}const U7={display:"none"};function $7(e){let{id:t,value:n}=e;return ye.createElement("div",{id:t,style:U7},n)}function W7(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ye.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function V7(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const NN=_.createContext(null);function q7(e){const t=_.useContext(NN);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function K7(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:s,event:o}=r;e.forEach(l=>{var u;return(u=l[s])==null?void 0:u.call(l,o)})},[e]),t]}const G7={draggable:`
|
|
470
|
+
To pick up a draggable item, press the space bar.
|
|
471
|
+
While dragging, use the arrow keys to move the item.
|
|
472
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
473
|
+
`},Y7={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 X7(e){let{announcements:t=Y7,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=G7}=e;const{announce:o,announcement:l}=V7(),u=jd("DndLiveRegion"),[h,d]=_.useState(!1);if(_.useEffect(()=>{d(!0)},[]),q7(_.useMemo(()=>({onDragStart(p){let{active:v}=p;o(t.onDragStart({active:v}))},onDragMove(p){let{active:v,over:y}=p;t.onDragMove&&o(t.onDragMove({active:v,over:y}))},onDragOver(p){let{active:v,over:y}=p;o(t.onDragOver({active:v,over:y}))},onDragEnd(p){let{active:v,over:y}=p;o(t.onDragEnd({active:v,over:y}))},onDragCancel(p){let{active:v,over:y}=p;o(t.onDragCancel({active:v,over:y}))}}),[o,t])),!h)return null;const g=ye.createElement(ye.Fragment,null,ye.createElement($7,{id:r,value:s.draggable}),ye.createElement(W7,{id:u,announcement:l}));return n?Bi.createPortal(g,n):g}var Vn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Vn||(Vn={}));function Tm(){}function x_(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Z7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const qi=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 J7(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function eH(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function tH(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function t2(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 nH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=t2(t,t.left,t.top),o=[];for(const l of r){const{id:u}=l,h=n.get(u);if(h){const d=Q7(t2(h),s);o.push({id:u,data:{droppableContainer:l,value:d}})}}return o.sort(J7)};function rH(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),o=Math.min(t.top+t.height,e.top+e.height),l=s-r,u=o-n;if(r<s&&n<o){const h=t.width*t.height,d=e.width*e.height,g=l*u,p=g/(h+d-g);return Number(p.toFixed(4))}return 0}const iH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const o of r){const{id:l}=o,u=n.get(l);if(u){const h=rH(u,t);h>0&&s.push({id:l,data:{droppableContainer:o,value:h}})}}return s.sort(eH)};function sH(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function AN(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:qi}function oH(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];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 aH=oH(1);function lH(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 cH(e,t,n){const r=lH(t);if(!r)return e;const{scaleX:s,scaleY:o,x:l,y:u}=r,h=e.left-l-(1-s)*parseFloat(n),d=e.top-u-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),g=s?e.width/s:e.width,p=o?e.height/o:e.height;return{width:g,height:p,top:d,right:h+g,bottom:d+p,left:h}}const uH={ignoreTransform:!1};function Cc(e,t){t===void 0&&(t=uH);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=Wr(e).getComputedStyle(e);d&&(n=cH(n,d,g))}const{top:r,left:s,width:o,height:l,bottom:u,right:h}=n;return{top:r,left:s,width:o,height:l,bottom:u,right:h}}function n2(e){return Cc(e,{ignoreTransform:!0})}function dH(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function hH(e,t){return t===void 0&&(t=Wr(e).getComputedStyle(e)),t.position==="fixed"}function fH(e,t){t===void 0&&(t=Wr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=t[s];return typeof o=="string"?n.test(o):!1})}function V0(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(U0(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Ad(s)||TN(s)||n.includes(s))return n;const o=Wr(e).getComputedStyle(s);return s!==e&&fH(s,o)&&n.push(s),hH(s,o)?n:r(s.parentNode)}return e?r(e):n}function DN(e){const[t]=V0(e,1);return t??null}function w_(e){return!Sp||!e?null:wc(e)?e:F0(e)?U0(e)||e===Sc(e).scrollingElement?window:Ad(e)?e:null:null}function jN(e){return wc(e)?e.scrollX:e.scrollLeft}function ON(e){return wc(e)?e.scrollY:e.scrollTop}function Bb(e){return{x:jN(e),y:ON(e)}}var Xn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xn||(Xn={}));function LN(e){return!Sp||!e?!1:e===document.scrollingElement}function zN(e){const t={x:0,y:0},n=LN(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,o=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,u=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:l,isRight:u,maxScroll:r,minScroll:t}}const mH={x:.2,y:.2};function pH(e,t,n,r,s){let{top:o,left:l,right:u,bottom:h}=n;r===void 0&&(r=10),s===void 0&&(s=mH);const{isTop:d,isBottom:g,isLeft:p,isRight:v}=zN(e),y={x:0,y:0},w={x:0,y:0},S={height:t.height*s.y,width:t.width*s.x};return!d&&o<=t.top+S.height?(y.y=Xn.Backward,w.y=r*Math.abs((t.top+S.height-o)/S.height)):!g&&h>=t.bottom-S.height&&(y.y=Xn.Forward,w.y=r*Math.abs((t.bottom-S.height-h)/S.height)),!v&&u>=t.right-S.width?(y.x=Xn.Forward,w.x=r*Math.abs((t.right-S.width-u)/S.width)):!p&&l<=t.left+S.width&&(y.x=Xn.Backward,w.x=r*Math.abs((t.left+S.width-l)/S.width)),{direction:y,speed:w}}function gH(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:l}=window;return{top:0,left:0,right:o,bottom:l,width:o,height:l}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function PN(e){return e.reduce((t,n)=>ic(t,Bb(n)),qi)}function vH(e){return e.reduce((t,n)=>t+jN(n),0)}function _H(e){return e.reduce((t,n)=>t+ON(n),0)}function bH(e,t){if(t===void 0&&(t=Cc),!e)return;const{top:n,left:r,bottom:s,right:o}=t(e);DN(e)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const yH=[["x",["left","right"],vH],["y",["top","bottom"],_H]];class q0{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=V0(n),s=PN(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,l,u]of yH)for(const h of l)Object.defineProperty(this,h,{get:()=>{const d=u(r),g=s[o]-d;return this.rect[h]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Gu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function xH(e){const{EventTarget:t}=Wr(e);return e instanceof t?e:Sc(e)}function S_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Ci;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ci||(Ci={}));function r2(e){e.preventDefault()}function wH(e){e.stopPropagation()}var Ft;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ft||(Ft={}));const BN={start:[Ft.Space,Ft.Enter],cancel:[Ft.Esc],end:[Ft.Space,Ft.Enter,Ft.Tab]},SH=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ft.Right:return{...n,x:n.x+25};case Ft.Left:return{...n,x:n.x-25};case Ft.Down:return{...n,y:n.y+25};case Ft.Up:return{...n,y:n.y-25}}};class K0{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Gu(Sc(n)),this.windowListeners=new Gu(Wr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ci.Resize,this.handleCancel),this.windowListeners.add(Ci.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ci.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&bH(r),n(qi)}handleKeyDown(t){if(W0(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=BN,coordinateGetter:l=SH,scrollBehavior:u="smooth"}=s,{code:h}=t;if(o.end.includes(h)){this.handleEnd(t);return}if(o.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:qi;this.referenceCoordinates||(this.referenceCoordinates=g);const p=l(t,{active:n,context:r.current,currentCoordinates:g});if(p){const v=Rm(p,g),y={x:0,y:0},{scrollableAncestors:w}=r.current;for(const S of w){const C=t.code,{isTop:k,isRight:R,isLeft:E,isBottom:M,maxScroll:j,minScroll:D}=zN(S),L=gH(S),$={x:Math.min(C===Ft.Right?L.right-L.width/2:L.right,Math.max(C===Ft.Right?L.left:L.left+L.width/2,p.x)),y:Math.min(C===Ft.Down?L.bottom-L.height/2:L.bottom,Math.max(C===Ft.Down?L.top:L.top+L.height/2,p.y))},Y=C===Ft.Right&&!R||C===Ft.Left&&!E,P=C===Ft.Down&&!M||C===Ft.Up&&!k;if(Y&&$.x!==p.x){const V=S.scrollLeft+v.x,I=C===Ft.Right&&V<=j.x||C===Ft.Left&&V>=D.x;if(I&&!v.y){S.scrollTo({left:V,behavior:u});return}I?y.x=S.scrollLeft-V:y.x=C===Ft.Right?S.scrollLeft-j.x:S.scrollLeft-D.x,y.x&&S.scrollBy({left:-y.x,behavior:u});break}else if(P&&$.y!==p.y){const V=S.scrollTop+v.y,I=C===Ft.Down&&V<=j.y||C===Ft.Up&&V>=D.y;if(I&&!v.x){S.scrollTo({top:V,behavior:u});return}I?y.y=S.scrollTop-V:y.y=C===Ft.Down?S.scrollTop-j.y:S.scrollTop-D.y,y.y&&S.scrollBy({top:-y.y,behavior:u});break}}this.handleMove(t,ic(Rm(p,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}K0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=BN,onActivation:s}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const u=o.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function i2(e){return!!(e&&"distance"in e)}function s2(e){return!!(e&&"delay"in e)}class G0{constructor(t,n,r){var s;r===void 0&&(r=xH(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:l}=o;this.props=t,this.events=n,this.document=Sc(l),this.documentListeners=new Gu(this.document),this.listeners=new Gu(r),this.windowListeners=new Gu(Wr(l)),this.initialCoordinates=(s=Pb(o))!=null?s:qi,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ci.Resize,this.handleCancel),this.windowListeners.add(Ci.DragStart,r2),this.windowListeners.add(Ci.VisibilityChange,this.handleCancel),this.windowListeners.add(Ci.ContextMenu,r2),this.documentListeners.add(Ci.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(s2(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(i2(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ci.Click,wH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ci.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:l,options:{activationConstraint:u}}=o;if(!s)return;const h=(n=Pb(t))!=null?n:qi,d=Rm(s,h);if(!r&&u){if(i2(u)){if(u.tolerance!=null&&S_(d,u.tolerance))return this.handleCancel();if(S_(d,u.distance))return this.handleStart()}if(s2(u)&&S_(d,u.tolerance))return this.handleCancel();this.handlePending(u,d);return}t.cancelable&&t.preventDefault(),l(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ft.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const CH={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Y0 extends G0{constructor(t){const{event:n}=t,r=Sc(n.target);super(t,CH,r)}}Y0.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 kH={move:{name:"mousemove"},end:{name:"mouseup"}};var Ib;(function(e){e[e.RightClick=2]="RightClick"})(Ib||(Ib={}));class EH extends G0{constructor(t){super(t,kH,Sc(t.event.target))}}EH.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ib.RightClick?!1:(r==null||r({event:n}),!0)}}];const C_={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class IN extends G0{constructor(t){super(t,C_)}static setup(){return window.addEventListener(C_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(C_.move.name,t)};function t(){}}}IN.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Yu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Yu||(Yu={}));var Mm;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Mm||(Mm={}));function RH(e){let{acceleration:t,activator:n=Yu.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:l=5,order:u=Mm.TreeOrder,pointerCoordinates:h,scrollableAncestors:d,scrollableAncestorRects:g,delta:p,threshold:v}=e;const y=MH({delta:p,disabled:!o}),[w,S]=B7(),C=_.useRef({x:0,y:0}),k=_.useRef({x:0,y:0}),R=_.useMemo(()=>{switch(n){case Yu.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Yu.DraggableRect:return s}},[n,s,h]),E=_.useRef(null),M=_.useCallback(()=>{const D=E.current;if(!D)return;const L=C.current.x*k.current.x,$=C.current.y*k.current.y;D.scrollBy(L,$)},[]),j=_.useMemo(()=>u===Mm.TreeOrder?[...d].reverse():d,[u,d]);_.useEffect(()=>{if(!o||!d.length||!R){S();return}for(const D of j){if((r==null?void 0:r(D))===!1)continue;const L=d.indexOf(D),$=g[L];if(!$)continue;const{direction:Y,speed:P}=pH(D,$,R,t,v);for(const V of["x","y"])y[V][Y[V]]||(P[V]=0,Y[V]=0);if(P.x>0||P.y>0){S(),E.current=D,w(M,l),C.current=P,k.current=Y;return}}C.current={x:0,y:0},k.current={x:0,y:0},S()},[t,M,r,S,o,l,JSON.stringify(R),JSON.stringify(y),w,d,j,g,JSON.stringify(v)])}const TH={x:{[Xn.Backward]:!1,[Xn.Forward]:!1},y:{[Xn.Backward]:!1,[Xn.Forward]:!1}};function MH(e){let{delta:t,disabled:n}=e;const r=zb(t);return Dd(s=>{if(n||!r||!s)return TH;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xn.Backward]:s.x[Xn.Backward]||o.x===-1,[Xn.Forward]:s.x[Xn.Forward]||o.x===1},y:{[Xn.Backward]:s.y[Xn.Backward]||o.y===-1,[Xn.Forward]:s.y[Xn.Forward]||o.y===1}}},[n,t,r])}function NH(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Dd(s=>{var o;return t==null?null:(o=r??s)!=null?o:null},[r,t])}function AH(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...o]},[]),[e,t])}var ud;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ud||(ud={}));var Hb;(function(e){e.Optimized="optimized"})(Hb||(Hb={}));const o2=new Map;function DH(e,t){let{dragging:n,dependencies:r,config:s}=t;const[o,l]=_.useState(null),{frequency:u,measure:h,strategy:d}=s,g=_.useRef(e),p=C(),v=ld(p),y=_.useCallback(function(k){k===void 0&&(k=[]),!v.current&&l(R=>R===null?k:R.concat(k.filter(E=>!R.includes(E))))},[v]),w=_.useRef(null),S=Dd(k=>{if(p&&!n)return o2;if(!k||k===o2||g.current!==e||o!=null){const R=new Map;for(let E of e){if(!E)continue;if(o&&o.length>0&&!o.includes(E.id)&&E.rect.current){R.set(E.id,E.rect.current);continue}const M=E.node.current,j=M?new q0(h(M),M):null;E.rect.current=j,j&&R.set(E.id,j)}return R}return k},[e,o,n,p,h]);return _.useEffect(()=>{g.current=e},[e]),_.useEffect(()=>{p||y()},[n,p]),_.useEffect(()=>{o&&o.length>0&&l(null)},[JSON.stringify(o)]),_.useEffect(()=>{p||typeof u!="number"||w.current!==null||(w.current=setTimeout(()=>{y(),w.current=null},u))},[u,p,y,...r]),{droppableRects:S,measureDroppableContainers:y,measuringScheduled:o!=null};function C(){switch(d){case ud.Always:return!1;case ud.BeforeDragging:return n;default:return!n}}}function HN(e,t){return Dd(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function jH(e,t){return HN(e,t)}function OH(e){let{callback:t,disabled:n}=e;const r=$0(t),s=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return _.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Cp(e){let{callback:t,disabled:n}=e;const r=$0(t),s=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return _.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function LH(e){return new q0(Cc(e),e)}function a2(e,t,n){t===void 0&&(t=LH);const[r,s]=_.useState(null);function o(){s(h=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=h??n)!=null?d:null}const g=t(e);return JSON.stringify(h)===JSON.stringify(g)?h:g})}const l=OH({callback(h){if(e)for(const d of h){const{type:g,target:p}=d;if(g==="childList"&&p instanceof HTMLElement&&p.contains(e)){o();break}}}}),u=Cp({callback:o});return _s(()=>{o(),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 zH(e){const t=HN(e);return AN(e,t)}const l2=[];function PH(e){const t=_.useRef(e),n=Dd(r=>e?r&&r!==l2&&e&&t.current&&e.parentNode===t.current.parentNode?r:V0(e):l2,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function BH(e){const[t,n]=_.useState(null),r=_.useRef(e),s=_.useCallback(o=>{const l=w_(o.target);l&&n(u=>u?(u.set(l,Bb(l)),new Map(u)):null)},[]);return _.useEffect(()=>{const o=r.current;if(e!==o){l(o);const u=e.map(h=>{const d=w_(h);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,Bb(d)]):null}).filter(h=>h!=null);n(u.length?new Map(u):null),r.current=e}return()=>{l(e),l(o)};function l(u){u.forEach(h=>{const d=w_(h);d==null||d.removeEventListener("scroll",s)})}},[s,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,l)=>ic(o,l),qi):PN(e):qi,[e,t])}function c2(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==qi;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Rm(e,n.current):qi}function IH(e){_.useEffect(()=>{if(!Sp)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 HH(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=l=>{o(l,t)},n},{}),[e,t])}function FN(e){return _.useMemo(()=>e?dH(e):null,[e])}const u2=[];function FH(e,t){t===void 0&&(t=Cc);const[n]=e,r=FN(n?Wr(n):null),[s,o]=_.useState(u2);function l(){o(()=>e.length?e.map(h=>LN(h)?r:new q0(t(h),h)):u2)}const u=Cp({callback:l});return _s(()=>{u==null||u.disconnect(),l(),e.forEach(h=>u==null?void 0:u.observe(h))},[e]),s}function UH(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ad(t)?t:e}function $H(e){let{measure:t}=e;const[n,r]=_.useState(null),s=_.useCallback(d=>{for(const{target:g}of d)if(Ad(g)){r(p=>{const v=t(g);return p?{...p,width:v.width,height:v.height}:v});break}},[t]),o=Cp({callback:s}),l=_.useCallback(d=>{const g=UH(d);o==null||o.disconnect(),g&&(o==null||o.observe(g)),r(g?t(g):null)},[t,o]),[u,h]=Em(l);return _.useMemo(()=>({nodeRef:u,rect:n,setRef:h}),[n,u,h])}const WH=[{sensor:Y0,options:{}},{sensor:K0,options:{}}],VH={current:{}},Qf={draggable:{measure:n2},droppable:{measure:n2,strategy:ud.WhileDragging,frequency:Hb.Optimized},dragOverlay:{measure:Cc}};class Xu extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const qH={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Tm},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Qf,measureDroppableContainers:Tm,windowRect:null,measuringScheduled:!1},KH={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Tm,draggableNodes:new Map,over:null,measureDroppableContainers:Tm},kp=_.createContext(KH),UN=_.createContext(qH);function GH(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xu}}}function YH(e,t){switch(t.type){case Vn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Vn.DragEnd:case Vn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vn.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new Xu(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case Vn.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new Xu(e.droppable.containers);return l.set(n,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case Vn.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new Xu(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function XH(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=_.useContext(kp),o=zb(r),l=zb(n==null?void 0:n.id);return _.useEffect(()=>{if(!t&&!r&&o&&l!=null){if(!W0(o)||document.activeElement===o.target)return;const u=s.get(l);if(!u)return;const{activatorNode:h,node:d}=u;if(!h.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[h.current,d.current]){if(!g)continue;const p=F7(g);if(p){p.focus();break}}})}},[r,t,s,l,o]),null}function ZH(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),n):n}function QH(e){return _.useMemo(()=>({draggable:{...Qf.draggable,...e==null?void 0:e.draggable},droppable:{...Qf.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Qf.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 JH(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const o=_.useRef(!1),{x:l,y:u}=typeof s=="boolean"?{x:s,y:s}:s;_s(()=>{if(!l&&!u||!t){o.current=!1;return}if(o.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const g=n(d),p=AN(g,r);if(l||(p.x=0),u||(p.y=0),o.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){const v=DN(d);v&&v.scrollBy({top:p.y,left:p.x})}},[t,l,u,r,n])}const $N=_.createContext({...qi,scaleX:1,scaleY:1});var Wo;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Wo||(Wo={}));const eF=_.memo(function(t){var n,r,s,o;let{id:l,accessibility:u,autoScroll:h=!0,children:d,sensors:g=WH,collisionDetection:p=iH,measuring:v,modifiers:y,...w}=t;const S=_.useReducer(YH,void 0,GH),[C,k]=S,[R,E]=K7(),[M,j]=_.useState(Wo.Uninitialized),D=M===Wo.Initialized,{draggable:{active:L,nodes:$,translate:Y},droppable:{containers:P}}=C,V=L!=null?$.get(L):null,I=_.useRef({initial:null,translated:null}),W=_.useMemo(()=>{var jt;return L!=null?{id:L,data:(jt=V==null?void 0:V.data)!=null?jt:VH,rect:I}:null},[L,V]),K=_.useRef(null),[q,O]=_.useState(null),[H,U]=_.useState(null),F=ld(w,Object.values(w)),N=jd("DndDescribedBy",l),B=_.useMemo(()=>P.getEnabled(),[P]),X=QH(v),{droppableRects:A,measureDroppableContainers:ne,measuringScheduled:ae}=DH(B,{dragging:D,dependencies:[Y.x,Y.y],config:X.droppable}),Z=NH($,L),te=_.useMemo(()=>H?Pb(H):null,[H]),le=Kn(),me=jH(Z,X.draggable.measure);JH({activeNode:L!=null?$.get(L):null,config:le.layoutShiftCompensation,initialRect:me,measure:X.draggable.measure});const xe=a2(Z,X.draggable.measure,me),Ae=a2(Z?Z.parentElement:null),Re=_.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:A,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=P.getNodeFor((n=Re.current.over)==null?void 0:n.id),Ye=$H({measure:X.dragOverlay.measure}),xt=(r=Ye.nodeRef.current)!=null?r:Z,ft=D?(s=Ye.rect)!=null?s:xe:null,he=!!(Ye.nodeRef.current&&Ye.rect),Pe=zH(he?null:xe),Ne=FN(xt?Wr(xt):null),tt=PH(D?je??Z:null),wt=FH(tt),$e=ZH(y,{transform:{x:Y.x-Pe.x,y:Y.y-Pe.y,scaleX:1,scaleY:1},activatorEvent:H,active:W,activeNodeRect:xe,containerNodeRect:Ae,draggingNodeRect:ft,over:Re.current.over,overlayNodeRect:Ye.rect,scrollableAncestors:tt,scrollableAncestorRects:wt,windowRect:Ne}),pt=te?ic(te,Y):null,Se=BH(tt),De=c2(Se),ce=c2(Se,[xe]),be=ic($e,De),Oe=ft?aH(ft,$e):null,Ve=W&&Oe?p({active:W,collisionRect:Oe,droppableRects:A,droppableContainers:B,pointerCoordinates:pt}):null,we=tH(Ve,"id"),[He,ot]=_.useState(null),rt=he?$e:ic($e,ce),Le=sH(rt,(o=He==null?void 0:He.rect)!=null?o:null,xe),St=_.useRef(null),at=_.useCallback((jt,zt)=>{let{sensor:Fe,options:ct}=zt;if(K.current==null)return;const st=$.get(K.current);if(!st)return;const mt=jt.nativeEvent,an=new Fe({active:K.current,activeNode:st,event:mt,options:ct,context:Re,onAbort(Te){if(!$.get(Te))return;const{onDragAbort:Qe}=F.current,vt={id:Te};Qe==null||Qe(vt),R({type:"onDragAbort",event:vt})},onPending(Te,gt,Qe,vt){if(!$.get(Te))return;const{onDragPending:Ot}=F.current,sn={id:Te,constraint:gt,initialCoordinates:Qe,offset:vt};Ot==null||Ot(sn),R({type:"onDragPending",event:sn})},onStart(Te){const gt=K.current;if(gt==null)return;const Qe=$.get(gt);if(!Qe)return;const{onDragStart:vt}=F.current,qt={activatorEvent:mt,active:{id:gt,data:Qe.data,rect:I}};Bi.unstable_batchedUpdates(()=>{vt==null||vt(qt),j(Wo.Initializing),k({type:Vn.DragStart,initialCoordinates:Te,active:gt}),R({type:"onDragStart",event:qt}),O(St.current),U(mt)})},onMove(Te){k({type:Vn.DragMove,coordinates:Te})},onEnd:Ce(Vn.DragEnd),onCancel:Ce(Vn.DragCancel)});St.current=an;function Ce(Te){return async function(){const{active:Qe,collisions:vt,over:qt,scrollAdjustedTranslate:Ot}=Re.current;let sn=null;if(Qe&&Ot){const{cancelDrop:G}=F.current;sn={activatorEvent:mt,active:Qe,collisions:vt,delta:Ot,over:qt},Te===Vn.DragEnd&&typeof G=="function"&&await Promise.resolve(G(sn))&&(Te=Vn.DragCancel)}K.current=null,Bi.unstable_batchedUpdates(()=>{k({type:Te}),j(Wo.Uninitialized),ot(null),O(null),U(null),St.current=null;const G=Te===Vn.DragEnd?"onDragEnd":"onDragCancel";if(sn){const Xe=F.current[G];Xe==null||Xe(sn),R({type:G,event:sn})}})}}},[$]),vn=_.useCallback((jt,zt)=>(Fe,ct)=>{const st=Fe.nativeEvent,mt=$.get(ct);if(K.current!==null||!mt||st.dndKit||st.defaultPrevented)return;const an={active:mt};jt(Fe,zt.options,an)===!0&&(st.dndKit={capturedBy:zt.sensor},K.current=ct,at(Fe,zt))},[$,at]),tn=AH(g,vn);IH(g),_s(()=>{xe&&M===Wo.Initializing&&j(Wo.Initialized)},[xe,M]),_.useEffect(()=>{const{onDragMove:jt}=F.current,{active:zt,activatorEvent:Fe,collisions:ct,over:st}=Re.current;if(!zt||!Fe)return;const mt={active:zt,activatorEvent:Fe,collisions:ct,delta:{x:be.x,y:be.y},over:st};Bi.unstable_batchedUpdates(()=>{jt==null||jt(mt),R({type:"onDragMove",event:mt})})},[be.x,be.y]),_.useEffect(()=>{const{active:jt,activatorEvent:zt,collisions:Fe,droppableContainers:ct,scrollAdjustedTranslate:st}=Re.current;if(!jt||K.current==null||!zt||!st)return;const{onDragOver:mt}=F.current,an=ct.get(we),Ce=an&&an.rect.current?{id:an.id,rect:an.rect.current,data:an.data,disabled:an.disabled}:null,Te={active:jt,activatorEvent:zt,collisions:Fe,delta:{x:st.x,y:st.y},over:Ce};Bi.unstable_batchedUpdates(()=>{ot(Ce),mt==null||mt(Te),R({type:"onDragOver",event:Te})})},[we]),_s(()=>{Re.current={activatorEvent:H,active:W,activeNode:Z,collisionRect:Oe,collisions:Ve,droppableRects:A,draggableNodes:$,draggingNode:xt,draggingNodeRect:ft,droppableContainers:P,over:He,scrollableAncestors:tt,scrollAdjustedTranslate:be},I.current={initial:ft,translated:Oe}},[W,Z,Ve,Oe,$,xt,ft,A,P,He,tt,be]),RH({...le,delta:Y,draggingRect:Oe,pointerCoordinates:pt,scrollableAncestors:tt,scrollableAncestorRects:wt});const Nn=_.useMemo(()=>({active:W,activeNode:Z,activeNodeRect:xe,activatorEvent:H,collisions:Ve,containerNodeRect:Ae,dragOverlay:Ye,draggableNodes:$,droppableContainers:P,droppableRects:A,over:He,measureDroppableContainers:ne,scrollableAncestors:tt,scrollableAncestorRects:wt,measuringConfiguration:X,measuringScheduled:ae,windowRect:Ne}),[W,Z,xe,H,Ve,Ae,Ye,$,P,A,He,ne,tt,wt,X,ae,Ne]),xr=_.useMemo(()=>({activatorEvent:H,activators:tn,active:W,activeNodeRect:xe,ariaDescribedById:{draggable:N},dispatch:k,draggableNodes:$,over:He,measureDroppableContainers:ne}),[H,tn,W,xe,k,N,$,He,ne]);return ye.createElement(NN.Provider,{value:E},ye.createElement(kp.Provider,{value:xr},ye.createElement(UN.Provider,{value:Nn},ye.createElement($N.Provider,{value:Le},d)),ye.createElement(XH,{disabled:(u==null?void 0:u.restoreFocus)===!1})),ye.createElement(X7,{...u,hiddenTextDescribedById:N}));function Kn(){const jt=(q==null?void 0:q.autoScrollEnabled)===!1,zt=typeof h=="object"?h.enabled===!1:h===!1,Fe=D&&!jt&&!zt;return typeof h=="object"?{...h,enabled:Fe}:{enabled:Fe}}}),tF=_.createContext(null),d2="button",nF="Draggable";function rF(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const o=jd(nF),{activators:l,activatorEvent:u,active:h,activeNodeRect:d,ariaDescribedById:g,draggableNodes:p,over:v}=_.useContext(kp),{role:y=d2,roleDescription:w="draggable",tabIndex:S=0}=s??{},C=(h==null?void 0:h.id)===t,k=_.useContext(C?$N:tF),[R,E]=Em(),[M,j]=Em(),D=HH(l,t),L=ld(n);_s(()=>(p.set(t,{id:t,key:o,node:R,activatorNode:M,data:L}),()=>{const Y=p.get(t);Y&&Y.key===o&&p.delete(t)}),[p,t]);const $=_.useMemo(()=>({role:y,tabIndex:S,"aria-disabled":r,"aria-pressed":C&&y===d2?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[r,y,S,C,w,g.draggable]);return{active:h,activatorEvent:u,activeNodeRect:d,attributes:$,isDragging:C,listeners:r?void 0:D,node:R,over:v,setNodeRef:E,setActivatorNodeRef:j,transform:k}}function iF(){return _.useContext(UN)}const sF="Droppable",oF={timeout:25};function aF(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const o=jd(sF),{active:l,dispatch:u,over:h,measureDroppableContainers:d}=_.useContext(kp),g=_.useRef({disabled:n}),p=_.useRef(!1),v=_.useRef(null),y=_.useRef(null),{disabled:w,updateMeasurementsFor:S,timeout:C}={...oF,...s},k=ld(S??r),R=_.useCallback(()=>{if(!p.current){p.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(k.current)?k.current:[k.current]),y.current=null},C)},[C]),E=Cp({callback:R,disabled:w||!l}),M=_.useCallback(($,Y)=>{E&&(Y&&(E.unobserve(Y),p.current=!1),$&&E.observe($))},[E]),[j,D]=Em(M),L=ld(t);return _.useEffect(()=>{!E||!j.current||(E.disconnect(),p.current=!1,E.observe(j.current))},[j,E]),_.useEffect(()=>(u({type:Vn.RegisterDroppable,element:{id:r,key:o,disabled:n,node:j,rect:v,data:L}}),()=>u({type:Vn.UnregisterDroppable,key:o,id:r})),[r]),_.useEffect(()=>{n!==g.current.disabled&&(u({type:Vn.SetDroppableDisabled,id:r,key:o,disabled:n}),g.current.disabled=n)},[r,o,n,u]),{active:l,rect:v,isOver:(h==null?void 0:h.id)===r,node:j,over:h,setNodeRef:D}}function Ep(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function lF(e,t){return e.reduce((n,r,s)=>{const o=t.get(r);return o&&(n[s]=o),n},Array(e.length))}function Cf(e){return e!==null&&e>=0}function cF(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 uF(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const WN=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const o=Ep(t,r,n),l=t[s],u=o[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}},kf={scaleX:1,scaleY:1},dF=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:l}=e;const u=(t=o[n])!=null?t:r;if(!u)return null;if(s===n){const d=o[l];return d?{x:0,y:n<l?d.top+d.height-(u.top+u.height):d.top-u.top,...kf}:null}const h=hF(o,s,n);return s>n&&s<=l?{x:0,y:-u.height-h,...kf}:s<n&&s>=l?{x:0,y:u.height+h,...kf}:{x:0,y:0,...kf}};function hF(e,t,n){const r=e[t],s=e[t-1],o=e[t+1];return r?n<t?s?r.top-(s.top+s.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const VN="Sortable",qN=ye.createContext({activeIndex:-1,containerId:VN,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:WN,disabled:{draggable:!1,droppable:!1}});function fF(e){let{children:t,id:n,items:r,strategy:s=WN,disabled:o=!1}=e;const{active:l,dragOverlay:u,droppableRects:h,over:d,measureDroppableContainers:g}=iF(),p=jd(VN,n),v=u.rect!==null,y=_.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),w=l!=null,S=l?y.indexOf(l.id):-1,C=d?y.indexOf(d.id):-1,k=_.useRef(y),R=!cF(y,k.current),E=C!==-1&&S===-1||R,M=uF(o);_s(()=>{R&&w&&g(y)},[R,y,w,g]),_.useEffect(()=>{k.current=y},[y]);const j=_.useMemo(()=>({activeIndex:S,containerId:p,disabled:M,disableTransforms:E,items:y,overIndex:C,useDragOverlay:v,sortedRects:lF(y,h),strategy:s}),[S,p,M.draggable,M.droppable,E,y,C,h,v,s]);return ye.createElement(qN.Provider,{value:j},t)}const mF=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return Ep(n,r,s).indexOf(t)},pF=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:o,newIndex:l,previousItems:u,previousContainerId:h,transition:d}=e;return!d||!r||u!==o&&s===l?!1:n?!0:l!==s&&t===h},gF={duration:200,easing:"ease"},KN="transform",vF=cd.Transition.toString({property:KN,duration:0,easing:"linear"}),_F={roleDescription:"sortable"};function bF(e){let{disabled:t,index:n,node:r,rect:s}=e;const[o,l]=_.useState(null),u=_.useRef(n);return _s(()=>{if(!t&&n!==u.current&&r.current){const h=s.current;if(h){const d=Cc(r.current,{ignoreTransform:!0}),g={x:h.left-d.left,y:h.top-d.top,scaleX:h.width/d.width,scaleY:h.height/d.height};(g.x||g.y)&&l(g)}}n!==u.current&&(u.current=n)},[t,n,r,s]),_.useEffect(()=>{o&&l(null)},[o]),o}function yF(e){let{animateLayoutChanges:t=pF,attributes:n,disabled:r,data:s,getNewIndex:o=mF,id:l,strategy:u,resizeObserverConfig:h,transition:d=gF}=e;const{items:g,containerId:p,activeIndex:v,disabled:y,disableTransforms:w,sortedRects:S,overIndex:C,useDragOverlay:k,strategy:R}=_.useContext(qN),E=xF(r,y),M=g.indexOf(l),j=_.useMemo(()=>({sortable:{containerId:p,index:M,items:g},...s}),[p,s,M,g]),D=_.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:L,node:$,isOver:Y,setNodeRef:P}=aF({id:l,data:j,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...h}}),{active:V,activatorEvent:I,activeNodeRect:W,attributes:K,setNodeRef:q,listeners:O,isDragging:H,over:U,setActivatorNodeRef:F,transform:N}=rF({id:l,data:j,attributes:{..._F,...n},disabled:E.draggable}),B=P7(P,q),X=!!V,A=X&&!w&&Cf(v)&&Cf(C),ne=!k&&H,ae=ne&&A?N:null,te=A?ae??(u??R)({rects:S,activeNodeRect:W,activeIndex:v,overIndex:C,index:M}):null,le=Cf(v)&&Cf(C)?o({id:l,items:g,activeIndex:v,overIndex:C}):M,me=V==null?void 0:V.id,xe=_.useRef({activeId:me,items:g,newIndex:le,containerId:p}),Ae=g!==xe.current.items,Re=t({active:V,containerId:p,isDragging:H,isSorting:X,id:l,index:M,items:g,newIndex:xe.current.newIndex,previousItems:xe.current.items,previousContainerId:xe.current.containerId,transition:d,wasDragging:xe.current.activeId!=null}),je=bF({disabled:!Re,index:M,node:$,rect:L});return _.useEffect(()=>{X&&xe.current.newIndex!==le&&(xe.current.newIndex=le),p!==xe.current.containerId&&(xe.current.containerId=p),g!==xe.current.items&&(xe.current.items=g)},[X,le,p,g]),_.useEffect(()=>{if(me===xe.current.activeId)return;if(me!=null&&xe.current.activeId==null){xe.current.activeId=me;return}const xt=setTimeout(()=>{xe.current.activeId=me},50);return()=>clearTimeout(xt)},[me]),{active:V,activeIndex:v,attributes:K,data:j,rect:L,index:M,newIndex:le,items:g,isOver:Y,isSorting:X,isDragging:H,listeners:O,node:$,overIndex:C,over:U,setNodeRef:B,setActivatorNodeRef:F,setDroppableNodeRef:P,setDraggableNodeRef:q,transform:je??te,transition:Ye()};function Ye(){if(je||Ae&&xe.current.newIndex===M)return vF;if(!(ne&&!W0(I)||!d)&&(X||Re))return cd.Transition.toString({...d,property:KN})}}function xF(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}Ft.Down,Ft.Right,Ft.Up,Ft.Left;const h2={idea:"border-amber-500/30 bg-amber-500/15 text-amber-700 dark:border-amber-500/40 dark:bg-amber-500/12 dark:text-amber-200",todo:"border-sky-500/30 bg-sky-500/15 text-sky-700 dark:border-sky-500/40 dark:bg-sky-500/12 dark:text-sky-200",progress:"border-indigo-500/30 bg-indigo-500/15 text-indigo-700 dark:border-indigo-500/40 dark:bg-indigo-500/12 dark:text-indigo-200",testing:"border-cyan-500/30 bg-cyan-500/15 text-cyan-700 dark:border-cyan-500/40 dark:bg-cyan-500/12 dark:text-cyan-200",done:"border-emerald-500/30 bg-emerald-500/15 text-emerald-700 dark:border-emerald-500/40 dark:bg-emerald-500/12 dark:text-emerald-200"};function f2(e,[t,n]){return Math.min(n,Math.max(t,e))}function X0(e){const t=e+"CollectionProvider",[n,r]=to(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=S=>{const{scope:C,children:k}=S,R=ye.useRef(null),E=ye.useRef(new Map).current;return f.jsx(s,{scope:C,itemMap:E,collectionRef:R,children:k})};l.displayName=t;const u=e+"CollectionSlot",h=Fa(u),d=ye.forwardRef((S,C)=>{const{scope:k,children:R}=S,E=o(u,k),M=Ut(C,E.collectionRef);return f.jsx(h,{ref:M,children:R})});d.displayName=u;const g=e+"CollectionItemSlot",p="data-radix-collection-item",v=Fa(g),y=ye.forwardRef((S,C)=>{const{scope:k,children:R,...E}=S,M=ye.useRef(null),j=Ut(C,M),D=o(g,k);return ye.useEffect(()=>(D.itemMap.set(M,{ref:M,...E}),()=>void D.itemMap.delete(M))),f.jsx(v,{[p]:"",ref:j,children:R})});y.displayName=g;function w(S){const C=o(e+"CollectionConsumer",S);return ye.useCallback(()=>{const R=C.collectionRef.current;if(!R)return[];const E=Array.from(R.querySelectorAll(`[${p}]`));return Array.from(C.itemMap.values()).sort((D,L)=>E.indexOf(D.ref.current)-E.indexOf(L.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:l,Slot:d,ItemSlot:y},w,r]}var wF=_.createContext(void 0);function Z0(e){const t=_.useContext(wF);return e||t||"ltr"}function SF(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var CF=[" ","Enter","ArrowUp","ArrowDown"],kF=[" ","Enter"],Wa="Select",[Rp,Tp,EF]=X0(Wa),[kc]=to(Wa,[EF,ea]),Mp=ea(),[RF,na]=kc(Wa),[TF,MF]=kc(Wa),GN=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:l,defaultValue:u,onValueChange:h,dir:d,name:g,autoComplete:p,disabled:v,required:y,form:w}=e,S=Mp(t),[C,k]=_.useState(null),[R,E]=_.useState(null),[M,j]=_.useState(!1),D=Z0(d),[L,$]=lc({prop:r,defaultProp:s??!1,onChange:o,caller:Wa}),[Y,P]=lc({prop:l,defaultProp:u,onChange:h,caller:Wa}),V=_.useRef(null),I=C?w||!!C.closest("form"):!0,[W,K]=_.useState(new Set),q=Array.from(W).map(O=>O.props.value).join(";");return f.jsx(mp,{...S,children:f.jsxs(RF,{required:y,scope:t,trigger:C,onTriggerChange:k,valueNode:R,onValueNodeChange:E,valueNodeHasChildren:M,onValueNodeHasChildrenChange:j,contentId:Gs(),value:Y,onValueChange:P,open:L,onOpenChange:$,dir:D,triggerPointerDownPosRef:V,disabled:v,children:[f.jsx(Rp.Provider,{scope:t,children:f.jsx(TF,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(O=>{K(H=>new Set(H).add(O))},[]),onNativeOptionRemove:_.useCallback(O=>{K(H=>{const U=new Set(H);return U.delete(O),U})},[]),children:n})}),I?f.jsxs(b5,{"aria-hidden":!0,required:y,tabIndex:-1,name:g,autoComplete:p,value:Y,onChange:O=>P(O.target.value),disabled:v,form:w,children:[Y===void 0?f.jsx("option",{value:""}):null,Array.from(W)]},q):null]})})};GN.displayName=Wa;var YN="SelectTrigger",XN=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=Mp(n),l=na(YN,n),u=l.disabled||r,h=Ut(t,l.onTriggerChange),d=Tp(n),g=_.useRef("touch"),[p,v,y]=x5(S=>{const C=d().filter(E=>!E.disabled),k=C.find(E=>E.value===l.value),R=w5(C,S,k);R!==void 0&&l.onValueChange(R.value)}),w=S=>{u||(l.onOpenChange(!0),y()),S&&(l.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return f.jsx(Td,{asChild:!0,...o,children:f.jsx(Tt.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":y5(l.value)?"":void 0,...s,ref:h,onClick:Be(s.onClick,S=>{S.currentTarget.focus(),g.current!=="mouse"&&w(S)}),onPointerDown:Be(s.onPointerDown,S=>{g.current=S.pointerType;const C=S.target;C.hasPointerCapture(S.pointerId)&&C.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(w(S),S.preventDefault())}),onKeyDown:Be(s.onKeyDown,S=>{const C=p.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&v(S.key),!(C&&S.key===" ")&&CF.includes(S.key)&&(w(),S.preventDefault())})})})});XN.displayName=YN;var ZN="SelectValue",QN=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:l="",...u}=e,h=na(ZN,n),{onValueNodeHasChildrenChange:d}=h,g=o!==void 0,p=Ut(t,h.onValueNodeChange);return br(()=>{d(g)},[d,g]),f.jsx(Tt.span,{...u,ref:p,style:{pointerEvents:"none"},children:y5(h.value)?f.jsx(f.Fragment,{children:l}):o})});QN.displayName=ZN;var NF="SelectIcon",JN=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return f.jsx(Tt.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});JN.displayName=NF;var AF="SelectPortal",e5=e=>f.jsx(bc,{asChild:!0,...e});e5.displayName=AF;var Va="SelectContent",t5=_.forwardRef((e,t)=>{const n=na(Va,e.__scopeSelect),[r,s]=_.useState();if(br(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?Bi.createPortal(f.jsx(n5,{scope:e.__scopeSelect,children:f.jsx(Rp.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),o):null}return f.jsx(r5,{...e,ref:t})});t5.displayName=Va;var Pi=10,[n5,ra]=kc(Va),DF="SelectContentImpl",jF=Fa("SelectContent.RemoveScroll"),r5=_.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:l,side:u,sideOffset:h,align:d,alignOffset:g,arrowPadding:p,collisionBoundary:v,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:C,...k}=e,R=na(Va,n),[E,M]=_.useState(null),[j,D]=_.useState(null),L=Ut(t,te=>M(te)),[$,Y]=_.useState(null),[P,V]=_.useState(null),I=Tp(n),[W,K]=_.useState(!1),q=_.useRef(!1);_.useEffect(()=>{if(E)return tp(E)},[E]),Jm();const O=_.useCallback(te=>{const[le,...me]=I().map(Re=>Re.ref.current),[xe]=me.slice(-1),Ae=document.activeElement;for(const Re of te)if(Re===Ae||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===le&&j&&(j.scrollTop=0),Re===xe&&j&&(j.scrollTop=j.scrollHeight),Re==null||Re.focus(),document.activeElement!==Ae))return},[I,j]),H=_.useCallback(()=>O([$,E]),[O,$,E]);_.useEffect(()=>{W&&H()},[W,H]);const{onOpenChange:U,triggerPointerDownPosRef:F}=R;_.useEffect(()=>{if(E){let te={x:0,y:0};const le=xe=>{var Ae,Re;te={x:Math.abs(Math.round(xe.pageX)-(((Ae=F.current)==null?void 0:Ae.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Re=F.current)==null?void 0:Re.y)??0))}},me=xe=>{te.x<=10&&te.y<=10?xe.preventDefault():E.contains(xe.target)||U(!1),document.removeEventListener("pointermove",le),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",me,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",me,{capture:!0})}}},[E,U,F]),_.useEffect(()=>{const te=()=>U(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[U]);const[N,B]=x5(te=>{const le=I().filter(Ae=>!Ae.disabled),me=le.find(Ae=>Ae.ref.current===document.activeElement),xe=w5(le,te,me);xe&&setTimeout(()=>xe.ref.current.focus())}),X=_.useCallback((te,le,me)=>{const xe=!q.current&&!me;(R.value!==void 0&&R.value===le||xe)&&(Y(te),xe&&(q.current=!0))},[R.value]),A=_.useCallback(()=>E==null?void 0:E.focus(),[E]),ne=_.useCallback((te,le,me)=>{const xe=!q.current&&!me;(R.value!==void 0&&R.value===le||xe)&&V(te)},[R.value]),ae=r==="popper"?Fb:i5,Z=ae===Fb?{side:u,sideOffset:h,align:d,alignOffset:g,arrowPadding:p,collisionBoundary:v,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:C}:{};return f.jsx(n5,{scope:n,content:E,viewport:j,onViewportChange:D,itemRefCallback:X,selectedItem:$,onItemLeave:A,itemTextRefCallback:ne,focusSelectedItem:H,selectedItemText:P,position:r,isPositioned:W,searchRef:N,children:f.jsx(Cd,{as:jF,allowPinchZoom:!0,children:f.jsx(Sd,{asChild:!0,trapped:R.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Be(s,te=>{var le;(le=R.trigger)==null||le.focus({preventScroll:!0}),te.preventDefault()}),children:f.jsx(_c,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:f.jsx(ae,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:te=>te.preventDefault(),...k,...Z,onPlaced:()=>K(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Be(k.onKeyDown,te=>{const le=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!le&&te.key.length===1&&B(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let xe=I().filter(Ae=>!Ae.disabled).map(Ae=>Ae.ref.current);if(["ArrowUp","End"].includes(te.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Ae=te.target,Re=xe.indexOf(Ae);xe=xe.slice(Re+1)}setTimeout(()=>O(xe)),te.preventDefault()}})})})})})})});r5.displayName=DF;var OF="SelectItemAlignedPosition",i5=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=na(Va,n),l=ra(Va,n),[u,h]=_.useState(null),[d,g]=_.useState(null),p=Ut(t,L=>g(L)),v=Tp(n),y=_.useRef(!1),w=_.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:k,focusSelectedItem:R}=l,E=_.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&d&&S&&C&&k){const L=o.trigger.getBoundingClientRect(),$=d.getBoundingClientRect(),Y=o.valueNode.getBoundingClientRect(),P=k.getBoundingClientRect();if(o.dir!=="rtl"){const Ae=P.left-$.left,Re=Y.left-Ae,je=L.left-Re,Ye=L.width+je,xt=Math.max(Ye,$.width),ft=window.innerWidth-Pi,he=f2(Re,[Pi,Math.max(Pi,ft-xt)]);u.style.minWidth=Ye+"px",u.style.left=he+"px"}else{const Ae=$.right-P.right,Re=window.innerWidth-Y.right-Ae,je=window.innerWidth-L.right-Re,Ye=L.width+je,xt=Math.max(Ye,$.width),ft=window.innerWidth-Pi,he=f2(Re,[Pi,Math.max(Pi,ft-xt)]);u.style.minWidth=Ye+"px",u.style.right=he+"px"}const V=v(),I=window.innerHeight-Pi*2,W=S.scrollHeight,K=window.getComputedStyle(d),q=parseInt(K.borderTopWidth,10),O=parseInt(K.paddingTop,10),H=parseInt(K.borderBottomWidth,10),U=parseInt(K.paddingBottom,10),F=q+O+W+U+H,N=Math.min(C.offsetHeight*5,F),B=window.getComputedStyle(S),X=parseInt(B.paddingTop,10),A=parseInt(B.paddingBottom,10),ne=L.top+L.height/2-Pi,ae=I-ne,Z=C.offsetHeight/2,te=C.offsetTop+Z,le=q+O+te,me=F-le;if(le<=ne){const Ae=V.length>0&&C===V[V.length-1].ref.current;u.style.bottom="0px";const Re=d.clientHeight-S.offsetTop-S.offsetHeight,je=Math.max(ae,Z+(Ae?A:0)+Re+H),Ye=le+je;u.style.height=Ye+"px"}else{const Ae=V.length>0&&C===V[0].ref.current;u.style.top="0px";const je=Math.max(ne,q+S.offsetTop+(Ae?X:0)+Z)+me;u.style.height=je+"px",S.scrollTop=le-ne+S.offsetTop}u.style.margin=`${Pi}px 0`,u.style.minHeight=N+"px",u.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[v,o.trigger,o.valueNode,u,d,S,C,k,o.dir,r]);br(()=>E(),[E]);const[M,j]=_.useState();br(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);const D=_.useCallback(L=>{L&&w.current===!0&&(E(),R==null||R(),w.current=!1)},[E,R]);return f.jsx(zF,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:y,onScrollButtonChange:D,children:f.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:f.jsx(Tt.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});i5.displayName=OF;var LF="SelectPopperPosition",Fb=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Pi,...o}=e,l=Mp(n);return f.jsx(pp,{...l,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Fb.displayName=LF;var[zF,Q0]=kc(Va,{}),Ub="SelectViewport",s5=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=ra(Ub,n),l=Q0(Ub,n),u=Ut(t,o.onViewportChange),h=_.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(Rp.Slot,{scope:n,children:f.jsx(Tt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Be(s.onScroll,d=>{const g=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:v}=l;if(v!=null&&v.current&&p){const y=Math.abs(h.current-g.scrollTop);if(y>0){const w=window.innerHeight-Pi*2,S=parseFloat(p.style.minHeight),C=parseFloat(p.style.height),k=Math.max(S,C);if(k<w){const R=k+y,E=Math.min(w,R),M=R-E;p.style.height=E+"px",p.style.bottom==="0px"&&(g.scrollTop=M>0?M:0,p.style.justifyContent="flex-end")}}}h.current=g.scrollTop})})})]})});s5.displayName=Ub;var o5="SelectGroup",[PF,BF]=kc(o5),a5=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Gs();return f.jsx(PF,{scope:n,id:s,children:f.jsx(Tt.div,{role:"group","aria-labelledby":s,...r,ref:t})})});a5.displayName=o5;var l5="SelectLabel",c5=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=BF(l5,n);return f.jsx(Tt.div,{id:s.id,...r,ref:t})});c5.displayName=l5;var Nm="SelectItem",[IF,u5]=kc(Nm),d5=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...l}=e,u=na(Nm,n),h=ra(Nm,n),d=u.value===r,[g,p]=_.useState(o??""),[v,y]=_.useState(!1),w=Ut(t,R=>{var E;return(E=h.itemRefCallback)==null?void 0:E.call(h,R,r,s)}),S=Gs(),C=_.useRef("touch"),k=()=>{s||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(IF,{scope:n,value:r,disabled:s,textId:S,isSelected:d,onItemTextChange:_.useCallback(R=>{p(E=>E||((R==null?void 0:R.textContent)??"").trim())},[]),children:f.jsx(Rp.ItemSlot,{scope:n,value:r,disabled:s,textValue:g,children:f.jsx(Tt.div,{role:"option","aria-labelledby":S,"data-highlighted":v?"":void 0,"aria-selected":d&&v,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:w,onFocus:Be(l.onFocus,()=>y(!0)),onBlur:Be(l.onBlur,()=>y(!1)),onClick:Be(l.onClick,()=>{C.current!=="mouse"&&k()}),onPointerUp:Be(l.onPointerUp,()=>{C.current==="mouse"&&k()}),onPointerDown:Be(l.onPointerDown,R=>{C.current=R.pointerType}),onPointerMove:Be(l.onPointerMove,R=>{var E;C.current=R.pointerType,s?(E=h.onItemLeave)==null||E.call(h):C.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Be(l.onPointerLeave,R=>{var E;R.currentTarget===document.activeElement&&((E=h.onItemLeave)==null||E.call(h))}),onKeyDown:Be(l.onKeyDown,R=>{var M;((M=h.searchRef)==null?void 0:M.current)!==""&&R.key===" "||(kF.includes(R.key)&&k(),R.key===" "&&R.preventDefault())})})})})});d5.displayName=Nm;var Pu="SelectItemText",h5=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,l=na(Pu,n),u=ra(Pu,n),h=u5(Pu,n),d=MF(Pu,n),[g,p]=_.useState(null),v=Ut(t,k=>p(k),h.onItemTextChange,k=>{var R;return(R=u.itemTextRefCallback)==null?void 0:R.call(u,k,h.value,h.disabled)}),y=g==null?void 0:g.textContent,w=_.useMemo(()=>f.jsx("option",{value:h.value,disabled:h.disabled,children:y},h.value),[h.disabled,h.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=d;return br(()=>(S(w),()=>C(w)),[S,C,w]),f.jsxs(f.Fragment,{children:[f.jsx(Tt.span,{id:h.textId,...o,ref:v}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Bi.createPortal(o.children,l.valueNode):null]})});h5.displayName=Pu;var f5="SelectItemIndicator",m5=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return u5(f5,n).isSelected?f.jsx(Tt.span,{"aria-hidden":!0,...r,ref:t}):null});m5.displayName=f5;var $b="SelectScrollUpButton",p5=_.forwardRef((e,t)=>{const n=ra($b,e.__scopeSelect),r=Q0($b,e.__scopeSelect),[s,o]=_.useState(!1),l=Ut(t,r.onScrollButtonChange);return br(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=h.scrollTop>0;o(d)};const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?f.jsx(v5,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop-h.offsetHeight)}}):null});p5.displayName=$b;var Wb="SelectScrollDownButton",g5=_.forwardRef((e,t)=>{const n=ra(Wb,e.__scopeSelect),r=Q0(Wb,e.__scopeSelect),[s,o]=_.useState(!1),l=Ut(t,r.onScrollButtonChange);return br(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=h.scrollHeight-h.clientHeight,g=Math.ceil(h.scrollTop)<d;o(g)};const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?f.jsx(v5,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop+h.offsetHeight)}}):null});g5.displayName=Wb;var v5=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=ra("SelectScrollButton",n),l=_.useRef(null),u=Tp(n),h=_.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return _.useEffect(()=>()=>h(),[h]),br(()=>{var g;const d=u().find(p=>p.ref.current===document.activeElement);(g=d==null?void 0:d.ref.current)==null||g.scrollIntoView({block:"nearest"})},[u]),f.jsx(Tt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Be(s.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Be(s.onPointerMove,()=>{var d;(d=o.onItemLeave)==null||d.call(o),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Be(s.onPointerLeave,()=>{h()})})}),HF="SelectSeparator",_5=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(Tt.div,{"aria-hidden":!0,...r,ref:t})});_5.displayName=HF;var Vb="SelectArrow",FF=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Mp(n),o=na(Vb,n),l=ra(Vb,n);return o.open&&l.position==="popper"?f.jsx(gp,{...s,...r,ref:t}):null});FF.displayName=Vb;var UF="SelectBubbleInput",b5=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=_.useRef(null),o=Ut(r,s),l=SF(t);return _.useEffect(()=>{const u=s.current;if(!u)return;const h=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==t&&g){const p=new Event("change",{bubbles:!0});g.call(u,t),u.dispatchEvent(p)}},[l,t]),f.jsx(Tt.select,{...n,style:{...XM,...n.style},ref:o,defaultValue:t})});b5.displayName=UF;function y5(e){return e===""||e===void 0}function x5(e){const t=Ui(e),n=_.useRef(""),r=_.useRef(0),s=_.useCallback(l=>{const u=n.current+l;t(u),(function h(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>h(""),1e3))})(u)},[t]),o=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function w5(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=$F(e,Math.max(o,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 $F(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var WF=GN,S5=XN,VF=QN,qF=JN,KF=e5,C5=t5,GF=s5,YF=a5,k5=c5,J0=d5,E5=h5,R5=m5,T5=p5,M5=g5,N5=_5;const pr=WF,k_=YF,Sr=VF,ur=_.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(S5,{ref:r,className:pe("flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors","placeholder:text-muted-foreground","focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",e),...n,children:[t,f.jsx(qF,{asChild:!0,children:f.jsx(rp,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));ur.displayName=S5.displayName;const A5=_.forwardRef(({className:e,...t},n)=>f.jsx(T5,{ref:n,className:pe("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(T6,{className:"h-4 w-4"})}));A5.displayName=T5.displayName;const D5=_.forwardRef(({className:e,...t},n)=>f.jsx(M5,{ref:n,className:pe("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(rp,{className:"h-4 w-4"})}));D5.displayName=M5.displayName;const dr=_.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>f.jsx(KF,{children:f.jsxs(C5,{ref:s,className:pe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-md backdrop-blur-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[f.jsx(A5,{}),f.jsx(GF,{className:pe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),f.jsx(D5,{})]})}));dr.displayName=C5.displayName;const XF=_.forwardRef(({className:e,...t},n)=>f.jsx(k5,{ref:n,className:pe("px-2 py-1.5 text-sm font-semibold",e),...t}));XF.displayName=k5.displayName;const Et=_.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(J0,{ref:r,className:pe("relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(R5,{children:f.jsx($i,{className:"h-4 w-4"})})}),f.jsx(E5,{children:t})]}));Et.displayName=J0.displayName;const Jf=_.forwardRef(({className:e,children:t,thumbnail:n,thumbnailAlt:r="",...s},o)=>f.jsxs(J0,{ref:o,className:pe("flex w-full cursor-default select-none items-center gap-2 rounded-md py-1.5 pl-2 pr-2 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[f.jsx("div",{className:"min-w-0 flex-1 truncate",children:f.jsx(E5,{children:t})}),f.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n?f.jsx("img",{src:n,alt:r,className:"h-5 w-9 rounded object-cover opacity-90"}):null,f.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(R5,{children:f.jsx($i,{className:"h-4 w-4"})})})]})]}));Jf.displayName="SelectItemWithThumbnail";const ZF=_.forwardRef(({className:e,...t},n)=>f.jsx(N5,{ref:n,className:pe("-mx-1 my-1 h-px bg-border",e),...t}));ZF.displayName=N5.displayName;var E_="rovingFocusGroup.onEntryFocus",QF={bubbles:!1,cancelable:!0},Od="RovingFocusGroup",[qb,j5,JF]=X0(Od),[eU,O5]=to(Od,[JF]),[tU,nU]=eU(Od),L5=_.forwardRef((e,t)=>f.jsx(qb.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(qb.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(rU,{...e,ref:t})})}));L5.displayName=Od;var rU=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:h,onEntryFocus:d,preventScrollOnEntryFocus:g=!1,...p}=e,v=_.useRef(null),y=Ut(t,v),w=Z0(o),[S,C]=lc({prop:l,defaultProp:u??null,onChange:h,caller:Od}),[k,R]=_.useState(!1),E=Ui(d),M=j5(n),j=_.useRef(!1),[D,L]=_.useState(0);return _.useEffect(()=>{const $=v.current;if($)return $.addEventListener(E_,E),()=>$.removeEventListener(E_,E)},[E]),f.jsx(tU,{scope:n,orientation:r,dir:w,loop:s,currentTabStopId:S,onItemFocus:_.useCallback($=>C($),[C]),onItemShiftTab:_.useCallback(()=>R(!0),[]),onFocusableItemAdd:_.useCallback(()=>L($=>$+1),[]),onFocusableItemRemove:_.useCallback(()=>L($=>$-1),[]),children:f.jsx(Tt.div,{tabIndex:k||D===0?-1:0,"data-orientation":r,...p,ref:y,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,()=>{j.current=!0}),onFocus:Be(e.onFocus,$=>{const Y=!j.current;if($.target===$.currentTarget&&Y&&!k){const P=new CustomEvent(E_,QF);if($.currentTarget.dispatchEvent(P),!P.defaultPrevented){const V=M().filter(O=>O.focusable),I=V.find(O=>O.active),W=V.find(O=>O.id===S),q=[I,W,...V].filter(Boolean).map(O=>O.ref.current);B5(q,g)}}j.current=!1}),onBlur:Be(e.onBlur,()=>R(!1))})})}),z5="RovingFocusGroupItem",P5=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:l,...u}=e,h=Gs(),d=o||h,g=nU(z5,n),p=g.currentTabStopId===d,v=j5(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:S}=g;return _.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),f.jsx(qb.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:f.jsx(Tt.span,{tabIndex:p?0:-1,"data-orientation":g.orientation,...u,ref:t,onMouseDown:Be(e.onMouseDown,C=>{r?g.onItemFocus(d):C.preventDefault()}),onFocus:Be(e.onFocus,()=>g.onItemFocus(d)),onKeyDown:Be(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){g.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const k=oU(C,g.orientation,g.dir);if(k!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let E=v().filter(M=>M.focusable).map(M=>M.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const M=E.indexOf(C.currentTarget);E=g.loop?aU(E,M+1):E.slice(M+1)}setTimeout(()=>B5(E))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:S!=null}):l})})});P5.displayName=z5;var iU={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sU(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function oU(e,t,n){const r=sU(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return iU[r]}function B5(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function aU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lU=L5,cU=P5,Kb=["Enter"," "],uU=["ArrowDown","PageUp","Home"],I5=["ArrowUp","PageDown","End"],dU=[...uU,...I5],hU={ltr:[...Kb,"ArrowRight"],rtl:[...Kb,"ArrowLeft"]},fU={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ld="Menu",[dd,mU,pU]=X0(Ld),[Ja,H5]=to(Ld,[pU,ea,O5]),Np=ea(),F5=O5(),[gU,el]=Ja(Ld),[vU,zd]=Ja(Ld),U5=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:l=!0}=e,u=Np(t),[h,d]=_.useState(null),g=_.useRef(!1),p=Ui(o),v=Z0(s);return _.useEffect(()=>{const y=()=>{g.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>g.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),f.jsx(mp,{...u,children:f.jsx(gU,{scope:t,open:n,onOpenChange:p,content:h,onContentChange:d,children:f.jsx(vU,{scope:t,onClose:_.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:g,dir:v,modal:l,children:r})})})};U5.displayName=Ld;var _U="MenuAnchor",ex=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Np(n);return f.jsx(Td,{...s,...r,ref:t})});ex.displayName=_U;var tx="MenuPortal",[bU,$5]=Ja(tx,{forceMount:void 0}),W5=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=el(tx,t);return f.jsx(bU,{scope:t,forceMount:n,children:f.jsx(Ai,{present:n||o.open,children:f.jsx(bc,{asChild:!0,container:s,children:r})})})};W5.displayName=tx;var Ti="MenuContent",[yU,nx]=Ja(Ti),V5=_.forwardRef((e,t)=>{const n=$5(Ti,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=el(Ti,e.__scopeMenu),l=zd(Ti,e.__scopeMenu);return f.jsx(dd.Provider,{scope:e.__scopeMenu,children:f.jsx(Ai,{present:r||o.open,children:f.jsx(dd.Slot,{scope:e.__scopeMenu,children:l.modal?f.jsx(xU,{...s,ref:t}):f.jsx(wU,{...s,ref:t})})})})}),xU=_.forwardRef((e,t)=>{const n=el(Ti,e.__scopeMenu),r=_.useRef(null),s=Ut(t,r);return _.useEffect(()=>{const o=r.current;if(o)return tp(o)},[]),f.jsx(rx,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Be(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),wU=_.forwardRef((e,t)=>{const n=el(Ti,e.__scopeMenu);return f.jsx(rx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),SU=Fa("MenuContent.ScrollLock"),rx=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:h,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:v,onDismiss:y,disableOutsideScroll:w,...S}=e,C=el(Ti,n),k=zd(Ti,n),R=Np(n),E=F5(n),M=mU(n),[j,D]=_.useState(null),L=_.useRef(null),$=Ut(t,L,C.onContentChange),Y=_.useRef(0),P=_.useRef(""),V=_.useRef(0),I=_.useRef(null),W=_.useRef("right"),K=_.useRef(0),q=w?Cd:_.Fragment,O=w?{as:SU,allowPinchZoom:!0}:void 0,H=F=>{var te,le;const N=P.current+F,B=M().filter(me=>!me.disabled),X=document.activeElement,A=(te=B.find(me=>me.ref.current===X))==null?void 0:te.textValue,ne=B.map(me=>me.textValue),ae=LU(ne,N,A),Z=(le=B.find(me=>me.textValue===ae))==null?void 0:le.ref.current;(function me(xe){P.current=xe,window.clearTimeout(Y.current),xe!==""&&(Y.current=window.setTimeout(()=>me(""),1e3))})(N),Z&&setTimeout(()=>Z.focus())};_.useEffect(()=>()=>window.clearTimeout(Y.current),[]),Jm();const U=_.useCallback(F=>{var B,X;return W.current===((B=I.current)==null?void 0:B.side)&&PU(F,(X=I.current)==null?void 0:X.area)},[]);return f.jsx(yU,{scope:n,searchRef:P,onItemEnter:_.useCallback(F=>{U(F)&&F.preventDefault()},[U]),onItemLeave:_.useCallback(F=>{var N;U(F)||((N=L.current)==null||N.focus(),D(null))},[U]),onTriggerLeave:_.useCallback(F=>{U(F)&&F.preventDefault()},[U]),pointerGraceTimerRef:V,onPointerGraceIntentChange:_.useCallback(F=>{I.current=F},[]),children:f.jsx(q,{...O,children:f.jsx(Sd,{asChild:!0,trapped:s,onMountAutoFocus:Be(o,F=>{var N;F.preventDefault(),(N=L.current)==null||N.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:f.jsx(_c,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:v,onDismiss:y,children:f.jsx(lU,{asChild:!0,...E,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:D,onEntryFocus:Be(h,F=>{k.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(pp,{role:"menu","aria-orientation":"vertical","data-state":aA(C.open),"data-radix-menu-content":"",dir:k.dir,...R,...S,ref:$,style:{outline:"none",...S.style},onKeyDown:Be(S.onKeyDown,F=>{const B=F.target.closest("[data-radix-menu-content]")===F.currentTarget,X=F.ctrlKey||F.altKey||F.metaKey,A=F.key.length===1;B&&(F.key==="Tab"&&F.preventDefault(),!X&&A&&H(F.key));const ne=L.current;if(F.target!==ne||!dU.includes(F.key))return;F.preventDefault();const Z=M().filter(te=>!te.disabled).map(te=>te.ref.current);I5.includes(F.key)&&Z.reverse(),jU(Z)}),onBlur:Be(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(Y.current),P.current="")}),onPointerMove:Be(e.onPointerMove,hd(F=>{const N=F.target,B=K.current!==F.clientX;if(F.currentTarget.contains(N)&&B){const X=F.clientX>K.current?"right":"left";W.current=X,K.current=F.clientX}}))})})})})})})});V5.displayName=Ti;var CU="MenuGroup",ix=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Tt.div,{role:"group",...r,ref:t})});ix.displayName=CU;var kU="MenuLabel",q5=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Tt.div,{...r,ref:t})});q5.displayName=kU;var Am="MenuItem",m2="menu.itemSelect",Ap=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=_.useRef(null),l=zd(Am,e.__scopeMenu),u=nx(Am,e.__scopeMenu),h=Ut(t,o),d=_.useRef(!1),g=()=>{const p=o.current;if(!n&&p){const v=new CustomEvent(m2,{bubbles:!0,cancelable:!0});p.addEventListener(m2,y=>r==null?void 0:r(y),{once:!0}),UT(p,v),v.defaultPrevented?d.current=!1:l.onClose()}};return f.jsx(K5,{...s,ref:h,disabled:n,onClick:Be(e.onClick,g),onPointerDown:p=>{var v;(v=e.onPointerDown)==null||v.call(e,p),d.current=!0},onPointerUp:Be(e.onPointerUp,p=>{var v;d.current||(v=p.currentTarget)==null||v.click()}),onKeyDown:Be(e.onKeyDown,p=>{const v=u.searchRef.current!=="";n||v&&p.key===" "||Kb.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Ap.displayName=Am;var K5=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,l=nx(Am,n),u=F5(n),h=_.useRef(null),d=Ut(t,h),[g,p]=_.useState(!1),[v,y]=_.useState("");return _.useEffect(()=>{const w=h.current;w&&y((w.textContent??"").trim())},[o.children]),f.jsx(dd.ItemSlot,{scope:n,disabled:r,textValue:s??v,children:f.jsx(cU,{asChild:!0,...u,focusable:!r,children:f.jsx(Tt.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:d,onPointerMove:Be(e.onPointerMove,hd(w=>{r?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Be(e.onPointerLeave,hd(w=>l.onItemLeave(w))),onFocus:Be(e.onFocus,()=>p(!0)),onBlur:Be(e.onBlur,()=>p(!1))})})})}),EU="MenuCheckboxItem",G5=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return f.jsx(J5,{scope:e.__scopeMenu,checked:n,children:f.jsx(Ap,{role:"menuitemcheckbox","aria-checked":Dm(n)?"mixed":n,...s,ref:t,"data-state":ox(n),onSelect:Be(s.onSelect,()=>r==null?void 0:r(Dm(n)?!0:!n),{checkForDefaultPrevented:!1})})})});G5.displayName=EU;var Y5="MenuRadioGroup",[RU,TU]=Ja(Y5,{value:void 0,onValueChange:()=>{}}),X5=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Ui(r);return f.jsx(RU,{scope:e.__scopeMenu,value:n,onValueChange:o,children:f.jsx(ix,{...s,ref:t})})});X5.displayName=Y5;var Z5="MenuRadioItem",Q5=_.forwardRef((e,t)=>{const{value:n,...r}=e,s=TU(Z5,e.__scopeMenu),o=n===s.value;return f.jsx(J5,{scope:e.__scopeMenu,checked:o,children:f.jsx(Ap,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":ox(o),onSelect:Be(r.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,n)},{checkForDefaultPrevented:!1})})})});Q5.displayName=Z5;var sx="MenuItemIndicator",[J5,MU]=Ja(sx,{checked:!1}),eA=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=MU(sx,n);return f.jsx(Ai,{present:r||Dm(o.checked)||o.checked===!0,children:f.jsx(Tt.span,{...s,ref:t,"data-state":ox(o.checked)})})});eA.displayName=sx;var NU="MenuSeparator",tA=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Tt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});tA.displayName=NU;var AU="MenuArrow",nA=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Np(n);return f.jsx(gp,{...s,...r,ref:t})});nA.displayName=AU;var DU="MenuSub",[hre,rA]=Ja(DU),Bu="MenuSubTrigger",iA=_.forwardRef((e,t)=>{const n=el(Bu,e.__scopeMenu),r=zd(Bu,e.__scopeMenu),s=rA(Bu,e.__scopeMenu),o=nx(Bu,e.__scopeMenu),l=_.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:h}=o,d={__scopeMenu:e.__scopeMenu},g=_.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return _.useEffect(()=>g,[g]),_.useEffect(()=>{const p=u.current;return()=>{window.clearTimeout(p),h(null)}},[u,h]),f.jsx(ex,{asChild:!0,...d,children:f.jsx(K5,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":aA(n.open),...e,ref:f0(t,s.onTriggerChange),onClick:p=>{var v;(v=e.onClick)==null||v.call(e,p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Be(e.onPointerMove,hd(p=>{o.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),g()},100))})),onPointerLeave:Be(e.onPointerLeave,hd(p=>{var y,w;g();const v=(y=n.content)==null?void 0:y.getBoundingClientRect();if(v){const S=(w=n.content)==null?void 0:w.dataset.side,C=S==="right",k=C?-5:5,R=v[C?"left":"right"],E=v[C?"right":"left"];o.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:R,y:v.top},{x:E,y:v.top},{x:E,y:v.bottom},{x:R,y:v.bottom}],side:S}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(p),p.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Be(e.onKeyDown,p=>{var y;const v=o.searchRef.current!=="";e.disabled||v&&p.key===" "||hU[r.dir].includes(p.key)&&(n.onOpenChange(!0),(y=n.content)==null||y.focus(),p.preventDefault())})})})});iA.displayName=Bu;var sA="MenuSubContent",oA=_.forwardRef((e,t)=>{const n=$5(Ti,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=el(Ti,e.__scopeMenu),l=zd(Ti,e.__scopeMenu),u=rA(sA,e.__scopeMenu),h=_.useRef(null),d=Ut(t,h);return f.jsx(dd.Provider,{scope:e.__scopeMenu,children:f.jsx(Ai,{present:r||o.open,children:f.jsx(dd.Slot,{scope:e.__scopeMenu,children:f.jsx(rx,{id:u.contentId,"aria-labelledby":u.triggerId,...s,ref:d,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{var p;l.isUsingKeyboardRef.current&&((p=h.current)==null||p.focus()),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:Be(e.onFocusOutside,g=>{g.target!==u.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Be(e.onEscapeKeyDown,g=>{l.onClose(),g.preventDefault()}),onKeyDown:Be(e.onKeyDown,g=>{var y;const p=g.currentTarget.contains(g.target),v=fU[l.dir].includes(g.key);p&&v&&(o.onOpenChange(!1),(y=u.trigger)==null||y.focus(),g.preventDefault())})})})})})});oA.displayName=sA;function aA(e){return e?"open":"closed"}function Dm(e){return e==="indeterminate"}function ox(e){return Dm(e)?"indeterminate":e?"checked":"unchecked"}function jU(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function OU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function LU(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=OU(e,Math.max(o,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 zU(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const u=t[o],h=t[l],d=u.x,g=u.y,p=h.x,v=h.y;g>r!=v>r&&n<(p-d)*(r-g)/(v-g)+d&&(s=!s)}return s}function PU(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return zU(n,t)}function hd(e){return t=>t.pointerType==="mouse"?e(t):void 0}var BU=U5,IU=ex,HU=W5,FU=V5,UU=ix,$U=q5,WU=Ap,VU=G5,qU=X5,KU=Q5,GU=eA,YU=tA,XU=nA,ZU=iA,QU=oA,ax="ContextMenu",[JU]=to(ax,[H5]),Mr=H5(),[e$,lA]=JU(ax),cA=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:s,modal:o=!0}=e,[l,u]=_.useState(!1),h=Mr(t),d=Ui(r),g=_.useCallback(p=>{u(p),d(p)},[d]);return f.jsx(e$,{scope:t,open:l,onOpenChange:g,modal:o,children:f.jsx(BU,{...h,dir:s,open:l,onOpenChange:g,modal:o,children:n})})};cA.displayName=ax;var uA="ContextMenuTrigger",dA=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=e,o=lA(uA,n),l=Mr(n),u=_.useRef({x:0,y:0}),h=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...u.current})}),d=_.useRef(0),g=_.useCallback(()=>window.clearTimeout(d.current),[]),p=v=>{u.current={x:v.clientX,y:v.clientY},o.onOpenChange(!0)};return _.useEffect(()=>g,[g]),_.useEffect(()=>void(r&&g()),[r,g]),f.jsxs(f.Fragment,{children:[f.jsx(IU,{...l,virtualRef:h}),f.jsx(Tt.span,{"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Be(e.onContextMenu,v=>{g(),p(v),v.preventDefault()}),onPointerDown:r?e.onPointerDown:Be(e.onPointerDown,Ef(v=>{g(),d.current=window.setTimeout(()=>p(v),700)})),onPointerMove:r?e.onPointerMove:Be(e.onPointerMove,Ef(g)),onPointerCancel:r?e.onPointerCancel:Be(e.onPointerCancel,Ef(g)),onPointerUp:r?e.onPointerUp:Be(e.onPointerUp,Ef(g))})]})});dA.displayName=uA;var t$="ContextMenuPortal",hA=e=>{const{__scopeContextMenu:t,...n}=e,r=Mr(t);return f.jsx(HU,{...r,...n})};hA.displayName=t$;var fA="ContextMenuContent",mA=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=lA(fA,n),o=Mr(n),l=_.useRef(!1);return f.jsx(FU,{...o,...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)"}})});mA.displayName=fA;var n$="ContextMenuGroup",r$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(UU,{...s,...r,ref:t})});r$.displayName=n$;var i$="ContextMenuLabel",s$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx($U,{...s,...r,ref:t})});s$.displayName=i$;var o$="ContextMenuItem",pA=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(WU,{...s,...r,ref:t})});pA.displayName=o$;var a$="ContextMenuCheckboxItem",l$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(VU,{...s,...r,ref:t})});l$.displayName=a$;var c$="ContextMenuRadioGroup",u$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(qU,{...s,...r,ref:t})});u$.displayName=c$;var d$="ContextMenuRadioItem",h$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(KU,{...s,...r,ref:t})});h$.displayName=d$;var f$="ContextMenuItemIndicator",m$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(GU,{...s,...r,ref:t})});m$.displayName=f$;var p$="ContextMenuSeparator",g$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(YU,{...s,...r,ref:t})});g$.displayName=p$;var v$="ContextMenuArrow",_$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(XU,{...s,...r,ref:t})});_$.displayName=v$;var b$="ContextMenuSubTrigger",y$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(ZU,{...s,...r,ref:t})});y$.displayName=b$;var x$="ContextMenuSubContent",w$=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Mr(n);return f.jsx(QU,{...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)"}})});w$.displayName=x$;function Ef(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var S$=cA,C$=dA,k$=hA,gA=mA,vA=pA;const _A=S$,bA=C$,lx=_.forwardRef(({className:e,...t},n)=>f.jsx(k$,{children:f.jsx(gA,{ref:n,className:pe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));lx.displayName=gA.displayName;const jm=_.forwardRef(({className:e,...t},n)=>f.jsx(vA,{ref:n,className:pe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));jm.displayName=vA.displayName;function yA({open:e,onOpenChange:t,position:n,children:r}){return f.jsxs(SN,{open:e,onOpenChange:t,children:[f.jsx(w7,{style:n?{position:"fixed",left:n.x,top:n.y,width:0,height:0}:void 0}),f.jsx(CN,{children:f.jsx(B0,{side:"bottom",align:"start",sideOffset:4,onOpenAutoFocus:s=>s.preventDefault(),className:pe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"),children:r})})]})}function Gb({onSelect:e,className:t,children:n}){return f.jsx("button",{type:"button",className:pe("relative flex w-full cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors","hover:bg-accent focus:bg-accent",t),onPointerDown:r=>{r.preventDefault(),e()},children:n})}function E$({onRemove:e,children:t,mobileMenuPosition:n,onMobileMenuClose:r,skipContextMenu:s}){return f.jsxs(f.Fragment,{children:[s?t:f.jsxs(_A,{children:[f.jsx(bA,{asChild:!0,children:t}),f.jsx(lx,{children:f.jsxs(jm,{onSelect:o=>{o.stopPropagation(),e()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(id,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})})]}),f.jsx(yA,{open:!!n,onOpenChange:o=>{o||r==null||r()},position:n??null,children:f.jsxs(Gb,{onSelect:()=>{r==null||r(),e()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(id,{className:"h-4 w-4"}),f.jsx("span",{children:"Hide"})]})})]})}function R$({onRename:e,onDelete:t,children:n,mobileMenuPosition:r,onMobileMenuClose:s,skipContextMenu:o}){return f.jsxs(f.Fragment,{children:[o?n:f.jsxs(_A,{children:[f.jsx(bA,{asChild:!0,children:n}),f.jsxs(lx,{children:[f.jsxs(jm,{onSelect:l=>{l.stopPropagation(),e()},children:[f.jsx(gm,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Rename Feature"})]}),f.jsxs(jm,{onSelect:l=>{l.stopPropagation(),t()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(id,{className:"h-4 w-4"}),f.jsx("span",{className:"text-xs font-medium",children:"Delete Feature"})]})]})]}),f.jsxs(yA,{open:!!r,onOpenChange:l=>{l||s==null||s()},position:r??null,children:[f.jsxs(Gb,{onSelect:()=>{s==null||s(),e()},children:[f.jsx(gm,{className:"h-4 w-4"}),f.jsx("span",{children:"Rename Feature"})]}),f.jsxs(Gb,{onSelect:()=>{s==null||s(),t()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[f.jsx(id,{className:"h-4 w-4"}),f.jsx("span",{children:"Delete Feature"})]})]})]})}function Dp(e){const[t,n]=_.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return _.useEffect(()=>{const r=window.matchMedia(e),s=()=>n(r.matches);return s(),r.addEventListener?(r.addEventListener("change",s),()=>r.removeEventListener("change",s)):(r.addListener(s),()=>r.removeListener(s))},[e]),t}function xA({iconDataUrl:e,alt:t,className:n,fallback:r=null}){return e?f.jsx("img",{src:e,alt:t,className:pe("shrink-0 object-contain",n)}):f.jsx(f.Fragment,{children:r})}const p2=e=>{let t;const n=new Set,r=(d,g)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const v=t;t=g??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,v))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>h,subscribe:d=>(n.add(d),()=>n.delete(d))},h=t=e(r,s,u);return u},T$=(e=>e?p2(e):p2),M$=e=>e;function N$(e,t=M$){const n=ye.useSyncExternalStore(e.subscribe,ye.useCallback(()=>t(e.getState()),[e,t]),ye.useCallback(()=>t(e.getInitialState()),[e,t]));return ye.useDebugValue(n),n}const A$=e=>{const t=T$(e),n=r=>N$(t,r);return Object.assign(n,t),n},ro=(e=>A$);function D$(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var o;const l=h=>h===null?null:JSON.parse(h,void 0),u=(o=n.getItem(s))!=null?o:null;return u instanceof Promise?u.then(l):l(u)},setItem:(s,o)=>n.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>n.removeItem(s)}}const Yb=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Yb(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Yb(r)(n)}}}},j$=(e,t)=>(n,r,s)=>{let o={storage:D$(()=>window.localStorage),partialize:C=>C,version:0,merge:(C,k)=>({...k,...C}),...t},l=!1,u=0;const h=new Set,d=new Set;let g=o.storage;if(!g)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...C)},r,s);const p=()=>{const C=o.partialize({...r()});return g.setItem(o.name,{state:C,version:o.version})},v=s.setState;s.setState=(C,k)=>(v(C,k),p());const y=e((...C)=>(n(...C),p()),r,s);s.getInitialState=()=>y;let w;const S=()=>{var C,k;if(!g)return;const R=++u;l=!1,h.forEach(M=>{var j;return M((j=r())!=null?j:y)});const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,(C=r())!=null?C:y))||void 0;return Yb(g.getItem.bind(g))(o.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==o.version){if(o.migrate){const j=o.migrate(M.state,M.version);return j instanceof Promise?j.then(D=>[!0,D]):[!0,j]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var j;if(R!==u)return;const[D,L]=M;if(w=o.merge(L,(j=r())!=null?j:y),n(w,!0),D)return p()}).then(()=>{R===u&&(E==null||E(w,void 0),w=r(),l=!0,d.forEach(M=>M(w)))}).catch(M=>{R===u&&(E==null||E(void 0,M))})};return s.persist={setOptions:C=>{o={...o,...C},C.storage&&(g=C.storage)},clearStorage:()=>{g==null||g.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:C=>(h.add(C),()=>{h.delete(C)}),onFinishHydration:C=>(d.add(C),()=>{d.delete(C)})},o.skipHydration||S(),w||y},io=j$,gn=ro()(io(e=>({themePreference:"system",colorTheme:"default",customAppearance:"system",backgroundImage:null,backgroundOpacity:1,backgroundBlur:0,showProjectIconsInSidebar:!0,setThemePreference:t=>e({themePreference:t}),setColorTheme:t=>e({colorTheme:t}),setCustomAppearance:t=>e({customAppearance:t}),setBackgroundImage:t=>e({backgroundImage:t}),setBackgroundOpacity:t=>e({backgroundOpacity:t}),setBackgroundBlur:t=>e({backgroundBlur:t}),setShowProjectIconsInSidebar:t=>e({showProjectIconsInSidebar:t})}),{name:"theme-settings"})),wA=8;function Xb(e,t){return!e.has(t)}function R_(e,t,n){const r=e.map(l=>l.featureId),s=r.indexOf(t),o=r.indexOf(n);return s===-1||o===-1||s===o?null:Ep(r,s,o)}function O$(e){return{activeFeatures:e.filter(t=>t.stage!=="done"),completedFeatures:e.filter(t=>t.stage==="done")}}function L$(e,t){return t?e:e.slice(0,wA)}function z$(e,t){return e.map(n=>`feature:${n.featureId}`).filter(n=>!t.has(n))}function g2({feature:e,groupKey:t,collapsedSections:n,onToggleSection:r,renderChatRow:s,onNewLocalChat:o,onRenameFeature:l,onDeleteFeature:u,onSetFeatureBrowserState:h,onSetFeatureStage:d,kanbanStatusesEnabled:g=!0,showAllChats:p,onToggleShowAllChats:v,draggedFeatureId:y,draggedChatId:w,hoveredDropTarget:S,isTouchDevice:C,onFeatureDragStart:k,onFeatureDragEnd:R,onFeatureDrop:E,onChatDrop:M,onTouchDragMove:j,onTouchDragEnd:D,onChatDragStart:L,onChatDragEnd:$}){const Y=`feature:${e.featureId}`,P=Xb(n,Y),V=w!==null,I=L$(e.chats,p),W=Math.max(0,e.chats.length-wA),K=W>0,[q,O]=_.useState(null);function H(){r(Y),h==null||h(e.featureId,P?"CLOSED":"OPEN")}const U=_.useRef(null),{touchRef:F,isDragging:N,isArmed:B,dragPosition:X}=H0({enabled:C,visualElementRef:U,onTap:H,onContextMenu:Z=>O(Z),onDragStart:()=>k(e.featureId),onDragMove:({x:Z,y:te,elementBelow:le})=>j(Z,te,le),onDragEnd:({x:Z,y:te,elementBelow:le})=>D(Z,te,le)}),A=y===e.featureId||N,ne=f.jsxs("div",{ref:U,"data-feature-drop-target":e.featureId,draggable:!C,onDragStart:C?void 0:()=>k(e.featureId),onDragEnd:C?void 0:R,onDragOver:C?void 0:Z=>{if(y&&y!==e.featureId){Z.preventDefault();return}V&&Z.preventDefault()},onDrop:C?void 0:Z=>{if(Z.preventDefault(),y&&y!==e.featureId){E(y,e.featureId);return}w&&M(w,e.featureId)},className:pe("rounded-lg border border-border/60 bg-muted/10 transition-all duration-150 select-none",V&&!C&&"border-dashed hover:border-primary/60 hover:bg-primary/5",S===e.featureId&&"border-primary/60 bg-primary/5",B&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card",A&&!B&&"opacity-20 scale-[0.98]"),children:[f.jsxs("div",{ref:C?F:void 0,className:"flex items-center gap-2 px-2 py-1.5",children:[C?f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-no-touch-drag":!0,onClick:H,className:"flex shrink-0 items-center",children:f.jsx(Tr,{className:pe("size-3 transition-transform",P&&"rotate-90")})}),f.jsx(f_,{className:"size-3.5 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title})]}):f.jsxs("button",{type:"button",onClick:H,className:"flex min-w-0 flex-1 basis-0 items-center gap-2 text-left",children:[f.jsx(Tr,{className:pe("size-3 transition-transform",P&&"rotate-90")}),f.jsx(f_,{className:"size-3.5 text-muted-foreground"}),f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title})}),f.jsx(Ii,{side:"right",sideOffset:4,children:e.title})]})]}),g?f.jsxs(pr,{value:e.stage,onValueChange:Z=>d==null?void 0:d(e.featureId,Z),children:[f.jsx(ur,{"data-no-touch-drag":!0,className:pe("h-7 w-auto min-w-[70px] shrink-0 items-center gap-1 rounded-full px-2 pr-1.5 text-[10px] font-semibold leading-none tracking-[0.04em] shadow-none focus:ring-0 focus:ring-offset-0 [&>span]:flex [&>span]:items-center [&>span]:leading-none [&>svg]:size-3 [&>svg]:shrink-0 [&>svg]:translate-y-0 [&>svg]:opacity-60",h2[e.stage]),children:f.jsx(Sr,{children:Xk[e.stage]})}),f.jsx(dr,{children:d7.map(Z=>f.jsx(Et,{value:Z,className:pe("text-[11px] font-medium",Z===e.stage&&h2[Z]),children:Xk[Z]},Z))})]}):null,o?f.jsx(Je,{variant:"ghost",size:"icon",className:"h-6 w-6","data-no-touch-drag":!0,onClick:()=>o(t,e.featureId),title:"New chat in feature",children:f.jsx(_0,{className:"size-3.5"})}):null]}),P?f.jsxs("div",{className:"space-y-[2px] border-t border-border/50 p-1 pl-3",children:[I.map(Z=>s(Z,{draggable:!0,onDragStart:te=>L(te.chatId),onDragEnd:$,isTouchDevice:C,onTouchDragMove:j,onTouchDragEnd:D})),K?f.jsx("div",{className:"pt-1",children:f.jsx(Je,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground",onClick:v,children:p?"Show less":`Show ${W} more`})}):null]}):null]}),ae=f.jsxs(RN,{position:X,children:[f.jsx(f_,{className:"size-3.5 shrink-0 text-primary"}),f.jsx("span",{className:"text-sm font-medium truncate",children:e.title})]});return u?f.jsxs(f.Fragment,{children:[f.jsx(R$,{onRename:()=>l==null?void 0:l(e.featureId),onDelete:()=>u(e.featureId),mobileMenuPosition:q,onMobileMenuClose:()=>O(null),skipContextMenu:C,children:ne}),ae]}):f.jsxs(f.Fragment,{children:[ne,ae]})}function P$({group:e,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:s,onCreateFeature:o,onRenameFeature:l,onDeleteFeature:u,onSetProjectBrowserState:h,onSetProjectGeneralChatsBrowserState:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:y,onRemoveProject:w,isConnected:S,startingLocalPath:C,folderGroupsEnabled:k=!0,kanbanStatusesEnabled:R=!0}){const E=gn(we=>we.showProjectIconsInSidebar),{groupKey:M,localPath:j,features:D,generalChats:L}=e,{activeFeatures:$,completedFeatures:Y}=_.useMemo(()=>O$(D),[D]),P=`project:${M}`,V=`general:${M}`,I=Xb(t,P),W=D.length===0||Xb(t,V),[K,q]=_.useState(null),[O,H]=_.useState(null),[U,F]=_.useState(null),[N,B]=_.useState(!1),[X,A]=_.useState(!1),[ne,ae]=_.useState({}),[Z,te]=_.useState(null),le=Dp("(pointer: coarse)"),me=k&&!N?L.slice(0,10):L,xe=k&&L.length>10,{attributes:Ae,listeners:Re,setNodeRef:je,setActivatorNodeRef:Ye,transform:xt,transition:ft,isDragging:he}=yF({id:M}),Pe=_.useRef(null),Ne={transform:cd.Translate.toString(xt),transition:ft};function tt(){n(P),h==null||h(M,I?"CLOSED":"OPEN")}function wt(){n(V),d==null||d(M,W?"CLOSED":"OPEN")}function $e(we){ae(He=>({...He,[we]:!He[we]}))}function pt(we){we.stopPropagation();for(const He of z$(D,t))n(He);for(const He of D)g==null||g(He.featureId,"CLOSED")}function Se(we){if(!we)return null;const He=we.closest("[data-feature-drop-target]");return He?{type:"feature",featureId:He.getAttribute("data-feature-drop-target")}:we.closest(`[data-general-chats-drop-target="${M}"]`)?{type:"general"}:null}function De(we,He,ot){const rt=Pe.current;if(rt){const St=rt.getBoundingClientRect(),at=60;He<St.top+at?rt.scrollBy(0,-6):He>St.bottom-at&&rt.scrollBy(0,6)}const Le=Se(ot);F((Le==null?void 0:Le.type)==="feature"?Le.featureId:null)}function ce(we,He,ot){const rt=Se(ot);if(O){if((rt==null?void 0:rt.type)==="feature"&&rt.featureId!==O&&y){const Le=R_(D,O,rt.featureId);Le&&y(M,Le)}H(null)}else K&&v&&((rt==null?void 0:rt.type)==="feature"?v(K,rt.featureId):(rt==null?void 0:rt.type)==="general"&&v(K,null),q(null));F(null)}const be=_.useRef(null),{touchRef:Oe}=H0({enabled:le&&!!w,onTap:tt,onContextMenu:we=>te(we)}),Ve=f.jsxs("div",{ref:we=>{Ye(we),be.current=we,le&&w&&Oe(we)},className:pe("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between cursor-grab active:cursor-grabbing select-none",he&&"cursor-grabbing"),onClick:le?void 0:tt,...Re,children:[f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[f.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:f.jsx(Tr,{className:pe("translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-transform duration-200",I&&"rotate-90")})}),E?f.jsx(xA,{iconDataUrl:e.iconDataUrl,alt:`${e.title||km(j)} icon`,className:"size-5",fallback:f.jsx("span",{className:"size-5 shrink-0","aria-hidden":"true"})}):null,f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx("span",{className:"truncate max-w-[180px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.title||km(j)})}),f.jsx(Ii,{side:"right",sideOffset:4,children:j})]})]}),f.jsxs("div",{className:"absolute right-2 flex items-center gap-1",children:[o?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx(Je,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100","data-no-touch-drag":!0,onClick:we=>{we.stopPropagation(),o(M)},children:f.jsx(nI,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(Ii,{side:"right",sideOffset:4,children:"New feature"})]}):null,D.length>0?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx(Je,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100","data-no-touch-drag":!0,onClick:pt,children:f.jsx(N6,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(Ii,{side:"right",sideOffset:4,children:"Close all feature folders"})]}):null,s?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsx(Je,{variant:"ghost",size:"icon",className:pe("h-5.5 w-5.5 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!S||C===j)&&"opacity-50 cursor-not-allowed"),disabled:!S||C===j,"data-no-touch-drag":!0,onClick:we=>{we.stopPropagation(),s(M)},children:C===j?f.jsx(oi,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):f.jsx(_0,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),f.jsx(Ii,{side:"right",sideOffset:4,children:S?"New general chat":`Start ${Mn} to connect`})]}):null]})]});return f.jsxs("div",{ref:we=>{je(we),Pe.current=(we==null?void 0:we.closest("[data-sidebar-scroll]"))??null},style:Ne,className:pe("group/section",he&&"opacity-50 shadow-lg z-50 relative"),...Ae,children:[w?f.jsx(E$,{onRemove:()=>w(M),mobileMenuPosition:Z,onMobileMenuClose:()=>te(null),skipContextMenu:le,children:Ve}):Ve,I?f.jsxs("div",{className:"mb-2 space-y-2",children:[k&&$.length>0?f.jsx("section",{className:"space-y-2 pl-6",children:$.map(we=>f.jsx(g2,{feature:we,groupKey:M,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:s,onRenameFeature:l,onDeleteFeature:u,onSetFeatureBrowserState:g,onSetFeatureStage:p,kanbanStatusesEnabled:R,showAllChats:!!ne[we.featureId],onToggleShowAllChats:()=>$e(we.featureId),draggedFeatureId:O,draggedChatId:K,hoveredDropTarget:U,isTouchDevice:le,onFeatureDragStart:He=>H(He),onFeatureDragEnd:()=>H(null),onFeatureDrop:(He,ot)=>{const rt=R_(D,He,ot);H(null),rt&&(y==null||y(M,rt))},onChatDrop:(He,ot)=>{v==null||v(He,ot),q(null)},onTouchDragMove:De,onTouchDragEnd:ce,onChatDragStart:He=>q(He),onChatDragEnd:()=>q(null)},we.featureId))}):null,k&&Y.length>0?f.jsxs("section",{className:"pl-6",children:[f.jsxs("button",{type:"button",onClick:()=>A(we=>!we),className:"flex w-full items-center gap-2 px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:[f.jsx(Tr,{className:pe("size-3 transition-transform",X&&"rotate-90")}),f.jsx("span",{children:X?"Hide completed":"Show completed"}),f.jsx("span",{className:"ml-auto",children:Y.length})]}),X?f.jsx("div",{className:"space-y-2 pt-1",children:Y.map(we=>f.jsx(g2,{feature:we,groupKey:M,collapsedSections:t,onToggleSection:n,renderChatRow:r,onNewLocalChat:s,onRenameFeature:l,onDeleteFeature:u,onSetFeatureBrowserState:g,onSetFeatureStage:p,kanbanStatusesEnabled:R,showAllChats:!!ne[we.featureId],onToggleShowAllChats:()=>$e(we.featureId),draggedFeatureId:O,draggedChatId:K,hoveredDropTarget:U,isTouchDevice:le,onFeatureDragStart:He=>H(He),onFeatureDragEnd:()=>H(null),onFeatureDrop:(He,ot)=>{const rt=R_(D,He,ot);H(null),rt&&(y==null||y(M,rt))},onChatDrop:(He,ot)=>{v==null||v(He,ot),q(null)},onTouchDragMove:De,onTouchDragEnd:ce,onChatDragStart:He=>q(He),onChatDragEnd:()=>q(null)},we.featureId))}):null]}):null,L.length>0?f.jsxs("section",{"data-general-chats-drop-target":M,onDragOver:K&&!le?we=>we.preventDefault():void 0,onDrop:K&&!le&&v?we=>{we.preventDefault(),v(K,null),q(null)}:void 0,children:[k?f.jsxs("button",{type:"button",onClick:wt,className:"flex w-full items-center gap-2 px-4 py-1 text-left text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:[f.jsx(Tr,{className:pe("size-3 transition-transform",W&&"rotate-90")}),f.jsx("span",{children:"General Chats"}),f.jsx("span",{className:"ml-auto",children:L.length})]}):null,!k||W?f.jsxs("div",{className:pe("space-y-[2px]",k?"pl-7":"pl-4"),children:[me.map(we=>r(we,{draggable:!0,onDragStart:He=>q(He.chatId),onDragEnd:()=>q(null),isTouchDevice:le,onTouchDragMove:De,onTouchDragEnd:ce})),xe?f.jsx("div",{className:"pt-1",children:f.jsx(Je,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground",onClick:()=>B(we=>!we),children:N?"Show less":`Show ${L.length-10} more`})}):null]}):null]}):null]}):null]})}function B$({projectGroups:e,collapsedSections:t,onToggleSection:n,onSetProjectBrowserState:r,onSetProjectGeneralChatsBrowserState:s,renderChatRow:o,onNewLocalChat:l,onCreateFeature:u,onRenameFeature:h,onDeleteFeature:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:y,onRemoveProject:w,onReorderGroups:S,isConnected:C,startingLocalPath:k,folderGroupsEnabled:R=!0,kanbanStatusesEnabled:E=!0}){const M=Z7(x_(Y0,{activationConstraint:{distance:8}}),x_(IN,{activationConstraint:{delay:250,tolerance:5}}),x_(K0)),j=_.useMemo(()=>e.map(Y=>Y.groupKey),[e]),D=_.useRef(null);function L(Y){const P=Y.active.id;t.has(P)?D.current=null:(D.current=P,n(P))}function $(Y){const{active:P,over:V}=Y;if(V&&P.id!==V.id&&S){const I=j.indexOf(P.id),W=j.indexOf(V.id);I!==-1&&W!==-1&&S(Ep(j,I,W))}if(D.current){const I=D.current;D.current=null,requestAnimationFrame(()=>n(I))}}return f.jsx(eF,{sensors:M,collisionDetection:nH,onDragStart:L,onDragEnd:$,children:f.jsx(fF,{items:j,strategy:dF,children:e.map(Y=>f.jsx(P$,{group:Y,collapsedSections:t,onToggleSection:n,onSetProjectBrowserState:r,onSetProjectGeneralChatsBrowserState:s,renderChatRow:o,onNewLocalChat:l,onCreateFeature:u,onRenameFeature:h,onDeleteFeature:d,onSetFeatureBrowserState:g,onSetFeatureStage:p,onSetChatFeature:v,onReorderFeatures:y,onRemoveProject:w,onReorderGroups:S,isConnected:C,startingLocalPath:k,folderGroupsEnabled:R,kanbanStatusesEnabled:E},Y.groupKey))})})}const SA=`${bp}provider-usage-collapsed`,CA=`${bp}provider-usage-mode`,I$=Ko.map(e=>e.id),H$=["claude","codex"],Zb=Object.fromEntries(Ko.map(e=>[e.id,e.label]));function v2(e){return e===null?"bg-muted":e>=90?"bg-red-500":e>=75?"bg-amber-500":"bg-emerald-500"}function T_(e){return e===null?"N/A":`${e.toFixed(1)}%`}function _2(e,t){if(t!=null&&t.trim())return`Resets ${t.trim()}`;if(e===null)return null;const n=Date.now();if(e<=n)return"Limit may have reset";const r=e-n,s=Math.ceil(r/6e4);return s<60?`Resets in ${s} min`:`Resets at ${new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}function F$(){try{return localStorage.getItem(SA)==="true"}catch{return!1}}function U$(){try{return localStorage.getItem(CA)==="weekly"?"weekly":"session"}catch{return"session"}}function $$(e){try{localStorage.setItem(SA,String(e))}catch{}}function W$(e){try{localStorage.setItem(CA,e)}catch{}}function b2(e){const{entry:t,mode:n,isPending:r,onRefreshProviderUsage:s,onOpenProviderLogin:o}=e,l=Cm[t.provider],u=e.labelOverride??Zb[t.provider],h=t.availability==="unavailable",d=t.availability==="login_required",g=t.availability==="stale",p=t.provider==="cursor",v=e.percentOverride!==void 0?e.percentOverride:n==="weekly"?t.weeklyLimitUsedPercent??null:t.sessionLimitUsedPercent,y=v,w=p?null:n==="weekly"?_2(t.weeklyRateLimitResetAt??null,t.weeklyRateLimitResetLabel??null):_2(t.rateLimitResetAt,t.rateLimitResetLabel),S=[];d?S.push("Login required to fetch Cursor usage"):h?S.push("Usage data unavailable"):(e.bars?S.push("Cursor limit usage"):v!==null&&S.push(`${T_(v)} of ${n} limit used`),w&&S.push(w),g&&S.push("Data may be outdated"),S.length===0&&S.push("No usage data yet")),t.statusDetail&&S.push(t.statusDetail.replaceAll("_"," "));const C=!e.hideActions&&p&&d,k=p&&!e.hideActions&&h&&!d&&t.statusDetail!=="unsupported_platform";return f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsxs("div",{className:pe("flex flex-col",g&&"opacity-50"),children:[f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-md",children:[f.jsx(l,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"text-[11px] text-muted-foreground w-11 shrink-0",children:u}),h&&!e.bars?f.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-auto",children:"N/A"}):e.bars?f.jsx("div",{className:"flex-1"}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden min-w-0",children:y!==null?f.jsx("div",{className:pe("h-full rounded-full transition-all",v2(y)),style:{width:`${Math.min(100,Math.max(0,y))}%`}}):null}),f.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground w-7 text-right shrink-0",children:T_(y)})]}),C?f.jsx("button",{type:"button",disabled:r,onClick:R=>{R.stopPropagation(),o==null||o("cursor")},className:"ml-auto rounded border border-border/70 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-50",children:"Sign In"}):null,k?f.jsxs("button",{type:"button",disabled:r,onClick:R=>{R.stopPropagation(),s==null||s("cursor")},className:"flex items-center gap-1 rounded border border-border/70 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-50",children:[r&&f.jsx(v0,{className:"h-2 w-2 animate-spin"}),r?"Checking":"Refresh"]}):null]}),e.bars&&f.jsx("div",{className:"flex flex-col gap-1 pb-1",children:e.bars.map((R,E)=>f.jsxs("div",{className:"flex items-center gap-2 pl-7 pr-2",children:[f.jsx("span",{className:"text-[10px] text-muted-foreground w-12 shrink-0",children:R.label}),h?f.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-auto",children:"N/A"}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden min-w-0",children:R.percent!==null?f.jsx("div",{className:pe("h-full rounded-full transition-all",v2(R.percent)),style:{width:`${Math.min(100,Math.max(0,R.percent))}%`}}):null}),f.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground w-7 text-right shrink-0",children:T_(R.percent)})]})]},E))})]})}),f.jsx(Ii,{side:"right",className:"max-w-48",children:S.map((R,E)=>f.jsx("div",{className:"text-xs",children:R},E))})]})}function V$({providerUsage:e,visibleProviders:t=I$,onRefreshProviderUsage:n,onOpenProviderLogin:r}){const[s,o]=_.useState(F$),[l,u]=_.useState(U$),[h,d]=_.useState(null),g=()=>{o(v=>{const y=!v;return $$(y),y})},p=async()=>{d("all");try{await(n==null?void 0:n()),hf("Usage checked successfully.")}catch{hf("Failed to check usage.")}finally{d(v=>v==="all"?null:v)}};return f.jsxs("div",{className:"px-1 pb-1.5",children:[f.jsxs("div",{className:"flex items-center gap-2 px-2 pb-0.5",children:[f.jsxs("button",{type:"button",onClick:g,className:"flex min-w-0 flex-1 items-center gap-1 text-left group",children:[s?f.jsx(Tr,{className:"h-3 w-3 text-muted-foreground/40 group-hover:text-muted-foreground transition-colors"}):f.jsx(rp,{className:"h-3 w-3 text-muted-foreground/40 group-hover:text-muted-foreground transition-colors"}),f.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-medium group-hover:text-muted-foreground transition-colors",children:"Provider Usage"})]}),!s&&f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("button",{type:"button",onClick:p,disabled:h==="all",className:"shrink-0 rounded-md border border-border/70 bg-muted/40 p-1 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors disabled:opacity-50",title:"Refresh usages",children:f.jsx(v0,{className:pe("h-3 w-3",h==="all"&&"animate-spin")})}),f.jsx("button",{type:"button",onClick:()=>{u(v=>{const y=v==="session"?"weekly":"session";return W$(y),y})},className:"shrink-0 rounded-md border border-border/70 bg-muted/40 px-2 py-0.5 text-[10px] uppercase tracking-wider text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",children:l==="session"?"Session":"Weekly"})]})]}),!s&&(l==="weekly"?H$:t).flatMap(v=>{const y=(e==null?void 0:e[v])??{provider:v,sessionLimitUsedPercent:null,apiLimitUsedPercent:null,rateLimitResetAt:null,rateLimitResetLabel:null,weeklyLimitUsedPercent:null,weeklyRateLimitResetAt:null,weeklyRateLimitResetLabel:null,statusDetail:null,availability:"unavailable",lastRequestedAt:null,updatedAt:null,warnings:[]},w=async C=>{d(C);try{await(n==null?void 0:n(C)),hf(`${Zb[C]??"Provider"} usage checked successfully.`)}catch{hf(`Failed to check ${Zb[C]??"provider"} usage.`)}finally{d(k=>k===C?null:k)}},S=C=>{d(C),Promise.resolve(r==null?void 0:r(C)).finally(()=>{d(k=>k===C?null:k)})};return v==="cursor"&&l==="session"?[f.jsx(b2,{entry:y,mode:l,isPending:h==="cursor",bars:[{label:"API",percent:y.apiLimitUsedPercent??null},{label:"Composer",percent:y.sessionLimitUsedPercent}],onRefreshProviderUsage:w,onOpenProviderLogin:S},"cursor")]:[f.jsx(b2,{entry:y,mode:l,isPending:h===v||h==="all",onRefreshProviderUsage:w,onOpenProviderLogin:S},v)]})]})}function q$(e){return e==="gpt-5-codex"?"gpt-5.3-codex":e??"gpt-5.4"}function K$(e){return e==="claude"||e==="codex"||e==="gemini"||e==="cursor"?e:"last_used"}function za(e){var o,l;const t=(o=e==null?void 0:e.modelOptions)==null?void 0:o.reasoningEffort,n=Kk(t)?t:Kk(e==null?void 0:e.effort)?e.effort:dN.reasoningEffort,r=(e==null?void 0:e.model)??Jt("claude").defaultModel,s=u7(r,(l=e==null?void 0:e.modelOptions)==null?void 0:l.contextWindow);return{model:r,modelOptions:{reasoningEffort:r!=="opus"&&n==="max"?"high":n,...s?{contextWindow:s}:{}},planMode:!!(e!=null&&e.planMode)}}function Pa(e){var r,s;const t=Ri("codex"),n=(r=e==null?void 0:e.modelOptions)==null?void 0:r.reasoningEffort;return{model:q$((e==null?void 0:e.model)??Jt("codex").defaultModel),modelOptions:{reasoningEffort:Gk(n)?n:Gk(e==null?void 0:e.effort)?e.effort:t.reasoningEffort,fastMode:typeof((s=e==null?void 0:e.modelOptions)==null?void 0:s.fastMode)=="boolean"?e.modelOptions.fastMode:t.fastMode},planMode:!!(e!=null&&e.planMode)}}function Ql(e){var n;const t=Ri("gemini");return{model:(e==null?void 0:e.model)??Jt("gemini").defaultModel,modelOptions:{thinkingMode:s7((n=e==null?void 0:e.modelOptions)==null?void 0:n.thinkingMode)?e.modelOptions.thinkingMode:t.thinkingMode},planMode:!!(e!=null&&e.planMode)}}function Ba(e){return e==null||e.modelOptions,{model:i7((e==null?void 0:e.model)??Jt("cursor").defaultModel),modelOptions:{...Ri("cursor")},planMode:!!(e!=null&&e.planMode)}}function G$(){return{claude:{model:Jt("claude").defaultModel,modelOptions:{...Ri("claude")},planMode:!1},codex:{model:Jt("codex").defaultModel,modelOptions:{...Ri("codex")},planMode:!1},gemini:{model:Jt("gemini").defaultModel,modelOptions:{...Ri("gemini")},planMode:!1},cursor:{model:Jt("cursor").defaultModel,modelOptions:{...Ri("cursor")},planMode:!1}}}function Y$(e){return{claude:za(e==null?void 0:e.claude),codex:Pa(e==null?void 0:e.codex),gemini:Ql(e==null?void 0:e.gemini),cursor:Ba(e==null?void 0:e.cursor)}}function y2(e,t){if(t===void 0){console.info(`[chat-preferences] ${e}`);return}console.info(`[chat-preferences] ${e}`,t)}function Qb(e,t){if(e==="claude"){const r=t.claude;return{provider:"claude",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}if(e==="gemini"){const r=t.gemini;return{provider:"gemini",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}if(e==="cursor"){const r=t.cursor;return{provider:"cursor",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}const n=t.codex;return{provider:"codex",model:n.model,modelOptions:{...n.modelOptions},planMode:n.planMode}}function X$(e,t,n,r){if((e==null?void 0:e.provider)==="claude"){const s=za(e);return{provider:"claude",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if((e==null?void 0:e.provider)==="codex"){const s=Pa(e);return{provider:"codex",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if((e==null?void 0:e.provider)==="gemini"){const s=Ql(e);return{provider:"gemini",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if((e==null?void 0:e.provider)==="cursor"){const s=Ba(e);return{provider:"cursor",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="claude"){const s=za(r==null?void 0:r.claude);return{provider:"claude",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="codex"){const s=Pa(r==null?void 0:r.codex);return{provider:"codex",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="cursor"){const s=Ba(r==null?void 0:r.cursor);return{provider:"cursor",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}return Qb("claude",t)}function Z$(e){const t=Y$(e==null?void 0:e.providerDefaults);return{defaultProvider:K$(e==null?void 0:e.defaultProvider),providerDefaults:t,showProviderIconsInSideTray:(e==null?void 0:e.showProviderIconsInSideTray)===!0,composerState:X$(e==null?void 0:e.composerState,t,e==null?void 0:e.liveProvider,e==null?void 0:e.livePreferences)}}const xi=ro()(io(e=>({defaultProvider:"last_used",providerDefaults:G$(),showProviderIconsInSideTray:!1,composerState:{provider:"claude",model:Jt("claude").defaultModel,modelOptions:{...Ri("claude")},planMode:!1},setDefaultProvider:t=>e({defaultProvider:t}),setShowProviderIconsInSideTray:t=>e({showProviderIconsInSideTray:t}),setProviderDefaultModel:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?za({...r.providerDefaults.claude,model:n}):t==="gemini"?Ql({...r.providerDefaults.gemini,model:n}):t==="cursor"?Ba({...r.providerDefaults.cursor,model:n}):Pa({...r.providerDefaults.codex,model:n})}})),setProviderDefaultModelOptions:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?za({...r.providerDefaults.claude,modelOptions:{...r.providerDefaults.claude.modelOptions,...n}}):t==="gemini"?Ql({...r.providerDefaults.gemini,modelOptions:{...r.providerDefaults.gemini.modelOptions,...n}}):t==="cursor"?Ba({...r.providerDefaults.cursor,modelOptions:{...r.providerDefaults.cursor.modelOptions,...n}}):Pa({...r.providerDefaults.codex,modelOptions:{...r.providerDefaults.codex.modelOptions,...n}})}})),setProviderDefaultPlanMode:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:{...r.providerDefaults[t],planMode:n}}})),setComposerProvider:t=>e(n=>({composerState:{...n.composerState,provider:t}})),setComposerModel:t=>e(n=>n.composerState.provider==="claude"?{composerState:{provider:"claude",model:t,modelOptions:za({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="gemini"?{composerState:{provider:"gemini",model:t,modelOptions:Ql({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="cursor"?{composerState:{provider:"cursor",model:t,modelOptions:Ba({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:t,modelOptions:Pa({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}),setComposerModelOptions:t=>e(n=>n.composerState.provider==="claude"?{composerState:{provider:"claude",model:n.composerState.model,modelOptions:za({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="gemini"?{composerState:{provider:"gemini",model:n.composerState.model,modelOptions:Ql({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:n.composerState.provider==="cursor"?{composerState:{provider:"cursor",model:n.composerState.model,modelOptions:Ba({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:n.composerState.model,modelOptions:Pa({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}),setComposerPlanMode:t=>e(n=>({composerState:{...n.composerState,planMode:t}})),resetComposerFromProvider:t=>e(n=>({composerState:Qb(t,n.providerDefaults)})),initializeComposerForNewChat:()=>e(t=>{if(t.defaultProvider==="last_used")return y2("initializeComposerForNewChat:last_used",{defaultProvider:t.defaultProvider,composerState:t.composerState,providerDefaults:t.providerDefaults}),{composerState:{...t.composerState}};const n=Qb(t.defaultProvider,t.providerDefaults);return y2("initializeComposerForNewChat:explicit_default",{defaultProvider:t.defaultProvider,composerState:n,providerDefaults:t.providerDefaults}),{composerState:n}})}),{name:"chat-preferences",version:5,migrate:e=>Z$(e)})),x2=ro()(io(e=>({order:[],setOrder:t=>e({order:t})}),{name:"project-group-order"})),Om=315,Q$=240,J$=520;function eW(e){return typeof e=="object"&&e!==null}function jp(e){return Number.isFinite(e)?Math.min(J$,Math.max(Q$,Math.round(e))):Om}function tW(e){return eW(e)?{widthPx:jp(typeof e.widthPx=="number"?e.widthPx:Om)}:{widthPx:Om}}const w2=ro()(io(e=>({widthPx:Om,setWidth:t=>e({widthPx:jp(t)})}),{name:"left-sidebar-layout",version:1,migrate:tW}));function kA(e,t){return e&&!t}function nW(e,t,n){if(kA(e,t))return{width:`${jp(n)}px`}}function rW({data:e,completedChatIds:t,activeChatId:n,connectionStatus:r,ready:s,open:o,collapsed:l,isDesktopViewport:u,showMobileOpenButton:h,desktopWidth:d,onOpen:g,onClose:p,onToggle:v,onCollapse:y,onExpand:w,toggleShortcut:S,onResizeDesktopWidth:C,onCreateChat:k,onCreateFeature:R,onRenameFeature:E,onDeleteFeature:M,onSetProjectBrowserState:j,onSetProjectGeneralChatsBrowserState:D,onSetFeatureBrowserState:L,onSetFeatureStage:$,onSetChatFeature:Y,onReorderFeatures:P,folderGroupsEnabled:V,kanbanStatusesEnabled:I,onDeleteChat:W,onRemoveProject:K,onRefreshProviderUsage:q,onOpenProviderLogin:O,providerSettings:H,startingLocalPath:U,updateSnapshot:F,onInstallUpdate:N}){const B=Ki(),X=xd(),A=_.useRef(null),ne=_.useRef(null),ae=_.useRef(0),Z=_.useRef(null),te=_.useRef(null),le=_.useRef({}),me=_.useRef({}),xe=_.useRef({}),[Ae,Re]=_.useState(new Set),[je,Ye]=_.useState(!1),[xt,ft]=_.useState(null),[he,Pe]=_.useState(()=>Date.now()),Ne=x2(Ce=>Ce.order),tt=x2(Ce=>Ce.setOrder),wt=_.useMemo(()=>z0((H==null?void 0:H.settings)??Wn).map(Ce=>Ce.id),[H==null?void 0:H.settings]),$e=_.useMemo(()=>{if(Ne.length===0)return e.projectGroups;const Ce=new Map(e.projectGroups.map(Qe=>[Qe.groupKey,Qe])),Te=Ne.filter(Qe=>Ce.has(Qe)).map(Qe=>Ce.get(Qe)),gt=new Set(Ne);for(const Qe of e.projectGroups)gt.has(Qe.groupKey)||Te.push(Qe);return Te},[e.projectGroups,Ne]),pt=_.useMemo(()=>V?$e:$e.map(Ce=>({...Ce,features:[],generalChats:S2(Ce)})),[V,$e]),Se=_.useCallback(Ce=>tt(Ce),[tt]),De=_.useMemo(()=>pt.reduce((Ce,Te)=>Ce+S2(Te).length,0),[pt]),ce=_.useCallback(Ce=>{Re(Te=>{const gt=new Set(Te);return gt.has(Ce)?gt.delete(Ce):gt.add(Ce),gt})},[]);_.useEffect(()=>{const Ce=le.current,Te=me.current,gt=xe.current;Re(Ot=>{const sn=new Set([...Ot].filter(G=>!G.startsWith("project:")&&!G.startsWith("general:")&&!G.startsWith("feature:")));for(const G of pt)(Ce[G.groupKey]??G.browserState)==="CLOSED"&&sn.add(`project:${G.groupKey}`),(Te[G.groupKey]??G.generalChatsBrowserState)==="CLOSED"&&sn.add(`general:${G.groupKey}`);for(const G of pt)for(const Xe of G.features)(gt[Xe.featureId]??Xe.browserState)==="CLOSED"&&sn.add(`feature:${Xe.featureId}`);return sn});const Qe={...Ce};for(const Ot of pt)Qe[Ot.groupKey]===Ot.browserState&&delete Qe[Ot.groupKey];le.current=Qe;const vt={...Te};for(const Ot of pt)vt[Ot.groupKey]===Ot.generalChatsBrowserState&&delete vt[Ot.groupKey];me.current=vt;const qt={...gt};for(const Ot of pt)for(const sn of Ot.features)qt[sn.featureId]===sn.browserState&&delete qt[sn.featureId];xe.current=qt},[pt]);const be=_.useCallback((Ce,Te)=>{le.current={...le.current,[Ce]:Te},j(Ce,Te)},[j]),Oe=_.useCallback((Ce,Te)=>{me.current={...me.current,[Ce]:Te},D(Ce,Te)},[D]),Ve=_.useCallback((Ce,Te)=>{xe.current={...xe.current,[Ce]:Te},L(Ce,Te)},[L]),we=_.useCallback(Ce=>{X(`/chat/${Ce}`),o&&p()},[X,p,o]),He=xi(Ce=>Ce.showProviderIconsInSideTray),ot=_.useCallback((Ce,Te)=>f.jsx(z7,{chat:Ce,activeChatId:n,nowMs:he,showProviderIcon:He,isCompleted:t.has(Ce.chatId),onSelectChat:we,onDeleteChat:()=>W(Ce),draggable:Te==null?void 0:Te.draggable,onDragStart:Te==null?void 0:Te.onDragStart,onDragEnd:Te==null?void 0:Te.onDragEnd,isTouchDevice:Te==null?void 0:Te.isTouchDevice,onTouchDragMove:Te==null?void 0:Te.onTouchDragMove,onTouchDragEnd:Te==null?void 0:Te.onTouchDragEnd},Ce._id),[n,t,we,he,W,He]);_.useEffect(()=>{const Ce=window.setInterval(()=>{Pe(Date.now())},3e4);return()=>window.clearInterval(Ce)},[]),_.useEffect(()=>{if(je)return document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.body.style.cursor="",document.body.style.userSelect=""}},[je]),_.useEffect(()=>()=>{te.current!==null&&window.cancelAnimationFrame(te.current)},[]),_.useEffect(()=>{!n||!ne.current||requestAnimationFrame(()=>{const Ce=ne.current,Te=Ce==null?void 0:Ce.querySelector(`[data-chat-id="${n}"]`);if(!Te||!Ce)return;const gt=Te.getBoundingClientRect(),Qe=Ce.getBoundingClientRect();if(gt.top<Qe.top+38){const vt=gt.top-Qe.top+Ce.scrollTop;Ce.scrollTo({top:vt-38,behavior:"smooth"})}else if(gt.bottom>Qe.bottom){const vt=gt.top+gt.height/2-Qe.top+Ce.scrollTop,qt=Ce.clientHeight/2;Ce.scrollTo({top:vt-qt,behavior:"smooth"})}})},[n,De]);const rt=De>0,Le=B.pathname==="/",St=B.pathname.startsWith("/settings"),at=Le||St,vn=r==="connecting"||!s,tn=vn?"Connecting":r==="connected"?"Connected":"Disconnected",Nn=r==="connected"?"bg-emerald-500":"bg-amber-500",xr=(F==null?void 0:F.updateAvailable)===!0,Kn=F?F.latestVersion===`${F.currentVersion}-dev`:!1,jt=(F==null?void 0:F.status)==="updating"||(F==null?void 0:F.status)==="restart_pending",Fe=nW(u,l,xt??d),ct=kA(u,l),st=S&&S.length>0?`Toggle sidebar (${S[0]})`:"Toggle sidebar",mt=t.size>0,an=_.useCallback(Ce=>{var vt;if(!ct)return;Ce.preventDefault(),Ye(!0),ae.current=((vt=A.current)==null?void 0:vt.getBoundingClientRect().left)??0,ft(d);const Te=qt=>{Z.current=jp(qt-ae.current),te.current===null&&(te.current=window.requestAnimationFrame(()=>{te.current=null,Z.current!==null&&ft(Z.current)}))};Te(Ce.clientX);const gt=qt=>{Te(qt.clientX)},Qe=()=>{Ye(!1),te.current!==null&&(window.cancelAnimationFrame(te.current),te.current=null);const qt=Z.current??d;Z.current=null,ft(null),C(qt),window.removeEventListener("pointermove",gt),window.removeEventListener("pointerup",Qe),window.removeEventListener("pointercancel",Qe)};window.addEventListener("pointermove",gt),window.addEventListener("pointerup",Qe),window.addEventListener("pointercancel",Qe)},[d,C,ct]);return f.jsxs(f.Fragment,{children:[!o&&h&&f.jsxs(Je,{variant:"ghost",size:"icon",className:"relative fixed top-3 left-3 z-50 md:hidden",onClick:g,children:[f.jsx(wM,{className:"h-5 w-5"}),mt&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),l&&at&&f.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("div",{className:"relative",children:[f.jsx(Ku,{className:"size-6 text-logo"}),mt&&f.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),f.jsx(Je,{variant:"ghost",size:"icon",onClick:w,title:"Expand sidebar",children:f.jsx(Cb,{className:"h-5 w-5"})})]})}),f.jsxs("div",{ref:A,"data-sidebar":"open",className:pe("fixed inset-0 z-50 bg-background dark:bg-card backdrop-blur-2xl flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:bg-background md:dark:bg-card md:backdrop-blur-none md:flex-none md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",o?"flex":"hidden md:flex",l&&"md:hidden"),style:Fe,children:[ct?f.jsx("div",{role:"separator","aria-label":"Resize sidebar","aria-orientation":"vertical",className:pe("hidden md:flex absolute top-0 right-0 z-20 h-full w-3 translate-x-1/2 cursor-col-resize items-center justify-center",je&&"after:bg-logo/70"),onPointerDown:an,children:f.jsx("span",{className:"h-14 w-px rounded-full bg-border transition-colors"})}):null,f.jsxs("div",{className:" pl-3 pr-[7px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("button",{type:"button",onClick:y,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:[f.jsx(Ku,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-collapse:opacity-0 group-hover/sidebar-collapse:scale-0"}),f.jsx(Cb,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-collapse:opacity-100 group-hover/sidebar-collapse:scale-80 hover:opacity-50"})]}),f.jsx(Ku,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),f.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:Mn})]}),f.jsxs("div",{className:"flex items-center",children:[Kn?f.jsx("span",{className:"mr-1 inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-bold tracking-wider text-muted-foreground",title:"Development build",children:"DEV"}):xr?f.jsxs(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:N,disabled:jt,title:F!=null&&F.latestVersion?`Update to ${F.latestVersion}`:"Update Kaizen",children:[jt?f.jsx(oi,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,f.jsx(Je,{variant:"ghost",size:"icon",onClick:()=>{X("/"),p()},className:"size-10 rounded-lg",title:"New project",children:f.jsx(ip,{className:"size-4"})}),f.jsx(Je,{variant:"ghost",size:"icon",onClick:()=>v(u),title:st,"aria-label":st,children:f.jsx(Xs,{className:"h-5 w-5"})})]})]}),f.jsx("div",{ref:ne,"data-sidebar-scroll":!0,className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",style:{WebkitOverflowScrolling:"touch"},children:f.jsxs("div",{className:"p-[7px]",children:[!rt&&vn?f.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(Ce=>f.jsxs("div",{className:"space-y-2 animate-pulse",children:[f.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),f.jsx("div",{className:"space-y-1",children:[0,1,2].map(Te=>f.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[f.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),f.jsx("div",{className:pe("h-3.5 rounded bg-muted",Te===0?"w-32":Te===1?"w-40":"w-28")})]},Te))})]},Ce))}):null,!rt&&!vn&&e.projectGroups.length===0?f.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,f.jsx(B$,{projectGroups:pt,onReorderGroups:Se,collapsedSections:Ae,onToggleSection:ce,onSetProjectBrowserState:be,onSetProjectGeneralChatsBrowserState:Oe,onSetFeatureBrowserState:Ve,renderChatRow:ot,onNewLocalChat:k,onCreateFeature:V?R:void 0,onRenameFeature:E,onDeleteFeature:M,onSetFeatureStage:I?$:void 0,onSetChatFeature:Y,onReorderFeatures:P,onRemoveProject:K,isConnected:r==="connected",startingLocalPath:U,folderGroupsEnabled:V,kanbanStatusesEnabled:I})]})}),f.jsxs("div",{className:"border-t border-border p-2",children:[f.jsx(V$,{providerUsage:e.providerUsage,visibleProviders:wt,onRefreshProviderUsage:q,onOpenProviderLogin:O}),f.jsx("button",{type:"button",onClick:()=>{X("/settings/general"),p()},className:pe("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",St?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:f.jsxs("div",{className:"flex items- justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(jI,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("span",{className:"text-sm",children:"Settings"})]}),f.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[f.jsx("span",{children:tn}),vn?f.jsx(oi,{className:"h-2 w-2 animate-spin"}):f.jsx("span",{className:pe("h-2 w-2 rounded-full",Nn)})]})]})})]})]})]})}function S2(e){return[...e.features.flatMap(t=>t.chats),...e.generalChats]}const EA={submitChatMessage:"Submit Chat Message",toggleProjectsSidebar:"Toggle Projects Sidebar",toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal"};function M_(e){return(e??[]).join(", ")}function ka(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const iW=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function sW(e,t){const n=oW(e);return n?t.key.toLowerCase()===n.key&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function Oa(e,t,n){return((e==null?void 0:e.bindings[t])??os[t]).some(s=>sW(s,n))}function cx(e){return{bindings:{submitChatMessage:(e==null?void 0:e.bindings.submitChatMessage)??os.submitChatMessage,toggleProjectsSidebar:(e==null?void 0:e.bindings.toggleProjectsSidebar)??os.toggleProjectsSidebar,toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??os.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??os.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??os.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??os.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??os.addSplitTerminal},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function oW(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(),o=iW.get(s);if(o==="ctrl"){n.ctrl=!0;continue}if(o==="meta"){n.meta=!0;continue}if(o==="alt"){n.alt=!0;continue}if(o==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=s}return n.key?n:null}function aW(e){if(!e||typeof e!="object")return!1;const t=e;if(t.isContentEditable===!0)return!0;if(typeof t.tagName=="string"){const n=t.tagName.toLowerCase();if(n==="input"||n==="textarea"||n==="select")return!0}return typeof t.closest=="function"?!!t.closest('input, textarea, select, [contenteditable], [contenteditable="true"]'):!1}function lW(){const[e,t]=_.useState(()=>{if(typeof window>"u")return!1;const n=navigator.standalone===!0,r=window.matchMedia("(display-mode: standalone)").matches;return n||r});return _.useEffect(()=>{const n=window.matchMedia("(display-mode: standalone)"),r=s=>{t(s.matches||navigator.standalone===!0)};return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const cW=ro()(io((e,t)=>({drafts:{},setDraft:(n,r)=>e(s=>{if(!r){const{[n]:o,...l}=s.drafts;return{drafts:l}}return{drafts:{...s.drafts,[n]:r}}}),clearDraft:n=>e(r=>{const{[n]:s,...o}=r.drafts;return{drafts:o}}),getDraft:n=>t().drafts[n]??""}),{name:"chat-input-drafts"}));async function uW(e){const t=await new Promise((n,r)=>{const s=new FileReader;s.onload=()=>{if(typeof s.result=="string"){n(s.result);return}r(new Error("Failed to read image attachment"))},s.onerror=()=>r(s.error??new Error("Failed to read image attachment")),s.readAsDataURL(e)});return{type:"image",name:e.name,mimeType:e.type,sizeBytes:e.size,dataUrl:t}}function C2(e,t){if(t===void 0){console.info(`[ChatInput] ${e}`);return}console.info(`[ChatInput] ${e}`,t)}function Ws(e,t,n,r,s){return e==="claude"?t.provider==="claude"?{provider:"claude",model:r??t.model,modelOptions:{...t.modelOptions},planMode:s??t.planMode}:{provider:"claude",model:r??n.claude.model,modelOptions:{...n.claude.modelOptions},planMode:s??n.claude.planMode}:e==="gemini"?t.provider==="gemini"?{provider:"gemini",model:r??t.model,modelOptions:{...t.modelOptions},planMode:s??t.planMode}:{provider:"gemini",model:r??n.gemini.model,modelOptions:{...n.gemini.modelOptions},planMode:s??n.gemini.planMode}:e==="cursor"?t.provider==="cursor"?{provider:"cursor",model:r??t.model,modelOptions:{...t.modelOptions},planMode:s??t.planMode}:{provider:"cursor",model:r??n.cursor.model,modelOptions:{...n.cursor.modelOptions},planMode:s??n.cursor.planMode}:t.provider==="codex"?{provider:"codex",model:r??t.model,modelOptions:{...t.modelOptions},planMode:s??t.planMode}:{provider:"codex",model:r??n.codex.model,modelOptions:{...n.codex.modelOptions},planMode:s??n.codex.planMode}}function dW(e,t,n,r){return r&&e.key==="Enter"?!1:Oa(t,"submitChatMessage",e)&&!n&&!e.isComposing}function hW(e){if(!e.providerLocked)return{composerPlanMode:e.planMode,lockedComposerState:e.lockedComposerState};const t=e.lockedComposerState??Ws(e.selectedProvider,e.composerState,e.providerDefaults);return{composerPlanMode:e.composerState.planMode,lockedComposerState:{...t,planMode:e.planMode}}}const fW=_.forwardRef(function({onSubmit:t,onCancel:n,disabled:r,canCancel:s,chatId:o,activeProvider:l,activeModel:u,activePlanMode:h,availableProviders:d,keybindings:g},p){const{getDraft:v,setDraft:y,clearDraft:w}=cW(),{composerState:S,providerDefaults:C,setComposerModel:k,setComposerModelOptions:R,setComposerPlanMode:E,resetComposerFromProvider:M}=xi(),[j,D]=_.useState(()=>o?v(o):""),[L,$]=_.useState([]),[Y,P]=_.useState(null),[V,I]=_.useState(!1),W=_.useRef(null),K=_.useRef(null),q=lW(),O=Dp("(pointer: coarse)"),[H,U]=_.useState(()=>l?Ws(l,S,C,u,h):null),F=l!==null,N=!F&&d.length===0,B=F?H??Ws(l,S,C,u,h):S,X=F?l:S.provider,A=d.find(he=>he.id===X)??Jt(X),ne=(A==null?void 0:A.supportsPlanMode)??!1,ae=r||N,Z=_.useCallback(()=>{const he=W.current;he&&(he.style.height="auto",he.style.height=`${he.scrollHeight}px`)},[]),te=_.useCallback(he=>{if(W.current=he,!!p){if(typeof p=="function"){p(he);return}p.current=he}},[p]);_.useEffect(()=>{Z()},[j,Z]),_.useEffect(()=>(window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)),[Z]),_.useEffect(()=>{var he;(he=W.current)==null||he.focus()},[o]),_.useEffect(()=>()=>{for(const he of L)URL.revokeObjectURL(he.previewUrl)},[L]),_.useEffect(()=>{if(l===null){U(null);return}U(Ws(l,S,C,u,h))},[u,h,l,o,S,C]),_.useEffect(()=>{F||d.length!==0&&(d.some(he=>he.id===S.provider)||M(d[0].id))},[d,S.provider,F,M]),_.useEffect(()=>{C2("resolved provider state",{chatId:o??null,activeProvider:l,composerProvider:S.provider,composerModel:S.model,effectiveProvider:B.provider,effectiveModel:B.model,selectedProvider:X,providerLocked:F,lockedComposerProvider:(H==null?void 0:H.provider)??null})},[l,o,S.model,S.provider,H==null?void 0:H.provider,F,B.model,B.provider,X]);function le(he){if(F){U(Pe=>{const Ne=Pe??Ws(X,S,C);return Ne.provider==="claude"?{...Ne,modelOptions:{...Ne.modelOptions,reasoningEffort:he}}:Ne.provider==="gemini"?Ne:{...Ne,modelOptions:{...Ne.modelOptions,reasoningEffort:he}}});return}if(X==="claude"){R({reasoningEffort:he});return}R({reasoningEffort:he})}function me(he){if(F){U(Pe=>{const Ne=Pe??Ws(X,S,C);return Ne.provider!=="gemini"?Ne:{...Ne,modelOptions:{...Ne.modelOptions,thinkingMode:he}}});return}X==="gemini"&&R({thinkingMode:he})}function xe(he){if(F){U(Pe=>{const Ne=Pe??Ws(X,S,C);return Ne.provider!=="claude"?Ne:{...Ne,modelOptions:{...Ne.modelOptions,contextWindow:he}}});return}X==="claude"&&R({contextWindow:he})}function Ae(he){const Pe=hW({providerLocked:F,planMode:he,selectedProvider:X,composerState:S,providerDefaults:C,lockedComposerState:H});Pe.lockedComposerState!==H&&U(Pe.lockedComposerState),Pe.composerPlanMode!==S.planMode&&E(Pe.composerPlanMode)}function Re(){Ae(!B.planMode)}async function je(){if(ae||!j.trim()&&L.length===0)return;const he=j,Pe=L;let Ne;B.provider==="claude"?Ne={claude:{...B.modelOptions}}:B.provider==="gemini"?Ne={gemini:{...B.modelOptions}}:Ne={codex:{...B.modelOptions}};const tt={provider:X,model:B.model,modelOptions:Ne,planMode:ne?B.planMode:!1};C2("submit settings",{chatId:o??null,activeProvider:l,composerProvider:B.provider,submitOptions:tt}),D(""),P(null),o&&w(o),W.current&&(W.current.style.height="auto");try{await t({text:he.trim(),attachments:Pe.length?await Promise.all(Pe.map(wt=>uW(wt.file))):void 0},tt);for(const wt of Pe)URL.revokeObjectURL(wt.previewUrl);$([])}catch(wt){console.error("[ChatInput] Submit failed:",wt),D(he),o&&y(o,he)}}const Ye=_.useCallback(he=>{if(ae)return;const Pe=he.filter(Ne=>Ne.type.startsWith("image/"));if(Pe.length===0){P("Only PNG, JPEG, WEBP, and GIF images are supported.");return}$(Ne=>{const tt=[...Ne];let wt=null;for(const $e of Pe){if(!Qk.includes($e.type)){wt=`Unsupported image type: ${$e.type||"unknown"}`;continue}if($e.size<=0||$e.size>h7){wt=`${$e.name} is empty or larger than 10 MB.`;continue}if(tt.length>=Zk){wt=`You can attach up to ${Zk} images per message.`;break}tt.push({id:Gf(),file:$e,name:$e.name||"image",mimeType:$e.type,sizeBytes:$e.size,previewUrl:URL.createObjectURL($e)})}return P(wt),tt})},[ae]),xt=_.useCallback(he=>{$(Pe=>{const Ne=Pe.find(tt=>tt.id===he);return Ne&&URL.revokeObjectURL(Ne.previewUrl),Pe.filter(tt=>tt.id!==he)}),P(null)},[]);function ft(he){if(he.key==="Tab"&&!he.shiftKey){he.preventDefault(),t8(W.current,document);return}if(he.key==="Tab"&&he.shiftKey&&ne){he.preventDefault(),Re();return}if(he.key==="Escape"&&s){he.preventDefault(),n==null||n();return}dW(he.nativeEvent,g,s,O)&&(he.preventDefault(),je())}return f.jsxs("div",{className:pe("p-3 pt-0 px-2 md:px-3 md:pb-2 flex flex-col items-center",q&&"px-3"),style:q?{paddingBottom:"var(--app-composer-bottom-padding)"}:void 0,children:[f.jsxs("div",{className:"flex flex-col items-center relative z-10 w-full max-w-[840px] mx-auto",children:[f.jsxs("div",{className:pe("w-full border dark:bg-card/40 bg-background/95 backdrop-blur-lg border-border rounded-[29px] px-2 pb-2 transition-colors relative z-10",V&&"border-foreground/40 bg-muted/30"),onDragEnter:he=>{r||!he.dataTransfer.types.includes("Files")||(he.preventDefault(),I(!0))},onDragOver:he=>{r||!he.dataTransfer.types.includes("Files")||(he.preventDefault(),he.dataTransfer.dropEffect="copy",I(!0))},onDragLeave:he=>{if(!he.dataTransfer.types.includes("Files"))return;he.preventDefault();const Pe=he.relatedTarget;Pe instanceof Node&&he.currentTarget.contains(Pe)||I(!1)},onDrop:he=>{var Pe;r||!he.dataTransfer.types.includes("Files")||(he.preventDefault(),I(!1),Ye(Array.from(he.dataTransfer.files)),(Pe=W.current)==null||Pe.focus())},children:[f.jsx("input",{ref:K,type:"file",accept:Qk.join(","),multiple:!0,className:"hidden",onChange:he=>{Ye(Array.from(he.target.files??[])),he.target.value=""}}),L.length?f.jsx("div",{className:"grid grid-cols-2 gap-2 px-2 pt-2 sm:grid-cols-3",children:L.map(he=>f.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/80 bg-background/80",children:[f.jsx("img",{src:he.previewUrl,alt:he.name,className:"h-28 w-full object-cover"}),f.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 px-2 py-1.5",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"truncate text-xs text-foreground",children:he.name}),f.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[Math.max(1,Math.round(he.sizeBytes/1024))," KB"]})]}),f.jsx(Je,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>xt(he.id),disabled:ae,children:f.jsx(Xs,{className:"h-3.5 w-3.5"})})]})]},he.id))}):null,f.jsxs("div",{className:"flex items-end gap-2",children:[f.jsx(Je,{type:"button",variant:"ghost",size:"icon",className:"mt-1.5 md:mt-0 h-10 w-10 shrink-0 rounded-full",disabled:ae||s,onClick:()=>{var he;return(he=K.current)==null?void 0:he.click()},children:f.jsx(kI,{className:"h-4.5 w-4.5"})}),f.jsx(cp,{ref:te,placeholder:"Build something...",value:j,autoFocus:!0,[x0]:"",rows:1,onChange:he=>{D(he.target.value),o&&y(o,he.target.value),Z()},onPaste:he=>{const Pe=Array.from(he.clipboardData.files);Pe.some(Ne=>Ne.type.startsWith("image/"))&&(he.preventDefault(),Ye(Pe))},onKeyDown:ft,disabled:ae,className:"flex-1 text-base py-2 md:py-3.75 px-1 md:px-2 resize-none max-h-[200px] outline-none bg-transparent border-0 shadow-none"}),f.jsx(Je,{type:"button",onPointerDown:he=>{he.preventDefault(),s?n==null||n():!ae&&(j.trim()||L.length>0)&&je()},disabled:!s&&(ae||!j.trim()&&L.length===0),size:"icon",className:"flex-shrink-0 bg-slate-600 text-white dark:bg-white dark:text-slate-900 rounded-full cursor-pointer h-10 w-10 md:h-11 md:w-11 md:mb-0.5 -mr-0.5 md:mr-0 touch-manipulation disabled:bg-white/60 disabled:text-slate-700",children:s?f.jsx("div",{className:"w-3 h-3 md:w-4 md:h-4 rounded-xs bg-current"}):f.jsx(p6,{className:"h-5 w-5 md:h-6 md:w-6"})})]})]}),f.jsxs("div",{className:pe("border-x border-b border-t-0 border-border rounded-b-[20px] px-3 py-1.5 transition-colors relative z-20 -mt-[1px] flex-shrink-0 shadow-sm","dark:bg-card/40 bg-background/95 backdrop-blur-lg",V&&"border-foreground/40 bg-muted/30"),children:[f.jsx("div",{className:"absolute top-0 left-0 right-0 h-[1px] bg-background"}),f.jsx(zu,{availableProviders:d,selectedProvider:X,disabled:ae,providerLocked:F,model:B.model,modelOptions:B.modelOptions,onProviderChange:he=>{F||M(he)},onModelChange:(he,Pe)=>{if(F){U(Ne=>({...Ne??Ws(X,S,C),model:Pe}));return}k(Pe)},onClaudeReasoningEffortChange:he=>le(he),onClaudeContextWindowChange:he=>xe(he),onCodexReasoningEffortChange:he=>le(he),onGeminiThinkingModeChange:he=>me(he),onCodexFastModeChange:he=>{if(F){U(Pe=>{const Ne=Pe??Ws(X,S,C);return Ne.provider!=="codex"?Ne:{...Ne,modelOptions:{...Ne.modelOptions,fastMode:he}}});return}R({fastMode:he})},planMode:B.planMode,onPlanModeChange:Ae,includePlanMode:ne,className:"w-full relative z-10"}),N?f.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No active providers are available. Re-enable one in Settings."}):null]})]}),Y?f.jsx("div",{className:"max-w-[840px] mx-auto mt-2 px-2 text-xs text-destructive relative z-10",children:Y}):null]})}),mW=_.memo(fW);function k2({label:e,isCurrent:t,icon:n,onClick:r,className:s}){return f.jsxs("button",{onClick:r,className:pe("w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left text-sm transition-colors hover:bg-muted",s),children:[f.jsx("span",{className:"flex-shrink-0 w-4 flex items-center justify-center",children:n??(t?f.jsx($i,{className:"h-3.5 w-3.5 text-muted-foreground"}):null)}),f.jsx("span",{className:"flex-1 min-w-0 truncate",children:e}),t&&f.jsx("span",{className:"flex-shrink-0 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full border border-border",children:"current"})]})}function pW({projectId:e,socket:t}){const[n,r]=_.useState({phase:"loading"}),[s,o]=_.useState(!1),[l,u]=_.useState(""),h=_.useDeferredValue(l),[d,g]=_.useTransition(),p=_.useRef(null),v=_.useCallback(async()=>{try{const R=await t.command({type:"git.getBranches",projectId:e});if(!R.isRepo){r({phase:"not-a-repo"});return}r({phase:"ready",currentBranch:R.currentBranch,branches:R.branches})}catch(R){r({phase:"error",message:R instanceof Error?R.message:String(R)})}},[e,t]);_.useEffect(()=>{v()},[v]),_.useEffect(()=>{s&&(u(""),v())},[s,v]),_.useEffect(()=>{if(s&&n.phase==="ready"){const R=setTimeout(()=>{var E;return(E=p.current)==null?void 0:E.focus()},50);return()=>clearTimeout(R)}},[s,n.phase]);function y(R){n.phase!=="ready"||R===n.currentBranch||(o(!1),g(async()=>{try{await t.command({type:"git.switchBranch",projectId:e,branchName:R}),await v()}catch(E){r({phase:"error",message:E instanceof Error?E.message:String(E)})}}))}function w(R){R.trim()&&(o(!1),g(async()=>{try{await t.command({type:"git.createBranch",projectId:e,branchName:R.trim(),checkout:!0}),await v()}catch(E){r({phase:"error",message:E instanceof Error?E.message:String(E)})}}))}if(n.phase==="not-a-repo")return null;const S=n.phase==="ready"?n.branches.filter(R=>R.toLowerCase().includes(h.toLowerCase())):[],C=n.phase==="ready"&&n.branches.some(R=>R===h.trim()),k=h.trim().length>0&&!C;return f.jsxs(kN,{open:s,onOpenChange:o,children:[f.jsx(EN,{asChild:!0,children:f.jsxs(Je,{variant:"ghost",size:"icon",className:pe("h-10 w-auto max-w-[180px] gap-1.5 rounded-lg border border-border/0 px-3 text-sm text-muted-foreground",n.phase==="error"&&"text-destructive"),children:[d?f.jsx(oi,{className:"h-4.5 w-4.5 flex-shrink-0 animate-spin"}):f.jsx(oI,{className:"h-4.5 w-4.5 flex-shrink-0"}),n.phase==="ready"&&f.jsx("span",{className:"truncate",children:n.currentBranch??"HEAD detached"}),n.phase==="error"&&f.jsx("span",{className:"truncate",children:"git error"})]})}),f.jsxs(I0,{align:"end",className:"w-64 p-0 overflow-hidden",children:[f.jsx("div",{className:"border-b border-border",children:f.jsx("input",{ref:p,value:l,onChange:R=>u(R.target.value),placeholder:"Search or create branch...",className:"w-full px-3 py-2 text-sm bg-transparent outline-none placeholder:text-muted-foreground",onKeyDown:R=>{R.key==="Enter"&&k&&w(l)}})}),f.jsxs("div",{className:"max-h-[220px] overflow-y-auto p-1",children:[n.phase==="loading"&&f.jsx("div",{className:"flex items-center justify-center py-6 text-muted-foreground",children:f.jsx(oi,{className:"h-4 w-4 animate-spin"})}),n.phase==="error"&&f.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:n.message}),n.phase==="ready"&&f.jsxs(f.Fragment,{children:[S.length===0&&!k&&f.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No branches match"}),S.map(R=>f.jsx(k2,{label:R,isCurrent:R===n.currentBranch,onClick:()=>y(R)},R)),k&&f.jsx(k2,{label:`Create branch "${h.trim()}"`,icon:f.jsx(ip,{className:"h-3.5 w-3.5 text-muted-foreground"}),onClick:()=>w(l),className:"text-muted-foreground border-t border-border/50 mt-1 pt-2 rounded-none"})]})]})]})]})}const RA=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:pe("bg-card text-card-foreground",e),...t}));RA.displayName="Card";const TA=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:pe("flex flex-col space-y-1.5 p-2",e),...t}));TA.displayName="CardHeader";const gW=_.forwardRef(({className:e,...t},n)=>f.jsx("h3",{ref:n,className:pe("text-2xl font-semibold leading-none tracking-tight",e),...t}));gW.displayName="CardTitle";const vW=_.forwardRef(({className:e,...t},n)=>f.jsx("p",{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));vW.displayName="CardDescription";const MA=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:pe("p-6 pt-0",e),...t}));MA.displayName="CardContent";const _W=_.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:pe("flex items-center p-6 pt-0",e),...t}));_W.displayName="CardFooter";function bW({sidebarCollapsed:e,hasCompletedChats:t=!1,onOpenSidebar:n,onExpandSidebar:r,onNewChat:s,usage:o,localPath:l,embeddedTerminalVisible:u=!1,onToggleEmbeddedTerminal:h,rightSidebarVisible:d=!1,onToggleRightSidebar:g,onOpenExternal:p,editorLabel:v="Editor",projectId:y,socket:w,finderShortcut:S,editorShortcut:C,terminalShortcut:k,rightSidebarShortcut:R}){const E=j=>j==null?"Unavailable":`${Math.round(j)}%`,M=o!=null&&o.warnings.includes("context_critical")||o!=null&&o.warnings.includes("rate_critical")?"text-amber-300 bg-amber-500/10":o!=null&&o.warnings.includes("context_warning")||o!=null&&o.warnings.includes("rate_warning")?"text-amber-100 bg-amber-500/5":"text-muted-foreground bg-background/70";return f.jsx(TA,{className:pe("absolute top-0 md:top-2 left-0 right-0 z-10 px-2.5 border-border/0 md:pb-0 flex items-center justify-center",e?"md:px-2.5 md:pr-4":"md:px-4 md:pr-4"," bg-gradient-to-b from-background"),children:f.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[f.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 md:bg-background/80 md:dark:bg-card/40 md:backdrop-blur-lg md:border md:border-border md:rounded-[20px] md:p-1",children:[f.jsxs(Je,{variant:"ghost",size:"icon",className:"relative md:hidden",onClick:n,children:[f.jsx(wM,{className:"h-5 w-5"}),t&&f.jsx("span",{className:"absolute top-0.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background"})]}),e&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"relative flex items-center justify-center w-[40px] h-[40px]",children:[f.jsx(Ku,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"}),t&&f.jsx("span",{className:"absolute top-1.5 right-0.5 size-2.5 rounded-full bg-emerald-400 ring-2 ring-background hidden md:block"})]}),f.jsx(Je,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:r,title:"Expand sidebar",children:f.jsx(Cb,{className:"size-4.5"})})]}),f.jsx(Je,{variant:"ghost",size:"icon",onClick:s,title:"Compose",children:f.jsx(_0,{className:"size-4.5"})})]}),f.jsx("div",{className:"flex-1 min-w-0"}),f.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 md:bg-background/80 md:dark:bg-card/40 md:backdrop-blur-lg md:border md:border-border md:rounded-[20px] md:p-1",children:[y?f.jsxs("div",{className:"hidden md:flex items-center gap-1 mr-1",children:[f.jsxs(ds,{children:[(o==null?void 0:o.contextUsedPercent)!==null&&(o==null?void 0:o.contextUsedPercent)!==void 0?f.jsx(hs,{asChild:!0,children:f.jsxs("div",{className:pe("px-2.5 py-1 rounded-lg text-[14px] font-medium",M),children:["Context: ",E(o.contextUsedPercent)]})}):null,f.jsx(Ii,{side:"bottom",children:(o==null?void 0:o.contextWindowTokens)!==null&&(o==null?void 0:o.contextWindowTokens)!==void 0&&(o==null?void 0:o.threadTokens)!==null&&(o==null?void 0:o.threadTokens)!==void 0?`${Math.round(o.threadTokens).toLocaleString()} of ${Math.round(o.contextWindowTokens).toLocaleString()} tokens`:"Context window unavailable for this chat yet"})]}),((o==null?void 0:o.sessionLimitUsedPercent)??0)>=75?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsxs("div",{className:pe("px-2.5 py-1 rounded-lg border text-[11px] font-medium",M),children:["Session: ",E(o==null?void 0:o.sessionLimitUsedPercent)]})}),f.jsx(Ii,{side:"bottom",children:o!=null&&o.rateLimitResetAt?`Resets ${new Date(o.rateLimitResetAt).toLocaleString()}`:"No reset time available yet"})]}):null]}):null,y?f.jsx(pW,{projectId:y,socket:w}):null,l&&(p||h)&&f.jsxs(f.Fragment,{children:[p?f.jsxs(Ou,{children:[f.jsx(Lu,{asChild:!0,children:f.jsx(Je,{variant:"ghost",size:"icon",onClick:()=>p("open_finder"),title:"Open in Finder",className:"border border-border/0",children:f.jsx(yM,{className:"h-4.5 w-4.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:S})]}):null,h?f.jsxs(Ou,{children:[f.jsx(Lu,{asChild:!0,children:f.jsx(Je,{variant:"ghost",size:"icon",onClick:h,className:pe("border border-border/0",u&&"text-white"),children:f.jsx(b0,{className:"h-4.5 w-4.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:k})]}):null,p?f.jsxs(Ou,{children:[f.jsx(Lu,{asChild:!0,children:f.jsx(Je,{variant:"ghost",size:"icon",onClick:()=>p("open_editor"),title:`Open in ${v}`,className:"border border-border/0",children:f.jsx(bM,{className:"h-4.5 w-4.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:C})]}):null]}),g?f.jsxs(Ou,{children:[f.jsx(Lu,{asChild:!0,children:f.jsx(Je,{variant:"ghost",size:"icon",onClick:g,className:pe("border border-border/0",d&&"text-white"),children:f.jsx(SI,{className:"h-4.5 w-4.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:R})]}):null]})]})})}function E2({onClose:e,className:t}){return f.jsx("div",{className:pe("h-full min-h-0 bg-background md:min-w-[300px] md:border-l md:border-border",t),children:f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[f.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[f.jsx("div",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:"Diffs"}),f.jsx("button",{type:"button","aria-label":"Close right sidebar",onClick:e,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:f.jsx(Xs,{className:"h-4 w-4"})})]}),f.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center",children:f.jsx("p",{className:"text-sm text-muted-foreground",children:"diffs coming soon"})})]})})}function yW(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function xW(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function wW(e){return e/100*window.innerHeight}function SW(e){return e/100*window.innerWidth}function CW(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 Iu({groupSize:e,panelElement:t,styleProp:n}){let r;const[s,o]=CW(n);switch(o){case"%":{r=s/100*e;break}case"px":{r=s;break}case"rem":{r=xW(t,s);break}case"em":{r=yW(t,s);break}case"vh":{r=wW(s);break}case"vw":{r=SW(s);break}}return r}function $r(e){return parseFloat(e.toFixed(3))}function hc({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,s)=>(r+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,r),0)}function Jb(e){const{panels:t}=e,n=hc({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:s,panelConstraints:o}=r;let l=0;if(o.collapsedSize!==void 0){const g=Iu({groupSize:n,panelElement:s,styleProp:o.collapsedSize});l=$r(g/n*100)}let u;if(o.defaultSize!==void 0){const g=Iu({groupSize:n,panelElement:s,styleProp:o.defaultSize});u=$r(g/n*100)}let h=0;if(o.minSize!==void 0){const g=Iu({groupSize:n,panelElement:s,styleProp:o.minSize});h=$r(g/n*100)}let d=100;if(o.maxSize!==void 0){const g=Iu({groupSize:n,panelElement:s,styleProp:o.maxSize});d=$r(g/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:u,disabled:o.disabled,minSize:h,maxSize:d,panelId:r.id}})}function en(e,t="Assertion error"){if(!e)throw Error(t)}function ey(e,t){return Array.from(t).sort(e==="horizontal"?kW:EW)}function kW(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function EW(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function NA(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function AA(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 RW({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let s,o=Number.MAX_VALUE;for(const l of t){const{x:u,y:h}=AA(r,l),d=e==="horizontal"?u:h;d<o&&(o=d,s=l)}return en(s,"No rect found"),s}let Rf;function TW(){return Rf===void 0&&(typeof matchMedia=="function"?Rf=!!matchMedia("(pointer:coarse)").matches:Rf=!1),Rf}function DA(e){const{element:t,orientation:n,panels:r,separators:s}=e,o=ey(n,Array.from(t.children).filter(NA).map(w=>({element:w}))).map(({element:w})=>w),l=[];let u=!1,h=!1,d=-1,g=-1,p=0,v,y=[];{let w=-1;for(const S of o)S.hasAttribute("data-panel")&&(w++,S.ariaDisabled===null&&(p++,d===-1&&(d=w),g=w))}if(p>1){let w=-1;for(const S of o)if(S.hasAttribute("data-panel")){w++;const C=r.find(k=>k.element===S);if(C){if(v){const k=v.element.getBoundingClientRect(),R=S.getBoundingClientRect();let E;if(h){const M=n==="horizontal"?new DOMRect(k.right,k.top,0,k.height):new DOMRect(k.left,k.bottom,k.width,0),j=n==="horizontal"?new DOMRect(R.left,R.top,0,R.height):new DOMRect(R.left,R.top,R.width,0);switch(y.length){case 0:{E=[M,j];break}case 1:{const D=y[0],L=RW({orientation:n,rects:[k,R],targetRect:D.element.getBoundingClientRect()});E=[D,L===k?j:M];break}default:{E=y;break}}}else y.length?E=y:E=[n==="horizontal"?new DOMRect(k.right,R.top,R.left-k.right,R.height):new DOMRect(R.left,k.bottom,R.width,R.top-k.bottom)];for(const M of E){let j="width"in M?M:M.element.getBoundingClientRect();const D=TW()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(j.width<D){const $=D-j.width;j=new DOMRect(j.x-$/2,j.y,j.width+$,j.height)}if(j.height<D){const $=D-j.height;j=new DOMRect(j.x,j.y-$/2,j.width,j.height+$)}const L=w<=d||w>g;!u&&!L&&l.push({group:e,groupSize:hc({group:e}),panels:[v,C],separator:"width"in M?void 0:M,rect:j}),u=!1}}h=!1,v=C,y=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(u=!0);const C=s.find(k=>k.element===S);C?y.push(C):(v=void 0,y=[])}else h=!0}return l}var qo,ZR;let jA=(ZR=class{constructor(){zC(this,qo,{})}addListener(t,n){const r=bu(this,qo)[t];return r===void 0?bu(this,qo)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=bu(this,qo)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let s=!1,o=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){o===null&&(s=!0,o=d)}}if(s)throw o}}removeAllListeners(){PC(this,qo,{})}removeListener(t,n){const r=bu(this,qo)[t];if(r!==void 0){const s=r.indexOf(n);s>=0&&r.splice(s,1)}}},qo=new WeakMap,ZR),fs=new Map;const OA=new jA;function MW(e){fs=new Map(fs),fs.delete(e)}function R2(e,t){for(const[n]of fs)if(n.id===e)return n}function Yo(e,t){for(const[n,r]of fs)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function tl(){return fs}function ux(e,t){return OA.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Js(e,t){const n=fs.get(e);fs=new Map(fs),fs.set(e,t),OA.emit("groupChange",{group:e,prev:n,next:t})}function NW(e,t,n){let r,s={x:1/0,y:1/0};for(const o of t){const l=AA(n,o.rect);switch(e){case"horizontal":{l.x<=s.x&&(r=o,s=l);break}case"vertical":{l.y<=s.y&&(r=o,s=l);break}}}return r?{distance:s,hitRegion:r}:void 0}function AW(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function DW(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:N2(e),b:N2(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();en(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:M2(T2(n.a)),b:M2(T2(n.b))};if(s.a===s.b){const o=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let u=o.length;for(;u--;){const h=o[u];if(h===l.a)return 1;if(h===l.b)return-1}}return Math.sign(s.a-s.b)}const jW=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function OW(e){const t=getComputedStyle(LA(e)??e).display;return t==="flex"||t==="inline-flex"}function LW(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||OW(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"||jW.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function T2(e){let t=e.length;for(;t--;){const n=e[t];if(en(n,"Missing node"),LW(n))return n}return null}function M2(e){return e&&Number(getComputedStyle(e).zIndex)||0}function N2(e){const t=[];for(;e;)t.push(e),e=LA(e);return t}function LA(e){const{parentNode:t}=e;return AW(t)?t.host:t}function zW(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 PW({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!NA(n)||n.contains(e)||e.contains(n))return!0;if(DW(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(zW(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function dx(e,t){const n=[];return t.forEach((r,s)=>{if(s.disabled)return;const o=DA(s),l=NW(s.orientation,o,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&PW({groupElement:s.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function BW(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Er(e,t,n=0){return Math.abs($r(e)-$r(t))<=n}function as(e,t){return Er(e,t)?0:e>t?1:-1}function Jl({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:s=0,collapsible:o,disabled:l,maxSize:u=100,minSize:h=0}=t;if(l&&!e)return n;if(as(r,h)<0)if(o){const d=(s+h)/2;as(r,d)<0?r=s:r=h}else r=h;return r=Math.min(u,r),r=$r(r),r}function fd({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:o}){if(Er(e,0))return t;const l=o==="imperative-api",u=Object.values(t),h=Object.values(s),d=[...u],[g,p]=r;en(g!=null,"Invalid first pivot index"),en(p!=null,"Invalid second pivot index");let v=0;switch(o){case"keyboard":{{const S=e<0?p:g,C=n[S];en(C,`Panel constraints not found for index ${S}`);const{collapsedSize:k=0,collapsible:R,minSize:E=0}=C;if(R){const M=u[S];if(en(M!=null,`Previous layout not found for panel index ${S}`),Er(M,k)){const j=E-M;as(j,Math.abs(e))>0&&(e=e<0?0-j:j)}}}{const S=e<0?g:p,C=n[S];en(C,`No panel constraints found for index ${S}`);const{collapsedSize:k=0,collapsible:R,minSize:E=0}=C;if(R){const M=u[S];if(en(M!=null,`Previous layout not found for panel index ${S}`),Er(M,E)){const j=M-k;as(j,Math.abs(e))>0&&(e=e<0?0-j:j)}}}break}default:{const S=e<0?p:g,C=n[S];en(C,`Panel constraints not found for index ${S}`);const k=u[S],{collapsible:R,collapsedSize:E,minSize:M}=C;if(R&&as(k,M)<0)if(e>0){const j=M-E,D=j/2,L=k+e;as(L,M)<0&&(e=as(e,D)<=0?0:j)}else{const j=M-E,D=100-j/2,L=k-e;as(L,M)<0&&(e=as(100+e,D)>0?0:-j)}break}}{const S=e<0?1:-1;let C=e<0?p:g,k=0;for(;;){const E=u[C];en(E!=null,`Previous layout not found for panel index ${C}`);const M=Jl({overrideDisabledPanels:l,panelConstraints:n[C],prevSize:E,size:100})-E;if(k+=M,C+=S,C<0||C>=n.length)break}const R=Math.min(Math.abs(e),Math.abs(k));e=e<0?0-R:R}{let S=e<0?g:p;for(;S>=0&&S<n.length;){const C=Math.abs(e)-Math.abs(v),k=u[S];en(k!=null,`Previous layout not found for panel index ${S}`);const R=k-C,E=Jl({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:k,size:R});if(!Er(k,E)&&(v+=k-E,d[S]=E,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?S--:S++}}if(BW(h,d))return s;{const S=e<0?p:g,C=u[S];en(C!=null,`Previous layout not found for panel index ${S}`);const k=C+v,R=Jl({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:C,size:k});if(d[S]=R,!Er(R,k)){let E=k-R,M=e<0?p:g;for(;M>=0&&M<n.length;){const j=d[M];en(j!=null,`Previous layout not found for panel index ${M}`);const D=j+E,L=Jl({overrideDisabledPanels:l,panelConstraints:n[M],prevSize:j,size:D});if(Er(j,L)||(E-=L-j,d[M]=L),Er(E,0))break;e>0?M--:M++}}}const y=Object.values(d).reduce((S,C)=>C+S,0);if(!Er(y,100,.1))return s;const w=Object.keys(s);return d.reduce((S,C,k)=>(S[w[k]]=C,S),{})}function qa(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||as(e[n],t[n])!==0)return!1;return!0}function Ka({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],s=r.reduce((u,h)=>u+h,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(u=>`${u}%`).join(", ")}`);if(!Er(s,100)&&r.length>0)for(let u=0;u<t.length;u++){const h=r[u];en(h!=null,`No layout data found for index ${u}`);const d=100/s*h;r[u]=d}let o=0;for(let u=0;u<t.length;u++){const h=n[u];en(h!=null,`No layout data found for index ${u}`);const d=r[u];en(d!=null,`No layout data found for index ${u}`);const g=Jl({overrideDisabledPanels:!0,panelConstraints:t[u],prevSize:h,size:d});d!=g&&(o+=d-g,r[u]=g)}if(!Er(o,0))for(let u=0;u<t.length;u++){const h=r[u];en(h!=null,`No layout data found for index ${u}`);const d=h+o,g=Jl({overrideDisabledPanels:!0,panelConstraints:t[u],prevSize:h,size:d});if(h!==g&&(o-=g-h,r[u]=g,Er(o,0)))break}const l=Object.keys(e);return r.reduce((u,h,d)=>(u[l[d]]=h,u),{})}function zA({groupId:e,panelId:t}){const n=()=>{const u=tl();for(const[h,{defaultLayoutDeferred:d,derivedPanelConstraints:g,layout:p,groupSize:v,separatorToPanels:y}]of u)if(h.id===e)return{defaultLayoutDeferred:d,derivedPanelConstraints:g,group:h,groupSize:v,layout:p,separatorToPanels:y};throw Error(`Group ${e} not found`)},r=()=>{const u=n().derivedPanelConstraints.find(h=>h.panelId===t);if(u!==void 0)return u;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const u=n().group.panels.find(h=>h.id===t);if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},o=()=>{const u=n().layout[t];if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},l=u=>{const h=o();if(u===h)return;const{defaultLayoutDeferred:d,derivedPanelConstraints:g,group:p,groupSize:v,layout:y,separatorToPanels:w}=n(),S=p.panels.findIndex(E=>E.id===t),C=S===p.panels.length-1,k=fd({delta:C?h-u:u-h,initialLayout:y,panelConstraints:g,pivotIndices:C?[S-1,S]:[S,S+1],prevLayout:y,trigger:"imperative-api"}),R=Ka({layout:k,panelConstraints:g});qa(y,R)||Js(p,{defaultLayoutDeferred:d,derivedPanelConstraints:g,groupSize:v,layout:R,separatorToPanels:w})};return{collapse:()=>{const{collapsible:u,collapsedSize:h}=r(),{mutableValues:d}=s(),g=o();u&&g!==h&&(d.expandToSize=g,l(h))},expand:()=>{const{collapsible:u,collapsedSize:h,minSize:d}=r(),{mutableValues:g}=s(),p=o();if(u&&p===h){let v=g.expandToSize??d;v===0&&(v=1),l(v)}},getSize:()=>{const{group:u}=n(),h=o(),{element:d}=s(),g=u.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:h,inPixels:g}},isCollapsed:()=>{const{collapsible:u,collapsedSize:h}=r(),d=o();return u&&Er(h,d)},resize:u=>{const{group:h}=n(),{element:d}=s(),g=hc({group:h}),p=Iu({groupSize:g,panelElement:d,styleProp:u}),v=$r(p/g*100);l(v)}}}function A2(e){if(e.defaultPrevented)return;const t=tl();dx(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,o=zA({groupId:n.group.id,panelId:r.id});o&&s!==void 0&&(o.resize(s),e.preventDefault())}}})}function em(e){const t=tl();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function PA({groupId:e}){const t=()=>{const n=tl();for(const[r,s]of n)if(r.id===e)return{group:r,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:s,group:o,groupSize:l,layout:u,separatorToPanels:h}=t(),d=Ka({layout:n,panelConstraints:s});return r?u:(qa(u,d)||Js(o,{defaultLayoutDeferred:r,derivedPanelConstraints:s,groupSize:l,layout:d,separatorToPanels:h}),d)}}}function Ea(e,t){const n=em(e),r=Yo(n.id,!0),s=n.separators.find(g=>g.element===e);en(s,"Matching separator not found");const o=r.separatorToPanels.get(s);en(o,"Matching panels not found");const l=o.map(g=>n.panels.indexOf(g)),u=PA({groupId:n.id}).getLayout(),h=fd({delta:t,initialLayout:u,panelConstraints:r.derivedPanelConstraints,pivotIndices:l,prevLayout:u,trigger:"keyboard"}),d=Ka({layout:h,panelConstraints:r.derivedPanelConstraints});qa(u,d)||Js(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:d,separatorToPanels:r.separatorToPanels})}function D2(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=em(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Ea(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Ea(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Ea(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Ea(t,-5);break}case"End":{e.preventDefault(),Ea(t,100);break}case"Enter":{e.preventDefault();const r=em(t),s=Yo(r.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:u}=s,h=r.separators.find(v=>v.element===t);en(h,"Matching separator not found");const d=u.get(h);en(d,"Matching panels not found");const g=d[0],p=o.find(v=>v.panelId===g.id);if(en(p,"Panel metadata not found"),p.collapsible){const v=l[g.id],y=p.collapsedSize===v?r.mutableState.expandedPanelSizes[g.id]??p.minSize:p.collapsedSize;Ea(t,y-v)}break}case"F6":{e.preventDefault();const r=em(t).separators.map(l=>l.element),s=Array.from(r).findIndex(l=>l===e.currentTarget);en(s!==null,"Index not found");const o=e.shiftKey?s>0?s-1:r.length-1:s+1<r.length?s+1:0;r[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Ea(t,-100);break}}}let sc={cursorFlags:0,state:"inactive"};const hx=new jA;function Ga(){return sc}function IW(e){return hx.addListener("change",e)}function HW(e){const t=sc,n={...sc};n.cursorFlags=e,sc=n,hx.emit("change",{prev:t,next:n})}function oc(e){const t=sc;sc=e,hx.emit("change",{prev:t,next:e})}function j2(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=tl(),n=dx(e,t),r=new Map;let s=!1;n.forEach(o=>{o.separator&&(s||(s=!0,o.separator.element.focus({preventScroll:!0})));const l=t.get(o.group);l&&r.set(o.group,l.layout)}),oc({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const FW=e=>e,N_=()=>{},BA=1,IA=2,HA=4,FA=8,O2=3,L2=12;let Tf;function z2(){return Tf===void 0&&(Tf=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Tf=!0)),Tf}function UW({cursorFlags:e,groups:t,state:n}){let r=0,s=0;switch(n){case"active":case"hover":t.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{r++;break}case"vertical":{s++;break}}})}if(!(r===0&&s===0)){switch(n){case"active":{if(e&&z2()){const o=(e&BA)!==0,l=(e&IA)!==0,u=(e&HA)!==0,h=(e&FA)!==0;if(o)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 z2()?r>0&&s>0?"move":r>0?"ew-resize":"ns-resize":r>0&&s>0?"grab":r>0?"col-resize":"row-resize"}}const P2=new WeakMap;function fx(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=P2.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=Ga();switch(r.state){case"active":case"hover":{const s=UW({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(l=>l.group),state:r.state}),o=`*, *:hover {cursor: ${s} !important; }`;if(t===o)return;t=o,s?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}P2.set(e,{prevStyle:t,styleSheet:n})}function UA({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:o,prevCursorFlags:l}){let u=0;n.forEach(d=>{const{group:g,groupSize:p}=d,{orientation:v,panels:y}=g,{disableCursor:w}=g.mutableState;let S=0;o?v==="horizontal"?S=(t.clientX-o.x)/p*100:S=(t.clientY-o.y)/p*100:v==="horizontal"?S=t.clientX<0?-100:100:S=t.clientY<0?-100:100;const C=r.get(g),k=s.get(g);if(!C||!k)return;const{defaultLayoutDeferred:R,derivedPanelConstraints:E,groupSize:M,layout:j,separatorToPanels:D}=k;if(E&&j&&D){const L=fd({delta:S,initialLayout:C,panelConstraints:E,pivotIndices:d.panels.map($=>y.indexOf($)),prevLayout:j,trigger:"mouse-or-touch"});if(qa(L,j)){if(S!==0&&!w)switch(v){case"horizontal":{u|=S<0?BA:IA;break}case"vertical":{u|=S<0?HA:FA;break}}}else Js(d.group,{defaultLayoutDeferred:R,derivedPanelConstraints:E,groupSize:M,layout:L,separatorToPanels:D})}});let h=0;t.movementX===0?h|=l&O2:h|=u&O2,t.movementY===0?h|=l&L2:h|=u&L2,HW(h),fx(e)}function B2(e){const t=tl(),n=Ga();switch(n.state){case"active":UA({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function I2(e){if(e.defaultPrevented)return;const t=Ga(),n=tl();switch(t.state){case"active":{if(e.buttons===0){oc({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const s=Yo(r.group.id,!0);Js(r.group,s)});return}UA({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=dx(e,n);r.length===0?t.state!=="inactive"&&oc({cursorFlags:0,state:"inactive"}):oc({cursorFlags:0,hitRegions:r,state:"hover"}),fx(e.currentTarget);break}}}function H2(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ga().state){case"hover":oc({cursorFlags:0,state:"inactive"})}}function F2(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Ga();switch(t.state){case"active":oc({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(fx(e.currentTarget),t.hitRegions.forEach(n=>{const r=Yo(n.group.id,!0);Js(n.group,r)}),e.preventDefault())}}function U2(e){let t=0,n=0;const r={};for(const o of e)if(o.defaultSize!==void 0){t++;const l=$r(o.defaultSize);n+=l,r[o.panelId]=l}else r[o.panelId]=void 0;const s=e.length-t;if(s!==0){const o=$r((100-n)/s);for(const l of e)l.defaultSize===void 0&&(r[l.panelId]=o)}return r}function $W(e,t,n){if(!n[0])return;const r=e.panels.find(h=>h.element===t);if(!r||!r.onResize)return;const s=hc({group:e}),o=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,u={asPercentage:$r(o/s*100),inPixels:o};r.mutableValues.prevSize=u,r.onResize(u,r.id,l)}function WW(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 VW({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let s=0,o=0,l=!1;const u=new Map,h=[];for(const p of e.panels){const v=r[p.id]??0;switch(p.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const y=v/100*n,w=$r(y/t*100);u.set(p.id,w),s+=w;break}case"preserve-relative-size":default:{h.push(p.id),o+=v;break}}}if(!l||h.length===0)return r;const d=100-s,g={...r};if(u.forEach((p,v)=>{g[v]=p}),o>0)for(const p of h){const v=r[p]??0;g[p]=$r(v/o*d)}else{const p=$r(d/h.length);for(const v of h)g[v]=p}return g}function qW(e,t){const n=e.map(s=>s.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n)if(!r.includes(s))return!1;return!0}const Ul=new Map;function KW(e){let t=!0;en(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,s=new Set,o=new n(w=>{for(const S of w){const{borderBoxSize:C,target:k}=S;if(k===e.element){if(t){const R=hc({group:e});if(R===0)return;const E=Yo(e.id);if(!E)return;const M=Jb(e),j=E.defaultLayoutDeferred?U2(M):E.layout,D=VW({group:e,nextGroupSize:R,prevGroupSize:E.groupSize,prevLayout:j}),L=Ka({layout:D,panelConstraints:M});if(!E.defaultLayoutDeferred&&qa(E.layout,L)&&WW(E.derivedPanelConstraints,M)&&E.groupSize===R)return;Js(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:M,groupSize:R,layout:L,separatorToPanels:E.separatorToPanels})}}else $W(e,k,C)}});o.observe(e.element),e.panels.forEach(w=>{en(!r.has(w.id),`Panel ids must be unique; id "${w.id}" was used more than once`),r.add(w.id),w.onResize&&o.observe(w.element)});const l=hc({group:e}),u=Jb(e),h=e.panels.map(({id:w})=>w).join(",");let d=e.mutableState.defaultLayout;d&&(qW(e.panels,d)||(d=void 0));const g=e.mutableState.layouts[h]??d??U2(u),p=Ka({layout:g,panelConstraints:u}),v=e.element.ownerDocument;Ul.set(v,(Ul.get(v)??0)+1);const y=new Map;return DA(e).forEach(w=>{w.separator&&y.set(w.separator,w.panels)}),Js(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:u,groupSize:l,layout:p,separatorToPanels:y}),e.separators.forEach(w=>{en(!s.has(w.id),`Separator ids must be unique; id "${w.id}" was used more than once`),s.add(w.id),w.element.addEventListener("keydown",D2)}),Ul.get(v)===1&&(v.addEventListener("dblclick",A2,!0),v.addEventListener("pointerdown",j2,!0),v.addEventListener("pointerleave",B2),v.addEventListener("pointermove",I2),v.addEventListener("pointerout",H2),v.addEventListener("pointerup",F2,!0)),function(){t=!1,Ul.set(v,Math.max(0,(Ul.get(v)??0)-1)),MW(e),e.separators.forEach(w=>{w.element.removeEventListener("keydown",D2)}),Ul.get(v)||(v.removeEventListener("dblclick",A2,!0),v.removeEventListener("pointerdown",j2,!0),v.removeEventListener("pointerleave",B2),v.removeEventListener("pointermove",I2),v.removeEventListener("pointerout",H2),v.removeEventListener("pointerup",F2,!0)),o.disconnect()}}function GW(){const[e,t]=_.useState({}),n=_.useCallback(()=>t({}),[]);return[e,n]}function mx(e){const t=_.useId();return`${e??t}`}const nl=typeof window<"u"?_.useLayoutEffect:_.useEffect;function Zu(e){const t=_.useRef(e);return nl(()=>{t.current=e},[e]),_.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function px(...e){return Zu(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function gx(e){const t=_.useRef({...e});return nl(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const $A=_.createContext(null);function YW(e,t){const n=_.useRef({getLayout:()=>({}),setLayout:FW});_.useImperativeHandle(t,()=>n.current,[]),nl(()=>{Object.assign(n.current,PA({groupId:e}))})}function WA({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:s,elementRef:o,groupRef:l,id:u,onLayoutChange:h,onLayoutChanged:d,orientation:g="horizontal",resizeTargetMinimumSize:p={coarse:20,fine:10},style:v,...y}){const w=_.useRef({onLayoutChange:{},onLayoutChanged:{}}),S=Zu(V=>{qa(w.current.onLayoutChange,V)||(w.current.onLayoutChange=V,h==null||h(V))}),C=Zu(V=>{qa(w.current.onLayoutChanged,V)||(w.current.onLayoutChanged=V,d==null||d(V))}),k=mx(u),R=_.useRef(null),[E,M]=GW(),j=_.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:p,separators:[]}),D=px(R,o);YW(k,l);const L=Zu((V,I)=>{const W=Ga(),K=R2(V),q=Yo(V);if(q){let O=!1;switch(W.state){case"active":{O=W.hitRegions.some(H=>H.group===K);break}}return{flexGrow:q.layout[I]??1,pointerEvents:O?"none":void 0}}return{flexGrow:(n==null?void 0:n[I])??1}}),$=gx({defaultLayout:n,disableCursor:r}),Y=_.useMemo(()=>({get disableCursor(){return!!$.disableCursor},getPanelStyles:L,id:k,orientation:g,registerPanel:V=>{const I=j.current;return I.panels=ey(g,[...I.panels,V]),M(),()=>{I.panels=I.panels.filter(W=>W!==V),M()}},registerSeparator:V=>{const I=j.current;return I.separators=ey(g,[...I.separators,V]),M(),()=>{I.separators=I.separators.filter(W=>W!==V),M()}},togglePanelDisabled:(V,I)=>{const W=j.current.panels.find(O=>O.id===V);W&&(W.panelConstraints.disabled=I);const K=R2(k),q=Yo(k);K&&q&&Js(K,{...q,derivedPanelConstraints:Jb(K)})},toggleSeparatorDisabled:(V,I)=>{const W=j.current.separators.find(K=>K.id===V);W&&(W.disabled=I)}}),[L,k,M,g,$]),P=_.useRef(null);return nl(()=>{const V=R.current;if(V===null)return;const I=j.current;let W;if($.defaultLayout!==void 0&&Object.keys($.defaultLayout).length===I.panels.length){W={};for(const N of I.panels){const B=$.defaultLayout[N.id];B!==void 0&&(W[N.id]=B)}}const K={disabled:!!s,element:V,id:k,mutableState:{defaultLayout:W,disableCursor:!!$.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:g,panels:I.panels,resizeTargetMinimumSize:I.resizeTargetMinimumSize,separators:I.separators};P.current=K;const q=KW(K),{defaultLayoutDeferred:O,derivedPanelConstraints:H,layout:U}=Yo(K.id,!0);!O&&H.length>0&&(S(U),C(U));const F=ux(k,N=>{const{defaultLayoutDeferred:B,derivedPanelConstraints:X,layout:A}=N.next;if(B||X.length===0)return;const ne=K.panels.map(({id:Z})=>Z).join(",");K.mutableState.layouts[ne]=A,X.forEach(Z=>{if(Z.collapsible){const{layout:te}=N.prev??{};if(te){const le=Er(Z.collapsedSize,A[Z.panelId]),me=Er(Z.collapsedSize,te[Z.panelId]);le&&!me&&(K.mutableState.expandedPanelSizes[Z.panelId]=te[Z.panelId])}}});const ae=Ga().state!=="active";S(A),ae&&C(A)});return()=>{P.current=null,q(),F()}},[s,k,C,S,g,E,$]),_.useEffect(()=>{const V=P.current;V&&(V.mutableState.defaultLayout=n,V.mutableState.disableCursor=!!r)}),f.jsx($A.Provider,{value:Y,children:f.jsx("div",{...y,className:t,"data-group":!0,"data-testid":k,id:k,ref:D,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:g==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:g==="horizontal"?"pan-y":"pan-x"},children:e})})}WA.displayName="Group";function vx(){const e=_.useContext($A);return en(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function XW(e,t){const{id:n}=vx(),r=_.useRef({collapse:N_,expand:N_,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:N_});_.useImperativeHandle(t,()=>r.current,[]),nl(()=>{Object.assign(r.current,zA({groupId:n,panelId:e}))})}function VA({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:s,disabled:o,elementRef:l,groupResizeBehavior:u="preserve-relative-size",id:h,maxSize:d="100%",minSize:g="0%",onResize:p,panelRef:v,style:y,...w}){const S=!!h,C=mx(h),k=gx({disabled:o}),R=_.useRef(null),E=px(R,l),{getPanelStyles:M,id:j,orientation:D,registerPanel:L,togglePanelDisabled:$}=vx(),Y=p!==null,P=Zu((I,W,K)=>{p==null||p(I,h,K)});nl(()=>{const I=R.current;if(I!==null){const W={element:I,id:C,idIsStable:S,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:Y?P:void 0,panelConstraints:{groupResizeBehavior:u,collapsedSize:n,collapsible:r,defaultSize:s,disabled:k.disabled,maxSize:d,minSize:g}};return L(W)}},[u,n,r,s,Y,C,S,d,g,P,L,k]),_.useEffect(()=>{$(C,!!o)},[o,C,$]),XW(C,v);const V=_.useSyncExternalStore(I=>ux(j,I),()=>JSON.stringify(M(j,C)),()=>JSON.stringify(M(j,C)));return f.jsx("div",{...w,"aria-disabled":o||void 0,"data-panel":!0,"data-testid":C,id:C,ref:E,style:{...ZW,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(V)},children:f.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:D==="horizontal"?"pan-y":"pan-x"},children:e})})}VA.displayName="Panel";const ZW={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function QW({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let s,o;const l=e[n],u=t.find(h=>h.panelId===n);if(u){const h=u.maxSize,d=u.collapsible?u.collapsedSize:u.minSize,g=[r,r+1];o=Ka({layout:fd({delta:d-l,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[n],s=Ka({layout:fd({delta:h-l,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:o,valueNow:l}}function qA({children:e,className:t,disabled:n,elementRef:r,id:s,style:o,...l}){const u=mx(s),h=gx({disabled:n}),[d,g]=_.useState({}),[p,v]=_.useState("inactive"),y=_.useRef(null),w=px(y,r),{disableCursor:S,id:C,orientation:k,registerSeparator:R,toggleSeparatorDisabled:E}=vx(),M=k==="horizontal"?"vertical":"horizontal";nl(()=>{const D=y.current;if(D!==null){const L={disabled:h.disabled,element:D,id:u},$=R(L),Y=IW(V=>{v(V.next.state!=="inactive"&&V.next.hitRegions.some(I=>I.separator===L)?V.next.state:"inactive")}),P=ux(C,V=>{const{derivedPanelConstraints:I,layout:W,separatorToPanels:K}=V.next,q=K.get(L);if(q){const O=q[0],H=q.indexOf(O);g(QW({layout:W,panelConstraints:I,panelId:O.id,panelIndex:H}))}});return()=>{Y(),P(),$()}}},[C,u,R,h]),_.useEffect(()=>{E(u,!!n)},[n,u,E]);let j;return n&&!S&&(j="not-allowed"),f.jsx("div",{...l,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":M,"aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":n?"disabled":p,"data-testid":u,id:u,ref:w,role:"separator",style:{flexBasis:"auto",cursor:j,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}qA.displayName="Separator";const tm=({className:e,...t})=>f.jsx(WA,{className:pe("flex h-full w-full",e),...t}),Na=e=>f.jsx(VA,{...e}),nm=({withHandle:e,orientation:t,disabled:n,className:r,...s})=>f.jsx(qA,{disabled:n,className:pe("relative flex items-center justify-center bg-transparent focus-visible:outline-none",t==="vertical"?"h-2 w-full -my-1 cursor-row-resize before:absolute before:inset-x-0 before:top-1/2 before:h-0.5 before:-translate-y-1/2 before:bg-border":"h-full w-2 -mx-1 cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-border",r),...s,children:f.jsx("span",{className:"sr-only",children:t==="vertical"?"Resize rows":"Resize columns"})});/**
|
|
474
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
475
|
+
* @license MIT
|
|
476
|
+
*
|
|
477
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
478
|
+
* @license MIT
|
|
479
|
+
*
|
|
480
|
+
* Originally forked from (with the author's permission):
|
|
481
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
482
|
+
* http://bellard.org/jslinux/
|
|
483
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
484
|
+
*/var Zn=0,Qn=0,Jn=0,xn=0,vr;(e=>{function t(s,o,l,u){return u!==void 0?`#${Ra(s)}${Ra(o)}${Ra(l)}${Ra(u)}`:`#${Ra(s)}${Ra(o)}${Ra(l)}`}e.toCss=t;function n(s,o,l,u=255){return(s<<24|o<<16|l<<8|u)>>>0}e.toRgba=n;function r(s,o,l,u){return{css:e.toCss(s,o,l,u),rgba:e.toRgba(s,o,l,u)}}e.toColor=r})(vr||(vr={}));var JW;(e=>{function t(h,d){if(xn=(d.rgba&255)/255,xn===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,p=d.rgba>>16&255,v=d.rgba>>8&255,y=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;Zn=y+Math.round((g-y)*xn),Qn=w+Math.round((p-w)*xn),Jn=S+Math.round((v-S)*xn);let C=vr.toCss(Zn,Qn,Jn),k=vr.toRgba(Zn,Qn,Jn);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,g){let p=rm.ensureContrastRatio(h.rgba,d.rgba,g);if(p)return vr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=r;function s(h){let d=(h.rgba|255)>>>0;return[Zn,Qn,Jn]=rm.toChannels(d),{css:vr.toCss(Zn,Qn,Jn),rgba:d}}e.opaque=s;function o(h,d){return xn=Math.round(d*255),[Zn,Qn,Jn]=rm.toChannels(h.rgba),{css:vr.toCss(Zn,Qn,Jn,xn),rgba:vr.toRgba(Zn,Qn,Jn,xn)}}e.opacity=o;function l(h,d){return xn=h.rgba&255,o(h,xn*d/255)}e.multiplyOpacity=l;function u(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=u})(JW||(JW={}));var cr;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,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 Zn=parseInt(s.slice(1,2).repeat(2),16),Qn=parseInt(s.slice(2,3).repeat(2),16),Jn=parseInt(s.slice(3,4).repeat(2),16),vr.toColor(Zn,Qn,Jn);case 5:return Zn=parseInt(s.slice(1,2).repeat(2),16),Qn=parseInt(s.slice(2,3).repeat(2),16),Jn=parseInt(s.slice(3,4).repeat(2),16),xn=parseInt(s.slice(4,5).repeat(2),16),vr.toColor(Zn,Qn,Jn,xn);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=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(o)return Zn=parseInt(o[1]),Qn=parseInt(o[2]),Jn=parseInt(o[3]),xn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),vr.toColor(Zn,Qn,Jn,xn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Zn,Qn,Jn,xn]=t.getImageData(0,0,1,1).data,xn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:vr.toRgba(Zn,Qn,Jn,xn),css:s}}e.toColor=r})(cr||(cr={}));var Cr;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,o){let l=r/255,u=s/255,h=o/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+g*.7152+p*.0722}e.relativeLuminance2=n})(Cr||(Cr={}));var rm;(e=>{function t(l,u){if(xn=(u&255)/255,xn===1)return u;let h=u>>24&255,d=u>>16&255,g=u>>8&255,p=l>>24&255,v=l>>16&255,y=l>>8&255;return Zn=p+Math.round((h-p)*xn),Qn=v+Math.round((d-v)*xn),Jn=y+Math.round((g-y)*xn),vr.toRgba(Zn,Qn,Jn)}e.blend=t;function n(l,u,h){let d=Cr.relativeLuminance(l>>8),g=Cr.relativeLuminance(u>>8);if(Us(d,g)<h){if(g<d){let y=r(l,u,h),w=Us(d,Cr.relativeLuminance(y>>8));if(w<h){let S=s(l,u,h),C=Us(d,Cr.relativeLuminance(S>>8));return w>C?y:S}return y}let p=s(l,u,h),v=Us(d,Cr.relativeLuminance(p>>8));if(v<h){let y=r(l,u,h),w=Us(d,Cr.relativeLuminance(y>>8));return v>w?p:y}return p}}e.ensureContrastRatio=n;function r(l,u,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=u>>24&255,y=u>>16&255,w=u>>8&255,S=Us(Cr.relativeLuminance2(v,y,w),Cr.relativeLuminance2(d,g,p));for(;S<h&&(v>0||y>0||w>0);)v-=Math.max(0,Math.ceil(v*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=Us(Cr.relativeLuminance2(v,y,w),Cr.relativeLuminance2(d,g,p));return(v<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=r;function s(l,u,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=u>>24&255,y=u>>16&255,w=u>>8&255,S=Us(Cr.relativeLuminance2(v,y,w),Cr.relativeLuminance2(d,g,p));for(;S<h&&(v<255||y<255||w<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Us(Cr.relativeLuminance2(v,y,w),Cr.relativeLuminance2(d,g,p));return(v<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=s;function o(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=o})(rm||(rm={}));function Ra(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Us(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var eV=Object.freeze((()=>{let e=[cr.toColor("#2e3436"),cr.toColor("#cc0000"),cr.toColor("#4e9a06"),cr.toColor("#c4a000"),cr.toColor("#3465a4"),cr.toColor("#75507b"),cr.toColor("#06989a"),cr.toColor("#d3d7cf"),cr.toColor("#555753"),cr.toColor("#ef2929"),cr.toColor("#8ae234"),cr.toColor("#fce94f"),cr.toColor("#729fcf"),cr.toColor("#ad7fa8"),cr.toColor("#34e2e2"),cr.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],o=t[n%6];e.push({css:vr.toCss(r,s,o),rgba:vr.toRgba(r,s,o)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:vr.toCss(r,r,r),rgba:vr.toRgba(r,r,r)})}return e})());function $2(e,t,n){return Math.max(t,Math.min(e,n))}function tV(e){switch(e){case"&":return"&";case"<":return"<"}return e}var KA=class{constructor(t){this._buffer=t}serialize(t,n){let r=this._buffer.getNullCell(),s=this._buffer.getNullCell(),o=r,l=t.start.y,u=t.end.y,h=t.start.x,d=t.end.x;this._beforeSerialize(u-l,l,u);for(let g=l;g<=u;g++){let p=this._buffer.getLine(g);if(p){let v=g===t.start.y?h:0,y=g===t.end.y?d:p.length;for(let w=v;w<y;w++){let S=p.getCell(w,o===r?s:r);if(!S){console.warn(`Can't get cell at row=${g}, col=${w}`);continue}this._nextCell(S,o,g,w),o=S}}this._rowEnd(g,g===u)}return this._afterSerialize(),this._serializeString(n)}_nextCell(t,n,r,s){}_rowEnd(t,n){}_beforeSerialize(t,n,r){}_afterSerialize(){}_serializeString(t){return""}};function GA(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Vs(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function YA(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 nV=class extends KA{constructor(t,n){super(t),this._terminal=n,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,n,r){this._allRows=new Array(t),this._lastContentCursorRow=n,this._lastCursorRow=n,this._firstRow=n}_rowEnd(t,n){var s;this._nullCellCount>0&&!Vs(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let r="";if(!n){t-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let o=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(!l.isWrapped)r=`\r
|
|
485
|
+
`,this._lastCursorRow=t+1,this._lastCursorCol=0;else{r="";let u=o.getCell(o.length-1,this._thisRowLastChar),h=o.getCell(o.length-2,this._thisRowLastSecondChar),d=l.getCell(0,this._nextRowFirstChar),g=d.getWidth()>1,p=!1;(d.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((u.getChars()||u.getWidth()===0)&&Vs(u,d)&&(p=!0),g&&(h.getChars()||h.getWidth()===0)&&Vs(u,d)&&Vs(h,d)&&(p=!0)),p||(r="-".repeat(this._nullCellCount+1),r+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(r+="\x1B[A",r+=`\x1B[${o.length-this._nullCellCount}C`,r+=`\x1B[${this._nullCellCount}X`,r+=`\x1B[${o.length-this._nullCellCount}D`,r+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=r,this._currentRow="",this._nullCellCount=0}_diffStyle(t,n){let r=[],s=!GA(t,n),o=!Vs(t,n),l=!YA(t,n);if(s||o||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(o){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 o=t.getChars()==="",l=this._diffStyle(t,this._cursorStyle);if(o?!Vs(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(Vs(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${l.join(";")}m`;let u=this._buffer.getLine(r);u!==void 0&&(u.getCell(s,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=s)}o?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Vs(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s+t.getWidth())}_serializeString(t){let n=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(n=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let r="";for(let l=0;l<n;l++)r+=this._allRows[l],l+1<n&&(r+=this._allRowSeparators[l]);if(!t){let l=this._buffer.baseY+this._buffer.cursorY,u=this._buffer.cursorX,h=l!==this._lastCursorRow||u!==this._lastCursorCol,d=g=>{g>0?r+=`\x1B[${g}C`:g<0&&(r+=`\x1B[${-g}D`)};h&&((g=>{g>0?r+=`\x1B[${g}B`:g<0&&(r+=`\x1B[${-g}A`)})(l-this._lastCursorRow),d(u-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,o=this._diffStyle(s,this._cursorStyle);return o.length>0&&(r+=`\x1B[${o.join(";")}m`),r}},rV=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,n,r){let s=n.length,o=r===void 0?s:$2(r+t.rows,0,s);return this._serializeBufferByRange(t,n,{start:s-o,end:s-1},!1)}_serializeBufferByRange(t,n,r,s){return new nV(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 iV(r,t,n),o=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(!o){let d=r.length,g=n.scrollback,p=g===void 0?d:$2(g+t.rows,0,d);return s.serialize({start:{x:0,y:d-p},end:{x:t.cols,y:d-1}})}let u=(h=this._terminal)==null?void 0:h.getSelectionPosition();return u!==void 0?s.serialize({start:{x:u.start.x,y:u.start.y},end:{x:u.end.x,y:u.end.y}}):""}_serializeModes(t){let n="",r=t.modes;if(r.applicationCursorKeysMode&&(n+="\x1B[?1h"),r.applicationKeypadMode&&(n+="\x1B[?66h"),r.bracketedPasteMode&&(n+="\x1B[?2004h"),r.insertMode&&(n+="\x1B[4h"),r.originMode&&(n+="\x1B[?6h"),r.reverseWraparoundMode&&(n+="\x1B[?45h"),r.sendFocusMode&&(n+="\x1B[?1004h"),r.wraparoundMode===!1&&(n+="\x1B[?7l"),r.mouseTrackingMode!=="none")switch(r.mouseTrackingMode){case"x10":n+="\x1B[?9h";break;case"vt200":n+="\x1B[?1000h";break;case"drag":n+="\x1B[?1002h";break;case"any":n+="\x1B[?1003h";break}return n}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let n=t!=null&&t.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t==null?void 0:t.scrollback);if(!(t!=null&&t.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let r=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);n+=`\x1B[?1049h\x1B[H${r}`}return t!=null&&t.excludeModes||(n+=this._serializeModes(this._terminal)),n}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t||{})}dispose(){}},iV=class extends KA{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=eV}_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",o="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((u=this._terminal.options.theme)==null?void 0:u.foreground)??"#ffffff",o=((h=this._terminal.options.theme)==null?void 0:h.background)??"#000000");let l=[];l.push("color: "+s+";"),l.push("background-color: "+o+";"),l.push("font-family: "+this._terminal.options.fontFamily+";"),l.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+l.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,n){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,n){let r=n?t.getFgColor():t.getBgColor();if(n?t.isFgRGB():t.isBgRGB())return"#"+[r>>16&255,r>>8&255,r&255].map(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=!GA(t,n),o=!Vs(t,n),l=!YA(t,n);if(s||o||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 o=t.getChars()==="",l=this._diffStyle(t,n);l&&(this._currentRow+=l.length===0?"</span><span>":"</span><span style='"+l.join(" ")+"'>"),o?this._currentRow+=" ":this._currentRow+=tV(t.getChars())}_serializeString(){return this._htmlContent}};/**
|
|
486
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
487
|
+
* @license MIT
|
|
488
|
+
*
|
|
489
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
490
|
+
* @license MIT
|
|
491
|
+
*
|
|
492
|
+
* Originally forked from (with the author's permission):
|
|
493
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
494
|
+
* http://bellard.org/jslinux/
|
|
495
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
496
|
+
*/var sV=class{constructor(t,n,r,s={}){this._terminal=t,this._regex=n,this._handler=r,this._options=s}provideLinks(t,n){let r=aV.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:o}=n;this._options.hover(r,s,o)}},n))}};function oV(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 aV=class im{static computeLink(t,n,r,s){let o=new RegExp(n.source,(n.flags||"")+"g"),[l,u]=im._getWindowedLineStrings(t-1,r),h=l.join(""),d,g=[];for(;d=o.exec(h);){let p=d[0];if(!oV(p))continue;let[v,y]=im._mapStrIdx(r,u,0,d.index),[w,S]=im._mapStrIdx(r,v,y,p.length);if(v===-1||y===-1||w===-1||S===-1)continue;let C={start:{x:y+1,y:v+1},end:{x:S,y:w+1}};g.push({range:C,text:p,activate:s})}return g}static _getWindowedLineStrings(t,n){let r,s=t,o=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(++o))&&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 o=t.buffer.active,l=o.getNullCell(),u=r;for(;s;){let h=o.getLine(n);if(!h)return[-1,-1];for(let d=u;d<h.length;++d){h.getCell(d,l);let g=l.getChars();if(l.getWidth()&&(s-=g.length||1,d===h.length-1&&g==="")){let p=o.getLine(n+1);p&&p.isWrapped&&(p.getCell(0,l),l.getWidth()===2&&(s+=1))}if(s<0)return[n,d]}n++,u=0}return[n,u]}},lV=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function cV(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 uV=class{constructor(t=cV,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||lV;this._linkProvider=this._terminal.registerLinkProvider(new sV(this._terminal,r,this._handler,n))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
|
|
497
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
498
|
+
* @license MIT
|
|
499
|
+
*
|
|
500
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
501
|
+
* @license MIT
|
|
502
|
+
*
|
|
503
|
+
* Originally forked from (with the author's permission):
|
|
504
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
505
|
+
* http://bellard.org/jslinux/
|
|
506
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
507
|
+
*/var XA=Object.defineProperty,dV=Object.getOwnPropertyDescriptor,hV=(e,t)=>{for(var n in t)XA(e,n,{get:t[n],enumerable:!0})},Sn=(e,t,n,r)=>{for(var s=r>1?void 0:r?dV(t,n):t,o=e.length-1,l;o>=0;o--)(l=e[o])&&(s=(r?l(t,n,s):l(s))||s);return r&&s&&XA(t,n,s),s},ze=(e,t)=>(n,r)=>t(n,r,e),W2="Terminal input",ty={get:()=>W2,set:e=>W2=e},V2="Too much output to announce, navigate to rows manually to read",ny={get:()=>V2,set:e=>V2=e};function fV(e){return e.replace(/\r?\n/g,"\r")}function mV(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function pV(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function gV(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");ZA(s,t,n,r)}}function ZA(e,t,n,r){e=fV(e),e=mV(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function QA(e,t,n){let r=n.getBoundingClientRect(),s=e.clientX-r.left-10,o=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function q2(e,t,n,r,s){QA(e,t,n),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Vo(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Op(e,t=0,n=e.length){let r="";for(let s=t;s<n;++s){let o=e[s];o>65535?(o-=65536,r+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):r+=String.fromCharCode(o)}return r}var vV=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 o=e.charCodeAt(s++);56320<=o&&o<=57343?t[r++]=(this._interim-55296)*1024+o-56320+65536:(t[r++]=this._interim,t[r++]=o),this._interim=0}for(let o=s;o<n;++o){let l=e.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=n)return this._interim=l,r;let u=e.charCodeAt(o);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}},_V=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,o,l,u,h=0,d=0;if(this.interim[0]){let v=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let w=0,S;for(;(S=this.interim[++w]&63)&&w<4;)y<<=6,y|=S;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=C-w;for(;d<k;){if(d>=n)return 0;if(S=e[d++],(S&192)!==128){d--,v=!0;break}else this.interim[w++]=S,y<<=6,y|=S&63}v||(C===2?y<128?d--:t[r++]=y:C===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let g=n-4,p=d;for(;p<n;){for(;p<g&&!((s=e[p])&128)&&!((o=e[p+1])&128)&&!((l=e[p+2])&128)&&!((u=e[p+3])&128);)t[r++]=s,t[r++]=o,t[r++]=l,t[r++]=u,p+=4;if(s=e[p++],s<128)t[r++]=s;else if((s&224)===192){if(p>=n)return this.interim[0]=s,r;if(o=e[p++],(o&192)!==128){p--;continue}if(h=(s&31)<<6|o&63,h<128){p--;continue}t[r++]=h}else if((s&240)===224){if(p>=n)return this.interim[0]=s,r;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=n)return this.interim[0]=s,this.interim[1]=o,r;if(l=e[p++],(l&192)!==128){p--;continue}if(h=(s&15)<<12|(o&63)<<6|l&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((s&248)===240){if(p>=n)return this.interim[0]=s,r;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=n)return this.interim[0]=s,this.interim[1]=o,r;if(l=e[p++],(l&192)!==128){p--;continue}if(p>=n)return this.interim[0]=s,this.interim[1]=o,this.interim[2]=l,r;if(u=e[p++],(u&192)!==128){p--;continue}if(h=(s&7)<<18|(o&63)<<12|(l&63)<<6|u&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},JA="",Go=" ",Pd=class eD{constructor(){this.fg=0,this.bg=0,this.extended=new Lm}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new eD;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Lm=class tD{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 tD(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Mi=class nD extends Pd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Lm,this.combinedData=""}static fromCharData(t){let n=new nD;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?Vo(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()]}},K2="di$target",ry="di$dependencies",A_=new Map;function bV(e){return e[ry]||[]}function rr(e){if(A_.has(e))return A_.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");yV(t,n,s)};return t._id=e,A_.set(e,t),t}function yV(e,t,n){t[K2]===t?t[ry].push({id:e,index:n}):(t[ry]=[{id:e,index:n}],t[K2]=t)}var Nr=rr("BufferService"),rD=rr("CoreMouseService"),rl=rr("CoreService"),xV=rr("CharsetService"),_x=rr("InstantiationService"),iD=rr("LogService"),Ar=rr("OptionsService"),sD=rr("OscLinkService"),wV=rr("UnicodeService"),Bd=rr("DecorationService"),iy=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var g;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,o=new Mi,l=n.getTrimmedLength(),u=-1,h=-1,d=!1;for(let p=0;p<l;p++)if(!(h===-1&&!n.hasContent(p))){if(n.loadCell(p,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=p,u=o.extended.urlId;continue}else d=o.extended.urlId!==u;else h!==-1&&(d=!0);if(d||h!==-1&&p===l-1){let v=(g=this._oscLinkService.getLinkData(u))==null?void 0:g.uri;if(v){let y={start:{x:h+1,y:e},end:{x:p+(!d&&p===l-1?1:0),y:e}},w=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let S=new URL(v);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||r.push({text:v,range:y,activate:(S,C)=>s?s.activate(S,C,y):SV(S,C),hover:(S,C)=>{var k;return(k=s==null?void 0:s.hover)==null?void 0:k.call(s,S,C,y)},leave:(S,C)=>{var k;return(k=s==null?void 0:s.leave)==null?void 0:k.call(s,S,C,y)}})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=p,u=o.extended.urlId):(h=-1,u=-1)}}t(r)}};iy=Sn([ze(0,Nr),ze(1,Ar),ze(2,sD)],iy);function SV(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
508
|
+
|
|
509
|
+
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 Lp=rr("CharSizeService"),so=rr("CoreBrowserService"),bx=rr("MouseService"),oo=rr("RenderService"),CV=rr("SelectionService"),oD=rr("CharacterJoinerService"),Ec=rr("ThemeService"),aD=rr("LinkProviderService"),kV=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?G2.isErrorNoTelemetry(e)?new G2(e.message+`
|
|
510
|
+
|
|
511
|
+
`+e.stack):new Error(e.message+`
|
|
512
|
+
|
|
513
|
+
`+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)}},EV=new kV;function sm(e){RV(e)||EV.onUnexpectedError(e)}var sy="Canceled";function RV(e){return e instanceof TV?!0:e instanceof Error&&e.name===sy&&e.message===sy}var TV=class extends Error{constructor(){super(sy),this.name=this.message}};function MV(e){return new Error(`Illegal argument: ${e}`)}var G2=class oy extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof oy)return t;let n=new oy;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ay=class lD extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,lD.prototype)}};function Jr(e,t=0){return e[e.length-(1+t)]}var NV;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function r(o){return o>0}e.isGreaterThan=r;function s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(NV||(NV={}));function AV(e,t){let n=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(n,arguments))),s}}var cD;(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 o(M){return t(M)?M:s(M)}e.wrap=o;function l(M){return M||n}e.from=l;function*u(M){for(let j=M.length-1;j>=0;j--)yield M[j]}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 g(M,j){let D=0;for(let L of M)if(j(L,D++))return!0;return!1}e.some=g;function p(M,j){for(let D of M)if(j(D))return D}e.find=p;function*v(M,j){for(let D of M)j(D)&&(yield D)}e.filter=v;function*y(M,j){let D=0;for(let L of M)yield j(L,D++)}e.map=y;function*w(M,j){let D=0;for(let L of M)yield*j(L,D++)}e.flatMap=w;function*S(...M){for(let j of M)yield*j}e.concat=S;function C(M,j,D){let L=D;for(let $ of M)L=j(L,$);return L}e.reduce=C;function*k(M,j,D=M.length){for(j<0&&(j+=M.length),D<0?D+=M.length:D>M.length&&(D=M.length);j<D;j++)yield M[j]}e.slice=k;function R(M,j=Number.POSITIVE_INFINITY){let D=[];if(j===0)return[D,M];let L=M[Symbol.iterator]();for(let $=0;$<j;$++){let Y=L.next();if(Y.done)return[D,e.empty()];D.push(Y.value)}return[D,{[Symbol.iterator](){return L}}]}e.consume=R;async function E(M){let j=[];for await(let D of M)j.push(D);return Promise.resolve(j)}e.asyncToArray=E})(cD||(cD={}));function Ya(e){if(cD.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 DV(...e){return fn(()=>Ya(e))}function fn(e){return{dispose:AV(()=>{e()})}}var uD=class dD{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ya(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?dD.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)}};uD.DISABLE_DISPOSED_WARNING=!1;var Xo=uD,yt=class{constructor(){this._store=new Xo,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)}};yt.None=Object.freeze({dispose(){}});var fc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Ks=typeof window=="object"?window:globalThis,ly=class cy{constructor(t){this.element=t,this.next=cy.Undefined,this.prev=cy.Undefined}};ly.Undefined=new ly(void 0);var mn=ly,Y2=class{constructor(){this._first=mn.Undefined,this._last=mn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===mn.Undefined}clear(){let e=this._first;for(;e!==mn.Undefined;){let t=e.next;e.prev=mn.Undefined,e.next=mn.Undefined,e=t}this._first=mn.Undefined,this._last=mn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new mn(e);if(this._first===mn.Undefined)this._first=n,this._last=n;else if(t){let s=this._last;this._last=n,n.prev=s,s.next=n}else{let s=this._first;this._first=n,n.next=s,s.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==mn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==mn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==mn.Undefined&&e.next!==mn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===mn.Undefined&&e.next===mn.Undefined?(this._first=mn.Undefined,this._last=mn.Undefined):e.next===mn.Undefined?(this._last=this._last.prev,this._last.next=mn.Undefined):e.prev===mn.Undefined&&(this._first=this._first.next,this._first.prev=mn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==mn.Undefined;)yield e.element,e=e.next}},jV=globalThis.performance&&typeof globalThis.performance.now=="function",OV=class hD{static create(t){return new hD(t)}constructor(t){this._now=jV&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},fr;(e=>{e.None=()=>yt.None;function t(I,W){return p(I,()=>{},0,void 0,!0,void 0,W)}e.defer=t;function n(I){return(W,K=null,q)=>{let O=!1,H;return H=I(U=>{if(!O)return H?H.dispose():O=!0,W.call(K,U)},null,q),O&&H.dispose(),H}}e.once=n;function r(I,W,K){return d((q,O=null,H)=>I(U=>q.call(O,W(U)),null,H),K)}e.map=r;function s(I,W,K){return d((q,O=null,H)=>I(U=>{W(U),q.call(O,U)},null,H),K)}e.forEach=s;function o(I,W,K){return d((q,O=null,H)=>I(U=>W(U)&&q.call(O,U),null,H),K)}e.filter=o;function l(I){return I}e.signal=l;function u(...I){return(W,K=null,q)=>{let O=DV(...I.map(H=>H(U=>W.call(K,U))));return g(O,q)}}e.any=u;function h(I,W,K,q){let O=K;return r(I,H=>(O=W(O,H),O),q)}e.reduce=h;function d(I,W){let K,q={onWillAddFirstListener(){K=I(O.fire,O)},onDidRemoveLastListener(){K==null||K.dispose()}},O=new Me(q);return W==null||W.add(O),O.event}function g(I,W){return W instanceof Array?W.push(I):W&&W.add(I),I}function p(I,W,K=100,q=!1,O=!1,H,U){let F,N,B,X=0,A,ne={leakWarningThreshold:H,onWillAddFirstListener(){F=I(Z=>{X++,N=W(N,Z),q&&!B&&(ae.fire(N),N=void 0),A=()=>{let te=N;N=void 0,B=void 0,(!q||X>1)&&ae.fire(te),X=0},typeof K=="number"?(clearTimeout(B),B=setTimeout(A,K)):B===void 0&&(B=0,queueMicrotask(A))})},onWillRemoveListener(){O&&X>0&&(A==null||A())},onDidRemoveLastListener(){A=void 0,F.dispose()}},ae=new Me(ne);return U==null||U.add(ae),ae.event}e.debounce=p;function v(I,W=0,K){return e.debounce(I,(q,O)=>q?(q.push(O),q):[O],W,void 0,!0,void 0,K)}e.accumulate=v;function y(I,W=(q,O)=>q===O,K){let q=!0,O;return o(I,H=>{let U=q||!W(H,O);return q=!1,O=H,U},K)}e.latch=y;function w(I,W,K){return[e.filter(I,W,K),e.filter(I,q=>!W(q),K)]}e.split=w;function S(I,W=!1,K=[],q){let O=K.slice(),H=I(N=>{O?O.push(N):F.fire(N)});q&&q.add(H);let U=()=>{O==null||O.forEach(N=>F.fire(N)),O=null},F=new Me({onWillAddFirstListener(){H||(H=I(N=>F.fire(N)),q&&q.add(H))},onDidAddFirstListener(){O&&(W?setTimeout(U):U())},onDidRemoveLastListener(){H&&H.dispose(),H=null}});return q&&q.add(F),F.event}e.buffer=S;function C(I,W){return(K,q,O)=>{let H=W(new R);return I(function(U){let F=H.evaluate(U);F!==k&&K.call(q,F)},void 0,O)}}e.chain=C;let k=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map(W){return this.steps.push(W),this}forEach(W){return this.steps.push(K=>(W(K),K)),this}filter(W){return this.steps.push(K=>W(K)?K:k),this}reduce(W,K){let q=K;return this.steps.push(O=>(q=W(q,O),q)),this}latch(W=(K,q)=>K===q){let K=!0,q;return this.steps.push(O=>{let H=K||!W(O,q);return K=!1,q=O,H?O:k}),this}evaluate(W){for(let K of this.steps)if(W=K(W),W===k)break;return W}}function E(I,W,K=q=>q){let q=(...F)=>U.fire(K(...F)),O=()=>I.on(W,q),H=()=>I.removeListener(W,q),U=new Me({onWillAddFirstListener:O,onDidRemoveLastListener:H});return U.event}e.fromNodeEventEmitter=E;function M(I,W,K=q=>q){let q=(...F)=>U.fire(K(...F)),O=()=>I.addEventListener(W,q),H=()=>I.removeEventListener(W,q),U=new Me({onWillAddFirstListener:O,onDidRemoveLastListener:H});return U.event}e.fromDOMEventEmitter=M;function j(I){return new Promise(W=>n(I)(W))}e.toPromise=j;function D(I){let W=new Me;return I.then(K=>{W.fire(K)},()=>{W.fire(void 0)}).finally(()=>{W.dispose()}),W.event}e.fromPromise=D;function L(I,W){return I(K=>W.fire(K))}e.forward=L;function $(I,W,K){return W(K),I(q=>W(q))}e.runAndSubscribe=$;class Y{constructor(W,K){this._observable=W,this._counter=0,this._hasChanged=!1;let q={onWillAddFirstListener:()=>{W.addObserver(this)},onDidRemoveLastListener:()=>{W.removeObserver(this)}};this.emitter=new Me(q),K&&K.add(this.emitter)}beginUpdate(W){this._counter++}handlePossibleChange(W){}handleChange(W,K){this._hasChanged=!0}endUpdate(W){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(I,W){return new Y(I,W).emitter.event}e.fromObservable=P;function V(I){return(W,K,q)=>{let O=0,H=!1,U={beginUpdate(){O++},endUpdate(){O--,O===0&&(I.reportChanges(),H&&(H=!1,W.call(K)))},handlePossibleChange(){},handleChange(){H=!0}};I.addObserver(U),I.reportChanges();let F={dispose(){I.removeObserver(U)}};return q instanceof Xo?q.add(F):Array.isArray(q)&&q.push(F),F}}e.fromObservableLight=V})(fr||(fr={}));var uy=class dy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${dy._idPool++}`,dy.all.add(this)}start(t){this._stopWatch=new OV,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}}};uy.all=new Set,uy._idPool=0;var LV=uy,zV=-1,fD=class mD{constructor(t,n,r=(mD._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[o,l]=this.getMostFrequentStack(),u=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(u),console.warn(o);let h=new IV(u,o);this._errorHandler(h)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,s]of this._stacks)(!t||n<s)&&(t=[r,s],n=s);return t}};fD._idPool=1;var PV=fD,BV=class pD{constructor(t){this.value=t}static create(){let t=new Error;return new pD(t.stack??"")}print(){console.warn(this.value.split(`
|
|
514
|
+
`).slice(2).join(`
|
|
515
|
+
`))}},IV=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},HV=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},FV=0,D_=class{constructor(e){this.value=e,this.id=FV++}},UV=2,$V,Me=class{constructor(e){var t,n,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new PV((e==null?void 0:e.onListenerError)??sm,((n=this._options)==null?void 0:n.leakWarningThreshold)??zV):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new LV(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var l,u,h,d,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let v=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new HV(`${p}. HINT: Stack shows most frequent listener (${v[1]}-times)`,v[0]);return(((l=this._options)==null?void 0:l.onListenerError)||sm)(y),yt.None}if(this._disposed)return yt.None;t&&(e=e.bind(t));let r=new D_(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=BV.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof D_?(this._deliveryQueue??(this._deliveryQueue=new WV),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(u=this._options)==null?void 0:u.onWillAddFirstListener)==null||h.call(u,this),this._listeners=r,(g=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||g.call(d,this)),this._size++;let o=fn(()=>{s==null||s(),this._removeListener(r)});return n instanceof Xo?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(e){var s,o,l,u;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.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*UV<=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)||sm;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 D_)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},WV=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}},hy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Me,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Me,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};hy.INSTANCE=new hy;var yx=hy;function VV(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}yx.INSTANCE.onDidChangeZoomLevel;function qV(e){return yx.INSTANCE.getZoomFactor(e)}yx.INSTANCE.onDidChangeFullscreen;var Rc=typeof navigator=="object"?navigator.userAgent:"",fy=Rc.indexOf("Firefox")>=0,KV=Rc.indexOf("AppleWebKit")>=0,xx=Rc.indexOf("Chrome")>=0,GV=!xx&&Rc.indexOf("Safari")>=0;Rc.indexOf("Electron/")>=0;Rc.indexOf("Android")>=0;var j_=!1;if(typeof Ks.matchMedia=="function"){let e=Ks.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ks.matchMedia("(display-mode: fullscreen)");j_=e.matches,VV(Ks,e,({matches:n})=>{j_&&t.matches||(j_=n)})}var ec="en",my=!1,py=!1,om=!1,gD=!1,Mf,am=ec,X2=ec,YV,zi,Ha=globalThis,hr,QR;typeof Ha.vscode<"u"&&typeof Ha.vscode.process<"u"?hr=Ha.vscode.process:typeof process<"u"&&typeof((QR=process==null?void 0:process.versions)==null?void 0:QR.node)=="string"&&(hr=process);var JR,XV=typeof((JR=hr==null?void 0:hr.versions)==null?void 0:JR.electron)=="string",ZV=XV&&(hr==null?void 0:hr.type)==="renderer",eT;if(typeof hr=="object"){my=hr.platform==="win32",py=hr.platform==="darwin",om=hr.platform==="linux",om&&hr.env.SNAP&&hr.env.SNAP_REVISION,hr.env.CI||hr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Mf=ec,am=ec;let e=hr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Mf=t.userLocale,X2=t.osLocale,am=t.resolvedLanguage||ec,YV=(eT=t.languagePack)==null?void 0:eT.translationsConfigFile}catch{}gD=!0}else typeof navigator=="object"&&!ZV?(zi=navigator.userAgent,my=zi.indexOf("Windows")>=0,py=zi.indexOf("Macintosh")>=0,(zi.indexOf("Macintosh")>=0||zi.indexOf("iPad")>=0||zi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,om=zi.indexOf("Linux")>=0,(zi==null?void 0:zi.indexOf("Mobi"))>=0,am=globalThis._VSCODE_NLS_LANGUAGE||ec,Mf=navigator.language.toLowerCase(),X2=Mf):console.error("Unable to resolve platform.");var vD=my,vs=py,QV=om,Z2=gD,bs=zi,Bo=am,JV;(e=>{function t(){return Bo}e.value=t;function n(){return Bo.length===2?Bo==="en":Bo.length>=3?Bo[0]==="e"&&Bo[1]==="n"&&Bo[2]==="-":!1}e.isDefaultVariant=n;function r(){return Bo==="en"}e.isDefault=r})(JV||(JV={}));var eq=typeof Ha.postMessage=="function"&&!Ha.importScripts;(()=>{if(eq){let e=[];Ha.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let o=e[r];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),o.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Ha.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var tq=!!(bs&&bs.indexOf("Chrome")>=0);bs&&bs.indexOf("Firefox")>=0;!tq&&bs&&bs.indexOf("Safari")>=0;bs&&bs.indexOf("Edg/")>=0;bs&&bs.indexOf("Android")>=0;var $l=typeof navigator=="object"?navigator:{};Z2||document.queryCommandSupported&&document.queryCommandSupported("copy")||$l&&$l.clipboard&&$l.clipboard.writeText,Z2||$l&&$l.clipboard&&$l.clipboard.readText;var wx=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}},O_=new wx,Q2=new wx,J2=new wx,nq=new Array(230),_D;(e=>{function t(u){return O_.keyCodeToStr(u)}e.toString=t;function n(u){return O_.strToKeyCode(u)}e.fromString=n;function r(u){return Q2.keyCodeToStr(u)}e.toUserSettingsUS=r;function s(u){return J2.keyCodeToStr(u)}e.toUserSettingsGeneral=s;function o(u){return Q2.strToKeyCode(u)||J2.strToKeyCode(u)}e.fromUserSettings=o;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 O_.keyCodeToStr(u)}e.toElectronAccelerator=l})(_D||(_D={}));var rq=class bD{constructor(t,n,r,s,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=s,this.keyCode=o}equals(t){return t instanceof bD&&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 iq([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},iq=class{constructor(e){if(e.length===0)throw MV("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 sq(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return _D.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(fy)switch(t){case 59:return 85;case 60:if(QV)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(vs)return 57;break}else if(KV&&(vs&&t===93||!vs&&t===92))return 57;return nq[t]||0}var oq=vs?256:2048,aq=512,lq=1024,cq=vs?2048:256,eE=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=sq(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|=oq),this.altKey&&(t|=aq),this.shiftKey&&(t|=lq),this.metaKey&&(t|=cq),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new rq(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},tE=new WeakMap;function uq(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 dq=class{static getSameOriginWindowChain(e){let t=tE.get(e);if(!t){t=[],tE.set(e,t);let n=e,r;do r=uq(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 o of s){let l=o.window.deref();if(n+=(l==null?void 0:l.scrollY)??0,r+=(l==null?void 0:l.scrollX)??0,l===t||!o.iframeElement)break;let u=o.iframeElement.getBoundingClientRect();n+=u.top,r+=u.left}return{top:n,left:r}}},Nf=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=dq.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},nE=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(xx){let o=navigator.userAgent.match(/Chrome\/(\d+)/);r=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,u=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")r?this.deltaY=o.wheelDeltaY/(120*u):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?fy&&!vs?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")GV&&vD?this.deltaX=-(o.wheelDeltaX/120):r?this.deltaX=o.wheelDeltaX/(120*u):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?fy&&!vs?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},yD=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),hq;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof fq?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:fr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:yD})})(hq||(hq={}));var fq=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?yD:(this._emitter||(this._emitter=new Me),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Sx=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 ay("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new ay("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},mq=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 ay("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=fn(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},pq;(e=>{async function t(r){let s,o=await Promise.all(r.map(l=>l.then(u=>u,u=>{s||(s=u)})));if(typeof s<"u")throw s;return o}e.settled=t;function n(r){return new Promise(async(s,o)=>{try{await r(s,o)}catch(l){o(l)}})}e.withAsyncBody=n})(pq||(pq={}));var rE=class yi{static fromArray(t){return new yi(n=>{n.emitMany(t)})}static fromPromise(t){return new yi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new yi(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new yi(async n=>{await Promise.all(t.map(async r=>{for await(let s of r)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Me,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await fr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new yi(async r=>{for await(let s of t)r.emitOne(n(s))})}map(t){return yi.map(this,t)}static filter(t,n){return new yi(async r=>{for await(let s of t)n(s)&&r.emitOne(s)})}filter(t){return yi.filter(this,t)}static coalesce(t){return yi.filter(t,n=>!!n)}coalesce(){return yi.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return yi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};rE.EMPTY=rE.fromArray([]);var{getWindow:ms,getWindowId:gq,onDidRegisterWindow:vq}=(function(){let e=new Map,t={window:Ks,disposables:new Xo};e.set(Ks.vscodeWindowId,t);let n=new Me,r=new Me,s=new Me;function o(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 yt.None;let u=new Xo,h={window:l,disposables:u.add(new Xo)};return e.set(l.vscodeWindowId,h),u.add(fn(()=>{e.delete(l.vscodeWindowId),r.fire(l)})),u.add(it(l,Yn.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:o,getWindow(l){var d;let u=l;if((d=u==null?void 0:u.ownerDocument)!=null&&d.defaultView)return u.ownerDocument.defaultView.window;let h=l;return h!=null&&h.view?h.view.window:Ks},getDocument(l){return ms(l).document}}})(),_q=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function it(e,t,n,r){return new _q(e,t,n,r)}var iE=function(e,t,n,r){return it(e,t,n,r)},Cx,bq=class extends mq{constructor(e){super(),this.defaultTarget=e&&ms(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},sE=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){sm(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=o=>{n.set(o,!1);let l=e.get(o)??[];for(t.set(o,l),e.set(o,[]),r.set(o,!0);l.length>0;)l.sort(sE.sort),l.shift().execute();r.set(o,!1)};Cx=(o,l,u=0)=>{let h=gq(o),d=new sE(l,u),g=e.get(h);return g||(g=[],e.set(h,g)),g.push(d),n.get(h)||(n.set(h,!0),o.requestAnimationFrame(()=>s(h))),d}})();function yq(e){let t=e.getBoundingClientRect(),n=ms(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Yn={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"},xq=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Hr(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Hr(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Hr(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Hr(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Hr(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Hr(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Hr(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Hr(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Hr(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Hr(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Hr(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Hr(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Hr(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Hr(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Hr(e){return typeof e=="number"?`${e}px`:e}function Qu(e){return new xq(e)}var xD=class{constructor(){this._hooks=new Xo,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 o=e;try{e.setPointerCapture(t),this._hooks.add(fn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=ms(e)}this._hooks.add(it(o,Yn.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(it(o,Yn.POINTER_UP,l=>this.stopMonitoring(!0)))}};function wq(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 o=`$memoize$${t}`;n[r]=function(...l){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,l)}),this[o]}}var is;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(is||(is={}));var Hu=class gr extends yt{constructor(){super(),this.dispatched=!1,this.targets=new Y2,this.ignoreTargets=new Y2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(fr.runAndSubscribe(vq,({window:t,disposables:n})=>{n.add(it(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(it(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(it(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Ks,disposables:this._store}))}static addTarget(t){if(!gr.isTouchDevice())return yt.None;gr.INSTANCE||(gr.INSTANCE=new gr);let n=gr.INSTANCE.targets.push(t);return fn(n)}static ignoreTarget(t){if(!gr.isTouchDevice())return yt.None;gr.INSTANCE||(gr.INSTANCE=new gr);let n=gr.INSTANCE.ignoreTargets.push(t);return fn(n)}static isTouchDevice(){return"ontouchstart"in Ks||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let o=t.targetTouches.item(r);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let l=this.newGestureEvent(is.Start,o.target);l.pageX=o.pageX,l.pageY=o.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,l=n.changedTouches.length;o<l;o++){let u=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(u.identifier))){console.warn("move of an UNKNOWN touch",u);continue}let h=this.activeTouches[u.identifier],d=Date.now()-h.initialTimeStamp;if(d<gr.HOLD_DELAY&&Math.abs(h.initialPageX-Jr(h.rollingPageX))<30&&Math.abs(h.initialPageY-Jr(h.rollingPageY))<30){let g=this.newGestureEvent(is.Tap,h.initialTarget);g.pageX=Jr(h.rollingPageX),g.pageY=Jr(h.rollingPageY),this.dispatchEvent(g)}else if(d>=gr.HOLD_DELAY&&Math.abs(h.initialPageX-Jr(h.rollingPageX))<30&&Math.abs(h.initialPageY-Jr(h.rollingPageY))<30){let g=this.newGestureEvent(is.Contextmenu,h.initialTarget);g.pageX=Jr(h.rollingPageX),g.pageY=Jr(h.rollingPageY),this.dispatchEvent(g)}else if(s===1){let g=Jr(h.rollingPageX),p=Jr(h.rollingPageY),v=Jr(h.rollingTimestamps)-h.rollingTimestamps[0],y=g-h.rollingPageX[0],w=p-h.rollingPageY[0],S=[...this.targets].filter(C=>h.initialTarget instanceof Node&&C.contains(h.initialTarget));this.inertia(t,S,r,Math.abs(y)/v,y>0?1:-1,g,Math.abs(w)/v,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(is.End,h.initialTarget)),delete this.activeTouches[u.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===is.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>gr.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===is.Change||t.type===is.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,o=t.initialTarget;for(;o&&o!==r;)s++,o=o.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,o,l,u,h,d){this.handle=Cx(t,()=>{let g=Date.now(),p=g-r,v=0,y=0,w=!0;s+=gr.SCROLL_FRICTION*p,u+=gr.SCROLL_FRICTION*p,s>0&&(w=!1,v=o*s*p),u>0&&(w=!1,y=h*u*p);let S=this.newGestureEvent(is.Change);S.translationX=v,S.translationY=y,n.forEach(C=>C.dispatchEvent(S)),w||this.inertia(t,n,g,s,o,l+v,u,h,d+y)})}onTouchMove(t){let n=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let l=this.activeTouches[o.identifier],u=this.newGestureEvent(is.Change,l.initialTarget);u.translationX=o.pageX-Jr(l.rollingPageX),u.translationY=o.pageY-Jr(l.rollingPageY),u.pageX=o.pageX,u.pageY=o.pageY,this.dispatchEvent(u),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(o.pageX),l.rollingPageY.push(o.pageY),l.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Hu.SCROLL_FRICTION=-.005,Hu.HOLD_DELAY=700,Hu.CLEAR_TAP_COUNT_TIME=400,Sn([wq],Hu,"isTouchDevice",1);var Sq=Hu,kx=class extends yt{onclick(e,t){this._register(it(e,Yn.CLICK,n=>t(new Nf(ms(e),n))))}onmousedown(e,t){this._register(it(e,Yn.MOUSE_DOWN,n=>t(new Nf(ms(e),n))))}onmouseover(e,t){this._register(it(e,Yn.MOUSE_OVER,n=>t(new Nf(ms(e),n))))}onmouseleave(e,t){this._register(it(e,Yn.MOUSE_LEAVE,n=>t(new Nf(ms(e),n))))}onkeydown(e,t){this._register(it(e,Yn.KEY_DOWN,n=>t(new eE(n))))}onkeyup(e,t){this._register(it(e,Yn.KEY_UP,n=>t(new eE(n))))}oninput(e,t){this._register(it(e,Yn.INPUT,t))}onblur(e,t){this._register(it(e,Yn.BLUR,t))}onfocus(e,t){this._register(it(e,Yn.FOCUS,t))}onchange(e,t){this._register(it(e,Yn.CHANGE,t))}ignoreGesture(e){return Sq.ignoreTarget(e)}},oE=11,Cq=class extends kx{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=oE+"px",this.domNode.style.height=oE+"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 xD),this._register(iE(this.bgDomNode,Yn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(iE(this.domNode,Yn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new bq),this._pointerdownScheduleRepeatTimer=this._register(new Sx)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ms(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},kq=class gy{constructor(t,n,r,s,o,l,u){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,s=s|0,o=o|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),o<0&&(o=0),u+o>l&&(u=l-o),u<0&&(u=0),this.width=n,this.scrollWidth=r,this.scrollLeft=s,this.height=o,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 gy(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 gy(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,o=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:o,heightChanged:l,scrollHeightChanged:u,scrollTopChanged:h}}},Eq=class extends yt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new kq(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 lE(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=lE.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)))}},aE=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function L_(e,t){let n=t-e;return function(r){return e+n*Mq(r)}}function Rq(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var lE=class vy{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,o;return t<n?(s=t+.75*r,o=n-.75*r):(s=t-.75*r,o=n+.75*r),Rq(L_(t,s),L_(o,n),.33)}return L_(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 aE(r,s,!1)}return new aE(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return vy.start(t,n,r)}static start(t,n,r){r=r+10;let s=Date.now()-10;return new vy(t,n,s,r)}};function Tq(e){return Math.pow(e,3)}function Mq(e){return 1-Tq(1-e)}var Nq=class extends yt{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 Sx)}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":"")))}},Aq=140,wD=class extends kx{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 Nq(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new xD),this._shouldRender=!0,this.domNode=Qu(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(it(this.domNode.domNode,Yn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Cq(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Qu(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(it(this.slider.domNode,Yn.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=yq(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 o=this._sliderOrthogonalPointerPosition(s),l=Math.abs(o-n);if(vD&&l>Aq){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()}},SD=class _y{constructor(t,n,r,s,o,l){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=o,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new _y(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,o){let l=Math.max(0,r-t),u=Math.max(0,l-2*n),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(u),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(r*u/s))),g=(u-d)/(s-r),p=o*g;return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(d),computedSliderRatio:g,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=_y._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)}},Dq=class extends wD{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new SD(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}},jq=class extends wD{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new SD(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}},Oq=500,cE=50,Lq=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},by=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 o=s===this._front?t:Math.pow(2,-r);if(t-=o,n+=this._memory[s].score*o,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(xx){let n=ms(t.browserEvent),r=qV(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,o=new Lq(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=o,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]=o),o.score=this._computeScore(o,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),o=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(o,u),1),g=Math.max(s,l),p=Math.max(o,u);g%h===0&&p%d===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};by.INSTANCE=new by;var zq=by,Pq=class extends kx{constructor(e,t,n){super(),this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Me),this.onWillScroll=this._onWillScroll.event,this._options=Iq(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 jq(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Dq(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Qu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Qu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Qu(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new Sx),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ya(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,vs&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new nE(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ya(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new nE(n))};this._mouseWheelToDispose.push(it(this._listenOnDomNode,Yn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=zq.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+o===0?l=o=0:Math.abs(o)>=Math.abs(l)?l=0:o=0),this._options.flipAxes&&([o,l]=[l,o]);let u=!vs&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!l&&(l=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),d={};if(o){let g=cE*o,p=h.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(d,p)}if(l){let g=cE*l,p=h.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(d,p)}d=this._scrollable.validateScrollPosition(d),(h.scrollLeft!==d.scrollLeft||h.scrollTop!==d.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",s=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${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(),Oq)}},Bq=class extends Pq{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 Iq(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,vs&&(t.className+=" mac"),t}var yy=class extends yt{constructor(e,t,n,r,s,o,l,u){super(),this._bufferService=n,this._optionsService=l,this._renderService=u,this._onRequestScrollLines=this._register(new Me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new Eq({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Cx(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Bq(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(fr.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(fn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(fn(()=>this._styleElement.remove())),this._register(fr.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
516
|
+
`)})),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}};yy=Sn([ze(2,Nr),ze(3,so),ze(4,rD),ze(5,Ec),ze(6,Ar),ze(7,oo)],yy);var xy=class extends yt{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(o=>this._removeDecoration(o))),this._register(fn(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};xy=Sn([ze(1,Nr),ze(2,so),ze(3,Bd),ze(4,oo)],xy);var Hq=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},ns={full:0,left:0,center:0,right:0},Io={full:0,left:0,center:0,right:0},Cu={full:0,left:0,center:0,right:0},zm=class extends yt{constructor(e,t,n,r,s,o,l,u){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=s,this._optionsService=o,this._themeService=l,this._coreBrowserService=u,this._colorZoneStore=new Hq,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(fn(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Io.full=this._canvas.width,Io.left=e,Io.center=t,Io.right=e,this._refreshDrawHeightConstants(),Cu.full=1,Cu.left=1,Cu.center=1+Io.left,Cu.right=1+Io.left+Io.center}_refreshDrawHeightConstants(){ns.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);ns.left=t,ns.center=t,ns.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ns.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ns.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ns.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ns.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Cu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ns[e.position||"full"]/2),Io[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ns[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};zm=Sn([ze(2,Nr),ze(3,Bd),ze(4,oo),ze(5,Ar),ze(6,Ec),ze(7,so)],zm);var _e;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
517
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(_e||(_e={}));var lm;(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=""))(lm||(lm={}));var CD;(e=>e.ST=`${_e.ESC}\\`)(CD||(CD={}));var wy=class{constructor(e,t,n,r,s,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=s,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${_e.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};wy=Sn([ze(2,Nr),ze(3,Ar),ze(4,rl),ze(5,oo)],wy);var er=0,tr=0,nr=0,wn=0,uE={css:"#00000000",rgba:0},Bn;(e=>{function t(s,o,l,u){return u!==void 0?`#${Ta(s)}${Ta(o)}${Ta(l)}${Ta(u)}`:`#${Ta(s)}${Ta(o)}${Ta(l)}`}e.toCss=t;function n(s,o,l,u=255){return(s<<24|o<<16|l<<8|u)>>>0}e.toRgba=n;function r(s,o,l,u){return{css:e.toCss(s,o,l,u),rgba:e.toRgba(s,o,l,u)}}e.toColor=r})(Bn||(Bn={}));var un;(e=>{function t(h,d){if(wn=(d.rgba&255)/255,wn===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,p=d.rgba>>16&255,v=d.rgba>>8&255,y=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;er=y+Math.round((g-y)*wn),tr=w+Math.round((p-w)*wn),nr=S+Math.round((v-S)*wn);let C=Bn.toCss(er,tr,nr),k=Bn.toRgba(er,tr,nr);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,g){let p=cm.ensureContrastRatio(h.rgba,d.rgba,g);if(p)return Bn.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=r;function s(h){let d=(h.rgba|255)>>>0;return[er,tr,nr]=cm.toChannels(d),{css:Bn.toCss(er,tr,nr),rgba:d}}e.opaque=s;function o(h,d){return wn=Math.round(d*255),[er,tr,nr]=cm.toChannels(h.rgba),{css:Bn.toCss(er,tr,nr,wn),rgba:Bn.toRgba(er,tr,nr,wn)}}e.opacity=o;function l(h,d){return wn=h.rgba&255,o(h,wn*d/255)}e.multiplyOpacity=l;function u(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=u})(un||(un={}));var pn;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,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 er=parseInt(s.slice(1,2).repeat(2),16),tr=parseInt(s.slice(2,3).repeat(2),16),nr=parseInt(s.slice(3,4).repeat(2),16),Bn.toColor(er,tr,nr);case 5:return er=parseInt(s.slice(1,2).repeat(2),16),tr=parseInt(s.slice(2,3).repeat(2),16),nr=parseInt(s.slice(3,4).repeat(2),16),wn=parseInt(s.slice(4,5).repeat(2),16),Bn.toColor(er,tr,nr,wn);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=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(o)return er=parseInt(o[1]),tr=parseInt(o[2]),nr=parseInt(o[3]),wn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Bn.toColor(er,tr,nr,wn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[er,tr,nr,wn]=t.getImageData(0,0,1,1).data,wn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Bn.toRgba(er,tr,nr,wn),css:s}}e.toColor=r})(pn||(pn={}));var kr;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,o){let l=r/255,u=s/255,h=o/255,d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+g*.7152+p*.0722}e.relativeLuminance2=n})(kr||(kr={}));var cm;(e=>{function t(l,u){if(wn=(u&255)/255,wn===1)return u;let h=u>>24&255,d=u>>16&255,g=u>>8&255,p=l>>24&255,v=l>>16&255,y=l>>8&255;return er=p+Math.round((h-p)*wn),tr=v+Math.round((d-v)*wn),nr=y+Math.round((g-y)*wn),Bn.toRgba(er,tr,nr)}e.blend=t;function n(l,u,h){let d=kr.relativeLuminance(l>>8),g=kr.relativeLuminance(u>>8);if($s(d,g)<h){if(g<d){let y=r(l,u,h),w=$s(d,kr.relativeLuminance(y>>8));if(w<h){let S=s(l,u,h),C=$s(d,kr.relativeLuminance(S>>8));return w>C?y:S}return y}let p=s(l,u,h),v=$s(d,kr.relativeLuminance(p>>8));if(v<h){let y=r(l,u,h),w=$s(d,kr.relativeLuminance(y>>8));return v>w?p:y}return p}}e.ensureContrastRatio=n;function r(l,u,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=u>>24&255,y=u>>16&255,w=u>>8&255,S=$s(kr.relativeLuminance2(v,y,w),kr.relativeLuminance2(d,g,p));for(;S<h&&(v>0||y>0||w>0);)v-=Math.max(0,Math.ceil(v*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=$s(kr.relativeLuminance2(v,y,w),kr.relativeLuminance2(d,g,p));return(v<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=r;function s(l,u,h){let d=l>>24&255,g=l>>16&255,p=l>>8&255,v=u>>24&255,y=u>>16&255,w=u>>8&255,S=$s(kr.relativeLuminance2(v,y,w),kr.relativeLuminance2(d,g,p));for(;S<h&&(v<255||y<255||w<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=$s(kr.relativeLuminance2(v,y,w),kr.relativeLuminance2(d,g,p));return(v<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=s;function o(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=o})(cm||(cm={}));function Ta(e){let t=e.toString(16);return t.length<2?"0"+t:t}function $s(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Fq=class extends Pd{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Pm=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Mi}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,o=0,l=0,u=t.getFg(0),h=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==u||this._workCell.bg!==h){if(d-s>1){let g=this._getJoinedRanges(r,l,o,t,s);for(let p=0;p<g.length;p++)n.push(g[p])}s=d,l=o,u=this._workCell.fg,h=this._workCell.bg}o+=this._workCell.getChars().length||Go.length}if(this._bufferService.cols-s>1){let d=this._getJoinedRanges(r,l,o,t,s);for(let g=0;g<d.length;g++)n.push(d[g])}return n}_getJoinedRanges(e,t,n,r,s){let o=e.substring(t,n),l=[];try{l=this._characterJoiners[0].handler(o)}catch(u){console.error(u)}for(let u=1;u<this._characterJoiners.length;u++)try{let h=this._characterJoiners[u].handler(o);for(let d=0;d<h.length;d++)Pm._mergeRanges(l,h[d])}catch(h){console.error(h)}return this._stringRangesToCellRanges(l,r,s),l}_stringRangesToCellRanges(e,t,n){let r=0,s=!1,o=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||Go.length;if(h!==0){if(!s&&l[0]<=o&&(l[0]=u,s=!0),l[1]<=o){if(l[1]=u,l=e[++r],!l)break;l[0]<=o?(l[0]=u,s=!0):s=!1}o+=d}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(n){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Pm=Sn([ze(0,Nr)],Pm);function Uq(e){return 57508<=e&&e<=57558}function $q(e){return 9472<=e&&e<=9631}function Wq(e){return Uq(e)||$q(e)}function Vq(){return{css:{canvas:Af(),cell:Af()},device:{canvas:Af(),cell:Af(),char:{width:0,height:0,left:0,top:0}}}}function Af(){return{width:0,height:0}}var Sy=class{constructor(e,t,n,r,s,o,l){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=s,this._decorationService=o,this._themeService=l,this._workCell=new Mi,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,o,l,u,h,d,g){let p=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let S,C=0,k="",R=0,E=0,M=0,j=0,D=!1,L=0,$=!1,Y=0,P=0,V=[],I=d!==-1&&g!==-1;for(let W=0;W<w;W++){e.loadCell(W,this._workCell);let K=this._workCell.getWidth();if(K===0)continue;let q=!1,O=W>=P,H=W,U=this._workCell;if(v.length>0&&W===v[0][0]&&O){let je=v.shift(),Ye=this._isCellInSelection(je[0],t);for(R=je[0]+1;R<je[1];R++)O&&(O=Ye===this._isCellInSelection(R,t));O&&(O=!n||o<je[0]||o>=je[1]),O?(q=!0,U=new Fq(this._workCell,e.translateToString(!0,je[0],je[1]),je[1]-je[0]),H=je[1]-1,K=U.getWidth()):P=je[1]}let F=this._isCellInSelection(W,t),N=n&&W===o,B=I&&W>=d&&W<=g,X=!1;this._decorationService.forEachDecorationAtCell(W,t,void 0,je=>{X=!0});let A=U.getChars()||Go;if(A===" "&&(U.isUnderline()||U.isOverline())&&(A=" "),Y=K*u-h.get(A,U.isBold(),U.isItalic()),!S)S=this._document.createElement("span");else if(C&&(F&&$||!F&&!$&&U.bg===E)&&(F&&$&&y.selectionForeground||U.fg===M)&&U.extended.ext===j&&B===D&&Y===L&&!N&&!q&&!X&&O){U.isInvisible()?k+=Go:k+=A,C++;continue}else C&&(S.textContent=k),S=this._document.createElement("span"),C=0,k="";if(E=U.bg,M=U.fg,j=U.extended.ext,D=B,L=Y,$=F,q&&o>=W&&o<=H&&(o=W),!this._coreService.isCursorHidden&&N&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&V.push("xterm-cursor-blink"),V.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break}}if(U.isBold()&&V.push("xterm-bold"),U.isItalic()&&V.push("xterm-italic"),U.isDim()&&V.push("xterm-dim"),U.isInvisible()?k=Go:k=U.getChars()||Go,U.isUnderline()&&(V.push(`xterm-underline-${U.extended.underlineStyle}`),k===" "&&(k=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Pd.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let je=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&je<8&&(je+=8),S.style.textDecorationColor=y.ansi[je].css}U.isOverline()&&(V.push("xterm-overline"),k===" "&&(k=" ")),U.isStrikethrough()&&V.push("xterm-strikethrough"),B&&(S.style.textDecoration="underline");let ne=U.getFgColor(),ae=U.getFgColorMode(),Z=U.getBgColor(),te=U.getBgColorMode(),le=!!U.isInverse();if(le){let je=ne;ne=Z,Z=je;let Ye=ae;ae=te,te=Ye}let me,xe,Ae=!1;this._decorationService.forEachDecorationAtCell(W,t,void 0,je=>{je.options.layer!=="top"&&Ae||(je.backgroundColorRGB&&(te=50331648,Z=je.backgroundColorRGB.rgba>>8&16777215,me=je.backgroundColorRGB),je.foregroundColorRGB&&(ae=50331648,ne=je.foregroundColorRGB.rgba>>8&16777215,xe=je.foregroundColorRGB),Ae=je.options.layer==="top")}),!Ae&&F&&(me=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,Z=me.rgba>>8&16777215,te=50331648,Ae=!0,y.selectionForeground&&(ae=50331648,ne=y.selectionForeground.rgba>>8&16777215,xe=y.selectionForeground)),Ae&&V.push("xterm-decoration-top");let Re;switch(te){case 16777216:case 33554432:Re=y.ansi[Z],V.push(`xterm-bg-${Z}`);break;case 50331648:Re=Bn.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(S,`background-color:#${dE((Z>>>0).toString(16),"0",6)}`);break;case 0:default:le?(Re=y.foreground,V.push("xterm-bg-257")):Re=y.background}switch(me||U.isDim()&&(me=un.multiplyOpacity(Re,.5)),ae){case 16777216:case 33554432:U.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(S,Re,y.ansi[ne],U,me,void 0)||V.push(`xterm-fg-${ne}`);break;case 50331648:let je=Bn.toColor(ne>>16&255,ne>>8&255,ne&255);this._applyMinimumContrast(S,Re,je,U,me,xe)||this._addStyle(S,`color:#${dE(ne.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,Re,y.foreground,U,me,xe)||le&&V.push("xterm-fg-257")}V.length&&(S.className=V.join(" "),V.length=0),!N&&!q&&!X&&O?C++:S.textContent=k,Y!==this.defaultSpacing&&(S.style.letterSpacing=`${Y}px`),p.push(S),W=H}return S&&C&&(S.textContent=k),p}_applyMinimumContrast(e,t,n,r,s,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Wq(r.getCode()))return!1;let l=this._getContrastCache(r),u;if(!s&&!o&&(u=l.getColor(t.rgba,n.rgba)),u===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);u=un.ensureContrastRatio(s||t,o||n,h),l.setColor((s||t).rgba,(o||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]}};Sy=Sn([ze(1,oD),ze(2,Ar),ze(3,so),ze(4,rl),ze(5,Bd),ze(6,Ec)],Sy);function dE(e,t,n){for(;e.length<n;)e=t+e;return e}var qq=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 o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,r,s,o],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let s=e;t&&(s+="B"),n&&(s+="I");let o=this._holey.get(s);if(o===void 0){let l=0;t&&(l|=1),n&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(s,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Kq=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,o=t[1]-s,l=n[1]-s,u=Math.max(o,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=o,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 Gq(){return new Kq}var z_="xterm-dom-renderer-owner-",_i="xterm-rows",Df="xterm-fg-",hE="xterm-bg-",ku="xterm-focus",jf="xterm-selection",Yq=1,Cy=class extends yt{constructor(e,t,n,r,s,o,l,u,h,d,g,p,v,y){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=s,this._helperContainer=o,this._linkifier2=l,this._charSizeService=h,this._optionsService=d,this._bufferService=g,this._coreService=p,this._coreBrowserService=v,this._themeService=y,this._terminalClass=Yq++,this._rowElements=[],this._selectionRenderModel=Gq(),this.onRequestRedraw=this._register(new Me).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(_i),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(jf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Vq(),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(Sy,document),this._element.classList.add(z_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(fn(()=>{this._element.classList.remove(z_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new qq(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${_i} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${_i} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${_i} .xterm-dim { color: ${un.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${_i}.${ku} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${_i}.${ku} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${_i}.${ku} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${_i} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${jf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${jf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${jf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Df}${o} { color: ${l.css}; }${this._terminalSelector} .${Df}${o}.xterm-dim { color: ${un.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${hE}${o} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Df}257 { color: ${un.opaque(e.background).css}; }${this._terminalSelector} .${Df}257.xterm-dim { color: ${un.multiplyOpacity(un.opaque(e.background),.5).css}; }${this._terminalSelector} .${hE}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(ku),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ku),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,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(n){let h=e[0]>t[0];u.appendChild(this._createSelectionElement(o,h?t[0]:e[0],h?e[0]:t[0],l-o+1))}else{let h=r===o?e[0]:0,d=o===s?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(o,h,d));let g=l-o-1;if(u.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==l){let p=s===l?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,0,p))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,t,n,r=1){let s=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-t);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${o}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),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let d=h+n.ydisp,g=this._rowElements[h],p=n.lines.get(d);if(!g||!p)break;g.replaceChildren(...this._rowFactory.createRow(p,d,d===r,l,u,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${z_}${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,o){n<0&&(e=0),r<0&&(t=0);let l=this._bufferService.rows-1;n=Math.max(Math.min(n,l),0),r=Math.max(Math.min(r,l),0),s=Math.min(s,this._bufferService.cols);let u=this._bufferService.buffer,h=u.ybase+u.y,d=Math.min(u.x,s-1),g=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,v=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=r;++y){let w=y+u.ydisp,S=this._rowElements[y],C=u.lines.get(w);if(!S||!C)break;S.replaceChildren(...this._rowFactory.createRow(C,w,w===h,p,v,d,g,this.dimensions.css.cell.width,this._widthCache,o?y===n?e:0:-1,o?(y===r?t:s)-1:-1))}}};Cy=Sn([ze(7,_x),ze(8,Lp),ze(9,Ar),ze(10,Nr),ze(11,rl),ze(12,so),ze(13,Ec)],Cy);var ky=class extends yt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Me),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Zq(this._optionsService))}catch{this._measureStrategy=this._register(new Xq(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())}};ky=Sn([ze(2,Ar)],ky);var kD=class extends yt{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)}},Xq=class extends kD{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}},Zq=class extends kD{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}},Qq=class extends yt{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 Jq(this._window)),this._onDprChange=this._register(new Me),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Me),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(fr.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(it(this._textarea,"focus",()=>this._isFocused=!0)),this._register(it(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Jq=class extends yt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new fc),this._onDprChange=this._register(new Me),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(fn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=it(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},eK=class extends yt{constructor(){super(),this.linkProviders=[],this._register(fn(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Ex(e,t,n){let r=n.getBoundingClientRect(),s=e.getComputedStyle(n),o=parseInt(s.getPropertyValue("padding-left")),l=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-o,t.clientY-r.top-l]}function tK(e,t,n,r,s,o,l,u,h){if(!o)return;let d=Ex(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 Ey=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,s){return tK(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=Ex(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])}}};Ey=Sn([ze(0,oo),ze(1,Lp)],Ey);var nK=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=[]}},ED={};hV(ED,{getSafariVersion:()=>iK,isChromeOS:()=>ND,isFirefox:()=>RD,isIpad:()=>sK,isIphone:()=>oK,isLegacyEdge:()=>rK,isLinux:()=>Rx,isMac:()=>Bm,isNode:()=>zp,isSafari:()=>TD,isWindows:()=>MD});var zp=typeof process<"u"&&"title"in process,Id=zp?"node":navigator.userAgent,Hd=zp?"node":navigator.platform,RD=Id.includes("Firefox"),rK=Id.includes("Edge"),TD=/^((?!chrome|android).)*safari/i.test(Id);function iK(){if(!TD)return 0;let e=Id.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Bm=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Hd),sK=Hd==="iPad",oK=Hd==="iPhone",MD=["Windows","Win16","Win32","WinCE"].includes(Hd),Rx=Hd.indexOf("Linux")>=0,ND=/\bCrOS\b/.test(Id),AD=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()}},aK=class extends AD{_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())}}},lK=class extends AD{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Im=!zp&&"requestIdleCallback"in window?lK:aK,cK=class{constructor(){this._queue=new Im}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ry=class extends yt{constructor(e,t,n,r,s,o,l,u,h){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=s,this._coreBrowserService=u,this._renderer=this._register(new fc),this._pausedResizeTask=new cK,this._observerDisposable=this._register(new fc),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Me),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Me),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Me),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Me),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new nK((d,g)=>this._renderRows(d,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new uK(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(fn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=fn(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Ry=Sn([ze(2,Ar),ze(3,Lp),ze(4,rl),ze(5,Bd),ze(6,Nr),ze(7,so),ze(8,Ec)],Ry);var uK=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 dK(e,t,n,r){let s=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return mK(s,o,e,t,n,r)+Pp(o,t,n,r)+pK(s,o,e,t,n,r);let l;if(o===t)return l=s>e?"D":"C",pd(Math.abs(s-e),md(l,r));l=o>t?"D":"C";let u=Math.abs(o-t),h=fK(o>t?e:s,n)+(u-1)*n.cols+1+hK(o>t?s:e);return pd(h,md(l,r))}function hK(e,t){return e-1}function fK(e,t){return t.cols-e}function mK(e,t,n,r,s,o){return Pp(t,r,s,o).length===0?"":pd(jD(e,t,e,t-Xa(t,s),!1,s).length,md("D",o))}function Pp(e,t,n,r){let s=e-Xa(e,n),o=t-Xa(t,n),l=Math.abs(s-o)-gK(e,t,n);return pd(l,md(DD(e,t),r))}function pK(e,t,n,r,s,o){let l;Pp(t,r,s,o).length>0?l=r-Xa(r,s):l=t;let u=r,h=vK(e,t,n,r,s,o);return pd(jD(e,l,n,u,h==="C",s).length,md(h,o))}function gK(e,t,n){var l;let r=0,s=e-Xa(e,n),o=t-Xa(t,n);for(let u=0;u<Math.abs(s-o);u++){let h=DD(e,t)==="A"?-1:1;(l=n.buffer.lines.get(s+h*u))!=null&&l.isWrapped&&r++}return r}function Xa(e,t){let n=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return n}function vK(e,t,n,r,s,o){let l;return Pp(n,r,s,o).length>0?l=r-Xa(r,s):l=t,e<n&&l<=r||e>=n&&l<r?"C":"D"}function DD(e,t){return e>t?"A":"B"}function jD(e,t,n,r,s,o){let l=e,u=t,h="";for(;(l!==n||u!==r)&&u>=0&&u<o.buffer.lines.length;)l+=s?1:-1,s&&l>o.cols-1?(h+=o.buffer.translateBufferLineToString(u,!1,e,l),l=0,e=0,u++):!s&&l<0&&(h+=o.buffer.translateBufferLineToString(u,!1,0,e+1),l=o.cols-1,e=l,u--);return h+o.buffer.translateBufferLineToString(u,!1,e,l)}function md(e,t){let n=t?"O":"[";return _e.ESC+n+e}function pd(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var _K=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 fE(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 P_=50,bK=15,yK=50,xK=500,wK=" ",SK=new RegExp(wK,"g"),Ty=class extends yt{constructor(e,t,n,r,s,o,l,u,h){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=s,this._mouseService=o,this._optionsService=l,this._renderService=u,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Mi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Me),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Me),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Me),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new _K(this._bufferService),this._activeSelectionMode=0,this._register(fn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let u=n.translateBufferLineToString(l,!0,s,o);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 o=e[1]+1;o<=t[1]-1;o++){let l=n.lines.get(o),u=n.translateBufferLineToString(o,!0);l!=null&&l.isWrapped?r[r.length-1]+=u:r.push(u)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),l=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(s=>s.replace(SK," ")).join(MD?`\r
|
|
518
|
+
`:`
|
|
519
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Rx&&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,o;let n=(o=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=fE(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=Ex(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,-P_),P_),t/=P_,t/Math.abs(t)+Math.round(t*(bK-1)))}shouldForceSelection(e){return Bm?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),yK)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Bm&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<xK&&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=dK(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,o=s.lines.get(e[1]);if(!o)return;let l=s.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(o,e[0]),h=u,d=e[0]-u,g=0,p=0,v=0,y=0;if(l.charAt(u)===" "){for(;u>0&&l.charAt(u-1)===" ";)u--;for(;h<l.length&&l.charAt(h+1)===" ";)h++}else{let C=e[0],k=e[0];o.getWidth(C)===0&&(g++,C--),o.getWidth(k)===2&&(p++,k++);let R=o.getString(k).length;for(R>1&&(y+=R-1,h+=R-1);C>0&&u>0&&!this._isCharWordSeparator(o.loadCell(C-1,this._workCell));){o.loadCell(C-1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,C--):E>1&&(v+=E-1,u-=E-1),u--,C--}for(;k<o.length&&h+1<l.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,k++):E>1&&(y+=E-1,h+=E-1),h++,k++}}h++;let w=u+d-g+v,S=Math.min(this._bufferService.cols,h-u+g+p-v-y);if(!(!t&&l.slice(u,h).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let C=s.lines.get(e[1]-1);if(C&&o.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let R=this._bufferService.cols-k.start;w-=R,S+=R}}}if(r&&w+S===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let C=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=fE(n,this._bufferService.cols)}};Ty=Sn([ze(3,Nr),ze(4,rl),ze(5,bx),ze(6,Ar),ze(7,oo),ze(8,so)],Ty);var mE=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={}}},pE=class{constructor(){this._color=new mE,this._css=new mE}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Un=Object.freeze((()=>{let e=[pn.toColor("#2e3436"),pn.toColor("#cc0000"),pn.toColor("#4e9a06"),pn.toColor("#c4a000"),pn.toColor("#3465a4"),pn.toColor("#75507b"),pn.toColor("#06989a"),pn.toColor("#d3d7cf"),pn.toColor("#555753"),pn.toColor("#ef2929"),pn.toColor("#8ae234"),pn.toColor("#fce94f"),pn.toColor("#729fcf"),pn.toColor("#ad7fa8"),pn.toColor("#34e2e2"),pn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],o=t[n%6];e.push({css:Bn.toCss(r,s,o),rgba:Bn.toRgba(r,s,o)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Bn.toCss(r,r,r),rgba:Bn.toRgba(r,r,r)})}return e})()),Aa=pn.toColor("#ffffff"),Fu=pn.toColor("#000000"),gE=pn.toColor("#ffffff"),vE=Fu,Eu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},CK=Aa,My=class extends yt{constructor(e){super(),this._optionsService=e,this._contrastCache=new pE,this._halfContrastCache=new pE,this._onChangeColors=this._register(new Me),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Aa,background:Fu,cursor:gE,cursorAccent:vE,selectionForeground:void 0,selectionBackgroundTransparent:Eu,selectionBackgroundOpaque:un.blend(Fu,Eu),selectionInactiveBackgroundTransparent:Eu,selectionInactiveBackgroundOpaque:un.blend(Fu,Eu),scrollbarSliderBackground:un.opacity(Aa,.2),scrollbarSliderHoverBackground:un.opacity(Aa,.4),scrollbarSliderActiveBackground:un.opacity(Aa,.5),overviewRulerBorder:Aa,ansi:Un.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Qt(e.foreground,Aa),t.background=Qt(e.background,Fu),t.cursor=un.blend(t.background,Qt(e.cursor,gE)),t.cursorAccent=un.blend(t.background,Qt(e.cursorAccent,vE)),t.selectionBackgroundTransparent=Qt(e.selectionBackground,Eu),t.selectionBackgroundOpaque=un.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Qt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=un.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Qt(e.selectionForeground,uE):void 0,t.selectionForeground===uE&&(t.selectionForeground=void 0),un.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=un.opacity(t.selectionBackgroundTransparent,.3)),un.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=un.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Qt(e.scrollbarSliderBackground,un.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Qt(e.scrollbarSliderHoverBackground,un.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Qt(e.scrollbarSliderActiveBackground,un.opacity(t.foreground,.5)),t.overviewRulerBorder=Qt(e.overviewRulerBorder,CK),t.ansi=Un.slice(),t.ansi[0]=Qt(e.black,Un[0]),t.ansi[1]=Qt(e.red,Un[1]),t.ansi[2]=Qt(e.green,Un[2]),t.ansi[3]=Qt(e.yellow,Un[3]),t.ansi[4]=Qt(e.blue,Un[4]),t.ansi[5]=Qt(e.magenta,Un[5]),t.ansi[6]=Qt(e.cyan,Un[6]),t.ansi[7]=Qt(e.white,Un[7]),t.ansi[8]=Qt(e.brightBlack,Un[8]),t.ansi[9]=Qt(e.brightRed,Un[9]),t.ansi[10]=Qt(e.brightGreen,Un[10]),t.ansi[11]=Qt(e.brightYellow,Un[11]),t.ansi[12]=Qt(e.brightBlue,Un[12]),t.ansi[13]=Qt(e.brightMagenta,Un[13]),t.ansi[14]=Qt(e.brightCyan,Un[14]),t.ansi[15]=Qt(e.brightWhite,Un[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Qt(e.extendedAnsi[r],Un[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};My=Sn([ze(0,Ar)],My);function Qt(e,t){if(e!==void 0)try{return pn.toColor(e)}catch{}return t}var kK=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)}},EK=class{constructor(){this._services=new kK,this._services.set(_x,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=bV(e).sort((o,l)=>o.index-l.index),r=[];for(let o of n){let l=this._services.get(o.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);r.push(l)}let 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)}},RK={trace:0,debug:1,info:2,warn:3,error:4,off:5},TK="xterm.js: ",Ny=class extends yt{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=RK[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?"":TK)+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)}};Ny=Sn([ze(0,Ar)],Ny);var _E=class extends yt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Me),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Me),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Me),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let 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}},_t=3,Pn=Object.freeze(new Pd),Of=0,B_=2,Uu=class OD{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*_t);let s=n||Mi.fromCharData([0,JA,1,0]);for(let o=0;o<t;++o)this.setCell(o,s);this.length=t}get(t){let n=this._data[t*_t+0],r=n&2097151;return[this._data[t*_t+1],n&2097152?this._combined[t]:r?Vo(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*_t+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*_t+0]=t|2097152|n[2]<<22):this._data[t*_t+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*_t+0]>>22}hasWidth(t){return this._data[t*_t+0]&12582912}getFg(t){return this._data[t*_t+1]}getBg(t){return this._data[t*_t+2]}hasContent(t){return this._data[t*_t+0]&4194303}getCodePoint(t){let n=this._data[t*_t+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*_t+0]&2097152}getString(t){let n=this._data[t*_t+0];return n&2097152?this._combined[t]:n&2097151?Vo(n&2097151):""}isProtected(t){return this._data[t*_t+2]&536870912}loadCell(t,n){return Of=t*_t,n.content=this._data[Of+0],n.fg=this._data[Of+1],n.bg=this._data[Of+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*_t+0]=n.content,this._data[t*_t+1]=n.fg,this._data[t*_t+2]=n.bg}setCellFromCodepoint(t,n,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*_t+0]=n|r<<22,this._data[t*_t+1]=s.fg,this._data[t*_t+2]=s.bg}addCodepointToCell(t,n,r){let s=this._data[t*_t+0];s&2097152?this._combined[t]+=Vo(n):s&2097151?(this._combined[t]=Vo(s&2097151)+Vo(n),s&=-2097152,s|=2097152):s=n|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*_t+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 Mi;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,s));for(let o=0;o<n;++o)this.setCell(t+o,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 Mi;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,s));for(let o=this.length-n;o<this.length;++o)this.setCell(o,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*B_<this._data.buffer.byteLength;let r=t*_t;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 o=Object.keys(this._extendedAttrs);for(let l=0;l<o.length;l++){let u=parseInt(o[l],10);u>=t&&delete this._extendedAttrs[u]}}return this.length=t,r*4*B_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*B_<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 OD(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*_t+0]&4194303)return t+(this._data[t*_t+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*_t+0]&4194303||this._data[t*_t+2]&50331648)return t+(this._data[t*_t+0]>>22);return 0}copyCellsFrom(t,n,r,s,o){let l=t._data;if(o)for(let h=s-1;h>=0;h--){for(let d=0;d<_t;d++)this._data[(r+h)*_t+d]=l[(n+h)*_t+d];l[(n+h)*_t+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}else for(let h=0;h<s;h++){for(let d=0;d<_t;d++)this._data[(r+h)*_t+d]=l[(n+h)*_t+d];l[(n+h)*_t+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 o="";for(;n<r;){let l=this._data[n*_t+0],u=l&2097151,h=l&2097152?this._combined[n]:u?Vo(u):Go;if(o+=h,s)for(let d=0;d<h.length;++d)s.push(n);n+=l>>22||1}return s&&s.push(n),o}};function MK(e,t,n,r,s,o){let l=[];for(let u=0;u<e.length-1;u++){let h=u,d=e.get(++h);if(!d.isWrapped)continue;let g=[e.get(u)];for(;h<e.length&&d.isWrapped;)g.push(d),d=e.get(++h);if(!o&&r>=u&&r<h){u+=g.length-1;continue}let p=0,v=gd(g,p,t),y=1,w=0;for(;y<g.length;){let C=gd(g,y,t),k=C-w,R=n-v,E=Math.min(k,R);g[p].copyCellsFrom(g[y],w,v,E,!1),v+=E,v===n&&(p++,v=0),w+=E,w===C&&(y++,w=0),v===0&&p!==0&&g[p-1].getWidth(n-1)===2&&(g[p].copyCellsFrom(g[p-1],n-1,v++,1,!1),g[p-1].setCell(n-1,s))}g[p].replaceCells(v,n,s);let S=0;for(let C=g.length-1;C>0&&(C>p||g[C].getTrimmedLength()===0);C--)S++;S>0&&(l.push(u+g.length-S),l.push(S)),u+=g.length-1}return l}function NK(e,t){let n=[],r=0,s=t[r],o=0;for(let l=0;l<e.length;l++)if(s===l){let u=t[++r];e.onDeleteEmitter.fire({index:l-o,amount:u}),l+=u-1,o+=u,s=t[++r]}else n.push(l);return{layout:n,countRemoved:o}}function AK(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 DK(e,t,n){let r=[],s=e.map((h,d)=>gd(e,d,t)).reduce((h,d)=>h+d),o=0,l=0,u=0;for(;u<s;){if(s-u<n){r.push(s-u);break}o+=n;let h=gd(e,l,t);o>h&&(o-=h,l++);let d=e[l].getWidth(o-1)===2;d&&o--;let g=d?n-1:n;r.push(g),u+=g}return r}function gd(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?n-1:n}var LD=class zD{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=zD._nextId++,this._onDispose=this.register(new Me),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ya(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};LD._nextId=1;var jK=LD,qn={},Da=qn.B;qn[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};qn.A={"#":"£"};qn.B=void 0;qn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};qn.C=qn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};qn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};qn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};qn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};qn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};qn.E=qn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};qn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};qn.H=qn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};qn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var bE=4294967295,yE=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=Pn.clone(),this.savedCharset=Da,this.markers=[],this._nullCell=Mi.fromCharData([0,JA,1,0]),this._whitespaceCell=Mi.fromCharData([0,Go,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Im,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _E(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Lm),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Lm),this._whitespaceCell}getBlankLine(e,t){return new Uu(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>bE?bE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Pn);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 _E(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Pn),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 o=0;if(this._rows<t)for(let l=this._rows;l<t;l++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Uu(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Uu(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),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=MK(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Pn),n);if(r.length>0){let s=NK(this.lines,r);AK(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Pn),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Uu(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(Pn),s=[],o=0;for(let l=this.lines.length-1;l>=0;l--){let u=this.lines.get(l);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let h=[u];for(;u.isWrapped&&l>0;)u=this.lines.get(--l),h.unshift(u);if(!n){let E=this.ybase+this.y;if(E>=l&&E<l+h.length)continue}let d=h[h.length-1].getTrimmedLength(),g=DK(h,this._cols,e),p=g.length-h.length,v;this.ybase===0&&this.y!==this.lines.length-1?v=Math.max(0,this.y-this.lines.maxLength+p):v=Math.max(0,this.lines.length-this.lines.maxLength+p);let y=[];for(let E=0;E<p;E++){let M=this.getBlankLine(Pn,!0);y.push(M)}y.length>0&&(s.push({start:l+h.length+o,newLines:y}),o+=y.length),h.push(...y);let w=g.length-1,S=g[w];S===0&&(w--,S=g[w]);let C=h.length-p-1,k=d;for(;C>=0;){let E=Math.min(k,S);if(h[w]===void 0)break;if(h[w].copyCellsFrom(h[C],k-E,S-E,E,!0),S-=E,S===0&&(w--,S=g[w]),k-=E,k===0){C--;let M=Math.max(C,0);k=gd(h,M,this._cols)}}for(let E=0;E<h.length;E++)g[E]<e&&h[E].setCell(g[E],r);let R=p-v;for(;R-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(s.length>0){let l=[],u=[];for(let S=0;S<this.lines.length;S++)u.push(this.lines.get(S));let h=this.lines.length,d=h-1,g=0,p=s[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let v=0;for(let S=Math.min(this.lines.maxLength-1,h+o-1);S>=0;S--)if(p&&p.start>d+v){for(let C=p.newLines.length-1;C>=0;C--)this.lines.set(S--,p.newLines[C]);S++,l.push({index:d+1,amount:p.newLines.length}),v+=p.newLines.length,p=s[++g]}else this.lines.set(S,u[d--]);let y=0;for(let S=l.length-1;S>=0;S--)l[S].index+=y,this.lines.onInsertEmitter.fire(l[S]),y+=l[S].amount;let w=Math.max(0,h+o-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 jK(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)}},OK=class extends yt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Me),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new yE(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new yE(!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)}},PD=2,BD=1,Ay=class extends yt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Me),this.onResize=this._onResize.event,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,PD),this.rows=Math.max(e.rawOptions.rows||0,BD),this.buffers=this._register(new OK(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,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;o===n.lines.length-1?l?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(o+1,0,r.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=o-s+1;n.lines.shiftElements(s+1,l-1,-1),n.lines.set(o,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Ay=Sn([ze(0,Ar)],Ay);var Wl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Bm,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},LK=["normal","bold","100","200","300","400","500","600","700","800","900"],zK=class extends yt{constructor(e){super(),this._onOptionChange=this._register(new Me),this.onOptionChange=this._onOptionChange.event;let t={...Wl};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(fn(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Wl))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Wl))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Wl[e]),!PK(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Wl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=LK.includes(t)?t:Wl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function PK(e){return e==="block"||e==="underline"||e==="bar"}function $u(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]&&$u(e[r],t-1);return n}var xE=Object.freeze({insertMode:!1}),wE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Dy=class extends yt{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Me),this.onData=this._onData.event,this._onUserInput=this._register(new Me),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Me),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Me),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=$u(xE),this.decPrivateModes=$u(wE)}reset(){this.modes=$u(xE),this.decPrivateModes=$u(wE)}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))}};Dy=Sn([ze(0,Nr),ze(1,iD),ze(2,Ar)],Dy);var SE={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 I_(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 H_=String.fromCharCode,CE={DEFAULT:e=>{let t=[I_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${H_(t[0])}${H_(t[1])}${H_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${I_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${I_(e,!0)};${e.x};${e.y}${t}`}},jy=class extends yt{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Me),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(SE))this.addProtocol(r,SE[r]);for(let r of Object.keys(CE))this.addEncoding(r,CE[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)}};jy=Sn([ze(0,Nr),ze(1,rl),ze(2,Ar)],jy);var F_=[[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]],BK=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],$n;function IK(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 HK=class{constructor(){if(this.version="6",!$n){$n=new Uint8Array(65536),$n.fill(1),$n[0]=0,$n.fill(0,1,32),$n.fill(0,127,160),$n.fill(2,4352,4448),$n[9001]=2,$n[9002]=2,$n.fill(2,11904,42192),$n[12351]=1,$n.fill(2,44032,55204),$n.fill(2,63744,64256),$n.fill(2,65040,65050),$n.fill(2,65072,65136),$n.fill(2,65280,65377),$n.fill(2,65504,65511);for(let e=0;e<F_.length;++e)$n.fill(0,F_[e][0],F_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?$n[e]:IK(e,BK)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let s=Ia.extractWidth(t);s===0?r=!1:s>n&&(n=s)}return Ia.createPropertyValue(0,n,r)}},Ia=class um{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Me,this.onChange=this._onChange.event;let t=new HK;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 o=0;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return n+this.wcwidth(l);let d=t.charCodeAt(o);56320<=d&&d<=57343?l=(l-55296)*1024+d-56320+65536:n+=this.wcwidth(d)}let u=this.charProperties(l,r),h=um.extractWidth(u);um.extractShouldJoin(u)&&(h-=um.extractWidth(r)),n+=h,r=u}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},FK=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 kE(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 Ru=2147483647,UK=256,ID=class Oy{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>UK)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 Oy;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 o=0;o<s.length;++o)n.addSubParam(s[o]);else n.addParam(s)}return n}clone(){let t=new Oy(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>Ru?Ru: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>Ru?Ru: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,Ru):t}},Tu=[],$K=class{constructor(){this._state=0,this._active=Tu,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=Tu}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=Tu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Tu,!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",Op(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=Tu,this._id=-1,this._state=0}}},ei=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Op(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Mu=[],WK=class{constructor(){this._handlers=Object.create(null),this._active=Mu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Mu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Mu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Mu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Op(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Mu,this._ident=0}},Wu=new ID;Wu.addParam(0);var EE=class{constructor(e){this._handler=e,this._data="",this._params=Wu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Wu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Op(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=Wu,this._data="",this._hitLimit=!1,n));return this._params=Wu,this._data="",this._hitLimit=!1,t}},VK=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=n<<4|r}},ki=160,qK=(function(){let e=new VK(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 o=n(0,14),l;e.setDefault(1,0),e.addMany(r,0,2,0);for(l in o)e.addMany([24,26,153,154],l,3,0),e.addMany(n(128,144),l,3,0),e.addMany(n(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ki,0,2,0),e.add(ki,8,5,8),e.add(ki,6,0,6),e.add(ki,11,0,11),e.add(ki,13,13,13),e})(),KK=class extends yt{constructor(e=qK){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 ID,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(fn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new $K),this._dcsParser=this._register(new WK),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 o=e.intermediates.charCodeAt(s);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let 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,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let 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,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let u=o;u<t;++u){switch(r=e[u],s=this._transitions.table[this.currentState<<8|(r<160?r:ki)],s>>4){case 2:for(let v=u+1;;++v){if(v>=t||(r=e[v])<32||r>126&&r<ki){this._printHandler(e,u,v),u=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<ki){this._printHandler(e,u,v),u=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<ki){this._printHandler(e,u,v),u=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<ki){this._printHandler(e,u,v),u=v-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],d=h?h.length-1:-1;for(;d>=0&&(l=h[d](this._params),l!==!0);d--)if(l instanceof Promise)return this._preserveStack(3,h,d,s,u),l;d<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++u<t&&(r=e[u])>47&&r<60);u--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let g=this._escHandlers[this._collect<<8|r],p=g?g.length-1:-1;for(;p>=0&&(l=g[p](),l!==!0);p--)if(l instanceof Promise)return this._preserveStack(4,g,p,s,u),l;p<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let v=u+1;;++v)if(v>=t||(r=e[v])===24||r===26||r===27||r>127&&r<ki){this._dcsParser.put(e,u,v),u=v-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,s,u),l;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let v=u+1;;v++)if(v>=t||(r=e[v])<32||r>127&&r<ki){this._oscParser.put(e,u,v),u=v-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,s,u),l;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},GK=/^([\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})$/,YK=/^[\da-f]+$/;function RE(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=GK.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),YK.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 o=parseInt(t.slice(n*s,n*s+n),16);r[s]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return r}}function U_(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 XK(e,t=16){let[n,r,s]=e;return`rgb:${U_(n,t)}/${U_(r,t)}/${U_(s,t)}`}var ZK={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ho=131072,TE=10;function ME(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var NE=5e3,AE=0,QK=class extends yt{constructor(e,t,n,r,s,o,l,u,h=new KK){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=s,this._oscLinkService=o,this._coreMouseService=l,this._unicodeService=u,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new vV,this._utf8Decoder=new _V,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Pn.clone(),this._eraseAttrDataInternal=Pn.clone(),this._onRequestBell=this._register(new Me),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Me),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Me),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Me),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Me),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Me),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Me),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Me),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Me),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Me),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Me),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Me),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Me),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Ly(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:g.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,g,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:g,data:p})}),this._parser.setDcsHandlerFallback((d,g,p)=>{g==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:g,payload:p})}),this._parser.setPrintHandler((d,g,p)=>this.print(d,g,p)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(_e.BEL,()=>this.bell()),this._parser.setExecuteHandler(_e.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(_e.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(_e.BS,()=>this.backspace()),this._parser.setExecuteHandler(_e.HT,()=>this.tab()),this._parser.setExecuteHandler(_e.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(_e.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(lm.IND,()=>this.index()),this._parser.setExecuteHandler(lm.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(lm.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ei(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new ei(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new ei(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new ei(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new ei(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new ei(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new ei(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new ei(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new ei(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new ei(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new ei(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new ei(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in qn)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new EE((d,g)=>this.requestStatusString(d,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),NE))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${NE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,s=this._activeBuffer.y,o=0,l=this._parseStack.paused;if(l){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ho&&(o=this._parseStack.position+Ho)}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<Ho&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ho))),l||this._dirtyRowTracker.clearRange(),e.length>Ho)for(let d=o;d<e.length;d+=Ho){let g=d+Ho<e.length?d+Ho:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(d,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(r,s,p,d),this._logSlowResolvingAsync(n),n}else if(!l){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,s,d,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let u=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(u,this._bufferService.rows-1)})}print(e,t,n){let r,s,o=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,u=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,g=this._curAttrData,p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let v=this._parser.precedingJoinState;for(let y=t;y<n;++y){if(r=e[y],r<127&&o){let k=o[String.fromCharCode(r)];k&&(r=k.charCodeAt(0))}let w=this._unicodeService.charProperties(r,v);s=Ia.extractWidth(w);let S=Ia.extractShouldJoin(w),C=S?Ia.extractWidth(v):0;if(v=w,l&&this._onA11yChar.fire(Vo(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-C>u){if(h){let k=p,R=this._activeBuffer.x-C;for(this._activeBuffer.x=C,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&p instanceof Uu&&p.copyCellsFrom(k,R,0,C,!1);R<u;)k.setCellFromCodepoint(R++,0,1,g)}else if(this._activeBuffer.x=u-1,s===2)continue}if(S&&this._activeBuffer.x){let k=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-k,r,s);for(let R=s-C;--R>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(d&&(p.insertCells(this._activeBuffer.x,s-C,this._activeBuffer.getNullCell(g)),p.getWidth(u-1)===2&&p.setCellFromCodepoint(u-1,0,1,g)),p.setCellFromCodepoint(this._activeBuffer.x++,r,s,g),s>0)for(;--s;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=v,this._activeBuffer.x<u&&n-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>ME(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new EE(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ei(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let 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(Pn));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Ia.extractWidth(t),s=this._activeBuffer.x-r,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),l=new Uint32Array(o.length*n),u=0;for(let d=0;d<o.length;){let g=o.codePointAt(d)||0;l[u++]=g,d+=g>65535?2:1}let h=u;for(let d=1;d<n;++d)l.copyWithin(h,0,u),h+=u;return this.print(l,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(_e.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(_e.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(_e.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(_e.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(_e.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Da),this._charsetService.setgCharset(1,Da),this._charsetService.setgCharset(2,Da),this._charsetService.setgCharset(3,Da);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:o}=this._coreMouseService,l=this._coreService,{buffers:u,cols:h}=this._bufferService,{active:d,alt:g}=u,p=this._optionsService.rawOptions,v=(S,C)=>(l.triggerDataEvent(`${_e.ESC}[${t?"":"?"}${S};${C}$y`),!0),y=S=>S?1:2,w=e.params[0];return t?w===2?v(w,4):w===4?v(w,y(l.modes.insertMode)):w===12?v(w,3):w===20?v(w,y(p.convertEol)):v(w,0):w===1?v(w,y(r.applicationCursorKeys)):w===3?v(w,p.windowOptions.setWinLines?h===80?2:h===132?1:0:0):w===6?v(w,y(r.origin)):w===7?v(w,y(r.wraparound)):w===8?v(w,3):w===9?v(w,y(s==="X10")):w===12?v(w,y(p.cursorBlink)):w===25?v(w,y(!l.isCursorHidden)):w===45?v(w,y(r.reverseWraparound)):w===66?v(w,y(r.applicationKeypad)):w===67?v(w,4):w===1e3?v(w,y(s==="VT200")):w===1002?v(w,y(s==="DRAG")):w===1003?v(w,y(s==="ANY")):w===1004?v(w,y(r.sendFocus)):w===1005?v(w,4):w===1006?v(w,y(o==="SGR")):w===1015?v(w,4):w===1016?v(w,y(o==="SGR_PIXELS")):w===1048?v(w,1):w===47||w===1047||w===1049?v(w,y(d===g)):w===2004?v(w,y(r.bracketedPasteMode)):w===2026?v(w,y(r.synchronizedOutput)):v(w,0)}_updateAttrColor(e,t,n,r,s){return t===2?(e|=50331648,e&=-16777216,e|=Pd.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,o=0;do{if(r[o+s]=e.params[t+o],e.hasSubParams(t+o)){let l=e.getSubParams(t+o),u=0;do r[1]===5&&(s=1),r[o+u+1+s]=l[u];while(++u<l.length&&u+o+1+s<r.length);break}if(r[1]===5&&o+s>=2||r[1]===2&&o+s>=5)break;r[1]&&(s=1)}while(++o+t<e.length&&o+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 o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Pn.fg,e.bg=Pn.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|=Pn.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Pn.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|=Pn.fg&16777215,r.bg&=-67108864,r.bg|=Pn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${_e.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${_e.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${_e.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Pn.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!ME(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${_e.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>TE&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>TE&&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 o=parseInt(r);if(DE(o))if(s==="?")t.push({type:0,index:o});else{let l=RE(s);l&&t.push({type:1,index:o,color:l})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,s=n.findIndex(o=>o.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=RE(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]);DE(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Da),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(ZK[e[0]],qn[e[1]]||Da),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Pn.clone(),this._eraseAttrDataInternal=Pn.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 Mi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=l=>(this._coreService.triggerDataEvent(`${_e.ESC}${l}${_e.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Ly=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&&(AE=e,e=t,t=AE),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ly=Sn([ze(0,Nr)],Ly);function DE(e){return 0<=e&&e<256}var JK=5e7,jE=12,eG=50,tG=class extends yt{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Me),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>JK)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>=jE?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(n,u);s.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=jE)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>eG&&(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()}},zy=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 o=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};zy=Sn([ze(0,Nr)],zy);var OE=!1,nG=class extends yt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new fc),this._onBinary=this._register(new Me),this.onBinary=this._onBinary.event,this._onData=this._register(new Me),this.onData=this._onData.event,this._onLineFeed=this._register(new Me),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Me),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Me),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Me),this._instantiationService=new EK,this.optionsService=this._register(new zK(e)),this._instantiationService.setService(Ar,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Ay)),this._instantiationService.setService(Nr,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ny)),this._instantiationService.setService(iD,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Dy)),this._instantiationService.setService(rl,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(jy)),this._instantiationService.setService(rD,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ia)),this._instantiationService.setService(wV,this.unicodeService),this._charsetService=this._instantiationService.createInstance(FK),this._instantiationService.setService(xV,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(zy),this._instantiationService.setService(sD,this._oscLinkService),this._inputHandler=this._register(new QK(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(fr.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(fr.forward(this._bufferService.onResize,this._onResize)),this._register(fr.forward(this.coreService.onData,this._onData)),this._register(fr.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new tG((t,n)=>this._inputHandler.parse(t,n))),this._register(fr.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Me),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!OE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),OE=!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,PD),t=Math.max(t,BD),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(kE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(kE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=fn(()=>{for(let t of e)t.dispose()})}}},rG={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 iG(e,t,n,r){var l;let s={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=_e.ESC+"OA":s.key=_e.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=_e.ESC+"OD":s.key=_e.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=_e.ESC+"OC":s.key=_e.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=_e.ESC+"OB":s.key=_e.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":_e.DEL,e.altKey&&(s.key=_e.ESC+s.key);break;case 9:if(e.shiftKey){s.key=_e.ESC+"[Z";break}s.key=_e.HT,s.cancel=!0;break;case 13:s.key=e.altKey?_e.ESC+_e.CR:_e.CR,s.cancel=!0;break;case 27:s.key=_e.ESC,e.altKey&&(s.key=_e.ESC+_e.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=_e.ESC+"[1;"+(o+1)+"D":t?s.key=_e.ESC+"OD":s.key=_e.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=_e.ESC+"[1;"+(o+1)+"C":t?s.key=_e.ESC+"OC":s.key=_e.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=_e.ESC+"[1;"+(o+1)+"A":t?s.key=_e.ESC+"OA":s.key=_e.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=_e.ESC+"[1;"+(o+1)+"B":t?s.key=_e.ESC+"OB":s.key=_e.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=_e.ESC+"[2~");break;case 46:o?s.key=_e.ESC+"[3;"+(o+1)+"~":s.key=_e.ESC+"[3~";break;case 36:o?s.key=_e.ESC+"[1;"+(o+1)+"H":t?s.key=_e.ESC+"OH":s.key=_e.ESC+"[H";break;case 35:o?s.key=_e.ESC+"[1;"+(o+1)+"F":t?s.key=_e.ESC+"OF":s.key=_e.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=_e.ESC+"[5;"+(o+1)+"~":s.key=_e.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=_e.ESC+"[6;"+(o+1)+"~":s.key=_e.ESC+"[6~";break;case 112:o?s.key=_e.ESC+"[1;"+(o+1)+"P":s.key=_e.ESC+"OP";break;case 113:o?s.key=_e.ESC+"[1;"+(o+1)+"Q":s.key=_e.ESC+"OQ";break;case 114:o?s.key=_e.ESC+"[1;"+(o+1)+"R":s.key=_e.ESC+"OR";break;case 115:o?s.key=_e.ESC+"[1;"+(o+1)+"S":s.key=_e.ESC+"OS";break;case 116:o?s.key=_e.ESC+"[15;"+(o+1)+"~":s.key=_e.ESC+"[15~";break;case 117:o?s.key=_e.ESC+"[17;"+(o+1)+"~":s.key=_e.ESC+"[17~";break;case 118:o?s.key=_e.ESC+"[18;"+(o+1)+"~":s.key=_e.ESC+"[18~";break;case 119:o?s.key=_e.ESC+"[19;"+(o+1)+"~":s.key=_e.ESC+"[19~";break;case 120:o?s.key=_e.ESC+"[20;"+(o+1)+"~":s.key=_e.ESC+"[20~";break;case 121:o?s.key=_e.ESC+"[21;"+(o+1)+"~":s.key=_e.ESC+"[21~";break;case 122:o?s.key=_e.ESC+"[23;"+(o+1)+"~":s.key=_e.ESC+"[23~";break;case 123:o?s.key=_e.ESC+"[24;"+(o+1)+"~":s.key=_e.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=_e.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=_e.DEL:e.keyCode===219?s.key=_e.ESC:e.keyCode===220?s.key=_e.FS:e.keyCode===221&&(s.key=_e.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let u=(l=rG[e.keyCode])==null?void 0:l[e.shiftKey?1:0];if(u)s.key=_e.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,d=String.fromCharCode(h);e.shiftKey&&(d=d.toUpperCase()),s.key=_e.ESC+d}else if(e.keyCode===32)s.key=_e.ESC+(e.ctrlKey?_e.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),s.key=_e.ESC+h,s.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=_e.US),e.key==="@"&&(s.key=_e.NUL));break}return s}var Rn=0,sG=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Im,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Im,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,o)=>this._getKey(s)-this._getKey(o)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[s]=e[t],t++):r[s]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Rn=this._search(t),Rn===-1)||this._getKey(this._array[Rn])!==t)return!1;do if(this._array[Rn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Rn),!0;while(++Rn<this._array.length&&this._getKey(this._array[Rn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,o)=>s-o),t=0,n=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:n[r++]=this._array[s];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Rn=this._search(e),!(Rn<0||Rn>=this._array.length)&&this._getKey(this._array[Rn])===e))do yield this._array[Rn];while(++Rn<this._array.length&&this._getKey(this._array[Rn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Rn=this._search(e),!(Rn<0||Rn>=this._array.length)&&this._getKey(this._array[Rn])===e))do t(this._array[Rn]);while(++Rn<this._array.length&&this._getKey(this._array[Rn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,s=this._getKey(this._array[r]);if(s>e)n=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},$_=0,LE=0,oG=class extends yt{constructor(){super(),this._decorations=new sG(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Me),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Me),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(fn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new aG(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 o of this._decorations.getKeyIterator(t))r=o.options.x??0,s=r+(o.options.width??1),e>=r&&e<s&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,s=>{$_=s.options.x??0,LE=$_+(s.options.width??1),e>=$_&&e<LE&&(!n||(s.options.layer??"bottom")===n)&&r(s)})}},aG=class extends Xo{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Me),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Me),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=pn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=pn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},lG=1e3,cG=class{constructor(e,t=lG){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,o=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},zE=20,Hm=class extends yt{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 o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=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 cG(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
520
|
+
`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(it(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(fn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<zE+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
521
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===zE+1&&(this._liveRegion.textContent+=ny.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 o=n.lines.get(n.ydisp+s),l=[],u=(o==null?void 0:o.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"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===o||e.relatedTarget!==r)return;let l,u;if(t===0?(l=n,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(l=this._rowElements.shift(),u=n,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var u;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((u=r.textContent)==null?void 0:u.length)??0}),!this._rowContainer.contains(n.node))return;let s=({node:h,offset:d})=>{let g=h instanceof Text?h.parentNode:h,p=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(g);if(!v)return console.warn("columns is null. Race condition?"),null;let y=d<v.length?v[d]:v.slice(-1)[0]+1;return y>=this._terminal.cols&&(++p,y=0),{row:p,column:y}},o=s(t),l=s(n);if(!(!o||!l)){if(o.row>l.row||o.row===l.row&&o.column>=l.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(l.row-o.row)*this._terminal.cols-o.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:o[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Hm=Sn([ze(1,_x),ze(2,so),ze(3,oo)],Hm);var Py=class extends yt{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 Me),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Me),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(fn(()=>{var o;Ya(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(it(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(it(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(it(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(it(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let s=n[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(o=>{o==null||o.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,l]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):l.provideLinks(e.y,u=>{var d,g;if(this._isMouseOut)return;let h=u==null?void 0:u.map(p=>({link:p}));(d=this._activeProviderReplies)==null||d.set(o,h),n=this._checkLinkProviderResult(o,e,n),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let o=0;o<s.length;o++){let l=s[o],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(o--,1);break}n.add(d)}}}}_checkLinkProviderResult(e,t,n){var o;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=(o=this._activeProviderReplies.get(l))==null?void 0:o.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&&uG(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Ya(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,s,o;(r=this._currentLink)!=null&&r.state&&((o=(s=this._currentLink)==null?void 0:s.state)==null?void 0:o.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,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 o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,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}}};Py=Sn([ze(1,bx),ze(2,oo),ze(3,Nr),ze(4,aD)],Py);function uG(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 dG=class extends nG{constructor(e={}){super(e),this._linkifier=this._register(new fc),this.browser=ED,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new fc),this._onCursorMove=this._register(new Me),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Me),this.onKey=this._onKey.event,this._onRender=this._register(new Me),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Me),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Me),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Me),this.onBell=this._onBell.event,this._onFocus=this._register(new Me),this._onBlur=this._register(new Me),this._onA11yCharEmitter=this._register(new Me),this._onA11yTabEmitter=this._register(new Me),this._onWillOpen=this._register(new Me),this._setup(),this._decorationService=this._instantiationService.createInstance(oG),this._instantiationService.setService(Bd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(eK),this._instantiationService.setService(aD,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(iy)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(fr.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(fr.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(fr.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(fr.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(fn(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let s=un.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${_e.ESC}]${r};${XK(s)}${CD.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Bn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(l=>l[o]=Bn.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Hm,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(_e.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(_e.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(n),o=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=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(it(this.element,"copy",t=>{this.hasSelection()&&pV(t,this._selectionService)}));let e=t=>gV(t,this.textarea,this.coreService,this.optionsService);this._register(it(this.textarea,"paste",e)),this._register(it(this.element,"paste",e)),RD?this._register(it(this.element,"mousedown",t=>{t.button===2&&q2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(it(this.element,"contextmenu",t=>{q2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Rx&&this._register(it(this.element,"auxclick",t=>{t.button===1&&QA(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(it(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(it(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(it(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(it(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(it(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(it(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(it(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(it(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ty.get()),ND||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(Qq,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(so,this._coreBrowserService),this._register(it(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(it(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ky,this._document,this._helperContainer),this._instantiationService.setService(Lp,this._charSizeService),this._themeService=this._instantiationService.createInstance(My),this._instantiationService.setService(Ec,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Pm),this._instantiationService.setService(oD,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ry,this.rows,this.screenElement)),this._instantiationService.setService(oo,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(wy,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ey),this._instantiationService.setService(bx,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Py,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(yy,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ty,this.element,this.screenElement,r)),this._instantiationService.setService(CV,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(fr.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(xy,this.screenElement)),this._register(it(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Hm,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zm,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zm,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Cy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var d,g,p,v,y;let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let u,h;switch(o.overrideType||o.type){case"mousemove":h=32,o.buttons===void 0?(u=3,o.button!==void 0&&(u=o.button<3?o.button:3)):u=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":h=0,u=o.button<3?o.button:3;break;case"mousedown":h=1,u=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let w=o.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(o,(v=(p=(g=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:g.device)==null?void 0:p.cell)==null?void 0:v.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;h=w<0?0:1,u=4;break;default:return!1}return h===void 0||u===void 0||u>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:u,action:h,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(it(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(it(t,"wheel",o=>{var l,u,h,d,g;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(d=(h=(u=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:u.device)==null?void 0:h.cell)==null?void 0:d.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let p=_e.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(p,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){ZA(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=iG(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===_e.ETX||n.key===_e.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(hG(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(Pn));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(_e.ESC+"[I"):this.coreService.triggerDataEvent(_e.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${_e.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${_e.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function hG(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var fG=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)}},mG=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 Mi)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},PE=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 mG(t)}getNullCell(){return new Mi}},pG=class extends yt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Me),this.onBufferChange=this._onBufferChange.event,this._normal=new PE(this._core.buffers.normal,"normal"),this._alternate=new PE(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)}},gG=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)}},vG=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}},_G=["cols","rows"],rs=0,bG=class extends yt{constructor(e){super(),this._core=this._register(new dG(e)),this._addonManager=this._register(new fG),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(_G.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 gG(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new vG(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 pG(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
|
|
522
|
+
`,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 ty.get()},set promptLabel(e){ty.set(e)},get tooMuchOutput(){return ny.get()},set tooMuchOutput(e){ny.set(e)}}}_verifyIntegers(...e){for(rs of e)if(rs===1/0||isNaN(rs)||rs%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(rs of e)if(rs&&(rs===1/0||isNaN(rs)||rs%1!==0||rs<0))throw new Error("This API only accepts positive integers")}};const BE="lever-theme",yG={light:"/manifest.webmanifest",dark:"/manifest-dark.webmanifest",custom:"/manifest-dark.webmanifest"},HD=_.createContext(void 0),xG=e=>e==="light"||e==="dark"||e==="system"||e==="custom",La=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",IE=(e,t)=>{if(typeof document>"u")return;let n;e==="custom"?n=t==="system"||!t?La():t:n=e==="system"?La():e,document.documentElement.classList.toggle("dark",n==="dark")},HE=e=>{if(typeof document>"u")return;document.documentElement.style.colorScheme=e;const t=document.querySelector('meta[name="theme-color"]');if(t){const s=getComputedStyle(document.body).backgroundColor;s&&s!=="rgba(0, 0, 0, 0)"&&s!=="transparent"&&t.setAttribute("content",s)}const n=document.querySelector('link[rel="manifest"]#app-manifest'),r=yG[e];n&&n.getAttribute("href")!==r&&n.setAttribute("href",r)};function wG({children:e}){const t=gn(g=>g.themePreference),n=gn(g=>g.setThemePreference),r=gn(g=>g.colorTheme),s=gn(g=>g.customAppearance),o=gn(g=>g.backgroundImage),l=gn(g=>g.backgroundOpacity),u=gn(g=>g.backgroundBlur);_.useEffect(()=>{if(typeof window>"u")return;const g=window.localStorage.getItem(BE);xG(g)&&(gn.getState().themePreference==="system"&&g!=="system"&&n(g),window.localStorage.removeItem(BE))},[]),_.useEffect(()=>{IE(t,s);const g=t==="custom"?s==="system"?La():s:t==="system"?La():t;HE(g)},[t,s]),_.useEffect(()=>{if(t!=="system"&&(t!=="custom"||s!=="system"))return;const g=window.matchMedia("(prefers-color-scheme: dark)"),p=()=>{IE(t,s),HE(La())};return g.addEventListener?(g.addEventListener("change",p),()=>g.removeEventListener("change",p)):(g.addListener(p),()=>g.removeListener(p))},[t,s]),_.useEffect(()=>{typeof document>"u"||(t==="custom"?document.documentElement.setAttribute("data-theme",r):document.documentElement.removeAttribute("data-theme"))},[t,r]),_.useEffect(()=>{if(typeof document>"u")return;let g=document.getElementById("kaizen-custom-theme-styles");g||(g=document.createElement("style"),g.id="kaizen-custom-theme-styles",document.head.appendChild(g));const p=t==="custom"&&o&&o.trim()!=="",v=[];if(p){const y=u?u*2:0;v.push(`
|
|
523
|
+
body {
|
|
524
|
+
background-image: none !important;
|
|
525
|
+
background-color: transparent !important;
|
|
526
|
+
}
|
|
527
|
+
body::before {
|
|
528
|
+
content: "";
|
|
529
|
+
position: fixed;
|
|
530
|
+
top: -${y}px;
|
|
531
|
+
left: -${y}px;
|
|
532
|
+
right: -${y}px;
|
|
533
|
+
bottom: -${y}px;
|
|
534
|
+
background-image: url("${o}");
|
|
535
|
+
background-size: cover;
|
|
536
|
+
background-position: center;
|
|
537
|
+
filter: blur(${u}px);
|
|
538
|
+
z-index: -2;
|
|
539
|
+
pointer-events: none;
|
|
540
|
+
}
|
|
541
|
+
body::after {
|
|
542
|
+
content: "";
|
|
543
|
+
position: fixed;
|
|
544
|
+
inset: 0;
|
|
545
|
+
background-color: hsl(var(--background) / ${l});
|
|
546
|
+
z-index: -1;
|
|
547
|
+
pointer-events: none;
|
|
548
|
+
}
|
|
549
|
+
#root {
|
|
550
|
+
background-color: transparent !important;
|
|
551
|
+
}
|
|
552
|
+
:root {
|
|
553
|
+
--color-background: transparent !important;
|
|
554
|
+
--color-card: hsl(var(--card) / 0.15) !important;
|
|
555
|
+
--color-popover: hsl(var(--popover) / 0.8) !important;
|
|
556
|
+
--color-muted: hsl(var(--muted) / 0.25) !important;
|
|
557
|
+
}
|
|
558
|
+
.kaizen-terminal, .xterm-viewport, .xterm-screen {
|
|
559
|
+
background-color: transparent !important;
|
|
560
|
+
}
|
|
561
|
+
`)}else v.push(`
|
|
562
|
+
body {
|
|
563
|
+
background-image: none !important;
|
|
564
|
+
}
|
|
565
|
+
body::before {
|
|
566
|
+
display: none;
|
|
567
|
+
}
|
|
568
|
+
#root {
|
|
569
|
+
background-color: transparent;
|
|
570
|
+
}
|
|
571
|
+
`);g.textContent=v.join(`
|
|
572
|
+
`)},[t,o,l,u]);const h=g=>{n(g)},d=_.useMemo(()=>{const g=t==="custom"?s==="system"?La():s:t==="system"?La():t;return{theme:t,resolvedTheme:g,setTheme:h}},[t,s,n]);return f.jsx(HD.Provider,{value:d,children:e})}function FD(){const e=_.useContext(HD);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const SG={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"},CG={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 UD(e){return{cols:Math.max(1,e.cols||80),rows:Math.max(1,e.rows||24)}}function $D(e,t){var w,S,C,k,R;const n=e.element,r=(k=(C=(S=(w=e._core)==null?void 0:w._renderService)==null?void 0:S.dimensions)==null?void 0:C.css)==null?void 0:k.cell,s=(r==null?void 0:r.width)??0,o=(r==null?void 0:r.height)??0;if(!n||!Number.isFinite(s)||!Number.isFinite(o)||s<=0||o<=0)return null;const l=t.getBoundingClientRect(),u=window.getComputedStyle(t),h=window.getComputedStyle(n),d=e.options.scrollback===0?0:((R=e.options.overviewRuler)==null?void 0:R.width)??14,g=parseFloat(u.paddingLeft)+parseFloat(u.paddingRight)+parseFloat(h.paddingLeft)+parseFloat(h.paddingRight),p=parseFloat(u.paddingTop)+parseFloat(u.paddingBottom)+parseFloat(h.paddingTop)+parseFloat(h.paddingBottom),v=Math.max(0,l.width-g-d-1),y=Math.max(0,l.height-p);return{cols:Math.max(2,Math.floor(v/s)),rows:Math.max(1,Math.floor(y/o))}}function Lf(e){e.refresh(0,Math.max(0,e.rows-1))}function zf(e,t,n,r,s){const o=$D(e,t)??UD(e);return n.current&&n.current.cols===o.cols&&n.current.rows===o.rows||(e.resize(o.cols,o.rows),n.current=o,r&&s(o.cols,o.rows)),o}function kG({projectId:e,terminalId:t,socket:n,scrollback:r,connectionStatus:s,clearVersion:o=0,focusRequestVersion:l=0,onPathChange:u}){const{resolvedTheme:h}=FD(),d=_.useRef(null),g=_.useRef(null),p=_.useRef(null),v=_.useRef(!1),y=_.useRef(0),w=_.useRef(null),S=_.useRef(null),[C,k]=_.useState(null),[R,E]=_.useState(null),M=h==="dark"?CG:SG,j=(L,$)=>{n.command({type:"terminal.resize",terminalId:t,cols:L,rows:$}).catch(()=>{})},D=()=>{const L=()=>{const $=g.current,Y=d.current;!$||!Y||!v.current||zf($,Y,S,!0,j)};requestAnimationFrame(()=>{L(),setTimeout(L,0)})};return _.useEffect(()=>{const L=new bG({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}),$=new rV;L.loadAddon($),L.loadAddon(new uV),g.current=L;const Y=d.current;Y&&(L.open(Y),p.current&&L.write(p.current),zf(L,Y,S,!1,()=>{}),Lf(L),D());const P=L.onData(W=>{n.command({type:"terminal.input",terminalId:t,data:W}).catch(K=>{E(K instanceof Error?K.message:String(K))})}),V=L.onResize(({cols:W,rows:K})=>{if(!v.current)return;const q={cols:W,rows:K};S.current&&S.current.cols===W&&S.current.rows===K||(S.current=q,j(W,K))}),I=new ResizeObserver(()=>{const W=g.current,K=d.current;!W||!K||zf(W,K,S,v.current,(q,O)=>{n.command({type:"terminal.resize",terminalId:t,cols:q,rows:O}).catch(()=>{})})});return Y&&I.observe(Y),()=>{I.disconnect(),V.dispose(),P.dispose(),p.current=$.serialize(),L.dispose(),g.current=null}},[r,n,t,M]),_.useEffect(()=>{const L=g.current;L&&(L.options.scrollback=r)},[r]),_.useEffect(()=>{const L=g.current;L&&(L.options.theme=M,Lf(L))},[M]),_.useEffect(()=>{if(l===0)return;const L=g.current;L&&requestAnimationFrame(()=>{L.focus()})},[l]),_.useEffect(()=>{if(o===0)return;const L=g.current;L&&(v.current=!1,y.current+=1,w.current=null,p.current=null,k(null),E(null),L.reset(),Lf(L),n.command({type:"terminal.close",terminalId:t}).catch($=>{E($ instanceof Error?$.message:String($))}))},[o,n,t]),_.useEffect(()=>{u==null||u((C==null?void 0:C.cwd)??null)},[C==null?void 0:C.cwd,u]),_.useEffect(()=>{const L=P=>{const V=g.current;if(!V)return;const I=JSON.stringify({cwd:P.cwd,shell:P.shell,cols:P.cols,rows:P.rows,scrollback:P.scrollback,status:P.status,exitCode:P.exitCode,serializedState:P.serializedState});if(w.current===I){k({cwd:P.cwd,shell:P.shell,status:P.status,exitCode:P.exitCode}),p.current=P.serializedState||null;return}w.current=I,k({cwd:P.cwd,shell:P.shell,status:P.status,exitCode:P.exitCode}),p.current=P.serializedState||null,V.options.scrollback=P.scrollback,V.reset(),P.serializedState&&V.write(P.serializedState),Lf(V)},$=()=>{const P=g.current,V=d.current;if(!P||!V)return;const I=$D(P,V)??UD(P);P.resize(I.cols,I.rows),S.current=I,n.command({type:"terminal.create",projectId:e,terminalId:t,cols:I.cols,rows:I.rows,scrollback:r}).then(W=>{v.current=!0,E(null),W&&L(W),D()}).catch(W=>{E(W instanceof Error?W.message:String(W))})},Y=()=>{const P=++y.current,V=()=>{if(y.current!==P)return;const I=g.current,W=d.current;if(!I||!W)return;zf(I,W,S,!1,()=>{});const K=W.getBoundingClientRect();if(K.width<=0||K.height<=0){requestAnimationFrame(V);return}$()};requestAnimationFrame(()=>{requestAnimationFrame(V)})};return Y(),n.subscribeTerminal(t,{onSnapshot:P=>{if(!P){v.current=!1,w.current=null,s==="connected"&&Y();return}v.current=!0,E(null),L(P),D()},onEvent:P=>{const V=g.current;if(V){if(P.type==="terminal.output"){V.write(P.data);return}P.type==="terminal.exit"&&k(I=>({cwd:(I==null?void 0:I.cwd)??"",shell:(I==null?void 0:I.shell)??"",status:"exited",exitCode:P.exitCode}))}}})},[s,e,r,n,t]),f.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden pb-4",children:[f.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden px-3 py-1",children:f.jsx("div",{ref:d,className:"kaizen-terminal min-h-0 min-w-0 flex-1 overflow-hidden w-full"})}),R?f.jsxs("div",{className:"px-3 py-1 text-xs text-destructive",children:["Terminal error: ",R]}):null]})}const EG=24;function WD(e){return e+EG}function RG(e,t){return Math.max(1,e)*WD(t)}function FE({projectId:e,layout:t,socket:n,connectionStatus:r,scrollback:s,minColumnWidth:o,focusRequestVersion:l=0,splitTerminalShortcut:u,onAddTerminal:h,onRemoveTerminal:d,onTerminalLayout:g}){const p=_.useRef(null),v=_.useRef({}),y=_.useRef([]),[w,S]=_.useState(0),[C,k]=_.useState({}),[R,E]=_.useState({});_.useLayoutEffect(()=>{const Y=p.current;if(!Y)return;const P=()=>{S(Y.getBoundingClientRect().width)},V=new ResizeObserver(P);return V.observe(Y),P(),()=>V.disconnect()},[]);const M=t.terminals.length,j=WD(o),D=RG(M,o),L=Math.max(w,D),$=_.useMemo(()=>t.terminals.map(Y=>Y.id).join(":"),[t.terminals]);return _.useLayoutEffect(()=>{const Y=y.current,P=t.terminals.map(W=>W.id),V=P.find(W=>!Y.includes(W));if(y.current=P,!V||Y.length===0)return;const I=v.current[V];I&&I.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[t.terminals]),f.jsx("div",{className:"flex h-full min-h-0 flex-col",children:f.jsx("div",{ref:p,className:"min-h-0 flex-1 overflow-x-auto overflow-y-hidden",children:f.jsx("div",{className:"h-full min-h-0",style:{width:L||"100%"},children:f.jsx(tm,{orientation:"horizontal",className:"h-full min-h-0",onLayoutChanged:Y=>g(e,t.terminals.map(P=>Y[P.id]??P.size)),children:t.terminals.map((Y,P)=>f.jsxs(_.Fragment,{children:[f.jsx(Na,{id:Y.id,defaultSize:`${Y.size}%`,minSize:`${j}px`,className:"min-h-0 overflow-hidden",style:{minWidth:j},children:f.jsxs("div",{ref:V=>{v.current[Y.id]=V},className:"flex h-full min-h-0 min-w-0 flex-col border-r border-border bg-transparent last:border-r-0",style:{minWidth:j},children:[f.jsxs("div",{className:"flex items-center gap-2 px-3 pr-2 pt-2 pb-1",children:[f.jsx("div",{className:"min-w-0 flex-1 text-left",children:f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("div",{className:"shrink-0 text-sm font-medium",children:"Terminal"}),f.jsx("div",{className:"min-w-0 truncate text-xs text-muted-foreground",children:C[Y.id]??""})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Je,{variant:"ghost",size:"icon-sm",className:"md:hidden","aria-label":"Send Ctrl+C",onClick:()=>{n.command({type:"terminal.input",terminalId:Y.id,data:""}).catch(()=>{})},title:"Send Ctrl+C",children:f.jsx(VI,{className:"size-3.5"})}),f.jsx(Je,{variant:"ghost",size:"icon-sm","aria-label":"Clear terminal",onClick:()=>E(V=>({...V,[Y.id]:(V[Y.id]??0)+1})),children:f.jsx(V6,{className:"size-3.5"})}),f.jsxs(Ou,{children:[f.jsx(Lu,{asChild:!0,children:f.jsx(Je,{variant:"ghost",size:"icon-sm","aria-label":"Add terminal to the right",onClick:()=>h(e,Y.id),children:f.jsx(ip,{className:"size-3.5"})})}),f.jsx(Zl,{side:"bottom",shortcut:u})]}),f.jsx(Je,{variant:"ghost",size:"icon-sm","aria-label":"Archive terminal",onClick:()=>d(e,Y.id),children:f.jsx(Xs,{className:"size-3.5"})})]})]}),f.jsx(kG,{projectId:e,terminalId:Y.id,socket:n,scrollback:s,connectionStatus:r,clearVersion:R[Y.id]??0,focusRequestVersion:P===0?l:0,onPathChange:V=>k(I=>I[Y.id]===V?I:{...I,[Y.id]:V})})]})}),P<t.terminals.length-1?f.jsx(nm,{withHandle:!0,orientation:"horizontal"}):null]},Y.id))},$)})})})}function UE(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function TG(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:UE(n.groups.line),column:UE(n.groups.column)}:{path:t}}function W_(e,t){if(!e)return"";if(t){const n=t.endsWith("/")?t:`${t}/`;if(e.startsWith(n))return e.slice(n.length);if(e===t)return""}return e.replace(/^\/home\/user\/workspace\//,"")}const Tx=()=>{},VD=_.createContext(Tx);function MG({children:e,onOpenLocalLink:t}){return f.jsx(VD.Provider,{value:t??Tx,children:e})}const By={Task:pm,TaskOutput:pm,Bash:b0,Glob:m_,Grep:m_,ExitPlanMode:Tk,Read:Z6,Edit:K6,Write:Y6,NotebookEdit:gm,WebFetch:c6,TodoWrite:w6,WebSearch:m_,KillShell:$I,AskUserQuestion:SM,Skill:Tn,EnterPlanMode:Tk},qD=GI;function KD(e){return By[e]?By[e]:qD}function ao({children:e,className:t}){return f.jsx("div",{className:pe("flex gap-3 justify-start items-center",t),children:e})}function NG({children:e,className:t}){return f.jsx("div",{className:pe("flex items-center gap-1.5 text-xs",t),children:e})}function eo({children:e,className:t}){return f.jsx("span",{className:pe("font-medium text-foreground/80",t),children:e})}function AG({children:e}){return f.jsx("span",{className:"text-muted-foreground",children:e})}function Fd({children:e,expandedContent:t,defaultExpanded:n=!1}){const[r,s]=_.useState(n);return f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsxs("button",{onClick:()=>s(!r),className:`group/expandable-row cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${r?"":"hover:opacity-60 transition-opacity"}`,children:[f.jsx("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:e}),f.jsx(Tr,{className:`h-4.5 w-4.5 text-muted-icon translate-y-[0.5px] transition-all duration-200 opacity-0 group-hover/expandable-row:opacity-100 ${r?"rotate-90 opacity-100":""}`})]}),r&&t]})}function V_({label:e,children:t,copyText:n}){const[r,s]=_.useState(!1),o=n??Fm(t),l=_.useCallback(async()=>{await navigator.clipboard.writeText(o),s(!0),setTimeout(()=>s(!1),2e3)},[o]);return f.jsxs("div",{children:[f.jsx("span",{className:"font-medium text-muted-foreground",children:e}),f.jsxs("div",{className:"relative group/codeblock",children:[f.jsx("pre",{className:"my-1 text-xs font-mono whitespace-no-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto w-full",children:t}),f.jsx(Je,{variant:"ghost",size:"icon",className:pe("absolute top-[4px] right-[4px] z-10 h-6.5 w-6.5 rounded-sm text-muted-foreground opacity-0 group-hover/codeblock:opacity-100 transition-opacity",!r&&"hover:text-foreground",r&&"hover:!bg-transparent hover:!border-transparent"),onClick:l,children:r?f.jsx($i,{className:"h-3.5 w-3.5 text-green-400"}):f.jsx(kd,{className:"h-4 w-4"})})]})]})}function GD({children:e,icon:t,className:n}){return f.jsxs("span",{className:pe("inline-flex items-center gap-1 px-2 py-1 bg-muted border border-border rounded-full",n),children:[t&&f.jsx(t,{className:"h-3 w-3 text-muted-foreground"}),e]})}function Ud({children:e,className:t}){return f.jsxs("div",{className:pe("grid grid-cols-[auto_1fr] gap-2 min-w-0",t),children:[f.jsx("div",{className:" min-w-5 flex flex-col relative items-center justify-center",children:f.jsx("div",{className:"min-h-full w-[1px] bg-muted-foreground/20"})}),f.jsx("div",{className:"-ml-[1px] min-w-0 overflow-hidden",children:e})]})}function Fm(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Fm).join("");if(e&&typeof e=="object"&&"props"in e){const t=e.props;return Fm(t.children)}return""}function $E(e,t){return _.isValidElement(e)?_.cloneElement(e,{className:pe(e.props.className,t)}):e}const DG={h1:({children:e})=>f.jsx("h1",{className:"text-[20px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h2:({children:e})=>f.jsx("h2",{className:"text-[18px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h3:({children:e})=>f.jsx("h3",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h4:({children:e})=>f.jsx("h4",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h5:({children:e})=>f.jsx("h5",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h6:({children:e})=>f.jsx("h6",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),pre:({children:e,...t})=>{const[n,r]=_.useState(!1),s=Fm(e),o=async()=>{await navigator.clipboard.writeText(s),r(!0),setTimeout(()=>r(!1),2e3)};return f.jsxs("div",{className:"relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre",children:[f.jsx("pre",{className:"min-w-0 rounded-xl py-2.5 px-3.5 [.no-pre-highlight_&]:bg-background",...t,children:e}),f.jsx(Je,{variant:"ghost",size:"icon",className:pe("absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-8 w-8 text-muted-foreground opacity-0 group-hover/pre:opacity-100 transition-opacity",!n&&"hover:text-foreground",n&&"hover:!bg-transparent hover:!border-transparent"),onClick:o,children:n?f.jsx($i,{className:"h-4 w-4 text-green-400"}):f.jsx(kd,{className:"h-4 w-4"})})]})},code:({children:e,className:t,...n})=>t?f.jsx("code",{className:"block text-xs whitespace-pre",...n,children:e}):f.jsx("code",{className:"break-all px-1 bg-border/60 dark:[.no-pre-highlight_&]:bg-background dark:[.text-pretty_&]:bg-neutral [.no-code-highlight_&]:!bg-transparent py-0.5 rounded text-sm whitespace-wrap",...n,children:e}),table:({children:e,...t})=>f.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:f.jsx("table",{className:"table-auto min-w-full divide-y divide-border bg-background",...t,children:e})}),tbody:({children:e,...t})=>f.jsx("tbody",{className:"divide-y divide-border",...t,children:e}),th:({children:e,...t})=>f.jsx("th",{className:"text-left text-xs uppercase text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold",...t,children:e}),td:({children:e,...t})=>f.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal ",...t,children:e}),p:({children:e,...t})=>f.jsx("p",{className:"break-words mt-5 mb-3 first:mt-0 last:mb-0",...t,children:e}),blockquote:({children:e,...t})=>(()=>{const n=_.Children.toArray(e),r=n[0];r!==void 0&&(n[0]=$E(r,"mt-0"));const s=n.length-1,o=n[s];return o!==void 0&&(n[s]=$E(o,"mb-0")),f.jsx("blockquote",{className:"my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground",...t,children:n})})(),a:({children:e,...t})=>f.jsx("a",{className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",target:"_blank",rel:"noopener noreferrer",...t,children:e})};function $d(e){return{...DG,a:({children:t,href:n,onClick:r,...s})=>{const o=_.useContext(VD),l=TG(n);return f.jsx("a",{className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",href:n,target:l?void 0:"_blank",rel:l?void 0:"noopener noreferrer",onClick:u=>{r==null||r(u),!(u.defaultPrevented||!l||o===Tx)&&(u.preventDefault(),o(l))},...s,children:t})}}}const jG={connecting:"Connecting...",acquiring_sandbox:"Booting...",initializing:"Initializing...",starting:"Starting...",running:"Running...",waiting_for_user:"Waiting...",failed:"Failed"};function OG({status:e}){const t=(e?jG[e]:void 0)||"Processing...",n=e==="failed";return f.jsx(ao,{className:"ml-[1px]",children:f.jsxs(NG,{children:[n?f.jsx(Xs,{className:"size-4.5 text-red-500"}):f.jsx(oi,{className:"size-4.5 animate-spin text-muted-icon"}),f.jsx(wp,{className:"ml-[1px] text-sm",shimmerWidth:44,children:t})]})})}const Mx=_.forwardRef(({className:e,children:t,...n},r)=>f.jsx("div",{ref:r,className:pe("relative overflow-y-auto overscroll-contain touch-pan-y scrollbar-hide",e),style:{WebkitOverflowScrolling:"touch"},...n,children:t}));Mx.displayName="ScrollArea";function LG(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"}const Bp=20,Iy=50,YD=30;function XD(e){return Number.isFinite(e)?Math.min(Iy,Math.max(Bp,e)):YD}function zG(){return{isVisible:!1,size:Bp}}function Pf(e,t){return e[t]??zG()}function PG(e){return!e||typeof e!="object"?{projects:{}}:{projects:Object.fromEntries(Object.entries(e.projects??{}).map(([r,s])=>[r,{isVisible:!1,size:XD(s.size??YD)}]))}}const Ju=ro()(io(e=>({projects:{},toggleVisibility:t=>e(n=>({projects:{...n.projects,[t]:{...Pf(n.projects,t),isVisible:!Pf(n.projects,t).isVisible}}})),setVisibility:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...Pf(r.projects,t),isVisible:n}}})),setSize:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...Pf(r.projects,t),size:XD(n)}}})),clearProject:t=>e(n=>{const{[t]:r,...s}=n.projects;return{projects:s}})}),{name:"right-sidebar-layouts",version:2,migrate:PG})),BG={isVisible:!1,size:Bp},Nx=[68,32];function IG(){return{isVisible:!1,mainSizes:[...Nx],terminals:[],nextTerminalIndex:0}}function HG(e,t){return e[t]??IG()}function q_(e){if(e.length===0)return[];const t=e.reduce((n,r)=>n+Math.max(r,0),0);return!Number.isFinite(t)||t<=0?Array.from({length:e.length},()=>100/e.length):e.map(n=>Math.max(n,0)/t*100)}function FG(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 UG(e){if(e.length===0)return e;const t=e.length+1;return e.map(n=>({...n,size:n.size*e.length/t}))}function Vl(e,t,n){return{...e,[t]:n(HG(e,t))}}const $o=ro()(io(e=>({projects:{},addTerminal:(t,n)=>e(r=>({projects:Vl(r.projects,t,s=>{var h,d;const o=UG(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:FG(s.nextTerminalIndex),size:100/(o.length+1)},u=n?Math.max(o.findIndex(g=>g.id===n)+1,0):o.length;return{...s,isVisible:!0,nextTerminalIndex:s.nextTerminalIndex+1,terminals:[...o.slice(0,u),l,...o.slice(u)]}})})),removeTerminal:(t,n)=>e(r=>({projects:Vl(r.projects,t,s=>{const o=s.terminals.filter(u=>u.id!==n);if(o.length===0)return{...s,isVisible:!1,terminals:[]};const l=q_(o.map(u=>u.size));return{...s,terminals:o.map((u,h)=>({...u,size:l[h]??100/o.length}))}})})),toggleVisibility:t=>e(n=>({projects:Vl(n.projects,t,r=>({...r,isVisible:r.terminals.length>0?!r.isVisible:!1}))})),resetMainSizes:t=>e(n=>({projects:Vl(n.projects,t,r=>({...r,mainSizes:[...Nx]}))})),setMainSizes:(t,n)=>e(r=>{if(n.length!==2)return r;const s=q_(n);return{projects:Vl(r.projects,t,o=>({...o,mainSizes:s}))}}),setTerminalSizes:(t,n)=>e(r=>({projects:Vl(r.projects,t,s=>{if(n.length!==s.terminals.length)return s;const o=q_(n);return{...s,terminals:s.terminals.map((l,u)=>({...l,size:o[u]??l.size}))}})})),clearProject:t=>e(n=>{const{[t]:r,...s}=n.projects;return{projects:s}})}),{name:"terminal-layouts",version:1})),$G={isVisible:!1,mainSizes:[...Nx],terminals:[],nextTerminalIndex:0},Um=1e3,Hy=500,Fy=5e3,$m=450,Uy=250,$y=900,Wy="cursor";function Vy(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 WG(e){switch(e){case"vscode":return"VS Code";case"windsurf":return"Windsurf";case"custom":return"Custom";case"cursor":default:return"Cursor"}}function WE(e){return Number.isFinite(e)?Math.min(Fy,Math.max(Hy,Math.round(e))):Um}function VE(e){return Number.isFinite(e)?Math.min($y,Math.max(Uy,Math.round(e))):$m}function qE(e){switch(e){case"vscode":case"windsurf":case"custom":case"cursor":return e;default:return Wy}}function K_(e,t){const n=e==null?void 0:e.trim();return n&&n.length>0?n:Vy(t)}const wi=ro()(io(e=>({scrollbackLines:Um,minColumnWidth:$m,editorPreset:Wy,editorCommandTemplate:Vy(Wy),setScrollbackLines:t=>e({scrollbackLines:WE(t)}),setMinColumnWidth:t=>e({minColumnWidth:VE(t)}),setEditorPreset:t=>e(n=>{const r=qE(t);return{editorPreset:r,editorCommandTemplate:r==="custom"?K_(n.editorCommandTemplate,r):Vy(r)}}),setEditorCommandTemplate:t=>e(n=>({editorCommandTemplate:K_(t,n.editorPreset)}))}),{name:"terminal-preferences",version:3,migrate:e=>{const t=e,n=qE(t==null?void 0:t.editorPreset);return{scrollbackLines:WE((t==null?void 0:t.scrollbackLines)??Um),minColumnWidth:VE((t==null?void 0:t.minColumnWidth)??$m),editorPreset:n,editorCommandTemplate:K_(t==null?void 0:t.editorCommandTemplate,n)}}})),VG=35;function qG(e,t){return!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?0:e*(t/100)}function KG(e,t){const n=qG(e,t);return n>=0&&n<VG}const tc=350,GG=[.4,0,.2,1],YG=8,KE=1e-6;function XG(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function ZG(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function QG(e,t,n){const r=1-e;return 3*r*r*t+6*r*e*(n-t)+3*e*e*(1-n)}function JG(e,t,n){let r=e;for(let s=0;s<YG;s+=1){const o=XG(r,t,n)-e;if(Math.abs(o)<KE)return r;const l=QG(r,t,n);if(Math.abs(l)<KE)break;r-=o/l}return r}function eY(e){if(e<=0)return 0;if(e>=1)return 1;const[t,n,r,s]=GG,o=JG(e,t,r);return ZG(o,n,s)}function ZD(e,t,n){const r=eY(n);return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function tY({projectId:e,shouldRenderRightSidebarLayout:t,showRightSidebar:n,rightSidebarSize:r}){const s=_.useRef(null),o=_.useRef(null),l=_.useRef(null),u=_.useRef(null),h=_.useRef(null),d=_.useRef(!1),g=_.useRef(null),p=_.useRef(!1),v=_.useRef(!1);return _.useEffect(()=>()=>{u.current!==null&&window.cancelAnimationFrame(u.current),h.current!==null&&window.clearTimeout(h.current)},[]),_.useLayoutEffect(()=>{var L,$,Y,P,V,I;if(!t){u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null),d.current=!1;return}const y=s.current;if(!y)return;u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null);const w=g.current,S=w!==null&&w!==e,C=n&&!v.current,k=!p.current,R=n?[100-r,r]:[100,0],E=S||k&&n,M=C||k?[100,0]:[y.getLayout().workspace??R[0],y.getLayout().rightSidebar??R[1]];if(g.current=e,p.current=t,v.current=n,E||Math.abs(M[0]-R[0])<.1&&Math.abs(M[1]-R[1])<.1){y.setLayout({workspace:R[0],rightSidebar:R[1]}),(L=o.current)==null||L.setAttribute("data-right-sidebar-open",n?"true":"false"),($=l.current)==null||$.setAttribute("data-right-sidebar-open",n?"true":"false"),(Y=l.current)==null||Y.setAttribute("data-right-sidebar-animated","false");return}d.current=!0,(P=o.current)==null||P.setAttribute("data-right-sidebar-open",n?"true":"false"),(V=l.current)==null||V.setAttribute("data-right-sidebar-open",n?"true":"false"),(I=l.current)==null||I.setAttribute("data-right-sidebar-animated","true"),y.setLayout({workspace:M[0],rightSidebar:M[1]});const j=performance.now(),D=W=>{const K=Math.min(1,(W-j)/tc),q=ZD(M,R,K);if(y.setLayout({workspace:q[0],rightSidebar:q[1]}),K<1){u.current=window.requestAnimationFrame(D);return}y.setLayout({workspace:R[0],rightSidebar:R[1]}),u.current=null,h.current=window.setTimeout(()=>{d.current=!1,h.current=null},0)};u.current=window.requestAnimationFrame(D)},[e,r,t,n]),_.useEffect(()=>{t||(p.current=!1,v.current=!1)},[t]),{isAnimating:d,panelGroupRef:s,sidebarPanelRef:o,sidebarVisualRef:l}}function nY(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 rY({previousProjectId:e,projectId:t,previousShouldRenderTerminalLayout:n,previousShowTerminalPane:r,showTerminalPane:s,terminalLayout:o,liveLayout:l}){const u=e!==null&&e!==t,h=s&&!r,d=!n,g=e===null&&t!==null,p=s?o.mainSizes:[100,0];return{currentLayout:h||d?[100,0]:l,shouldSkipAnimation:u||g&&d,targetLayout:p}}function iY({chatInputRef:e,projectId:t,shouldRenderTerminalLayout:n,showTerminalPane:r,terminalLayout:s}){const o=_.useRef(null),l=_.useRef(null),u=_.useRef(null),h=_.useRef(null),d=_.useRef(null),g=_.useRef(!1),p=_.useRef(null),v=_.useRef(!1),y=_.useRef(!1),w=_.useRef(!1),[S,C]=_.useState(0);return _.useEffect(()=>{var E;const k=p.current,R=w.current;nY({previousProjectId:k,projectId:t,showTerminalPane:r,wasTerminalVisible:R})&&C(M=>M+1),k!==null&&k===t&&!r&&R&&((E=e.current)==null||E.focus({preventScroll:!0})),w.current=r,p.current=t},[e,t,r]),_.useEffect(()=>()=>{h.current!==null&&window.cancelAnimationFrame(h.current),d.current!==null&&window.clearTimeout(d.current)},[]),_.useLayoutEffect(()=>{var $,Y,P,V,I,W;if(!n){h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null),g.current=!1;return}const k=o.current;if(!k)return;h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null);const R=p.current,{currentLayout:E,shouldSkipAnimation:M,targetLayout:j}=rY({previousProjectId:R,projectId:t,previousShouldRenderTerminalLayout:v.current,previousShowTerminalPane:y.current,showTerminalPane:r,terminalLayout:s,liveLayout:[k.getLayout().chat??s.mainSizes[0],k.getLayout().terminal??s.mainSizes[1]]});if(v.current=n,y.current=r,M||Math.abs(E[0]-j[0])<.1&&Math.abs(E[1]-j[1])<.1){k.setLayout({chat:j[0],terminal:j[1]}),($=l.current)==null||$.setAttribute("data-terminal-open",r?"true":"false"),(Y=u.current)==null||Y.setAttribute("data-terminal-open",r?"true":"false"),(P=u.current)==null||P.setAttribute("data-terminal-animated","false");return}g.current=!0,(V=l.current)==null||V.setAttribute("data-terminal-open",r?"true":"false"),(I=u.current)==null||I.setAttribute("data-terminal-open",r?"true":"false"),(W=u.current)==null||W.setAttribute("data-terminal-animated","true"),k.setLayout({chat:E[0],terminal:E[1]});const D=performance.now(),L=K=>{const q=Math.min(1,(K-D)/tc),O=ZD(E,j,q);if(k.setLayout({chat:O[0],terminal:O[1]}),q<1){h.current=window.requestAnimationFrame(L);return}k.setLayout({chat:j[0],terminal:j[1]}),h.current=null,d.current=window.setTimeout(()=>{g.current=!1,d.current=null},0)};h.current=window.requestAnimationFrame(L)},[t,n,r,s.mainSizes]),_.useEffect(()=>{n||(v.current=!1,y.current=!1)},[n]),{isAnimating:g,mainPanelGroupRef:o,terminalFocusRequestVersion:S,terminalPanelRef:l,terminalVisualRef:u}}const qs=ro()(io(e=>({folderGroupsEnabled:!1,kanbanStatusesEnabled:!0,commitProjectMetadataDirectory:!0,setFolderGroupsEnabled:t=>e({folderGroupsEnabled:t}),setKanbanStatusesEnabled:t=>e({kanbanStatusesEnabled:t}),setCommitProjectMetadataDirectory:t=>e({commitProjectMetadataDirectory:t})}),{name:"feature-settings"}));function Bf(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function sY(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}function oY(e,t){const n=sY(t);switch(e.toolKind){case"ask_user_question":{const s=Bf(n),o=Bf(s==null?void 0:s.answers)??(s||{});return{answers:Object.fromEntries(Object.entries(o).map(([l,u])=>Array.isArray(u)?[l,u.map(h=>String(h))]:u&&typeof u=="object"&&Array.isArray(u.answers)?[l,u.answers.map(h=>String(h))]:u==null||u===""?[l,[]]:[l,[String(u)]])),...(s==null?void 0:s.discarded)===!0?{discarded:!0}:{}}}case"exit_plan_mode":{const s=Bf(n);return{confirmed:typeof(s==null?void 0:s.confirmed)=="boolean"?s.confirmed:void 0,clearContext:typeof(s==null?void 0:s.clearContext)=="boolean"?s.clearContext:void 0,message:typeof(s==null?void 0:s.message)=="string"?s.message:void 0,...(s==null?void 0:s.discarded)===!0?{discarded:!0}:{}}}case"read_file":if(typeof n=="string")return n;const r=Bf(n);return{content:typeof(r==null?void 0:r.content)=="string"?r.content:JSON.stringify(n,null,2)};default:return n}}function QD(e){return new Date(e).toISOString()}function bi(e){return{id:e._id,messageId:e.messageId,timestamp:QD(e.createdAt),hidden:e.hidden}}function aY(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:QD(e.createdAt)}}function lY(e){if(e.debugRaw)try{return JSON.parse(e.debugRaw).tool_use_result}catch{return}}function cY(e){if(e!=null&&e.length)return e.map(t=>({...t,previewUrl:`/attachments/${t.relativePath.split("/").map(encodeURIComponent).join("/")}`}))}function GE(e,t){const n=e.at(-1);if((n==null?void 0:n.kind)===t.kind&&n.hidden===t.hidden&&n.messageId===t.messageId){n.text+=t.text;return}e.push(t)}function uY(e){const t=new Map,n=[];for(const r of e)switch(r.kind){case"user_prompt":n.push({...bi(r),kind:"user_prompt",content:r.content,attachments:cY(r.attachments)});break;case"system_init":n.push({...bi(r),kind:"system_init",provider:r.provider,model:r.model,tools:r.tools,agents:r.agents,slashCommands:r.slashCommands,mcpServers:r.mcpServers,debugRaw:r.debugRaw});break;case"account_info":n.push({...bi(r),kind:"account_info",accountInfo:r.accountInfo});break;case"assistant_text":GE(n,{...bi(r),kind:"assistant_text",text:r.text});break;case"assistant_thought":GE(n,{...bi(r),kind:"assistant_thought",text:r.text});break;case"tool_call":{const s=aY(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 o=s.normalized.toolKind==="ask_user_question"||s.normalized.toolKind==="exit_plan_mode"?lY(r)??r.content:r.content;s.hydrated.result=oY(s.normalized,o),s.hydrated.rawResult=o,s.hydrated.isError=r.isError}break}case"result":n.push({...bi(r),kind:"result",success:!r.isError,cancelled:r.subtype==="cancelled",result:r.result,durationMs:r.durationMs,costUsd:r.costUsd});break;case"status":n.push({...bi(r),kind:"status",status:r.status});break;case"compact_boundary":n.push({...bi(r),kind:"compact_boundary"});break;case"compact_summary":n.push({...bi(r),kind:"compact_summary",summary:r.summary});break;case"context_cleared":n.push({...bi(r),kind:"context_cleared"});break;case"interrupted":n.push({...bi(r),kind:"interrupted"});break;default:n.push({...bi(r),kind:"unknown",json:JSON.stringify(r,null,2)});break}return n}const dY=["AskUserQuestion","ExitPlanMode","TodoWrite"],hY=new Set(["TodoWrite"]);function fY(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 mY(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 pY(e){const t={};for(const n of dY)t[n]=hY.has(n)?mY(e,n):fY(e,n);return t}function gY(e){return e==="starting"||e==="running"||e==="waiting_for_user"}function G_(e){return e==="starting"||e==="running"||e==="waiting_for_user"}const vY=25e3,_Y=15e3,bY=4e3;class yY{constructor(t){Hn(this,"url");Hn(this,"ws",null);Hn(this,"started",!1);Hn(this,"reconnectTimer",null);Hn(this,"reconnectDelayMs",750);Hn(this,"subscriptions",new Map);Hn(this,"pending",new Map);Hn(this,"outboundQueue",[]);Hn(this,"statusListeners",new Set);Hn(this,"heartbeatTimer",null);Hn(this,"pingTimeoutTimer",null);Hn(this,"pingPromise",null);Hn(this,"lastOpenAt",0);Hn(this,"lastMessageAt",0);Hn(this,"reconnectImmediatelyOnClose",!1);Hn(this,"handleWindowFocus",()=>{this.ensureHealthyConnection()});Hn(this,"handleVisibilityChange",()=>{if(document.visibilityState==="visible"){this.startHeartbeat(),this.ensureHealthyConnection();return}this.stopHeartbeat()});Hn(this,"handleOnline",()=>{this.ensureHealthyConnection()});this.url=t}start(){this.started||(this.started=!0,window.addEventListener("focus",this.handleWindowFocus),window.addEventListener("online",this.handleOnline),document.addEventListener("visibilitychange",this.handleVisibilityChange),this.connect())}dispose(){var t;this.started=!1,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.clearPingState(),window.removeEventListener("focus",this.handleWindowFocus),window.removeEventListener("online",this.handleOnline),document.removeEventListener("visibilitychange",this.handleVisibilityChange),(t=this.ws)==null||t.close(),this.ws=null;for(const n of this.pending.values())n.reject(new Error("Socket disposed"));this.pending.clear()}onStatus(t){return this.statusListeners.add(t),t(this.getStatus()),()=>{this.statusListeners.delete(t)}}subscribe(t,n,r){const s=Gf();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=Gf(),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=Gf(),r={v:1,type:"command",id:n,command:t};return new Promise((s,o)=>{this.pending.set(n,{resolve:s,reject:o}),this.enqueue(r)})}ensureHealthyConnection(){return!this.ws||this.ws.readyState===WebSocket.CLOSED||this.ws.readyState===WebSocket.CLOSING?(this.reconnectNow(),Promise.resolve()):this.ws.readyState===WebSocket.CONNECTING||!this.isConnectionStale()?Promise.resolve():this.sendPing()}connect(){if(!this.started)return;this.emitStatus("connecting");const t=new WebSocket(this.url);this.ws=t,t.addEventListener("open",()=>{if(this.ws===t){this.reconnectDelayMs=750,this.reconnectImmediatelyOnClose=!1,this.lastOpenAt=Date.now(),this.lastMessageAt=this.lastOpenAt,this.emitStatus("connected"),this.startHeartbeat();for(const[n,r]of this.subscriptions.entries())this.sendNow({v:1,type:"subscribe",id:n,topic:r.topic},t);for(;this.outboundQueue.length>0;){const n=this.outboundQueue.shift();n&&this.sendNow(n,t)}}}),t.addEventListener("message",n=>{var s;if(this.ws!==t)return;this.lastMessageAt=Date.now();let r;try{r=JSON.parse(String(n.data))}catch{return}if(r.type==="snapshot"){const o=this.subscriptions.get(r.id);o==null||o.listener(r.snapshot.data);return}if(r.type==="event"){const o=this.subscriptions.get(r.id);(s=o==null?void 0:o.eventListener)==null||s.call(o,r.event);return}if(r.type==="ack"){const o=this.pending.get(r.id);if(!o)return;this.pending.delete(r.id),o.resolve(r.result);return}if(r.type==="error"){if(!r.id){console.error(Z9,r.message);return}const o=this.pending.get(r.id);if(!o)return;this.pending.delete(r.id),o.reject(new Error(r.message))}}),t.addEventListener("close",()=>{if(this.ws!==t||!this.started)return;const n=this.reconnectImmediatelyOnClose;this.reconnectImmediatelyOnClose=!1,this.stopHeartbeat(),this.clearPingState(),this.emitStatus("disconnected");for(const r of this.pending.values())r.reject(new Error("Disconnected"));if(this.pending.clear(),n){this.connect();return}this.scheduleReconnect()})}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect(),this.reconnectDelayMs=Math.min(this.reconnectDelayMs*2,5e3)},this.reconnectDelayMs))}getStatus(){var t,n;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN?"connected":((n=this.ws)==null?void 0:n.readyState)===WebSocket.CONNECTING?"connecting":"disconnected"}emitStatus(t){for(const n of this.statusListeners)n(t)}isConnectionStale(){const t=Math.max(this.lastMessageAt,this.lastOpenAt);return t>0&&Date.now()-t>=vY}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()},bY),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()},_Y))}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}clearPingState(){this.pingTimeoutTimer!==null&&(window.clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=null),this.pingPromise=null}enqueue(t){var n;if(((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN){this.sendNow(t,this.ws);return}this.outboundQueue.push(t)}sendNow(t,n){if(n.readyState!==WebSocket.OPEN){this.outboundQueue.unshift(t);return}n.send(JSON.stringify(t))}}function xY(e,t){var r;const n=e.find(s=>vd(s).some(o=>o.chatId===t));return n?((r=vd(n).find(s=>s.chatId!==t))==null?void 0:r.chatId)??null:null}function YE(e,t){var n;return((n=e.find(r=>vd(r).some(s=>s.chatId===t)))==null?void 0:n.groupKey)??null}function wY(e,t){for(const n of e){const r=vd(n).find(s=>s.chatId===t);if(r)return r}return null}function SY(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function CY(){const e=_.useRef(null);return e.current||(e.current=new yY(SY())),_.useEffect(()=>{const t=e.current;return t==null||t.start(),()=>{t==null||t.dispose()}},[]),e.current}function Vu(e,t){if(t===void 0){console.info(`[useKaizenState] ${e}`);return}console.info(`[useKaizenState] ${e}`,t)}function JD(e){return e<24}function kY(e){return Math.max(136,Math.round(e+24))}function EY(e,t){return e==="awaiting_disconnect"&&t==="disconnected"?"awaiting_reconnect":e==="awaiting_reconnect"&&t==="connected"?"clear_phase":"none"}const Ax=`${bp}ui-update-restart`;function RY(){return window.sessionStorage.getItem(Ax)}function XE(e){window.sessionStorage.setItem(Ax,e)}function Y_(){window.sessionStorage.removeItem(Ax)}function TY(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 MY(e,t){return!e||!t?null:e.runtime.chatId!==t?(Vu("stale snapshot masked",{routeChatId:t,snapshotChatId:e.runtime.chatId,snapshotProvider:e.runtime.provider}),null):e}function NY(e){var Xi,ws,Qd;const t=xd(),n=CY(),r=s8(),[s,o]=_.useState({projectGroups:[]}),[l,u]=_.useState(null),[h,d]=_.useState(null),[g,p]=_.useState(null),[v,y]=_.useState(null),[w,S]=_.useState(null),[C,k]=_.useState("connecting"),[R,E]=_.useState(!1),[M,j]=_.useState(!1),[D,L]=_.useState(!1),[$,Y]=_.useState(null),[P,V]=_.useState(!1),[I,W]=_.useState(!1),[K,q]=_.useState(148),[O,H]=_.useState(!0),[U,F]=_.useState(null),[N,B]=_.useState(null),[X,A]=_.useState(null),[ne,ae]=_.useState(null),[Z,te]=_.useState(!1),le=qs(J=>J.folderGroupsEnabled),me=qs(J=>J.kanbanStatusesEnabled),xe=WG(wi(J=>J.editorPreset)),Ae=_.useRef(null),Re=_.useRef(null),je=Ju(J=>J.setVisibility),[Ye,xt]=_.useState(new Set),ft=_.useRef(new Map),he=_.useRef(e),Pe=_.useRef(typeof document<"u"?document.visibilityState==="visible":!0),Ne=_.useRef(!1),tt=_.useRef(null),wt=_.useRef(new Map);_.useEffect(()=>n.onStatus(k),[n]),_.useEffect(()=>{he.current=e},[e]),_.useEffect(()=>{function J(){const ie=document.visibilityState==="visible";if(Pe.current=ie,ie){const Ee=he.current;Ee&&xt(Ue=>{if(!Ue.has(Ee))return Ue;const Mt=new Set(Ue);return Mt.delete(Ee),Mt})}}return document.addEventListener("visibilitychange",J),()=>document.removeEventListener("visibilitychange",J)},[]),_.useEffect(()=>n.subscribe({type:"sidebar"},J=>{const ie=new Map;for(const Wt of J.projectGroups)for(const Vt of[...Wt.generalChats,...Wt.features.flatMap(Dr=>Dr.chats)])ie.set(Vt.chatId,Vt.status);const Ee=ft.current,Ue=he.current,Mt=Pe.current;xt(Wt=>{let Vt=Wt;for(const[Dr,Jd]of ie){const sl=Ee.get(Dr);G_(Jd)&&Vt.has(Dr)&&(Vt===Wt&&(Vt=new Set(Wt)),Vt.delete(Dr)),sl&&G_(sl)&&Jd==="idle"&&(Dr!==Ue||!Mt)&&(Vt===Wt&&(Vt=new Set(Wt)),Vt.add(Dr))}return Vt}),ft.current=ie,o(J),E(!0),F(null)}),[n]),_.useEffect(()=>n.subscribe({type:"local-projects"},J=>{u(J),j(!0),F(null)}),[n]),_.useEffect(()=>n.subscribe({type:"update"},J=>{d(J),F(null)}),[n]),_.useEffect(()=>{C==="connected"&&n.command({type:"update.check",force:!0}).catch(J=>{F(J instanceof Error?J.message:String(J))})},[C,n]),_.useEffect(()=>{const J=RY(),ie=EY(J,C);if(ie==="awaiting_reconnect"){XE("awaiting_reconnect");return}ie==="clear_phase"&&Y_()},[C,t]),_.useEffect(()=>{function J(){h!=null&&h.lastCheckedAt&&(Date.now()-h.lastCheckedAt<=3600*1e3||n.command({type:"update.check"}).catch(ie=>{F(ie instanceof Error?ie.message:String(ie))}))}return window.addEventListener("focus",J),()=>{window.removeEventListener("focus",J)}},[n,h==null?void 0:h.lastCheckedAt]),_.useEffect(()=>n.subscribe({type:"keybindings"},J=>{y(J),F(null)}),[n]),_.useEffect(()=>n.subscribe({type:"theme-settings"},J=>{gn.setState({themePreference:J.settings.themePreference,colorTheme:J.settings.colorTheme,customAppearance:J.settings.customAppearance,backgroundImage:J.settings.backgroundImage,backgroundOpacity:J.settings.backgroundOpacity,backgroundBlur:J.settings.backgroundBlur,showProjectIconsInSidebar:J.settings.showProjectIconsInSidebar})}),[n]),_.useEffect(()=>n.subscribe({type:"provider-settings"},J=>{S(J),F(null)}),[n]),_.useEffect(()=>{if(!e){Vu("clearing chat snapshot for non-chat route"),p(null),L(!0);return}return Vu("subscribing to chat",{activeChatId:e}),p(null),L(!1),n.subscribe({type:"chat",chatId:e},J=>{Vu("chat snapshot received",{activeChatId:e,snapshotChatId:(J==null?void 0:J.runtime.chatId)??null,snapshotProvider:(J==null?void 0:J.runtime.provider)??null,snapshotStatus:(J==null?void 0:J.runtime.status)??null}),p(J),L(!0),F(null)})},[e,n]),_.useEffect(()=>{e&&xt(J=>{if(!J.has(e))return J;const ie=new Set(J);return ie.delete(e),ie})},[e]),_.useEffect(()=>{if(!e)return;const J=YE(s.projectGroups,e);J&&je(J,!1)},[e,je,s.projectGroups]),_.useEffect(()=>{if($)return;const J=s.projectGroups[0];J&&Y(J.groupKey)},[$,s.projectGroups]),_.useEffect(()=>{if(!e||!R||!D)return;if(s.projectGroups.some(ie=>vd(ie).some(Ee=>Ee.chatId===e))){X===e&&A(null);return}X!==e&&t("/")},[e,D,t,X,s.projectGroups,R]),_.useEffect(()=>{g&&(Y(g.runtime.projectId),X===g.runtime.chatId&&A(null))},[g,X]),_.useEffect(()=>{Ne.current=!1,tt.current!==null&&(window.cancelAnimationFrame(tt.current),tt.current=null),H(!0)},[e]),_.useEffect(()=>()=>{tt.current!==null&&window.cancelAnimationFrame(tt.current)},[]),_.useLayoutEffect(()=>{const J=Re.current;if(!J)return;const ie=new ResizeObserver(()=>{q(J.getBoundingClientRect().height)});return ie.observe(J),q(J.getBoundingClientRect().height),()=>ie.disconnect()},[]);const $e=_.useMemo(()=>MY(g,e),[e,g]);_.useEffect(()=>{Vu("active snapshot resolved",{routeChatId:e,rawSnapshotChatId:(g==null?void 0:g.runtime.chatId)??null,rawSnapshotProvider:(g==null?void 0:g.runtime.provider)??null,activeSnapshotChatId:($e==null?void 0:$e.runtime.chatId)??null,activeSnapshotProvider:($e==null?void 0:$e.runtime.provider)??null,pendingChatId:X})},[e,$e,g,X]);const pt=_.useMemo(()=>{const J=$e;if(!J)return[];const ie=J.messages,Ee=J.runtime.chatId,Ue=ie.at(-1),Mt=`${ie.length}:${(Ue==null?void 0:Ue._id)??""}:${(Ue==null?void 0:Ue.createdAt)??0}`,Wt=wt.current.get(Ee);if((Wt==null?void 0:Wt.signature)===Mt)return Wt.messages;const Vt=uY(ie);return wt.current.set(Ee,{signature:Mt,messages:Vt}),Vt},[$e]),Se=_.useMemo(()=>pY(pt),[pt]),De=($e==null?void 0:$e.runtime)??null,ce=($e==null?void 0:$e.usage)??null,be=($e==null?void 0:$e.availableProviders)??z0((w==null?void 0:w.settings)??Wn),Oe=G_(De==null?void 0:De.status),Ve=gY(De==null?void 0:De.status),we=kY(K),He=!O&&pt.length>0,ot=((Xi=l==null?void 0:l.projects[0])==null?void 0:Xi.localPath)??null,rt=(De==null?void 0:De.localPath)??ot??((ws=s.projectGroups[0])==null?void 0:ws.localPath),Le=!!($??(De==null?void 0:De.projectId)??((Qd=s.projectGroups[0])==null?void 0:Qd.groupKey)??ot);_.useLayoutEffect(()=>{if(Ne.current)return;const J=Ae.current;J&&(e&&!De||(J.scrollTo({top:J.scrollHeight,behavior:"auto"}),tt.current!==null&&window.cancelAnimationFrame(tt.current),tt.current=window.requestAnimationFrame(()=>{const ie=Ae.current;ie&&(ie.scrollTo({top:ie.scrollHeight,behavior:"auto"}),tt.current=null)}),Ne.current=!0))},[e,K,pt.length,De]),_.useEffect(()=>{if(!Ne.current||!O)return;const J=window.requestAnimationFrame(()=>{const ie=Ae.current;!ie||!O||ie.scrollTo({top:ie.scrollHeight,behavior:"auto"})});return()=>window.cancelAnimationFrame(J)},[e,K,O,pt.length,De==null?void 0:De.status]);function St(){const J=Ae.current;if(!J)return;const ie=J.scrollHeight-J.scrollTop-J.clientHeight;H(JD(ie))}function at(J){const ie=Ae.current;H(!0),ie&&ie.scrollTo({top:ie.scrollHeight,behavior:J})}function vn(){at("smooth")}async function tn(J,ie){var Mt;xi.getState().initializeComposerForNewChat();const Ee=s.projectGroups.find(Wt=>Wt.groupKey===J);if(Ee){const Vt=(ie?((Mt=Ee.features.find(Dr=>Dr.featureId===ie))==null?void 0:Mt.chats)??[]:Ee.generalChats).find(Dr=>Dr.lastMessageAt==null);if(Vt){Y(J),t(`/chat/${Vt.chatId}`),V(!1),F(null);return}}const Ue=await n.command({type:"chat.create",projectId:J,featureId:ie});Y(J),A(Ue.chatId),t(`/chat/${Ue.chatId}`),V(!1),F(null)}async function Nn(J,ie=qs.getState().commitProjectMetadataDirectory){await n.command({type:"project.setProjectMetadataDirectoryCommitMode",projectId:J.projectId,localPath:J.localPath,commitProjectMetadata:ie})}async function xr(J){return J.kind==="project_id"?{projectId:J.projectId}:J.kind==="local_path"?{projectId:(await n.command({type:"project.open",localPath:J.localPath})).projectId,localPath:J.localPath}:{projectId:(await n.command(J.project.mode==="new"?{type:"project.create",localPath:J.project.localPath,title:J.project.title}:{type:"project.open",localPath:J.project.localPath})).projectId,localPath:J.project.localPath}}async function Kn(J){try{const ie=J.kind==="project_id"?null:J.kind==="local_path"?J.localPath:J.project.localPath;ie&&B(ie);const{projectId:Ee}=await xr(J);await Nn({projectId:Ee}),await tn(Ee)}catch(ie){F(ie instanceof Error?ie.message:String(ie))}finally{B(null)}}async function jt(J){const ie=J.split("/").filter(Boolean).pop()??J;if(await r.confirm({title:"Hide Project",description:`Hide "${ie}" from ${Mn}? This only removes it from ${Mn} until you re-add it or reset local state.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await n.command({type:"project.hide",localPath:J}),F(null)}catch(Ue){F(Ue instanceof Error?Ue.message:String(Ue))}}async function zt(J,ie){if(ie){try{await tn(J,ie)}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}return}await Kn({kind:"project_id",projectId:J})}function Fe(J){ae(J)}function ct(){ae(null)}async function st(J){const ie=ne;if(ie)try{const Ee=await n.command({type:"feature.create",projectId:ie,title:J.title,description:J.description});ae(null),await tn(ie,Ee.featureId)}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function mt(J){const ie=s.projectGroups.flatMap(Ue=>Ue.features).find(Ue=>Ue.featureId===J);if(!ie)return;const Ee=await r.prompt({title:"Rename Feature",placeholder:"Feature name",initialValue:ie.title,confirmLabel:"Rename"});if(!(!Ee||Ee===ie.title))try{await n.command({type:"feature.rename",featureId:J,title:Ee}),F(null)}catch(Ue){F(Ue instanceof Error?Ue.message:String(Ue))}}async function an(J){const ie=s.projectGroups.flatMap(Ue=>Ue.features).find(Ue=>Ue.featureId===J);if(!(!ie||!await r.confirm({title:"Delete Feature",description:`Delete "${ie.title}"? Its chats will move to General and the feature folder will be removed.`,confirmLabel:"Delete",confirmVariant:"destructive"})))try{await n.command({type:"feature.delete",featureId:J}),F(null)}catch(Ue){F(Ue instanceof Error?Ue.message:String(Ue))}}async function Ce(J,ie){try{await n.command({type:"feature.setBrowserState",featureId:J,browserState:ie}),F(null)}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function Te(J,ie){try{await n.command({type:"project.setBrowserState",projectId:J,browserState:ie}),F(null)}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function gt(J,ie){try{await n.command({type:"project.setGeneralChatsBrowserState",projectId:J,browserState:ie}),F(null)}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function Qe(J,ie){try{await n.command({type:"feature.setStage",featureId:J,stage:ie}),F(null)}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function vt(J){try{await n.command({type:"provider.refreshUsage",provider:J}),F(null)}catch(ie){F(ie instanceof Error?ie.message:String(ie))}}async function qt(J){if(J==="cursor")try{const ie=await n.command({type:"provider.browserLogin",provider:J});if(ie.availability==="login_required"){ie.statusDetail==="browser_launch_failed"&&te(!0),F(ie.statusDetail==="browser_launch_failed"?"Could not launch a Chromium browser for Cursor sign-in. Paste a copied cURL command instead.":"Cursor sign-in did not complete. Try again and finish login in the opened browser.");return}F(null)}catch(ie){F(ie instanceof Error?ie.message:String(ie))}}async function Ot(J){try{const ie=await n.command({type:"provider.importUsageCurl",provider:"cursor",curlCommand:J});if(ie.availability==="login_required"&&ie.statusDetail==="invalid_curl_import"){F("Could not import that cURL command. Copy the get-current-period-usage request as cURL and paste it here.");return}te(!1),F(null)}catch(ie){F(ie instanceof Error?ie.message:String(ie))}}async function sn(J,ie){try{await n.command({type:"chat.setFeature",chatId:J,featureId:ie}),F(null)}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function G(J,ie){try{await n.command({type:"feature.reorder",projectId:J,orderedFeatureIds:ie}),F(null)}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function Xe(J){await Kn({kind:"local_path",localPath:J})}async function It(J){await Kn({kind:"project_request",project:J})}async function Cn(J){try{await Promise.all(AY((l==null?void 0:l.projects.map(ie=>({localPath:ie.localPath})))??s.projectGroups.map(ie=>({projectId:ie.groupKey,localPath:ie.localPath}))).map(ie=>Nn(ie,J))),F(null)}catch(ie){throw F(ie instanceof Error?ie.message:String(ie)),ie}}async function li(J){const ie=new URL("/api/directories",window.location.origin);J&&ie.searchParams.set("path",J);const Ee=await fetch(ie.toString());if(!Ee.ok){let Mt="Failed to load directories";try{const Wt=await Ee.json();Wt.error&&(Mt=Wt.error)}catch{}throw new Error(Mt)}const Ue=await Ee.json();return F(null),Ue}async function $t(J){try{await n.command({type:"update.check",force:J==null?void 0:J.force}),F(null)}catch(ie){F(ie instanceof Error?ie.message:String(ie))}}async function ir(){try{const J=await n.command({type:"update.install"});if(!J.ok){Y_(),F(null),await r.alert({title:J.userTitle??"Update failed",description:J.userMessage??`${Mn} could not install the update. Try again later.`,closeLabel:"OK"});return}if(J.ok&&J.action==="reload"){window.location.reload();return}J.ok&&J.action==="restart"&&XE("awaiting_disconnect"),F(null)}catch(J){Y_(),F(J instanceof Error?J.message:String(J))}}async function Nc(J,ie){var Ee;try{let Ue=$??((Ee=s.projectGroups[0])==null?void 0:Ee.groupKey)??null;if(!e&&!Ue&&ot&&(Ue=(await n.command({type:"project.open",localPath:ot})).projectId,Y(Ue)),!e&&!Ue)throw new Error("Open a project first");if(ie!=null&&ie.provider&&!Yk(ie.provider,(w==null?void 0:w.settings)??Wn))throw new Error(`${ie.provider} is inactive.`);if(at("auto"),ie!=null&&ie.provider&&!Yk(ie.provider,(w==null?void 0:w.settings)??Wn))throw new Error(`${ie.provider} is inactive.`);at("auto");const Mt=await n.command({type:"chat.send",chatId:e??void 0,projectId:e?void 0:Ue??void 0,provider:ie==null?void 0:ie.provider,message:J,model:ie==null?void 0:ie.model,modelOptions:ie==null?void 0:ie.modelOptions,planMode:ie==null?void 0:ie.planMode});!e&&Mt.chatId&&(A(Mt.chatId),t(`/chat/${Mt.chatId}`)),F(null)}catch(Ue){throw F(Ue instanceof Error?Ue.message:String(Ue)),Ue}}async function Yd(){if(e)try{await n.command({type:"chat.cancel",chatId:e})}catch(J){F(J instanceof Error?J.message:String(J))}}async function sa(J){if(await r.confirm({title:"Delete Chat",description:`Delete "${J.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{if(await n.command({type:"chat.delete",chatId:J.chatId}),J.chatId===e){const Ee=xY(s.projectGroups,J.chatId);t(Ee?`/chat/${Ee}`:"/")}}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function Ac(J){const ie=s.projectGroups.find(Mt=>Mt.groupKey===J);if(!ie)return;const Ee=ie.localPath.split("/").filter(Boolean).pop()??ie.localPath;if(await r.confirm({title:"Hide Project",description:`Hide "${Ee}" from ${Mn}? Existing chats for this project will be removed from ${Mn}, but the project itself is not deleted.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await n.command({type:"project.remove",projectId:J}),$o.getState().clearProject(J),Ju.getState().clearProject(J),(De==null?void 0:De.projectId)===J&&t("/"),F(null)}catch(Mt){F(Mt instanceof Error?Mt.message:String(Mt))}}async function co(J){var Ee,Ue;const ie=(De==null?void 0:De.localPath)??((Ee=l==null?void 0:l.projects[0])==null?void 0:Ee.localPath)??((Ue=s.projectGroups[0])==null?void 0:Ue.localPath);if(ie)try{await Yi({action:J,localPath:ie})}catch(Mt){F(Mt instanceof Error?Mt.message:String(Mt))}}async function uo(J){try{await Yi({action:"open_editor",localPath:J.path,line:J.line,column:J.column})}catch(ie){F(ie instanceof Error?ie.message:String(ie))}}async function oa(J,ie){try{await Yi({action:J,localPath:ie})}catch(Ee){F(Ee instanceof Error?Ee.message:String(Ee))}}async function Yi(J){const ie=wi.getState();F(null),await n.command({type:"system.openExternal",...J,editor:J.action==="open_editor"?{preset:ie.editorPreset,commandTemplate:ie.editorCommandTemplate}:void 0})}function An(){var Ue;const J=e?wY(s.projectGroups,e):null,ie=e?YE(s.projectGroups,e):null;if(J&&ie){F(null),zt(ie,J.featureId??void 0);return}const Ee=TY({selectedProjectId:$,sidebarProjectId:(Ue=s.projectGroups[0])==null?void 0:Ue.groupKey,fallbackLocalProjectPath:ot});if(Ee){F(null),Kn(Ee);return}F("Open a project first")}async function Xd(J,ie,Ee){if(e)try{await n.command({type:"chat.respondTool",chatId:e,toolUseId:J,result:{questions:ie,answers:Ee}})}catch(Ue){F(Ue instanceof Error?Ue.message:String(Ue))}}async function Zd(J,ie,Ee,Ue){if(e){ie&&xi.getState().setComposerPlanMode(!1);try{await n.command({type:"chat.respondTool",chatId:e,toolUseId:J,result:{confirmed:ie,...Ee?{clearContext:!0}:{},...Ue?{message:Ue}:{}}})}catch(Mt){F(Mt instanceof Error?Mt.message:String(Mt))}}}return{socket:n,activeChatId:e,sidebarData:s,completedChatIds:Ye,localProjects:l,updateSnapshot:h,chatSnapshot:g,keybindings:v,providerSettings:w,connectionStatus:C,sidebarReady:R,localProjectsReady:M,commandError:U,startingLocalPath:N,folderGroupsEnabled:le,kanbanStatusesEnabled:me,sidebarOpen:P,sidebarCollapsed:I,scrollRef:Ae,inputRef:Re,messages:pt,latestToolIds:Se,runtime:De,usage:ce,availableProviders:be,isProcessing:Oe,canCancel:Ve,transcriptPaddingBottom:we,showScrollButton:He,navbarLocalPath:rt,editorLabel:xe,hasSelectedProject:Le,createFeatureModalProjectId:ne,cursorCurlImportOpen:Z,openSidebar:()=>V(!0),closeSidebar:()=>V(!1),collapseSidebar:()=>W(!0),expandSidebar:()=>W(!1),toggleProjectsSidebar:J=>{if(J){V(!1),W(ie=>!ie);return}V(ie=>!ie)},updateScrollState:St,scrollToBottom:vn,handleCreateChat:zt,handleCreateFeature:Fe,handleCloseCreateFeatureModal:ct,handleConfirmCreateFeature:st,handleRenameFeature:mt,handleDeleteFeature:an,handleSetProjectBrowserState:Te,handleSetProjectGeneralChatsBrowserState:gt,handleSetFeatureBrowserState:Ce,handleSetFeatureStage:Qe,handleSetChatFeature:sn,handleReorderFeatures:G,handleOpenLocalProject:Xe,handleHideLocalProject:jt,handleListDirectories:li,handleCreateProject:It,handleCheckForUpdates:$t,handleInstallUpdate:ir,handleRefreshProviderUsage:vt,handleOpenProviderLogin:qt,handleCloseCursorCurlImport:()=>te(!1),handleSubmitCursorCurlImport:Ot,handleSetCommitProjectMetadataDirectory:Cn,handleSend:Nc,handleCancel:Yd,handleDeleteChat:sa,handleRemoveProject:Ac,handleOpenExternal:co,handleOpenExternalPath:oa,handleOpenLocalLink:uo,handleCompose:An,handleAskUserQuestion:Xd,handleExitPlanMode:Zd}}function vd(e){return[...e.features.flatMap(t=>t.chats),...e.generalChats]}function AY(e){const t=new Set;return e.filter(n=>{const r=n.localPath??n.projectId;return!r||t.has(r)?!1:(t.add(r),!0)})}function DY(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const jY=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,OY=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LY={};function ZE(e,t){return(LY.jsx?OY:jY).test(e)}const zY=/[ \t\n\f\r]/g;function PY(e){return typeof e=="object"?e.type==="text"?QE(e.value):!1:QE(e)}function QE(e){return e.replace(zY,"")===""}class Wd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Wd.prototype.normal={};Wd.prototype.property={};Wd.prototype.space=void 0;function ej(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Wd(n,r,t)}function qy(e){return e.toLowerCase()}class Vr{constructor(t,n){this.attribute=n,this.property=t}}Vr.prototype.attribute="";Vr.prototype.booleanish=!1;Vr.prototype.boolean=!1;Vr.prototype.commaOrSpaceSeparated=!1;Vr.prototype.commaSeparated=!1;Vr.prototype.defined=!1;Vr.prototype.mustUseProperty=!1;Vr.prototype.number=!1;Vr.prototype.overloadedBoolean=!1;Vr.prototype.property="";Vr.prototype.spaceSeparated=!1;Vr.prototype.space=void 0;let BY=0;const ht=il(),zn=il(),Ky=il(),ke=il(),on=il(),ac=il(),ni=il();function il(){return 2**++BY}const Gy=Object.freeze(Object.defineProperty({__proto__:null,boolean:ht,booleanish:zn,commaOrSpaceSeparated:ni,commaSeparated:ac,number:ke,overloadedBoolean:Ky,spaceSeparated:on},Symbol.toStringTag,{value:"Module"})),X_=Object.keys(Gy);class Dx extends Vr{constructor(t,n,r,s){let o=-1;if(super(t,n),JE(this,"space",s),typeof r=="number")for(;++o<X_.length;){const l=X_[o];JE(this,X_[o],(r&Gy[l])===Gy[l])}}}Dx.prototype.defined=!0;function JE(e,t,n){n&&(e[t]=n)}function Tc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new Dx(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[qy(r)]=r,n[qy(o.attribute)]=r}return new Wd(t,n,e.space)}const tj=Tc({properties:{ariaActiveDescendant:null,ariaAtomic:zn,ariaAutoComplete:null,ariaBusy:zn,ariaChecked:zn,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:on,ariaCurrent:null,ariaDescribedBy:on,ariaDetails:null,ariaDisabled:zn,ariaDropEffect:on,ariaErrorMessage:null,ariaExpanded:zn,ariaFlowTo:on,ariaGrabbed:zn,ariaHasPopup:null,ariaHidden:zn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:on,ariaLevel:ke,ariaLive:null,ariaModal:zn,ariaMultiLine:zn,ariaMultiSelectable:zn,ariaOrientation:null,ariaOwns:on,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:zn,ariaReadOnly:zn,ariaRelevant:null,ariaRequired:zn,ariaRoleDescription:on,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:zn,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function nj(e,t){return t in e?e[t]:t}function rj(e,t){return nj(e,t.toLowerCase())}const IY=Tc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ac,acceptCharset:on,accessKey:on,action:null,allow:null,allowFullScreen:ht,allowPaymentRequest:ht,allowUserMedia:ht,alt:null,as:null,async:ht,autoCapitalize:null,autoComplete:on,autoFocus:ht,autoPlay:ht,blocking:on,capture:null,charSet:null,checked:ht,cite:null,className:on,cols:ke,colSpan:null,content:null,contentEditable:zn,controls:ht,controlsList:on,coords:ke|ac,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ht,defer:ht,dir:null,dirName:null,disabled:ht,download:Ky,draggable:zn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ht,formTarget:null,headers:on,height:ke,hidden:Ky,high:ke,href:null,hrefLang:null,htmlFor:on,httpEquiv:on,id:null,imageSizes:null,imageSrcSet:null,inert:ht,inputMode:null,integrity:null,is:null,isMap:ht,itemId:null,itemProp:on,itemRef:on,itemScope:ht,itemType:on,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ht,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:ht,muted:ht,name:null,nonce:null,noModule:ht,noValidate:ht,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ht,optimum:ke,pattern:null,ping:on,placeholder:null,playsInline:ht,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ht,referrerPolicy:null,rel:on,required:ht,reversed:ht,rows:ke,rowSpan:ke,sandbox:on,scope:null,scoped:ht,seamless:ht,selected:ht,shadowRootClonable:ht,shadowRootDelegatesFocus:ht,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:zn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:ht,useMap:null,value:zn,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:on,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ht,declare:ht,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:ht,noHref:ht,noShade:ht,noWrap:ht,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:zn,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ht,disableRemotePlayback:ht,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:rj}),HY=Tc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ni,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:on,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:ht,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ac,g2:ac,glyphName:ac,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:ni,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ke,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:on,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ni,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ni,rev:ni,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ni,requiredFeatures:ni,requiredFonts:ni,requiredFormats:ni,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:ni,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ni,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ni,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:nj}),ij=Tc({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()}}),sj=Tc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:rj}),oj=Tc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),FY={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"},UY=/[A-Z]/g,eR=/-[a-z]/g,$Y=/^data[-\w.:]+$/i;function WY(e,t){const n=qy(t);let r=t,s=Vr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&$Y.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(eR,qY);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!eR.test(o)){let l=o.replace(UY,VY);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}s=Dx}return new s(r,t)}function VY(e){return"-"+e.toLowerCase()}function qY(e){return e.charAt(1).toUpperCase()}const KY=ej([tj,IY,ij,sj,oj],"html"),jx=ej([tj,HY,ij,sj,oj],"svg");function GY(e){return e.join(" ").trim()}var ql={},Z_,tR;function YY(){if(tR)return Z_;tR=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,h=`
|
|
573
|
+
`,d="/",g="*",p="",v="comment",y="declaration";function w(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var R=1,E=1;function M(K){var q=K.match(t);q&&(R+=q.length);var O=K.lastIndexOf(h);E=~O?K.length-O:E+K.length}function j(){var K={line:R,column:E};return function(q){return q.position=new D(K),Y(),q}}function D(K){this.start=K,this.end={line:R,column:E},this.source=k.source}D.prototype.content=C;function L(K){var q=new Error(k.source+":"+R+":"+E+": "+K);if(q.reason=K,q.filename=k.source,q.line=R,q.column=E,q.source=C,!k.silent)throw q}function $(K){var q=K.exec(C);if(q){var O=q[0];return M(O),C=C.slice(O.length),q}}function Y(){$(n)}function P(K){var q;for(K=K||[];q=V();)q!==!1&&K.push(q);return K}function V(){var K=j();if(!(d!=C.charAt(0)||g!=C.charAt(1))){for(var q=2;p!=C.charAt(q)&&(g!=C.charAt(q)||d!=C.charAt(q+1));)++q;if(q+=2,p===C.charAt(q-1))return L("End of comment missing");var O=C.slice(2,q-2);return E+=2,M(O),C=C.slice(q),E+=2,K({type:v,comment:O})}}function I(){var K=j(),q=$(r);if(q){if(V(),!$(s))return L("property missing ':'");var O=$(o),H=K({type:y,property:S(q[0].replace(e,p)),value:O?S(O[0].replace(e,p)):p});return $(l),H}}function W(){var K=[];P(K);for(var q;q=I();)q!==!1&&(K.push(q),P(K));return K}return Y(),W()}function S(C){return C?C.replace(u,p):p}return Z_=w,Z_}var nR;function XY(){if(nR)return ql;nR=1;var e=ql&&ql.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ql,"__esModule",{value:!0}),ql.default=n;const t=e(YY());function n(r,s){let o=null;if(!r||typeof r!="string")return o;const l=(0,t.default)(r),u=typeof s=="function";return l.forEach(h=>{if(h.type!=="declaration")return;const{property:d,value:g}=h;u?s(d,g,h):g&&(o=o||{},o[d]=g)}),o}return ql}var Nu={},rR;function ZY(){if(rR)return Nu;rR=1,Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(d){return!d||n.test(d)||e.test(d)},l=function(d,g){return g.toUpperCase()},u=function(d,g){return"".concat(g,"-")},h=function(d,g){return g===void 0&&(g={}),o(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(s,u):d=d.replace(r,u),d.replace(t,l))};return Nu.camelCase=h,Nu}var Au,iR;function QY(){if(iR)return Au;iR=1;var e=Au&&Au.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(XY()),n=ZY();function r(s,o){var l={};return!s||typeof s!="string"||(0,t.default)(s,function(u,h){u&&h&&(l[(0,n.camelCase)(u,o)]=h)}),l}return r.default=r,Au=r,Au}var JY=QY();const eX=Ym(JY),aj=lj("end"),Ox=lj("start");function lj(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 tX(e){const t=Ox(e),n=aj(e);if(t&&n)return{start:t,end:n}}function ed(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?sR(e.position):"start"in e||"end"in e?sR(e):"line"in e||"column"in e?Yy(e):""}function Yy(e){return oR(e&&e.line)+":"+oR(e&&e.column)}function sR(e){return Yy(e&&e.start)+"-"+Yy(e&&e.end)}function oR(e){return e&&typeof e=="number"?e:1}class yr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(l=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?o.ruleId=r:(o.source=r.slice(0,h),o.ruleId=r.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=u?u.line:void 0,this.name=ed(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}yr.prototype.file="";yr.prototype.name="";yr.prototype.reason="";yr.prototype.message="";yr.prototype.stack="";yr.prototype.column=void 0;yr.prototype.line=void 0;yr.prototype.ancestors=void 0;yr.prototype.cause=void 0;yr.prototype.fatal=void 0;yr.prototype.place=void 0;yr.prototype.ruleId=void 0;yr.prototype.source=void 0;const Lx={}.hasOwnProperty,nX=new Map,rX=/[A-Z]/g,iX=new Set(["table","tbody","thead","tfoot","tr"]),sX=new Set(["td","th"]),cj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function oX(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=mX(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=fX(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"?jx:KY,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=uj(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function uj(e,t,n){if(t.type==="element")return aX(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return lX(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return uX(e,t,n);if(t.type==="mdxjsEsm")return cX(e,t);if(t.type==="root")return dX(e,t,n);if(t.type==="text")return hX(e,t)}function aX(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=jx,e.schema=s),e.ancestors.push(t);const o=hj(e,t.tagName,!1),l=pX(e,t);let u=Px(e,t);return iX.has(t.tagName)&&(u=u.filter(function(h){return typeof h=="string"?!PY(h):!0})),dj(e,l,o,t),zx(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function lX(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}_d(e,t.position)}function cX(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_d(e,t.position)}function uX(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=jx,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:hj(e,t.name,!0),l=gX(e,t),u=Px(e,t);return dj(e,l,o,t),zx(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function dX(e,t,n){const r={};return zx(r,Px(e,t)),e.create(t,e.Fragment,r,n)}function hX(e,t){return t.value}function dj(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function zx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function fX(e,t,n){return r;function r(s,o,l,u){const d=Array.isArray(l.children)?n:t;return u?d(o,l,u):d(o,l)}}function mX(e,t){return n;function n(r,s,o,l){const u=Array.isArray(o.children),h=Ox(r);return t(s,o,l,u,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function pX(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Lx.call(t.properties,s)){const o=vX(e,s,t.properties[s]);if(o){const[l,u]=o;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&sX.has(t.tagName)?r=u:n[l]=u}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function gX(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else _d(e,t.position);else{const s=r.name;let o;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,o=e.evaluater.evaluateExpression(u.expression)}else _d(e,t.position);else o=r.value===null?!0:r.value;n[s]=o}return n}function Px(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:nX;for(;++r<t.children.length;){const o=t.children[r];let l;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const d=s.get(h)||0;l=h+"-"+d,s.set(h,d+1)}}const u=uj(e,o,l);u!==void 0&&n.push(u)}return n}function vX(e,t,n){const r=WY(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?DY(n):GY(n)),r.property==="style"){let s=typeof n=="object"?n:_X(e,String(n));return e.stylePropertyNameCase==="css"&&(s=bX(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?FY[r.property]||r.property:r.attribute,n]}}function _X(e,t){try{return eX(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new yr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=cj+"#cannot-parse-style-attribute",s}}function hj(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,l;for(;++o<s.length;){const u=ZE(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(o&&u.type==="Literal"),optional:!1}:u}r=l}else r=ZE(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Lx.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);_d(e)}function _d(e,t){const n=new yr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=cj+"#cannot-handle-mdx-estrees-without-createevaluater",n}function bX(e){const t={};let n;for(n in e)Lx.call(e,n)&&(t[yX(n)]=e[n]);return t}function yX(e){let t=e.replace(rX,xX);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function xX(e){return"-"+e.toLowerCase()}const Q_={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},wX={};function Bx(e,t){const n=wX,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return fj(e,r,s)}function fj(e,t,n){if(SX(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 aR(e.children,t,n)}return Array.isArray(e)?aR(e,t,n):""}function aR(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=fj(e[s],t,n);return r.join("")}function SX(e){return!!(e&&typeof e=="object")}const lR=document.createElement("i");function Ix(e){const t="&"+e+";";lR.innerHTML=t;const n=lR.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function si(e,t,n,r){const s=e.length;let o=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);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function Ei(e,t){return e.length>0?(si(e,e.length,0,t),e):t}const cR={}.hasOwnProperty;function mj(e){const t={};let n=-1;for(;++n<e.length;)CX(t,e[n]);return t}function CX(e,t){let n;for(n in t){const s=(cR.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){cR.call(s,l)||(s[l]=[]);const u=o[l];kX(s[l],Array.isArray(u)?u:u?[u]:[])}}}function kX(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);si(e,0,0,r)}function pj(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 Hi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rr=ia(/[A-Za-z]/),_r=ia(/[\dA-Za-z]/),EX=ia(/[#-'*+\--9=?A-Z^-~]/);function Wm(e){return e!==null&&(e<32||e===127)}const Xy=ia(/\d/),RX=ia(/[\dA-Fa-f]/),TX=ia(/[!-/:-@[-`{-~]/);function et(e){return e!==null&&e<-2}function rn(e){return e!==null&&(e<0||e===32)}function Rt(e){return e===-2||e===-1||e===32}const Ip=ia(new RegExp("\\p{P}|\\p{S}","u")),Za=ia(/\s/);function ia(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&_r(e.charCodeAt(n+1))&&_r(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const u=e.charCodeAt(n+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),s=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Lt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(h){return Rt(h)?(e.enter(n),u(h)):t(h)}function u(h){return Rt(h)&&o++<s?(e.consume(h),u):(e.exit(n),t(h))}}const MX={tokenize:NX};function NX(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Lt(e,t,"linePrefix")}function s(u){return e.enter("paragraph"),o(u)}function o(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 et(u)?(e.consume(u),e.exit("chunkText"),o):(e.consume(u),l)}}const AX={tokenize:DX},uR={tokenize:jX};function DX(e){const t=this,n=[];let r=0,s,o,l;return u;function u(E){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,h,d)(E)}return d(E)}function h(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&R();const M=t.events.length;let j=M,D;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){D=t.events[j][1].end;break}k(r);let L=M;for(;L<t.events.length;)t.events[L][1].end={...D},L++;return si(t.events,j+1,0,t.events.slice(M)),t.events.length=L,d(E)}return u(E)}function d(E){if(r===n.length){if(!s)return v(E);if(s.currentConstruct&&s.currentConstruct.concrete)return w(E);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(uR,g,p)(E)}function g(E){return s&&R(),k(r),v(E)}function p(E){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,w(E)}function v(E){return t.containerState={},e.attempt(uR,y,w)(E)}function y(E){return r++,n.push([t.currentConstruct,t.containerState]),v(E)}function w(E){if(E===null){s&&R(),k(0),e.consume(E);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),S(E)}function S(E){if(E===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(E);return}return et(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(E),S)}function C(E,M){const j=t.sliceStream(E);if(M&&j.push(null),E.previous=o,o&&(o.next=E),o=E,s.defineSkip(E.start),s.write(j),t.parser.lazy[E.start.line]){let D=s.events.length;for(;D--;)if(s.events[D][1].start.offset<l&&(!s.events[D][1].end||s.events[D][1].end.offset>l))return;const L=t.events.length;let $=L,Y,P;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(Y){P=t.events[$][1].end;break}Y=!0}for(k(r),D=L;D<t.events.length;)t.events[D][1].end={...P},D++;si(t.events,$+1,0,t.events.slice(L)),t.events.length=D}}function k(E){let M=n.length;for(;M-- >E;){const j=n[M];t.containerState=j[1],j[0].exit.call(t,e)}n.length=E}function R(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function jX(e,t,n){return Lt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function mc(e){if(e===null||rn(e)||Za(e))return 1;if(Ip(e))return 2}function Hp(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Zy={name:"attention",resolveAll:OX,tokenize:LX};function OX(e,t){let n=-1,r,s,o,l,u,h,d,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},v={...e[n][1].start};dR(p,-h),dR(v,h),l={type:h>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},u={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},o={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:h>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},e[r][1].end={...l.start},e[n][1].start={...u.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Ei(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Ei(d,[["enter",s,t],["enter",l,t],["exit",l,t],["enter",o,t]]),d=Ei(d,Hp(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Ei(d,[["exit",o,t],["enter",u,t],["exit",u,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,d=Ei(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,si(e,r-1,n-r+3,d),n=r+d.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function LX(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=mc(r);let o;return l;function l(h){return o=h,e.enter("attentionSequence"),u(h)}function u(h){if(h===o)return e.consume(h),u;const d=e.exit("attentionSequence"),g=mc(h),p=!g||g===2&&s||n.includes(h),v=!s||s===2&&g||n.includes(r);return d._open=!!(o===42?p:p&&(s||!v)),d._close=!!(o===42?v:v&&(g||!p)),t(h)}}function dR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const zX={name:"autolink",tokenize:PX};function PX(e,t,n){let r=0;return s;function s(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return Rr(y)?(e.consume(y),l):y===64?n(y):d(y)}function l(y){return y===43||y===45||y===46||_r(y)?(r=1,u(y)):d(y)}function u(y){return y===58?(e.consume(y),r=0,h):(y===43||y===45||y===46||_r(y))&&r++<32?(e.consume(y),u):(r=0,d(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Wm(y)?n(y):(e.consume(y),h)}function d(y){return y===64?(e.consume(y),g):EX(y)?(e.consume(y),d):n(y)}function g(y){return _r(y)?p(y):n(y)}function p(y){return y===46?(e.consume(y),r=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):v(y)}function v(y){if((y===45||_r(y))&&r++<63){const w=y===45?v:p;return e.consume(y),w}return n(y)}}const Vd={partial:!0,tokenize:BX};function BX(e,t,n){return r;function r(o){return Rt(o)?Lt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||et(o)?t(o):n(o)}}const gj={continuation:{tokenize:HX},exit:FX,name:"blockQuote",tokenize:IX};function IX(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"),o}return n(l)}function o(l){return Rt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function HX(e,t,n){const r=this;return s;function s(l){return Rt(l)?Lt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(gj,t,n)(l)}}function FX(e){e.exit("blockQuote")}const vj={name:"characterEscape",tokenize:UX};function UX(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return TX(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const _j={name:"characterReference",tokenize:$X};function $X(e,t,n){const r=this;let s=0,o,l;return u;function u(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),h}function h(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),o=31,l=_r,g(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=RX,g):(e.enter("characterReferenceValue"),o=7,l=Xy,g(p))}function g(p){if(p===59&&s){const v=e.exit("characterReferenceValue");return l===_r&&!Ix(r.sliceSerialize(v))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&s++<o?(e.consume(p),g):n(p)}}const hR={partial:!0,tokenize:VX},fR={concrete:!0,name:"codeFenced",tokenize:WX};function WX(e,t,n){const r=this,s={partial:!0,tokenize:j};let o=0,l=0,u;return h;function h(D){return d(D)}function d(D){const L=r.events[r.events.length-1];return o=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,u=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(D)}function g(D){return D===u?(l++,e.consume(D),g):l<3?n(D):(e.exit("codeFencedFenceSequence"),Rt(D)?Lt(e,p,"whitespace")(D):p(D))}function p(D){return D===null||et(D)?(e.exit("codeFencedFence"),r.interrupt?t(D):e.check(hR,S,M)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(D))}function v(D){return D===null||et(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(D)):Rt(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Lt(e,y,"whitespace")(D)):D===96&&D===u?n(D):(e.consume(D),v)}function y(D){return D===null||et(D)?p(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(D))}function w(D){return D===null||et(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(D)):D===96&&D===u?n(D):(e.consume(D),w)}function S(D){return e.attempt(s,M,C)(D)}function C(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),k}function k(D){return o>0&&Rt(D)?Lt(e,R,"linePrefix",o+1)(D):R(D)}function R(D){return D===null||et(D)?e.check(hR,S,M)(D):(e.enter("codeFlowValue"),E(D))}function E(D){return D===null||et(D)?(e.exit("codeFlowValue"),R(D)):(e.consume(D),E)}function M(D){return e.exit("codeFenced"),t(D)}function j(D,L,$){let Y=0;return P;function P(q){return D.enter("lineEnding"),D.consume(q),D.exit("lineEnding"),V}function V(q){return D.enter("codeFencedFence"),Rt(q)?Lt(D,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):I(q)}function I(q){return q===u?(D.enter("codeFencedFenceSequence"),W(q)):$(q)}function W(q){return q===u?(Y++,D.consume(q),W):Y>=l?(D.exit("codeFencedFenceSequence"),Rt(q)?Lt(D,K,"whitespace")(q):K(q)):$(q)}function K(q){return q===null||et(q)?(D.exit("codeFencedFence"),L(q)):$(q)}}}function VX(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"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const J_={name:"codeIndented",tokenize:KX},qX={partial:!0,tokenize:GX};function KX(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),Lt(e,o,"linePrefix",5)(d)}function o(d){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?l(d):n(d)}function l(d){return d===null?h(d):et(d)?e.attempt(qX,l,h)(d):(e.enter("codeFlowValue"),u(d))}function u(d){return d===null||et(d)?(e.exit("codeFlowValue"),l(d)):(e.consume(d),u)}function h(d){return e.exit("codeIndented"),t(d)}}function GX(e,t,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):et(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):Lt(e,o,"linePrefix",5)(l)}function o(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):et(l)?s(l):n(l)}}const YX={name:"codeText",previous:ZX,resolve:XX,tokenize:QX};function XX(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 ZX(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function QX(e,t,n){let r=0,s,o;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),u(p)}function u(p){return p===96?(e.consume(p),r++,u):(e.exit("codeTextSequence"),h(p))}function h(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),h):p===96?(o=e.enter("codeTextSequence"),s=0,g(p)):et(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||et(p)?(e.exit("codeTextData"),h(p)):(e.consume(p),d)}function g(p){return p===96?(e.consume(p),s++,g):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",d(p))}}class JX{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 o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Du(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Du(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Du(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);Du(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Du(this.left,n.reverse())}}}function Du(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 bj(e){const t={};let n=-1,r,s,o,l,u,h,d;const g=new JX(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(r=g.get(n),n&&r[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,eZ(g,n)),n=t[n],d=!0);else if(r[1]._container){for(o=n,s=void 0;o--;)if(l=g.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(r[1].end={...g.get(s)[1].start},u=g.slice(s,n),u.unshift(r),g.splice(s,n-s+1,u))}}return si(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function eZ(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,h=[],d={};let g,p,v=-1,y=n,w=0,S=0;const C=[S];for(;y;){for(;e.get(++s)[1]!==y;);o.push(s),y._tokenizer||(g=r.sliceStream(y),y.next||g.push(null),p&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(g),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=y,y=y.next}for(y=n;++v<u.length;)u[v][0]==="exit"&&u[v-1][0]==="enter"&&u[v][1].type===u[v-1][1].type&&u[v][1].start.line!==u[v][1].end.line&&(S=v+1,C.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):C.pop(),v=C.length;v--;){const k=u.slice(C[v],C[v+1]),R=o.pop();h.push([R,R+k.length-1]),e.splice(R,2,k)}for(h.reverse(),v=-1;++v<h.length;)d[w+h[v][0]]=w+h[v][1],w+=h[v][1]-h[v][0]-1;return d}const tZ={resolve:rZ,tokenize:iZ},nZ={partial:!0,tokenize:sZ};function rZ(e){return bj(e),e}function iZ(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?o(u):et(u)?e.check(nZ,l,o)(u):(e.consume(u),s)}function o(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 sZ(e,t,n){const r=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Lt(e,o,"linePrefix")}function o(l){if(l===null||et(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 yj(e,t,n,r,s,o,l,u,h){const d=h||Number.POSITIVE_INFINITY;let g=0;return p;function p(k){return k===60?(e.enter(r),e.enter(s),e.enter(o),e.consume(k),e.exit(o),v):k===null||k===32||k===41||Wm(k)?n(k):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),S(k))}function v(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(s),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(e.exit("chunkString"),e.exit(u),v(k)):k===null||k===60||et(k)?n(k):(e.consume(k),k===92?w:y)}function w(k){return k===60||k===62||k===92?(e.consume(k),y):y(k)}function S(k){return!g&&(k===null||k===41||rn(k))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(k)):g<d&&k===40?(e.consume(k),g++,S):k===41?(e.consume(k),g--,S):k===null||k===32||k===40||Wm(k)?n(k):(e.consume(k),k===92?C:S)}function C(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function xj(e,t,n,r,s,o){const l=this;let u=0,h;return d;function d(y){return e.enter(r),e.enter(s),e.consume(y),e.exit(s),e.enter(o),g}function g(y){return u>999||y===null||y===91||y===93&&!h||y===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(e.exit(o),e.enter(s),e.consume(y),e.exit(s),e.exit(r),t):et(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===null||y===91||y===93||et(y)||u++>999?(e.exit("chunkString"),g(y)):(e.consume(y),h||(h=!Rt(y)),y===92?v:p)}function v(y){return y===91||y===92||y===93?(e.consume(y),u++,p):p(y)}}function wj(e,t,n,r,s,o){let l;return u;function u(v){return v===34||v===39||v===40?(e.enter(r),e.enter(s),e.consume(v),e.exit(s),l=v===40?41:v,h):n(v)}function h(v){return v===l?(e.enter(s),e.consume(v),e.exit(s),e.exit(r),t):(e.enter(o),d(v))}function d(v){return v===l?(e.exit(o),h(l)):v===null?n(v):et(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Lt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===l||v===null||et(v)?(e.exit("chunkString"),d(v)):(e.consume(v),v===92?p:g)}function p(v){return v===l||v===92?(e.consume(v),g):g(v)}}function td(e,t){let n;return r;function r(s){return et(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Rt(s)?Lt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const oZ={name:"definition",tokenize:lZ},aZ={partial:!0,tokenize:cZ};function lZ(e,t,n){const r=this;let s;return o;function o(y){return e.enter("definition"),l(y)}function l(y){return xj.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function u(y){return s=Hi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return rn(y)?td(e,d)(y):d(y)}function d(y){return yj(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(aZ,p,p)(y)}function p(y){return Rt(y)?Lt(e,v,"whitespace")(y):v(y)}function v(y){return y===null||et(y)?(e.exit("definition"),r.parser.defined.push(s),t(y)):n(y)}}function cZ(e,t,n){return r;function r(u){return rn(u)?td(e,s)(u):n(u)}function s(u){return wj(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return Rt(u)?Lt(e,l,"whitespace")(u):l(u)}function l(u){return u===null||et(u)?t(u):n(u)}}const uZ={name:"hardBreakEscape",tokenize:dZ};function dZ(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return et(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const hZ={name:"headingAtx",resolve:fZ,tokenize:mZ};function fZ(e,t){let n=e.length-2,r=3,s,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},si(e,r,n-r+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function mZ(e,t,n){let r=0;return s;function s(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),l(g)}function l(g){return g===35&&r++<6?(e.consume(g),l):g===null||rn(g)?(e.exit("atxHeadingSequence"),u(g)):n(g)}function u(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||et(g)?(e.exit("atxHeading"),t(g)):Rt(g)?Lt(e,u,"whitespace")(g):(e.enter("atxHeadingText"),d(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),u(g))}function d(g){return g===null||g===35||rn(g)?(e.exit("atxHeadingText"),u(g)):(e.consume(g),d)}}const pZ=["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"],mR=["pre","script","style","textarea"],gZ={concrete:!0,name:"htmlFlow",resolveTo:bZ,tokenize:yZ},vZ={partial:!0,tokenize:wZ},_Z={partial:!0,tokenize:xZ};function bZ(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 yZ(e,t,n){const r=this;let s,o,l,u,h;return d;function d(A){return g(A)}function g(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),p}function p(A){return A===33?(e.consume(A),v):A===47?(e.consume(A),o=!0,S):A===63?(e.consume(A),s=3,r.interrupt?t:N):Rr(A)?(e.consume(A),l=String.fromCharCode(A),C):n(A)}function v(A){return A===45?(e.consume(A),s=2,y):A===91?(e.consume(A),s=5,u=0,w):Rr(A)?(e.consume(A),s=4,r.interrupt?t:N):n(A)}function y(A){return A===45?(e.consume(A),r.interrupt?t:N):n(A)}function w(A){const ne="CDATA[";return A===ne.charCodeAt(u++)?(e.consume(A),u===ne.length?r.interrupt?t:I:w):n(A)}function S(A){return Rr(A)?(e.consume(A),l=String.fromCharCode(A),C):n(A)}function C(A){if(A===null||A===47||A===62||rn(A)){const ne=A===47,ae=l.toLowerCase();return!ne&&!o&&mR.includes(ae)?(s=1,r.interrupt?t(A):I(A)):pZ.includes(l.toLowerCase())?(s=6,ne?(e.consume(A),k):r.interrupt?t(A):I(A)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):o?R(A):E(A))}return A===45||_r(A)?(e.consume(A),l+=String.fromCharCode(A),C):n(A)}function k(A){return A===62?(e.consume(A),r.interrupt?t:I):n(A)}function R(A){return Rt(A)?(e.consume(A),R):P(A)}function E(A){return A===47?(e.consume(A),P):A===58||A===95||Rr(A)?(e.consume(A),M):Rt(A)?(e.consume(A),E):P(A)}function M(A){return A===45||A===46||A===58||A===95||_r(A)?(e.consume(A),M):j(A)}function j(A){return A===61?(e.consume(A),D):Rt(A)?(e.consume(A),j):E(A)}function D(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),h=A,L):Rt(A)?(e.consume(A),D):$(A)}function L(A){return A===h?(e.consume(A),h=null,Y):A===null||et(A)?n(A):(e.consume(A),L)}function $(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||rn(A)?j(A):(e.consume(A),$)}function Y(A){return A===47||A===62||Rt(A)?E(A):n(A)}function P(A){return A===62?(e.consume(A),V):n(A)}function V(A){return A===null||et(A)?I(A):Rt(A)?(e.consume(A),V):n(A)}function I(A){return A===45&&s===2?(e.consume(A),O):A===60&&s===1?(e.consume(A),H):A===62&&s===4?(e.consume(A),B):A===63&&s===3?(e.consume(A),N):A===93&&s===5?(e.consume(A),F):et(A)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(vZ,X,W)(A)):A===null||et(A)?(e.exit("htmlFlowData"),W(A)):(e.consume(A),I)}function W(A){return e.check(_Z,K,X)(A)}function K(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),q}function q(A){return A===null||et(A)?W(A):(e.enter("htmlFlowData"),I(A))}function O(A){return A===45?(e.consume(A),N):I(A)}function H(A){return A===47?(e.consume(A),l="",U):I(A)}function U(A){if(A===62){const ne=l.toLowerCase();return mR.includes(ne)?(e.consume(A),B):I(A)}return Rr(A)&&l.length<8?(e.consume(A),l+=String.fromCharCode(A),U):I(A)}function F(A){return A===93?(e.consume(A),N):I(A)}function N(A){return A===62?(e.consume(A),B):A===45&&s===2?(e.consume(A),N):I(A)}function B(A){return A===null||et(A)?(e.exit("htmlFlowData"),X(A)):(e.consume(A),B)}function X(A){return e.exit("htmlFlow"),t(A)}}function xZ(e,t,n){const r=this;return s;function s(l){return et(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function wZ(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Vd,t,n)}}const SZ={name:"htmlText",tokenize:CZ};function CZ(e,t,n){const r=this;let s,o,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),j):N===63?(e.consume(N),E):Rr(N)?(e.consume(N),$):n(N)}function d(N){return N===45?(e.consume(N),g):N===91?(e.consume(N),o=0,w):Rr(N)?(e.consume(N),R):n(N)}function g(N){return N===45?(e.consume(N),y):n(N)}function p(N){return N===null?n(N):N===45?(e.consume(N),v):et(N)?(l=p,H(N)):(e.consume(N),p)}function v(N){return N===45?(e.consume(N),y):p(N)}function y(N){return N===62?O(N):N===45?v(N):p(N)}function w(N){const B="CDATA[";return N===B.charCodeAt(o++)?(e.consume(N),o===B.length?S:w):n(N)}function S(N){return N===null?n(N):N===93?(e.consume(N),C):et(N)?(l=S,H(N)):(e.consume(N),S)}function C(N){return N===93?(e.consume(N),k):S(N)}function k(N){return N===62?O(N):N===93?(e.consume(N),k):S(N)}function R(N){return N===null||N===62?O(N):et(N)?(l=R,H(N)):(e.consume(N),R)}function E(N){return N===null?n(N):N===63?(e.consume(N),M):et(N)?(l=E,H(N)):(e.consume(N),E)}function M(N){return N===62?O(N):E(N)}function j(N){return Rr(N)?(e.consume(N),D):n(N)}function D(N){return N===45||_r(N)?(e.consume(N),D):L(N)}function L(N){return et(N)?(l=L,H(N)):Rt(N)?(e.consume(N),L):O(N)}function $(N){return N===45||_r(N)?(e.consume(N),$):N===47||N===62||rn(N)?Y(N):n(N)}function Y(N){return N===47?(e.consume(N),O):N===58||N===95||Rr(N)?(e.consume(N),P):et(N)?(l=Y,H(N)):Rt(N)?(e.consume(N),Y):O(N)}function P(N){return N===45||N===46||N===58||N===95||_r(N)?(e.consume(N),P):V(N)}function V(N){return N===61?(e.consume(N),I):et(N)?(l=V,H(N)):Rt(N)?(e.consume(N),V):Y(N)}function I(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),s=N,W):et(N)?(l=I,H(N)):Rt(N)?(e.consume(N),I):(e.consume(N),K)}function W(N){return N===s?(e.consume(N),s=void 0,q):N===null?n(N):et(N)?(l=W,H(N)):(e.consume(N),W)}function K(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||rn(N)?Y(N):(e.consume(N),K)}function q(N){return N===47||N===62||rn(N)?Y(N):n(N)}function O(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function H(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),U}function U(N){return Rt(N)?Lt(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):F(N)}function F(N){return e.enter("htmlTextData"),l(N)}}const Hx={name:"labelEnd",resolveAll:TZ,resolveTo:MZ,tokenize:NZ},kZ={tokenize:AZ},EZ={tokenize:DZ},RZ={tokenize:jZ};function TZ(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&si(e,0,e.length,n),e}function MZ(e,t){let n=e.length,r=0,s,o,l,u;for(;n--;)if(s=e[n][1],o){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&&(o=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(l=n);const h={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},g={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[l-2][1].start}};return u=[["enter",h,t],["enter",d,t]],u=Ei(u,e.slice(o+1,o+r+3)),u=Ei(u,[["enter",g,t]]),u=Ei(u,Hp(t.parser.constructs.insideSpan.null,e.slice(o+r+4,l-3),t)),u=Ei(u,[["exit",g,t],e[l-2],e[l-1],["exit",d,t]]),u=Ei(u,e.slice(l+1)),u=Ei(u,[["exit",h,t]]),si(e,o,e.length,u),e}function NZ(e,t,n){const r=this;let s=r.events.length,o,l;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){o=r.events[s][1];break}return u;function u(v){return o?o._inactive?p(v):(l=r.parser.defined.includes(Hi(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),h):n(v)}function h(v){return v===40?e.attempt(kZ,g,l?g:p)(v):v===91?e.attempt(EZ,g,l?d:p)(v):l?g(v):p(v)}function d(v){return e.attempt(RZ,g,p)(v)}function g(v){return t(v)}function p(v){return o._balanced=!0,n(v)}}function AZ(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return rn(p)?td(e,o)(p):o(p)}function o(p){return p===41?g(p):yj(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return rn(p)?td(e,h)(p):g(p)}function u(p){return n(p)}function h(p){return p===34||p===39||p===40?wj(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function d(p){return rn(p)?td(e,g)(p):g(p)}function g(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function DZ(e,t,n){const r=this;return s;function s(u){return xj.call(r,e,o,l,"reference","referenceMarker","referenceString")(u)}function o(u){return r.parser.defined.includes(Hi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function jZ(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const OZ={name:"labelStartImage",resolveAll:Hx.resolveAll,tokenize:LZ};function LZ(e,t,n){const r=this;return s;function s(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),o}function o(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 zZ={name:"labelStartLink",resolveAll:Hx.resolveAll,tokenize:PZ};function PZ(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"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const eb={name:"lineEnding",tokenize:BZ};function BZ(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Lt(e,t,"linePrefix")}}const dm={name:"thematicBreak",tokenize:IZ};function IZ(e,t,n){let r=0,s;return o;function o(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||et(d))?(e.exit("thematicBreak"),t(d)):n(d)}function h(d){return d===s?(e.consume(d),r++,h):(e.exit("thematicBreakSequence"),Rt(d)?Lt(e,u,"whitespace")(d):u(d))}}const Fr={continuation:{tokenize:$Z},exit:VZ,name:"list",tokenize:UZ},HZ={partial:!0,tokenize:qZ},FZ={partial:!0,tokenize:WZ};function UZ(e,t,n){const r=this,s=r.events[r.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return u;function u(y){const w=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Xy(y)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(dm,n,d)(y):d(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return Xy(y)&&++l<10?(e.consume(y),h):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),d(y)):n(y)}function d(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Vd,r.interrupt?n:g,e.attempt(HZ,v,p))}function g(y){return r.containerState.initialBlankLine=!0,o++,v(y)}function p(y){return Rt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),v):n(y)}function v(y){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function $Z(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Vd,s,o);function s(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Lt(e,t,"listItemIndent",r.containerState.size+1)(u)}function o(u){return r.containerState.furtherBlankLines||!Rt(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(FZ,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,Lt(e,e.attempt(Fr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function WZ(e,t,n){const r=this;return Lt(e,s,"listItemIndent",r.containerState.size+1);function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function VZ(e){e.exit(this.containerState.type)}function qZ(e,t,n){const r=this;return Lt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const l=r.events[r.events.length-1];return!Rt(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const pR={name:"setextUnderline",resolveTo:KZ,tokenize:GZ};function KZ(e,t){let n=e.length,r,s,o;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),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",l,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function GZ(e,t,n){const r=this;let s;return o;function o(d){let g=r.events.length,p;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){p=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),s=d,l(d)):n(d)}function l(d){return e.enter("setextHeadingLineSequence"),u(d)}function u(d){return d===s?(e.consume(d),u):(e.exit("setextHeadingLineSequence"),Rt(d)?Lt(e,h,"lineSuffix")(d):h(d))}function h(d){return d===null||et(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const YZ={tokenize:XZ};function XZ(e){const t=this,n=e.attempt(Vd,r,e.attempt(this.parser.constructs.flowInitial,s,Lt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(tZ,s)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ZZ={resolveAll:Cj()},QZ=Sj("string"),JZ=Sj("text");function Sj(e){return{resolveAll:Cj(e==="text"?eQ:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],o=n.attempt(s,l,u);return l;function l(g){return d(g)?o(g):u(g)}function u(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),h}function h(g){return d(g)?(n.exit("data"),o(g)):(n.consume(g),h)}function d(g){if(g===null)return!0;const p=s[g];let v=-1;if(p)for(;++v<p.length;){const y=p[v];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function Cj(e){return t;function t(n,r){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,r):n}}function eQ(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 o=s.length,l=-1,u=0,h;for(;o--;){const d=s[o];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){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const d={type:n===e.length||h||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:r.start._bufferIndex+l,_index:r.start._index+o,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 tQ={42:Fr,43:Fr,45:Fr,48:Fr,49:Fr,50:Fr,51:Fr,52:Fr,53:Fr,54:Fr,55:Fr,56:Fr,57:Fr,62:gj},nQ={91:oZ},rQ={[-2]:J_,[-1]:J_,32:J_},iQ={35:hZ,42:dm,45:[pR,dm],60:gZ,61:pR,95:dm,96:fR,126:fR},sQ={38:_j,92:vj},oQ={[-5]:eb,[-4]:eb,[-3]:eb,33:OZ,38:_j,42:Zy,60:[zX,SZ],91:zZ,92:[uZ,vj],93:Hx,95:Zy,96:YX},aQ={null:[Zy,ZZ]},lQ={null:[42,95]},cQ={null:[]},uQ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:lQ,contentInitial:nQ,disable:cQ,document:tQ,flow:iQ,flowInitial:rQ,insideSpan:aQ,string:sQ,text:oQ},Symbol.toStringTag,{value:"Module"}));function dQ(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={},o=[];let l=[],u=[];const h={attempt:L(j),check:L(D),consume:R,enter:E,exit:M,interrupt:L(D,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:v,sliceStream:y,write:p};let g=t.tokenize.call(d,h);return t.resolveAll&&o.push(t),d;function p(V){return l=Ei(l,V),C(),l[l.length-1]!==null?[]:($(t,0),d.events=Hp(o,d.events,d),d.events)}function v(V,I){return fQ(y(V),I)}function y(V){return hQ(l,V)}function w(){const{_bufferIndex:V,_index:I,line:W,column:K,offset:q}=r;return{_bufferIndex:V,_index:I,line:W,column:K,offset:q}}function S(V){s[V.line]=V.column,P()}function C(){let V;for(;r._index<l.length;){const I=l[r._index];if(typeof I=="string")for(V=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===V&&r._bufferIndex<I.length;)k(I.charCodeAt(r._bufferIndex));else k(I)}}function k(V){g=g(V)}function R(V){et(V)?(r.line++,r.column=1,r.offset+=V===-3?2:1,P()):V!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=V}function E(V,I){const W=I||{};return W.type=V,W.start=w(),d.events.push(["enter",W,d]),u.push(W),W}function M(V){const I=u.pop();return I.end=w(),d.events.push(["exit",I,d]),I}function j(V,I){$(V,I.from)}function D(V,I){I.restore()}function L(V,I){return W;function W(K,q,O){let H,U,F,N;return Array.isArray(K)?X(K):"tokenize"in K?X([K]):B(K);function B(Z){return te;function te(le){const me=le!==null&&Z[le],xe=le!==null&&Z.null,Ae=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(xe)?xe:xe?[xe]:[]];return X(Ae)(le)}}function X(Z){return H=Z,U=0,Z.length===0?O:A(Z[U])}function A(Z){return te;function te(le){return N=Y(),F=Z,Z.partial||(d.currentConstruct=Z),Z.name&&d.parser.constructs.disable.null.includes(Z.name)?ae():Z.tokenize.call(I?Object.assign(Object.create(d),I):d,h,ne,ae)(le)}}function ne(Z){return V(F,N),q}function ae(Z){return N.restore(),++U<H.length?A(H[U]):O}}}function $(V,I){V.resolveAll&&!o.includes(V)&&o.push(V),V.resolve&&si(d.events,I,d.events.length-I,V.resolve(d.events.slice(I),d)),V.resolveTo&&(d.events=V.resolveTo(d.events,d))}function Y(){const V=w(),I=d.previous,W=d.currentConstruct,K=d.events.length,q=Array.from(u);return{from:K,restore:O};function O(){r=V,d.previous=I,d.currentConstruct=W,d.events.length=K,u=q,P()}}function P(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function hQ(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let l;if(n===s)l=[e[n].slice(r,o)];else{if(l=e.slice(n,s),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}o>0&&l.push(e[s].slice(0,o))}return l}function fQ(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
|
|
574
|
+
`;break}case-3:{l=`\r
|
|
575
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&s)continue;l=" ";break}default:l=String.fromCharCode(o)}s=o===-2,r.push(l)}return r.join("")}function mQ(e){const r={constructs:mj([uQ,...(e||{}).extensions||[]]),content:s(MX),defined:[],document:s(AX),flow:s(YZ),lazy:{},string:s(QZ),text:s(JZ)};return r;function s(o){return l;function l(u){return dQ(r,o,u)}}}function pQ(e){for(;!bj(e););return e}const gR=/[\0\t\n\r]/g;function gQ(){let e=1,t="",n=!0,r;return s;function s(o,l,u){const h=[];let d,g,p,v,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(gR.lastIndex=p,d=gR.exec(o),v=d&&d.index!==void 0?d.index:o.length,y=o.charCodeAt(v),!d){t=o.slice(p);break}if(y===10&&p===v&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),p<v&&(h.push(o.slice(p,v)),e+=v-p),y){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}p=v+1}return u&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const vQ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _Q(e){return e.replace(vQ,bQ)}function bQ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return pj(n.slice(o?2:1),o?16:10)}return Ix(n)||e}const kj={}.hasOwnProperty;function yQ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),xQ(n)(pQ(mQ(n).document().write(gQ()(e,t,!0))))}function xQ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Ne),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:o(xt),blockQuote:o(xe),characterEscape:Y,characterReference:Y,codeFenced:o(Ae),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(Ae,l),codeText:o(Re,l),codeTextData:Y,data:Y,codeFlowValue:Y,definition:o(je),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(Ye),hardBreakEscape:o(ft),hardBreakTrailing:o(ft),htmlFlow:o(he,l),htmlFlowData:Y,htmlText:o(he,l),htmlTextData:Y,image:o(Pe),label:l,link:o(Ne),listItem:o(wt),listItemValue:v,listOrdered:o(tt,p),listUnordered:o(tt),paragraph:o($e),reference:A,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(xt),strong:o(pt),thematicBreak:o(De)},exit:{atxHeading:h(),atxHeadingSequence:j,autolink:h(),autolinkEmail:me,autolinkProtocol:le,blockQuote:h(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:Z,characterReference:te,codeFenced:h(C),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:P,codeIndented:h(k),codeText:h(q),codeTextData:P,data:P,definition:h(),definitionDestinationString:M,definitionLabelString:R,definitionTitleString:E,emphasis:h(),hardBreakEscape:h(I),hardBreakTrailing:h(I),htmlFlow:h(W),htmlFlowData:P,htmlText:h(K),htmlTextData:P,image:h(H),label:F,labelText:U,lineEnding:V,link:h(O),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:ne,resourceDestinationString:N,resourceTitleString:B,resource:X,setextHeading:h($),setextHeadingLineSequence:L,setextHeadingText:D,strong:h(),thematicBreak:h()}};Ej(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ce){let be={type:"root",children:[]};const Oe={stack:[be],tokenStack:[],config:t,enter:u,exit:d,buffer:l,resume:g,data:n},Ve=[];let we=-1;for(;++we<ce.length;)if(ce[we][1].type==="listOrdered"||ce[we][1].type==="listUnordered")if(ce[we][0]==="enter")Ve.push(we);else{const He=Ve.pop();we=s(ce,He,we)}for(we=-1;++we<ce.length;){const He=t[ce[we][0]];kj.call(He,ce[we][1].type)&&He[ce[we][1].type].call(Object.assign({sliceSerialize:ce[we][2].sliceSerialize},Oe),ce[we][1])}if(Oe.tokenStack.length>0){const He=Oe.tokenStack[Oe.tokenStack.length-1];(He[1]||vR).call(Oe,void 0,He[0])}for(be.position={start:Fo(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Fo(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)be=t.transforms[we](be)||be;return be}function s(ce,be,Oe){let Ve=be-1,we=-1,He=!1,ot,rt,Le,St;for(;++Ve<=Oe;){const at=ce[Ve];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?we++:we--,St=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(ot&&!St&&!we&&!Le&&(Le=Ve),St=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:St=void 0}if(!we&&at[0]==="enter"&&at[1].type==="listItemPrefix"||we===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(ot){let vn=Ve;for(rt=void 0;vn--;){const tn=ce[vn];if(tn[1].type==="lineEnding"||tn[1].type==="lineEndingBlank"){if(tn[0]==="exit")continue;rt&&(ce[rt][1].type="lineEndingBlank",He=!0),tn[1].type="lineEnding",rt=vn}else if(!(tn[1].type==="linePrefix"||tn[1].type==="blockQuotePrefix"||tn[1].type==="blockQuotePrefixWhitespace"||tn[1].type==="blockQuoteMarker"||tn[1].type==="listItemIndent"))break}Le&&(!rt||Le<rt)&&(ot._spread=!0),ot.end=Object.assign({},rt?ce[rt][1].start:at[1].end),ce.splice(rt||Ve,0,["exit",ot,at[2]]),Ve++,Oe++}if(at[1].type==="listItemPrefix"){const vn={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};ot=vn,ce.splice(Ve,0,["enter",vn,at[2]]),Ve++,Oe++,Le=void 0,St=!0}}}return ce[be][1]._spread=He,Oe}function o(ce,be){return Oe;function Oe(Ve){u.call(this,ce(Ve),Ve),be&&be.call(this,Ve)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(ce,be,Oe){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([be,Oe||void 0]),ce.position={start:Fo(be.start),end:void 0}}function h(ce){return be;function be(Oe){ce&&ce.call(this,Oe),d.call(this,Oe)}}function d(ce,be){const Oe=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==ce.type&&(be?be.call(this,ce,Ve[0]):(Ve[1]||vR).call(this,ce,Ve[0]));else throw new Error("Cannot close `"+ce.type+"` ("+ed({start:ce.start,end:ce.end})+"): it’s not open");Oe.position.end=Fo(ce.end)}function g(){return Bx(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function v(ce){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.lang=ce}function w(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.meta=ce}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce.replace(/(\r?\n|\r)$/g,"")}function R(ce){const be=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=be,Oe.identifier=Hi(this.sliceSerialize(ce)).toLowerCase()}function E(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.title=ce}function M(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.url=ce}function j(ce){const be=this.stack[this.stack.length-1];if(!be.depth){const Oe=this.sliceSerialize(ce).length;be.depth=Oe}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function L(ce){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(ce){const Oe=this.stack[this.stack.length-1].children;let Ve=Oe[Oe.length-1];(!Ve||Ve.type!=="text")&&(Ve=Se(),Ve.position={start:Fo(ce.start),end:void 0},Oe.push(Ve)),this.stack.push(Ve)}function P(ce){const be=this.stack.pop();be.value+=this.sliceSerialize(ce),be.position.end=Fo(ce.end)}function V(ce){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=be.children[be.children.length-1];Oe.position.end=Fo(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(Y.call(this,ce),P.call(this,ce))}function I(){this.data.atHardBreak=!0}function W(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function K(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function q(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function O(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=be,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function H(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=be,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function U(ce){const be=this.sliceSerialize(ce),Oe=this.stack[this.stack.length-2];Oe.label=_Q(be),Oe.identifier=Hi(be).toLowerCase()}function F(){const ce=this.stack[this.stack.length-1],be=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const Ve=ce.children;Oe.children=Ve}else Oe.alt=be}function N(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.url=ce}function B(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.title=ce}function X(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ne(ce){const be=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=be,Oe.identifier=Hi(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function ae(ce){this.data.characterReferenceType=ce.type}function Z(ce){const be=this.sliceSerialize(ce),Oe=this.data.characterReferenceType;let Ve;Oe?(Ve=pj(be,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=Ix(be);const we=this.stack[this.stack.length-1];we.value+=Ve}function te(ce){const be=this.stack.pop();be.position.end=Fo(ce.end)}function le(ce){P.call(this,ce);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ce)}function me(ce){P.call(this,ce);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ce)}function xe(){return{type:"blockquote",children:[]}}function Ae(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ye(){return{type:"emphasis",children:[]}}function xt(){return{type:"heading",depth:0,children:[]}}function ft(){return{type:"break"}}function he(){return{type:"html",value:""}}function Pe(){return{type:"image",title:null,url:"",alt:null}}function Ne(){return{type:"link",title:null,url:"",children:[]}}function tt(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function wt(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function $e(){return{type:"paragraph",children:[]}}function pt(){return{type:"strong",children:[]}}function Se(){return{type:"text",value:""}}function De(){return{type:"thematicBreak"}}}function Fo(e){return{line:e.line,column:e.column,offset:e.offset}}function Ej(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Ej(e,r):wQ(e,r)}}function wQ(e,t){let n;for(n in t)if(kj.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 vR(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ed({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ed({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ed({start:t.start,end:t.end})+") is still open")}function SQ(e){const t=this;t.parser=n;function n(r){return yQ(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function CQ(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 kQ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
576
|
+
`}]}function EQ(e,t){const n=t.value?t.value+`
|
|
577
|
+
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function RQ(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TQ(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MQ(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Mc(r.toLowerCase()),o=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=o+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 NQ(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 AQ(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Rj(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),o=s[0];o&&o.type==="text"?o.value="["+o.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 DQ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Rj(e,t);const s={src:Mc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function jQ(e,t){const n={src:Mc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function OQ(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 LQ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Rj(e,t);const s={href:Mc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function zQ(e,t){const n={href:Mc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function PQ(e,t,n){const r=e.all(t),s=n?BQ(n):Tj(t),o={},l=[];if(typeof t.checked=="boolean"){const g=r[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const g=r[u];(s||u!==0||g.type!=="element"||g.tagName!=="p")&&l.push({type:"text",value:`
|
|
578
|
+
`}),g.type==="element"&&g.tagName==="p"&&!s?l.push(...g.children):l.push(g)}const h=r[r.length-1];h&&(s||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
|
|
579
|
+
`});const d={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,d),e.applyData(t,d)}function BQ(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=Tj(n[r])}return t}function Tj(e){const t=e.spread;return t??e.children.length>1}function IQ(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 o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function HQ(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function FQ(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function UQ(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $Q(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=Ox(t.children[1]),h=aj(t.children[t.children.length-1]);u&&h&&(l.position={start:u,end:h}),s.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function WQ(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let h=-1;const d=[];for(;++h<u;){const p=t.children[h],v={},y=l?l[h]:void 0;y&&(v.align=y);let w={type:"element",tagName:o,properties:v,children:[]};p&&(w.children=e.all(p),e.patch(p,w),w=e.applyData(p,w)),d.push(w)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,g),e.applyData(t,g)}function VQ(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const _R=9,bR=32;function qQ(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const o=[];for(;r;)o.push(yR(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return o.push(yR(t.slice(s),s>0,!1)),o.join("")}function yR(e,t,n){let r=0,s=e.length;if(t){let o=e.codePointAt(r);for(;o===_R||o===bR;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(s-1);for(;o===_R||o===bR;)s--,o=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function KQ(e,t){const n={type:"text",value:qQ(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function GQ(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const YQ={blockquote:CQ,break:kQ,code:EQ,delete:RQ,emphasis:TQ,footnoteReference:MQ,heading:NQ,html:AQ,imageReference:DQ,image:jQ,inlineCode:OQ,linkReference:LQ,link:zQ,listItem:PQ,list:IQ,paragraph:HQ,root:FQ,strong:UQ,table:$Q,tableCell:VQ,tableRow:WQ,text:KQ,thematicBreak:GQ,toml:If,yaml:If,definition:If,footnoteDefinition:If};function If(){}const Mj=-1,Fp=0,nd=1,Vm=2,Fx=3,Ux=4,$x=5,Wx=6,Nj=7,Aj=8,xR=typeof self=="object"?self:globalThis,XQ=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),r=s=>{if(e.has(s))return e.get(s);const[o,l]=t[s];switch(o){case Fp:case Mj:return n(l,s);case nd:{const u=n([],s);for(const h of l)u.push(r(h));return u}case Vm:{const u=n({},s);for(const[h,d]of l)u[r(h)]=r(d);return u}case Fx:return n(new Date(l),s);case Ux:{const{source:u,flags:h}=l;return n(new RegExp(u,h),s)}case $x:{const u=n(new Map,s);for(const[h,d]of l)u.set(r(h),r(d));return u}case Wx:{const u=n(new Set,s);for(const h of l)u.add(r(h));return u}case Nj:{const{name:u,message:h}=l;return n(new xR[u](h),s)}case Aj: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 xR[o](l),s)};return r},wR=e=>XQ(new Map,e)(0),Kl="",{toString:ZQ}={},{keys:QQ}=Object,ju=e=>{const t=typeof e;if(t!=="object"||!e)return[Fp,t];const n=ZQ.call(e).slice(8,-1);switch(n){case"Array":return[nd,Kl];case"Object":return[Vm,Kl];case"Date":return[Fx,Kl];case"RegExp":return[Ux,Kl];case"Map":return[$x,Kl];case"Set":return[Wx,Kl];case"DataView":return[nd,n]}return n.includes("Array")?[nd,n]:n.includes("Error")?[Nj,n]:[Vm,n]},Hf=([e,t])=>e===Fp&&(t==="function"||t==="symbol"),JQ=(e,t,n,r)=>{const s=(l,u)=>{const h=r.push(l)-1;return n.set(u,h),h},o=l=>{if(n.has(l))return n.get(l);let[u,h]=ju(l);switch(u){case Fp:{let g=l;switch(h){case"bigint":u=Aj,g=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return s([Mj],l)}return s([u,g],l)}case nd:{if(h){let v=l;return h==="DataView"?v=new Uint8Array(l.buffer):h==="ArrayBuffer"&&(v=new Uint8Array(l)),s([h,[...v]],l)}const g=[],p=s([u,g],l);for(const v of l)g.push(o(v));return p}case Vm:{if(h)switch(h){case"BigInt":return s([h,l.toString()],l);case"Boolean":case"Number":case"String":return s([h,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const g=[],p=s([u,g],l);for(const v of QQ(l))(e||!Hf(ju(l[v])))&&g.push([o(v),o(l[v])]);return p}case Fx:return s([u,l.toISOString()],l);case Ux:{const{source:g,flags:p}=l;return s([u,{source:g,flags:p}],l)}case $x:{const g=[],p=s([u,g],l);for(const[v,y]of l)(e||!(Hf(ju(v))||Hf(ju(y))))&&g.push([o(v),o(y)]);return p}case Wx:{const g=[],p=s([u,g],l);for(const v of l)(e||!Hf(ju(v)))&&g.push(o(v));return p}}const{message:d}=l;return s([u,{name:h,message:d}],l)};return o},SR=(e,{json:t,lossy:n}={})=>{const r=[];return JQ(!(t||n),!!t,new Map,r)(e),r},qm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?wR(SR(e,t)):structuredClone(e):(e,t)=>wR(SR(e,t));function eJ(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 tJ(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function nJ(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||eJ,r=e.options.footnoteBackLabel||tJ,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let h=-1;for(;++h<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[h]);if(!d)continue;const g=e.all(d),p=String(d.identifier).toUpperCase(),v=Mc(p.toLowerCase());let y=0;const w=[],S=e.footnoteCounts.get(p);for(;S!==void 0&&++y<=S;){w.length>0&&w.push({type:"text",value:" "});let R=typeof n=="string"?n:n(h,y);typeof R=="string"&&(R={type:"text",value:R}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,y),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const R=C.children[C.children.length-1];R&&R.type==="text"?R.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else g.push(...w);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(g,!0)};e.patch(d,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...qm(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
580
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
581
|
+
`}]}}const Up=(function(e){if(e==null)return oJ;if(typeof e=="function")return $p(e);if(typeof e=="object")return Array.isArray(e)?rJ(e):iJ(e);if(typeof e=="string")return sJ(e);throw new Error("Expected function, string, or object as test")});function rJ(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Up(e[n]);return $p(r);function r(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function iJ(e){const t=e;return $p(n);function n(r){const s=r;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function sJ(e){return $p(t);function t(n){return n&&n.type===e}}function $p(e){return t;function t(n,r,s){return!!(aJ(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function oJ(){return!0}function aJ(e){return e!==null&&typeof e=="object"&&"type"in e}const Dj=[],lJ=!0,Qy=!1,cJ="skip";function jj(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const o=Up(s),l=r?-1:1;u(e,void 0,[])();function u(h,d,g){const p=h&&typeof h=="object"?h:{};if(typeof p.type=="string"){const y=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return v;function v(){let y=Dj,w,S,C;if((!t||o(h,d,g[g.length-1]||void 0))&&(y=uJ(n(h,g)),y[0]===Qy))return y;if("children"in h&&h.children){const k=h;if(k.children&&y[0]!==cJ)for(S=(r?k.children.length:-1)+l,C=g.concat(k);S>-1&&S<k.children.length;){const R=k.children[S];if(w=u(R,S,C)(),w[0]===Qy)return w;S=typeof w[1]=="number"?w[1]:S+l}}return y}}}function uJ(e){return Array.isArray(e)?e:typeof e=="number"?[lJ,e]:e==null?Dj:[e]}function Vx(e,t,n,r){let s,o,l;typeof t=="function"&&typeof n!="function"?(o=void 0,l=t,s=n):(o=t,l=n,s=r),jj(e,o,u,s);function u(h,d){const g=d[d.length-1],p=g?g.children.indexOf(h):void 0;return l(h,p,g)}}const Jy={}.hasOwnProperty,dJ={};function hJ(e,t){const n=t||dJ,r=new Map,s=new Map,o=new Map,l={...YQ,...n.handlers},u={all:d,applyData:mJ,definitionById:r,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:l,one:h,options:n,patch:fJ,wrap:gJ};return Vx(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?r:s,v=String(g.identifier).toUpperCase();p.has(v)||p.set(v,g)}}),u;function h(g,p){const v=g.type,y=u.handlers[v];if(Jy.call(u.handlers,v)&&y)return y(u,g,p);if(u.options.passThrough&&u.options.passThrough.includes(v)){if("children"in g){const{children:S,...C}=g,k=qm(C);return k.children=u.all(g),k}return qm(g)}return(u.options.unknownHandler||pJ)(u,g,p)}function d(g){const p=[];if("children"in g){const v=g.children;let y=-1;for(;++y<v.length;){const w=u.one(v[y],g);if(w){if(y&&v[y-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=CR(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=CR(S.value))}Array.isArray(w)?p.push(...w):p.push(w)}}}return p}}function fJ(e,t){e.position&&(t.position=tX(e))}function mJ(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&o&&Object.assign(n.properties,qm(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function pJ(e,t){const n=t.data||{},r="value"in t&&!(Jy.call(n,"hProperties")||Jy.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 gJ(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
582
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
583
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
584
|
+
`}),n}function CR(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function kR(e,t){const n=hJ(e,t),r=n.one(e,void 0),s=nJ(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
|
|
585
|
+
`},s),o}function vJ(e,t){return e&&"run"in e?async function(n,r){const s=kR(n,{file:r,...t});await e.run(s,r)}:function(n,r){return kR(n,{file:r,...e||t})}}function ER(e){if(e)throw e}var tb,RR;function _J(){if(RR)return tb;RR=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]"},o=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var g=e.call(d,"constructor"),p=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!g&&!p)return!1;var v;for(v in d);return typeof v>"u"||e.call(d,v)},l=function(d,g){n&&g.name==="__proto__"?n(d,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):d[g.name]=g.newValue},u=function(d,g){if(g==="__proto__")if(e.call(d,g)){if(r)return r(d,g).value}else return;return d[g]};return tb=function h(){var d,g,p,v,y,w,S=arguments[0],C=1,k=arguments.length,R=!1;for(typeof S=="boolean"&&(R=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(d=arguments[C],d!=null)for(g in d)p=u(S,g),v=u(d,g),S!==v&&(R&&v&&(o(v)||(y=s(v)))?(y?(y=!1,w=p&&s(p)?p:[]):w=p&&o(p)?p:{},l(S,{name:g,newValue:h(R,w,v)})):typeof v<"u"&&l(S,{name:g,newValue:v}));return S},tb}var bJ=_J();const nb=Ym(bJ);function e0(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 yJ(){const e=[],t={run:n,use:r};return t;function n(...s){let o=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...s);function u(h,...d){const g=e[++o];let p=-1;if(h){l(h);return}for(;++p<s.length;)(d[p]===null||d[p]===void 0)&&(d[p]=s[p]);s=d,g?xJ(g,u)(...d):l(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function xJ(e,t){let n;return r;function r(...l){const u=e.length>l.length;let h;u&&l.push(s);try{h=e.apply(this,l)}catch(d){const g=d;if(u&&n)throw g;return s(g)}u||(h&&h.then&&typeof h.then=="function"?h.then(o,s):h instanceof Error?s(h):o(h))}function s(l,...u){n||(n=!0,t(l,...u))}function o(l){s(null,l)}}const ss={basename:wJ,dirname:SJ,extname:CJ,join:kJ,sep:"/"};function wJ(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');qd(e);let n=0,r=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else r<0&&(o=!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(o){n=s+1;break}}else l<0&&(o=!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 SJ(e){if(qd(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 CJ(e){qd(e);let t=e.length,n=-1,r=0,s=-1,o=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:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function kJ(...e){let t=-1,n;for(;++t<e.length;)qd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":EJ(n)}function EJ(e){qd(e);const t=e.codePointAt(0)===47;let n=RJ(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function RJ(e,t){let n="",r=0,s=-1,o=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||o===1))if(s!==l-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",r=0):(n=n.slice(0,h),r=n.length-1-n.lastIndexOf("/")),s=l,o=0;continue}}else if(n.length>0){n="",r=0,s=l,o=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,o=0}else u===46&&o>-1?o++:o=-1}return n}function qd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const TJ={cwd:MJ};function MJ(){return"/"}function t0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function NJ(e){if(typeof e=="string")e=new URL(e);else if(!t0(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 AJ(e)}function AJ(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const rb=["history","path","basename","stem","extname","dirname"];class Oj{constructor(t){let n;t?t0(t)?n={path:t}:typeof t=="string"||DJ(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":TJ.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<rb.length;){const o=rb[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)rb.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ss.basename(this.path):void 0}set basename(t){sb(t,"basename"),ib(t,"basename"),this.path=ss.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ss.dirname(this.path):void 0}set dirname(t){TR(this.basename,"dirname"),this.path=ss.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ss.extname(this.path):void 0}set extname(t){if(ib(t,"extname"),TR(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ss.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){t0(t)&&(t=NJ(t)),sb(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ss.basename(this.path,this.extname):void 0}set stem(t){sb(t,"stem"),ib(t,"stem"),this.path=ss.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new yr(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ib(e,t){if(e&&e.includes(ss.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ss.sep+"`")}function sb(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function TR(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function DJ(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jJ=(function(e){const r=this.constructor.prototype,s=r[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),OJ={}.hasOwnProperty;class qx extends jJ{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=yJ()}copy(){const t=new qx;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(nb(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(lb("data",this.frozen),this.namespace[t]=n,this):OJ.call(this.namespace,t)&&this.namespace[t]||void 0:t?(lb("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Ff(t),r=this.parser||this.Parser;return ob("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ob("process",this.parser||this.Parser),ab("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,l){const u=Ff(t),h=r.parse(u);r.run(h,u,function(g,p,v){if(g||!p||!v)return d(g);const y=p,w=r.stringify(y,v);PJ(w)?v.value=w:v.result=w,d(g,v)});function d(g,p){g||!p?l(g):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),ob("processSync",this.parser||this.Parser),ab("processSync",this.compiler||this.Compiler),this.process(t,s),NR("processSync","process",n),r;function s(o,l){n=!0,ER(o),r=l}}run(t,n,r){MR(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(l,u){const h=Ff(n);s.run(t,h,d);function d(g,p,v){const y=p||t;g?u(g):l?l(y):r(void 0,y,v)}}}runSync(t,n){let r=!1,s;return this.run(t,n,o),NR("runSync","run",r),s;function o(l,u){ER(l),s=u,r=!0}}stringify(t,n){this.freeze();const r=Ff(n),s=this.compiler||this.Compiler;return ab("stringify",s),MR(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(lb("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(d){if(typeof d=="function")h(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[g,...p]=d;h(g,p)}else l(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function l(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(d.plugins),d.settings&&(s.settings=nb(!0,s.settings,d.settings))}function u(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const p=d[g];o(p)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function h(d,g){let p=-1,v=-1;for(;++p<r.length;)if(r[p][0]===d){v=p;break}if(v===-1)r.push([d,...g]);else if(g.length>0){let[y,...w]=g;const S=r[v][1];e0(S)&&e0(y)&&(y=nb(!0,S,y)),r[v]=[d,y,...w]}}}}const LJ=new qx().freeze();function ob(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ab(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function lb(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function MR(e){if(!e0(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function NR(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ff(e){return zJ(e)?e:new Oj(e)}function zJ(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function PJ(e){return typeof e=="string"||BJ(e)}function BJ(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const IJ="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",AR=[],DR={allowDangerousHtml:!0},HJ=/^(https?|ircs?|mailto|xmpp)$/i,FJ=[{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 Kd(e){const t=UJ(e),n=$J(e);return WJ(t.runSync(t.parse(n),n),e)}function UJ(e){const t=e.rehypePlugins||AR,n=e.remarkPlugins||AR,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...DR}:DR;return LJ().use(SQ).use(n).use(vJ,r).use(t)}function $J(e){const t=e.children||"",n=new Oj;return typeof t=="string"&&(n.value=t),n}function WJ(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,o=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,h=t.urlTransform||VJ;for(const g of FJ)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+IJ+g.id,void 0);return Vx(e,d),oX(e,{Fragment:f.Fragment,components:s,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function d(g,p,v){if(g.type==="raw"&&v&&typeof p=="number")return l?v.children.splice(p,1):v.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let y;for(y in Q_)if(Object.hasOwn(Q_,y)&&Object.hasOwn(g.properties,y)){const w=g.properties[y],S=Q_[y];(S===null||S.includes(g.tagName))&&(g.properties[y]=h(String(w||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&r&&typeof p=="number"&&(y=!r(g,p,v)),y&&v&&typeof p=="number")return u&&g.children?v.children.splice(p,1,...g.children):v.children.splice(p,1),p}}}function VJ(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||HJ.test(e.slice(0,t))?e:""}function jR(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 qJ(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function KJ(e,t,n){const s=Up((n||{}).ignore||[]),o=GJ(t);let l=-1;for(;++l<o.length;)jj(e,"text",u);function u(d,g){let p=-1,v;for(;++p<g.length;){const y=g[p],w=v?v.children:void 0;if(s(y,w?w.indexOf(y):void 0,v))return;v=y}if(v)return h(d,g)}function h(d,g){const p=g[g.length-1],v=o[l][0],y=o[l][1];let w=0;const C=p.children.indexOf(d);let k=!1,R=[];v.lastIndex=0;let E=v.exec(d.value);for(;E;){const M=E.index,j={index:E.index,input:E.input,stack:[...g,d]};let D=y(...E,j);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?v.lastIndex=M+1:(w!==M&&R.push({type:"text",value:d.value.slice(w,M)}),Array.isArray(D)?R.push(...D):D&&R.push(D),w=M+E[0].length,k=!0),!v.global)break;E=v.exec(d.value)}return k?(w<d.value.length&&R.push({type:"text",value:d.value.slice(w)}),p.children.splice(C,1,...R)):R=[d],C+R.length}}function GJ(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([YJ(s[0]),XJ(s[1])])}return t}function YJ(e){return typeof e=="string"?new RegExp(qJ(e),"g"):e}function XJ(e){return typeof e=="function"?e:function(){return e}}const cb="phrasing",ub=["autolink","link","image","label"];function ZJ(){return{transforms:[iee],enter:{literalAutolink:JJ,literalAutolinkEmail:db,literalAutolinkHttp:db,literalAutolinkWww:db},exit:{literalAutolink:ree,literalAutolinkEmail:nee,literalAutolinkHttp:eee,literalAutolinkWww:tee}}}function QJ(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:cb,notInConstruct:ub},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:cb,notInConstruct:ub},{character:":",before:"[ps]",after:"\\/",inConstruct:cb,notInConstruct:ub}]}}function JJ(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function db(e){this.config.enter.autolinkProtocol.call(this,e)}function eee(e){this.config.exit.autolinkProtocol.call(this,e)}function tee(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 nee(e){this.config.exit.autolinkEmail.call(this,e)}function ree(e){this.exit(e)}function iee(e){KJ(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,see],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),oee]],{ignore:["link","linkReference"]})}function see(e,t,n,r,s){let o="";if(!Lj(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!aee(n)))return!1;const l=lee(n+r);if(!l[0])return!1;const u={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function oee(e,t,n,r){return!Lj(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function aee(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 lee(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=jR(e,"(");let o=jR(e,")");for(;r!==-1&&s>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Lj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Za(n)||Ip(n))&&(!t||n!==47)}zj.peek=vee;function cee(){this.buffer()}function uee(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function dee(){this.buffer()}function hee(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function fee(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Hi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function mee(e){this.exit(e)}function pee(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Hi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function gee(e){this.exit(e)}function vee(){return"["}function zj(e,t,n,r){const s=n.createTracker(r);let o=s.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),u(),l(),o+=s.move("]"),o}function _ee(){return{enter:{gfmFootnoteCallString:cee,gfmFootnoteCall:uee,gfmFootnoteDefinitionLabelString:dee,gfmFootnoteDefinition:hee},exit:{gfmFootnoteCallString:fee,gfmFootnoteCall:mee,gfmFootnoteDefinitionLabelString:pee,gfmFootnoteDefinition:gee}}}function bee(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:zj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,o,l){const u=o.createTracker(l);let h=u.move("[^");const d=o.enter("footnoteDefinition"),g=o.enter("label");return h+=u.move(o.safe(o.associationId(r),{before:h,after:"]"})),g(),h+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),h+=u.move((t?`
|
|
586
|
+
`:" ")+o.indentLines(o.containerFlow(r,u.current()),t?Pj:yee))),d(),h}}function yee(e,t,n){return t===0?e:Pj(e,t,n)}function Pj(e,t,n){return(n?"":" ")+e}const xee=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Bj.peek=Eee;function wee(){return{canContainEols:["delete"],enter:{strikethrough:Cee},exit:{strikethrough:kee}}}function See(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xee}],handlers:{delete:Bj}}}function Cee(e){this.enter({type:"delete",children:[]},e)}function kee(e){this.exit(e)}function Bj(e,t,n,r){const s=n.createTracker(r),o=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(e,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),o(),l}function Eee(){return"~"}function Ree(e){return e.length}function Tee(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||Ree,o=[],l=[],u=[],h=[];let d=0,g=-1;for(;++g<e.length;){const S=[],C=[];let k=-1;for(e[g].length>d&&(d=e[g].length);++k<e[g].length;){const R=Mee(e[g][k]);if(n.alignDelimiters!==!1){const E=s(R);C[k]=E,(h[k]===void 0||E>h[k])&&(h[k]=E)}S.push(R)}l[g]=S,u[g]=C}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<d;)o[p]=OR(r[p]);else{const S=OR(r);for(;++p<d;)o[p]=S}p=-1;const v=[],y=[];for(;++p<d;){const S=o[p];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let R=n.alignDelimiters===!1?1:Math.max(1,h[p]-C.length-k.length);const E=C+"-".repeat(R)+k;n.alignDelimiters!==!1&&(R=C.length+R+k.length,R>h[p]&&(h[p]=R),y[p]=R),v[p]=E}l.splice(1,0,v),u.splice(1,0,y),g=-1;const w=[];for(;++g<l.length;){const S=l[g],C=u[g];p=-1;const k=[];for(;++p<d;){const R=S[p]||"";let E="",M="";if(n.alignDelimiters!==!1){const j=h[p]-(C[p]||0),D=o[p];D===114?E=" ".repeat(j):D===99?j%2?(E=" ".repeat(j/2+.5),M=" ".repeat(j/2-.5)):(E=" ".repeat(j/2),M=E):M=" ".repeat(j)}n.delimiterStart!==!1&&!p&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&R==="")&&(n.delimiterStart!==!1||p)&&k.push(" "),n.alignDelimiters!==!1&&k.push(E),k.push(R),n.alignDelimiters!==!1&&k.push(M),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||p!==d-1)&&k.push("|")}w.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
|
|
587
|
+
`)}function Mee(e){return e==null?"":String(e)}function OR(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 Nee(e,t,n,r){const s=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),Aee);return s(),l}function Aee(e,t,n){return">"+(n?"":" ")+e}function Dee(e,t){return LR(e,t.inConstruct,!0)&&!LR(e,t.notInConstruct,!1)}function LR(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 zR(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
588
|
+
`&&Dee(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
589
|
+
`}function jee(e,t){const n=String(e);let r=n.indexOf(t),s=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++o>l&&(l=o):o=1,s=r+t.length,r=n.indexOf(t,s);return l}function Oee(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 Lee(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 zee(e,t,n,r){const s=Lee(n),o=e.value||"",l=s==="`"?"GraveAccent":"Tilde";if(Oee(e,n)){const p=n.enter("codeIndented"),v=n.indentLines(o,Pee);return p(),v}const u=n.createTracker(r),h=s.repeat(Math.max(jee(o,s)+1,3)),d=n.enter("codeFenced");let g=u.move(h);if(e.lang){const p=n.enter(`codeFencedLang${l}`);g+=u.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...u.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${l}`);g+=u.move(" "),g+=u.move(n.safe(e.meta,{before:g,after:`
|
|
590
|
+
`,encode:["`"],...u.current()})),p()}return g+=u.move(`
|
|
591
|
+
`),o&&(g+=u.move(o+`
|
|
592
|
+
`)),g+=u.move(h),d(),g}function Pee(e,t,n){return(n?"":" ")+e}function Kx(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 Bee(e,t,n,r){const s=Kx(n),o=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?" ":`
|
|
593
|
+
`,...h.current()}))),u(),e.title&&(u=n.enter(`title${o}`),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 Iee(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function bd(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Km(e,t,n){const r=mc(e),s=mc(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ij.peek=Hee;function Ij(e,t,n,r){const s=Iee(n),o=n.enter("emphasis"),l=n.createTracker(r),u=l.move(s);let h=l.move(n.containerPhrasing(e,{after:s,before:u,...l.current()}));const d=h.charCodeAt(0),g=Km(r.before.charCodeAt(r.before.length-1),d,s);g.inside&&(h=bd(d)+h.slice(1));const p=h.charCodeAt(h.length-1),v=Km(r.after.charCodeAt(0),p,s);v.inside&&(h=h.slice(0,-1)+bd(p));const y=l.move(s);return o(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},u+h+y}function Hee(e,t,n){return n.options.emphasis||"*"}function Fee(e,t){let n=!1;return Vx(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Qy}),!!((!e.depth||e.depth<3)&&Bx(e)&&(t.options.setext||n))}function Uee(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Fee(e,n)){const g=n.enter("headingSetext"),p=n.enter("phrasing"),v=n.containerPhrasing(e,{...o.current(),before:`
|
|
594
|
+
`,after:`
|
|
595
|
+
`});return p(),g(),v+`
|
|
596
|
+
`+(s===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
597
|
+
`))+1))}const l="#".repeat(s),u=n.enter("headingAtx"),h=n.enter("phrasing");o.move(l+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
|
|
598
|
+
`,...o.current()});return/^[\t ]/.test(d)&&(d=bd(d.charCodeAt(0))+d.slice(1)),d=d?l+" "+d:l,n.options.closeAtx&&(d+=" "+l),h(),u(),d}Hj.peek=$ee;function Hj(e){return e.value||""}function $ee(){return"<"}Fj.peek=Wee;function Fj(e,t,n,r){const s=Kx(n),o=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${o}`),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 Wee(){return"!"}Uj.peek=Vee;function Uj(e,t,n,r){const s=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let h=u.move("![");const d=n.safe(e.alt,{before:h,after:"]",...u.current()});h+=u.move(d+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:h,after:"]",...u.current()});return l(),n.stack=g,o(),s==="full"||!d||d!==p?h+=u.move(p+"]"):s==="shortcut"?h=h.slice(0,-1):h+=u.move("]"),h}function Vee(){return"!"}$j.peek=qee;function $j(e,t,n){let r=e.value||"",s="`",o=-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+" ");++o<n.unsafe.length;){const l=n.unsafe[o],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 qee(){return"`"}function Wj(e,t){const n=Bx(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))}Vj.peek=Kee;function Vj(e,t,n,r){const s=Kx(n),o=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let u,h;if(Wj(e,n)){const g=n.stack;n.stack=[],u=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,{before:p,after:">",...l.current()})),p+=l.move(">"),u(),n.stack=g,p}u=n.enter("link"),h=n.enter("label");let d=l.move("[");return d+=l.move(n.containerPhrasing(e,{before:d,after:"](",...l.current()})),d+=l.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),d+=l.move("<"),d+=l.move(n.safe(e.url,{before:d,after:">",...l.current()})),d+=l.move(">")):(h=n.enter("destinationRaw"),d+=l.move(n.safe(e.url,{before:d,after:e.title?" ":")",...l.current()}))),h(),e.title&&(h=n.enter(`title${o}`),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 Kee(e,t,n){return Wj(e,n)?"<":"["}qj.peek=Gee;function qj(e,t,n,r){const s=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let h=u.move("[");const d=n.containerPhrasing(e,{before:h,after:"]",...u.current()});h+=u.move(d+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:h,after:"]",...u.current()});return l(),n.stack=g,o(),s==="full"||!d||d!==p?h+=u.move(p+"]"):s==="shortcut"?h=h.slice(0,-1):h+=u.move("]"),h}function Gee(){return"["}function Gx(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 Yee(e){const t=Gx(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 Xee(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 Kj(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 Zee(e,t,n,r){const s=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?Xee(n):Gx(n);const u=e.ordered?l==="."?")":".":Yee(n);let h=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),Kj(n)===l&&g){let p=-1;for(;++p<e.children.length;){const v=e.children[p];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(l=u),n.bulletCurrent=l;const d=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,s(),d}function Qee(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 Jee(e,t,n,r){const s=Qee(n);let o=n.bulletCurrent||Gx(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(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(o+" ".repeat(l-o.length)),u.shift(l);const h=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),g);return h(),d;function g(p,v,y){return v?(y?"":" ".repeat(l))+p:(y?o:o+" ".repeat(l-o.length))+p}}function ete(e,t,n,r){const s=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),s(),l}const tte=Up(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function nte(e,t,n,r){return(e.children.some(function(l){return tte(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function rte(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Gj.peek=ite;function Gj(e,t,n,r){const s=rte(n),o=n.enter("strong"),l=n.createTracker(r),u=l.move(s+s);let h=l.move(n.containerPhrasing(e,{after:s,before:u,...l.current()}));const d=h.charCodeAt(0),g=Km(r.before.charCodeAt(r.before.length-1),d,s);g.inside&&(h=bd(d)+h.slice(1));const p=h.charCodeAt(h.length-1),v=Km(r.after.charCodeAt(0),p,s);v.inside&&(h=h.slice(0,-1)+bd(p));const y=l.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},u+h+y}function ite(e,t,n){return n.options.strong||"*"}function ste(e,t,n,r){return n.safe(e.value,r)}function ote(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 ate(e,t,n){const r=(Kj(n)+(n.options.ruleSpaces?" ":"")).repeat(ote(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Yj={blockquote:Nee,break:zR,code:zee,definition:Bee,emphasis:Ij,hardBreak:zR,heading:Uee,html:Hj,image:Fj,imageReference:Uj,inlineCode:$j,link:Vj,linkReference:qj,list:Zee,listItem:Jee,paragraph:ete,root:nte,strong:Gj,text:ste,thematicBreak:ate};function lte(){return{enter:{table:cte,tableData:PR,tableHeader:PR,tableRow:dte},exit:{codeText:hte,table:ute,tableData:hb,tableHeader:hb,tableRow:hb}}}function cte(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 ute(e){this.exit(e),this.data.inTable=void 0}function dte(e){this.enter({type:"tableRow",children:[]},e)}function hb(e){this.exit(e)}function PR(e){this.enter({type:"tableCell",children:[]},e)}function hte(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,fte));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function fte(e,t){return t==="|"?t:e}function mte(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
599
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:l,tableCell:h,tableRow:u}};function l(y,w,S,C){return d(g(y,S,C),y.align)}function u(y,w,S,C){const k=p(y,S,C),R=d([k]);return R.slice(0,R.indexOf(`
|
|
600
|
+
`))}function h(y,w,S,C){const k=S.enter("tableCell"),R=S.enter("phrasing"),E=S.containerPhrasing(y,{...C,before:o,after:o});return R(),k(),E}function d(y,w){return Tee(y,{align:w,alignDelimiters:r,padding:n,stringLength:s})}function g(y,w,S){const C=y.children;let k=-1;const R=[],E=w.enter("table");for(;++k<C.length;)R[k]=p(C[k],w,S);return E(),R}function p(y,w,S){const C=y.children;let k=-1;const R=[],E=w.enter("tableRow");for(;++k<C.length;)R[k]=h(C[k],y,w,S);return E(),R}function v(y,w,S){let C=Yj.inlineCode(y,w,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function pte(){return{exit:{taskListCheckValueChecked:BR,taskListCheckValueUnchecked:BR,paragraph:vte}}}function gte(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_te}}}function BR(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function vte(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 o=-1,l;for(;++o<s.length;){const u=s[o];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 _te(e,t,n,r){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(l);let h=Yj.listItem(e,t,n,{...r,...u.current()});return o&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),h;function d(g){return g+l}}function bte(){return[ZJ(),_ee(),wee(),lte(),pte()]}function yte(e){return{extensions:[QJ(),bee(e),See(),mte(e),gte()]}}const xte={tokenize:Rte,partial:!0},Xj={tokenize:Tte,partial:!0},Zj={tokenize:Mte,partial:!0},Qj={tokenize:Nte,partial:!0},wte={tokenize:Ate,partial:!0},Jj={name:"wwwAutolink",tokenize:kte,previous:t3},e3={name:"protocolAutolink",tokenize:Ete,previous:n3},lo={name:"emailAutolink",tokenize:Cte,previous:r3},xs={};function Ste(){return{text:xs}}let Ma=48;for(;Ma<123;)xs[Ma]=lo,Ma++,Ma===58?Ma=65:Ma===91&&(Ma=97);xs[43]=lo;xs[45]=lo;xs[46]=lo;xs[95]=lo;xs[72]=[lo,e3];xs[104]=[lo,e3];xs[87]=[lo,Jj];xs[119]=[lo,Jj];function Cte(e,t,n){const r=this;let s,o;return l;function l(p){return!n0(p)||!r3.call(r,r.previous)||Yx(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(p))}function u(p){return n0(p)?(e.consume(p),u):p===64?(e.consume(p),h):n(p)}function h(p){return p===46?e.check(wte,g,d)(p):p===45||p===95||_r(p)?(o=!0,e.consume(p),h):g(p)}function d(p){return e.consume(p),s=!0,h}function g(p){return o&&s&&Rr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function kte(e,t,n){const r=this;return s;function s(l){return l!==87&&l!==119||!t3.call(r,r.previous)||Yx(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(xte,e.attempt(Xj,e.attempt(Zj,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function Ete(e,t,n){const r=this;let s="",o=!1;return l;function l(p){return(p===72||p===104)&&n3.call(r,r.previous)&&!Yx(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),u):n(p)}function u(p){if(Rr(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),u;if(p===58){const v=s.toLowerCase();if(v==="http"||v==="https")return e.consume(p),h}return n(p)}function h(p){return p===47?(e.consume(p),o?d:(o=!0,h)):n(p)}function d(p){return p===null||Wm(p)||rn(p)||Za(p)||Ip(p)?n(p):e.attempt(Xj,e.attempt(Zj,g),n)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function Rte(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),o):n(l)}function o(l){return l===null?n(l):t(l)}}function Tte(e,t,n){let r,s,o;return l;function l(d){return d===46||d===95?e.check(Qj,h,u)(d):d===null||rn(d)||Za(d)||d!==45&&Ip(d)?h(d):(o=!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||!o?n(d):t(d)}}function Mte(e,t){let n=0,r=0;return s;function s(l){return l===40?(n++,e.consume(l),s):l===41&&r<n?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(Qj,t,o)(l):l===null||rn(l)||Za(l)?t(l):(e.consume(l),s)}function o(l){return l===41&&r++,e.consume(l),s}}function Nte(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),o):u===93?(e.consume(u),s):u===60||u===null||rn(u)||Za(u)?t(u):n(u)}function s(u){return u===null||u===40||u===91||rn(u)||Za(u)?t(u):r(u)}function o(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 Ate(e,t,n){return r;function r(o){return e.consume(o),s}function s(o){return _r(o)?n(o):t(o)}}function t3(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||rn(e)}function n3(e){return!Rr(e)}function r3(e){return!(e===47||n0(e))}function n0(e){return e===43||e===45||e===46||e===95||_r(e)}function Yx(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 Dte={tokenize:Hte,partial:!0};function jte(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Pte,continuation:{tokenize:Bte},exit:Ite}},text:{91:{name:"gfmFootnoteCall",tokenize:zte},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ote,resolveTo:Lte}}}}function Ote(e,t,n){const r=this;let s=r.events.length;const o=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=Hi(r.sliceSerialize({start:l.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function Lte(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 o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function zte(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return u;function u(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),h}function h(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(p){if(o>999||p===93&&!l||p===null||p===91||rn(p))return n(p);if(p===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return s.includes(Hi(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return rn(p)||(l=!0),o++,e.consume(p),p===92?g:d}function g(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}}function Pte(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,u;return h;function h(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(w)}function g(w){if(l>999||w===93&&!u||w===null||w===91||rn(w))return n(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=Hi(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return rn(w)||(u=!0),l++,e.consume(w),w===92?p:g}function p(w){return w===91||w===92||w===93?(e.consume(w),l++,g):g(w)}function v(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),s.includes(o)||s.push(o),Lt(e,y,"gfmFootnoteDefinitionWhitespace")):n(w)}function y(w){return t(w)}}function Bte(e,t,n){return e.check(Vd,t,e.attempt(Dte,t,n))}function Ite(e){e.exit("gfmFootnoteDefinition")}function Hte(e,t,n){const r=this;return Lt(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):n(o)}}function Fte(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,u){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let d=h;for(;d--;)if(l[d][0]==="exit"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[d][1].end.offset-l[d][1].start.offset){l[h][1].type="strikethroughSequence",l[d][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},l[d][1].start),end:Object.assign({},l[h][1].end)},p={type:"strikethroughText",start:Object.assign({},l[d][1].end),end:Object.assign({},l[h][1].start)},v=[["enter",g,u],["enter",l[d][1],u],["exit",l[d][1],u],["enter",p,u]],y=u.parser.constructs.insideSpan.null;y&&si(v,v.length,0,Hp(y,l.slice(d+1,h),u)),si(v,v.length,0,[["exit",p,u],["enter",l[h][1],u],["exit",l[h][1],u],["exit",g,u]]),si(l,d-1,h-d+3,v),h=d+v.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function o(l,u,h){const d=this.previous,g=this.events;let p=0;return v;function v(w){return d===126&&g[g.length-1][1].type!=="characterEscape"?h(w):(l.enter("strikethroughSequenceTemporary"),y(w))}function y(w){const S=mc(d);if(w===126)return p>1?h(w):(l.consume(w),p++,y);if(p<2&&!n)return h(w);const C=l.exit("strikethroughSequenceTemporary"),k=mc(w);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,u(w)}}}class Ute{constructor(){this.map=[]}add(t,n,r){$te(this,t,n,r)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const o of s)t.push(o);s=r.pop()}this.map.length=0}}function $te(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 Wte(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 o=r.length-1;r[o]=r[o]==="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 Vte(){return{flow:{null:{name:"table",tokenize:qte,resolveAll:Kte}}}}function qte(e,t,n){const r=this;let s=0,o=0,l;return u;function u(P){let V=r.events.length-1;for(;V>-1;){const K=r.events[V][1].type;if(K==="lineEnding"||K==="linePrefix")V--;else break}const I=V>-1?r.events[V][1].type:null,W=I==="tableHead"||I==="tableRow"?D:h;return W===D&&r.parser.lazy[r.now().line]?n(P):W(P)}function h(P){return e.enter("tableHead"),e.enter("tableRow"),d(P)}function d(P){return P===124||(l=!0,o+=1),g(P)}function g(P){return P===null?n(P):et(P)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),y):n(P):Rt(P)?Lt(e,g,"whitespace")(P):(o+=1,l&&(l=!1,s+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),l=!0,g):(e.enter("data"),p(P)))}function p(P){return P===null||P===124||rn(P)?(e.exit("data"),g(P)):(e.consume(P),P===92?v:p)}function v(P){return P===92||P===124?(e.consume(P),p):p(P)}function y(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(e.enter("tableDelimiterRow"),l=!1,Rt(P)?Lt(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):w(P))}function w(P){return P===45||P===58?C(P):P===124?(l=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),S):j(P)}function S(P){return Rt(P)?Lt(e,C,"whitespace")(P):C(P)}function C(P){return P===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),k):P===45?(o+=1,k(P)):P===null||et(P)?M(P):j(P)}function k(P){return P===45?(e.enter("tableDelimiterFiller"),R(P)):j(P)}function R(P){return P===45?(e.consume(P),R):P===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(P))}function E(P){return Rt(P)?Lt(e,M,"whitespace")(P):M(P)}function M(P){return P===124?w(P):P===null||et(P)?!l||s!==o?j(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):j(P)}function j(P){return n(P)}function D(P){return e.enter("tableRow"),L(P)}function L(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),L):P===null||et(P)?(e.exit("tableRow"),t(P)):Rt(P)?Lt(e,L,"whitespace")(P):(e.enter("data"),$(P))}function $(P){return P===null||P===124||rn(P)?(e.exit("data"),L(P)):(e.consume(P),P===92?Y:$)}function Y(P){return P===92||P===124?(e.consume(P),$):$(P)}}function Kte(e,t){let n=-1,r=!0,s=0,o=[0,0,0,0],l=[0,0,0,0],u=!1,h=0,d,g,p;const v=new Ute;for(;++n<e.length;){const y=e[n],w=y[1];y[0]==="enter"?w.type==="tableHead"?(u=!1,h!==0&&(IR(v,t,h,d,g),g=void 0,h=0),d={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(n,0,[["enter",d,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,p=void 0,o=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,g={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(n,0,[["enter",g,t]])),s=w.type==="tableDelimiterRow"?2:g?3:1):s&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],p=Uf(v,t,o,s,void 0,p),o=[0,0,0,0]),l[2]=n)):w.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],p=Uf(v,t,o,s,void 0,p)),o=l,l=[o[1],n,0,0])):w.type==="tableHead"?(u=!0,h=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=n,o[1]!==0?(l[0]=l[1],p=Uf(v,t,o,s,n,p)):l[1]!==0&&(p=Uf(v,t,l,s,n,p)),s=0):s&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&IR(v,t,h,d,g),v.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=Wte(t.events,n))}return e}function Uf(e,t,n,r,s,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const h=Xl(t.events,n[1]);if(o={type:l,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=Xl(t.events,n[2]),g=Xl(t.events,n[3]),p={type:u,start:Object.assign({},d),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const v=t.events[n[2]],y=t.events[n[3]];if(v[1].end=Object.assign({},y[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const w=n[2]+1,S=n[3]-n[2]-1;e.add(w,S,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(o.end=Object.assign({},Xl(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function IR(e,t,n,r,s){const o=[],l=Xl(t.events,n);s&&(s.end=Object.assign({},l),o.push(["exit",s,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function Xl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Gte={name:"tasklistCheck",tokenize:Xte};function Yte(){return{text:{91:Gte}}}function Xte(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"),o)}function o(h){return rn(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(h)}function u(h){return et(h)?t(h):Rt(h)?e.check({tokenize:Zte},t,n)(h):n(h)}}function Zte(e,t,n){return Lt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function Qte(e){return mj([Ste(),jte(),Fte(e),Vte(),Yte()])}const Jte={};function Gd(e){const t=this,n=e||Jte,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(Qte(n)),o.push(bte()),l.push(yte(n))}function ene({content:e,attachments:t}){const[n,r]=_.useState(null),s=(t==null?void 0:t.find(o=>o.id===n))??null;return _.useEffect(()=>{s||r(null)},[s]),f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex gap-2 justify-end",children:f.jsxs("div",{className:"max-w-[85%] sm:max-w-[80%] rounded-[20px] py-1.5 px-3.5 bg-muted text-primary border border-border prose prose-sm prose-invert [&_p]:whitespace-pre-line",children:[t!=null&&t.length?f.jsx("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:t.map(o=>f.jsxs("button",{type:"button",className:"overflow-hidden rounded-lg border border-border/80 bg-background/70 text-left cursor-zoom-in",onClick:()=>r(o.id),children:[f.jsx("img",{src:o.previewUrl,alt:o.name,className:"h-full max-h-[220px] w-full object-cover"}),f.jsx("div",{className:"border-t border-border/60 px-2 py-1 text-[11px] text-muted-foreground",children:o.name})]},o.id))}):null,e.trim()?f.jsx(Kd,{remarkPlugins:[Gd],components:$d(),children:e}):null]})}),s?f.jsx("button",{type:"button",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 cursor-zoom-out",onClick:()=>r(null),children:f.jsx("img",{src:s.previewUrl,alt:s.name,className:"max-h-full max-w-full rounded-xl shadow-2xl"})}):null]})}function tne({json:e}){return f.jsx("div",{className:"flex gap-3 justify-start",children:f.jsx("div",{className:"flex-1 max-w-[90%]",children:f.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words bg-muted rounded-lg p-3 overflow-auto max-h-96",children:e})})})}function i3({title:e,count:t,children:n,badge:r}){const[s,o]=_.useState(!1);return t===0?null:f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>o(!s),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[f.jsx(Tr,{className:pe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",s&&"rotate-90")}),f.jsx("span",{className:"text-muted-foreground font-medium",children:e}),f.jsx("span",{className:"text-muted-foreground/60",children:t}),r]}),s&&f.jsx("div",{className:"ml-5",children:n})]})}function fb({title:e,items:t,icon:n,getIcon:r}){return t.length===0?null:f.jsx(i3,{title:e,count:t.length,children:f.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(s=>f.jsx(GD,{icon:r?r(s):n,children:s},s))})})}function nne(e){const t=e.match(/^mcp__([^_]+)__(.+)$/);return t?{server:t[1],tool:t[2]}:null}function s3({status:e}){const t=e==="connected"?"bg-emerald-500":e==="pending"?"bg-yellow-500":"bg-red-500";return f.jsx("span",{className:pe("inline-block h-2 w-2 rounded-full shrink-0",t)})}function rne(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 HR({server:e}){const[t,n]=_.useState(!1),r=e.status==="connected";return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>r&&e.tools.length>0&&n(!t),className:pe("flex items-center gap-1.5",r&&e.tools.length>0&&"cursor-pointer hover:opacity-60 transition-opacity"),children:[r&&e.tools.length>0&&f.jsx(Tr,{className:pe("h-3 w-3 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),f.jsx(s3,{status:e.status}),f.jsx("span",{className:"text-muted-foreground font-medium",children:Lb(e.name)}),r?f.jsxs("span",{className:"text-muted-foreground/50",children:[e.tools.length," tools"]}):f.jsx("span",{className:"text-muted-foreground/50",children:rne(e.status)})]}),!r&&e.error&&f.jsx("span",{className:"text-destructive ml-5",children:e.error}),t&&e.tools.length>0&&f.jsx("div",{className:"flex flex-wrap gap-1.5 ml-5",children:e.tools.map(s=>f.jsx(GD,{icon:KD(`mcp__${e.name}__${s}`),children:s},s))})]})}function ine({servers:e}){if(e.length===0)return null;const t=e.filter(s=>s.status==="connected"),n=e.filter(s=>s.status!=="connected"),r=n.length>0?f.jsxs("span",{className:"flex items-center gap-1 ml-1",children:[f.jsx(s3,{status:"failed"}),f.jsxs("span",{className:"text-muted-foreground/60",children:[n.length," disconnected"]})]}):null;return f.jsx(i3,{title:"MCP Servers",count:e.length,badge:r,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[t.map(s=>f.jsx(HR,{server:s},s.name)),n.map(s=>f.jsx(HR,{server:s},s.name))]})})}function sne({rawJson:e}){const[t,n]=_.useState(!1);return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[f.jsx(Tr,{className:pe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),f.jsx("span",{className:"text-muted-foreground font-medium",children:"Raw Message"})]}),t&&f.jsx("pre",{className:"ml-5 text-xs whitespace-pre-wrap break-all border border-border rounded-md p-3 overflow-x-auto max-h-96 overflow-y-auto",children:e})]})}function one({message:e,rawJson:t}){const{coreTools:n,mcpServersWithTools:r}=_.useMemo(()=>{const s=new Map,o=[];for(const u of e.tools){const h=nne(u);if(h){const d=s.get(h.server)||[];d.push(h.tool),s.set(h.server,d)}else o.push(u)}const l=e.mcpServers.map(u=>({name:u.name,status:u.status,error:u.error,tools:s.get(u.name)||[]}));return{coreTools:o,mcpServersWithTools:l}},[e.tools,e.mcpServers]);return f.jsx(ao,{children:f.jsxs(Fd,{expandedContent:f.jsx(Ud,{className:"my-4 text-xs",children:f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsx(AG,{children:e.model}),f.jsx(fb,{title:"Tools",items:n,getIcon:s=>By[s]??qD}),f.jsx(fb,{title:"Agents",items:e.agents,icon:y0}),f.jsx(fb,{title:"Commands",items:e.slashCommands,icon:PI}),f.jsx(ine,{servers:r}),t&&f.jsx(sne,{rawJson:t})]})}),children:[f.jsx(v6,{className:"h-5 w-5 text-logo"}),f.jsx(eo,{children:"Session Started"})]})})}function ane({message:e}){return f.jsx(ao,{className:"hidden",children:f.jsxs(Fd,{expandedContent:f.jsx(Ud,{className:"my-4 text-xs",children:f.jsx("pre",{className:"font-mono whitespace-pre-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto",children:JSON.stringify(e.accountInfo,null,2)})}),children:[f.jsx("div",{className:"size-5 flex justify-center items-center ",children:f.jsx(y0,{className:"h-4 w-4 text-muted-foreground"})}),f.jsx(eo,{children:"Account"})]})})}function lne({message:e}){return f.jsx("div",{className:"text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-full space-y-4",children:f.jsx(Kd,{remarkPlugins:[Gd],components:$d(),children:e.text})})}function cne({message:e}){return f.jsx(ao,{className:"w-full",children:f.jsxs(Fd,{expandedContent:f.jsx(Ud,{className:"my-4 text-sm text-muted-foreground/90",children:f.jsx("div",{className:"text-pretty prose prose-sm max-w-full px-0.5 opacity-90 dark:prose-invert",children:f.jsx(Kd,{remarkPlugins:[Gd],components:$d(),children:e.text})})}),children:[f.jsx(ti,{className:"h-4 w-4 text-muted-icon"}),f.jsx(eo,{className:"text-left text-muted-foreground",children:"Thinking"})]})})}function une({question:e,currentIndex:t,totalQuestions:n,onBack:r,children:s}){const o=r&&t>0;return f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("div",{className:"relative",children:[f.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border text-foreground flex flex-row items-center gap-2",children:[o?f.jsx("button",{onClick:r,className:" text-muted-foreground hover:opacity-60 transition-all flex items-center",children:f.jsx(_M,{className:"h-4 w-4 -ml-0.5",strokeWidth:3})}):n>1?f.jsxs("span",{className:"font-bold text-muted-foreground whitespace-nowrap",children:[t+1," of ",n]}):null,e]}),n>1&&f.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-border",children:f.jsx("div",{className:"h-full bg-muted-foreground/40 transition-all duration-300",style:{width:`${t/n*100}%`}})})]}),s]})}function FR({label:e,description:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-foreground text-sm",children:e}),t&&f.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]})}function o3({selected:e,multiSelect:t,onClick:n}){return f.jsx("button",{type:"button",onClick:n,className:pe("flex-shrink-0 w-5 h-5 border-1 flex items-center justify-center",t?"rounded":"rounded-full",e?"border-slate-500/0 bg-foreground":"border-muted-foreground/50 bg-background",n&&e&&"cursor-pointer"),children:e&&f.jsx($i,{strokeWidth:3,className:"translate-y-[0.5px] h-3 w-3 text-white dark:text-background"})})}function dne({option:e,selected:t,multiSelect:n,onClick:r,isLast:s}){const o="w-full text-left p-3 pt-2.5 pl-4 pr-5 bg-background",l=s?"":"border-b border-border";return r?f.jsx("button",{onClick:r,className:pe(o,l,"transition-all cursor-pointer"),children:f.jsxs("div",{className:"flex items-center justify-between gap-3",children:[f.jsx("div",{className:"flex-1 min-w-0",children:f.jsx(FR,{label:e.label,description:e.description})}),f.jsx(o3,{selected:t,multiSelect:n})]})}):f.jsx("div",{className:pe(o,l),children:f.jsx(FR,{label:e.label,description:e.description})})}function hne(e){return e==null?void 0:e.answers}function Li(e){return e.id||e.question}function fne({message:e,onSubmit:t,isLatest:n}){var O,H;const r=e.input.questions,s=!!e.result,o=hne(e.result),l=((O=e.result)==null?void 0:O.discarded)===!0,[u,h]=_.useState(0),[d,g]=_.useState({}),[p,v]=_.useState({}),[y,w]=_.useState(o??null),[S,C]=_.useState(s),k=(U,F)=>{var ne;const N=(ne=p[U])==null?void 0:ne.trim(),B=d[U]||"",X=F||r.find(ae=>Li(ae)===U);if(X!=null&&X.multiSelect)return[B,N].filter(Boolean).flatMap(ae=>ae.split(", ").filter(Boolean));const A=N||B;return A?[A]:[]},R=U=>{const F=d[Li(U)]||"";return U.multiSelect?F.split(", ").filter(Boolean):[F]},E=(U,F)=>{const N=Li(U);if(U.multiSelect){const B=d[N]?d[N].split(", ").filter(Boolean):[],X=B.includes(F)?B.filter(A=>A!==F):[...B,F];g({...d,[N]:X.join(", ")})}else g({...d,[N]:F}),v({...p,[N]:""}),u<r.length-1&&setTimeout(()=>h(u+1),150)},M=(U,F)=>{const N=Li(U);v({...p,[N]:F}),F&&!U.multiSelect&&g({...d,[N]:""})},j=U=>{const F=Li(U);U.multiSelect&&p[F]&&v({...p,[F]:""})},D=r.every(U=>k(Li(U),U).length>0),L=r[u],$=u===r.length-1,Y=L&&k(Li(L),L).length>0,P=()=>{u<r.length-1&&h(u+1)},V=()=>{u>0&&h(u-1)},I=()=>{if(!D)return;const U={};for(const F of r){const N=Li(F);U[N]=k(N,F)}w(U),C(!0),t(e.toolId,r,U)},W=U=>{if(U.key==="Enter"&&!(!L||!Y)){if(U.preventDefault(),$){I();return}P()}};if(S||s){const U=o||y||{};return f.jsx("div",{className:"w-full",children:f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("div",{className:"font-medium text-sm p-3 px-4 pr-5 bg-muted border-b border-border flex flex-row items-center justify-between",children:[f.jsxs("p",{children:["Question",r.length!==1?"s":""]}),f.jsx("p",{className:"",children:l?"Discarded":"Answers"})]}),r.map((F,N)=>{const B=U[Li(F)]||U[F.question]||[],X=N===r.length-1;return f.jsxs("div",{className:pe("w-full p-3 pt-2.5 pl-4 pr-5 bg-background flex items-center justify-between gap-3",!X&&"border-b border-border"),children:[f.jsx("div",{className:"text-sm text-pretty",children:F.question}),B.length>0&&f.jsx("div",{className:"text-sm font-medium text-right max-w-[50%] text-pretty",children:B.join(", ")}),B.length===0&&f.jsx("div",{className:"text-sm font-medium text-right italic",children:l?"Discarded":"No Response"})]},Li(F))})]})})}if(!n)return f.jsx("div",{className:"w-full py-2",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(SM,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:"Questions pending (newer question active)"})]})});if(!L)return null;const K=R(L),q=p[Li(L)]||"";return f.jsxs("div",{className:"w-full space-y-3",children:[f.jsxs(une,{question:L.question,currentIndex:u,totalQuestions:r.length,onBack:u>0?V:void 0,children:[(H=L.options)==null?void 0:H.map(U=>f.jsx(dne,{option:U,selected:K.includes(U.label),multiSelect:L.multiSelect,onClick:()=>E(L,U.label)},U.label)),f.jsx("div",{className:"transition-all bg-background",children:f.jsxs("div",{className:"flex pr-5 items-center justify-between gap-3",children:[f.jsx("input",{type:"text",value:q,onChange:U=>M(L,U.target.value),onKeyDown:W,placeholder:"Other...",className:"flex-1 px-3 !py-1 pl-4 min-h-[55px] min-w-0 text-base md:text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),f.jsx(o3,{selected:!!q,multiSelect:L.multiSelect,onClick:L.multiSelect&&q?()=>j(L):void 0})]})})]}),f.jsxs("div",{className:"flex justify-end gap-2 mx-2",children:[!$&&Y&&(L.multiSelect||!!q)&&f.jsx(Je,{size:"sm",onClick:P,children:"Next"}),$&&f.jsx(Je,{size:"sm",onClick:I,disabled:!D,className:pe(!D&&"opacity-50 cursor-not-allowed","rounded-full"),children:"Submit"})]})]})}function mne({message:e,onConfirm:t,isLatest:n,isActionable:r=n}){const s=!!e.result,[o,l]=_.useState(!1),[u,h]=_.useState(!1),[d,g]=_.useState(!1),[p,v]=_.useState(""),y=_.useRef(null),w=e.input;_.useEffect(()=>{d&&y.current&&y.current.focus()},[d]);const S=async()=>{w!=null&&w.plan&&(await navigator.clipboard.writeText(w.plan),h(!0),setTimeout(()=>h(!1),2e3))},C=s?e.result:null,k=(C==null?void 0:C.discarded)===!0;return f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"relative rounded-2xl border border-border overflow-hidden group/plan",children:[(w==null?void 0:w.plan)&&f.jsx(Je,{variant:"ghost",size:"icon",className:pe("absolute top-2 right-2 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-0 group-hover/plan:opacity-100 transition-opacity",!u&&"hover:text-foreground",u&&"hover:!bg-transparent hover:!border-transparent"),onClick:S,children:u?f.jsx($i,{className:"h-4 w-4 text-green-400"}):f.jsx(kd,{className:"h-4 w-4"})}),f.jsxs("div",{className:pe("!pt-5 !pb-0 px-4 md:py-4.5 md:px-5.5 bg-muted dark:bg-card overflow-scroll no-pre-highlight transition-all",s&&!o?"max-h-[min(400px,40vh)] ":"",s?"hover:!pb-[32px]":""),children:[s&&f.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:()=>l(!o),children:[o?"Show Less":"Show More",f.jsx(rp,{className:`size-3.5 transition-transform ${o?"rotate-180":""}`})]}),w!=null&&w.plan?f.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[f.jsx(Kd,{remarkPlugins:[Gd],components:$d(),children:w.plan}),f.jsx("div",{className:"mt-5"})]}):f.jsx("p",{className:"text-sm text-muted-foreground",children:"No plan provided"})]})]}),s?f.jsx("div",{className:"flex justify-end mx-2",children:f.jsxs("span",{className:"pl-4 inline text-sm font-medium bg-background text-foreground/60 border border-border py-1.5 px-3 rounded-[20px] leading-relaxed max-w-[85%] sm:max-w-[80%]",children:[f.jsx("em",{children:k?"Discarded":C!=null&&C.clearContext?"Approved & Cleared Context":C!=null&&C.confirmed?"Approved":C!=null&&C.message?`Adjusted: "${C.message}"`:"Adjusted Plan"}),f.jsx($6,{className:"inline h-4 w-4 ml-1.5 -mt-0.5"})]})}):n?r?f.jsxs("div",{className:"flex flex-col gap-3",children:[!d&&f.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-end gap-2 mx-2",children:[f.jsxs(Je,{size:"sm",onClick:()=>t(e.toolId,!0,!0),className:"rounded-full bg-primary text-primary-foreground pr-4 md:order-last",children:[f.jsx(y6,{className:"h-4 w-4 mr-1.5"}),"Approve & Clear"]}),f.jsxs("div",{className:"flex items-stretch md:items-center gap-2 md:contents",children:[f.jsxs(Je,{size:"sm",variant:"outline",onClick:()=>g(!0),className:"rounded-full border-border flex-1 md:flex-initial md:order-first",children:[f.jsx(gm,{className:"h-4 w-4 mr-1.5"}),"Suggest Edits"]}),f.jsxs(Je,{size:"sm",variant:"outline",onClick:()=>t(e.toolId,!0),className:"rounded-full border-border flex-1 md:flex-initial",children:[f.jsx($i,{className:"h-4 w-4 mr-1.5"}),"Approve"]})]})]}),d&&f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("textarea",{ref:y,value:p,onChange:R=>v(R.target.value),onKeyDown:R=>{R.key==="Enter"&&!R.shiftKey&&p.trim()&&(R.preventDefault(),t(e.toolId,!1,void 0,p.trim())),R.key==="Escape"&&(g(!1),v(""))},placeholder:"Describe what you'd like to change...",rows:3,className:"w-full rounded-2xl border border-border bg-muted dark:bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none"}),f.jsxs("div",{className:"flex items-center justify-end gap-2 mx-2",children:[f.jsx(Je,{size:"sm",variant:"ghost",onClick:()=>{g(!1),v("")},className:"rounded-full text-muted-foreground",children:"Cancel"}),f.jsxs(Je,{size:"sm",disabled:!p.trim(),onClick:()=>t(e.toolId,!1,void 0,p.trim()),className:"rounded-full bg-primary text-primary-foreground disabled:opacity-50 disabled:pointer-events-none",children:[f.jsx(AI,{className:"h-4 w-4 mr-1.5"}),"Adjust Plan"]})]})]})]}):f.jsx("div",{className:"flex justify-end mx-2",children:f.jsx("span",{className:"inline text-sm text-muted-foreground italic",children:"Plan pending"})}):f.jsx("div",{className:"flex justify-end mx-2",children:f.jsx("span",{className:"inline text-sm text-muted-foreground italic",children:"Plan pending (newer prompt active)"})})]})}const pne={completed:{Icon:$i,iconClass:"text-emerald-500",textClass:"text-muted-foreground"},in_progress:{Icon:oi,iconClass:"text-foreground animate-spin",textClass:"text-foreground font-medium"},pending:{Icon:O6,iconClass:"text-muted-foreground",textClass:"text-muted-foreground"}};function gne({message:e}){const t=e.input.todos;return t.length?f.jsx("div",{className:"w-full",children:f.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[f.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border flex items-center gap-2",children:[f.jsx(uI,{className:"h-4 w-4 text-muted-foreground"}),"Progress"]}),f.jsx("div",{children:t.map((n,r)=>{const s=r===t.length-1,{Icon:o,iconClass:l,textClass:u}=pne[n.status];return f.jsxs("div",{className:pe("flex items-center gap-3 px-4 py-2.5 bg-background",!s&&"border-b border-border"),children:[f.jsx(o,{className:pe("h-4 w-4 flex-shrink-0",l)}),f.jsx("span",{className:pe("text-sm",u),children:n.status==="in_progress"?n.activeForm:n.content})]},r)})})]})}):null}function vne(e){const t=e.split(`
|
|
601
|
+
`),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 _ne(e){return e.replace(/<[^>]+>/g,"")}function bne(e,t){const n=e.split(`
|
|
602
|
+
`),r=t.split(`
|
|
603
|
+
`),s=yne(n,r),o=xne(n,r,s);return wne(o)}function yne(e,t){const n=e.length,r=t.length,s=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let o=1;o<=n;o++)for(let l=1;l<=r;l++)s[o][l]=e[o-1]===t[l-1]?s[o-1][l-1]+1:Math.max(s[o-1][l],s[o][l-1]);return s}function xne(e,t,n){const r=[];let s=e.length,o=t.length;for(;s>0||o>0;)s>0&&o>0&&e[s-1]===t[o-1]?(r.push({type:"context",text:e[s-1],oldIdx:s,newIdx:o}),s--,o--):o>0&&(s===0||n[s][o-1]>=n[s-1][o])?(r.push({type:"added",text:t[o-1],oldIdx:s,newIdx:o}),o--):(r.push({type:"removed",text:e[s-1],oldIdx:s,newIdx:o}),s--);return r.reverse()}function wne(e){return e.map(t=>{const n=t.type==="removed"?"-":t.type==="added"?"+":" ";return{type:t.type,content:`${n}${t.text}`}})}function mb({content:e,isDiff:t=!1,oldString:n,newString:r}){const s=_.useMemo(()=>t&&n!==void 0&&r!==void 0?bne(n,r):[],[t,n,r]),o=_.useMemo(()=>t?[]:vne(e),[e,t]),l=_.useMemo(()=>o.some(u=>u.lineNumber!==null),[o]);return t&&s.length>0?f.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:f.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:f.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:f.jsx("tbody",{children:s.map((u,h)=>{const d=u.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":u.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",g=u.type==="removed"?"text-red-700 dark:text-red-400":u.type==="added"?"text-green-700 dark:text-green-400":"text-foreground";return f.jsxs("tr",{className:d,children:[f.jsx("td",{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${u.type==="removed"?"text-red-500/50":u.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:u.type==="removed"?"-":u.type==="added"?"+":" "}),f.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${g}`,children:u.content.slice(1)})]},h)})})})})}):f.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:f.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:f.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:f.jsx("tbody",{children:o.map((u,h)=>f.jsxs("tr",{children:[l&&f.jsx("td",{className:"px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right",children:u.lineNumber!==null?u.lineNumber:""}),f.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:_ne(u.content)})]},h))})})})})}function a3({message:e,isLoading:t=!1,localPath:n}){var k;const r=e.result!==void 0,s=!r&&t,o=_.useMemo(()=>{if(typeof e.result=="string")return e.result;if(!e.result)return"";if(typeof e.result=="object"&&e.result!==null&&"content"in e.result){const R=e.result.content;if(typeof R=="string")return R}return JSON.stringify(e.result,null,2)},[e.result]),l=_.useMemo(()=>{if((e.toolKind==="read_file"||e.toolKind==="write_file"||e.toolKind==="edit_file")&&e.input.filePath)return e.input.filePath;if(e.toolKind==="edit_file"){const R=o.match(/^Updated\s+(.+)$/m);if(R!=null&&R[1])return R[1].trim()}return""},[e.input,e.toolKind,o]),u=_.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill;if(e.toolKind==="glob")return`Search files ${e.input.pattern==="**/*"?"in all directories":`matching ${e.input.pattern}`}`;if(e.toolKind==="grep"){const R=e.input.pattern,E=e.input.outputMode;return E==="count"?`Count \`${R}\` occurrences`:E==="content"?`Find \`${R}\` in text`:`Find \`${R}\` in files`}return e.toolKind==="bash"?e.input.description||(e.input.command?D7(e.input.command):"Bash"):e.toolKind==="web_search"?e.input.query||"Web Search":e.toolKind==="read_file"?l?`Read ${W_(l,n)}`:"Read file":e.toolKind==="write_file"?l?`Write ${W_(l,n)}`:"Write file":e.toolKind==="edit_file"?l?`Edit ${W_(l,n)}`:"Edit file":e.toolKind==="mcp_generic"?`${Lb(e.input.tool)} from ${Lb(e.input.server)}`:e.toolKind==="subagent_task"&&e.input.subagentType||e.toolName},[l,e.input,e.toolKind,e.toolName,n]),h=_.useMemo(()=>e.toolKind==="subagent_task",[e.toolKind]),d=_.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill},[e.input,e.toolKind]),g=e.toolKind==="bash",p=e.toolKind==="write_file",v=e.toolKind==="edit_file",y=e.toolKind==="read_file",w=y&&!!o.trim(),S=v&&(!!e.input.oldString.trim()||!!e.input.newString.trim()),C=_.useMemo(()=>{switch(e.toolKind){case"bash":return e.input.command;case"write_file":return e.input.content;default:return JSON.stringify(e.input,null,2)}},[e]);return f.jsx(ao,{className:"w-full",children:f.jsxs(Fd,{expandedContent:f.jsx(Ud,{className:"my-4 text-sm",children:f.jsxs("div",{className:"flex flex-col gap-2",children:[v?S?f.jsx(mb,{content:"",isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):o.trim()?f.jsx(V_,{label:e.isError?"Error":"Result",copyText:o,children:o}):f.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this edit, but ACP did not include the file diff details."}):!y&&!p&&f.jsx(V_,{label:g?f.jsxs("span",{className:"flex items-center gap-2 w-full",children:[f.jsx("span",{children:"Command"}),!!e.input.timeoutMs&&f.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeoutMs),"ms"]}),!!e.input.runInBackground&&f.jsx("span",{className:"text-muted-foreground",children:"background"})]}):p?"Contents":"Input",copyText:C,children:C}),r&&y&&!e.isError&&(w?f.jsx(mb,{content:o}):f.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this read, but ACP did not include the file contents."})),p&&!e.isError&&f.jsx(mb,{content:e.input.content}),r&&!y&&!(p&&!e.isError)&&!(v&&!e.isError)&&f.jsx(V_,{label:e.isError?"Error":"Result",copyText:o,children:o})]})}),children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:(()=>{if(e.isError)return f.jsx(Xs,{className:"size-4 text-destructive"});if(h)return f.jsx(y0,{className:"size-4 text-muted-icon"});const R=KD(e.toolName);return f.jsx(R,{className:"size-4 text-muted-icon"})})()}),f.jsx(eo,{className:"text-left transition-opacity duration-200 truncate",children:f.jsx(wp,{animate:s,shimmerWidth:Math.max(20,(((k=d||u)==null?void 0:k.length)??33)*3),children:d||u})})]})})}function Sne({message:e}){const t=n=>{if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3),s=Math.floor(r/3600),o=Math.floor(r%3600/60),l=r%60;return s>0?`${s}h${o>0?` ${o}m`:""}`:o>0?`${o}m${l>0?` ${l}s`:""}`:`${l}s`};return e.success?f.jsxs(ao,{className:`px-0.5 text-xs tracking-wide ${e.durationMs>6e4?"":"hidden"}`,children:[f.jsx("div",{className:"w-full h-[1px] bg-border"}),f.jsxs(eo,{className:"whitespace-nowrap text-[11px] tracking-widest text-muted-foreground/60 uppercase flex-shrink-0",children:["Worked for ",t(e.durationMs)]}),f.jsx("div",{className:"w-full h-[1px] bg-border"})]}):f.jsx("div",{className:"px-4 py-3 mx-2 my-1 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm",children:e.result||"An unknown error occurred."})}function Cne({message:e}){return f.jsx("div",{className:"flex items-center justify-end gap-2 text-sm text-muted-foreground my-3",children:f.jsxs("div",{className:"inline-flex gap-1.5 items-center justify-center whitespace-nowrap text-sm font-medium bg-background text-foreground/60 border border-border h-9 pl-1 pr-4 rounded-full",children:[f.jsx(D6,{className:"h-4 w-4 ml-1.5"}),f.jsx("em",{children:"Interrupted"})]})})}function Gm({size:e=4}){return f.jsxs("svg",{className:"flex-1",viewBox:`0 0 100 ${e}`,preserveAspectRatio:"none",style:{height:`${e}px`},children:[f.jsx("pattern",{id:"zigzag",width:e,height:e,patternUnits:"userSpaceOnUse",children:f.jsx("path",{d:`M0 ${e} L${e/2} 0 L${e} ${e}`,fill:"none",stroke:"currentColor",strokeWidth:"0.5",className:"text-muted-foreground/30",style:{stroke:"currentColor"}})}),f.jsx("rect",{width:"100%",height:e,fill:"url(#zigzag)",className:"text-muted-foreground/30"})]})}function kne(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Gm,{}),f.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),f.jsx(Gm,{})]})}function Ene(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Gm,{}),f.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),f.jsx(Gm,{})]})}function Rne({message:e}){return f.jsx(ao,{children:f.jsxs(Fd,{expandedContent:f.jsx(Ud,{className:"my-4 text-xs",children:f.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:f.jsx(Kd,{remarkPlugins:[Gd],components:$d(),children:e.summary})})}),children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(CM,{className:"h-4.5 w-4.5 text-muted-foreground"})}),f.jsx(eo,{children:"Summarized"})]})})}const Tne={compacting:"Compacting..."};function Mne({message:e}){const t=Tne[e.status]||e.status;return f.jsxs(ao,{className:"grid grid-cols-[auto_1fr] items-center gap-1.5 text-sm animate-pulse",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(CM,{className:"h-4.5 w-4.5 text-muted-foreground"})}),f.jsx(eo,{className:"text-left transition-opacity duration-200 truncate",children:t})]})}const Nne={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"}},Ane={key:"other",singular:"tool call",plural:"tool calls"};function Dne(e){return Nne[e]??Ane}function jne(e){const t=new Map,n=[];for(const r of e){const s=r.toolKind,o=Dne(s),l=t.get(o.key);l?l.count++:(t.set(o.key,{category:o,count:1}),n.push(o.key))}return n.map(r=>{const{category:s,count:o}=t.get(r);return`${o} ${o===1?s.singular:s.plural}`}).join(", ")}function One({messages:e,isLoading:t,localPath:n}){const[r,s]=_.useState(!1),o=_.useMemo(()=>jne(e),[e]),u=e.some(h=>h.result===void 0)&&t;return f.jsx(ao,{className:"w-full",children:f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsx("button",{onClick:()=>s(!r),className:`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!r&&!u?"hover:opacity-60 transition-opacity":""}`,children:f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(Tr,{className:`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${r?"rotate-90":""}`})}),f.jsx(eo,{className:"text-left",children:f.jsx(wp,{animate:u,children:o})})]})}),r&&f.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[e.map(h=>f.jsx(a3,{message:h,isLoading:t,localPath:n},h.id)),e.length>5&&f.jsx("button",{onClick:()=>s(!1),className:"cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-xs hover:opacity-80 transition-opacity",children:f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[f.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:f.jsx(Tr,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),f.jsx(eo,{className:"text-left",children:"Collapse"})]})})]})]})})}const Lne=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function UR(e){if(e.kind!=="tool")return!1;const t=e.toolName;return!Lne.has(t)}function zne(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(UR(r)){const s=[r],o=n;for(n+=1;n<e.length&&UR(e[n]);)s.push(e[n]),n+=1;s.length>=2?t.push({type:"tool-group",messages:s,startIndex:o}):t.push({type:"single",message:r,index:o});continue}t.push({type:"single",message:r,index:n}),n+=1}return t}function Pne({messages:e,isLoading:t,localPath:n,latestToolIds:r,onOpenLocalLink:s,onAskUserQuestionSubmit:o,onExitPlanModeConfirm:l,pendingTool:u}){const h=_.useMemo(()=>zne(e),[e]);function d(g,p){if(g.kind==="user_prompt")return f.jsx(ene,{content:g.content,attachments:g.attachments},g.id);switch(g.kind){case"unknown":return f.jsx(tne,{json:g.json},g.id);case"system_init":return e.findIndex(y=>y.kind==="system_init")===p?f.jsx(one,{message:g,rawJson:g.debugRaw},g.id):null;case"account_info":return e.findIndex(y=>y.kind==="account_info")===p?f.jsx(ane,{message:g},g.id):null;case"assistant_text":return f.jsx(lne,{message:g},g.id);case"assistant_thought":return f.jsx(cne,{message:g},g.id);case"tool":return g.toolKind==="ask_user_question"?f.jsx(fne,{message:g,onSubmit:o,isLatest:g.id===r.AskUserQuestion},g.id):g.toolKind==="exit_plan_mode"?f.jsx(mne,{message:g,onConfirm:l,isLatest:g.id===r.ExitPlanMode,isActionable:(u==null?void 0:u.toolKind)==="exit_plan_mode"&&u.toolUseId===g.toolId},g.id):g.toolKind==="todo_write"?g.id!==r.TodoWrite?null:f.jsx(gne,{message:g},g.id):f.jsx(a3,{message:g,isLoading:t,localPath:n},g.id);case"result":{const v=e[p+1],y=e[p-1];return(v==null?void 0:v.kind)==="context_cleared"||(y==null?void 0:y.kind)==="context_cleared"?null:f.jsx(Sne,{message:g},g.id)}case"interrupted":return f.jsx(Cne,{message:g},g.id);case"compact_boundary":return f.jsx(kne,{},g.id);case"context_cleared":return f.jsx(Ene,{},g.id);case"compact_summary":return f.jsx(Rne,{message:g},g.id);case"status":return p===e.length-1?f.jsx(Mne,{message:g},g.id):null}}return f.jsx(MG,{onOpenLocalLink:s,children:h.map(g=>{if(g.type==="tool-group")return f.jsx("div",{className:"group relative",[_m]:"",children:f.jsx(One,{messages:g.messages,isLoading:t,localPath:n})},`group-${g.startIndex}`);const p=d(g.message,g.index);return p?f.jsx("div",{id:`msg-${g.message.id}`,className:"group relative",[_m]:"",children:p},g.message.id):null})})}function Bne({rootRef:e,fallbackRef:t,enabled:n,canCancel:r}){_.useEffect(()=>{if(!n)return;let s=0,o=null;const l=p=>{const v=p instanceof Element?p:null,y=e.current,w=t.current;if(Dk({trigger:"pointer",activeElement:document.activeElement,pointerStartTarget:o,pointerEndTarget:v,root:y,fallback:w,hasActiveOverlay:Ak(document),hasActiveSelection:e8(window.getSelection())})!=="restore"){o=null;return}w==null||w.focus({preventScroll:!0}),o=null},u=p=>{cancelAnimationFrame(s),o=p.target instanceof Element?p.target:null},h=p=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{l(p.target)})},d=()=>{o=null;const p=t.current;!p||p.disabled||p.focus({preventScroll:!0})},g=p=>{if(p.key!=="Escape")return;const v=t.current;Dk({trigger:"escape",activeElement:document.activeElement,fallback:v,hasActiveOverlay:Ak(document),canCancel:r,defaultPrevented:p.defaultPrevented})==="escape-focus"&&(p.preventDefault(),v==null||v.focus({preventScroll:!0}))};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("keydown",g,!0),window.addEventListener(vm,d),()=>{cancelAnimationFrame(s),window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener(vm,d)}},[r,n,t,e])}const $f="What are we building?",Ine=19,Hne=72,Fne=120;function Une(){var je,Ye,xt,ft,he,Pe,Ne,tt,wt,$e,pt;const e=o0(),t=_.useRef(null),n=_.useRef(null),r=_.useRef(null),[s,o]=_.useState(""),[l,u]=_.useState(!1),[h,d]=_.useState(0),g=Dp("(min-width: 768px)"),p=typeof window>"u"?!0:LG(window.location.hostname),v=((je=e.runtime)==null?void 0:je.projectId)??null,w=$o(Se=>v?Se.projects[v]:void 0)??$G,C=Ju(Se=>v?Se.projects[v]:void 0)??BG,k=$o(Se=>Se.addTerminal),R=$o(Se=>Se.removeTerminal),E=$o(Se=>Se.toggleVisibility),M=$o(Se=>Se.resetMainSizes),j=$o(Se=>Se.setMainSizes),D=$o(Se=>Se.setTerminalSizes),L=Ju(Se=>Se.toggleVisibility),$=Ju(Se=>Se.setSize),Y=wi(Se=>Se.scrollbackLines),P=wi(Se=>Se.minColumnWidth),V=e.keybindings,I=_.useMemo(()=>cx(V),[V]),W=w.terminals.length>0,K=!!(v&&w.isVisible&&W),q=!!(v&&W),O=!!(v&&C.isVisible),H=!!(v&&!g&&O),U=!!(v&&g),{isAnimating:F,mainPanelGroupRef:N,terminalFocusRequestVersion:B,terminalPanelRef:X,terminalVisualRef:A}=iY({showTerminalPane:K,shouldRenderTerminalLayout:q,projectId:v,terminalLayout:w,chatInputRef:r}),{isAnimating:ne,panelGroupRef:ae,sidebarPanelRef:Z,sidebarVisualRef:te}=tY({projectId:v,shouldRenderRightSidebarLayout:U,showRightSidebar:O,rightSidebarSize:C.size});Bne({rootRef:n,fallbackRef:r,enabled:e.hasSelectedProject&&((Ye=e.runtime)==null?void 0:Ye.status)!=="waiting_for_user",canCancel:e.canCancel});const le=()=>{if(v){if(W){E(v);return}k(v)}},me=Se=>{var Oe;if(!v||!K||F.current)return;const De=Se.chat,ce=Se.terminal;if(!Number.isFinite(De)||!Number.isFinite(ce))return;const be=((Oe=t.current)==null?void 0:Oe.getBoundingClientRect().height)??0;if(KG(be,ce)){M(v),E(v);return}j(v,[De,ce])};_.useEffect(()=>{if(e.messages.length!==0)return;o(""),u(!1);let Se=0;const De=window.setInterval(()=>{Se+=1,o($f.slice(0,Se)),Se>=$f.length&&(window.clearInterval(De),u(!0))},Ine);return()=>window.clearInterval(De)},[e.activeChatId,e.messages.length]),_.useEffect(()=>{function Se(De){if(v){if(Oa(I,"toggleEmbeddedTerminal",De)){De.preventDefault(),le();return}if(Oa(I,"toggleRightSidebar",De)){De.preventDefault(),L(v);return}if(Oa(I,"openInFinder",De)){if(!p)return;De.preventDefault(),e.handleOpenExternal("open_finder");return}if(Oa(I,"openInEditor",De)){if(!p)return;De.preventDefault(),e.handleOpenExternal("open_editor");return}Oa(I,"addSplitTerminal",De)&&(De.preventDefault(),k(v))}}return window.addEventListener("keydown",Se),()=>window.removeEventListener("keydown",Se)},[k,p,le,v,I,L]),_.useEffect(()=>{const Se=window.requestAnimationFrame(()=>{e.updateScrollState()}),De=window.setTimeout(()=>{e.updateScrollState()},tc);return()=>{window.cancelAnimationFrame(Se),window.clearTimeout(De)}},[q,K,e.updateScrollState]),_.useEffect(()=>{function Se(){e.updateScrollState()}return window.addEventListener("resize",Se),()=>window.removeEventListener("resize",Se)},[e.updateScrollState]),_.useEffect(()=>{if(g)return;const Se=window.visualViewport;if(!Se)return;const De=()=>{const ce=e.scrollRef.current;if(!ce)return;const be=ce.scrollHeight-ce.scrollTop-ce.clientHeight;if(JD(be)){requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.scrollToBottom(),e.updateScrollState()})});return}const Oe=document.activeElement;Oe&&ce.contains(Oe)&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{var He;const Ve=(He=e.inputRef.current)==null?void 0:He.getBoundingClientRect(),we=Oe.getBoundingClientRect();if(Ve&&we.bottom>Ve.top){const ot=we.bottom-Ve.top;ce.scrollBy({top:ot+16,behavior:"auto"})}e.updateScrollState()})})};return Se.addEventListener("resize",De),Se.addEventListener("scroll",De),()=>{Se.removeEventListener("resize",De),Se.removeEventListener("scroll",De)}},[g,e.scrollRef,e.scrollToBottom,e.updateScrollState]),_.useEffect(()=>{const Se=t.current;if(!Se||!q)return;const De=()=>{const be=Se.getBoundingClientRect().height;if(be<=0)return;const Oe=be*(w.mainSizes[1]/100);Oe<=0||d(Ve=>Math.abs(Ve-Oe)<1?Ve:Oe)},ce=new ResizeObserver(De);return ce.observe(Se),De(),()=>ce.disconnect()},[v,q,w.mainSizes]);const xe=Se=>Number.isFinite(Se)?Math.min(Iy,Math.max(Bp,Se)):C.size,Ae=()=>{v&&L(v)},Re=f.jsxs(RA,{ref:n,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",children:[f.jsxs(MA,{className:"flex flex-1 min-h-0 flex-col p-0 overflow-hidden relative",children:[f.jsx(bW,{sidebarCollapsed:e.sidebarCollapsed,hasCompletedChats:e.completedChatIds.size>0,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,onNewChat:e.handleCompose,usage:e.usage,localPath:e.navbarLocalPath,embeddedTerminalVisible:K,onToggleEmbeddedTerminal:v?le:void 0,rightSidebarVisible:O,onToggleRightSidebar:v?()=>L(v):void 0,onOpenExternal:p?Se=>{e.handleOpenExternal(Se)}:void 0,editorLabel:e.editorLabel,projectId:v??void 0,socket:e.socket,finderShortcut:p?I.bindings.openInFinder:void 0,editorShortcut:p?I.bindings.openInEditor:void 0,terminalShortcut:I.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:I.bindings.toggleRightSidebar}),f.jsxs(Mx,{ref:e.scrollRef,onScroll:e.updateScrollState,className:"flex-1 min-h-0 px-4 scroll-pt-[72px]",children:[(xt=e.runtime)!=null&&xt.inactiveProviderMessage?f.jsxs("div",{className:"mx-auto mt-[72px] max-w-[800px] rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm text-amber-900 dark:text-amber-200",children:["This thread uses ",e.runtime.provider,", which is currently inactive. ",e.runtime.inactiveProviderMessage]}):null,e.messages.length===0?f.jsx("div",{style:{height:e.transcriptPaddingBottom},"aria-hidden":"true"}):null,e.messages.length>0?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"animate-fade-in space-y-5 pt-[72px] max-w-[800px] mx-auto",children:[f.jsx(Pne,{messages:e.messages,isLoading:e.isProcessing,localPath:(ft=e.runtime)==null?void 0:ft.localPath,latestToolIds:e.latestToolIds,pendingTool:((he=e.runtime)==null?void 0:he.pendingTool)??null,onOpenLocalLink:e.handleOpenLocalLink,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode}),e.isProcessing?f.jsx(OG,{status:(Pe=e.runtime)==null?void 0:Pe.status}):null,e.commandError?f.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:e.commandError}):null]}),f.jsx("div",{style:{height:e.transcriptPaddingBottom},"aria-hidden":"true"})]}):null]}),e.messages.length===0?f.jsx("div",{className:"pointer-events-none absolute inset-x-4 animate-fade-in",style:{top:Hne,bottom:e.transcriptPaddingBottom},children:f.jsx("div",{className:"mx-auto flex h-full max-w-[800px] items-center justify-center",children:f.jsxs("div",{className:"flex flex-col items-center justify-center text-muted-foreground gap-4 opacity-70",children:[f.jsx(Ku,{strokeWidth:1.5,className:"size-8 text-muted-foreground kaizen-empty-state-flower"}),f.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs flex items-center kaizen-empty-state-text","aria-label":$f,children:f.jsxs("span",{className:"relative inline-grid place-items-start",children:[f.jsxs("span",{className:"invisible col-start-1 row-start-1 whitespace-pre flex items-center",children:[f.jsx("span",{children:$f}),f.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true"})]}),f.jsxs("span",{className:"col-start-1 row-start-1 whitespace-pre flex items-center",children:[f.jsx("span",{children:s}),f.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true",children:f.jsx("span",{className:"kaizen-typewriter-cursor","data-typing-complete":l?"true":"false"})})]})]})})]})})},e.activeChatId??"new-chat"):null,f.jsx("div",{style:{bottom:Fne},className:pe("absolute left-1/2 -translate-x-1/2 z-10 transition-all",e.showScrollButton?"scale-100 duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]":"scale-60 duration-300 ease-out pointer-events-none blur-sm opacity-0"),children:f.jsx("button",{onClick:e.scrollToBottom,className:"flex items-center transition-colors gap-1.5 px-2 bg-background/80 dark:bg-card/40 backdrop-blur-lg hover:bg-muted/80 border border-border rounded-full aspect-square cursor-pointer text-sm text-foreground/80 hover:text-foreground",children:f.jsx(d6,{className:"h-5 w-5"})})})]}),f.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:f.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:e.inputRef,children:f.jsx(mW,{ref:r,onSubmit:e.handleSend,onCancel:()=>{e.handleCancel()},disabled:!e.hasSelectedProject||((Ne=e.runtime)==null?void 0:Ne.status)==="waiting_for_user"||!!((tt=e.runtime)!=null&&tt.inactiveProviderMessage),canCancel:e.canCancel,chatId:e.activeChatId,activeProvider:((wt=e.runtime)==null?void 0:wt.provider)??null,activeModel:(($e=e.runtime)==null?void 0:$e.model)??null,activePlanMode:((pt=e.runtime)==null?void 0:pt.planMode)??!1,availableProviders:e.availableProviders,keybindings:I},e.activeChatId??"new-chat")})})]});return f.jsxs("div",{ref:t,className:"flex-1 flex flex-col min-w-0 relative",children:[U&&v?f.jsxs(tm,{groupRef:ae,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:Se=>{var ce;if(!O||ne.current)return;const De=xe(Se.rightSidebar);Math.abs(De-Se.rightSidebar)<.1||(ce=ae.current)==null||ce.setLayout({workspace:100-De,rightSidebar:De})},onLayoutChanged:Se=>{!O||ne.current||$(v,xe(Se.rightSidebar))},children:[f.jsx(Na,{id:"workspace",defaultSize:`${100-C.size}%`,minSize:"50%",className:"min-h-0 min-w-0",children:q?f.jsxs(tm,{groupRef:N,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:me,children:[f.jsx(Na,{id:"chat",defaultSize:`${w.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:Re}),f.jsx(nm,{withHandle:!0,orientation:"vertical",disabled:!K,className:pe(!K&&"pointer-events-none opacity-0")}),f.jsx(Na,{id:"terminal",defaultSize:`${w.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:X,children:f.jsx("div",{ref:A,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":K?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${tc}ms`},children:f.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:f.jsx(FE,{projectId:v,layout:w,onAddTerminal:k,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:Y,minColumnWidth:P,splitTerminalShortcut:I.bindings.addSplitTerminal,focusRequestVersion:B,onRemoveTerminal:(Se,De)=>{e.socket.command({type:"terminal.close",terminalId:De}).catch(()=>{}),R(Se,De)},onTerminalLayout:D})})})})]},v):Re}),f.jsx(nm,{withHandle:!0,orientation:"horizontal",disabled:!O,className:pe(!O&&"pointer-events-none opacity-0")}),f.jsx(Na,{id:"rightSidebar",defaultSize:`${C.size}%`,maxSize:`${Iy}%`,className:"min-h-0 min-w-0",elementRef:Z,children:f.jsx("div",{ref:te,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":O?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${tc}ms`},children:f.jsx(E2,{onClose:()=>L(v)})})})]},`${v}-right-sidebar`):q&&v?f.jsxs(tm,{groupRef:N,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:me,children:[f.jsx(Na,{id:"chat",defaultSize:`${w.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:Re}),f.jsx(nm,{withHandle:!0,orientation:"vertical",disabled:!K,className:pe(!K&&"pointer-events-none opacity-0")}),f.jsx(Na,{id:"terminal",defaultSize:`${w.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:X,children:f.jsx("div",{ref:A,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":K?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${tc}ms`},children:f.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:f.jsx(FE,{projectId:v,layout:w,onAddTerminal:k,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:Y,minColumnWidth:P,splitTerminalShortcut:I.bindings.addSplitTerminal,focusRequestVersion:B,onRemoveTerminal:(Se,De)=>{e.socket.command({type:"terminal.close",terminalId:De}).catch(()=>{}),R(Se,De)},onTerminalLayout:D})})})})]},v):Re,H?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 md:hidden",onClick:Ae}),f.jsx("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-2xl md:hidden",children:f.jsx(E2,{onClose:Ae,className:"h-[var(--app-shell-height)]"})})]}):null]})}function $R({narrow:e=!1,title:t,subtitle:n,icon:r=kM}){return f.jsxs("div",{className:pe("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[f.jsxs("div",{className:pe("flex items-center gap-1 mb-2",e&&"justify-center"),children:[f.jsx("div",{className:"p-2 pl-0 rounded-lg",children:f.jsx(r,{className:"h-6 w-6 text-muted-foreground"})}),f.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t})]}),n&&f.jsx("p",{className:pe("text-muted-foreground",e&&"mb-10 text-center"),children:n})]})}const $ne={sm:"text-sm px-2.5 py-1",md:"text-sm px-3 py-1.5"};function Wne({value:e,onValueChange:t,options:n,size:r="md",className:s,optionClassName:o}){return f.jsx("div",{className:pe("inline-flex items-center rounded-lg border border-border p-[3px] ",s),children:n.map(l=>{const u=l.value===e,h=l.icon,d=h?_.isValidElement(h)?h:(()=>{const p=h;return f.jsx(p,{className:r==="sm"?"h-3.5 w-3.5":"h-4 w-4"})})():null,g=f.jsxs("button",{type:"button",onClick:()=>t(l.value),disabled:l.disabled,"aria-pressed":u,className:pe("rounded-[4px] border transition-colors",h?"grid grid-cols-[auto_auto] items-center gap-2":"inline-flex items-center gap-1.5",$ne[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",o),children:[d,f.jsx("span",{children:l.label})]},l.value);return l.tooltip?f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:g}),f.jsx(Ii,{children:l.tooltip})]},l.value):g})})}function Vne(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function qne(e){const t=e.split("/").filter(Boolean);return t[t.length-1]||e}function Kne({open:e,onOpenChange:t,initialDirectory:n,onListDirectories:r,onConfirm:s}){var O;const[o,l]=_.useState("new"),[u,h]=_.useState(""),[d,g]=_.useState([]),[p,v]=_.useState({}),[y,w]=_.useState([]),[S,C]=_.useState(null),[k,R]=_.useState(""),[E,M]=_.useState(null),[j,D]=_.useState(null),L=_.useRef(null);_.useEffect(()=>{e&&(l("new"),h(""),g(n?n.roots:[]),v(n?{[n.currentPath]:n.entries}:{}),w(n?[n.currentPath]:[]),C((n==null?void 0:n.currentPath)??null),R(""),M(null),D(null),setTimeout(()=>{var H;return(H=L.current)==null?void 0:H.focus()},0))},[n,e]),_.useEffect(()=>{e&&setTimeout(()=>{var H;o==="new"&&((H=L.current)==null||H.focus())},0)},[o,e]);const $=Vne(u),Y=$?`${Q9}/${$}`:"",P=k.trim(),V=o==="new"?!!$:!!P,I=async H=>{M(null),D(H??"__root__");try{const U=await r(H);if(!H){g(U.roots),C(U.currentPath),v({[U.currentPath]:U.entries}),w([U.currentPath]);return}d.length===0&&(g([{name:qne(U.currentPath),localPath:U.currentPath}]),C(U.currentPath)),v(F=>({...F,[U.currentPath]:U.entries})),w(F=>F.includes(U.currentPath)?F:[...F,U.currentPath])}catch(U){M(U instanceof Error?U.message:String(U))}finally{D(null)}},W=async H=>{if(y.includes(H)){w(U=>U.filter(F=>F!==H));return}if(p[H]){w(U=>[...U,H]);return}await I(H)},K=(H,U,F)=>{const N=y.includes(H),B=k===H,X=p[H]??[],A=j===H;return f.jsxs("div",{children:[f.jsxs("div",{className:pe("grid grid-cols-[auto_1fr] items-center gap-2 px-3 py-2",B?"bg-muted":"hover:bg-muted/50"),style:{paddingLeft:`${12+F*16}px`},children:[f.jsx("button",{type:"button",className:"flex h-6 w-6 items-center justify-center rounded hover:bg-background disabled:opacity-50",onClick:()=>void W(H),disabled:A,children:A?f.jsx(oi,{className:"h-4 w-4 animate-spin text-muted-foreground"}):f.jsx(Tr,{className:pe("h-4 w-4 text-muted-foreground transition-transform",N&&"rotate-90")})}),f.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",onClick:()=>R(H),children:[N?f.jsx(yM,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):f.jsx(xM,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),f.jsx("span",{className:"truncate",children:U})]})]}),N&&X.length>0?X.map(ne=>K(ne.localPath,ne.name,F+1)):null]},H)},q=()=>{if(V){if(o==="new")s({mode:"new",localPath:Y,title:u.trim()});else{const H=P.split("/").pop()||P;s({mode:"existing",localPath:P,title:H})}t(!1)}};return f.jsx(sp,{open:e,onOpenChange:t,children:f.jsxs(Ed,{size:"sm",children:[f.jsxs(ap,{className:"space-y-4",children:[f.jsx(op,{children:"Add Project"}),f.jsx(Wne,{value:o,onValueChange:l,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Folder"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),o==="new"?f.jsxs("div",{className:"space-y-2",children:[f.jsx(Si,{ref:L,type:"text",value:u,onChange:H=>h(H.target.value),onKeyDown:H=>{H.key==="Enter"&&q(),H.key==="Escape"&&t(!1)},placeholder:"Project name"}),Y&&f.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:Y})]}):f.jsxs("div",{className:"space-y-2",children:[f.jsx(Si,{type:"text",value:k,onChange:H=>R(H.target.value),onKeyDown:H=>{H.key==="Enter"&&I(k||void 0)},placeholder:"Enter a server path, for example /home/bettie/Projects/my-app"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Import an existing folder from the connected server machine. You can type a path manually or choose from the root folder list below."}),f.jsx("div",{className:"flex justify-end",children:f.jsx(Je,{type:"button",variant:"ghost",size:"sm",onClick:()=>void I("~"),disabled:j!==null,children:"Load Root"})}),d.length>0?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Server Folders"}),f.jsxs(Mx,{className:"max-h-64 rounded-xl border border-border",children:[d.map(H=>K(H.localPath,H.name,0)),S&&((O=p[S])==null?void 0:O.length)===0?f.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"No subfolders"}):null]})]}):j?f.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-border px-3 py-2 text-sm text-muted-foreground",children:[f.jsx(oi,{className:"h-4 w-4 animate-spin"}),"Loading folders from server machine..."]}):null,E?f.jsx("p",{className:"text-xs text-destructive",children:E}):null]})]}),f.jsxs(lp,{children:[f.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),f.jsx(Je,{variant:"secondary",size:"sm",onClick:q,disabled:!V,children:o==="new"?"Create":"Import"})]})]})})}function Gne({text:e}){const[t,n]=_.useState(!1);async function r(){await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return f.jsx(Je,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void r(),children:t?f.jsx($i,{className:"h-4 w-4 text-green-400"}):f.jsx(kd,{className:"h-4 w-4"})})}function WR({children:e}){return f.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[f.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[f.jsx(Tr,{className:"inline h-4 w-4 opacity-40"}),f.jsx("code",{children:e})]}),f.jsx(Gne,{text:e})]})}function Wf({children:e}){return f.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function pb({children:e}){return f.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function gb({icon:e,title:t,subtitle:n,iconClassName:r}){return f.jsxs("div",{className:"flex flex-col items-center gap-0",children:[f.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:f.jsx(e,{className:r||"h-8 w-8 text-muted-foreground"})}),f.jsx("span",{className:"text-sm font-medium",children:t}),f.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function VR(){return f.jsx(f6,{className:"h-4 w-4 text-muted-foreground"})}function qR({number:e,title:t,children:n}){return f.jsx("div",{className:"flex gap-4",children:f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[f.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),f.jsx("h3",{className:"font-medium text-foreground mb-2",children:t})]}),f.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:n})]})})}function Yne({localPath:e,iconDataUrl:t,loading:n,onClick:r,onHide:s}){const o=gn(l=>l.showProjectIconsInSidebar);return f.jsxs("div",{className:"relative group",children:[f.jsxs(ds,{children:[f.jsx(hs,{asChild:!0,children:f.jsxs("button",{className:pe("border border-border hover:border-primary/30 rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",n&&"opacity-50 cursor-not-allowed"),disabled:n,onClick:r,children:[o?f.jsx(xA,{iconDataUrl:t,alt:`${km(e)} icon`,className:"h-5.5 w-5.5",fallback:f.jsx(xM,{className:"h-5.5 w-5.5 text-muted-foreground flex-shrink-0"})}):null,f.jsx("span",{className:"font-medium text-foreground truncate flex-1 pr-10",children:km(e)}),n?f.jsx(oi,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):null]})}),f.jsx(Ii,{children:f.jsx("p",{children:e})})]}),f.jsx(Je,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 h-7 w-7 -translate-y-1/2 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",disabled:n,onClick:l=>{l.stopPropagation(),s()},children:f.jsx(id,{className:"h-4 w-4"})})]})}function Xne({connectionStatus:e,ready:t,snapshot:n,startingLocalPath:r,commandError:s,onOpenProject:o,onHideProject:l,onListDirectories:u,onCreateProject:h}){const[d,g]=_.useState(!1),p=_.useMemo(()=>(n==null?void 0:n.projects)??[],[n==null?void 0:n.projects]),v=e==="connecting"||!t,y=e==="connected"&&t;return f.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[y?f.jsxs(f.Fragment,{children:[f.jsx($R,{title:(n==null?void 0:n.machine.displayName)??"Local Projects",subtitle:`${Mn} is connected, choose a project below to get started.`}),f.jsxs("div",{className:"w-full px-6 mb-10",children:[f.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[f.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),f.jsxs(Je,{variant:"default",size:"sm",onClick:()=>g(!0),children:[f.jsx(ip,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),p.length>0?f.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 3xl:grid-cols-5 gap-2",children:p.map(w=>f.jsx(Yne,{localPath:w.localPath,iconDataUrl:w.iconDataUrl,loading:r===w.localPath,onClick:()=>{o(w.localPath)},onHide:()=>{l(w.localPath)}},w.localPath))}):f.jsx(Wf,{children:f.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),s?f.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:s}):null]})]}):f.jsxs(f.Fragment,{children:[f.jsx($R,{narrow:!0,icon:Ek,title:v?`Connecting ${Mn}`:`Connect ${Mn}`,subtitle:v?`${Mn} is starting up and loading your local projects.`:`Run ${Mn} directly on your machine with full access to your local files and agent project history.`}),f.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[f.jsx(pb,{children:"Status"}),f.jsx("div",{className:"mb-8",children:f.jsx(Wf,{children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(oi,{className:"h-4 w-4 text-muted-foreground animate-spin"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:v?`Connecting to your local ${Mn} server...`:f.jsxs(f.Fragment,{children:["Not connected. Run ",f.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:wf()})," from any terminal on this machine."]})})]})})}),v?null:f.jsxs("div",{className:"mb-10",children:[f.jsx(pb,{children:"How it works"}),f.jsx(Wf,{children:f.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[f.jsx(gb,{icon:b0,title:`${Mn} CLI`,subtitle:"On Your Machine"}),f.jsx(VR,{}),f.jsx(gb,{icon:kM,title:`${Mn} Server`,subtitle:"Local WebSocket"}),f.jsx(VR,{}),f.jsx(gb,{icon:Ek,title:`${Mn} UI`,subtitle:"Project Chat"})]})})]}),v?null:f.jsxs("div",{className:"mb-10",children:[f.jsx(pb,{children:"Setup"}),f.jsx(Wf,{children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs(qR,{number:1,title:`Start ${Mn}`,children:[f.jsx("p",{children:"Run this command in your terminal:"}),f.jsx(WR,{children:wf()})]}),f.jsxs(qR,{number:2,title:"Open the local UI",children:[f.jsxs("p",{children:[Mn," serves the app locally and opens the Local Projects page in an app-style browser window."]}),f.jsx(WR,{children:"http://localhost:3210/local"})]}),f.jsxs("div",{className:"mt-8",children:[f.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),f.jsxs("div",{className:"space-y-3 text-sm",children:[f.jsxs("div",{className:"flex gap-4",children:[f.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:wf("").trim()}),f.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),f.jsxs("div",{className:"flex gap-4",children:[f.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:wf("--no-open")}),f.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),f.jsx(Kne,{open:d,onOpenChange:g,initialDirectory:(n==null?void 0:n.rootDirectory)??null,onListDirectories:u,onConfirm:w=>{h(w)}}),f.jsx("div",{className:"py-4 text-center",children:f.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",O0.split("/")[1]]})})]})}function Zne(){const e=o0();return f.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:f.jsx(Xne,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,onOpenProject:e.handleOpenLocalProject,onHideProject:e.handleHideLocalProject,onListDirectories:e.handleListDirectories,onCreateProject:e.handleCreateProject})})}function vb({children:e,className:t,icon:n,type:r="button",variant:s="outline",...o}){return f.jsxs("button",{type:r,className:pe(HT({variant:s,size:"sm"}),"h-auto gap-1.5 px-3 py-1.5",t),...o,children:[n,e?f.jsx("span",{children:e}):null]})}const qu=[{id:"general",label:"General",icon:LI,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"providers",label:"Providers",icon:_I,subtitle:"Manage the default chat provider and saved model defaults for Claude, Codex, Gemini, and Cursor."},{id:"keybindings",label:"Keybindings",icon:H6,subtitle:"Edit global app shortcuts stored in the active keybindings file."}];function KR(e){return e&&qu.some(t=>t.id===e)?e:null}const Qne=[{value:"cursor",label:"Cursor"},{value:"vscode",label:"VS Code"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],GR=Object.keys(EA);function Jne(e){return`Edit global app shortcuts stored in ${e}.`}function ere(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 Vf(e,t){const n=Jt(t),r=(e==null?void 0:e.settings[t])??Wn[t];return n.systemActive?r.active?"Active.":"Inactive.":"Inactive by server policy."}function tre(e){return e&&typeof e=="object"&&"idx"in e&&typeof e.idx=="number"&&e.idx>0?"back":"home"}function YR({themePreference:e,nextBackgroundImage:t,backgroundOpacity:n}){const r=typeof t=="string"&&t.trim()!=="";return e!=="custom"||!r||n!==1?{}:{backgroundOpacity:.85,backgroundBlur:6}}function yn({title:e,description:t,children:n,bordered:r=!0,alignStart:s=!1}){return f.jsx("div",{className:r?"border-t border-border":void 0,children:f.jsxs("div",{className:`flex flex-col sm:flex-row sm:justify-between gap-3 sm:gap-8 py-5 ${s?"sm:items-start":"sm:items-center"}`,children:[f.jsxs("div",{className:"min-w-0 max-w-xl",children:[f.jsx("div",{className:"text-sm font-medium text-foreground",children:e}),f.jsx("div",{className:"mt-1 text-[13px] text-muted-foreground",children:t})]}),f.jsx("div",{className:"flex w-full items-center sm:w-auto sm:shrink-0",children:n})]})})}function nre(){var Ot,sn;const e=xd(),{sectionId:t}=mT(),n=o0(),{theme:r,setTheme:s}=FD(),o=KR(t)??"general",l=n.connectionStatus==="connecting"||!n.localProjectsReady,u=((Ot=n.localProjects)==null?void 0:Ot.machine.displayName)??"Unavailable",h=((sn=n.localProjects)==null?void 0:sn.projects.length)??0,d=O0.split("/")[1]??"unknown",g=wi(G=>G.scrollbackLines),p=wi(G=>G.minColumnWidth),v=wi(G=>G.editorPreset),y=wi(G=>G.editorCommandTemplate),w=wi(G=>G.setScrollbackLines),S=wi(G=>G.setMinColumnWidth),C=wi(G=>G.setEditorPreset),k=wi(G=>G.setEditorCommandTemplate),R=n.keybindings,E=n.providerSettings,M=xi(G=>G.defaultProvider),j=xi(G=>G.providerDefaults),D=xi(G=>G.showProviderIconsInSideTray),L=xi(G=>G.setDefaultProvider),$=xi(G=>G.setProviderDefaultModel),Y=xi(G=>G.setProviderDefaultModelOptions),P=xi(G=>G.setProviderDefaultPlanMode),V=xi(G=>G.setShowProviderIconsInSideTray),I=qs(G=>G.folderGroupsEnabled),W=qs(G=>G.kanbanStatusesEnabled),K=qs(G=>G.commitProjectMetadataDirectory),q=qs(G=>G.setFolderGroupsEnabled),O=qs(G=>G.setKanbanStatusesEnabled),H=qs(G=>G.setCommitProjectMetadataDirectory),U=gn(G=>G.colorTheme),F=gn(G=>G.customAppearance),N=gn(G=>G.backgroundImage),B=gn(G=>G.backgroundOpacity),X=gn(G=>G.backgroundBlur),A=gn(G=>G.showProjectIconsInSidebar),ne=gn(G=>G.setColorTheme),ae=gn(G=>G.setCustomAppearance),Z=gn(G=>G.setBackgroundImage),te=gn(G=>G.setBackgroundOpacity),le=gn(G=>G.setBackgroundBlur),me=gn(G=>G.setShowProjectIconsInSidebar),xe=_.useMemo(()=>cx(R),[R]),Ae=xe.filePathDisplay||n7(),[Re,je]=_.useState(String(g)),[Ye,xt]=_.useState(String(p)),[ft,he]=_.useState(y),[Pe,Ne]=_.useState(N??""),[tt,wt]=_.useState(String(B)),[$e,pt]=_.useState(String(X)),[Se,De]=_.useState({}),[ce,be]=_.useState(null),[Oe,Ve]=_.useState(null),we=_.useMemo(()=>z0((E==null?void 0:E.settings)??Wn),[E==null?void 0:E.settings]),He=M==="last_used"||we.some(G=>G.id===M)?M:"last_used",[ot,rt]=_.useState([]),Le=n.updateSnapshot,St=ere(Le),at=(Le==null?void 0:Le.status)==="checking"?"Checking for updates…":(Le==null?void 0:Le.status)==="updating"?"Installing update…":(Le==null?void 0:Le.status)==="restart_pending"?`Restarting ${Mn}…`:(Le==null?void 0:Le.status)==="available"?`Update available${Le.latestVersion?`: ${Le.latestVersion}`:""}`:(Le==null?void 0:Le.status)==="up_to_date"?"Up to date":(Le==null?void 0:Le.status)==="error"?"Update check failed":"Not checked yet";_.useEffect(()=>{fetch("/api/backgrounds").then(G=>G.json()).then(G=>rt(G)).catch(G=>console.error("Failed to load system backgrounds",G))},[]),_.useEffect(()=>{je(String(g))},[g]),_.useEffect(()=>{xt(String(p))},[p]),_.useEffect(()=>{he(y)},[y]),_.useEffect(()=>{Ne(N??"")},[N]),_.useEffect(()=>{wt(String(B))},[B]),_.useEffect(()=>{pt(String(X))},[X]),_.useEffect(()=>{De(Object.fromEntries(GR.map(G=>[G,M_(xe.bindings[G])])))},[xe]),_.useEffect(()=>{t&&(KR(t)||e("/settings/general",{replace:!0}))},[e,t]);function vn(){const G=Number(Re);if(!Number.isFinite(G)){je(String(g));return}w(G)}function tn(){const G=Number(Ye);if(!Number.isFinite(G)){xt(String(p));return}S(G)}function Nn(){const G=Pe.trim()===""?null:Pe.trim(),Xe=YR({themePreference:r,nextBackgroundImage:G,backgroundOpacity:B});Z(G),Xe.backgroundOpacity!==void 0&&te(Xe.backgroundOpacity),Xe.backgroundBlur!==void 0&&le(Xe.backgroundBlur),st({backgroundImage:G,...Xe})}function xr(){const G=Number(tt);if(!Number.isFinite(G)||G<0||G>1){wt(String(B));return}te(G),st({backgroundOpacity:G})}function Kn(){const G=Number($e);if(!Number.isFinite(G)||G<0){pt(String(X));return}le(G),st({backgroundBlur:G})}function jt(G,Xe){G.key==="Enter"&&(Xe(),G.currentTarget.blur())}function zt(G,Xe){G.key==="Enter"&&(Xe(),G.currentTarget.blur())}function Fe(){k(ft)}async function ct(G=Se){try{be(null),await n.socket.command({type:"settings.writeKeybindings",bindings:XR(G)})}catch(Xe){be(Xe instanceof Error?Xe.message:"Unable to save keybindings.")}}async function st(G){try{await n.socket.command({type:"settings.writeThemeSettings",settings:{themePreference:(G==null?void 0:G.themePreference)??r,colorTheme:(G==null?void 0:G.colorTheme)??U,customAppearance:(G==null?void 0:G.customAppearance)??F,backgroundImage:(G==null?void 0:G.backgroundImage)!==void 0?G.backgroundImage:N,backgroundOpacity:(G==null?void 0:G.backgroundOpacity)??B,backgroundBlur:(G==null?void 0:G.backgroundBlur)??X,showProjectIconsInSidebar:(G==null?void 0:G.showProjectIconsInSidebar)??A}})}catch(Xe){console.error("Failed to save theme settings:",Xe)}}async function mt(G){try{Ve(null),await n.socket.command({type:"settings.writeProviderSettings",settings:G})}catch(Xe){Ve(Xe instanceof Error?Xe.message:"Unable to save provider settings.")}}async function an(G){const Xe={...Se,[G]:M_(os[G])};De(Xe);try{be(null),await n.socket.command({type:"settings.writeKeybindings",bindings:XR(Xe)})}catch(It){be(It instanceof Error?It.message:"Unable to save keybindings.")}}const Ce=ft.replaceAll("{path}","/Users/jake/Projects/kaizen/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),Te=qu.find(G=>G.id===o)??qu[0],gt=o==="keybindings"?Jne(Ae):Te.subtitle,Qe=!l,vt=o==="keybindings"?f.jsxs(vb,{onClick:()=>{n.handleOpenExternalPath("open_editor",Ae)},icon:f.jsx(bM,{className:"h-4 w-4"}),children:["Open in ",n.editorLabel]}):o==="general"?f.jsx(vb,{variant:St.variant,onClick:()=>{if(St.kind==="update"){n.handleInstallUpdate();return}n.handleCheckForUpdates({force:!0})},disabled:St.disabled,icon:St.kind==="check"?f.jsx(v0,{className:pe("size-3.5",St.spinning&&"animate-spin")}):St.kind==="update"?f.jsx(z6,{className:pe("size-3.5")}):void 0,children:St.label}):null;function qt(){if(tre(window.history.state)==="back"){e(-1);return}e("/",{replace:!0})}return f.jsxs("div",{className:"relative flex h-full flex-1 min-w-0 bg-background",children:[f.jsxs("div",{className:"flex min-w-0 flex-1",children:[f.jsx("aside",{className:`hidden w-[200px] shrink-0 md:block ${Qe?"pb-[89px]":""}`,children:f.jsxs("div",{className:"flex flex-col gap-1 px-4 py-6",children:[f.jsx("div",{className:"px-3 pb-5 text-[22px] font-extrabold tracking-[-0.5px] text-foreground",children:"Settings"}),qu.map(G=>f.jsx("button",{type:"button",onClick:()=>e(`/settings/${G.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${G.id===o?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:f.jsxs("div",{className:"flex items-center gap-2.5",children:[f.jsx(G.icon,{className:"h-4 w-4 shrink-0"}),f.jsx("span",{children:G.label})]})},G.label))]})}),f.jsxs("div",{className:"min-w-0 flex-1 overflow-y-auto",children:[f.jsx("div",{className:"md:hidden sticky top-0 z-10 bg-background border-b border-border px-4 py-2 backdrop-blur-md",children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-hide",children:qu.map(G=>f.jsxs("button",{type:"button",onClick:()=>e(`/settings/${G.id}`),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm transition-colors ${G.id===o?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:[f.jsx(G.icon,{className:"h-3.5 w-3.5 shrink-0"}),f.jsx("span",{children:G.label})]},G.id))}),f.jsx("button",{type:"button","aria-label":"Close settings",onClick:qt,className:"ml-1 flex shrink-0 items-center justify-center rounded-lg p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:f.jsx(Xs,{className:"h-4 w-4"})})]})}),f.jsxs("div",{className:"w-full px-6 pt-8 md:pt-16 pb-32",children:[l?f.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-2xl border border-border bg-card/40 px-4 py-6 text-sm text-muted-foreground",children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(oi,{className:"h-4 w-4 animate-spin"}),f.jsx("span",{children:"Loading machine settings…"})]})}):f.jsxs("div",{className:"mx-auto max-w-4xl",children:[f.jsxs("div",{className:"pb-6",children:[f.jsxs("div",{className:"flex items-center justify-between gap-4 min-h-[34px]",children:[f.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:Te.label}),f.jsxs("div",{className:"flex items-center gap-2",children:[vt,f.jsx(vb,{"aria-label":"Close settings",title:"Close settings",onClick:qt,icon:f.jsx(Xs,{className:"h-4 w-4"}),className:"hidden md:flex"})]})]}),f.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:gt})]}),o==="general"?f.jsx(f.Fragment,{children:f.jsxs("div",{className:"border-b border-border",children:[f.jsx(yn,{title:"Application Update",description:f.jsxs(f.Fragment,{children:[f.jsxs("span",{children:[at,"."]}),Le!=null&&Le.lastCheckedAt?f.jsxs("span",{children:[" Last checked ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(Le.lastCheckedAt),"."]}):null,Le!=null&&Le.error?f.jsxs("span",{children:[" ",Le.error]}):null]}),bordered:!1,children:f.jsxs("div",{className:"text-right text-sm text-foreground",children:[f.jsxs("div",{children:["Current: ",(Le==null?void 0:Le.currentVersion)??d]}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(Le==null?void 0:Le.latestVersion)??"Unknown"]})]})}),f.jsx(yn,{title:"Release Notes",description:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"The old GitHub changelog page is hidden after the rebrand because releases are no longer sourced from a public GitHub repo."}),f.jsx("span",{children:" We need to come back to this and wire release notes to the deployment/NPX update flow."})]}),children:f.jsx("div",{className:"rounded-full border border-border bg-muted/40 px-3 py-1 text-xs font-medium text-muted-foreground",children:"Temporary placeholder"})}),f.jsx(yn,{title:"Theme",description:"Choose between light, dark, system, or custom appearance",children:f.jsxs(pr,{value:r,onValueChange:G=>{s(G),st({themePreference:G})},children:[f.jsx(ur,{className:"w-[150px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"light",children:"Light"}),f.jsx(Et,{value:"dark",children:"Dark"}),f.jsx(Et,{value:"system",children:"System"}),f.jsx(Et,{value:"custom",children:"Custom"})]})]})}),r==="custom"?f.jsxs("div",{className:"mb-2 ml-6 space-y-0 border-l border-border/60 pl-4",children:[f.jsx(yn,{title:"Appearance",description:"Choose light, dark, or system mode for your custom theme",bordered:!1,children:f.jsxs(pr,{value:F,onValueChange:G=>{ae(G),st({customAppearance:G})},children:[f.jsx(ur,{className:"w-[150px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"light",children:"Light"}),f.jsx(Et,{value:"dark",children:"Dark"}),f.jsx(Et,{value:"system",children:"System"})]})]})}),f.jsx(yn,{title:"Color Theme",description:"Choose a color palette for the interface",alignStart:!0,bordered:!1,children:f.jsxs(pr,{value:U,onValueChange:G=>{ne(G),st({colorTheme:G})},children:[f.jsx(ur,{className:"min-w-[180px]",children:f.jsx(Sr,{})}),f.jsx(dr,{children:f.jsxs(k_,{children:[f.jsx(Et,{value:"default",children:"Default"}),f.jsx(Et,{value:"tokyo-night",children:"Tokyo Night"}),f.jsx(Et,{value:"catppuccin",children:"Catppuccin"}),f.jsx(Et,{value:"dracula",children:"Dracula"}),f.jsx(Et,{value:"nord",children:"Nord"}),f.jsx(Et,{value:"everforest",children:"Everforest"}),f.jsx(Et,{value:"rose-pine",children:"Rose Pine"})]})})]})}),f.jsx(yn,{title:"Background Image",description:"Choose a background or enter a custom URL",alignStart:!0,bordered:!1,children:(()=>{const G=ot.find($t=>$t.url===Pe),Xe=!Pe,It=!!Pe&&!G,Cn=Xe?"__none__":It?"__custom__":Pe,li=Xe?"None":It?"Custom URL":(G==null?void 0:G.name)??"Unknown";return f.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-2 sm:max-w-[320px]",children:[f.jsxs(pr,{value:Cn,onValueChange:$t=>{if($t==="__none__")Ne(""),Z(null),st({backgroundImage:null});else{const ir=YR({themePreference:r,nextBackgroundImage:$t,backgroundOpacity:B});Ne($t),Z($t),ir.backgroundOpacity!==void 0&&te(ir.backgroundOpacity),ir.backgroundBlur!==void 0&&le(ir.backgroundBlur),st({backgroundImage:$t,...ir})}},children:[f.jsx(ur,{className:"w-full",children:f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Xe?null:f.jsx("img",{src:Pe,alt:"",className:"h-5 w-9 shrink-0 rounded object-cover"}),f.jsx("span",{className:"truncate",children:li})]})}),f.jsxs(dr,{children:[f.jsx(Jf,{value:"__none__",children:"None"}),ot.map($t=>f.jsx(Jf,{value:$t.url,thumbnail:$t.url,thumbnailAlt:$t.name,children:$t.name},$t.id)),It?f.jsx(Jf,{value:"__custom__",thumbnail:Pe,thumbnailAlt:"Custom",children:"Custom URL"}):null]})]}),f.jsx(Si,{type:"text",placeholder:"Or enter a custom URL...",value:Pe,onChange:$t=>Ne($t.target.value),onBlur:Nn,onKeyDown:$t=>zt($t,Nn),className:"w-full"})]})})()}),f.jsx(yn,{title:"Background Opacity",description:"Opacity of the interface layered over the background (0 to 1)",bordered:!1,children:f.jsx("div",{className:"flex min-w-0 flex-col items-end gap-2",children:f.jsx(Si,{type:"number",min:0,max:1,step:.05,value:tt,onChange:G=>wt(G.target.value),onBlur:xr,onKeyDown:G=>jt(G,xr),className:"hide-number-steppers w-28 text-right font-mono"})})}),f.jsx(yn,{title:"Background Blur",description:"Blur applied to the background image (in pixels)",bordered:!1,children:f.jsx("div",{className:"flex min-w-0 flex-col items-end gap-2",children:f.jsx(Si,{type:"number",min:0,max:50,step:1,value:$e,onChange:G=>pt(G.target.value),onBlur:Kn,onKeyDown:G=>jt(G,Kn),className:"hide-number-steppers w-28 text-right font-mono"})})})]}):null,f.jsx(yn,{title:"Project Icons",description:"Show detected project icons in the sidebar and open-project list.",children:f.jsxs(pr,{value:A?"enabled":"disabled",onValueChange:G=>{const Xe=G==="enabled";me(Xe),st({showProjectIconsInSidebar:Xe})},children:[f.jsx(ur,{className:"w-[100px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"disabled",children:"Off"}),f.jsx(Et,{value:"enabled",children:"On"})]})]})}),f.jsx(yn,{title:"Folder Groups",description:"Show or hide feature folder grouping in the sidebar. Turning this off keeps the existing feature state, but flattens chats into a direct list and hides the new-folder button.",children:f.jsxs(pr,{value:I?"enabled":"disabled",onValueChange:G=>q(G==="enabled"),children:[f.jsx(ur,{className:"w-[100px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"disabled",children:"Off"}),f.jsx(Et,{value:"enabled",children:"On"})]})]})}),I?f.jsxs("div",{className:"mb-2 ml-6 space-y-0 border-l border-border/60 pl-4",children:[f.jsx(yn,{title:"Kanban Status",description:"Show or hide feature status controls like Idea, Todo, Progress, Testing, and Done.",bordered:!1,children:f.jsxs(pr,{value:W?"enabled":"disabled",onValueChange:G=>O(G==="enabled"),children:[f.jsx(ur,{className:"w-[100px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"disabled",children:"Off"}),f.jsx(Et,{value:"enabled",children:"On"})]})]})}),f.jsx(yn,{title:`${__} In Git`,description:`Control whether ${Mn} keeps the project ${__} directory tracked in git or adds it to .gitignore for currently loaded projects and future opens. This is best suited to solo developers working across multiple machines. For team repos, we recommend ignoring \`${__}\`.`,bordered:!1,children:f.jsxs(pr,{value:K?"commit":"ignore",onValueChange:G=>{const Xe=G==="commit";H(Xe),n.handleSetCommitProjectMetadataDirectory(Xe)},children:[f.jsx(ur,{className:"w-[120px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"commit",children:"Commit"}),f.jsx(Et,{value:"ignore",children:"Ignore"})]})]})})]}):null,f.jsx(yn,{title:"Provider Icons In Side Tray",description:"Show provider badges next to chats in the left sidebar side tray.",children:f.jsxs(pr,{value:D?"enabled":"disabled",onValueChange:G=>V(G==="enabled"),children:[f.jsx(ur,{className:"w-[100px]",children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"disabled",children:"Off"}),f.jsx(Et,{value:"enabled",children:"On"})]})]})}),f.jsx(yn,{title:"Default Editor",description:"Used by the navbar code button and local file links in chat",alignStart:!0,children:f.jsxs(pr,{value:v,onValueChange:G=>C(G),children:[f.jsx(ur,{className:"min-w-[180px]",children:f.jsx(Sr,{})}),f.jsx(dr,{children:f.jsx(k_,{children:Qne.map(G=>f.jsx(Et,{value:G.value,children:G.label},G.value))})})]})}),v==="custom"?f.jsx("div",{className:"border-t border-border",children:f.jsxs("div",{className:"flex justify-between gap-8 py-5 pl-6",children:[f.jsxs("div",{className:"min-w-0 max-w-xl",children:[f.jsx("div",{className:"text-sm font-medium text-foreground",children:"Command Template"}),f.jsxs("div",{className:"mt-1 text-[13px] text-muted-foreground",children:["Include ","{path}"," and optionally ","{line}"," and ","{column}"," in your command."]})]}),f.jsxs("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:[f.jsx(Si,{type:"text",value:ft,onChange:G=>he(G.target.value),onBlur:Fe,onKeyDown:G=>zt(G,Fe),className:"font-mono"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview: ",f.jsx("span",{className:"font-mono",children:Ce})]})]})]})}):null,f.jsx(yn,{title:"Terminal Scrollback",description:"Lines retained for embedded terminal history",children:f.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[f.jsx(Si,{type:"number",min:Hy,max:Fy,step:100,value:Re,onChange:G=>je(G.target.value),onBlur:vn,onKeyDown:G=>jt(G,vn),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),f.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Hy,"-",Fy," lines",g===Um?" (default)":""]})]})}),f.jsx(yn,{title:"Terminal Min Column Width",description:"Minimum width for each terminal pane",children:f.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[f.jsx(Si,{type:"number",min:Uy,max:$y,step:10,value:Ye,onChange:G=>xt(G.target.value),onBlur:tn,onKeyDown:G=>jt(G,tn),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),f.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Uy,"-",$y," px",p===$m?" (default)":""]})]})})]})}):o==="providers"?f.jsxs("div",{className:"border-b border-border",children:[f.jsx(yn,{title:"Default Provider",description:"The default harness used for new chats before a provider is locked by an existing session.",bordered:!1,children:f.jsxs(pr,{value:He,onValueChange:G=>L(G),children:[f.jsx(ur,{className:"min-w-[180px]",children:f.jsx(Sr,{})}),f.jsx(dr,{children:f.jsxs(k_,{children:[f.jsx(Et,{value:"last_used",children:"Last Used"}),we.map(G=>f.jsx(Et,{value:G.id,children:G.label},G.id))]})})]})}),Oe?f.jsx("div",{className:"border-t border-border px-0 py-3 text-sm text-destructive",children:Oe}):null,f.jsx(yn,{title:"Claude Code Defaults",description:`Saved defaults when using Claude Code. ${Vf(E,"claude")}`,alignStart:!0,children:f.jsxs("div",{className:pe("max-w-[420px]",!Jt("claude").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(pr,{value:((E==null?void 0:E.settings.claude)??Wn.claude).active?"active":"inactive",onValueChange:G=>{mt({...(E==null?void 0:E.settings)??Wn,claude:{...(E==null?void 0:E.settings.claude)??Wn.claude,active:G==="active"}})},children:[f.jsx(ur,{className:"min-w-[140px]",disabled:!Jt("claude").systemActive,children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"active",children:"Active"}),f.jsx(Et,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(zu,{availableProviders:Ko,selectedProvider:"claude",disabled:!Jt("claude").systemActive,showProviderPicker:!1,providerLocked:!0,model:j.claude.model,modelOptions:j.claude.modelOptions,onModelChange:(G,Xe)=>{$("claude",Xe)},onClaudeReasoningEffortChange:G=>{Y("claude",{reasoningEffort:G})},onClaudeContextWindowChange:G=>{Y("claude",{contextWindow:G})},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:()=>{},planMode:j.claude.planMode,onPlanModeChange:G=>P("claude",G),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(yn,{title:"Codex Defaults",description:`Saved defaults when using Codex. ${Vf(E,"codex")}`,alignStart:!0,children:f.jsxs("div",{className:pe("max-w-[420px]",!Jt("codex").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(pr,{value:((E==null?void 0:E.settings.codex)??Wn.codex).active?"active":"inactive",onValueChange:G=>{mt({...(E==null?void 0:E.settings)??Wn,codex:{...(E==null?void 0:E.settings.codex)??Wn.codex,active:G==="active"}})},children:[f.jsx(ur,{className:"min-w-[140px]",disabled:!Jt("codex").systemActive,children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"active",children:"Active"}),f.jsx(Et,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(zu,{availableProviders:Ko,selectedProvider:"codex",disabled:!Jt("codex").systemActive,showProviderPicker:!1,providerLocked:!0,model:j.codex.model,modelOptions:j.codex.modelOptions,onModelChange:(G,Xe)=>{$("codex",Xe)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:G=>{Y("codex",{reasoningEffort:G})},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:G=>{Y("codex",{fastMode:G})},planMode:j.codex.planMode,onPlanModeChange:G=>P("codex",G),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(yn,{title:"Gemini Defaults",description:`Saved defaults when using Gemini. ${Vf(E,"gemini")}`,alignStart:!0,children:f.jsxs("div",{className:pe("max-w-[420px]",!Jt("gemini").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(pr,{value:((E==null?void 0:E.settings.gemini)??Wn.gemini).active?"active":"inactive",onValueChange:G=>{mt({...(E==null?void 0:E.settings)??Wn,gemini:{...(E==null?void 0:E.settings.gemini)??Wn.gemini,active:G==="active"}})},children:[f.jsx(ur,{className:"min-w-[140px]",disabled:!Jt("gemini").systemActive,children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"active",children:"Active"}),f.jsx(Et,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(zu,{availableProviders:Ko,selectedProvider:"gemini",disabled:!Jt("gemini").systemActive,showProviderPicker:!1,providerLocked:!0,model:j.gemini.model,modelOptions:j.gemini.modelOptions,onModelChange:(G,Xe)=>{$("gemini",Xe)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:G=>{Y("gemini",{thinkingMode:G})},onCodexFastModeChange:()=>{},planMode:j.gemini.planMode,onPlanModeChange:G=>P("gemini",G),includePlanMode:!0,className:"justify-start flex-wrap"})]})}),f.jsx(yn,{title:"Cursor Defaults",description:`Saved defaults when using Cursor. ${Vf(E,"cursor")}`,alignStart:!0,children:f.jsxs("div",{className:pe("max-w-[420px]",!Jt("cursor").systemActive&&"opacity-50"),children:[f.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f.jsxs(pr,{value:((E==null?void 0:E.settings.cursor)??Wn.cursor).active?"active":"inactive",onValueChange:G=>{mt({...(E==null?void 0:E.settings)??Wn,cursor:{...(E==null?void 0:E.settings.cursor)??Wn.cursor,active:G==="active"}})},children:[f.jsx(ur,{className:"min-w-[140px]",disabled:!Jt("cursor").systemActive,children:f.jsx(Sr,{})}),f.jsxs(dr,{children:[f.jsx(Et,{value:"active",children:"Active"}),f.jsx(Et,{value:"inactive",children:"Inactive"})]})]})}),f.jsx(zu,{availableProviders:Ko,selectedProvider:"cursor",disabled:!Jt("cursor").systemActive,showProviderPicker:!1,providerLocked:!0,model:j.cursor.model,modelOptions:j.cursor.modelOptions,onModelChange:(G,Xe)=>{$("cursor",Xe)},onClaudeReasoningEffortChange:()=>{},onClaudeContextWindowChange:()=>{},onCodexReasoningEffortChange:()=>{},onGeminiThinkingModeChange:()=>{},onCodexFastModeChange:()=>{},planMode:j.cursor.planMode,onPlanModeChange:G=>P("cursor",G),includePlanMode:!0,className:"justify-start flex-wrap"})]})})]}):o==="keybindings"?f.jsxs("div",{className:"border-b border-border",children:[ce?f.jsx("div",{className:"mb-4 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:ce}):null,xe.warning?f.jsx("div",{className:"mb-4 rounded-2xl border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:xe.warning}):null,GR.map((G,Xe)=>{const It=M_(os[G]),Cn=Se[G]??"",li=Cn!==It;return f.jsx(yn,{title:EA[G],description:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Comma-separated shortcuts."}),li?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:" "}),f.jsxs("button",{type:"button",onClick:()=>{an(G)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",It]})]}):null]}),bordered:Xe!==0,children:f.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:f.jsx(Si,{type:"text",value:Cn,onChange:$t=>{const ir=$t.target.value;De(Nc=>({...Nc,[G]:ir}))},onBlur:$t=>{const ir={...Se,[G]:$t.currentTarget.value};De(ir),ct(ir)},onKeyDown:$t=>zt($t,()=>{const ir={...Se,[G]:$t.currentTarget.value};De(ir),ct(ir)}),className:"font-mono"})})},G)})]}):null]}),n.commandError?f.jsxs("div",{className:"mx-auto mt-4 flex max-w-4xl items-start gap-3 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:[f.jsx(lI,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),f.jsx("span",{children:n.commandError})]}):null]})]})]}),Qe?f.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:f.jsx("div",{className:"px-6 py-[14.25px]",children:f.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-xs text-muted-foreground lg:grid-cols-4 lg:gap-3",children:[f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Machine"}),f.jsx("div",{className:"truncate text-foreground/80",children:u})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Connection"}),f.jsx("div",{className:"truncate text-foreground/80",children:n.connectionStatus})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Projects"}),f.jsx("div",{className:"truncate text-foreground/80",children:h})]})}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-baseline gap-1.5 lg:block",children:[f.jsx("div",{className:"uppercase tracking-wide text-[11px] text-muted-foreground/80 lg:mb-1",children:"Version"}),f.jsx("div",{className:"truncate text-foreground/80",children:d})]})})]})})}):null]})}function XR(e){return{submitChatMessage:ka(e.submitChatMessage??""),toggleProjectsSidebar:ka(e.toggleProjectsSidebar??""),toggleEmbeddedTerminal:ka(e.toggleEmbeddedTerminal??""),toggleRightSidebar:ka(e.toggleRightSidebar??""),openInFinder:ka(e.openInFinder??""),openInEditor:ka(e.openInEditor??""),addSplitTerminal:ka(e.addSplitTerminal??"")}}function rre(){const e=typeof navigator<"u"&&navigator.standalone===!0,t=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches;return e||t}function ire(){const e=window.visualViewport,t=Math.round((e==null?void 0:e.height)??window.innerHeight),n=Math.max(0,Math.round((e==null?void 0:e.offsetTop)??0));return{height:t,offsetTop:n}}function sre(){_.useLayoutEffect(()=>{let e=0,t=null,n=0;const r=rre(),s=()=>{e=0;const{height:u,offsetTop:h}=ire();t===null&&(t=h),u>n&&(n=u);const d=Math.max(0,h-t),g=n-u>120||d>12,p=document.documentElement;p.style.setProperty("--app-shell-height",`${u}px`),p.style.setProperty("--app-shell-offset-top",r?g?`max(0px, calc(${d}px - env(safe-area-inset-top)))`:"0px":`${d}px`),p.style.setProperty("--app-composer-bottom-padding",r?g?"0px":"max(12px, env(safe-area-inset-bottom))":g?"12px":"20px")},o=()=>{e!==0&&window.cancelAnimationFrame(e),e=window.requestAnimationFrame(s)};o();const l=window.visualViewport;return window.addEventListener("resize",o),window.addEventListener("orientationchange",o),l==null||l.addEventListener("resize",o),l==null||l.addEventListener("scroll",o),()=>{e!==0&&window.cancelAnimationFrame(e),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),l==null||l.removeEventListener("resize",o),l==null||l.removeEventListener("scroll",o)}},[])}const ore=`${bp}last-seen-version`;function are(e,t){return!(!t||e.defaultPrevented||e.isComposing||aW(e.target))}function lre(){const e=Ki(),t=mT(),n=NY(t.chatId??null),r=Dp("(min-width: 768px)"),s=w2(d=>d.widthPx),o=w2(d=>d.setWidth),l=e.pathname==="/",u=O0.split("/")[1]??"unknown",h=_.useMemo(()=>cx(n.keybindings),[n.keybindings]);return sre(),_.useEffect(()=>{window.localStorage.setItem(ore,u)},[u]),_.useEffect(()=>{function d(g){const p=Oa(h,"toggleProjectsSidebar",g);are(g,p)&&(g.preventDefault(),n.toggleProjectsSidebar(r))}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r,h,n.toggleProjectsSidebar]),f.jsxs("div",{className:"relative flex h-[var(--app-shell-height)] min-h-[var(--app-shell-height)] overflow-hidden",style:{top:"var(--app-shell-offset-top)"},children:[f.jsx(rW,{data:n.sidebarData,completedChatIds:n.completedChatIds,activeChatId:n.activeChatId,connectionStatus:n.connectionStatus,ready:n.sidebarReady,open:n.sidebarOpen,collapsed:n.sidebarCollapsed,isDesktopViewport:r,showMobileOpenButton:l,onOpen:n.openSidebar,onClose:n.closeSidebar,onToggle:n.toggleProjectsSidebar,onCollapse:n.collapseSidebar,onExpand:n.expandSidebar,desktopWidth:s,toggleShortcut:h.bindings.toggleProjectsSidebar,onResizeDesktopWidth:o,onCreateChat:(d,g)=>{n.handleCreateChat(d,g)},onCreateFeature:d=>{n.handleCreateFeature(d)},onRenameFeature:d=>{n.handleRenameFeature(d)},onDeleteFeature:d=>{n.handleDeleteFeature(d)},onSetProjectBrowserState:(d,g)=>{n.handleSetProjectBrowserState(d,g)},onSetProjectGeneralChatsBrowserState:(d,g)=>{n.handleSetProjectGeneralChatsBrowserState(d,g)},onSetFeatureBrowserState:(d,g)=>{n.handleSetFeatureBrowserState(d,g)},onSetFeatureStage:(d,g)=>{n.handleSetFeatureStage(d,g)},onSetChatFeature:(d,g)=>{n.handleSetChatFeature(d,g)},onReorderFeatures:(d,g)=>{n.handleReorderFeatures(d,g)},folderGroupsEnabled:n.folderGroupsEnabled,kanbanStatusesEnabled:n.kanbanStatusesEnabled,onDeleteChat:d=>{n.handleDeleteChat(d)},onRemoveProject:d=>{n.handleRemoveProject(d)},onRefreshProviderUsage:n.handleRefreshProviderUsage,onOpenProviderLogin:d=>{n.handleOpenProviderLogin(d)},providerSettings:n.providerSettings,startingLocalPath:n.startingLocalPath,updateSnapshot:n.updateSnapshot,onInstallUpdate:()=>{n.handleInstallUpdate()}}),f.jsx(a8,{open:n.createFeatureModalProjectId!==null,onOpenChange:d=>{d||n.handleCloseCreateFeatureModal()},onConfirm:d=>n.handleConfirmCreateFeature(d)}),f.jsx(l8,{open:n.cursorCurlImportOpen,onOpenChange:d=>{d||n.handleCloseCursorCurlImport()},onSubmit:d=>n.handleSubmitCursorCurlImport(d)}),f.jsx(CL,{context:n})]})}function cre(){return f.jsx(W9,{children:f.jsxs(i8,{children:[f.jsx(EL,{children:f.jsxs(Gl,{element:f.jsx(lre,{}),children:[f.jsx(Gl,{path:"/",element:f.jsx(Zne,{})}),f.jsx(Gl,{path:"/settings",element:f.jsx(SL,{to:"/settings/general",replace:!0})}),f.jsx(Gl,{path:"/settings/:sectionId",element:f.jsx(nre,{})}),f.jsx(Gl,{path:"/chat/:chatId",element:f.jsx(Une,{})})]})}),f.jsx(Dz,{})]})})}const l3=document.getElementById("root");if(!l3)throw new Error("Missing #root");EO.createRoot(l3).render(f.jsx(_.StrictMode,{children:f.jsx(XL,{children:f.jsx(wG,{children:f.jsx(cre,{})})})}));
|