const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-LfdN0zeE.js","assets/html-C2L_23MC.js","assets/javascript-ySlJ1b_l.js","assets/css-BPhBrDlE.js","assets/angular-ts-CKsD7JZE.js","assets/scss-C31hgJw-.js","assets/apl-BBq3IX1j.js","assets/xml-e3z08dGr.js","assets/java-xI-RfyKK.js","assets/json-BQoSv7ci.js","assets/astro-CqkE3fuf.js","assets/typescript-Dj6nwHGl.js","assets/postcss-B3ZDOciz.js","assets/blade-a8OxSdnT.js","assets/sql-COK4E0Yg.js","assets/bsl-Dgyn0ogV.js","assets/sdbl-BLhTXw86.js","assets/cairo--RitsXJZ.js","assets/python-DhUJRlN_.js","assets/cobol-PTqiYgYu.js","assets/coffee-dyiR41kL.js","assets/cpp-BksuvNSY.js","assets/regexp-DWJ3fJO_.js","assets/glsl-DBO2IWDn.js","assets/c-C3t2pwGQ.js","assets/crystal-DtDmRg-F.js","assets/shellscript-atvbtKCR.js","assets/edge-D5gP-w-T.js","assets/html-derivative-CSfWNPLT.js","assets/elixir-CLiX3zqd.js","assets/elm-CmHSxxaM.js","assets/erb-BYTLMnw6.js","assets/ruby-DeZ3UC14.js","assets/haml-B2EZWmdv.js","assets/graphql-cDcHW_If.js","assets/jsx-BAng5TT0.js","assets/tsx-B6W0miNI.js","assets/lua-CvWAzNxB.js","assets/yaml-CVw76BM1.js","assets/fortran-fixed-form-TqA4NnZg.js","assets/fortran-free-form-DKXYxT9g.js","assets/fsharp-XplgxFYe.js","assets/markdown-UIAJJxZW.js","assets/gdresource-BHYsBjWJ.js","assets/gdshader-SKMF96pI.js","assets/gdscript-DfxzS6Rs.js","assets/git-commit-i4q6IMui.js","assets/diff-BgYniUM_.js","assets/git-rebase-B-v9cOL2.js","assets/glimmer-js-D-cwc0-E.js","assets/glimmer-ts-pgjy16dm.js","assets/hack-D1yCygmZ.js","assets/handlebars-BQGss363.js","assets/http-FRrOvY1W.js","assets/hxml-TIA70rKU.js","assets/haxe-C5wWYbrZ.js","assets/imba-bv_oIlVt.js","assets/jinja-DGy0s7-h.js","assets/jison-BqZprYcd.js","assets/julia-BBuGR-5E.js","assets/r-CwjWoCRV.js","assets/latex-C-cWTeAZ.js","assets/tex-rYs2v40G.js","assets/liquid-D3W5UaiH.js","assets/marko-z0MBrx5-.js","assets/less-BfCpw3nA.js","assets/mdc-DB_EDNY_.js","assets/nginx-D_VnBJ67.js","assets/nim-ZlGxZxc3.js","assets/perl-CHQXSrWU.js","assets/php-B5ebYQev.js","assets/pug-CM9l7STV.js","assets/qml-D8XfuvdV.js","assets/razor-CNLDkMZG.js","assets/csharp-D9R-vmeu.js","assets/rst-4NLicBqY.js","assets/cmake-DbXoA79R.js","assets/sas-BmTFh92c.js","assets/shaderlab-B7qAK45m.js","assets/hlsl-ifBTmRxC.js","assets/shellsession-C_rIy8kc.js","assets/soy-C-lX7w71.js","assets/sparql-bYkjHRlG.js","assets/turtle-BMR_PYu6.js","assets/stata-DorPZHa4.js","assets/svelte-MSaWC3Je.js","assets/templ-dwX3ZSMB.js","assets/go-B1SYOhNW.js","assets/ts-tags-CipyTH0X.js","assets/twig-NC5TFiHP.js","assets/vue-BuYVFjOK.js","assets/vue-html-xdeiXROB.js","assets/xsl-Dd0NUgwM.js"])))=>i.map(i=>d[i]);
var m0e=Object.defineProperty;var jB=e=>{throw TypeError(e)};var p0e=(e,t,n)=>t in e?m0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ue=(e,t,n)=>p0e(e,typeof t!="symbol"?t+"":t,n),NB=(e,t,n)=>t.has(e)||jB("Cannot "+n);var ts=(e,t,n)=>(NB(e,t,"read from private field"),n?n.call(e):t.get(e)),Dd=(e,t,n)=>t.has(e)?jB("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Xi=(e,t,n,r)=>(NB(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var IB=(e,t,n,r)=>({set _(s){Xi(e,t,s,n)},get _(){return ts(e,t,r)}});function g0e(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 i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{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 i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var tk=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function i_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xX={exports:{}},$3={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var b0e=Symbol.for("react.transitional.element"),y0e=Symbol.for("react.fragment");function kX(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var s in t)s!=="key"&&(n[s]=t[s])}else n=t;return t=n.ref,{$$typeof:b0e,type:e,key:r,ref:t!==void 0?t:null,props:n}}$3.Fragment=y0e;$3.jsx=kX;$3.jsxs=kX;xX.exports=$3;var a=xX.exports,_X={exports:{}},Ir={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var RR=Symbol.for("react.transitional.element"),v0e=Symbol.for("react.portal"),w0e=Symbol.for("react.fragment"),x0e=Symbol.for("react.strict_mode"),k0e=Symbol.for("react.profiler"),_0e=Symbol.for("react.consumer"),S0e=Symbol.for("react.context"),C0e=Symbol.for("react.forward_ref"),T0e=Symbol.for("react.suspense"),E0e=Symbol.for("react.memo"),SX=Symbol.for("react.lazy"),A0e=Symbol.for("react.activity"),MB=Symbol.iterator;function j0e(e){return e===null||typeof e!="object"?null:(e=MB&&e[MB]||e["@@iterator"],typeof e=="function"?e:null)}var CX={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},TX=Object.assign,EX={};function Jy(e,t,n){this.props=e,this.context=t,this.refs=EX,this.updater=n||CX}Jy.prototype.isReactComponent={};Jy.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Jy.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function AX(){}AX.prototype=Jy.prototype;function DR(e,t,n){this.props=e,this.context=t,this.refs=EX,this.updater=n||CX}var LR=DR.prototype=new AX;LR.constructor=DR;TX(LR,Jy.prototype);LR.isPureReactComponent=!0;var RB=Array.isArray;function N7(){}var Ri={H:null,A:null,T:null,S:null},jX=Object.prototype.hasOwnProperty;function PR(e,t,n){var r=n.ref;return{$$typeof:RR,type:e,key:t,ref:r!==void 0?r:null,props:n}}function N0e(e,t){return PR(e.type,t,e.props)}function OR(e){return typeof e=="object"&&e!==null&&e.$$typeof===RR}function I0e(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var DB=/\/+/g;function Z8(e,t){return typeof e=="object"&&e!==null&&e.key!=null?I0e(""+e.key):t.toString(36)}function M0e(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(N7,N7):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function db(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case RR:case v0e:o=!0;break;case SX:return o=e._init,db(o(e._payload),t,n,r,s)}}if(o)return s=s(e),o=r===""?"."+Z8(e,0):r,RB(s)?(n="",o!=null&&(n=o.replace(DB,"$&/")+"/"),db(s,t,n,"",function(u){return u})):s!=null&&(OR(s)&&(s=N0e(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(DB,"$&/")+"/")+o)),t.push(s)),1;o=0;var l=r===""?".":r+":";if(RB(e))for(var c=0;c<e.length;c++)r=e[c],i=l+Z8(r,c),o+=db(r,t,n,i,s);else if(c=j0e(e),typeof c=="function")for(e=c.call(e),c=0;!(r=e.next()).done;)r=r.value,i=l+Z8(r,c++),o+=db(r,t,n,i,s);else if(i==="object"){if(typeof e.then=="function")return db(M0e(e),t,n,r,s);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function FS(e,t,n){if(e==null)return e;var r=[],s=0;return db(e,r,"","",function(i){return t.call(n,i,s++)}),r}function R0e(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var LB=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},D0e={map:FS,forEach:function(e,t,n){FS(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return FS(e,function(){t++}),t},toArray:function(e){return FS(e,function(t){return t})||[]},only:function(e){if(!OR(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ir.Activity=A0e;Ir.Children=D0e;Ir.Component=Jy;Ir.Fragment=w0e;Ir.Profiler=k0e;Ir.PureComponent=DR;Ir.StrictMode=x0e;Ir.Suspense=T0e;Ir.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ri;Ir.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Ri.H.useMemoCache(e)}};Ir.cache=function(e){return function(){return e.apply(null,arguments)}};Ir.cacheSignal=function(){return null};Ir.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=TX({},e.props),s=e.key;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)!jX.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(r[i]=t[i]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var o=Array(i),l=0;l<i;l++)o[l]=arguments[l+2];r.children=o}return PR(e.type,s,r)};Ir.createContext=function(e){return e={$$typeof:S0e,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:_0e,_context:e},e};Ir.createElement=function(e,t,n){var r,s={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)jX.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];s.children=l}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)s[r]===void 0&&(s[r]=o[r]);return PR(e,i,s)};Ir.createRef=function(){return{current:null}};Ir.forwardRef=function(e){return{$$typeof:C0e,render:e}};Ir.isValidElement=OR;Ir.lazy=function(e){return{$$typeof:SX,_payload:{_status:-1,_result:e},_init:R0e}};Ir.memo=function(e,t){return{$$typeof:E0e,type:e,compare:t===void 0?null:t}};Ir.startTransition=function(e){var t=Ri.T,n={};Ri.T=n;try{var r=e(),s=Ri.S;s!==null&&s(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(N7,LB)}catch(i){LB(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Ri.T=t}};Ir.unstable_useCacheRefresh=function(){return Ri.H.useCacheRefresh()};Ir.use=function(e){return Ri.H.use(e)};Ir.useActionState=function(e,t,n){return Ri.H.useActionState(e,t,n)};Ir.useCallback=function(e,t){return Ri.H.useCallback(e,t)};Ir.useContext=function(e){return Ri.H.useContext(e)};Ir.useDebugValue=function(){};Ir.useDeferredValue=function(e,t){return Ri.H.useDeferredValue(e,t)};Ir.useEffect=function(e,t){return Ri.H.useEffect(e,t)};Ir.useEffectEvent=function(e){return Ri.H.useEffectEvent(e)};Ir.useId=function(){return Ri.H.useId()};Ir.useImperativeHandle=function(e,t,n){return Ri.H.useImperativeHandle(e,t,n)};Ir.useInsertionEffect=function(e,t){return Ri.H.useInsertionEffect(e,t)};Ir.useLayoutEffect=function(e,t){return Ri.H.useLayoutEffect(e,t)};Ir.useMemo=function(e,t){return Ri.H.useMemo(e,t)};Ir.useOptimistic=function(e,t){return Ri.H.useOptimistic(e,t)};Ir.useReducer=function(e,t,n){return Ri.H.useReducer(e,t,n)};Ir.useRef=function(e){return Ri.H.useRef(e)};Ir.useState=function(e){return Ri.H.useState(e)};Ir.useSyncExternalStore=function(e,t,n){return Ri.H.useSyncExternalStore(e,t,n)};Ir.useTransition=function(){return Ri.H.useTransition()};Ir.version="19.2.4";_X.exports=Ir;var h=_X.exports;const Dn=i_(h),B3=g0e({__proto__:null,default:Dn},[h]);var NX={exports:{}},z3={},IX={exports:{}},MX={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(B,N){var z=B.length;B.push(N);e:for(;0<z;){var G=z-1>>>1,I=B[G];if(0<s(I,N))B[G]=N,B[z]=I,z=G;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var N=B[0],z=B.pop();if(z!==N){B[0]=z;e:for(var G=0,I=B.length,Y=I>>>1;G<Y;){var U=2*(G+1)-1,P=B[U],F=U+1,te=B[F];if(0>s(P,z))F<I&&0>s(te,P)?(B[G]=te,B[F]=z,G=F):(B[G]=P,B[U]=z,G=U);else if(F<I&&0>s(te,z))B[G]=te,B[F]=z,G=F;else break e}}return N}function s(B,N){var z=B.sortIndex-N.sortIndex;return z!==0?z:B.id-N.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,m=3,p=!1,g=!1,b=!1,w=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function k(B){for(var N=n(u);N!==null;){if(N.callback===null)r(u);else if(N.startTime<=B)r(u),N.sortIndex=N.expirationTime,t(c,N);else break;N=n(u)}}function S(B){if(b=!1,k(B),!g)if(n(c)!==null)g=!0,T||(T=!0,D());else{var N=n(u);N!==null&&$(S,N.startTime-B)}}var T=!1,_=-1,C=5,j=-1;function E(){return w?!0:!(e.unstable_now()-j<C)}function L(){if(w=!1,T){var B=e.unstable_now();j=B;var N=!0;try{e:{g=!1,b&&(b=!1,v(_),_=-1),p=!0;var z=m;try{t:{for(k(B),f=n(c);f!==null&&!(f.expirationTime>B&&E());){var G=f.callback;if(typeof G=="function"){f.callback=null,m=f.priorityLevel;var I=G(f.expirationTime<=B);if(B=e.unstable_now(),typeof I=="function"){f.callback=I,k(B),N=!0;break t}f===n(c)&&r(c),k(B)}else r(c);f=n(c)}if(f!==null)N=!0;else{var Y=n(u);Y!==null&&$(S,Y.startTime-B),N=!1}}break e}finally{f=null,m=z,p=!1}N=void 0}}finally{N?D():T=!1}}}var D;if(typeof x=="function")D=function(){x(L)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,R=M.port2;M.port1.onmessage=L,D=function(){R.postMessage(null)}}else D=function(){y(L,0)};function $(B,N){_=y(function(){B(e.unstable_now())},N)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(B){switch(m){case 1:case 2:case 3:var N=3;break;default:N=m}var z=m;m=N;try{return B()}finally{m=z}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(B,N){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var z=m;m=B;try{return N()}finally{m=z}},e.unstable_scheduleCallback=function(B,N,z){var G=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?G+z:G):z=G,B){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=z+I,B={id:d++,callback:N,priorityLevel:B,startTime:z,expirationTime:I,sortIndex:-1},z>G?(B.sortIndex=z,t(u,B),n(c)===null&&B===n(u)&&(b?(v(_),_=-1):b=!0,$(S,z-G))):(B.sortIndex=I,t(c,B),g||p||(g=!0,T||(T=!0,D()))),B},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(B){var N=m;return function(){var z=m;m=N;try{return B.apply(this,arguments)}finally{m=z}}}})(MX);IX.exports=MX;var L0e=IX.exports,RX={exports:{}},Jl={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var P0e=h;function DX(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function _m(){}var Kl={d:{f:_m,r:function(){throw Error(DX(522))},D:_m,C:_m,L:_m,m:_m,X:_m,S:_m,M:_m},p:0,findDOMNode:null},O0e=Symbol.for("react.portal");function $0e(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O0e,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var vx=P0e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function F3(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Jl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Kl;Jl.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(DX(299));return $0e(e,t,null,n)};Jl.flushSync=function(e){var t=vx.T,n=Kl.p;try{if(vx.T=null,Kl.p=2,e)return e()}finally{vx.T=t,Kl.p=n,Kl.d.f()}};Jl.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Kl.d.C(e,t))};Jl.prefetchDNS=function(e){typeof e=="string"&&Kl.d.D(e)};Jl.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=F3(n,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Kl.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:i}):n==="script"&&Kl.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Jl.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=F3(t.as,t.crossOrigin);Kl.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Kl.d.M(e)};Jl.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=F3(n,t.crossOrigin);Kl.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Jl.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=F3(t.as,t.crossOrigin);Kl.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Kl.d.m(e)};Jl.requestFormReset=function(e){Kl.d.r(e)};Jl.unstable_batchedUpdates=function(e,t){return e(t)};Jl.useFormState=function(e,t,n){return vx.H.useFormState(e,t,n)};Jl.useFormStatus=function(){return vx.H.useHostTransitionStatus()};Jl.version="19.2.4";function LX(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(LX)}catch(e){console.error(e)}}LX(),RX.exports=Jl;var xd=RX.exports;/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ma=L0e,PX=h,B0e=xd;function wt(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function OX(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o_(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function $X(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function BX(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function PB(e){if(o_(e)!==e)throw Error(wt(188))}function z0e(e){var t=e.alternate;if(!t){if(t=o_(e),t===null)throw Error(wt(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return PB(s),e;if(i===r)return PB(s),t;i=i.sibling}throw Error(wt(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(wt(189))}}if(n.alternate!==r)throw Error(wt(190))}if(n.tag!==3)throw Error(wt(188));return n.stateNode.current===n?e:t}function zX(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=zX(e),t!==null)return t;e=e.sibling}return null}var Di=Object.assign,F0e=Symbol.for("react.element"),qS=Symbol.for("react.transitional.element"),Xw=Symbol.for("react.portal"),xb=Symbol.for("react.fragment"),FX=Symbol.for("react.strict_mode"),I7=Symbol.for("react.profiler"),qX=Symbol.for("react.consumer"),yf=Symbol.for("react.context"),$R=Symbol.for("react.forward_ref"),M7=Symbol.for("react.suspense"),R7=Symbol.for("react.suspense_list"),BR=Symbol.for("react.memo"),Om=Symbol.for("react.lazy"),D7=Symbol.for("react.activity"),q0e=Symbol.for("react.memo_cache_sentinel"),OB=Symbol.iterator;function gw(e){return e===null||typeof e!="object"?null:(e=OB&&e[OB]||e["@@iterator"],typeof e=="function"?e:null)}var H0e=Symbol.for("react.client.reference");function L7(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===H0e?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case xb:return"Fragment";case I7:return"Profiler";case FX:return"StrictMode";case M7:return"Suspense";case R7:return"SuspenseList";case D7:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Xw:return"Portal";case yf:return e.displayName||"Context";case qX:return(e._context.displayName||"Context")+".Consumer";case $R:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case BR:return t=e.displayName||null,t!==null?t:L7(e.type)||"Memo";case Om:t=e._payload,e=e._init;try{return L7(e(t))}catch{}}return null}var Qw=Array.isArray,yr=PX.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ws=B0e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_g={pending:!1,data:null,method:null,action:null},P7=[],kb=-1;function Eh(e){return{current:e}}function za(e){0>kb||(e.current=P7[kb],P7[kb]=null,kb--)}function Ei(e,t){kb++,P7[kb]=e.current,e.current=t}var vh=Eh(null),nk=Eh(null),up=Eh(null),D4=Eh(null);function L4(e,t){switch(Ei(up,t),Ei(nk,e),Ei(vh,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Hz(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Hz(t),e=lZ(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}za(vh),Ei(vh,e)}function dy(){za(vh),za(nk),za(up)}function O7(e){e.memoizedState!==null&&Ei(D4,e);var t=vh.current,n=lZ(t,e.type);t!==n&&(Ei(nk,e),Ei(vh,n))}function P4(e){nk.current===e&&(za(vh),za(nk)),D4.current===e&&(za(D4),fk._currentValue=_g)}var eE,$B;function Z0(e){if(eE===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);eE=t&&t[1]||"",$B=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+eE+e+$B}var tE=!1;function nE(e,t){if(!e||tE)return"";tE=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(p){var m=p}Reflect.construct(e,[],f)}else{try{f.call()}catch(p){m=p}e.call(f.prototype)}}else{try{throw Error()}catch(p){m=p}(f=e())&&typeof f.catch=="function"&&f.catch(function(){})}}catch(p){if(p&&m&&typeof p.stack=="string")return[p.stack,m.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],l=i[1];if(o&&l){var c=o.split(`
`),u=l.split(`
`);for(s=r=0;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;for(;s<u.length&&!u[s].includes("DetermineComponentFrameRoot");)s++;if(r===c.length||s===u.length)for(r=c.length-1,s=u.length-1;1<=r&&0<=s&&c[r]!==u[s];)s--;for(;1<=r&&0<=s;r--,s--)if(c[r]!==u[s]){if(r!==1||s!==1)do if(r--,s--,0>s||c[r]!==u[s]){var d=`
`+c[r].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=r&&0<=s);break}}}finally{tE=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Z0(n):""}function U0e(e,t){switch(e.tag){case 26:case 27:case 5:return Z0(e.type);case 16:return Z0("Lazy");case 13:return e.child!==t&&t!==null?Z0("Suspense Fallback"):Z0("Suspense");case 19:return Z0("SuspenseList");case 0:case 15:return nE(e.type,!1);case 11:return nE(e.type.render,!1);case 1:return nE(e.type,!0);case 31:return Z0("Activity");default:return""}}function BB(e){try{var t="",n=null;do t+=U0e(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
Error generating stack: `+r.message+`
`+r.stack}}var $7=Object.prototype.hasOwnProperty,zR=ma.unstable_scheduleCallback,rE=ma.unstable_cancelCallback,W0e=ma.unstable_shouldYield,V0e=ma.unstable_requestPaint,Wc=ma.unstable_now,G0e=ma.unstable_getCurrentPriorityLevel,HX=ma.unstable_ImmediatePriority,UX=ma.unstable_UserBlockingPriority,O4=ma.unstable_NormalPriority,K0e=ma.unstable_LowPriority,WX=ma.unstable_IdlePriority,Y0e=ma.log,X0e=ma.unstable_setDisableYieldValue,a_=null,Vc=null;function Ym(e){if(typeof Y0e=="function"&&X0e(e),Vc&&typeof Vc.setStrictMode=="function")try{Vc.setStrictMode(a_,e)}catch{}}var Gc=Math.clz32?Math.clz32:Z0e,Q0e=Math.log,J0e=Math.LN2;function Z0e(e){return e>>>=0,e===0?32:31-(Q0e(e)/J0e|0)|0}var HS=256,US=262144,WS=4194304;function eg(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function q3(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var s=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~i,r!==0?s=eg(r):(o&=l,o!==0?s=eg(o):n||(n=l&~e,n!==0&&(s=eg(n))))):(l=r&~i,l!==0?s=eg(l):o!==0?s=eg(o):n||(n=r&~e,n!==0&&(s=eg(n)))),s===0?0:t!==0&&t!==s&&!(t&i)&&(i=s&-s,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:s}function l_(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ege(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function VX(){var e=WS;return WS<<=1,!(WS&62914560)&&(WS=4194304),e}function sE(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function c_(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tge(e,t,n,r,s,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-Gc(n),f=1<<d;l[d]=0,c[d]=-1;var m=u[d];if(m!==null)for(u[d]=null,d=0;d<m.length;d++){var p=m[d];p!==null&&(p.lane&=-536870913)}n&=~f}r!==0&&GX(e,r,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function GX(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Gc(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function KX(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Gc(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}function YX(e,t){var n=t&-t;return n=n&42?1:FR(n),n&(e.suspendedLanes|t)?0:n}function FR(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function qR(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function XX(){var e=Ws.p;return e!==0?e:(e=window.event,e===void 0?32:vZ(e.type))}function zB(e,t){var n=Ws.p;try{return Ws.p=e,t()}finally{Ws.p=n}}var r0=Math.random().toString(36).slice(2),ol="__reactFiber$"+r0,vc="__reactProps$"+r0,Zy="__reactContainer$"+r0,B7="__reactEvents$"+r0,nge="__reactListeners$"+r0,rge="__reactHandles$"+r0,FB="__reactResources$"+r0,u_="__reactMarker$"+r0;function HR(e){delete e[ol],delete e[vc],delete e[B7],delete e[nge],delete e[rge]}function _b(e){var t=e[ol];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Zy]||n[ol]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Kz(e);e!==null;){if(n=e[ol])return n;e=Kz(e)}return t}e=n,n=e.parentNode}return null}function ev(e){if(e=e[ol]||e[Zy]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Jw(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(wt(33))}function qb(e){var t=e[FB];return t||(t=e[FB]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Pa(e){e[u_]=!0}var QX=new Set,JX={};function t1(e,t){hy(e,t),hy(e+"Capture",t)}function hy(e,t){for(JX[e]=t,e=0;e<t.length;e++)QX.add(t[e])}var sge=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]*$"),qB={},HB={};function ige(e){return $7.call(HB,e)?!0:$7.call(qB,e)?!1:sge.test(e)?HB[e]=!0:(qB[e]=!0,!1)}function DC(e,t,n){if(ige(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function VS(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Qh(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+r)}}function yu(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ZX(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function oge(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function z7(e){if(!e._valueTracker){var t=ZX(e)?"checked":"value";e._valueTracker=oge(e,t,""+e[t])}}function eQ(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ZX(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function $4(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var age=/[\n"\\]/g;function Su(e){return e.replace(age,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function F7(e,t,n,r,s,i,o,l){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+yu(t)):e.value!==""+yu(t)&&(e.value=""+yu(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?q7(e,o,yu(t)):n!=null?q7(e,o,yu(n)):r!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+yu(l):e.removeAttribute("name")}function tQ(e,t,n,r,s,i,o,l){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){z7(e);return}n=n!=null?""+yu(n):"",t=t!=null?""+yu(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r=r??s,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),z7(e)}function q7(e,t,n){t==="number"&&$4(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Hb(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+yu(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function nQ(e,t,n){if(t!=null&&(t=""+yu(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+yu(n):""}function rQ(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(wt(92));if(Qw(r)){if(1<r.length)throw Error(wt(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=yu(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),z7(e)}function fy(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var lge=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 UB(e,t,n){var r=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,n):typeof n!="number"||n===0||lge.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function sQ(e,t,n){if(t!=null&&typeof t!="object")throw Error(wt(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var s in t)r=t[s],t.hasOwnProperty(s)&&n[s]!==r&&UB(e,s,r)}else for(var i in t)t.hasOwnProperty(i)&&UB(e,i,t[i])}function UR(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var cge=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"]]),uge=/^[\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 LC(e){return uge.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function vf(){}var H7=null;function WR(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Sb=null,Ub=null;function WB(e){var t=ev(e);if(t&&(e=t.stateNode)){var n=e[vc]||null;e:switch(e=t.stateNode,t.type){case"input":if(F7(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Su(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=r[vc]||null;if(!s)throw Error(wt(90));F7(r,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&eQ(r)}break e;case"textarea":nQ(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Hb(e,!!n.multiple,t,!1)}}}var iE=!1;function iQ(e,t,n){if(iE)return e(t,n);iE=!0;try{var r=e(t);return r}finally{if(iE=!1,(Sb!==null||Ub!==null)&&(e5(),Sb&&(t=Sb,e=Ub,Ub=Sb=null,WB(t),e)))for(t=0;t<e.length;t++)WB(e[t])}}function rk(e,t){var n=e.stateNode;if(n===null)return null;var r=n[vc]||null;if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(wt(231,t,typeof n));return n}var $f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),U7=!1;if($f)try{var bw={};Object.defineProperty(bw,"passive",{get:function(){U7=!0}}),window.addEventListener("test",bw,bw),window.removeEventListener("test",bw,bw)}catch{U7=!1}var Xm=null,VR=null,PC=null;function oQ(){if(PC)return PC;var e,t=VR,n=t.length,r,s="value"in Xm?Xm.value:Xm.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return PC=s.slice(e,1<r?1-r:void 0)}function OC(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function GS(){return!0}function VB(){return!1}function xc(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?GS:VB,this.isPropagationStopped=VB,this}return Di(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=GS)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=GS)},persist:function(){},isPersistent:GS}),t}var n1={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},H3=xc(n1),d_=Di({},n1,{view:0,detail:0}),dge=xc(d_),oE,aE,yw,U3=Di({},d_,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:GR,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==yw&&(yw&&e.type==="mousemove"?(oE=e.screenX-yw.screenX,aE=e.screenY-yw.screenY):aE=oE=0,yw=e),oE)},movementY:function(e){return"movementY"in e?e.movementY:aE}}),GB=xc(U3),hge=Di({},U3,{dataTransfer:0}),fge=xc(hge),mge=Di({},d_,{relatedTarget:0}),lE=xc(mge),pge=Di({},n1,{animationName:0,elapsedTime:0,pseudoElement:0}),gge=xc(pge),bge=Di({},n1,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yge=xc(bge),vge=Di({},n1,{data:0}),KB=xc(vge),wge={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xge={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"},kge={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _ge(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kge[e])?!!t[e]:!1}function GR(){return _ge}var Sge=Di({},d_,{key:function(e){if(e.key){var t=wge[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=OC(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?xge[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:GR,charCode:function(e){return e.type==="keypress"?OC(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?OC(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Cge=xc(Sge),Tge=Di({},U3,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),YB=xc(Tge),Ege=Di({},d_,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:GR}),Age=xc(Ege),jge=Di({},n1,{propertyName:0,elapsedTime:0,pseudoElement:0}),Nge=xc(jge),Ige=Di({},U3,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Mge=xc(Ige),Rge=Di({},n1,{newState:0,oldState:0}),Dge=xc(Rge),Lge=[9,13,27,32],KR=$f&&"CompositionEvent"in window,wx=null;$f&&"documentMode"in document&&(wx=document.documentMode);var Pge=$f&&"TextEvent"in window&&!wx,aQ=$f&&(!KR||wx&&8<wx&&11>=wx),XB=" ",QB=!1;function lQ(e,t){switch(e){case"keyup":return Lge.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cQ(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Cb=!1;function Oge(e,t){switch(e){case"compositionend":return cQ(t);case"keypress":return t.which!==32?null:(QB=!0,XB);case"textInput":return e=t.data,e===XB&&QB?null:e;default:return null}}function $ge(e,t){if(Cb)return e==="compositionend"||!KR&&lQ(e,t)?(e=oQ(),PC=VR=Xm=null,Cb=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return aQ&&t.locale!=="ko"?null:t.data;default:return null}}var Bge={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 JB(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Bge[e.type]:t==="textarea"}function uQ(e,t,n,r){Sb?Ub?Ub.push(r):Ub=[r]:Sb=r,t=nT(t,"onChange"),0<t.length&&(n=new H3("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var xx=null,sk=null;function zge(e){iZ(e,0)}function W3(e){var t=Jw(e);if(eQ(t))return e}function ZB(e,t){if(e==="change")return t}var dQ=!1;if($f){var cE;if($f){var uE="oninput"in document;if(!uE){var ez=document.createElement("div");ez.setAttribute("oninput","return;"),uE=typeof ez.oninput=="function"}cE=uE}else cE=!1;dQ=cE&&(!document.documentMode||9<document.documentMode)}function tz(){xx&&(xx.detachEvent("onpropertychange",hQ),sk=xx=null)}function hQ(e){if(e.propertyName==="value"&&W3(sk)){var t=[];uQ(t,sk,e,WR(e)),iQ(zge,t)}}function Fge(e,t,n){e==="focusin"?(tz(),xx=t,sk=n,xx.attachEvent("onpropertychange",hQ)):e==="focusout"&&tz()}function qge(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return W3(sk)}function Hge(e,t){if(e==="click")return W3(t)}function Uge(e,t){if(e==="input"||e==="change")return W3(t)}function Wge(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Qc=typeof Object.is=="function"?Object.is:Wge;function ik(e,t){if(Qc(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!$7.call(t,s)||!Qc(e[s],t[s]))return!1}return!0}function nz(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function rz(e,t){var n=nz(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=nz(n)}}function fQ(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?fQ(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mQ(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=$4(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=$4(e.document)}return t}function YR(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Vge=$f&&"documentMode"in document&&11>=document.documentMode,Tb=null,W7=null,kx=null,V7=!1;function sz(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;V7||Tb==null||Tb!==$4(r)||(r=Tb,"selectionStart"in r&&YR(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kx&&ik(kx,r)||(kx=r,r=nT(W7,"onSelect"),0<r.length&&(t=new H3("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Tb)))}function F0(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Eb={animationend:F0("Animation","AnimationEnd"),animationiteration:F0("Animation","AnimationIteration"),animationstart:F0("Animation","AnimationStart"),transitionrun:F0("Transition","TransitionRun"),transitionstart:F0("Transition","TransitionStart"),transitioncancel:F0("Transition","TransitionCancel"),transitionend:F0("Transition","TransitionEnd")},dE={},pQ={};$f&&(pQ=document.createElement("div").style,"AnimationEvent"in window||(delete Eb.animationend.animation,delete Eb.animationiteration.animation,delete Eb.animationstart.animation),"TransitionEvent"in window||delete Eb.transitionend.transition);function r1(e){if(dE[e])return dE[e];if(!Eb[e])return e;var t=Eb[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in pQ)return dE[e]=t[n];return e}var gQ=r1("animationend"),bQ=r1("animationiteration"),yQ=r1("animationstart"),Gge=r1("transitionrun"),Kge=r1("transitionstart"),Yge=r1("transitioncancel"),vQ=r1("transitionend"),wQ=new Map,G7="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(" ");G7.push("scrollEnd");function kd(e,t){wQ.set(e,t),t1(t,[e])}var B4=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},gu=[],Ab=0,XR=0;function V3(){for(var e=Ab,t=XR=Ab=0;t<e;){var n=gu[t];gu[t++]=null;var r=gu[t];gu[t++]=null;var s=gu[t];gu[t++]=null;var i=gu[t];if(gu[t++]=null,r!==null&&s!==null){var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}i!==0&&xQ(n,s,i)}}function G3(e,t,n,r){gu[Ab++]=e,gu[Ab++]=t,gu[Ab++]=n,gu[Ab++]=r,XR|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function QR(e,t,n,r){return G3(e,t,n,r),z4(e)}function s1(e,t){return G3(e,null,null,t),z4(e)}function xQ(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var s=!1,i=e.return;i!==null;)i.childLanes|=n,r=i.alternate,r!==null&&(r.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(s=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,s&&t!==null&&(s=31-Gc(n),e=i.hiddenUpdates,r=e[s],r===null?e[s]=[t]:r.push(t),t.lane=n|536870912),i):null}function z4(e){if(50<Ix)throw Ix=0,mN=null,Error(wt(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var jb={};function Xge(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fc(e,t,n,r){return new Xge(e,t,n,r)}function JR(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Tf(e,t){var n=e.alternate;return n===null?(n=Fc(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function kQ(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function $C(e,t,n,r,s,i){var o=0;if(r=e,typeof e=="function")JR(e)&&(o=1);else if(typeof e=="string")o=tbe(e,n,vh.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case D7:return e=Fc(31,n,t,s),e.elementType=D7,e.lanes=i,e;case xb:return Sg(n.children,s,i,t);case FX:o=8,s|=24;break;case I7:return e=Fc(12,n,t,s|2),e.elementType=I7,e.lanes=i,e;case M7:return e=Fc(13,n,t,s),e.elementType=M7,e.lanes=i,e;case R7:return e=Fc(19,n,t,s),e.elementType=R7,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case yf:o=10;break e;case qX:o=9;break e;case $R:o=11;break e;case BR:o=14;break e;case Om:o=16,r=null;break e}o=29,n=Error(wt(130,e===null?"null":typeof e,"")),r=null}return t=Fc(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Sg(e,t,n,r){return e=Fc(7,e,r,t),e.lanes=n,e}function hE(e,t,n){return e=Fc(6,e,null,t),e.lanes=n,e}function _Q(e){var t=Fc(18,null,null,0);return t.stateNode=e,t}function fE(e,t,n){return t=Fc(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var iz=new WeakMap;function Cu(e,t){if(typeof e=="object"&&e!==null){var n=iz.get(e);return n!==void 0?n:(t={value:e,source:t,stack:BB(t)},iz.set(e,t),t)}return{value:e,source:t,stack:BB(t)}}var Nb=[],Ib=0,F4=null,ok=0,vu=[],wu=0,Ep=null,lh=1,ch="";function cf(e,t){Nb[Ib++]=ok,Nb[Ib++]=F4,F4=e,ok=t}function SQ(e,t,n){vu[wu++]=lh,vu[wu++]=ch,vu[wu++]=Ep,Ep=e;var r=lh;e=ch;var s=32-Gc(r)-1;r&=~(1<<s),n+=1;var i=32-Gc(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,lh=1<<32-Gc(t)+s|n<<s|r,ch=i+e}else lh=1<<i|n<<s|r,ch=e}function ZR(e){e.return!==null&&(cf(e,1),SQ(e,1,0))}function e9(e){for(;e===F4;)F4=Nb[--Ib],Nb[Ib]=null,ok=Nb[--Ib],Nb[Ib]=null;for(;e===Ep;)Ep=vu[--wu],vu[wu]=null,ch=vu[--wu],vu[wu]=null,lh=vu[--wu],vu[wu]=null}function CQ(e,t){vu[wu++]=lh,vu[wu++]=ch,vu[wu++]=Ep,lh=t.id,ch=t.overflow,Ep=e}var al=null,Mi=null,bs=!1,dp=null,Tu=!1,K7=Error(wt(519));function Ap(e){var t=Error(wt(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ak(Cu(t,e)),K7}function oz(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ol]=e,t[vc]=r,n){case"dialog":ns("cancel",t),ns("close",t);break;case"iframe":case"object":case"embed":ns("load",t);break;case"video":case"audio":for(n=0;n<dk.length;n++)ns(dk[n],t);break;case"source":ns("error",t);break;case"img":case"image":case"link":ns("error",t),ns("load",t);break;case"details":ns("toggle",t);break;case"input":ns("invalid",t),tQ(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":ns("invalid",t);break;case"textarea":ns("invalid",t),rQ(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||aZ(t.textContent,n)?(r.popover!=null&&(ns("beforetoggle",t),ns("toggle",t)),r.onScroll!=null&&ns("scroll",t),r.onScrollEnd!=null&&ns("scrollend",t),r.onClick!=null&&(t.onclick=vf),t=!0):t=!1,t||Ap(e,!0)}function az(e){for(al=e.return;al;)switch(al.tag){case 5:case 31:case 13:Tu=!1;return;case 27:case 3:Tu=!0;return;default:al=al.return}}function q1(e){if(e!==al)return!1;if(!bs)return az(e),bs=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||vN(e.type,e.memoizedProps)),n=!n),n&&Mi&&Ap(e),az(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(wt(317));Mi=Gz(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(wt(317));Mi=Gz(e)}else t===27?(t=Mi,s0(e.type)?(e=_N,_N=null,Mi=e):Mi=t):Mi=al?Ou(e.stateNode.nextSibling):null;return!0}function Rg(){Mi=al=null,bs=!1}function mE(){var e=dp;return e!==null&&(ac===null?ac=e:ac.push.apply(ac,e),dp=null),e}function ak(e){dp===null?dp=[e]:dp.push(e)}var Y7=Eh(null),i1=null,wf=null;function Hm(e,t,n){Ei(Y7,t._currentValue),t._currentValue=n}function Ef(e){e._currentValue=Y7.current,za(Y7)}function X7(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Q7(e,t,n,r){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var o=s.child;i=i.firstContext;e:for(;i!==null;){var l=i;i=s;for(var c=0;c<t.length;c++)if(l.context===t[c]){i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),X7(i.return,n,e),r||(o=null);break e}i=l.next}}else if(s.tag===18){if(o=s.return,o===null)throw Error(wt(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),X7(o,n,e),o=null}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}}function tv(e,t,n,r){e=null;for(var s=t,i=!1;s!==null;){if(!i){if(s.flags&524288)i=!0;else if(s.flags&262144)break}if(s.tag===10){var o=s.alternate;if(o===null)throw Error(wt(387));if(o=o.memoizedProps,o!==null){var l=s.type;Qc(s.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(s===D4.current){if(o=s.alternate,o===null)throw Error(wt(387));o.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(fk):e=[fk])}s=s.return}e!==null&&Q7(t,e,n,r),t.flags|=262144}function q4(e){for(e=e.firstContext;e!==null;){if(!Qc(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Dg(e){i1=e,wf=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ll(e){return TQ(i1,e)}function KS(e,t){return i1===null&&Dg(e),TQ(e,t)}function TQ(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},wf===null){if(e===null)throw Error(wt(308));wf=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else wf=wf.next=t;return n}var Qge=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},Jge=ma.unstable_scheduleCallback,Zge=ma.unstable_NormalPriority,qo={$$typeof:yf,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function t9(){return{controller:new Qge,data:new Map,refCount:0}}function h_(e){e.refCount--,e.refCount===0&&Jge(Zge,function(){e.controller.abort()})}var _x=null,J7=0,my=0,Wb=null;function e1e(e,t){if(_x===null){var n=_x=[];J7=0,my=T9(),Wb={status:"pending",value:void 0,then:function(r){n.push(r)}}}return J7++,t.then(lz,lz),t}function lz(){if(--J7===0&&_x!==null){Wb!==null&&(Wb.status="fulfilled");var e=_x;_x=null,my=0,Wb=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function t1e(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(r.status="rejected",r.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),r}var cz=yr.S;yr.S=function(e,t){zJ=Wc(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&e1e(e,t),cz!==null&&cz(e,t)};var Cg=Eh(null);function n9(){var e=Cg.current;return e!==null?e:xi.pooledCache}function BC(e,t){t===null?Ei(Cg,Cg.current):Ei(Cg,t.pool)}function EQ(){var e=n9();return e===null?null:{parent:qo._currentValue,pool:e}}var nv=Error(wt(460)),r9=Error(wt(474)),K3=Error(wt(542)),H4={then:function(){}};function uz(e){return e=e.status,e==="fulfilled"||e==="rejected"}function AQ(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(vf,vf),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hz(e),e;default:if(typeof t.status=="string")t.then(vf,vf);else{if(e=xi,e!==null&&100<e.shellSuspendCounter)throw Error(wt(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=r}},function(r){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hz(e),e}throw Tg=t,nv}}function tg(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Tg=n,nv):n}}var Tg=null;function dz(){if(Tg===null)throw Error(wt(459));var e=Tg;return Tg=null,e}function hz(e){if(e===nv||e===K3)throw Error(wt(483))}var Vb=null,lk=0;function YS(e){var t=lk;return lk+=1,Vb===null&&(Vb=[]),AQ(Vb,e,t)}function vw(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function XS(e,t){throw t.$$typeof===F0e?Error(wt(525)):(e=Object.prototype.toString.call(t),Error(wt(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function jQ(e){function t(y,v){if(e){var x=y.deletions;x===null?(y.deletions=[v],y.flags|=16):x.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function r(y){for(var v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function s(y,v){return y=Tf(y,v),y.index=0,y.sibling=null,y}function i(y,v,x){return y.index=x,e?(x=y.alternate,x!==null?(x=x.index,x<v?(y.flags|=67108866,v):x):(y.flags|=67108866,v)):(y.flags|=1048576,v)}function o(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function l(y,v,x,k){return v===null||v.tag!==6?(v=hE(x,y.mode,k),v.return=y,v):(v=s(v,x),v.return=y,v)}function c(y,v,x,k){var S=x.type;return S===xb?d(y,v,x.props.children,k,x.key):v!==null&&(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Om&&tg(S)===v.type)?(v=s(v,x.props),vw(v,x),v.return=y,v):(v=$C(x.type,x.key,x.props,null,y.mode,k),vw(v,x),v.return=y,v)}function u(y,v,x,k){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=fE(x,y.mode,k),v.return=y,v):(v=s(v,x.children||[]),v.return=y,v)}function d(y,v,x,k,S){return v===null||v.tag!==7?(v=Sg(x,y.mode,k,S),v.return=y,v):(v=s(v,x),v.return=y,v)}function f(y,v,x){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=hE(""+v,y.mode,x),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case qS:return x=$C(v.type,v.key,v.props,null,y.mode,x),vw(x,v),x.return=y,x;case Xw:return v=fE(v,y.mode,x),v.return=y,v;case Om:return v=tg(v),f(y,v,x)}if(Qw(v)||gw(v))return v=Sg(v,y.mode,x,null),v.return=y,v;if(typeof v.then=="function")return f(y,YS(v),x);if(v.$$typeof===yf)return f(y,KS(y,v),x);XS(y,v)}return null}function m(y,v,x,k){var S=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return S!==null?null:l(y,v,""+x,k);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case qS:return x.key===S?c(y,v,x,k):null;case Xw:return x.key===S?u(y,v,x,k):null;case Om:return x=tg(x),m(y,v,x,k)}if(Qw(x)||gw(x))return S!==null?null:d(y,v,x,k,null);if(typeof x.then=="function")return m(y,v,YS(x),k);if(x.$$typeof===yf)return m(y,v,KS(y,x),k);XS(y,x)}return null}function p(y,v,x,k,S){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return y=y.get(x)||null,l(v,y,""+k,S);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case qS:return y=y.get(k.key===null?x:k.key)||null,c(v,y,k,S);case Xw:return y=y.get(k.key===null?x:k.key)||null,u(v,y,k,S);case Om:return k=tg(k),p(y,v,x,k,S)}if(Qw(k)||gw(k))return y=y.get(x)||null,d(v,y,k,S,null);if(typeof k.then=="function")return p(y,v,x,YS(k),S);if(k.$$typeof===yf)return p(y,v,x,KS(v,k),S);XS(v,k)}return null}function g(y,v,x,k){for(var S=null,T=null,_=v,C=v=0,j=null;_!==null&&C<x.length;C++){_.index>C?(j=_,_=null):j=_.sibling;var E=m(y,_,x[C],k);if(E===null){_===null&&(_=j);break}e&&_&&E.alternate===null&&t(y,_),v=i(E,v,C),T===null?S=E:T.sibling=E,T=E,_=j}if(C===x.length)return n(y,_),bs&&cf(y,C),S;if(_===null){for(;C<x.length;C++)_=f(y,x[C],k),_!==null&&(v=i(_,v,C),T===null?S=_:T.sibling=_,T=_);return bs&&cf(y,C),S}for(_=r(_);C<x.length;C++)j=p(_,y,C,x[C],k),j!==null&&(e&&j.alternate!==null&&_.delete(j.key===null?C:j.key),v=i(j,v,C),T===null?S=j:T.sibling=j,T=j);return e&&_.forEach(function(L){return t(y,L)}),bs&&cf(y,C),S}function b(y,v,x,k){if(x==null)throw Error(wt(151));for(var S=null,T=null,_=v,C=v=0,j=null,E=x.next();_!==null&&!E.done;C++,E=x.next()){_.index>C?(j=_,_=null):j=_.sibling;var L=m(y,_,E.value,k);if(L===null){_===null&&(_=j);break}e&&_&&L.alternate===null&&t(y,_),v=i(L,v,C),T===null?S=L:T.sibling=L,T=L,_=j}if(E.done)return n(y,_),bs&&cf(y,C),S;if(_===null){for(;!E.done;C++,E=x.next())E=f(y,E.value,k),E!==null&&(v=i(E,v,C),T===null?S=E:T.sibling=E,T=E);return bs&&cf(y,C),S}for(_=r(_);!E.done;C++,E=x.next())E=p(_,y,C,E.value,k),E!==null&&(e&&E.alternate!==null&&_.delete(E.key===null?C:E.key),v=i(E,v,C),T===null?S=E:T.sibling=E,T=E);return e&&_.forEach(function(D){return t(y,D)}),bs&&cf(y,C),S}function w(y,v,x,k){if(typeof x=="object"&&x!==null&&x.type===xb&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case qS:e:{for(var S=x.key;v!==null;){if(v.key===S){if(S=x.type,S===xb){if(v.tag===7){n(y,v.sibling),k=s(v,x.props.children),k.return=y,y=k;break e}}else if(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Om&&tg(S)===v.type){n(y,v.sibling),k=s(v,x.props),vw(k,x),k.return=y,y=k;break e}n(y,v);break}else t(y,v);v=v.sibling}x.type===xb?(k=Sg(x.props.children,y.mode,k,x.key),k.return=y,y=k):(k=$C(x.type,x.key,x.props,null,y.mode,k),vw(k,x),k.return=y,y=k)}return o(y);case Xw:e:{for(S=x.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(y,v.sibling),k=s(v,x.children||[]),k.return=y,y=k;break e}else{n(y,v);break}else t(y,v);v=v.sibling}k=fE(x,y.mode,k),k.return=y,y=k}return o(y);case Om:return x=tg(x),w(y,v,x,k)}if(Qw(x))return g(y,v,x,k);if(gw(x)){if(S=gw(x),typeof S!="function")throw Error(wt(150));return x=S.call(x),b(y,v,x,k)}if(typeof x.then=="function")return w(y,v,YS(x),k);if(x.$$typeof===yf)return w(y,v,KS(y,x),k);XS(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(y,v.sibling),k=s(v,x),k.return=y,y=k):(n(y,v),k=hE(x,y.mode,k),k.return=y,y=k),o(y)):n(y,v)}return function(y,v,x,k){try{lk=0;var S=w(y,v,x,k);return Vb=null,S}catch(_){if(_===nv||_===K3)throw _;var T=Fc(29,_,null,y.mode);return T.lanes=k,T.return=y,T}finally{}}}var Lg=jQ(!0),NQ=jQ(!1),$m=!1;function s9(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Z7(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function hp(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fp(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qs&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,t=z4(e),xQ(e,null,n),t}return G3(e,r,t,n),z4(e)}function Sx(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,KX(e,n)}}function pE(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var eN=!1;function Cx(){if(eN){var e=Wb;if(e!==null)throw e}}function Tx(e,t,n,r){eN=!1;var s=e.updateQueue;$m=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var m=l.lane&-536870913,p=m!==l.lane;if(p?(cs&m)===m:(r&m)===m){m!==0&&m===my&&(eN=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var g=e,b=l;m=t;var w=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){f=g.call(w,f,m);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,m=typeof g=="function"?g.call(w,f,m):g,m==null)break e;f=Di({},f,m);break e;case 2:$m=!0}}m=l.callback,m!==null&&(e.flags|=64,p&&(e.flags|=8192),p=s.callbacks,p===null?s.callbacks=[m]:p.push(m))}else p={lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=m;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,i===null&&(s.shared.lanes=0),Np|=o,e.lanes=o,e.memoizedState=f}}function IQ(e,t){if(typeof e!="function")throw Error(wt(191,e));e.call(t)}function MQ(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)IQ(n[e],t)}var py=Eh(null),U4=Eh(0);function fz(e,t){e=qf,Ei(U4,e),Ei(py,t),qf=e|t.baseLanes}function tN(){Ei(U4,qf),Ei(py,py.current)}function i9(){qf=U4.current,za(py),za(U4)}var Jc=Eh(null),Pu=null;function Um(e){var t=e.alternate;Ei(Mo,Mo.current&1),Ei(Jc,e),Pu===null&&(t===null||py.current!==null||t.memoizedState!==null)&&(Pu=e)}function nN(e){Ei(Mo,Mo.current),Ei(Jc,e),Pu===null&&(Pu=e)}function RQ(e){e.tag===22?(Ei(Mo,Mo.current),Ei(Jc,e),Pu===null&&(Pu=e)):Wm()}function Wm(){Ei(Mo,Mo.current),Ei(Jc,Jc.current)}function Bc(e){za(Jc),Pu===e&&(Pu=null),za(Mo)}var Mo=Eh(0);function W4(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||xN(n)||kN(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Bf=0,Pr=null,li=null,zo=null,V4=!1,Gb=!1,Pg=!1,G4=0,ck=0,Kb=null,n1e=0;function uo(){throw Error(wt(321))}function o9(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Qc(e[n],t[n]))return!1;return!0}function a9(e,t,n,r,s,i){return Bf=i,Pr=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,yr.H=e===null||e.memoizedState===null?uJ:y9,Pg=!1,i=n(r,s),Pg=!1,Gb&&(i=LQ(t,n,r,s)),DQ(e),i}function DQ(e){yr.H=uk;var t=li!==null&&li.next!==null;if(Bf=0,zo=li=Pr=null,V4=!1,ck=0,Kb=null,t)throw Error(wt(300));e===null||Wo||(e=e.dependencies,e!==null&&q4(e)&&(Wo=!0))}function LQ(e,t,n,r){Pr=e;var s=0;do{if(Gb&&(Kb=null),ck=0,Gb=!1,25<=s)throw Error(wt(301));if(s+=1,zo=li=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}yr.H=dJ,i=t(n,r)}while(Gb);return i}function r1e(){var e=yr.H,t=e.useState()[0];return t=typeof t.then=="function"?f_(t):t,e=e.useState()[0],(li!==null?li.memoizedState:null)!==e&&(Pr.flags|=1024),t}function l9(){var e=G4!==0;return G4=0,e}function c9(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function u9(e){if(V4){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}V4=!1}Bf=0,zo=li=Pr=null,Gb=!1,ck=G4=0,Kb=null}function Ol(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zo===null?Pr.memoizedState=zo=e:zo=zo.next=e,zo}function Ro(){if(li===null){var e=Pr.alternate;e=e!==null?e.memoizedState:null}else e=li.next;var t=zo===null?Pr.memoizedState:zo.next;if(t!==null)zo=t,li=e;else{if(e===null)throw Pr.alternate===null?Error(wt(467)):Error(wt(310));li=e,e={memoizedState:li.memoizedState,baseState:li.baseState,baseQueue:li.baseQueue,queue:li.queue,next:null},zo===null?Pr.memoizedState=zo=e:zo=zo.next=e}return zo}function Y3(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function f_(e){var t=ck;return ck+=1,Kb===null&&(Kb=[]),e=AQ(Kb,e,t),t=Pr,(zo===null?t.memoizedState:zo.next)===null&&(t=t.alternate,yr.H=t===null||t.memoizedState===null?uJ:y9),e}function X3(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return f_(e);if(e.$$typeof===yf)return ll(e)}throw Error(wt(438,String(e)))}function d9(e){var t=null,n=Pr.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Pr.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Y3(),Pr.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=q0e;return t.index++,n}function zf(e,t){return typeof t=="function"?t(e):t}function zC(e){var t=Ro();return h9(t,li,e)}function h9(e,t,n){var r=e.queue;if(r===null)throw Error(wt(311));r.lastRenderedReducer=n;var s=e.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}t.baseQueue=s=i,r.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var l=o=null,c=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(cs&f)===f:(Bf&f)===f){var m=u.revertLane;if(m===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===my&&(d=!0);else if((Bf&m)===m){u=u.next,m===my&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(l=c=f,o=i):c=c.next=f,Pr.lanes|=m,Np|=m;f=u.action,Pg&&n(i,f),i=u.hasEagerState?u.eagerState:n(i,f)}else m={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(l=c=m,o=i):c=c.next=m,Pr.lanes|=f,Np|=f;u=u.next}while(u!==null&&u!==t);if(c===null?o=i:c.next=l,!Qc(i,e.memoizedState)&&(Wo=!0,d&&(n=Wb,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=c,r.lastRenderedState=i}return s===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function gE(e){var t=Ro(),n=t.queue;if(n===null)throw Error(wt(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);Qc(i,t.memoizedState)||(Wo=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function PQ(e,t,n){var r=Pr,s=Ro(),i=bs;if(i){if(n===void 0)throw Error(wt(407));n=n()}else n=t();var o=!Qc((li||s).memoizedState,n);if(o&&(s.memoizedState=n,Wo=!0),s=s.queue,f9(BQ.bind(null,r,s,e),[e]),s.getSnapshot!==t||o||zo!==null&&zo.memoizedState.tag&1){if(r.flags|=2048,gy(9,{destroy:void 0},$Q.bind(null,r,s,n,t),null),xi===null)throw Error(wt(349));i||Bf&127||OQ(r,t,n)}return n}function OQ(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Pr.updateQueue,t===null?(t=Y3(),Pr.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function $Q(e,t,n,r){t.value=n,t.getSnapshot=r,zQ(t)&&FQ(e)}function BQ(e,t,n){return n(function(){zQ(t)&&FQ(e)})}function zQ(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Qc(e,n)}catch{return!0}}function FQ(e){var t=s1(e,2);t!==null&&gc(t,e,2)}function rN(e){var t=Ol();if(typeof e=="function"){var n=e;if(e=n(),Pg){Ym(!0);try{n()}finally{Ym(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zf,lastRenderedState:e},t}function qQ(e,t,n,r){return e.baseState=n,h9(e,li,typeof r=="function"?r:zf)}function s1e(e,t,n,r,s){if(J3(e))throw Error(wt(485));if(e=t.action,e!==null){var i={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};yr.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,HQ(t,i)):(i.next=n.next,t.pending=n.next=i)}}function HQ(e,t){var n=t.action,r=t.payload,s=e.state;if(t.isTransition){var i=yr.T,o={};yr.T=o;try{var l=n(s,r),c=yr.S;c!==null&&c(o,l),mz(e,t,l)}catch(u){sN(e,t,u)}finally{i!==null&&o.types!==null&&(i.types=o.types),yr.T=i}}else try{i=n(s,r),mz(e,t,i)}catch(u){sN(e,t,u)}}function mz(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){pz(e,t,r)},function(r){return sN(e,t,r)}):pz(e,t,n)}function pz(e,t,n){t.status="fulfilled",t.value=n,UQ(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,HQ(e,n)))}function sN(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,UQ(t),t=t.next;while(t!==r)}e.action=null}function UQ(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function WQ(e,t){return t}function gz(e,t){if(bs){var n=xi.formState;if(n!==null){e:{var r=Pr;if(bs){if(Mi){t:{for(var s=Mi,i=Tu;s.nodeType!==8;){if(!i){s=null;break t}if(s=Ou(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){Mi=Ou(s.nextSibling),r=s.data==="F!";break e}}Ap(r)}r=!1}r&&(t=n[0])}}return n=Ol(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:WQ,lastRenderedState:t},n.queue=r,n=aJ.bind(null,Pr,r),r.dispatch=n,r=rN(!1),i=b9.bind(null,Pr,!1,r.queue),r=Ol(),s={state:t,dispatch:null,action:e,pending:null},r.queue=s,n=s1e.bind(null,Pr,s,i,n),s.dispatch=n,r.memoizedState=e,[t,n,!1]}function bz(e){var t=Ro();return VQ(t,li,e)}function VQ(e,t,n){if(t=h9(e,t,WQ)[0],e=zC(zf)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=f_(t)}catch(o){throw o===nv?K3:o}else r=t;t=Ro();var s=t.queue,i=s.dispatch;return n!==t.memoizedState&&(Pr.flags|=2048,gy(9,{destroy:void 0},i1e.bind(null,s,n),null)),[r,i,e]}function i1e(e,t){e.action=t}function yz(e){var t=Ro(),n=li;if(n!==null)return VQ(t,n,e);Ro(),t=t.memoizedState,n=Ro();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function gy(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Pr.updateQueue,t===null&&(t=Y3(),Pr.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function GQ(){return Ro().memoizedState}function FC(e,t,n,r){var s=Ol();Pr.flags|=e,s.memoizedState=gy(1|t,{destroy:void 0},n,r===void 0?null:r)}function Q3(e,t,n,r){var s=Ro();r=r===void 0?null:r;var i=s.memoizedState.inst;li!==null&&r!==null&&o9(r,li.memoizedState.deps)?s.memoizedState=gy(t,i,n,r):(Pr.flags|=e,s.memoizedState=gy(1|t,i,n,r))}function vz(e,t){FC(8390656,8,e,t)}function f9(e,t){Q3(2048,8,e,t)}function o1e(e){Pr.flags|=4;var t=Pr.updateQueue;if(t===null)t=Y3(),Pr.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function KQ(e){var t=Ro().memoizedState;return o1e({ref:t,nextImpl:e}),function(){if(qs&2)throw Error(wt(440));return t.impl.apply(void 0,arguments)}}function YQ(e,t){return Q3(4,2,e,t)}function XQ(e,t){return Q3(4,4,e,t)}function QQ(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function JQ(e,t,n){n=n!=null?n.concat([e]):null,Q3(4,4,QQ.bind(null,t,e),n)}function m9(){}function ZQ(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&o9(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function eJ(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&o9(t,r[1]))return r[0];if(r=e(),Pg){Ym(!0);try{e()}finally{Ym(!1)}}return n.memoizedState=[r,t],r}function p9(e,t,n){return n===void 0||Bf&1073741824&&!(cs&261930)?e.memoizedState=t:(e.memoizedState=n,e=qJ(),Pr.lanes|=e,Np|=e,n)}function tJ(e,t,n,r){return Qc(n,t)?n:py.current!==null?(e=p9(e,n,r),Qc(e,t)||(Wo=!0),e):!(Bf&42)||Bf&1073741824&&!(cs&261930)?(Wo=!0,e.memoizedState=n):(e=qJ(),Pr.lanes|=e,Np|=e,t)}function nJ(e,t,n,r,s){var i=Ws.p;Ws.p=i!==0&&8>i?i:8;var o=yr.T,l={};yr.T=l,b9(e,!1,t,n);try{var c=s(),u=yr.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=t1e(c,r);Ex(e,t,d,Kc(e))}else Ex(e,t,r,Kc(e))}catch(f){Ex(e,t,{then:function(){},status:"rejected",reason:f},Kc())}finally{Ws.p=i,o!==null&&l.types!==null&&(o.types=l.types),yr.T=o}}function a1e(){}function iN(e,t,n,r){if(e.tag!==5)throw Error(wt(476));var s=rJ(e).queue;nJ(e,s,t,_g,n===null?a1e:function(){return sJ(e),n(r)})}function rJ(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:_g,baseState:_g,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zf,lastRenderedState:_g},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zf,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function sJ(e){var t=rJ(e);t.next===null&&(t=e.alternate.memoizedState),Ex(e,t.next.queue,{},Kc())}function g9(){return ll(fk)}function iJ(){return Ro().memoizedState}function oJ(){return Ro().memoizedState}function l1e(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Kc();e=hp(n);var r=fp(t,e,n);r!==null&&(gc(r,t,n),Sx(r,t,n)),t={cache:t9()},e.payload=t;return}t=t.return}}function c1e(e,t,n){var r=Kc();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},J3(e)?lJ(t,n):(n=QR(e,t,n,r),n!==null&&(gc(n,e,r),cJ(n,t,r)))}function aJ(e,t,n){var r=Kc();Ex(e,t,n,r)}function Ex(e,t,n,r){var s={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(J3(e))lJ(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Qc(l,o))return G3(e,t,s,0),xi===null&&V3(),!1}catch{}finally{}if(n=QR(e,t,s,r),n!==null)return gc(n,e,r),cJ(n,t,r),!0}return!1}function b9(e,t,n,r){if(r={lane:2,revertLane:T9(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},J3(e)){if(t)throw Error(wt(479))}else t=QR(e,n,r,2),t!==null&&gc(t,e,2)}function J3(e){var t=e.alternate;return e===Pr||t!==null&&t===Pr}function lJ(e,t){Gb=V4=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cJ(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,KX(e,n)}}var uk={readContext:ll,use:X3,useCallback:uo,useContext:uo,useEffect:uo,useImperativeHandle:uo,useLayoutEffect:uo,useInsertionEffect:uo,useMemo:uo,useReducer:uo,useRef:uo,useState:uo,useDebugValue:uo,useDeferredValue:uo,useTransition:uo,useSyncExternalStore:uo,useId:uo,useHostTransitionStatus:uo,useFormState:uo,useActionState:uo,useOptimistic:uo,useMemoCache:uo,useCacheRefresh:uo};uk.useEffectEvent=uo;var uJ={readContext:ll,use:X3,useCallback:function(e,t){return Ol().memoizedState=[e,t===void 0?null:t],e},useContext:ll,useEffect:vz,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,FC(4194308,4,QQ.bind(null,t,e),n)},useLayoutEffect:function(e,t){return FC(4194308,4,e,t)},useInsertionEffect:function(e,t){FC(4,2,e,t)},useMemo:function(e,t){var n=Ol();t=t===void 0?null:t;var r=e();if(Pg){Ym(!0);try{e()}finally{Ym(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ol();if(n!==void 0){var s=n(t);if(Pg){Ym(!0);try{n(t)}finally{Ym(!1)}}}else s=t;return r.memoizedState=r.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},r.queue=e,e=e.dispatch=c1e.bind(null,Pr,e),[r.memoizedState,e]},useRef:function(e){var t=Ol();return e={current:e},t.memoizedState=e},useState:function(e){e=rN(e);var t=e.queue,n=aJ.bind(null,Pr,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:m9,useDeferredValue:function(e,t){var n=Ol();return p9(n,e,t)},useTransition:function(){var e=rN(!1);return e=nJ.bind(null,Pr,e.queue,!0,!1),Ol().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Pr,s=Ol();if(bs){if(n===void 0)throw Error(wt(407));n=n()}else{if(n=t(),xi===null)throw Error(wt(349));cs&127||OQ(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,vz(BQ.bind(null,r,i,e),[e]),r.flags|=2048,gy(9,{destroy:void 0},$Q.bind(null,r,i,n,t),null),n},useId:function(){var e=Ol(),t=xi.identifierPrefix;if(bs){var n=ch,r=lh;n=(r&~(1<<32-Gc(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=G4++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=n1e++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:g9,useFormState:gz,useActionState:gz,useOptimistic:function(e){var t=Ol();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=b9.bind(null,Pr,!0,n),n.dispatch=t,[e,t]},useMemoCache:d9,useCacheRefresh:function(){return Ol().memoizedState=l1e.bind(null,Pr)},useEffectEvent:function(e){var t=Ol(),n={impl:e};return t.memoizedState=n,function(){if(qs&2)throw Error(wt(440));return n.impl.apply(void 0,arguments)}}},y9={readContext:ll,use:X3,useCallback:ZQ,useContext:ll,useEffect:f9,useImperativeHandle:JQ,useInsertionEffect:YQ,useLayoutEffect:XQ,useMemo:eJ,useReducer:zC,useRef:GQ,useState:function(){return zC(zf)},useDebugValue:m9,useDeferredValue:function(e,t){var n=Ro();return tJ(n,li.memoizedState,e,t)},useTransition:function(){var e=zC(zf)[0],t=Ro().memoizedState;return[typeof e=="boolean"?e:f_(e),t]},useSyncExternalStore:PQ,useId:iJ,useHostTransitionStatus:g9,useFormState:bz,useActionState:bz,useOptimistic:function(e,t){var n=Ro();return qQ(n,li,e,t)},useMemoCache:d9,useCacheRefresh:oJ};y9.useEffectEvent=KQ;var dJ={readContext:ll,use:X3,useCallback:ZQ,useContext:ll,useEffect:f9,useImperativeHandle:JQ,useInsertionEffect:YQ,useLayoutEffect:XQ,useMemo:eJ,useReducer:gE,useRef:GQ,useState:function(){return gE(zf)},useDebugValue:m9,useDeferredValue:function(e,t){var n=Ro();return li===null?p9(n,e,t):tJ(n,li.memoizedState,e,t)},useTransition:function(){var e=gE(zf)[0],t=Ro().memoizedState;return[typeof e=="boolean"?e:f_(e),t]},useSyncExternalStore:PQ,useId:iJ,useHostTransitionStatus:g9,useFormState:yz,useActionState:yz,useOptimistic:function(e,t){var n=Ro();return li!==null?qQ(n,li,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:d9,useCacheRefresh:oJ};dJ.useEffectEvent=KQ;function bE(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Di({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var oN={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Kc(),s=hp(r);s.payload=t,n!=null&&(s.callback=n),t=fp(e,s,r),t!==null&&(gc(t,e,r),Sx(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Kc(),s=hp(r);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=fp(e,s,r),t!==null&&(gc(t,e,r),Sx(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Kc(),r=hp(n);r.tag=2,t!=null&&(r.callback=t),t=fp(e,r,n),t!==null&&(gc(t,e,n),Sx(t,e,n))}};function wz(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!ik(n,r)||!ik(s,i):!0}function xz(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&oN.enqueueReplaceState(t,t.state,null)}function Og(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=Di({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function hJ(e){B4(e)}function fJ(e){console.error(e)}function mJ(e){B4(e)}function K4(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function kz(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function aN(e,t,n){return n=hp(n),n.tag=3,n.payload={element:null},n.callback=function(){K4(e,t)},n}function pJ(e){return e=hp(e),e.tag=3,e}function gJ(e,t,n,r){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var i=r.value;e.payload=function(){return s(i)},e.callback=function(){kz(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){kz(t,n,r),typeof s!="function"&&(mp===null?mp=new Set([this]):mp.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function u1e(e,t,n,r,s){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&tv(t,n,s,!0),n=Jc.current,n!==null){switch(n.tag){case 31:case 13:return Pu===null?Z4():n.alternate===null&&go===0&&(go=3),n.flags&=-257,n.flags|=65536,n.lanes=s,r===H4?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),AE(e,r,s)),!1;case 22:return n.flags|=65536,r===H4?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),AE(e,r,s)),!1}throw Error(wt(435,n.tag))}return AE(e,r,s),Z4(),!1}if(bs)return t=Jc.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=s,r!==K7&&(e=Error(wt(422),{cause:r}),ak(Cu(e,n)))):(r!==K7&&(t=Error(wt(423),{cause:r}),ak(Cu(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,r=Cu(r,n),s=aN(e.stateNode,r,s),pE(e,s),go!==4&&(go=2)),!1;var i=Error(wt(520),{cause:r});if(i=Cu(i,n),Nx===null?Nx=[i]:Nx.push(i),go!==4&&(go=2),t===null)return!0;r=Cu(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=aN(n.stateNode,r,e),pE(n,e),!1;case 1:if(t=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(mp===null||!mp.has(i))))return n.flags|=65536,s&=-s,n.lanes|=s,s=pJ(s),gJ(s,e,n,r),pE(n,s),!1}n=n.return}while(n!==null);return!1}var v9=Error(wt(461)),Wo=!1;function tl(e,t,n,r){t.child=e===null?NQ(t,null,n,r):Lg(t,e.child,n,r)}function _z(e,t,n,r,s){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var l in r)l!=="ref"&&(o[l]=r[l])}else o=r;return Dg(t),r=a9(e,t,n,o,i,s),l=l9(),e!==null&&!Wo?(c9(e,t,s),Ff(e,t,s)):(bs&&l&&ZR(t),t.flags|=1,tl(e,t,r,s),t.child)}function Sz(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!JR(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,bJ(e,t,i,r,s)):(e=$C(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!w9(e,s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:ik,n(o,r)&&e.ref===t.ref)return Ff(e,t,s)}return t.flags|=1,e=Tf(i,r),e.ref=t.ref,e.return=t,t.child=e}function bJ(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(ik(i,r)&&e.ref===t.ref)if(Wo=!1,t.pendingProps=r=i,w9(e,s))e.flags&131072&&(Wo=!0);else return t.lanes=e.lanes,Ff(e,t,s)}return lN(e,t,n,r,s)}function yJ(e,t,n,r){var s=r.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(r=t.child=e.child,s=0;r!==null;)s=s|r.lanes|r.childLanes,r=r.sibling;r=s&~i}else r=0,t.child=null;return Cz(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&BC(t,i!==null?i.cachePool:null),i!==null?fz(t,i):tN(),RQ(t);else return r=t.lanes=536870912,Cz(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(BC(t,i.cachePool),fz(t,i),Wm(),t.memoizedState=null):(e!==null&&BC(t,null),tN(),Wm());return tl(e,t,s,n),t.child}function Zw(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Cz(e,t,n,r,s){var i=n9();return i=i===null?null:{parent:qo._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&BC(t,null),tN(),RQ(t),e!==null&&tv(e,t,r,!0),t.childLanes=s,null}function qC(e,t){return t=Y4({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Tz(e,t,n){return Lg(t,e.child,null,n),e=qC(t,t.pendingProps),e.flags|=2,Bc(t),t.memoizedState=null,e}function d1e(e,t,n){var r=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(bs){if(r.mode==="hidden")return e=qC(t,r),t.lanes=536870912,Zw(null,e);if(nN(t),(e=Mi)?(e=uZ(e,Tu),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ep!==null?{id:lh,overflow:ch}:null,retryLane:536870912,hydrationErrors:null},n=_Q(e),n.return=t,t.child=n,al=t,Mi=null)):e=null,e===null)throw Ap(t);return t.lanes=536870912,null}return qC(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(nN(t),s)if(t.flags&256)t.flags&=-257,t=Tz(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(wt(558));else if(Wo||tv(e,t,n,!1),s=(n&e.childLanes)!==0,Wo||s){if(r=xi,r!==null&&(o=YX(r,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,s1(e,o),gc(r,e,o),v9;Z4(),t=Tz(e,t,n)}else e=i.treeContext,Mi=Ou(o.nextSibling),al=t,bs=!0,dp=null,Tu=!1,e!==null&&CQ(t,e),t=qC(t,r),t.flags|=4096;return t}return e=Tf(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function HC(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(wt(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function lN(e,t,n,r,s){return Dg(t),n=a9(e,t,n,r,void 0,s),r=l9(),e!==null&&!Wo?(c9(e,t,s),Ff(e,t,s)):(bs&&r&&ZR(t),t.flags|=1,tl(e,t,n,s),t.child)}function Ez(e,t,n,r,s,i){return Dg(t),t.updateQueue=null,n=LQ(t,r,n,s),DQ(e),r=l9(),e!==null&&!Wo?(c9(e,t,i),Ff(e,t,i)):(bs&&r&&ZR(t),t.flags|=1,tl(e,t,n,i),t.child)}function Az(e,t,n,r,s){if(Dg(t),t.stateNode===null){var i=jb,o=n.contextType;typeof o=="object"&&o!==null&&(i=ll(o)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=oN,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},s9(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?ll(o):jb,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(bE(t,n,o,r),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&oN.enqueueReplaceState(i,i.state,null),Tx(t,r,i,s),Cx(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var l=t.memoizedProps,c=Og(n,l);i.props=c;var u=i.context,d=n.contextType;o=jb,typeof d=="object"&&d!==null&&(o=ll(d));var f=n.getDerivedStateFromProps;d=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l||u!==o)&&xz(t,i,r,o),$m=!1;var m=t.memoizedState;i.state=m,Tx(t,r,i,s),Cx(),u=t.memoizedState,l||m!==u||$m?(typeof f=="function"&&(bE(t,n,f,r),u=t.memoizedState),(c=$m||wz(t,n,c,r,m,u,o))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=o,r=c):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Z7(e,t),o=t.memoizedProps,d=Og(n,o),i.props=d,f=t.pendingProps,m=i.context,u=n.contextType,c=jb,typeof u=="object"&&u!==null&&(c=ll(u)),l=n.getDerivedStateFromProps,(u=typeof l=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==f||m!==c)&&xz(t,i,r,c),$m=!1,m=t.memoizedState,i.state=m,Tx(t,r,i,s),Cx();var p=t.memoizedState;o!==f||m!==p||$m||e!==null&&e.dependencies!==null&&q4(e.dependencies)?(typeof l=="function"&&(bE(t,n,l,r),p=t.memoizedState),(d=$m||wz(t,n,d,r,m,p,c)||e!==null&&e.dependencies!==null&&q4(e.dependencies))?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,p,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,p,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=c,r=d):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,HC(e,t),r=(t.flags&128)!==0,i||r?(i=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&r?(t.child=Lg(t,e.child,null,s),t.child=Lg(t,null,n,s)):tl(e,t,n,s),t.memoizedState=i.state,e=t.child):e=Ff(e,t,s),e}function jz(e,t,n,r){return Rg(),t.flags|=256,tl(e,t,n,r),t.child}var yE={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vE(e){return{baseLanes:e,cachePool:EQ()}}function wE(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=qc),e}function vJ(e,t,n){var r=t.pendingProps,s=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(Mo.current&2)!==0),o&&(s=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(bs){if(s?Um(t):Wm(),(e=Mi)?(e=uZ(e,Tu),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ep!==null?{id:lh,overflow:ch}:null,retryLane:536870912,hydrationErrors:null},n=_Q(e),n.return=t,t.child=n,al=t,Mi=null)):e=null,e===null)throw Ap(t);return kN(e)?t.lanes=32:t.lanes=536870912,null}var l=r.children;return r=r.fallback,s?(Wm(),s=t.mode,l=Y4({mode:"hidden",children:l},s),r=Sg(r,s,n,null),l.return=t,r.return=t,l.sibling=r,t.child=l,r=t.child,r.memoizedState=vE(n),r.childLanes=wE(e,o,n),t.memoizedState=yE,Zw(null,r)):(Um(t),cN(t,l))}var c=e.memoizedState;if(c!==null&&(l=c.dehydrated,l!==null)){if(i)t.flags&256?(Um(t),t.flags&=-257,t=xE(e,t,n)):t.memoizedState!==null?(Wm(),t.child=e.child,t.flags|=128,t=null):(Wm(),l=r.fallback,s=t.mode,r=Y4({mode:"visible",children:r.children},s),l=Sg(l,s,n,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,Lg(t,e.child,null,n),r=t.child,r.memoizedState=vE(n),r.childLanes=wE(e,o,n),t.memoizedState=yE,t=Zw(null,r));else if(Um(t),kN(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(wt(419)),r.stack="",r.digest=o,ak({value:r,source:null,stack:null}),t=xE(e,t,n)}else if(Wo||tv(e,t,n,!1),o=(n&e.childLanes)!==0,Wo||o){if(o=xi,o!==null&&(r=YX(o,n),r!==0&&r!==c.retryLane))throw c.retryLane=r,s1(e,r),gc(o,e,r),v9;xN(l)||Z4(),t=xE(e,t,n)}else xN(l)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Mi=Ou(l.nextSibling),al=t,bs=!0,dp=null,Tu=!1,e!==null&&CQ(t,e),t=cN(t,r.children),t.flags|=4096);return t}return s?(Wm(),l=r.fallback,s=t.mode,c=e.child,u=c.sibling,r=Tf(c,{mode:"hidden",children:r.children}),r.subtreeFlags=c.subtreeFlags&65011712,u!==null?l=Tf(u,l):(l=Sg(l,s,n,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,Zw(null,r),r=t.child,l=e.child.memoizedState,l===null?l=vE(n):(s=l.cachePool,s!==null?(c=qo._currentValue,s=s.parent!==c?{parent:c,pool:c}:s):s=EQ(),l={baseLanes:l.baseLanes|n,cachePool:s}),r.memoizedState=l,r.childLanes=wE(e,o,n),t.memoizedState=yE,Zw(e.child,r)):(Um(t),n=e.child,e=n.sibling,n=Tf(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function cN(e,t){return t=Y4({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Y4(e,t){return e=Fc(22,e,null,t),e.lanes=0,e}function xE(e,t,n){return Lg(t,e.child,null,n),e=cN(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Nz(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),X7(e.return,t,n)}function kE(e,t,n,r,s,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s,o.treeForkCount=i)}function wJ(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;r=r.children;var o=Mo.current,l=(o&2)!==0;if(l?(o=o&1|2,t.flags|=128):o&=1,Ei(Mo,o),tl(e,t,r,n),r=bs?ok:0,!l&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Nz(e,n,t);else if(e.tag===19)Nz(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&W4(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),kE(t,!1,s,n,i,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&W4(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}kE(t,!0,n,null,i,r);break;case"together":kE(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ff(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Np|=t.lanes,!(n&t.childLanes))if(e!==null){if(tv(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(wt(153));if(t.child!==null){for(e=t.child,n=Tf(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Tf(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function w9(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&q4(e)))}function h1e(e,t,n){switch(t.tag){case 3:L4(t,t.stateNode.containerInfo),Hm(t,qo,e.memoizedState.cache),Rg();break;case 27:case 5:O7(t);break;case 4:L4(t,t.stateNode.containerInfo);break;case 10:Hm(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,nN(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Um(t),t.flags|=128,null):n&t.child.childLanes?vJ(e,t,n):(Um(t),e=Ff(e,t,n),e!==null?e.sibling:null);Um(t);break;case 19:var s=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(tv(e,t,n,!1),r=(n&t.childLanes)!==0),s){if(r)return wJ(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ei(Mo,Mo.current),r)break;return null;case 22:return t.lanes=0,yJ(e,t,n,t.pendingProps);case 24:Hm(t,qo,e.memoizedState.cache)}return Ff(e,t,n)}function xJ(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Wo=!0;else{if(!w9(e,n)&&!(t.flags&128))return Wo=!1,h1e(e,t,n);Wo=!!(e.flags&131072)}else Wo=!1,bs&&t.flags&1048576&&SQ(t,ok,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=tg(t.elementType),t.type=e,typeof e=="function")JR(e)?(r=Og(e,r),t.tag=1,t=Az(null,t,e,r,n)):(t.tag=0,t=lN(null,t,e,r,n));else{if(e!=null){var s=e.$$typeof;if(s===$R){t.tag=11,t=_z(null,t,e,r,n);break e}else if(s===BR){t.tag=14,t=Sz(null,t,e,r,n);break e}}throw t=L7(e)||e,Error(wt(306,t,""))}}return t;case 0:return lN(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,s=Og(r,t.pendingProps),Az(e,t,r,s,n);case 3:e:{if(L4(t,t.stateNode.containerInfo),e===null)throw Error(wt(387));r=t.pendingProps;var i=t.memoizedState;s=i.element,Z7(e,t),Tx(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Hm(t,qo,r),r!==i.cache&&Q7(t,[qo],n,!0),Cx(),r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=jz(e,t,r,n);break e}else if(r!==s){s=Cu(Error(wt(424)),t),ak(s),t=jz(e,t,r,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Mi=Ou(e.firstChild),al=t,bs=!0,dp=null,Tu=!0,n=NQ(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Rg(),r===s){t=Ff(e,t,n);break e}tl(e,t,r,n)}t=t.child}return t;case 26:return HC(e,t),e===null?(n=Xz(t.type,null,t.pendingProps,null))?t.memoizedState=n:bs||(n=t.type,e=t.pendingProps,r=rT(up.current).createElement(n),r[ol]=t,r[vc]=e,ul(r,n,e),Pa(r),t.stateNode=r):t.memoizedState=Xz(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return O7(t),e===null&&bs&&(r=t.stateNode=dZ(t.type,t.pendingProps,up.current),al=t,Tu=!0,s=Mi,s0(t.type)?(_N=s,Mi=Ou(r.firstChild)):Mi=s),tl(e,t,t.pendingProps.children,n),HC(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&bs&&((s=r=Mi)&&(r=q1e(r,t.type,t.pendingProps,Tu),r!==null?(t.stateNode=r,al=t,Mi=Ou(r.firstChild),Tu=!1,s=!0):s=!1),s||Ap(t)),O7(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,vN(s,i)?r=null:o!==null&&vN(s,o)&&(t.flags|=32),t.memoizedState!==null&&(s=a9(e,t,r1e,null,null,n),fk._currentValue=s),HC(e,t),tl(e,t,r,n),t.child;case 6:return e===null&&bs&&((e=n=Mi)&&(n=H1e(n,t.pendingProps,Tu),n!==null?(t.stateNode=n,al=t,Mi=null,e=!0):e=!1),e||Ap(t)),null;case 13:return vJ(e,t,n);case 4:return L4(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Lg(t,null,r,n):tl(e,t,r,n),t.child;case 11:return _z(e,t,t.type,t.pendingProps,n);case 7:return tl(e,t,t.pendingProps,n),t.child;case 8:return tl(e,t,t.pendingProps.children,n),t.child;case 12:return tl(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Hm(t,t.type,r.value),tl(e,t,r.children,n),t.child;case 9:return s=t.type._context,r=t.pendingProps.children,Dg(t),s=ll(s),r=r(s),t.flags|=1,tl(e,t,r,n),t.child;case 14:return Sz(e,t,t.type,t.pendingProps,n);case 15:return bJ(e,t,t.type,t.pendingProps,n);case 19:return wJ(e,t,n);case 31:return d1e(e,t,n);case 22:return yJ(e,t,n,t.pendingProps);case 24:return Dg(t),r=ll(qo),e===null?(s=n9(),s===null&&(s=xi,i=t9(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=n),s=i),t.memoizedState={parent:r,cache:s},s9(t),Hm(t,qo,s)):(e.lanes&n&&(Z7(e,t),Tx(t,null,null,n),Cx()),s=e.memoizedState,i=t.memoizedState,s.parent!==r?(s={parent:r,cache:r},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Hm(t,qo,r)):(r=i.cache,Hm(t,qo,r),r!==s.cache&&Q7(t,[qo],n,!0))),tl(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(wt(156,t.tag))}function Jh(e){e.flags|=4}function _E(e,t,n,r,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(WJ())e.flags|=8192;else throw Tg=H4,r9}else e.flags&=-16777217}function Iz(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!mZ(t))if(WJ())e.flags|=8192;else throw Tg=H4,r9}function QS(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?VX():536870912,e.lanes|=t,by|=t)}function ww(e,t){if(!bs)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ii(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&65011712,r|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function f1e(e,t,n){var r=t.pendingProps;switch(e9(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ii(t),null;case 1:return Ii(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ef(qo),dy(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(q1(t)?Jh(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,mE())),Ii(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(Jh(t),i!==null?(Ii(t),Iz(t,i)):(Ii(t),_E(t,s,null,r,n))):i?i!==e.memoizedState?(Jh(t),Ii(t),Iz(t,i)):(Ii(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Jh(t),Ii(t),_E(t,s,e,r,n)),null;case 27:if(P4(t),n=up.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Jh(t);else{if(!r){if(t.stateNode===null)throw Error(wt(166));return Ii(t),null}e=vh.current,q1(t)?oz(t):(e=dZ(s,r,n),t.stateNode=e,Jh(t))}return Ii(t),null;case 5:if(P4(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Jh(t);else{if(!r){if(t.stateNode===null)throw Error(wt(166));return Ii(t),null}if(i=vh.current,q1(t))oz(t);else{var o=rT(up.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?o.createElement(s,{is:r.is}):o.createElement(s)}}i[ol]=t,i[vc]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(ul(i,s,r),s){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Jh(t)}}return Ii(t),_E(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Jh(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(wt(166));if(e=up.current,q1(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,s=al,s!==null)switch(s.tag){case 27:case 5:r=s.memoizedProps}e[ol]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||aZ(e.nodeValue,n)),e||Ap(t,!0)}else e=rT(e).createTextNode(r),e[ol]=t,t.stateNode=e}return Ii(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=q1(t),n!==null){if(e===null){if(!r)throw Error(wt(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(wt(557));e[ol]=t}else Rg(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ii(t),e=!1}else n=mE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Bc(t),t):(Bc(t),null);if(t.flags&128)throw Error(wt(558))}return Ii(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=q1(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(wt(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(wt(317));s[ol]=t}else Rg(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ii(t),s=!1}else s=mE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Bc(t),t):(Bc(t),null)}return Bc(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,s=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(s=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==s&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),QS(t,t.updateQueue),Ii(t),null);case 4:return dy(),e===null&&E9(t.stateNode.containerInfo),Ii(t),null;case 10:return Ef(t.type),Ii(t),null;case 19:if(za(Mo),r=t.memoizedState,r===null)return Ii(t),null;if(s=(t.flags&128)!==0,i=r.rendering,i===null)if(s)ww(r,!1);else{if(go!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=W4(e),i!==null){for(t.flags|=128,ww(r,!1),e=i.updateQueue,t.updateQueue=e,QS(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)kQ(n,e),n=n.sibling;return Ei(Mo,Mo.current&1|2),bs&&cf(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Wc()>Q4&&(t.flags|=128,s=!0,ww(r,!1),t.lanes=4194304)}else{if(!s)if(e=W4(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,QS(t,e),ww(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!bs)return Ii(t),null}else 2*Wc()-r.renderingStartTime>Q4&&n!==536870912&&(t.flags|=128,s=!0,ww(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Wc(),e.sibling=null,n=Mo.current,Ei(Mo,s?n&1|2:n&1),bs&&cf(t,r.treeForkCount),e):(Ii(t),null);case 22:case 23:return Bc(t),i9(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ii(t),t.subtreeFlags&6&&(t.flags|=8192)):Ii(t),n=t.updateQueue,n!==null&&QS(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&za(Cg),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ef(qo),Ii(t),null;case 25:return null;case 30:return null}throw Error(wt(156,t.tag))}function m1e(e,t){switch(e9(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ef(qo),dy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return P4(t),null;case 31:if(t.memoizedState!==null){if(Bc(t),t.alternate===null)throw Error(wt(340));Rg()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Bc(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(wt(340));Rg()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return za(Mo),null;case 4:return dy(),null;case 10:return Ef(t.type),null;case 22:case 23:return Bc(t),i9(),e!==null&&za(Cg),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ef(qo),null;case 25:return null;default:return null}}function kJ(e,t){switch(e9(t),t.tag){case 3:Ef(qo),dy();break;case 26:case 27:case 5:P4(t);break;case 4:dy();break;case 31:t.memoizedState!==null&&Bc(t);break;case 13:Bc(t);break;case 19:za(Mo);break;case 10:Ef(t.type);break;case 22:case 23:Bc(t),i9(),e!==null&&za(Cg);break;case 24:Ef(qo)}}function m_(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var s=r.next;n=s;do{if((n.tag&e)===e){r=void 0;var i=n.create,o=n.inst;r=i(),o.destroy=r}n=n.next}while(n!==s)}}catch(l){ri(t,t.return,l)}}function jp(e,t,n){try{var r=t.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var i=s.next;r=i;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(l!==void 0){o.destroy=void 0,s=t;var c=n,u=l;try{u()}catch(d){ri(s,c,d)}}}r=r.next}while(r!==i)}}catch(d){ri(t,t.return,d)}}function _J(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{MQ(t,n)}catch(r){ri(e,e.return,r)}}}function SJ(e,t,n){n.props=Og(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){ri(e,t,r)}}function Ax(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(s){ri(e,t,s)}}function uh(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(s){ri(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){ri(e,t,s)}else n.current=null}function CJ(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(s){ri(e,e.return,s)}}function SE(e,t,n){try{var r=e.stateNode;P1e(r,e.type,n,t),r[vc]=t}catch(s){ri(e,e.return,s)}}function TJ(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&s0(e.type)||e.tag===4}function CE(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||TJ(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&s0(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function uN(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vf));else if(r!==4&&(r===27&&s0(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(uN(e,t,n),e=e.sibling;e!==null;)uN(e,t,n),e=e.sibling}function X4(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&s0(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(X4(e,t,n),e=e.sibling;e!==null;)X4(e,t,n),e=e.sibling}function EJ(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);ul(t,r,n),t[ol]=e,t[vc]=n}catch(i){ri(e,e.return,i)}}var mf=!1,Fo=!1,TE=!1,Mz=typeof WeakSet=="function"?WeakSet:Set,Da=null;function p1e(e,t){if(e=e.containerInfo,bN=aT,e=mQ(e),YR(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)m=f,f=p;for(;;){if(f===e)break t;if(m===n&&++u===s&&(l=o),m===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(yN={focusedElem:e,selectionRange:n},aT=!1,Da=t;Da!==null;)if(t=Da,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Da=e;else for(;Da!==null;){switch(t=Da,i=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)s=e[n],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,s=i.memoizedProps,i=i.memoizedState,r=n.stateNode;try{var g=Og(n.type,s);e=r.getSnapshotBeforeUpdate(g,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(b){ri(n,n.return,b)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)wN(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":wN(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(wt(163))}if(e=t.sibling,e!==null){e.return=t.return,Da=e;break}Da=t.return}}function AJ(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ef(e,n),r&4&&m_(5,n);break;case 1:if(ef(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){ri(n,n.return,o)}else{var s=Og(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){ri(n,n.return,o)}}r&64&&_J(n),r&512&&Ax(n,n.return);break;case 3:if(ef(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{MQ(e,t)}catch(o){ri(n,n.return,o)}}break;case 27:t===null&&r&4&&EJ(n);case 26:case 5:ef(e,n),t===null&&r&4&&CJ(n),r&512&&Ax(n,n.return);break;case 12:ef(e,n);break;case 31:ef(e,n),r&4&&IJ(e,n);break;case 13:ef(e,n),r&4&&MJ(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=S1e.bind(null,n),U1e(e,n))));break;case 22:if(r=n.memoizedState!==null||mf,!r){t=t!==null&&t.memoizedState!==null||Fo,s=mf;var i=Fo;mf=r,(Fo=t)&&!i?lf(e,n,(n.subtreeFlags&8772)!==0):ef(e,n),mf=s,Fo=i}break;case 30:break;default:ef(e,n)}}function jJ(e){var t=e.alternate;t!==null&&(e.alternate=null,jJ(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&HR(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Bi=null,oc=!1;function Zh(e,t,n){for(n=n.child;n!==null;)NJ(e,t,n),n=n.sibling}function NJ(e,t,n){if(Vc&&typeof Vc.onCommitFiberUnmount=="function")try{Vc.onCommitFiberUnmount(a_,n)}catch{}switch(n.tag){case 26:Fo||uh(n,t),Zh(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Fo||uh(n,t);var r=Bi,s=oc;s0(n.type)&&(Bi=n.stateNode,oc=!1),Zh(e,t,n),Mx(n.stateNode),Bi=r,oc=s;break;case 5:Fo||uh(n,t);case 6:if(r=Bi,s=oc,Bi=null,Zh(e,t,n),Bi=r,oc=s,Bi!==null)if(oc)try{(Bi.nodeType===9?Bi.body:Bi.nodeName==="HTML"?Bi.ownerDocument.body:Bi).removeChild(n.stateNode)}catch(i){ri(n,t,i)}else try{Bi.removeChild(n.stateNode)}catch(i){ri(n,t,i)}break;case 18:Bi!==null&&(oc?(e=Bi,Wz(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),xy(e)):Wz(Bi,n.stateNode));break;case 4:r=Bi,s=oc,Bi=n.stateNode.containerInfo,oc=!0,Zh(e,t,n),Bi=r,oc=s;break;case 0:case 11:case 14:case 15:jp(2,n,t),Fo||jp(4,n,t),Zh(e,t,n);break;case 1:Fo||(uh(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&SJ(n,t,r)),Zh(e,t,n);break;case 21:Zh(e,t,n);break;case 22:Fo=(r=Fo)||n.memoizedState!==null,Zh(e,t,n),Fo=r;break;default:Zh(e,t,n)}}function IJ(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{xy(e)}catch(n){ri(t,t.return,n)}}}function MJ(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{xy(e)}catch(n){ri(t,t.return,n)}}function g1e(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Mz),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Mz),t;default:throw Error(wt(435,e.tag))}}function JS(e,t){var n=g1e(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var s=C1e.bind(null,e,r);r.then(s,s)}})}function nc(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r],i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 27:if(s0(l.type)){Bi=l.stateNode,oc=!1;break e}break;case 5:Bi=l.stateNode,oc=!1;break e;case 3:case 4:Bi=l.stateNode.containerInfo,oc=!0;break e}l=l.return}if(Bi===null)throw Error(wt(160));NJ(i,o,s),Bi=null,oc=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)RJ(t,e),t=t.sibling}var ad=null;function RJ(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:nc(t,e),rc(e),r&4&&(jp(3,e,e.return),m_(3,e),jp(5,e,e.return));break;case 1:nc(t,e),rc(e),r&512&&(Fo||n===null||uh(n,n.return)),r&64&&mf&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var s=ad;if(nc(t,e),rc(e),r&512&&(Fo||n===null||uh(n,n.return)),r&4){var i=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,s=s.ownerDocument||s;t:switch(r){case"title":i=s.getElementsByTagName("title")[0],(!i||i[u_]||i[ol]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(r),s.head.insertBefore(i,s.querySelector("head > title"))),ul(i,r,n),i[ol]=e,Pa(i),r=i;break e;case"link":var o=Jz("link","href",s).get(r+(n.href||""));if(o){for(var l=0;l<o.length;l++)if(i=o[l],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(l,1);break t}}i=s.createElement(r),ul(i,r,n),s.head.appendChild(i);break;case"meta":if(o=Jz("meta","content",s).get(r+(n.content||""))){for(l=0;l<o.length;l++)if(i=o[l],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(l,1);break t}}i=s.createElement(r),ul(i,r,n),s.head.appendChild(i);break;default:throw Error(wt(468,r))}i[ol]=e,Pa(i),r=i}e.stateNode=r}else Zz(s,e.type,e.stateNode);else e.stateNode=Qz(s,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?Zz(s,e.type,e.stateNode):Qz(s,r,e.memoizedProps)):r===null&&e.stateNode!==null&&SE(e,e.memoizedProps,n.memoizedProps)}break;case 27:nc(t,e),rc(e),r&512&&(Fo||n===null||uh(n,n.return)),n!==null&&r&4&&SE(e,e.memoizedProps,n.memoizedProps);break;case 5:if(nc(t,e),rc(e),r&512&&(Fo||n===null||uh(n,n.return)),e.flags&32){s=e.stateNode;try{fy(s,"")}catch(g){ri(e,e.return,g)}}r&4&&e.stateNode!=null&&(s=e.memoizedProps,SE(e,s,n!==null?n.memoizedProps:s)),r&1024&&(TE=!0);break;case 6:if(nc(t,e),rc(e),r&4){if(e.stateNode===null)throw Error(wt(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(g){ri(e,e.return,g)}}break;case 3:if(VC=null,s=ad,ad=sT(t.containerInfo),nc(t,e),ad=s,rc(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{xy(t.containerInfo)}catch(g){ri(e,e.return,g)}TE&&(TE=!1,DJ(e));break;case 4:r=ad,ad=sT(e.stateNode.containerInfo),nc(t,e),rc(e),ad=r;break;case 12:nc(t,e),rc(e);break;case 31:nc(t,e),rc(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,JS(e,r)));break;case 13:nc(t,e),rc(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Z3=Wc()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,JS(e,r)));break;case 22:s=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=mf,d=Fo;if(mf=u||s,Fo=d||c,nc(t,e),Fo=d,mf=u,rc(e),r&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||c||mf||Fo||ng(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(i=c.stateNode,s)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{l=c.stateNode;var f=c.memoizedProps.style,m=f!=null&&f.hasOwnProperty("display")?f.display:null;l.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){ri(c,c.return,g)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=s?"":c.memoizedProps}catch(g){ri(c,c.return,g)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;s?Vz(p,!0):Vz(c.stateNode,!1)}catch(g){ri(c,c.return,g)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,JS(e,n))));break;case 19:nc(t,e),rc(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,JS(e,r)));break;case 30:break;case 21:break;default:nc(t,e),rc(e)}}function rc(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(TJ(r)){n=r;break}r=r.return}if(n==null)throw Error(wt(160));switch(n.tag){case 27:var s=n.stateNode,i=CE(e);X4(e,i,s);break;case 5:var o=n.stateNode;n.flags&32&&(fy(o,""),n.flags&=-33);var l=CE(e);X4(e,l,o);break;case 3:case 4:var c=n.stateNode.containerInfo,u=CE(e);uN(e,u,c);break;default:throw Error(wt(161))}}catch(d){ri(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function DJ(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;DJ(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ef(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)AJ(e,t.alternate,t),t=t.sibling}function ng(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:jp(4,t,t.return),ng(t);break;case 1:uh(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&SJ(t,t.return,n),ng(t);break;case 27:Mx(t.stateNode);case 26:case 5:uh(t,t.return),ng(t);break;case 22:t.memoizedState===null&&ng(t);break;case 30:ng(t);break;default:ng(t)}e=e.sibling}}function lf(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,s=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:lf(s,i,n),m_(4,i);break;case 1:if(lf(s,i,n),r=i,s=r.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(u){ri(r,r.return,u)}if(r=i,s=r.updateQueue,s!==null){var l=r.stateNode;try{var c=s.shared.hiddenCallbacks;if(c!==null)for(s.shared.hiddenCallbacks=null,s=0;s<c.length;s++)IQ(c[s],l)}catch(u){ri(r,r.return,u)}}n&&o&64&&_J(i),Ax(i,i.return);break;case 27:EJ(i);case 26:case 5:lf(s,i,n),n&&r===null&&o&4&&CJ(i),Ax(i,i.return);break;case 12:lf(s,i,n);break;case 31:lf(s,i,n),n&&o&4&&IJ(s,i);break;case 13:lf(s,i,n),n&&o&4&&MJ(s,i);break;case 22:i.memoizedState===null&&lf(s,i,n),Ax(i,i.return);break;case 30:break;default:lf(s,i,n)}t=t.sibling}}function x9(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&h_(n))}function k9(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&h_(e))}function ed(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)LJ(e,t,n,r),t=t.sibling}function LJ(e,t,n,r){var s=t.flags;switch(t.tag){case 0:case 11:case 15:ed(e,t,n,r),s&2048&&m_(9,t);break;case 1:ed(e,t,n,r);break;case 3:ed(e,t,n,r),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&h_(e)));break;case 12:if(s&2048){ed(e,t,n,r),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,l=i.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){ri(t,t.return,c)}}else ed(e,t,n,r);break;case 31:ed(e,t,n,r);break;case 13:ed(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?ed(e,t,n,r):jx(e,t):i._visibility&2?ed(e,t,n,r):(i._visibility|=2,hb(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),s&2048&&x9(o,t);break;case 24:ed(e,t,n,r),s&2048&&k9(t.alternate,t);break;default:ed(e,t,n,r)}}function hb(e,t,n,r,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,l=n,c=r,u=o.flags;switch(o.tag){case 0:case 11:case 15:hb(i,o,l,c,s),m_(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?hb(i,o,l,c,s):jx(i,o):(d._visibility|=2,hb(i,o,l,c,s)),s&&u&2048&&x9(o.alternate,o);break;case 24:hb(i,o,l,c,s),s&&u&2048&&k9(o.alternate,o);break;default:hb(i,o,l,c,s)}t=t.sibling}}function jx(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,s=r.flags;switch(r.tag){case 22:jx(n,r),s&2048&&x9(r.alternate,r);break;case 24:jx(n,r),s&2048&&k9(r.alternate,r);break;default:jx(n,r)}t=t.sibling}}var ex=8192;function H1(e,t,n){if(e.subtreeFlags&ex)for(e=e.child;e!==null;)PJ(e,t,n),e=e.sibling}function PJ(e,t,n){switch(e.tag){case 26:H1(e,t,n),e.flags&ex&&e.memoizedState!==null&&nbe(n,ad,e.memoizedState,e.memoizedProps);break;case 5:H1(e,t,n);break;case 3:case 4:var r=ad;ad=sT(e.stateNode.containerInfo),H1(e,t,n),ad=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=ex,ex=16777216,H1(e,t,n),ex=r):H1(e,t,n));break;default:H1(e,t,n)}}function OJ(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function xw(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Da=r,BJ(r,e)}OJ(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$J(e),e=e.sibling}function $J(e){switch(e.tag){case 0:case 11:case 15:xw(e),e.flags&2048&&jp(9,e,e.return);break;case 3:xw(e);break;case 12:xw(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,UC(e)):xw(e);break;default:xw(e)}}function UC(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Da=r,BJ(r,e)}OJ(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:jp(8,t,t.return),UC(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,UC(t));break;default:UC(t)}e=e.sibling}}function BJ(e,t){for(;Da!==null;){var n=Da;switch(n.tag){case 0:case 11:case 15:jp(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:h_(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Da=r;else e:for(n=e;Da!==null;){r=Da;var s=r.sibling,i=r.return;if(jJ(r),r===n){Da=null;break e}if(s!==null){s.return=i,Da=s;break e}Da=i}}}var b1e={getCacheForType:function(e){var t=ll(qo),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ll(qo).controller.signal}},y1e=typeof WeakMap=="function"?WeakMap:Map,qs=0,xi=null,rs=null,cs=0,ni=0,Pc=null,Qm=!1,rv=!1,_9=!1,qf=0,go=0,Np=0,Eg=0,S9=0,qc=0,by=0,Nx=null,ac=null,dN=!1,Z3=0,zJ=0,Q4=1/0,J4=null,mp=null,ha=0,pp=null,yy=null,Af=0,hN=0,fN=null,FJ=null,Ix=0,mN=null;function Kc(){return qs&2&&cs!==0?cs&-cs:yr.T!==null?T9():XX()}function qJ(){if(qc===0)if(!(cs&536870912)||bs){var e=US;US<<=1,!(US&3932160)&&(US=262144),qc=e}else qc=536870912;return e=Jc.current,e!==null&&(e.flags|=32),qc}function gc(e,t,n){(e===xi&&(ni===2||ni===9)||e.cancelPendingCommit!==null)&&(vy(e,0),Jm(e,cs,qc,!1)),c_(e,n),(!(qs&2)||e!==xi)&&(e===xi&&(!(qs&2)&&(Eg|=n),go===4&&Jm(e,cs,qc,!1)),Ah(e))}function HJ(e,t,n){if(qs&6)throw Error(wt(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||l_(e,t),s=r?x1e(e,t):EE(e,t,!0),i=r;do{if(s===0){rv&&!r&&Jm(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!v1e(n)){s=EE(e,t,!1),i=!1;continue}if(s===2){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var l=e;s=Nx;var c=l.current.memoizedState.isDehydrated;if(c&&(vy(l,o).flags|=256),o=EE(l,o,!1),o!==2){if(_9&&!c){l.errorRecoveryDisabledLanes|=i,Eg|=i,s=4;break e}i=ac,ac=s,i!==null&&(ac===null?ac=i:ac.push.apply(ac,i))}s=o}if(i=!1,s!==2)continue}}if(s===1){vy(e,0),Jm(e,t,0,!0);break}e:{switch(r=e,i=s,i){case 0:case 1:throw Error(wt(345));case 4:if((t&4194048)!==t)break;case 6:Jm(r,t,qc,!Qm);break e;case 2:ac=null;break;case 3:case 5:break;default:throw Error(wt(329))}if((t&62914560)===t&&(s=Z3+300-Wc(),10<s)){if(Jm(r,t,qc,!Qm),q3(r,0,!0)!==0)break e;Af=t,r.timeoutHandle=cZ(Rz.bind(null,r,n,ac,J4,dN,t,qc,Eg,by,Qm,i,"Throttled",-0,0),s);break e}Rz(r,n,ac,J4,dN,t,qc,Eg,by,Qm,i,null,-0,0)}}break}while(!0);Ah(e)}function Rz(e,t,n,r,s,i,o,l,c,u,d,f,m,p){if(e.timeoutHandle=-1,f=t.subtreeFlags,f&8192||(f&16785408)===16785408){f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vf},PJ(t,i,f);var g=(i&62914560)===i?Z3-Wc():(i&4194048)===i?zJ-Wc():0;if(g=rbe(f,g),g!==null){Af=i,e.cancelPendingCommit=g(Lz.bind(null,e,t,i,n,r,s,o,l,c,d,f,null,m,p)),Jm(e,i,o,!u);return}}Lz(e,t,i,n,r,s,o,l,c)}function v1e(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Qc(i(),s))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Jm(e,t,n,r){t&=~S9,t&=~Eg,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var s=t;0<s;){var i=31-Gc(s),o=1<<i;r[i]=-1,s&=~o}n!==0&&GX(e,n,t)}function e5(){return qs&6?!0:(p_(0),!1)}function C9(){if(rs!==null){if(ni===0)var e=rs.return;else e=rs,wf=i1=null,u9(e),Vb=null,lk=0,e=rs;for(;e!==null;)kJ(e.alternate,e),e=e.return;rs=null}}function vy(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,B1e(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Af=0,C9(),xi=e,rs=n=Tf(e.current,null),cs=t,ni=0,Pc=null,Qm=!1,rv=l_(e,t),_9=!1,by=qc=S9=Eg=Np=go=0,ac=Nx=null,dN=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var s=31-Gc(r),i=1<<s;t|=e[s],r&=~i}return qf=t,V3(),n}function UJ(e,t){Pr=null,yr.H=uk,t===nv||t===K3?(t=dz(),ni=3):t===r9?(t=dz(),ni=4):ni=t===v9?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pc=t,rs===null&&(go=1,K4(e,Cu(t,e.current)))}function WJ(){var e=Jc.current;return e===null?!0:(cs&4194048)===cs?Pu===null:(cs&62914560)===cs||cs&536870912?e===Pu:!1}function VJ(){var e=yr.H;return yr.H=uk,e===null?uk:e}function GJ(){var e=yr.A;return yr.A=b1e,e}function Z4(){go=4,Qm||(cs&4194048)!==cs&&Jc.current!==null||(rv=!0),!(Np&134217727)&&!(Eg&134217727)||xi===null||Jm(xi,cs,qc,!1)}function EE(e,t,n){var r=qs;qs|=2;var s=VJ(),i=GJ();(xi!==e||cs!==t)&&(J4=null,vy(e,t)),t=!1;var o=go;e:do try{if(ni!==0&&rs!==null){var l=rs,c=Pc;switch(ni){case 8:C9(),o=6;break e;case 3:case 2:case 9:case 6:Jc.current===null&&(t=!0);var u=ni;if(ni=0,Pc=null,Mb(e,l,c,u),n&&rv){o=0;break e}break;default:u=ni,ni=0,Pc=null,Mb(e,l,c,u)}}w1e(),o=go;break}catch(d){UJ(e,d)}while(!0);return t&&e.shellSuspendCounter++,wf=i1=null,qs=r,yr.H=s,yr.A=i,rs===null&&(xi=null,cs=0,V3()),o}function w1e(){for(;rs!==null;)KJ(rs)}function x1e(e,t){var n=qs;qs|=2;var r=VJ(),s=GJ();xi!==e||cs!==t?(J4=null,Q4=Wc()+500,vy(e,t)):rv=l_(e,t);e:do try{if(ni!==0&&rs!==null){t=rs;var i=Pc;t:switch(ni){case 1:ni=0,Pc=null,Mb(e,t,i,1);break;case 2:case 9:if(uz(i)){ni=0,Pc=null,Dz(t);break}t=function(){ni!==2&&ni!==9||xi!==e||(ni=7),Ah(e)},i.then(t,t);break e;case 3:ni=7;break e;case 4:ni=5;break e;case 7:uz(i)?(ni=0,Pc=null,Dz(t)):(ni=0,Pc=null,Mb(e,t,i,7));break;case 5:var o=null;switch(rs.tag){case 26:o=rs.memoizedState;case 5:case 27:var l=rs;if(o?mZ(o):l.stateNode.complete){ni=0,Pc=null;var c=l.sibling;if(c!==null)rs=c;else{var u=l.return;u!==null?(rs=u,t5(u)):rs=null}break t}}ni=0,Pc=null,Mb(e,t,i,5);break;case 6:ni=0,Pc=null,Mb(e,t,i,6);break;case 8:C9(),go=6;break e;default:throw Error(wt(462))}}k1e();break}catch(d){UJ(e,d)}while(!0);return wf=i1=null,yr.H=r,yr.A=s,qs=n,rs!==null?0:(xi=null,cs=0,V3(),go)}function k1e(){for(;rs!==null&&!W0e();)KJ(rs)}function KJ(e){var t=xJ(e.alternate,e,qf);e.memoizedProps=e.pendingProps,t===null?t5(e):rs=t}function Dz(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Ez(n,t,t.pendingProps,t.type,void 0,cs);break;case 11:t=Ez(n,t,t.pendingProps,t.type.render,t.ref,cs);break;case 5:u9(t);default:kJ(n,t),t=rs=kQ(t,qf),t=xJ(n,t,qf)}e.memoizedProps=e.pendingProps,t===null?t5(e):rs=t}function Mb(e,t,n,r){wf=i1=null,u9(t),Vb=null,lk=0;var s=t.return;try{if(u1e(e,s,t,n,cs)){go=1,K4(e,Cu(n,e.current)),rs=null;return}}catch(i){if(s!==null)throw rs=s,i;go=1,K4(e,Cu(n,e.current)),rs=null;return}t.flags&32768?(bs||r===1?e=!0:rv||cs&536870912?e=!1:(Qm=e=!0,(r===2||r===9||r===3||r===6)&&(r=Jc.current,r!==null&&r.tag===13&&(r.flags|=16384))),YJ(t,e)):t5(t)}function t5(e){var t=e;do{if(t.flags&32768){YJ(t,Qm);return}e=t.return;var n=f1e(t.alternate,t,qf);if(n!==null){rs=n;return}if(t=t.sibling,t!==null){rs=t;return}rs=t=e}while(t!==null);go===0&&(go=5)}function YJ(e,t){do{var n=m1e(e.alternate,e);if(n!==null){n.flags&=32767,rs=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){rs=e;return}rs=e=n}while(e!==null);go=6,rs=null}function Lz(e,t,n,r,s,i,o,l,c){e.cancelPendingCommit=null;do n5();while(ha!==0);if(qs&6)throw Error(wt(327));if(t!==null){if(t===e.current)throw Error(wt(177));if(i=t.lanes|t.childLanes,i|=XR,tge(e,n,i,o,l,c),e===xi&&(rs=xi=null,cs=0),yy=t,pp=e,Af=n,hN=i,fN=s,FJ=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,T1e(O4,function(){return eZ(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=yr.T,yr.T=null,s=Ws.p,Ws.p=2,o=qs,qs|=4;try{p1e(e,t,n)}finally{qs=o,Ws.p=s,yr.T=r}}ha=1,XJ(),QJ(),JJ()}}function XJ(){if(ha===1){ha=0;var e=pp,t=yy,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=yr.T,yr.T=null;var r=Ws.p;Ws.p=2;var s=qs;qs|=4;try{RJ(t,e);var i=yN,o=mQ(e.containerInfo),l=i.focusedElem,c=i.selectionRange;if(o!==l&&l&&l.ownerDocument&&fQ(l.ownerDocument.documentElement,l)){if(c!==null&&YR(l)){var u=c.start,d=c.end;if(d===void 0&&(d=u),"selectionStart"in l)l.selectionStart=u,l.selectionEnd=Math.min(d,l.value.length);else{var f=l.ownerDocument||document,m=f&&f.defaultView||window;if(m.getSelection){var p=m.getSelection(),g=l.textContent.length,b=Math.min(c.start,g),w=c.end===void 0?b:Math.min(c.end,g);!p.extend&&b>w&&(o=w,w=b,b=o);var y=rz(l,b),v=rz(l,w);if(y&&v&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var x=f.createRange();x.setStart(y.node,y.offset),p.removeAllRanges(),b>w?(p.addRange(x),p.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),p.addRange(x))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<f.length;l++){var k=f[l];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}aT=!!bN,yN=bN=null}finally{qs=s,Ws.p=r,yr.T=n}}e.current=t,ha=2}}function QJ(){if(ha===2){ha=0;var e=pp,t=yy,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=yr.T,yr.T=null;var r=Ws.p;Ws.p=2;var s=qs;qs|=4;try{AJ(e,t.alternate,t)}finally{qs=s,Ws.p=r,yr.T=n}}ha=3}}function JJ(){if(ha===4||ha===3){ha=0,V0e();var e=pp,t=yy,n=Af,r=FJ;t.subtreeFlags&10256||t.flags&10256?ha=5:(ha=0,yy=pp=null,ZJ(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(mp=null),qR(n),t=t.stateNode,Vc&&typeof Vc.onCommitFiberRoot=="function")try{Vc.onCommitFiberRoot(a_,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=yr.T,s=Ws.p,Ws.p=2,yr.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];i(l.value,{componentStack:l.stack})}}finally{yr.T=t,Ws.p=s}}Af&3&&n5(),Ah(e),s=e.pendingLanes,n&261930&&s&42?e===mN?Ix++:(Ix=0,mN=e):Ix=0,p_(0)}}function ZJ(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,h_(t)))}function n5(){return XJ(),QJ(),JJ(),eZ()}function eZ(){if(ha!==5)return!1;var e=pp,t=hN;hN=0;var n=qR(Af),r=yr.T,s=Ws.p;try{Ws.p=32>n?32:n,yr.T=null,n=fN,fN=null;var i=pp,o=Af;if(ha=0,yy=pp=null,Af=0,qs&6)throw Error(wt(331));var l=qs;if(qs|=4,$J(i.current),LJ(i,i.current,o,n),qs=l,p_(0,!1),Vc&&typeof Vc.onPostCommitFiberRoot=="function")try{Vc.onPostCommitFiberRoot(a_,i)}catch{}return!0}finally{Ws.p=s,yr.T=r,ZJ(e,t)}}function Pz(e,t,n){t=Cu(n,t),t=aN(e.stateNode,t,2),e=fp(e,t,2),e!==null&&(c_(e,2),Ah(e))}function ri(e,t,n){if(e.tag===3)Pz(e,e,n);else for(;t!==null;){if(t.tag===3){Pz(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(mp===null||!mp.has(r))){e=Cu(n,e),n=pJ(2),r=fp(t,n,2),r!==null&&(gJ(n,r,t,e),c_(r,2),Ah(r));break}}t=t.return}}function AE(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new y1e;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(_9=!0,s.add(n),e=_1e.bind(null,e,t,n),t.then(e,e))}function _1e(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,xi===e&&(cs&n)===n&&(go===4||go===3&&(cs&62914560)===cs&&300>Wc()-Z3?!(qs&2)&&vy(e,0):S9|=n,by===cs&&(by=0)),Ah(e)}function tZ(e,t){t===0&&(t=VX()),e=s1(e,t),e!==null&&(c_(e,t),Ah(e))}function S1e(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),tZ(e,n)}function C1e(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(wt(314))}r!==null&&r.delete(t),tZ(e,n)}function T1e(e,t){return zR(e,t)}var eT=null,fb=null,pN=!1,tT=!1,jE=!1,Zm=0;function Ah(e){e!==fb&&e.next===null&&(fb===null?eT=fb=e:fb=fb.next=e),tT=!0,pN||(pN=!0,A1e())}function p_(e,t){if(!jE&&tT){jE=!0;do for(var n=!1,r=eT;r!==null;){if(e!==0){var s=r.pendingLanes;if(s===0)var i=0;else{var o=r.suspendedLanes,l=r.pingedLanes;i=(1<<31-Gc(42|e)+1)-1,i&=s&~(o&~l),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,Oz(r,i))}else i=cs,i=q3(r,r===xi?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||l_(r,i)||(n=!0,Oz(r,i));r=r.next}while(n);jE=!1}}function E1e(){nZ()}function nZ(){tT=pN=!1;var e=0;Zm!==0&&$1e()&&(e=Zm);for(var t=Wc(),n=null,r=eT;r!==null;){var s=r.next,i=rZ(r,t);i===0?(r.next=null,n===null?eT=s:n.next=s,s===null&&(fb=n)):(n=r,(e!==0||i&3)&&(tT=!0)),r=s}ha!==0&&ha!==5||p_(e),Zm!==0&&(Zm=0)}function rZ(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Gc(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=ege(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}if(t=xi,n=cs,n=q3(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(ni===2||ni===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&rE(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||l_(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&rE(r),qR(n)){case 2:case 8:n=UX;break;case 32:n=O4;break;case 268435456:n=WX;break;default:n=O4}return r=sZ.bind(null,e),n=zR(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&rE(r),e.callbackPriority=2,e.callbackNode=null,2}function sZ(e,t){if(ha!==0&&ha!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(n5()&&e.callbackNode!==n)return null;var r=cs;return r=q3(e,e===xi?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(HJ(e,r,t),rZ(e,Wc()),e.callbackNode!=null&&e.callbackNode===n?sZ.bind(null,e):null)}function Oz(e,t){if(n5())return null;HJ(e,t,!0)}function A1e(){z1e(function(){qs&6?zR(HX,E1e):nZ()})}function T9(){if(Zm===0){var e=my;e===0&&(e=HS,HS<<=1,!(HS&261888)&&(HS=256)),Zm=e}return Zm}function $z(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:LC(""+e)}function Bz(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function j1e(e,t,n,r,s){if(t==="submit"&&n&&n.stateNode===s){var i=$z((s[vc]||null).action),o=r.submitter;o&&(t=(t=o[vc]||null)?$z(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var l=new H3("action","action",null,r,s);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Zm!==0){var c=o?Bz(s,o):new FormData(s);iN(n,{pending:!0,data:c,method:s.method,action:i},null,c)}}else typeof i=="function"&&(l.preventDefault(),c=o?Bz(s,o):new FormData(s),iN(n,{pending:!0,data:c,method:s.method,action:i},i,c))},currentTarget:s}]})}}for(var NE=0;NE<G7.length;NE++){var IE=G7[NE],N1e=IE.toLowerCase(),I1e=IE[0].toUpperCase()+IE.slice(1);kd(N1e,"on"+I1e)}kd(gQ,"onAnimationEnd");kd(bQ,"onAnimationIteration");kd(yQ,"onAnimationStart");kd("dblclick","onDoubleClick");kd("focusin","onFocus");kd("focusout","onBlur");kd(Gge,"onTransitionRun");kd(Kge,"onTransitionStart");kd(Yge,"onTransitionCancel");kd(vQ,"onTransitionEnd");hy("onMouseEnter",["mouseout","mouseover"]);hy("onMouseLeave",["mouseout","mouseover"]);hy("onPointerEnter",["pointerout","pointerover"]);hy("onPointerLeave",["pointerout","pointerover"]);t1("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));t1("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));t1("onBeforeInput",["compositionend","keypress","textInput","paste"]);t1("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));t1("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));t1("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var dk="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(" "),M1e=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(dk));function iZ(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;i=l,s.currentTarget=u;try{i(s)}catch(d){B4(d)}s.currentTarget=null,i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;i=l,s.currentTarget=u;try{i(s)}catch(d){B4(d)}s.currentTarget=null,i=c}}}}function ns(e,t){var n=t[B7];n===void 0&&(n=t[B7]=new Set);var r=e+"__bubble";n.has(r)||(oZ(t,e,2,!1),n.add(r))}function ME(e,t,n){var r=0;t&&(r|=4),oZ(n,e,r,t)}var ZS="_reactListening"+Math.random().toString(36).slice(2);function E9(e){if(!e[ZS]){e[ZS]=!0,QX.forEach(function(n){n!=="selectionchange"&&(M1e.has(n)||ME(n,!1,e),ME(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ZS]||(t[ZS]=!0,ME("selectionchange",!1,t))}}function oZ(e,t,n,r){switch(vZ(t)){case 2:var s=obe;break;case 8:s=abe;break;default:s=I9}n=s.bind(null,t,n,e),s=void 0,!U7||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function RE(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===s)return;o=o.return}for(;l!==null;){if(o=_b(l),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=i=o;continue e}l=l.parentNode}}r=r.return}iQ(function(){var u=i,d=WR(n),f=[];e:{var m=wQ.get(e);if(m!==void 0){var p=H3,g=e;switch(e){case"keypress":if(OC(n)===0)break e;case"keydown":case"keyup":p=Cge;break;case"focusin":g="focus",p=lE;break;case"focusout":g="blur",p=lE;break;case"beforeblur":case"afterblur":p=lE;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=GB;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=fge;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Age;break;case gQ:case bQ:case yQ:p=gge;break;case vQ:p=Nge;break;case"scroll":case"scrollend":p=dge;break;case"wheel":p=Mge;break;case"copy":case"cut":case"paste":p=yge;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=YB;break;case"toggle":case"beforetoggle":p=Dge}var b=(t&4)!==0,w=!b&&(e==="scroll"||e==="scrollend"),y=b?m!==null?m+"Capture":null:m;b=[];for(var v=u,x;v!==null;){var k=v;if(x=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||x===null||y===null||(k=rk(v,y),k!=null&&b.push(hk(v,k,x))),w)break;v=v.return}0<b.length&&(m=new p(m,g,null,n,d),f.push({event:m,listeners:b}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==H7&&(g=n.relatedTarget||n.fromElement)&&(_b(g)||g[Zy]))break e;if((p||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?_b(g):null,g!==null&&(w=o_(g),b=g.tag,g!==w||b!==5&&b!==27&&b!==6)&&(g=null)):(p=null,g=u),p!==g)){if(b=GB,k="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(b=YB,k="onPointerLeave",y="onPointerEnter",v="pointer"),w=p==null?m:Jw(p),x=g==null?m:Jw(g),m=new b(k,v+"leave",p,n,d),m.target=w,m.relatedTarget=x,k=null,_b(d)===u&&(b=new b(y,v+"enter",g,n,d),b.target=x,b.relatedTarget=w,k=b),w=k,p&&g)t:{for(b=R1e,y=p,v=g,x=0,k=y;k;k=b(k))x++;k=0;for(var S=v;S;S=b(S))k++;for(;0<x-k;)y=b(y),x--;for(;0<k-x;)v=b(v),k--;for(;x--;){if(y===v||v!==null&&y===v.alternate){b=y;break t}y=b(y),v=b(v)}b=null}else b=null;p!==null&&zz(f,m,p,b,!1),g!==null&&w!==null&&zz(f,w,g,b,!0)}}e:{if(m=u?Jw(u):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var T=ZB;else if(JB(m))if(dQ)T=Uge;else{T=qge;var _=Fge}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?u&&UR(u.elementType)&&(T=ZB):T=Hge;if(T&&(T=T(e,u))){uQ(f,T,n,d);break e}_&&_(e,m,u),e==="focusout"&&u&&m.type==="number"&&u.memoizedProps.value!=null&&q7(m,"number",m.value)}switch(_=u?Jw(u):window,e){case"focusin":(JB(_)||_.contentEditable==="true")&&(Tb=_,W7=u,kx=null);break;case"focusout":kx=W7=Tb=null;break;case"mousedown":V7=!0;break;case"contextmenu":case"mouseup":case"dragend":V7=!1,sz(f,n,d);break;case"selectionchange":if(Vge)break;case"keydown":case"keyup":sz(f,n,d)}var C;if(KR)e:{switch(e){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else Cb?lQ(e,n)&&(j="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(j="onCompositionStart");j&&(aQ&&n.locale!=="ko"&&(Cb||j!=="onCompositionStart"?j==="onCompositionEnd"&&Cb&&(C=oQ()):(Xm=d,VR="value"in Xm?Xm.value:Xm.textContent,Cb=!0)),_=nT(u,j),0<_.length&&(j=new KB(j,e,null,n,d),f.push({event:j,listeners:_}),C?j.data=C:(C=cQ(n),C!==null&&(j.data=C)))),(C=Pge?Oge(e,n):$ge(e,n))&&(j=nT(u,"onBeforeInput"),0<j.length&&(_=new KB("onBeforeInput","beforeinput",null,n,d),f.push({event:_,listeners:j}),_.data=C)),j1e(f,e,u,n,d)}iZ(f,t)})}function hk(e,t,n){return{instance:e,listener:t,currentTarget:n}}function nT(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||i===null||(s=rk(e,n),s!=null&&r.unshift(hk(e,s,i)),s=rk(e,t),s!=null&&r.push(hk(e,s,i))),e.tag===3)return r;e=e.return}return[]}function R1e(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function zz(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(l=l.tag,c!==null&&c===r)break;l!==5&&l!==26&&l!==27||u===null||(c=u,s?(u=rk(n,i),u!=null&&o.unshift(hk(n,u,c))):s||(u=rk(n,i),u!=null&&o.push(hk(n,u,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var D1e=/\r\n?/g,L1e=/\u0000|\uFFFD/g;function Fz(e){return(typeof e=="string"?e:""+e).replace(D1e,`
`).replace(L1e,"")}function aZ(e,t){return t=Fz(t),Fz(e)===t}function oi(e,t,n,r,s,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||fy(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&fy(e,""+r);break;case"className":VS(e,"class",r);break;case"tabIndex":VS(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":VS(e,n,r);break;case"style":sQ(e,r,i);break;case"data":if(t!=="object"){VS(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=LC(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(n==="formAction"?(t!=="input"&&oi(e,t,"name",s.name,s,null),oi(e,t,"formEncType",s.formEncType,s,null),oi(e,t,"formMethod",s.formMethod,s,null),oi(e,t,"formTarget",s.formTarget,s,null)):(oi(e,t,"encType",s.encType,s,null),oi(e,t,"method",s.method,s,null),oi(e,t,"target",s.target,s,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=LC(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=vf);break;case"onScroll":r!=null&&ns("scroll",e);break;case"onScrollEnd":r!=null&&ns("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(wt(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(wt(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}n=LC(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":ns("beforetoggle",e),ns("toggle",e),DC(e,"popover",r);break;case"xlinkActuate":Qh(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Qh(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Qh(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Qh(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Qh(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Qh(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Qh(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Qh(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Qh(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":DC(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=cge.get(n)||n,DC(e,n,r))}}function gN(e,t,n,r,s,i){switch(n){case"style":sQ(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(wt(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(wt(60));e.innerHTML=n}}break;case"children":typeof r=="string"?fy(e,r):(typeof r=="number"||typeof r=="bigint")&&fy(e,""+r);break;case"onScroll":r!=null&&ns("scroll",e);break;case"onScrollEnd":r!=null&&ns("scrollend",e);break;case"onClick":r!=null&&(e.onclick=vf);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!JX.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),t=n.slice(2,s?n.length-7:void 0),i=e[vc]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,s),typeof r=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,s);break e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):DC(e,n,r)}}}function ul(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ns("error",e),ns("load",e);var r=!1,s=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":r=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(wt(137,t));default:oi(e,t,i,o,n,null)}}s&&oi(e,t,"srcSet",n.srcSet,n,null),r&&oi(e,t,"src",n.src,n,null);return;case"input":ns("invalid",e);var l=i=o=s=null,c=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case"name":s=d;break;case"type":o=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":i=d;break;case"defaultValue":l=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(wt(137,t));break;default:oi(e,t,r,d,n,null)}}tQ(e,i,l,c,u,o,s,!1);return;case"select":ns("invalid",e),r=o=i=null;for(s in n)if(n.hasOwnProperty(s)&&(l=n[s],l!=null))switch(s){case"value":i=l;break;case"defaultValue":o=l;break;case"multiple":r=l;default:oi(e,t,s,l,n,null)}t=i,n=o,e.multiple=!!r,t!=null?Hb(e,!!r,t,!1):n!=null&&Hb(e,!!r,n,!0);return;case"textarea":ns("invalid",e),i=s=r=null;for(o in n)if(n.hasOwnProperty(o)&&(l=n[o],l!=null))switch(o){case"value":r=l;break;case"defaultValue":s=l;break;case"children":i=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(wt(91));break;default:oi(e,t,o,l,n,null)}rQ(e,r,s,i);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(r=n[c],r!=null))switch(c){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:oi(e,t,c,r,n,null)}return;case"dialog":ns("beforetoggle",e),ns("toggle",e),ns("cancel",e),ns("close",e);break;case"iframe":case"object":ns("load",e);break;case"video":case"audio":for(r=0;r<dk.length;r++)ns(dk[r],e);break;case"image":ns("error",e),ns("load",e);break;case"details":ns("toggle",e);break;case"embed":case"source":case"link":ns("error",e),ns("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(wt(137,t));default:oi(e,t,u,r,n,null)}return;default:if(UR(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&gN(e,t,d,r,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(r=n[l],r!=null&&oi(e,t,l,r,n,null))}function P1e(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,i=null,o=null,l=null,c=null,u=null,d=null;for(p in n){var f=n[p];if(n.hasOwnProperty(p)&&f!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":c=f;default:r.hasOwnProperty(p)||oi(e,t,p,null,r,f)}}for(var m in r){var p=r[m];if(f=n[m],r.hasOwnProperty(m)&&(p!=null||f!=null))switch(m){case"type":i=p;break;case"name":s=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":o=p;break;case"defaultValue":l=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(wt(137,t));break;default:p!==f&&oi(e,t,m,p,r,f)}}F7(e,o,l,c,u,d,i,s);return;case"select":p=o=l=m=null;for(i in n)if(c=n[i],n.hasOwnProperty(i)&&c!=null)switch(i){case"value":break;case"multiple":p=c;default:r.hasOwnProperty(i)||oi(e,t,i,null,r,c)}for(s in r)if(i=r[s],c=n[s],r.hasOwnProperty(s)&&(i!=null||c!=null))switch(s){case"value":m=i;break;case"defaultValue":l=i;break;case"multiple":o=i;default:i!==c&&oi(e,t,s,i,r,c)}t=l,n=o,r=p,m!=null?Hb(e,!!n,m,!1):!!r!=!!n&&(t!=null?Hb(e,!!n,t,!0):Hb(e,!!n,n?[]:"",!1));return;case"textarea":p=m=null;for(l in n)if(s=n[l],n.hasOwnProperty(l)&&s!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:oi(e,t,l,null,r,s)}for(o in r)if(s=r[o],i=n[o],r.hasOwnProperty(o)&&(s!=null||i!=null))switch(o){case"value":m=s;break;case"defaultValue":p=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(wt(91));break;default:s!==i&&oi(e,t,o,s,r,i)}nQ(e,m,p);return;case"option":for(var g in n)if(m=n[g],n.hasOwnProperty(g)&&m!=null&&!r.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:oi(e,t,g,null,r,m)}for(c in r)if(m=r[c],p=n[c],r.hasOwnProperty(c)&&m!==p&&(m!=null||p!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:oi(e,t,c,m,r,p)}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 b in n)m=n[b],n.hasOwnProperty(b)&&m!=null&&!r.hasOwnProperty(b)&&oi(e,t,b,null,r,m);for(u in r)if(m=r[u],p=n[u],r.hasOwnProperty(u)&&m!==p&&(m!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(wt(137,t));break;default:oi(e,t,u,m,r,p)}return;default:if(UR(t)){for(var w in n)m=n[w],n.hasOwnProperty(w)&&m!==void 0&&!r.hasOwnProperty(w)&&gN(e,t,w,void 0,r,m);for(d in r)m=r[d],p=n[d],!r.hasOwnProperty(d)||m===p||m===void 0&&p===void 0||gN(e,t,d,m,r,p);return}}for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!=null&&!r.hasOwnProperty(y)&&oi(e,t,y,null,r,m);for(f in r)m=r[f],p=n[f],!r.hasOwnProperty(f)||m===p||m==null&&p==null||oi(e,t,f,m,r,p)}function qz(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function O1e(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var s=n[r],i=s.transferSize,o=s.initiatorType,l=s.duration;if(i&&l&&qz(o)){for(o=0,l=s.responseEnd,r+=1;r<n.length;r++){var c=n[r],u=c.startTime;if(u>l)break;var d=c.transferSize,f=c.initiatorType;d&&qz(f)&&(c=c.responseEnd,o+=d*(c<l?1:(l-u)/(c-u)))}if(--r,t+=8*(i+o)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var bN=null,yN=null;function rT(e){return e.nodeType===9?e:e.ownerDocument}function Hz(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lZ(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function vN(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var DE=null;function $1e(){var e=window.event;return e&&e.type==="popstate"?e===DE?!1:(DE=e,!0):(DE=null,!1)}var cZ=typeof setTimeout=="function"?setTimeout:void 0,B1e=typeof clearTimeout=="function"?clearTimeout:void 0,Uz=typeof Promise=="function"?Promise:void 0,z1e=typeof queueMicrotask=="function"?queueMicrotask:typeof Uz<"u"?function(e){return Uz.resolve(null).then(e).catch(F1e)}:cZ;function F1e(e){setTimeout(function(){throw e})}function s0(e){return e==="head"}function Wz(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(s),xy(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Mx(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Mx(n);for(var i=n.firstChild;i;){var o=i.nextSibling,l=i.nodeName;i[u_]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&Mx(e.ownerDocument.body);n=s}while(n);xy(t)}function Vz(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=r}while(n)}function wN(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":wN(n),HR(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function q1e(e,t,n,r){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[u_])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Ou(e.nextSibling),e===null)break}return null}function H1e(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ou(e.nextSibling),e===null))return null;return e}function uZ(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ou(e.nextSibling),e===null))return null;return e}function xN(e){return e.data==="$?"||e.data==="$~"}function kN(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function U1e(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Ou(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var _N=null;function Gz(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ou(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Kz(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function dZ(e,t,n){switch(t=rT(n),e){case"html":if(e=t.documentElement,!e)throw Error(wt(452));return e;case"head":if(e=t.head,!e)throw Error(wt(453));return e;case"body":if(e=t.body,!e)throw Error(wt(454));return e;default:throw Error(wt(451))}}function Mx(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);HR(e)}var zu=new Map,Yz=new Set;function sT(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var tm=Ws.d;Ws.d={f:W1e,r:V1e,D:G1e,C:K1e,L:Y1e,m:X1e,X:J1e,S:Q1e,M:Z1e};function W1e(){var e=tm.f(),t=e5();return e||t}function V1e(e){var t=ev(e);t!==null&&t.tag===5&&t.type==="form"?sJ(t):tm.r(e)}var sv=typeof document>"u"?null:document;function hZ(e,t,n){var r=sv;if(r&&typeof t=="string"&&t){var s=Su(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),Yz.has(s)||(Yz.add(s),e={rel:e,crossOrigin:n,href:t},r.querySelector(s)===null&&(t=r.createElement("link"),ul(t,"link",e),Pa(t),r.head.appendChild(t)))}}function G1e(e){tm.D(e),hZ("dns-prefetch",e,null)}function K1e(e,t){tm.C(e,t),hZ("preconnect",e,t)}function Y1e(e,t,n){tm.L(e,t,n);var r=sv;if(r&&e&&t){var s='link[rel="preload"][as="'+Su(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Su(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Su(n.imageSizes)+'"]')):s+='[href="'+Su(e)+'"]';var i=s;switch(t){case"style":i=wy(e);break;case"script":i=iv(e)}zu.has(i)||(e=Di({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),zu.set(i,e),r.querySelector(s)!==null||t==="style"&&r.querySelector(g_(i))||t==="script"&&r.querySelector(b_(i))||(t=r.createElement("link"),ul(t,"link",e),Pa(t),r.head.appendChild(t)))}}function X1e(e,t){tm.m(e,t);var n=sv;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Su(r)+'"][href="'+Su(e)+'"]',i=s;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=iv(e)}if(!zu.has(i)&&(e=Di({rel:"modulepreload",href:e},t),zu.set(i,e),n.querySelector(s)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(b_(i)))return}r=n.createElement("link"),ul(r,"link",e),Pa(r),n.head.appendChild(r)}}}function Q1e(e,t,n){tm.S(e,t,n);var r=sv;if(r&&e){var s=qb(r).hoistableStyles,i=wy(e);t=t||"default";var o=s.get(i);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(g_(i)))l.loading=5;else{e=Di({rel:"stylesheet",href:e,"data-precedence":t},n),(n=zu.get(i))&&A9(e,n);var c=o=r.createElement("link");Pa(c),ul(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,WC(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},s.set(i,o)}}}function J1e(e,t){tm.X(e,t);var n=sv;if(n&&e){var r=qb(n).hoistableScripts,s=iv(e),i=r.get(s);i||(i=n.querySelector(b_(s)),i||(e=Di({src:e,async:!0},t),(t=zu.get(s))&&j9(e,t),i=n.createElement("script"),Pa(i),ul(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function Z1e(e,t){tm.M(e,t);var n=sv;if(n&&e){var r=qb(n).hoistableScripts,s=iv(e),i=r.get(s);i||(i=n.querySelector(b_(s)),i||(e=Di({src:e,async:!0,type:"module"},t),(t=zu.get(s))&&j9(e,t),i=n.createElement("script"),Pa(i),ul(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function Xz(e,t,n,r){var s=(s=up.current)?sT(s):null;if(!s)throw Error(wt(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=wy(n.href),n=qb(s).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=wy(n.href);var i=qb(s).hoistableStyles,o=i.get(e);if(o||(s=s.ownerDocument||s,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=s.querySelector(g_(e)))&&!i._p&&(o.instance=i,o.state.loading=5),zu.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},zu.set(e,n),i||ebe(s,e,n,o.state))),t&&r===null)throw Error(wt(528,""));return o}if(t&&r!==null)throw Error(wt(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=iv(n),n=qb(s).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(wt(444,e))}}function wy(e){return'href="'+Su(e)+'"'}function g_(e){return'link[rel="stylesheet"]['+e+"]"}function fZ(e){return Di({},e,{"data-precedence":e.precedence,precedence:null})}function ebe(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),ul(t,"link",n),Pa(t),e.head.appendChild(t))}function iv(e){return'[src="'+Su(e)+'"]'}function b_(e){return"script[async]"+e}function Qz(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Su(n.href)+'"]');if(r)return t.instance=r,Pa(r),r;var s=Di({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Pa(r),ul(r,"style",s),WC(r,n.precedence,e),t.instance=r;case"stylesheet":s=wy(n.href);var i=e.querySelector(g_(s));if(i)return t.state.loading|=4,t.instance=i,Pa(i),i;r=fZ(n),(s=zu.get(s))&&A9(r,s),i=(e.ownerDocument||e).createElement("link"),Pa(i);var o=i;return o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),ul(i,"link",r),t.state.loading|=4,WC(i,n.precedence,e),t.instance=i;case"script":return i=iv(n.src),(s=e.querySelector(b_(i)))?(t.instance=s,Pa(s),s):(r=n,(s=zu.get(i))&&(r=Di({},n),j9(r,s)),e=e.ownerDocument||e,s=e.createElement("script"),Pa(s),ul(s,"link",r),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(wt(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,WC(r,n.precedence,e));return t.instance}function WC(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=r.length?r[r.length-1]:null,i=s,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)i=l;else if(i!==s)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function A9(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function j9(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var VC=null;function Jz(e,t,n){if(VC===null){var r=new Map,s=VC=new Map;s.set(n,r)}else s=VC,r=s.get(n),r||(r=new Map,s.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var i=n[s];if(!(i[u_]||i[ol]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(i):r.set(o,[i])}}return r}function Zz(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function tbe(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function mZ(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function nbe(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var s=wy(r.href),i=t.querySelector(g_(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=iT.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Pa(i);return}i=t.ownerDocument||t,r=fZ(r),(s=zu.get(s))&&A9(r,s),i=i.createElement("link"),Pa(i);var o=i;o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),ul(i,"link",r),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=iT.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var LE=0;function rbe(e,t){return e.stylesheets&&e.count===0&&GC(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&GC(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&LE===0&&(LE=62500*O1e());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&GC(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>LE?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(s)}}:null}function iT(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)GC(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var oT=null;function GC(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oT=new Map,t.forEach(sbe,e),oT=null,iT.call(e))}function sbe(e,t){if(!(t.state.loading&4)){var n=oT.get(e);if(n)var r=n.get(null);else{n=new Map,oT.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var o=s[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}s=t.instance,o=s.getAttribute("data-precedence"),i=n.get(o)||r,i===r&&n.set(null,s),n.set(o,s),this.count++,r=iT.bind(this),s.addEventListener("load",r),s.addEventListener("error",r),i?i.parentNode.insertBefore(s,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var fk={$$typeof:yf,Provider:null,Consumer:null,_currentValue:_g,_currentValue2:_g,_threadCount:0};function ibe(e,t,n,r,s,i,o,l,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=sE(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sE(0),this.hiddenUpdates=sE(null),this.identifierPrefix=r,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function pZ(e,t,n,r,s,i,o,l,c,u,d,f){return e=new ibe(e,t,n,o,c,u,d,f,l),t=1,i===!0&&(t|=24),i=Fc(3,null,null,t),e.current=i,i.stateNode=e,t=t9(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},s9(i),e}function gZ(e){return e?(e=jb,e):jb}function bZ(e,t,n,r,s,i){s=gZ(s),r.context===null?r.context=s:r.pendingContext=s,r=hp(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=fp(e,r,t),n!==null&&(gc(n,e,t),Sx(n,e,t))}function eF(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function N9(e,t){eF(e,t),(e=e.alternate)&&eF(e,t)}function yZ(e){if(e.tag===13||e.tag===31){var t=s1(e,67108864);t!==null&&gc(t,e,67108864),N9(e,67108864)}}function tF(e){if(e.tag===13||e.tag===31){var t=Kc();t=FR(t);var n=s1(e,t);n!==null&&gc(n,e,t),N9(e,t)}}var aT=!0;function obe(e,t,n,r){var s=yr.T;yr.T=null;var i=Ws.p;try{Ws.p=2,I9(e,t,n,r)}finally{Ws.p=i,yr.T=s}}function abe(e,t,n,r){var s=yr.T;yr.T=null;var i=Ws.p;try{Ws.p=8,I9(e,t,n,r)}finally{Ws.p=i,yr.T=s}}function I9(e,t,n,r){if(aT){var s=SN(r);if(s===null)RE(e,t,r,lT,n),nF(e,r);else if(cbe(s,e,t,n,r))r.stopPropagation();else if(nF(e,r),t&4&&-1<lbe.indexOf(e)){for(;s!==null;){var i=ev(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=eg(i.pendingLanes);if(o!==0){var l=i;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var c=1<<31-Gc(o);l.entanglements[1]|=c,o&=~c}Ah(i),!(qs&6)&&(Q4=Wc()+500,p_(0))}}break;case 31:case 13:l=s1(i,2),l!==null&&gc(l,i,2),e5(),N9(i,2)}if(i=SN(r),i===null&&RE(e,t,r,lT,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else RE(e,t,r,null,n)}}function SN(e){return e=WR(e),M9(e)}var lT=null;function M9(e){if(lT=null,e=_b(e),e!==null){var t=o_(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=$X(t),e!==null)return e;e=null}else if(n===31){if(e=BX(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return lT=e,null}function vZ(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(G0e()){case HX:return 2;case UX:return 8;case O4:case K0e:return 32;case WX:return 268435456;default:return 32}default:return 32}}var CN=!1,gp=null,bp=null,yp=null,mk=new Map,pk=new Map,Vm=[],lbe="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 nF(e,t){switch(e){case"focusin":case"focusout":gp=null;break;case"dragenter":case"dragleave":bp=null;break;case"mouseover":case"mouseout":yp=null;break;case"pointerover":case"pointerout":mk.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pk.delete(t.pointerId)}}function kw(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=ev(t),t!==null&&yZ(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function cbe(e,t,n,r,s){switch(t){case"focusin":return gp=kw(gp,e,t,n,r,s),!0;case"dragenter":return bp=kw(bp,e,t,n,r,s),!0;case"mouseover":return yp=kw(yp,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return mk.set(i,kw(mk.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,pk.set(i,kw(pk.get(i)||null,e,t,n,r,s)),!0}return!1}function wZ(e){var t=_b(e.target);if(t!==null){var n=o_(t);if(n!==null){if(t=n.tag,t===13){if(t=$X(n),t!==null){e.blockedOn=t,zB(e.priority,function(){tF(n)});return}}else if(t===31){if(t=BX(n),t!==null){e.blockedOn=t,zB(e.priority,function(){tF(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function KC(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=SN(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);H7=r,n.target.dispatchEvent(r),H7=null}else return t=ev(n),t!==null&&yZ(t),e.blockedOn=n,!1;t.shift()}return!0}function rF(e,t,n){KC(e)&&n.delete(t)}function ube(){CN=!1,gp!==null&&KC(gp)&&(gp=null),bp!==null&&KC(bp)&&(bp=null),yp!==null&&KC(yp)&&(yp=null),mk.forEach(rF),pk.forEach(rF)}function e2(e,t){e.blockedOn===t&&(e.blockedOn=null,CN||(CN=!0,ma.unstable_scheduleCallback(ma.unstable_NormalPriority,ube)))}var t2=null;function sF(e){t2!==e&&(t2=e,ma.unstable_scheduleCallback(ma.unstable_NormalPriority,function(){t2===e&&(t2=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],s=e[t+2];if(typeof r!="function"){if(M9(r||n)===null)continue;break}var i=ev(n);i!==null&&(e.splice(t,3),t-=3,iN(i,{pending:!0,data:s,method:n.method,action:r},r,s))}}))}function xy(e){function t(c){return e2(c,e)}gp!==null&&e2(gp,e),bp!==null&&e2(bp,e),yp!==null&&e2(yp,e),mk.forEach(t),pk.forEach(t);for(var n=0;n<Vm.length;n++){var r=Vm[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Vm.length&&(n=Vm[0],n.blockedOn===null);)wZ(n),n.blockedOn===null&&Vm.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var s=n[r],i=n[r+1],o=s[vc]||null;if(typeof i=="function")o||sF(n);else if(o){var l=null;if(i&&i.hasAttribute("formAction")){if(s=i,o=i[vc]||null)l=o.formAction;else if(M9(s)!==null)continue}else l=o.action;typeof l=="function"?n[r+1]=l:(n.splice(r,3),r-=3),sF(n)}}}function xZ(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return s=o})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function R9(e){this._internalRoot=e}r5.prototype.render=R9.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(wt(409));var n=t.current,r=Kc();bZ(n,r,e,t,null,null)};r5.prototype.unmount=R9.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bZ(e.current,2,null,e,null,null),e5(),t[Zy]=null}};function r5(e){this._internalRoot=e}r5.prototype.unstable_scheduleHydration=function(e){if(e){var t=XX();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Vm.length&&t!==0&&t<Vm[n].priority;n++);Vm.splice(n,0,e),n===0&&wZ(e)}};var iF=PX.version;if(iF!=="19.2.4")throw Error(wt(527,iF,"19.2.4"));Ws.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(wt(188)):(e=Object.keys(e).join(","),Error(wt(268,e)));return e=z0e(t),e=e!==null?zX(e):null,e=e===null?null:e.stateNode,e};var dbe={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:yr,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var n2=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!n2.isDisabled&&n2.supportsFiber)try{a_=n2.inject(dbe),Vc=n2}catch{}}z3.createRoot=function(e,t){if(!OX(e))throw Error(wt(299));var n=!1,r="",s=hJ,i=fJ,o=mJ;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=pZ(e,1,!1,null,null,n,r,null,s,i,o,xZ),e[Zy]=t.current,E9(e),new R9(t)};z3.hydrateRoot=function(e,t,n){if(!OX(e))throw Error(wt(299));var r=!1,s="",i=hJ,o=fJ,l=mJ,c=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(l=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=pZ(e,1,!0,t,n??null,r,s,c,i,o,l,xZ),t.context=gZ(null),n=t.current,r=Kc(),r=FR(r),s=hp(r),s.callback=null,fp(n,s,r),n=r,t.current.lanes=n,c_(t,n),Ah(t),e[Zy]=t.current,E9(e),new r5(t)};z3.version="19.2.4";function kZ(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kZ)}catch(e){console.error(e)}}kZ(),NX.exports=z3;var TN=NX.exports;const hbe=i_(TN);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const fbe="agent";function mbe(e){return e===fbe}var pbe=3e4,gbe=new Set(["authorized","expired","error","cancelled"]),bbe=class{constructor(t){this.client=t}async start(t){let n=await this.client.startDeviceFlow(t),r=this.client;return{deviceFlowId:n.deviceFlowId,providerId:n.providerId,userCode:n.userCode,verificationUri:n.verificationUri,verificationUriComplete:n.verificationUriComplete,expiresAt:n.expiresAt,intervalMs:n.intervalMs,attached:n.attached,cancel:()=>r.cancelDeviceFlow(n.deviceFlowId,{clientId:t.clientId}),awaitCompletion:async(s={})=>await ybe(r,n,t.clientId,s)}}status(t,n){return this.client.getDeviceFlow(t,n)}cancel(t,n){return this.client.cancelDeviceFlow(t,n)}};async function ybe(e,t,n,r){return await vbe(e,t,n,r)}async function oF(e,t,n,r){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:r})}catch(s){if(s instanceof Zc&&s.status===404)return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,status:"error",errorKind:"not_found_or_evicted",hint:"device-flow not found on daemon (evicted past terminal grace, daemon restart, or unknown deviceFlowId)",createdAt:Date.now()};throw s}}function aF(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function vbe(e,t,n,r){var d;let s=r.signal,i=aF(r.timeoutMs,{allowZero:!0}),o=aF(r.pollOverrideMs),l=i!==void 0?Date.now()+i:t.expiresAt+pbe,c=Math.max(1e3,o??t.intervalMs??5e3),u=c;for(;;){if(s!=null&&s.aborted)throw EN(s);if(Date.now()>=l)return await oF(e,t,n,s);let f=await oF(e,t,n,s);if(f.intervalMs&&f.intervalMs!==u&&(u=f.intervalMs,c=f.intervalMs,(d=r.onThrottled)==null||d.call(r,f.intervalMs)),gbe.has(f.status))return f;await wbe(c,s)}}async function wbe(e,t){if(t!=null&&t.aborted)throw EN(t);await new Promise((n,r)=>{let s=setTimeout(()=>{o(),n()},e),i=()=>{o(),r(EN(t))};function o(){clearTimeout(s),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function EN(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var Zc=class extends Error{constructor(n,r,s){super(s);Ue(this,"status");Ue(this,"body");this.name="DaemonHttpError",this.status=n,this.body=r}},lF=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},xbe=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},cF=16*1024*1024;async function*_Z(e,t){let n=e.getReader(),r=new TextDecoder,s="",i;t&&(i=()=>{n.cancel().catch(()=>{})},t.aborted?i():t.addEventListener("abort",i,{once:!0}));try{for(;;){if(t!=null&&t.aborted)return;let o,l;try{({value:o,done:l}=await n.read())}catch(u){if(t!=null&&t.aborted)return;throw u}if(l){if(s+=r.decode(),s.length>0){let u=uF(s);for(let d of u.frames){let f=PE(d);f&&(yield f)}if(u.tail.length>0){let d=PE(u.tail);d&&(yield d)}}return}if(s+=r.decode(o,{stream:!0}),s.length>cF)throw new xbe(`parseSseStream: unread buffer exceeded ${cF} UTF-16 code units without a frame separator — upstream likely not SSE`);let c=uF(s);if(c.frames.length>0)for(let u of c.frames){let d=PE(u);d&&(yield d)}s=c.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function uF(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`

`,n);if(r===-1){let i=e.indexOf(`\r
\r
`,n);if(i===-1)break;t.push(e.slice(n,i)),n=i+4;continue}let s=e.slice(n,r).indexOf(`\r
\r
`);if(s!==-1){let i=n+s;t.push(e.slice(n,i)),n=i+4}else t.push(e.slice(n,r)),n=r+2}return{frames:t,tail:e.slice(n)}}function PE(e){if(!e)return;let t=[];for(let r of e.split(/\r?\n/)){if(!r.startsWith("data:"))continue;let s=r.slice(5);t.push(s.startsWith(" ")?s.slice(1):s)}if(t.length===0)return;let n=t.join(`
`);try{let r=JSON.parse(n);if(typeof r!="object"||r===null||Array.isArray(r)||r.v!==1||typeof r.type!="string")return;let s=r.id;return s!==void 0&&(!Number.isSafeInteger(s)||s<1)?void 0:r}catch{return}}var kbe=class{constructor(e,t,n){Ue(this,"baseUrl");Ue(this,"token");Ue(this,"_fetch");Ue(this,"activeSseRequests",new Set);Ue(this,"_disposed",!1);Ue(this,"type","rest");Ue(this,"supportsReplay",!0);Ue(this,"restFetch");this.baseUrl=e,this.token=t,this._fetch=n,this.restFetch=n}get connected(){return!this._disposed}async fetch(e,t,n){if(this._disposed)throw new lF;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var r,s;if(this._disposed)throw new lF;let n=new AbortController;this.activeSseRequests.add(n);try{let i={Accept:"text/event-stream"};this.token&&(i.Authorization=`Bearer ${this.token}`),t.lastEventId!==void 0&&(i["Last-Event-ID"]=String(t.lastEventId),t.epoch!==void 0&&(i["X-Qwen-Event-Epoch"]=t.epoch));let o=t.signal?_be([t.signal,n.signal]):n.signal,l=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(l+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let c,u=t.connectTimeoutMs;u&&Number.isFinite(u)&&(c=setTimeout(()=>n.abort(new DOMException("Initial connect timed out","TimeoutError")),u),typeof c=="object"&&c&&"unref"in c&&c.unref());let d;try{d=await this._fetch(l,{headers:i,signal:o})}finally{c!==void 0&&clearTimeout(c)}if(!d.ok){let p;try{let b=await d.text();try{p=JSON.parse(b)}catch{p=b}}catch{}let g=p&&typeof p=="object"&&"error"in p?String(p.error):`HTTP ${d.status}`;throw new Zc(d.status,p,`GET /session/:id/events: ${g}`)}let f=d.headers.get("content-type")??"";if(!f.toLowerCase().includes("text/event-stream")){try{await((r=d.body)==null?void 0:r.cancel())}catch{}throw new Zc(d.status,f,`GET /session/:id/events: expected content-type text/event-stream, got "${f}"`)}if(!d.body)throw new Error("No SSE body");let m=d.headers.get("x-qwen-event-epoch");m&&((s=t.onEpoch)==null||s.call(t,m)),yield*_Z(d.body,o)}finally{n.abort(),this.activeSseRequests.delete(n)}}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.activeSseRequests)e.abort();this.activeSseRequests.clear()}}};function _be(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,r=[],s=()=>{for(;r.length>0;){let i=r.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),s(),n.signal;let o=()=>{n.abort(i.reason),s()};i.addEventListener("abort",o,{once:!0}),r.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}var Sbe=class extends Error{constructor(t,n){super(`DaemonCapabilities.${t} is missing — ${n}. The daemon you are connected to likely predates the feature that added this field; upgrade the daemon or fall back to a different code path that doesn't require it.`);Ue(this,"capability");this.name="DaemonCapabilityMissingError",this.capability=t}},Cbe=["missing_binary","blocked_egress","auth_env_error","init_timeout","protocol_error","missing_file","parse_error","budget_exhausted","mcp_budget_would_exceed","mcp_server_spawn_failed","invalid_config","prompt_deadline_exceeded","writer_idle_timeout","model_stream_interrupted"],ov=["plan","default","auto-edit","auto","yolo"],r2="/workspace/memory/remember",s2="/workspace/memory/forget",i2="/workspace/memory/dream";function dF(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(t.v!==1||typeof t.type!="string")return;let n=t.requestId,r=t.modelSource,s=typeof n=="string"&&n.length>0,i=r==="fast"||r==="main",o=l=>l===void 0||typeof l=="number"&&Number.isSafeInteger(l)&&l>=0;if(t.type==="started"){if(!s||typeof t.model!="string"||!i)return}else if(t.type==="thinking"){if(!s)return}else if(t.type==="delta"){if(!s||!Number.isSafeInteger(t.seq)||t.seq<0||typeof t.text!="string"||t.text.length===0)return}else if(t.type==="done"){if(!s||typeof t.model!="string"||!i||!o(t.inputTokens)||!o(t.outputTokens))return}else if(t.type==="error"){if(typeof t.code!="string"||typeof t.message!="string")return}else return;return t}var cT=20,Tbe=3e4,Ebe=65e3,Abe=9e4,SZ=35e3,hF=2147483647,jbe=5,mb=33e4,Nbe="X-Qwen-Client-Id",Xe=encodeURIComponent;function CZ(e){let t=new URLSearchParams;e.cursor!==void 0&&t.set("cursor",e.cursor),e.beforeRecordId!==void 0&&t.set("beforeRecordId",e.beforeRecordId),e.limit!==void 0&&t.set("limit",String(e.limit));let n=t.toString();return n?`?${n}`:""}function fF(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function TZ(e){if(e===void 0)return jbe;if(e===null||e===0||e===1/0)return 1/0;if(!Number.isInteger(e)||e<0)throw new TypeError("bad maxPendingPromptsPerSession");return e}function Ibe(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function Mbe(){var e,t;try{let n=(t=(e=globalThis.process)==null?void 0:e.env)==null?void 0:t.QWEN_SERVER_TOKEN;if(typeof n!="string")return;let r=n.trim();return r.length===0?void 0:r}catch{return}}var mF=class extends Error{constructor(t,n,r){super(`Pending prompts full: "${t}" (${r}/${n})`),this.name="DaemonPendingPromptLimitError",this.sessionId=t,this.limit=n,this.pendingCount=r}};function EZ(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var AN=class{constructor(e){Ue(this,"baseUrl");Ue(this,"token");Ue(this,"_fetch");Ue(this,"fetchTimeoutMs");Ue(this,"promptLimit");Ue(this,"promptCounts",Object.create(null));Ue(this,"transport");Ue(this,"_authFlow");var n;this.baseUrl=Ibe(e.baseUrl),this.token=e.token??Mbe(),this._fetch=e.fetch??((n=e.transport)==null?void 0:n.restFetch)??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??Tbe;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=TZ(e.maxPendingPromptsPerSession),this.transport=e.transport??new kbe(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new bbe(this)),this._authFlow}get maxPendingPromptsPerSession(){return this.promptLimit}reservePromptSlot(e,t=this.promptLimit){if(t===1/0)return()=>{};let n=this.promptCounts,r=n[e]??0;if(r>=t)throw new mF(e,t,r);n[e]=r+1;let s;return()=>{s||(s=!0,(n[e]??0)<=1?delete n[e]:--n[e])}}async fetchWithTimeout(e,t={},n,r,s="transport"){let i=this.fetchTimeoutMs;if(r!==void 0&&Number.isFinite(r)&&r>=0&&(i=r),!i||!Number.isFinite(i)){let d=s==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(d):d}let o=new AbortController,l=setTimeout(()=>{o.abort(new DOMException("timeout","TimeoutError"))},i);typeof l=="object"&&l&&"unref"in l&&l.unref();let c=t.signal??void 0,u=c?OE([c,o.signal]):o.signal;try{let d=s==="rest"?await this._fetch(e,{...t,signal:u}):await this.transport.fetch(e,{...t,signal:u});return n?await n(d):d}finally{clearTimeout(l)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[Nbe]=t),n}async failOnError(e,t,n){let r;try{let i=await e.text();if(i.length>0)try{r=JSON.parse(i)}catch{r=i}}catch{}let s=r&&typeof r=="object"&&"error"in r?String(r.error):`HTTP ${e.status}`;if(n&&e.status===503&&r&&typeof r=="object"){let i=r;if(i.code==="prompt_queue_full")return new mF(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new Zc(e.status,r,`${t}: ${s}`)}async jsonRequest(e,t,n={}){let r=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${e}`,{...n.method?{method:n.method}:{},headers:this.headers(r?{"Content-Type":"application/json"}:{},n.clientId),...r?{body:JSON.stringify(n.body)}:{},...n.signal?{signal:n.signal}:{}},async s=>{if(!s.ok)throw await this.failOnError(s,t);return await s.json()},n.timeoutMs,n.mode)}async workspaceJsonRequest(e,t,n,r={}){return await this.jsonRequest(`/workspaces/${e}${t}`,n,r)}async sessionExportRequest(e,t,n={}){let r=n.format??"html",s=n.format?`?format=${Xe(n.format)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${s}`,{headers:this.headers({},n.clientId)},async i=>{var u;if(!i.ok)throw await this.failOnError(i,t);let o=await i.text(),l=i.headers.get("content-type")??"",c=((u=/filename="([^"]+)"/i.exec(i.headers.get("content-disposition")??""))==null?void 0:u[1])??`export.${r}`;return{content:o,filename:c,mimeType:l,format:r}},void 0,"rest")}async workspaceNoContentRequest(e,t,n,r={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces/${e}${t}`,{...r.method?{method:r.method}:{},headers:this.headers({},r.clientId)},async s=>{var i,o;if(s.status===204){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return}if(s.status===404&&r.okNotFoundCode){let l=await this.failOnError(s,n);if(((o=l.body)==null?void 0:o.code)===r.okNotFoundCode)return;throw l}throw await this.failOnError(s,n)},r.timeoutMs)}workspaceById(e){return new pF(this,Xe(e))}workspaceByCwd(e){return new pF(this,Xe(e))}async health(){return await this.fetchWithTimeout(`${this.baseUrl}/health`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /health");return await e.json()})}async capabilities(){return await this.fetchWithTimeout(`${this.baseUrl}/capabilities`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /capabilities");return await e.json()})}async notify(e,t){return await this.jsonRequest("/workspace/notify","POST /workspace/notify",{method:"POST",body:e,timeoutMs:(t==null?void 0:t.timeoutMs)??SZ,mode:"rest"})}async requireCapability(e){if(!(await this.capabilities()).features.includes(e))throw new Sbe(e,`daemon does not advertise the ${e} feature`)}async daemonStatus(e="summary"){let t=e==="summary"?"":`?detail=${e}`;return await this.jsonRequest(`/daemon/status${t}`,"GET /daemon/status")}async usageDashboard(e={}){let t=new URLSearchParams;e.range!==void 0&&t.set("range",e.range),e.heatmapDays!==void 0&&t.set("heatmapDays",String(e.heatmapDays));let n=t.toString();return await this.jsonRequest(`/usage/dashboard${n?`?${n}`:""}`,"GET /usage/dashboard")}async workspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/mcp");return await e.json()})}async initializeWorkspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/initialize`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:"{}"},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspace/mcp/initialize");return await e.json()})}async reloadWorkspaceMcp(e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify(e)},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/mcp/reload");return await t.json()})}async workspaceGit(e){return await this.jsonRequest(`/workspace/git${e!=null&&e.wait?"?wait=1":""}`,"GET /workspace/git",{mode:"rest"})}async workspaceGitDiff(){return await this.jsonRequest("/workspace/git/diff","GET /workspace/git/diff",{mode:"rest"})}async workspaceGitDiffFile(e,t){let n=`/workspace/git/diff/file?path=${Xe(e)}`+(t!=null?`&oldPath=${Xe(t)}`:"");return await this.jsonRequest(n,"GET /workspace/git/diff/file",{mode:"rest"})}async workspaceGitLog(e,t,n){let r=new URLSearchParams;e!=null&&r.set("limit",String(e)),t!=null&&r.set("skip",String(t)),n&&r.set("range",n);let s=r.toString();return await this.jsonRequest(`/workspace/git/log${s?`?${s}`:""}`,"GET /workspace/git/log",{mode:"rest"})}async workspaceGitCommitDetail(e){return await this.jsonRequest(`/workspace/git/log/commit?sha=${Xe(e)}`,"GET /workspace/git/log/commit",{mode:"rest"})}async workspaceGitBranches(){return await this.jsonRequest("/workspace/git/branches","GET /workspace/git/branches",{mode:"rest"})}async workspaceGitCheckout(e){return await this.jsonRequest("/workspace/git/checkout","POST /workspace/git/checkout",{method:"POST",body:{ref:e},mode:"rest"})}async workspaceGitCreateBranch(e,t){return await this.jsonRequest("/workspace/git/branch","POST /workspace/git/branch",{method:"POST",body:{name:e,startPoint:t},mode:"rest"})}async workspaceGitPush(e){return await this.jsonRequest("/workspace/git/push","POST /workspace/git/push",{method:"POST",body:e??{},mode:"rest"})}async workspaceGitPull(e){return await this.jsonRequest("/workspace/git/pull","POST /workspace/git/pull",{method:"POST",body:e??{},mode:"rest"})}async workspaceGitCommit(e,t){return await this.jsonRequest("/workspace/git/commit","POST /workspace/git/commit",{method:"POST",body:{message:e,...t},mode:"rest"})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${Xe(e)}/tools`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp/:server/tools");return await t.json()})}async workspaceMcpResources(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${Xe(e)}/resources`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp/:server/resources");return await t.json()})}async workspaceSkills(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/skills");return await e.json()})}async workspaceAcpPreheat(e){let t=e??5e3,n=e!==void 0?`?timeoutMs=${encodeURIComponent(e)}`:"";return await this.jsonRequest(`/workspace/acp/preheat${n}`,"POST /workspace/acp/preheat",{method:"POST",timeoutMs:t+2e3,mode:"rest"})}async workspaceAcpStatus(){return await this.jsonRequest("/workspace/acp/status","GET /workspace/acp/status",{mode:"rest"})}async workspaceProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/providers");return await e.json()})}async workspaceHooks(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/hooks`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/hooks");return await e.json()})}async sessionHooks(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/hooks`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /session/:id/hooks");return await t.json()})}async workspaceExtensions(){return await this.jsonRequest("/workspace/extensions","GET /workspace/extensions",{mode:"rest"})}async installExtension(e,t){return await this.jsonRequest("/workspace/extensions/install","POST /workspace/extensions/install",{method:"POST",body:e,clientId:t,mode:"rest"})}async extensionOperationStatus(e){return await this.jsonRequest(`/workspace/extensions/operations/${Xe(e)}`,"GET /workspace/extensions/operations/:operationId",{mode:"rest"})}async activeExtensionOperations(){return await this.jsonRequest("/workspace/extensions/operations","GET /workspace/extensions/operations",{mode:"rest"})}async respondToExtensionInteraction(e,t,n,r){return await this.jsonRequest(`/workspace/extensions/operations/${Xe(e)}/interactions/${Xe(t)}`,"POST /workspace/extensions/operations/:operationId/interactions/:interactionId",{method:"POST",body:n,clientId:r,mode:"rest"})}async checkExtensionUpdates(e){return await this.jsonRequest("/workspace/extensions/check-updates","POST /workspace/extensions/check-updates",{method:"POST",body:{},clientId:e,mode:"rest"})}async refreshExtensions(e){return await this.jsonRequest("/workspace/extensions/refresh","POST /workspace/extensions/refresh",{method:"POST",body:{},clientId:e,mode:"rest"})}async enableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${Xe(e)}/enable`,"POST /workspace/extensions/:name/enable",{method:"POST",body:t,clientId:n,mode:"rest"})}async disableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${Xe(e)}/disable`,"POST /workspace/extensions/:name/disable",{method:"POST",body:t,clientId:n,mode:"rest"})}async updateExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${Xe(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${Xe(e)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:t,mode:"rest"})}async extensionCatalog(){return await this.jsonRequest("/extensions","GET /extensions",{mode:"rest"})}async installUserExtension(e,t){return await this.jsonRequest("/extensions/install","POST /extensions/install",{method:"POST",body:e,clientId:t,mode:"rest"})}async checkUserExtensionUpdates(e){return await this.jsonRequest("/extensions/check-updates","POST /extensions/check-updates",{method:"POST",body:{},clientId:e,mode:"rest"})}async updateUserExtension(e,t){return await this.jsonRequest(`/extensions/${Xe(e)}/update`,"POST /extensions/:extensionId/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallUserExtension(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/extensions/${Xe(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var r;if(n.status===204){await((r=n.body)==null?void 0:r.cancel().catch(()=>{}));return}if(!n.ok)throw await this.failOnError(n,"DELETE /extensions/:extensionId");return await n.json()},void 0,"rest")}async setExtensionDefaultActivation(e,t,n){return await this.jsonRequest(`/extensions/${Xe(e)}/activation`,"PUT /extensions/:extensionId/activation",{method:"PUT",body:{state:t},clientId:n,mode:"rest"})}async extensionOperation(e,t){return await this.jsonRequest(`/extensions/operations/${Xe(e)}`,"GET /extensions/operations/:operationId",t?{signal:t,mode:"rest"}:{mode:"rest"})}async waitForExtensionOperation(e,t={}){var l;let n=t.pollIntervalMs??1e3,r=t.timeoutMs??10*6e4,s=r!==Number.POSITIVE_INFINITY,i=Date.now()+r,o=()=>new Error(`Timed out waiting for extension operation ${e.operationId}. The server operation was not cancelled.`);for(;;){(l=t.signal)==null||l.throwIfAborted();let c=i-Date.now();if(c<=0||Number.isNaN(c))throw o();let u;if(!s)u=await this.extensionOperation(e.operationId,t.signal);else{let f=new AbortController,m=t.signal?OE([t.signal,f.signal]):f.signal,p,g=new Promise((b,w)=>{let y=()=>{let x=o();w(x),f.abort(x)},v=()=>{let x=i-Date.now();if(x<=0){y();return}p=setTimeout(()=>{Date.now()>=i?y():v()},Math.min(x,hF))};v()});try{u=await Promise.race([this.extensionOperation(e.operationId,m),g])}finally{p!==void 0&&clearTimeout(p),f.abort()}}if(u.status!=="queued"&&u.status!=="running")return u;let d=i-Date.now();if(d<=0)throw o();await new Promise((f,m)=>{var b,w;let p=setTimeout(()=>{var y;(y=t.signal)==null||y.removeEventListener("abort",g),f()},Math.min(n,d,hF)),g=()=>{var y,v;clearTimeout(p),(y=t.signal)==null||y.removeEventListener("abort",g),m(((v=t.signal)==null?void 0:v.reason)??new DOMException("Aborted","AbortError"))};(b=t.signal)==null||b.addEventListener("abort",g,{once:!0}),(w=t.signal)!=null&&w.aborted&&g()})}}async readWorkspaceFile(e,t={},n){let r=new URL(`${this.baseUrl}/file`);return r.searchParams.set("path",e),t.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&r.searchParams.set("line",String(t.line)),t.limit!==void 0&&r.searchParams.set("limit",String(t.limit)),t.cursor!==void 0&&r.searchParams.set("cursor",t.cursor),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /file");return await s.json()})}async readWorkspaceFileBytes(e,t={},n){let r=new URL(`${this.baseUrl}/file/bytes`);return r.searchParams.set("path",e),t.offset!==void 0&&r.searchParams.set("offset",String(t.offset)),t.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(t.maxBytes)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /file/bytes");return await s.json()})}async fileStat(e){let t=new URL(`${this.baseUrl}/stat`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /stat");return await n.json()})}async dirList(e){let t=new URL(`${this.baseUrl}/list`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /list");return await n.json()})}async workspacePathSuggestions(e){let t=new URL(`${this.baseUrl}/workspace-path-suggestions`);return t.searchParams.set("prefix",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace-path-suggestions");return await n.json()})}async workspaceDirectoryPicker(){return await this.jsonRequest("/workspace-directory-picker","POST /workspace-directory-picker",{method:"POST",body:{},timeoutMs:31e4,mode:"rest"})}async glob(e){let t=new URL(`${this.baseUrl}/glob`);return t.searchParams.set("pattern",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /glob");return await n.json()})}async writeWorkspaceFile(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/file/write`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/write");return await n.json()})}async editWorkspaceFile(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/file/edit`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/edit");return await n.json()})}async workspaceMemory(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/memory");return await e.json()})}async writeWorkspaceMemory(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/memory");return await n.json()})}async rememberWorkspaceMemory(e,t={}){return await this.jsonRequest(r2,`POST ${r2}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${r2}/${Xe(e)}`,`GET ${r2}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(s2,`POST ${s2}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${s2}/${Xe(e)}`,`GET ${s2}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(i2,`POST ${i2}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${i2}/${Xe(e)}`,`GET ${i2}/:taskId`,{clientId:t==null?void 0:t.clientId})}async listWorkspaceAgents(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/agents");return await e.json()})}async createWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents");return await n.json()})}async generateWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/generate`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({description:e})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents/generate");return await n.json()},mb)}async*generateContentEvents(e,t,n,r,s,i){var c;let o=await this.transport.fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json",Accept:"text/event-stream"},r==null?void 0:r.clientId),body:JSON.stringify(n),signal:r==null?void 0:r.signal});if(!o.ok)throw await this.failOnError(o,t);if(!o.body)throw new Error("Generation response body is missing");let l=!1;for await(let u of _Z(o.body,r==null?void 0:r.signal)){let d=s(u);if(d&&(l=d.type==="done"||d.type==="error",yield d,i&&l))return}if(i&&!((c=r==null?void 0:r.signal)!=null&&c.aborted)&&!l)throw new Error("Stream ended without terminal event")}async*generateWorkspaceContent(e,t){yield*this.generateContentEvents("/workspace/generate","POST /workspace/generate",{prompt:e},t,dF,!0)}async getWorkspaceAgent(e,t={}){let n=t.scope?`${this.baseUrl}/workspace/agents/${Xe(e)}?scope=${Xe(t.scope)}`:`${this.baseUrl}/workspace/agents/${Xe(e)}`;return await this.fetchWithTimeout(n,{headers:this.headers()},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /workspace/agents/:agentType");return await r.json()})}async updateWorkspaceAgent(e,t,n={},r){let s=n.scope?`${this.baseUrl}/workspace/agents/${Xe(e)}?scope=${Xe(n.scope)}`:`${this.baseUrl}/workspace/agents/${Xe(e)}`;return await this.fetchWithTimeout(s,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t)},async i=>{if(!i.ok)throw await this.failOnError(i,"POST /workspace/agents/:agentType");return await i.json()})}async deleteWorkspaceAgent(e,t={},n){let r=t.scope?`${this.baseUrl}/workspace/agents/${Xe(e)}?scope=${Xe(t.scope)}`:`${this.baseUrl}/workspace/agents/${Xe(e)}`;return await this.fetchWithTimeout(r,{method:"DELETE",headers:this.headers({},n)},async s=>{var i;if(s.status===204){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return}if(s.status===404){let o=await this.failOnError(s,"DELETE /workspace/agents/:agentType"),l=o.body;if(l&&l.code==="agent_not_found")return;throw o}throw await this.failOnError(s,"DELETE /workspace/agents/:agentType")})}async workspaceEnv(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/env`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/env");return await e.json()})}async workspacePreflight(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/preflight`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/preflight");return await e.json()})}async workspaceTools(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/tools");return await e.json()})}async createOrAttachSession(e,t){return(e.sourceType!==void 0||e.sourceId!==void 0)&&await this.requireCapability("session_source_metadata"),await this.fetchWithTimeout(`${this.baseUrl}/session`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({cwd:e.workspaceCwd,...e.modelServiceId?{modelServiceId:e.modelServiceId}:{},...e.sessionScope!==void 0?{sessionScope:e.sessionScope}:{},...e.approvalMode!==void 0?{approvalMode:e.approvalMode}:{},...e.sourceType!==void 0?{sourceType:e.sourceType}:{},...e.sourceId!==void 0?{sourceId:e.sourceId}:{},...e.worktree!==void 0?{worktree:e.worktree}:{},...e.branch!==void 0?{branch:e.branch}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session");return await n.json()})}async listWorkspaceSessions(e,t){return(await this.listWorkspaceSessionsPage(e,t)).sessions}async listWorkspaceSessionsPage(e,t){((t==null?void 0:t.sourceType)!==void 0||(t==null?void 0:t.sourceId)!==void 0)&&await this.requireCapability("session_source_metadata");let n=(t==null?void 0:t.pageSize)??cT,r=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:cT))),s=new URLSearchParams({size:String(r)});return(t==null?void 0:t.cursor)!==void 0&&s.set("cursor",t.cursor),(t==null?void 0:t.archiveState)!==void 0&&s.set("archiveState",t.archiveState),(t==null?void 0:t.view)!==void 0&&s.set("view",t.view),(t==null?void 0:t.group)!==void 0&&s.set("group",t.group),(t==null?void 0:t.parentSessionId)!==void 0&&s.set("parentSessionId",t.parentSessionId),(t==null?void 0:t.sourceType)!==void 0&&s.set("sourceType",t.sourceType),(t==null?void 0:t.sourceId)!==void 0&&s.set("sourceId",t.sourceId),await this.jsonRequest(`/workspace/${Xe(e)}/sessions?${s.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${Xe(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${Xe(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${Xe(e)}/session-groups/${Xe(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${Xe(e)}/session-groups/${Xe(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${Xe(e)}/organization`,"PATCH /session/:id/organization",{method:"PATCH",body:t,clientId:n})}async loadSession(e,t={},n){return this.restoreSession("load",e,t,n)}async exportSession(e,t={}){return await this.sessionExportRequest(`/session/${Xe(e)}/export`,"GET /session/:id/export",t)}async getSessionTranscriptPage(e,t={}){return await this.jsonRequest(`/session/${Xe(e)}/transcript${CZ(t)}`,"GET /session/:id/transcript",{clientId:t.clientId,mode:"rest"})}async resolveSubagentSession(e,t,n){return await this.jsonRequest(`/session/${Xe(e)}/subagents/${Xe(t)}`,"GET /session/:id/subagents/:toolCallId",{clientId:n,mode:"rest"})}async cancelSubagentSession(e,t,n){return await this.jsonRequest(`/session/${Xe(e)}/subagents/${Xe(t)}/cancel`,"POST /session/:id/subagents/:toolCallId/cancel",{clientId:n,mode:"rest",method:"POST"})}async resumeSession(e,t={},n){return this.restoreSession("resume",e,t,n)}async branchSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({...t.name!==void 0?{name:t.name}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/branch");return await r.json()})}async createSideTaskSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/side-task`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({...t.name!==void 0?{name:t.name}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/side-task");return await r.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/fork`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({directive:t.directive})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/fork");return await r.json()})}async sessionContext(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/context`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/context");return await n.json()})}async sessionStatus(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/status`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/status");return await n.json()})}async sessionContextUsage(e,t={},n){let r=new URLSearchParams;t.detail===!0&&r.set("detail","true");let s=r.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/context-usage${s?`?${s}`:""}`,{headers:this.headers({},n)},async i=>{if(!i.ok)throw await this.failOnError(i,"GET /session/:id/context-usage");return await i.json()})}async sessionSupportedCommands(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/supported-commands`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/supported-commands");return await n.json()})}async sessionTasks(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/tasks`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/tasks");return await n.json()})}async sessionLspStatus(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/lsp`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/lsp");return await n.json()})}async sessionTaskCancel(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/tasks/${Xe(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({kind:n})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/tasks/:taskId/cancel");return await s.json()})}async sessionGoalClear(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/goal/clear`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/goal/clear");return await n.json()})}async sessionStats(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/stats`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/stats");return await n.json()})}async restoreSession(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({cwd:n.workspaceCwd,...n.approvalMode!==void 0?{approvalMode:n.approvalMode}:{},...e==="load"&&n.historyPageSize!==void 0?{historyPageSize:n.historyPageSize}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,`POST /session/:id/${e}`);return await s.json()})}async setSessionApprovalMode(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/approval-mode`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({mode:t,...(n==null?void 0:n.persist)===!0?{persist:!0}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/approval-mode");return await r.json()})}async getRewindSnapshots(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/rewind/snapshots`,{method:"GET",headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /session/:id/rewind/snapshots");return await t.json()},void 0,"rest")}async rewindSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/rewind`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({promptId:t,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/rewind");return await r.json()},void 0,"rest")}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${Xe(e)}/recap`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}",signal:t==null?void 0:t.signal});if(!n.ok)throw await this.failOnError(n,"POST /session/:id/recap");return await n.json()}async*generateSessionContent(e,t,n){yield*this.generateContentEvents(`/session/${Xe(e)}/generate`,"POST /session/:id/generate",{prompt:t},n,dF,!1)}async btwSession(e,t,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${Xe(e)}/btw`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({question:t}),signal:n==null?void 0:n.signal});if(!r.ok)throw await this.failOnError(r,"POST /session/:id/btw");return await r.json()}async enqueueMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/mid-turn-message`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({message:t}),signal:n==null?void 0:n.signal},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/mid-turn-message");return await r.json()})}async getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/pending-prompts`,{method:"GET",headers:this.headers({},t==null?void 0:t.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/pending-prompts");return await n.json()})}async removePendingPrompt(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/pending-prompts/${Xe(t)}`,{method:"DELETE",headers:this.headers({},n==null?void 0:n.clientId)},async r=>{if(!r.ok)throw await this.failOnError(r,"DELETE /session/:id/pending-prompts/:promptId");return await r.json()})}async shellCommand(e,t,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${Xe(e)}/shell`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({command:t}),signal:n==null?void 0:n.signal});if(!r.ok)throw await this.failOnError(r,"POST /session/:id/shell");return await r.json()}async setWorkspaceToolEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${Xe(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/tools/:name/enable");return await r.json()})}async setWorkspaceSkillEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills/${Xe(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/skills/:name/enable");return await r.json()})}installWorkspaceSkill(e){return this.jsonRequest("/workspace/skills/install","Skill",{method:"POST",body:e})}deleteWorkspaceSkill(e,t){return this.jsonRequest(`/workspace/skills/${Xe(e)}?scope=${t}`,"Skill",{method:"DELETE"})}async workspaceSettings(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/settings");return await t.json()})}async setWorkspaceSetting(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r==null?void 0:r.clientId),body:JSON.stringify({scope:e,key:t,value:n,...r!=null&&r.mcpServerMutation?{mcpServerMutation:r.mcpServerMutation}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/settings");return await s.json()})}async deleteModel(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/models`,{method:"DELETE",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"DELETE /workspace/models");return await n.json()})}async workspaceVoice(e){return await this.jsonRequest("/workspace/voice","GET /workspace/voice",{clientId:e})}async setWorkspaceVoice(e,t){return await this.jsonRequest("/workspace/voice","POST /workspace/voice",{method:"POST",body:e,clientId:t})}async transcribeWorkspaceVoice(e,t){return await this.voiceTranscriptionRequest("/workspace/voice/transcribe","POST /workspace/voice/transcribe",e,t)}async workspaceVoiceTranscriptionRequest(e,t,n){return await this.voiceTranscriptionRequest(`/workspaces/${e}/voice/transcribe`,"POST /workspaces/:workspace/voice/transcribe",t,n)}async voiceTranscriptionRequest(e,t,n,r){let s=r.voiceModel?`?${new URLSearchParams({voiceModel:r.voiceModel}).toString()}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${s}`,{method:"POST",headers:this.headers({"Content-Type":r.mimeType},r.clientId),body:n},async i=>{if(!i.ok)throw await this.failOnError(i,t);return await i.json()},r.timeoutMs??Ebe,"rest")}async workspaceTrust(e){let t=(e==null?void 0:e.statusVersion)===2?"?statusVersion=2":"";return await this.fetchWithTimeout(`${this.baseUrl}/workspace/trust${t}`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace/trust");return await n.json()})}async requestWorkspaceTrustChange(e,t){return await this.jsonRequest("/workspace/trust/request","POST /workspace/trust/request",{method:"POST",body:e,clientId:t})}async workspacePermissions(e){return await this.jsonRequest("/workspace/permissions","GET /workspace/permissions",{clientId:e==null?void 0:e.clientId})}async setWorkspacePermissionRules(e,t,n,r){return await this.jsonRequest("/workspace/permissions","POST /workspace/permissions",{method:"POST",body:{scope:e,ruleType:t,rules:[...n]},clientId:r==null?void 0:r.clientId})}async addWorkspacePermissionRule(e,t,n,r){let s=fF(n),i=await this.workspacePermissions(r),o=i[e].rules[t];return o.includes(s)?i:await this.setWorkspacePermissionRules(e,t,[...o,s],r)}async removeWorkspacePermissionRule(e,t,n,r){let s=fF(n),i=await this.workspacePermissions(r),o=i[e].rules[t];return o.includes(s)?await this.setWorkspacePermissionRules(e,t,o.filter(l=>l!==s),r):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${Xe(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${Xe(e)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/mcp/:server/restart");return await r.json()},(t==null?void 0:t.timeoutMs)??mb)}async reload(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:"{}"},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/reload");return await t.json()},e==null?void 0:e.timeoutMs)}async reloadChannelWorker(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:"{}"},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/channel/reload");return await t.json()},(e==null?void 0:e.timeoutMs)??213e4)}async getChannelWorkerControl(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/channel");return await t.json()},e==null?void 0:e.timeoutMs)}async setChannelWorkerSelection(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"PUT",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify({selection:e})},async n=>{if(!n.ok)throw await this.failOnError(n,"PUT /workspace/channel");return await n.json()},(t==null?void 0:t.timeoutMs)??213e4)}async stopChannelWorker(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"DELETE",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"DELETE /workspace/channel");return await t.json()},(e==null?void 0:e.timeoutMs)??213e4)}workspaceChannelTypes(e){return this.jsonRequest("/workspace/channel-types","GET /workspace/channel-types",{clientId:e==null?void 0:e.clientId,timeoutMs:e==null?void 0:e.timeoutMs,mode:"rest"})}workspaceChannels(e){return this.jsonRequest("/workspace/channels","GET /workspace/channels",{clientId:e==null?void 0:e.clientId,timeoutMs:e==null?void 0:e.timeoutMs,mode:"rest"})}upsertWorkspaceChannel(e,t,n){return this.jsonRequest(`/workspace/channels/${Xe(e)}`,"PUT /workspace/channels/:name",{method:"PUT",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}deleteWorkspaceChannel(e,t,n){return this.jsonRequest(`/workspace/channels/${Xe(e)}`,"DELETE /workspace/channels/:name",{method:"DELETE",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}setWorkspaceChannelStartup(e,t,n){return this.jsonRequest(`/workspace/channels/${Xe(e)}/startup`,"PUT /workspace/channels/:name/startup",{method:"PUT",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}startWorkspaceChannel(e,t){return this.workspaceChannelAction(e,"start",t)}stopWorkspaceChannel(e,t){return this.workspaceChannelAction(e,"stop",t)}restartWorkspaceChannel(e,t){return this.workspaceChannelAction(e,"restart",t)}workspaceChannelPairingRequests(e,t){return this.jsonRequest(`/workspace/channels/${Xe(e)}/pairing-requests`,"GET /workspace/channels/:name/pairing-requests",{clientId:t==null?void 0:t.clientId,timeoutMs:t==null?void 0:t.timeoutMs,mode:"rest"})}approveWorkspaceChannelPairing(e,t,n){return this.jsonRequest(`/workspace/channels/${Xe(e)}/pairing-requests/approve`,"POST /workspace/channels/:name/pairing-requests/approve",{method:"POST",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}workspaceChannelPairingApprovals(e,t){return this.jsonRequest(`/workspace/channels/${Xe(e)}/pairing-approvals`,"GET /workspace/channels/:name/pairing-approvals",{clientId:t==null?void 0:t.clientId,timeoutMs:t==null?void 0:t.timeoutMs,mode:"rest"})}revokeWorkspaceChannelPairingApproval(e,t,n){return this.jsonRequest(`/workspace/channels/${Xe(e)}/pairing-approvals`,"DELETE /workspace/channels/:name/pairing-approvals",{method:"DELETE",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}workspaceChannelAction(e,t,n){return this.jsonRequest(`/workspace/channels/${Xe(e)}/${t}`,`POST /workspace/channels/:name/${t}`,{method:"POST",body:{},clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}async manageMcpServer(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${Xe(e)}/${Xe(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:"{}"},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/mcp/:server/:action");return await r.json()},(n==null?void 0:n.timeoutMs)??mb)}async addRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/mcp/servers");return await n.json()},(t==null?void 0:t.timeoutMs)??mb)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${Xe(e)}`,{method:"DELETE",headers:this.headers({},t==null?void 0:t.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"DELETE /workspace/mcp/servers/:name");return await n.json()},(t==null?void 0:t.timeoutMs)??mb)}async initWorkspace(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/init`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:JSON.stringify((e==null?void 0:e.force)===!0?{force:!0}:{})},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/init");return await t.json()})}async setupGithub(e,t){return await this.jsonRequest("/workspace/setup-github","POST /workspace/setup-github",{method:"POST",body:e,clientId:t,timeoutMs:Abe})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/model");return await r.json()})}async setSessionLanguage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/language`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({language:t,syncOutputLanguage:(n==null?void 0:n.syncOutputLanguage)??!1})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/language");return await r.json()})}async prompt(e,t,n,r){n==null||n.throwIfAborted();let s=this.reservePromptSlot(e),i=!0;try{let o=await this.transport.fetch(`${this.baseUrl}/session/${Xe(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t),signal:n});if(o.status===202){let l=await o.json();i=!1;try{return await this._awaitTurnComplete(e,l.promptId,l.lastEventId,n,r,l.eventEpoch)}finally{s()}}if(!o.ok)throw await this.failOnError(o,"POST /session/:id/prompt",e);return await o.json()}finally{i&&s()}}async promptNonBlocking(e,t,n,r){let s=await this.transport.fetch(`${this.baseUrl}/session/${Xe(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t),signal:n});if(s.status===202)return await s.json();if(!s.ok)throw await this.failOnError(s,"POST /session/:id/prompt",e);return await s.json()}async _awaitTurnComplete(e,t,n,r,s,i){let o=new AbortController,l=r?OE([r,o.signal]):o.signal;try{let c=this.subscribeEvents(e,{lastEventId:n,...i!==void 0?{epoch:i}:{},signal:l});for await(let u of c){let d=D9(u,t);if(d!==void 0)return d}throw new Error("SSE stream ended")}catch(c){throw r!=null&&r.aborted&&c instanceof DOMException&&c.name==="AbortError"&&this.cancel(e,s).catch(()=>{}),c}finally{o.signal.aborted||o.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/heartbeat`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/heartbeat");return await n.json()})}async cancel(e,t){await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{var r;if(!n.ok&&n.status!==204)throw await this.failOnError(n,"POST /session/:id/cancel");try{await((r=n.body)==null?void 0:r.cancel())}catch{}})}async*subscribeEvents(e,t={}){yield*this.transport.subscribeEvents(e,{lastEventId:t.lastEventId,epoch:t.epoch,onEpoch:t.onEpoch,maxQueued:t.maxQueued,signal:t.signal,connectTimeoutMs:this.fetchTimeoutMs||void 0})}async respondToPermission(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/permission/${Xe(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async r=>{var s,i;if(r.status===200){try{await((s=r.body)==null?void 0:s.cancel())}catch{}return!0}if(r.status===404){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /permission/:requestId")})}async respondToSessionPermission(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/permission/${Xe(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(n)},async s=>{var i,o;if(s.status===200){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!0}if(s.status===404){try{await((o=s.body)==null?void 0:o.cancel())}catch{}return!1}throw await this.failOnError(s,"POST /session/:id/permission/:requestId")})}async closeSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /session/:id")})}async detachSession(e,t){if(t)return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/detach`,{method:"POST",headers:this.headers({},t)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"POST /session/:id/detach")})}async deleteSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/delete`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/delete")})}async archiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/archive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/archive")})}async unarchiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/unarchive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/unarchive")})}async startDeviceFlow(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e.clientId),body:JSON.stringify({providerId:e.providerId})},async t=>{if(t.status!==200&&t.status!==201)throw await this.failOnError(t,"POST /workspace/auth/device-flow");return await t.json()})}async getDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${Xe(e)}`,{headers:this.headers({},t.clientId),signal:t.signal},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace/auth/device-flow/:id");return await n.json()})}async cancelDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${Xe(e)}`,{method:"DELETE",headers:this.headers({},t.clientId)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /workspace/auth/device-flow/:id")})}async getAuthStatus(e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/status`,{headers:this.headers({},e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/auth/status");return await t.json()})}async getAuthProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/auth/providers");return await e.json()})}async installAuthProvider(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/provider`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify(e)},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/auth/provider");return await t.json()})}async addWorkspace(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify({cwd:e,...t.persist?{persist:!0}:{},...t.displayName!==void 0?{displayName:t.displayName}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspaces");return await n.json()})}async updateWorkspace(e,t){return await this.workspaceJsonRequest(Xe(e),"","PATCH /workspaces/:workspace",{method:"PATCH",body:t,mode:"rest"})}async addScratchWorkspace(){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify({kind:"scratch"})},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspaces");return await e.json()})}dispose(){this.transport.dispose()}async listSessionArtifacts(e,t){return await this.jsonRequest(`/session/${Xe(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${Xe(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${Xe(e)}/artifacts/${Xe(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Xe(e)}/metadata`,{method:"PATCH",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async r=>{if(r.status===200){let s=await r.json();return typeof s.displayName=="string"?{displayName:s.displayName}:{}}throw await this.failOnError(r,"PATCH /session/:id/metadata")})}},pF=class{constructor(e,t){this.client=e,this.workspaceSelector=t}workspaceMcp(){return this.get("/mcp","GET /workspaces/:workspace/mcp")}notify(e,t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/notify","POST /workspaces/:workspace/notify",{method:"POST",body:e,timeoutMs:(t==null?void 0:t.timeoutMs)??SZ,mode:"rest"})}workspaceChannelTypes(e){return this.channelRequest("/channel-types","GET /workspaces/:workspace/channel-types",void 0,e)}workspaceChannels(e){return this.channelRequest("/channels","GET /workspaces/:workspace/channels",void 0,e)}upsertWorkspaceChannel(e,t,n){return this.channelRequest(`/channels/${Xe(e)}`,"PUT /workspaces/:workspace/channels/:name",{method:"PUT",body:t},n)}deleteWorkspaceChannel(e,t,n){return this.channelRequest(`/channels/${Xe(e)}`,"DELETE /workspaces/:workspace/channels/:name",{method:"DELETE",body:t},n)}setWorkspaceChannelStartup(e,t,n){return this.channelRequest(`/channels/${Xe(e)}/startup`,"PUT /workspaces/:workspace/channels/:name/startup",{method:"PUT",body:t},n)}startWorkspaceChannel(e,t){return this.channelAction(e,"start",t)}stopWorkspaceChannel(e,t){return this.channelAction(e,"stop",t)}restartWorkspaceChannel(e,t){return this.channelAction(e,"restart",t)}workspaceChannelPairingRequests(e,t){return this.channelRequest(`/channels/${Xe(e)}/pairing-requests`,"GET /workspaces/:workspace/channels/:name/pairing-requests",void 0,t)}approveWorkspaceChannelPairing(e,t,n){return this.channelRequest(`/channels/${Xe(e)}/pairing-requests/approve`,"POST /workspaces/:workspace/channels/:name/pairing-requests/approve",{method:"POST",body:t},n)}workspaceChannelPairingApprovals(e,t){return this.channelRequest(`/channels/${Xe(e)}/pairing-approvals`,"GET /workspaces/:workspace/channels/:name/pairing-approvals",void 0,t)}revokeWorkspaceChannelPairingApproval(e,t,n){return this.channelRequest(`/channels/${Xe(e)}/pairing-approvals`,"DELETE /workspaces/:workspace/channels/:name/pairing-approvals",{method:"DELETE",body:t},n)}channelAction(e,t,n){return this.channelRequest(`/channels/${Xe(e)}/${t}`,`POST /workspaces/:workspace/channels/:name/${t}`,{method:"POST",body:{}},n)}channelRequest(e,t,n,r){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{...n??{},clientId:r==null?void 0:r.clientId,timeoutMs:(r==null?void 0:r.timeoutMs)??(n?213e4:void 0),mode:"rest"})}initializeWorkspaceMcp(){return this.post("/mcp/initialize","POST /workspaces/:workspace/mcp/initialize",{})}reloadWorkspaceMcp(e={}){return this.post("/mcp/reload","POST /workspaces/:workspace/mcp/reload",e)}workspaceVoice(e){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","GET /workspaces/:workspace/voice",{clientId:e,mode:"rest"})}setWorkspaceVoice(e,t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","POST /workspaces/:workspace/voice",{method:"POST",body:e,clientId:t,mode:"rest"})}transcribeWorkspaceVoice(e,t){return this.client.workspaceVoiceTranscriptionRequest(this.workspaceSelector,e,t)}workspaceGit(e){let t=new URLSearchParams;e!=null&&e.cwd&&t.set("cwd",e.cwd),e!=null&&e.wait&&t.set("wait","1");let n=t.toString(),r=n?`/git?${n}`:"/git";return this.client.workspaceJsonRequest(this.workspaceSelector,r,"GET /workspaces/:workspace/git",{mode:"rest"})}workspaceGitDiff(e){let t=e!=null?`/git/diff?cwd=${Xe(e)}`:"/git/diff";return this.client.workspaceJsonRequest(this.workspaceSelector,t,"GET /workspaces/:workspace/git/diff",{mode:"rest"})}workspaceGitDiffFile(e,t,n){let r=`/git/diff/file?path=${Xe(e)}`+(t!=null?`&oldPath=${Xe(t)}`:"")+(n!=null?`&cwd=${Xe(n)}`:"");return this.client.workspaceJsonRequest(this.workspaceSelector,r,"GET /workspaces/:workspace/git/diff/file",{mode:"rest"})}workspaceGitLog(e,t,n,r){let s=new URLSearchParams;e!=null&&s.set("limit",String(e)),t!=null&&s.set("skip",String(t)),n!=null&&s.set("cwd",n),r&&s.set("range",r);let i=s.toString();return this.client.workspaceJsonRequest(this.workspaceSelector,`/git/log${i?`?${i}`:""}`,"GET /workspaces/:workspace/git/log",{mode:"rest"})}workspaceGitCommitDetail(e,t){let n=`/git/log/commit?sha=${Xe(e)}`+(t!=null?`&cwd=${Xe(t)}`:"");return this.client.workspaceJsonRequest(this.workspaceSelector,n,"GET /workspaces/:workspace/git/log/commit",{mode:"rest"})}workspaceGitBranches(e){let t=e!=null?`/git/branches?cwd=${Xe(e)}`:"/git/branches";return this.client.workspaceJsonRequest(this.workspaceSelector,t,"GET /workspaces/:workspace/git/branches",{mode:"rest"})}workspaceGitCheckout(e,t){let n=t!=null?`/git/checkout?cwd=${Xe(t)}`:"/git/checkout";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"POST /workspaces/:workspace/git/checkout",{method:"POST",body:{ref:e},mode:"rest"})}workspaceGitCreateBranch(e,t,n){let r=n!=null?`/git/branch?cwd=${Xe(n)}`:"/git/branch";return this.client.workspaceJsonRequest(this.workspaceSelector,r,"POST /workspaces/:workspace/git/branch",{method:"POST",body:{name:e,startPoint:t},mode:"rest"})}workspaceGitPush(e,t){let n=t!=null?`/git/push?cwd=${Xe(t)}`:"/git/push";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"POST /workspaces/:workspace/git/push",{method:"POST",body:e??{},mode:"rest"})}workspaceGitPull(e,t){let n=t!=null?`/git/pull?cwd=${Xe(t)}`:"/git/pull";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"POST /workspaces/:workspace/git/pull",{method:"POST",body:e??{},mode:"rest"})}workspaceGitCommit(e,t,n){let r=n!=null?`/git/commit?cwd=${Xe(n)}`:"/git/commit";return this.client.workspaceJsonRequest(this.workspaceSelector,r,"POST /workspaces/:workspace/git/commit",{method:"POST",body:{message:e,...t},mode:"rest"})}workspaceGitHubPullRequests(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/github/prs","GET /workspaces/:workspace/github/prs",{mode:"rest"})}workspaceGitHubCreatePullRequest(e,t){let n=t!=null?`/github/prs/create?cwd=${Xe(t)}`:"/github/prs/create";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"POST /workspaces/:workspace/github/prs/create",{method:"POST",body:e,mode:"rest"})}workspaceGitHubDefaultBranch(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/github/default-branch","GET /workspaces/:workspace/github/default-branch",{mode:"rest"})}workspaceSkills(){return this.get("/skills","GET /workspaces/:workspace/skills")}workspaceProviders(){return this.get("/providers","GET /workspaces/:workspace/providers")}workspaceHooks(){return this.get("/hooks","GET /workspaces/:workspace/hooks")}workspaceEnv(){return this.get("/env","GET /workspaces/:workspace/env")}workspacePreflight(){return this.get("/preflight","GET /workspaces/:workspace/preflight")}workspaceTools(){return this.get("/tools","GET /workspaces/:workspace/tools")}workspaceMemory(){return this.get("/memory","GET /workspaces/:workspace/memory")}remove(e){let t=(e==null?void 0:e.force)===void 0?void 0:{force:e.force};return this.client.workspaceJsonRequest(this.workspaceSelector,"","DELETE /workspaces/:workspace",{method:"DELETE",...t?{body:t}:{},...(e==null?void 0:e.timeoutMs)!==void 0?{timeoutMs:e.timeoutMs}:{},mode:"rest"})}writeWorkspaceMemory(e,t){return this.post("/memory","POST /workspaces/:workspace/memory",{...e,scope:"workspace"},t)}listWorkspaceAgents(){return this.get("/agents","GET /workspaces/:workspace/agents")}createWorkspaceAgent(e,t){return this.post("/agents","POST /workspaces/:workspace/agents",{...e,scope:e.scope??"workspace"},t)}getWorkspaceAgent(e){return this.get(`/agents/${Xe(e)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(e,t,n={}){let r=n.scope?`?scope=${Xe(n.scope)}`:"";return this.post(`/agents/${Xe(e)}${r}`,"POST /workspaces/:workspace/agents/:agentType",t,n.clientId)}async deleteWorkspaceAgent(e,t={}){let n=t.scope?`?scope=${Xe(t.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${Xe(e)}${n}`,"DELETE /workspaces/:workspace/agents/:agentType",{method:"DELETE",clientId:t.clientId,okNotFoundCode:"agent_not_found"})}async listWorkspaceSessionsPage(e){((e==null?void 0:e.sourceType)!==void 0||(e==null?void 0:e.sourceId)!==void 0)&&await this.client.requireCapability("session_source_metadata");let t=(e==null?void 0:e.pageSize)??cT,n=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(t)?t:cT))),r=new URLSearchParams({size:String(n)});return(e==null?void 0:e.cursor)!==void 0&&r.set("cursor",e.cursor),(e==null?void 0:e.archiveState)!==void 0&&r.set("archiveState",e.archiveState),(e==null?void 0:e.view)!==void 0&&r.set("view",e.view),(e==null?void 0:e.group)!==void 0&&r.set("group",e.group),(e==null?void 0:e.parentSessionId)!==void 0&&r.set("parentSessionId",e.parentSessionId),(e==null?void 0:e.sourceType)!==void 0&&r.set("sourceType",e.sourceType),(e==null?void 0:e.sourceId)!==void 0&&r.set("sourceId",e.sourceId),await this.get(`/sessions?${r.toString()}`,"GET /workspaces/:workspace/sessions")}async listWorkspaceSessions(e){return(await this.listWorkspaceSessionsPage(e)).sessions}getWorkspaceSessionInfo(){return this.get("/session-info","GET /workspaces/:workspace/session-info")}getSessionTranscriptPage(e,t={}){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${Xe(e)}/transcript${CZ(t)}`,"GET /workspaces/:workspace/session/:id/transcript",{clientId:t.clientId,mode:"rest"})}exportSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${Xe(e)}/export`,"GET /workspaces/:workspace/session/:id/export",t)}exportArchivedSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${Xe(e)}/archive/export`,"GET /workspaces/:workspace/session/:id/archive/export",t)}listSessionGroups(){return this.get("/session-groups","GET /workspaces/:workspace/session-groups")}async createSessionGroup(e){return(await this.post("/session-groups","POST /workspaces/:workspace/session-groups",e)).group}async updateSessionGroup(e,t){return(await this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${Xe(e)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:t})).group}deleteSessionGroup(e){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${Xe(e)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}updateSessionOrganization(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${Xe(e)}/organization`,"PATCH /workspaces/:workspace/session/:id/organization",{method:"PATCH",body:t,clientId:n})}deleteSessionsData(e,t){return this.post("/sessions/delete","POST /workspaces/:workspace/sessions/delete",{sessionIds:e},t)}archiveSessionsData(e,t){return this.post("/sessions/archive","POST /workspaces/:workspace/sessions/archive",{sessionIds:e},t)}unarchiveSessionsData(e,t){return this.post("/sessions/unarchive","POST /workspaces/:workspace/sessions/unarchive",{sessionIds:e},t)}readWorkspaceFile(e,t={},n){let r=new URLSearchParams({path:e});return t.maxBytes!==void 0&&r.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&r.set("line",String(t.line)),t.limit!==void 0&&r.set("limit",String(t.limit)),t.cursor!==void 0&&r.set("cursor",t.cursor),this.get(`/file?${r.toString()}`,"GET /workspaces/:workspace/file",n)}readWorkspaceFileBytes(e,t={},n){let r=new URLSearchParams({path:e});return t.offset!==void 0&&r.set("offset",String(t.offset)),t.maxBytes!==void 0&&r.set("maxBytes",String(t.maxBytes)),this.get(`/file/bytes?${r.toString()}`,"GET /workspaces/:workspace/file/bytes",n)}fileStat(e){let t=new URLSearchParams({path:e});return this.get(`/stat?${t.toString()}`,"GET /workspaces/:workspace/stat")}dirList(e){let t=new URLSearchParams({path:e});return this.get(`/list?${t.toString()}`,"GET /workspaces/:workspace/list")}glob(e,t={}){let n=new URLSearchParams({pattern:e});return t.maxResults!==void 0&&n.set("maxResults",String(t.maxResults)),this.client.workspaceJsonRequest(this.workspaceSelector,`/glob?${n.toString()}`,"GET /workspaces/:workspace/glob",{signal:t.signal})}writeWorkspaceFile(e,t){return this.post("/file/write","POST /workspaces/:workspace/file/write",e,t)}editWorkspaceFile(e,t){return this.post("/file/edit","POST /workspaces/:workspace/file/edit",e,t)}workspaceSettings(e){return this.get("/settings","GET /workspaces/:workspace/settings",e==null?void 0:e.clientId)}setWorkspaceSetting(e,t,n,r){return this.post("/settings","POST /workspaces/:workspace/settings",{scope:e,key:t,value:n,...r!=null&&r.mcpServerMutation?{mcpServerMutation:r.mcpServerMutation}:{}},r==null?void 0:r.clientId)}workspaceTrust(e){return this.get((e==null?void 0:e.statusVersion)===2?"/trust?statusVersion=2":"/trust","GET /workspaces/:workspace/trust",e==null?void 0:e.clientId)}requestWorkspaceTrustChange(e,t){return this.post("/trust/request","POST /workspaces/:workspace/trust/request",e,t)}workspacePermissions(e){return this.get("/permissions","GET /workspaces/:workspace/permissions",e==null?void 0:e.clientId)}setWorkspacePermissionRules(e,t,n){return this.post("/permissions","POST /workspaces/:workspace/permissions",{scope:"workspace",ruleType:e,rules:[...t]},n==null?void 0:n.clientId)}setWorkspaceToolEnabled(e,t,n){return this.post(`/tools/${Xe(e)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:t},n==null?void 0:n.clientId)}setWorkspaceSkillEnabled(e,t,n){return this.post(`/skills/${Xe(e)}/enable`,"POST /workspaces/:workspace/skills/:name/enable",{enabled:t},n==null?void 0:n.clientId)}restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${Xe(String(t.entryIndex))}`;return this.post(`/mcp/${Xe(e)}/restart${n}`,"POST /workspaces/:workspace/mcp/:server/restart",{},t==null?void 0:t.clientId,(t==null?void 0:t.timeoutMs)??mb)}reload(e){return this.post("/reload","POST /workspaces/:workspace/reload",{},e==null?void 0:e.clientId,e==null?void 0:e.timeoutMs)}initWorkspace(e){return this.post("/init","POST /workspaces/:workspace/init",(e==null?void 0:e.force)===!0?{force:!0}:{},e==null?void 0:e.clientId)}workspaceExtensions(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions","GET /workspaces/:workspace/extensions",{mode:"rest"})}setExtensionActivation(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${Xe(e)}/activation`,"PUT /workspaces/:workspace/extensions/:extensionId/activation",{method:"PUT",body:{state:t},clientId:n,mode:"rest"})}clearExtensionActivation(e,t){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${Xe(e)}/activation`,"DELETE /workspaces/:workspace/extensions/:extensionId/activation",{method:"DELETE",clientId:t,mode:"rest"})}refreshExtensionRuntime(e){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions/refresh","POST /workspaces/:workspace/extensions/refresh",{method:"POST",body:{},clientId:e,mode:"rest"})}get(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{clientId:n})}post(e,t,n,r,s){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{method:"POST",body:n,clientId:r,timeoutMs:s})}};function OE(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,r=[],s=()=>{for(;r.length>0;){let i=r.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),s(),n.signal;let o=()=>{n.abort(i.reason),s()};i.addEventListener("abort",o,{once:!0}),r.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}function D9(e,t){if(e.type==="turn_complete"){let n=e.data;if(n.promptId===t)return{stopReason:n.stopReason??"end_turn"}}if(e.type==="turn_error"){let n=e.data;if(n.promptId===t)throw Object.assign(new Zc(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function gF(e){return"promptId"in e&&"lastEventId"in e}var _w=class YC{constructor(t){Ue(this,"client");Ue(this,"session");Ue(this,"state");Ue(this,"replaySnapshot");Ue(this,"hasActivePrompt");Ue(this,"historyHasMore");Ue(this,"historyAnchorRecordId");Ue(this,"replayDegraded");Ue(this,"lastSeenEventId");Ue(this,"lastSeenEpoch");Ue(this,"subscriptionActive",!1);Ue(this,"reattaching");Ue(this,"cancelling");Ue(this,"promptLimit");Ue(this,"_pendingPrompts",new Map);this.client=t.client,this.session={...t.session},this.state={...t.state??{}},this.hasActivePrompt=t.hasActivePrompt??!1,this.historyHasMore=t.historyHasMore??!1,this.historyAnchorRecordId=t.historyAnchorRecordId,this.replayDegraded=t.replayDegraded??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=o2(t.lastEventId),this.lastSeenEpoch=t.eventEpoch,this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:TZ(t.maxPendingPromptsPerSession)}static async createOrAttach(t,n={},r){let s=await t.createOrAttachSession(n,r),i=!s.attached||n.modelServiceId||n.approvalMode?0:void 0;return new YC({client:t,session:s,hasActivePrompt:s.hasActivePrompt,lastEventId:i,eventEpoch:s.eventEpoch})}static async load(t,n,r={},s){let{state:i,hasActivePrompt:o,compactedReplay:l,liveJournal:c,historyHasMore:u,historyAnchorRecordId:d,replayDegraded:f,lastEventId:m,eventEpoch:p,...g}=await t.loadSession(n,r,s);return new YC({client:t,session:g,hasActivePrompt:o,state:i,lastEventId:m??0,eventEpoch:p,replaySnapshot:{compactedReplay:l??[],liveJournal:c??[]},historyHasMore:u,historyAnchorRecordId:d,replayDegraded:f})}static async resume(t,n,r={},s){let{state:i,hasActivePrompt:o,lastEventId:l,eventEpoch:c,...u}=await t.resumeSession(n,r,s);return new YC({client:t,session:u,hasActivePrompt:o,state:i,lastEventId:l??0,eventEpoch:c})}get sessionId(){return this.session.sessionId}get workspaceCwd(){return this.session.workspaceCwd}get attached(){return this.session.attached}get clientId(){return this.session.clientId}get worktree(){return this.session.worktree}get branch(){return this.session.branch}get lastEventId(){return this.lastSeenEventId}setLastEventId(t){this.lastSeenEventId=o2(t)}async prompt(t,n){if(n==null||n.throwIfAborted(),!this.subscriptionActive)return await this.withClientIdSelfHeal(()=>this.client.prompt(this.sessionId,t,n,this.clientId));let r=this.client.reservePromptSlot(this.sessionId,this.promptLimit),s;try{if(s=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId)),!gF(s))return r(),s;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw r(),i}return new Promise((i,o)=>{let l=()=>{let u=this._pendingPrompts.get(s.promptId);u&&this._pendingPrompts.delete(s.promptId)&&(this.cancel().catch(()=>{}),u.reject(n.reason??new DOMException("Aborted","AbortError")))},c=()=>n==null?void 0:n.removeEventListener("abort",l);this._pendingPrompts.set(s.promptId,{resolve:u=>{c(),r(),i(u)},reject:u=>{c(),r(),o(u)}}),n!=null&&n.aborted?l():n==null||n.addEventListener("abort",l,{once:!0})})}async submitPrompt(t,n){n==null||n.throwIfAborted();let r=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId));if(!gF(r))throw new Error("Expected non-blocking prompt acceptance");return r}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!Rbe(n))throw n;return await this.reattach(),await t()}}async reattach(){if(this.reattaching)return this.reattaching;this.reattaching=this.client.resumeSession(this.sessionId,{workspaceCwd:this.workspaceCwd}).then(t=>{this.session.clientId=t.clientId});try{await this.reattaching}finally{this.reattaching=void 0}}async cancel(){let t=this.cancelling??this.client.cancel(this.sessionId,this.clientId);this.cancelling=t;try{await t}finally{this.cancelling===t&&(this.cancelling=void 0)}}async heartbeat(){return await this.client.heartbeat(this.sessionId,this.clientId)}async artifacts(){return await this.client.listSessionArtifacts(this.sessionId,this.clientId)}async addArtifact(t){return await this.client.addSessionArtifact(this.sessionId,t,this.clientId)}async removeArtifact(t){return await this.client.removeSessionArtifact(this.sessionId,t,this.clientId)}async setModel(t){return await this.client.setSessionModel(this.sessionId,t,this.clientId)}async getRewindSnapshots(){return await this.client.getRewindSnapshots(this.sessionId)}async rewind(t,n){return await this.client.rewindSession(this.sessionId,t,{clientId:this.clientId,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})}async fork(t){return await this.client.forkSession(this.sessionId,{directive:t},this.clientId)}async recap(t){return await this.client.recapSession(this.sessionId,{...t!=null&&t.signal?{signal:t.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}generateContent(t,n){return this.client.generateSessionContent(this.sessionId,t,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async btw(t,n){return await this.client.btwSession(this.sessionId,t,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async enqueueMidTurnMessage(t,n){return await this.client.enqueueMidTurnMessage(this.sessionId,t,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async getPendingPrompts(){return await this.client.getPendingPrompts(this.sessionId,{...this.clientId?{clientId:this.clientId}:{}})}async removePendingPrompt(t){return await this.client.removePendingPrompt(this.sessionId,t,{...this.clientId?{clientId:this.clientId}:{}})}async shellCommand(t,n){return await this.client.shellCommand(this.sessionId,t,{...n?{signal:n}:{},...this.clientId?{clientId:this.clientId}:{}})}async context(){return await this.client.sessionContext(this.sessionId,this.clientId)}async status(){return await this.client.sessionStatus(this.sessionId,this.clientId)}async contextUsage(t={}){return await this.client.sessionContextUsage(this.sessionId,t,this.clientId)}async supportedCommands(){return await this.client.sessionSupportedCommands(this.sessionId,this.clientId)}async tasks(){return await this.client.sessionTasks(this.sessionId,this.clientId)}async lspStatus(){return await this.client.sessionLspStatus(this.sessionId,this.clientId)}async cancelTask(t,n){return await this.client.sessionTaskCancel(this.sessionId,t,n,this.clientId)}async clearGoal(){return await this.client.sessionGoalClear(this.sessionId,this.clientId)}async stats(){return await this.client.sessionStats(this.sessionId,this.clientId)}async respondToPermission(t,n){return await this.client.respondToPermission(t,n,this.clientId)}async respondToSessionPermission(t,n){return await this.client.respondToSessionPermission(this.sessionId,t,n,this.clientId)}async close(){return await this.client.closeSession(this.sessionId,this.clientId)}async detach(){return await this.client.detachSession(this.sessionId,this.clientId)}async updateMetadata(t){return await this.client.updateSessionMetadata(this.sessionId,t,this.clientId)}events(t={}){return this.openEventSubscription(t)}subscribeEvents(t={}){return this.openEventSubscription(t)}openEventSubscription(t){let n=o2(t.lastEventId),r=!1,s=!1,i=()=>{s||(s=!0,this.subscriptionActive=!1)},o=()=>{if(!r){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,r=!0}},l=this.iterateEvents({...t,lastEventId:n},i);return{next:async c=>(s||o(),await l.next(c)),return:async()=>{try{return await l.return(void 0)}finally{i()}},throw:async c=>{try{return await l.throw(c)}finally{i()}},[Symbol.asyncIterator](){return this}}}async*iterateEvents(t,n){try{let{resume:r=!0,...s}=t,i=s.lastEventId??(r?this.lastSeenEventId:void 0),o=s.epoch??(r?this.lastSeenEpoch:void 0),l=s.onEpoch;for await(let c of this.client.subscribeEvents(this.sessionId,{...s,lastEventId:i,...o!==void 0?{epoch:o}:{},onEpoch:u=>{this.lastSeenEpoch=u,l==null||l(u)}}))this._dispatchTurnEvent(c),yield c,c.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,o2(c.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(t){var s;if(t.type!=="turn_complete"&&t.type!=="turn_error")return;let n=(s=t.data)==null?void 0:s.promptId;if(!n)return;let r=this._pendingPrompts.get(n);if(r){this._pendingPrompts.delete(n);try{let i=D9(t,n);i!==void 0&&r.resolve(i)}catch(i){r.reject(i)}}}_rejectAllPending(t){for(let[,n]of this._pendingPrompts)n.reject(t);this._pendingPrompts.clear()}};function o2(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function Rbe(e){return e instanceof Zc&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var AZ="mid_turn_message_injected",L9="pending_prompt_added",P9="pending_prompt_started",O9="pending_prompt_completed",Dbe=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated","session_recording_degraded","artifact_changed",AZ,L9,P9,O9,"client_evicted","slow_client_warning","stream_error","state_resync_required","history_truncated","mcp_budget_warning","mcp_child_refused_batch","memory_changed","agent_changed","auth_device_flow_started","auth_device_flow_throttled","auth_device_flow_authorized","auth_device_flow_failed","auth_device_flow_cancelled","approval_mode_changed","tool_toggled","settings_changed","trust_change_requested","workspace_initialized","github_setup_completed","mcp_server_restarted","mcp_server_restart_refused","mcp_server_changed","settings_reloaded","mcp_server_added","mcp_server_removed","extensions_changed","permission_partial_vote","permission_forbidden","prompt_cancelled","replay_complete","followup_suggestion","channel_delivery_result","user_shell_command","user_shell_result","turn_complete","turn_error","session_rewound","session_branched","session_snapshot","git_branch_changed","git_status_changed"];new Set(Dbe);var jN="daemon-plan";function an(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(e,t){if(!an(e))return;let n=e[t];return typeof n=="string"?n:void 0}function Ls(e,t){if(an(e))for(let n of t){let r=e[n];if(typeof r=="string"&&r.trim().length>0)return r}}function Ip(e){if(e===void 0)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function Hf(e){return Ip(xf(e))}function xf(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>xf(n,t+1)):an(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,jZ(n)?"[redacted]":xf(r,t+1)])):e}function jZ(e){let t=e.toLowerCase().replace(/[^a-z0-9]/g,"");return t==="authorization"||t==="auth"||t==="cookie"||t==="setcookie"||t==="credential"||t==="credentials"||t==="passphrase"||t==="xauthkey"||t.endsWith("password")||t.endsWith("token")||t.endsWith("secret")||t.endsWith("secretkey")||t.endsWith("accesskey")||t.endsWith("apikey")||t.endsWith("privatekey")||t.includes("accesstoken")||t.includes("refreshtoken")||t.includes("bearertoken")||t.includes("personalaccesstoken")}function $E(e){if(typeof e=="string")return e;if(!an(e))return"";let t=e.text;return typeof t=="string"?t:""}function Lbe(e){if(typeof e=="string")return{kind:"text",text:e};if(!an(e))return;let t=e.type;if(t==="text"||t===void 0){let n=e.text;return typeof n=="string"?{kind:"text",text:n}:void 0}if(t==="image"){let n=an(e.source)?e.source:void 0,r,s;return n&&(r=typeof n.url=="string"?n.url:void 0,s=typeof n.data=="string"?n.data:void 0),!r&&!s&&(s=typeof e.data=="string"?e.data:void 0,r=typeof e.url=="string"?e.url:void 0),!r&&!s?void 0:{kind:"image",mediaType:(typeof e.mediaType=="string"?e.mediaType:void 0)??(typeof e.mimeType=="string"?e.mimeType:void 0)??(typeof e.media_type=="string"?e.media_type:void 0)??(n&&typeof n.mediaType=="string"?n.mediaType:void 0)??"image/*",source:{...r?{url:r}:{},...s?{data:s}:{}}}}if(t==="audio"){let n=an(e.source)?e.source:void 0;if(!n)return;let r=(typeof e.mediaType=="string"?e.mediaType:void 0)??"audio/*",s=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0;return!s&&!i?void 0:{kind:"audio",mediaType:r,source:{...s?{url:s}:{},...i?{data:i}:{}}}}if(t==="resource"||t==="resource_link"){let n=typeof e.uri=="string"?e.uri:void 0;if(!n)return;let r=typeof e.mediaType=="string"?e.mediaType:void 0,s=typeof e.description=="string"?e.description:void 0;return{kind:"resource",uri:n,...r?{mediaType:r}:{},...s?{description:s}:{}}}}var Pbe=64;function uT(e,t=0){if(t>Pbe)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>uT(r,t+1)).filter(Boolean).join(`
`);if(!an(e))return e===void 0?"":Ip(e);for(let r of["text","output","stdout","stderr","rawOutput"]){let s=e[r];if(typeof s=="string")return s}let n=e.content;if(n!==void 0){let r=uT(n,t+1);if(r)return r}return Ip(e)}var Obe=new Set(Cbe),NZ=new Set(["qwen","qwen-oauth"]),$be=new Set(["in_flight","disabled","budget_would_exceed","authentication_required"]),bF="malformed memory_changed payload",yF=4096,vF="Session recording stopped after a write failure. New messages for the affected session will not be saved. Check disk space and permissions, then start a new session to resume recording.";function Bbe(e,t={}){let n=Gbe(e,t);switch(e.type){case"session_update":return Ybe(e,n,t);case"shell_output":{let r=uT(e.data),s=IN(e.data),i=MN(e.data);return r?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:r,...s?{stream:s}:{}}]:[]}case"permission_request":return rye(e,n);case"permission_resolved":case"permission_already_resolved":return sye(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:pt(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:pt(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let r=BE(pt(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...r?{errorKind:r}:{},text:pt(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${pt(e.data,"reason")??"closed"}`}];case"session_recording_degraded":return!pt(e.data,"sessionId")||pt(e.data,"reason")!=="write_failed"?us(e,n,"malformed recording state"):[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:vF}];case"session_snapshot":{if(!an(e.data)||!pt(e.data,"sessionId"))return us(e,n,"malformed recording snapshot");let r=e.data.recordingDegraded;return r!==void 0&&typeof r!="boolean"?us(e,n,"malformed recording snapshot"):r===!0?[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:vF}]:[]}case"client_evicted":return[{...n,type:"error",recoverable:!0,text:pt(e.data,"reason")??"SSE client evicted (no details available)"}];case"slow_client_warning":return[{...n,type:"status",text:"SSE stream is lagging"}];case"stream_error":{let r=BE(pt(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...r?{errorKind:r}:{},text:pt(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let r=pt(e.data,"code"),s=BE(pt(e.data,"errorKind")),i=pt(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...r?{code:r}:{},...s?{errorKind:s}:{},...i?{promptId:i}:{},text:pt(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return Fbe(e,n);case"history_truncated":return qbe(e,n);case"session_rewound":return Hbe(e,n);case"session_branched":return Ube(e,n);case"prompt_cancelled":{let r=Nye(e.data,"reason");return[{...n,type:"prompt.cancelled",...r?{reason:r}:{}}]}case"followup_suggestion":return Wbe(e,n);case"mid_turn_message_injected":return Vbe(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let r=pt(e.data,"command"),s=pt(e.data,"cwd");return r?[{...n,type:"user.shell.command",command:r,...s?{cwd:s}:{}},{...n,type:"user.text.delta",text:`$ ${r}`}]:[]}case"user_shell_result":{let r=vi(e.data,"exitCode"),s=an(e.data)&&e.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${r??"unknown"}`;return[{...n,type:"status",text:s}]}case"replay_complete":{let r=vi(e.data,"replayedCount")??0,s=vi(e.data,"lastReplayedEventId")??vi(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:r,...s!==void 0?{lastReplayedEventId:s}:{}}]}case"session_metadata_updated":return lye(e,n);case"approval_mode_changed":return uye(e,n);case"git_branch_changed":return[];case"git_status_changed":return[];case"memory_changed":return dye(e,n);case"agent_changed":return hye(e,n);case"tool_toggled":return fye(e,n);case"settings_changed":return mye(e,n);case"settings_reloaded":return pye(e,n);case"trust_change_requested":return bye(e,n);case"workspace_initialized":return gye(e,n);case"github_setup_completed":return yye(e,n);case"mcp_budget_warning":return vye(e,n);case"mcp_child_refused_batch":return wye(e,n);case"mcp_server_restarted":return xye(e,n);case"mcp_server_restart_refused":return kye(e,n);case"mcp_server_added":return zE(e,n,"added");case"mcp_server_removed":return zE(e,n,"removed");case"mcp_server_changed":return zE(e,n);case"extensions_changed":return _ye(e,n);case"artifact_changed":return cye(e,n);case"auth_device_flow_started":return Sye(e,n);case"auth_device_flow_throttled":return Cye(e,n);case"auth_device_flow_authorized":return Tye(e,n);case"auth_device_flow_failed":return Eye(e,n);case"auth_device_flow_cancelled":return jye(e,n);default:return zbe(e,n)}}function zbe(e,t){return[{...t,type:"debug",text:`${e.type} (unrecognized daemon event): ${Hf(e.data)}`}]}function Fbe(e,t){let n=pt(e.data,"reason"),r=vi(e.data,"lastDeliveredId"),s=vi(e.data,"earliestAvailableId");return!n||r===void 0||s===void 0?us(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:r,earliestAvailableId:s}]}function qbe(e,t){let n=pt(e.data,"reason"),r=vi(e.data,"truncatedEvents"),s=vi(e.data,"retainedEvents"),i=vi(e.data,"maxBytes");return n!=="replay_window_exceeded"||r===void 0||s===void 0||i===void 0||!an(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?us(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${s}, dropped ${r} (window ${i} bytes).`,source:"history_truncated"}]}function Hbe(e,t){let n=pt(e.data,"promptId"),r=vi(e.data,"targetTurnIndex");if(!n||r===void 0)return us(e,t,"malformed session_rewound payload");let s=pt(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:r,...s?{sessionId:s}:{}}]}function Ube(e,t){let n=pt(e.data,"sourceSessionId"),r=pt(e.data,"newSessionId"),s=pt(e.data,"displayName");return!n||!r||!s?us(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:r,displayName:s}]}function Wbe(e,t){let n=pt(e.data,"sessionId"),r=pt(e.data,"suggestion"),s=pt(e.data,"promptId");return!n||!r||!s?us(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:r,promptId:s}]}function Vbe(e,t){if(!an(e.data))return us(e,t,"malformed mid_turn_message_injected");let n=Array.isArray(e.data.messages)?e.data.messages.filter(r=>typeof r=="string"&&r.length>0):[];return n.length===0?us(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function Gbe(e,t){let n=IZ(e),r=Xbe(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...r?{sourceRecordIds:r}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:xf(e.data)}}:{}}}function IZ(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(an(n)){let r=n.serverTimestamp;if(typeof r=="number"&&Number.isFinite(r))return r}if(an(e.data)){let r=e.data._meta,s=e.data.update,i=an(s)?s._meta:void 0;if(an(r)){let l=r.serverTimestamp;if(typeof l=="number"&&Number.isFinite(l))return l}if(an(i)){let l=i.serverTimestamp;if(typeof l=="number"&&Number.isFinite(l))return l}let o=[an(i)?i.timestamp:void 0,an(s)?s.timestamp:void 0,an(r)?r.timestamp:void 0,e.data.timestamp];for(let l of o){let c=Kbe(l);if(c!==void 0)return c}}}function Kbe(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return;if(/^\d+$/.test(e)){let n=Number(e);return Number.isFinite(n)?n:void 0}let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Ybe(e,t,n){let r=MZ(e.data);if(!r)return[{...t,type:"debug",text:`session_update: ${Hf(e.data)}`}];let s=pt(r,"sessionUpdate");switch(s){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=xF(r),o=r.content,l=Lbe(o);if(l){if(l.kind==="image"){let u=l.source.data,d=l.mediaType||"image/*";if(d==="image/*"&&u){let f=(u.startsWith("data:")?u.split(",")[1]??"":u).slice(0,10);f.startsWith("iVBORw0KGg")?d="image/png":f.startsWith("/9j/")?d="image/jpeg":f.startsWith("R0lGOD")?d="image/gif":f.startsWith("UklGR")&&(d="image/webp")}return u?[{...t,type:"user.image.delta",data:u,mimeType:d}]:[]}return l.kind==="text"?l.text?[{...t,type:"user.text.delta",text:l.text,...i?{meta:i}:{}}]:[]:[]}let c=$E(o);return c?[{...t,type:"user.text.delta",text:c,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=$E(r.content),o=wF(r),l=xF(r),c=[];i&&c.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...l?{meta:l}:{}});let u=Qbe(r);return u&&c.push({...t,type:"assistant.usage",usage:u,...o?{parentToolCallId:o}:{}}),c}case"agent_thought_chunk":{let i=$E(r.content);if(!i)return[];let o=wF(r);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":{let i=an(r._meta)?r._meta:void 0;return pt(r,"status")==="in_progress"&&pt(r,"kind")===void 0&&(i==null?void 0:i.shellProgress)!==void 0?[]:[Jbe(r,t)]}case"shell_output":case"tool_output":{let i=uT(r),o=IN(r)??IN(e.data),l=MN(r)??MN(e.data);return i?[{...t,type:l==="user-shell"?"user.shell.output":"shell.output",text:i,...o?{stream:o}:{}}]:[]}case"available_commands_update":{let i=(Array.isArray(r.availableCommands)?r.availableCommands:[]).filter(an);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[Zbe(r,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${s??"session_update"}: ${Hf(r)}`}]}}function wF(e){let t=an(e._meta)?e._meta:void 0;return t?pt(t,"parentToolCallId"):void 0}function xF(e){let t=an(e._meta)?e._meta:void 0;if(!t)return;let{qwenTranscript:n,...r}=t;return Object.keys(r).length>0?r:void 0}function Xbe(e){var i;if(!an(e.data))return;let t=MZ(e.data),n=t&&an(t._meta)?t._meta:void 0,r=(i=n&&an(n.qwenTranscript)?n.qwenTranscript:void 0)==null?void 0:i.sourceRecordIds;if(!Array.isArray(r))return;let s=[...new Set(r.filter(o=>typeof o=="string"))];return s.length>0?s:void 0}function Qbe(e){let t=an(e._meta)?e._meta:void 0,n=t&&an(t.usage)?t.usage:void 0;if(!n)return;let r=vi(n,"inputTokens"),s=vi(n,"outputTokens");if(r===void 0&&s===void 0)return;let i=vi(n,"cachedReadTokens");return{inputTokens:r??0,outputTokens:s??0,...i!==void 0?{cachedTokens:i}:{}}}function Jbe(e,t){let n=an(e._meta)?e._meta:void 0,r=pt(e,"toolName")??pt(e,"name")??(n?pt(n,"toolName"):void 0)??(n?pt(n,"name"):void 0),s=pt(e,"kind"),i=pt(e,"title")??(pt(e,"sessionUpdate")==="tool_call"?r??s:void 0),o=e.rawInput??e.input??e.args,l=e.rawOutput??e.output??e.result,c=o!==void 0?xf(o):void 0,u=l!==void 0?xf(l):void 0,d=e.content!==void 0?xf(e.content):void 0,f=e.locations!==void 0?xf(e.locations):void 0,m=pt(e,"toolCallId"),p=pt(e,"status");if(!m)return{...t,type:"error",code:"daemon.protocol.tool_update_missing_tool_call_id",recoverable:!0,text:`Tool update missing toolCallId${i?` (${i})`:""}`};let{provenance:g,serverId:b}=nye(e,r),w=pt(e,"parentToolCallId")??(n?pt(n,"parentToolCallId"):void 0),y=w&&w!==m?w:void 0,v=pt(e,"subagentType")??(n?pt(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:m,...p?{status:p}:{},...i?{title:i}:{},...r?{toolName:r}:{},...s?{toolKind:s}:{},...d!==void 0?{content:d}:{},...f!==void 0?{locations:f}:{},...g?{provenance:g}:{},...b?{serverId:b}:{},...y?{parentToolCallId:y}:{},...v?{subagentType:v}:{},...c!==void 0?{rawInput:c}:{},...u!==void 0?{rawOutput:u}:{},...c!==void 0?{details:NN(Hf(c))}:u!==void 0?{details:NN(Hf(u))}:{}}}function Zbe(e,t){let n=Array.isArray(e.entries)?e.entries:[],r=NN(eye(n)),s=an(e._meta)?e._meta:void 0,i=s&&an(s.qwenTranscript)?s.qwenTranscript:void 0,o=pt(i,"planToolCallId")??(t.eventId!==void 0?`${jN}-${t.eventId}`:jN),l=s&&an(s.stats)?s.stats:void 0;return{...t,type:"tool.update",toolCallId:o,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:r}}],rawOutput:l?{entries:n,stats:l}:{entries:n}}}function eye(e){return e.flatMap(t=>{if(!an(t))return[];let n=pt(t,"content");return n?[`- [${tye(pt(t,"status"))}] ${n}`]:[]}).join(`
`)}function tye(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function nye(e,t){let n=pt(e,"provenance"),r=pt(e,"serverId");if(n==="builtin"||n==="mcp"||n==="subagent")return{provenance:n,...n==="mcp"&&r?{serverId:r}:{}};if(t&&t.startsWith("mcp__")){let s=t.slice(5),i=s.indexOf("__");if(i>0)return{provenance:"mcp",serverId:s.slice(0,i)}}return{}}function BE(e){if(e)return Obe.has(e)?e:void 0}function NN(e){return e.length<=yF?e:`${e.slice(0,yF)}... [truncated]`}function rye(e,t){if(!an(e.data))return[{...t,type:"debug",text:`permission_request: ${Hf(e.data)}`}];let n=pt(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${Hf(e.data)}`}];let r=e.data.toolCall!==void 0?xf(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:pt(e.data,"sessionId"),title:aye(r),options:iye(e.data.options),toolCall:r}]}function sye(e,t){let n=pt(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${Hf(e.data)}`}];let r=pt(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:oye(e.data),...r?{voterClientId:r}:{}}]}function MZ(e){if(!an(e))return;let t=e.update;return an(t)?t:e}function iye(e){return Array.isArray(e)?e.flatMap(t=>{if(!an(t))return[];let n=pt(t,"optionId");return n?[{optionId:n,label:pt(t,"label")??pt(t,"title")??pt(t,"name")??n,...pt(t,"description")?{description:pt(t,"description")}:{},raw:t}]:[]}):[]}function oye(e){if(!an(e))return Ip(e);let t=e.outcome;if(typeof t=="string")return t;if(an(t)){let n=pt(t,"outcome")??"selected",r=pt(t,"optionId");return r?`${n}:${r}`:n}return Ls(e,["status","reason"])??Ip(e)}function aye(e){return an(e)?pt(e,"title")??pt(e,"name")??pt(e,"kind")??pt(e,"toolName")??"Tool permission":"Tool permission"}function IN(e){let t=pt(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function MN(e){if(!an(e))return;let t=pt(e,"source");if(t)return t;let n=e._meta;return an(n)?pt(n,"source"):void 0}function us(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function lye(e,t){let n=pt(e.data,"sessionId");if(!n)return us(e,t,"missing sessionId");let r=pt(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...r!==void 0?{displayName:r}:{}}]}function cye(e,t){let n=pt(e.data,"sessionId"),r=an(e.data)?e.data.change:void 0;if(!n||!an(r))return us(e,t,"malformed artifact_changed payload");let s=pt(r,"action"),i=pt(r,"artifactId");return!s||!i?us(e,t,"missing action or artifactId"):[{...t,type:"session.artifact.changed",sessionId:n,change:r}]}function uye(e,t){let n=pt(e.data,"sessionId"),r=pt(e.data,"previous"),s=pt(e.data,"next");if(!n||!r||!s)return us(e,t,"missing sessionId / previous / next");let i=an(e.data)&&typeof e.data.persisted=="boolean"?e.data.persisted:!1;return[{...t,type:"session.approval_mode.changed",sessionId:n,previous:r,next:s,persisted:i}]}function dye(e,t){var o;let n=pt(e.data,"scope");if(n==="managed"){let l=pt(e.data,"source"),c=pt(e.data,"taskId"),u=(o=e.data)==null?void 0:o.touchedScopes;return!(l&&c&&Array.isArray(u))||u.some(d=>d!=="user"&&d!=="project")?us(e,t,bF):[{...t,type:"workspace.memory.changed",scope:n,source:l,taskId:c,touchedScopes:u}]}let r=pt(e.data,"filePath"),s=pt(e.data,"mode"),i=vi(an(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!r||s!=="append"&&s!=="replace"||i===void 0?us(e,t,bF):[{...t,type:"workspace.memory.changed",scope:n,filePath:r,mode:s,bytesWritten:i}]}function hye(e,t){let n=pt(e.data,"change"),r=pt(e.data,"name"),s=pt(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!r||s!=="project"&&s!=="user"?us(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:r,level:s}]}function fye(e,t){let n=pt(e.data,"toolName"),r=an(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||r===void 0?us(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:r}]}function mye(e,t){let n=pt(e.data,"key"),r=pt(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:r??"workspace",value:an(e.data)?e.data.value:void 0}]:us(e,t,"malformed settings_changed payload")}function pye(e,t){return an(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:us(e,t,"malformed settings_reloaded payload")}function gye(e,t){let n=pt(e.data,"path"),r=pt(e.data,"action");return!n||r!=="created"&&r!=="overwrote"&&r!=="noop"?us(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:r}]}function bye(e,t){let n=pt(e.data,"workspaceCwd"),r=pt(e.data,"desiredState"),s=pt(e.data,"reason");return!n||r!=="trusted"&&r!=="untrusted"?us(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:r,...s!==void 0?{reason:s}:{}}]}function yye(e,t){let n=pt(e.data,"releaseTag"),r=pt(e.data,"readmeUrl");if(!n||!r||!an(e.data))return us(e,t,"malformed github_setup_completed payload");let s=e.data.workflows,i=e.data.warnings;return[{...t,type:"workspace.github.setup.completed",releaseTag:n,readmeUrl:r,...typeof e.data.secretsUrl=="string"?{secretsUrl:e.data.secretsUrl}:{},workflows:Array.isArray(s)?s:[],gitignore:e.data.gitignore,warnings:Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}]}function vye(e,t){if(!an(e.data))return us(e,t,"non-object payload");let n=vi(e.data,"liveCount"),r=vi(e.data,"reservedCount"),s=vi(e.data,"budget"),i=vi(e.data,"thresholdRatio"),o=pt(e.data,"mode");return n===void 0||r===void 0||s===void 0||i===void 0||o!=="warn"&&o!=="enforce"?us(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:r,budget:s,thresholdRatio:i,mode:o}]}function wye(e,t){if(!an(e.data))return us(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(an).map(o=>{let l=pt(o,"name"),c=pt(o,"transport"),u=pt(o,"reason");return!l||!c||u!=="budget_exhausted"?null:{name:l,transport:c,reason:"budget_exhausted"}}).filter(o=>o!==null):[],r=vi(e.data,"budget"),s=vi(e.data,"liveCount"),i=vi(e.data,"reservedCount");return n.length===0||r===void 0||s===void 0||i===void 0?us(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:r,liveCount:s,reservedCount:i}]}function xye(e,t){let n=pt(e.data,"serverName"),r=vi(e.data,"durationMs");return!n||r===void 0?us(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:r}]}function kye(e,t){let n=pt(e.data,"serverName"),r=pt(e.data,"reason");return!n||!r||!$be.has(r)?us(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:r}]}function zE(e,t,n){let r=pt(e.data,n?"name":"serverName"),s=n??pt(e.data,"action");return!r||!s||!["added","removed","approve","enable","disable","authenticate","clear-auth"].includes(s)?us(e,t,`malformed ${e.type} payload`):[{...t,type:"workspace.mcp.server_changed",serverName:r,action:s}]}function _ye(e,t){let n=vi(e.data,"refreshed"),r=vi(e.data,"failed"),s=pt(e.data,"status"),i=pt(e.data,"source"),o=pt(e.data,"name"),l=pt(e.data,"version"),c=pt(e.data,"error");return n===void 0||r===void 0||s!==void 0&&s!=="installed"&&s!=="enabled"&&s!=="disabled"&&s!=="updated"&&s!=="uninstalled"&&s!=="failed"?us(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:r,...s?{status:s}:{},...i?{source:i}:{},...o?{name:o}:{},...l?{version:l}:{},...c?{error:c}:{}}]}function Sye(e,t){let n=pt(e.data,"deviceFlowId"),r=pt(e.data,"providerId"),s=vi(e.data,"expiresAt");return!n||!r||!NZ.has(r)||s===void 0?us(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:r,expiresAt:s}]}function Cye(e,t){let n=pt(e.data,"deviceFlowId"),r=vi(e.data,"intervalMs");return!n||r===void 0?us(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:r}]}function Tye(e,t){let n=pt(e.data,"deviceFlowId"),r=pt(e.data,"providerId");if(!n||!r||!NZ.has(r))return us(e,t,"malformed auth_device_flow_authorized payload");let s=vi(e.data,"expiresAt"),i=pt(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:r,...s!==void 0?{expiresAt:s}:{},...i?{accountAlias:i}:{}}]}function Eye(e,t){let n=pt(e.data,"deviceFlowId"),r=pt(e.data,"errorKind");if(!n||!Aye(r))return us(e,t,"malformed auth_device_flow_failed payload");let s=pt(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:r,...s?{hint:s}:{}}]}function Aye(e){return typeof e=="string"&&e.trim().length>0}function jye(e,t){let n=pt(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:us(e,t,"malformed auth_device_flow_cancelled payload")}function vi(e,t){if(!an(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Nye(e,t){if(!an(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var Iye=8;function dT(e,t={},n=0){if(n>Iye){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(an(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let b=dT(g,{title:t.title??Ls(e,["title"]),toolName:t.toolName??Ls(e,["toolName","name"]),toolKind:t.toolKind??Ls(e,["kind"])},n+1);if(b.kind!=="generic"||!b.summary)return b}}let r=Pye(e);if(r.length>0)return{kind:"ask_user_question",questions:r};let s=Lye(e,t);if(s)return s;let i=zye(e,t);if(i)return i;let o=Fye(e,t);if(o)return o;let l=qye(e,t);if(l)return l;let c=Mye(e,t);if(c)return c;let u=Rye(e,t);if(u)return u;let d=Dye(e);if(d)return d;let f=Hye(e,t);if(f)return f;let m=Uye(e);if(m)return m;if(an(e)){let g=Ls(e,["command","cmd"]);if(g){let w=Ls(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...w?{cwd:w}:{}}}let b=$ye(e);if(b.length>0)return{kind:"key_value",rows:b}}let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}function Mye(e,t={}){if(!an(e))return;let n=Ls(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=Ls(e,["oldText","old_text","old_str","oldString"]),s=Ls(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),o=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!r,l=s===void 0&&o?Ls(e,["content"]):void 0,c=s??l,u=Ls(e,["patch","diff","unified_diff"]);if(!(!r&&!c&&!u))return{kind:"file_diff",path:n,...r?{oldText:r}:{},...c?{newText:c}:{},...u?{patch:u}:{}}}function Rye(e,t){if(!an(e))return;let n=Ls(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=t.toolName??Ls(e,["toolName","name"]),s=r!==void 0&&/read|view|cat/i.test(r),i=e.lineRange??e.line_range??e.range,o;if(Array.isArray(i)&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number")o=[i[0],i[1]];else{let l=e.offset,c=e.limit;typeof l=="number"&&typeof c=="number"&&c>0&&(o=[l+1,l+c])}if(!(!s&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function Dye(e){if(!an(e))return;let t=Ls(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=Ls(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function Lye(e,t){let n=t.toolName??(an(e)?Ls(e,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let r=n.slice(5),s=r.indexOf("__");if(s<=0)return;let i=r.slice(0,s),o=r.slice(s+2),l;if(an(e)){let c=e.arguments??e.args??e;if(an(c)){let u=Object.entries(c).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,f])=>{let m=typeof f=="string"?f:JSON.stringify(f),p=m.length>60?`${m.slice(0,60)}…`:m;return`${d}=${p}`})[0];u&&(l=u)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...l?{argsSummary:l}:{}}}function Pye(e){return!an(e)||!Array.isArray(e.questions)?[]:e.questions.filter(an).map(t=>{let n=Ls(t,["header","title","label"]),r=Ls(t,["question","prompt","text"])??"Question",s=Array.isArray(t.options)?t.options.filter(an).map(Oye):[];return{...n?{header:n}:{},question:r,options:s,raw:t}})}function Oye(e){let t=Ls(e,["label","title","value"])??"Option",n=Ls(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function $ye(e){let t=[],n=[["Path",["path","filePath","file_path","absolutePath"]],["Cwd",["cwd","directory","workingDirectory"]],["Query",["query","pattern","search"]],["Note",["description","reason"]]];for(let[r,s]of n){let i=Ls(e,s);i&&t.push({label:r,value:i})}if(t.length>0)return t;for(let[r,s]of Object.entries(e).slice(0,4))s==null||Array.isArray(s)||an(s)||t.push({label:r,value:jZ(r)?"[redacted]":Hf(s)});return t}var kF=50,Bye=5;function zye(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!an(e))return;let r=Ls(e,["subagent_type","agent","agentName","agent_name","subagent"]),s=Ls(e,["prompt","task","description","instruction","query"]);if(!r&&!s)return;let i=Ls(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:r??"subagent",task:s??"(no task description)",...i?{parentDelegationId:i}:{}}}function Fye(e,t){if(!an(e))return;let n=Ls(e,["query","pattern","search","q"]);if(!n)return;let r=t.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(r)||typeof e.resultCount=="number"||Array.isArray(e.results)||Array.isArray(e.matches)))return;let s=typeof e.resultCount=="number"?e.resultCount:typeof e.total=="number"?e.total:Array.isArray(e.results)?e.results.length:Array.isArray(e.matches)?e.matches.length:void 0,i,o=e.results??e.matches;return Array.isArray(o)&&(i=o.slice(0,Bye).map(l=>typeof l=="string"?l:an(l)?Ls(l,["path","file","name","title","text"])??Ip(l).slice(0,120):String(l)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...s!==void 0?{resultCount:s}:{},...i?{top:i}:{}}}function qye(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!an(e))return;let r=Ls(e,["prompt","description","query"]);if(!r)return;let s=Ls(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=Ls(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:r,...s?{thumbnailUrl:s}:{},...i?{model:i}:{}}}function Hye(e,t){if(!an(e))return;let n=Ls(e,["code","snippet","source"]);if(!n)return;let r=Ls(e,["language","lang","codeLanguage","syntax"]),s=t.toolName??"",i=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(s);if(!r&&!i)return;let o=Ls(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...r?{language:r}:{},...o?{origin:o}:{}}}function Uye(e){if(!an(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let s=t.filter(o=>typeof o=="string").slice(0,30);if(s.length===0)return;let i=n.slice(0,kF).map(o=>Array.isArray(o)?o.map(l=>typeof l=="string"?l:Ip(l).slice(0,80)):[]);return{kind:"tabular",columns:s,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let r=e.data??e.records;if(Array.isArray(r)&&r.length>0&&an(r[0])){let s=Object.keys(r[0]).slice(0,30);if(s.length===0)return;let i=r.slice(0,kF).map(o=>{let l=o;return s.map(c=>{let u=l[c];return typeof u=="string"?u:Ip(u).slice(0,80)})});return{kind:"tabular",columns:s,rows:i,...r.length>i.length?{totalRows:r.length}:{}}}}var Wye=1e3,vp="__trimmed_tool_block__",s5="__trimmed_permission_block__",RN=1e5,_F=`
[truncated]
`,Vye=16,gk=new WeakMap;function Gye(e={}){let t={blocks:[],blockIndexById:Ho(),toolBlockByCallId:Ho(),trimmedToolNotificationByCallId:Ho(),permissionBlockByRequestId:Ho(),activeAssistantBlockByParent:Ho(),activeThoughtBlockByParent:Ho(),toolProgress:Ho(),awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??Wye,retainSubagentBlocks:e.retainSubagentBlocks??!0};return e.onTruncation&&gk.set(t,e.onTruncation),t}var $9=new Set(["pending","confirming","running","in_progress"]),Kye=new Set(["completed","success","failed","error","canceled","cancelled"]),Yye=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function Xye(e,t,n={}){let r=PZ(e,n);F9(r);let s=q9(r,"user",t,void 0,void 0,n.meta);return n.images&&n.images.length>0&&(s.images=[...n.images]),jh(r,s),r.activeUserBlockId=s.id,OZ(r)}function Qye(e,t,n={}){if(t.length===0)return e;let r=PZ(e,n);for(let i of t)Jye(r,i);return OZ(r)}function i5(e){let t=Ho();return e.forEach((n,r)=>{t[n.id]=r}),t}function Jye(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!Yye.has(t.type)){typeof console<"u"&&((n=console.warn)==null||n.call(console,`[daemon-ui] dropping event \`${t.type}\` while awaitingResync; state may be stale until session reconnect (lastResyncRequired: ${e.lastResyncRequired?JSON.stringify(e.lastResyncRequired):"unknown"})`));return}switch(t.type){case"user.shell.command":e.pendingUserShellCommand={command:t.command,...t.cwd?{cwd:t.cwd}:{}};break;case"user.text.delta":e.activeUserBlockId||(e.lastFollowupSuggestion=void 0),FE(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{let r=e.activeUserBlockId?e.blockIndexById[e.activeUserBlockId]:void 0,s=r!==void 0?e.blocks[r]:void 0;if((s==null?void 0:s.kind)!=="user"||!BZ(s.sourceRecordIds,t.sourceRecordIds)){let i=q9(e,"user","",t.eventId,t.serverTimestamp,void 0,t.sourceRecordIds);i.images=[{data:t.data,mimeType:t.mimeType}],jh(e,i),e.activeUserBlockId=i.id}else{let i=eu(e,e.activeUserBlockId);i&&i.kind==="user"&&(i.images=[...i.images??[],{data:t.data,mimeType:t.mimeType}])}break}case"assistant.text.delta":if(t.parentToolCallId&&!e.retainSubagentBlocks)break;FE(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":F9(e,t),(t.reason==="cancelled"||t.reason==="error")&&DN(e);break;case"assistant.usage":t.parentToolCallId&&!e.retainSubagentBlocks?nve(e,t):tve(e,t);break;case"thought.text.delta":if(t.parentToolCallId&&!e.retainSubagentBlocks)break;FE(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":if(t.parentToolCallId&&!e.retainSubagentBlocks){sve(e,t.toolCallId);break}LZ(e,t);break;case"shell.output":ave(e,t);break;case"user.shell.output":lve(e,t);break;case"permission.request":cve(e,t);break;case"permission.resolved":uve(e,t);break;case"model.changed":Rx(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Rx(e,t.type,t.text,t);break;case"session.approval_mode.changed":e.approvalMode=t.next;break;case"session.metadata.changed":case"session.artifact.changed":case"session.available_commands":break;case"session.state_resync_required":Zye(e,t);break;case"prompt.cancelled":DN(e),t.reason!=="forward_failed"&&dve(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":fve(e,t.targetTurnIndex);break;case"session.branched":Rx(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function Zye(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},DN(e),Rx(e,"error",`State resync required: ${eve(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function eve(e,t){let n=e+1,r=t-1;return r<n?"no events lost (resync requested without gap)":r===n?`missed 1 daemon event (id ${n})`:`missed daemon events ${n}-${r}`}function o5(e,t,n){let r=eu(e,t);((r==null?void 0:r.kind)==="assistant"||(r==null?void 0:r.kind)==="thought")&&(r.streaming=!1,r.updatedAt=e.now,(n==null?void 0:n.eventId)!==void 0&&(r.eventId=n.eventId),r.serverTimestamp===void 0&&(n==null?void 0:n.serverTimestamp)!==void 0&&(r.serverTimestamp=n.serverTimestamp))}function RZ(e,t){o5(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function tve(e,t){let n=eu(e,e.activeAssistantBlockId);if(!n||n.kind!=="assistant")return;let r=n.usage;n.usage={inputTokens:((r==null?void 0:r.inputTokens)??0)+t.usage.inputTokens,outputTokens:((r==null?void 0:r.outputTokens)??0)+t.usage.outputTokens,cachedTokens:((r==null?void 0:r.cachedTokens)??0)+(t.usage.cachedTokens??0)},n.updatedAt=e.now}function nve(e,t){if(!t.parentToolCallId)return;let n=eu(e,e.toolBlockByCallId[t.parentToolCallId]);if((n==null?void 0:n.kind)!=="tool")return;let r=an(n.rawOutput)?n.rawOutput:void 0,s=an(r==null?void 0:r.executionSummary)?r.executionSummary:void 0,i=od(s==null?void 0:s.inputTokens)+t.usage.inputTokens,o=od(s==null?void 0:s.outputTokens)+t.usage.outputTokens,l=od(s==null?void 0:s.cachedTokens)+(t.usage.cachedTokens??0);n.rawOutput={...r??{type:"task_execution",status:"running"},executionSummary:{...s??{},inputTokens:i,outputTokens:o,cachedTokens:l,totalTokens:i+o}},n.updatedAt=e.now}function od(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function DZ(e,t){o5(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function B9(e,t,n){o5(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function z9(e,t,n){o5(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function FE(e,t,n,r,s){let i=t!=="user"&&"parentToolCallId"in s?s.parentToolCallId:void 0,o=i!=null?t==="assistant"?e.activeAssistantBlockByParent:t==="thought"?e.activeThoughtBlockByParent:void 0:void 0,l=o&&i!=null?o[i]:e[n],c=eu(e,l);if(c&&c.kind===t&&rve(c,s)){c.text=H9(e,c,r),c.updatedAt=e.now,s.eventId!==void 0&&(c.eventId=s.eventId),s.serverTimestamp!==void 0&&(c.serverTimestamp=s.serverTimestamp),"meta"in s&&s.meta&&(c.meta={...c.meta,...s.meta}),t!=="user"&&(c.streaming=!0);return}(c==null?void 0:c.kind)===t&&t!=="user"&&(c.streaming=!1,c.updatedAt=e.now);let u=q9(e,t,r,s.eventId,s.serverTimestamp,"meta"in s?s.meta:void 0,s.sourceRecordIds);t!=="user"&&(u.streaming=!0),t==="thought"&&(u.collapsed=!0),i!=null&&(u.parentToolCallId=i),jh(e,u),o&&i!=null?o[i]=u.id:e[n]=u.id,i!=null?(t==="assistant"&&z9(e,i),t==="thought"&&B9(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&RZ(e),t!=="thought"&&DZ(e))}function rve(e,t){var n,r;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0||!BZ(e.sourceRecordIds,t.sourceRecordIds)?!1:!("meta"in t)||((r=t.meta)==null?void 0:r.qwenDiscreteMessage)!==!0}function F9(e,t){RZ(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))B9(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))z9(e,n,t);DZ(e,t)}function LZ(e,t){let n=!e.retainSubagentBlocks&&an(t.rawOutput)&&t.rawOutput.type==="task_execution",r=ive(t.rawOutput,e.retainSubagentBlocks),s=e.toolBlockByCallId[t.toolCallId];if(s===vp){if(hve(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],LZ(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Rx(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let i=eu(e,s);if((i==null?void 0:i.kind)==="tool"){if(t.title!==void 0&&(i.title=t.title),t.status!==void 0&&(i.status=t.status),t.rawInput!==void 0&&(i.preview=dT(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),i.updatedAt=e.now,t.eventId!==void 0&&(i.eventId=t.eventId),t.details&&(i.details=t.details),n?delete i.content:t.content!==void 0&&(i.content=t.content),t.locations!==void 0&&(i.locations=t.locations),t.rawInput!==void 0&&(i.rawInput=t.rawInput),r!==void 0){if(n&&an(r)&&an(i.rawOutput)){let c=an(i.rawOutput.executionSummary)?i.rawOutput.executionSummary:void 0,u=an(r.executionSummary)?r.executionSummary:void 0;if(c&&u){let d=Math.max(od(c.inputTokens),od(u.inputTokens)),f=Math.max(od(c.outputTokens),od(u.outputTokens));r={...r,executionSummary:{...u,inputTokens:d,outputTokens:f,cachedTokens:Math.max(od(c.cachedTokens),od(u.cachedTokens)),totalTokens:Math.max(od(c.totalTokens),od(u.totalTokens),d+f)}}}else c&&(r={...r,executionSummary:{...c}})}i.rawOutput=r}if(i.sourceRecordIds=gve(i.sourceRecordIds,t.sourceRecordIds),t.toolName&&(i.toolName=t.toolName),t.toolKind&&(i.toolKind=t.toolKind),t.parentToolCallId&&!i.parentToolCallId&&(i.parentToolCallId=t.parentToolCallId),i.parentToolCallId&&!i.parentBlockId){let c=e.toolBlockByCallId[i.parentToolCallId];c&&c!==vp&&(i.parentBlockId=c)}t.subagentType&&!i.subagentType&&(i.subagentType=t.subagentType),SF(e,t.toolCallId,t.status);return}let o=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==vp?e.toolBlockByCallId[t.parentToolCallId]:void 0,l={id:i0(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:dT(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind}),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.sourceRecordIds?{sourceRecordIds:[...t.sourceRecordIds]}:{},...t.details?{details:t.details}:{},...!n&&t.content!==void 0?{content:t.content}:{},...t.locations!==void 0?{locations:t.locations}:{},...t.rawInput!==void 0?{rawInput:t.rawInput}:{},...r!==void 0?{rawOutput:r}:{},...t.toolName?{toolName:t.toolName}:{},...t.toolKind?{toolKind:t.toolKind}:{},...t.parentToolCallId?{parentToolCallId:t.parentToolCallId}:{},...t.subagentType?{subagentType:t.subagentType}:{},...o?{parentBlockId:o}:{}};jh(e,l),e.toolBlockByCallId[t.toolCallId]=l.id;for(let c of e.blocks)if(c.kind==="tool"&&c.parentToolCallId===t.toolCallId&&!c.parentBlockId){let u=eu(e,c.id);(u==null?void 0:u.kind)==="tool"&&(u.parentBlockId=l.id)}SF(e,t.toolCallId,t.status??"pending"),o1(e,t.parentToolCallId)}function sve(e,t){let n=e.toolBlockByCallId[t];!n||n===vp||(a5(e),e.blocks=e.blocks.filter(r=>r.id!==n),e.blockIndexById=i5(e.blocks),delete e.toolBlockByCallId[t],delete e.toolProgress[t],e.currentToolCallId===t&&(e.currentToolCallId=void 0))}function ive(e,t){if(t||!an(e)||e.type!=="task_execution")return e;let n={type:"task_execution"};for(let r of["subagentName","subagentColor","taskDescription","status","terminateReason","tokenCount","executionSummary"])e[r]!==void 0&&(n[r]=e[r]);return n}function SF(e,t,n){if(n!==void 0){if($9.has(n)){e.currentToolCallId=t;return}if(Kye.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=ove(e));return}}}function ove(e){for(let t=e.blocks.length-1;t>=0;t-=1){let n=e.blocks[t];if((n==null?void 0:n.kind)==="tool"&&$9.has(n.status))return n.toolCallId}}function DN(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===vp)continue;let n=eu(e,t);!n||n.kind!=="tool"||$9.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function ave(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="shell"&&n.stream===t.stream){let i=eu(e,n.id);(i==null?void 0:i.kind)==="shell"&&(i.text=H9(e,i,t.text),i.updatedAt=e.now,t.eventId!==void 0&&(i.eventId=t.eventId));return}let r=i0(e,"shell"),s={id:r,kind:"shell",text:y_(e,r,void 0,t.text),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.stream?{stream:t.stream}:{}};jh(e,s),o1(e)}function lve(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="user_shell"&&n.stream===t.stream&&!e.pendingUserShellCommand){let l=eu(e,n.id);(l==null?void 0:l.kind)==="user_shell"&&(l.text=H9(e,l,t.text),l.updatedAt=e.now,t.eventId!==void 0&&(l.eventId=t.eventId));return}let r=e.pendingUserShellCommand,s=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i=i0(e,"user-shell"),o={id:i,kind:"user_shell",text:y_(e,i,void 0,t.text),command:(r==null?void 0:r.command)??(s==null?void 0:s.command)??"",...r!=null&&r.cwd||s!=null&&s.cwd?{cwd:(r==null?void 0:r.cwd)??(s==null?void 0:s.cwd)}:{},clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.stream?{stream:t.stream}:{}};e.pendingUserShellCommand=void 0,jh(e,o),o1(e)}function cve(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===s5)return;let r=eu(e,n),s=dT(t.toolCall,{title:t.title});if((r==null?void 0:r.kind)==="permission"){r.title=t.title,r.options=t.options.map(o=>({...o})),r.toolCall=t.toolCall,r.preview=s,r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId);return}let i={id:i0(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(o=>({...o})),preview:s,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.sessionId?{sessionId:t.sessionId}:{},...t.toolCall!==void 0?{toolCall:t.toolCall}:{}};jh(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,o1(e)}function uve(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===s5)return;let r=eu(e,n);if((r==null?void 0:r.kind)==="permission"){r.resolved=t.outcome,r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId);return}let s={id:i0(e,"permission"),kind:"permission",requestId:t.requestId,title:`Permission resolved: ${t.requestId}`,options:[],preview:{kind:"generic",summary:t.outcome},resolved:t.outcome,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{}};jh(e,s),e.permissionBlockByRequestId[t.requestId]=s.id,o1(e)}function Rx(e,t,n,r,s={}){let i=i0(e,t),o={id:i,kind:t,text:y_(e,i,void 0,n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...(r==null?void 0:r.eventId)!==void 0?{eventId:r.eventId}:{},...(r==null?void 0:r.serverTimestamp)!==void 0?{serverTimestamp:r.serverTimestamp}:{},...(r==null?void 0:r.type)==="error"&&r.code?{code:r.code}:{},...(r==null?void 0:r.type)==="error"&&r.promptId?{promptId:r.promptId}:{},...(r==null?void 0:r.type)==="error"&&r.errorKind?{errorKind:r.errorKind}:{},...(r==null?void 0:r.type)==="error"&&r.source?{source:r.source}:{},...((r==null?void 0:r.type)==="status"||(r==null?void 0:r.type)==="debug")&&r.source?{source:r.source}:{},...((r==null?void 0:r.type)==="status"||(r==null?void 0:r.type)==="debug")&&r.data!==void 0?{data:r.data}:{},...(r==null?void 0:r.type)==="session.branched"?{source:"session_branched",data:{sourceSessionId:r.sourceSessionId,newSessionId:r.newSessionId,displayName:r.displayName}}:{}};jh(e,o),s.clearActiveText!==!1&&o1(e)}function dve(e,t){let n={id:i0(e,"prompt_cancelled"),kind:"prompt_cancelled",clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.reason?{reason:t.reason}:{},...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{}};jh(e,n),o1(e)}function q9(e,t,n,r,s,i,o){let l=i0(e,t);return{id:l,kind:t,text:y_(e,l,o,n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...r!==void 0?{eventId:r}:{},...s!==void 0?{serverTimestamp:s}:{},...o?{sourceRecordIds:[...o]}:{},...i?{meta:{...i}}:{}}}function PZ(e,t){let n={...e,now:t.now??Date.now(),maxBlocks:t.maxBlocks??e.maxBlocks,retainSubagentBlocks:t.retainSubagentBlocks??e.retainSubagentBlocks,blocks:e.blocks,blockIndexById:e.blockIndexById,toolBlockByCallId:Ho(e.toolBlockByCallId),activeAssistantBlockByParent:Ho(e.activeAssistantBlockByParent),activeThoughtBlockByParent:Ho(e.activeThoughtBlockByParent),trimmedToolNotificationByCallId:Ho(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:Ho(e.permissionBlockByRequestId),toolProgress:Ho(Object.fromEntries(Object.entries(e.toolProgress).map(([s,i])=>[s,{...i}]))),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion},r=t.onTruncation??gk.get(e);return r&&gk.set(n,r),n}function OZ(e){var r;if(e.blocks.length<=e.maxBlocks)return e;(r=gk.get(e))==null||r({kind:"blocks"});let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(s=>s.id));e.blocks=t,e.blockIndexById=i5(t),hT.set(e,e.blocks);for(let[s,i]of Object.entries(e.toolBlockByCallId))n.has(i)||(e.toolBlockByCallId[s]=vp);bve(e);for(let[s]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[s]!==vp&&delete e.trimmedToolNotificationByCallId[s];for(let[s,i]of Object.entries(e.permissionBlockByRequestId))n.has(i)||(e.permissionBlockByRequestId[s]=s5);yve(e);for(let s of e.blocks)if(s.kind==="tool"&&s.parentBlockId&&!n.has(s.parentBlockId)){let i=eu(e,s.id);(i==null?void 0:i.kind)==="tool"&&(i.parentBlockId=void 0)}n.has(e.activeUserBlockId??"")||(e.activeUserBlockId=void 0),n.has(e.activeAssistantBlockId??"")||(e.activeAssistantBlockId=void 0),n.has(e.activeThoughtBlockId??"")||(e.activeThoughtBlockId=void 0);for(let[s,i]of Object.entries(e.activeAssistantBlockByParent))n.has(i)||delete e.activeAssistantBlockByParent[s];for(let[s,i]of Object.entries(e.activeThoughtBlockByParent))n.has(i)||delete e.activeThoughtBlockByParent[s];return e}function hve(e){return e.toolCallId===jN||e.toolKind==="updated_plan"}var hT=new WeakMap;function a5(e){hT.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById=Ho(e.blockIndexById),hT.set(e,e.blocks))}function fve(e,t){var s;let n=0,r=-1;for(let i=0;i<e.blocks.length;i+=1)if(((s=e.blocks[i])==null?void 0:s.kind)==="user"){if(r=i,n===t){CF(e,i);return}n+=1}r>=0&&t>=n&&CF(e,r)}function CF(e,t){a5(e),e.blocks=e.blocks.slice(0,t),hT.set(e,e.blocks),mve(e)}function mve(e){e.blockIndexById=i5(e.blocks),e.toolBlockByCallId=Ho(),e.permissionBlockByRequestId=Ho(),e.trimmedToolNotificationByCallId=Ho(),e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent=Ho(),e.activeThoughtBlockByParent=Ho(),e.currentToolCallId=void 0,e.pendingUserShellCommand=void 0,e.lastFollowupSuggestion=void 0;let t=new Set;for(let n of e.blocks)n.kind==="tool"?(e.toolBlockByCallId[n.toolCallId]=n.id,t.add(n.toolCallId)):n.kind==="permission"&&(e.permissionBlockByRequestId[n.requestId]=n.id);for(let n of Object.keys(e.toolProgress))t.has(n)||delete e.toolProgress[n]}function jh(e,t){a5(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function eu(e,t){if(!t)return;let n=e.blockIndexById[t];if(n===void 0)return;let r=e.blocks[n];if(!r||r.id!==t)return;let s=pve(r);return a5(e),e.blocks[n]=s,s}function pve(e){return e.kind==="permission"?{...e,options:e.options.map(t=>Xd(t)),toolCall:Xd(e.toolCall),preview:Xd(e.preview)}:e.kind==="tool"?{...e,preview:Xd(e.preview),content:Xd(e.content),locations:Xd(e.locations),rawInput:Xd(e.rawInput),rawOutput:Xd(e.rawOutput)}:{...e}}function i0(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function o1(e,t){t?(B9(e,t),z9(e,t)):(F9(e),e.activeUserBlockId=void 0)}function H9(e,t,n){let r="text"in t?t.text:"";return r.length>=RN?(n&&$Z(e,t.id,t.sourceRecordIds),r):y_(e,t.id,t.sourceRecordIds,r+n)}function y_(e,t,n,r){if(r.length<=RN)return r;$Z(e,t,n);let s=Math.max(0,RN-_F.length);return`${r.slice(0,s)}${_F}`}function $Z(e,t,n){var r;(r=gk.get(e))==null||r({kind:"text",blockId:t,sourceRecordIds:n})}function Ho(e){return Object.assign(Object.create(null),e)}function BZ(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function gve(e,t){if(!(!e&&!t))return[...new Set([...e??[],...t??[]])]}function bve(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,s])=>s===vp).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.toolBlockByCallId[s],delete e.trimmedToolNotificationByCallId[s]}function yve(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,s])=>s===s5).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.permissionBlockByRequestId[s]}function Xd(e,t=0){return t>Vye?e:Array.isArray(e)?e.map(n=>Xd(n,t+1)):an(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Xd(r,t+1)])):e}function LN(e={}){let t=TF(e),n=new Set,r=!1,s=()=>{for(let o of n)try{o()}catch(l){vve(l)}},i=()=>{r||(r=!0,queueMicrotask(()=>{r=!1,s()}))};return{getSnapshot(){return t},subscribe(o){return n.add(o),()=>{n.delete(o)}},dispatch(o){let l=Array.isArray(o)?o:[o];l.length!==0&&(t=Qye(t,l),i())},appendLocalUserMessage(o,l,c){t=Xye(t,o,{images:l,meta:c}),i()},reset(o={}){t=TF({maxBlocks:o.maxBlocks??t.maxBlocks,retainSubagentBlocks:o.retainSubagentBlocks??t.retainSubagentBlocks,...o}),i()},clearAwaitingResync(){t.awaitingResync&&(t={...t,awaitingResync:!1},i())},clearFollowupSuggestion(){t.lastFollowupSuggestion!==void 0&&(t={...t,lastFollowupSuggestion:void 0},i())}}}function vve(e){var r;let t=globalThis.reportError;if(typeof t=="function"){t(e);return}let n=(r=globalThis.console)==null?void 0:r.error;typeof n=="function"&&n.call(globalThis.console,e)}function TF(e){let t=e.blocks?[...e.blocks]:[];return{...Gye({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:i5(t),toolBlockByCallId:U1(e.toolBlockByCallId),trimmedToolNotificationByCallId:U1(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:U1(e.permissionBlockByRequestId),toolProgress:U1(e.toolProgress),activeAssistantBlockByParent:U1(e.activeAssistantBlockByParent),activeThoughtBlockByParent:U1(e.activeThoughtBlockByParent),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}function U1(e){return Object.assign(Object.create(null),e)}var wve="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function EF(e,t){var n;if(!e)return{models:[]};const r=new Set,s=[];let i=(n=e.current)==null?void 0:n.modelId;const o=e.approvalMode;let l;for(const c of e.providers)for(const u of c.models){!i&&u.isCurrent&&(i=u.modelId),l===void 0&&(i?u.modelId===i:u.isCurrent)&&(l=u.contextLimit);const d=[c.authType,u.modelId,u.baseUrl??"",u.envKey??""].join("\0");r.has(d)||(r.add(d),s.push({id:u.modelId,baseModelId:u.baseModelId,label:u.name||u.modelId,authType:c.authType,...u.contextLimit!==void 0?{contextWindow:u.contextLimit}:{},...u.modalities!==void 0?{modalities:u.modalities}:{},...u.baseUrl!==void 0?{baseUrl:u.baseUrl}:{},...u.envKey!==void 0?{envKey:u.envKey}:{},...u.isRuntime?{isRuntime:!0}:{}}))}return{models:s,currentModel:i,currentMode:o,contextWindow:l}}function xve(e){var t;const n=La((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const r=ro(n,"currentModelId")??ro(n,"currentModel"),s=n.availableModels,i=[];let o;if(Array.isArray(s))for(const l of s){const c=La(l),u=ro(c,"modelId")??ro(c,"id")??ro(c,"value");if(!u)continue;const d=La(c==null?void 0:c._meta),f=tx(d,"contextLimit")??tx(d,"contextWindow")??tx(c,"contextLimit")??tx(c,"contextWindow");o===void 0&&r!==void 0&&u===r&&(o=f),i.push({id:u,baseModelId:ro(c,"baseModelId")??Tve(u),label:ro(c,"name")??ro(c,"label")??u,...f!==void 0?{contextWindow:f}:{}})}if(!(!r&&i.length===0))return{models:i,currentModel:r,contextWindow:o}}function zZ(e){if(!e)return{commands:[],skills:[]};const t=e.availableCommands.map(r=>{var s;return{name:r.name,description:r.description||"",...(s=r.input)!=null&&s.hint?{argumentHint:r.input.hint}:{},...HZ(r._meta),raw:r}}),n=e.availableSkills.map(r=>({name:r,description:"",raw:{name:r,description:"",input:null,_meta:{source:"skill"}}}));return{commands:FZ(t,n),skills:e.availableSkills}}function AF(e){if(!e)return{commands:[],skills:[]};const t=e.skills.filter(r=>r.status==="ok");return{commands:t.map(r=>({name:r.name,description:r.description||"",...r.argumentHint?{argumentHint:r.argumentHint}:{},raw:{name:r.name,description:r.description||"",input:r.argumentHint?{hint:r.argumentHint}:null,_meta:{source:"skill"}}})),skills:t.map(r=>r.name)}}function FZ(...e){const t=new Map;for(const n of e)for(const r of n){const s=t.get(r.name);s?t.set(r.name,{...s,...r,description:r.description||s.description,argumentHint:r.argumentHint??s.argumentHint,raw:r.raw}):t.set(r.name,r)}return[...t.values()]}function kve(e,t){var n;if(e.type==="session_update"){const r=La((n=La(e.data))==null?void 0:n.update),s=qZ(r);if(s&&t(i=>({...i,tokenUsage:s,tokenCount:U9(s)})),ro(r,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=Cve(r);t(l=>({...l,commands:i,skills:o}))}return}switch(e.type){case"git_branch_changed":{const r=La(e.data),s=ro(r,"workspaceCwd"),i=ro(r,"branch");t(o=>s&&s!==o.workspaceCwd?o:{...o,gitBranch:i});break}case"git_status_changed":{const r=La(e.data),s=ro(r,"workspaceCwd");t(i=>s&&s!==i.workspaceCwd?i:{...i,gitStatus:r});break}case"session_metadata_updated":{const r=La(e.data);Object.prototype.hasOwnProperty.call(r??{},"displayName")&&t(s=>({...s,displayName:ro(r,"displayName")}));break}case"model_switched":{const r=ro(La(e.data),"modelId");r&&t(s=>({...s,currentModel:r}));break}case"approval_mode_changed":{const r=La(e.data),s=ro(r,"next")??ro(r,"mode");s&&t(i=>({...i,currentMode:s}));break}}}function jF(e){const t=ro(e,"displayName");return t!=null&&t.trim()?t:void 0}function _ve(e){var t;const n=La((t=e==null?void 0:e.state)==null?void 0:t.modes);return ro(n,"currentModeId")??ro(n,"currentMode")}function U9(e){const t=(e==null?void 0:e.inputTokens)??(e==null?void 0:e.totalTokens);if(t!==void 0&&t>0)return t;if(!e)return;const n=Object.values(e).reduce((r,s)=>r+(typeof s=="number"?s:0),0);return n>0?n:void 0}function Sve(e){var t;for(let n=e.length-1;n>=0;n--)try{const r=e[n];if(r.type!=="session_update")continue;const s=La((t=La(r.data))==null?void 0:t.update),i=qZ(s);if(i)return i}catch{}}function qZ(e){const t=La(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=La(t==null?void 0:t.usage),r={...Sw(n,"inputTokens"),...Sw(n,"outputTokens"),...Sw(n,"totalTokens"),...Sw(n,"thoughtTokens"),...Sw(n,"cachedReadTokens")};return U9(r)!==void 0?r:void 0}function Sw(e,t){const n=tx(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function Cve(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const l=La(i),c=ro(l,"name");if(!c)return[];const u=La(l==null?void 0:l.input),d={name:c,description:ro(l,"description")??"",input:u?{hint:ro(u,"hint")??""}:null,_meta:La(l==null?void 0:l._meta)??null};return[{name:c,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...HZ(d._meta),raw:d}]}),r=Array.isArray(e.availableSkills)?e.availableSkills.filter(i=>typeof i=="string"):[],s=r.map(i=>({name:i,description:"",raw:{name:i,description:"",input:null,_meta:{source:"skill"}}}));return{commands:FZ(n,s),skills:r}}function HZ(e){const n=ro(e??void 0,"source");return{...n?{source:n}:{}}}function La(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function ro(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function tx(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Tve(e){const t=e.lastIndexOf(")"),n=e.lastIndexOf("(");return n>=0&&t===e.length-1&&n<t?e.slice(0,n):e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function NF(e,t=[]){const n=[{type:"text",text:e}];for(const r of t){const s=r.mimeType??r.mediaType??r.media_type;s&&s!=="image/*"?n.push({type:"image",data:r.data,mimeType:s}):n.push({type:"image",data:r.data})}return n}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Eve=3e4;function Ave(e,t,n){const r=Number.isFinite(t)&&t>0?t:1e3,s=Number.isFinite(n)&&n>0?Math.max(r,n):r,i=r*2**Math.max(0,e-1),o=Math.min(i,s),l=.8+Math.random()*.4;return Math.min(s,Math.max(1,Math.round(o*l)))}async function xt(e,t,n=Eve){let r;try{return await Promise.race([e,new Promise((s,i)=>{r=setTimeout(()=>{i(new Error(`${t} after ${n}ms`))},n)})])}finally{r!==void 0&&clearTimeout(r)}}function jve(e,t){return e<=0||t.aborted?Promise.resolve():new Promise(n=>{const r=setTimeout(s,e);function s(){clearTimeout(r),t.removeEventListener("abort",s),n()}t.addEventListener("abort",s,{once:!0})})}function Eo(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function Nve(e,t,n="replay",r=80,s){Eo(t),t.current=setTimeout(()=>{t.current=void 0,e.getSnapshot().activeAssistantBlockId&&(e.dispatch({type:"assistant.done",reason:n}),s==null||s())},r)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Ive="qwen-code-webui-client-id:session:";function qE(e,t){if(e)return e;if(typeof window>"u")return HE();try{if(t){const n=window.sessionStorage.getItem(UZ(t));if(n)return n}return HE()}catch{return HE()}}function XC(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(UZ(t),e)}catch{}}async function IF(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${Mve(e.baseUrl)}/session/${encodeURIComponent(e.sessionId)}/detach`,r=await fetch(n,{method:"POST",headers:t,keepalive:!0});if(!(r.status===204||r.status===404))throw new Error(`Detach client failed (${r.status})`)}function HE(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function UZ(e){return`${Ive}${encodeURIComponent(e)}`}function Mve(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t-=1;return t===e.length?e:e.slice(0,t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Rve(e,t){const n={...e};return(!t||e.sessionId===t)&&(delete n.sessionId,delete n.clientId,delete n.displayName,delete n.tokenUsage,delete n.tokenCount,delete n.supportedCommands,delete n.context),{...n,status:"connected",loadingTranscript:void 0,catchingUp:void 0,error:void 0,errorStatus:void 0,missingSession:!1}}function Dve({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:r,pendingSessionLoadRef:s,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:l,skipNextCleanupDetachSessionIdRef:c,passiveAssistantDoneTimerRef:u,getCreateSessionRequest:d,createDetachedSession:f,getConnection:m,hasSessionActivePrompt:p,resetCurrentSessionActivePrompt:g,restartEventStream:b,addNotice:w,setConnection:y,setPromptStatus:v,setRestoreSessionId:x,setRestoreWorkspaceCwd:k,setRestoreMode:S,setRestoreSessionNonce:T,setAttachSessionNonce:_,setNewSessionNonce:C}){function j(){for(const[,D]of n.current)D.controller.abort();n.current.clear(),r.current.clear(),v("idle"),Eo(u),s.current&&(c.current===s.current.sessionId&&(c.current=void 0),clearTimeout(s.current.timeout),s.current.reject(new DOMException("Session cleared","AbortError")),s.current=void 0),e.reset(),x(void 0),k(void 0)}function E(D,M,R){const $=i.current+1;return i.current=$,s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException(`Session ${M} superseded by a newer request`,"AbortError"))),new Promise((N,z)=>{const G=setTimeout(()=>{var I;((I=s.current)==null?void 0:I.id)===$&&(s.current=void 0,z(Zs(w,`${Bve(M)} session failed`,new Error(`Session ${M} timed out`),zve(M))))},3e4);s.current={id:$,sessionId:D,mode:M,timeout:G,resolve:N,reject:z,...R?{signal:R}:{}}})}function L(D,M,R,$){var B;if($!=null&&$.aborted)return Promise.reject(new DOMException("Session load cancelled","AbortError"));l.current=!1;const N=E(D,M,$),z=t.current,G=z==null?void 0:z.sessionId,I=G?n.current.get(G):void 0;(B=I==null?void 0:I.reject)==null||B.call(I,new DOMException("Session switch interrupted prompt wait","AbortError")),G&&n.current.delete(G),g();const Y=M==="load"&&G===D;if(z){const U=()=>z.detach().catch(P=>{console.warn("[DaemonSessionActions] detach before session switch failed:",P)});Y?(c.current=D,N.then(U,()=>{})):U()}return Y||(t.current=void 0),Y||y(U=>({...U,status:"connecting",sessionId:D,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),v("idle"),r.current.clear(),Eo(u),Y||e.reset(),S(M),x(D),k(R??m().workspaceCwd),T(U=>U+1),N.catch(U=>{throw nx(U)||y(P=>({...P,loadingTranscript:void 0,catchingUp:void 0})),U})}return{async sendPrompt(D,M){var R,$,B,N,z;const G=pi(w,t.current,"Prompt failed","send_prompt"),I=G.sessionId;if(n.current.has(I))throw Zs(w,"Prompt failed","A prompt is already in progress","send_prompt");Eo(u),v("waiting");const Y=new AbortController;n.current.set(I,{controller:Y});try{const U=((M==null?void 0:M.images)??[]).map(W=>({data:W.data,mimeType:W.mimeType||W.mediaType||W.media_type||"image/*"})),P=M!=null&&M.inputAnnotations&&M.inputAnnotations.length>0?M.inputAnnotations:void 0;(M==null?void 0:M.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(D,U,P?{inputAnnotations:P}:void 0);const F={prompt:NF(D,U)};P&&(F._meta={inputAnnotations:P}),M!=null&&M.retry&&(F.retry=!0);const te=await G.submitPrompt(F,Y.signal);return((R=n.current.get(I))==null?void 0:R.controller)===Y&&b(I),($=M==null?void 0:M.onAdmitted)==null||$.call(M),await Lve(n.current,r.current,I,Y,te.promptId)}catch(U){if(nx(U))return((B=t.current)==null?void 0:B.sessionId)===I&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw EZ(U)?U:(((N=t.current)==null?void 0:N.sessionId)===I&&e.dispatch({type:"assistant.done",reason:"error"}),Zs(w,"Prompt failed",U,"send_prompt"))}finally{const U=n.current.get(I);(U==null?void 0:U.controller)===Y&&n.current.delete(I),((z=t.current)==null?void 0:z.sessionId)===I&&!p()&&v("idle")}},async submitPrompt(D,M){var R;const $=pi(w,t.current,"Prompt failed","send_prompt");if(M!=null&&M.sessionId&&$.sessionId!==M.sessionId)throw new Error("Session changed before prompt submission");const B=((M==null?void 0:M.images)??[]).map(I=>({data:I.data,mimeType:I.mimeType||I.mediaType||I.media_type||"image/*"})),N=M!=null&&M.inputAnnotations&&M.inputAnnotations.length>0?M.inputAnnotations:void 0;(M==null?void 0:M.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(D,B,N?{inputAnnotations:N}:void 0);const z={prompt:NF(D,B)};N&&(z._meta={inputAnnotations:N}),M!=null&&M.retry&&(z.retry=!0);const G=await $.submitPrompt(z);if((R=M==null?void 0:M.signal)!=null&&R.aborted)throw await $.removePendingPrompt(G.promptId).catch(I=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",I),w({severity:"error",category:"user_action",operation:"send_prompt",code:"daemon.send_prompt.pending_cleanup_failed",message:"Prompt was accepted after cancellation but could not be removed from the queue.",debugMessage:I instanceof Error?I.message:String(I),recoverable:!0})}),M.signal.reason??new DOMException("Aborted","AbortError");return{promptId:G.promptId}},async cancel(){var D,M;const R=pi(w,t.current,"Cancel failed","cancel_prompt"),$=n.current.get(R.sessionId);$==null||$.controller.abort(),Eo(u);const B=$?new AbortController:void 0;B&&n.current.set(R.sessionId,{controller:B});try{await xt(R.cancel(),"Cancel timed out")}catch(N){throw Zs(w,"Cancel failed",N,"cancel_prompt")}finally{B&&((D=n.current.get(R.sessionId))==null?void 0:D.controller)===B&&n.current.delete(R.sessionId),((M=t.current)==null?void 0:M.sessionId)===R.sessionId&&!p()&&v("idle")}},async setModel(D){const M=pi(w,t.current,"Set model failed","switch_model");try{const R=await xt(M.setModel(D),"Set model timed out");return y($=>({...$,currentModel:D})),R}catch(R){throw Zs(w,"Set model failed",R,"switch_model")}},async setApprovalMode(D,M){const R=pi(w,t.current,"Set approval mode failed","set_approval_mode");try{const $=await xt(R.client.setSessionApprovalMode(R.sessionId,D,{persist:M==null?void 0:M.persist,clientId:R.clientId}),"Set approval mode timed out");return y(B=>({...B,currentMode:$.mode||D})),$}catch($){throw Zs(w,"Set approval mode failed",$,"set_approval_mode")}},async respondToPermission(D,M){const R=pi(w,t.current,"Permission response failed","submit_permission");try{return await xt(R.respondToSessionPermission(D,M),"Permission response timed out")}catch($){throw Zs(w,"Permission response failed",$,"submit_permission")}},async submitPermission(D,M,R){const $=pi(w,t.current,"Permission response failed","submit_permission"),B=M!==void 0&&M.length>0?{outcome:{outcome:"selected",optionId:M},...R?{answers:R}:{}}:{outcome:{outcome:"cancelled"},...R?{answers:R}:{}};try{return await xt($.respondToSessionPermission(D,B),"Permission response timed out")}catch(N){throw Zs(w,"Permission response failed",N,"submit_permission")}},async heartbeat(){const D=t.current;if(!(!D||!o.current))return xt(D.heartbeat(),"Heartbeat timed out")},async listSessions(D){const M=t.current;if(!M)return[];try{return await xt(M.client.listWorkspaceSessions(M.workspaceCwd,D),"List sessions timed out")}catch(R){throw Zs(w,"List sessions failed",R,"list_sessions")}},async loadSession(D,M){return L(D,"load",M==null?void 0:M.workspaceCwd)},async reloadSession(D){const M=pi(w,t.current,"Reload session failed","load_session");return L(M.sessionId,"load",M.workspaceCwd,D)},async resumeSession(D,M){return L(D,"resume",M==null?void 0:M.workspaceCwd)},async createSession(D){try{l.current=!1;const M={...(D==null?void 0:D.approvalMode)!==void 0?{approvalMode:D.approvalMode}:{},...(D==null?void 0:D.sourceType)!==void 0?{sourceType:D.sourceType}:{},...(D==null?void 0:D.worktree)!==void 0?{worktree:D.worktree}:{},...(D==null?void 0:D.branch)!==void 0?{branch:D.branch}:{}},R=t.current,$=R&&m().sessionId===R.sessionId?R:void 0;if($){const N=await xt($.client.createOrAttachSession({...d(),...(D==null?void 0:D.workspaceCwd)!==void 0?{workspaceCwd:D.workspaceCwd}:{},...M}),"Create session timed out");return XC(N.clientId,N.sessionId),N}const B=await xt(f(D==null?void 0:D.workspaceCwd,M),"Create session timed out");if(l.current){try{await xt(B.detach(),"Detach cleared session timed out")}catch(N){console.warn("[DaemonSessionActions] detach after interrupted create failed:",N)}throw new DOMException("Session creation interrupted","AbortError")}return XC(B.clientId,B.sessionId),t.current=B,c.current=B.sessionId,y(N=>({...N,status:"connected",sessionId:B.sessionId,...B.clientId?{clientId:B.clientId}:{},workspaceCwd:B.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),B}catch(M){throw Zs(w,`Create session failed${D!=null&&D.workspaceCwd?` (workspace: ${D.workspaceCwd})`:""}`,M,"create_session")}},async attachSession(){const D=pi(w,t.current,"Attach session failed","attach_session"),M=E(D.sessionId,"attach");return _(R=>R+1),M},async clearSession(){const D=t.current;if(l.current=!0,j(),t.current=void 0,y(M=>Rve(M,D==null?void 0:D.sessionId)),D)try{await xt(D.detach(),"Clear session timed out")}catch(M){console.warn("[DaemonSessionActions] detach on clear failed:",M)}},async newSession(){l.current=!1,j(),y(D=>({...D,missingSession:!1,error:void 0,errorStatus:void 0})),C(D=>D+1)},async releaseSession(D){try{const M=pi(w,t.current,"Release session failed","release_session");await xt(M.client.closeSession(D),"Release session timed out")}catch(M){throw Zs(w,"Release session failed",M,"release_session")}},async closeSession(){const D=pi(w,t.current,"Close session failed","close_session");try{await xt(D.close(),"Close session timed out")}catch(M){throw Zs(w,"Close session failed",M,"close_session")}},async refreshCommands(){const D=pi(w,t.current,"Refresh commands failed","refresh_commands");try{const M=await xt(D.supportedCommands(),"Refresh commands timed out"),{commands:R,skills:$}=zZ(M);y(B=>({...B,commands:R,skills:$,supportedCommands:M}))}catch(M){throw Zs(w,"Refresh commands failed",M,"refresh_commands")}},async getContext(){const D=pi(w,t.current,"Load context failed","load_context");try{const M=await xt(D.context(),"Load context timed out");return y(R=>({...R,context:M,currentMode:Pve(M)??R.currentMode,currentModel:Ove(M)??R.currentModel})),M}catch(M){throw Zs(w,"Load context failed",M,"load_context")}},async getContextUsage(D){const M=pi(w,t.current,"Load context usage failed","load_context_usage");try{return await xt(M.contextUsage(D),"Load context usage timed out")}catch(R){throw Zs(w,"Load context usage failed",R,"load_context_usage")}},async renameSession(D){const M=pi(w,t.current,"Rename session failed","rename_session");try{return await xt(M.updateMetadata({displayName:D}),"Rename session timed out")}catch(R){throw Zs(w,"Rename session failed",R,"rename_session")}},async recapSession(){const D=pi(w,t.current,"Recap session failed","recap_session");try{return await xt(D.recap(),"Recap session timed out")}catch(M){throw Zs(w,"Recap session failed",M,"recap_session")}},async*generateSessionContent(D,M){yield*pi(w,t.current,"Generate content failed","generate_session_content").generateContent(D,M)},async getRewindSnapshots(){const D=pi(w,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await xt(D.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(M){throw Zs(w,"Load rewind snapshots failed",M,"rewind_snapshots")}},async rewindSession(D,M){const R=pi(w,t.current,"Rewind session failed","rewind_session");try{return await xt(R.rewind(D,M),"Rewind session timed out")}catch($){throw Zs(w,"Rewind session failed",$,"rewind_session")}},async btwSession(D,M){var R;const $=pi(w,t.current,"Side question failed","btw_session");try{return await xt($.btw(D,M),"Side question timed out")}catch(B){throw(R=M==null?void 0:M.signal)!=null&&R.aborted||nx(B)?B:Zs(w,"Side question failed",B,"btw_session")}},async enqueueMidTurnMessage(D,M){const R=t.current;if(!R)return{accepted:!1};try{return await R.enqueueMidTurnMessage(D,M)}catch($){return $ instanceof DOMException&&$.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",$),{accepted:!1}}},async getPendingPrompts(D){const M=t.current;if(!M)return{pendingPrompts:[]};if(D!=null&&D.sessionId&&M.sessionId!==D.sessionId)throw new Error("Session changed before pending prompts refresh");return await M.getPendingPrompts()},async removePendingPrompt(D,M){const R=t.current;return R?M!=null&&M.sessionId&&R.sessionId!==M.sessionId?await R.client.removePendingPrompt(M.sessionId,D):await R.removePendingPrompt(D):{removed:!1}},async sendShellCommand(D){var M,R;const $=pi(w,t.current,"Shell command failed","send_shell_command"),B=`${$.sessionId}:shell`;v("waiting");const N=new AbortController;n.current.set(B,{controller:N});try{return await $.shellCommand(D,N.signal)}catch(z){throw Zs(w,"Shell command failed",z,"send_shell_command")}finally{((M=n.current.get(B))==null?void 0:M.controller)===N&&n.current.delete(B),((R=t.current)==null?void 0:R.sessionId)===$.sessionId&&!p()&&v("idle")}},async getTasks(){const D=t.current;if(!D)throw new Error("Daemon session is not connected");try{return await xt(D.tasks(),"Get tasks timed out")}catch(M){throw M instanceof Error&&M.message==="Daemon session is not connected"?M:Zs(w,"Get tasks failed",M,"load_tasks")}},async cancelTask(D,M){const R=pi(w,t.current,"Cancel task failed","cancel_task");try{return await xt(R.cancelTask(D,M),"Cancel task timed out")}catch($){throw Zs(w,"Cancel task failed",$,"cancel_task")}},async clearGoal(){const D=pi(w,t.current,"Clear goal failed","clear_goal");try{return await xt(D.clearGoal(),"Clear goal timed out")}catch(M){throw Zs(w,"Clear goal failed",M,"clear_goal")}},async getStats(){const D=pi(w,t.current,"Load stats failed","load_stats");try{return await xt(D.stats(),"Load stats timed out")}catch(M){throw Zs(w,"Load stats failed",M,"load_stats")}},async loadArtifacts(){const D=t.current;if(!D)throw new Error("Daemon session is not connected");return xt(D.artifacts(),"Load artifacts timed out")},async respondToGlobalPermission(D,M){const R=pi(w,t.current,"Global permission response failed","submit_permission");try{return await xt(R.client.respondToPermission(D,M),"Global permission response timed out")}catch($){throw Zs(w,"Global permission response failed",$,"submit_permission")}},async branchSession(D){const M=pi(w,t.current,"Branch session failed","branch_session");try{const R=await xt(M.client.branchSession(M.sessionId,{name:D},M.clientId),"Branch session timed out");return XC(R.clientId,R.sessionId),L(R.sessionId,"load").catch($=>{nx($)||Zs(w,"Branch session failed",$,"branch_session")}),{sessionId:R.sessionId,displayName:R.displayName}}catch(R){throw Zs(w,"Branch session failed",R,"branch_session")}},async forkSession(D){const M=pi(w,t.current,"Fork session failed","fork_session");try{return await xt(M.fork(D),"Fork session timed out")}catch(R){throw Zs(w,"Fork session failed",R,"fork_session")}}}}function Lve(e,t,n,r,s){return new Promise((i,o)=>{const l=PN(n,s),c=t.get(l);if(c){t.delete(l),c.status==="resolved"?i(c.result):o(c.error);return}const u=e.get(n);if((u==null?void 0:u.controller)!==r){o(new DOMException("Aborted","AbortError"));return}if(u.promptId!==void 0&&u.promptId!==s){o(new Error(`Prompt accepted with unexpected id ${s}`));return}if(r.signal.aborted){e.delete(n),o(r.signal.reason??new DOMException("Aborted","AbortError"));return}const d=()=>{r.signal.removeEventListener("abort",f)},f=()=>{const m=e.get(n);(m==null?void 0:m.controller)===r&&e.delete(n),d(),o(r.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...u,promptId:s,resolve:m=>{d(),i(m)},reject:m=>{d(),o(m)}}),r.signal.addEventListener("abort",f,{once:!0})})}function PN(e,t){return JSON.stringify([e,t])}function Pve(e){const t=typeof e.state.modes=="object"&&e.state.modes!==null?e.state.modes:void 0,n=(t==null?void 0:t.currentModeId)??(t==null?void 0:t.currentMode);return typeof n=="string"?n:void 0}function Ove(e){const t=typeof e.state.models=="object"&&e.state.models!==null?e.state.models:void 0,n=(t==null?void 0:t.currentModelId)??(t==null?void 0:t.currentModel);return typeof n=="string"?n:void 0}function pi(e,t,n,r){if(!t)throw Zs(e,n,"Daemon session is not connected",r);return t}function Zs(e,t,n,r){if(nx(n)){if(n instanceof Error)return n;const i=n instanceof DOMException?n.message:"Aborted",o=new Error(i);return o.name="AbortError",o}const s=n instanceof Error?n.message:String(n);return e({severity:"error",category:"user_action",operation:r,code:`daemon.${r}.failed`,message:`${t}: ${s}`,debugMessage:s,recoverable:!0}),$ve(n instanceof Error?n:new Error(s))}function nx(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function $ve(e){return Object.assign(e,{_alreadyDispatched:!0})}function Bve(e){return e.charAt(0).toUpperCase()+e.slice(1)}function zve(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Fve=33e4;function qve({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:r}){return{async listSessions(s){const i=on(e,"List sessions failed"),o=t();return o?xt(i.listWorkspaceSessionsPage(o,s).then(l=>l.sessions),"List sessions timed out"):[]},async listSessionsPage(s){const i=on(e,"List sessions failed"),o=t();return o?xt(i.listWorkspaceSessionsPage(o,s),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const s=on(e,"List session groups failed"),i=t();return i?xt(s.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(s){const i=on(e,"Create session group failed"),o=QC(t);return xt(i.createSessionGroup(o,s),"Create session group timed out")},async updateSessionGroup(s,i){const o=on(e,"Update session group failed"),l=QC(t);return xt(o.updateSessionGroup(l,s,i),"Update session group timed out")},async deleteSessionGroup(s){const i=on(e,"Delete session group failed"),o=QC(t);return xt(i.deleteSessionGroup(o,s),"Delete session group timed out")},async updateSessionOrganization(s,i){const o=on(e,"Update session organization failed");return xt(o.updateSessionOrganization(s,i),"Update session organization timed out")},async deleteSession(s){const i=on(e,"Delete session failed"),o=await xt(i.deleteSessionsData([s]),"Delete session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.removed.length>0||o.notFound.length>0},async deleteSessions(s){const i=on(e,"Delete sessions failed");return xt(i.deleteSessionsData(s),"Delete sessions timed out")},async exportSession(s,i="html"){const o=on(e,"Export session failed");return xt(o.exportSession(s,{format:i}),"Export session timed out")},async archiveSession(s){const i=on(e,"Archive session failed"),o=await xt(i.archiveSessionsData([s]),"Archive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.archived.length>0||o.alreadyArchived.length>0},async unarchiveSession(s){const i=on(e,"Unarchive session failed"),o=await xt(i.unarchiveSessionsData([s]),"Unarchive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.unarchived.length>0||o.alreadyActive.length>0},async loadChannels(){const s=td(e,t,"Load channels failed"),[i,o]=await xt(Promise.all([s.workspaceChannelTypes(),s.workspaceChannels()]),"Load channels timed out");return{catalog:i,snapshot:o}},async upsertChannel(s,i){return td(e,t,"Update channel failed").upsertWorkspaceChannel(s,i)},async removeChannel(s,i){return td(e,t,"Remove channel failed").deleteWorkspaceChannel(s,i)},async setChannelStartup(s,i){return td(e,t,"Update channel startup failed").setWorkspaceChannelStartup(s,i)},async startChannel(s){return td(e,t,"Start channel failed").startWorkspaceChannel(s)},async stopChannel(s){return td(e,t,"Stop channel failed").stopWorkspaceChannel(s)},async restartChannel(s){return td(e,t,"Restart channel failed").restartWorkspaceChannel(s)},channelPairing:{async list(s){const i=td(e,t,"Load channel pairing requests failed");return xt(i.workspaceChannelPairingRequests(s),"Load channel pairing requests timed out")},async approve(s,i){return td(e,t,"Approve channel pairing failed").approveWorkspaceChannelPairing(s,{code:i})},async approvals(s){const i=td(e,t,"Load channel pairing approvals failed");return xt(i.workspaceChannelPairingApprovals(s),"Load channel pairing approvals timed out")},async revoke(s,i){return td(e,t,"Revoke channel pairing approval failed").revokeWorkspaceChannelPairingApproval(s,{senderId:i})}},async loadMcpStatus(){const s=on(e,"Load MCP status failed");return xt(s.workspaceMcp(),"Load MCP status timed out")},async initializeMcp(){const s=on(e,"Initialize MCP failed");return xt(s.initializeWorkspaceMcp(),"Initialize MCP timed out")},async reloadMcp(){const s=on(e,"Reload MCP failed");return xt(s.reloadWorkspaceMcp(),"Reload MCP timed out")},async loadMcpTools(s){const i=on(e,"Load MCP tools failed");try{return await xt(i.workspaceMcpTools(s),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:s,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async loadMcpResources(s){const i=on(e,"Load MCP resources failed");try{return await xt(i.workspaceMcpResources(s),"Load MCP resources timed out")}catch{return{v:1,workspaceCwd:"",serverName:s,initialized:!1,acpChannelLive:!1,resources:[],errors:[{kind:"mcp_resources",status:"error",error:"The connected daemon does not expose MCP resource details."}]}}},async restartMcpServer(s){const i=on(e,"Restart MCP server failed");return xt(i.restartMcpServer(s),"Restart MCP server timed out",5*6e4)},async manageMcpServer(s,i){const o=on(e,"Manage MCP server failed"),l=i==="authenticate"?10*6e4:5*6e4;return xt(o.manageMcpServer(s,i),"Manage MCP server timed out",l)},async addRuntimeMcpServer(s){const i=on(e,"Add MCP server failed");return xt(i.addRuntimeMcpServer(s),"Add MCP server timed out",5*6e4)},async removeRuntimeMcpServer(s){const i=on(e,"Remove MCP server failed");return xt(i.removeRuntimeMcpServer(s),"Remove MCP server timed out",5*6e4)},async loadDaemonStatus(s){const i=on(e,"Load daemon status failed");return xt(i.daemonStatus(s),"Load daemon status timed out")},async loadUsageDashboard(s){const i=on(e,"Load usage dashboard failed");return xt(i.usageDashboard(s),"Load usage dashboard timed out")},async loadSkillsStatus(){const s=on(e,"Load skills failed");return xt(s.workspaceSkills(),"Load skills timed out")},async setWorkspaceSkillEnabled(s,i){const o=on(e,"Set skill enabled failed");return xt(o.setWorkspaceSkillEnabled(s,i),"Set skill enabled timed out")},async installWorkspaceSkill(s){const i=on(e,"Install skill failed");return xt(i.installWorkspaceSkill(s),"Install skill timed out")},async deleteWorkspaceSkill(s,i){const o=on(e,"Delete skill failed");return xt(o.deleteWorkspaceSkill(s,i),"Delete skill timed out")},async loadExtensionsStatus(){const s=on(e,"Load extensions failed");return xt(s.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const s=on(e,"Load tools failed");return xt(s.workspaceTools(),"Load tools timed out")},async preheatAcp(s){const i=on(e,"Preheat ACP failed");return xt(i.workspaceAcpPreheat(s),"Preheat ACP timed out",s===void 0?void 0:s+2e3)},async setWorkspaceToolEnabled(s,i){const o=on(e,"Set tool enabled failed");return xt(o.setWorkspaceToolEnabled(s,i),"Set tool enabled timed out")},async loadSettingsStatus(){const s=on(e,"Load settings failed");return xt(s.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(s,i,o,l){const c=on(e,"Set setting failed");return xt(c.setWorkspaceSetting(s,i,o,l),"Set setting timed out")},async loadMemoryStatus(){const s=on(e,"Load memory failed");return xt(s.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(s){const i=on(e,"Read workspace file failed");return xt(i.readWorkspaceFile(s),"Read workspace file timed out")},async writeMemory(s){const i=on(e,"Write memory failed");return xt(i.writeWorkspaceMemory(s),"Write memory timed out")},async*generateContent(s,i){yield*on(e,"Generate content failed").generateWorkspaceContent(s,{signal:i==null?void 0:i.signal})},async listAgents(){const s=on(e,"List agents failed");return xt(s.listWorkspaceAgents(),"List agents timed out")},async getAgent(s,i){const o=on(e,"Get agent failed");return xt(o.getWorkspaceAgent(s,i?{scope:i}:{}),"Get agent timed out")},async createAgent(s){const i=on(e,"Create agent failed");return xt(i.createWorkspaceAgent(s),"Create agent timed out")},async generateAgent(s){const i=on(e,"Generate agent failed");return xt(i.generateWorkspaceAgent(s),"Generate agent timed out",Fve)},async deleteAgent(s,i){const o=on(e,"Delete agent failed");return xt(o.deleteWorkspaceAgent(s,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(s,i){on(e,"Glob workspace failed");const o=Ld(n,"/glob");o.searchParams.set("pattern",s),(i==null?void 0:i.maxResults)!==void 0&&o.searchParams.set("maxResults",String(i.maxResults)),(i==null?void 0:i.includeIgnored)!==void 0&&o.searchParams.set("includeIgnored",i.includeIgnored?"1":"0"),(i==null?void 0:i.cwd)!==void 0&&o.searchParams.set("cwd",i.cwd);const l=await xt(fetch(Pd(o,n),{headers:W1(r)}),"Glob workspace timed out");if(!l.ok)throw new Error(await Od(l,"GET /glob"));const c=await l.json();return{matches:Array.isArray(c.matches)?c.matches.filter(u=>typeof u=="string"):[]}},async loadProviders(){const s=on(e,"Load providers failed");return xt(s.workspaceProviders(),"Load providers timed out")},async readFileBytes(s,i){const o=on(e,"Read file bytes failed");return xt(o.readWorkspaceFileBytes(s,i??{}),"Read file bytes timed out")},async writeFile(s){const i=on(e,"Write file failed");return xt(i.writeWorkspaceFile(s),"Write file timed out")},async editFile(s){const i=on(e,"Edit file failed");return xt(i.editWorkspaceFile(s),"Edit file timed out")},async stat(s){on(e,"Stat file failed");const i=Ld(n,"/stat");i.searchParams.set("path",s);const o=await xt(fetch(Pd(i,n),{headers:W1(r)}),"Stat file timed out");if(!o.ok)throw new Error(await Od(o,"GET /stat"));return await o.json()},async listDirectory(s){on(e,"List directory failed");const i=Ld(n,"/list");i.searchParams.set("path",s);const o=await xt(fetch(Pd(i,n),{headers:W1(r)}),"List directory timed out");if(!o.ok)throw new Error(await Od(o,"GET /list"));return await o.json()},async listScheduledTasks(s){on(e,"List scheduled tasks failed");const i=Cw(s),o=Ld(n,i),l=await xt(fetch(Pd(o,n),{headers:W1(r)}),"List scheduled tasks timed out");if(!l.ok)throw new Error(await Od(l,`GET ${i}`));const c=await l.json();return Array.isArray(c.tasks)?c.tasks:[]},async createScheduledTask(s,i){on(e,"Create scheduled task failed");const o=Cw(i),l=Ld(n,o),c=await xt(fetch(Pd(l,n),{method:"POST",headers:a2(r),body:JSON.stringify(s)}),"Create scheduled task timed out");if(!c.ok)throw new Error(await Od(c,`POST ${o}`));return await c.json()},async updateScheduledTask(s,i,o){on(e,"Update scheduled task failed");const l=Cw(o,`/${encodeURIComponent(s)}`),c=Ld(n,l),u=await xt(fetch(Pd(c,n),{method:"PATCH",headers:a2(r),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!u.ok)throw new Error(await Od(u,`PATCH ${l}`));return await u.json()},async runScheduledTask(s,i){on(e,"Run scheduled task failed");const o=Cw(i,`/${encodeURIComponent(s)}/run`),l=Ld(n,o),c=await xt(fetch(Pd(l,n),{method:"POST",headers:a2(r)}),"Run scheduled task timed out");if(!c.ok)throw new Error(await Od(c,`POST ${o}`));return await c.json()},async deleteScheduledTask(s,i){on(e,"Delete scheduled task failed");const o=Cw(i,`/${encodeURIComponent(s)}`),l=Ld(n,o),c=await xt(fetch(Pd(l,n),{method:"DELETE",headers:W1(r)}),"Delete scheduled task timed out");if(!c.ok)throw new Error(await Od(c,`DELETE ${o}`))},async listGoals(){on(e,"List goals failed");const s=Ld(n,"/goals"),i=await xt(fetch(Pd(s,n),{headers:W1(r)}),"List goals timed out");if(!i.ok)throw new Error(await Od(i,"GET /goals"));const o=await i.json();return{goals:Array.isArray(o.goals)?o.goals:[],droppedCount:typeof o.droppedCount=="number"&&o.droppedCount>0?o.droppedCount:0}},async clearGoal(s){on(e,"Clear goal failed");const i=Ld(n,`/session/${encodeURIComponent(s)}/goal/clear`),o=await xt(fetch(Pd(i,n),{method:"POST",headers:a2(r),body:"{}"}),"Clear goal timed out");if(!o.ok)throw new Error(await Od(o,`POST /session/${s}/goal/clear`));return await o.json()},async loadEnv(){const s=on(e,"Load env failed");return xt(s.workspaceEnv(),"Load env timed out")},async loadPreflight(){const s=on(e,"Load preflight failed");return xt(s.workspacePreflight(),"Load preflight timed out")},async initWorkspace(s){const i=on(e,"Init workspace failed");return xt(i.initWorkspace(s),"Init workspace timed out")},async updateAgent(s,i,o){const l=on(e,"Update agent failed");return xt(l.updateWorkspaceAgent(s,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(s,i){const o=on(e,"Install extension failed");return xt(o.installExtension(s,i),"Install extension timed out")},async extensionOperationStatus(s){const i=on(e,"Load extension operation failed");return xt(i.extensionOperationStatus(s),"Load extension operation timed out")},async activeExtensionOperations(){const s=on(e,"Load active extension operations failed");return xt(s.activeExtensionOperations(),"Load active extension operations timed out")},async respondToExtensionInteraction(s,i,o,l){const c=on(e,"Respond to extension interaction failed");return xt(c.respondToExtensionInteraction(s,i,o,l),"Respond to extension interaction timed out")},async checkExtensionUpdates(s){const i=on(e,"Check extension updates failed");return xt(i.checkExtensionUpdates(s),"Check extension updates timed out")},async refreshExtensions(s){const i=on(e,"Refresh extensions failed");return xt(i.refreshExtensions(s),"Refresh extensions timed out")},async enableExtension(s,i,o){const l=on(e,"Enable extension failed");return xt(l.enableExtension(s,i,o),"Enable extension timed out")},async disableExtension(s,i,o){const l=on(e,"Disable extension failed");return xt(l.disableExtension(s,i,o),"Disable extension timed out")},async updateExtension(s,i){const o=on(e,"Update extension failed");return xt(o.updateExtension(s,i),"Update extension timed out")},async uninstallExtension(s,i){const o=on(e,"Uninstall extension failed");return xt(o.uninstallExtension(s,i),"Uninstall extension timed out")},async startDeviceFlow(s){const i=on(e,"Start device flow failed");return xt(i.startDeviceFlow({providerId:s}),"Start device flow timed out")},async getDeviceFlow(s,i){const o=on(e,"Get device flow failed");return xt(o.getDeviceFlow(s,i),"Get device flow timed out")},async cancelDeviceFlow(s){const i=on(e,"Cancel device flow failed");return xt(i.cancelDeviceFlow(s),"Cancel device flow timed out")},async getAuthStatus(){const s=on(e,"Get auth status failed");return xt(s.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const s=on(e,"Get auth providers failed");return xt(s.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(s){const i=on(e,"Install auth provider failed");return xt(i.installAuthProvider(s),"Install auth provider timed out")},async deleteModel(s){const i=on(e,"Delete model failed");return xt(i.deleteModel(s),"Delete model timed out")},async addWorkspace(s,i){const o=on(e,"Add workspace failed");return xt(o.addWorkspace(s,i),"Add workspace timed out")},async addScratchWorkspace(){const s=on(e,"Add scratch workspace failed");return xt(s.addScratchWorkspace(),"Add scratch workspace timed out")},async suggestWorkspacePaths(s){const i=on(e,"Suggest workspace paths failed");return await xt(i.workspacePathSuggestions(s),"Suggest workspace paths timed out")},async pickWorkspaceDirectory(){const s=on(e,"Open directory picker failed");return await xt(s.workspaceDirectoryPicker(),"Open directory picker timed out",32e4)},async updateWorkspace(s,i){const o=on(e,"Update workspace failed");return xt(o.updateWorkspace(s,i),"Update workspace timed out")},async removeWorkspace(s,i){const l=on(e,"Remove workspace failed").workspaceById(s).remove(i);return(i==null?void 0:i.timeoutMs)===0?l:xt(l,"Remove workspace timed out",i==null?void 0:i.timeoutMs)}}}function on(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function QC(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function td(e,t,n){return on(e,n).workspaceByCwd(QC(t))}function Cw(e,t=""){return e?`/workspaces/${encodeURIComponent(e)}/scheduled-tasks${t}`:`/scheduled-tasks${t}`}function W1(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function a2(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Ld(e,t){const n=WZ(e),r=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,r)}function Pd(e,t){return WZ(t)?e.toString():`${e.pathname}${e.search}`}function WZ(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}async function Od(e,t){try{const n=await e.json(),r=typeof n.error=="string"?n.error:typeof n.message=="string"?n.message:void 0;return r?`${t}: ${r}`:`${t}: HTTP ${e.status}`}catch{return`${t}: HTTP ${e.status}`}}const W9=h.createContext(void 0);let Tw;function Hve({baseUrl:e,token:t,workspaceCwd:n,autoConnect:r=!0,transport:s,children:i}){const o=h.useMemo(()=>r?new AN({baseUrl:e,token:t,transport:s}):void 0,[r,e,t,s]),l=h.useRef(o);l.current=o;const c=h.useRef(void 0),u=h.useRef(void 0),d=h.useRef(0),f=h.useRef(n),[m,p]=h.useState(void 0),[g,b]=h.useState(r?"connecting":"idle"),[w,y]=h.useState(void 0),v=h.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(c.current!==o&&(c.current=o,u.current=void 0,d.current++),!u.current){const T=o.capabilities().catch(_=>{throw u.current===T&&(u.current=void 0),_});u.current=T}return u.current},[o]),x=h.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));c.current!==o&&(c.current=o,d.current++);const T=++d.current,_=()=>{const j=u.current;return c.current===o&&j&&d.current!==T?j:Promise.reject(new Error("Capabilities refresh was superseded by a client change"))},C=o.capabilities().then(j=>c.current!==o||d.current!==T?_():(p(j),b("connected"),y(void 0),j),j=>{if(c.current!==o||d.current!==T)return _();throw y(j instanceof Error?j:new Error(String(j))),b("error"),j});return u.current=C,C},[o]);h.useEffect(()=>{if(!o)return;b("connecting"),y(void 0),p(void 0),Tw===o&&(Tw=void 0);let T=!1;const _=v();return _.then(C=>{!T&&c.current===o&&u.current===_&&(p(C),b("connected"))}).catch(C=>{!T&&c.current===o&&u.current===_&&(y(C instanceof Error?C:new Error(String(C))),b("error"))}),()=>{T=!0,Tw=o,queueMicrotask(()=>{Tw===o&&(Tw=void 0,o.dispose())})}},[o,v]),f.current=(m==null?void 0:m.workspaceCwd)??n;const k=h.useMemo(()=>qve({getClient:()=>l.current,getWorkspaceCwd:()=>f.current,baseUrl:e,token:t}),[e,t]),S=h.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(m==null?void 0:m.workspaceCwd)??n,status:g,error:w,capabilities:m,getCapabilities:v,refreshCapabilities:x,actions:k}},[o,t,e,n,g,w,m,v,x,k]);return a.jsx(W9.Provider,{value:S,children:i})}function yo(){const e=h.useContext(W9);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function ga(){return yo().actions}function VZ(){return h.useContext(W9)}function Uve(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&MF(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&MF(t)||(t==null?void 0:t.kind)==="tool"&&RF(t))return"responding";for(let n=e.length-1;n>=0;n--){const r=e[n];if(r.kind==="user")break;if(r.kind==="tool"&&RF(r))return"responding"}return"idle"}function Wve(e,t){const n=Uve(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function MF(e){return e.streaming===!0}function RF(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const ON=new Set;let fT;function DF(){return fT}function Vve(e){return ON.add(e),()=>{ON.delete(e)}}function Gve(e){fT={...e},GZ()}function l2(){fT!==void 0&&(fT=void 0,GZ())}function GZ(){for(const e of ON)e()}function Kve(e){if(!e||typeof e!="object")return;const t=e;if(t.type!=="followup_suggestion")return;const n=t.data;if(!n||typeof n!="object")return;const r=n,s=r.sessionId,i=r.suggestion,o=r.promptId;if(!(typeof s!="string"||typeof i!="string"||i.length===0||typeof o!="string"))return{sessionId:s,suggestion:i,promptId:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const $N=new Set,KZ=Object.freeze([]),UE=64;let ep=KZ;function LF(){return ep}function Yve(e){return $N.add(e),()=>{$N.delete(e)}}function Xve(e){const t=[...ep,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>UE){const n=t.length-UE;console.debug(`[mid-turn] sidechannel buffer over ${UE}; evicting ${n} oldest batch(es)`),ep=t.slice(n)}else ep=t;YZ()}function Qve(e){if(e.length===0||ep.length===0)return;const t=new Set(e),n=ep.filter(r=>!t.has(r));n.length!==ep.length&&(ep=n.length===0?KZ:n,YZ())}function YZ(){for(const e of $N)e()}function Jve(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==AZ)return;const n=t.data;if(!n||typeof n!="object")return;const r=n,s=r.sessionId,i=r.messages;if(typeof s!="string"||!Array.isArray(i))return;const o=i.filter(c=>typeof c=="string"&&c.length>0);if(o.length===0)return;const l=t.originatorClientId;return{sessionId:s,messages:o,...typeof l=="string"?{originatorClientId:l}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const BN=new Set,zN=new Set;let XZ=0,Yb=[];function Zve(){return XZ}function PF(){return Yb}function ewe(e){return BN.add(e),()=>{BN.delete(e)}}function twe(e){return zN.add(e),()=>{zN.delete(e)}}function nwe(){XZ++;for(const e of BN)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function QZ(){for(const e of zN)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function rwe(e){if(e.length===0)return;const t=new Set(e),n=Yb.filter(r=>!t.has(r));n.length!==Yb.length&&(Yb=n,QZ())}function swe(e){const t=JZ(e);return t?(Yb=[...Yb,t].slice(-200),QZ(),(t.type===L9||t.type===P9||t.type===O9)&&nwe(),!0):!1}function iwe(e){return JZ(e)!==void 0}function JZ(e){if(!e||typeof e!="object")return;const t=e,n=t.type,r=t.data;if(!r||typeof r!="object")return;const s=r;if(typeof s.sessionId=="string"&&((n===L9||n===P9||n===O9)&&typeof s.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof s.promptId=="string"))return e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const ZZ=[404,410],owe=new Set(ZZ);function Dx(e){return e!==void 0&&owe.has(e)}function $d(e,t){return Dx(t)&&!Dx(e)?t:e}const OF="session_transcript_pagination",awe="workspace_acp_preheat",lwe="workspace_acp_status";function Bm(e,t){const n=IZ(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}function WE(e){if(e.type==="history_truncated")try{return Io(e.data)?$u(e.data,"recordId"):void 0}catch{return}if(e.type==="session_update")try{if(!Io(e.data))return;const t=e.data.update,n=Io(t)?t._meta:e.data._meta;return Io(n)?$u(n,"qwen.session.recordId"):void 0}catch{return}}function eee(e){return e.type==="history_truncated"&&Io(e.data)&&e.data.fullTranscriptAvailable===!0}function cwe(e,t,n){const r=e.getSnapshot(),s=new Set;for(const c of r.blocks)for(const u of c.sourceRecordIds??[])s.add(u);const i=s.size===0?t:t.filter(c=>{var u;return!((u=c.sourceRecordIds)!=null&&u.some(d=>s.has(d)))}),o=LN({maxBlocks:Number.MAX_SAFE_INTEGER,nextOrdinal:r.nextOrdinal,retainSubagentBlocks:r.retainSubagentBlocks});o.dispatch(i);const l=o.getSnapshot();return l.blocks.length+r.blocks.length>n?!1:(e.reset({...r,blocks:[...l.blocks,...r.blocks],nextOrdinal:l.nextOrdinal,toolBlockByCallId:{...l.toolBlockByCallId,...r.toolBlockByCallId},permissionBlockByRequestId:{...l.permissionBlockByRequestId,...r.permissionBlockByRequestId}}),!0)}function Sm(e,t){if(!(typeof e!="string"||e.length===0))return e.length<=t?e:`${e.slice(0,t)}…`}function uwe(e){var t;const n=Io(e.rawInput)?e.rawInput:void 0,r=Io(e.rawOutput)?e.rawOutput:void 0,s=(t=e.toolName)==null?void 0:t.toLowerCase();if(!(s==="agent"||s==="task"||typeof(n==null?void 0:n.subagent_type)=="string"||(r==null?void 0:r.type)==="task_execution"))return e;const o=Io(r==null?void 0:r.executionSummary)?r.executionSummary:void 0,l=Sm(n==null?void 0:n.subagent_type,120),c=Sm(n==null?void 0:n.prompt,240),u=Sm(n==null?void 0:n.description,240),d=Sm(r==null?void 0:r.subagentName,120),f=Sm(r==null?void 0:r.subagentColor,80),m=Sm(r==null?void 0:r.taskDescription,240),p=Sm(r==null?void 0:r.status,80),g=Sm(r==null?void 0:r.terminateReason,240),b=n?{...l?{subagent_type:l}:{},...c?{prompt:c}:{},...u?{description:u}:{},...n.run_in_background===!0?{run_in_background:!0}:{}}:void 0,w=r?{...r.type==="task_execution"?{type:"task_execution"}:{},...d?{subagentName:d}:{},...f?{subagentColor:f}:{},...m?{taskDescription:m}:{},...p?{status:p}:{},...g?{terminateReason:g}:{},...typeof r.tokenCount=="number"?{tokenCount:r.tokenCount}:{},...o?{executionSummary:{...typeof o.totalToolCalls=="number"?{totalToolCalls:o.totalToolCalls}:{},...typeof o.totalDurationMs=="number"?{totalDurationMs:o.totalDurationMs}:{},...typeof o.outputTokens=="number"?{outputTokens:o.outputTokens}:{},...typeof o.inputTokens=="number"?{inputTokens:o.inputTokens}:{},...typeof o.cachedTokens=="number"?{cachedTokens:o.cachedTokens}:{},...typeof o.totalTokens=="number"?{totalTokens:o.totalTokens}:{}}}:{}}:void 0;return{...e,...b&&Object.keys(b).length>0?{rawInput:b}:{rawInput:void 0},...w&&Object.keys(w).length>0?{rawOutput:w}:{rawOutput:void 0},content:void 0,details:void 0}}function VE(e){const t=[];for(const n of e)"parentToolCallId"in n&&n.parentToolCallId&&n.type!=="assistant.usage"||t.push(n.type==="tool.update"?uwe(n):n);return t}const tee=h.createContext(void 0),nee=h.createContext(void 0),V9=h.createContext(void 0),ree=h.createContext(void 0),see=h.createContext(void 0),iee=h.createContext(void 0),oee=h.createContext(void 0),G9=new Set([401,403]),dwe=new Set([...G9,...ZZ]),hwe=2e5,fwe={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,artifactsVersion:0,initVersion:0,authVersion:0},mwe=Symbol("unhandled session");function l5(e){const{baseUrl:t,token:n,workspaceCwd:r,sessionId:s,clientId:i,createSessionRequest:o,maxQueued:l=1024,maxBlocks:c=hwe,historyPageSize:u,subagentTranscriptMode:d="full",suppressOwnUserEcho:f=!0,includeRawEvent:m=!1,autoConnect:p=!0,autoReconnect:g=!0,restartEventStreamOnPrompt:b=!1,reconnectDelayMs:w=1e3,maxReconnectDelayMs:y=1e4,heartbeatIntervalMs:v=3e4,heartbeatFailureThreshold:x=3,loadWarnings:k,children:S}=e,T=VZ(),_=t??(T==null?void 0:T.baseUrl),C=n??(T==null?void 0:T.token),j=r??(T==null?void 0:T.workspaceCwd),E=h.useRef(T==null?void 0:T.client);E.current=T==null?void 0:T.client;const L=h.useRef(T==null?void 0:T.capabilities);L.current=T==null?void 0:T.capabilities;const D=h.useRef(T==null?void 0:T.getCapabilities);D.current=T==null?void 0:T.getCapabilities;const M=h.useRef(!1),$=h.useRef(s).current,B=$===void 0,N=h.useRef(j);N.current=j;const z=h.useRef(j);j&&(z.current=j);const G=h.useMemo(()=>LN({maxBlocks:c,retainSubagentBlocks:d==="full"}),[c,d]),I=h.useRef(void 0),Y=h.useRef({hasMore:!1,loading:!1,capacityReached:!1,paginationError:!1}),[U,P]=h.useState({hasMore:!1,loading:!1,capacityReached:!1,paginationError:!1}),F=h.useRef(void 0),te=h.useRef(void 0),W=h.useRef(new Map),K=h.useRef(new Map),ce=h.useRef(void 0),ie=h.useRef(0),Z=h.useRef(void 0),ee=h.useRef(!1),oe=h.useRef({consecutiveFailures:0}),we=h.useRef(!1),pe=h.useRef(void 0),he=h.useRef(new WeakSet),X=h.useRef({suppressOwnUserEcho:f,includeRawEvent:m}),ye=h.useRef({reconnectDelayMs:w,maxReconnectDelayMs:y}),Ce=h.useRef(k),ae=h.useRef(u),me=h.useRef(d),We=h.useRef(void 0);(!We.current||i)&&(We.current=qE(i)),X.current={suppressOwnUserEcho:f,includeRawEvent:m},ye.current={reconnectDelayMs:w,maxReconnectDelayMs:y},Ce.current=k,ae.current=u,me.current=d;const Oe=o==null?void 0:o.modelServiceId,Mt=o==null?void 0:o.sessionScope,$t=h.useRef(o);$t.current=o;const[St,ue]=h.useState("idle"),[Ee,tt]=h.useState($),[ut,Ct]=h.useState(void 0),[Ze,Et]=h.useState("load"),[Nt,gt]=h.useState(0),[Je,Ae]=h.useState(0),[de,nt]=h.useState(0),[ve,Ke]=h.useState({status:p?"connecting":"idle",...$?{sessionId:$}:{}}),le=h.useRef(ve);le.current=ve,h.useEffect(()=>{T!=null&&T.capabilities&&Ke(He=>He.capabilities===T.capabilities?He:{...He,capabilities:T.capabilities})},[T==null?void 0:T.capabilities]);const Le=h.useRef(0),[dt,Fe]=h.useState([]),Ge=h.useCallback(He=>{const Ye={...He,id:He.id??`daemon-notice-${Date.now()}-${++Le.current}`,createdAt:He.createdAt??Date.now()};return Fe(Yt=>Yt.some(Cn=>Cn.id===Ye.id)?Yt:[...Yt.slice(-49),Ye]),Ye},[]),un=h.useCallback(He=>{Fe(Ye=>Ye.filter(Yt=>Yt.id!==He))},[]),Wn=h.useCallback(()=>{Fe([])},[]),Me=h.useMemo(()=>({notices:dt,dismissNotice:un,clearNotices:Wn}),[Wn,un,dt]),[yt,cn]=h.useState(fwe),Re=h.useRef(()=>!1),et=h.useRef(!1);h.useEffect(()=>(et.current=!0,()=>{et.current=!1}),[]),h.useEffect(()=>{var He;if(!p)return;if(!E.current&&!_){Ke({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Ye=new AbortController;let Yt=!1;const Cn=Ze==="load"&&Ee!==void 0&&Ee===((He=I.current)==null?void 0:He.sessionId)&&Ee===pe.current;let Tn=[],zr;const Ns=()=>{if(zr=void 0,Tn.length===0)return;const Vt=Tn;Tn=[];try{G.dispatch(Vt)}catch(Dt){console.error("[DaemonSessionProvider] batched transcript dispatch failed",{eventCount:Vt.length,error:Dt})}},kr=()=>{zr!==void 0&&(clearTimeout(zr),zr=void 0)},si=Vt=>{if(Vt.length!==0){for(const Dt of Vt)Tn.push(Dt);zr===void 0&&(zr=setTimeout(Ns,0))}},Fr=()=>{kr(),Ns()},At=Vt=>{Fr(),G.dispatch(Vt)},Xn=()=>{kr(),Tn=[]};return(async()=>{var Vt,Dt,Kn,Vn,ds,hs,vs,Mr,ji,os,zt,Ni,Ur,vo,wo;const Ps=E.current??new AN({baseUrl:_,token:C});let Gt,_r,Er=Ee,Do=!Ee&&de>0,fs=0,di=!1,ws=()=>!1,xe=!1;for(;!Yt&&!Ye.signal.aborted;){const $e=di;di=!1;let it=!1,Ft,On;const Yn=()=>{On==null||On(),On=void 0,F.current===Ft&&(F.current=void 0)};try{let cr=!1,Gs=!1,Qr=!1,vr=!1,xr,xs;if(!Gt){const ct=I.current;ct&&!Ee&&!Er&&!Do&&(Gt=ct,Er=ct.sessionId,te.current=ct.sessionId,vr=!0)}if(!Gt){Cn||Ke(Vr=>({...Vr,status:"connecting",error:void 0,errorStatus:$d(void 0,Vr.errorStatus)}));const ct=D.current,tr=L.current??(ct?await ct():await Ps.capabilities());if(Yt||Ye.signal.aborted)return;_r=tr;const re=Array.isArray(tr.features)&&tr.features.includes(OF);ee.current=Array.isArray(tr.features)&&tr.features.includes("client_heartbeat");const ge=ut??N.current??tr.workspaceCwd;z.current=ge;const ze=Array.isArray(tr.features)?tr.features:[],ot=ge===tr.workspaceCwd&&ze.includes(awe),mn=ot&&ze.includes(lwe);if((B||we.current)&&!Ee&&!Er&&!Do){const[Vr,Po,Gi,va]=await Promise.allSettled([Ps.workspaceProviders(),Ps.workspaceSkills(),mn?Ps.workspaceAcpStatus():Promise.resolve(void 0),ge?Ps.workspaceByCwd(ge).workspaceGit():Ps.workspaceGit()]);Vr.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",Vr.reason),Po.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",Po.reason),mn&&Gi.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",Gi.reason);const qr=Vr.status==="fulfilled"?Vr.value:void 0,$s=EF(qr),{commands:ei,skills:mi}=AF(Po.status==="fulfilled"?Po.value:void 0),Ua=Po.status==="rejected"||we.current&&ei.length===0;Ke(ii=>({...ii,status:"connected",workspaceCwd:ge,gitBranch:va.status==="fulfilled"?va.value.branch??void 0:void 0,models:$s.models,currentModel:$s.currentModel,currentMode:$s.currentMode,contextWindow:$s.contextWindow,providers:qr,capabilities:tr,commands:Ua?ii.commands:ei,skills:Ua?ii.skills:mi})),ot&&!(Gi.status==="fulfilled"&&((Vt=Gi.value)==null?void 0:Vt.channelLive)===!0)&&!M.current&&(M.current=!0,(async()=>{try{const ii=await Ps.workspaceAcpPreheat(5e3);if(Yt||Ye.signal.aborted||!ii.ready||le.current.sessionId)return;const wa=await Ps.workspaceSkills();if(Yt||Ye.signal.aborted||le.current.sessionId)return;const{commands:Zo,skills:kt}=AF(wa);Ke(Qt=>Qt.sessionId?Qt:{...Qt,commands:Zo,skills:kt})}catch(ii){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",ii)}finally{M.current=!1}})());return}const Bt=Ee&&Ze==="resume"?_w.resume:_w.load,zn=Ee??Er,Zn=i?We.current:qE(void 0,zn);it=!!Ee,zn&&!Cn&&Ke(Vr=>({...Vr,sessionId:zn,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const Mn=((Dt=ce.current)==null?void 0:Dt.sessionId)===zn?ce.current:void 0,vn=Ee?await Bt(Ps,Ee,{workspaceCwd:ge,...re&&Ze==="load"&&ae.current!==void 0?{historyPageSize:ae.current}:{}},Zn):Er?await _w.load(Ps,Er,{workspaceCwd:ge,...re&&ae.current!==void 0?{historyPageSize:ae.current}:{}},Zn):await _w.createOrAttach(Ps,{...Oe!==void 0?{modelServiceId:Oe}:{},...Do?{sessionScope:"thread"}:Mt!==void 0?{sessionScope:Mt}:{},workspaceCwd:ge},Zn);if(it=!1,!i&&vn.clientId&&(We.current=vn.clientId,XC(vn.clientId,vn.sessionId)),Yt||Ye.signal.aborted){IF({baseUrl:_,token:C,sessionId:vn.sessionId,clientId:vn.clientId}).catch(Vr=>console.warn("[DaemonSessionProvider] detach failed:",Vr));return}if(Cn&&(Mn==null?void 0:Mn.sessionId)===vn.sessionId&&((Kn=Mn.signal)!=null&&Kn.aborted||ce.current!==Mn)){const Vr=I.current;if(vn!==Vr&&await vn.detach().catch(Po=>{console.warn("[DaemonSessionProvider] detach cancelled reload failed:",Po)}),ce.current===Mn&&(ce.current=void 0,clearTimeout(Mn.timeout),Mn.reject(new DOMException("Session load cancelled","AbortError"))),pe.current===vn.sessionId&&(pe.current=void 0),it=!1,(Vr==null?void 0:Vr.sessionId)===vn.sessionId){Gt=Vr,Er=Vr.sessionId,fs=0,di=!0;continue}return}const En=te.current;En!==vn.sessionId&&Wn(),En!==void 0&&vn.sessionId!==En?(ue("idle"),Eo(Z),Qr=!0):En!==void 0&&(vn.replaySnapshot.compactedReplay.length+vn.replaySnapshot.liveJournal.length>0?(ue("idle"),Eo(Z),Qr=!0):(G.dispatch({type:"assistant.done",reason:"reconnected"}),G.getSnapshot().awaitingResync&&G.clearAwaitingResync())),cr=En!==void 0&&En===vn.sessionId,Gs=vn.replaySnapshot.compactedReplay.length>0||vn.replaySnapshot.liveJournal.length>0;const fi=[...vn.replaySnapshot.compactedReplay,...vn.replaySnapshot.liveJournal];xr=Sve(fi),xs=U9(xr),Gt=vn,Er=Gt.sessionId,Do=!1,te.current=Gt.sessionId,I.current=Gt}const nn=Gt,ks=he.current.has(nn);let Jr=nn.hasActivePrompt===!0&&!ks;const fn=()=>{he.current.add(nn),Jr=!1},Ks=()=>Jr||W.current.has(nn.sessionId);ws=Ks,Re.current=Ks,ue(Ks()?"streaming":"idle");const ur=ce.current,je=(ur==null?void 0:ur.sessionId)===nn.sessionId?ur:void 0,{compactedReplay:lt,liveJournal:Xt}=nn.replaySnapshot,Nn=[...lt,...Xt],Lt=Nn.filter(ct=>ct.type==="session_update").map(WE).find(ct=>ct!==void 0)??Nn.filter(ct=>ct.type==="history_truncated").map(WE).find(ct=>ct!==void 0)??nn.historyAnchorRecordId,Be=Nn.some(eee),yn=Array.isArray(_r==null?void 0:_r.features)&&_r.features.includes(OF)&&(nn.historyHasMore||Be)&&Lt!==void 0;Y.current={sessionId:nn.sessionId,...Lt!==void 0?{beforeRecordId:Lt}:{},hasMore:yn,loading:!1,capacityReached:!1,paginationError:!1},P({hasMore:yn,loading:!1,capacityReached:!1,paginationError:!1});const mr=Gs&&Nn.length>0;if(Qr&&!mr&&G.reset(),mr){const ct={...X.current,suppressOwnUserEcho:!1},tr=[];for(const ge of Nn)try{const ze=GE(ge,nn.clientId,ct,Ke,{updateConnection:!1}),ot=KE(ge,ze,Ge,un,{hideHistoryTruncation:yn});if(tr.push(...me.current==="summary"?VE(ot):ot),ge.type==="turn_complete"){const mn=((Vn=ge.data)==null?void 0:Vn.stopReason)??"end_turn";tr.push(Bm(ge,mn))}else ge.type==="turn_error"&&tr.push(Bm(ge,"error"))}catch(ze){const ot=ze instanceof Error?ze.message:String(ze);Ge({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:ot,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",ze)}let re=!1;if(Qr||G.getSnapshot().blocks.length===0){const ge=LN({maxBlocks:Number.MAX_SAFE_INTEGER,retainSubagentBlocks:me.current==="full"});ge.dispatch(tr);const ze=ge.getSnapshot();re=ze.blocks.length>c,G.reset({...ze,maxBlocks:Math.max(c,ze.blocks.length)})}else tr.length>0&&G.dispatch(tr);tr.length>0&&zF(tr,cn),re&&yn&&(Y.current.hasMore=!1,Y.current.capacityReached=!0,P({hasMore:!1,loading:!1,capacityReached:!0,paginationError:!1}));for(const ge of Nn)$F(W.current,K.current,nn.sessionId,ge,G,ue,Z,{requireBoundPromptId:!0});Ke(ge=>({...ge,catchingUp:void 0}))}Ke(ct=>({...ct,status:"connected",sessionId:nn.sessionId,...nn.clientId?{clientId:nn.clientId}:{},workspaceCwd:nn.workspaceCwd,displayName:jF(nn.state)??(ct.sessionId===nn.sessionId?ct.displayName:void 0),tokenUsage:xr!==void 0?xr:ct.sessionId===nn.sessionId?ct.tokenUsage:void 0,tokenCount:xs!==void 0?xs:ct.sessionId===nn.sessionId?ct.tokenCount??0:0,loadingTranscript:void 0,catchingUp:mr?ct.catchingUp:cr||nn.lastEventId!=null||void 0})),je&&(ce.current=void 0,clearTimeout(je.timeout),pe.current===nn.sessionId&&(pe.current=void 0),je.resolve());const dr=$e||vr&&le.current.commands!==void 0&&le.current.skills!==void 0&&le.current.supportedCommands!==void 0&&le.current.context!==void 0,as=$e?Promise.resolve({branch:le.current.gitBranch}):nn.workspaceCwd?Ps.workspaceByCwd(nn.workspaceCwd).workspaceGit():Ps.workspaceGit(),[Ht,hr,hi,Zr]=await Promise.allSettled([dr?Promise.resolve(void 0):Ps.workspaceProviders(),dr?Promise.resolve(void 0):nn.supportedCommands(),dr?Promise.resolve(void 0):nn.context(),as]),Os=(Ht==null?void 0:Ht.status)==="fulfilled"?Ht.value:void 0,Vi=(hr==null?void 0:hr.status)==="fulfilled"?hr.value:void 0,Ms=(hi==null?void 0:hi.status)==="fulfilled"?hi.value:void 0,Lo=(Zr==null?void 0:Zr.status)==="fulfilled"?Zr.value.branch??void 0:void 0,Ys=[(Ht==null?void 0:Ht.status)==="rejected"?(ds=Ce.current)==null?void 0:ds.models:void 0,(hr==null?void 0:hr.status)==="rejected"?(hs=Ce.current)==null?void 0:hs.commands:void 0,(hi==null?void 0:hi.status)==="rejected"?(vs=Ce.current)==null?void 0:vs.context:void 0].filter(ct=>!!ct),ya=EF(Os),Ss=xve(Ms),Li=Ss&&Ss.models.length>0?Ss.models:ya.models,pr=(Ss==null?void 0:Ss.currentModel)??ya.currentModel,xo=pr===ya.currentModel?ya.contextWindow:(Mr=ya.models.find(ct=>ct.id===pr))==null?void 0:Mr.contextWindow,Qo=(Ss==null?void 0:Ss.contextWindow)??((ji=Li.find(ct=>ct.id===pr))==null?void 0:ji.contextWindow)??xo,{commands:ko,skills:_o}=zZ(Vi),_c=_ve(Ms)??ya.currentMode;Ke(ct=>ct.sessionId!==nn.sessionId?ct:{...ct,status:"connected",sessionId:nn.sessionId,...nn.clientId?{clientId:nn.clientId}:{},workspaceCwd:nn.workspaceCwd,commands:Vi!==void 0?ko:ct.commands,skills:Vi!==void 0?_o:ct.skills,models:Li.length>0?Li:ct.models,currentModel:pr??ct.currentModel,currentMode:_c??ct.currentMode,displayName:jF(nn.state)??ct.displayName,contextWindow:Qo??ct.contextWindow,providers:Os??ct.providers,supportedCommands:Vi??ct.supportedCommands,context:Ms??ct.context,gitBranch:Zr.status==="fulfilled"?Lo:ct.gitBranch,capabilities:_r??ct.capabilities,loadingTranscript:void 0,catchingUp:mr?ct.catchingUp:cr||nn.lastEventId!=null||void 0}),Ys.length>0&&G.dispatch(Ys.map(ct=>({type:"status",text:ct})));let Ha=!1,Cs=!1;const lo=()=>{const ct=W.current.get(nn.sessionId);ct==null||ct.controller.abort(),W.current.delete(nn.sessionId),Jr&&fn(),Eo(Z),ue("idle"),Xn(),G.reset(),nn.setLastEventId(0),Er=nn.sessionId,Cs=!0,Gt=void 0,I.current=void 0,Re.current=()=>!1,Ke(tr=>({...tr,status:"connecting",error:void 0,errorStatus:$d(void 0,tr.errorStatus)}))},Jo=new AbortController;Ft={sessionId:nn.sessionId,controller:Jo,restartRequested:!1},F.current=Ft;const Sc=()=>Jo.abort(Ye.signal.reason);Ye.signal.addEventListener("abort",Sc,{once:!0}),On=()=>Ye.signal.removeEventListener("abort",Sc);for await(const ct of nn.events({signal:Jo.signal,maxQueued:l})){if(((os=I.current)==null?void 0:os.sessionId)!==nn.sessionId)break;Ha||(Ha=!0,fs=0);try{const tr=Kve(ct);if(tr){Gve(tr);continue}const re=Jve(ct);re&&Xve(re),iwe(ct)&&(swe(ct),ct.type==="pending_prompt_started"&&(Eo(Z),ue("waiting")));const ge=GE(ct,nn.clientId,X.current,Ke),ze=KE(ct,ge,Ge,un),ot=me.current==="summary"?VE(ze):ze;if(ct.type==="state_resync_required"&&(typeof ct.data=="object"&&ct.data!==null?ct.data.reason:void 0)==="epoch_reset"){lo();break}if(zF(ze,cn),ze.length>0){const vn=YE(ze);ue(En=>En==="waiting"||En==="idle"&&vn?"streaming":En)}(ct.type==="turn_complete"||ct.type==="turn_error")&&Fr();const mn=$F(W.current,K.current,nn.sessionId,ct,G,ue,Z);let Bt=!1;if(!mn&&Jr&&(ct.type==="turn_complete"||ct.type==="turn_error")){fn(),Bt=!0,Eo(Z);const vn=ct.type==="turn_complete"?((zt=ct.data)==null?void 0:zt.stopReason)??"end_turn":"error";At(Bm(ct,vn)),Ks()||ue("idle")}!Ks()&&ze.some(vn=>vn.type==="debug")&&Fr();const Zn=!Ks()&&G.getSnapshot().activeAssistantBlockId!=null?ot.filter(vn=>vn.type!=="debug"):ot;si(Zn);for(const vn of ze)if(vn.type==="prompt.cancelled"&&(Jr||vn.originatorClientId!==nn.clientId)){At(Bm(ct,"cancelled"));const En=Jr;fn(),Bt=!0,Eo(Z),En||W.current.delete(nn.sessionId),Ks()||ue("idle")}else vn.type==="session.replay_complete"&&(Fr(),Ke(En=>({...En,catchingUp:void 0})),G.getSnapshot().awaitingResync&&G.clearAwaitingResync(),Ks()||(Eo(Z),At({type:"assistant.done",reason:"replay_complete"}),ue("idle")));const Mn=!mn&&!Bt&&!Ks();if(Mn&&(ze.some(En=>En.type==="user.text.delta")?ue("waiting"):YE(ze)&&ue(En=>En==="idle"?"streaming":En)),Mn&&ct.type==="turn_complete"){Eo(Z);const vn=((Ni=ct.data)==null?void 0:Ni.stopReason)??"end_turn";At(Bm(ct,vn)),ue("idle")}else Mn&&ct.type==="turn_error"?(Eo(Z),At(Bm(ct,"error")),ue("idle")):Mn&&YE(ze)&&Nve(G,Z,"passive_observer",3e3,()=>ue("idle"));if(ct.type==="state_resync_required"&&(typeof ct.data=="object"&&ct.data!==null?ct.data.reason:void 0)!=="epoch_reset"){Ks()||(ue("idle"),Eo(Z)),Xn(),G.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",nn.sessionId),Cs=!0,Gt=void 0,I.current=void 0,Re.current=()=>!1,Ke(En=>({...En,status:"connecting",error:void 0,errorStatus:$d(void 0,En.errorStatus)}));break}if(ct.type==="session_closed"&&((Ur=ct.data)==null?void 0:Ur.reason)==="client_close"){xe=!0;const vn=nn.sessionId,En=W.current.get(vn);En==null||En.controller.abort(),W.current.delete(vn),Gt=void 0,I.current=void 0;break}}catch(tr){const re=tr instanceof Error?tr.message:String(tr);Ge({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:re,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",tr)}}Fr();const fl=Ft.restartRequested;if(Yn(),fl){fs=0,di=!0;continue}if(xe){At({type:"assistant.done",reason:"cancelled"}),ue("idle"),Eo(Z),Ke(ct=>({...ct,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(we.current){Gt=void 0,I.current=void 0,Re.current=()=>!1;return}!Yt&&!Ye.signal.aborted&&!Cs&&(((vo=I.current)==null?void 0:vo.sessionId)===nn.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),Ks()||(Eo(Z),ue("idle"),At({type:"assistant.done",reason:"stream_ended"}))),Ke(ct=>({...ct,status:ct.status==="error"?"error":"disconnected",error:ct.status==="error"?ct.error:void 0,errorStatus:$d(void 0,ct.errorStatus)})))}catch(cr){const Gs=(Ft==null?void 0:Ft.restartRequested)===!0;if(Yn(),Gs&&!Yt&&!Ye.signal.aborted){Fr(),fs=0,di=!0;continue}if(Yt||Ye.signal.aborted)return;Fr();const Qr=cr instanceof Error?cr.message:String(cr),vr=mT(cr),xr=Gt==null?void 0:Gt.sessionId,xs=Twe(cr),nn=Cwe(cr);if(xr&&(xs||nn)){const Jr=W.current.get(xr);Jr==null||Jr.controller.abort(),W.current.delete(xr)}(xs||nn||!ws())&&(Eo(Z),ue("idle"));const ks=ce.current;if(ks&&(ks.sessionId===Ee||ks.sessionId===Er)&&(pe.current===ks.sessionId&&(pe.current=void 0),ce.current=void 0,clearTimeout(ks.timeout),ks.reject(cr)),xs||nn){if(Gt=void 0,I.current=void 0,xs){Ke(fn=>({...fn,status:"error",sessionId:void 0,error:Qr,errorStatus:$d(vr,fn.errorStatus),missingSession:!1,capabilities:_r??fn.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const Jr=it&&Dx(vr);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",xr,vr,Qr),Ke(fn=>({...fn,status:"disconnected",sessionId:void 0,error:Qr,errorStatus:$d(vr,fn.errorStatus),missingSession:Jr||fn.missingSession===!0,capabilities:_r??fn.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else if(Cn&&Gt===void 0&&(ks==null?void 0:ks.sessionId)===Ee&&((wo=I.current)==null?void 0:wo.sessionId)===Ee){Gt=I.current,Er=Gt.sessionId,fs=0,di=!0;continue}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",Gt==null?void 0:Gt.sessionId);if(!g){Gt=void 0,I.current=void 0,Ke(Jr=>({...Jr,status:"error",error:Qr,errorStatus:$d(vr,Jr.errorStatus),missingSession:!1}));return}Ke(Jr=>({...Jr,status:"disconnected",error:Qr,errorStatus:$d(vr,Jr.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!g){I.current=void 0,Ke(cr=>({...cr,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}fs+=1;const Is=ye.current,Wr=Ave(fs,Is.reconnectDelayMs,Is.maxReconnectDelayMs);Ke(cr=>({...cr,status:"disconnected",error:`Reconnecting in ${Wr}ms`})),await jve(Wr,Ye.signal)}})(),()=>{const Vt=I.current;Yt=!0,Ye.abort(),Fr(),Re.current=()=>!1,ue("idle"),Eo(Z);const Dt=(Vt==null?void 0:Vt.sessionId)===pe.current,Kn=!et.current;ce.current&&(!Dt||Kn)&&(clearTimeout(ce.current.timeout),ce.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),ce.current=void 0),(!Dt||Kn)&&(Vt!=null&&Vt.clientId)&&IF({baseUrl:_,token:C,sessionId:Vt.sessionId,clientId:Vt.clientId}).catch(Vn=>console.warn("[DaemonSessionProvider] detach failed:",Vn)),(!Dt||Kn)&&(I.current=void 0)}},[p,g,_,C,r,Oe,Mt,l,c,G,Ee,ut,Ze,Nt,Je,de,i,B,Wn,Ge,un]),h.useEffect(()=>{if(!ee.current||ve.status!=="connected"||v<=0||x<=0||!ve.sessionId)return;oe.current.sessionId!==ve.sessionId&&(oe.current={sessionId:ve.sessionId,consecutiveFailures:0});const He=oe.current;let Ye=!1;const Yt=setInterval(()=>{const Cn=I.current;Cn&&Cn.heartbeat().then(()=>{Ye||(He.consecutiveFailures>=x&&Ke(Tn=>Tn.sessionId===Cn.sessionId?{...Tn,status:"connected",error:void 0,errorStatus:void 0}:Tn),He.consecutiveFailures=0,He.lastHttpError=void 0)}).catch(Tn=>{var zr,Ns,kr,si,Fr;if(Ye)return;He.consecutiveFailures+=1;const At=Tn instanceof Error?Tn.message:"Session heartbeat failed",Xn=mT(Tn);if(Xn!==void 0){const Vn=(zr=He.lastHttpError)==null?void 0:zr.status;He.lastHttpError={status:$d(Xn,Vn)??Xn,message:Dx(Vn)?((Ns=He.lastHttpError)==null?void 0:Ns.message)??At:At}}if(He.consecutiveFailures<x)return;const _e=(kr=He.lastHttpError)==null?void 0:kr.status,Vt=((si=He.lastHttpError)==null?void 0:si.message)??At,Dt=_e!==void 0&&G9.has(_e),Kn=Dx(_e);if(Dt||Kn){const Vn=Cn.sessionId;console.warn(Kn?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",Vn,_e);const ds=W.current.get(Vn);ds==null||ds.controller.abort(),W.current.delete(Vn),Eo(Z),ue("idle"),((Fr=I.current)==null?void 0:Fr.sessionId)===Vn&&(Kn&&(we.current=!0),I.current=void 0)}Ke(Vn=>Vn.sessionId===Cn.sessionId?{...Vn,status:Dt?"error":"disconnected",error:Vt,errorStatus:$d(_e,Vn.errorStatus),missingSession:Kn,...Dt||Kn?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:Vn)})},v);return()=>{Ye=!0,clearInterval(Yt)}},[ve.sessionId,ve.status,x,v]);const bt=h.useMemo(()=>Dve({store:G,sessionRef:I,activePromptsRef:W,settledPromptsRef:K,pendingSessionLoadRef:ce,pendingSessionLoadIdRef:ie,heartbeatSupportedRef:ee,manualSessionClearRef:we,skipNextCleanupDetachSessionIdRef:pe,passiveAssistantDoneTimerRef:Z,hasSessionActivePrompt:()=>Re.current(),resetCurrentSessionActivePrompt:()=>{Re.current=()=>!1},restartEventStream:He=>{if(!b)return;const Ye=F.current;(Ye==null?void 0:Ye.sessionId)===He&&(Ye.restartRequested=!0,Ye.controller.abort())},getCreateSessionRequest:()=>{var He;return{...$t.current,sessionScope:"thread",workspaceCwd:z.current??((He=I.current)==null?void 0:He.workspaceCwd)}},createDetachedSession:(He,Ye)=>{var Yt;const Cn=E.current??new AN({baseUrl:_,token:C}),Tn={...$t.current,sessionScope:"thread",workspaceCwd:He??z.current??((Yt=I.current)==null?void 0:Yt.workspaceCwd),...(Ye==null?void 0:Ye.approvalMode)!==void 0?{approvalMode:Ye.approvalMode}:{},...(Ye==null?void 0:Ye.sourceType)!==void 0?{sourceType:Ye.sourceType}:{},...(Ye==null?void 0:Ye.worktree)!==void 0?{worktree:Ye.worktree}:{},...(Ye==null?void 0:Ye.branch)!==void 0?{branch:Ye.branch}:{}},zr=i?We.current:qE(void 0);return _w.createOrAttach(Cn,Tn,zr)},getConnection:()=>le.current,addNotice:Ge,setConnection:Ke,setPromptStatus:ue,setRestoreSessionId:tt,setRestoreWorkspaceCwd:Ct,setRestoreMode:Et,setRestoreSessionNonce:gt,setAttachSessionNonce:Ae,setNewSessionNonce:nt}),[Ge,i,_,C,b,G]),rn=h.useCallback(async()=>{const He=Y.current,Ye=I.current;if(!He.hasMore||He.loading||He.paginationError||!Ye||Ye.sessionId!==He.sessionId)return;He.loading=!0,P({hasMore:!0,loading:!0,capacityReached:!1,paginationError:!1});let Yt=!1;try{const Cn=await Ye.client.getSessionTranscriptPage(Ye.sessionId,{...He.cursor!==void 0?{cursor:He.cursor}:He.beforeRecordId!==void 0?{beforeRecordId:He.beforeRecordId}:{},limit:ae.current??100,clientId:Ye.clientId});if(I.current!==Ye||Y.current!==He)return;if(Cn.partial||Cn.replayError)throw Yt=!0,new Error(Cn.replayError??"Earlier session history was only partially read");const Tn={...X.current,suppressOwnUserEcho:!1},zr=Cn.events.map(WE).find(si=>si!==void 0),Ns=[];for(const si of Cn.events)try{const Fr=KE(si,GE(si,Ye.clientId,Tn,Ke,{updateConnection:!1}),Ge,un);Ns.push(...me.current==="summary"?VE(Fr):Fr)}catch(Fr){const At=Fr instanceof Error?Fr.message:String(Fr);Ge({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed history event",debugMessage:At,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed history event:",Fr)}if(Ns.length>0&&!cwe(G,Ns,c)){He.hasMore=!1,He.loading=!1,He.capacityReached=!0,P({hasMore:!1,loading:!1,capacityReached:!0,paginationError:!1});return}const kr=G.getSnapshot().blocks.length<c;He.capacityReached=Cn.hasMore&&!kr,He.cursor=zr===void 0?Cn.nextCursor:void 0,He.beforeRecordId=zr,He.hasMore=Cn.hasMore&&kr,He.loading=!1,P({hasMore:He.hasMore,loading:!1,capacityReached:He.capacityReached,paginationError:!1})}catch(Cn){if(I.current!==Ye||Y.current!==He)return;const Tn=!Yt&&(!(Cn instanceof Zc)||Cn.status>=500||Cn.status===408||Cn.status===429);throw He.hasMore=Tn,He.loading=!1,He.capacityReached=!1,He.paginationError=!Tn,P({hasMore:Tn,loading:!1,capacityReached:!1,paginationError:!Tn}),Tn&&Ge({severity:"warning",category:"user_action",operation:"load_session",code:"daemon.transcript_history.failed",message:"Failed to load earlier session history",debugMessage:Cn instanceof Error?Cn.message:String(Cn),recoverable:Tn}),Cn}},[Ge,un,c,G]),qn=h.useMemo(()=>{var He;const Ye=ve.sessionId===Y.current.sessionId&&((He=I.current)==null?void 0:He.sessionId)===Y.current.sessionId;return{hasMore:Ye&&U.hasMore,loading:Ye&&U.loading,capacityReached:Ye&&U.capacityReached,paginationError:Ye&&U.paginationError,loadMore:rn}},[ve.sessionId,rn,U]),ft=h.useRef(mwe);return h.useEffect(()=>{if(ft.current===s)return;ft.current=s;const He=le.current.sessionId;if(s===He)return;const Ye=s?bt.loadSession(s):He?bt.clearSession():void 0;Ye&&Ye.catch(Yt=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",Yt)})},[bt,s]),a.jsx(tee.Provider,{value:G,children:a.jsx(nee.Provider,{value:ve,children:a.jsx(see.Provider,{value:St,children:a.jsx(iee.Provider,{value:Me,children:a.jsx(oee.Provider,{value:yt,children:a.jsx(V9.Provider,{value:bt,children:a.jsx(ree.Provider,{value:qn,children:S})})})})})})})}function $F(e,t,n,r,s,i,o,l={}){var c;if(r.type!=="turn_complete"&&r.type!=="turn_error")return!1;const u=(c=r.data)==null?void 0:c.promptId;if(!u)return!1;const d=e.get(n);if(!d||l.requireBoundPromptId&&d.promptId===void 0||d.promptId!==void 0&&d.promptId!==u)return!1;Eo(o);try{const f=D9(r,u);if(!f)return!1;s.dispatch(Bm(r,f.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(f)):(e.delete(n),t.set(PN(n,u),{status:"resolved",result:f}))}catch(f){s.dispatch(Bm(r,"error")),i("idle"),d.reject?(e.delete(n),d.reject(f)):(e.delete(n),t.set(PN(n,u),{status:"rejected",error:f}))}return!0}function pwe(e){return e.type==="turn_complete"}function GE(e,t,n,r,s={}){gwe(e),s.updateConnection!==!1&&kve(e,r);const i=Bbe(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=kwe(e);return pwe(e)?o?[o]:[]:o?[...i,o]:i}function gwe(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",bwe(e))}function bwe(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!Io(e.data))return t.payload="non-object",t;const n=ywe(e.data.env),r=Lx(e.data.changedKeys),s=Lx(e.data.sessionsRefreshed),i=Lx(e.data.sessionsSkipped),o=e.data.childReloaded,l=$u(e.data,"childError");return n&&(t.env=n),r&&(t.changedKeys=r),typeof o=="boolean"&&(t.childReloaded=o),s&&(t.sessionsRefreshed=s),i&&(t.sessionsSkipped=i),l&&(t.childError=l),t}function ywe(e){if(Io(e))return{updatedKeys:Lx(e.updatedKeys)??[],removedKeys:Lx(e.removedKeys)??[]}}function Lx(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function KE(e,t,n,r,s={}){if(s.hideHistoryTruncation&&eee(e))return[];if(e.type==="session_snapshot"&&Io(e.data)&&e.data.recordingDegraded===!1){const o=$u(e.data,"sessionId");o&&r(`daemon.session_recording_degraded:${o}`)}const i=[];for(const o of t){if(o.type!=="error"){i.push(o);continue}if(e.type==="turn_error"){i.push(o);continue}const l=n(vwe(e,o));(l.category==="protocol"||l.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",l)}return i}function vwe(e,t){const n={message:t.text,debugMessage:t.text,recoverable:t.recoverable};switch(e.type){case"session_recording_degraded":case"session_snapshot":{const r=Io(e.data)?$u(e.data,"sessionId"):void 0;return{...n,...r?{id:`daemon.session_recording_degraded:${r}`}:{},severity:"warning",category:"system",operation:"record_session",code:"daemon.session_recording_degraded"}}case"model_switch_failed":return{...n,severity:"error",category:"user_action",operation:"switch_model",code:"daemon.switch_model.failed"};case"session_died":return{...n,severity:"error",category:"connection",operation:"stream",code:t.errorKind??"daemon.session_died"};case"client_evicted":return{...n,severity:"warning",category:"connection",operation:"stream",code:"daemon.client_evicted"};case"stream_error":return{...n,severity:"warning",category:"connection",operation:"stream",code:t.errorKind??"daemon.stream_error"};default:return{...n,severity:"warning",category:"protocol",operation:"normalize_event",code:t.code??"daemon.protocol.error"}}}function av(){const e=h.useContext(tee);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function K9(){const e=h.useContext(ree);if(!e)throw new Error("useDaemonTranscriptHistory must be used within DaemonSessionProvider");return e}function Y9(){const e=av(),t=h.useCallback(()=>e.getSnapshot().blocks,[e]);return h.useSyncExternalStore(e.subscribe,t,t)}function c5(){const e=av(),t=aee(),n=h.useCallback(()=>Wve(e.getSnapshot().blocks,t),[t,e]);return h.useSyncExternalStore(e.subscribe,n,n)}function nm(){const e=h.useContext(V9);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function wwe(){return h.useContext(V9)}function Nh(){return h.useContext(oee)}function aee(){const e=h.useContext(see);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function qa(){const e=h.useContext(nee);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function xwe(){const e=h.useContext(iee);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function YE(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function kwe(e){if(e.type!=="session_update")return null;const t=Io(e.data)?e.data:void 0,n=Io(t==null?void 0:t.update)?t.update:Io(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const r=n._meta;if(!Io(r))return null;const s=_we(r.goalStatus);if(s)return BF(e,s);const i=Swe(r.goalTerminal);if(i)return BF(e,i);const o=r.stopHookLoop;if(!Io(o))return null;const l=o.goal;return!Io(l)||!$u(l,"condition"),null}function BF(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function _we(e){if(!Io(e))return null;const t=$u(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=$u(e,"condition");if(!n)return null;const r=Px(e,"iterations"),s=Px(e,"durationMs"),i=Px(e,"setAt"),o=$u(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i!==void 0?{setAt:i}:{},...o?{lastReason:o}:{}}}function Swe(e){if(!Io(e))return null;const t=$u(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=$u(e,"condition");if(!n)return null;const r=Px(e,"iterations"),s=Px(e,"durationMs"),i=$u(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i?{lastReason:i}:{}}}function $u(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Px(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function zF(e,t){let n=0,r=0,s=0,i=0,o=0,l=0,c=0,u,d=0,f=0;for(const m of e)switch(m.type){case"workspace.memory.changed":n+=1;break;case"workspace.agent.changed":r+=1;break;case"workspace.tool.toggled":s+=1;break;case"workspace.settings.changed":i+=1;break;case"workspace.mcp.budget_warning":case"workspace.mcp.child_refused":case"workspace.mcp.server_restarted":case"workspace.mcp.server_restart_refused":case"workspace.mcp.server_changed":o+=1;break;case"workspace.extensions.changed":l+=1,u={...m.status?{status:m.status}:{},...m.source?{source:m.source}:{},...m.name?{name:m.name}:{},...m.version?{version:m.version}:{},...m.error?{error:m.error}:{},refreshed:m.refreshed,failed:m.failed};break;case"session.artifact.changed":c+=1;break;case"workspace.initialized":d+=1;break;case"auth.device_flow.started":case"auth.device_flow.throttled":case"auth.device_flow.authorized":case"auth.device_flow.failed":case"auth.device_flow.cancelled":f+=1;break}n+r+s+i+o+l+c+d+f!==0&&t(m=>({memoryVersion:m.memoryVersion+n,agentsVersion:m.agentsVersion+r,toolsVersion:m.toolsVersion+s,settingsVersion:m.settingsVersion+i,mcpVersion:m.mcpVersion+o,extensionsVersion:m.extensionsVersion+l,artifactsVersion:m.artifactsVersion+c,...u?{lastExtensionChange:u}:{},initVersion:m.initVersion+d,authVersion:m.authVersion+f}))}function Cwe(e){const t=mT(e);return t!==void 0&&dwe.has(t)}function Twe(e){const t=mT(e);return t!==void 0&&G9.has(t)}function mT(e){if(e instanceof Zc||Io(e)&&typeof e.status=="number")return e.status}function Io(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function _d(e,t){const{autoLoad:n=!1,enabled:r=!0}=t,[s,i]=h.useState({data:void 0,loading:!1,error:void 0}),o=h.useRef(0),l=h.useCallback(async()=>{if(!r)return;const c=++o.current;i(u=>({...u,loading:!0,error:void 0}));try{const u=await e();return c!==o.current?void 0:(i({data:u,loading:!1,error:void 0}),u)}catch(u){if(c!==o.current)return;const d=u instanceof Error?u:new Error(String(u));i(f=>({...f,loading:!1,error:d}));return}},[r,e]);return h.useEffect(()=>{!n||!r||l()},[n,r,l]),{...s,reload:l}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function lv(e,t,n){const r=h.useRef(!1);h.useEffect(()=>{if(!(e===void 0||!n)){if(!r.current){r.current=!0;return}t()}},[n,t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function lee(e={}){var t;const n=ga(),r=h.useCallback(()=>n.listAgents(),[n]),s=_d(r,e),i=Nh();return lv(i==null?void 0:i.agentsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,agents:((t=s.data)==null?void 0:t.agents)??[],getAgent:n.getAgent,createAgent:n.createAgent,generateAgent:n.generateAgent,generateContent:n.generateContent,deleteAgent:n.deleteAgent,updateAgent:n.updateAgent}}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Ewe(e={}){var t;const{actions:n,workspaceCwd:r}=yo(),s=e.enabled!==!1&&r!==void 0,i=h.useCallback(async()=>{if(!r)throw new Error("Channel management requires a workspace.");return{...await n.loadChannels(),workspaceCwd:r}},[n,r]),o=_d(i,{...e,autoLoad:!1,enabled:s}),l=o.reload,c=h.useRef(!1),u=h.useRef(r),d=h.useCallback(async()=>(c.current=!0,l()),[l]),f=h.useRef(d);f.current=d,h.useEffect(()=>{const k=u.current!==r;!s||e.autoLoad!==!0&&!(k&&c.current)||(u.current=r,d())},[s,e.autoLoad,d,r]);const m=h.useCallback(async k=>{const S=await k();return await f.current(),S},[]),p=h.useCallback((k,S)=>m(()=>n.upsertChannel(k,S)),[n,m]),g=h.useCallback((k,S)=>m(()=>n.removeChannel(k,S)),[n,m]),b=h.useCallback((k,S)=>m(()=>n.setChannelStartup(k,S)),[n,m]),w=h.useCallback(k=>m(()=>n.startChannel(k)),[n,m]),y=h.useCallback(k=>m(()=>n.stopChannel(k)),[n,m]),v=h.useCallback(k=>m(()=>n.restartChannel(k)),[n,m]),x=((t=o.data)==null?void 0:t.workspaceCwd)===r?o.data:void 0;return{data:x?{catalog:x.catalog,snapshot:x.snapshot}:void 0,loading:o.loading,error:o.error,reload:d,catalog:(x==null?void 0:x.catalog)??[],snapshot:x==null?void 0:x.snapshot,channels:(x==null?void 0:x.snapshot.instances)??{},createOrUpdate:p,remove:g,setStartup:b,start:w,stop:y,restart:v,pairing:n.channelPairing}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function X9(e={}){const t=ga(),n=h.useCallback(()=>t.loadMcpStatus(),[t]),r=_d(n,e),s=Nh();return lv(s==null?void 0:s.mcpVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,initialize:t.initializeMcp,reloadConfig:t.reloadMcp,loadTools:t.loadMcpTools,loadResources:t.loadMcpResources,restartServer:t.restartMcpServer,manageServer:t.manageMcpServer,addServer:t.addRuntimeMcpServer,removeServer:t.removeRuntimeMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Awe(e={}){var t;const n=ga(),r=h.useCallback(()=>n.loadMemoryStatus(),[n]),s=_d(r,e),i=Nh();return lv(i==null?void 0:i.memoryVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,files:((t=s.data)==null?void 0:t.files)??[],readFile:n.readWorkspaceFile,writeMemory:n.writeMemory}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function JC(e={}){const{pageSize:t,cursor:n,archiveState:r,view:s,group:i,sourceType:o,...l}=e,c=yo(),u=wwe(),d=h.useCallback(()=>{const T={...t!==void 0?{pageSize:t}:{},...n!==void 0?{cursor:n}:{},...r!==void 0?{archiveState:r}:{},...s!==void 0?{view:s}:{},...i!==void 0?{group:i}:{},...o!==void 0?{sourceType:o}:{}};return c.actions.listSessionsPage(T)},[r,n,i,t,o,s,c.actions]),f=!!c.workspaceCwd,m=_d(d,{...l,enabled:(l.enabled??!0)&&f}),p=m.reload,g=h.useCallback(async()=>{const T=await p();return T==null?void 0:T.sessions},[p]),b=m.data,w=(b==null?void 0:b.sessions)??[],y=h.useCallback(async T=>{const _=await c.actions.deleteSession(T);return _&&g(),_},[c.actions,g]),v=h.useCallback(async T=>{const _=await c.actions.deleteSessions(T);return(_.removed.length>0||_.notFound.length>0)&&g(),_},[c.actions,g]),x=h.useCallback((T,_="html")=>c.actions.exportSession(T,_),[c.actions]),k=h.useCallback(async T=>{const _=await c.actions.archiveSession(T);return _&&g(),_},[c.actions,g]),S=h.useCallback(async T=>{const _=await c.actions.unarchiveSession(T);return _&&g(),_},[c.actions,g]);return{...m,data:b!==void 0?w:void 0,reload:g,sessions:w,nextCursor:b==null?void 0:b.nextCursor,liveMergeFailed:(b==null?void 0:b.liveMergeFailed)===!0,truncated:(b==null?void 0:b.truncated)===!0,loadSession:u==null?void 0:u.loadSession,resumeSession:u==null?void 0:u.resumeSession,newSession:u==null?void 0:u.newSession,releaseSession:u==null?void 0:u.releaseSession,deleteSession:y,deleteSessions:v,exportSession:x,archiveSession:k,unarchiveSession:S}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function jwe(e={}){var t;const n=ga(),r=h.useCallback(()=>n.loadSkillsStatus(),[n]),s=_d(r,e);return{...s,status:s.data,skills:((t=s.data)==null?void 0:t.skills)??[],setEnabled:n.setWorkspaceSkillEnabled,install:n.installWorkspaceSkill,remove:n.deleteWorkspaceSkill}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function FN(e={}){const{detail:t="summary",...n}=e,r=ga(),s=h.useCallback(()=>r.loadDaemonStatus(t),[r,t]),i=_d(s,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Nwe(e={}){const{range:t,heatmapDays:n,...r}=e,s=ga(),i=h.useCallback(()=>s.loadUsageDashboard({range:t,heatmapDays:n}),[s,t,n]),o=_d(i,r);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function cee(e={}){var t;const n=ga(),r=h.useCallback(()=>n.loadToolsStatus(),[n]),s=_d(r,e),i=Nh();return lv(i==null?void 0:i.toolsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,tools:((t=s.data)==null?void 0:t.tools)??[],preheat:n.preheatAcp,setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Q9(e={}){var t;const n=ga(),r=h.useCallback(()=>n.loadSettingsStatus(),[n]),s=_d(r,e),i=Nh();return lv(i==null?void 0:i.settingsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,settings:((t=s.data)==null?void 0:t.settings)??[],setValue:n.setWorkspaceSetting}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Iwe(e={}){var t,n;const r=ga(),s=h.useCallback(()=>r.loadProviders(),[r]),i=_d(s,e),o=Nh();return lv(o==null?void 0:o.settingsVersion,i.reload,e.autoLoad===!0||i.data!==void 0),{...i,status:i.data,providers:((t=i.data)==null?void 0:t.providers)??[],current:(n=i.data)==null?void 0:n.current}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Mwe=300,Rwe=100,pb=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function XE(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function Dwe(e){const{enabled:t=!0,onStateChange:n,getOnAccept:r,getOnOutcome:s}=e;let i=pb,o=null,l=!1,c=null;function u(w){i=w,n(w)}function d(){o&&(clearTimeout(o),o=null),c&&(clearTimeout(c),c=null)}return{setSuggestion:w=>{if(o&&(clearTimeout(o),o=null),!w){u(pb);return}t&&(o=setTimeout(()=>{u({suggestion:w,isVisible:!0,shownAt:Date.now()})},Mwe))},accept:(w,y)=>{var v;if(l)return;o&&(clearTimeout(o),o=null),l=!0;const x=i.suggestion,{shownAt:k}=i;if(!x){l=!1;return}try{(v=s())==null||v({outcome:"accepted",accept_method:w,time_ms:k>0?Date.now()-k:0,suggestion_length:x.length})}catch(S){console.error("[followup] onOutcome callback threw:",S)}u(pb),queueMicrotask(()=>{var S;try{y!=null&&y.skipOnAccept||(S=r())==null||S(x)}catch(T){console.error("[followup] onAccept callback threw:",T)}finally{c&&clearTimeout(c),c=setTimeout(()=>{l=!1},Rwe)}})},dismiss:()=>{var w;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(w=s())==null||w({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(y){console.error("[followup] onOutcome callback threw:",y)}u(pb)}},clear:()=>{d(),l=!1,u(pb)},cleanup:()=>{d(),l=!1}}}function uee(e={}){const{enabled:t=!0,onAccept:n,onOutcome:r}=e,s=av(),i=qa().sessionId,[o,l]=h.useState(pb),c=h.useRef(n);c.current=n;const u=h.useRef(r);u.current=r;const d=h.useSyncExternalStore(s.subscribe,()=>s.getSnapshot().lastFollowupSuggestion,()=>s.getSnapshot().lastFollowupSuggestion),f=h.useSyncExternalStore(Vve,DF,DF),m=(f==null?void 0:f.sessionId)===i?f:d,p=h.useMemo(()=>Dwe({enabled:t,onStateChange:l,getOnAccept:()=>c.current,getOnOutcome:()=>u.current}),[t]),{setSuggestion:g}=p;h.useEffect(()=>(t||p.clear(),()=>p.cleanup()),[p,t]);const b=h.useRef(void 0),w=h.useRef(i);h.useEffect(()=>{const k=w.current;w.current=i,k!==void 0&&i!==void 0&&k!==i&&(p.clear(),l2(),b.current=void 0)},[p,i]),h.useEffect(()=>{const k=m==null?void 0:m.promptId;k!==b.current&&(b.current=k,g((m==null?void 0:m.suggestion)??null))},[m,g]);const y=h.useCallback(()=>{p.clear(),XE(s),l2(),b.current=void 0},[p,s]),v=h.useCallback((k,S)=>{p.accept(k,S),XE(s),l2(),b.current=void 0},[p,s]),x=h.useCallback(()=>{p.dismiss(),XE(s),l2(),b.current=void 0},[p,s]);return h.useMemo(()=>({followupState:o,onAcceptFollowup:v,onDismissFollowup:x,clear:y}),[o,v,x,y])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Lwe(){const e=h.useSyncExternalStore(Yve,LF,LF),t=h.useCallback(n=>Qve(n),[]);return{batches:e,consume:t}}const FF=[];function Pwe(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,r)=>!Object.is(n,t[r]))}class Uf extends h.Component{constructor(){super(...arguments);Ue(this,"state",{error:null,resetKeys:this.props.resetKeys??FF});Ue(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){const s=n.resetKeys??FF;return Pwe(r.resetKeys,s)?{error:null,resetKeys:s}:null}componentDidCatch(n,r){console.error(`[web-shell] ${this.props.label??"render"} failed:`,n,r.componentStack)}render(){const{error:n}=this.state;if(n===null)return this.props.children;const{fallback:r}=this.props;return typeof r=="function"?r(n,this.reset):r}}const qF={en:{title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again"},"zh-CN":{title:"出了点问题",body:"发生意外错误，无法显示此内容。",retry:"重试"}},Owe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},$we={margin:0,fontSize:"1rem",fontWeight:600},Bwe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},zwe={appearance:"none",cursor:"pointer",padding:"0.4rem 1rem",fontSize:"0.85rem",borderRadius:"6px",border:"1px solid rgba(128, 128, 128, 0.4)",background:"transparent",color:"inherit"};function Fwe({error:e,onRetry:t,language:n="en"}){const r=qF[n]??qF.en;return a.jsxs("div",{role:"alert",style:Owe,"data-web-shell-error":!0,children:[a.jsx("p",{style:$we,children:r.title}),a.jsx("p",{style:Bwe,children:r.body}),!1,a.jsx("button",{type:"button",style:zwe,onClick:t,children:r.retry})]})}/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dee=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qwe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hwe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HF=e=>{const t=Hwe(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var QE={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"};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Uwe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Wwe=h.createContext({}),Vwe=()=>h.useContext(Wwe),Gwe=h.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>{const{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:m="currentColor",className:p=""}=Vwe()??{},g=r??f?Number(n??d)*24/Number(t??u):n??d;return h.createElement("svg",{ref:c,...QE,width:t??u??QE.width,height:t??u??QE.height,stroke:e??m,strokeWidth:g,className:dee("lucide",p,s),...!i&&!Uwe(l)&&{"aria-hidden":"true"},...l},[...o.map(([b,w])=>h.createElement(b,w)),...Array.isArray(i)?i:[i]])});/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const It=(e,t)=>{const n=h.forwardRef(({className:r,...s},i)=>h.createElement(Gwe,{ref:i,iconNode:t,className:dee(`lucide-${qwe(HF(e))}`,`lucide-${e}`,r),...s}));return n.displayName=HF(e),n};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kwe=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ywe=It("activity",Kwe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xwe=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],Qwe=It("archive-restore",Xwe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jwe=[["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"}]],c2=It("archive",Jwe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zwe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],exe=It("arrow-down-to-line",Zwe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const txe=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]],nxe=It("arrow-down-up",txe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rxe=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],sxe=It("arrow-down",rxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ixe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],v_=It("arrow-left",ixe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oxe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],axe=It("arrow-up-from-line",oxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lxe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],cxe=It("arrow-up",lxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uxe=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],dxe=It("blocks",uxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hxe=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],fxe=It("bolt",hxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mxe=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Xb=It("bot",mxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pxe=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],gxe=It("box",pxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bxe=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],yxe=It("calendar-clock",bxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vxe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],kh=It("check",vxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wxe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Oc=It("chevron-down",wxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xxe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Eu=It("chevron-right",xxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kxe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],_xe=It("chevron-up",kxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Oa=It("circle-alert",Sxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],u5=It("circle-check",Cxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Txe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],hee=It("circle-dot",Txe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Exe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Axe=It("circle-minus",Exe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Nxe=It("circle-plus",jxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ixe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],Mxe=It("circle-stop",Ixe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],fee=It("circle-x",Rxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Lxe=It("clock",Dxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pxe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Oxe=It("columns-2",Pxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $xe=[["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"}]],Bxe=It("command",$xe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zxe=[["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"}]],J9=It("copy",zxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fxe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],qN=It("database",Fxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qxe=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ZC=It("download",qxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hxe=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],tp=It("ellipsis-vertical",Hxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Uxe=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Wxe=It("ellipsis",Uxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vxe=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Gxe=It("eye",Vxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kxe=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Yxe=It("file-code-corner",Kxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xxe=[["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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],mee=It("file-diff",Xxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qxe=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],Jxe=It("file-headphone",Qxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zxe=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],eke=It("file-image",Zxe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tke=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],nke=It("file-play",tke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rke=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],pee=It("file-text",rke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ske=[["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"}]],ike=It("file",ske);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oke=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],ake=It("flask-conical",oke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lke=[["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"}],["path",{d:"M2 10h20",key:"1ir3d8"}]],bk=It("folder-closed",lke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cke=[["path",{d:"M2 9V5a2 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 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],uke=It("folder-input",cke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dke=[["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"}]],gee=It("folder-open",dke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hke=[["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"}]],fke=It("folder-plus",hke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mke=[["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"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]],pke=It("folder-x",mke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gke=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],bke=It("funnel",gke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yke=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],ky=It("git-branch",yke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vke=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],wke=It("git-commit-horizontal",vke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xke=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],pT=It("git-fork",xke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kke=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M18 6V5",key:"1oao2s"}],["path",{d:"M18 11v-1",key:"11c8tz"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],_ke=It("git-pull-request-draft",kke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ske=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],Cke=It("git-pull-request",Ske);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tke=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Eke=It("grip-vertical",Tke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ake=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],d5=It("info",Ake);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jke=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],UF=It("key-round",jke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nke=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ike=It("layers",Nke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mke=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Rke=It("layout-grid",Mke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dke=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],Lke=It("layout-list",Dke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pke=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Oke=It("link",Pke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $ke=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ag=It("loader-circle",$ke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bke=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],zke=It("lock",Bke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fke=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],bee=It("maximize-2",Fke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qke=[["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:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],u2=It("message-circle-plus",qke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hke=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],yee=It("minimize-2",Hke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Uke=[["path",{d:"M5 12h14",key:"1ays0h"}]],Wke=It("minus",Uke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vke=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Gke=It("moon",Vke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kke=[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]],Yke=It("notebook-tabs",Kke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xke=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],WF=It("package",Xke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qke=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Jke=It("palette",Qke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zke=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],e_e=It("panel-left-close",Zke);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const t_e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],n_e=It("panel-left-open",t_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const r_e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],vee=It("panel-right",r_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s_e=[["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"}]],_y=It("pencil",s_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i_e=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],VF=It("pin",i_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const o_e=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],a_e=It("play",o_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const l_e=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Wf=It("plus",l_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const c_e=[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]],wee=It("radio-tower",c_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const u_e=[["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"}]],$g=It("refresh-cw",u_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const d_e=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],h_e=It("rotate-cw",d_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const f_e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],tu=It("search",f_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const m_e=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Qb=It("server",m_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const p_e=[["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"}]],xee=It("settings-2",p_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const g_e=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],b_e=It("settings",g_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const y_e=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],GF=It("shield-check",y_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const v_e=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],w_e=It("shield",v_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const x_e=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],k_e=It("sliders-horizontal",x_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const __e=[["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"}]],Jb=It("sparkles",__e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S_e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]],kee=It("square-activity",S_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const C_e=[["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"}]],KF=It("square-pen",C_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const T_e=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],_ee=It("square-terminal",T_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E_e=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],A_e=It("star",E_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const j_e=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],N_e=It("sun",j_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const I_e=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],YF=It("tag",I_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const M_e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],R_e=It("target",M_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const D_e=[["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"}]],kf=It("trash-2",D_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const L_e=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],P_e=It("triangle-alert",L_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const O_e=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],$_e=It("upload",O_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const B_e=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],z_e=It("users-round",B_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const F_e=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],XF=It("wifi-off",F_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const q_e=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],HN=It("wrench",q_e);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const H_e=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],cv=It("x",H_e);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const nh=1e3,Z9="session_organization",See="session_transcript_pagination",Cee="session_monitor_tool_correlation",U_e="session_side_task",rh="default",W_e="side_task",eD=100,V_e=500,tD=5e4;function UN(e){for(const t of e){if(!G_e(t))continue;const n=t;if(n.resolved)continue;const r=Rb(n.toolCall),s=typeof(r==null?void 0:r.toolCallId)=="string"?r.toolCallId:typeof(r==null?void 0:r.id)=="string"?r.id:void 0,i=typeof(r==null?void 0:r.kind)=="string"?r.kind:void 0,o=Rb(r==null?void 0:r._meta),l=typeof(o==null?void 0:o.toolName)=="string"?o.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:s,title:n.title,toolKind:i,toolName:l,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(c=>({id:c.optionId,label:c.label,kind:Y_e(c.raw)})),rawInput:K_e(n.toolCall)}}return null}function G_e(e){return e.kind==="permission"}function K_e(e){const t=Rb(e);return t?Rb(t.rawInput)??Rb(t.input)??Rb(t.args)??t:void 0}function Rb(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Y_e(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.kind;return t==="allow_once"||t==="allow_always"||t==="reject_once"||t==="reject_always"?t:void 0}function X_e(e,t,n){const r=new Array(e);return new Proxy(r,{get(s,i,o){if(typeof i=="string"){const l=i.charCodeAt(0);if(l>=48&&l<=57){const c=+i;if(Number.isInteger(c)&&c>=0&&c<e){let u=s[c];if(!u){const d=t[c*2];u=s[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(s,i,o)}})}function V1(e,t,n){let r=n.initialDeps??[],s,i=!0;function o(){const l=e();return(l.length!==r.length||l.some((u,d)=>r[d]!==u))&&(r=l,s=t(...l),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(s),i=!1),s}return o.updateDeps=l=>{r=l},o}function QF(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Q_e=(e,t)=>Math.abs(e-t)<1.01,J_e=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};let Ew;const JE=()=>{if(Ew!==void 0)return Ew;if(typeof navigator>"u")return Ew=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ew=!0;const e=navigator.maxTouchPoints;return Ew=navigator.platform==="MacIntel"&&e!==void 0&&e>0},JF=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Z_e=e=>e,eSe=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,s=new Array(r);for(let i=0;i<r;i++)s[i]=t+i;return s},tSe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=o=>{const{width:l,height:c}=o;t({width:Math.round(l),height:Math.round(c)})};if(s(JF(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const l=()=>{const c=o[0];if(c!=null&&c.borderBoxSize){const u=c.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(JF(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},gT={passive:!0},nSe=typeof window>"u"?!0:"onscrollend"in window,rSe=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&nSe;let o=0;const l=i?null:J_e(s,()=>t(o,!1),e.options.isScrollingResetDelay),c=f=>()=>{o=n(r),l==null||l(),t(o,f)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,gT),i&&r.addEventListener("scrollend",d,gT),()=>{r.removeEventListener("scroll",u),i&&r.removeEventListener("scrollend",d)}},sSe=(e,t)=>rSe(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),iSe=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),s=n.options.getItemKey(r);return n.itemSizeCache.get(s)??n.options.estimateSize(r)}if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),s=n.options.getItemKey(r),i=n.itemSizeCache.get(s);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},oSe=(e,{adjustments:t=0,behavior:n},r)=>{var s,i;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},aSe=oSe;class lSe{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,s;return((s=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const o=()=>{const l=i.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{var r,s;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Z_e,rangeExtractor:eSe,onChange:()=>{},measureElement:iSe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const m in n){const p=n[m];p!==void 0&&(i[m]=p)}const o=this.options;let l=null,c=null,u=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=o.count,p=i.count,g=this.getMeasurements(),b=m>0?((r=g[0])==null?void 0:r.key)??o.getItemKey(0):null,w=m>0?((s=g[m-1])==null?void 0:s.key)??o.getItemKey(m-1):null;if(p!==m||m>0&&p>0&&(i.getItemKey(0)!==b||i.getItemKey(p-1)!==w)){u=!0;const x=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;x&&(l=[x.key,this.getScrollOffset()-x.start]);const k=i.followOnAppend===!0?"auto":i.followOnAppend||null;k&&p>m&&this.isAtEnd(o.scrollEndThreshold)&&(m===0||i.getItemKey(p-1)!==w)&&(c=k)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,f=0;if(l&&this.scrollOffset!==null){const[m,p]=l,g=this.getMeasurements(),{count:b,getItemKey:w}=this.options;let y=0;for(;y<b&&w(y)!==m;)y++;if(y<b){const v=g[y];if(v){const x=v.start+p;x!==this.scrollOffset&&(f=x-this.scrollOffset,this.scrollOffset=x,d=!0)}}}(d||c)&&(this.pendingScrollAnchor=[d?l[0]:null,d?l[1]:0,c,f])},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=V1(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!JE()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,gT),i.addEventListener("touchend",l,gT),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[i,o,l,c]=s;i!==null&&!l&&(JE()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?c!==0&&(this._iosDeferredAdjustment+=c):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let o=r-1;o>=0;o--){const l=n[o];if(s.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.end<c.end&&s.set(l.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,l)=>o.end===l.end?o.index-l.index:o.end-l.end)[0]:void 0},this.getMeasurementOptions=V1(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,s,i,o,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=V1(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const g of this.laneAssignments.keys())g>=n&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const g=this.options.gap,b=n*2;let w=this._flatMeasurements;if(!w||w.length<b){const x=new Float64Array(b);w&&f>0&&x.set(w.subarray(0,f*2)),w=x,this._flatMeasurements=w}let y;if(f===0)y=r+s;else{const x=f-1;y=w[x*2]+w[x*2+1]+g}for(let x=f;x<n;x++){const k=i(x),S=d.get(k),T=typeof S=="number"?S:this.options.estimateSize(x);w[x*2]=y,w[x*2+1]=T,y+=T+g}const v=X_e(n,w,i);return this.measurementsCache=v,v}const m=this.measurementsCache.slice(0,f),p=new Array(l).fill(void 0);for(let g=0;g<f;g++){const b=m[g];b&&(p[b.lane]=g)}for(let g=f;g<n;g++){const b=i(g),w=this.laneAssignments.get(g);let y,v;const x=c==="estimate"||d.has(b);if(w!==void 0&&this.options.lanes>1){y=w;const _=p[y],C=_!==void 0?m[_]:void 0;v=C?C.end+this.options.gap:r+s}else{const _=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);v=_?_.end+this.options.gap:r+s,y=_?_.lane:g%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(g,y)}const k=d.get(b),S=typeof k=="number"?k:this.options.estimateSize(g),T=v+S;m[g]={index:g,start:v,size:S,end:T,key:b,lane:y},p[y]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=V1(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?cSe({measurements:n,outerSize:r,scrollOffset:s,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=V1(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,s-i),l=Math.min(this.options.count-1,s+i);return n>=o&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,l)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(l))});return}const r=this.indexFromElement(n),s=this.options.getItemKey(r),i=this.elementsCache.get(s);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(s,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var s,i;if(n<0||n>=this.options.count)return;let o,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],o=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;c=m.key,l=m.start,o=m.size}const d=this.itemSizeCache.get(c)??o,f=r-d;if(f!==0){const m=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=m?this.getTotalSize():0,g=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:o,end:l+o,lane:0},f,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-p):g&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=V1(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,o=n.length;i<o;i++){const l=n[i],c=r[l];s.push(c)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const s=this._flatMeasurements,i=this.options.lanes===1&&s!=null,o=Tee(0,r.length-1,i?l=>s[l*2]:l=>QF(r[l]).start,n);return QF(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:s="auto"}={})=>{const i=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:s="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);if(!i)return;const[o,l]=i,c=this.now();this.scrollState={index:n,align:l,behavior:s,startedAt:c,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,o=this._flatMeasurements;o!=null?s=o[i*2]+o[i*2+1]:s=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&i.some(l=>l===null);){const l=r[o];i[l.lane]===null&&(i[l.lane]=l.end),o--}s=Math.max(...i.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const s of r)s&&this.itemSizeCache.has(s.key)&&n.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(JE()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,i=1,o=s!==this.scrollState.lastTargetOffset;if(!o&&Q_e(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const l=this.getSize()||600,c=Math.abs(s-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=s,u||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Tee=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,i=n(s);if(i<r)e=s+1;else if(i>r)t=s-1;else return s}return e>0?e-1:0};function cSe({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:s}){const i=e.length-1,o=s?d=>s[d*2]:d=>e[d].start,l=s?d=>s[d*2]+s[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:i};let c=Tee(0,i,o,n),u=c;if(r===1)for(;u<i&&l(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<i&&d.some(m=>m<n+t);){const m=e[u];d[m.lane]=m.end,u++}const f=Array(r).fill(n+t);for(;c>=0&&f.some(m=>m>=n);){const m=e[c];f[m.lane]=m.start,c--}c=Math.max(0,c-c%r),u=Math.min(i,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const ZE=typeof document<"u"?h.useLayoutEffect:h.useEffect;function uSe({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const s=h.useReducer(u=>u+1,0)[1],i=h.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=u=>{const d=i.current;if(!d.enabled)return;const f=u.getTotalSize();if(d.container&&f!==d.lastSize){d.lastSize=f;const y=u.options.horizontal?"width":"height";d.container.style[y]=`${f}px`}const m=!!u.options.horizontal,p=d.mode==="transform",g=m?"left":"top",b=u.options.scrollMargin,w=u.getVirtualItems();for(const y of w){const v=y.start-b,x=u.elementsCache.get(y.key);x&&d.lastPositions.get(x)!==v&&(d.lastPositions.set(x,v),p?x.style.transform=m?`translate3d(${v}px, 0, 0)`:`translate3d(0, ${v}px, 0)`:x.style[g]=`${v}px`)}},l={...r,onChange:(u,d)=>{var f;const m=i.current;let p=!0;if(m.enabled){o(u);const g=u.range,b=m.prevRange;p=!b||b.isScrolling!==u.isScrolling||b.startIndex!==(g==null?void 0:g.startIndex)||b.endIndex!==(g==null?void 0:g.endIndex),p&&(m.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:u.isScrolling}:null)}p&&(e&&d?xd.flushSync(s):s()),(f=r.onChange)==null||f.call(r,u,d)}},[c]=h.useState(()=>{const u=new lSe(l);return Object.assign(u,{containerRef:d=>{const f=i.current;if(f.container=d,f.lastSize=null,d&&f.enabled){const m=u.getTotalSize();f.lastSize=m;const p=u.options.horizontal?"width":"height";d.style[p]=`${m}px`}}})});return c.setOptions(l),ZE(()=>c._didMount(),[]),ZE(()=>c._willUpdate()),ZE(()=>{o(c)}),c}function dSe(e){return uSe({observeElementRect:tSe,observeElementOffset:sSe,scrollToFn:aSe,...e})}function Eee(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function hSe(e){var t;return((t=Eee(e))==null?void 0:t.type)==="task_execution"}function uv(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||hSe(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function bd(e){if(!uv(e))return!1;const t=Eee(e.rawOutput),n=e.toolName.toLowerCase(),r=e.args,s=n==="agent"&&e.parentToolCallId===void 0,i=s&&(r==null?void 0:r.run_in_background)===void 0&&(r==null?void 0:r.working_dir)===void 0&&(r==null?void 0:r.name)===void 0&&(typeof(r==null?void 0:r.subagent_type)!="string"||r.subagent_type.toLowerCase()!=="fork"),o=(r==null?void 0:r.run_in_background)===!0&&(n!=="agent"||s);return(t==null?void 0:t.status)==="background"||o||i}const Aee=h.createContext({}),ZF=Aee.Provider;function Vu(){return h.useContext(Aee)}const fSe=["en","zh-CN"],nD={"git.currentBranch":e=>`Current Git branch: ${(e==null?void 0:e.branch)??""}`,"git.detached":"Detached HEAD","git.clean":"Working tree clean","git.operation.merge":"Merging","git.operation.rebase":"Rebasing","git.operation.cherry-pick":"Cherry-picking","git.operation.revert":"Reverting","git.operation.bisect":"Bisecting","git.conflicted":e=>`${(e==null?void 0:e.count)??0} conflicted`,"git.staged":e=>`${(e==null?void 0:e.count)??0} staged`,"git.unstaged":e=>`${(e==null?void 0:e.count)??0} modified`,"git.untracked":e=>`${(e==null?void 0:e.count)??0} untracked`,"git.ahead":e=>`${(e==null?void 0:e.count)??0} ahead`,"git.behind":e=>`${(e==null?void 0:e.count)??0} behind`,"git.stash":e=>`${(e==null?void 0:e.count)??0} stashed`,"branchPicker.label":"Git","branchPicker.search":"Search for branches and actions","branchPicker.loading":"Loading branches…","branchPicker.noBranches":"No branches","branchPicker.noTags":"No tags","branchPicker.action.pull":"Update Project","branchPicker.action.push":"Push","branchPicker.action.commit":"Commit","branchPicker.action.newBranch":"New Branch…","branchPicker.action.checkoutRef":"Checkout Tag or Revision…","branchPicker.action.viewChanges":"View Changes","branchPicker.newBranchPlaceholder":"Branch name","branchPicker.invalidBranchName":"Invalid branch name — avoid spaces, ~, ^, :, ? * and leading -","branchPicker.checkoutRefPlaceholder":"Tag name or commit SHA","branchPicker.section.recent":"Recent","branchPicker.section.local":"Local","branchPicker.section.remote":"Remote","branchPicker.section.tags":"Tags","branchPicker.checkedOut":e=>`Checked out ${(e==null?void 0:e.branch)??""}`,"branchPicker.createdBranch":e=>`Created branch ${(e==null?void 0:e.branch)??""}`,"branchPicker.pushSuccess":"Pushed successfully","branchPicker.pullSuccess":"Updated successfully","gitCommit.title":"Commit","gitCommit.messagePlaceholder":"Commit message (⌘/Ctrl+Enter to commit)","gitCommit.generating":"Generating commit message…","gitCommit.genFailed":"Auto-generation failed — write your message","gitCommit.prLogUnavailable":"Could not load commits for the selected base branch.","gitCommit.prPushFirst":"Push your branch to a remote before creating a pull request.","gitCommit.commit":"Commit","gitCommit.commitAndPush":"Commit and Push","gitCommit.createPr":"Create Pull Request","gitCommit.prTitlePlaceholder":"Pull request title","gitCommit.prBodyPlaceholder":"Description (optional)","gitCommit.prEdit":"Edit","gitCommit.prPreview":"Preview","gitCommit.prSubmit":"Create","gitCommit.prCreated":e=>`Pull Request #${(e==null?void 0:e.number)??""} created`,"gitCommit.commitSuccess":e=>`Committed ${(e==null?void 0:e.sha)??""}`,"gitCommit.commitPushSuccess":e=>`Committed & pushed ${(e==null?void 0:e.sha)??""}`,"gitCommit.commitSuccessPushFailed":e=>`Committed ${(e==null?void 0:e.sha)??""} — push failed: ${(e==null?void 0:e.error)??"unknown"}`,"branchSelect.baseBranch":"Base branch","branchSelect.search":"Search branches…","branchSelect.loading":"Loading…","branchSelect.noMatches":"No matches","branchSelect.error":"Failed to load branches","branchSelect.retry":"Retry","branchSelect.local":"local","gitDiff.title":"Changes","gitDiff.summary":e=>`${(e==null?void 0:e.count)??0} files · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitDiff.loading":"Loading changes…","gitDiff.empty":"No changes in the working tree","gitDiff.unavailable":"Git is not available for this workspace","gitDiff.error":"Failed to load changes","gitDiff.binary":"Binary","gitDiff.untracked":"Untracked","gitDiff.deleted":"Deleted","gitDiff.noDiff":"No changes to display","gitDiff.fileError":"Failed to load this diff","gitDiff.truncated":"Diff truncated — the file is too large to show in full","gitDiff.hidden":e=>`${(e==null?void 0:e.count)??0} more file(s) not shown`,"gitDiff.expand":e=>`Show changes for ${(e==null?void 0:e.path)??"file"}`,"gitDiff.collapse":e=>`Hide changes for ${(e==null?void 0:e.path)??"file"}`,"gitMode.title":"Git mode","gitMode.current":"Current branch","gitMode.currentDesc":e=>`Develop directly on ${(e==null?void 0:e.branch)??"main"}`,"gitMode.branch":"New branch","gitMode.branchDesc":e=>`Create a new branch from ${(e==null?void 0:e.branch)??"main"}`,"gitMode.branchPlaceholder":"feat/my-feature","gitMode.branchLabel":"Branch name","gitMode.branchConflictWarning":"Only one branch session per workspace at a time","gitMode.branchHint":"Switches the working directory to a new branch","gitMode.branchInvalidName":"Invalid branch name","gitMode.worktree":"Worktree","gitMode.worktreeDesc":"Isolated copy · can run in parallel","gitMode.confirmBranch":"Create branch","gitMode.confirmWorktree":"Create worktree","gitMode.resetToCurrent":"Reset to current branch","gitLog.title":"History","gitLog.subtitle":e=>`${(e==null?void 0:e.count)??0} commits`,"gitLog.loading":"Loading history…","gitLog.empty":"No commits yet","gitLog.unavailable":"Git is not available for this workspace","gitLog.error":"Failed to load history","gitLog.loadMore":"Load more","gitLog.loadingMore":"Loading…","gitLog.files":e=>`${(e==null?void 0:e.count)??0} files · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitLog.detailError":"Failed to load commit details","gitLog.hidden":e=>`${(e==null?void 0:e.count)??0} more file(s) not shown`,"gitLog.copySha":e=>`Copy commit ${(e==null?void 0:e.sha)??""}`,"githubPrs.title":"Pull requests","githubPrs.subtitle":e=>`${(e==null?void 0:e.count)??0} open`,"githubPrs.loading":"Loading pull requests…","githubPrs.empty":"No open pull requests","githubPrs.unavailable":"This workspace is not a git repository","githubPrs.error":"Failed to load pull requests","githubPrs.cliUnavailable":"The GitHub CLI (gh) is not installed on the daemon host.\nInstall it and run `gh auth login`, then try again.","githubPrs.reviewApproved":"Approved","githubPrs.reviewChanges":"Changes requested","githubPrs.reviewRequired":"Review required","githubPrs.checksPassing":"Checks passing","githubPrs.checksFailing":"Checks failing","githubPrs.checksPending":"Checks pending","githubPrs.open":e=>`Open pull request #${(e==null?void 0:e.number)??""} on GitHub`,"workspace.paneLabel":e=>`Workspace: ${(e==null?void 0:e.name)??""}`,"about.auth":"Auth","about.baseUrl":"Base URL","about.fastModel":"Fast Model","about.memoryUsage":"Memory Usage","about.model":"Model","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"OS","about.proxy":"Proxy","about.qwenCode":"Qwen Code","about.runtime":"Runtime","about.sandbox":"Sandbox","about.sessionId":"Session ID","about.title":"Status","agent.back":"Back","agent.builtInBadge":"(built-in)","agent.action.delete":"Delete Agent","agent.action.edit":"Edit Agent","agent.action.view":"View Agent","agent.chooseAction":e=>`Choose action for ${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"Choose Action","agent.colorLabel":"Color: ","agent.colorUpdated":e=>`Updated color for ${(e==null?void 0:e.name)??""}`,"agent.create":"Create a new subagent","agent.create.button":"Create Agent","agent.create.confirm":"Confirm and Save","agent.create.desc":"Create a new subagent","agent.create.descPlaceholder":"What does this agent do?","agent.create.describeAgent":"Describe requirements","agent.create.description":"Description","agent.create.editAgain":"Edit","agent.create.enterDescription":"Enter Description","agent.create.enterName":"Enter Subagent Name","agent.create.enterPrompt":"Enter System Prompt","agent.create.generateFailed":e=>`Failed to generate subagent: ${(e==null?void 0:e.error)??"Unknown error"}`,"agent.create.generate":"Generate","agent.create.generatedDescription":"Description","agent.create.generatedSystemPrompt":"System prompt","agent.create.generatingConfig":"Generating subagent configuration...","agent.create.generatingPrompt":"Generating...","agent.create.loading":"Creating...","agent.create.location":"Choose Location","agent.create.method":"Choose Generation Method","agent.create.method.manual":"Manual Creation","agent.create.method.qwen":"Generate with Qwen Code","agent.create.method.qwen.recommended":"Generate with Qwen Code (Recommended)","agent.create.method.qwen.desc":"LLM generates the description and system prompt","agent.create.name":"Name","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"Enter a clear, unique name for this subagent.","agent.create.project":"Project","agent.create.project.cli":"Workspace","agent.create.project.desc":"Create a project-level subagent","agent.create.prompt":"System prompt","agent.create.promptPlaceholder":"You are a specialized agent that...","agent.create.promptPlaceholder.cli":"e.g., You are an expert code reviewer...","agent.create.promptHelp":"Write the system prompt that defines this subagent's behavior. Be comprehensive for best results.","agent.create.preview":"Preview","agent.create.qwenHint":"Explain the responsibilities, usage scenarios, and important constraints, then generate each field separately.","agent.create.qwenPlaceholder":"> e.g., Expert code reviewer that reviews code based on best practices...","agent.create.regenerate":"Regenerate draft","agent.create.required":"Name, description, and system prompt are required.","agent.create.tools":"Allowed tools","agent.create.toolsHelp":"Enter canonical tool names separated by commas or lines. MCP tools use mcp__server__tool; leave blank to inherit all tools.","agent.create.disallowedTools":"Disallowed tools","agent.create.model":"Model","agent.create.approvalMode":"Approval mode","agent.create.maxTurns":"Maximum execution turns","agent.create.maxTurnsHelp":"Limits the model reasoning rounds for a single task. Execution stops at the limit; leave blank for no agent-specific limit.","agent.create.maxTurnsInvalid":"Maximum execution turns must be a positive integer.","agent.create.mcpServers":"MCP servers","agent.create.mcpServers.empty":"No MCP servers are available.","agent.create.mcpServers.select":"Select an MCP Server","agent.create.mcpServers.noneSelected":"No MCP Servers selected.","agent.create.modelGenerate":"Generate with model","agent.create.modelGenerate.description":"Describe what you need, then generate and review the description and system prompt separately.","agent.create.color":"Color","agent.create.jsonObjectHelp":"Enter a JSON object, or leave blank.","agent.create.save":"Save Agent","agent.create.scope":"Category","agent.create.manualDescHelp":"Describe when and how this subagent should be used.","agent.create.manualDescPlaceholder":"e.g., Reviews code for best practices and potential bugs.","agent.create.tools.builtin":"Built-in tools","agent.create.tools.empty":"No tools are available.","agent.create.tools.mcp":"MCP tools","agent.create.tools.type":"Tool type","agent.create.tools.selectServer":"Select an MCP Server","agent.create.tools.selectTool":"Select a tool","agent.create.tools.noneSelected":"No tools selected.","agent.create.tools.initializing":"Initializing tool catalogs...","agent.create.tools.preheatFailed":"ACP preheating did not complete.","agent.create.tools.loadFailed":"Failed to load built-in tools.","agent.create.removeSelection":e=>`Remove ${(e==null?void 0:e.name)??""}`,"agent.create.toolsSelectHelp":"Select the tools this subagent may use. Leave all unchecked to inherit all tools.","agent.create.toolsSelection":"Select Tools","agent.create.tools.all":"All Tools","agent.create.tools.allDefault":"All Tools (Default)","agent.create.tools.allInfo":"All tools selected, including MCP tools","agent.create.tools.allInfoFallback":"All tools selected, including MCP tools","agent.create.tools.editLabel":"• Edit tools:","agent.create.tools.executionLabel":"• Execution tools:","agent.create.tools.none":"(none)","agent.create.tools.readEdit":"Read & Edit Tools","agent.create.tools.readEditExecute":"Read & Edit & Execution Tools","agent.create.tools.readOnlyLabel":"• Read-only tools:","agent.create.tools.readOnly":"Read-only Tools","agent.create.tools.selected":"Selected tools:","agent.create.user":"User","agent.create.user.cli":"Global","agent.create.user.desc":"Create a user-level subagent","agent.create.useGenerated":"Use this draft","agent.approval.inherit":"Default","agent.approval.default":"Default approval","agent.approval.plan":"Plan only","agent.approval.auto-edit":"Automatically approve edits","agent.approval.yolo":"Automatically approve all actions","agent.approval.bubble":"Bubble approval","agent.approval.desc.inherit":"Use the subagent's default approval rules.","agent.approval.desc.bubble":"Forward tool approval requests to the parent session.","agent.createFirstHint":"Use '/agents create' to create your first subagent.","agent.created":e=>`Created ${(e==null?void 0:e.name)??""}`,"agent.edit.save":"Save changes","agent.updated":e=>`Updated ${(e==null?void 0:e.name)??""}`,"agent.turnsBadge":e=>`${(e==null?void 0:e.count)??0} turns`,"agent.delete":"Delete","agent.delete.confirm":e=>`Are you sure you want to delete "${(e==null?void 0:e.name)??""}"?`,"agent.delete.loading":"Deleting...","agent.delete.no":"No","agent.delete.title":e=>`Delete ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"Yes, delete","agent.deleted":e=>`Deleted ${(e==null?void 0:e.name)??""}`,"agent.edit":"Edit","agent.edit.color":"Edit Color","agent.edit.tools":"Edit Tools","agent.editColorTitle":e=>`Edit Color: ${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`Edit ${(e==null?void 0:e.name)??""}`,"agent.empty":"No subagents found.","agent.noMatches":"No matching subagents found.","agent.footer.back":"Esc to go back","agent.footer.cliBack":"Enter to select, ↑↓ to navigate, Esc to go back","agent.footer.cliSelect":"Enter to select, ↑↓ to navigate, Esc to close","agent.footer.close":"Esc to close","agent.footer.deleteConfirm":"Enter to confirm, Esc to cancel","agent.footer.enterNext":"Press Enter to continue, Esc to go back","agent.footer.generating":"Esc to cancel","agent.footer.createLocation":"Press Enter to continue, ↑↓ to navigate, Esc to cancel","agent.footer.createContinue":"Press Enter to continue, ↑↓ to navigate, Esc to go back","agent.footer.final":"Press Enter to save, e to save and edit, Esc to go back","agent.footer.nav":"↑↓ navigate · Enter select · Esc back","agent.footer.navBack":"↑↓ navigate · Enter select · Esc back","agent.footer.navSelect":"↑↓ navigate · Enter select · Esc close","agent.footer.viewerBack":"Esc to go back","agent.filePathLabel":"File Path: ","agent.label":"Agent","agent.location":"Location","agent.level.builtin":"Built-in","agent.level.extension":"Extension","agent.level.project":"Project","agent.level.user":"User","agent.level.filter":"Filter by agent level","agent.manage":"Manage","agent.manage.desc":"Manage existing subagents","agent.modelLabel":"Model: ","agent.overriddenBadge":"(overridden by project level agent)","agent.readonly":"This agent is read-only.","agent.select":"Select an agent.","agent.selectAction":"Select an action","agent.descriptionLabel":"Description:","agent.systemPromptLabel":"System Prompt:","agent.level.label":"Level","agent.step":e=>`Step ${(e==null?void 0:e.n)??""}`,"agent.tools":"Tools","agent.toolsLabel":"Tools: ","agent.detail.overview":"Basic Information","agent.detail.tools":"Tools","agent.detail.mcp":"MCP","agent.detail.hooks":"Hooks","agent.detail.systemPrompt":"System Prompt","agent.toolsUpdated":e=>`Updated tools for ${(e==null?void 0:e.name)??""}`,"agent.usingCount":e=>`Using: ${(e==null?void 0:e.count)??0} agents`,"agent.view":"View","agents.closed":"Agents panel closed.","agents.title":"Agents","subagent.result":"Result","subagent.tools":e=>`Tools (${(e==null?void 0:e.count)??0})`,"subagent.toolsCount":e=>`${(e==null?void 0:e.count)??0} tools`,"subagent.toggleStream":"Toggle agent stream details","subagent.pending":"pending","subagent.running":"running","subagent.background":"background task","subagent.completed":"completed","subagent.failed":"failed","subagent.cancelled":"cancelled","subagent.paused":"paused","subagent.detailsLoading":"Loading agent details…","subagent.detailsLoadFailed":"Failed to load agent details.","timeline.parallelAgents":"Parallel agents","timeline.thinking":"Thinking","timeline.assistantUpdate":"Assistant update","timeline.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool call${(e==null?void 0:e.count)===1?"":"s"}`,"timeline.planUpdate":"Plan update","timeline.statusUpdate":"Status update","timeline.userTurn":"User turn","timeline.planDetail":"plan update","timeline.parallelAgentsDetail":e=>`${(e==null?void 0:e.count)??0} parallel agent${(e==null?void 0:e.count)===1?"":"s"}`,"timeline.noActivity":"No activity","timeline.sessionTimeline":"Session timeline","timeline.turnPrefix":e=>`Turn ${(e==null?void 0:e.index)??0}`,"timeline.currentTurn":"Current turn","timeline.kind.thought":"thinking","timeline.kind.commentary":"assistant update","timeline.kind.tool":"tool calls","timeline.kind.agents":"parallel agents","timeline.kind.plan":"plan update","timeline.kind.status":"status update","timeline.kind.none":"turn","common.copy":"Copy","common.open":"Open","common.na":"N/A","common.server":"Server","common.agent":"Agent","common.auto":"auto","common.runtime":"Runtime","common.failedToLoad":"Failed to load","auth.notSet":"(not set)","auth.apiKeyPlaceholder":"sk-...","auth.modelsPlaceholder":"model-id-1, model-id-2","model.usingModel":e=>`Using ${e!=null&&e.isRuntime?"runtime ":""}model: ${(e==null?void 0:e.modelId)??""}`,"mermaid.label":"mermaid","mermaid.errorLabel":"mermaid (error)","user.uploadedImage":e=>`User uploaded image ${(e==null?void 0:e.index)??1}`,"voice.noSpeech":"No speech detected.","voice.stopDictation":"Stop dictation","voice.transcribing":"Transcribing…","voice.starting":"Starting…","voice.errorRetry":e=>`Voice error — click to retry${e!=null&&e.message?`: ${e.message}`:""}`,"voice.noSpeechRetry":"No speech detected — click to retry","voice.startDictation":"Start voice dictation","voice.error":"Voice error","resume.failedToLoad":"Failed to load sessions","toast.dismiss":"Dismiss notification","toast.dismissShort":"Dismiss","insight.ready":"Insight report generated successfully!","request.cancelled":"Request cancelled.","approval.execQuestion":e=>`Allow execution of: '${(e==null?void 0:e.tool)??""}'?`,"approval.changeQuestion":"Apply this change?","approval.launchAgentQuestion":"Launch this agent?","approval.option.allowOnce":"Yes, allow once","approval.option.allowOnceAndSwitchToDefault":"Allow once and switch to Default mode","approval.option.rejectOnce":"Reject","approval.option.allowAllEdits":"Allow All Edits","approval.option.allowAlwaysProject":"Always allow in this project","approval.option.allowAlwaysUser":"Always allow for this user","approval.option.allowAlwaysServer":"Always allow for this server","approval.option.allowAlwaysTool":"Always allow for this tool","assistant.branch":"Branch","assistant.copy":"Copy","at.category.extensions":"Extensions","at.category.extensions.description":"Reference active extensions","at.category.files":"Files","at.category.files.description":"Reference workspace files","at.category.mcpResources":"MCP resources","at.category.mcpResources.description":"Reference MCP server resources","at.menu":"Reference menu","common.back":"back","common.all":"All","common.add":"add","common.cancel":"cancel","common.close":"close","common.fullscreen":"Fullscreen","common.exitFullscreen":"Exit fullscreen","common.continue":"continue","common.current":"current","common.disabled":"disabled","common.enabled":"enabled","common.enterSelect":"Enter to select","common.invalid":"invalid","common.loading":"Loading...","common.retry":"Try again","common.save":"save","common.navigate":"↑↓ to navigate","common.next":"next","common.noResults":"No results","common.previous":"previous","common.expand":"Expand","common.collapse":"Collapse","common.refresh":"refresh","common.search":"Search","common.valid":"valid","common.clients":e=>`${(e==null?void 0:e.count)??0} clients`,"agent.count":e=>`${(e==null?void 0:e.count)??0} agents`,"askUser.submit":"Submit","askUser.submitting":"Submitting...","askUser.submitFailed":"Failed to submit answer","askUser.submitOptionUnavailable":"Submit option is unavailable","askUser.ignore":"Ignore","askUser.multiHint":"multiple choice","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} questions`,"askUser.selectAnswer":"Select an answer","askUser.typePlaceholder":"Type something...","copy.failedFallback":"Failed to copy to the clipboard","copy.inlineLatexMissing":"No matching inline LaTeX expression found in the last AI output.","copy.latexMissing":"No matching LaTeX block found in the last AI output.","copy.noOutput":"No output in history","copy.noText":"Last AI output contains no text to copy.","copy.codeMissing":"No matching code block found in the last AI output.","copy.outputCopied":"Last output copied to the clipboard","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"Selection"} copied to the clipboard`,"code.copy":"Copy","code.copied":"Copied!","echartsChart.noData":"No data","echartsChart.tableNotice":e=>{const t=Number((e==null?void 0:e.omittedRows)??0),n=Number((e==null?void 0:e.omittedColumns)??0);return t>0&&n>0?`Showing ${(e==null?void 0:e.visibleRows)??0} of ${(e==null?void 0:e.totalRows)??0} rows and ${(e==null?void 0:e.visibleColumns)??0} of ${(e==null?void 0:e.totalColumns)??0} columns`:n>0?`Showing ${(e==null?void 0:e.visibleColumns)??0} of ${(e==null?void 0:e.totalColumns)??0} columns`:`Showing ${(e==null?void 0:e.visibleRows)??0} of ${(e==null?void 0:e.totalRows)??0} rows`},"echartsChart.rendering":"Rendering chart","echartsChart.renderFailed":"Chart render failed.","echartsChart.viewMode":"View mode","echartsChart.showChart":"Show chart","echartsChart.showData":"Show data","echartsChart.chart":"Chart","echartsChart.data":"Data","markdownTable.blank":"(blank)","markdownTable.column":e=>`Column ${(e==null?void 0:e.index)??""}`,"markdownTable.rows":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} row${t===1?"":"s"}`},"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} rows`,"markdownTable.hint":"Click headers to sort, open filters from ▾.","markdownTable.filtersActive":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} filter${t===1?"":"s"}`},"markdownTable.selection.selected":"Selected","markdownTable.selection.nonEmpty":"Non-empty","markdownTable.selection.numeric":"Numeric","markdownTable.selection.sum":"Sum","markdownTable.selection.average":"Average","markdownTable.selection.min":"Min","markdownTable.selection.max":"Max","markdownTable.copyTsv":"Copy TSV","markdownTable.copyTsvHint":"Copy as TSV for pasting into spreadsheet apps","markdownTable.copyVisible":"Copy table","markdownTable.customColumns":"Custom columns","markdownTable.customColumns.tableSection":"Columns shown in the table","markdownTable.customColumns.detailSection":"Fields shown in expanded rows","markdownTable.customColumns.toggleAllTable":"Toggle all table columns","markdownTable.customColumns.toggleAllDetails":"Toggle all expanded-row fields","markdownTable.customColumns.reset":"Reset","markdownTable.customColumns.noDetails":"No expanded-row fields selected.","markdownTable.freezeFirstColumn":"Freeze first column","markdownTable.unfreezeFirstColumn":"Unfreeze first column","markdownTable.densityLabel":"Table density","markdownTable.densityCurrent":e=>`${(e==null?void 0:e.density)??""} density`.trim(),"markdownTable.density":e=>`Density: ${(e==null?void 0:e.density)??""}`,"markdownTable.density.standard":"Standard","markdownTable.density.compact":"Compact","markdownTable.density.comfortable":"Comfortable","markdownTable.expandLongText":"Expand text","markdownTable.collapseLongText":"Collapse text","markdownTable.emptyValue":"(blank)","markdownTable.hideColumn":"Hide column","markdownTable.showHiddenColumns":e=>{const t=Number((e==null?void 0:e.count)??0);return`Show ${t} hidden column${t===1?"":"s"}`},"markdownTable.moveColumn":e=>`Move ${(e==null?void 0:e.column)??""}`,"markdownTable.resizeColumn":e=>`Resize ${(e==null?void 0:e.column)??""}`,"markdownTable.rowDetails":"Details","markdownTable.rowDetailsAria":e=>`View details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.closeRowDetailsAria":e=>`Hide details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.detailsHeader":"Row details","markdownTable.cellDialogTitle":"Current field value","markdownTable.copyCell":"Copy","markdownTable.close":"Close","markdownTable.actions":"Actions","markdownTable.sortByColumn":e=>`Sort by ${(e==null?void 0:e.column)??""}`,"markdownTable.sortByColumnAsc":e=>`Sort by ${(e==null?void 0:e.column)??""}, ascending`,"markdownTable.sortByColumnDesc":e=>`Sort by ${(e==null?void 0:e.column)??""}, descending`,"markdownTable.filterColumn":e=>`Filter ${(e==null?void 0:e.column)??""}`,"markdownTable.empty":"This table has no data.","markdownTable.emptyFiltered":"No rows match the filters.","markdownTable.sort.asc":"Sort ascending","markdownTable.sort.desc":"Sort descending","markdownTable.sort.clear":"Clear sort","markdownTable.filter.searchPlaceholder":"Search filter values","markdownTable.filter.searchAria":e=>`Search ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.selectVisible":"Select current results","markdownTable.filter.optionLimit":e=>`Showing first ${(e==null?void 0:e.count)??0} items. Search to narrow results.`,"markdownTable.filter.noOptions":"No matches","markdownTable.filter.custom":"Custom filter","markdownTable.filter.numberAria":e=>`Number filter for ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.textAria":e=>`Text filter for ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.numberPlaceholder":"Value","markdownTable.filter.toPlaceholder":"To","markdownTable.filter.textPlaceholder":"Enter filter condition","markdownTable.filter.reset":"Reset","markdownTable.filter.cancel":"Cancel","markdownTable.filter.confirm":"Confirm","markdownTable.filter.text.contains":"Contains","markdownTable.filter.text.equals":"Equals","markdownTable.filter.text.notEquals":"Does not equal","markdownTable.filter.text.startsWith":"Starts with","markdownTable.filter.text.endsWith":"Ends with","markdownTable.filter.number.gt":"Greater than","markdownTable.filter.number.gte":"Greater than or equal to","markdownTable.filter.number.lt":"Less than","markdownTable.filter.number.lte":"Less than or equal to","markdownTable.filter.number.between":"Between","mermaid.rendering":"Rendering diagram...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","mermaid.zoomIn":"+","mermaid.zoomOut":"−","mermaid.zoomReset":"↺","contextUsage.active":"active","contextUsage.autocompactBuffer":"Autocompact buffer","contextUsage.bodyLoaded":"body loaded","contextUsage.builtinTools":"Built-in tools","contextUsage.contextWindow":"Context window","contextUsage.detailHint":"Run /context detail for per-item breakdown.","contextUsage.estimatedOverhead":"Estimated pre-conversation overhead","contextUsage.free":"Free","contextUsage.memoryFiles":"Memory files","contextUsage.messages":"Messages","contextUsage.mcpTools":"MCP tools","contextUsage.model":"Model","contextUsage.noSession":"No active session yet. Send your first message before viewing context usage.","contextUsage.noApiResponse":"No API response yet. Send a message to see actual usage.","contextUsage.overLimit":"Context exceeds limit! Use /compress or /clear to reduce.","contextUsage.skills":"Skills","contextUsage.systemPrompt":"System prompt","contextUsage.title":"Context Usage","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"Usage by category","contextUsage.used":"Used","daemon.title":"Daemon Status","daemon.details.loading":"Loading diagnostics...","daemon.details.failed":"Failed to load diagnostics.","daemon.refresh":"Refresh","daemon.loading":"Loading daemon status...","daemon.loadFailed":"Failed to load daemon status","daemon.updatedAt":e=>`Updated ${(e==null?void 0:e.time)??""}`,"daemon.none":"none","daemon.level.ok":"OK","daemon.level.warning":"Warning","daemon.level.error":"Error","daemon.level.unavailable":"Unavailable","daemon.issues.title":"Issues","daemon.overview.title":"Daemon","daemon.overview.version":"Version","daemon.overview.pid":"PID","daemon.overview.mode":"Mode","daemon.overview.uptime":"Uptime","daemon.overview.workspace":"Workspace","daemon.runtime.title":"Runtime","daemon.runtime.activeSessions":"Active sessions","daemon.runtime.activePrompts":"Active prompts","daemon.runtime.idle":"Idle for","daemon.runtime.noActivity":"no activity yet","daemon.runtime.pendingPermissions":"Pending permissions","daemon.runtime.permissionPolicy":"Permission policy","daemon.runtime.channel":"ACP channel","daemon.runtime.channelLive":"live","daemon.runtime.channelDown":"down","daemon.runtime.startingUp":"Runtime is starting...","daemon.runtime.startFailed":"Runtime failed to start","daemon.runtime.channelWorker":"Channel worker","daemon.runtime.channelWorkerRestarts":"Worker restarts","daemon.runtime.memory":"Memory (RSS / heap)","daemon.transport.title":"Transport","daemon.transport.restSse":"REST SSE streams","daemon.transport.acpDisabled":"ACP transport disabled","daemon.transport.acpConnections":"ACP connections","daemon.transport.acpStreams":"ACP streams (session/SSE/WS)","daemon.transport.pendingRequests":"Pending client requests","daemon.transport.rateLimitRejected":"Rate-limit rejects","daemon.security.title":"Security","daemon.security.token":"Bearer token","daemon.security.requireAuth":"Require auth","daemon.security.loopback":"Loopback bind","daemon.security.allowOrigin":"Allowed origins","daemon.security.shell":"Session shell commands","daemon.security.configured":"configured","daemon.security.notConfigured":"not configured","daemon.limits.title":"Limits","daemon.limits.unlimited":"unlimited","daemon.limits.maxSessions":"Max sessions","daemon.limits.maxPendingPrompts":"Max pending prompts / session","daemon.limits.maxConnections":"Max listener connections","daemon.limits.eventRing":"Event ring size","daemon.limits.promptDeadline":"Prompt deadline","daemon.limits.sessionIdle":"Session idle timeout","daemon.capabilities.title":"Capabilities","daemon.capabilities.titleCount":e=>`Capabilities (${(e==null?void 0:e.count)??0})`,"daemon.full.sessions.title":"Sessions","daemon.full.sessions.empty":"No active sessions","daemon.full.session.pendingPrompts":e=>`${(e==null?void 0:e.count)??0} pending prompts`,"daemon.full.session.pendingPermissions":e=>`${(e==null?void 0:e.count)??0} pending permissions`,"daemon.full.session.prompting":"prompting","daemon.full.workspace.title":"Workspace Diagnostics","daemon.full.workspace.empty":"No workspace diagnostics reported","daemon.full.auth.title":"Auth","daemon.full.auth.providers":"Device-flow providers","daemon.full.auth.pending":"Pending device flows","daemon.full.acp.title":"ACP connections","daemon.tab.overview":"Overview","daemon.tab.usage":"Usage","daemon.tab.metrics":"Metrics","daemon.tab.diagnostics":"Diagnostics","daemon.charts.title":"Metrics","daemon.charts.empty":"Collecting metrics… charts appear after the first sample.","daemon.charts.concurrency":"Concurrency","daemon.charts.activePrompts":"Active tasks","daemon.charts.activeSessions":"Sessions","daemon.charts.requests":"Requests","daemon.charts.reqTotal":"Total","daemon.charts.reqErrors":"Errors","daemon.charts.apiLatency":"API latency","daemon.charts.promptLatency":"Prompt latency","daemon.charts.queueWait":"Queue wait","daemon.charts.promptDuration":"Duration","daemon.charts.eventLoop":"Event-loop lag","daemon.charts.eventLoopLag":"Lag p99","daemon.charts.queuedPrompts":"Queued","daemon.charts.reqRejected":"Rejected","daemon.charts.llmLatency":"LLM API latency","daemon.charts.apiHealth":"Model API health","daemon.charts.apiErrors":"API errors","daemon.charts.apiRetries":"Retries","daemon.charts.cpu":"CPU","daemon.charts.pipe":"IPC pipe","daemon.charts.pipeIn":"In","daemon.charts.pipeOut":"Out","daemon.charts.connections":"Connections","daemon.charts.cpuDaemon":"Daemon","daemon.charts.cpuChild":"Child","daemon.charts.rssDaemon":"Daemon RSS","daemon.charts.rssChild":"Child RSS","daemon.charts.memory":"Memory","daemon.charts.heap":"Heap","daemon.charts.tokens":"Token burn","daemon.charts.tokensIn":"Input","daemon.charts.tokensOut":"Output","daemon.charts.peak":"peak","daemon.charts.concurrency.help":"Live load at each sample: prompts running now, prompts queued (accepted but not yet dispatched), and active sessions. Queued rising above active is backpressure.","daemon.charts.requests.help":"Client↔daemon HTTP traffic per window — NOT model calls. Total requests, those returning 4xx/5xx, and those the rate limiter rejected.","daemon.charts.apiLatency.help":"Client↔daemon HTTP request duration (p50/p95) — how fast the daemon answers, not the model. Compare with LLM API latency to separate 'we are slow' from 'the model is slow'.","daemon.charts.llmLatency.help":"Per-round model API round-trip (daemon→model→daemon), p50/p95. Model-side latency, distinct from the HTTP API latency above.","daemon.charts.apiHealth.help":"Provider-side LLM failures. Each failed attempt = 1 error; each automatic backoff = 1 retry. Transient 429/5xx are usually absorbed by retries (errors ≈ retries); errors climbing above retries means calls are failing outright.","daemon.charts.promptLatency.help":"Per prompt (task): p95 time waiting in the per-session queue before dispatch, and p95 end-to-end run time. Rising queue wait signals backpressure.","daemon.charts.eventLoop.help":"Daemon event-loop lag p99 per window — the CPU-saturation / blocking signal. High lag means the daemon is starved and everything slows.","daemon.charts.cpu.help":"CPU utilization (% of all cores) at each sample: the daemon and the ACP child (where LLM/tool work runs). Child at 0% means no child is running.","daemon.charts.memory.help":"Resident memory at each sample: daemon RSS, daemon V8 heap, and ACP child RSS. Steady growth over time hints at a leak.","daemon.charts.pipe.help":"Bytes over the stdio pipe to/from the ACP child per window. Sustained high volume points to chatty framing between daemon and child.","daemon.charts.connections.help":"Live client transport connections at each sample: REST/SSE streams, ACP WebSocket streams, and ACP connections.","daemon.charts.tokens.help":"Input (prompt) and output (completion) tokens attributed to model turns per window — model spend over time.","daemon.usage.today":"Today","daemon.usage.period7d":"7D","daemon.usage.period30d":"30D","daemon.usage.rangeWeek":"Last 7 days","daemon.usage.rangeMonth":"Last 30 days","daemon.usage.rangeGroup":"Summary period","daemon.usage.tokensConsumed":"tokens consumed","daemon.usage.sessions":"Sessions","daemon.usage.requests":"Requests","daemon.usage.tools":"Tools","daemon.usage.changes":"Changes","daemon.usage.breakdownTitle":"Token Breakdown","daemon.usage.inputTokens":"Input tokens","daemon.usage.inputHint":"request + cache read","daemon.usage.outputTokens":"Output tokens","daemon.usage.outputHint":"response + reasoning","daemon.usage.cacheRead":"Cache read","daemon.usage.cacheHint":"cache read share","daemon.usage.heatmapTitle":"Token Heatmap","daemon.usage.heatmapSub":e=>`recent ${(e==null?void 0:e.months)??12} months · daily aggregated tokens`,"daemon.usage.low":"Low","daemon.usage.high":"High","daemon.usage.dowMon":"Mon","daemon.usage.dowWed":"Wed","daemon.usage.dowFri":"Fri","daemon.usage.empty":"No token usage recorded yet.","daemon.usage.loading":"Loading usage…","daemon.usage.failed":"Failed to load usage","daemon.usage.cellTokens":e=>`${(e==null?void 0:e.date)??""} · Tokens: ${(e==null?void 0:e.tokens)??"0"} · Cache: ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.rangeWordToday":"Today","daemon.usage.rangeWordWeek":"7 days","daemon.usage.rangeWordMonth":"30 days","daemon.usage.modelShareTitle":"model share","daemon.usage.modelShareSub":"token share · light green shows cache read","daemon.usage.modelMeta":e=>`${(e==null?void 0:e.tokens)??"0"} tokens · cache ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.skillTitle":"skill calls","daemon.usage.skillSub":"skill name / count","daemon.usage.skillName":"Skill name","daemon.usage.skillCount":"Count","daemon.usage.dailyTokensTitle":"tokens","daemon.usage.dailyTokensSub":"daily token totals","daemon.usage.dailySessionsTitle":"sessions","daemon.usage.dailySessionsSub":"active session counts per day","delete.cannotCurrent":"Cannot delete the current active session.","delete.action":"Delete","delete.deleted":"Session deleted.","delete.deletedCount":e=>`${(e==null?void 0:e.count)??0} session(s) deleted.`,"delete.deleting":"Deleting...","delete.failed":e=>`Failed to delete session.${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ navigate · Space select · Enter delete · Esc cancel","delete.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"delete.none":"No sessions to delete","delete.allFailed":e=>`Failed to delete ${(e==null?void 0:e.count)??0} session(s): ${(e==null?void 0:e.reason)??"unknown error"}`,"delete.nonRemoved":"No sessions were deleted.","delete.notFound":"Session not found — it may have been deleted already.","delete.partialFail":e=>`${(e==null?void 0:e.removed)??0} deleted, ${(e==null?void 0:e.failed)??0} failed: ${(e==null?void 0:e.detail)??"unknown error"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"delete.pressSearch":"Press / to search; Space to select; Enter to delete","delete.selected":e=>`${(e==null?void 0:e.count)??0} selected`,"delete.title":"Delete Session","time.justNow":"just now","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} min ago`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0}h ago`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0}d ago`,"dialog.footer.close":"Esc to close","dialog.footer.confirmCancel":"Enter to confirm · Esc to cancel","release.cannotCurrent":"Cannot release the current active session.","release.action":"Release","release.released":"Session released successfully.","release.failed":e=>`Failed to release session.${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ to navigate · Enter to release · Esc to cancel","release.inactive":"Only active live sessions can be released.","release.inactiveBadge":"inactive","release.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"release.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"release.none":"No live sessions to release","release.pressSearch":"Press / to search; Enter releases the selected live session","release.releasing":"Releasing...","release.title":"Release Session","dialog.footer.menu":"Esc to menu","dialog.footer.mcpServers":"↑↓ to navigate · Enter details · r refresh · Esc close","dialog.footer.mcpSelect":"↑↓ to navigate · Enter select · Esc back","dialog.footer.modelFast":"↑↓ to navigate · / to search · c for custom · Enter to set fast model · Esc to cancel","dialog.footer.navSelectCancel":"↑↓ to navigate · Enter to select · Esc to cancel","dialog.footer.navSelectClose":"↑↓ to navigate · Enter to select · Esc to close","dialog.footer.navSelectMenu":"↑↓ to navigate · Enter to select · Esc to menu","dialog.footer.navOpenClose":"↑↓ to navigate · Enter to open · Esc to close","dialog.footer.navOpenMenu":"↑↓ to navigate · Enter to open · Esc to menu","dialog.footer.back":"Esc to go back","dialog.footer.backClose":"Esc to close","dialog.footer.saveClose":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to close","dialog.footer.saveMenu":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to menu","dialog.footer.search":"Type to search · Enter to commit · Esc to clear","dialog.footer.select":"Enter to select","editor.escClearHint":"Press Esc again to clear","editor.hintCommands":"commands","editor.hintFiles":"Files","editor.hintNext":"next","editor.hintPrev":"previous","editor.hintSearch":"search","editor.noHistory":"No matching history","editor.placeholder":"Type a message or @ file path","history.loadingEarlier":"Loading earlier messages…","history.capacityReached":"History display limit reached. Earlier messages remain saved.","history.paginationError":"Earlier history could not be loaded.","editor.shellPlaceholder":"Enter terminal command","editor.send":"Send message","editor.connectionDisconnected":"Connection interrupted. Please try again after it reconnects.","editor.sessionLoading":"Session is still loading. Try again in a moment.","editor.processing":"Processing. New messages will be queued.","editor.searchHint":"ctrl+r next · tab accept · enter send · esc cancel","editor.searchLabel":"reverse-i-search:","editor.searchPlaceholder":"type to search...","editor.newSessionSuggestionTitle":"This looks like a new topic","editor.newSessionSuggestionStart":"Send in new session","editor.btwSuggestionTitle":"This looks like a side question","editor.btwSuggestionSend":"Ask with BTW","quickActions.open":"more actions","quickActions.title":"more actions","quickActions.mcp":"MCP","quickActions.context":"Context","quickActions.status":"Status","quickActions.stats":"Session","quickActions.memory":"Memory","quickActions.extensions":"Extensions","quickActions.skills":"Skills","quickActions.tools":"Tools","quickActions.agents":"Agents","quickActions.help":"Help","quickActions.theme":"Set theme","quickActions.auth":"Auth","quickActions.settings":"Settings","quickActions.new":"New session","quickActions.resume":"Switch session","quickActions.delete":"Delete session","quickActions.branch":"Copy session","quickActions.rewind":"Rewind session","quickActions.historyQuestion":"Question history","quickActions.recap":"Generate recap","quickActions.copy":"Copy output","quickActions.shellMode":"Shell mode","quickActions.exitShellMode":"Exit Shell","quickActions.setGoal":"Set goal","session.missing":"Current session does not exist","session.new":"New session","workspace.loadFailed":"Failed to load workspace","workspace.notFound":"Workspace not found","workspace.notFoundDescription":"This workspace may have been removed or the link is no longer valid.","workspace.loadFailedDescription":"The workspace service could not be reached. Check the daemon and try again.","scheduledTasks.title":"Scheduled Tasks","scheduledTasks.subtitle":"Run tasks automatically on a schedule, or trigger them manually anytime.","scheduledTasks.loading":"Loading…","scheduledTasks.count":e=>`${(e==null?void 0:e.count)??0} task${Number((e==null?void 0:e.count)??0)===1?"":"s"}`,"scheduledTasks.refresh":"Refresh","scheduledTasks.new":"New scheduled task","scheduledTasks.createViaChat":"Create via chat","scheduledTasks.chatStarter":"Help me set up a recurring scheduled task (keep it long-term). What I want: ","scheduledTasks.name":"Name","scheduledTasks.workspace":"Workspace","scheduledTasks.taskId":"Task ID","scheduledTasks.schedule":"Schedule","scheduledTasks.type":"Type","scheduledTasks.status":"Status","scheduledTasks.namePlaceholder":"Optional — defaults to the prompt","scheduledTasks.prompt":"Prompt","scheduledTasks.promptPlaceholder":"What should this task do?","scheduledTasks.reference.extension":"Extensions","scheduledTasks.reference.skill":"Skills","scheduledTasks.reference.mcp":"MCP","scheduledTasks.referencePicker":"Reference picker","scheduledTasks.reference.remove":"Remove","scheduledTasks.reference.loading":"Loading…","scheduledTasks.reference.empty":"No available items.","scheduledTasks.frequency":"Frequency","scheduledTasks.freq.daily":"Daily","scheduledTasks.freq.weekdays":"Weekdays","scheduledTasks.freq.weekly":"Weekly","scheduledTasks.freq.hourly":"Hourly","scheduledTasks.freq.minutes":"Every N minutes","scheduledTasks.freq.custom":"Custom (cron)","scheduledTasks.time":"Time","scheduledTasks.weekday":"Weekday","scheduledTasks.interval":"Minutes","scheduledTasks.cron":"Cron expression","scheduledTasks.weekdayNames":"Sun,Mon,Tue,Wed,Thu,Fri,Sat","scheduledTasks.human.daily":e=>`Daily at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekdays":e=>`Weekdays at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekly":e=>`Every ${(e==null?void 0:e.day)??""} at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.hourly":e=>`Hourly at :${(e==null?void 0:e.min)??"00"}`,"scheduledTasks.human.everyMinutes":e=>`Every ${(e==null?void 0:e.n)??""} minutes`,"scheduledTasks.never":"Never run","scheduledTasks.repeats":"Repeats","scheduledTasks.runsOnce":"Runs once","scheduledTasks.lastFired":e=>`Last run: ${(e==null?void 0:e.when)??""}`,"scheduledTasks.runNow":"Run now","scheduledTasks.enable":"Enable","scheduledTasks.disable":"Disable","scheduledTasks.delete":"Delete","scheduledTasks.deleteConfirmTitle":"Delete scheduled task","scheduledTasks.deleteConfirm":e=>`Delete scheduled task "${(e==null?void 0:e.name)??""}"?`,"scheduledTasks.deletedSnapshot":"This scheduled task has been deleted. Showing the snapshot from when it was created.","scheduledTasks.sessionScopedSnapshot":"This is a session-scoped scheduled task. Showing the snapshot from when it was created.","scheduledTasks.empty":"No scheduled tasks yet. Create one to get started.","scheduledTasks.create":"Create","scheduledTasks.creating":"Creating…","scheduledTasks.cancel":"Cancel","scheduledTasks.error.invalidSchedule":"Invalid schedule","scheduledTasks.error.emptyPrompt":"Prompt is required","scheduledTasks.error.promptTooLong":e=>`Prompt exceeds ${(e==null?void 0:e.max)??1e5}-character limit`,"scheduledTasks.error.toggleFailed":"Failed to update task","scheduledTasks.error.deleteFailed":"Failed to delete task","scheduledTasks.edit":"Edit","scheduledTasks.editTitle":"Edit scheduled task","scheduledTasks.save":"Save","scheduledTasks.saving":"Saving…","scheduledTasks.runHistory":e=>`Run history (${(e==null?void 0:e.count)??0})`,"scheduledTasks.viewHistory":e=>`View conversation (${(e==null?void 0:e.count)??0})`,"scheduledTasks.viewHistoryEmpty":"View conversation","scheduledTasks.viewHistoryHint":"Open the task's session to see its runs","scheduledTasks.runKind.catchUp":"late","scheduledTasks.runKind.manual":"manual","scheduledTasks.runKind.withheld":"skipped","scheduledTasks.error.runFailed":"Failed to record the run","scheduledTasks.error.oneShotConsumedButFailed":"The task was deleted but the prompt could not be delivered — it never ran. Recreate it to try again.","scheduledTasks.dueNow":"Due now","scheduledTasks.nextRunTooltip":e=>`Next run: ${(e==null?void 0:e.when)??""}`,"scheduledTasks.dur.d":"d","scheduledTasks.dur.h":"h","scheduledTasks.dur.m":"m","scheduledTasks.dur.s":"s","scheduledTasks.runMode":"Run mode","scheduledTasks.runMode.shared":"Shared session","scheduledTasks.runMode.isolated":"Isolated (fresh session per run)","scheduledTasks.runMode.shared.hint":"Runs accumulate in one session transcript.","scheduledTasks.runMode.isolated.hint":"Each run gets a clean session context.","scheduledTasks.condition":"Precondition (optional)","scheduledTasks.conditionPlaceholder":"e.g. Check whether anything landed on main since yesterday. If nothing did, the task should not run.","scheduledTasks.condition.hint":"Checked in this task's own session before each run. The prompt only runs in a fresh session when the check says yes — otherwise the run is skipped.","scheduledTasks.condition.cardPrefix":"If:","turnOutputs.filesEdited":e=>`Edited ${(e==null?void 0:e.count)??0} files`,"turnOutputs.viewChanges":"View changes","turnOutputs.review":"Review","turnOutputs.reviewLatest":"View recent file changes","sideTask.title":"Side task","sideTask.description":"View or create side tasks","sideTask.new":"New","sideTask.create":"New side task","rightPanel.add":"Add panel","sideTask.creating":"Creating side task…","sideTask.createFailed":"Failed to create side task","sideTask.promptFailed":"Failed to send the side-task question","sideTask.renameFailed":"Failed to name side task","turnOutputs.preview":"Preview","turnOutputs.collapseFiles":"Collapse files","turnOutputs.showMoreFiles":e=>`Show ${(e==null?void 0:e.count)??0} more files`,"turnOutputs.previousTurn":"Previous turn","turnOutputs.fileCount":e=>`${(e==null?void 0:e.count)??0} files`,"turnOutputs.openFileTree":"Open file tree","turnOutputs.closeFileTree":"Close file tree","sidebar.label":"Workspace sidebar","sidebar.toggleMenu":"Toggle menu","sidebar.newChat":"New chat","sidebar.newTask":"New task","sidebar.newWorktreeTask":"New worktree task","sidebar.plugins":"Plugins","sidebar.channels":"Channels","sidebar.project":"Project","sidebar.pinnedSessions":"Pinned","sidebar.workspaceSelectLabel":"Workspace","sidebar.details":"Details","sidebar.copySessionId":"Copy session ID","sidebar.copySessionIdFailed":"Failed to copy session ID","sidebar.sessionIdCopied":"Session ID copied","sidebar.workspaceUntrusted":"untrusted","sidebar.workspaceReadOnly":"read-only","sidebar.workspaceTrustToOpen":"Trust this workspace to open the session.","sidebar.addWorkspace":"Add workspace","sidebar.newWorkspace":"New workspace","sidebar.startFromScratch":"Start from scratch","sidebar.useExistingFolder":"Use an existing folder…","sidebar.scratchOutcomeUnknownTitle":"Check workspace creation","sidebar.scratchOutcomeUnknown":"The daemon response was interrupted. Check the refreshed workspace list before creating another workspace.","sidebar.scratchOutcomeRefresh":"Refresh workspace list","sidebar.scratchOutcomeAcknowledge":"I checked the workspace list","sidebar.addWorkspaceTitle":"Add Workspace","sidebar.addWorkspacePath":"Directory path","sidebar.addWorkspaceBrowse":"Browse…","sidebar.addWorkspaceBrowseError":"Unable to open the system folder picker. Enter an absolute path instead.","sidebar.addWorkspaceDisplayName":"Display name (optional)","sidebar.addWorkspaceDisplayNameHint":"Shown in Web Shell; the directory path remains the workspace identity.","sidebar.addWorkspaceRegister":"Register","sidebar.addWorkspaceCancel":"Cancel","sidebar.addWorkspaceError":"Failed to add workspace","sidebar.addWorkspaceBusyError":"Another workspace operation is in progress","sidebar.addWorkspacePersistenceError":"The daemon did not confirm persistent workspace registration","sidebar.addWorkspaceRefreshError":"Workspace added, but the workspace list could not be refreshed","sidebar.addWorkspaceAbsError":"Path must be absolute","sidebar.addWorkspaceHint":"Enter the absolute path to a project directory.","sidebar.addWorkspaceSuggestions":"Directory suggestions","sidebar.addWorkspacePersist":"Keep after daemon restart","sidebar.addWorkspacePersistHint":"Persist this workspace registration in the daemon configuration.","sidebar.addWorkspaceAdding":"Adding…","sidebar.removeWorkspace":"Remove workspace","sidebar.workspaceActions":"Workspace actions","sidebar.forceRemoveWorkspace":"Force remove","sidebar.removeWorkspaceTitle":"Remove Workspace","sidebar.removeWorkspaceConfirm":e=>`Remove the runtime and persistent registration for “${(e==null?void 0:e.name)??""}”? Files, settings, and session history will not be deleted.`,"sidebar.removeWorkspaceBusy":e=>`“${(e==null?void 0:e.name)??""}” still has active runtime resources. Force removal will terminate them.`,"sidebar.removeWorkspaceCurrentSession":"Switch to another workspace or close the current session before forcing removal.","sidebar.removeWorkspaceInProgress":"Another client is already removing this workspace. Refresh after that operation finishes.","sidebar.removeWorkspaceError":"Failed to remove workspace","sidebar.removeWorkspaceSessions":e=>`Sessions: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspacePrompts":e=>`Active prompts: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceStarts":e=>`Pending session starts: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceConnections":e=>`ACP connections: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceMemoryTasks":e=>`Memory tasks: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceWorkers":e=>`Channel workers: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceVoiceSessions":e=>`Voice sessions: ${(e==null?void 0:e.count)??0}`,"sidebar.noSessions":"No sessions.","sidebar.projectFallback":"Project","sidebar.sessionsOverview":"Session Overview","sidebar.splitView":"Split View","sidebar.settings":"Settings","sidebar.daemonStatus":"Daemon Status","sidebar.scheduledTasks":"Scheduled Tasks","sidebar.goals":"Goals","sidebar.themeLight":"Switch to light theme","sidebar.themeDark":"Switch to dark theme","sidebar.collapse":"Collapse","sidebar.expand":"Expand","sidebar.collapseProject":"Collapse project","sidebar.expandProject":"Expand project","sidebar.search":"Search sessions","sidebar.searchPlaceholder":"Search sessions","sidebar.searchEmpty":"No matching sessions.","sidebar.rename":"Rename","sidebar.renameCurrentOnly":"Only the current session can be renamed","sidebar.export":"Export conversation record","sidebar.exportFailed":"Failed to export session","sidebar.delete":"Delete","sidebar.archive":"Archive","sidebar.unarchive":"Restore","sidebar.moreActions":"More actions","sidebar.archiveCurrentDisabled":"The current session cannot be archived","sidebar.archivedTitle":"Archived","sidebar.archivedEmpty":"No archived sessions.","sidebar.archiveFailed":"Failed to archive session","sidebar.unarchiveFailed":"Failed to restore session","sidebar.loadingSessions":"Loading sessions...","sidebar.loadFailed":"Failed to load sessions. Click to retry.","sidebar.renameFailed":"Failed to rename session","sidebar.deleteFailed":"Failed to delete session","sidebar.newSessionFailed":"Failed to create a new chat","sidebar.switchFailed":"Failed to switch session","sidebar.currentDeleteDisabled":"Current session cannot be deleted","sidebar.deleteConfirmDescription":e=>`Delete "${(e==null?void 0:e.name)??""}"? This cannot be undone.`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} client(s)`,"sidebar.running":"Running","sidebar.waitingForApproval":"Waiting for approval","sidebar.userInputNeeded":"User input needed","sidebar.completedUnread":"Finished","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.sessionGroup":"Group","sidebar.groupFilter":"Session group","sidebar.groupAll":"All","sidebar.groupPinned":"Pinned","sidebar.groupUngrouped":"Ungrouped","sidebar.groupRecent":"Recent","sidebar.groupCreate":"Create group","sidebar.groupRename":"Rename group","sidebar.groupDelete":"Delete group","sidebar.groupColor":"Group color","sidebar.groupNamePrompt":"Group name","sidebar.groupDeleteConfirm":e=>`Delete group "${(e==null?void 0:e.name)??""}"?`,"sidebar.groupsLoadFailed":"Failed to load session groups","sidebar.groupCreateFailed":"Failed to create group","sidebar.groupAssignFailedAfterCreate":"Group created, but failed to move session into it","sidebar.groupUpdateFailed":"Failed to update group","sidebar.groupDeleteFailed":"Failed to delete group","sidebar.organizationFailed":"Failed to update session organization","sidebar.groupColor.red":"Red","sidebar.groupColor.orange":"Orange","sidebar.groupColor.yellow":"Yellow","sidebar.groupColor.green":"Green","sidebar.groupColor.blue":"Blue","sidebar.groupColor.purple":"Purple","sidebar.groupColor.custom":"Custom…","sidebar.groupColor.picker":"Choose custom group color","sidebar.groupColor.hex":"Hex color","sidebar.groupColor.invalid":"Enter a six-digit Hex color such as #416ef5.","quickKeys.cursor":"Move cursor","quickKeys.escape":"Cancel run","quickKeys.history":"History","quickKeys.retry":"Retry failed","quickKeys.searchHistory":"Search history","quickKeys.tab":"Accept completion","error.unsupportedTheme":"Unsupported theme. Use /theme light or /theme dark.","queue.delete":"Delete","queue.edit":"Edit","queue.insert":"Insert","queue.cleared":"Queue cleared.","queue.deleteTip":"Remove from queue","queue.editTip":"Remove from queue and edit again","queue.insertTip":"Insert this message into the current session; it takes effect on the next model call.","queue.inserted":"Inserted. It takes effect on the next model call.","queue.insertCommandDisabled":"Commands can't be inserted into the running turn; they run after it finishes.","queue.submitting":"Submitting...","queue.serverQueued":"Queued on server...","queue.editing":"Editing...","queue.removing":"Updating...","queue.submittingDisabled":"Submitting queued message...","queue.commandBlocked":"Slash commands can't be queued while a turn is running.","queue.shellQueued":"Shell command queued — it will run after the current turn finishes.","queue.shellDropped":e=>{const t=(e==null?void 0:e.count)??0;return t===1?"1 queued shell command will not run.":`${t} queued shell commands will not run.`},"queue.queueFailed":"Failed to queue message","queue.insertFailed":"Failed to insert queued message","queue.deleteFailed":"Failed to move message out of queue","queue.editFailed":"Failed to edit queued message","queue.footer":"Press ↑ to edit the latest queued message · Esc to clear queue","queue.imageCount":e=>`(+${(e==null?void 0:e.count)??0} images)`,"queue.more":e=>`... (+${(e==null?void 0:e.count)??0} more)`,"midTurn.inserted":e=>`Inserted message: ${(e==null?void 0:e.message)??""}`,"help.builtIn":"Built-in commands","help.commandCount":e=>`${(e==null?void 0:e.count)??0} commands`,"help.commandMeta.builtIn":"built-in","help.commandMeta.custom":"custom","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} subcommands`,"help.commandsIntro":"Browse built-in commands:","help.customGroup":"Custom, skills, plugins, MCP","help.customIntro":"Browse custom, skill, plugin, and MCP commands:","help.empty":"No commands are currently available.","help.emptyCustom":"No custom commands are currently available.","help.footer":"Tab/Shift+Tab to switch tabs · ↑/↓ or PgUp/PgDn to scroll · Esc to close","help.intro":"Qwen Code understands your codebase, makes edits with your permission, and executes commands right from your terminal.","help.section.shortcuts":"Shortcuts","help.search":"Search commands","help.shortcut.addContext":"Add files or folders as context","help.shortcut.altWords":"Jump through words","help.shortcut.clear":"Clear the screen","help.shortcut.commandMenu":"Open command menu","help.shortcut.completion":"Accept completion or switch help tabs","help.shortcut.history":"Cycle prompt history or scroll lists","help.shortcut.searchHistory":"Search prompt history","help.shortcut.newline":"Insert a newline","help.shortcut.pasteImages":"Paste images","help.shortcut.shell":"Run shell commands","help.shortcut.togglePanel":"Toggle this panel","help.shortcut.retry":"Retry last request","help.shortcut.compact":"Toggle compact mode","retry.hint":"Press Ctrl+Y to retry or click to retry","retry.none":"No failed request to retry.","system.taskNotification":"Task notification","system.taskCompleted":"Background task completed","system.taskFailed":"Background task failed","system.taskCancelled":"Background task cancelled","branch.failed":"Failed to branch session.","branch.success":e=>`Copied session. New session name: "${(e==null?void 0:e.name)??""}". Switched to the new session.`,"fork.empty":"Please provide a directive. Usage: /fork <directive>","fork.failed":e=>`Failed to launch fork: ${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"Background agent was not launched.","fork.started":e=>`Started background agent: "${(e==null?void 0:e.name)??""}". Track it in background tasks.`,"command.hidden":"This command is not available.","help.shortcut.approvals":"Cycle approval modes","help.shortcut.cancel":"Close dialogs or cancel operation","bug.failed":"Failed to load system info for bug report.","bug.popupBlocked":"Popup blocked — please allow popups and try again.","bug.submitted":"Bug report opened in a new tab.","clear.blocked":"Cannot clear while streaming — cancel first (Esc).","error.unknown":"Unknown error","error.modelStreamInterrupted":"Model response stream was interrupted. Please retry.","shell.command":"Shell Command","compact.enabled":"Compact mode enabled","compact.disabled":"Compact mode disabled","compact.hint":"Press Ctrl+O to show full tool output","compact.saveFailed":"Failed to save compact mode","help.subcommands":"subcommands","help.tab.commands":"Built-in commands","help.tab.custom":"custom-commands","help.tab.general":"shortcuts","help.title":"Help","slash.category.custom":"Custom commands","slash.category.skill":"Skill commands","slash.category.system":"System commands","language.changed":e=>`UI language changed to ${(e==null?void 0:e.language)??""}`,"language.current":e=>`Current UI language: ${(e==null?void 0:e.language)??""}`,"language.invalid":"Invalid language. Available: en, zh-CN","language.options":"Available options:","language.set":"Set UI language","language.usage":"Usage: /language ui [en|zh-CN]","localCommand.noSession":"No active session yet. Send your first message before using this command.","localCommand.diffNoWorkspace":"No workspace is available yet to show changes for.","localCommand.logNoWorkspace":"No workspace is available yet to show history for.","localCommand.prsNoWorkspace":"No workspace is available yet to show pull requests for.","localCommand.prsUnsupported":"This daemon does not support listing pull requests.","local.agents":"Manage subagents","local.bug":"Submit a bug report","local.compress":"Compress the context into a summary","local.compressFast":"Fast context compression without AI","local.config":"Get or set any setting by dot-path key","local.diff":"Show working-tree change stats versus HEAD","local.log":"Show commit history for the workspace","local.prs":"Show open GitHub pull requests for the workspace","local.directory":"Manage workspace directories","local.docs":"Open the full Qwen Code documentation","local.doctor":"Run installation and environment diagnostics","local.dream":"Consolidate managed auto-memory topic files","local.effort":"Set reasoning effort for capable models","local.export":"Export the current session history to a file","local.forget":"Remove matching entries from managed auto-memory","local.hooks":"Manage Qwen Code hooks","local.importConfig":"Import MCP servers from Claude configs","local.init":"Analyze the project and create a QWEN.md file","local.insight":"Generate programming insights from chat history","local.lsp":"Show LSP server status","local.remember":"Save a durable memory to the memory system","local.summary":"Generate a project summary file","local.workflows":"List active and completed workflow runs","skilldesc.batch":"Run batch operations across many files in parallel","skilldesc.dataviz":"Design guidance for charts and data visualizations","skilldesc.extensionCreator":"Create, test, and customize Qwen Code extensions","skilldesc.loop":"Run a prompt on a schedule or self-paced wakeups","skilldesc.newApp":"Workflow for building a new app from scratch","skilldesc.qcHelper":"Answer questions about using Qwen Code","skilldesc.review":"Review changed code for bugs, security, and quality","skilldesc.simplify":"Clean up recent changes for reuse and simplicity","skilldesc.stuck":"Diagnose frozen or slow Qwen Code sessions","skilldesc.agentReproduceAlign":"Align a ported Codex/Claude Code feature with the original","skilldesc.agentReproduceFeature":"Reproduce an existing Codex/Claude Code feature","skilldesc.autofix":"Implement approved issues or address PR review feedback","skilldesc.bugfix":"Fix a bug from a GitHub issue, reproduce-first","skilldesc.codegraph":"Analyze the codebase via graph and vector index","skilldesc.createIssue":"Draft and submit a GitHub issue from an idea","skilldesc.desktopPet":"Create a pixel-art desktop pet for Qwen Code","skilldesc.docsAuditAndRefresh":"Audit and refresh docs/ against the codebase","skilldesc.docsUpdateFromDiff":"Update official docs from local git diff","skilldesc.e2eTesting":"Run end-to-end tests of the Qwen Code CLI","skilldesc.featDev":"End-to-end workflow for a non-trivial feature","skilldesc.memoryLeakDebug":"Diagnose CLI memory leaks via heap snapshots","skilldesc.openworkDesktopSync":"Sync packages/desktop with openwork commit-by-commit","skilldesc.preparePr":"Prepare a GitHub PR title and body from the branch","skilldesc.qwenCodeClaw":"Use Qwen Code as a code-understanding agent","skilldesc.structuredDebugging":"Hypothesis-driven methodology for hard bugs","skilldesc.terminalCapture":"Automate terminal UI screenshot testing","skilldesc.tmuxRealUserTesting":"Real-user testing with tmux, saving logs","skilldesc.triage":"Triage and review Qwen Code issues and PRs","local.approvalMode":"Change approval mode","local.auth":"Connect an LLM provider","auth.title":"Connect a Provider","auth.step.group":"Type","auth.step.provider":"Provider","auth.step.protocol":"Protocol","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"Model IDs","auth.step.advanced":"Advanced Config","auth.protocol.openai":"OpenAI-compatible","auth.protocol.openaiDesc":"Standard OpenAI API format (most common)","auth.protocol.anthropic":"Anthropic-compatible","auth.protocol.anthropicDesc":"Anthropic Messages API format","auth.protocol.gemini":"Gemini-compatible","auth.protocol.geminiDesc":"Google Gemini API format","auth.apiKeyRequired":"API key cannot be empty.","auth.baseUrlInvalid":"Base URL must start with http:// or https://.","auth.baseUrlPrompt":"Enter the API endpoint for this protocol.","auth.baseUrlRequired":"Base URL cannot be empty.","auth.documentation":"Documentation","auth.modelsRequired":"Model IDs cannot be empty.","auth.review":"Review","auth.reviewText":"The following JSON will be saved to settings.json:","auth.save":"Save","auth.saving":"Saving...","auth.termsTitle":"Terms of Services and Privacy Notice","auth.continue":"Continue","auth.modelsPrompt":e=>`Enter model IDs separated by commas. Examples: ${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"Optional: configure advanced generation settings.","auth.advanced.thinking":"Enable thinking","auth.advanced.thinkingDesc":"Allows the model to perform extended reasoning before responding.","auth.advanced.modality":"Enable modality","auth.advanced.modalityDesc":"Enables multimodal input capabilities (image, video, etc.).","auth.advanced.modalityImage":"Image","auth.advanced.modalityVideo":"Video","auth.advanced.modalityAudio":"Audio","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"Context window","auth.advanced.contextDesc":"Max input tokens (leave empty to auto-detect from model name).","auth.advanced.contextPlaceholder":"Context window (optional)","local.btw":"Ask a quick side question without affecting the main conversation. Usage: /btw <your question>","btw.empty":"Please provide a question. Usage: /btw <your question>","btw.side.empty":"Please provide a question. Usage: /btw side <your question>","btw.emptyAnswer":"No response received.","btw.failed":"Failed to answer btw question","btw.answering":"+ Answering...","btw.shortcuts.pending":"Press Escape, Ctrl+C, or Ctrl+D to cancel","btw.shortcuts.done":"Press Space, Enter, or Escape to dismiss","local.clear":"Start a new session with empty context; previous session stays on disk (resumable with /resume)","local.context":'Show context window usage breakdown. Use "/context detail" for per-item breakdown.',"local.copy":"Copy last output or snippet","local.delete":"Delete a session permanently","local.release":"Release a live session","local.rewind":"Rewind the current conversation","local.branch":"Fork the current conversation into a new session","local.fork":"Start a background agent from this conversation","local.help":"Show help and commands","local.language":"Change UI language","local.mcp":"Manage MCP servers","local.memory":"Manage memory","local.model":"Switch model or set fast model","local.new":"Start a new conversation","local.plan":"Enter Plan mode","local.goal":"Set a goal and keep working until it is met","local.recap":"Generate a session recap","recap.label":"Recap","recap.loading":"Generating recap...","recap.empty":"Not enough conversation context for a recap yet.","recap.failed":"Failed to generate recap","rewind.action":"Rewind","rewind.confirm":"Confirm rewind","rewind.empty":"No rewind snapshots are available for this session.","rewind.failed":e=>`Failed to rewind session: ${(e==null?void 0:e.reason)??""}`,"rewind.loading":"Loading rewind snapshots...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"Rewinding...","rewind.subtitle":"Only the conversation is rewound. Files are not changed.","rewind.title":"Rewind Conversation","rewind.turn":e=>`Prompt ${(e==null?void 0:e.turn)??0}`,"local.rename":"Rename current session","rename.empty":"Please enter a session name, for example /rename project debugging, or use /rename --auto.","rename.success":e=>`Session renamed to ${(e==null?void 0:e.name)??""}`,"local.reset":"Reset current conversation","local.resume":"Resume a previous session","local.skills":"View available skills","local.stats":"Show session statistics","local.tasks":"View background tasks","local.status":"Show version info","local.theme":"Change theme","local.settings":"View and edit settings","local.schedule":"Manage scheduled tasks","local.extensions":"Manage extensions. Usage: /extensions manage|install <source>","extensions.label":"extension","extensions.action.failed":e=>`Extension action failed${e!=null&&e.name?` for "${e.name}"`:e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.commands.refreshFailed":"Failed to refresh extension commands.","extensions.install.failed":e=>`Failed to install extension${e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.manage.agents":"Agents:","extensions.manage.actions":"Extension actions","extensions.manage.add":"Add Extension","extensions.manage.checkingUpdates":"Checking for updates...","extensions.manage.checkUpdates":"Check for updates","extensions.manage.commands":"Commands:","extensions.manage.contextFiles":"Context files:","extensions.manage.count":e=>`${(e==null?void 0:e.count)??0} extensions installed`,"extensions.manage.setting.disabled":"Disabled","extensions.manage.setting.default":"Default","extensions.manage.setting.enabled":"Enabled","extensions.manage.setting.unknown":"Unavailable","extensions.manage.setting.unavailableDescription":"The service did not return scoped extension settings. Restart qwen serve and try again.","extensions.manage.userSetting":"Global setting","extensions.manage.userSettingDescription":"Applies to your workspaces unless a workspace setting overrides it.","extensions.manage.workspaceSetting":"Workspace setting","extensions.manage.workspaceSettingDescription":"Applies only to the current workspace.","extensions.manage.disable":"Disable Extension","extensions.manage.disabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" disabled.`,"extensions.manage.disabling":e=>`Disabling extension "${(e==null?void 0:e.name)??"extension"}"…`,"extensions.manage.inherited":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" now uses the global setting.`,"extensions.manage.inheriting":e=>`Resetting extension "${(e==null?void 0:e.name)??"extension"}" to the global setting…`,"extensions.manage.empty":"No extensions installed.","extensions.manage.emptyAgents":"This extension has no agents.","extensions.manage.emptyCommands":"This extension has no commands.","extensions.manage.emptyContextFiles":"This extension has no context files.","extensions.manage.emptyDescription":"Install an extension to add commands, skills, agents, or MCP servers.","extensions.manage.emptyMcpServers":"This extension has no MCP servers.","extensions.manage.emptySkills":"This extension has no skills.","extensions.manage.enable":"Enable Extension","extensions.manage.enabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" enabled.`,"extensions.manage.enabling":e=>`Enabling extension "${(e==null?void 0:e.name)??"extension"}"…`,"extensions.manage.install":"Install","extensions.manage.installDescription":"Enter a GitHub, Git, or npm extension source.","extensions.manage.installSelectPluginDescription":e=>`Choose a plugin from "${(e==null?void 0:e.marketplace)??"this marketplace"}".`,"extensions.manage.installType":"Install type:","extensions.manage.mcpServers":"MCP servers:","extensions.manage.marketplaceRoot":"Marketplace root","extensions.manage.name":"Name:","extensions.manage.notUpdatable":"not updatable","extensions.manage.operationFailed":"Extension operation failed.","extensions.manage.noDescription":"No description","extensions.manage.noMatches":"No matching extensions.","extensions.manage.origin":"Origin:","extensions.manage.overview":"Overview","extensions.manage.path":"Path:","extensions.manage.queued":e=>`Extension action queued for "${(e==null?void 0:e.name)??"extension"}".`,"extensions.manage.refreshFailed":e=>`Extension action succeeded, but session refresh failed${e!=null&&e.error?`: ${e.error}`:"."}`,"extensions.manage.restartRequired":"updated; restart required","extensions.manage.search":"Search extensions…","extensions.manage.selectExtension":"Choose an extension","extensions.manage.settings":"Settings:","extensions.manage.skills":"Skills:","extensions.manage.source":"Source:","extensions.manage.sourcePlaceholder":"https://github.com/owner/repository","extensions.manage.status":"Status:","extensions.manage.status.disabled":"disabled","extensions.manage.status.enabled":"enabled","extensions.manage.title":"Manage Extensions","extensions.manage.unknownUpdate":"unknown","extensions.manage.uninstalled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" uninstalled.`,"extensions.manage.uninstalling":e=>`Uninstalling extension "${(e==null?void 0:e.name)??"extension"}"…`,"extensions.manage.uninstallAction":"Uninstall Extension","extensions.manage.uninstallConfirm":e=>`Uninstall extension "${(e==null?void 0:e.name)??"extension"}"?`,"extensions.manage.upToDate":"up to date","extensions.manage.update":"Update Extension","extensions.manage.updateAvailable":"update available","extensions.manage.updateError":"update check failed","extensions.manage.updateComplete":"updated","extensions.manage.updatedWithWarnings":"updated with warnings","extensions.manage.updateStatus":"Update status:","extensions.manage.updating":"updating…","extensions.manage.updatingExtension":e=>`Updating extension "${(e==null?void 0:e.name)??"extension"}"…`,"extensions.manage.updated":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" updated.`,"extensions.manage.updatedWithVersion":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" updated to v${(e==null?void 0:e.version)??""}.`,"extensions.manage.version":"Version:","extensions.manage.viewDetails":"View Details","extensions.install.installed":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" installed.`,"extensions.install.installedWithVersion":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" v${(e==null?void 0:e.version)??""} installed.`,"extensions.install.missingOptionValue":e=>`Missing value for ${(e==null?void 0:e.option)??"option"}`,"extensions.install.requestFailed":"Failed to install extension","extensions.install.started":e=>`Installing extension from "${(e==null?void 0:e.source)??""}"...`,"extensions.install.unknownOption":e=>`Unknown option ${(e==null?void 0:e.option)??""}`,"extensions.install.usage":"Usage: /extensions manage|install <source>","extensions.install.waitForSession":"Wait for the session to connect before installing an extension.","local.tools":"List available tools. Usage: /tools [desc]","loadWarning.commands":"Failed to load command list; slash commands may be incomplete.","loadWarning.context":"Failed to load session context; current mode may be inaccurate.","loadWarning.models":"Failed to load model list; some model details may be unavailable.","mcp.action.auth":"Authenticate","mcp.action.authHint":"Not exposed by daemon yet","mcp.action.authMessage":"Daemon serve does not expose MCP authentication yet.","mcp.action.clearAuth":"Clear Authentication","mcp.action.disable":"Disable","mcp.action.done":e=>`${(e==null?void 0:e.action)??"Action"} complete.`,"mcp.action.enable":"Enable","mcp.action.enableMessage":"Daemon serve does not expose MCP enable/disable yet.","mcp.action.failed":e=>`Failed: ${(e==null?void 0:e.error)??""}`,"mcp.action.running":e=>`${(e==null?void 0:e.action)??"Action"}...`,"mcp.action.reauth":"Re-authenticate","mcp.action.approve":"Approve","mcp.actions":"Server actions","mcp.annotation.destructive":"destructive","mcp.annotation.idempotent":"idempotent","mcp.annotation.openWorld":"open-world","mcp.annotation.readOnly":"read-only","mcp.annotations":"Annotations","mcp.oauth.server":"Server","mcp.oauth.starting":e=>`Starting OAuth authentication for MCP server '${(e==null?void 0:e.name)??""}'...`,"mcp.oauth.title":"OAuth Authentication","mcp.oauth.timeout":"Authentication timed out. Refresh to check the status.","mcp.oauth.authenticationFailed":"Authentication failed.","mcp.oauth.statusFailed":"Failed to check the authentication status.","mcp.oauth.serverRemoved":"The MCP server was removed during authentication.","mcp.clientBudget":e=>`${(e==null?void 0:e.count)??0}/${(e==null?void 0:e.budget)??0} clients · ${(e==null?void 0:e.mode)??"off"}`,"mcp.command":"Command","mcp.description":"Description:","mcp.descriptionTitle":"Description","mcp.basicInfo":"Basic Information","mcp.action.reconnect":"Reconnect","mcp.action.edit":"Edit","mcp.reconnect.skipped":e=>`Reconnect was not completed: ${(e==null?void 0:e.reason)??"unknown reason"}.`,"mcp.reconnect.authenticationRequired":"Authentication is required before reconnecting.","mcp.action.restart":"Restart","mcp.action.tools":"View tools","mcp.action.toolsHint":"Enter to inspect","mcp.empty":"No MCP servers configured.","mcp.emptyDescription":"Add an MCP server to manage it here.","mcp.emptyTools":"No tools discovered.","mcp.expand":"Expand MCP server","mcp.collapse":"Collapse MCP server","mcp.inputSchema":"Input schema","mcp.loadingStatus":"Loading MCP status...","mcp.loadingTools":"Loading tools...","mcp.name":"Name","mcp.noDescription":"No description","mcp.noMatches":"No matching MCP servers.","mcp.add.button":"Add MCP Server","mcp.add.adding":"Adding MCP Server…","mcp.add.title":"Add MCP Server","mcp.add.description":"Save an MCP server to this workspace with a name and configuration.","mcp.add.name":"Name","mcp.add.serverDescription":"Description","mcp.add.serverDescriptionPlaceholder":"Describe this MCP server","mcp.add.scope":"Location","mcp.add.scope.global":"Global","mcp.add.nameRequired":"Enter an MCP server name.","mcp.add.config":"Configuration (JSON)","mcp.add.configInvalid":"Configuration must be a JSON object.","mcp.add.done":e=>`Added ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.edit.title":"Edit MCP Server","mcp.edit.description":"Update the description or configuration. Name and location cannot be changed.","mcp.edit.save":"Save Changes","mcp.edit.saving":"Saving Changes…","mcp.edit.done":e=>`Updated ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.edit.notFound":"The MCP server is no longer present in settings.","mcp.runtime.notUpdated":"Configuration was saved, but the current session was not updated.","mcp.runtime.removeNotUpdated":"Configuration was deleted, but the current session was not updated.","mcp.discovery.empty":"No MCP servers are configured.","mcp.discovery.initializing":"Initializing MCP servers…","mcp.discovery.timeout":"MCP discovery is taking longer than expected. Refresh to check again.","mcp.add.settingsUnavailable":"Workspace settings are unavailable.","mcp.action.remove":"Delete","mcp.remove.title":"Delete MCP Server","mcp.remove.description":e=>`Remove MCP server “${(e==null?void 0:e.name)??""}” from this workspace?`,"mcp.remove.description.global":e=>`Remove MCP server “${(e==null?void 0:e.name)??""}” from global settings?`,"mcp.remove.done":e=>`Deleted ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.remove.notWorkspace":"This MCP server is not defined in workspace settings.","mcp.source.all":"All","mcp.noSchema":"No input schema.","mcp.oauth.open":"Open authentication page","mcp.serverTool":"Server tool","mcp.servers":e=>`${(e==null?void 0:e.count)??0} servers`,"mcp.configuredServers":"Configured MCP servers:","mcp.fromExtension":e=>`(from ${(e==null?void 0:e.name)??""})`,"mcp.extensionMcp":"Extension MCP","mcp.invalidReason":e=>`invalid: ${(e==null?void 0:e.reason)??""}`,"mcp.invalidReasonLabel":"Reason:","mcp.invalidToolHelp":"Tools must have both name and description to be used by the LLM.","mcp.invalidToolWarning":"Warning: This tool cannot be called by the LLM","mcp.manageServers":"Manage MCP servers","mcp.viewDetails":"View details","mcp.parameters":"Parameters:","mcp.required":" required","mcp.resources":"Resources","mcp.resourcesUnavailable":"Resource details unavailable.","mcp.noResources":"No resources.","mcp.resourceCount":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"resource":"resources"}`,"mcp.promptCount":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"prompt":"prompts"}`,"mcp.resource.uriLabel":"URI:","mcp.resource.nameLabel":"Name:","mcp.resource.mimeTypeLabel":"MIME Type:","mcp.resource.sizeLabel":"Size:","mcp.resource.bytes":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"byte":"bytes"}`,"mcp.scrollPosition":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0}`,"mcp.shortcut.back":"Esc to back","mcp.shortcut.close":"Esc to close","mcp.shortcut.selectBack":"↑↓ to navigate · Enter to select · Esc to back","mcp.shortcut.selectClose":"↑↓ to navigate · Enter to select · Esc to close","mcp.settings":"Settings","mcp.extension":e=>`Extension: ${(e==null?void 0:e.name)??""}`,"mcp.starting":e=>`⏳ MCP servers are starting up (${(e==null?void 0:e.count)??0} initializing)...`,"mcp.startingNote":"Note: First startup may take longer. Tool availability will update automatically.","mcp.restartSkipped":e=>`Skipped ${(e==null?void 0:e.name)??""}: ${(e==null?void 0:e.reason)??""}`,"mcp.restarted":e=>`Restarted ${(e==null?void 0:e.name)??""} in ${(e==null?void 0:e.duration)??0}ms`,"mcp.restartEntries":e=>`Restarted ${(e==null?void 0:e.restarted)??0}/${(e==null?void 0:e.total)??0} ${(e==null?void 0:e.name)??""} entries${e!=null&&e.failedReasons?` (failed: ${e.failedReasons})`:""}`,"mcp.source":"Source","mcp.source.extension":"Extension","mcp.source.project":"Project MCP (.mcp.json)","mcp.source.workspace":"Workspace Settings","mcp.source.user":"Global Settings","mcp.status":"Status","mcp.status.blocked":"Blocked","mcp.status.authenticating":"Authenticating","mcp.status.needsApproval":"Needs approval","mcp.status.rejected":"Rejected","mcp.status.connected":"connected","mcp.status.connecting":"connecting","mcp.status.disconnected":"disconnected","mcp.status.disconnectedTitle":"Disconnected","mcp.status.disabled":"disabled","mcp.status.ready":"Ready","mcp.status.starting":"Starting... (first startup may take longer)","mcp.status.unknown":"unknown","mcp.tipDesc":"to show server and tool descriptions","mcp.tipNodesc":"to hide descriptions","mcp.tipSchema":"to show tool parameter schemas","mcp.tips":"💡 Tips:","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} tool`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} tools`,"mcp.toolsLabel":"Tools:","mcp.title":"MCP Servers","mcp.toolDetail":"Tool Detail","mcp.tools":"Tools","mcp.toolsForServer":e=>`Tools for ${(e==null?void 0:e.name)??"Server"}`,"mcp.transport":"Transport Protocol","mcp.use":"Use","mcp.userMcp":"Global MCP","mcp.workingDirectory":"Working Directory","goal.aborted":"Goal aborted","goal.achieved":"Goal achieved","goal.check":"Goal check","goal.cleared":"Goal cleared","goal.failed":"Goal could not be achieved","goal.judge":"Judge","goal.label":"Goal","goal.lastCheck":"Last check","goal.notYetMet":"not yet met","goal.set":"Goal set","goal.statusActive":"/goal active","goal.turn":e=>`${(e==null?void 0:e.count)??0} turn`,"goal.turnLabel":e=>`turn ${(e==null?void 0:e.count)??0}`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} turns`,"goals.title":"Goals","goals.subtitle":"A goal keeps its session working until the condition is met. Only sessions that are currently loaded appear here — a goal advances only while its session is running.","goals.loading":"Loading goals…","goals.count":e=>`${(e==null?void 0:e.count)??0} active ${Number(e==null?void 0:e.count)===1?"goal":"goals"}`,"goals.empty":"No active goals. Set one with /goal <condition>.","goals.refresh":"Refresh","goals.new":"New goal","goals.newHint":"The goal starts in a new session and runs until its condition holds.","goals.condition":"Condition","goals.conditionPlaceholder":"e.g. all tests pass and the lint is clean","goals.cancel":"Cancel","goals.create":"Set goal","goals.creating":"Starting…","goals.clear":"Clear goal","goals.clearConfirm":e=>`Clear the goal "${(e==null?void 0:e.condition)??""}"?`,"goals.running":"Working","goals.idle":"Waiting","goals.dropped":e=>`${(e==null?void 0:e.count)??0} session${Number(e==null?void 0:e.count)===1?"":"s"} could not be reached — any goals they are running are missing from this list.`,"goals.notYetEvaluated":"not yet evaluated","goals.openSessionHint":"Open this goal's session","goals.error.emptyCondition":"Enter a condition for the goal.","goals.error.clearKeyword":e=>`"${(e==null?void 0:e.word)??""}" clears a goal rather than setting one. Describe the condition to work toward.`,"goals.error.createFailed":"Failed to start the goal","goals.error.clearFailed":"Failed to clear the goal","memory.add":"Add","memory.add.desc":"Write a durable memory","memory.autoDream":e=>`Auto-dream: ${(e==null?void 0:e.status)??"unknown"} · ${(e==null?void 0:e.lastDream)??"never"} · /dream to run`,"memory.autoDreamUnsupported":"Auto-dream settings are not available from web-shell yet.","memory.autoFolder":"Open auto-memory folder","memory.autoMemory":e=>`Auto-memory: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoMemoryUnsupported":"Auto-memory settings are not available from web-shell yet.","memory.autoSkill":e=>`Auto-skill: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoSkillUnsupported":"Auto-skill settings are not available from web-shell yet.","memory.chooseScope":"Choose where to save the memory","memory.closed":"Memory panel closed.","memory.contentEmpty":"Memory content is empty.","memory.file":"Memory file","memory.fileOpen":"Memory file opened.","memory.fileTruncated":"Memory file opened. Content is truncated.","memory.files":"Memory Files","memory.footer":"Enter to confirm · Esc to cancel","memory.footer.back":"Esc to go back","memory.global":"User","memory.global.desc":"Saved to the global user memory file","memory.globalReadUnsupported":"Global memory is outside the bound workspace, so the current daemon file-read API cannot open its content.","memory.loading":"Loading memory...","memory.loadingFile":"Loading memory file...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"never","memory.noFiles":"No memory files found.","memory.on":"on","memory.openFolderUnsupported":"Opening the auto-memory folder is not available from web-shell yet.","memory.placeholder":e=>`Write ${(e==null?void 0:e.scope)??"memory"} content...`,"memory.project":"Project","memory.project.desc":"Saved to this workspace memory file","memory.refresh":"Refresh","memory.refresh.desc":"Reload memory file information","memory.refreshed":"Memory refreshed.","memory.save":"Save Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} saved: ${(e==null?void 0:e.bytes)??0} bytes -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"Saving...","memory.show":"Show","memory.show.desc":"Show configured memory files","memory.status":"Workspace and user memory files","memory.unknown":"unknown","memory.write":"Write memory content","mode.auto":"Classifier Approval","mode.auto.desc":"Uses a classifier to approve safe tool calls and block or ask for risky ones","mode.auto.notice":"Auto mode enabled. An LLM classifier evaluates each tool call and auto-approves safe actions, blocks risky ones. To exit: Shift+Tab or /approval-mode default.","mode.footer":"(Use Enter to select, Esc to cancel)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"Plan","mode.label.default":"Ask Approval","mode.label.auto-edit":"Auto Edit","mode.label.auto":"Classifier Approval","mode.label.yolo":"Full Access","mode.listLabel.plan":"Plan (plan)","mode.listLabel.default":"Ask Approval (default)","mode.listLabel.auto-edit":"Auto Edit (auto-edit)","mode.listLabel.auto":"Classifier Approval (auto)","mode.listLabel.yolo":"Full Access (yolo)","mode.desc.plan":"Analyze only, do not modify files or execute commands","mode.desc.default":"Ask before running commands, editing files, or accessing external resources","mode.desc.auto-edit":"Automatically approve file edits and ask before command execution or other sensitive actions","mode.desc.auto":"Evaluate tool risk automatically, run safe actions, and confirm risky ones","mode.desc.yolo":"Automatically approve all tool calls in trusted contexts","mode.select":"Approval Mode","mode.autoApproved":e=>e!=null&&e.tool?`Auto-approved: ${e.tool}`:"Pending tool call auto-approved by mode switch.","mode.auto-edit":"Auto-accept edits","mode.auto-edit.desc":"Automatically approve file read/write operations","mode.default":"Default mode","mode.default.desc":"Ask before each tool call","mode.plan":"Plan mode","mode.plan.desc":"Analyze and plan without running tools","mode.unknown":"unknown mode","mode.yolo":"YOLO mode","mode.yolo.desc":"Automatically approve all operations","plan.title":"Plan","model.contextWindow":"Context Window","model.contextWindow.unknown":"(unknown)","model.current":e=>`current: ${(e==null?void 0:e.model)??"unknown"}`,"model.modality":"Modality","model.modality.text":"text","model.modality.textOnly":"text-only","model.modality.image":"image","model.modality.pdf":"pdf","model.modality.audio":"audio","model.modality.video":"video","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"(default)","model.notSet":"(not set)","model.footer":"Enter select, ↑↓ navigate, Esc close","model.searchHint":"Press / to search","model.fastHint":"for suggestions and side tasks","model.noMatch":e=>`No model matching "${(e==null?void 0:e.query)??""}"`,"model.none":"No models available","model.select":"Select Model","model.setFast":"Set Fast Model","model.setVoice":"Set Voice Model","model.setVision":"Set Vision Model","model.switch":"Switch Model","model.unknown":"unknown","resume.current":"current","resume.activePrompt":"active prompt","resume.filter":"Filter","resume.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"resume.none":"No sessions to resume","resume.pressSearch":"Press / to search","resume.search":"Search","resume.title":"Resume Session","parallelAgents.title":"Parallel agents","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} done`,"skills.actions":"Skill actions","skills.disable":"Disable","skills.disabled":"Skill disabled.","skills.enable":"Enable","skills.enabled":"Skill enabled.","skills.install.action":"Upload skill","skills.install.description":"Install a skill from GitHub, a local folder, or a ZIP archive.","skills.install.error.authentication":"Authentication is required to upload skills.","skills.install.error.folderRequired":"Enter a folder path.","skills.install.error.githubRequired":"Enter a GitHub SKILL.md URL.","skills.install.error.invalidName":"The skill name is missing or contains unsupported characters.","skills.install.error.manifestMissing":"The package must contain a SKILL.md file at its root.","skills.install.error.invalidPackage":"The skill package is invalid. Check its structure and SKILL.md content.","skills.install.error.zipTooLarge":"The ZIP file must not exceed 6 MB.","skills.install.error.invalidFolder":"Enter a valid local skill folder.","skills.install.error.githubFailed":"Could not download the skill from GitHub. Check the URL or authentication and try again.","skills.install.error.invalidScope":"Choose either the workspace or global install location.","skills.install.error.invalidSource":"The daemon does not recognize this upload source. Restart the updated daemon and try again.","skills.install.error.notFound":"The requested skill was not found.","skills.install.error.nameRequired":"Enter the skill name.","skills.install.error.untrusted":"Trust this workspace before uploading skills.","skills.install.failed":"Failed to upload skill.","skills.install.folder":"Local folder","skills.install.folderPath":"Folder path","skills.install.githubUrl":"SKILL.md URL","skills.install.name":"Skill name","skills.install.scope":"Install to","skills.install.scope.global":"Global","skills.install.scope.workspace":"Workspace","skills.install.selectZip":"Select a ZIP archive.","skills.install.title":"Upload skill","skills.install.succeeded":e=>`Skill “${(e==null?void 0:e.name)??""}” uploaded successfully.`,"skills.install.zipSelected":e=>`Selected: ${(e==null?void 0:e.name)??""}`,"skills.delete.action":"Delete skill","skills.delete.description":e=>`Delete “${(e==null?void 0:e.name)??""}” from disk? This cannot be undone.`,"skills.delete.failed":"Failed to delete skill.","skills.delete.succeeded":e=>`Skill “${(e==null?void 0:e.name)??""}” deleted successfully.`,"skills.delete.title":"Delete skill?","skills.empty":"No skills available.","skills.count":e=>[`${(e==null?void 0:e.count)??0} skills`,...e!=null&&e.enabled?[`${e.enabled} enabled`]:[],...e!=null&&e.disabled?[`${e.disabled} disabled`]:[]].join(", "),"skills.details":"Skill details","skills.extension":"Extension","skills.filter.all":"All","skills.filter.bundled":"Built-in","skills.filter.extension":"Extensions","skills.filter.label":"Filter skills by source","skills.filter.project":"Workspace settings","skills.filter.status.all":"All","skills.filter.status.disabled":"Disabled","skills.filter.status.enabled":"Enabled","skills.filter.status.label":"Filter skills by status","skills.filter.user":"Global settings","skills.hint":"Hint","skills.invocation":"Invocation","skills.level":"Scope","skills.level.bundled":"Bundled","skills.level.extension":"Extension","skills.level.project":"Project","skills.level.user":"Global","skills.loading":"Loading skills...","skills.manualReference":"Manual reference","skills.manualReferenceHint":"The model cannot discover this skill automatically. Reference it manually.","skills.model":"Model","skills.modelAccess":"Model access","skills.modelAccess.disabled":"Not model-invocable","skills.modelAccess.enabled":"Model-invocable","skills.modelInvocable":"Model","skills.noDescription":"No description","skills.noMatches":"No matching skills.","skills.notToggleable":"This skill cannot be enabled or disabled.","skills.run":"Reference skill","skills.search":"Search skills…","skills.status":"Status","skills.status.disabled":"disabled","skills.status.enabled":"enabled","skills.toggleFailed":"Failed to update skill.","skills.error.inactiveExtension":"This skill belongs to an inactive extension. Enable the extension first.","skills.toggleUnsupported":"The connected daemon does not support skill enable or disable actions.","skills.title":"Skills","plugins.extensions":"Extensions","plugins.agents":"Agents","plugins.mcp":"MCP","plugins.mcpLoadFailed":"Failed to load MCP status","plugins.sections":"Plugin sections","plugins.skills":"Skills","plugins.title":"Plugins","plugins.tools":"Tools","stats.accepted":"Accepted:","stats.agreementRate":"Overall Agreement Rate:","stats.api":"API","stats.apiTime":"API Time","stats.avgDuration":"Avg Duration","stats.avgLatency":"Avg Latency","stats.cached":"Cached","stats.cacheDesc":"of input tokens were served from the cache, reducing costs.","stats.calls":"Calls","stats.codeChanges":"Code Changes","stats.decisionSummary":"User Decision Summary","stats.duration":"Duration","stats.errors":"Errors","stats.inputTokens":"Input Tokens","stats.metric":"Metric","stats.modelStats":"Model Stats","stats.modelTip":"Tip: For a full token breakdown, run /stats model.","stats.modelUsage":"Model Usage","stats.modified":"Modified:","stats.noApiCalls":"No API calls have been made in this session.","stats.noToolCalls":"No tool calls have been made in this session.","stats.outputTokens":"Output Tokens","stats.overview":"Session Overview","stats.performance":"Performance","stats.prompts":"Prompts","stats.rejected":"Rejected:","stats.reqs":"Reqs","stats.requests":"Requests","stats.savingsHighlight":"Savings Highlight:","stats.successRate":"Success Rate","stats.thoughts":"Thoughts","stats.title":"Session Stats","stats.tokens":"Tokens","stats.toolCalls":"Tool Calls","stats.toolName":"Tool Name","stats.toolStats":"Tool Stats","stats.toolTime":"Tool Time","stats.total":"Total","stats.totalReviewed":"Total Reviewed Suggestions:","status.contextUsed":e=>`${(e==null?void 0:e.pct)??"0.0"}% context used`,"status.disconnected":"Disconnected","status.modeHint":"(shift + tab or click to switch)","status.shortcuts":"? for shortcuts","stream.cancel":"esc to cancel","stream.cancelArmed":"Press Esc again to stop","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`current: ${(e==null?void 0:e.theme)??""}`,"theme.auto":"Auto","theme.dark":"Dark","theme.dark.desc":"Terminal-style dark skin.","theme.light":"Light","theme.light.desc":"Terminal-style light skin.","theme.title":"Theme","todo.allDone":"All tasks completed","todo.collapse":"Collapse task list","todo.completedAbove":e=>`✓ ${(e==null?void 0:e.count)??0} completed`,"todo.detail.api":"API","todo.detail.cached":"Cached","todo.detail.end":"End","todo.detail.hide":"Hide task detail","todo.detail.input":"Input","todo.detail.noResources":"Token & time usage wasn't captured for this task.","todo.detail.output":"Output","todo.detail.sectionSpent":"Time spent","todo.detail.sectionTime":"Time","todo.detail.sectionTokens":"Tokens","todo.detail.show":"Show task detail","todo.detail.start":"Start","todo.detail.tool":"Tool","todo.expand":"Expand task list","todo.more":e=>`... ${(e==null?void 0:e.count)??0} more`,"todo.moreAbove":e=>`... ${(e==null?void 0:e.count)??0} earlier`,"todo.showLess":"Show less","todo.stepProgress":e=>`Step ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"Current tasks","chat.scrollToBottom":"Scroll to bottom","chatHeader.toggleEnvironment":"Toggle environment information","chatHeader.toggleRightPanel":"Toggle right panel","environment.title":"Environment","environment.changes":"Changes","environment.changeCount":e=>`${(e==null?void 0:e.count)??0} changed`,"environment.clean":"Clean","environment.workspace":"Workspace","environment.branch":"Branch","environment.history":"Commit history","environment.agents":"Subagents","environment.unnamedAgent":e=>`Agent (${(e==null?void 0:e.index)??0})`,"environment.unavailable":"Unavailable","userMessage.showMore":"Show more","userMessage.showLess":"Collapse","userMessage.sendFailed":"Failed to send","userMessage.retrySend":"Retry sending message","turn.processed":"Processed","turn.processing":"Processing","turn.collapse":"Collapse steps","turn.expand":"Expand steps","turn.cached":"cached","turn.executionSteps":e=>{const t=(e==null?void 0:e.count)??0;return`${t} step${t===1?"":"s"}`},"turn.toolCalls":e=>{const t=(e==null?void 0:e.count)??0;return`${t} tool call${t===1?"":"s"}`},"turn.thinkingCount":e=>{const t=(e==null?void 0:e.count)??0;return`${t} thought${t===1?"":"s"}`},"turn.stopped":"You cancelled this request","message.renderError":"This message could not be displayed.","tasks.title":"Background tasks","tasks.empty":"No tasks currently running","tasks.refreshStale":"Task status may be stale; reconnecting...","tasks.cancelFailed":"Failed to cancel task","tasks.alreadyStopped":"Task already stopped","tasks.moreAbove":e=>`^ ${(e==null?void 0:e.count)??0} more above`,"tasks.moreBelow":e=>`v ${(e==null?void 0:e.count)??0} more below`,"tasks.running":"Running","tasks.completed":"Completed","tasks.failed":"Failed","tasks.cancelled":"Stopped","tasks.paused":"Paused","tasks.kind.shell":"Shell","tasks.kind.monitor":"Monitor","tasks.action.stop":"Stop","tasks.action.abandon":"Abandon","tasks.action.confirmStop":"Confirm stop","tasks.action.confirmAbandon":"Confirm abandon","tasks.action.confirmHint":"This will end the blocking turn.","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} local agent`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} local agents`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} local agent paused`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} local agents paused`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} task done`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} tasks done`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} monitor`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} monitors`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} shells`,"tasks.confirmStop":"x again to confirm stop · ends the blocking turn","tasks.shortcut.select":"↑/↓ select","tasks.shortcut.view":"Enter view","tasks.shortcut.stop":"x stop","tasks.shortcut.abandon":"x abandon","tasks.shortcut.listClose":"←/Esc close","tasks.shortcut.detailBack":"← go back","tasks.shortcut.detailClose":"Esc/Enter/Space close","tasks.shortcut.close":"Esc close","tasks.shortcut.cancelConfirm":"Esc cancel","tasks.detail.workingDir":"Working dir","tasks.detail.outputFile":"Output file","tasks.detail.command":"Command","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} events`,"tasks.detail.exit":e=>`exit ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} dropped`,"tasks.detail.error":"Error","tasks.detail.stoppedBecause":"Stopped because","tasks.detail.resumeBlocked":"Resume blocked","tasks.detail.progress":"Progress","tasks.detail.prompt":"Prompt","tasks.detail.type":"Type","tasks.detail.runtime":"Time","tasks.detail.eventCount":"Events","tasks.detail.pid":"PID","tasks.detail.lastEvent":"Last event","tasks.detail.droppedCount":"Dropped","tasks.detail.exitCode":"Exit code","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"Tool calls","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool calls`,"tasks.detail.nesting":"Nesting","tasks.detail.nestingValue":e=>`Level ${(e==null?void 0:e.level)??"?"} · from ${(e==null?void 0:e.parent)??"?"}`,"tasks.detail.nestingLevel":e=>`Level ${(e==null?void 0:e.level)??"?"}`,"tasks.row.from":e=>`from ${(e==null?void 0:e.parent)??"?"}`,"tasks.row.nested":"nested","tips.items":"Type / to see all available commands.|Use @ to reference file paths.|Press Esc to cancel an in-flight request.|Use Shift+Enter for a newline.|Press ↑↓ to browse message history.","tools.available":"Available tools:","tools.none":"No tools available.","tools.empty":"No built-in tools available. Open a session first.","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space for details · ":""}t to toggle ${e.name} · r to refresh · Esc to close`:"r to refresh · Esc to close","tools.details.hide":"Hide details","tools.details.show":"Show details","tools.description":"Description","tools.details":"Tool details","tools.loading":"Loading tools...","tools.name":"Tool name","tools.noDescription":"No description","tools.noMatches":"No matching tools.","tools.search":"Search tools…","tools.status":"Status","tools.status.disabled":"disabled","tools.status.enabled":"enabled","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} enabled`,"tools.title":"Tools","tools.update.disable":"Disable","tools.update.enable":"Enable","tools.updating":"Updating...","tool.collapse":"▲ Collapse","tool.expand":"Expand","tool.collapseHint":"Collapse","tool.status.failed":"Failed","toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`Ran ${(e==null?void 0:e.count)??0} tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.editedFiles":e=>`Edited ${(e==null?void 0:e.count)??0} file${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.ranCommands":e=>`Ran ${(e==null?void 0:e.count)??0} command${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.readFiles":e=>`Read ${(e==null?void 0:e.count)??0} file${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.searched":e=>`Searched ${(e==null?void 0:e.count)??0} time${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.updatedTodos":e=>`Updated task list${(e==null?void 0:e.count)===1?"":` ${(e==null?void 0:e.count)??0} times`}`,"toolGroup.summary.provideInformation":"Provide information","toolGroup.summary.askedQuestions":e=>`Asked ${(e==null?void 0:e.count)??0} question${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.otherTools":e=>`Called ${(e==null?void 0:e.count)??0} other tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.running":e=>`Running ${(e==null?void 0:e.name)??"tool"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · ${(e==null?void 0:e.count)??0} tools`:""}`,"toolGroup.runningPrefix":"Running","thinking.expand":"Expand thinking","thinking.collapse":"Collapse thinking","thinking.running":e=>`Thinking${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.doneBriefly":"Thought briefly","thinking.done":e=>e!=null&&e.duration?`Thought for ${e.duration}`:"Done thinking","thinking.translate":"Translate","thinking.translation":"Translated thinking","thinking.translating":"Translating...","thinking.translationThinking":"Thinking...","thinking.translationFailed":"Translation failed","thinking.retranslate":"Translate again","thinking.cancelTranslation":"Cancel","thinking.closeTranslation":"Close","thinking.inputTokens":e=>`Input tokens: ${(e==null?void 0:e.count)??"--"}`,"thinking.outputTokens":e=>`Output tokens: ${(e==null?void 0:e.count)??"--"}`,"sessionsOverview.count":e=>`${(e==null?void 0:e.count)??0} sessions`,"sessionsOverview.current":"Current","sessionsOverview.empty":"No sessions yet","sessionsOverview.loadFailed":"Failed to load sessions","sessionsOverview.loading":"Loading sessions…","sessionsOverview.openElsewhere":"Currently open in another window","sessionsOverview.openInSplit":"Open in split","sessionsOverview.openInSplitHint":"Show the selected sessions side by side in this window","sessionsOverview.openInTab":"Open in new tab","sessionsOverview.openInTabHint":"Open the selected sessions as a split view in a new browser tab","sessionsOverview.popupBlocked":"Pop-up blocked. Allow pop-ups for this site to open sessions in new tabs.","sessionsOverview.refresh":"Refresh","sessionsOverview.selectAll":"Select all","sessionsOverview.splitCap":e=>`Only the first ${(e==null?void 0:e.max)??6} selected sessions will open in the split.`,"sessionsOverview.selectSession":e=>`Select ${(e==null?void 0:e.name)??""}`,"sessionsOverview.status.idle":"Idle","sessionsOverview.status.needsApproval":"Needs approval","sessionsOverview.status.running":"Running","sessionsOverview.title":"Session Overview","splitView.title":"Split View","splitView.count":e=>`${(e==null?void 0:e.count)??0} panes`,"splitView.addPane":"Add session","splitView.closePane":"Close pane","splitView.maximizePane":"Maximize pane","splitView.restorePane":"Restore pane","splitView.morePaneActions":"More pane actions","splitView.defaultActionLabel":"Action","splitView.paneError":"This session pane hit an error","splitView.paneConnectionError":"Connection lost","splitView.outerApprovalPending":"Your main session is waiting for approval.","splitView.goToApproval":"Go to it","splitView.empty":"No sessions in the split. Add one to get started.","splitView.composerPlaceholder":"Message this session…","settings.title":"Settings","channels.title":"Channels","channels.summary":e=>`${(e==null?void 0:e.workspace)??""} · ${(e==null?void 0:e.count)??0} configured`,"channels.workspace.current":"Current workspace","channels.loading":"Loading channels","channels.configured":"Configured channels","channels.availablePlatforms":"Available platforms","channels.availablePlatforms.description":"Channel management is currently available for these platforms only.","channels.platform.available":"Available","channels.platform.configure":"Configure","channels.platform.configureNamed":e=>`Configure ${(e==null?void 0:e.platform)??"Channel"}`,"channels.status.stopped":"Stopped","channels.status.starting":"Starting","channels.status.connected":"Connected","channels.status.partial":"Partially connected","channels.status.error":"Error","channels.startsWithServe":"Start with serve","channels.unsupported.title":"Channel management is not supported","channels.unsupported.description":"Update Qwen Code to a version that supports Channel management.","channels.readOnly.title":"Channel management is read-only","channels.readOnly.description":"Restart Qwen Code with a bearer token to control channels.","channels.loadError.title":"Channels could not be loaded","channels.empty.title":"No supported channels configured","channels.empty.description":"Configure DingTalk, WeCom, or Feishu to receive messages in this workspace.","channels.runtimeError":"Channel runtime error","channels.action.back":"Back","channels.action.start":"Start","channels.action.stop":"Stop","channels.action.restart":"Restart","channels.action.retry":"Retry","channels.action.edit":"Edit","channels.action.editNamed":e=>`Edit ${(e==null?void 0:e.name)??"Channel"}`,"channels.action.delete":"Delete","channels.action.deleteNamed":e=>`Delete ${(e==null?void 0:e.name)??"Channel"}`,"channels.action.startWithServeNamed":e=>`Start ${(e==null?void 0:e.name)??""} with serve`,"channels.delete.title":e=>`Delete ${(e==null?void 0:e.name)??"Channel"}?`,"channels.delete.description":"The Channel will be stopped and removed from this workspace. This action cannot be undone.","channels.delete.error":"Channel was not deleted","channels.editor.addTitle":e=>`Configure ${(e==null?void 0:e.platform)??"Channel"}`,"channels.editor.editTitle":e=>`Edit ${(e==null?void 0:e.platform)??"Channel"}`,"channels.editor.addDescription":"Connect this workspace with an existing platform application.","channels.editor.editDescription":"Update public settings or explicitly change stored credentials.","channels.editor.section.identity":"Identity","channels.editor.section.credentials":"Credentials","channels.editor.section.access":"Access policy","channels.editor.instanceName":"Instance name","channels.editor.instanceNamePlaceholder":"e.g. release-bot","channels.editor.environmentReference":"$ENV_VAR supported","channels.editor.field.dingtalk.clientId":"Client ID (AppKey)","channels.editor.field.dingtalk.clientSecret":"Client Secret (AppSecret)","channels.editor.field.wecom.botId":"Bot ID","channels.editor.field.wecom.secret":"Bot Secret","channels.editor.field.wecom.wsUrl":"WebSocket URL","channels.editor.field.feishu.clientId":"App ID","channels.editor.field.feishu.clientSecret":"App Secret","channels.editor.secret.environment":"Stored in environment","channels.editor.secret.stored":"Stored securely","channels.editor.secret.preserve":"Keep","channels.editor.secret.replace":"Replace","channels.editor.secret.clear":"Clear","channels.editor.secret.placeholder":e=>`Enter ${(e==null?void 0:e.label)??"secret"}`,"channels.editor.secret.clearHint":"This credential will be removed when you save.","channels.editor.policy.pairing.title":"Pairing","channels.editor.policy.pairing.description":"People receive a pairing code and can chat after you approve them.","channels.editor.pairing.title":"Pending requests","channels.editor.pairing.description":"Match the code shared by the person before approving access. Approvals take effect immediately; Save and Cancel do not undo them.","channels.editor.pairing.refresh":"Refresh pairing requests","channels.editor.pairing.approve":"Approve","channels.editor.pairing.approveFor":e=>`Approve ${(e==null?void 0:e.sender)??"request"}, code ${(e==null?void 0:e.code)??""}`,"channels.editor.pairing.approved":e=>`${(e==null?void 0:e.sender)??"This person"} can now use this Channel.`,"channels.editor.pairing.error":"Pairing requests were not updated","channels.editor.pairing.unavailable":"Pairing requests are temporarily unavailable. Try again.","channels.editor.pairing.retry":"Try again","channels.editor.pairing.empty.title":"No pending requests","channels.editor.pairing.empty.description":"New requests appear here after someone messages the bot.","channels.editor.pairing.saveFirst.title":"Save pairing mode first","channels.editor.pairing.saveFirst.description":"Pending requests will appear here after this Channel is saved in pairing mode.","channels.editor.pairing.approvals.title":"Pairing approvals","channels.editor.pairing.approvals.description":"Sender IDs approved through pairing for this Channel.","channels.editor.pairing.approvals.refresh":"Refresh pairing approvals","channels.editor.pairing.approvals.revoke":"Revoke","channels.editor.pairing.approvals.revokeFor":e=>`Revoke ${(e==null?void 0:e.senderId)??"pairing approval"}`,"channels.editor.pairing.approvals.revoked":e=>`Pairing approval for ${(e==null?void 0:e.senderId)??"this sender"} was revoked.`,"channels.editor.pairing.approvals.error":"Pairing approvals were not updated","channels.editor.pairing.approvals.unavailable":"Pairing approvals are temporarily unavailable. Try again.","channels.editor.pairing.approvals.empty.title":"No pairing approvals","channels.editor.pairing.approvals.empty.description":"Approved sender IDs will appear here.","channels.editor.pairing.approvals.confirm.title":e=>`Revoke pairing approval for ${(e==null?void 0:e.senderId)||"this sender"}?`,"channels.editor.pairing.approvals.confirm.description":"Only the approval created through pairing will be removed. Access configured in the Channel allowlist is not changed.","channels.editor.pairing.approvals.confirm.action":"Revoke approval","channels.editor.pairing.allowlist.title":"Configured allowlist","channels.editor.pairing.allowlist.description":"Configured allowlist users remain allowed after a pairing approval is revoked.","channels.editor.policy.open.title":"Open","channels.editor.policy.open.description":"Anyone who can reach the bot can start a conversation.","channels.editor.validation.required":e=>`${(e==null?void 0:e.label)??"This field"} is required.`,"channels.editor.validation.duplicate":"A Channel with this name already exists.","channels.editor.validation.invalidName":"Choose a different instance name.","channels.editor.validation.number":"Enter a valid number.","channels.editor.validation.policy":"Choose an access policy.","channels.editor.saveError":"Changes were not saved","channels.editor.reloadLatest":"Reload latest","channels.editor.cancel":"Cancel","channels.editor.save":"Save","settings.loading":"Loading settings...","settings.empty":"No settings available.","settings.footer":"↑↓ Navigate  Enter Toggle  Tab Scope  r Reload  ESC Close","settings.footer.edit":"Enter Save  ESC Cancel","settings.footer.theme":"↑↓ Navigate  Enter Select  ESC Back","settings.scope.user":"User","settings.scope.workspace":"Workspace","settings.value.on":"ON","settings.value.off":"OFF","settings.action.edit":"Edit","settings.action.select":"Select","settings.action.save":"Save","settings.modifiedIn":e=>`(Modified in ${(e==null?void 0:e.scope)??""})`,"settings.alsoModifiedIn":e=>`(Also modified in ${(e==null?void 0:e.scope)??""})`,"settings.invalidNumber":"Invalid number","settings.requiresRestart":"This change requires a restart to take effect.","settings.models.title":"Models","settings.models.add":"+ Add Model","settings.models.setCurrent":"Set current","settings.models.current":"Current","settings.models.runtime":"Runtime","settings.models.delete":"Delete","settings.models.confirmDelete":"Confirm","settings.models.cancel":"Cancel","settings.models.empty":"No configured models yet.","settings.models.loading":"Loading models…","settings.models.deleteFailed":"Failed to delete model","settings.models.fallbacks.title":"Model Fallbacks","settings.models.fallbacks.hint":e=>`Select up to ${(e==null?void 0:e.max)??3}; tried in order when the main model is at capacity.`,"settings.models.fallbacks.confirm":"Confirm","settings.models.fallbacks.empty":"No selectable models.","settings.models.fallbacks.saveFailed":"Failed to save fallback models","settings.models.fallbacks.limitReached":e=>`Maximum of ${(e==null?void 0:e.max)??3} fallback models selected; deselect one to choose another.`,"settings.corrupted":e=>`Settings file was corrupted${(e==null?void 0:e.recovered)==="true"?" (recovered from backup)":""}`,"settings.label.ui.chatWidth":"Chat width","settings.description.ui.chatWidth":"Frontend-only chat content width. Stored in this browser.","settings.option.ui.chatWidth.1000":"Regular","settings.option.ui.chatWidth.wide":"Ultra wide","settings.label.visionModel":"Vision Model","settings.description.visionModel":"Image-capable model used as the vision bridge. Leave empty to auto-select.","welcome.changeModel":"(/model to change)","welcome.defaultModel":"unknown model","welcome.modeHint":"Shift+Tab or /approval-mode","welcome.prompt":"What would you like to do?","welcome.titlePrefix":"Welcome to","welcome.tipLabel":"Tips:"},mSe={...nD,"git.currentBranch":e=>`当前 Git 分支：${(e==null?void 0:e.branch)??""}`,"git.detached":"游离 HEAD","git.clean":"工作区干净","git.operation.merge":"合并中","git.operation.rebase":"变基中","git.operation.cherry-pick":"拣选中","git.operation.revert":"回退中","git.operation.bisect":"二分中","git.conflicted":e=>`${(e==null?void 0:e.count)??0} 个冲突`,"git.staged":e=>`${(e==null?void 0:e.count)??0} 已暂存`,"git.unstaged":e=>`${(e==null?void 0:e.count)??0} 已修改`,"git.untracked":e=>`${(e==null?void 0:e.count)??0} 未跟踪`,"git.ahead":e=>`领先 ${(e==null?void 0:e.count)??0}`,"git.behind":e=>`落后 ${(e==null?void 0:e.count)??0}`,"git.stash":e=>`${(e==null?void 0:e.count)??0} 个 stash`,"branchPicker.label":"Git","branchPicker.search":"搜索分支和操作","branchPicker.loading":"加载分支中…","branchPicker.noBranches":"无分支","branchPicker.noTags":"无标签","branchPicker.action.pull":"更新项目","branchPicker.action.push":"推送","branchPicker.action.commit":"提交","branchPicker.action.newBranch":"新建分支…","branchPicker.action.checkoutRef":"检出标签或修订…","branchPicker.action.viewChanges":"查看变更","branchPicker.newBranchPlaceholder":"分支名称","branchPicker.invalidBranchName":"无效的分支名称 — 避免空格、~、^、:、? * 以及以 - 开头","branchPicker.checkoutRefPlaceholder":"标签名或提交 SHA","branchPicker.section.recent":"最近","branchPicker.section.local":"本地","branchPicker.section.remote":"远程","branchPicker.section.tags":"标签","branchPicker.checkedOut":e=>`已检出 ${(e==null?void 0:e.branch)??""}`,"branchPicker.createdBranch":e=>`已创建分支 ${(e==null?void 0:e.branch)??""}`,"branchPicker.pushSuccess":"推送成功","branchPicker.pullSuccess":"更新成功","gitCommit.title":"提交","gitCommit.messagePlaceholder":"提交信息（⌘/Ctrl+Enter 提交）","gitCommit.generating":"正在生成提交信息…","gitCommit.genFailed":"自动生成失败 — 请手动输入提交信息","gitCommit.prLogUnavailable":"无法加载所选目标分支的提交记录。","gitCommit.prPushFirst":"请先将分支推送到远程仓库，再创建合并请求。","gitCommit.commit":"提交","gitCommit.commitAndPush":"提交并推送","gitCommit.createPr":"创建合并请求","gitCommit.prTitlePlaceholder":"合并请求标题","gitCommit.prBodyPlaceholder":"描述（可选）","gitCommit.prEdit":"编辑","gitCommit.prPreview":"预览","gitCommit.prSubmit":"创建","gitCommit.prCreated":e=>`合并请求 #${(e==null?void 0:e.number)??""} 已创建`,"gitCommit.commitSuccess":e=>`已提交 ${(e==null?void 0:e.sha)??""}`,"gitCommit.commitPushSuccess":e=>`已提交并推送 ${(e==null?void 0:e.sha)??""}`,"gitCommit.commitSuccessPushFailed":e=>`已提交 ${(e==null?void 0:e.sha)??""} — 推送失败：${(e==null?void 0:e.error)??"未知错误"}`,"branchSelect.baseBranch":"目标分支","branchSelect.search":"搜索分支…","branchSelect.loading":"加载中…","branchSelect.noMatches":"无匹配","branchSelect.error":"分支加载失败","branchSelect.retry":"重试","branchSelect.local":"本地","gitDiff.title":"变更","gitDiff.summary":e=>`${(e==null?void 0:e.count)??0} 个文件 · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitDiff.loading":"加载变更中…","gitDiff.empty":"工作区无变更","gitDiff.unavailable":"此工作区无 Git","gitDiff.error":"加载变更失败","gitDiff.binary":"二进制","gitDiff.untracked":"未跟踪","gitDiff.deleted":"已删除","gitDiff.noDiff":"无差异可显示","gitDiff.fileError":"加载此差异失败","gitDiff.truncated":"差异已截断——文件过大，未完整显示","gitDiff.hidden":e=>`还有 ${(e==null?void 0:e.count)??0} 个文件未显示`,"gitDiff.expand":e=>`显示 ${(e==null?void 0:e.path)??"文件"} 的变更`,"gitDiff.collapse":e=>`隐藏 ${(e==null?void 0:e.path)??"文件"} 的变更`,"gitMode.title":"Git 模式","gitMode.current":"当前分支","gitMode.currentDesc":e=>`直接在 ${(e==null?void 0:e.branch)??"main"} 上开发`,"gitMode.branch":"新建分支","gitMode.branchDesc":e=>`从 ${(e==null?void 0:e.branch)??"main"} 创建新分支`,"gitMode.branchPlaceholder":"feat/my-feature","gitMode.branchLabel":"分支名","gitMode.branchConflictWarning":"同一 workspace 同时只能有一个分支会话","gitMode.branchHint":"在工作目录中切换到新分支","gitMode.branchInvalidName":"分支名不合法","gitMode.worktree":"Worktree 隔离","gitMode.worktreeDesc":"独立副本 · 可并行","gitMode.confirmBranch":"创建分支","gitMode.confirmWorktree":"创建 Worktree","gitMode.resetToCurrent":"恢复当前分支","gitLog.title":"提交历史","gitLog.subtitle":e=>`${(e==null?void 0:e.count)??0} 条提交`,"gitLog.loading":"加载历史中…","gitLog.empty":"暂无提交","gitLog.unavailable":"此工作区不可用 Git","gitLog.error":"加载历史失败","gitLog.loadMore":"加载更多","gitLog.loadingMore":"加载中…","gitLog.files":e=>`${(e==null?void 0:e.count)??0} 个文件 · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitLog.detailError":"加载提交详情失败","gitLog.hidden":e=>`还有 ${(e==null?void 0:e.count)??0} 个文件未显示`,"gitLog.copySha":e=>`复制提交 ${(e==null?void 0:e.sha)??""}`,"githubPrs.title":"拉取请求","githubPrs.subtitle":e=>`${(e==null?void 0:e.count)??0} 个开放`,"githubPrs.loading":"加载拉取请求中…","githubPrs.empty":"没有开放的拉取请求","githubPrs.unavailable":"当前工作区不是 git 仓库","githubPrs.error":"加载拉取请求失败","githubPrs.cliUnavailable":"daemon 所在主机未安装 GitHub CLI(gh)。\n请先安装并运行 `gh auth login`,然后重试。","githubPrs.reviewApproved":"已批准","githubPrs.reviewChanges":"要求修改","githubPrs.reviewRequired":"需要审查","githubPrs.checksPassing":"检查通过","githubPrs.checksFailing":"检查失败","githubPrs.checksPending":"检查进行中","githubPrs.open":e=>`在 GitHub 上打开拉取请求 #${(e==null?void 0:e.number)??""}`,"workspace.paneLabel":e=>`工作区：${(e==null?void 0:e.name)??""}`,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.zoom_image":"图片放大","toolName.grep":"搜索内容","toolName.grep_search":"搜索内容","toolName.glob":"Glob","toolName.run_shell_command":"运行命令","toolName.todo_write":"任务清单","toolName.get_goal":"目标","toolName.update_goal":"更新目标","toolName.save_memory":"保存记忆","toolName.agent":"Agent","toolName.skill":"查看技能","toolName.enter_plan_mode":"进入计划模式","toolName.exit_plan_mode":"退出计划模式","toolName.web_fetch":"网络搜索","toolName.webfetch":"网络搜索","toolName.fetch":"网络搜索","toolName.web_search":"网络搜索","toolName.list_directory":"列出文件","toolName.lsp":"LSP","toolName.ask_user_question":"询问用户","toolName.cron_create":"创建定时任务","toolName.cron_list":"定时任务列表","toolName.cron_delete":"删除定时任务","toolName.task_create":"创建任务","toolName.task_update":"更新任务","toolName.task_list":"任务列表","toolName.task_stop":"停止任务","toolName.team_create":"创建团队","toolName.team_delete":"删除团队","toolName.send_message":"发送消息","toolName.list_agents":"列出 Agent","toolName.structured_output":"结构化输出","toolName.monitor":"监控","toolName.notebook_edit":"编辑 Notebook","toolName.tool_search":"工具搜索","toolName.enter_worktree":"进入 Worktree","toolName.exit_worktree":"退出 Worktree","toolName.workflow":"工作流","toolName.team_plan_approval":"团队计划审批","toolName.loop_wakeup":"循环唤醒","toolName.create_sub_session":"创建子会话","toolName.read_mcp_resource":"读取 MCP 资源","toolName.artifact":"制品","toolName.record_artifact":"记录制品","toolName.image_gen":"生成图片","toolName.bash":"运行命令","toolName.shell":"Shell 命令","toolName.read":"读取文件","toolName.readfile":"读取文件","toolName.write":"写入文件","toolName.writefile":"写入文件","toolName.search":"搜索内容","toolName.todowrite":"任务清单","toolName.savememory":"保存记忆","toolName.askuserquestion":"询问用户","toolName.toolsearch":"工具搜索","about.auth":"认证","about.baseUrl":"Base URL","about.fastModel":"快速模型","about.memoryUsage":"内存使用","about.model":"模型","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"操作系统","about.proxy":"代理","about.qwenCode":"Qwen Code","about.runtime":"运行环境","about.sandbox":"沙箱","about.sessionId":"会话 ID","about.title":"状态","agent.back":"返回","agent.builtInBadge":"（内置）","agent.action.delete":"删除智能体","agent.action.edit":"编辑智能体","agent.action.view":"查看智能体","agent.chooseAction":e=>`选择操作：${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"选择操作","agent.colorLabel":"颜色：","agent.colorUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的颜色`,"agent.create":"创建新的智能体","agent.create.button":"创建智能体","agent.create.confirm":"确认并保存","agent.create.desc":"创建新的智能体","agent.create.descPlaceholder":"这个智能体做什么？","agent.create.describeAgent":"描述需求","agent.create.description":"描述","agent.create.editAgain":"编辑","agent.create.enterDescription":"输入描述","agent.create.enterName":"输入子智能体名称","agent.create.enterPrompt":"输入系统提示词","agent.create.generateFailed":e=>`生成子智能体失败：${(e==null?void 0:e.error)??"未知错误"}`,"agent.create.generate":"生成","agent.create.generatedDescription":"描述","agent.create.generatedSystemPrompt":"系统提示词","agent.create.generatingConfig":"正在生成子智能体配置...","agent.create.generatingPrompt":"生成中...","agent.create.loading":"创建中...","agent.create.location":"选择位置","agent.create.method":"选择生成方式","agent.create.method.manual":"手动创建","agent.create.method.qwen":"使用 Qwen Code 生成","agent.create.method.qwen.recommended":"使用 Qwen Code 生成（推荐）","agent.create.method.qwen.desc":"LLM 生成描述和系统提示词","agent.create.name":"名称","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"输入此子智能体清晰且唯一的名称。","agent.create.project":"项目","agent.create.project.cli":"工作区","agent.create.project.desc":"创建项目级智能体","agent.create.prompt":"系统提示词","agent.create.promptPlaceholder":"你是一个专门的智能体...","agent.create.promptPlaceholder.cli":"例如：你是一名专业的代码审查员...","agent.create.promptHelp":"编写定义此子智能体行为的系统提示词。为了获得最佳效果，请全面描述。","agent.create.preview":"预览","agent.create.qwenHint":"说明职责、使用场景和重要约束，然后分别生成各项内容。","agent.create.qwenPlaceholder":"> 例如：专业的代码审查员，根据最佳实践审查代码...","agent.create.regenerate":"重新生成草稿","agent.create.required":"名称、描述和系统提示词均为必填项。","agent.create.tools":"允许的工具","agent.create.toolsHelp":"使用逗号或换行分隔 canonical 工具名称；MCP 工具使用 mcp__server__tool，留空表示继承全部工具。","agent.create.disallowedTools":"禁用的工具","agent.create.model":"模型","agent.create.approvalMode":"审批模式","agent.create.maxTurns":"最大执行轮次","agent.create.maxTurnsHelp":"限制智能体完成单次任务时的模型调用轮数，达到上限后将停止执行。留空表示不设置智能体层级的限制。","agent.create.maxTurnsInvalid":"最大执行轮次必须是正整数。","agent.create.mcpServers":"MCP Server","agent.create.mcpServers.empty":"暂无可用的 MCP Server。","agent.create.mcpServers.select":"选择 MCP Server","agent.create.mcpServers.noneSelected":"尚未选择 MCP Server。","agent.create.modelGenerate":"模型生成","agent.create.modelGenerate.description":"描述你的需求，然后分别生成并检查描述和系统提示词。","agent.create.color":"颜色","agent.create.jsonObjectHelp":"请输入 JSON 对象，或留空。","agent.create.save":"保存智能体","agent.create.scope":"类别","agent.create.manualDescHelp":"描述此子智能体应该在何时以及如何使用。","agent.create.manualDescPlaceholder":"例如：根据最佳实践和潜在 bug 审查代码。","agent.create.tools.builtin":"内置工具","agent.create.tools.empty":"暂无可用工具。","agent.create.tools.mcp":"MCP 工具","agent.create.tools.type":"工具类型","agent.create.tools.selectServer":"选择 MCP Server","agent.create.tools.selectTool":"选择工具","agent.create.tools.noneSelected":"尚未选择工具。","agent.create.tools.initializing":"正在初始化工具目录...","agent.create.tools.preheatFailed":"ACP 预热未完成。","agent.create.tools.loadFailed":"内置工具加载失败。","agent.create.removeSelection":e=>`移除 ${(e==null?void 0:e.name)??""}`,"agent.create.toolsSelectHelp":"选择此子智能体可以使用的工具；全部不选表示继承所有工具。","agent.create.toolsSelection":"选择工具","agent.create.tools.all":"所有工具","agent.create.tools.allDefault":"所有工具（默认）","agent.create.tools.allInfo":"已选择所有工具，包括 MCP 工具","agent.create.tools.allInfoFallback":"已选择所有工具，包括 MCP 工具","agent.create.tools.editLabel":"• 编辑工具:","agent.create.tools.executionLabel":"• 执行工具:","agent.create.tools.none":"（无）","agent.create.tools.readEdit":"读取和编辑工具","agent.create.tools.readEditExecute":"读取、编辑和执行工具","agent.create.tools.readOnlyLabel":"• 只读工具:","agent.create.tools.readOnly":"只读工具","agent.create.tools.selected":"已选择的工具:","agent.create.user":"用户","agent.create.user.cli":"全局","agent.create.user.desc":"创建用户级智能体","agent.create.useGenerated":"确认使用","agent.approval.inherit":"默认","agent.approval.default":"默认审批","agent.approval.plan":"仅规划","agent.approval.auto-edit":"自动批准编辑","agent.approval.yolo":"自动批准所有操作","agent.approval.bubble":"气泡审批","agent.approval.desc.inherit":"使用智能体默认的审批规则。","agent.approval.desc.bubble":"将工具审批请求转交给父会话处理。","agent.createFirstHint":"使用 '/agents create' 创建第一个智能体。","agent.created":e=>`已创建 ${(e==null?void 0:e.name)??""}`,"agent.edit.save":"保存修改","agent.updated":e=>`已更新 ${(e==null?void 0:e.name)??""}`,"agent.turnsBadge":e=>`${(e==null?void 0:e.count)??0} 轮`,"agent.delete":"删除","agent.delete.confirm":e=>`确定要删除 "${(e==null?void 0:e.name)??""}" 吗？`,"agent.delete.loading":"删除中...","agent.delete.no":"否","agent.delete.title":e=>`删除 ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"是，删除","agent.deleted":e=>`已删除 ${(e==null?void 0:e.name)??""}`,"agent.edit":"编辑","agent.edit.color":"编辑颜色","agent.edit.tools":"编辑工具","agent.editColorTitle":e=>`编辑颜色：${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`编辑 ${(e==null?void 0:e.name)??""}`,"agent.empty":"未找到智能体。","agent.noMatches":"未找到匹配的智能体。","agent.footer.back":"Esc 返回","agent.footer.cliBack":"Enter 选择 · ↑↓ 导航 · Esc 返回","agent.footer.cliSelect":"Enter 选择 · ↑↓ 导航 · Esc 关闭","agent.footer.close":"Esc 关闭","agent.footer.deleteConfirm":"Enter 确认，Esc 取消","agent.footer.enterNext":"按 Enter 继续，Esc 返回","agent.footer.generating":"Esc 取消","agent.footer.createLocation":"按 Enter 继续，↑↓ 导航，Esc 取消","agent.footer.createContinue":"按 Enter 继续，↑↓ 导航，Esc 返回","agent.footer.final":"按 Enter 保存，e 保存并编辑，Esc 返回","agent.footer.nav":"↑↓ 导航 · Enter 选择 · Esc 返回","agent.footer.navBack":"↑↓ 导航 · Enter 选择 · Esc 返回","agent.footer.navSelect":"↑↓ 导航 · Enter 选择 · Esc 关闭","agent.footer.viewerBack":"Esc 返回","agent.filePathLabel":"文件路径：","agent.label":"智能体","agent.location":"位置","agent.level.builtin":"内置","agent.level.extension":"扩展","agent.level.project":"项目","agent.level.user":"用户","agent.level.filter":"按智能体级别筛选","agent.manage":"管理","agent.manage.desc":"管理已有智能体","agent.modelLabel":"模型：","agent.overriddenBadge":"（已被项目级智能体覆盖）","agent.readonly":"该智能体是只读的。","agent.select":"请选择一个智能体。","agent.selectAction":"选择操作","agent.descriptionLabel":"描述：","agent.systemPromptLabel":"系统提示词：","agent.level.label":"级别","agent.step":e=>`步骤 ${(e==null?void 0:e.n)??""}`,"agent.tools":"工具","agent.toolsLabel":"工具：","agent.detail.overview":"基本信息","agent.detail.tools":"工具","agent.detail.mcp":"MCP","agent.detail.hooks":"Hooks","agent.detail.systemPrompt":"系统提示词","agent.toolsUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的工具`,"agent.usingCount":e=>`使用中：${(e==null?void 0:e.count)??0} 个智能体`,"agent.view":"查看","agents.closed":"智能体面板已关闭。","agents.title":"智能体","subagent.result":"结果","subagent.tools":e=>`工具 (${(e==null?void 0:e.count)??0})`,"subagent.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"subagent.toggleStream":"展开/收起子智能体详情","subagent.pending":"等待中","subagent.running":"运行中","subagent.background":"后台任务","subagent.completed":"已完成","subagent.failed":"失败","subagent.cancelled":"已取消","subagent.paused":"已暂停","subagent.detailsLoading":"正在加载子智能体详情…","subagent.detailsLoadFailed":"子智能体详情加载失败。","timeline.parallelAgents":"并行智能体","timeline.thinking":"思考","timeline.assistantUpdate":"助手更新","timeline.toolCalls":e=>`${(e==null?void 0:e.count)??0} 个工具调用`,"timeline.planUpdate":"计划更新","timeline.statusUpdate":"状态更新","timeline.userTurn":"用户轮次","timeline.planDetail":"计划更新","timeline.parallelAgentsDetail":e=>`${(e==null?void 0:e.count)??0} 个并行智能体`,"timeline.noActivity":"无活动","timeline.sessionTimeline":"会话时间线","timeline.turnPrefix":e=>`第 ${(e==null?void 0:e.index)??0} 轮`,"timeline.currentTurn":"当前轮次","timeline.kind.thought":"思考","timeline.kind.commentary":"助手更新","timeline.kind.tool":"工具调用","timeline.kind.agents":"并行智能体","timeline.kind.plan":"计划更新","timeline.kind.status":"状态更新","timeline.kind.none":"轮次","common.copy":"复制","common.open":"打开","common.na":"不适用","common.server":"服务器","common.agent":"智能体","common.auto":"自动","common.runtime":"运行时","common.failedToLoad":"加载失败","auth.notSet":"（未设置）","auth.apiKeyPlaceholder":"sk-...","auth.modelsPlaceholder":"模型ID-1, 模型ID-2","model.usingModel":e=>`正在使用${e!=null&&e.isRuntime?"运行时":""}模型：${(e==null?void 0:e.modelId)??""}`,"mermaid.label":"mermaid","mermaid.errorLabel":"mermaid（错误）","user.uploadedImage":e=>`用户上传的图片 ${(e==null?void 0:e.index)??1}`,"voice.noSpeech":"未检测到语音。","voice.stopDictation":"停止语音输入","voice.transcribing":"正在转录…","voice.starting":"正在启动…","voice.errorRetry":e=>`语音错误 — 点击重试${e!=null&&e.message?`：${e.message}`:""}`,"voice.noSpeechRetry":"未检测到语音 — 点击重试","voice.startDictation":"开始语音输入","voice.error":"语音错误","resume.failedToLoad":"加载会话失败","toast.dismiss":"关闭通知","toast.dismissShort":"关闭","insight.ready":"Insight 报告已生成！","request.cancelled":"请求已取消。","approval.execQuestion":e=>`允许执行：'${(e==null?void 0:e.tool)??""}'？`,"approval.changeQuestion":"是否继续？","approval.launchAgentQuestion":"启动这个 agent？","approval.option.allowOnce":"是，允许一次","approval.option.allowOnceAndSwitchToDefault":"允许一次并切换到默认模式","approval.option.rejectOnce":"拒绝","approval.option.allowAllEdits":"允许所有编辑","approval.option.allowAlwaysProject":"项目内始终允许","approval.option.allowAlwaysUser":"对此用户始终允许","approval.option.allowAlwaysServer":"对此服务始终允许","approval.option.allowAlwaysTool":"对此工具始终允许","assistant.branch":"分叉","assistant.copy":"复制","at.category.extensions":"扩展","at.category.extensions.description":"引用已启用扩展","at.category.files":"文件","at.category.files.description":"引用工作区文件","at.category.mcpResources":"MCP 资源","at.category.mcpResources.description":"引用 MCP server 资源","at.menu":"引用菜单","common.back":"返回","common.all":"全部","common.add":"添加","common.cancel":"取消","common.close":"关闭","common.fullscreen":"全屏","common.exitFullscreen":"退出全屏","common.continue":"继续","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","common.retry":"重试","common.save":"保存","common.navigate":"↑↓ 导航","common.next":"下一步","common.noResults":"无结果","common.previous":"上一步","common.expand":"展开","common.collapse":"收起","common.refresh":"刷新","common.search":"搜索","common.valid":"有效","common.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"agent.count":e=>`${(e==null?void 0:e.count)??0} 个智能体`,"askUser.submit":"提交","askUser.submitting":"提交中...","askUser.submitFailed":"提交回答失败","askUser.submitOptionUnavailable":"提交选项不可用","askUser.ignore":"忽略","askUser.multiHint":"可多选","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} 个问题`,"askUser.selectAnswer":"选择一个答案","askUser.typePlaceholder":"输入内容...","copy.failedFallback":"复制到剪贴板失败","copy.inlineLatexMissing":"最后一条 AI 输出中没有匹配的行内 LaTeX 表达式。","copy.latexMissing":"最后一条 AI 输出中没有匹配的 LaTeX 块。","copy.noOutput":"历史记录中没有可复制的输出","copy.noText":"最后一条 AI 输出没有可复制的文本。","copy.codeMissing":"最后一条 AI 输出中没有匹配的代码块。","copy.outputCopied":"已复制最后一条输出到剪贴板","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"内容"} 已复制到剪贴板`,"code.copy":"复制","code.copied":"已复制！","echartsChart.noData":"暂无数据","echartsChart.tableNotice":e=>{const t=Number((e==null?void 0:e.omittedRows)??0),n=Number((e==null?void 0:e.omittedColumns)??0);return t>0&&n>0?`显示 ${(e==null?void 0:e.visibleRows)??0}/${(e==null?void 0:e.totalRows)??0} 行，${(e==null?void 0:e.visibleColumns)??0}/${(e==null?void 0:e.totalColumns)??0} 列`:n>0?`显示 ${(e==null?void 0:e.visibleColumns)??0}/${(e==null?void 0:e.totalColumns)??0} 列`:`显示 ${(e==null?void 0:e.visibleRows)??0}/${(e==null?void 0:e.totalRows)??0} 行`},"echartsChart.rendering":"正在渲染图表","echartsChart.renderFailed":"图表渲染失败。","echartsChart.viewMode":"视图模式","echartsChart.showChart":"显示图表","echartsChart.showData":"显示数据","echartsChart.chart":"图表","echartsChart.data":"数据","markdownTable.blank":"(空白)","markdownTable.column":e=>`第 ${(e==null?void 0:e.index)??""} 列`,"markdownTable.rows":e=>`共${(e==null?void 0:e.count)??0}行`,"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} 行`,"markdownTable.hint":"点击表头排序，点击 ▾ 打开筛选。","markdownTable.filtersActive":e=>`${(e==null?void 0:e.count)??0} 个筛选`,"markdownTable.selection.selected":"已选","markdownTable.selection.nonEmpty":"非空","markdownTable.selection.numeric":"数值","markdownTable.selection.sum":"求和","markdownTable.selection.average":"平均","markdownTable.selection.min":"最小","markdownTable.selection.max":"最大","markdownTable.copyTsv":"复制 TSV","markdownTable.copyTsvHint":"复制为 TSV，可粘贴到 Excel 等表格应用","markdownTable.copyVisible":"复制表格","markdownTable.customColumns":"自定义列","markdownTable.customColumns.tableSection":"显示在表格列的信息","markdownTable.customColumns.detailSection":"显示在折叠面板的信息","markdownTable.customColumns.toggleAllTable":"切换全部表格列","markdownTable.customColumns.toggleAllDetails":"切换全部折叠面板字段","markdownTable.customColumns.reset":"重置","markdownTable.customColumns.noDetails":"未选择折叠面板字段","markdownTable.freezeFirstColumn":"冻结首列","markdownTable.unfreezeFirstColumn":"取消冻结首列","markdownTable.densityLabel":"表格密度","markdownTable.densityCurrent":e=>`${(e==null?void 0:e.density)??""}密度`,"markdownTable.density":e=>`密度：${(e==null?void 0:e.density)??""}`,"markdownTable.density.standard":"标准","markdownTable.density.compact":"紧凑","markdownTable.density.comfortable":"舒适","markdownTable.expandLongText":"展开文本","markdownTable.collapseLongText":"收起文本","markdownTable.emptyValue":"(空白)","markdownTable.hideColumn":"隐藏列","markdownTable.showHiddenColumns":e=>`显示 ${(e==null?void 0:e.count)??0} 个隐藏列`,"markdownTable.moveColumn":e=>`移动 ${(e==null?void 0:e.column)??""}`,"markdownTable.resizeColumn":e=>`调整 ${(e==null?void 0:e.column)??""} 列宽`,"markdownTable.rowDetails":"详情","markdownTable.rowDetailsAria":e=>`查看第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.closeRowDetailsAria":e=>`收起第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.detailsHeader":"单行详情","markdownTable.cellDialogTitle":"当前字段值","markdownTable.copyCell":"复制","markdownTable.close":"关闭","markdownTable.actions":"操作","markdownTable.sortByColumn":e=>`按 ${(e==null?void 0:e.column)??""} 排序`,"markdownTable.sortByColumnAsc":e=>`${(e==null?void 0:e.column)??""} 已升序排序`,"markdownTable.sortByColumnDesc":e=>`${(e==null?void 0:e.column)??""} 已降序排序`,"markdownTable.filterColumn":e=>`筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.empty":"此表格没有数据。","markdownTable.emptyFiltered":"没有符合筛选条件的行。","markdownTable.sort.asc":"升序排序","markdownTable.sort.desc":"降序排序","markdownTable.sort.clear":"清除排序","markdownTable.filter.searchPlaceholder":"搜索筛选值","markdownTable.filter.searchAria":e=>`搜索 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.selectVisible":"全选当前结果","markdownTable.filter.optionLimit":e=>`已显示前 ${(e==null?void 0:e.count)??0} 项，请搜索缩小范围`,"markdownTable.filter.noOptions":"没有匹配项","markdownTable.filter.custom":"自定义筛选","markdownTable.filter.numberAria":e=>`数字筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.textAria":e=>`文本筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.numberPlaceholder":"数值","markdownTable.filter.toPlaceholder":"到","markdownTable.filter.textPlaceholder":"输入筛选条件","markdownTable.filter.reset":"重置","markdownTable.filter.cancel":"取消","markdownTable.filter.confirm":"确认","markdownTable.filter.text.contains":"包含","markdownTable.filter.text.equals":"等于","markdownTable.filter.text.notEquals":"不等于","markdownTable.filter.text.startsWith":"开头是","markdownTable.filter.text.endsWith":"结尾是","markdownTable.filter.number.gt":"大于","markdownTable.filter.number.gte":"大于等于","markdownTable.filter.number.lt":"小于","markdownTable.filter.number.lte":"小于等于","markdownTable.filter.number.between":"区间","mermaid.rendering":"正在渲染图表...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","mermaid.zoomIn":"+","mermaid.zoomOut":"−","mermaid.zoomReset":"↺","contextUsage.active":"已激活","contextUsage.autocompactBuffer":"自动压缩缓冲区","contextUsage.bodyLoaded":"已加载正文","contextUsage.builtinTools":"内置工具","contextUsage.contextWindow":"上下文窗口","contextUsage.detailHint":"运行 /context detail 查看逐项明细。","contextUsage.estimatedOverhead":"预估的对话前开销","contextUsage.free":"空闲","contextUsage.memoryFiles":"Memory 文件","contextUsage.messages":"消息","contextUsage.mcpTools":"MCP 工具","contextUsage.model":"模型","contextUsage.noSession":"当前还没有会话。请先发送第一条消息，再查看上下文使用情况。","contextUsage.noApiResponse":"尚无 API 响应。发送一条消息后可查看实际使用量。","contextUsage.overLimit":"上下文已超过限制！请使用 /compress 或 /clear 减少占用。","contextUsage.skills":"Skills","contextUsage.systemPrompt":"系统提示词","contextUsage.title":"上下文使用情况","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"按类别统计","contextUsage.used":"已用","daemon.title":"Daemon 状态","daemon.details.loading":"正在加载诊断信息...","daemon.details.failed":"诊断信息加载失败。","daemon.refresh":"刷新","daemon.loading":"正在加载 Daemon 状态...","daemon.loadFailed":"加载 Daemon 状态失败","daemon.updatedAt":e=>`更新于 ${(e==null?void 0:e.time)??""}`,"daemon.none":"无","daemon.level.ok":"正常","daemon.level.warning":"警告","daemon.level.error":"错误","daemon.level.unavailable":"不可用","daemon.issues.title":"问题","daemon.overview.title":"Daemon","daemon.overview.version":"版本","daemon.overview.pid":"PID","daemon.overview.mode":"模式","daemon.overview.uptime":"运行时长","daemon.overview.workspace":"工作区","daemon.runtime.title":"运行时","daemon.runtime.activeSessions":"活跃会话","daemon.runtime.activePrompts":"执行中的 prompt","daemon.runtime.idle":"空闲时长","daemon.runtime.noActivity":"暂无活动","daemon.runtime.pendingPermissions":"待审批权限","daemon.runtime.permissionPolicy":"权限策略","daemon.runtime.channel":"ACP 通道","daemon.runtime.channelLive":"在线","daemon.runtime.channelDown":"离线","daemon.runtime.startingUp":"运行时启动中...","daemon.runtime.startFailed":"运行时启动失败","daemon.runtime.channelWorker":"通道 Worker","daemon.runtime.channelWorkerRestarts":"Worker 重启次数","daemon.runtime.memory":"内存 (RSS / 堆)","daemon.transport.title":"传输","daemon.transport.restSse":"REST SSE 流","daemon.transport.acpDisabled":"ACP 传输未启用","daemon.transport.acpConnections":"ACP 连接","daemon.transport.acpStreams":"ACP 流 (会话/SSE/WS)","daemon.transport.pendingRequests":"待处理客户端请求","daemon.transport.rateLimitRejected":"限流拒绝数","daemon.security.title":"安全","daemon.security.token":"Bearer 令牌","daemon.security.requireAuth":"强制鉴权","daemon.security.loopback":"回环绑定","daemon.security.allowOrigin":"允许来源","daemon.security.shell":"会话 Shell 命令","daemon.security.configured":"已配置","daemon.security.notConfigured":"未配置","daemon.limits.title":"限制","daemon.limits.unlimited":"无限制","daemon.limits.maxSessions":"最大会话数","daemon.limits.maxPendingPrompts":"每会话最大待处理 prompt 数","daemon.limits.maxConnections":"最大监听连接数","daemon.limits.eventRing":"事件环大小","daemon.limits.promptDeadline":"Prompt 截止时间","daemon.limits.sessionIdle":"会话空闲超时","daemon.capabilities.title":"能力","daemon.capabilities.titleCount":e=>`能力 (${(e==null?void 0:e.count)??0})`,"daemon.full.sessions.title":"会话","daemon.full.sessions.empty":"无活跃会话","daemon.full.session.pendingPrompts":e=>`${(e==null?void 0:e.count)??0} 个待处理 prompt`,"daemon.full.session.pendingPermissions":e=>`${(e==null?void 0:e.count)??0} 个待审批权限`,"daemon.full.session.prompting":"执行中","daemon.full.workspace.title":"工作区诊断","daemon.full.workspace.empty":"未上报工作区诊断","daemon.full.auth.title":"认证","daemon.full.auth.providers":"设备码登录提供方","daemon.full.auth.pending":"进行中的设备码登录","daemon.full.acp.title":"ACP 连接","daemon.tab.overview":"概览","daemon.tab.usage":"用量","daemon.tab.metrics":"指标","daemon.tab.diagnostics":"诊断","daemon.charts.title":"指标图表","daemon.charts.empty":"正在采集指标…首次采样后显示图表。","daemon.charts.concurrency":"并发","daemon.charts.activePrompts":"执行中任务","daemon.charts.activeSessions":"会话","daemon.charts.requests":"请求数","daemon.charts.reqTotal":"总数","daemon.charts.reqErrors":"错误","daemon.charts.apiLatency":"API 耗时","daemon.charts.promptLatency":"Prompt 延迟","daemon.charts.queueWait":"排队等待","daemon.charts.promptDuration":"端到端","daemon.charts.eventLoop":"事件循环延迟","daemon.charts.eventLoopLag":"延迟 p99","daemon.charts.queuedPrompts":"排队中","daemon.charts.reqRejected":"限流拒绝","daemon.charts.llmLatency":"LLM 耗时","daemon.charts.apiHealth":"模型 API 健康","daemon.charts.apiErrors":"API 报错","daemon.charts.apiRetries":"重试","daemon.charts.cpu":"CPU","daemon.charts.pipe":"IPC 管道","daemon.charts.pipeIn":"接收","daemon.charts.pipeOut":"发送","daemon.charts.connections":"连接数","daemon.charts.cpuDaemon":"Daemon","daemon.charts.cpuChild":"子进程","daemon.charts.rssDaemon":"Daemon RSS","daemon.charts.rssChild":"子进程 RSS","daemon.charts.memory":"内存","daemon.charts.heap":"堆","daemon.charts.tokens":"Token 消耗","daemon.charts.tokensIn":"输入","daemon.charts.tokensOut":"输出","daemon.charts.peak":"峰值","daemon.charts.concurrency.help":"每次采样的实时负载:正在执行的 prompt、排队中(已接受未派发)、活跃会话数。排队数超过执行数即出现背压。","daemon.charts.requests.help":"每个窗口内客户端↔守护进程的 HTTP 流量,并非模型调用。总请求数、返回 4xx/5xx 的数量、被限流拒绝的数量。","daemon.charts.apiLatency.help":'客户端↔守护进程 HTTP 请求耗时(p50/p95)——反映守护进程本身快慢,而非模型。与「LLM 耗时」对比可区分是"我们慢"还是"模型慢"。',"daemon.charts.llmLatency.help":"每轮模型 API 往返耗时(守护进程→模型→守护进程),p50/p95。属模型侧延迟,区别于上面的 HTTP「API 耗时」。","daemon.charts.apiHealth.help":"服务商侧 LLM 失败。每次失败尝试 = 1 次报错,每次自动退避 = 1 次重试。瞬时 429/5xx 通常被重试吸收(报错 ≈ 重试);报错高于重试说明调用彻底失败。","daemon.charts.promptLatency.help":"每个 prompt(任务):派发前在会话队列中的等待 p95,以及端到端执行 p95。等待升高即背压信号。","daemon.charts.eventLoop.help":"守护进程事件循环延迟 p99——CPU 饱和 / 阻塞信号。延迟高说明守护进程被拖住,一切都会变慢。","daemon.charts.cpu.help":"每次采样的 CPU 占用(占全部核心百分比):守护进程,以及运行实际 LLM/工具的 ACP 子进程。子进程 0% 表示无子进程运行。","daemon.charts.memory.help":"每次采样的常驻内存:守护进程 RSS、守护进程 V8 堆、ACP 子进程 RSS。若持续增长可能是内存泄漏。","daemon.charts.pipe.help":"每个窗口内经 stdio 管道与 ACP 子进程收发的字节数。持续偏大说明守护进程与子进程间帧交互频繁。","daemon.charts.connections.help":"每次采样的客户端传输连接:REST/SSE 流、ACP WebSocket 流、ACP 连接数。","daemon.charts.tokens.help":"每个窗口内计入模型轮次的输入(prompt)与输出(completion)token——随时间的模型消耗。","daemon.usage.today":"今日","daemon.usage.period7d":"7天","daemon.usage.period30d":"30天","daemon.usage.rangeWeek":"近 7 天","daemon.usage.rangeMonth":"近 30 天","daemon.usage.rangeGroup":"统计周期","daemon.usage.tokensConsumed":"tokens 消耗","daemon.usage.sessions":"会话","daemon.usage.requests":"请求","daemon.usage.tools":"工具","daemon.usage.changes":"改动","daemon.usage.breakdownTitle":"Token 拆分","daemon.usage.inputTokens":"输入 tokens","daemon.usage.inputHint":"请求 + 缓存读取","daemon.usage.outputTokens":"输出 tokens","daemon.usage.outputHint":"响应 + 推理","daemon.usage.cacheRead":"缓存读取","daemon.usage.cacheHint":"缓存读取占比","daemon.usage.heatmapTitle":"Token 热力图","daemon.usage.heatmapSub":e=>`最近 ${(e==null?void 0:e.months)??12} 个月 · 每日 token 汇总`,"daemon.usage.low":"少","daemon.usage.high":"多","daemon.usage.dowMon":"一","daemon.usage.dowWed":"三","daemon.usage.dowFri":"五","daemon.usage.empty":"暂无 token 使用记录。","daemon.usage.loading":"加载用量中…","daemon.usage.failed":"加载用量失败","daemon.usage.cellTokens":e=>`${(e==null?void 0:e.date)??""} · Tokens: ${(e==null?void 0:e.tokens)??"0"} · Cache: ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.rangeWordToday":"今日","daemon.usage.rangeWordWeek":"7 天","daemon.usage.rangeWordMonth":"30 天","daemon.usage.modelShareTitle":"模型份额","daemon.usage.modelShareSub":"token 份额 · 浅绿表示缓存读取","daemon.usage.modelMeta":e=>`${(e==null?void 0:e.tokens)??"0"} tokens · 缓存 ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.skillTitle":"技能调用","daemon.usage.skillSub":"技能名 / 次数","daemon.usage.skillName":"技能名","daemon.usage.skillCount":"次数","daemon.usage.dailyTokensTitle":"Tokens","daemon.usage.dailyTokensSub":"每日 token 总量","daemon.usage.dailySessionsTitle":"会话","daemon.usage.dailySessionsSub":"每日活跃会话数","delete.cannotCurrent":"无法删除当前活动会话。","delete.action":"删除","delete.deleted":"会话已删除。","delete.deletedCount":e=>`已删除 ${(e==null?void 0:e.count)??0} 个会话。`,"delete.deleting":"删除中...","delete.failed":e=>`删除会话失败。${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ 导航 · Space 选择 · Enter 删除 · Esc 取消","delete.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"delete.none":"没有可删除的会话","delete.allFailed":e=>`删除 ${(e==null?void 0:e.count)??0} 个会话失败: ${(e==null?void 0:e.reason)??"未知错误"}`,"delete.nonRemoved":"没有会话被删除。","delete.notFound":"会话未找到，可能已被删除。","delete.partialFail":e=>`已删除 ${(e==null?void 0:e.removed)??0} 个，${(e==null?void 0:e.failed)??0} 个失败: ${(e==null?void 0:e.detail)??"未知错误"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} 个匹配`,"delete.pressSearch":"按 / 搜索；Space 选择；Enter 删除","delete.selected":e=>`已选 ${(e==null?void 0:e.count)??0} 个`,"delete.title":"删除会话","time.justNow":"刚刚","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} 分钟前`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0} 小时前`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0} 天前`,"dialog.footer.close":"Esc 关闭","dialog.footer.confirmCancel":"Enter 确认 · Esc 取消","release.cannotCurrent":"不能释放当前活动会话。","release.action":"释放","release.released":"会话已释放。","release.failed":e=>`释放会话失败。${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ 导航 · Enter 释放 · Esc 取消","release.inactive":"只有活跃的 live session 才能释放。","release.inactiveBadge":"非活跃","release.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"release.matches":e=>`${(e==null?void 0:e.count)??0} 个匹配`,"release.none":"没有可释放的 live session","release.pressSearch":"按 / 搜索；Enter 释放选中的 live session","release.releasing":"释放中...","release.title":"释放会话","dialog.footer.menu":"Esc 返回菜单","dialog.footer.mcpServers":"↑↓ 导航 · Enter 查看详情 · r 刷新 · Esc 关闭","dialog.footer.mcpSelect":"↑↓ 导航 · Enter 选择 · Esc 返回","dialog.footer.modelFast":"↑↓ 导航 · / 搜索 · c 自定义 · Enter 设置 fast model · Esc 取消","dialog.footer.navSelectCancel":"↑↓ 导航 · Enter 选择 · Esc 取消","dialog.footer.navSelectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","dialog.footer.navSelectMenu":"↑↓ 导航 · Enter 选择 · Esc 返回菜单","dialog.footer.navOpenClose":"↑↓ 导航 · Enter 打开 · Esc 关闭","dialog.footer.navOpenMenu":"↑↓ 导航 · Enter 打开 · Esc 返回菜单","dialog.footer.back":"Esc 返回","dialog.footer.backClose":"Esc 关闭","dialog.footer.saveClose":"↑↓ 切换输入框 · ⌘/Ctrl+Enter 保存 · Esc 关闭","dialog.footer.saveMenu":"↑↓ 切换输入框 · ⌘/Ctrl+Enter 保存 · Esc 返回菜单","dialog.footer.search":"输入搜索 · Enter 确认 · Esc 清空","dialog.footer.select":"Enter 选择","editor.escClearHint":"再按一次 Esc 清空","editor.hintCommands":"命令","editor.hintFiles":"文件","editor.hintNext":"下一条","editor.hintPrev":"上一条","editor.hintSearch":"搜索","editor.noHistory":"没有匹配的历史记录","editor.placeholder":"输入消息或 @ 文件路径","history.loadingEarlier":"正在加载更早消息…","history.capacityReached":"已达到历史显示上限，更早消息仍保存在会话中。","history.paginationError":"无法加载更早的历史记录。","editor.shellPlaceholder":"请输入终端命令","editor.send":"发送消息","editor.connectionDisconnected":"连接已中断，请在恢复后重试。","editor.sessionLoading":"会话正在加载，请稍后再发送。","editor.processing":"处理中。新消息会进入队列。","editor.searchHint":"ctrl+r 下一条 · tab 采纳 · enter 发送 · esc 取消","editor.searchLabel":"历史搜索：","editor.searchPlaceholder":"输入以搜索…","editor.newSessionSuggestionTitle":"这条消息看起来像新话题","editor.newSessionSuggestionStart":"在新会话发送","editor.btwSuggestionTitle":"这条消息看起来像顺带一问","editor.btwSuggestionSend":"用 BTW 提问","quickActions.open":"更多操作","quickActions.title":"更多操作","quickActions.mcp":"MCP","quickActions.context":"上下文","quickActions.status":"运行状态","quickActions.stats":"会话统计","quickActions.memory":"记忆管理","quickActions.extensions":"扩展","quickActions.skills":"技能详情","quickActions.tools":"工具详情","quickActions.agents":"智能体","quickActions.help":"帮助","quickActions.theme":"设置主题","quickActions.auth":"认证","quickActions.settings":"设置","quickActions.new":"新建会话","quickActions.resume":"切换会话","quickActions.delete":"删除会话","quickActions.branch":"复制会话","quickActions.rewind":"回退会话","quickActions.historyQuestion":"历史提问","quickActions.recap":"生成摘要","quickActions.copy":"复制输出","quickActions.shellMode":"Shell模式","quickActions.exitShellMode":"退出Shell","quickActions.setGoal":"设置目标","session.missing":"当前会话不存在","session.new":"新建会话","workspace.loadFailed":"工作区加载失败","workspace.notFound":"工作区不存在","workspace.notFoundDescription":"此工作区可能已被移除，或链接已经失效。","workspace.loadFailedDescription":"无法连接工作区服务，请检查守护进程后重试。","scheduledTasks.title":"定时任务","scheduledTasks.subtitle":"按计划自动执行任务，也可随时手动触发。","scheduledTasks.loading":"加载中…","scheduledTasks.count":e=>`${(e==null?void 0:e.count)??0} 个任务`,"scheduledTasks.refresh":"刷新","scheduledTasks.new":"新建定时任务","scheduledTasks.createViaChat":"通过聊天创建","scheduledTasks.chatStarter":"帮我创建一个长期保留的定时任务，我想：","scheduledTasks.name":"名称","scheduledTasks.workspace":"工作区","scheduledTasks.taskId":"任务 ID","scheduledTasks.schedule":"计划","scheduledTasks.type":"类型","scheduledTasks.status":"状态","scheduledTasks.namePlaceholder":"可选 —— 默认取提示词","scheduledTasks.prompt":"提示词","scheduledTasks.promptPlaceholder":"这个任务要做什么？","scheduledTasks.reference.extension":"扩展","scheduledTasks.reference.skill":"技能","scheduledTasks.reference.mcp":"MCP","scheduledTasks.referencePicker":"引用选择器","scheduledTasks.reference.remove":"删除","scheduledTasks.reference.loading":"加载中…","scheduledTasks.reference.empty":"暂无可选项。","scheduledTasks.frequency":"频率","scheduledTasks.freq.daily":"每天","scheduledTasks.freq.weekdays":"工作日","scheduledTasks.freq.weekly":"每周","scheduledTasks.freq.hourly":"每小时","scheduledTasks.freq.minutes":"每 N 分钟","scheduledTasks.freq.custom":"自定义（cron）","scheduledTasks.time":"时间","scheduledTasks.weekday":"星期","scheduledTasks.interval":"分钟","scheduledTasks.cron":"Cron 表达式","scheduledTasks.weekdayNames":"周日,周一,周二,周三,周四,周五,周六","scheduledTasks.human.daily":e=>`每天 ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekdays":e=>`工作日 ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekly":e=>`每${(e==null?void 0:e.day)??""} ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.hourly":e=>`每小时 第 ${(e==null?void 0:e.min)??"00"} 分`,"scheduledTasks.human.everyMinutes":e=>`每 ${(e==null?void 0:e.n)??""} 分钟`,"scheduledTasks.never":"尚未运行","scheduledTasks.repeats":"重复","scheduledTasks.runsOnce":"仅一次","scheduledTasks.lastFired":e=>`上次运行：${(e==null?void 0:e.when)??""}`,"scheduledTasks.runNow":"立即运行","scheduledTasks.enable":"启用","scheduledTasks.disable":"停用","scheduledTasks.delete":"删除","scheduledTasks.deleteConfirmTitle":"删除定时任务","scheduledTasks.deleteConfirm":e=>`确定删除定时任务「${(e==null?void 0:e.name)??""}」？`,"scheduledTasks.deletedSnapshot":"这个定时任务已被删除，下面显示的是创建时的快照。","scheduledTasks.sessionScopedSnapshot":"这是一个会话内定时任务，下面显示的是创建时的快照。","scheduledTasks.empty":"还没有定时任务，创建一个开始吧。","scheduledTasks.create":"创建","scheduledTasks.creating":"创建中…","scheduledTasks.cancel":"取消","scheduledTasks.error.invalidSchedule":"计划无效","scheduledTasks.error.emptyPrompt":"提示词不能为空","scheduledTasks.error.promptTooLong":e=>`提示词超过 ${(e==null?void 0:e.max)??1e5} 字符限制`,"scheduledTasks.error.toggleFailed":"更新任务失败","scheduledTasks.error.deleteFailed":"删除任务失败","scheduledTasks.edit":"编辑","scheduledTasks.editTitle":"编辑定时任务","scheduledTasks.save":"保存","scheduledTasks.saving":"保存中…","scheduledTasks.runHistory":e=>`运行记录（${(e==null?void 0:e.count)??0}）`,"scheduledTasks.viewHistory":e=>`查看对话（${(e==null?void 0:e.count)??0}）`,"scheduledTasks.viewHistoryEmpty":"查看对话","scheduledTasks.viewHistoryHint":"打开该任务的会话查看运行详情","scheduledTasks.runKind.catchUp":"补跑","scheduledTasks.runKind.manual":"手动","scheduledTasks.runKind.withheld":"已跳过","scheduledTasks.error.runFailed":"记录运行失败","scheduledTasks.error.oneShotConsumedButFailed":"任务已删除,但提示词未能送达——它没有运行。请重新创建后重试。","scheduledTasks.dueNow":"即将运行","scheduledTasks.nextRunTooltip":e=>`下次运行：${(e==null?void 0:e.when)??""}`,"scheduledTasks.dur.d":"天","scheduledTasks.dur.h":"小时","scheduledTasks.dur.m":"分","scheduledTasks.dur.s":"秒","scheduledTasks.runMode":"运行模式","scheduledTasks.runMode.shared":"共享会话","scheduledTasks.runMode.isolated":"隔离（每次运行新建会话）","scheduledTasks.runMode.shared.hint":"所有运行记录累积在同一个会话中。","scheduledTasks.runMode.isolated.hint":"每次运行获得独立的会话上下文。","scheduledTasks.condition":"前置条件（可选）","scheduledTasks.conditionPlaceholder":"例如：检查昨天以来 main 分支有没有新提交。如果没有，则本次不应执行。","scheduledTasks.condition.hint":'每次触发前，先在本任务自己的会话中检查该条件。只有判定为"是"，才会新建会话执行命令；否则跳过本次运行。',"scheduledTasks.condition.cardPrefix":"若：","turnOutputs.filesEdited":e=>`已编辑 ${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.viewChanges":"查看更改","turnOutputs.review":"审核","turnOutputs.reviewLatest":"查看最近文件修改","sideTask.title":"侧边任务","sideTask.description":"查看或新增侧边任务","sideTask.new":"新增","sideTask.create":"新建侧边任务","rightPanel.add":"添加页签","sideTask.creating":"正在创建侧边任务…","sideTask.createFailed":"创建侧边任务失败","sideTask.promptFailed":"发送侧边任务问题失败","sideTask.renameFailed":"侧边任务命名失败","turnOutputs.preview":"预览","turnOutputs.collapseFiles":"收起文件","turnOutputs.showMoreFiles":e=>`再展示 ${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.previousTurn":"上轮对话","turnOutputs.fileCount":e=>`${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.openFileTree":"打开文件树","turnOutputs.closeFileTree":"关闭文件树","sidebar.label":"工作区侧边栏","sidebar.toggleMenu":"切换菜单","sidebar.newChat":"新对话","sidebar.newTask":"新建任务","sidebar.newWorktreeTask":"新建 Worktree 任务","sidebar.plugins":"插件","sidebar.channels":"频道","sidebar.project":"项目","sidebar.pinnedSessions":"置顶","sidebar.workspaceSelectLabel":"工作区","sidebar.details":"详情","sidebar.copySessionId":"复制会话 ID","sidebar.copySessionIdFailed":"复制会话 ID 失败","sidebar.sessionIdCopied":"会话 ID 已复制","sidebar.workspaceUntrusted":"未信任","sidebar.workspaceReadOnly":"只读","sidebar.workspaceTrustToOpen":"信任此工作区后才能打开会话。","sidebar.addWorkspace":"添加工作区","sidebar.newWorkspace":"新建工作区","sidebar.startFromScratch":"从空目录开始","sidebar.useExistingFolder":"使用已有目录…","sidebar.scratchOutcomeUnknownTitle":"确认工作区创建结果","sidebar.scratchOutcomeUnknown":"守护进程响应已中断。再次创建前，请检查刷新后的工作区列表。","sidebar.scratchOutcomeRefresh":"刷新工作区列表","sidebar.scratchOutcomeAcknowledge":"我已检查工作区列表","sidebar.addWorkspaceTitle":"添加工作区","sidebar.addWorkspacePath":"目录路径","sidebar.addWorkspaceBrowse":"浏览…","sidebar.addWorkspaceBrowseError":"无法打开系统文件夹选择器，请改为输入绝对路径。","sidebar.addWorkspaceDisplayName":"展示名称（可选）","sidebar.addWorkspaceDisplayNameHint":"用于 Web Shell 展示；目录路径仍是工作区身份。","sidebar.addWorkspaceRegister":"注册","sidebar.addWorkspaceCancel":"取消","sidebar.addWorkspaceError":"添加工作区失败","sidebar.addWorkspaceBusyError":"另一个工作区操作正在进行中","sidebar.addWorkspacePersistenceError":"守护进程未确认工作区已持久化注册","sidebar.addWorkspaceRefreshError":"工作区已添加，但无法刷新工作区列表","sidebar.addWorkspaceAbsError":"路径必须是绝对路径","sidebar.addWorkspaceHint":"请输入项目目录的绝对路径。","sidebar.addWorkspaceSuggestions":"目录建议","sidebar.addWorkspacePersist":"服务重启后保留","sidebar.addWorkspacePersistHint":"将此工作区注册持久化到守护进程配置中。","sidebar.addWorkspaceAdding":"添加中…","sidebar.removeWorkspace":"移除工作区","sidebar.workspaceActions":"工作区操作","sidebar.forceRemoveWorkspace":"强制移除","sidebar.removeWorkspaceTitle":"移除工作区","sidebar.removeWorkspaceConfirm":e=>`确定移除“${(e==null?void 0:e.name)??""}”的运行时和持久化注册吗？文件、设置和会话历史不会被删除。`,"sidebar.removeWorkspaceBusy":e=>`“${(e==null?void 0:e.name)??""}”仍有活动运行时资源。强制移除会终止这些资源。`,"sidebar.removeWorkspaceCurrentSession":"请先切换到其他工作区或关闭当前会话，再执行强制移除。","sidebar.removeWorkspaceInProgress":"另一个客户端正在移除此工作区，请在操作完成后刷新。","sidebar.removeWorkspaceError":"移除工作区失败","sidebar.removeWorkspaceSessions":e=>`会话：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspacePrompts":e=>`活动提示：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceStarts":e=>`待启动会话：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceConnections":e=>`ACP 连接：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceMemoryTasks":e=>`Memory 任务：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceWorkers":e=>`Channel worker：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceVoiceSessions":e=>`语音会话：${(e==null?void 0:e.count)??0}`,"sidebar.noSessions":"暂无会话","sidebar.projectFallback":"项目","sidebar.sessionsOverview":"会话总览","sidebar.splitView":"分屏","sidebar.settings":"设置","sidebar.daemonStatus":"Daemon 状态","sidebar.scheduledTasks":"定时任务","sidebar.goals":"目标","sidebar.themeLight":"切换到浅色主题","sidebar.themeDark":"切换到深色主题","sidebar.collapse":"收起","sidebar.expand":"展开","sidebar.collapseProject":"收起项目","sidebar.expandProject":"展开项目","sidebar.search":"搜索会话","sidebar.searchPlaceholder":"搜索会话","sidebar.searchEmpty":"没有匹配的会话。","sidebar.rename":"重命名","sidebar.renameCurrentOnly":"暂仅支持重命名当前会话","sidebar.export":"导出对话记录","sidebar.exportFailed":"导出会话失败","sidebar.delete":"删除","sidebar.archive":"归档","sidebar.unarchive":"恢复","sidebar.moreActions":"更多操作","sidebar.archiveCurrentDisabled":"不能归档当前会话","sidebar.archivedTitle":"已归档","sidebar.archivedEmpty":"没有已归档的会话。","sidebar.archiveFailed":"归档会话失败","sidebar.unarchiveFailed":"恢复会话失败","sidebar.loadingSessions":"正在加载会话...","sidebar.loadFailed":"会话加载失败，点击重试。","sidebar.renameFailed":"重命名会话失败","sidebar.deleteFailed":"删除会话失败","sidebar.newSessionFailed":"创建新对话失败","sidebar.switchFailed":"切换会话失败","sidebar.currentDeleteDisabled":"不能删除当前会话","sidebar.deleteConfirmDescription":e=>`确定删除“${(e==null?void 0:e.name)??""}”吗？删除后不可恢复。`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"sidebar.running":"运行中","sidebar.waitingForApproval":"等待批准","sidebar.userInputNeeded":"需要用户输入","sidebar.completedUnread":"刚完成","sidebar.pin":"置顶","sidebar.unpin":"取消置顶","sidebar.sessionGroup":"分组","sidebar.groupFilter":"会话分组","sidebar.groupAll":"全部","sidebar.groupPinned":"已置顶","sidebar.groupUngrouped":"未分组","sidebar.groupRecent":"最近","sidebar.groupCreate":"新建分组","sidebar.groupRename":"重命名分组","sidebar.groupDelete":"删除分组","sidebar.groupColor":"分组颜色","sidebar.groupNamePrompt":"分组名称","sidebar.groupDeleteConfirm":e=>`确定删除分组“${(e==null?void 0:e.name)??""}”吗？`,"sidebar.groupsLoadFailed":"加载会话分组失败","sidebar.groupCreateFailed":"创建分组失败","sidebar.groupAssignFailedAfterCreate":"分组已创建，但移动会话失败","sidebar.groupUpdateFailed":"更新分组失败","sidebar.groupDeleteFailed":"删除分组失败","sidebar.organizationFailed":"更新会话组织失败","sidebar.groupColor.red":"红色","sidebar.groupColor.orange":"橙色","sidebar.groupColor.yellow":"黄色","sidebar.groupColor.green":"绿色","sidebar.groupColor.blue":"蓝色","sidebar.groupColor.purple":"紫色","sidebar.groupColor.custom":"自定义…","sidebar.groupColor.picker":"选择自定义分组颜色","sidebar.groupColor.hex":"Hex 颜色","sidebar.groupColor.invalid":"请输入六位 Hex 颜色，例如 #416ef5。","quickKeys.cursor":"移动光标","quickKeys.escape":"取消运行","quickKeys.history":"切换历史","quickKeys.retry":"重试失败请求","quickKeys.searchHistory":"搜索历史","quickKeys.tab":"接受补全","error.unsupportedTheme":"不支持该主题。请使用 /theme light 或 /theme dark。","queue.delete":"删除","queue.edit":"编辑","queue.insert":"插入","queue.cleared":"队列已清空。","queue.deleteTip":"移出队列","queue.editTip":"移出队列并将内容放回输入框","queue.insertTip":"将信息插入当前会话，下次模型调用生效。","queue.inserted":"已插入，下次模型调用生效。","queue.insertCommandDisabled":"命令无法插入当前回合。","queue.submitting":"提交中...","queue.serverQueued":"服务器排队中...","queue.editing":"编辑中...","queue.removing":"处理中...","queue.submittingDisabled":"排队消息正在提交中...","queue.commandBlocked":"当前回合运行时，Slash 命令不能进入排队。","queue.shellQueued":"Shell 命令已排队，将在当前回合结束后执行。","queue.shellDropped":e=>`${(e==null?void 0:e.count)??0} 条排队的 Shell 命令将不会执行。`,"queue.queueFailed":"排队消息失败","queue.insertFailed":"插入排队消息失败","queue.deleteFailed":"移出队列失败","queue.editFailed":"编辑排队消息失败","queue.footer":"按 ↑ 编辑最后一条排队消息 · Esc 清空队列","queue.imageCount":e=>`（+${(e==null?void 0:e.count)??0} 张图片）`,"queue.more":e=>`...（还有 ${(e==null?void 0:e.count)??0} 条）`,"midTurn.inserted":e=>`已插入消息：${(e==null?void 0:e.message)??""}`,"help.builtIn":"内置命令","help.commandCount":e=>`${(e==null?void 0:e.count)??0} 个命令`,"help.commandMeta.builtIn":"内置","help.commandMeta.custom":"自定义","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} 个子命令`,"help.commandsIntro":"浏览内置命令：","help.customGroup":"自定义、skills、plugins、MCP","help.customIntro":"浏览自定义、skill、plugin 和 MCP 命令：","help.empty":"当前没有可用命令。","help.emptyCustom":"当前没有可用的自定义命令。","help.footer":"Tab/Shift+Tab 切换标签 · ↑/↓ 或 PgUp/PgDn 滚动 · Esc 关闭","help.intro":"Qwen Code 可以理解代码库，在你的许可下修改文件，并直接执行命令。","help.section.shortcuts":"快捷键","help.search":"搜索命令","help.shortcut.addContext":"添加文件或目录作为上下文","help.shortcut.altWords":"按词跳转","help.shortcut.clear":"清屏","help.shortcut.commandMenu":"打开命令菜单","help.shortcut.completion":"接受补全或切换帮助标签","help.shortcut.history":"切换历史 prompt 或滚动列表","help.shortcut.searchHistory":"搜索历史 prompt","help.shortcut.newline":"插入换行","help.shortcut.pasteImages":"粘贴图片","help.shortcut.shell":"运行 shell 命令","help.shortcut.togglePanel":"切换此面板","help.shortcut.retry":"重试上次请求","help.shortcut.compact":"切换紧凑模式","retry.hint":"按 Ctrl+Y 重试或点击重试","retry.none":"没有可重试的失败请求。","system.taskNotification":"后台任务通知","system.taskCompleted":"后台任务执行完成","system.taskFailed":"后台任务执行失败","system.taskCancelled":"后台任务已取消","branch.failed":"分支会话失败。","branch.success":e=>`已复制会话，新会话名称为： "${(e==null?void 0:e.name)??""}"，当前已切换到新的会话。`,"fork.empty":"请提供任务指令。用法：/fork <指令>","fork.failed":e=>`启动后台智能体失败：${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"后台智能体未启动。","fork.started":e=>`已启动后台智能体："${(e==null?void 0:e.name)??""}"，可在后台任务中查看。`,"command.hidden":"该命令不可用。","help.shortcut.approvals":"切换审批模式","help.shortcut.cancel":"关闭弹窗或取消操作","bug.failed":"加载系统信息失败，无法提交 Bug 报告。","bug.popupBlocked":"弹窗被拦截，请允许弹窗后重试。","bug.submitted":"Bug 报告已在新标签页中打开。","clear.blocked":"流式输出中无法清屏 — 先按 Esc 取消。","error.unknown":"未知错误","error.modelStreamInterrupted":"模型响应流已中断，请重试。","shell.command":"Shell 命令","compact.enabled":"紧凑模式已开启","compact.disabled":"紧凑模式已关闭","compact.hint":"按 Ctrl+O 显示完整工具输出","compact.saveFailed":"保存紧凑模式失败","help.subcommands":"子命令","help.tab.commands":"内置命令","help.tab.custom":"自定义命令","help.tab.general":"快捷键","help.title":"帮助","slash.category.custom":"自定义","slash.category.skill":"Skill","slash.category.system":"系统","language.changed":e=>`UI 语言已切换为 ${(e==null?void 0:e.language)??""}`,"language.current":e=>`当前 UI 语言：${(e==null?void 0:e.language)??""}`,"language.invalid":"语言无效。可用值：en, zh-CN","language.options":"可用选项：","language.set":"设置 UI 语言","language.usage":"用法：/language ui [en|zh-CN]","localCommand.noSession":"当前还没有会话。请先发送第一条消息，再使用这个命令。","localCommand.diffNoWorkspace":"当前还没有可用于查看变更的工作区。","localCommand.logNoWorkspace":"当前还没有可用于查看历史的工作区。","localCommand.prsNoWorkspace":"当前还没有可用于查看拉取请求的工作区。","localCommand.prsUnsupported":"当前 daemon 不支持查看拉取请求。","local.agents":"管理智能体","local.bug":"提交错误报告","local.compress":"将上下文压缩为摘要","local.compressFast":"无需 AI 的快速上下文压缩","local.config":"通过点分路径键获取或设置配置项","local.diff":"显示工作区相对 HEAD 的改动统计","local.log":"显示工作区的提交历史","local.prs":"显示工作区开放的 GitHub 拉取请求","local.directory":"管理工作区目录","local.docs":"打开完整的 Qwen Code 文档","local.doctor":"运行安装和环境诊断","local.dream":"整合托管的自动记忆主题文件","local.effort":"设置推理模型的思考强度","local.export":"将当前会话历史导出到文件","local.forget":"从托管的自动记忆中移除匹配的条目","local.hooks":"管理 Qwen Code 钩子","local.importConfig":"从 Claude 配置导入 MCP 服务器","local.init":"分析项目并创建 QWEN.md 文件","local.insight":"根据聊天历史生成编程洞察","local.lsp":"显示 LSP 服务器状态","local.remember":"将持久记忆保存到记忆系统","local.summary":"生成项目摘要文件","local.workflows":"列出进行中和已完成的工作流运行","skilldesc.batch":"并行批量处理多个文件","skilldesc.dataviz":"图表与数据可视化设计指南","skilldesc.extensionCreator":"创建、测试和定制 Qwen Code 扩展","skilldesc.loop":"按计划或自定节奏循环运行提示词","skilldesc.newApp":"从零构建新应用的工作流","skilldesc.qcHelper":"解答 Qwen Code 使用相关问题","skilldesc.review":"审查代码变更的正确性、安全、质量与性能","skilldesc.simplify":"清理近期代码变更（复用与精简）","skilldesc.stuck":"诊断卡死或缓慢的 Qwen Code 会话","skilldesc.agentReproduceAlign":"将已移植的 Codex/Claude Code 功能与原版对齐","skilldesc.agentReproduceFeature":"复现 Codex/Claude Code 的现有功能","skilldesc.autofix":"实现已批准的 issue 或处理 PR 审查反馈","skilldesc.bugfix":"按先复现流程修复 GitHub issue 中的 bug","skilldesc.codegraph":"通过图数据库和向量索引分析代码库","skilldesc.createIssue":"根据想法或 bug 描述起草并提交 GitHub issue","skilldesc.desktopPet":"为 Qwen Code 创建像素风桌面宠物","skilldesc.docsAuditAndRefresh":"对照代码库审计并刷新 docs/ 文档","skilldesc.docsUpdateFromDiff":"按本地 git diff 更新官方文档","skilldesc.e2eTesting":"运行 Qwen Code CLI 的端到端测试","skilldesc.featDev":"实现非平凡功能的端到端工作流","skilldesc.memoryLeakDebug":"用堆快照诊断 CLI 内存泄漏","skilldesc.openworkDesktopSync":"将 packages/desktop 与 openwork 逐提交同步","skilldesc.preparePr":"从当前分支准备 GitHub PR 标题和正文","skilldesc.qwenCodeClaw":"将 Qwen Code 用作代码理解智能体","skilldesc.structuredDebugging":"假设驱动的疑难 bug 调试方法","skilldesc.terminalCapture":"自动化终端 UI 截图测试","skilldesc.tmuxRealUserTesting":"用 tmux 做真实用户测试并保存日志","skilldesc.triage":"把关和审查 Qwen Code 的 issue 与 PR","local.approvalMode":"切换审批模式","local.auth":"连接 LLM provider","auth.title":"连接 Provider","auth.step.group":"类型","auth.step.provider":"供应商","auth.step.protocol":"协议","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"模型 ID","auth.step.advanced":"高级配置","auth.protocol.openai":"OpenAI 兼容","auth.protocol.openaiDesc":"标准 OpenAI API 格式（最常用）","auth.protocol.anthropic":"Anthropic 兼容","auth.protocol.anthropicDesc":"Anthropic Messages API 格式","auth.protocol.gemini":"Gemini 兼容","auth.protocol.geminiDesc":"Google Gemini API 格式","auth.apiKeyRequired":"API key 不能为空。","auth.baseUrlInvalid":"Base URL 必须以 http:// 或 https:// 开头。","auth.baseUrlPrompt":"输入此协议的 API endpoint。","auth.baseUrlRequired":"Base URL 不能为空。","auth.documentation":"文档","auth.modelsRequired":"模型 ID 不能为空。","auth.review":"确认","auth.reviewText":"以下 JSON 将保存到 settings.json：","auth.save":"保存","auth.saving":"正在保存...","auth.termsTitle":"服务条款和隐私声明","auth.continue":"继续","auth.modelsPrompt":e=>`输入以逗号分隔的模型 ID。例如：${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"可选：配置高级生成设置。","auth.advanced.thinking":"启用 thinking","auth.advanced.thinkingDesc":"允许模型在回复前进行扩展推理。","auth.advanced.modality":"启用多模态","auth.advanced.modalityDesc":"启用图片、视频等多模态输入能力。","auth.advanced.modalityImage":"图片","auth.advanced.modalityVideo":"视频","auth.advanced.modalityAudio":"音频","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"上下文窗口","auth.advanced.contextDesc":"最大输入 token 数（留空则根据模型名称自动检测）。","auth.advanced.contextPlaceholder":"上下文窗口（可选）","local.btw":"快速问一个不影响主对话的侧边问题。用法：/btw <your question>","btw.empty":"请提供一个问题。用法：/btw <你的问题>","btw.side.empty":"请提供一个问题。用法：/btw side <你的问题>","btw.emptyAnswer":"未收到回答。","btw.failed":"回答 btw 问题失败","btw.answering":"+ 正在回答...","btw.shortcuts.pending":"按 Escape、Ctrl+C 或 Ctrl+D 取消","btw.shortcuts.done":"按 Space、Enter 或 Escape 关闭","local.clear":"以空上下文开始新会话；之前的会话会保留在磁盘上（可用 /resume 恢复）","local.context":'显示上下文窗口使用情况明细。使用 "/context detail" 查看逐项明细',"local.copy":"复制最后输出或代码片段","local.delete":"永久删除会话","local.release":"释放 live session","local.rewind":"回退当前会话","local.branch":"将当前对话分叉到新会话","local.fork":"基于当前对话启动后台智能体","local.help":"查看帮助和可用命令","local.language":"切换 UI 语言","local.mcp":"管理 MCP servers","local.memory":"管理 memory","local.model":"切换模型或设置 fast model","local.new":"开始新对话","local.plan":"进入 Plan 模式","local.goal":"设置目标并持续工作直到完成","local.recap":"生成会话摘要","recap.label":"回顾","recap.loading":"正在生成摘要...","recap.empty":"对话内容还不够，暂时无法生成摘要。","recap.failed":"生成摘要失败","rewind.action":"回退","rewind.confirm":"确认回退","rewind.empty":"当前会话没有可回退的快照。","rewind.failed":e=>`回退会话失败：${(e==null?void 0:e.reason)??""}`,"rewind.loading":"正在加载可回退的 prompt...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"回退中...","rewind.subtitle":"仅回退会话，不涉及文件。","rewind.title":"回退会话","rewind.turn":e=>`第 ${(e==null?void 0:e.turn)??0} 个 prompt`,"local.rename":"重命名当前会话","rename.empty":"请输入会话名称，例如 /rename 项目调试，或使用 /rename --auto。","rename.success":e=>`会话已重命名为 ${(e==null?void 0:e.name)??""}`,"local.reset":"重置当前对话","local.resume":"恢复历史会话","local.skills":"查看可用 skills","local.stats":"查看会话统计","local.tasks":"查看后台任务","local.status":"查看版本信息","local.theme":"切换主题","local.settings":"查看和编辑设置","local.schedule":"管理定时任务","local.extensions":"管理扩展。用法: /extensions manage|install <source>","extensions.label":"扩展","extensions.action.failed":e=>`扩展操作失败${e!=null&&e.name?`（${e.name}）`:e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.commands.refreshFailed":"刷新扩展命令失败。","extensions.install.failed":e=>`安装扩展失败${e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.manage.agents":"智能体：","extensions.manage.actions":"扩展操作","extensions.manage.add":"添加扩展","extensions.manage.checkingUpdates":"正在检查更新...","extensions.manage.checkUpdates":"检查更新","extensions.manage.commands":"命令：","extensions.manage.contextFiles":"上下文文件：","extensions.manage.count":e=>`已安装 ${(e==null?void 0:e.count)??0} 个扩展`,"extensions.manage.setting.disabled":"禁用","extensions.manage.setting.default":"默认","extensions.manage.setting.enabled":"启用","extensions.manage.setting.unknown":"状态不可用","extensions.manage.setting.unavailableDescription":"当前服务未返回扩展的全局和工作区设置，请重启 qwen serve 后重试。","extensions.manage.userSetting":"全局设置","extensions.manage.userSettingDescription":"适用于用户工作区，工作区设置可单独覆盖。","extensions.manage.workspaceSetting":"工作区设置","extensions.manage.workspaceSettingDescription":"仅适用于当前工作区。","extensions.manage.disable":"禁用扩展","extensions.manage.disabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已禁用。`,"extensions.manage.disabling":e=>`正在禁用扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"extensions.manage.inherited":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已恢复为全局设置。`,"extensions.manage.inheriting":e=>`正在将扩展 "${(e==null?void 0:e.name)??"扩展"}" 恢复为全局设置…`,"extensions.manage.empty":"未安装扩展。","extensions.manage.emptyAgents":"此扩展没有智能体。","extensions.manage.emptyCommands":"此扩展没有命令。","extensions.manage.emptyContextFiles":"此扩展没有上下文文件。","extensions.manage.emptyDescription":"安装扩展以添加命令、Skills、智能体或 MCP servers。","extensions.manage.emptyMcpServers":"此扩展没有 MCP servers。","extensions.manage.emptySkills":"此扩展没有 Skills。","extensions.manage.enable":"启用扩展","extensions.manage.enabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已启用。`,"extensions.manage.enabling":e=>`正在启用扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"extensions.manage.install":"安装","extensions.manage.installDescription":"输入 GitHub、Git 或 npm 扩展来源。","extensions.manage.installSelectPluginDescription":e=>`从「${(e==null?void 0:e.marketplace)??"此市场"}」中选择插件。`,"extensions.manage.installType":"安装类型：","extensions.manage.mcpServers":"MCP servers：","extensions.manage.marketplaceRoot":"此市场根目录","extensions.manage.name":"名称：","extensions.manage.notUpdatable":"不可更新","extensions.manage.operationFailed":"扩展操作失败。","extensions.manage.noDescription":"暂无描述","extensions.manage.noMatches":"没有匹配的扩展。","extensions.manage.origin":"来源平台：","extensions.manage.overview":"基本信息","extensions.manage.path":"路径：","extensions.manage.queued":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 的操作已提交。`,"extensions.manage.refreshFailed":e=>`扩展操作已成功，但 session 刷新失败${e!=null&&e.error?`：${e.error}`:"。"}`,"extensions.manage.restartRequired":"已更新，需要重启","extensions.manage.search":"搜索扩展…","extensions.manage.selectExtension":"请选择扩展","extensions.manage.settings":"设置：","extensions.manage.skills":"Skills：","extensions.manage.source":"来源：","extensions.manage.sourcePlaceholder":"https://github.com/owner/repository","extensions.manage.status":"状态：","extensions.manage.status.disabled":"已禁用","extensions.manage.status.enabled":"已启用","extensions.manage.title":"管理扩展","extensions.manage.unknownUpdate":"未知","extensions.manage.uninstalled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已卸载。`,"extensions.manage.uninstalling":e=>`正在卸载扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"extensions.manage.uninstallAction":"卸载扩展","extensions.manage.uninstallConfirm":e=>`确定卸载扩展 "${(e==null?void 0:e.name)??"扩展"}"？`,"extensions.manage.upToDate":"已是最新","extensions.manage.update":"更新扩展","extensions.manage.updateAvailable":"有可用更新","extensions.manage.updateError":"检查更新失败","extensions.manage.updateComplete":"已更新","extensions.manage.updatedWithWarnings":"已更新，但有警告","extensions.manage.updateStatus":"更新状态：","extensions.manage.updating":"正在更新…","extensions.manage.updatingExtension":e=>`正在更新扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"extensions.manage.updated":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已更新。`,"extensions.manage.updatedWithVersion":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已更新到 v${(e==null?void 0:e.version)??""}。`,"extensions.manage.version":"版本：","extensions.manage.viewDetails":"查看详情","extensions.install.installed":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已安装。`,"extensions.install.installedWithVersion":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" v${(e==null?void 0:e.version)??""} 已安装。`,"extensions.install.missingOptionValue":e=>`${(e==null?void 0:e.option)??"选项"} 缺少值`,"extensions.install.requestFailed":"安装扩展失败","extensions.install.started":e=>`正在从 "${(e==null?void 0:e.source)??""}" 安装扩展...`,"extensions.install.unknownOption":e=>`未知选项 ${(e==null?void 0:e.option)??""}`,"extensions.install.usage":"用法: /extensions manage|install <source>","extensions.install.waitForSession":"等待会话连接后再安装扩展。","local.tools":"列出可用工具。用法: /tools [desc]","loadWarning.commands":"命令列表加载失败，斜杠命令可能不完整。","loadWarning.context":"会话上下文加载失败，当前模式可能不准确。","loadWarning.models":"模型列表加载失败，部分模型详情可能不可用。","mcp.action.auth":"认证","mcp.action.authHint":"daemon 尚未暴露","mcp.action.authMessage":"daemon serve 尚未暴露 MCP 认证能力。","mcp.action.clearAuth":"清空认证","mcp.action.disable":"禁用","mcp.action.done":e=>`${(e==null?void 0:e.action)??"操作"}完成。`,"mcp.action.enable":"启用","mcp.action.enableMessage":"daemon serve 尚未暴露 MCP 启用/禁用能力。","mcp.action.failed":e=>`失败：${(e==null?void 0:e.error)??""}`,"mcp.action.running":e=>`${(e==null?void 0:e.action)??"操作"}中...`,"mcp.action.reauth":"重新认证","mcp.action.approve":"审批","mcp.actions":"服务器操作","mcp.annotation.destructive":"破坏性","mcp.annotation.idempotent":"幂等","mcp.annotation.openWorld":"开放世界","mcp.annotation.readOnly":"只读","mcp.annotations":"注解","mcp.oauth.server":"服务器","mcp.oauth.starting":e=>`正在为 MCP server '${(e==null?void 0:e.name)??""}' 启动 OAuth 认证...`,"mcp.oauth.title":"OAuth 认证","mcp.oauth.timeout":"认证等待超时，请刷新后查看状态。","mcp.oauth.authenticationFailed":"认证失败。","mcp.oauth.statusFailed":"检查认证状态失败。","mcp.oauth.serverRemoved":"MCP 服务器已在认证期间被移除。","mcp.clientBudget":e=>`${(e==null?void 0:e.count)??0}/${(e==null?void 0:e.budget)??0} 个客户端 · ${(e==null?void 0:e.mode)??"off"}`,"mcp.command":"命令","mcp.description":"描述：","mcp.descriptionTitle":"描述","mcp.basicInfo":"基本信息","mcp.action.reconnect":"重新连接","mcp.action.edit":"编辑","mcp.reconnect.skipped":e=>`重新连接未完成：${(e==null?void 0:e.reason)??"未知原因"}。`,"mcp.reconnect.authenticationRequired":"请先完成认证，再重新连接。","mcp.action.restart":"重启","mcp.action.tools":"查看工具","mcp.action.toolsHint":"Enter 查看","mcp.empty":"未配置 MCP 服务器。","mcp.emptyDescription":"添加 MCP 服务器后可在此管理。","mcp.emptyTools":"没有发现工具。","mcp.expand":"展开 MCP server","mcp.collapse":"收起 MCP server","mcp.inputSchema":"输入 schema","mcp.loadingStatus":"正在加载 MCP 状态...","mcp.loadingTools":"正在加载工具...","mcp.name":"名称","mcp.noDescription":"没有描述","mcp.noMatches":"没有匹配的 MCP 服务器。","mcp.add.button":"添加 MCP 服务器","mcp.add.adding":"正在添加 MCP 服务器…","mcp.add.title":"添加 MCP 服务器","mcp.add.description":"输入服务器名称和配置，并保存到当前工作区。","mcp.add.name":"名称","mcp.add.serverDescription":"描述","mcp.add.serverDescriptionPlaceholder":"描述这个 MCP 服务器","mcp.add.scope":"保存位置","mcp.add.scope.global":"全局","mcp.add.nameRequired":"请输入 MCP 服务器名称。","mcp.add.config":"配置（JSON）","mcp.add.configInvalid":"配置必须是 JSON 对象。","mcp.add.done":e=>`已添加 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.edit.title":"编辑 MCP 服务器","mcp.edit.description":"修改描述或配置。名称和保存位置不可修改。","mcp.edit.save":"保存修改","mcp.edit.saving":"正在保存修改…","mcp.edit.done":e=>`已更新 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.edit.notFound":"设置中已不存在该 MCP 服务器。","mcp.runtime.notUpdated":"配置已保存，但未同步当前会话。","mcp.runtime.removeNotUpdated":"配置已删除，但未同步当前会话。","mcp.discovery.empty":"尚未配置 MCP 服务器。","mcp.discovery.initializing":"正在初始化 MCP 服务器…","mcp.discovery.timeout":"MCP 发现耗时较长，请刷新后查看状态。","mcp.add.settingsUnavailable":"无法读取工作区设置。","mcp.action.remove":"删除","mcp.remove.title":"删除 MCP 服务器","mcp.remove.description":e=>`确定从当前工作区移除 MCP 服务器“${(e==null?void 0:e.name)??""}”吗？`,"mcp.remove.description.global":e=>`确定从全局设置中移除 MCP 服务器“${(e==null?void 0:e.name)??""}”吗？`,"mcp.remove.done":e=>`已删除 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.remove.notWorkspace":"此 MCP 服务器不在工作区设置中。","mcp.source.all":"全部","mcp.noSchema":"没有输入 schema。","mcp.oauth.open":"打开认证页面","mcp.serverTool":"服务器工具","mcp.servers":e=>`${(e==null?void 0:e.count)??0} 个服务器`,"mcp.configuredServers":"已配置的 MCP 服务器：","mcp.fromExtension":e=>`（来自 ${(e==null?void 0:e.name)??""}）`,"mcp.extensionMcp":"扩展 MCP","mcp.invalidReason":e=>`无效：${(e==null?void 0:e.reason)??""}`,"mcp.invalidReasonLabel":"原因：","mcp.invalidToolHelp":"工具必须同时包含 name 和 description 才能被 LLM 使用。","mcp.invalidToolWarning":"警告：这个工具不能被 LLM 调用","mcp.manageServers":"管理 MCP servers","mcp.viewDetails":"查看详情","mcp.parameters":"参数：","mcp.required":" 必填","mcp.resources":"资源","mcp.resourcesUnavailable":"无法加载资源详情。","mcp.noResources":"没有资源。","mcp.resourceCount":e=>`${(e==null?void 0:e.count)??0} 个资源`,"mcp.promptCount":e=>`${(e==null?void 0:e.count)??0} 个提示词`,"mcp.resource.uriLabel":"URI：","mcp.resource.nameLabel":"名称：","mcp.resource.mimeTypeLabel":"MIME 类型：","mcp.resource.sizeLabel":"大小：","mcp.resource.bytes":e=>`${(e==null?void 0:e.count)??0} 字节`,"mcp.scrollPosition":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0}`,"mcp.shortcut.back":"Esc 返回","mcp.shortcut.close":"Esc 关闭","mcp.shortcut.selectBack":"↑↓ 导航 · Enter 选择 · Esc 返回","mcp.shortcut.selectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","mcp.settings":"设置","mcp.extension":e=>`扩展：${(e==null?void 0:e.name)??""}`,"mcp.starting":e=>`⏳ MCP 服务器正在启动（${(e==null?void 0:e.count)??0} 个初始化中）...`,"mcp.startingNote":"注意：首次启动可能需要更长时间。工具可用性会自动更新。","mcp.restartSkipped":e=>`已跳过 ${(e==null?void 0:e.name)??""}：${(e==null?void 0:e.reason)??""}`,"mcp.restarted":e=>`已重启 ${(e==null?void 0:e.name)??""}，耗时 ${(e==null?void 0:e.duration)??0}ms`,"mcp.restartEntries":e=>`已重启 ${(e==null?void 0:e.name)??""} 的 ${(e==null?void 0:e.restarted)??0}/${(e==null?void 0:e.total)??0} 个条目${e!=null&&e.failedReasons?`（失败：${e.failedReasons}）`:""}`,"mcp.source":"来源","mcp.source.extension":"扩展","mcp.source.project":"项目 MCP（.mcp.json）","mcp.source.workspace":"工作区设置","mcp.source.user":"全局设置","mcp.status":"状态","mcp.status.blocked":"已阻止","mcp.status.authenticating":"认证中","mcp.status.needsApproval":"待审批","mcp.status.rejected":"已拒绝","mcp.status.connected":"已连接","mcp.status.connecting":"连接中","mcp.status.disconnected":"未连接","mcp.status.disconnectedTitle":"已断开","mcp.status.disabled":"已禁用","mcp.status.ready":"就绪","mcp.status.starting":"启动中...（首次启动可能需要更长时间）","mcp.status.unknown":"未知","mcp.tipDesc":"显示 server 和工具描述","mcp.tipNodesc":"隐藏描述","mcp.tipSchema":"显示工具参数 schema","mcp.tips":"💡 提示：","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsLabel":"工具：","mcp.title":"MCP 服务器","mcp.toolDetail":"工具详情","mcp.tools":"工具","mcp.toolsForServer":e=>`${(e==null?void 0:e.name)??"Server"} 的工具`,"mcp.transport":"传输协议","mcp.use":"使用","mcp.userMcp":"全局 MCP","mcp.workingDirectory":"工作目录","goal.aborted":"目标已中止","goal.achieved":"目标已达成","goal.check":"目标检查","goal.cleared":"目标已清除","goal.failed":"目标未能达成","goal.judge":"判断","goal.label":"目标","goal.lastCheck":"上次检查","goal.notYetMet":"尚未满足","goal.set":"目标已设置","goal.statusActive":"/goal 运行中","goal.turn":e=>`${(e==null?void 0:e.count)??0} 轮`,"goal.turnLabel":e=>`第 ${(e==null?void 0:e.count)??0} 轮`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} 轮`,"goals.title":"目标","goals.subtitle":"目标会让所在会话持续工作，直到条件满足。这里只列出当前已加载的会话——目标只在会话运行时才会推进。","goals.loading":"正在加载目标…","goals.count":e=>`${(e==null?void 0:e.count)??0} 个进行中的目标`,"goals.empty":"没有进行中的目标。用 /goal <条件> 设置一个。","goals.refresh":"刷新","goals.new":"新建目标","goals.newHint":"目标会在一个新会话中启动，并持续运行直到条件满足。","goals.condition":"条件","goals.conditionPlaceholder":"例如：所有测试通过且 lint 无告警","goals.cancel":"取消","goals.create":"设置目标","goals.creating":"正在启动…","goals.clear":"清除目标","goals.clearConfirm":e=>`确定清除目标“${(e==null?void 0:e.condition)??""}”？`,"goals.running":"工作中","goals.idle":"等待中","goals.dropped":e=>`有 ${(e==null?void 0:e.count)??0} 个会话无法访问——它们正在运行的目标未显示在此列表中。`,"goals.notYetEvaluated":"尚未判定","goals.openSessionHint":"打开该目标所在的会话","goals.error.emptyCondition":"请输入目标条件。","goals.error.clearKeyword":e=>`“${(e==null?void 0:e.word)??""}”是清除目标的指令，不是一个条件。请描述要达成的条件。`,"goals.error.createFailed":"启动目标失败","goals.error.clearFailed":"清除目标失败","memory.add":"添加","memory.add.desc":"写入一条持久 memory","memory.autoDream":e=>`自动整理：${(e==null?void 0:e.status)??"未知"} · ${(e==null?void 0:e.lastDream)??"从未"} · /dream 立即运行`,"memory.autoDreamUnsupported":"web-shell 暂不支持修改自动整理设置。","memory.autoFolder":"打开自动记忆文件夹","memory.autoMemory":e=>`自动记忆：${(e==null?void 0:e.status)??"未知"}`,"memory.autoMemoryUnsupported":"web-shell 暂不支持修改自动记忆设置。","memory.autoSkill":e=>`自动技能：${(e==null?void 0:e.status)??"未知"}`,"memory.autoSkillUnsupported":"web-shell 暂不支持修改自动技能设置。","memory.chooseScope":"选择 memory 的保存位置","memory.closed":"Memory 面板已关闭。","memory.contentEmpty":"Memory 内容为空。","memory.file":"Memory 文件","memory.fileOpen":"Memory 文件已打开。","memory.fileTruncated":"Memory 文件已打开，内容已截断。","memory.files":"Memory 文件","memory.footer":"Enter 确认 · Esc 取消","memory.footer.back":"Esc 返回","memory.global":"用户级","memory.global.desc":"保存到全局用户 memory 文件","memory.globalReadUnsupported":"全局 memory 位于当前 workspace 之外，当前 daemon 文件读取接口不能打开它的内容。","memory.loading":"正在加载 memory...","memory.loadingFile":"正在加载 memory 文件...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"从未","memory.noFiles":"未找到 memory 文件。","memory.on":"开","memory.openFolderUnsupported":"web-shell 暂不支持打开自动记忆文件夹。","memory.placeholder":e=>`写入${(e==null?void 0:e.scope)??"memory"}内容...`,"memory.project":"项目级","memory.project.desc":"保存到当前 workspace memory 文件","memory.refresh":"刷新","memory.refresh.desc":"重新加载 memory 文件信息","memory.refreshed":"Memory 已刷新。","memory.save":"保存 Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} 已保存：${(e==null?void 0:e.bytes)??0} 字节 -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"保存中...","memory.show":"查看","memory.show.desc":"查看已配置的 memory 文件","memory.status":"Workspace 和用户 memory 文件","memory.unknown":"未知","memory.write":"写入 memory 内容","mode.auto":"智能审批","mode.auto.desc":"使用分类器评估工具调用，安全操作自动批准，风险操作阻止或请求确认","mode.auto.notice":"Auto 模式已启用。LLM 分类器会评估每个工具调用，自动批准安全操作，拦截危险操作。退出方式：Shift+Tab 或 /approval-mode default。","mode.footer":"(Enter 选择，Esc 取消)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"计划","mode.label.default":"请求批准","mode.label.auto-edit":"自动编辑","mode.label.auto":"智能审批","mode.label.yolo":"完全访问权限","mode.listLabel.plan":"计划（plan）","mode.listLabel.default":"请求批准（default）","mode.listLabel.auto-edit":"自动编辑（auto-edit）","mode.listLabel.auto":"智能审批（auto）","mode.listLabel.yolo":"完全访问权限（yolo）","mode.desc.plan":"仅分析，不修改文件或执行命令","mode.desc.default":"执行命令、编辑文件或访问外部资源前请求确认","mode.desc.auto-edit":"自动批准文件编辑，命令执行等敏感操作仍会询问","mode.desc.auto":"自动评估工具风险，安全操作直接执行，风险操作再确认","mode.desc.yolo":"自动批准所有工具调用，适合可信任务环境","mode.select":"审批模式","mode.autoApproved":e=>e!=null&&e.tool?`已自动批准：${e.tool}`:"切换模式后自动批准了待处理的工具调用。","mode.auto-edit":"自动编辑","mode.auto-edit.desc":"自动批准文件读写操作","mode.default":"默认模式","mode.default.desc":"每次工具调用都需要确认","mode.plan":"Plan 模式","mode.plan.desc":"仅分析和规划，不执行工具","mode.unknown":"未知模式","mode.yolo":"YOLO 模式","mode.yolo.desc":"自动批准所有操作","plan.title":"计划","model.contextWindow":"上下文窗口","model.contextWindow.unknown":"（未知）","model.current":e=>`当前：${(e==null?void 0:e.model)??"未知"}`,"model.modality":"模态","model.modality.text":"文本","model.modality.textOnly":"仅文本","model.modality.image":"图片","model.modality.pdf":"PDF","model.modality.audio":"音频","model.modality.video":"视频","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"（默认）","model.notSet":"（未设置）","model.footer":"Enter 选择，↑↓ 导航，Esc 关闭","model.searchHint":"按 / 搜索","model.fastHint":"用于建议和旁路任务","model.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的模型`,"model.none":"没有可用模型","model.select":"选择模型","model.setFast":"设置 Fast Model","model.setVoice":"设置语音模型","model.setVision":"设置视觉模型","model.switch":"切换模型","model.unknown":"未知","resume.current":"当前","resume.activePrompt":"正在运行","resume.filter":"筛选","resume.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"resume.none":"没有可恢复的会话","resume.pressSearch":"按 / 搜索","resume.search":"搜索","resume.title":"恢复会话","parallelAgents.title":"并行智能体","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} 完成`,"skills.actions":"Skill 操作","skills.disable":"禁用","skills.disabled":"Skill 已禁用。","skills.enable":"启用","skills.enabled":"Skill 已启用。","skills.install.action":"上传技能","skills.install.description":"从 GitHub、本地文件夹或 ZIP 压缩包安装技能。","skills.install.error.authentication":"上传技能需要身份认证。","skills.install.error.folderRequired":"请输入文件夹路径。","skills.install.error.githubRequired":"请输入 GitHub SKILL.md 地址。","skills.install.error.invalidName":"技能名称缺失或包含不支持的字符。","skills.install.error.manifestMissing":"技能包根目录中必须包含 SKILL.md 文件。","skills.install.error.invalidPackage":"技能包无效，请检查目录结构和 SKILL.md 内容。","skills.install.error.zipTooLarge":"ZIP 文件不能超过 6 MB。","skills.install.error.invalidFolder":"请输入有效的本地技能文件夹路径。","skills.install.error.githubFailed":"无法从 GitHub 下载技能，请检查地址或认证信息后重试。","skills.install.error.invalidScope":"请选择工作区或全局安装位置。","skills.install.error.invalidSource":"当前 daemon 无法识别这种上传来源，请重启已更新的 daemon 后重试。","skills.install.error.notFound":"未找到指定的技能。","skills.install.error.nameRequired":"请输入技能名称。","skills.install.error.untrusted":"请先信任当前工作区，再上传技能。","skills.install.failed":"上传技能失败。","skills.install.folder":"本地文件夹","skills.install.folderPath":"文件夹路径","skills.install.githubUrl":"SKILL.md 地址","skills.install.name":"技能名称","skills.install.scope":"安装位置","skills.install.scope.global":"全局","skills.install.scope.workspace":"工作区","skills.install.selectZip":"请选择 ZIP 压缩包。","skills.install.title":"上传技能","skills.install.succeeded":e=>`技能“${(e==null?void 0:e.name)??""}”上传成功。`,"skills.install.zipSelected":e=>`已选择：${(e==null?void 0:e.name)??""}`,"skills.delete.action":"删除技能","skills.delete.description":e=>`确定从磁盘删除“${(e==null?void 0:e.name)??""}”吗？此操作无法撤销。`,"skills.delete.failed":"删除技能失败。","skills.delete.succeeded":e=>`技能“${(e==null?void 0:e.name)??""}”删除成功。`,"skills.delete.title":"删除技能？","skills.empty":"没有可用 skill。","skills.count":e=>[`${(e==null?void 0:e.count)??0} 个技能`,...e!=null&&e.enabled?[`已启用 ${e.enabled} 个`]:[],...e!=null&&e.disabled?[`已禁用 ${e.disabled} 个`]:[]].join("，"),"skills.details":"Skill 详情","skills.extension":"所属扩展","skills.filter.all":"全部","skills.filter.bundled":"内置","skills.filter.extension":"扩展","skills.filter.label":"按来源筛选 Skills","skills.filter.project":"工作区设置","skills.filter.status.all":"全部","skills.filter.status.disabled":"已禁用","skills.filter.status.enabled":"已启用","skills.filter.status.label":"按状态筛选技能","skills.filter.user":"全局设置","skills.hint":"提示","skills.invocation":"调用方式","skills.level":"作用域","skills.level.bundled":"内置","skills.level.extension":"扩展","skills.level.project":"项目","skills.level.user":"全局","skills.loading":"正在加载 skills...","skills.manualReference":"手动引用","skills.manualReferenceHint":"模型无法自动识别，需手动引用 skill","skills.model":"模型","skills.modelAccess":"模型调用","skills.modelAccess.disabled":"不可由模型调用","skills.modelAccess.enabled":"可由模型调用","skills.modelInvocable":"模型可用","skills.noDescription":"暂无描述","skills.noMatches":"没有匹配的 Skill。","skills.notToggleable":"此 Skill 不支持启用或禁用。","skills.run":"引用 skill","skills.search":"搜索 Skills…","skills.status":"状态","skills.status.disabled":"已禁用","skills.status.enabled":"已启用","skills.toggleFailed":"更新 Skill 失败。","skills.error.inactiveExtension":"该技能所属扩展当前未启用，请先启用对应扩展。","skills.toggleUnsupported":"当前连接的 daemon 不支持启用或禁用 Skill。","skills.title":"Skills","plugins.extensions":"扩展","plugins.agents":"智能体","plugins.mcp":"MCP","plugins.mcpLoadFailed":"MCP 状态加载失败","plugins.sections":"插件分类","plugins.skills":"技能","plugins.title":"插件","plugins.tools":"工具","stats.accepted":"已接受：","stats.agreementRate":"总体同意率：","stats.api":"API","stats.apiTime":"API 耗时","stats.avgDuration":"平均耗时","stats.avgLatency":"平均延迟","stats.cached":"缓存","stats.cacheDesc":"的输入 Token 来自缓存，降低了成本。","stats.calls":"调用次数","stats.codeChanges":"代码变更","stats.decisionSummary":"用户决策摘要","stats.duration":"时长","stats.errors":"错误数","stats.inputTokens":"输入 Token","stats.metric":"指标","stats.modelStats":"模型统计（技术细节）","stats.modelTip":"提示：运行 /stats model 查看完整 Token 明细。","stats.modelUsage":"模型使用","stats.modified":"已修改：","stats.noApiCalls":"本次会话暂无 API 调用。","stats.noToolCalls":"本次会话暂无工具调用。","stats.outputTokens":"输出 Token","stats.overview":"会话概览","stats.performance":"性能","stats.prompts":"对话轮次","stats.rejected":"已拒绝：","stats.reqs":"请求","stats.requests":"请求数","stats.savingsHighlight":"节省亮点：","stats.successRate":"成功率","stats.thoughts":"思考","stats.title":"会话统计","stats.tokens":"Token","stats.toolCalls":"工具调用","stats.toolName":"工具名称","stats.toolStats":"工具统计（技术细节）","stats.toolTime":"工具耗时","stats.total":"总计","stats.totalReviewed":"已审核建议总数：","status.contextUsed":e=>`上下文已用 ${(e==null?void 0:e.pct)??"0.0"}%`,"status.disconnected":"断开连接","status.modeHint":"(shift + tab 或点击切换)","status.shortcuts":"? 查看快捷键","stream.cancel":"esc 取消","stream.cancelArmed":"再按一次 Esc 停止","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`当前：${(e==null?void 0:e.theme)??""}`,"theme.auto":"自动","theme.dark":"暗色","theme.dark.desc":"仿终端暗色皮肤。","theme.light":"亮色","theme.light.desc":"仿终端亮色皮肤。","theme.title":"主题","todo.allDone":"任务已全部完成","todo.collapse":"折叠任务列表","todo.completedAbove":e=>`✓ 已完成 ${(e==null?void 0:e.count)??0} 项`,"todo.detail.api":"API","todo.detail.cached":"缓存","todo.detail.end":"结束","todo.detail.hide":"收起任务明细","todo.detail.input":"输入","todo.detail.noResources":"未采集到该任务的 Token 与耗时明细。","todo.detail.output":"输出","todo.detail.sectionSpent":"耗时","todo.detail.sectionTime":"时间","todo.detail.sectionTokens":"Token","todo.detail.show":"查看任务明细","todo.detail.start":"开始","todo.detail.tool":"工具","todo.expand":"展开任务列表","todo.more":e=>`... 还有 ${(e==null?void 0:e.count)??0} 项`,"todo.moreAbove":e=>`... 前面还有 ${(e==null?void 0:e.count)??0} 项`,"todo.showLess":"收起","todo.stepProgress":e=>`第 ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0} 步`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"当前任务","chat.scrollToBottom":"回到底部","chatHeader.toggleEnvironment":"切换环境信息","chatHeader.toggleRightPanel":"切换右侧扩展区","environment.title":"环境信息","environment.changes":"变更","environment.changeCount":e=>`${(e==null?void 0:e.count)??0} 项变更`,"environment.clean":"无变更","environment.workspace":"工作区","environment.branch":"分支","environment.history":"提交历史","environment.agents":"子智能体","environment.unnamedAgent":e=>`智能体（${(e==null?void 0:e.index)??0}）`,"environment.unavailable":"不可用","userMessage.showMore":"显示更多","userMessage.showLess":"收起","userMessage.sendFailed":"发送失败","userMessage.retrySend":"重新发送消息","turn.processed":"已处理","turn.processing":"处理中","turn.collapse":"折叠步骤","turn.expand":"展开步骤","turn.cached":"缓存","turn.executionSteps":e=>`${(e==null?void 0:e.count)??0} 步`,"turn.toolCalls":e=>`工具 ${(e==null?void 0:e.count)??0} 次`,"turn.thinkingCount":e=>`思考 ${(e==null?void 0:e.count)??0} 次`,"turn.stopped":"你已取消请求","message.renderError":"此消息无法显示。","tasks.title":"后台任务","tasks.empty":"当前没有运行中的任务","tasks.refreshStale":"任务状态可能已过期，正在重连...","tasks.cancelFailed":"取消任务失败","tasks.alreadyStopped":"任务已停止","tasks.moreAbove":e=>`^ 上方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.moreBelow":e=>`v 下方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.running":"运行中","tasks.completed":"已完成","tasks.failed":"失败","tasks.cancelled":"已停止","tasks.paused":"已暂停","tasks.kind.shell":"Shell","tasks.kind.monitor":"监控","tasks.action.stop":"停止","tasks.action.abandon":"放弃","tasks.action.confirmStop":"确认停止","tasks.action.confirmAbandon":"确认放弃","tasks.action.confirmHint":"这会终结当前阻塞轮次。","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.confirmStop":"再按 x 确认停止 · 会终结当前阻塞轮次","tasks.shortcut.select":"↑/↓ 选择","tasks.shortcut.view":"Enter 查看","tasks.shortcut.stop":"x 停止","tasks.shortcut.abandon":"x 放弃","tasks.shortcut.listClose":"←/Esc 关闭","tasks.shortcut.detailBack":"← 返回","tasks.shortcut.detailClose":"Esc/Enter/Space 关闭","tasks.shortcut.close":"Esc 关闭","tasks.shortcut.cancelConfirm":"Esc 取消","tasks.detail.workingDir":"工作目录","tasks.detail.outputFile":"输出文件","tasks.detail.command":"命令","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} 个事件`,"tasks.detail.exit":e=>`退出码 ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} 个已丢弃`,"tasks.detail.error":"错误","tasks.detail.stoppedBecause":"停止原因","tasks.detail.resumeBlocked":"恢复被阻止","tasks.detail.progress":"执行进度","tasks.detail.prompt":"提示词","tasks.detail.type":"类型","tasks.detail.runtime":"时间","tasks.detail.eventCount":"事件数","tasks.detail.pid":"PID","tasks.detail.lastEvent":"最近事件","tasks.detail.droppedCount":"丢弃行数","tasks.detail.exitCode":"退出码","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"工具数量","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} 次工具调用`,"tasks.detail.nesting":"嵌套","tasks.detail.nestingValue":e=>`第 ${(e==null?void 0:e.level)??"?"} 层 · 来自 ${(e==null?void 0:e.parent)??"?"}`,"tasks.detail.nestingLevel":e=>`第 ${(e==null?void 0:e.level)??"?"} 层`,"tasks.row.from":e=>`来自 ${(e==null?void 0:e.parent)??"?"}`,"tasks.row.nested":"嵌套","tips.items":"输入 / 查看所有可用命令。|使用 @ 引用文件路径。|按 Esc 取消正在进行的请求。|使用 Shift+Enter 换行。|按 ↑↓ 浏览历史消息。","tools.available":"可用工具:","tools.none":"没有可用工具。","tools.empty":"没有可用的内置工具。请先打开一个会话。","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space 查看详情 · ":""}t 切换 ${e.name} · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","tools.details.hide":"收起详情","tools.details.show":"展开详情","tools.description":"描述","tools.details":"工具详情","tools.loading":"正在加载工具...","tools.name":"工具名称","tools.noDescription":"暂无描述","tools.noMatches":"没有匹配的工具。","tools.search":"搜索工具…","tools.status":"状态","tools.status.disabled":"已禁用","tools.status.enabled":"已启用","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 已启用`,"tools.title":"工具","tools.update.disable":"禁用","tools.update.enable":"启用","tools.updating":"更新中...","tool.collapse":"▲ 收起","tool.expand":"展开","tool.collapseHint":"收起","tool.status.failed":"执行失败","toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.summary.editedFiles":e=>`已编辑 ${(e==null?void 0:e.count)??0} 个文件`,"toolGroup.summary.ranCommands":e=>`已运行 ${(e==null?void 0:e.count)??0} 条命令`,"toolGroup.summary.readFiles":e=>`已读取 ${(e==null?void 0:e.count)??0} 个文件`,"toolGroup.summary.searched":e=>`已搜索 ${(e==null?void 0:e.count)??0} 次`,"toolGroup.summary.updatedTodos":e=>Number((e==null?void 0:e.count)??0)>1?`已更新任务清单 ${(e==null?void 0:e.count)??0} 次`:"已更新任务清单","toolGroup.summary.provideInformation":"补充信息","toolGroup.summary.askedQuestions":e=>`已询问 ${(e==null?void 0:e.count)??0} 个问题`,"toolGroup.summary.otherTools":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.running":e=>`正在执行 ${(e==null?void 0:e.name)??"工具"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · 共 ${(e==null?void 0:e.count)??0} 个工具`:""}`,"toolGroup.runningPrefix":"正在执行","thinking.expand":"展开思考","thinking.collapse":"收起思考","thinking.running":e=>`正在思考${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.doneBriefly":"思考片刻","thinking.done":e=>e!=null&&e.duration?`已思考 ${e.duration}`:"思考完成","thinking.translate":"翻译","thinking.translation":"思考翻译","thinking.translating":"正在翻译…","thinking.translationThinking":"思考中…","thinking.translationFailed":"翻译失败","thinking.retranslate":"重新翻译","thinking.cancelTranslation":"取消","thinking.closeTranslation":"关闭","thinking.inputTokens":e=>`发送 Token：${(e==null?void 0:e.count)??"--"}`,"thinking.outputTokens":e=>`生成 Token：${(e==null?void 0:e.count)??"--"}`,"welcome.changeModel":"(/model 切换)","welcome.defaultModel":"未知模型","sessionsOverview.count":e=>`${(e==null?void 0:e.count)??0} 个会话`,"sessionsOverview.current":"当前","sessionsOverview.empty":"暂无会话","sessionsOverview.loadFailed":"加载会话失败","sessionsOverview.loading":"正在加载会话…","sessionsOverview.openElsewhere":"已在其他窗口打开","sessionsOverview.openInSplit":"打开到分屏","sessionsOverview.openInSplitHint":"在本窗口内并排显示选中的会话","sessionsOverview.openInTab":"在新标签页打开","sessionsOverview.openInTabHint":"在新标签页中以分屏并排打开选中的会话","sessionsOverview.popupBlocked":"弹出窗口被拦截。请允许本站弹窗，以便在新标签页中打开会话。","sessionsOverview.refresh":"刷新","sessionsOverview.selectAll":"全选","sessionsOverview.splitCap":e=>`只有前 ${(e==null?void 0:e.max)??6} 个选中的会话会进入分屏。`,"sessionsOverview.selectSession":e=>`选择 ${(e==null?void 0:e.name)??""}`,"sessionsOverview.status.idle":"空闲","sessionsOverview.status.needsApproval":"待审批","sessionsOverview.status.running":"运行中","sessionsOverview.title":"会话总览","splitView.title":"分屏","splitView.count":e=>`${(e==null?void 0:e.count)??0} 个窗格`,"splitView.addPane":"添加会话","splitView.closePane":"关闭窗格","splitView.maximizePane":"最大化窗格","splitView.restorePane":"还原窗格","splitView.morePaneActions":"更多窗格操作","splitView.defaultActionLabel":"操作","splitView.paneError":"此会话窗格出错","splitView.paneConnectionError":"连接已断开","splitView.outerApprovalPending":"主会话正在等待审批。","splitView.goToApproval":"前往处理","splitView.empty":"分屏中还没有会话，添加一个开始。","splitView.composerPlaceholder":"给这个会话发消息…","settings.title":"设置","channels.title":"频道","channels.summary":e=>`${(e==null?void 0:e.workspace)??""} · 已配置 ${(e==null?void 0:e.count)??0} 个`,"channels.workspace.current":"当前工作区","channels.loading":"正在加载频道","channels.configured":"已配置频道","channels.availablePlatforms":"可连接平台","channels.availablePlatforms.description":"频道管理目前仅开放以下平台。","channels.platform.available":"已开放","channels.platform.configure":"配置","channels.platform.configureNamed":e=>`配置${(e==null?void 0:e.platform)??"频道"}`,"channels.status.stopped":"已停止","channels.status.starting":"启动中","channels.status.connected":"已连接","channels.status.partial":"部分连接","channels.status.error":"错误","channels.startsWithServe":"随服务启动","channels.unsupported.title":"当前版本不支持频道管理","channels.unsupported.description":"请升级 Qwen Code 到支持频道管理的版本。","channels.readOnly.title":"频道管理为只读模式","channels.readOnly.description":"请使用 bearer token 重启 Qwen Code，以控制频道。","channels.loadError.title":"无法加载频道","channels.empty.title":"尚未配置支持的频道","channels.empty.description":"配置钉钉、企业微信或飞书，让当前工作区接收消息。","channels.runtimeError":"频道运行时错误","channels.action.back":"返回","channels.action.start":"启动","channels.action.stop":"停止","channels.action.restart":"重启","channels.action.retry":"重试","channels.action.edit":"编辑","channels.action.editNamed":e=>`编辑${(e==null?void 0:e.name)??"频道"}`,"channels.action.delete":"删除","channels.action.deleteNamed":e=>`删除${(e==null?void 0:e.name)??"频道"}`,"channels.action.startWithServeNamed":e=>`让 ${(e==null?void 0:e.name)??""} 随服务启动`,"channels.delete.title":e=>`删除${(e==null?void 0:e.name)??"频道"}？`,"channels.delete.description":"该频道将停止运行，并从当前工作区移除。此操作无法撤销。","channels.delete.error":"未能删除频道","channels.editor.addTitle":e=>`配置${(e==null?void 0:e.platform)??"频道"}`,"channels.editor.editTitle":e=>`编辑${(e==null?void 0:e.platform)??"频道"}`,"channels.editor.addDescription":"连接当前工作区与已有的平台应用。","channels.editor.editDescription":"更新公开配置，或明确更改已保存的凭据。","channels.editor.section.identity":"频道标识","channels.editor.section.credentials":"应用凭据","channels.editor.section.access":"准入策略","channels.editor.instanceName":"实例名称","channels.editor.instanceNamePlaceholder":"例如 release-bot","channels.editor.environmentReference":"支持 $ENV_VAR","channels.editor.field.dingtalk.clientId":"Client ID（原 AppKey）","channels.editor.field.dingtalk.clientSecret":"Client Secret（原 AppSecret）","channels.editor.field.wecom.botId":"Bot ID","channels.editor.field.wecom.secret":"Bot Secret","channels.editor.field.wecom.wsUrl":"WebSocket URL","channels.editor.field.feishu.clientId":"App ID","channels.editor.field.feishu.clientSecret":"App Secret","channels.editor.secret.environment":"已保存在环境变量中","channels.editor.secret.stored":"已安全保存","channels.editor.secret.preserve":"保留","channels.editor.secret.replace":"替换","channels.editor.secret.clear":"清除","channels.editor.secret.placeholder":e=>`请输入${(e==null?void 0:e.label)??"密钥"}`,"channels.editor.secret.clearHint":"保存后将移除此凭据。","channels.editor.policy.pairing.title":"配对模式","channels.editor.policy.pairing.description":"用户会收到配对码，经您批准后才能开始对话。","channels.editor.pairing.title":"待处理的配对请求","channels.editor.pairing.description":"批准前，请核对用户提供的配对码是否一致。批准会立即生效，保存或取消都不会撤销已批准的访问。","channels.editor.pairing.refresh":"刷新配对请求","channels.editor.pairing.approve":"批准","channels.editor.pairing.approveFor":e=>`批准${(e==null?void 0:e.sender)??"该请求"}，配对码 ${(e==null?void 0:e.code)??""}`,"channels.editor.pairing.approved":e=>`${(e==null?void 0:e.sender)??"该用户"}现在可以使用此频道。`,"channels.editor.pairing.error":"未能更新配对请求","channels.editor.pairing.unavailable":"暂时无法获取配对请求，请重试。","channels.editor.pairing.retry":"重试","channels.editor.pairing.empty.title":"暂无待处理请求","channels.editor.pairing.empty.description":"用户向机器人发送消息后，新的配对请求会显示在这里。","channels.editor.pairing.saveFirst.title":"请先保存配对模式","channels.editor.pairing.saveFirst.description":"频道以配对模式保存后，待处理请求会显示在这里。","channels.editor.pairing.approvals.title":"已配对用户","channels.editor.pairing.approvals.description":"通过配对获得此频道访问权限的用户 ID。","channels.editor.pairing.approvals.refresh":"刷新已配对用户","channels.editor.pairing.approvals.revoke":"撤销","channels.editor.pairing.approvals.revokeFor":e=>`撤销 ${(e==null?void 0:e.senderId)??"该用户"} 的配对授权`,"channels.editor.pairing.approvals.revoked":e=>`已撤销 ${(e==null?void 0:e.senderId)??"该用户"} 的配对授权。`,"channels.editor.pairing.approvals.error":"未能更新已配对用户","channels.editor.pairing.approvals.unavailable":"暂时无法获取已配对用户，请重试。","channels.editor.pairing.approvals.empty.title":"暂无已配对用户","channels.editor.pairing.approvals.empty.description":"批准配对请求后，用户 ID 会显示在这里。","channels.editor.pairing.approvals.confirm.title":e=>`撤销 ${(e==null?void 0:e.senderId)||"该用户"} 的配对授权？`,"channels.editor.pairing.approvals.confirm.description":"只会移除通过配对获得的授权，不会更改频道配置中的白名单访问权限。","channels.editor.pairing.approvals.confirm.action":"撤销授权","channels.editor.pairing.allowlist.title":"配置白名单","channels.editor.pairing.allowlist.description":"撤销配对授权后，配置白名单中的用户仍然可以访问此频道。","channels.editor.policy.open.title":"开放模式","channels.editor.policy.open.description":"所有能够访问机器人的用户均可直接开始对话。","channels.editor.validation.required":e=>`${(e==null?void 0:e.label)??"此字段"}为必填项。`,"channels.editor.validation.duplicate":"已存在同名频道。","channels.editor.validation.invalidName":"请使用其他实例名称。","channels.editor.validation.number":"请输入有效数字。","channels.editor.validation.policy":"请选择准入策略。","channels.editor.saveError":"未能保存更改","channels.editor.reloadLatest":"加载最新配置","channels.editor.cancel":"取消","channels.editor.save":"保存","settings.loading":"正在加载设置...","settings.empty":"暂无可用设置。","settings.footer":"↑↓ 导航  Enter 切换  Tab 切换作用域  r 刷新  ESC 关闭","settings.footer.edit":"Enter 保存  ESC 取消","settings.footer.theme":"↑↓ 导航  Enter 选择  ESC 返回","settings.scope.user":"用户","settings.scope.workspace":"工作区","settings.value.on":"开","settings.value.off":"关","settings.action.edit":"编辑","settings.action.select":"选择","settings.action.save":"保存","settings.modifiedIn":e=>`（已在${(e==null?void 0:e.scope)??""}中修改）`,"settings.alsoModifiedIn":e=>`（同时在${(e==null?void 0:e.scope)??""}中修改）`,"settings.invalidNumber":"无效数字","settings.requiresRestart":"此更改需要重启后才能生效。","settings.models.title":"模型","settings.models.add":"+ 增加模型","settings.models.setCurrent":"设为当前","settings.models.current":"当前","settings.models.runtime":"运行时","settings.models.delete":"删除","settings.models.confirmDelete":"确认删除","settings.models.cancel":"取消","settings.models.empty":"暂无配置的模型。","settings.models.loading":"正在加载模型…","settings.models.deleteFailed":"删除模型失败","settings.models.fallbacks.title":"模型回退","settings.models.fallbacks.hint":e=>`最多选择 ${(e==null?void 0:e.max)??3} 个；主模型容量不足时按顺序回退。`,"settings.models.fallbacks.confirm":"确认","settings.models.fallbacks.empty":"暂无可选模型。","settings.models.fallbacks.saveFailed":"保存回退模型失败","settings.models.fallbacks.limitReached":e=>`最多可选 ${(e==null?void 0:e.max)??3} 个回退模型；请先取消一个再选择其他。`,"settings.corrupted":e=>`设置文件已损坏${(e==null?void 0:e.recovered)==="true"?"（已从备份恢复）":""}`,"settings.label.ui.chatWidth":"屏宽","settings.description.ui.chatWidth":"纯前端的聊天内容宽度设置，保存在当前浏览器中。","settings.option.ui.chatWidth.1000":"常规","settings.option.ui.chatWidth.wide":"超宽","settings.category.General":"通用","settings.category.UI":"界面","settings.category.Privacy":"隐私","settings.category.Model":"模型","settings.category.Context":"上下文","settings.category.Tools":"工具","settings.category.Daemon":"守护进程","settings.category.Experimental":"实验性","settings.category.Advanced":"高级","settings.label.general.enableAutoUpdate":"启用自动更新","settings.description.general.enableAutoUpdate":"启动时自动检查并安装更新。","settings.label.general.showSessionRecap":"显示会话回顾","settings.description.general.showSessionRecap":"离开终端一段时间后返回时，自动显示一行“上次停在这里”的回顾。默认关闭。也可以随时使用 /recap 手动触发。","settings.label.general.sessionRecapAwayThresholdMinutes":"会话回顾离开阈值（分钟）","settings.description.general.sessionRecapAwayThresholdMinutes":"终端失焦多少分钟后，下一次重新聚焦时触发自动回顾。默认与 Claude Code 一致为 5 分钟；如果只是短暂切换窗口，可以调高。","settings.label.general.cleanupPeriodDays":"清理周期（天）","settings.description.general.cleanupPeriodDays":"~/.qwen/file-history/ 中用于 /rewind 的会话备份保留天数。后台清理最多每天运行一次。设为 0 表示最小保留（约 1 小时），仍会保护最近一小时触碰过的会话和当前活动会话。","settings.label.general.gitCoAuthor.commit":"归因：commit","settings.description.general.gitCoAuthor.commit":"通过 Qwen Code 创建 commit 时，添加 Co-authored-by trailer，并写入逐文件 AI 归因 git note。关闭后两者都会跳过。","settings.label.general.gitCoAuthor.pr":"归因：PR","settings.description.general.gitCoAuthor.pr":"运行 gh pr create 时，在 PR 描述中追加 Qwen Code 归因行。","settings.label.general.language":"语言：界面","settings.description.general.language":"用户界面的语言。使用 auto 可根据系统设置自动检测；也可以在 ~/.qwen/locales/ 中放置 JS 语言文件来使用自定义语言代码。","settings.label.general.dynamicCommandTranslation":"语言：动态命令翻译","settings.description.general.dynamicCommandTranslation":"为动态 slash command 描述启用 AI 翻译。关闭后动态命令使用原始描述，也不会触发翻译模型调用。","settings.label.general.preventSystemSleep":"运行时防止系统睡眠","settings.description.general.preventSystemSleep":"当 Qwen Code 正在流式生成模型回复或执行工具时防止系统睡眠。空闲输入状态和权限确认状态不会阻止睡眠。","settings.label.ui.theme":"主题","settings.description.ui.theme":"界面的颜色主题。","settings.label.ui.hideTips":"隐藏提示","settings.description.ui.hideTips":"隐藏界面中的帮助提示。","settings.label.ui.enableWelcomeBack":"显示欢迎回来对话框","settings.description.ui.enableWelcomeBack":"回到有历史会话的项目时显示欢迎回来对话框。选择“开始新的聊天会话”后，在项目摘要变化前不会再次显示。","settings.label.ui.enableUserFeedback":"启用用户反馈","settings.description.ui.enableUserFeedback":"对话结束后显示可选反馈对话框，帮助改进 Qwen 表现。","settings.label.ui.enableFollowupSuggestions":"启用后续建议","settings.description.ui.enableFollowupSuggestions":"任务完成后显示上下文相关的后续建议。按 Tab 或右方向键接受，按 Enter 接受并提交。","settings.label.ui.compactMode":"紧凑模式","settings.description.ui.compactMode":"隐藏工具输出和思考内容，显示更简洁的视图（可用 Ctrl+O 切换）。","settings.label.ui.compactInline":"紧凑内联","settings.description.ui.compactInline":"在每个分组内紧凑显示工具内容，而不是跨分组合并。需要先启用紧凑模式。","settings.label.ui.shellOutputMaxLines":"Shell 输出最大行数","settings.description.ui.shellOutputMaxLines":"内联显示的 shell 输出最大行数。设为 0 可取消限制并显示完整输出；隐藏行数仍会通过 +N lines 指示器展示。","settings.label.privacy.usageStatisticsEnabled":"启用使用统计","settings.description.privacy.usageStatisticsEnabled":"启用使用统计收集。","settings.label.fastModel":"快速模型","settings.description.fastModel":"用于生成提示建议和推测执行的模型。留空则使用主模型。较小/更快的模型（例如 qwen3-coder-flash）可以降低延迟和成本。","settings.label.visionModel":"视觉模型","settings.description.visionModel":"用于视觉桥接的图像能力模型。留空则自动选择。","settings.label.context.fileFiltering.respectGitIgnore":"遵守 .gitignore","settings.description.context.fileFiltering.respectGitIgnore":"搜索时遵守 .gitignore 文件。","settings.label.context.fileFiltering.respectQwenIgnore":"遵守 .qwenignore","settings.description.context.fileFiltering.respectQwenIgnore":"搜索时遵守 .qwenignore 文件。","settings.label.context.fileFiltering.enableFuzzySearch":"启用模糊搜索","settings.description.context.fileFiltering.enableFuzzySearch":"搜索文件时启用模糊搜索。","settings.label.tools.toolSearch.enabled":"启用 ToolSearch","settings.description.tools.toolSearch.enabled":"启用后，MCP 工具会通过 ToolSearch 按需加载，以减少提示词大小。对于依赖前缀 KV 缓存的模型（如 DeepSeek），可关闭此项来保持提示词前缀稳定并提高缓存命中率。","settings.label.tools.shell.enableInteractiveShell":"交互式 Shell（PTY）","settings.description.tools.shell.enableInteractiveShell":"使用 node-pty 提供交互式 shell 体验。PTY 不可用时回退到 child_process。","settings.label.tools.computerUse.enabled":"启用 Computer Use","settings.description.tools.computerUse.enabled":"启用后（默认），会注册 9 个 computer_use__* 延迟内置工具。","settings.label.policy.permissionStrategy":"权限协调策略","settings.description.policy.permissionStrategy":"多个客户端连接时权限请求的决策方式。first-responder 表示任意客户端先响应者生效；designated 表示仅提示发起方决策；consensus 表示需要 N-of-M 投票同意；local-only 表示只有 loopback 客户端可决策。需要重启 daemon 后生效。","settings.option.policy.permissionStrategy.first-responder":"先响应者","settings.option.policy.permissionStrategy.designated":"指定发起方","settings.option.policy.permissionStrategy.consensus":"共识法定人数","settings.option.policy.permissionStrategy.local-only":"仅本机","settings.label.experimental.enableCronTools":"启用 Cron/Loop 工具","settings.description.experimental.enableCronTools":"启用会话内 cron/loop 工具（实验性）。启用后，模型可以用 cron_create、cron_list 和 cron_delete 创建周期性提示。也可通过 QWEN_CODE_ENABLE_CRON=1 环境变量启用。","settings.label.experimental.emitToolUseSummaries":"工具使用摘要","settings.description.experimental.emitToolUseSummaries":"每个工具批次完成后生成一个简短的 LLM 标签。紧凑模式下会替代通用的 Tool × N 标题；完整模式下显示为工具组下方的弱化 ● <label> 行。需要配置快速模型。","settings.label.agents.arena.preserveArtifacts":"保留 Arena 产物","settings.description.agents.arena.preserveArtifacts":"启用后，Arena worktree 和会话状态文件会在会话结束或主智能体退出后保留。","welcome.modeHint":"Shift+Tab 或 /approval-mode","welcome.prompt":"你想构建什么？","welcome.titlePrefix":"欢迎使用","welcome.tipLabel":"提示："},pSe={en:nD,"zh-CN":mSe},gSe={en:"English [en]","zh-CN":"中文 [zh-CN]"},jee=h.createContext({language:"en",t:e=>e});function jf(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function rD(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return jf(typeof navigator<"u"?navigator.language:void 0);if(t==="zh"||t==="zh-cn"||t==="chinese"||t==="中文")return"zh-CN";if(t==="en"||t==="en-us"||t==="english")return"en"}}function sD(e){return gSe[e]}function iD(e){const t=pSe[e];return(n,r)=>{const s=t[n]??nD[n]??n;return typeof s=="function"?s(r):s}}function bSe({language:e,children:t}){const n=h.useMemo(()=>({language:e,t:iD(e)}),[e]);return a.jsx(jee.Provider,{value:n,children:t})}function rt(){return h.useContext(jee)}const Nee=h.createContext(null);function Gu(){return h.useContext(Nee)}const ySe="_row_19m4s_1",vSe="_tip_19m4s_13",wSe="_chatRow_19m4s_35",xSe="_chatTip_19m4s_43",kSe="_chatActions_19m4s_56",_Se="_copyButton_19m4s_71",Cm={row:ySe,tip:vSe,chatRow:wSe,chatTip:xSe,chatActions:kSe,copyButton:_Se};function WN({timestamp:e,children:t,chatMode:n=!1,copyText:r,copyTitle:s="Copy"}){const[i,o]=h.useState(!1),l=h.useCallback(()=>{var u;r&&((u=navigator.clipboard)==null||u.writeText(r).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[r]);if(e===void 0&&!r)return a.jsx(a.Fragment,{children:t});const c=r?a.jsx("button",{type:"button",className:Cm.copyButton,title:s,"aria-label":s,onClick:l,children:i?a.jsx(CSe,{}):a.jsx(SSe,{})}):null;return e===void 0?a.jsxs("div",{className:n?Cm.chatRow:Cm.row,children:[t,c]}):a.jsxs("div",{className:n?Cm.chatRow:Cm.row,children:[t,n?a.jsxs("span",{className:Cm.chatActions,children:[a.jsx("span",{className:Cm.chatTip,"aria-hidden":"true",children:Sy(e)}),c]}):a.jsx("span",{className:Cm.tip,"aria-hidden":"true",children:Sy(e)})]})}function SSe(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.jsx("path",{d:"M5.2 4.4V3.2c0-.7.5-1.2 1.2-1.2h5.4c.7 0 1.2.5 1.2 1.2v5.4c0 .7-.5 1.2-1.2 1.2h-1.2",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.3"}),a.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function CSe(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Sy(e,t=new Date){const n=new Date(e),r=o=>String(o).padStart(2,"0"),s=`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?s:`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())} ${s}`}const TSe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3crect%20x='1.2'%20y='8.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3crect%20x='1.2'%20y='2.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3cg%20transform='matrix(0.86602545%200.50000006%20-0.50000006%200.86602545%202.21032266%20-5.24903863)'%3e%3crect%20x='10.9'%20y='1.5'%20width='4.3'%20height='4.3'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3c/g%3e%3crect%20x='7.2'%20y='8.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3c/svg%3e",ESe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2020%2020'%3e%3cpath%20d='M18%2018V5H9.5L7.5%202H2L2%2018H5M18%2018H5M18%2018V8.5H5V18'%20stroke='currentColor'%20stroke-linecap='square'/%3e%3c/svg%3e",ASe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M5.4%201.2v3.2M10.6%201.2v3.2M3.8%204.4h8.4v2.2a4.2%204.2%200%200%201-4.2%204.2%204.2%204.2%200%200%201-4.2-4.2V4.4ZM8%2011v3.8'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",jSe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M9.333333480718995,0.4848014130697632L8.909069580718995,0.9090693330697632L8.666668880718994,1.1514702030697632L7.818136680718994,2.000002323069763L6.000002380718994,3.8181367730697633L4.909069780718994,4.909069373069763L4.484801580718994,5.333333373069763L5.333333480718994,6.181865073069763L5.757597480718994,5.757597373069763L6.002225380718994,5.5129693730697635Q6.399448880718994,5.902126173069763,6.835733380718994,6.315723273069763L0.6516202707189941,12.497309373069763L3.5001483807189944,15.345837373069763L9.749393980718994,9.099145273069762L10.000080580718993,9.349833873069763L10.848612280718994,8.501302173069764L10.424344580718994,8.077038173069763Q9.527247880718994,7.179941973069763,8.407596580718995,6.143646073069763Q7.564285280718994,5.3631170730697635,6.850798580718994,4.664396173069763L8.666666480718995,2.848528273069763L13.151472080718994,7.333333873069763L10.242402580718995,10.242403373069763L9.818134780718994,10.666667373069764L10.666666480718995,11.515199373069763L11.090930480718994,11.090931273069764L13.999998080718994,8.181864173069762L14.848531080718994,7.333333373069763L15.090931080718994,7.090931273069764L15.515198080718994,6.666666873069763L14.666666080718993,5.818134673069763L14.242402080718994,6.242402873069763L14.000000080718994,6.484805973069763L9.515194380718993,2.0000002430697634L9.757597480718994,1.7575974430697632L10.181865180718994,1.3333333730697632L9.333333480718995,0.4848014130697632ZM8.895271280718994,8.256209773069763Q8.340813180718994,7.719207673069763,7.712720380718994,7.1358045730697635L2.348849830718994,12.497482373069763L3.5003215807189942,13.648954373069763L8.895271280718994,8.256209773069763Z'%20fill-rule='evenodd'%20fill='currentColor'/%3e%3c/svg%3e";function NSe(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&(t.label===void 0||typeof t.label=="string")&&(t.value===void 0||typeof t.value=="string")&&(t.removable===void 0||typeof t.removable=="boolean")&&(t.kind===void 0||typeof t.kind=="string")&&(t.icon===void 0||typeof t.icon=="string")&&(t.serialized===void 0||typeof t.serialized=="string")}function ISe(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="text"?typeof t.text=="string":t.type!=="tag"?!1:NSe(t.tag)}function oD(e,t,n,r={}){if(!t)return null;try{const s=t(e);return!Array.isArray(s)||s.length===0||!s.every(ISe)||r.requireSourcePreservation&&s.map(i=>i.type==="text"?i.text:h5(i.tag)).join("")!==e?null:s}catch(s){return console.warn(n,s),null}}const aD={extension:TSe,file:ESe,mcp:ASe,skill:jSe},MSe=new Set(Object.values(aD));function VN(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function h5(e){var t,n,r;return((t=e.serialized)==null?void 0:t.trim())||((n=e.value)==null?void 0:n.trim())||((r=e.label)==null?void 0:r.trim())||e.id}function a1(e,t){if(e)return VN(t,e)??VN(aD,e)}function lD(e){return e!==void 0&&MSe.has(e)}function RSe(e,t){const n=[];let r=0;for(const s of t){const i=h5(s);if(!i)continue;const o=e.indexOf(i,r);if(o<0)continue;const l=o+i.length;n.push({type:"reference",start:o,end:l,text:i,reference:{id:s.id,...s.kind?{kind:s.kind}:{},...s.label?{label:s.label}:{},...s.value?{value:s.value}:{},...s.serialized?{serialized:s.serialized}:{},...s.removable!==void 0?{removable:s.removable}:{}}}),r=l}return n}function Iee(e,t){if(!t||t.length===0)return[{type:"text",text:e}];const n=[];let r=0;for(const s of t){if(s.type!=="reference")continue;const{start:i,end:o,text:l}=s,c=s.reference;!c||typeof c.id!="string"||i<r||o<=i||o>e.length||e.slice(i,o)!==l||(r<i&&n.push({type:"text",text:e.slice(r,i)}),n.push({type:"reference",tag:{id:c.id,...c.kind?{kind:c.kind}:{},...c.label?{label:c.label}:{},...c.value?{value:c.value}:{},serialized:c.serialized??l,...c.removable!==void 0?{removable:c.removable}:{}}}),r=o)}return r<e.length&&n.push({type:"text",text:e.slice(r)}),n.length>0?n:[{type:"text",text:e}]}function DSe(e,t){var i,o;const n=((i=e.label)==null?void 0:i.trim())??"",r=((o=e.value)==null?void 0:o.trim())??"";return{tagLabel:(e.kind?VN(aD,e.kind):void 0)?"":n,tagValue:r,fallback:e.id,iconUrl:a1(e.kind,t)}}const LSe="modulepreload",PSe=function(e){return"/"+e},eq={},fe=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=PSe(c),c in eq)return;eq[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":LSe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Fs={Dark:"dark",Light:"light"},Mee=[Fs.Dark,Fs.Light],Ree=h.createContext(Fs.Dark),OSe=Ree.Provider;function rm(){return h.useContext(Ree)}const mg="ui.theme",bT="general.language";function cD(e,t){return e===Fs.Light||e==="Qwen Light"?Fs.Light:e===Fs.Dark||e==="Qwen Dark"?Fs.Dark:t}function Dee(e){return e===Fs.Light?"Qwen Light":"Qwen Dark"}const Lee=h.createContext("interactive");Lee.Provider;function uD(){return h.useContext(Lee)}function tq(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(s,r).trim();(o||!i)&&t.push(o),s=r+1,r=n.indexOf(",",s)}return t}function Pee(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $Se=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BSe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zSe={};function nq(e,t){return(zSe.jsx?BSe:$Se).test(e)}const FSe=/[ \t\n\f\r]/g;function f5(e){return typeof e=="object"?e.type==="text"?rq(e.value):!1:rq(e)}function rq(e){return e.replace(FSe,"")===""}class w_{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}w_.prototype.normal={};w_.prototype.property={};w_.prototype.space=void 0;function Oee(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new w_(n,r,t)}function yk(e){return e.toLowerCase()}class kc{constructor(t,n){this.attribute=n,this.property=t}}kc.prototype.attribute="";kc.prototype.booleanish=!1;kc.prototype.boolean=!1;kc.prototype.commaOrSpaceSeparated=!1;kc.prototype.commaSeparated=!1;kc.prototype.defined=!1;kc.prototype.mustUseProperty=!1;kc.prototype.number=!1;kc.prototype.overloadedBoolean=!1;kc.prototype.property="";kc.prototype.spaceSeparated=!1;kc.prototype.space=void 0;let qSe=0;const Sr=l1(),$o=l1(),GN=l1(),Ut=l1(),gi=l1(),jg=l1(),Rc=l1();function l1(){return 2**++qSe}const KN=Object.freeze(Object.defineProperty({__proto__:null,boolean:Sr,booleanish:$o,commaOrSpaceSeparated:Rc,commaSeparated:jg,number:Ut,overloadedBoolean:GN,spaceSeparated:gi},Symbol.toStringTag,{value:"Module"})),eA=Object.keys(KN);class dD extends kc{constructor(t,n,r,s){let i=-1;if(super(t,n),sq(this,"space",s),typeof r=="number")for(;++i<eA.length;){const o=eA[i];sq(this,eA[i],(r&KN[o])===KN[o])}}}dD.prototype.defined=!0;function sq(e,t,n){n&&(e[t]=n)}function dv(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new dD(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[yk(r)]=r,n[yk(i.attribute)]=r}return new w_(t,n,e.space)}const $ee=dv({properties:{ariaActiveDescendant:null,ariaAtomic:$o,ariaAutoComplete:null,ariaBusy:$o,ariaChecked:$o,ariaColCount:Ut,ariaColIndex:Ut,ariaColSpan:Ut,ariaControls:gi,ariaCurrent:null,ariaDescribedBy:gi,ariaDetails:null,ariaDisabled:$o,ariaDropEffect:gi,ariaErrorMessage:null,ariaExpanded:$o,ariaFlowTo:gi,ariaGrabbed:$o,ariaHasPopup:null,ariaHidden:$o,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gi,ariaLevel:Ut,ariaLive:null,ariaModal:$o,ariaMultiLine:$o,ariaMultiSelectable:$o,ariaOrientation:null,ariaOwns:gi,ariaPlaceholder:null,ariaPosInSet:Ut,ariaPressed:$o,ariaReadOnly:$o,ariaRelevant:null,ariaRequired:$o,ariaRoleDescription:gi,ariaRowCount:Ut,ariaRowIndex:Ut,ariaRowSpan:Ut,ariaSelected:$o,ariaSetSize:Ut,ariaSort:null,ariaValueMax:Ut,ariaValueMin:Ut,ariaValueNow:Ut,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Bee(e,t){return t in e?e[t]:t}function zee(e,t){return Bee(e,t.toLowerCase())}const HSe=dv({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:jg,acceptCharset:gi,accessKey:gi,action:null,allow:null,allowFullScreen:Sr,allowPaymentRequest:Sr,allowUserMedia:Sr,alpha:Sr,alt:null,as:null,async:Sr,autoCapitalize:null,autoComplete:gi,autoFocus:Sr,autoPlay:Sr,blocking:gi,capture:null,charSet:null,checked:Sr,cite:null,className:gi,closedBy:null,colorSpace:null,cols:Ut,colSpan:Ut,command:null,commandFor:null,content:null,contentEditable:$o,controls:Sr,controlsList:gi,coords:Ut|jg,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Sr,defer:Sr,dir:null,dirName:null,disabled:Sr,download:GN,draggable:$o,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Sr,formTarget:null,headers:gi,height:Ut,hidden:GN,high:Ut,href:null,hrefLang:null,htmlFor:gi,httpEquiv:gi,id:null,imageSizes:null,imageSrcSet:null,inert:Sr,inputMode:null,integrity:null,is:null,isMap:Sr,itemId:null,itemProp:gi,itemRef:gi,itemScope:Sr,itemType:gi,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Sr,low:Ut,manifest:null,max:null,maxLength:Ut,media:null,method:null,min:null,minLength:Ut,multiple:Sr,muted:Sr,name:null,nonce:null,noModule:Sr,noValidate:Sr,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:Sr,optimum:Ut,pattern:null,ping:gi,placeholder:null,playsInline:Sr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Sr,referrerPolicy:null,rel:gi,required:Sr,reversed:Sr,rows:Ut,rowSpan:Ut,sandbox:gi,scope:null,scoped:Sr,seamless:Sr,selected:Sr,shadowRootClonable:Sr,shadowRootCustomElementRegistry:Sr,shadowRootDelegatesFocus:Sr,shadowRootMode:null,shadowRootSerializable:Sr,shape:null,size:Ut,sizes:null,slot:null,span:Ut,spellCheck:$o,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ut,step:null,style:null,tabIndex:Ut,target:null,title:null,translate:null,type:null,typeMustMatch:Sr,useMap:null,value:$o,width:Ut,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gi,axis:null,background:null,bgColor:null,border:Ut,borderColor:null,bottomMargin:Ut,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Sr,declare:Sr,event:null,face:null,frame:null,frameBorder:null,hSpace:Ut,leftMargin:Ut,link:null,longDesc:null,lowSrc:null,marginHeight:Ut,marginWidth:Ut,noResize:Sr,noHref:Sr,noShade:Sr,noWrap:Sr,object:null,profile:null,prompt:null,rev:null,rightMargin:Ut,rules:null,scheme:null,scrolling:$o,standby:null,summary:null,text:null,topMargin:Ut,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ut,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Sr,disablePictureInPicture:Sr,disableRemotePlayback:Sr,exportParts:jg,part:gi,prefix:null,property:null,results:Ut,security:null,unselectable:null},space:"html",transform:zee}),USe=dv({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",maskType:"mask-type",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:Rc,accentHeight:Ut,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ut,amplitude:Ut,arabicForm:null,ascent:Ut,attributeName:null,attributeType:null,azimuth:Ut,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ut,by:null,calcMode:null,capHeight:Ut,className:gi,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:Ut,diffuseConstant:Ut,direction:null,display:null,dur:null,divisor:Ut,dominantBaseline:null,download:Sr,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ut,enableBackground:null,end:null,event:null,exponent:Ut,externalResourcesRequired:null,fill:null,fillOpacity:Ut,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:jg,g2:jg,glyphName:jg,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ut,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ut,horizOriginX:Ut,horizOriginY:Ut,id:null,ideographic:Ut,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ut,k:Ut,k1:Ut,k2:Ut,k3:Ut,k4:Ut,kernelMatrix:Rc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ut,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ut,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:Ut,overlineThickness:Ut,paintOrder:null,panose1:null,path:null,pathLength:Ut,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gi,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ut,pointsAtY:Ut,pointsAtZ:Ut,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Rc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Rc,rev:Rc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Rc,requiredFeatures:Rc,requiredFonts:Rc,requiredFormats:Rc,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:Ut,specularExponent:Ut,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ut,strikethroughThickness:Ut,string:null,stroke:null,strokeDashArray:Rc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ut,strokeOpacity:Ut,strokeWidth:null,style:null,surfaceScale:Ut,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Rc,tabIndex:Ut,tableValues:null,target:null,targetX:Ut,targetY:Ut,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Rc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ut,underlineThickness:Ut,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ut,values:null,vAlphabetic:Ut,vMathematical:Ut,vectorEffect:null,vHanging:Ut,vIdeographic:Ut,version:null,vertAdvY:Ut,vertOriginX:Ut,vertOriginY:Ut,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ut,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Bee}),Fee=dv({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()}}),qee=dv({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zee}),Hee=dv({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),WSe={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"},VSe=/[A-Z]/g,iq=/-[a-z]/g,GSe=/^data[-\w.:]+$/i;function hD(e,t){const n=yk(t);let r=t,s=kc;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&GSe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(iq,YSe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!iq.test(i)){let o=i.replace(VSe,KSe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=dD}return new s(r,t)}function KSe(e){return"-"+e.toLowerCase()}function YSe(e){return e.charAt(1).toUpperCase()}const fD=Oee([$ee,HSe,Fee,qee,Hee],"html"),hv=Oee([$ee,USe,Fee,qee,Hee],"svg");function oq(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Uee(e){return e.join(" ").trim()}var mD={},aq=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,XSe=/\n/g,QSe=/^\s*/,JSe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,ZSe=/^:\s*/,e2e=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,t2e=/^[;\s]*/,n2e=/^\s+|\s+$/g,r2e=`
`,lq="/",cq="*",lg="",s2e="comment",i2e="declaration";function o2e(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var b=g.match(XSe);b&&(n+=b.length);var w=g.lastIndexOf(r2e);r=~w?g.length-w:r+g.length}function i(){var g={line:n,column:r};return function(b){return b.position=new o(g),u(),b}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(g){var b=new Error(t.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var w=b[0];return s(w),e=e.slice(w.length),b}}function u(){c(QSe)}function d(g){var b;for(g=g||[];b=f();)b!==!1&&g.push(b);return g}function f(){var g=i();if(!(lq!=e.charAt(0)||cq!=e.charAt(1))){for(var b=2;lg!=e.charAt(b)&&(cq!=e.charAt(b)||lq!=e.charAt(b+1));)++b;if(b+=2,lg===e.charAt(b-1))return l("End of comment missing");var w=e.slice(2,b-2);return r+=2,s(w),e=e.slice(b),r+=2,g({type:s2e,comment:w})}}function m(){var g=i(),b=c(JSe);if(b){if(f(),!c(ZSe))return l("property missing ':'");var w=c(e2e),y=g({type:i2e,property:uq(b[0].replace(aq,lg)),value:w?uq(w[0].replace(aq,lg)):lg});return c(t2e),y}}function p(){var g=[];d(g);for(var b;b=m();)b!==!1&&(g.push(b),d(g));return g}return u(),p()}function uq(e){return e?e.replace(n2e,lg):lg}var a2e=o2e,l2e=tk&&tk.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mD,"__esModule",{value:!0});mD.default=u2e;const c2e=l2e(a2e);function u2e(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,c2e.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var m5={};Object.defineProperty(m5,"__esModule",{value:!0});m5.camelCase=void 0;var d2e=/^--[a-zA-Z0-9_-]+$/,h2e=/-([a-z])/g,f2e=/^[^-]+$/,m2e=/^-(webkit|moz|ms|o|khtml)-/,p2e=/^-(ms)-/,g2e=function(e){return!e||f2e.test(e)||d2e.test(e)},b2e=function(e,t){return t.toUpperCase()},dq=function(e,t){return"".concat(t,"-")},y2e=function(e,t){return t===void 0&&(t={}),g2e(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(p2e,dq):e=e.replace(m2e,dq),e.replace(h2e,b2e))};m5.camelCase=y2e;var v2e=tk&&tk.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},w2e=v2e(mD),x2e=m5;function YN(e,t){var n={};return!e||typeof e!="string"||(0,w2e.default)(e,function(r,s){r&&s&&(n[(0,x2e.camelCase)(r,t)]=s)}),n}YN.default=YN;var k2e=YN;const _2e=i_(k2e),Wee=Vee("end"),pD=Vee("start");function Vee(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 S2e(e){const t=pD(e),n=Wee(e);if(t&&n)return{start:t,end:n}}function Ox(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?hq(e.position):"start"in e||"end"in e?hq(e):"line"in e||"column"in e?XN(e):""}function XN(e){return fq(e&&e.line)+":"+fq(e&&e.column)}function hq(e){return XN(e&&e.start)+"-"+XN(e&&e.end)}function fq(e){return e&&typeof e=="number"?e:1}class jl extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Ox(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jl.prototype.file="";jl.prototype.name="";jl.prototype.reason="";jl.prototype.message="";jl.prototype.stack="";jl.prototype.column=void 0;jl.prototype.line=void 0;jl.prototype.ancestors=void 0;jl.prototype.cause=void 0;jl.prototype.fatal=void 0;jl.prototype.place=void 0;jl.prototype.ruleId=void 0;jl.prototype.source=void 0;const gD={}.hasOwnProperty,C2e=new Map,T2e=/[A-Z]/g,E2e=new Set(["table","tbody","thead","tfoot","tr"]),A2e=new Set(["td","th"]),Gee="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function j2e(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=O2e(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=P2e(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"?hv:fD,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Kee(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function Kee(e,t,n){if(t.type==="element")return N2e(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return I2e(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return R2e(e,t,n);if(t.type==="mdxjsEsm")return M2e(e,t);if(t.type==="root")return D2e(e,t,n);if(t.type==="text")return L2e(e,t)}function N2e(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=hv,e.schema=s),e.ancestors.push(t);const i=Xee(e,t.tagName,!1),o=$2e(e,t);let l=yD(e,t);return E2e.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!f5(c):!0})),Yee(e,o,i,t),bD(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function I2e(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)}vk(e,t.position)}function M2e(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vk(e,t.position)}function R2e(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=hv,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:Xee(e,t.name,!0),o=B2e(e,t),l=yD(e,t);return Yee(e,o,i,t),bD(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function D2e(e,t,n){const r={};return bD(r,yD(e,t)),e.create(t,e.Fragment,r,n)}function L2e(e,t){return t.value}function Yee(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function bD(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function P2e(e,t,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function O2e(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=pD(r);return t(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function $2e(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&gD.call(t.properties,s)){const i=z2e(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&A2e.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function B2e(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else vk(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else vk(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function yD(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:C2e;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=Kee(e,i,o);l!==void 0&&n.push(l)}return n}function z2e(e,t,n){const r=hD(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Pee(n):Uee(n)),r.property==="style"){let s=typeof n=="object"?n:F2e(e,String(n));return e.stylePropertyNameCase==="css"&&(s=q2e(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?WSe[r.property]||r.property:r.attribute,n]}}function F2e(e,t){try{return _2e(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new jl("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=Gee+"#cannot-parse-style-attribute",s}}function Xee(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=nq(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=nq(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return gD.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);vk(e)}function vk(e,t){const n=new jl("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=Gee+"#cannot-handle-mdx-estrees-without-createevaluater",n}function q2e(e){const t={};let n;for(n in e)gD.call(e,n)&&(t[H2e(n)]=e[n]);return t}function H2e(e){let t=e.replace(T2e,U2e);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function U2e(e){return"-"+e.toLowerCase()}const tA={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"]},W2e={};function vD(e,t){const n=W2e,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Qee(e,r,s)}function Qee(e,t,n){if(V2e(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 mq(e.children,t,n)}return Array.isArray(e)?mq(e,t,n):""}function mq(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=Qee(e[s],t,n);return r.join("")}function V2e(e){return!!(e&&typeof e=="object")}const pq=document.createElement("i");function wD(e){const t="&"+e+";";pq.innerHTML=t;const n=pq.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Yc(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function xu(e,t){return e.length>0?(Yc(e,e.length,0,t),e):t}const gq={}.hasOwnProperty;function Jee(e){const t={};let n=-1;for(;++n<e.length;)G2e(t,e[n]);return t}function G2e(e,t){let n;for(n in t){const s=(gq.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){gq.call(s,o)||(s[o]=[]);const l=i[o];K2e(s[o],Array.isArray(l)?l:l?[l]:[])}}}function K2e(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Yc(e,0,0,r)}function Zee(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 hd(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Hl=o0(/[A-Za-z]/),kl=o0(/[\dA-Za-z]/),Y2e=o0(/[#-'*+\--9=?A-Z^-~]/);function yT(e){return e!==null&&(e<32||e===127)}const QN=o0(/\d/),X2e=o0(/[\dA-Fa-f]/),Q2e=o0(/[!-/:-@[-`{-~]/);function Jn(e){return e!==null&&e<-2}function ki(e){return e!==null&&(e<0||e===32)}function is(e){return e===-2||e===-1||e===32}const p5=o0(new RegExp("\\p{P}|\\p{S}","u")),Bg=o0(/\s/);function o0(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function fv(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&kl(e.charCodeAt(n+1))&&kl(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Xr(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return is(c)?(e.enter(n),l(c)):t(c)}function l(c){return is(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const J2e={tokenize:Z2e};function Z2e(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Xr(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Jn(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const eCe={tokenize:tCe},bq={tokenize:nCe};function tCe(e){const t=this,n=[];let r=0,s,i,o;return l;function l(x){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,c,u)(x)}return u(x)}function c(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const k=t.events.length;let S=k,T;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){T=t.events[S][1].end;break}y(r);let _=k;for(;_<t.events.length;)t.events[_][1].end={...T},_++;return Yc(t.events,S+1,0,t.events.slice(k)),t.events.length=_,u(x)}return l(x)}function u(x){if(r===n.length){if(!s)return m(x);if(s.currentConstruct&&s.currentConstruct.concrete)return g(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bq,d,f)(x)}function d(x){return s&&v(),y(r),m(x)}function f(x){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(x)}function m(x){return t.containerState={},e.attempt(bq,p,g)(x)}function p(x){return r++,n.push([t.currentConstruct,t.containerState]),m(x)}function g(x){if(x===null){s&&v(),y(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),b(x)}function b(x){if(x===null){w(e.exit("chunkFlow"),!0),y(0),e.consume(x);return}return Jn(x)?(e.consume(x),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(x),b)}function w(x,k){const S=t.sliceStream(x);if(k&&S.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(S),t.parser.lazy[x.start.line]){let T=s.events.length;for(;T--;)if(s.events[T][1].start.offset<o&&(!s.events[T][1].end||s.events[T][1].end.offset>o))return;const _=t.events.length;let C=_,j,E;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){if(j){E=t.events[C][1].end;break}j=!0}for(y(r),T=_;T<t.events.length;)t.events[T][1].end={...E},T++;Yc(t.events,C+1,0,t.events.slice(_)),t.events.length=T}}function y(x){let k=n.length;for(;k-- >x;){const S=n[k];t.containerState=S[1],S[0].exit.call(t,e)}n.length=x}function v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function nCe(e,t,n){return Xr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Cy(e){if(e===null||ki(e)||Bg(e))return 1;if(p5(e))return 2}function g5(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const JN={name:"attention",resolveAll:rCe,tokenize:sCe};function rCe(e,t){let n=-1,r,s,i,o,l,c,u,d;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;c=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 f={...e[r][1].end},m={...e[n][1].start};yq(f,-c),yq(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=xu(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=xu(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=xu(u,g5(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=xu(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=xu(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Yc(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function sCe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Cy(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=Cy(c),f=!d||d===2&&s||n.includes(c),m=!s||s===2&&d||n.includes(r);return u._open=!!(i===42?f:f&&(s||!m)),u._close=!!(i===42?m:m&&(d||!f)),t(c)}}function yq(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const iCe={name:"autolink",tokenize:oCe};function oCe(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Hl(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||kl(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||kl(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||yT(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):Y2e(p)?(e.consume(p),u):n(p)}function d(p){return kl(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||kl(p))&&r++<63){const g=p===45?m:f;return e.consume(p),g}return n(p)}}const x_={partial:!0,tokenize:aCe};function aCe(e,t,n){return r;function r(i){return is(i)?Xr(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||Jn(i)?t(i):n(i)}}const ete={continuation:{tokenize:cCe},exit:uCe,name:"blockQuote",tokenize:lCe};function lCe(e,t,n){const r=this;return s;function s(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return is(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function cCe(e,t,n){const r=this;return s;function s(o){return is(o)?Xr(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(ete,t,n)(o)}}function uCe(e){e.exit("blockQuote")}const tte={name:"characterEscape",tokenize:dCe};function dCe(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return Q2e(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const nte={name:"characterReference",tokenize:hCe};function hCe(e,t,n){const r=this;let s=0,i,o;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=kl,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=X2e,d):(e.enter("characterReferenceValue"),i=7,o=QN,d(f))}function d(f){if(f===59&&s){const m=e.exit("characterReferenceValue");return o===kl&&!wD(r.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&s++<i?(e.consume(f),d):n(f)}}const vq={partial:!0,tokenize:mCe},wq={concrete:!0,name:"codeFenced",tokenize:fCe};function fCe(e,t,n){const r=this,s={partial:!0,tokenize:S};let i=0,o=0,l;return c;function c(T){return u(T)}function u(T){const _=r.events[r.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===l?(o++,e.consume(T),d):o<3?n(T):(e.exit("codeFencedFenceSequence"),is(T)?Xr(e,f,"whitespace")(T):f(T))}function f(T){return T===null||Jn(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(vq,b,k)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||Jn(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(T)):is(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Xr(e,p,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),m)}function p(T){return T===null||Jn(T)?f(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||Jn(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(T)):T===96&&T===l?n(T):(e.consume(T),g)}function b(T){return e.attempt(s,k,w)(T)}function w(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),y}function y(T){return i>0&&is(T)?Xr(e,v,"linePrefix",i+1)(T):v(T)}function v(T){return T===null||Jn(T)?e.check(vq,b,k)(T):(e.enter("codeFlowValue"),x(T))}function x(T){return T===null||Jn(T)?(e.exit("codeFlowValue"),v(T)):(e.consume(T),x)}function k(T){return e.exit("codeFenced"),t(T)}function S(T,_,C){let j=0;return E;function E($){return T.enter("lineEnding"),T.consume($),T.exit("lineEnding"),L}function L($){return T.enter("codeFencedFence"),is($)?Xr(T,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):D($)}function D($){return $===l?(T.enter("codeFencedFenceSequence"),M($)):C($)}function M($){return $===l?(j++,T.consume($),M):j>=o?(T.exit("codeFencedFenceSequence"),is($)?Xr(T,R,"whitespace")($):R($)):C($)}function R($){return $===null||Jn($)?(T.exit("codeFencedFence"),_($)):C($)}}}function mCe(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const nA={name:"codeIndented",tokenize:gCe},pCe={partial:!0,tokenize:bCe};function gCe(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),Xr(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Jn(u)?e.attempt(pCe,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Jn(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function bCe(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Jn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Xr(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Jn(o)?s(o):n(o)}}const yCe={name:"codeText",previous:wCe,resolve:vCe,tokenize:xCe};function vCe(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 wCe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xCe(e,t,n){let r=0,s,i;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),s=0,d(f)):Jn(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Jn(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),s++,d):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class kCe{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 i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Aw(this.left,r),i.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),Aw(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Aw(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);Aw(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Aw(this.left,n.reverse())}}}function Aw(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 rte(e){const t={};let n=-1,r,s,i,o,l,c,u;const d=new kCe(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,_Ce(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(d.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...d.get(s)[1].start},l=d.slice(s,n),l.unshift(r),d.splice(s,n-s+1,l))}}return Yc(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function _Ce(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,f,m=-1,p=n,g=0,b=0;const w=[b];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++m<l.length;)l[m][0]==="exit"&&l[m-1][0]==="enter"&&l[m][1].type===l[m-1][1].type&&l[m][1].start.line!==l[m][1].end.line&&(b=m+1,w.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),m=w.length;m--;){const y=l.slice(w[m],w[m+1]),v=i.pop();c.push([v,v+y.length-1]),e.splice(v,2,y)}for(c.reverse(),m=-1;++m<c.length;)u[g+c[m][0]]=g+c[m][1],g+=c[m][1]-c[m][0]-1;return u}const SCe={resolve:TCe,tokenize:ECe},CCe={partial:!0,tokenize:ACe};function TCe(e){return rte(e),e}function ECe(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):Jn(l)?e.check(CCe,o,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function ACe(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Xr(e,i,"linePrefix")}function i(o){if(o===null||Jn(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ste(e,t,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),m):y===null||y===32||y===41||yT(y)?n(y):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function m(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),m(y)):y===null||y===60||Jn(y)?n(y):(e.consume(y),y===92?g:p)}function g(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function b(y){return!d&&(y===null||y===41||ki(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,b):y===41?(e.consume(y),d--,b):y===null||y===32||y===40||yT(y)?n(y):(e.consume(y),y===92?w:b)}function w(y){return y===40||y===41||y===92?(e.consume(y),b):b(y)}}function ite(e,t,n,r,s,i){const o=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(i),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):Jn(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Jn(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!is(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function ote(e,t,n,r,s,i){let o;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(s),e.consume(m),e.exit(s),o=m===40?41:m,c):n(m)}function c(m){return m===o?(e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===o?(e.exit(i),c(o)):m===null?n(m):Jn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Xr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||Jn(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?f:d)}function f(m){return m===o||m===92?(e.consume(m),d):d(m)}}function $x(e,t){let n;return r;function r(s){return Jn(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):is(s)?Xr(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const jCe={name:"definition",tokenize:ICe},NCe={partial:!0,tokenize:MCe};function ICe(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return ite.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=hd(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return ki(p)?$x(e,u)(p):u(p)}function u(p){return ste(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(NCe,f,f)(p)}function f(p){return is(p)?Xr(e,m,"whitespace")(p):m(p)}function m(p){return p===null||Jn(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function MCe(e,t,n){return r;function r(l){return ki(l)?$x(e,s)(l):n(l)}function s(l){return ote(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return is(l)?Xr(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Jn(l)?t(l):n(l)}}const RCe={name:"hardBreakEscape",tokenize:DCe};function DCe(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Jn(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const LCe={name:"headingAtx",resolve:PCe,tokenize:OCe};function PCe(e,t){let n=e.length-2,r=3,s,i;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},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Yc(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function OCe(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||ki(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Jn(d)?(e.exit("atxHeading"),t(d)):is(d)?Xr(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||ki(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const $Ce=["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"],xq=["pre","script","style","textarea"],BCe={concrete:!0,name:"htmlFlow",resolveTo:qCe,tokenize:HCe},zCe={partial:!0,tokenize:WCe},FCe={partial:!0,tokenize:UCe};function qCe(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 HCe(e,t,n){const r=this;let s,i,o,l,c;return u;function u(P){return d(P)}function d(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),m):P===47?(e.consume(P),i=!0,b):P===63?(e.consume(P),s=3,r.interrupt?t:I):Hl(P)?(e.consume(P),o=String.fromCharCode(P),w):n(P)}function m(P){return P===45?(e.consume(P),s=2,p):P===91?(e.consume(P),s=5,l=0,g):Hl(P)?(e.consume(P),s=4,r.interrupt?t:I):n(P)}function p(P){return P===45?(e.consume(P),r.interrupt?t:I):n(P)}function g(P){const F="CDATA[";return P===F.charCodeAt(l++)?(e.consume(P),l===F.length?r.interrupt?t:D:g):n(P)}function b(P){return Hl(P)?(e.consume(P),o=String.fromCharCode(P),w):n(P)}function w(P){if(P===null||P===47||P===62||ki(P)){const F=P===47,te=o.toLowerCase();return!F&&!i&&xq.includes(te)?(s=1,r.interrupt?t(P):D(P)):$Ce.includes(o.toLowerCase())?(s=6,F?(e.consume(P),y):r.interrupt?t(P):D(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?v(P):x(P))}return P===45||kl(P)?(e.consume(P),o+=String.fromCharCode(P),w):n(P)}function y(P){return P===62?(e.consume(P),r.interrupt?t:D):n(P)}function v(P){return is(P)?(e.consume(P),v):E(P)}function x(P){return P===47?(e.consume(P),E):P===58||P===95||Hl(P)?(e.consume(P),k):is(P)?(e.consume(P),x):E(P)}function k(P){return P===45||P===46||P===58||P===95||kl(P)?(e.consume(P),k):S(P)}function S(P){return P===61?(e.consume(P),T):is(P)?(e.consume(P),S):x(P)}function T(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),c=P,_):is(P)?(e.consume(P),T):C(P)}function _(P){return P===c?(e.consume(P),c=null,j):P===null||Jn(P)?n(P):(e.consume(P),_)}function C(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||ki(P)?S(P):(e.consume(P),C)}function j(P){return P===47||P===62||is(P)?x(P):n(P)}function E(P){return P===62?(e.consume(P),L):n(P)}function L(P){return P===null||Jn(P)?D(P):is(P)?(e.consume(P),L):n(P)}function D(P){return P===45&&s===2?(e.consume(P),B):P===60&&s===1?(e.consume(P),N):P===62&&s===4?(e.consume(P),Y):P===63&&s===3?(e.consume(P),I):P===93&&s===5?(e.consume(P),G):Jn(P)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(zCe,U,M)(P)):P===null||Jn(P)?(e.exit("htmlFlowData"),M(P)):(e.consume(P),D)}function M(P){return e.check(FCe,R,U)(P)}function R(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),$}function $(P){return P===null||Jn(P)?M(P):(e.enter("htmlFlowData"),D(P))}function B(P){return P===45?(e.consume(P),I):D(P)}function N(P){return P===47?(e.consume(P),o="",z):D(P)}function z(P){if(P===62){const F=o.toLowerCase();return xq.includes(F)?(e.consume(P),Y):D(P)}return Hl(P)&&o.length<8?(e.consume(P),o+=String.fromCharCode(P),z):D(P)}function G(P){return P===93?(e.consume(P),I):D(P)}function I(P){return P===62?(e.consume(P),Y):P===45&&s===2?(e.consume(P),I):D(P)}function Y(P){return P===null||Jn(P)?(e.exit("htmlFlowData"),U(P)):(e.consume(P),Y)}function U(P){return e.exit("htmlFlow"),t(P)}}function UCe(e,t,n){const r=this;return s;function s(o){return Jn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function WCe(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(x_,t,n)}}const VCe={name:"htmlText",tokenize:GCe};function GCe(e,t,n){const r=this;let s,i,o;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),S):I===63?(e.consume(I),x):Hl(I)?(e.consume(I),C):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),i=0,g):Hl(I)?(e.consume(I),v):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),m):Jn(I)?(o=f,N(I)):(e.consume(I),f)}function m(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?B(I):I===45?m(I):f(I)}function g(I){const Y="CDATA[";return I===Y.charCodeAt(i++)?(e.consume(I),i===Y.length?b:g):n(I)}function b(I){return I===null?n(I):I===93?(e.consume(I),w):Jn(I)?(o=b,N(I)):(e.consume(I),b)}function w(I){return I===93?(e.consume(I),y):b(I)}function y(I){return I===62?B(I):I===93?(e.consume(I),y):b(I)}function v(I){return I===null||I===62?B(I):Jn(I)?(o=v,N(I)):(e.consume(I),v)}function x(I){return I===null?n(I):I===63?(e.consume(I),k):Jn(I)?(o=x,N(I)):(e.consume(I),x)}function k(I){return I===62?B(I):x(I)}function S(I){return Hl(I)?(e.consume(I),T):n(I)}function T(I){return I===45||kl(I)?(e.consume(I),T):_(I)}function _(I){return Jn(I)?(o=_,N(I)):is(I)?(e.consume(I),_):B(I)}function C(I){return I===45||kl(I)?(e.consume(I),C):I===47||I===62||ki(I)?j(I):n(I)}function j(I){return I===47?(e.consume(I),B):I===58||I===95||Hl(I)?(e.consume(I),E):Jn(I)?(o=j,N(I)):is(I)?(e.consume(I),j):B(I)}function E(I){return I===45||I===46||I===58||I===95||kl(I)?(e.consume(I),E):L(I)}function L(I){return I===61?(e.consume(I),D):Jn(I)?(o=L,N(I)):is(I)?(e.consume(I),L):j(I)}function D(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),s=I,M):Jn(I)?(o=D,N(I)):is(I)?(e.consume(I),D):(e.consume(I),R)}function M(I){return I===s?(e.consume(I),s=void 0,$):I===null?n(I):Jn(I)?(o=M,N(I)):(e.consume(I),M)}function R(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||ki(I)?j(I):(e.consume(I),R)}function $(I){return I===47||I===62||ki(I)?j(I):n(I)}function B(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function N(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),z}function z(I){return is(I)?Xr(e,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):G(I)}function G(I){return e.enter("htmlTextData"),o(I)}}const xD={name:"labelEnd",resolveAll:QCe,resolveTo:JCe,tokenize:ZCe},KCe={tokenize:e4e},YCe={tokenize:t4e},XCe={tokenize:n4e};function QCe(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&&Yc(e,0,e.length,n),e}function JCe(e,t){let n=e.length,r=0,s,i,o,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=xu(l,e.slice(i+1,i+r+3)),l=xu(l,[["enter",d,t]]),l=xu(l,g5(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=xu(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=xu(l,e.slice(o+1)),l=xu(l,[["exit",c,t]]),Yc(e,i,e.length,l),e}function ZCe(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(m){return i?i._inactive?f(m):(o=r.parser.defined.includes(hd(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),c):n(m)}function c(m){return m===40?e.attempt(KCe,d,o?d:f)(m):m===91?e.attempt(YCe,d,o?u:f)(m):o?d(m):f(m)}function u(m){return e.attempt(XCe,d,f)(m)}function d(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function e4e(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return ki(f)?$x(e,i)(f):i(f)}function i(f){return f===41?d(f):ste(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return ki(f)?$x(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?ote(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return ki(f)?$x(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function t4e(e,t,n){const r=this;return s;function s(l){return ite.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(hd(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function n4e(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const r4e={name:"labelStartImage",resolveAll:xD.resolveAll,tokenize:s4e};function s4e(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const i4e={name:"labelStartLink",resolveAll:xD.resolveAll,tokenize:o4e};function o4e(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const rA={name:"lineEnding",tokenize:a4e};function a4e(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Xr(e,t,"linePrefix")}}const e4={name:"thematicBreak",tokenize:l4e};function l4e(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Jn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),is(u)?Xr(e,l,"whitespace")(u):l(u))}}const sc={continuation:{tokenize:h4e},exit:m4e,name:"list",tokenize:d4e},c4e={partial:!0,tokenize:p4e},u4e={partial:!0,tokenize:f4e};function d4e(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:QN(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(e4,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return QN(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(x_,r.interrupt?n:d,e.attempt(c4e,m,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return is(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function h4e(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(x_,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Xr(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!is(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(u4e,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Xr(e,e.attempt(sc,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function f4e(e,t,n){const r=this;return Xr(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function m4e(e){e.exit(this.containerState.type)}function p4e(e,t,n){const r=this;return Xr(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!is(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const kq={name:"setextUnderline",resolveTo:g4e,tokenize:b4e};function g4e(e,t){let n=e.length,r,s,i;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),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function b4e(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),is(u)?Xr(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Jn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const y4e={tokenize:v4e};function v4e(e){const t=this,n=e.attempt(x_,r,e.attempt(this.parser.constructs.flowInitial,s,Xr(e,e.attempt(this.parser.constructs.flow,s,e.attempt(SCe,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const w4e={resolveAll:lte()},x4e=ate("string"),k4e=ate("text");function ate(e){return{resolveAll:lte(e==="text"?_4e:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=s[d];let m=-1;if(f)for(;++m<f.length;){const p=f[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function lte(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function _4e(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 i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const S4e={42:sc,43:sc,45:sc,48:sc,49:sc,50:sc,51:sc,52:sc,53:sc,54:sc,55:sc,56:sc,57:sc,62:ete},C4e={91:jCe},T4e={[-2]:nA,[-1]:nA,32:nA},E4e={35:LCe,42:e4,45:[kq,e4],60:BCe,61:kq,95:e4,96:wq,126:wq},A4e={38:nte,92:tte},j4e={[-5]:rA,[-4]:rA,[-3]:rA,33:r4e,38:nte,42:JN,60:[iCe,VCe],91:i4e,92:[RCe,tte],93:xD,95:JN,96:yCe},N4e={null:[JN,w4e]},I4e={null:[42,95]},M4e={null:[]},R4e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:I4e,contentInitial:C4e,disable:M4e,document:S4e,flow:E4e,flowInitial:T4e,insideSpan:N4e,string:A4e,text:j4e},Symbol.toStringTag,{value:"Module"}));function D4e(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={},i=[];let o=[],l=[];const c={attempt:_(S),check:_(T),consume:v,enter:x,exit:k,interrupt:_(T,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:m,sliceStream:p,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(L){return o=xu(o,L),w(),o[o.length-1]!==null?[]:(C(t,0),u.events=g5(i,u.events,u),u.events)}function m(L,D){return P4e(p(L),D)}function p(L){return L4e(o,L)}function g(){const{_bufferIndex:L,_index:D,line:M,column:R,offset:$}=r;return{_bufferIndex:L,_index:D,line:M,column:R,offset:$}}function b(L){s[L.line]=L.column,E()}function w(){let L;for(;r._index<o.length;){const D=o[r._index];if(typeof D=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<D.length;)y(D.charCodeAt(r._bufferIndex));else y(D)}}function y(L){d=d(L)}function v(L){Jn(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,E()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function x(L,D){const M=D||{};return M.type=L,M.start=g(),u.events.push(["enter",M,u]),l.push(M),M}function k(L){const D=l.pop();return D.end=g(),u.events.push(["exit",D,u]),D}function S(L,D){C(L,D.from)}function T(L,D){D.restore()}function _(L,D){return M;function M(R,$,B){let N,z,G,I;return Array.isArray(R)?U(R):"tokenize"in R?U([R]):Y(R);function Y(W){return K;function K(ce){const ie=ce!==null&&W[ce],Z=ce!==null&&W.null,ee=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return U(ee)(ce)}}function U(W){return N=W,z=0,W.length===0?B:P(W[z])}function P(W){return K;function K(ce){return I=j(),G=W,W.partial||(u.currentConstruct=W),W.name&&u.parser.constructs.disable.null.includes(W.name)?te():W.tokenize.call(D?Object.assign(Object.create(u),D):u,c,F,te)(ce)}}function F(W){return L(G,I),$}function te(W){return I.restore(),++z<N.length?P(N[z]):B}}}function C(L,D){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&Yc(u.events,D,u.events.length-D,L.resolve(u.events.slice(D),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function j(){const L=g(),D=u.previous,M=u.currentConstruct,R=u.events.length,$=Array.from(l);return{from:R,restore:B};function B(){r=L,u.previous=D,u.currentConstruct=M,u.events.length=R,l=$,E()}}function E(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function L4e(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function P4e(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function O4e(e){const r={constructs:Jee([R4e,...(e||{}).extensions||[]]),content:s(J2e),defined:[],document:s(eCe),flow:s(y4e),lazy:{},string:s(x4e),text:s(k4e)};return r;function s(i){return o;function o(l){return D4e(r,i,l)}}}function $4e(e){for(;!rte(e););return e}const _q=/[\0\t\n\r]/g;function B4e(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const c=[];let u,d,f,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(_q.lastIndex=f,u=_q.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(f);break}if(p===10&&f===m&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<m&&(c.push(i.slice(f,m)),e+=m-f),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=m+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const z4e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function F4e(e){return e.replace(z4e,q4e)}function q4e(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return Zee(n.slice(i?2:1),i?16:10)}return wD(n)||e}const cte={}.hasOwnProperty;function H4e(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),U4e(n)($4e(O4e(n).document().write(B4e()(e,t,!0))))}function U4e(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ae),autolinkProtocol:j,autolinkEmail:j,atxHeading:i(he),blockQuote:i(Z),characterEscape:j,characterReference:j,codeFenced:i(ee),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ee,o),codeText:i(oe,o),codeTextData:j,data:j,codeFlowValue:j,definition:i(we),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(pe),hardBreakEscape:i(X),hardBreakTrailing:i(X),htmlFlow:i(ye,o),htmlFlowData:j,htmlText:i(ye,o),htmlTextData:j,image:i(Ce),label:o,link:i(ae),listItem:i(We),listItemValue:m,listOrdered:i(me,f),listUnordered:i(me),paragraph:i(Oe),reference:P,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(he),strong:i(Mt),thematicBreak:i(St)},exit:{atxHeading:c(),atxHeadingSequence:S,autolink:c(),autolinkEmail:ie,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:W,characterReference:K,codeFenced:c(w),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:E,codeIndented:c(y),codeText:c($),codeTextData:E,data:E,definition:c(),definitionDestinationString:k,definitionLabelString:v,definitionTitleString:x,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(M),htmlFlowData:E,htmlText:c(R),htmlTextData:E,image:c(N),label:G,labelText:z,lineEnding:L,link:c(B),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:F,resourceDestinationString:I,resourceTitleString:Y,resource:U,setextHeading:c(C),setextHeadingLineSequence:_,setextHeadingText:T,strong:c(),thematicBreak:c()}};ute(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let Ee={type:"root",children:[]};const tt={stack:[Ee],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:n},ut=[];let Ct=-1;for(;++Ct<ue.length;)if(ue[Ct][1].type==="listOrdered"||ue[Ct][1].type==="listUnordered")if(ue[Ct][0]==="enter")ut.push(Ct);else{const Ze=ut.pop();Ct=s(ue,Ze,Ct)}for(Ct=-1;++Ct<ue.length;){const Ze=t[ue[Ct][0]];cte.call(Ze,ue[Ct][1].type)&&Ze[ue[Ct][1].type].call(Object.assign({sliceSerialize:ue[Ct][2].sliceSerialize},tt),ue[Ct][1])}if(tt.tokenStack.length>0){const Ze=tt.tokenStack[tt.tokenStack.length-1];(Ze[1]||Sq).call(tt,void 0,Ze[0])}for(Ee.position={start:Tm(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Tm(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ct=-1;++Ct<t.transforms.length;)Ee=t.transforms[Ct](Ee)||Ee;return Ee}function s(ue,Ee,tt){let ut=Ee-1,Ct=-1,Ze=!1,Et,Nt,gt,Je;for(;++ut<=tt;){const Ae=ue[ut];switch(Ae[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ae[0]==="enter"?Ct++:Ct--,Je=void 0;break}case"lineEndingBlank":{Ae[0]==="enter"&&(Et&&!Je&&!Ct&&!gt&&(gt=ut),Je=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Je=void 0}if(!Ct&&Ae[0]==="enter"&&Ae[1].type==="listItemPrefix"||Ct===-1&&Ae[0]==="exit"&&(Ae[1].type==="listUnordered"||Ae[1].type==="listOrdered")){if(Et){let de=ut;for(Nt=void 0;de--;){const nt=ue[de];if(nt[1].type==="lineEnding"||nt[1].type==="lineEndingBlank"){if(nt[0]==="exit")continue;Nt&&(ue[Nt][1].type="lineEndingBlank",Ze=!0),nt[1].type="lineEnding",Nt=de}else if(!(nt[1].type==="linePrefix"||nt[1].type==="blockQuotePrefix"||nt[1].type==="blockQuotePrefixWhitespace"||nt[1].type==="blockQuoteMarker"||nt[1].type==="listItemIndent"))break}gt&&(!Nt||gt<Nt)&&(Et._spread=!0),Et.end=Object.assign({},Nt?ue[Nt][1].start:Ae[1].end),ue.splice(Nt||ut,0,["exit",Et,Ae[2]]),ut++,tt++}if(Ae[1].type==="listItemPrefix"){const de={type:"listItem",_spread:!1,start:Object.assign({},Ae[1].start),end:void 0};Et=de,ue.splice(ut,0,["enter",de,Ae[2]]),ut++,tt++,gt=void 0,Je=!0}}}return ue[Ee][1]._spread=Ze,tt}function i(ue,Ee){return tt;function tt(ut){l.call(this,ue(ut),ut),Ee&&Ee.call(this,ut)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(ue,Ee,tt){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([Ee,tt||void 0]),ue.position={start:Tm(Ee.start),end:void 0}}function c(ue){return Ee;function Ee(tt){ue&&ue.call(this,tt),u.call(this,tt)}}function u(ue,Ee){const tt=this.stack.pop(),ut=this.tokenStack.pop();if(ut)ut[0].type!==ue.type&&(Ee?Ee.call(this,ue,ut[0]):(ut[1]||Sq).call(this,ue,ut[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Ox({start:ue.start,end:ue.end})+"): it’s not open");tt.position.end=Tm(ue.end)}function d(){return vD(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(ue){if(this.data.expectingFirstListItemValue){const Ee=this.stack[this.stack.length-2];Ee.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.lang=ue}function g(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.meta=ue}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ue.replace(/(\r?\n|\r)$/g,"")}function v(ue){const Ee=this.resume(),tt=this.stack[this.stack.length-1];tt.label=Ee,tt.identifier=hd(this.sliceSerialize(ue)).toLowerCase()}function x(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.title=ue}function k(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.url=ue}function S(ue){const Ee=this.stack[this.stack.length-1];if(!Ee.depth){const tt=this.sliceSerialize(ue).length;Ee.depth=tt}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function _(ue){const Ee=this.stack[this.stack.length-1];Ee.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function j(ue){const tt=this.stack[this.stack.length-1].children;let ut=tt[tt.length-1];(!ut||ut.type!=="text")&&(ut=$t(),ut.position={start:Tm(ue.start),end:void 0},tt.push(ut)),this.stack.push(ut)}function E(ue){const Ee=this.stack.pop();Ee.value+=this.sliceSerialize(ue),Ee.position.end=Tm(ue.end)}function L(ue){const Ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const tt=Ee.children[Ee.children.length-1];tt.position.end=Tm(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ee.type)&&(j.call(this,ue),E.call(this,ue))}function D(){this.data.atHardBreak=!0}function M(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ue}function R(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ue}function $(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ue}function B(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Ee=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Ee,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function N(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Ee=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Ee,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function z(ue){const Ee=this.sliceSerialize(ue),tt=this.stack[this.stack.length-2];tt.label=F4e(Ee),tt.identifier=hd(Ee).toLowerCase()}function G(){const ue=this.stack[this.stack.length-1],Ee=this.resume(),tt=this.stack[this.stack.length-1];if(this.data.inReference=!0,tt.type==="link"){const ut=ue.children;tt.children=ut}else tt.alt=Ee}function I(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.url=ue}function Y(){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.title=ue}function U(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function F(ue){const Ee=this.resume(),tt=this.stack[this.stack.length-1];tt.label=Ee,tt.identifier=hd(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function te(ue){this.data.characterReferenceType=ue.type}function W(ue){const Ee=this.sliceSerialize(ue),tt=this.data.characterReferenceType;let ut;tt?(ut=Zee(Ee,tt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ut=wD(Ee);const Ct=this.stack[this.stack.length-1];Ct.value+=ut}function K(ue){const Ee=this.stack.pop();Ee.position.end=Tm(ue.end)}function ce(ue){E.call(this,ue);const Ee=this.stack[this.stack.length-1];Ee.url=this.sliceSerialize(ue)}function ie(ue){E.call(this,ue);const Ee=this.stack[this.stack.length-1];Ee.url="mailto:"+this.sliceSerialize(ue)}function Z(){return{type:"blockquote",children:[]}}function ee(){return{type:"code",lang:null,meta:null,value:""}}function oe(){return{type:"inlineCode",value:""}}function we(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function X(){return{type:"break"}}function ye(){return{type:"html",value:""}}function Ce(){return{type:"image",title:null,url:"",alt:null}}function ae(){return{type:"link",title:null,url:"",children:[]}}function me(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function We(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function Mt(){return{type:"strong",children:[]}}function $t(){return{type:"text",value:""}}function St(){return{type:"thematicBreak"}}}function Tm(e){return{line:e.line,column:e.column,offset:e.offset}}function ute(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ute(e,r):W4e(e,r)}}function W4e(e,t){let n;for(n in t)if(cte.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 Sq(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ox({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ox({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ox({start:t.start,end:t.end})+") is still open")}function V4e(e){const t=this;t.parser=n;function n(r){return H4e(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function G4e(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 K4e(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function Y4e(e,t){const n=t.value?t.value+`
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function X4e(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Q4e(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function J4e(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=fv(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Z4e(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 eTe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function dte(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),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function tTe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dte(e,t);const s={src:fv(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function nTe(e,t){const n={src:fv(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 rTe(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 sTe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dte(e,t);const s={href:fv(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function iTe(e,t){const n={href:fv(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 oTe(e,t,n){const r=e.all(t),s=n?aTe(n):hte(t),i={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(s||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!s?o.push(...d.children):o.push(d)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function aTe(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=hte(n[r])}return t}function hte(e){const t=e.spread;return t??e.children.length>1}function lTe(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 o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function cTe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uTe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function dTe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hTe(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=pD(t.children[1]),c=Wee(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function fTe(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const f=t.children[c],m={},p=o?o[c]:void 0;p&&(m.align=p);let g={type:"element",tagName:i,properties:m,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function mTe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Cq=9,Tq=32;function pTe(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(Eq(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(Eq(t.slice(s),s>0,!1)),i.join("")}function Eq(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===Cq||i===Tq;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===Cq||i===Tq;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function gTe(e,t){const n={type:"text",value:pTe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function bTe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const yTe={blockquote:G4e,break:K4e,code:Y4e,delete:X4e,emphasis:Q4e,footnoteReference:J4e,heading:Z4e,html:eTe,imageReference:tTe,image:nTe,inlineCode:rTe,linkReference:sTe,link:iTe,listItem:oTe,list:lTe,paragraph:cTe,root:uTe,strong:dTe,table:hTe,tableCell:mTe,tableRow:fTe,text:gTe,thematicBreak:bTe,toml:d2,yaml:d2,definition:d2,footnoteDefinition:d2};function d2(){}const fte=-1,b5=0,Bx=1,vT=2,kD=3,_D=4,SD=5,CD=6,mte=7,pte=8,Aq=typeof self=="object"?self:globalThis,vTe=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case b5:case fte:return n(o,s);case Bx:{const l=n([],s);for(const c of o)l.push(r(c));return l}case vT:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case kD:return n(new Date(o),s);case _D:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case SD:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case CD:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case mte:{const{name:l,message:c}=o;return n(new Aq[l](c),s)}case pte:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new Aq[i](o),s)};return r},jq=e=>vTe(new Map,e)(0),G1="",{toString:wTe}={},{keys:xTe}=Object,jw=e=>{const t=typeof e;if(t!=="object"||!e)return[b5,t];const n=wTe.call(e).slice(8,-1);switch(n){case"Array":return[Bx,G1];case"Object":return[vT,G1];case"Date":return[kD,G1];case"RegExp":return[_D,G1];case"Map":return[SD,G1];case"Set":return[CD,G1];case"DataView":return[Bx,n]}return n.includes("Array")?[Bx,n]:n.includes("Error")?[mte,n]:[vT,n]},h2=([e,t])=>e===b5&&(t==="function"||t==="symbol"),kTe=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=jw(o);switch(l){case b5:{let d=o;switch(c){case"bigint":l=pte,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([fte],o)}return s([l,d],o)}case Bx:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),s([c,[...m]],o)}const d=[],f=s([l,d],o);for(const m of o)d.push(i(m));return f}case vT:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],f=s([l,d],o);for(const m of xTe(o))(e||!h2(jw(o[m])))&&d.push([i(m),i(o[m])]);return f}case kD:return s([l,o.toISOString()],o);case _D:{const{source:d,flags:f}=o;return s([l,{source:d,flags:f}],o)}case SD:{const d=[],f=s([l,d],o);for(const[m,p]of o)(e||!(h2(jw(m))||h2(jw(p))))&&d.push([i(m),i(p)]);return f}case CD:{const d=[],f=s([l,d],o);for(const m of o)(e||!h2(jw(m)))&&d.push(i(m));return f}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},Nq=(e,{json:t,lossy:n}={})=>{const r=[];return kTe(!(t||n),!!t,new Map,r)(e),r},wT=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?jq(Nq(e,t)):structuredClone(e):(e,t)=>jq(Nq(e,t));function _Te(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 STe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function CTe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||_Te,r=e.options.footnoteBackLabel||STe,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),m=fv(f.toLowerCase());let p=0;const g=[],b=e.footnoteCounts.get(f);for(;b!==void 0&&++p<=b;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...wT(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
`}]}}const k_=function(e){if(e==null)return jTe;if(typeof e=="function")return y5(e);if(typeof e=="object")return Array.isArray(e)?TTe(e):ETe(e);if(typeof e=="string")return ATe(e);throw new Error("Expected function, string, or object as test")};function TTe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=k_(e[n]);return y5(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function ETe(e){const t=e;return y5(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function ATe(e){return y5(t);function t(n){return n&&n.type===e}}function y5(e){return t;function t(n,r,s){return!!(NTe(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function jTe(){return!0}function NTe(e){return e!==null&&typeof e=="object"&&"type"in e}const gte=[],ITe=!0,ZN=!1,bte="skip";function TD(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=k_(s),o=r?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=gte,g,b,w;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=MTe(n(c,d)),p[0]===ZN))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==bte)for(b=(r?y.children.length:-1)+o,w=d.concat(y);b>-1&&b<y.children.length;){const v=y.children[b];if(g=l(v,b,w)(),g[0]===ZN)return g;b=typeof g[1]=="number"?g[1]:b+o}}return p}}}function MTe(e){return Array.isArray(e)?e:typeof e=="number"?[ITe,e]:e==null?gte:[e]}function ED(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),TD(e,i,l,s);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return o(c,f,d)}}const eI={}.hasOwnProperty,RTe={};function DTe(e,t){const n=t||RTe,r=new Map,s=new Map,i=new Map,o={...yTe,...n.handlers},l={all:u,applyData:PTe,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:LTe,wrap:$Te};return ED(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:s,m=String(d.identifier).toUpperCase();f.has(m)||f.set(m,d)}}),l;function c(d,f){const m=d.type,p=l.handlers[m];if(eI.call(l.handlers,m)&&p)return p(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(m)){if("children"in d){const{children:b,...w}=d,y=wT(w);return y.children=l.all(d),y}return wT(d)}return(l.options.unknownHandler||OTe)(l,d,f)}function u(d){const f=[];if("children"in d){const m=d.children;let p=-1;for(;++p<m.length;){const g=l.one(m[p],d);if(g){if(p&&m[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Iq(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=Iq(b.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function LTe(e,t){e.position&&(t.position=S2e(e))}function PTe(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,wT(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function OTe(e,t){const n=t.data||{},r="value"in t&&!(eI.call(n,"hProperties")||eI.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 $Te(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
`});++r<e.length;)r&&n.push({type:"text",value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function Iq(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Mq(e,t){const n=DTe(e,t),r=n.one(e,void 0),s=CTe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function BTe(e,t){return e&&"run"in e?async function(n,r){const s=Mq(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Mq(n,{file:r,...e||t})}}function Rq(e){if(e)throw e}var t4=Object.prototype.hasOwnProperty,yte=Object.prototype.toString,Dq=Object.defineProperty,Lq=Object.getOwnPropertyDescriptor,Pq=function(t){return typeof Array.isArray=="function"?Array.isArray(t):yte.call(t)==="[object Array]"},Oq=function(t){if(!t||yte.call(t)!=="[object Object]")return!1;var n=t4.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&t4.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||t4.call(t,s)},$q=function(t,n){Dq&&n.name==="__proto__"?Dq(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Bq=function(t,n){if(n==="__proto__")if(t4.call(t,n)){if(Lq)return Lq(t,n).value}else return;return t[n]},zTe=function e(){var t,n,r,s,i,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=Bq(l,n),s=Bq(t,n),l!==s&&(d&&s&&(Oq(s)||(i=Pq(s)))?(i?(i=!1,o=r&&Pq(r)?r:[]):o=r&&Oq(r)?r:{},$q(l,{name:n,newValue:e(d,o,s)})):typeof s<"u"&&$q(l,{name:n,newValue:s}));return l};const sA=i_(zTe);function tI(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 FTe(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const d=e[++i];let f=-1;if(c){o(c);return}for(;++f<s.length;)(u[f]===null||u[f]===void 0)&&(u[f]=s[f]);s=u,d?qTe(d,l)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function qTe(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,t(o,...l))}function i(o){s(null,o)}}const Qd={basename:HTe,dirname:UTe,extname:WTe,join:VTe,sep:"/"};function HTe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');__(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function UTe(e){if(__(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 WTe(e){__(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function VTe(...e){let t=-1,n;for(;++t<e.length;)__(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":GTe(n)}function GTe(e){__(e);const t=e.codePointAt(0)===47;let n=KTe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function KTe(e,t){let n="",r=0,s=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function __(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const YTe={cwd:XTe};function XTe(){return"/"}function nI(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function QTe(e){if(typeof e=="string")e=new URL(e);else if(!nI(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 JTe(e)}function JTe(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 iA=["history","path","basename","stem","extname","dirname"];class vte{constructor(t){let n;t?nI(t)?n={path:t}:typeof t=="string"||ZTe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":YTe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<iA.length;){const i=iA[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)iA.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Qd.basename(this.path):void 0}set basename(t){aA(t,"basename"),oA(t,"basename"),this.path=Qd.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Qd.dirname(this.path):void 0}set dirname(t){zq(this.basename,"dirname"),this.path=Qd.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Qd.extname(this.path):void 0}set extname(t){if(oA(t,"extname"),zq(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=Qd.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){nI(t)&&(t=QTe(t)),aA(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Qd.basename(this.path,this.extname):void 0}set stem(t){aA(t,"stem"),oA(t,"stem"),this.path=Qd.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 jl(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 oA(e,t){if(e&&e.includes(Qd.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Qd.sep+"`")}function aA(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function zq(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ZTe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const e3e=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},t3e={}.hasOwnProperty;class AD extends e3e{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=FTe()}copy(){const t=new AD;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(sA(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(uA("data",this.frozen),this.namespace[t]=n,this):t3e.call(this.namespace,t)&&this.namespace[t]||void 0:t?(uA("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=f2(t),r=this.parser||this.Parser;return lA("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),lA("process",this.parser||this.Parser),cA("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=f2(t),c=r.parse(l);r.run(c,l,function(d,f,m){if(d||!f||!m)return u(d);const p=f,g=r.stringify(p,m);s3e(g)?m.value=g:m.result=g,u(d,m)});function u(d,f){d||!f?o(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),lA("processSync",this.parser||this.Parser),cA("processSync",this.compiler||this.Compiler),this.process(t,s),qq("processSync","process",n),r;function s(i,o){n=!0,Rq(i),r=o}}run(t,n,r){Fq(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=f2(n);s.run(t,c,u);function u(d,f,m){const p=f||t;d?l(d):o?o(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),qq("runSync","run",r),s;function i(o,l){Rq(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=f2(n),s=this.compiler||this.Compiler;return cA("stringify",s),Fq(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(uA("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))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");l(u.plugins),u.settings&&(s.settings=sA(!0,s.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,m=-1;for(;++f<r.length;)if(r[f][0]===u){m=f;break}if(m===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const b=r[m][1];tI(b)&&tI(p)&&(p=sA(!0,b,p)),r[m]=[u,p,...g]}}}}const n3e=new AD().freeze();function lA(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cA(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function uA(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 Fq(e){if(!tI(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function qq(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function f2(e){return r3e(e)?e:new vte(e)}function r3e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function s3e(e){return typeof e=="string"||i3e(e)}function i3e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o3e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hq=[],Uq={allowDangerousHtml:!0},a3e=/^(https?|ircs?|mailto|xmpp)$/i,l3e=[{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:"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 c3e(e){const t=u3e(e),n=d3e(e);return h3e(t.runSync(t.parse(n),n),e)}function u3e(e){const t=e.rehypePlugins||Hq,n=e.remarkPlugins||Hq,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Uq}:Uq;return n3e().use(V4e).use(n).use(BTe,r).use(t)}function d3e(e){const t=e.children||"",n=new vte;return typeof t=="string"&&(n.value=t),n}function h3e(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||wte;for(const d of l3e)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+o3e+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),ED(e,u),j2e(e,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,f,m){if(d.type==="raw"&&m&&typeof f=="number")return o?m.children.splice(f,1):m.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in tA)if(Object.hasOwn(tA,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=tA[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=c(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,m)),p&&m&&typeof f=="number")return l&&d.children?m.children.splice(f,1,...d.children):m.children.splice(f,1),f}}}function wte(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||a3e.test(e.slice(0,t))?e:""}var n4="markdown-chart",gn=class extends Error{constructor(t,n,r){super(n);Ue(this,"code");Ue(this,"cause");this.name="MarkdownChartError",this.code=t,this.cause=r==null?void 0:r.cause}},jD=Object.freeze({maxCharacters:5e5,maxDepth:40,maxNodes:1e5}),f3e=new Set(["__proto__","prototype","constructor"]);function xte(e,t){const n=t.maxCharacters??jD.maxCharacters;if(e.length>n)throw new gn("LIMIT_EXCEEDED",`Chart fence exceeds the ${n} character limit`)}function js(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function xT(e,t,n,r,s){if(n.nodes+=1,n.nodes>t.maxNodes)throw new gn("LIMIT_EXCEEDED",`Chart JSON exceeds the ${t.maxNodes} node limit`);if(r>t.maxDepth)throw new gn("LIMIT_EXCEEDED",`Chart JSON exceeds the ${t.maxDepth} level depth limit`);if(!(e===null||typeof e=="string"||typeof e=="boolean")){if(typeof e=="number"){if(!Number.isFinite(e))throw new gn("INVALID_JSON",`${s} contains a non-finite number`);return}if(Array.isArray(e)){for(const i of Reflect.ownKeys(e))if(i!=="length"&&(typeof i!="string"||!/^(0|[1-9]\d*)$/.test(i)||Number(i)>=e.length))throw new gn("INVALID_JSON",`${s} contains a non-JSON array property`);for(let i=0;i<e.length;i+=1){const o=Object.getOwnPropertyDescriptor(e,String(i));if(!o||!o.enumerable||!("value"in o))throw new gn("INVALID_JSON",`${s}[${i}] is not a JSON data property`);xT(o.value,t,n,r+1,`${s}[${i}]`)}return}if(!js(e))throw new gn("INVALID_JSON",`${s} contains a non-JSON value`);for(const i of Reflect.ownKeys(e)){if(typeof i!="string")throw new gn("INVALID_JSON",`${s} contains a symbol key`);if(f3e.has(i))throw new gn("UNSAFE_SPEC",`${s} contains forbidden key ${i}`);const o=Object.getOwnPropertyDescriptor(e,i);if(!o||!o.enumerable||!("value"in o))throw new gn("INVALID_JSON",`${s}.${i} is not a JSON data property`);xT(o.value,t,n,r+1,`${s}.${i}`)}}}function kte(e,t={}){const n={...jD,...t};return xT(e,n,{nodes:0},0,"$"),e}function _te(e,t={}){const n={...jD,...t};xte(e,n);let r;try{r=JSON.parse(e)}catch(s){throw new gn("INVALID_JSON","Chart fence must contain valid JSON",{cause:s})}return xT(r,n,{nodes:0},0,"$"),r}function m3e(e){if(e!==void 0){if(!Array.isArray(e)||e.some(t=>typeof t!="string"||t.length===0))throw new gn("SCHEMA_INVALID","markdown-chart.data.dimensions must be an array of non-empty strings");return[...e]}}function p3e(e){if(!Array.isArray(e))throw new gn("SCHEMA_INVALID","markdown-chart.data.source must be an array");return e.map((t,n)=>{if(Array.isArray(t)){if(t.some(r=>r!==null&&!["string","number","boolean"].includes(typeof r)))throw new gn("SCHEMA_INVALID",`markdown-chart.data.source[${n}] must contain only JSON scalars`);return[...t]}if(js(t)){const r={};for(const[s,i]of Object.entries(t)){if(i!==null&&!["string","number","boolean"].includes(typeof i))throw new gn("SCHEMA_INVALID",`markdown-chart.data.source[${n}].${s} must be a JSON scalar`);r[s]=i}return r}throw new gn("SCHEMA_INVALID",`markdown-chart.data.source[${n}] must be an array or object`)})}function g3e(e){if(!js(e)||typeof e.kind!="string")throw new gn("SCHEMA_INVALID","markdown-chart.data must be an inline or ref dataset object");const t=m3e(e.dimensions);if(e.kind==="inline"){const n=p3e(e.source);return t?{kind:"inline",dimensions:t,source:n}:{kind:"inline",source:n}}if(e.kind==="ref"){if(typeof e.ref!="string"||e.ref.length===0)throw new gn("SCHEMA_INVALID","markdown-chart.data.ref must be a non-empty string");if(e.format!==void 0&&e.format!=="csv"&&e.format!=="json")throw new gn("SCHEMA_INVALID","markdown-chart.data.format must be csv or json");return{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...t?{dimensions:t}:{}}}throw new gn("SCHEMA_INVALID",`Unsupported markdown-chart.data.kind: ${e.kind}`)}function rI(e,t){const n=e.trim().toLowerCase();if(!/^[a-z][a-z0-9._-]*$/.test(n))throw new gn("SCHEMA_INVALID",`Invalid ${t}: ${e}`);return n}function b3e(e){return e.trim().split(/\s+/,1)[0]??""}function y3e(e,t={}){const n=_te(e,t);if(!js(n))throw new gn("SCHEMA_INVALID","The canonical markdown-chart fence must contain an object");if(n.version!==1)throw new gn("UNSUPPORTED_VERSION","Only markdown-chart protocol version 1 is supported");if(typeof n.renderer!="string")throw new gn("SCHEMA_INVALID","markdown-chart.renderer must be a string");if(!Object.prototype.hasOwnProperty.call(n,"spec"))throw new gn("SCHEMA_INVALID","markdown-chart.spec is required");return{version:1,renderer:rI(n.renderer,"renderer id"),data:n.data===void 0?void 0:g3e(n.data),spec:n.spec}}var Zd,Km,kg,vX,v3e=(vX=class{constructor(e={}){Dd(this,Zd,new Map);Dd(this,Km,new Map);Dd(this,kg);Xi(this,kg,e.jsonLimits??{})}register(e){const t=rI(e.id,"renderer id"),n=(e.aliases??[]).map(o=>rI(o,"renderer alias")),r=ts(this,Km).get(t);if(ts(this,Zd).has(t)||r)throw new gn("RENDERER_CONFLICT",`Renderer id ${t} is already owned by ${r??t}`);const s=new Set;for(const o of n){if(o===n4)throw new gn("RENDERER_CONFLICT","The canonical markdown-chart fence cannot be a renderer alias");if(s.has(o))throw new gn("RENDERER_CONFLICT",`Renderer alias ${o} is declared more than once`);s.add(o);const l=ts(this,Km).get(o)??(o!==t&&ts(this,Zd).has(o)?o:void 0);if(l)throw new gn("RENDERER_CONFLICT",`Renderer alias ${o} is already owned by ${l}`)}const i=e;return ts(this,Zd).set(t,i),n.forEach(o=>ts(this,Km).set(o,t)),this}has(e){const t=e.trim().toLowerCase();return t===n4||ts(this,Km).has(t)||[...ts(this,Zd).values()].some(n=>{var r;return((r=n.matchLanguage)==null?void 0:r.call(n,t))===!0})}get rendererIds(){return[...ts(this,Zd).keys()]}async prepare(e,t){const n=b3e(e),r=n.toLowerCase();let s,i,o,l=!1;if(r===n4){const f=y3e(t,ts(this,kg));s=f.renderer,i=f.spec,o=f.data}else{const f=ts(this,Km).get(r),m=f?[]:[...ts(this,Zd).entries()].filter(([,p])=>{var g;return((g=p.matchLanguage)==null?void 0:g.call(p,r))===!0}).map(([p])=>p);if(!f&&m.length===0)throw new gn("RENDERER_NOT_FOUND",`No renderer is registered for ${r||"this fence"}`);if(m.length>1)throw new gn("RENDERER_CONFLICT",`Multiple renderers match the dynamic fence language ${r}`);s=f??m[0],l=!f,l&&xte(t,ts(this,kg)),i=l?null:_te(t,ts(this,kg))}const c=ts(this,Zd).get(s);if(!c)throw new gn("RENDERER_NOT_FOUND",`Renderer ${s} is not registered`);const u={language:r,rawLanguage:n,rendererId:s,data:o};if(l&&!c.parseSource)throw new gn("SCHEMA_INVALID",`Renderer ${s} matched ${r} but cannot parse its source`);const d=l?await c.parseSource(t,u):await c.parse(i,u);return{renderer:c,parsed:d,data:o,language:r,rawLanguage:n,rendererId:s}}},Zd=new WeakMap,Km=new WeakMap,kg=new WeakMap,vX),w3e="Rendering chart…",Wq=Object.freeze({chartUnavailable:"Chart unavailable",viewMode:"View mode",chart:"Chart",data:"Data",showChart:"Show chart",showData:"Show data",noData:"No data",tableNotice:({visibleRows:e,totalRows:t,visibleColumns:n,totalColumns:r})=>`Showing ${e} of ${t} rows and ${n} of ${r} columns.`});function Ste(e){return e?Object.freeze({...Wq,...e}):Wq}var x3e=/^ {0,3}(`{3,}|~{3,})/,Cte=/^ {0,3}>[ \t]?/;function k3e(e,t){var r;let n=e;for(let s=0;s<t;s+=1){const i=(r=Cte.exec(n))==null?void 0:r[0];if(!i)return;n=n.slice(i.length)}return n}function Tte(e){var c;const t=e.replace(/\r\n?/g,`
`).split(`
`);let n=t[0]??"",r=0;for(;;){const u=(c=Cte.exec(n))==null?void 0:c[0];if(!u)break;r+=1,n=n.slice(u.length)}const s=x3e.exec(n),i=s==null?void 0:s[1];if(!i)return!1;const o=i[0];if(!o)return!1;const l=new RegExp(`^ {0,3}${o==="`"?"`":"~"}{${i.length},}[\\t ]*$`);return t.slice(1).some(u=>{const d=k3e(u,r);return d!==void 0&&l.test(d)})}var _3e=500,S3e=50;function C3e(e){if(e.dimensions&&e.dimensions.length>0)return[...e.dimensions];const t=[],n=new Set;for(const r of e.source)if(Array.isArray(r))for(let s=0;s<r.length;s+=1){const i=String(s+1);n.has(i)||(n.add(i),t.push(i))}else for(const s of Object.keys(r))n.has(s)||(n.add(s),t.push(s));return t}function T3e(e,t,n){return Array.isArray(e)?e[n]:e[t]}function xl(e,t){Object.assign(e.style,t)}var E3e="http://www.w3.org/2000/svg";function _f(e){return document.createElementNS(E3e,e)}function A3e(){const e=_f("svg");e.setAttribute("viewBox","0 0 20 20"),e.setAttribute("aria-hidden","true"),xl(e,{width:"16px",height:"16px",fill:"currentColor"});for(const t of[{x:"3",y:"10",width:"3",height:"6",rx:"1"},{x:"8.5",y:"6",width:"3",height:"10",rx:"1"},{x:"14",y:"3",width:"3",height:"13",rx:"1"}]){const n=_f("rect");Object.entries(t).forEach(([r,s])=>n.setAttribute(r,s)),e.append(n)}return e}function j3e(){const e=_f("svg");e.setAttribute("viewBox","0 0 20 20"),e.setAttribute("aria-hidden","true"),xl(e,{width:"16px",height:"16px",fill:"none"});const t=_f("rect");Object.entries({x:"3",y:"4",width:"14",height:"12",rx:"1.5",fill:"none",stroke:"currentColor","stroke-width":"1.4"}).forEach(([r,s])=>t.setAttribute(r,s));const n=_f("path");return n.setAttribute("d","M3 8.5H17M3 12.5H17M8 4V16M13 4V16"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.4"),e.append(t,n),e}function N3e(){const e=_f("svg");e.classList.add("markdown-chart-loading-spinner"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("aria-hidden","true"),xl(e,{flex:"none",fill:"none"});const t=_f("circle");Object.entries({cx:"12",cy:"12",r:"9",stroke:"currentColor","stroke-width":"2",opacity:".24"}).forEach(([s,i])=>t.setAttribute(s,i));const n=_f("path");Object.entries({d:"M12 3a9 9 0 0 1 9 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}).forEach(([s,i])=>n.setAttribute(s,i));const r=_f("animateTransform");return Object.entries({attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:".8s",repeatCount:"indefinite"}).forEach(([s,i])=>r.setAttribute(s,i)),n.append(r),e.append(t,n),e}function Ete(e){return[...e.children].find(t=>t.dataset.markdownChartLoading==="true")}function dA(e,t=w3e){const n=Ete(e);if(n){const i=n.querySelector(".markdown-chart-loading-label");i&&(i.textContent=t),e.setAttribute("aria-busy","true");return}const r=document.createElement("div");r.className="markdown-chart-loading",r.dataset.markdownChartLoading="true",r.setAttribute("role","status"),xl(r,{display:"flex",minHeight:"inherit",width:"100%",boxSizing:"border-box",alignItems:"center",justifyContent:"center",gap:"8px",padding:"24px",color:"var(--markdown-chart-loading-color, currentColor)",opacity:".68",font:'400 12px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'});const s=document.createElement("span");s.className="markdown-chart-loading-label",s.textContent=t,r.append(N3e(),s),e.replaceChildren(r),e.setAttribute("aria-busy","true")}function I3e(e){var t;(t=Ete(e))==null||t.remove(),e.removeAttribute("aria-busy")}function Vq(e,t,n){const r=document.createElement("button");return r.type="button",r.setAttribute("aria-label",t),r.setAttribute("title",e),r.className="markdown-chart-toggle-button",r.append(n),xl(r,{display:"grid",width:"30px",height:"26px",placeItems:"center",padding:"0",border:"0",borderRadius:"4px",background:"transparent",color:"color-mix(in srgb, currentColor 68%, transparent)",cursor:"pointer",transition:"background-color 0.16s ease, color 0.16s ease"}),r}function M3e(e){const t=e==="dark";return{background:`var(--markdown-chart-background, ${t?"#0d0d0d":"#ffffff"})`,subtleBackground:`var(--markdown-chart-subtle-background, ${t?"#161616":"#f7f8fa"})`}}function R3e(e,t,n){const r=C3e(e),s=r.slice(0,S3e),i=e.source.slice(0,_3e),o=document.createElement("div");if(o.className="markdown-chart-data-view",o.dataset.markdownChartDataView="true",xl(o,{minHeight:"240px",maxHeight:"min(60vh, 520px)",overflow:"auto",background:t.background,scrollbarColor:"color-mix(in srgb, currentColor 18%, transparent) transparent"}),r.length===0||e.source.length===0){const f=document.createElement("div");return f.textContent=n.noData,xl(f,{padding:"24px",textAlign:"center",opacity:"0.68"}),o.append(f),o}if(s.length<r.length||i.length<e.source.length){const f=document.createElement("div");f.className="markdown-chart-data-notice",f.textContent=n.tableNotice({visibleRows:i.length,totalRows:e.source.length,visibleColumns:s.length,totalColumns:r.length}),xl(f,{position:"sticky",top:"0",zIndex:"2",padding:"8px 12px",borderBottom:"1px solid color-mix(in srgb, currentColor 18%, transparent)",background:t.subtleBackground,fontSize:"12px",opacity:"0.75"}),o.append(f)}const l=document.createElement("table");l.className="markdown-chart-data-table",xl(l,{width:"max-content",minWidth:"100%",borderCollapse:"separate",borderSpacing:"0",fontSize:"13px"});const c=document.createElement("thead"),u=document.createElement("tr");for(const f of s){const m=document.createElement("th");m.scope="col",m.textContent=f,xl(m,{position:"sticky",top:"0",zIndex:"1",padding:"8px 12px",borderRight:"1px solid color-mix(in srgb, currentColor 18%, transparent)",borderBottom:"1px solid color-mix(in srgb, currentColor 18%, transparent)",background:t.subtleBackground,textAlign:"left",whiteSpace:"nowrap",fontSize:"12px",fontWeight:"600"}),u.append(m)}c.append(u),l.append(c);const d=document.createElement("tbody");for(const f of i){const m=document.createElement("tr");s.forEach((p,g)=>{const b=document.createElement("td"),w=T3e(f,p,g);b.textContent=w===void 0?"undefined":w===null?"null":w===""?'""':String(w),xl(b,{padding:"9px 12px",borderRight:"1px solid color-mix(in srgb, currentColor 18%, transparent)",borderBottom:"1px solid color-mix(in srgb, currentColor 18%, transparent)",textAlign:"left",verticalAlign:"top"}),m.append(b)}),d.append(m)}return l.append(d),o.append(l),o}function D3e(e,t,n,r,s,i){const o=M3e(s),l=e.classList.contains("markdown-chart-card"),c={margin:e.style.margin,minWidth:e.style.minWidth,maxWidth:e.style.maxWidth,overflow:e.style.overflow,border:e.style.border,borderRadius:e.style.borderRadius,background:e.style.background,boxShadow:e.style.boxShadow};e.classList.add("markdown-chart-card"),xl(e,{margin:"10px 0",minWidth:"0",maxWidth:"100%",overflow:"hidden",border:"1px solid color-mix(in srgb, currentColor 14%, transparent)",borderRadius:"8px",background:o.background,boxShadow:"0 8px 22px rgb(15 23 42 / 5%)"});const u=document.createElement("div");u.className="markdown-chart-toolbar",xl(u,{display:"flex",minHeight:"44px",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"0 10px 0 14px",borderBottom:"1px solid color-mix(in srgb, currentColor 14%, transparent)",background:o.subtleBackground});const d=n==null?void 0:n.trim();let f;if(d){const _=document.createElement("div");_.className="markdown-chart-title",_.textContent=d,xl(_,{minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"13px",fontWeight:"600",lineHeight:"1.3"}),f=_}const m=document.createElement("div");m.className="markdown-chart-toggle",m.setAttribute("role","group"),m.setAttribute("aria-label",i.viewMode),xl(m,{display:"inline-grid",flex:"0 0 auto",marginLeft:"auto",gridTemplateColumns:"repeat(2, 30px)",gap:"2px",padding:"2px",overflow:"hidden",border:"1px solid color-mix(in srgb, currentColor 16%, transparent)",borderRadius:"6px",background:o.background});const p=Vq(i.chart,i.showChart,A3e()),g=Vq(i.data,i.showData,j3e()),b=document.createElement("div");b.className="markdown-chart-chart-view",b.dataset.markdownChartChartView="true",b.setAttribute("role","img"),b.setAttribute("aria-label",i.chart),xl(b,{width:"calc(100% - 20px)",minHeight:"inherit",margin:"8px 10px",background:o.background});const w=R3e(t,o,i);w.hidden=!0;const y="var(--markdown-chart-accent, #0033ff)",v="var(--markdown-chart-accent-foreground, var(--markdown-chart-background, #ffffff))",x="color-mix(in srgb, currentColor 68%, transparent)",k=_=>{const C=_==="chart";p.setAttribute("aria-pressed",String(C)),g.setAttribute("aria-pressed",String(!C)),p.style.background=C?y:"transparent",p.style.color=C?v:x,g.style.background=C?"transparent":y,g.style.color=C?x:v,b.hidden=!C,w.hidden=C},S=()=>{k("chart"),r()},T=()=>k("data");return p.addEventListener("click",S),g.addEventListener("click",T),m.append(p,g),f&&u.append(f),u.append(m),e.replaceChildren(u,b,w),k("chart"),{chartContainer:b,dispose(){p.removeEventListener("click",S),g.removeEventListener("click",T),l||e.classList.remove("markdown-chart-card"),e.style.margin=c.margin,e.style.minWidth=c.minWidth,e.style.maxWidth=c.maxWidth,e.style.overflow=c.overflow,e.style.border=c.border,e.style.borderRadius=c.borderRadius,e.style.background=c.background,e.style.boxShadow=c.boxShadow}}}var s_,eh,mu,hf,pu,ff,wX,L3e=(wX=class{constructor(e){Dd(this,s_);Dd(this,eh,0);Dd(this,mu);Dd(this,hf);Dd(this,pu);Dd(this,ff,!1);Xi(this,s_,e)}async render(e,t){var s,i,o,l,c,u,d,f,m;if(t.streaming){ts(this,mu)&&(Xi(this,eh,ts(this,eh)+1),ts(this,mu).abort(),Xi(this,mu,void 0),(s=ts(this,pu))==null||s.dispose(),Xi(this,pu,void 0),e.replaceChildren(),Xi(this,ff,!1)),ts(this,ff)?e.removeAttribute("aria-busy"):dA(e,t.loadingLabel);return}const n=++IB(this,eh)._;(i=ts(this,mu))==null||i.abort(),(o=ts(this,hf))==null||o.dispose(),Xi(this,hf,void 0),(l=ts(this,pu))==null||l.dispose(),Xi(this,pu,void 0),e.replaceChildren(),Xi(this,ff,!1),dA(e,t.loadingLabel);const r=new AbortController;Xi(this,mu,r);try{const p=await ts(this,s_).prepare(t.language,t.source);if(n!==ts(this,eh)||r.signal.aborted)return;const g=p.renderer.materialize?await p.renderer.materialize(p.parsed,{signal:r.signal,theme:t.theme,language:p.language,rawLanguage:p.rawLanguage,rendererId:p.rendererId,data:p.data}):{parsed:p.parsed,data:p.data};if(n!==ts(this,eh)||r.signal.aborted)return;const b=((c=g.data)==null?void 0:c.kind)==="inline"?g.data:void 0,w=((f=(d=(u=p.renderer).getTitle)==null?void 0:d.call(u,g.parsed))==null?void 0:f.trim())||void 0,y=Ste(t.labels),v=b?D3e(e,b,w,()=>{var S,T;return(T=(S=ts(this,hf))==null?void 0:S.resize)==null?void 0:T.call(S)},t.theme,y):void 0;Xi(this,pu,v);const x=(v==null?void 0:v.chartContainer)??e;dA(x,t.loadingLabel);const k=await p.renderer.mount(x,g.parsed,{signal:r.signal,theme:t.theme,...v&&w?{externalizedTitle:w}:{}});if(n!==ts(this,eh)||r.signal.aborted){k==null||k.dispose();return}Xi(this,hf,k||void 0),Xi(this,ff,!0),I3e(x),e.removeAttribute("aria-busy")}catch(p){if(n!==ts(this,eh)||r.signal.aborted)return;throw(m=ts(this,pu))==null||m.dispose(),Xi(this,pu,void 0),e.replaceChildren(),e.removeAttribute("aria-busy"),Xi(this,ff,!1),p}finally{ts(this,mu)===r&&Xi(this,mu,void 0)}}dispose(){var e,t,n;Xi(this,eh,ts(this,eh)+1),(e=ts(this,mu))==null||e.abort(),Xi(this,mu,void 0),(t=ts(this,hf))==null||t.dispose(),Xi(this,hf,void 0),(n=ts(this,pu))==null||n.dispose(),Xi(this,pu,void 0),Xi(this,ff,!1)}},s_=new WeakMap,eh=new WeakMap,mu=new WeakMap,hf=new WeakMap,pu=new WeakMap,ff=new WeakMap,wX);function kT(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 P3e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function O3e(e,t,n){const s=k_((n||{}).ignore||[]),i=$3e(t);let o=-1;for(;++o<i.length;)TD(e,"text",l);function l(u,d){let f=-1,m;for(;++f<d.length;){const p=d[f],g=m?m.children:void 0;if(s(p,g?g.indexOf(p):void 0,m))return;m=p}if(m)return c(u,d)}function c(u,d){const f=d[d.length-1],m=i[o][0],p=i[o][1];let g=0;const w=f.children.indexOf(u);let y=!1,v=[];m.lastIndex=0;let x=m.exec(u.value);for(;x;){const k=x.index,S={index:x.index,input:x.input,stack:[...d,u]};let T=p(...x,S);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?m.lastIndex=k+1:(g!==k&&v.push({type:"text",value:u.value.slice(g,k)}),Array.isArray(T)?v.push(...T):T&&v.push(T),g=k+x[0].length,y=!0),!m.global)break;x=m.exec(u.value)}return y?(g<u.value.length&&v.push({type:"text",value:u.value.slice(g)}),f.children.splice(w,1,...v)):v=[u],w+v.length}}function $3e(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([B3e(s[0]),z3e(s[1])])}return t}function B3e(e){return typeof e=="string"?new RegExp(P3e(e),"g"):e}function z3e(e){return typeof e=="function"?e:function(){return e}}const hA="phrasing",fA=["autolink","link","image","label"];function F3e(){return{transforms:[K3e],enter:{literalAutolink:H3e,literalAutolinkEmail:mA,literalAutolinkHttp:mA,literalAutolinkWww:mA},exit:{literalAutolink:G3e,literalAutolinkEmail:V3e,literalAutolinkHttp:U3e,literalAutolinkWww:W3e}}}function q3e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:hA,notInConstruct:fA},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:hA,notInConstruct:fA},{character:":",before:"[ps]",after:"\\/",inConstruct:hA,notInConstruct:fA}]}}function H3e(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function mA(e){this.config.enter.autolinkProtocol.call(this,e)}function U3e(e){this.config.exit.autolinkProtocol.call(this,e)}function W3e(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 V3e(e){this.config.exit.autolinkEmail.call(this,e)}function G3e(e){this.exit(e)}function K3e(e){O3e(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Y3e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),X3e]],{ignore:["link","linkReference"]})}function Y3e(e,t,n,r,s){let i="";if(!Ate(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Q3e(n)))return!1;const o=J3e(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function X3e(e,t,n,r){return!Ate(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Q3e(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 J3e(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=kT(e,"(");let i=kT(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function Ate(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Bg(n)||p5(n))&&(!t||n!==47)}jte.peek=a5e;function Z3e(){this.buffer()}function e5e(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function t5e(){this.buffer()}function n5e(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function r5e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hd(this.sliceSerialize(e)).toLowerCase(),n.label=t}function s5e(e){this.exit(e)}function i5e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hd(this.sliceSerialize(e)).toLowerCase(),n.label=t}function o5e(e){this.exit(e)}function a5e(){return"["}function jte(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=s.move("]"),i}function l5e(){return{enter:{gfmFootnoteCallString:Z3e,gfmFootnoteCall:e5e,gfmFootnoteDefinitionLabelString:t5e,gfmFootnoteDefinition:n5e},exit:{gfmFootnoteCallString:r5e,gfmFootnoteCall:s5e,gfmFootnoteDefinitionLabelString:i5e,gfmFootnoteDefinition:o5e}}}function c5e(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:jte},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
`:" ")+i.indentLines(i.containerFlow(r,l.current()),t?Nte:u5e))),u(),c}}function u5e(e,t,n){return t===0?e:Nte(e,t,n)}function Nte(e,t,n){return(n?"":"    ")+e}const d5e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ite.peek=g5e;function h5e(){return{canContainEols:["delete"],enter:{strikethrough:m5e},exit:{strikethrough:p5e}}}function f5e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:d5e}],handlers:{delete:Ite}}}function m5e(e){this.enter({type:"delete",children:[]},e)}function p5e(e){this.exit(e)}function Ite(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function g5e(){return"~"}function b5e(e){return e.length}function y5e(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||b5e,i=[],o=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const b=[],w=[];let y=-1;for(e[d].length>u&&(u=e[d].length);++y<e[d].length;){const v=v5e(e[d][y]);if(n.alignDelimiters!==!1){const x=s(v);w[y]=x,(c[y]===void 0||x>c[y])&&(c[y]=x)}b.push(v)}o[d]=b,l[d]=w}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)i[f]=Gq(r[f]);else{const b=Gq(r);for(;++f<u;)i[f]=b}f=-1;const m=[],p=[];for(;++f<u;){const b=i[f];let w="",y="";b===99?(w=":",y=":"):b===108?w=":":b===114&&(y=":");let v=n.alignDelimiters===!1?1:Math.max(1,c[f]-w.length-y.length);const x=w+"-".repeat(v)+y;n.alignDelimiters!==!1&&(v=w.length+v+y.length,v>c[f]&&(c[f]=v),p[f]=v),m[f]=x}o.splice(1,0,m),l.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const b=o[d],w=l[d];f=-1;const y=[];for(;++f<u;){const v=b[f]||"";let x="",k="";if(n.alignDelimiters!==!1){const S=c[f]-(w[f]||0),T=i[f];T===114?x=" ".repeat(S):T===99?S%2?(x=" ".repeat(S/2+.5),k=" ".repeat(S/2-.5)):(x=" ".repeat(S/2),k=x):k=" ".repeat(S)}n.delimiterStart!==!1&&!f&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&y.push(" "),n.alignDelimiters!==!1&&y.push(x),y.push(v),n.alignDelimiters!==!1&&y.push(k),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&y.push("|")}g.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return g.join(`
`)}function v5e(e){return e==null?"":String(e)}function Gq(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}const Kq={}.hasOwnProperty;function w5e(e,t){const n=t||{};function r(s,...i){let o=r.invalid;const l=r.handlers;if(s&&Kq.call(s,e)){const c=String(s[e]);o=Kq.call(l,c)?l[c]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function x5e(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),k5e);return s(),o}function k5e(e,t,n){return">"+(n?"":" ")+e}function _5e(e,t){return Yq(e,t.inConstruct,!0)&&!Yq(e,t.notInConstruct,!1)}function Yq(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 Xq(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&_5e(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function Mte(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function S5e(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 C5e(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 T5e(e,t,n,r){const s=C5e(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(S5e(e,n)){const f=n.enter("codeIndented"),m=n.indentLines(i,E5e);return f(),m}const l=n.createTracker(r),c=s.repeat(Math.max(Mte(i,s)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:`
`,encode:["`"],...l.current()})),f()}return d+=l.move(`
`),i&&(d+=l.move(i+`
`)),d+=l.move(c),u(),d}function E5e(e,t,n){return(n?"":"    ")+e}function ND(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 A5e(e,t,n,r){const s=ND(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
`,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),o(),u}function j5e(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 wk(e){return"&#x"+e.toString(16).toUpperCase()+";"}function _T(e,t,n){const r=Cy(e),s=Cy(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}}Rte.peek=N5e;function Rte(e,t,n,r){const s=j5e(n),i=n.enter("emphasis"),o=n.createTracker(r),l=o.move(s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),d=_T(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=wk(u)+c.slice(1));const f=c.charCodeAt(c.length-1),m=_T(r.after.charCodeAt(0),f,s);m.inside&&(c=c.slice(0,-1)+wk(f));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+c+p}function N5e(e,t,n){return n.options.emphasis||"*"}function I5e(e,t){let n=!1;return ED(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ZN}),!!((!e.depth||e.depth<3)&&vD(e)&&(t.options.setext||n))}function M5e(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(I5e(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return f(),d(),m+`
`+(s===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
`))+1))}const o="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(u)&&(u=wk(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}Dte.peek=R5e;function Dte(e){return e.value||""}function R5e(){return"<"}Lte.peek=D5e;function Lte(e,t,n,r){const s=ND(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),u+=c.move(")"),o(),u}function D5e(){return"!"}Pte.peek=L5e;function Pte(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),s==="full"||!u||u!==f?c+=l.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function L5e(){return"!"}Ote.peek=P5e;function Ote(e,t,n){let r=e.value||"",s="`",i=-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+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return s+r+s}function P5e(){return"`"}function $te(e,t){const n=vD(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))}Bte.peek=O5e;function Bte(e,t,n,r){const s=ND(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if($te(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),c()),u+=o.move(")"),l(),u}function O5e(e,t,n){return $te(e,n)?"<":"["}zte.peek=$5e;function zte(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),s==="full"||!u||u!==f?c+=l.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function $5e(){return"["}function ID(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 B5e(e){const t=ID(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 z5e(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 Fte(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 F5e(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?z5e(n):ID(n);const l=e.ordered?o==="."?")":".":B5e(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.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&&(c=!0),Fte(n)===o&&d){let f=-1;for(;++f<e.children.length;){const m=e.children[f];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function q5e(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 H5e(e,t,n,r){const s=q5e(n);let i=n.bulletCurrent||ID(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,m,p){return m?(p?"":" ".repeat(o))+f:(p?i:i+" ".repeat(o-i.length))+f}}function U5e(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const W5e=k_(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function V5e(e,t,n,r){return(e.children.some(function(o){return W5e(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function G5e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}qte.peek=K5e;function qte(e,t,n,r){const s=G5e(n),i=n.enter("strong"),o=n.createTracker(r),l=o.move(s+s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),d=_T(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=wk(u)+c.slice(1));const f=c.charCodeAt(c.length-1),m=_T(r.after.charCodeAt(0),f,s);m.inside&&(c=c.slice(0,-1)+wk(f));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+c+p}function K5e(e,t,n){return n.options.strong||"*"}function Y5e(e,t,n,r){return n.safe(e.value,r)}function X5e(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 Q5e(e,t,n){const r=(Fte(n)+(n.options.ruleSpaces?" ":"")).repeat(X5e(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Hte={blockquote:x5e,break:Xq,code:T5e,definition:A5e,emphasis:Rte,hardBreak:Xq,heading:M5e,html:Dte,image:Lte,imageReference:Pte,inlineCode:Ote,link:Bte,linkReference:zte,list:F5e,listItem:H5e,paragraph:U5e,root:V5e,strong:qte,text:Y5e,thematicBreak:Q5e};function J5e(){return{enter:{table:Z5e,tableData:Qq,tableHeader:Qq,tableRow:t6e},exit:{codeText:n6e,table:e6e,tableData:pA,tableHeader:pA,tableRow:pA}}}function Z5e(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 e6e(e){this.exit(e),this.data.inTable=void 0}function t6e(e){this.enter({type:"tableRow",children:[]},e)}function pA(e){this.exit(e)}function Qq(e){this.enter({type:"tableCell",children:[]},e)}function n6e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,r6e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function r6e(e,t){return t==="|"?t:e}function s6e(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:o,tableCell:c,tableRow:l}};function o(p,g,b,w){return u(d(p,b,w),p.align)}function l(p,g,b,w){const y=f(p,b,w),v=u([y]);return v.slice(0,v.indexOf(`
`))}function c(p,g,b,w){const y=b.enter("tableCell"),v=b.enter("phrasing"),x=b.containerPhrasing(p,{...w,before:i,after:i});return v(),y(),x}function u(p,g){return y5e(p,{align:g,alignDelimiters:r,padding:n,stringLength:s})}function d(p,g,b){const w=p.children;let y=-1;const v=[],x=g.enter("table");for(;++y<w.length;)v[y]=f(w[y],g,b);return x(),v}function f(p,g,b){const w=p.children;let y=-1;const v=[],x=g.enter("tableRow");for(;++y<w.length;)v[y]=c(w[y],p,g,b);return x(),v}function m(p,g,b){let w=Hte.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function i6e(){return{exit:{taskListCheckValueChecked:Jq,taskListCheckValueUnchecked:Jq,paragraph:a6e}}}function o6e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:l6e}}}function Jq(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function a6e(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 i=-1,o;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){o=l;break}}o===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 l6e(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(o);let c=Hte.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function c6e(){return[F3e(),l5e(),h5e(),J5e(),i6e()]}function u6e(e){return{extensions:[q3e(),c5e(e),f5e(),s6e(e),o6e()]}}const d6e={tokenize:b6e,partial:!0},Ute={tokenize:y6e,partial:!0},Wte={tokenize:v6e,partial:!0},Vte={tokenize:w6e,partial:!0},h6e={tokenize:x6e,partial:!0},Gte={name:"wwwAutolink",tokenize:p6e,previous:Yte},Kte={name:"protocolAutolink",tokenize:g6e,previous:Xte},sm={name:"emailAutolink",tokenize:m6e,previous:Qte},Ih={};function f6e(){return{text:Ih}}let q0=48;for(;q0<123;)Ih[q0]=sm,q0++,q0===58?q0=65:q0===91&&(q0=97);Ih[43]=sm;Ih[45]=sm;Ih[46]=sm;Ih[95]=sm;Ih[72]=[sm,Kte];Ih[104]=[sm,Kte];Ih[87]=[sm,Gte];Ih[119]=[sm,Gte];function m6e(e,t,n){const r=this;let s,i;return o;function o(f){return!sI(f)||!Qte.call(r,r.previous)||MD(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return sI(f)?(e.consume(f),l):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(h6e,d,u)(f):f===45||f===95||kl(f)?(i=!0,e.consume(f),c):d(f)}function u(f){return e.consume(f),s=!0,c}function d(f){return i&&s&&Hl(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function p6e(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!Yte.call(r,r.previous)||MD(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(d6e,e.attempt(Ute,e.attempt(Wte,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function g6e(e,t,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&Xte.call(r,r.previous)&&!MD(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(Hl(f)&&s.length<5)return s+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const m=s.toLowerCase();if(m==="http"||m==="https")return e.consume(f),c}return n(f)}function c(f){return f===47?(e.consume(f),i?u:(i=!0,c)):n(f)}function u(f){return f===null||yT(f)||ki(f)||Bg(f)||p5(f)?n(f):e.attempt(Ute,e.attempt(Wte,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function b6e(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function y6e(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(Vte,c,l)(u):u===null||ki(u)||Bg(u)||u!==45&&p5(u)?c(u):(i=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function c(u){return s||r||!i?n(u):t(u)}}function v6e(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Vte,t,i)(o):o===null||ki(o)||Bg(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function w6e(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),s):l===60||l===null||ki(l)||Bg(l)?t(l):n(l)}function s(l){return l===null||l===40||l===91||ki(l)||Bg(l)?t(l):r(l)}function i(l){return Hl(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):Hl(l)?(e.consume(l),o):n(l)}}function x6e(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return kl(i)?n(i):t(i)}}function Yte(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ki(e)}function Xte(e){return!Hl(e)}function Qte(e){return!(e===47||sI(e))}function sI(e){return e===43||e===45||e===46||e===95||kl(e)}function MD(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 k6e={tokenize:N6e,partial:!0};function _6e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:E6e,continuation:{tokenize:A6e},exit:j6e}},text:{91:{name:"gfmFootnoteCall",tokenize:T6e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:S6e,resolveTo:C6e}}}}function S6e(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=hd(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function C6e(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 i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function T6e(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!o||f===null||f===91||ki(f))return n(f);if(f===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return s.includes(hd(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ki(f)||(o=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function E6e(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!l||g===null||g===91||ki(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=hd(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return ki(g)||(l=!0),o++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function m(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),s.includes(i)||s.push(i),Xr(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function A6e(e,t,n){return e.check(x_,t,e.attempt(k6e,t,n))}function j6e(e){e.exit("gfmFootnoteDefinition")}function N6e(e,t,n){const r=this;return Xr(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function I6e(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},f={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},m=[["enter",d,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",f,l]],p=l.parser.constructs.insideSpan.null;p&&Yc(m,m.length,0,g5(p,o.slice(u+1,c),l)),Yc(m,m.length,0,[["exit",f,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",d,l]]),Yc(o,u-1,c-u+3,m),c=u+m.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const u=this.previous,d=this.events;let f=0;return m;function m(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const b=Cy(u);if(g===126)return f>1?c(g):(o.consume(g),f++,p);if(f<2&&!n)return c(g);const w=o.exit("strikethroughSequenceTemporary"),y=Cy(g);return w._open=!y||y===2&&!!b,w._close=!b||b===2&&!!y,l(g)}}}class M6e{constructor(){this.map=[]}add(t,n,r){R6e(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[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 i of s)t.push(i);s=r.pop()}this.map.length=0}}function R6e(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 D6e(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 i=r.length-1;r[i]=r[i]==="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 L6e(){return{flow:{null:{name:"table",tokenize:P6e,resolveAll:O6e}}}}function P6e(e,t,n){const r=this;let s=0,i=0,o;return l;function l(E){let L=r.events.length-1;for(;L>-1;){const R=r.events[L][1].type;if(R==="lineEnding"||R==="linePrefix")L--;else break}const D=L>-1?r.events[L][1].type:null,M=D==="tableHead"||D==="tableRow"?T:c;return M===T&&r.parser.lazy[r.now().line]?n(E):M(E)}function c(E){return e.enter("tableHead"),e.enter("tableRow"),u(E)}function u(E){return E===124||(o=!0,i+=1),d(E)}function d(E){return E===null?n(E):Jn(E)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):n(E):is(E)?Xr(e,d,"whitespace")(E):(i+=1,o&&(o=!1,s+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),f(E)))}function f(E){return E===null||E===124||ki(E)?(e.exit("data"),d(E)):(e.consume(E),E===92?m:f)}function m(E){return E===92||E===124?(e.consume(E),f):f(E)}function p(E){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(E):(e.enter("tableDelimiterRow"),o=!1,is(E)?Xr(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):g(E))}function g(E){return E===45||E===58?w(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),b):S(E)}function b(E){return is(E)?Xr(e,w,"whitespace")(E):w(E)}function w(E){return E===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),y):E===45?(i+=1,y(E)):E===null||Jn(E)?k(E):S(E)}function y(E){return E===45?(e.enter("tableDelimiterFiller"),v(E)):S(E)}function v(E){return E===45?(e.consume(E),v):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(E))}function x(E){return is(E)?Xr(e,k,"whitespace")(E):k(E)}function k(E){return E===124?g(E):E===null||Jn(E)?!o||s!==i?S(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):S(E)}function S(E){return n(E)}function T(E){return e.enter("tableRow"),_(E)}function _(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),_):E===null||Jn(E)?(e.exit("tableRow"),t(E)):is(E)?Xr(e,_,"whitespace")(E):(e.enter("data"),C(E))}function C(E){return E===null||E===124||ki(E)?(e.exit("data"),_(E)):(e.consume(E),E===92?j:C)}function j(E){return E===92||E===124?(e.consume(E),C):C(E)}}function O6e(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,d,f;const m=new M6e;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(Zq(m,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",d,t]])),s=g.type==="tableDelimiterRow"?2:d?3:1):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],f=m2(m,t,i,s,void 0,f),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],f=m2(m,t,i,s,void 0,f)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],f=m2(m,t,i,s,n,f)):o[1]!==0&&(f=m2(m,t,o,s,n,f)),s=0):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&Zq(m,t,c,u,d),m.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=D6e(t.events,n))}return e}function m2(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},gb(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=gb(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=gb(t.events,n[2]),d=gb(t.events,n[3]),f={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const m=t.events[n[2]],p=t.events[n[3]];if(m[1].end=Object.assign({},p[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},gb(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function Zq(e,t,n,r,s){const i=[],o=gb(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function gb(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const $6e={name:"tasklistCheck",tokenize:z6e};function B6e(){return{text:{91:$6e}}}function z6e(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return ki(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Jn(c)?t(c):is(c)?e.check({tokenize:F6e},t,n)(c):n(c)}}function F6e(e,t,n){return Xr(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function q6e(e){return Jee([f6e(),_6e(),I6e(e),L6e(),B6e()])}const H6e={};function eH(e){const t=this,n=e||H6e,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(q6e(n)),i.push(c6e()),o.push(u6e(n))}function U6e(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:o,mathTextData:l}};function e(c){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},c)}function t(){this.buffer()}function n(){const c=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(c),d.value=u;const f=d.data.hChildren[0];f.type,f.tagName,f.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function i(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function o(c){const u=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(c),d.value=u,d.data.hChildren.push({type:"text",value:u})}function l(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function W6e(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,o,l,c){const u=i.value||"",d=l.createTracker(c),f="$".repeat(Math.max(Mte(u,"$")+1,2)),m=l.enter("mathFlow");let p=d.move(f);if(i.meta){const g=l.enter("mathFlowMeta");p+=d.move(l.safe(i.meta,{after:`
`,before:p,encode:["$"],...d.current()})),g()}return p+=d.move(`
`),u&&(p+=d.move(u+`
`)),p+=d.move(f),m(),p}function r(i,o,l){let c=i.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(c);)u++;const d="$".repeat(u);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let f=-1;for(;++f<l.unsafe.length;){const m=l.unsafe[f];if(!m.atBreak)continue;const p=l.compilePattern(m);let g;for(;g=p.exec(c);){let b=g.index;c.codePointAt(b)===10&&c.codePointAt(b-1)===13&&b--,c=c.slice(0,b)+" "+c.slice(g.index+1)}}return d+c+d}function s(){return"$"}}const V6e={tokenize:G6e,concrete:!0,name:"mathFlow"},tH={tokenize:K6e,partial:!0};function G6e(e,t,n){const r=this,s=r.events[r.events.length-1],i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0;let o=0;return l;function l(v){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),c(v)}function c(v){return v===36?(e.consume(v),o++,c):o<2?n(v):(e.exit("mathFlowFenceSequence"),Xr(e,u,"whitespace")(v))}function u(v){return v===null||Jn(v)?f(v):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||Jn(v)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),f(v)):v===36?n(v):(e.consume(v),d)}function f(v){return e.exit("mathFlowFence"),r.interrupt?t(v):e.attempt(tH,m,w)(v)}function m(v){return e.attempt({tokenize:y,partial:!0},w,p)(v)}function p(v){return(i?Xr(e,g,"linePrefix",i+1):g)(v)}function g(v){return v===null?w(v):Jn(v)?e.attempt(tH,m,w)(v):(e.enter("mathFlowValue"),b(v))}function b(v){return v===null||Jn(v)?(e.exit("mathFlowValue"),g(v)):(e.consume(v),b)}function w(v){return e.exit("mathFlow"),t(v)}function y(v,x,k){let S=0;return Xr(v,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function T(j){return v.enter("mathFlowFence"),v.enter("mathFlowFenceSequence"),_(j)}function _(j){return j===36?(S++,v.consume(j),_):S<o?k(j):(v.exit("mathFlowFenceSequence"),Xr(v,C,"whitespace")(j))}function C(j){return j===null||Jn(j)?(v.exit("mathFlowFence"),x(j)):k(j)}}}function K6e(e,t,n){const r=this;return s;function s(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Y6e(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:X6e,previous:Q6e,name:"mathText"};function r(s,i,o){let l=0,c,u;return d;function d(b){return s.enter("mathText"),s.enter("mathTextSequence"),f(b)}function f(b){return b===36?(s.consume(b),l++,f):l<2&&!n?o(b):(s.exit("mathTextSequence"),m(b))}function m(b){return b===null?o(b):b===36?(u=s.enter("mathTextSequence"),c=0,g(b)):b===32?(s.enter("space"),s.consume(b),s.exit("space"),m):Jn(b)?(s.enter("lineEnding"),s.consume(b),s.exit("lineEnding"),m):(s.enter("mathTextData"),p(b))}function p(b){return b===null||b===32||b===36||Jn(b)?(s.exit("mathTextData"),m(b)):(s.consume(b),p)}function g(b){return b===36?(s.consume(b),c++,g):c===l?(s.exit("mathTextSequence"),s.exit("mathText"),i(b)):(u.type="mathTextData",p(b))}}}function X6e(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==="mathTextData"){e[t][1].type="mathTextPadding",e[n][1].type="mathTextPadding",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="mathTextData",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 Q6e(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function J6e(e){return{flow:{36:V6e},text:{36:Y6e(e)}}}class qt extends Error{constructor(t,n){var r="KaTeX parse error: "+t,s,i,o=n&&n.loc;if(o&&o.start<=o.end){var l=o.lexer.input;s=o.start,i=o.end,s===l.length?r+=" at end of input: ":r+=" at position "+(s+1)+": ";var c=l.slice(s,i).replace(/[^]/g,"$&̲"),u;s>15?u="…"+l.slice(s-15,s):u=l.slice(0,s);var d;i+15<l.length?d=l.slice(i,i+15)+"…":d=l.slice(i),r+=u+c+d}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,qt.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=t}}var Z6e=/([A-Z])/g,e8e=e=>e.replace(Z6e,"-$1").toLowerCase(),t8e={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},n8e=/[&><"']/g,_l=e=>String(e).replace(n8e,t=>t8e[t]),r4=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?r4(e.body[0]):e:e.type==="font"?r4(e.body):e,r8e=new Set(["mathord","textord","atom"]),im=e=>r8e.has(r4(e).type),s8e=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},ST={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function i8e(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function o8e(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return i8e(t)}function a8e(e,t,n,r){var s=n[t];e[t]=s!==void 0?r.processor?r.processor(s):s:o8e(r)}class RD{constructor(t){t===void 0&&(t={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var n of Object.keys(ST)){var r=ST[n];r&&a8e(this,n,t,r)}}reportNonstrict(t,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(t,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new qt("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,r){var s=this.strict;if(typeof s=="function")try{s=s(t,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=s8e(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}let Em=class{constructor(t,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=r}sup(){return th[l8e[this.id]]}sub(){return th[c8e[this.id]]}fracNum(){return th[u8e[this.id]]}fracDen(){return th[d8e[this.id]]}cramp(){return th[h8e[this.id]]}text(){return th[f8e[this.id]]}isTight(){return this.size>=2}};var DD=0,CT=1,Zb=2,Nf=3,xk=4,Au=5,Ty=6,Yl=7,th=[new Em(DD,0,!1),new Em(CT,0,!0),new Em(Zb,1,!1),new Em(Nf,1,!0),new Em(xk,2,!1),new Em(Au,2,!0),new Em(Ty,3,!1),new Em(Yl,3,!0)],l8e=[xk,Au,xk,Au,Ty,Yl,Ty,Yl],c8e=[Au,Au,Au,Au,Yl,Yl,Yl,Yl],u8e=[Zb,Nf,xk,Au,Ty,Yl,Ty,Yl],d8e=[Nf,Nf,Au,Au,Yl,Yl,Yl,Yl],h8e=[CT,CT,Nf,Nf,Au,Au,Yl,Yl],f8e=[DD,CT,Zb,Nf,Zb,Nf,Zb,Nf],Cr={DISPLAY:th[DD],TEXT:th[Zb],SCRIPT:th[xk],SCRIPTSCRIPT:th[Ty]},iI=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function m8e(e){for(var t=0;t<iI.length;t++)for(var n=iI[t],r=0;r<n.blocks.length;r++){var s=n.blocks[r];if(e>=s[0]&&e<=s[1])return n.name}return null}var s4=[];iI.forEach(e=>e.blocks.forEach(t=>s4.push(...t)));function Jte(e){for(var t=0;t<s4.length;t+=2)if(e>=s4[t]&&e<=s4[t+1])return!0;return!1}var la=e=>e+" "+e,K1=80,p8e=function(t,n){return"M95,"+(622+t+n)+`
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l`+t/2.075+" -"+t+`
c5.3,-9.3,12,-14,20,-14
H400000v`+(40+t)+`H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M`+(834+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},g8e=function(t,n){return"M263,"+(601+t+n)+`c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l`+t/2.084+" -"+t+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+t)+`H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},b8e=function(t,n){return"M983 "+(10+t+n)+`
l`+t/3.13+" -"+t+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+`
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},y8e=function(t,n){return"M424,"+(2398+t+n)+`
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000
v`+(40+t)+`H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+n+`
h400000v`+(40+t)+"h-400000z"},v8e=function(t,n){return"M473,"+(2713+t+n)+`
c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM`+(1001+t)+" "+n+"h400000v"+(40+t)+"H1017.7z"},w8e=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},x8e=function(t,n,r){var s=r-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+`
H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},k8e=function(t,n,r){n=1e3*n;var s="";switch(t){case"sqrtMain":s=p8e(n,K1);break;case"sqrtSize1":s=g8e(n,K1);break;case"sqrtSize2":s=b8e(n,K1);break;case"sqrtSize3":s=y8e(n,K1);break;case"sqrtSize4":s=v8e(n,K1);break;case"sqrtTall":s=x8e(n,K1,r)}return s},_8e=function(t,n){switch(t){case"⎜":return la("M291 0 H417 V"+n+" H291z");case"∣":return la("M145 0 H188 V"+n+" H145z");case"∥":return la("M145 0 H188 V"+n+" H145z")+la("M367 0 H410 V"+n+" H367z");case"⎟":return la("M457 0 H583 V"+n+" H457z");case"⎢":return la("M319 0 H403 V"+n+" H319z");case"⎥":return la("M263 0 H347 V"+n+" H263z");case"⎪":return la("M384 0 H504 V"+n+" H384z");case"⏐":return la("M312 0 H355 V"+n+" H312z");case"‖":return la("M257 0 H300 V"+n+" H257z")+la("M478 0 H521 V"+n+" H478z");default:return""}},nH={doubleleftarrow:`M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
 l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
 435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:la("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:la("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:la("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:la("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:la("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:la("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:la("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:la("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
 -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
 -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},S8e=function(t,n){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 v84 h347 v-84
H403z M403 1759 V0 H319 V1759 v`+n+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z
M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z
M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z
M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+`
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function C8e(e){return"toText"in e}let mv=class{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){for(var t="",n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t}toText(){return this.children.map(t=>{if(C8e(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}};var oI={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},T8e={ex:!0,em:!0,mu:!0},Zte=function(t){return typeof t!="string"&&(t=t.unit),t in oI||t in T8e||t==="ex"},io=function(t,n){var r;if(t.unit in oI)r=oI[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,t.unit==="ex")r=s.fontMetrics().xHeight;else if(t.unit==="em")r=s.fontMetrics().quad;else throw new qt("Invalid unit: '"+t.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*r,n.maxSize)},tn=function(t){return+t.toFixed(4)+"em"},Mp=function(t){return t.filter(n=>n).join(" ")},LD=function(t){var n="";for(var r of Object.keys(t)){var s=t[r];s!==void 0&&(n+=e8e(r)+":"+s+";")}return n},ene=function(t,n,r){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},tne=function(t){var n=document.createElement(t);n.className=Mp(this.classes),Object.assign(n.style,this.style);for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var s=0;s<this.children.length;s++)n.appendChild(this.children[s].toNode());return n},E8e=/[\s"'>/=\x00-\x1f]/,nne=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+_l(Mp(this.classes))+'"');var r=LD(this.style);r&&(n+=' style="'+_l(r)+'"');for(var s of Object.keys(this.attributes)){if(E8e.test(s))throw new qt("Invalid attribute name '"+s+"'");n+=" "+s+'="'+_l(this.attributes[s])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class pv{constructor(t,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,ene.call(this,t,r,s),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return tne.call(this,"span")}toMarkup(){return nne.call(this,"span")}}let v5=class{constructor(t,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,ene.call(this,n,s),this.children=r||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return tne.call(this,"a")}toMarkup(){return nne.call(this,"a")}};class A8e{constructor(t,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t='<img src="'+_l(this.src)+'"'+(' alt="'+_l(this.alt)+'"'),n=LD(this.style);return n&&(t+=' style="'+_l(n)+'"'),t+="'/>",t}}var j8e={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class nu{constructor(t,n,r,s,i,o,l,c){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=n||0,this.depth=r||0,this.italic=s||0,this.skew=i||0,this.width=o||0,this.classes=l||[],this.style=c||{},this.maxFontSize=0;var u=m8e(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=j8e[this.text])}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createTextNode(this.text),n=null;return this.italic>0&&(n=document.createElement("span"),n.style.marginRight=tn(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Mp(this.classes)),Object.keys(this.style).length>0&&(n=n||document.createElement("span"),Object.assign(n.style,this.style)),n?(n.appendChild(t),n):t}toMarkup(){var t=!1,n="<span";this.classes.length&&(t=!0,n+=' class="',n+=_l(Mp(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+tn(this.italic)+";"),r+=LD(this.style),r&&(t=!0,n+=' style="'+_l(r)+'"');var s=_l(this.text);return t?(n+=">",n+=s,n+="</span>",n):s}}class Vf{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var s=0;s<this.children.length;s++)n.appendChild(this.children[s].toNode());return n}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))t+=" "+n+'="'+_l(this.attributes[n])+'"';t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</svg>",t}}class Rp{constructor(t,n){this.pathName=void 0,this.alternate=void 0,this.pathName=t,this.alternate=n}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",nH[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+_l(this.alternate)+'"/>':'<path d="'+_l(nH[this.pathName])+'"/>'}}class aI{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var t="<line";for(var n of Object.keys(this.attributes))t+=" "+n+'="'+_l(this.attributes[n])+'"';return t+="/>",t}}function N8e(e){if(e instanceof nu)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function I8e(e){if(e instanceof pv)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var M8e=e=>e instanceof pv||e instanceof v5||e instanceof mv,dh={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},p2={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},rH={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function rne(e,t){dh[e]=t}function PD(e,t,n){if(!dh[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),s=dh[t][r];if(!s&&e[0]in rH&&(r=rH[e[0]].charCodeAt(0),s=dh[t][r]),!s&&n==="text"&&Jte(r)&&(s=dh[t][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var gA={};function R8e(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!gA[t]){var n=gA[t]={cssEmPerMu:p2.quad[t]/18};for(var r in p2)p2.hasOwnProperty(r)&&(n[r]=p2[r][t])}return gA[t]}var Hi={math:{},text:{}};function O(e,t,n,r,s,i){Hi[e][s]={font:t,group:n,replace:r},i&&r&&(Hi[e][r]=Hi[e][s])}var H="math",jt="text",J="main",ke="ams",Wi="accent-token",Ln="bin",Zl="close",gv="inner",ar="mathord",Xo="op-token",su="open",S_="punct",Se="rel",om="spacing",Ne="textord";O(H,J,Se,"≡","\\equiv",!0);O(H,J,Se,"≺","\\prec",!0);O(H,J,Se,"≻","\\succ",!0);O(H,J,Se,"∼","\\sim",!0);O(H,J,Se,"⊥","\\perp");O(H,J,Se,"⪯","\\preceq",!0);O(H,J,Se,"⪰","\\succeq",!0);O(H,J,Se,"≃","\\simeq",!0);O(H,J,Se,"∣","\\mid",!0);O(H,J,Se,"≪","\\ll",!0);O(H,J,Se,"≫","\\gg",!0);O(H,J,Se,"≍","\\asymp",!0);O(H,J,Se,"∥","\\parallel");O(H,J,Se,"⋈","\\bowtie",!0);O(H,J,Se,"⌣","\\smile",!0);O(H,J,Se,"⊑","\\sqsubseteq",!0);O(H,J,Se,"⊒","\\sqsupseteq",!0);O(H,J,Se,"≐","\\doteq",!0);O(H,J,Se,"⌢","\\frown",!0);O(H,J,Se,"∋","\\ni",!0);O(H,J,Se,"∝","\\propto",!0);O(H,J,Se,"⊢","\\vdash",!0);O(H,J,Se,"⊣","\\dashv",!0);O(H,J,Se,"∋","\\owns");O(H,J,S_,".","\\ldotp");O(H,J,S_,"⋅","\\cdotp");O(H,J,S_,"⋅","·");O(jt,J,Ne,"⋅","·");O(H,J,Ne,"#","\\#");O(jt,J,Ne,"#","\\#");O(H,J,Ne,"&","\\&");O(jt,J,Ne,"&","\\&");O(H,J,Ne,"ℵ","\\aleph",!0);O(H,J,Ne,"∀","\\forall",!0);O(H,J,Ne,"ℏ","\\hbar",!0);O(H,J,Ne,"∃","\\exists",!0);O(H,J,Ne,"∇","\\nabla",!0);O(H,J,Ne,"♭","\\flat",!0);O(H,J,Ne,"ℓ","\\ell",!0);O(H,J,Ne,"♮","\\natural",!0);O(H,J,Ne,"♣","\\clubsuit",!0);O(H,J,Ne,"℘","\\wp",!0);O(H,J,Ne,"♯","\\sharp",!0);O(H,J,Ne,"♢","\\diamondsuit",!0);O(H,J,Ne,"ℜ","\\Re",!0);O(H,J,Ne,"♡","\\heartsuit",!0);O(H,J,Ne,"ℑ","\\Im",!0);O(H,J,Ne,"♠","\\spadesuit",!0);O(H,J,Ne,"§","\\S",!0);O(jt,J,Ne,"§","\\S");O(H,J,Ne,"¶","\\P",!0);O(jt,J,Ne,"¶","\\P");O(H,J,Ne,"†","\\dag");O(jt,J,Ne,"†","\\dag");O(jt,J,Ne,"†","\\textdagger");O(H,J,Ne,"‡","\\ddag");O(jt,J,Ne,"‡","\\ddag");O(jt,J,Ne,"‡","\\textdaggerdbl");O(H,J,Zl,"⎱","\\rmoustache",!0);O(H,J,su,"⎰","\\lmoustache",!0);O(H,J,Zl,"⟯","\\rgroup",!0);O(H,J,su,"⟮","\\lgroup",!0);O(H,J,Ln,"∓","\\mp",!0);O(H,J,Ln,"⊖","\\ominus",!0);O(H,J,Ln,"⊎","\\uplus",!0);O(H,J,Ln,"⊓","\\sqcap",!0);O(H,J,Ln,"∗","\\ast");O(H,J,Ln,"⊔","\\sqcup",!0);O(H,J,Ln,"◯","\\bigcirc",!0);O(H,J,Ln,"∙","\\bullet",!0);O(H,J,Ln,"‡","\\ddagger");O(H,J,Ln,"≀","\\wr",!0);O(H,J,Ln,"⨿","\\amalg");O(H,J,Ln,"&","\\And");O(H,J,Se,"⟵","\\longleftarrow",!0);O(H,J,Se,"⇐","\\Leftarrow",!0);O(H,J,Se,"⟸","\\Longleftarrow",!0);O(H,J,Se,"⟶","\\longrightarrow",!0);O(H,J,Se,"⇒","\\Rightarrow",!0);O(H,J,Se,"⟹","\\Longrightarrow",!0);O(H,J,Se,"↔","\\leftrightarrow",!0);O(H,J,Se,"⟷","\\longleftrightarrow",!0);O(H,J,Se,"⇔","\\Leftrightarrow",!0);O(H,J,Se,"⟺","\\Longleftrightarrow",!0);O(H,J,Se,"↦","\\mapsto",!0);O(H,J,Se,"⟼","\\longmapsto",!0);O(H,J,Se,"↗","\\nearrow",!0);O(H,J,Se,"↩","\\hookleftarrow",!0);O(H,J,Se,"↪","\\hookrightarrow",!0);O(H,J,Se,"↘","\\searrow",!0);O(H,J,Se,"↼","\\leftharpoonup",!0);O(H,J,Se,"⇀","\\rightharpoonup",!0);O(H,J,Se,"↙","\\swarrow",!0);O(H,J,Se,"↽","\\leftharpoondown",!0);O(H,J,Se,"⇁","\\rightharpoondown",!0);O(H,J,Se,"↖","\\nwarrow",!0);O(H,J,Se,"⇌","\\rightleftharpoons",!0);O(H,ke,Se,"≮","\\nless",!0);O(H,ke,Se,"","\\@nleqslant");O(H,ke,Se,"","\\@nleqq");O(H,ke,Se,"⪇","\\lneq",!0);O(H,ke,Se,"≨","\\lneqq",!0);O(H,ke,Se,"","\\@lvertneqq");O(H,ke,Se,"⋦","\\lnsim",!0);O(H,ke,Se,"⪉","\\lnapprox",!0);O(H,ke,Se,"⊀","\\nprec",!0);O(H,ke,Se,"⋠","\\npreceq",!0);O(H,ke,Se,"⋨","\\precnsim",!0);O(H,ke,Se,"⪹","\\precnapprox",!0);O(H,ke,Se,"≁","\\nsim",!0);O(H,ke,Se,"","\\@nshortmid");O(H,ke,Se,"∤","\\nmid",!0);O(H,ke,Se,"⊬","\\nvdash",!0);O(H,ke,Se,"⊭","\\nvDash",!0);O(H,ke,Se,"⋪","\\ntriangleleft");O(H,ke,Se,"⋬","\\ntrianglelefteq",!0);O(H,ke,Se,"⊊","\\subsetneq",!0);O(H,ke,Se,"","\\@varsubsetneq");O(H,ke,Se,"⫋","\\subsetneqq",!0);O(H,ke,Se,"","\\@varsubsetneqq");O(H,ke,Se,"≯","\\ngtr",!0);O(H,ke,Se,"","\\@ngeqslant");O(H,ke,Se,"","\\@ngeqq");O(H,ke,Se,"⪈","\\gneq",!0);O(H,ke,Se,"≩","\\gneqq",!0);O(H,ke,Se,"","\\@gvertneqq");O(H,ke,Se,"⋧","\\gnsim",!0);O(H,ke,Se,"⪊","\\gnapprox",!0);O(H,ke,Se,"⊁","\\nsucc",!0);O(H,ke,Se,"⋡","\\nsucceq",!0);O(H,ke,Se,"⋩","\\succnsim",!0);O(H,ke,Se,"⪺","\\succnapprox",!0);O(H,ke,Se,"≆","\\ncong",!0);O(H,ke,Se,"","\\@nshortparallel");O(H,ke,Se,"∦","\\nparallel",!0);O(H,ke,Se,"⊯","\\nVDash",!0);O(H,ke,Se,"⋫","\\ntriangleright");O(H,ke,Se,"⋭","\\ntrianglerighteq",!0);O(H,ke,Se,"","\\@nsupseteqq");O(H,ke,Se,"⊋","\\supsetneq",!0);O(H,ke,Se,"","\\@varsupsetneq");O(H,ke,Se,"⫌","\\supsetneqq",!0);O(H,ke,Se,"","\\@varsupsetneqq");O(H,ke,Se,"⊮","\\nVdash",!0);O(H,ke,Se,"⪵","\\precneqq",!0);O(H,ke,Se,"⪶","\\succneqq",!0);O(H,ke,Se,"","\\@nsubseteqq");O(H,ke,Ln,"⊴","\\unlhd");O(H,ke,Ln,"⊵","\\unrhd");O(H,ke,Se,"↚","\\nleftarrow",!0);O(H,ke,Se,"↛","\\nrightarrow",!0);O(H,ke,Se,"⇍","\\nLeftarrow",!0);O(H,ke,Se,"⇏","\\nRightarrow",!0);O(H,ke,Se,"↮","\\nleftrightarrow",!0);O(H,ke,Se,"⇎","\\nLeftrightarrow",!0);O(H,ke,Se,"△","\\vartriangle");O(H,ke,Ne,"ℏ","\\hslash");O(H,ke,Ne,"▽","\\triangledown");O(H,ke,Ne,"◊","\\lozenge");O(H,ke,Ne,"Ⓢ","\\circledS");O(H,ke,Ne,"®","\\circledR");O(jt,ke,Ne,"®","\\circledR");O(H,ke,Ne,"∡","\\measuredangle",!0);O(H,ke,Ne,"∄","\\nexists");O(H,ke,Ne,"℧","\\mho");O(H,ke,Ne,"Ⅎ","\\Finv",!0);O(H,ke,Ne,"⅁","\\Game",!0);O(H,ke,Ne,"‵","\\backprime");O(H,ke,Ne,"▲","\\blacktriangle");O(H,ke,Ne,"▼","\\blacktriangledown");O(H,ke,Ne,"■","\\blacksquare");O(H,ke,Ne,"⧫","\\blacklozenge");O(H,ke,Ne,"★","\\bigstar");O(H,ke,Ne,"∢","\\sphericalangle",!0);O(H,ke,Ne,"∁","\\complement",!0);O(H,ke,Ne,"ð","\\eth",!0);O(jt,J,Ne,"ð","ð");O(H,ke,Ne,"╱","\\diagup");O(H,ke,Ne,"╲","\\diagdown");O(H,ke,Ne,"□","\\square");O(H,ke,Ne,"□","\\Box");O(H,ke,Ne,"◊","\\Diamond");O(H,ke,Ne,"¥","\\yen",!0);O(jt,ke,Ne,"¥","\\yen",!0);O(H,ke,Ne,"✓","\\checkmark",!0);O(jt,ke,Ne,"✓","\\checkmark");O(H,ke,Ne,"ℶ","\\beth",!0);O(H,ke,Ne,"ℸ","\\daleth",!0);O(H,ke,Ne,"ℷ","\\gimel",!0);O(H,ke,Ne,"ϝ","\\digamma",!0);O(H,ke,Ne,"ϰ","\\varkappa");O(H,ke,su,"┌","\\@ulcorner",!0);O(H,ke,Zl,"┐","\\@urcorner",!0);O(H,ke,su,"└","\\@llcorner",!0);O(H,ke,Zl,"┘","\\@lrcorner",!0);O(H,ke,Se,"≦","\\leqq",!0);O(H,ke,Se,"⩽","\\leqslant",!0);O(H,ke,Se,"⪕","\\eqslantless",!0);O(H,ke,Se,"≲","\\lesssim",!0);O(H,ke,Se,"⪅","\\lessapprox",!0);O(H,ke,Se,"≊","\\approxeq",!0);O(H,ke,Ln,"⋖","\\lessdot");O(H,ke,Se,"⋘","\\lll",!0);O(H,ke,Se,"≶","\\lessgtr",!0);O(H,ke,Se,"⋚","\\lesseqgtr",!0);O(H,ke,Se,"⪋","\\lesseqqgtr",!0);O(H,ke,Se,"≑","\\doteqdot");O(H,ke,Se,"≓","\\risingdotseq",!0);O(H,ke,Se,"≒","\\fallingdotseq",!0);O(H,ke,Se,"∽","\\backsim",!0);O(H,ke,Se,"⋍","\\backsimeq",!0);O(H,ke,Se,"⫅","\\subseteqq",!0);O(H,ke,Se,"⋐","\\Subset",!0);O(H,ke,Se,"⊏","\\sqsubset",!0);O(H,ke,Se,"≼","\\preccurlyeq",!0);O(H,ke,Se,"⋞","\\curlyeqprec",!0);O(H,ke,Se,"≾","\\precsim",!0);O(H,ke,Se,"⪷","\\precapprox",!0);O(H,ke,Se,"⊲","\\vartriangleleft");O(H,ke,Se,"⊴","\\trianglelefteq");O(H,ke,Se,"⊨","\\vDash",!0);O(H,ke,Se,"⊪","\\Vvdash",!0);O(H,ke,Se,"⌣","\\smallsmile");O(H,ke,Se,"⌢","\\smallfrown");O(H,ke,Se,"≏","\\bumpeq",!0);O(H,ke,Se,"≎","\\Bumpeq",!0);O(H,ke,Se,"≧","\\geqq",!0);O(H,ke,Se,"⩾","\\geqslant",!0);O(H,ke,Se,"⪖","\\eqslantgtr",!0);O(H,ke,Se,"≳","\\gtrsim",!0);O(H,ke,Se,"⪆","\\gtrapprox",!0);O(H,ke,Ln,"⋗","\\gtrdot");O(H,ke,Se,"⋙","\\ggg",!0);O(H,ke,Se,"≷","\\gtrless",!0);O(H,ke,Se,"⋛","\\gtreqless",!0);O(H,ke,Se,"⪌","\\gtreqqless",!0);O(H,ke,Se,"≖","\\eqcirc",!0);O(H,ke,Se,"≗","\\circeq",!0);O(H,ke,Se,"≜","\\triangleq",!0);O(H,ke,Se,"∼","\\thicksim");O(H,ke,Se,"≈","\\thickapprox");O(H,ke,Se,"⫆","\\supseteqq",!0);O(H,ke,Se,"⋑","\\Supset",!0);O(H,ke,Se,"⊐","\\sqsupset",!0);O(H,ke,Se,"≽","\\succcurlyeq",!0);O(H,ke,Se,"⋟","\\curlyeqsucc",!0);O(H,ke,Se,"≿","\\succsim",!0);O(H,ke,Se,"⪸","\\succapprox",!0);O(H,ke,Se,"⊳","\\vartriangleright");O(H,ke,Se,"⊵","\\trianglerighteq");O(H,ke,Se,"⊩","\\Vdash",!0);O(H,ke,Se,"∣","\\shortmid");O(H,ke,Se,"∥","\\shortparallel");O(H,ke,Se,"≬","\\between",!0);O(H,ke,Se,"⋔","\\pitchfork",!0);O(H,ke,Se,"∝","\\varpropto");O(H,ke,Se,"◀","\\blacktriangleleft");O(H,ke,Se,"∴","\\therefore",!0);O(H,ke,Se,"∍","\\backepsilon");O(H,ke,Se,"▶","\\blacktriangleright");O(H,ke,Se,"∵","\\because",!0);O(H,ke,Se,"⋘","\\llless");O(H,ke,Se,"⋙","\\gggtr");O(H,ke,Ln,"⊲","\\lhd");O(H,ke,Ln,"⊳","\\rhd");O(H,ke,Se,"≂","\\eqsim",!0);O(H,J,Se,"⋈","\\Join");O(H,ke,Se,"≑","\\Doteq",!0);O(H,ke,Ln,"∔","\\dotplus",!0);O(H,ke,Ln,"∖","\\smallsetminus");O(H,ke,Ln,"⋒","\\Cap",!0);O(H,ke,Ln,"⋓","\\Cup",!0);O(H,ke,Ln,"⩞","\\doublebarwedge",!0);O(H,ke,Ln,"⊟","\\boxminus",!0);O(H,ke,Ln,"⊞","\\boxplus",!0);O(H,ke,Ln,"⋇","\\divideontimes",!0);O(H,ke,Ln,"⋉","\\ltimes",!0);O(H,ke,Ln,"⋊","\\rtimes",!0);O(H,ke,Ln,"⋋","\\leftthreetimes",!0);O(H,ke,Ln,"⋌","\\rightthreetimes",!0);O(H,ke,Ln,"⋏","\\curlywedge",!0);O(H,ke,Ln,"⋎","\\curlyvee",!0);O(H,ke,Ln,"⊝","\\circleddash",!0);O(H,ke,Ln,"⊛","\\circledast",!0);O(H,ke,Ln,"⋅","\\centerdot");O(H,ke,Ln,"⊺","\\intercal",!0);O(H,ke,Ln,"⋒","\\doublecap");O(H,ke,Ln,"⋓","\\doublecup");O(H,ke,Ln,"⊠","\\boxtimes",!0);O(H,ke,Se,"⇢","\\dashrightarrow",!0);O(H,ke,Se,"⇠","\\dashleftarrow",!0);O(H,ke,Se,"⇇","\\leftleftarrows",!0);O(H,ke,Se,"⇆","\\leftrightarrows",!0);O(H,ke,Se,"⇚","\\Lleftarrow",!0);O(H,ke,Se,"↞","\\twoheadleftarrow",!0);O(H,ke,Se,"↢","\\leftarrowtail",!0);O(H,ke,Se,"↫","\\looparrowleft",!0);O(H,ke,Se,"⇋","\\leftrightharpoons",!0);O(H,ke,Se,"↶","\\curvearrowleft",!0);O(H,ke,Se,"↺","\\circlearrowleft",!0);O(H,ke,Se,"↰","\\Lsh",!0);O(H,ke,Se,"⇈","\\upuparrows",!0);O(H,ke,Se,"↿","\\upharpoonleft",!0);O(H,ke,Se,"⇃","\\downharpoonleft",!0);O(H,J,Se,"⊶","\\origof",!0);O(H,J,Se,"⊷","\\imageof",!0);O(H,ke,Se,"⊸","\\multimap",!0);O(H,ke,Se,"↭","\\leftrightsquigarrow",!0);O(H,ke,Se,"⇉","\\rightrightarrows",!0);O(H,ke,Se,"⇄","\\rightleftarrows",!0);O(H,ke,Se,"↠","\\twoheadrightarrow",!0);O(H,ke,Se,"↣","\\rightarrowtail",!0);O(H,ke,Se,"↬","\\looparrowright",!0);O(H,ke,Se,"↷","\\curvearrowright",!0);O(H,ke,Se,"↻","\\circlearrowright",!0);O(H,ke,Se,"↱","\\Rsh",!0);O(H,ke,Se,"⇊","\\downdownarrows",!0);O(H,ke,Se,"↾","\\upharpoonright",!0);O(H,ke,Se,"⇂","\\downharpoonright",!0);O(H,ke,Se,"⇝","\\rightsquigarrow",!0);O(H,ke,Se,"⇝","\\leadsto");O(H,ke,Se,"⇛","\\Rrightarrow",!0);O(H,ke,Se,"↾","\\restriction");O(H,J,Ne,"‘","`");O(H,J,Ne,"$","\\$");O(jt,J,Ne,"$","\\$");O(jt,J,Ne,"$","\\textdollar");O(H,J,Ne,"%","\\%");O(jt,J,Ne,"%","\\%");O(H,J,Ne,"_","\\_");O(jt,J,Ne,"_","\\_");O(jt,J,Ne,"_","\\textunderscore");O(H,J,Ne,"∠","\\angle",!0);O(H,J,Ne,"∞","\\infty",!0);O(H,J,Ne,"′","\\prime");O(H,J,Ne,"△","\\triangle");O(H,J,Ne,"Γ","\\Gamma",!0);O(H,J,Ne,"Δ","\\Delta",!0);O(H,J,Ne,"Θ","\\Theta",!0);O(H,J,Ne,"Λ","\\Lambda",!0);O(H,J,Ne,"Ξ","\\Xi",!0);O(H,J,Ne,"Π","\\Pi",!0);O(H,J,Ne,"Σ","\\Sigma",!0);O(H,J,Ne,"Υ","\\Upsilon",!0);O(H,J,Ne,"Φ","\\Phi",!0);O(H,J,Ne,"Ψ","\\Psi",!0);O(H,J,Ne,"Ω","\\Omega",!0);O(H,J,Ne,"A","Α");O(H,J,Ne,"B","Β");O(H,J,Ne,"E","Ε");O(H,J,Ne,"Z","Ζ");O(H,J,Ne,"H","Η");O(H,J,Ne,"I","Ι");O(H,J,Ne,"K","Κ");O(H,J,Ne,"M","Μ");O(H,J,Ne,"N","Ν");O(H,J,Ne,"O","Ο");O(H,J,Ne,"P","Ρ");O(H,J,Ne,"T","Τ");O(H,J,Ne,"X","Χ");O(H,J,Ne,"¬","\\neg",!0);O(H,J,Ne,"¬","\\lnot");O(H,J,Ne,"⊤","\\top");O(H,J,Ne,"⊥","\\bot");O(H,J,Ne,"∅","\\emptyset");O(H,ke,Ne,"∅","\\varnothing");O(H,J,ar,"α","\\alpha",!0);O(H,J,ar,"β","\\beta",!0);O(H,J,ar,"γ","\\gamma",!0);O(H,J,ar,"δ","\\delta",!0);O(H,J,ar,"ϵ","\\epsilon",!0);O(H,J,ar,"ζ","\\zeta",!0);O(H,J,ar,"η","\\eta",!0);O(H,J,ar,"θ","\\theta",!0);O(H,J,ar,"ι","\\iota",!0);O(H,J,ar,"κ","\\kappa",!0);O(H,J,ar,"λ","\\lambda",!0);O(H,J,ar,"μ","\\mu",!0);O(H,J,ar,"ν","\\nu",!0);O(H,J,ar,"ξ","\\xi",!0);O(H,J,ar,"ο","\\omicron",!0);O(H,J,ar,"π","\\pi",!0);O(H,J,ar,"ρ","\\rho",!0);O(H,J,ar,"σ","\\sigma",!0);O(H,J,ar,"τ","\\tau",!0);O(H,J,ar,"υ","\\upsilon",!0);O(H,J,ar,"ϕ","\\phi",!0);O(H,J,ar,"χ","\\chi",!0);O(H,J,ar,"ψ","\\psi",!0);O(H,J,ar,"ω","\\omega",!0);O(H,J,ar,"ε","\\varepsilon",!0);O(H,J,ar,"ϑ","\\vartheta",!0);O(H,J,ar,"ϖ","\\varpi",!0);O(H,J,ar,"ϱ","\\varrho",!0);O(H,J,ar,"ς","\\varsigma",!0);O(H,J,ar,"φ","\\varphi",!0);O(H,J,Ln,"∗","*",!0);O(H,J,Ln,"+","+");O(H,J,Ln,"−","-",!0);O(H,J,Ln,"⋅","\\cdot",!0);O(H,J,Ln,"∘","\\circ",!0);O(H,J,Ln,"÷","\\div",!0);O(H,J,Ln,"±","\\pm",!0);O(H,J,Ln,"×","\\times",!0);O(H,J,Ln,"∩","\\cap",!0);O(H,J,Ln,"∪","\\cup",!0);O(H,J,Ln,"∖","\\setminus",!0);O(H,J,Ln,"∧","\\land");O(H,J,Ln,"∨","\\lor");O(H,J,Ln,"∧","\\wedge",!0);O(H,J,Ln,"∨","\\vee",!0);O(H,J,Ne,"√","\\surd");O(H,J,su,"⟨","\\langle",!0);O(H,J,su,"∣","\\lvert");O(H,J,su,"∥","\\lVert");O(H,J,Zl,"?","?");O(H,J,Zl,"!","!");O(H,J,Zl,"⟩","\\rangle",!0);O(H,J,Zl,"∣","\\rvert");O(H,J,Zl,"∥","\\rVert");O(H,J,Se,"=","=");O(H,J,Se,":",":");O(H,J,Se,"≈","\\approx",!0);O(H,J,Se,"≅","\\cong",!0);O(H,J,Se,"≥","\\ge");O(H,J,Se,"≥","\\geq",!0);O(H,J,Se,"←","\\gets");O(H,J,Se,">","\\gt",!0);O(H,J,Se,"∈","\\in",!0);O(H,J,Se,"","\\@not");O(H,J,Se,"⊂","\\subset",!0);O(H,J,Se,"⊃","\\supset",!0);O(H,J,Se,"⊆","\\subseteq",!0);O(H,J,Se,"⊇","\\supseteq",!0);O(H,ke,Se,"⊈","\\nsubseteq",!0);O(H,ke,Se,"⊉","\\nsupseteq",!0);O(H,J,Se,"⊨","\\models");O(H,J,Se,"←","\\leftarrow",!0);O(H,J,Se,"≤","\\le");O(H,J,Se,"≤","\\leq",!0);O(H,J,Se,"<","\\lt",!0);O(H,J,Se,"→","\\rightarrow",!0);O(H,J,Se,"→","\\to");O(H,ke,Se,"≱","\\ngeq",!0);O(H,ke,Se,"≰","\\nleq",!0);O(H,J,om," ","\\ ");O(H,J,om," ","\\space");O(H,J,om," ","\\nobreakspace");O(jt,J,om," ","\\ ");O(jt,J,om," "," ");O(jt,J,om," ","\\space");O(jt,J,om," ","\\nobreakspace");O(H,J,om,"","\\nobreak");O(H,J,om,"","\\allowbreak");O(H,J,S_,",",",");O(H,J,S_,";",";");O(H,ke,Ln,"⊼","\\barwedge",!0);O(H,ke,Ln,"⊻","\\veebar",!0);O(H,J,Ln,"⊙","\\odot",!0);O(H,J,Ln,"⊕","\\oplus",!0);O(H,J,Ln,"⊗","\\otimes",!0);O(H,J,Ne,"∂","\\partial",!0);O(H,J,Ln,"⊘","\\oslash",!0);O(H,ke,Ln,"⊚","\\circledcirc",!0);O(H,ke,Ln,"⊡","\\boxdot",!0);O(H,J,Ln,"△","\\bigtriangleup");O(H,J,Ln,"▽","\\bigtriangledown");O(H,J,Ln,"†","\\dagger");O(H,J,Ln,"⋄","\\diamond");O(H,J,Ln,"⋆","\\star");O(H,J,Ln,"◃","\\triangleleft");O(H,J,Ln,"▹","\\triangleright");O(H,J,su,"{","\\{");O(jt,J,Ne,"{","\\{");O(jt,J,Ne,"{","\\textbraceleft");O(H,J,Zl,"}","\\}");O(jt,J,Ne,"}","\\}");O(jt,J,Ne,"}","\\textbraceright");O(H,J,su,"{","\\lbrace");O(H,J,Zl,"}","\\rbrace");O(H,J,su,"[","\\lbrack",!0);O(jt,J,Ne,"[","\\lbrack",!0);O(H,J,Zl,"]","\\rbrack",!0);O(jt,J,Ne,"]","\\rbrack",!0);O(H,J,su,"(","\\lparen",!0);O(H,J,Zl,")","\\rparen",!0);O(jt,J,Ne,"<","\\textless",!0);O(jt,J,Ne,">","\\textgreater",!0);O(H,J,su,"⌊","\\lfloor",!0);O(H,J,Zl,"⌋","\\rfloor",!0);O(H,J,su,"⌈","\\lceil",!0);O(H,J,Zl,"⌉","\\rceil",!0);O(H,J,Ne,"\\","\\backslash");O(H,J,Ne,"∣","|");O(H,J,Ne,"∣","\\vert");O(jt,J,Ne,"|","\\textbar",!0);O(H,J,Ne,"∥","\\|");O(H,J,Ne,"∥","\\Vert");O(jt,J,Ne,"∥","\\textbardbl");O(jt,J,Ne,"~","\\textasciitilde");O(jt,J,Ne,"\\","\\textbackslash");O(jt,J,Ne,"^","\\textasciicircum");O(H,J,Se,"↑","\\uparrow",!0);O(H,J,Se,"⇑","\\Uparrow",!0);O(H,J,Se,"↓","\\downarrow",!0);O(H,J,Se,"⇓","\\Downarrow",!0);O(H,J,Se,"↕","\\updownarrow",!0);O(H,J,Se,"⇕","\\Updownarrow",!0);O(H,J,Xo,"∐","\\coprod");O(H,J,Xo,"⋁","\\bigvee");O(H,J,Xo,"⋀","\\bigwedge");O(H,J,Xo,"⨄","\\biguplus");O(H,J,Xo,"⋂","\\bigcap");O(H,J,Xo,"⋃","\\bigcup");O(H,J,Xo,"∫","\\int");O(H,J,Xo,"∫","\\intop");O(H,J,Xo,"∬","\\iint");O(H,J,Xo,"∭","\\iiint");O(H,J,Xo,"∏","\\prod");O(H,J,Xo,"∑","\\sum");O(H,J,Xo,"⨂","\\bigotimes");O(H,J,Xo,"⨁","\\bigoplus");O(H,J,Xo,"⨀","\\bigodot");O(H,J,Xo,"∮","\\oint");O(H,J,Xo,"∯","\\oiint");O(H,J,Xo,"∰","\\oiiint");O(H,J,Xo,"⨆","\\bigsqcup");O(H,J,Xo,"∫","\\smallint");O(jt,J,gv,"…","\\textellipsis");O(H,J,gv,"…","\\mathellipsis");O(jt,J,gv,"…","\\ldots",!0);O(H,J,gv,"…","\\ldots",!0);O(H,J,gv,"⋯","\\@cdots",!0);O(H,J,gv,"⋱","\\ddots",!0);O(H,J,Ne,"⋮","\\varvdots");O(jt,J,Ne,"⋮","\\varvdots");O(H,J,Wi,"ˊ","\\acute");O(H,J,Wi,"ˋ","\\grave");O(H,J,Wi,"¨","\\ddot");O(H,J,Wi,"~","\\tilde");O(H,J,Wi,"ˉ","\\bar");O(H,J,Wi,"˘","\\breve");O(H,J,Wi,"ˇ","\\check");O(H,J,Wi,"^","\\hat");O(H,J,Wi,"⃗","\\vec");O(H,J,Wi,"˙","\\dot");O(H,J,Wi,"˚","\\mathring");O(H,J,ar,"","\\@imath");O(H,J,ar,"","\\@jmath");O(H,J,Ne,"ı","ı");O(H,J,Ne,"ȷ","ȷ");O(jt,J,Ne,"ı","\\i",!0);O(jt,J,Ne,"ȷ","\\j",!0);O(jt,J,Ne,"ß","\\ss",!0);O(jt,J,Ne,"æ","\\ae",!0);O(jt,J,Ne,"œ","\\oe",!0);O(jt,J,Ne,"ø","\\o",!0);O(jt,J,Ne,"Æ","\\AE",!0);O(jt,J,Ne,"Œ","\\OE",!0);O(jt,J,Ne,"Ø","\\O",!0);O(jt,J,Wi,"ˊ","\\'");O(jt,J,Wi,"ˋ","\\`");O(jt,J,Wi,"ˆ","\\^");O(jt,J,Wi,"˜","\\~");O(jt,J,Wi,"ˉ","\\=");O(jt,J,Wi,"˘","\\u");O(jt,J,Wi,"˙","\\.");O(jt,J,Wi,"¸","\\c");O(jt,J,Wi,"˚","\\r");O(jt,J,Wi,"ˇ","\\v");O(jt,J,Wi,"¨",'\\"');O(jt,J,Wi,"˝","\\H");O(jt,J,Wi,"◯","\\textcircled");var sne={"--":!0,"---":!0,"``":!0,"''":!0};O(jt,J,Ne,"–","--",!0);O(jt,J,Ne,"–","\\textendash");O(jt,J,Ne,"—","---",!0);O(jt,J,Ne,"—","\\textemdash");O(jt,J,Ne,"‘","`",!0);O(jt,J,Ne,"‘","\\textquoteleft");O(jt,J,Ne,"’","'",!0);O(jt,J,Ne,"’","\\textquoteright");O(jt,J,Ne,"“","``",!0);O(jt,J,Ne,"“","\\textquotedblleft");O(jt,J,Ne,"”","''",!0);O(jt,J,Ne,"”","\\textquotedblright");O(H,J,Ne,"°","\\degree",!0);O(jt,J,Ne,"°","\\degree");O(jt,J,Ne,"°","\\textdegree",!0);O(H,J,Ne,"£","\\pounds");O(H,J,Ne,"£","\\mathsterling",!0);O(jt,J,Ne,"£","\\pounds");O(jt,J,Ne,"£","\\textsterling",!0);O(H,ke,Ne,"✠","\\maltese");O(jt,ke,Ne,"✠","\\maltese");var sH='0123456789/@."';for(var bA=0;bA<sH.length;bA++){var iH=sH.charAt(bA);O(H,J,Ne,iH,iH)}var oH='0123456789!@*()-=+";:?/.,';for(var yA=0;yA<oH.length;yA++){var aH=oH.charAt(yA);O(jt,J,Ne,aH,aH)}var TT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var vA=0;vA<TT.length;vA++){var g2=TT.charAt(vA);O(H,J,ar,g2,g2),O(jt,J,Ne,g2,g2)}O(H,ke,Ne,"C","ℂ");O(jt,ke,Ne,"C","ℂ");O(H,ke,Ne,"H","ℍ");O(jt,ke,Ne,"H","ℍ");O(H,ke,Ne,"N","ℕ");O(jt,ke,Ne,"N","ℕ");O(H,ke,Ne,"P","ℙ");O(jt,ke,Ne,"P","ℙ");O(H,ke,Ne,"Q","ℚ");O(jt,ke,Ne,"Q","ℚ");O(H,ke,Ne,"R","ℝ");O(jt,ke,Ne,"R","ℝ");O(H,ke,Ne,"Z","ℤ");O(jt,ke,Ne,"Z","ℤ");O(H,J,ar,"h","ℎ");O(jt,J,ar,"h","ℎ");var br;for(var Dl=0;Dl<TT.length;Dl++){var co=TT.charAt(Dl);br=String.fromCharCode(55349,56320+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56372+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56424+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56580+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56684+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56736+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56788+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56840+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56944+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),Dl<26&&(br=String.fromCharCode(55349,56632+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br),br=String.fromCharCode(55349,56476+Dl),O(H,J,ar,co,br),O(jt,J,Ne,co,br))}br="𝕜";O(H,J,ar,"k",br);O(jt,J,Ne,"k",br);for(var H0=0;H0<10;H0++){var Am=H0.toString();br=String.fromCharCode(55349,57294+H0),O(H,J,ar,Am,br),O(jt,J,Ne,Am,br),br=String.fromCharCode(55349,57314+H0),O(H,J,ar,Am,br),O(jt,J,Ne,Am,br),br=String.fromCharCode(55349,57324+H0),O(H,J,ar,Am,br),O(jt,J,Ne,Am,br),br=String.fromCharCode(55349,57334+H0),O(H,J,ar,Am,br),O(jt,J,Ne,Am,br)}var lI="ÐÞþ";for(var wA=0;wA<lI.length;wA++){var b2=lI.charAt(wA);O(H,J,ar,b2,b2),O(jt,J,Ne,b2,b2)}var cI={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},lH={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},cH={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},D8e={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},cg={mathClass:"",textClass:"",font:""},uH={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},dH={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},hH={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},uI={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},dI={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},fH={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},hI={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},mH=[cI,cI,lH,lH,cH,cH,D8e,cg,cg,cg,uH,uH,dH,dH,hH,hH,uI,uI,dI,dI,fH,fH,cg,cg,hI,hI],L8e=[cI,cg,uI,dI,hI],P8e=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),r=(t-55296)*1024+(n-56320)+65536;if(119808<=r&&r<120484){var s=Math.floor((r-119808)/26);return mH[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return L8e[i]}else{if(r===120485||r===120486)return mH[0];if(120486<r&&r<120782)return cg;throw new qt("Unsupported character: "+e)}},w5=function(t,n,r){if(Hi[r][t]){var s=Hi[r][t].replace;s&&(t=s)}return{value:t,metrics:PD(t,n,r)}},$l=function(t,n,r,s,i){var o=w5(t,n,r),l=o.metrics;t=o.value;var c;if(l){var u=l.italic;(r==="text"||s&&s.font==="mathit")&&(u=0),c=new nu(t,l.height,l.depth,u,l.skew,l.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+r+"'")),c=new nu(t,0,0,0,0,0,i);if(s){c.maxFontSize=s.sizeMultiplier,s.style.isTight()&&c.classes.push("mtight");var d=s.getColor();d&&(c.style.color=d)}return c},OD=function(t,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&w5(t,"Main-Bold",n).metrics?$l(t,"Main-Bold",n,r,s.concat(["mathbf"])):t==="\\"||Hi[n][t].font==="main"?$l(t,"Main-Regular",n,r,s):$l(t,"AMS-Regular",n,r,s.concat(["amsrm"]))},O8e=function(t,n,r){return r!=="textord"&&w5(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},x5=function(t,n,r){var s=t.mode,i=t.text,o=["mord"],{font:l,fontFamily:c,fontWeight:u,fontShape:d}=n,f=s==="math"||s==="text"&&!!l,m=f?l:c,p="",g="";if(i.charCodeAt(0)===55349){var b=P8e(i);p=b.font,g=b[s+"Class"]}if(p)return $l(i,p,s,n,o.concat(g));if(m){var w,y;if(m==="boldsymbol"){var v=O8e(i,s,r);w=v.fontName,y=[v.fontClass]}else f?(w=fI[l].fontName,y=[l]):(w=y2(c,u,d),y=[c,u,d]);if(w5(i,w,s).metrics)return $l(i,w,s,n,o.concat(y));if(sne.hasOwnProperty(i)&&w.slice(0,10)==="Typewriter"){for(var x=[],k=0;k<i.length;k++)x.push($l(i[k],w,s,n,o.concat(y)));return am(x)}}if(r==="mathord")return $l(i,"Math-Italic",s,n,o.concat(["mathnormal"]));if(r==="textord"){var S=Hi[s][i]&&Hi[s][i].font;if(S==="ams"){var T=y2("amsrm",u,d);return $l(i,T,s,n,o.concat("amsrm",u,d))}else if(S==="main"||!S){var _=y2("textrm",u,d);return $l(i,_,s,n,o.concat(u,d))}else{var C=y2(S,u,d);return $l(i,C,s,n,o.concat(C,u,d))}}else throw new Error("unexpected type: "+r+" in makeOrd")},$8e=(e,t)=>{if(Mp(e.classes)!==Mp(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r of Object.keys(e.style))if(e.style[r]!==t.style[r])return!1;for(var s of Object.keys(t.style))if(e.style[s]!==t.style[s])return!1;return!0},ine=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof nu&&r instanceof nu&&$8e(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e},$D=function(t){for(var n=0,r=0,s=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>n&&(n=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>s&&(s=o.maxFontSize)}t.height=n,t.depth=r,t.maxFontSize=s},Pt=function(t,n,r,s){var i=new pv(t,n,r,s);return $D(i),i},Dp=(e,t,n,r)=>new pv(e,t,n,r),Ey=function(t,n,r){var s=Pt([t],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=tn(s.height),s.maxFontSize=1,s},B8e=function(t,n,r,s){var i=new v5(t,n,r,s);return $D(i),i},am=function(t){var n=new mv(t);return $D(n),n},Ay=function(t,n){return t instanceof mv?Pt([],[t],n):t},z8e=function(t){if(t.positionType==="individualShift"){for(var n=t.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,o=1;o<n.length;o++){var l=-n[o].shift-i-n[o].elem.depth,c=l-(n[o-1].elem.height+n[o-1].elem.depth);i=i+l,r.push({type:"kern",size:c}),r.push(n[o])}return{children:r,depth:s}}var u;if(t.positionType==="top"){for(var d=t.positionData,f=0;f<t.children.length;f++){var m=t.children[f];d-=m.type==="kern"?m.size:m.elem.height+m.elem.depth}u=d}else if(t.positionType==="bottom")u=-t.positionData;else{var p=t.children[0];if(p.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")u=-p.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")u=-p.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:u}},Hs=function(t,n){for(var{children:r,depth:s}=z8e(t),i=0,o=0;o<r.length;o++){var l=r[o];if(l.type==="elem"){var c=l.elem;i=Math.max(i,c.maxFontSize,c.height)}}i+=2;var u=Pt(["pstrut"],[]);u.style.height=tn(i);for(var d=[],f=s,m=s,p=s,g=0;g<r.length;g++){var b=r[g];if(b.type==="kern")p+=b.size;else{var w=b.elem,y=b.wrapperClasses||[],v=b.wrapperStyle||{},x=Pt(y,[u,w],void 0,v);x.style.top=tn(-i-p-w.depth),b.marginLeft&&(x.style.marginLeft=b.marginLeft),b.marginRight&&(x.style.marginRight=b.marginRight),d.push(x),p+=w.height+w.depth}f=Math.min(f,p),m=Math.max(m,p)}var k=Pt(["vlist"],d);k.style.height=tn(m);var S;if(f<0){var T=Pt([],[]),_=Pt(["vlist"],[T]);_.style.height=tn(-f);var C=Pt(["vlist-s"],[new nu("​")]);S=[Pt(["vlist-r"],[k,C]),Pt(["vlist-r"],[_])]}else S=[Pt(["vlist-r"],[k])];var j=Pt(["vlist-t"],S);return S.length===2&&j.classes.push("vlist-t2"),j.height=m,j.depth=-f,j},one=(e,t)=>{var n=Pt(["mspace"],[],t),r=io(e,t);return n.style.marginRight=tn(r),n},y2=(e,t,n)=>{var r,s;switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return t==="textbf"&&n==="textit"?s="BoldItalic":t==="textbf"?s="Bold":n==="textit"?s="Italic":s="Regular",r+"-"+s},fI={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},ane={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},lne=function(t,n){var[r,s,i]=ane[t],o=new Rp(r),l=new Vf([o],{width:tn(s),height:tn(i),style:"width:"+tn(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=Dp(["overlay"],[l],n);return c.height=i,c.style.height=tn(i),c.style.width=tn(s),c},Zi={number:3,unit:"mu"},U0={number:4,unit:"mu"},tf={number:5,unit:"mu"},F8e={mord:{mop:Zi,mbin:U0,mrel:tf,minner:Zi},mop:{mord:Zi,mop:Zi,mrel:tf,minner:Zi},mbin:{mord:U0,mop:U0,mopen:U0,minner:U0},mrel:{mord:tf,mop:tf,mopen:tf,minner:tf},mopen:{},mclose:{mop:Zi,mbin:U0,mrel:tf,minner:Zi},mpunct:{mord:Zi,mop:Zi,mrel:tf,mopen:Zi,mclose:Zi,mpunct:Zi,minner:Zi},minner:{mord:Zi,mop:Zi,mbin:U0,mrel:tf,mopen:Zi,mpunct:Zi,minner:Zi}},q8e={mord:{mop:Zi},mop:{mord:Zi,mop:Zi},mbin:{},mrel:{},mopen:{},mclose:{mop:Zi},mpunct:{},minner:{mop:Zi}},cne={},ET={},AT={};function Sn(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,l={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},c=0;c<n.length;++c)cne[n[c]]=l;t&&(i&&(ET[t]=i),o&&(AT[t]=o))}function c1(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;Sn({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var jT=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Vo=function(t){return t.type==="ordgroup"?t.body:[t]},H8e=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),U8e=new Set(["rightmost","mrel","mclose","mpunct"]),W8e={display:Cr.DISPLAY,text:Cr.TEXT,script:Cr.SCRIPT,scriptscript:Cr.SCRIPTSCRIPT},V8e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},pa=function(t,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<t.length;o++){var l=Vs(t[o],n);if(l instanceof mv){var c=l.children;i.push(...c)}else i.push(l)}if(ine(i),!r)return i;var u=n;if(t.length===1){var d=t[0];d.type==="sizing"?u=n.havingSize(d.size):d.type==="styling"&&(u=n.havingStyle(W8e[d.style]))}var f=Pt([s[0]||"leftmost"],[],n),m=Pt([s[1]||"rightmost"],[],n),p=r==="root";return mI(i,(g,b)=>{var w=b.classes[0],y=g.classes[0];w==="mbin"&&U8e.has(y)?b.classes[0]="mord":y==="mbin"&&H8e.has(w)&&(g.classes[0]="mord")},{node:f},m,p),mI(i,(g,b)=>{var w,y,v=gI(b),x=gI(g),k=v&&x?g.hasClass("mtight")?(w=q8e[v])==null?void 0:w[x]:(y=F8e[v])==null?void 0:y[x]:null;if(k)return one(k,u)},{node:f},m,p),i},mI=function(t,n,r,s,i){s&&t.push(s);for(var o=0;o<t.length;o++){var l=t[o],c=une(l);if(c){mI(c.children,n,r,null,i);continue}var u=!l.hasClass("mspace");if(u){var d=n(l,r.node);d&&(r.insertAfter?r.insertAfter(d):(t.unshift(d),o++))}u?r.node=l:i&&l.hasClass("newline")&&(r.node=Pt(["leftmost"])),r.insertAfter=(f=>m=>{t.splice(f+1,0,m),o++})(o)}s&&t.pop()},une=function(t){return t instanceof mv||t instanceof v5||t instanceof pv&&t.hasClass("enclosing")?t:null},pI=function(t,n){var r=une(t);if(r){var s=r.children;if(s.length){if(n==="right")return pI(s[s.length-1],"right");if(n==="left")return pI(s[0],"left")}}return t},gI=function(t,n){if(!t)return null;n&&(t=pI(t,n));var r=t.classes[0];return V8e[r]||null},kk=function(t,n){var r=["nulldelimiter"].concat(t.baseSizingClasses());return Pt(n.concat(r))},Vs=function(t,n,r){if(!t)return Pt();if(ET[t.type]){var s=ET[t.type](t,n);if(r&&n.size!==r.size){s=Pt(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new qt("Got group of unknown type: '"+t.type+"'")};function v2(e,t){var n=Pt(["base"],e,t),r=Pt(["strut"]);return r.style.height=tn(n.height+n.depth),n.depth&&(r.style.verticalAlign=tn(-n.depth)),n.children.unshift(r),n}function bI(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var r=pa(e,t,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],o=[],l=0;l<r.length;l++)if(o.push(r[l]),r[l].hasClass("mbin")||r[l].hasClass("mrel")||r[l].hasClass("allowbreak")){for(var c=!1;l<r.length-1&&r[l+1].hasClass("mspace")&&!r[l+1].hasClass("newline");)l++,o.push(r[l]),r[l].hasClass("nobreak")&&(c=!0);c||(i.push(v2(o,t)),o=[])}else r[l].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(v2(o,t)),o=[]),i.push(r[l]));o.length>0&&i.push(v2(o,t));var u;n?(u=v2(pa(n,t,!0),t),u.classes=["tag"],i.push(u)):s&&i.push(s);var d=Pt(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),u){var f=u.children[0];f.style.height=tn(d.height+d.depth),d.depth&&(f.style.verticalAlign=tn(-d.depth))}return d}function dne(e){return new mv(e)}class Wt{constructor(t,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=Mp(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Go&&this.children[r+1]instanceof Go){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Go;)s+=this.children[++r].toText();t.appendChild(new Go(s).toNode())}else t.appendChild(this.children[r].toNode());return t}toMarkup(){var t="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=" "+n+'="',t+=_l(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+_l(Mp(this.classes))+'"'),t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}let Go=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return _l(this.toText())}toText(){return this.text}};class hne{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",tn(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+tn(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var G8e=new Set(["\\imath","\\jmath"]),K8e=new Set(["mrow","mtable"]),Fu=function(t,n,r){return Hi[n][t]&&Hi[n][t].replace&&t.charCodeAt(0)!==55349&&!(sne.hasOwnProperty(t)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(t=Hi[n][t].replace),new Go(t)},BD=function(t){return t.length===1?t[0]:new Wt("mrow",t)},Y8e={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},zD=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var n=t.font;if(!n||n==="mathnormal")return null;var r=e.mode,s=Y8e[n];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(G8e.has(i))return null;if(Hi[r][i]){var o=Hi[r][i].replace;o&&(i=o)}var l=fI[n].fontName;return PD(i,l,r)?fI[n].variant:null};function xA(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Go&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var n=e.children[0];return n instanceof Go&&n.text===","}else return!1}var iu=function(t,n,r){if(t.length===1){var s=_i(t[0],n);return r&&s instanceof Wt&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,l=0;l<t.length;l++){var c=_i(t[l],n);if(c instanceof Wt&&o instanceof Wt){if(c.type==="mtext"&&o.type==="mtext"&&c.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...c.children);continue}else if(c.type==="mn"&&o.type==="mn"){o.children.push(...c.children);continue}else if(xA(c)&&o.type==="mn"){o.children.push(...c.children);continue}else if(c.type==="mn"&&xA(o))c.children=[...o.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(o.type==="mn"||xA(o))){var u=c.children[0];u instanceof Wt&&u.type==="mn"&&(u.children=[...o.children,...u.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var d=o.children[0];if(d instanceof Go&&d.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var f=c.children[0];f instanceof Go&&f.text.length>0&&(f.text=f.text.slice(0,1)+"̸"+f.text.slice(1),i.pop())}}}i.push(c),o=c}return i},Lp=function(t,n,r){return BD(iu(t,n,r))},_i=function(t,n){if(!t)return new Wt("mrow");if(AT[t.type])return AT[t.type](t,n);throw new qt("Got group of unknown type: '"+t.type+"'")};function pH(e,t,n,r,s){var i=iu(e,n),o;i.length===1&&i[0]instanceof Wt&&K8e.has(i[0].type)?o=i[0]:o=new Wt("mrow",i);var l=new Wt("annotation",[new Go(t)]);l.setAttribute("encoding","application/x-tex");var c=new Wt("semantics",[o,l]),u=new Wt("math",[c]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&u.setAttribute("display","block");var d=s?"katex":"katex-mathml";return Pt([d],[u])}var X8e=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],gH=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],bH=function(t,n){return n.size<2?t:X8e[t-1][n.size-1]};class uf{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||uf.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=gH[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(n,t),new uf(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:bH(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:gH[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=bH(uf.BASESIZE,t);return this.size===n&&this.textSize===uf.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==uf.BASESIZE?["sizing","reset-size"+this.size,"size"+uf.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=R8e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}uf.BASESIZE=6;var fne=function(t){return new uf({style:t.displayMode?Cr.DISPLAY:Cr.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},mne=function(t,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),t=Pt(r,[t])}return t},Q8e=function(t,n,r){var s=fne(r),i;if(r.output==="mathml")return pH(t,n,s,r.displayMode,!0);if(r.output==="html"){var o=bI(t,s);i=Pt(["katex"],[o])}else{var l=pH(t,n,s,r.displayMode,!1),c=bI(t,s);i=Pt(["katex"],[l,c])}return mne(i,r)},J8e=function(t,n,r){var s=fne(r),i=bI(t,s),o=Pt(["katex"],[i]);return mne(o,r)},Z8e={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},k5=function(t){var n=new Wt("mo",[new Go(Z8e[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},eEe={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},tEe=new Set(["widehat","widecheck","widetilde","utilde"]),_5=function(t,n){function r(){var l=4e5,c=t.label.slice(1);if(tEe.has(c)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,d,f,m;if(u>5)c==="widehat"||c==="widecheck"?(d=420,l=2364,m=.42,f=c+"4"):(d=312,l=2340,m=.34,f="tilde4");else{var p=[1,1,2,2,3,3][u];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][p],d=[0,239,300,360,420][p],m=[0,.24,.3,.3,.36,.42][p],f=c+p):(l=[0,600,1033,2339,2340][p],d=[0,260,286,306,312][p],m=[0,.26,.286,.3,.306,.34][p],f="tilde"+p)}var g=new Rp(f),b=new Vf([g],{width:"100%",height:tn(m),viewBox:"0 0 "+l+" "+d,preserveAspectRatio:"none"});return{span:Dp([],[b],n),minWidth:0,height:m}}else{var w=[],y=eEe[c];if(!y)throw new Error('No SVG data for "'+c+'".');var[v,x,k]=y,S=k/1e3,T=v.length,_,C;if(T===1){if(y.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+c+'".');_=["hide-tail"],C=[y[3]]}else if(T===2)_=["halfarrow-left","halfarrow-right"],C=["xMinYMin","xMaxYMin"];else if(T===3)_=["brace-left","brace-center","brace-right"],C=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+T+" children.");for(var j=0;j<T;j++){var E=new Rp(v[j]),L=new Vf([E],{width:"400em",height:tn(S),viewBox:"0 0 "+l+" "+k,preserveAspectRatio:C[j]+" slice"}),D=Dp([_[j]],[L],n);if(T===1)return{span:D,minWidth:x,height:S};D.style.height=tn(S),w.push(D)}return{span:Pt(["stretchy"],w,n),minWidth:x,height:S}}}var{span:s,minWidth:i,height:o}=r();return s.height=o,s.style.height=tn(o),i>0&&(s.style.minWidth=tn(i)),s},nEe=function(t,n,r,s,i){var o,l=t.height+t.depth+r+s;if(/fbox|color|angl/.test(n)){if(o=Pt(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(o.style.borderColor=c)}}else{var u=[];/^[bx]cancel$/.test(n)&&u.push(new aI({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&u.push(new aI({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new Vf(u,{width:"100%",height:tn(l)});o=Dp([],[d],i)}return o.height=l,o.style.height=tn(l),o},rEe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},sEe={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function iEe(e){return e in rEe}function Br(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function S5(e){var t=C5(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function C5(e){return e&&(e.type==="atom"||sEe.hasOwnProperty(e.type))?e:null}var pne=e=>{if(e instanceof nu)return e;if(M8e(e)&&e.children.length===1)return pne(e.children[0])},FD=(e,t)=>{var n,r,s;e&&e.type==="supsub"?(r=Br(e.base,"accent"),n=r.base,e.base=n,s=I8e(Vs(e,t)),e.base=r):(r=Br(e,"accent"),n=r.base);var i=Vs(n,t.havingCrampedStyle()),o=r.isShifty&&im(n),l=0;if(o){var c,u;l=(c=(u=pne(i))==null?void 0:u.skew)!=null?c:0}var d=r.label==="\\c",f=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),m;if(r.isStretchy)m=_5(r,t),m=Hs({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+tn(2*l)+")",marginLeft:tn(2*l)}:void 0}]});else{var p,g;r.label==="\\vec"?(p=lne("vec",t),g=ane.vec[1]):(p=x5({mode:r.mode,text:r.label},t,"textord"),p=N8e(p),p.italic=0,g=p.width,d&&(f+=p.depth)),m=Pt(["accent-body"],[p]);var b=r.label==="\\textcircled";b&&(m.classes.push("accent-full"),f=i.height);var w=l;b||(w-=g/2),m.style.left=tn(w),r.label==="\\textcircled"&&(m.style.top=".2em"),m=Hs({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-f},{type:"elem",elem:m}]})}var y=Pt(["mord","accent"],[m],t);return s?(s.children[0]=y,s.height=Math.max(y.height,s.height),s.classes[0]="mord",s):y},gne=(e,t)=>{var n=e.isStretchy?k5(e.label):new Wt("mo",[Fu(e.label,e.mode)]),r=new Wt("mover",[_i(e.base,t),n]);return r.setAttribute("accent","true"),r},oEe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Sn({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=jT(t[0]),r=!oEe.test(e.funcName),s=!r||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:FD,mathmlBuilder:gne});Sn({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],r=e.parser.mode;return r==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:FD,mathmlBuilder:gne});Sn({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(e,t)=>{var n=Vs(e.base,t),r=_5(e,t),s=e.label==="\\utilde"?.12:0,i=Hs({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]});return Pt(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=k5(e.label),r=new Wt("munder",[_i(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var w2=e=>{var t=new Wt("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Sn({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r,funcName:s}=e;return{type:"xArrow",mode:r.mode,label:s,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,r=t.havingStyle(n.sup()),s=Ay(Vs(e.body,r,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var o;e.below&&(r=t.havingStyle(n.sub()),o=Ay(Vs(e.below,r,t),t),o.classes.push(i+"-arrow-pad"));var l=_5(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,u=-t.fontMetrics().axisHeight-.5*l.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(u-=s.depth);var d;if(o){var f=-t.fontMetrics().axisHeight+o.height+.5*l.height+.111;d=Hs({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:f}]})}else d=Hs({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]}]});return Pt(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=k5(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=w2(_i(e.body,t));if(e.below){var i=w2(_i(e.below,t));r=new Wt("munderover",[n,i,s])}else r=new Wt("mover",[n,s])}else if(e.below){var o=w2(_i(e.below,t));r=new Wt("munder",[n,o])}else r=w2(),r=new Wt("mover",[n,r]);return r}});function bne(e,t){var n=pa(e.body,t,!0);return Pt([e.mclass],n,t)}function yne(e,t){var n,r=iu(e.body,t);return e.mclass==="minner"?n=new Wt("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(n=r[0],n.type="mi"):n=new Wt("mi",r):(e.isCharacterBox?(n=r[0],n.type="mo"):n=new Wt("mo",r),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Sn({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:Vo(s),isCharacterBox:im(s)}},htmlBuilder:bne,mathmlBuilder:yne});var T5=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};Sn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:T5(t[0]),body:Vo(t[1]),isCharacterBox:im(t[1])}}});Sn({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:r}=e,s=t[1],i=t[0],o;r!=="\\stackrel"?o=T5(s):o="mrel";var l={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Vo(s)},c={type:"supsub",mode:i.mode,base:l,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[c],isCharacterBox:im(c)}},htmlBuilder:bne,mathmlBuilder:yne});Sn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:T5(t[0]),body:Vo(t[0])}},htmlBuilder(e,t){var n=pa(e.body,t,!0),r=Pt([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=iu(e.body,t),r=new Wt("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var aEe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},yH=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),vH=e=>e.type==="textord"&&e.text==="@",lEe=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function cEe(e,t,n){var r=aEe[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},o=n.callFunction("\\Big",[i],[]),l=n.callFunction("\\\\cdright",[t[1]],[]),c={type:"ordgroup",mode:"math",body:[s,o,l]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function uEe(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n==="&"||n==="\\\\")e.consume();else if(n==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new qt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;i<t.length;i++){for(var o=t[i],l=yH(),c=0;c<o.length;c++)if(!vH(o[c]))l.body.push(o[c]);else{r.push(l),c+=1;var u=S5(o[c]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(u))if("<>AV".includes(u))for(var f=0;f<2;f++){for(var m=!0,p=c+1;p<o.length;p++){if(lEe(o[p],u)){m=!1,c=p;break}if(vH(o[p]))throw new qt("Missing a "+u+" character to complete a CD arrow.",o[p]);d[f].body.push(o[p])}if(m)throw new qt("Missing a "+u+" character to complete a CD arrow.",o[c])}else throw new qt('Expected one of "<>AV=|." after @',o[c]);var g=cEe(u,d,e),b={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};r.push(b),l=yH()}i%2===0?r.push(l):r.shift(),r=[],s.push(r)}e.gullet.endGroup(),e.gullet.endGroup();var w=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:w,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Sn({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=Ay(Vs(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=tn(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new Wt("mrow",[_i(e.label,t)]);return n=new Wt("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Wt("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Sn({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=Ay(Vs(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Wt("mrow",[_i(e.fragment,t)])}});Sn({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=Br(t[0],"ordgroup"),s=r.body,i="",o=0;o<s.length;o++){var l=Br(s[o],"textord");i+=l.text}var c=parseInt(i),u;if(isNaN(c))throw new qt("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new qt("\\@char with invalid code point "+i);return c<=65535?u=String.fromCharCode(c):(c-=65536,u=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:u}}});var vne=(e,t)=>{var n=pa(e.body,t.withColor(e.color),!1);return am(n)},wne=(e,t)=>{var n=iu(e.body,t.withColor(e.color)),r=new Wt("mstyle",n);return r.setAttribute("mathcolor",e.color),r};Sn({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=Br(t[0],"color-token").color,s=t[1];return{type:"color",mode:n.mode,color:r,body:Vo(s)}},htmlBuilder:vne,mathmlBuilder:wne});Sn({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,s=Br(t[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:vne,mathmlBuilder:wne});Sn({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:r}=e,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Br(s,"size").value}},htmlBuilder(e,t){var n=Pt(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=tn(io(e.size,t)))),n},mathmlBuilder(e,t){var n=new Wt("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",tn(io(e.size,t)))),n}});var yI={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},xne=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new qt("Expected a control sequence",e);return t},dEe=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},kne=(e,t,n,r)=>{var s=e.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,s,r)};Sn({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(yI[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=yI[r.text]),Br(t.parseFunction(),"internal");throw new qt("Invalid token after macro prefix",r)}});Sn({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new qt("Expected a control sequence",r);for(var i=0,o,l=[[]];t.gullet.future().text!=="{";)if(r=t.gullet.popToken(),r.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),l[i].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new qt('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new qt('Argument number "'+r.text+'" out of order');i++,l.push([])}else{if(r.text==="EOF")throw new qt("Expected a macro definition");l[i].push(r.text)}var{tokens:c}=t.gullet.consumeArg();return o&&c.unshift(o),(n==="\\edef"||n==="\\xdef")&&(c=t.gullet.expandTokens(c),c.reverse()),t.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:l},n===yI[n]),{type:"internal",mode:t.mode}}});Sn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=xne(t.gullet.popToken());t.gullet.consumeSpaces();var s=dEe(t);return kne(t,r,s,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});Sn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=xne(t.gullet.popToken()),s=t.gullet.popToken(),i=t.gullet.popToken();return kne(t,r,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(s),{type:"internal",mode:t.mode}}});var rx=function(t,n,r){var s=Hi.math[t]&&Hi.math[t].replace,i=PD(s||t,n,r);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},qD=function(t,n,r,s){var i=r.havingBaseStyle(n),o=Pt(s.concat(i.sizingClasses(r)),[t],r),l=i.sizeMultiplier/r.sizeMultiplier;return o.height*=l,o.depth*=l,o.maxFontSize=i.sizeMultiplier,o},_ne=function(t,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=tn(i),t.height-=i,t.depth+=i},hEe=function(t,n,r,s,i,o){var l=$l(t,"Main-Regular",i,s),c=qD(l,n,s,o);return _ne(c,s,n),c},fEe=function(t,n,r,s){return $l(t,"Size"+n+"-Regular",r,s)},Sne=function(t,n,r,s,i,o){var l=fEe(t,n,i,s),c=qD(Pt(["delimsizing","size"+n],[l],s),Cr.TEXT,s,o);return r&&_ne(c,s,Cr.TEXT),c},kA=function(t,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=Pt(["delimsizinginner",s],[Pt([],[$l(t,n,r)])]);return{type:"elem",elem:i}},_A=function(t,n,r){var s=dh["Size4-Regular"][t.charCodeAt(0)]?dh["Size4-Regular"][t.charCodeAt(0)][4]:dh["Size1-Regular"][t.charCodeAt(0)][4],i=new Rp("inner",_8e(t,Math.round(1e3*n))),o=new Vf([i],{width:tn(s),height:tn(n),style:"width:"+tn(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),l=Dp([],[o],r);return l.height=n,l.style.height=tn(n),l.style.width=tn(s),{type:"elem",elem:l}},vI=.008,x2={type:"kern",size:-1*vI},mEe=new Set(["|","\\lvert","\\rvert","\\vert"]),pEe=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Cne=function(t,n,r,s,i,o){var l,c,u,d,f="",m=0;l=u=d=t,c=null;var p="Size1-Regular";t==="\\uparrow"?u=d="⏐":t==="\\Uparrow"?u=d="‖":t==="\\downarrow"?l=u="⏐":t==="\\Downarrow"?l=u="‖":t==="\\updownarrow"?(l="\\uparrow",u="⏐",d="\\downarrow"):t==="\\Updownarrow"?(l="\\Uparrow",u="‖",d="\\Downarrow"):mEe.has(t)?(u="∣",f="vert",m=333):pEe.has(t)?(u="∥",f="doublevert",m=556):t==="["||t==="\\lbrack"?(l="⎡",u="⎢",d="⎣",p="Size4-Regular",f="lbrack",m=667):t==="]"||t==="\\rbrack"?(l="⎤",u="⎥",d="⎦",p="Size4-Regular",f="rbrack",m=667):t==="\\lfloor"||t==="⌊"?(u=l="⎢",d="⎣",p="Size4-Regular",f="lfloor",m=667):t==="\\lceil"||t==="⌈"?(l="⎡",u=d="⎢",p="Size4-Regular",f="lceil",m=667):t==="\\rfloor"||t==="⌋"?(u=l="⎥",d="⎦",p="Size4-Regular",f="rfloor",m=667):t==="\\rceil"||t==="⌉"?(l="⎤",u=d="⎥",p="Size4-Regular",f="rceil",m=667):t==="("||t==="\\lparen"?(l="⎛",u="⎜",d="⎝",p="Size4-Regular",f="lparen",m=875):t===")"||t==="\\rparen"?(l="⎞",u="⎟",d="⎠",p="Size4-Regular",f="rparen",m=875):t==="\\{"||t==="\\lbrace"?(l="⎧",c="⎨",d="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(l="⎫",c="⎬",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(l="⎧",d="⎩",u="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(l="⎫",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(l="⎧",d="⎭",u="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(l="⎫",d="⎩",u="⎪",p="Size4-Regular");var g=rx(l,p,i),b=g.height+g.depth,w=rx(u,p,i),y=w.height+w.depth,v=rx(d,p,i),x=v.height+v.depth,k=0,S=1;if(c!==null){var T=rx(c,p,i);k=T.height+T.depth,S=2}var _=b+x+k,C=Math.max(0,Math.ceil((n-_)/(S*y))),j=_+C*S*y,E=s.fontMetrics().axisHeight;r&&(E*=s.sizeMultiplier);var L=j/2-E,D=[];if(f.length>0){var M=j-b-x,R=Math.round(j*1e3),$=S8e(f,Math.round(M*1e3)),B=new Rp(f,$),N=tn(m/1e3),z=tn(R/1e3),G=new Vf([B],{width:N,height:z,viewBox:"0 0 "+m+" "+R}),I=Dp([],[G],s);I.height=R/1e3,I.style.width=N,I.style.height=z,D.push({type:"elem",elem:I})}else{if(D.push(kA(d,p,i)),D.push(x2),c===null){var Y=j-b-x+2*vI;D.push(_A(u,Y,s))}else{var U=(j-b-x-k)/2+2*vI;D.push(_A(u,U,s)),D.push(x2),D.push(kA(c,p,i)),D.push(x2),D.push(_A(u,U,s))}D.push(x2),D.push(kA(l,p,i))}var P=s.havingBaseStyle(Cr.TEXT),F=Hs({positionType:"bottom",positionData:L,children:D});return qD(Pt(["delimsizing","mult"],[F],P),Cr.TEXT,s,o)},SA=80,CA=.08,TA=function(t,n,r,s,i){var o=k8e(t,s,r),l=new Rp(t,o),c=new Vf([l],{width:"400em",height:tn(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return Dp(["hide-tail"],[c],i)},gEe=function(t,n){var r=n.havingBaseSizing(),s=Nne("\\surd",t*r.sizeMultiplier,jne,r),i=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),l,c,u,d,f;return s.type==="small"?(d=1e3+1e3*o+SA,t<1?i=1:t<1.4&&(i=.7),c=(1+o+CA)/i,u=(1+o)/i,l=TA("sqrtMain",c,d,o,n),l.style.minWidth="0.853em",f=.833/i):s.type==="large"?(d=(1e3+SA)*zx[s.size],u=(zx[s.size]+o)/i,c=(zx[s.size]+o+CA)/i,l=TA("sqrtSize"+s.size,c,d,o,n),l.style.minWidth="1.02em",f=1/i):(c=t+o+CA,u=t+o,d=Math.floor(1e3*t+o)+SA,l=TA("sqrtTall",c,d,o,n),l.style.minWidth="0.742em",f=1.056),l.height=u,l.style.height=tn(c),{span:l,advanceWidth:f,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},Tne=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),bEe=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),Ene=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),zx=[0,1.2,1.8,2.4,3],Ane=function(t,n,r,s,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),Tne.has(t)||Ene.has(t))return Sne(t,n,!1,r,s,i);if(bEe.has(t))return Cne(t,zx[n],!1,r,s,i);throw new qt("Illegal delimiter: '"+t+"'")},yEe=[{type:"small",style:Cr.SCRIPTSCRIPT},{type:"small",style:Cr.SCRIPT},{type:"small",style:Cr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],vEe=[{type:"small",style:Cr.SCRIPTSCRIPT},{type:"small",style:Cr.SCRIPT},{type:"small",style:Cr.TEXT},{type:"stack"}],jne=[{type:"small",style:Cr.SCRIPTSCRIPT},{type:"small",style:Cr.SCRIPT},{type:"small",style:Cr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],wEe=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";var n=t.type;throw new Error("Add support for delim type '"+n+"' here.")},Nne=function(t,n,r,s){for(var i=Math.min(2,3-s.style.size),o=i;o<r.length;o++){var l=r[o];if(l.type==="stack")break;var c=rx(t,wEe(l),"math"),u=c.height+c.depth;if(l.type==="small"){var d=s.havingBaseStyle(l.style);u*=d.sizeMultiplier}if(u>n)return l}return r[r.length-1]},wI=function(t,n,r,s,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var l;Ene.has(t)?l=yEe:Tne.has(t)?l=jne:l=vEe;var c=Nne(t,n,l,s);return c.type==="small"?hEe(t,c.style,r,s,i,o):c.type==="large"?Sne(t,c.size,r,s,i,o):Cne(t,n,r,s,i,o)},EA=function(t,n,r,s,i,o){var l=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,u=5/s.fontMetrics().ptPerEm,d=Math.max(n-l,r+l),f=Math.max(d/500*c,2*d-u);return wI(t,f,!0,s,i,o)},wH={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},xEe=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function xH(e){return"isMiddle"in e}function E5(e,t){var n=C5(e);if(n&&xEe.has(n.text))return n;throw n?new qt("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new qt("Invalid delimiter type '"+e.type+"'",e)}Sn({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=E5(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:wH[e.funcName].size,mclass:wH[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?Pt([e.mclass]):Ane(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Fu(e.delim,e.mode));var n=new Wt("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=tn(zx[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function kH(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Sn({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new qt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:E5(t[0],e).text,color:n}}});Sn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=E5(t[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Br(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{kH(e);for(var n=pa(e.body,t,!0,["mopen","mclose"]),r=0,s=0,i=!1,o=0;o<n.length;o++){var l=n[o];xH(l)?i=!0:(r=Math.max(n[o].height,r),s=Math.max(n[o].depth,s))}r*=t.sizeMultiplier,s*=t.sizeMultiplier;var c;if(e.left==="."?c=kk(t,["mopen"]):c=EA(e.left,r,s,t,e.mode,["mopen"]),n.unshift(c),i)for(var u=1;u<n.length;u++){var d=n[u];if(xH(d)){var f=d.isMiddle;n[u]=EA(f.delim,r,s,f.options,e.mode,[])}}var m;if(e.right===".")m=kk(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;m=EA(e.right,r,s,p,e.mode,["mclose"])}return n.push(m),Pt(["minner"],n,t)},mathmlBuilder:(e,t)=>{kH(e);var n=iu(e.body,t);if(e.left!=="."){var r=new Wt("mo",[Fu(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(e.right!=="."){var s=new Wt("mo",[Fu(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),n.push(s)}return BD(n)}});Sn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=E5(t[0],e);if(!e.parser.leftrightDepth)throw new qt("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=kk(t,[]):(n=Ane(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?Fu("|","text"):Fu(e.delim,e.mode),r=new Wt("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var A5=(e,t)=>{var n=Ay(Vs(e.body,t),t),r=e.label.slice(1),s=t.sizeMultiplier,i,o,l=im(e.body);if(r==="sout")i=Pt(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/s,o=-.5*t.fontMetrics().xHeight;else if(r==="phase"){var c=io({number:.6,unit:"pt"},t),u=io({number:.35,unit:"ex"},t),d=t.havingBaseSizing();s=s/d.sizeMultiplier;var f=n.height+n.depth+c+u;n.style.paddingLeft=tn(f/2+c);var m=Math.floor(1e3*f*s),p=w8e(m),g=new Vf([new Rp("phase",p)],{width:"400em",height:tn(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});i=Dp(["hide-tail"],[g],t),i.style.height=tn(f),o=n.depth+c+u}else{/cancel/.test(r)?l||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var b,w,y=0;/box/.test(r)?(y=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),b=t.fontMetrics().fboxsep+(r==="colorbox"?0:y),w=b):r==="angl"?(y=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),b=4*y,w=Math.max(0,.25-n.depth)):(b=l?.2:0,w=b),i=nEe(n,r,b,w,t),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=tn(y)):r==="angl"&&y!==.049&&(i.style.borderTopWidth=tn(y),i.style.borderRightWidth=tn(y)),o=n.depth+w,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var v;if(e.backgroundColor)v=Hs({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(r)?["svg-align"]:[];v=Hs({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:x}]})}return/cancel/.test(r)&&(v.height=n.height,v.depth=n.depth),/cancel/.test(r)&&!l?Pt(["mord","cancel-lap"],[v],t):Pt(["mord"],[v],t)},j5=(e,t)=>{var n,r=new Wt(e.label.includes("colorbox")?"mpadded":"menclose",[_i(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var s=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+tn(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};Sn({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=Br(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:A5,mathmlBuilder:j5});Sn({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=Br(t[0],"color-token").color,o=Br(t[1],"color-token").color,l=t[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:o,borderColor:i,body:l}},htmlBuilder:A5,mathmlBuilder:j5});Sn({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}});Sn({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:A5,mathmlBuilder:j5});Sn({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var s=t[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:A5,mathmlBuilder:j5});Sn({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var Ine={};function Mh(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,l={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c<n.length;++c)Ine[n[c]]=l;i&&(ET[t]=i),o&&(AT[t]=o)}var Mne={};function se(e,t){Mne[e]=t}class cc{constructor(t,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=n,this.end=r}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new cc(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Xc{constructor(t,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=n}range(t,n){return new Xc(n,cc.range(this,t))}}function _H(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for(n==="\\relax"&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n==="\\hline"||n==="\\hdashline";)e.consume(),t.push(n==="\\hdashline"),e.consumeSpaces(),n=e.fetch().text;return t}var N5=e=>{var t=e.parser.settings;if(!t.displayMode)throw new qt("{"+e.envName+"} can be used only in display mode.")},kEe=new Set(["gather","gather*"]);function HD(e){if(!e.includes("ed"))return!e.includes("*")}function a0(e,t,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:o,colSeparationType:l,autoTag:c,singleRow:u,emptySingleRow:d,maxNumCols:f,leqno:m}=t;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!o){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)o=1;else if(o=parseFloat(p),!o||o<0)throw new qt("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],b=[g],w=[],y=[],v=c!=null?[]:void 0;function x(){c&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){v&&(e.gullet.macros.get("\\df@tag")?(v.push(e.subparse([new Xc("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):v.push(!!c&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),y.push(_H(e));;){var S=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var T={type:"ordgroup",mode:e.mode,body:S};n&&(T={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[T]}),g.push(T);var _=e.fetch().text;if(_==="&"){if(f&&g.length===f){if(u||l)throw new qt("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(_==="\\end"){k(),g.length===1&&T.type==="styling"&&T.body.length===1&&T.body[0].type==="ordgroup"&&T.body[0].body.length===0&&(b.length>1||!d)&&b.pop(),y.length<b.length+1&&y.push([]);break}else if(_==="\\\\"){e.consume();var C=void 0;e.gullet.future().text!==" "&&(C=e.parseSizeGroup(!0)),w.push(C?C.value:null),k(),y.push(_H(e)),g=[],b.push(g),x()}else throw new qt("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:s,arraystretch:o,body:b,cols:i,rowGaps:w,hskipBeforeAndAfter:r,hLinesBeforeRow:y,colSeparationType:l,tags:v,leqno:m}}function UD(e){return e.slice(0,1)==="d"?"display":"text"}var Rh=function(t,n){var r,s,i=t.body.length,o=t.hLinesBeforeRow,l=0,c=new Array(i),u=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),f=1/n.fontMetrics().ptPerEm,m=5*f;if(t.colSeparationType&&t.colSeparationType==="small"){var p=n.havingStyle(Cr.SCRIPT).sizeMultiplier;m=.2778*(p/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?io({number:3,unit:"ex"},n):12*f,b=3*f,w=t.arraystretch*g,y=.7*w,v=.3*w,x=0;function k(tt){for(var ut=0;ut<tt.length;++ut)ut>0&&(x+=.25),u.push({pos:x,isDashed:tt[ut]})}for(k(o[0]),r=0;r<t.body.length;++r){var S=t.body[r],T=y,_=v;l<S.length&&(l=S.length);var C={cells:new Array(S.length),height:0,depth:0,pos:0};for(s=0;s<S.length;++s){var j=Vs(S[s],n);_<j.depth&&(_=j.depth),T<j.height&&(T=j.height),C.cells[s]=j}var E=t.rowGaps[r],L=0;E&&(L=io(E,n),L>0&&(L+=v,_<L&&(_=L),L=0)),t.addJot&&r<t.body.length-1&&(_+=b),C.height=T,C.depth=_,x+=T,C.pos=x,x+=_+L,c[r]=C,k(o[r+1])}var D=x/2+n.fontMetrics().axisHeight,M=t.cols||[],R=[],$,B,N=[];if(t.tags&&t.tags.some(tt=>tt))for(r=0;r<i;++r){var z=c[r],G=z.pos-D,I=t.tags[r],Y=void 0;I===!0?Y=Pt(["eqn-num"],[],n):I===!1?Y=Pt([],[],n):Y=Pt([],pa(I,n,!0),n),Y.depth=z.depth,Y.height=z.height,N.push({type:"elem",elem:Y,shift:G})}for(s=0,B=0;s<l||B<M.length;++s,++B){for(var U,P=M[B],F=!0;((te=P)==null?void 0:te.type)==="separator";){var te;if(F||($=Pt(["arraycolsep"],[]),$.style.width=tn(n.fontMetrics().doubleRuleSep),R.push($)),P.separator==="|"||P.separator===":"){var W=P.separator==="|"?"solid":"dashed",K=Pt(["vertical-separator"],[],n);K.style.height=tn(x),K.style.borderRightWidth=tn(d),K.style.borderRightStyle=W,K.style.margin="0 "+tn(-d/2);var ce=x-D;ce&&(K.style.verticalAlign=tn(-ce)),R.push(K)}else throw new qt("Invalid separator type: "+P.separator);B++,P=M[B],F=!1}if(!(s>=l)){var ie=void 0;if(s>0||t.hskipBeforeAndAfter){var Z,ee;ie=(Z=(ee=P)==null?void 0:ee.pregap)!=null?Z:m,ie!==0&&($=Pt(["arraycolsep"],[]),$.style.width=tn(ie),R.push($))}var oe=[];for(r=0;r<i;++r){var we=c[r],pe=we.cells[s];if(pe){var he=we.pos-D;pe.depth=we.depth,pe.height=we.height,oe.push({type:"elem",elem:pe,shift:he})}}var X=Hs({positionType:"individualShift",children:oe}),ye=Pt(["col-align-"+(((U=P)==null?void 0:U.align)||"c")],[X]);if(R.push(ye),s<l-1||t.hskipBeforeAndAfter){var Ce,ae;ie=(Ce=(ae=P)==null?void 0:ae.postgap)!=null?Ce:m,ie!==0&&($=Pt(["arraycolsep"],[]),$.style.width=tn(ie),R.push($))}}}var me=Pt(["mtable"],R);if(u.length>0){for(var We=Ey("hline",n,d),Oe=Ey("hdashline",n,d),Mt=[{type:"elem",elem:me,shift:0}];u.length>0;){var $t=u.pop(),St=$t.pos-D;$t.isDashed?Mt.push({type:"elem",elem:Oe,shift:St}):Mt.push({type:"elem",elem:We,shift:St})}me=Hs({positionType:"individualShift",children:Mt})}if(N.length===0)return Pt(["mord"],[me],n);var ue=Hs({positionType:"individualShift",children:N}),Ee=Pt(["tag"],[ue],n);return am([me,Ee])},_Ee={c:"center ",l:"left ",r:"right "},Dh=function(t,n){for(var r=[],s=new Wt("mtd",[],["mtr-glue"]),i=new Wt("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var l=t.body[o],c=[],u=0;u<l.length;u++)c.push(new Wt("mtd",[_i(l[u],n)]));t.tags&&t.tags[o]&&(c.unshift(s),c.push(s),t.leqno?c.unshift(i):c.push(i)),r.push(new Wt("mtr",c))}var d=new Wt("mtable",r),f=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",tn(f));var m="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,b="",w=!1,y=0,v=g.length;g[0].type==="separator"&&(m+="top ",y=1),g[g.length-1].type==="separator"&&(m+="bottom ",v-=1);for(var x=y;x<v;x++){var k=g[x];k.type==="align"?(p+=_Ee[k.align],w&&(b+="none "),w=!0):k.type==="separator"&&w&&(b+=k.separator==="|"?"solid ":"dashed ",w=!1)}d.setAttribute("columnalign",p.trim()),/[sd]/.test(b)&&d.setAttribute("columnlines",b.trim())}if(t.colSeparationType==="align"){for(var S=t.cols||[],T="",_=1;_<S.length;_++)T+=_%2?"0em ":"1em ";d.setAttribute("columnspacing",T.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?d.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?d.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?d.setAttribute("columnspacing","0.5em"):d.setAttribute("columnspacing","1em");var C="",j=t.hLinesBeforeRow;m+=j[0].length>0?"left ":"",m+=j[j.length-1].length>0?"right ":"";for(var E=1;E<j.length-1;E++)C+=j[E].length===0?"none ":j[E][0]?"dashed ":"solid ";return/[sd]/.test(C)&&d.setAttribute("rowlines",C.trim()),m!==""&&(d=new Wt("menclose",[d]),d.setAttribute("notation",m.trim())),t.arraystretch&&t.arraystretch<1&&(d=new Wt("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},Rne=function(t,n){t.envName.includes("ed")||N5(t);var r=[],s=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=a0(t.parser,{cols:r,addJot:!0,autoTag:i?void 0:HD(t.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),l=0,c=0,u={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",f=0;f<n[0].body.length;f++){var m=Br(n[0].body[f],"textord");d+=m.text}l=Number(d),c=l*2}var p=!c;o.body.forEach(function(y){for(var v=1;v<y.length;v+=2){var x=Br(y[v],"styling"),k=Br(x.body[0],"ordgroup");k.body.unshift(u)}if(p)c<y.length&&(c=y.length);else{var S=y.length/2;if(l<S)throw new qt("Too many math in a row: "+("expected "+l+", but got "+S),y[0])}});for(var g=0;g<c;++g){var b="r",w=0;g%2===1?b="l":g>0&&p&&(w=1),r[g]={type:"align",align:b,pregap:w,postgap:0}}return o.colSeparationType=p?"align":"alignat",o};Mh({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=C5(t[0]),r=n?[t[0]]:Br(t[0],"ordgroup").body,s=r.map(function(o){var l=S5(o),c=l.text;if("lcr".includes(c))return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new qt("Unknown column alignment: "+c,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return a0(e.parser,i,UD(e.envName))},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var s=e.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,!"lcr".includes(n))throw new qt("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=a0(e.parser,r,UD(e.envName)),o=Math.max(0,...i.body.map(l=>l.length));return i.cols=new Array(o).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=a0(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=C5(t[0]),r=n?[t[0]]:Br(t[0],"ordgroup").body,s=r.map(function(l){var c=S5(l),u=c.text;if("lc".includes(u))return{type:"align",align:u};throw new qt("Unknown column alignment: "+u,l)});if(s.length>1)throw new qt("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=a0(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new qt("{subarray} can contain only one column");return o},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=a0(e.parser,t,UD(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Rne,htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){kEe.has(e.envName)&&N5(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:HD(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return a0(e.parser,t,"display")},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Rne,htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){N5(e);var t={autoTag:HD(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return a0(e.parser,t,"display")},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["CD"],props:{numArgs:0},handler(e){return N5(e),uEe(e.parser)},htmlBuilder:Rh,mathmlBuilder:Dh});se("\\nonumber","\\gdef\\@eqnsw{0}");se("\\notag","\\nonumber");Sn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new qt(e.funcName+" valid only within array environment")}});var SH=Ine;Sn({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];if(s.type!=="ordgroup")throw new qt("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=Br(s.body[o],"textord").text;if(r==="\\begin"){if(!SH.hasOwnProperty(i))throw new qt("No such environment: "+i,s);var l=SH[i],{args:c,optArgs:u}=n.parseArguments("\\begin{"+i+"}",l),d={mode:n.mode,envName:i,parser:n},f=l.handler(d,c,u);n.expect("\\end",!1);var m=n.nextToken,p=Br(n.parseFunction(),"environment");if(p.name!==i)throw new qt("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",m);return f}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var Dne=(e,t)=>{var n=e.font,r=t.withFont(n);return Vs(e.body,r)},Lne=(e,t)=>{var n=e.font,r=t.withFont(n);return _i(e.body,r)},CH={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};Sn({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=jT(t[0]),i=r;return i in CH&&(i=CH[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:Dne,mathmlBuilder:Lne});Sn({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:T5(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:im(r)}}});Sn({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:s}=e,{mode:i}=n,o=n.parseExpression(!0,s);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:Dne,mathmlBuilder:Lne});var SEe=(e,t)=>{var n=t.style,r=n.fracNum(),s=n.fracDen(),i;i=t.havingStyle(r);var o=Vs(e.numer,i,t);if(e.continued){var l=8.5/t.fontMetrics().ptPerEm,c=3.5/t.fontMetrics().ptPerEm;o.height=o.height<l?l:o.height,o.depth=o.depth<c?c:o.depth}i=t.havingStyle(s);var u=Vs(e.denom,i,t),d,f,m;e.hasBarLine?(e.barSize?(f=io(e.barSize,t),d=Ey("frac-line",t,f)):d=Ey("frac-line",t),f=d.height,m=d.height):(d=null,f=0,m=t.fontMetrics().defaultRuleThickness);var p,g,b;n.size===Cr.DISPLAY.size?(p=t.fontMetrics().num1,f>0?g=3*m:g=7*m,b=t.fontMetrics().denom1):(f>0?(p=t.fontMetrics().num2,g=m):(p=t.fontMetrics().num3,g=3*m),b=t.fontMetrics().denom2);var w;if(d){var v=t.fontMetrics().axisHeight;p-o.depth-(v+.5*f)<g&&(p+=g-(p-o.depth-(v+.5*f))),v-.5*f-(u.height-b)<g&&(b+=g-(v-.5*f-(u.height-b)));var x=-(v-.5*f);w=Hs({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:d,shift:x},{type:"elem",elem:o,shift:-p}]})}else{var y=p-o.depth-(u.height-b);y<g&&(p+=.5*(g-y),b+=.5*(g-y)),w=Hs({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:o,shift:-p}]})}i=t.havingStyle(n),w.height*=i.sizeMultiplier/t.sizeMultiplier,w.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===Cr.DISPLAY.size?k=t.fontMetrics().delim1:n.size===Cr.SCRIPTSCRIPT.size?k=t.havingStyle(Cr.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var S,T;return e.leftDelim==null?S=kk(t,["mopen"]):S=wI(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?T=Pt([]):e.rightDelim==null?T=kk(t,["mclose"]):T=wI(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),Pt(["mord"].concat(i.sizingClasses(t)),[S,Pt(["mfrac"],[w]),T],t)},CEe=(e,t)=>{var n=new Wt("mfrac",[_i(e.numer,t),_i(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var r=io(e.barSize,t);n.setAttribute("linethickness",tn(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new Wt("mo",[new Go(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(n),e.rightDelim!=null){var o=new Wt("mo",[new Go(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return BD(s)}return n},Pne=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};Sn({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=t[1],o,l=null,c=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,l="(",c=")";break;case"\\\\bracefrac":o=!1,l="\\{",c="\\}";break;case"\\\\brackfrac":o=!1,l="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}var u=r==="\\cfrac",d=null;return u||r.startsWith("\\d")?d="display":r.startsWith("\\t")&&(d="text"),Pne({type:"genfrac",mode:n.mode,numer:s,denom:i,continued:u,hasBarLine:o,leftDelim:l,rightDelim:c,barSize:null},d)},htmlBuilder:SEe,mathmlBuilder:CEe});Sn({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:r}=e,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:s,token:r}}});var TH=["display","text","script","scriptscript"],EH=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};Sn({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,r=t[4],s=t[5],i=jT(t[0]),o=i.type==="atom"&&i.family==="open"?EH(i.text):null,l=jT(t[1]),c=l.type==="atom"&&l.family==="close"?EH(l.text):null,u=Br(t[2],"size"),d,f=null;u.isBlank?d=!0:(f=u.value,d=f.number>0);var m=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=Br(p.body[0],"textord");m=TH[Number(g.text)]}}else p=Br(p,"textord"),m=TH[Number(p.text)];return Pne({type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:d,barSize:f,leftDelim:o,rightDelim:c},m)}});Sn({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:r,token:s}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Br(t[0],"size").value,token:s}}});Sn({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=Br(t[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=t[2],l=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:o,continued:!1,hasBarLine:l,barSize:i,leftDelim:null,rightDelim:null}}});var One=(e,t)=>{var n=t.style,r,s;e.type==="supsub"?(r=e.sup?Vs(e.sup,t.havingStyle(n.sup()),t):Vs(e.sub,t.havingStyle(n.sub()),t),s=Br(e.base,"horizBrace")):s=Br(e,"horizBrace");var i=Vs(s.base,t.havingBaseStyle(Cr.DISPLAY)),o=_5(s,t),l;if(s.isOver?l=Hs({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):l=Hs({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),r){var c=Pt(["minner",s.isOver?"mover":"munder"],[l],t);s.isOver?l=Hs({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]}):l=Hs({positionType:"bottom",positionData:c.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:c}]})}return Pt(["minner",s.isOver?"mover":"munder"],[l],t)},TEe=(e,t)=>{var n=k5(e.label);return new Wt(e.isOver?"mover":"munder",[_i(e.base,t),n])};Sn({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:r.includes("\\over"),base:t[0]}},htmlBuilder:One,mathmlBuilder:TEe});Sn({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],s=Br(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:Vo(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=pa(e.body,t,!1);return B8e(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Lp(e.body,t);return n instanceof Wt||(n=new Wt("mrow",[n])),n.setAttribute("href",e.href),n}});Sn({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=Br(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<r.length;i++){var o=r[i];o==="~"&&(o="\\textasciitilde"),s.push({type:"textord",mode:"text",text:o})}var l={type:"text",mode:n.mode,font:"\\texttt",body:s};return{type:"href",mode:n.mode,href:r,body:Vo(l)}}});Sn({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:Vo(t[0])}},htmlBuilder(e,t){var n=pa(e.body,t.withFont(""),!1);return am(n)},mathmlBuilder(e,t){return new Wt("mrow",iu(e.body,t.withFont("")))}});Sn({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,token:s}=e,i=Br(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,c={};switch(r){case"\\htmlClass":c.class=i,l={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,l={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,l={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var u=i.split(","),d=0;d<u.length;d++){var f=u[d],m=f.indexOf("=");if(m<0)throw new qt("\\htmlData key/value '"+f+"' missing equals sign");var p=f.slice(0,m),g=f.slice(m+1);c["data-"+p.trim()]=g}l={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(l)?{type:"html",mode:n.mode,attributes:c,body:Vo(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=pa(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=Pt(r,n,t);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&s.setAttribute(i,e.attributes[i]);return s},mathmlBuilder:(e,t)=>Lp(e.body,t)});Sn({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:Vo(t[0]),mathml:Vo(t[1])}},htmlBuilder:(e,t)=>{var n=pa(e.html,t,!1);return am(n)},mathmlBuilder:(e,t)=>Lp(e.mathml,t)});var AA=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!n)throw new qt("Invalid size: '"+t+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!Zte(r))throw new qt("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Sn({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:r}=e,s={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},l="";if(n[0])for(var c=Br(n[0],"raw").string,u=c.split(","),d=0;d<u.length;d++){var f=u[d].split("=");if(f.length===2){var m=f[1].trim();switch(f[0].trim()){case"alt":l=m;break;case"width":s=AA(m);break;case"height":i=AA(m);break;case"totalheight":o=AA(m);break;default:throw new qt("Invalid key: '"+f[0]+"' in \\includegraphics.")}}}var p=Br(t[0],"url").url;return l===""&&(l=p,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:r.mode,alt:l,width:s,height:i,totalheight:o,src:p}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=io(e.height,t),r=0;e.totalheight.number>0&&(r=io(e.totalheight,t)-n);var s=0;e.width.number>0&&(s=io(e.width,t));var i={height:tn(n+r)};s>0&&(i.width=tn(s)),r>0&&(i.verticalAlign=tn(-r));var o=new A8e(e.src,e.alt,i);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new Wt("mglyph",[]);n.setAttribute("alt",e.alt);var r=io(e.height,t),s=0;if(e.totalheight.number>0&&(s=io(e.totalheight,t)-r,n.setAttribute("valign",tn(-s))),n.setAttribute("height",tn(r+s)),e.width.number>0){var i=io(e.width,t);n.setAttribute("width",tn(i))}return n.setAttribute("src",e.src),n}});Sn({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,s=Br(t[0],"size");if(n.settings.strict){var i=r[1]==="m",o=s.value.unit==="mu";i?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(e,t){return one(e.dimension,t)},mathmlBuilder(e,t){var n=io(e.dimension,t);return new hne(n)}});Sn({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=Pt([],[Vs(e.body,t)]),n=Pt(["inner"],[n],t)):n=Pt(["inner"],[Vs(e.body,t)]);var r=Pt(["fix"],[]),s=Pt([e.alignment],[n,r],t),i=Pt(["strut"]);return i.style.height=tn(s.height+s.depth),s.depth&&(i.style.verticalAlign=tn(-s.depth)),s.children.unshift(i),s=Pt(["thinbox"],[s],t),Pt(["mord","vbox"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Wt("mpadded",[_i(e.body,t)]);if(e.alignment!=="rlap"){var r=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Sn({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",o=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:o}}});Sn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new qt("Mismatched "+e.funcName)}});var AH=(e,t)=>{switch(t.style.size){case Cr.DISPLAY.size:return e.display;case Cr.TEXT.size:return e.text;case Cr.SCRIPT.size:return e.script;case Cr.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Sn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Vo(t[0]),text:Vo(t[1]),script:Vo(t[2]),scriptscript:Vo(t[3])}},htmlBuilder:(e,t)=>{var n=AH(e,t),r=pa(n,t,!1);return am(r)},mathmlBuilder:(e,t)=>{var n=AH(e,t);return Lp(n,t)}});var $ne=(e,t,n,r,s,i,o)=>{e=Pt([],[e]);var l=n&&im(n),c,u;if(t){var d=Vs(t,r.havingStyle(s.sup()),r);u={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var f=Vs(n,r.havingStyle(s.sub()),r);c={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-f.height)}}var m;if(u&&c){var p=r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+e.depth+o;m=Hs({positionType:"bottom",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:tn(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:tn(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(c){var g=e.height-o;m=Hs({positionType:"top",positionData:g,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:tn(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e}]})}else if(u){var b=e.depth+o;m=Hs({positionType:"bottom",positionData:b,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:tn(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var w=[m];if(c&&i!==0&&!l){var y=Pt(["mspace"],[],r);y.style.marginRight=tn(i),w.unshift(y)}return Pt(["mop","op-limits"],w,r)},Bne=new Set(["\\smallint"]),bv=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=Br(e.base,"op"),s=!0):i=Br(e,"op");var o=t.style,l=!1;o.size===Cr.DISPLAY.size&&i.symbol&&!Bne.has(i.name)&&(l=!0);var c,u;if(i.symbol){var d=l?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),c=$l(i.name,d,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),u=c.italic,f.length>0){var m=lne(f+"Size"+(l?"2":"1"),t);c=Hs({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:m,shift:l?.08:0}]}),i.name="\\"+f,c.classes.unshift("mop"),c.italic=u}}else if(i.body){var p=pa(i.body,t,!0);p.length===1&&p[0]instanceof nu?(c=p[0],c.classes[0]="mop"):c=Pt(["mop"],p,t)}else{for(var g=[],b=1;b<i.name.length;b++)g.push(OD(i.name[b],i.mode,t));c=Pt(["mop"],g,t)}var w=0,y=0;if((c instanceof nu||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var v;w=(c.height-c.depth)/2-t.fontMetrics().axisHeight,y=(v=c.italic)!=null?v:0}return s?$ne(c,n,r,t,o,y,w):(w&&(c.style.position="relative",c.style.top=tn(w)),c)},C_=(e,t)=>{var n;if(e.symbol)n=new Wt("mo",[Fu(e.name,e.mode)]),Bne.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Wt("mo",iu(e.body,t));else{n=new Wt("mi",[new Go(e.name.slice(1))]);var r=new Wt("mo",[Fu("⁡","text")]);e.parentIsSupSub?n=new Wt("mrow",[n,r]):n=dne([n,r])}return n},EEe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Sn({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=r;return s.length===1&&(s=EEe[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:bv,mathmlBuilder:C_});Sn({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Vo(r)}},htmlBuilder:bv,mathmlBuilder:C_});var AEe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Sn({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:bv,mathmlBuilder:C_});Sn({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:bv,mathmlBuilder:C_});Sn({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,r=n;return r.length===1&&(r=AEe[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:bv,mathmlBuilder:C_});var zne=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=Br(e.base,"operatorname"),s=!0):i=Br(e,"operatorname");var o;if(i.body.length>0){for(var l=i.body.map(f=>{var m="text"in f?f.text:void 0;return typeof m=="string"?{type:"textord",mode:f.mode,text:m}:f}),c=pa(l,t.withFont("mathrm"),!0),u=0;u<c.length;u++){var d=c[u];d instanceof nu&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Pt(["mop"],c,t)}else o=Pt(["mop"],[],t);return s?$ne(o,n,r,t,t.style,0,0):o},jEe=(e,t)=>{for(var n=iu(e.body,t.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof hne))if(i instanceof Wt)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var o=i.children[0];i.children.length===1&&o instanceof Go?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var l=n.map(d=>d.toText()).join("");n=[new Go(l)]}var c=new Wt("mi",n);c.setAttribute("mathvariant","normal");var u=new Wt("mo",[Fu("⁡","text")]);return e.parentIsSupSub?new Wt("mrow",[c,u]):dne([c,u])};Sn({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"operatorname",mode:n.mode,body:Vo(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:zne,mathmlBuilder:jEe});se("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");c1({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?am(pa(e.body,t,!1)):Pt(["mord"],pa(e.body,t,!0),t)},mathmlBuilder(e,t){return Lp(e.body,t,!0)}});Sn({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=Vs(e.body,t.havingCrampedStyle()),r=Ey("overline-line",t),s=t.fontMetrics().defaultRuleThickness,i=Hs({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return Pt(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Wt("mo",[new Go("‾")]);n.setAttribute("stretchy","true");var r=new Wt("mover",[_i(e.body,t),n]);return r.setAttribute("accent","true"),r}});Sn({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:Vo(r)}},htmlBuilder:(e,t)=>{var n=pa(e.body,t.withPhantom(),!1);return am(n)},mathmlBuilder:(e,t)=>{var n=iu(e.body,t);return new Wt("mphantom",n)}});se("\\hphantom","\\smash{\\phantom{#1}}");Sn({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=Pt(["inner"],[Vs(e.body,t.withPhantom())]),r=Pt(["fix"],[]);return Pt(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=iu(Vo(e.body),t),r=new Wt("mphantom",n),s=new Wt("mpadded",[r]);return s.setAttribute("width","0px"),s}});Sn({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=Br(t[0],"size").value,s=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(e,t){var n=Vs(e.body,t),r=io(e.dy,t);return Hs({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Wt("mpadded",[_i(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});Sn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Sn({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,s=n[0],i=Br(t[0],"size"),o=Br(t[1],"size");return{type:"rule",mode:r.mode,shift:s&&Br(s,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=Pt(["mord","rule"],[],t),r=io(e.width,t),s=io(e.height,t),i=e.shift?io(e.shift,t):0;return n.style.borderRightWidth=tn(r),n.style.borderTopWidth=tn(s),n.style.bottom=tn(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=io(e.width,t),r=io(e.height,t),s=e.shift?io(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Wt("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",tn(n)),o.setAttribute("height",tn(r));var l=new Wt("mpadded",[o]);return s>=0?l.setAttribute("height",tn(s)):(l.setAttribute("height",tn(s)),l.setAttribute("depth",tn(-s))),l.setAttribute("voffset",tn(s)),l}});function Fne(e,t,n){for(var r=pa(e,t,!1),s=t.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var o=r[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[i].classes,t.sizingClasses(n)):r[i].classes[o+1]==="reset-size"+t.size&&(r[i].classes[o+1]="reset-size"+n.size),r[i].height*=s,r[i].depth*=s}return am(r)}var jH=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],NEe=(e,t)=>{var n=t.havingSize(e.size);return Fne(e.body,n,t)};Sn({type:"sizing",names:jH,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:s}=e,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:jH.indexOf(r)+1,body:i}},htmlBuilder:NEe,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=iu(e.body,n),s=new Wt("mstyle",r);return s.setAttribute("mathsize",tn(n.sizeMultiplier)),s}});Sn({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,s=!1,i=!1,o=n[0]&&Br(n[0],"ordgroup");if(o)for(var l,c=0;c<o.body.length;++c){var u=o.body[c];if(l=S5(u).text,l==="t")s=!0;else if(l==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var d=t[0];return{type:"smash",mode:r.mode,body:d,smashHeight:s,smashDepth:i}},htmlBuilder:(e,t)=>{var n=Pt([],[Vs(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0),e.smashDepth&&(n.depth=0),e.smashHeight&&e.smashDepth)return Pt(["mord","smash"],[n],t);if(n.children)for(var r=0;r<n.children.length;r++)e.smashHeight&&(n.children[r].height=0),e.smashDepth&&(n.children[r].depth=0);var s=Hs({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Pt(["mord"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Wt("mpadded",[_i(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});Sn({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r}=e,s=n[0],i=t[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(e,t){var n=Vs(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=Ay(n,t);var r=t.fontMetrics(),s=r.defaultRuleThickness,i=s;t.style.id<Cr.TEXT.id&&(i=t.fontMetrics().xHeight);var o=s+i/4,l=n.height+n.depth+o+s,{span:c,ruleWidth:u,advanceWidth:d}=gEe(l,t),f=c.height-u;f>n.height+n.depth+o&&(o=(o+f-n.height-n.depth)/2);var m=c.height-n.height-o-u;n.style.paddingLeft=tn(d);var p=Hs({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+m)},{type:"elem",elem:c},{type:"kern",size:u}]});if(e.index){var g=t.havingStyle(Cr.SCRIPTSCRIPT),b=Vs(e.index,g,t),w=.6*(p.height-p.depth),y=Hs({positionType:"shift",positionData:-w,children:[{type:"elem",elem:b}]}),v=Pt(["root"],[y]);return Pt(["mord","sqrt"],[v,p],t)}else return Pt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new Wt("mroot",[_i(n,t),_i(r,t)]):new Wt("msqrt",[_i(n,t)])}});var xI={display:Cr.DISPLAY,text:Cr.TEXT,script:Cr.SCRIPT,scriptscript:Cr.SCRIPTSCRIPT};function IEe(e){return e in xI}Sn({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:s}=e,i=s.parseExpression(!0,n),o=r.slice(1,r.length-5);if(!IEe(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(e,t){var n=xI[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),Fne(e.body,r,t)},mathmlBuilder(e,t){var n=xI[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var s=iu(e.body,r),i=new Wt("mstyle",s),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=o[e.style];return i.setAttribute("scriptlevel",l[0]),i.setAttribute("displaystyle",l[1]),i}});var MEe=function(t,n){var r=t.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===Cr.DISPLAY.size||r.alwaysHandleSupSub);return s?bv:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===Cr.DISPLAY.size||r.limits);return i?zne:null}else{if(r.type==="accent")return im(r.base)?FD:null;if(r.type==="horizBrace"){var o=!t.sub;return o===r.isOver?One:null}else return null}else return null};c1({type:"supsub",htmlBuilder(e,t){var n=MEe(e,t);if(n)return n(e,t);var{base:r,sup:s,sub:i}=e,o=Vs(r,t),l,c,u=t.fontMetrics(),d=0,f=0,m=r&&im(r);if(s){var p=t.havingStyle(t.style.sup());l=Vs(s,p,t),m||(d=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());c=Vs(i,g,t),m||(f=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var b;t.style===Cr.DISPLAY?b=u.sup1:t.style.cramped?b=u.sup3:b=u.sup2;var w=t.sizeMultiplier,y=tn(.5/u.ptPerEm/w),v=null;if(c){var x=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof nu||x){var k;v=tn(-((k=o.italic)!=null?k:0))}}var S;if(l&&c){d=Math.max(d,b,l.depth+.25*u.xHeight),f=Math.max(f,u.sub2);var T=u.defaultRuleThickness,_=4*T;if(d-l.depth-(c.height-f)<_){f=_-(d-l.depth)+c.height;var C=.8*u.xHeight-(d-l.depth);C>0&&(d+=C,f-=C)}var j=[{type:"elem",elem:c,shift:f,marginRight:y,marginLeft:v},{type:"elem",elem:l,shift:-d,marginRight:y}];S=Hs({positionType:"individualShift",children:j})}else if(c){f=Math.max(f,u.sub1,c.height-.8*u.xHeight);var E=[{type:"elem",elem:c,marginLeft:v,marginRight:y}];S=Hs({positionType:"shift",positionData:f,children:E})}else if(l)d=Math.max(d,b,l.depth+.25*u.xHeight),S=Hs({positionType:"shift",positionData:-d,children:[{type:"elem",elem:l,marginRight:y}]});else throw new Error("supsub must have either sup or sub.");var L=gI(o,"right")||"mord";return Pt([L],[o,Pt(["msupsub"],[S])],t)},mathmlBuilder(e,t){var n=!1,r,s;e.base&&e.base.type==="horizBrace"&&(s=!!e.sup,s===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[_i(e.base,t)];e.sub&&i.push(_i(e.sub,t)),e.sup&&i.push(_i(e.sup,t));var o;if(n)o=r?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===Cr.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===Cr.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var c=e.base;c&&c.type==="op"&&c.limits&&(t.style===Cr.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||t.style===Cr.DISPLAY)?o="munder":o="msub"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===Cr.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===Cr.DISPLAY)?o="mover":o="msup"}return new Wt(o,i)}});c1({type:"atom",htmlBuilder(e,t){return OD(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Wt("mo",[Fu(e.text,e.mode)]);if(e.family==="bin"){var r=zD(e,t);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var qne={mi:"italic",mn:"normal",mtext:"normal"};c1({type:"mathord",htmlBuilder(e,t){return x5(e,t,"mathord")},mathmlBuilder(e,t){var n=new Wt("mi",[Fu(e.text,e.mode,t)]),r=zD(e,t)||"italic";return r!==qne[n.type]&&n.setAttribute("mathvariant",r),n}});c1({type:"textord",htmlBuilder(e,t){return x5(e,t,"textord")},mathmlBuilder(e,t){var n=Fu(e.text,e.mode,t),r=zD(e,t)||"normal",s;return e.mode==="text"?s=new Wt("mtext",[n]):/[0-9]/.test(e.text)?s=new Wt("mn",[n]):e.text==="\\prime"?s=new Wt("mo",[n]):s=new Wt("mi",[n]),r!==qne[s.type]&&s.setAttribute("mathvariant",r),s}});var jA={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},NA={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};c1({type:"spacing",htmlBuilder(e,t){if(NA.hasOwnProperty(e.text)){var n=NA[e.text].className||"";if(e.mode==="text"){var r=x5(e,t,"textord");return r.classes.push(n),r}else return Pt(["mspace",n],[OD(e.text,e.mode,t)],t)}else{if(jA.hasOwnProperty(e.text))return Pt(["mspace",jA[e.text]],[],t);throw new qt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(NA.hasOwnProperty(e.text))n=new Wt("mtext",[new Go(" ")]);else{if(jA.hasOwnProperty(e.text))return new Wt("mspace");throw new qt('Unknown type of space "'+e.text+'"')}return n}});var NH=()=>{var e=new Wt("mtd",[]);return e.setAttribute("width","50%"),e};c1({type:"tag",mathmlBuilder(e,t){var n=new Wt("mtable",[new Wt("mtr",[NH(),new Wt("mtd",[Lp(e.body,t)]),NH(),new Wt("mtd",[Lp(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var IH={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},MH={"\\textbf":"textbf","\\textmd":"textmd"},REe={"\\textit":"textit","\\textup":"textup"},RH=(e,t)=>{var n=e.font;if(n){if(IH[n])return t.withTextFontFamily(IH[n]);if(MH[n])return t.withTextFontWeight(MH[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(REe[n])};Sn({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"text",mode:n.mode,body:Vo(s),font:r}},htmlBuilder(e,t){var n=RH(e,t),r=pa(e.body,n,!0);return Pt(["mord","text"],r,n)},mathmlBuilder(e,t){var n=RH(e,t);return Lp(e.body,n)}});Sn({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Vs(e.body,t),r=Ey("underline-line",t),s=t.fontMetrics().defaultRuleThickness,i=Hs({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]});return Pt(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Wt("mo",[new Go("‾")]);n.setAttribute("stretchy","true");var r=new Wt("munder",[_i(e.body,t),n]);return r.setAttribute("accentunder","true"),r}});Sn({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Vs(e.body,t),r=t.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return Hs({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Wt("mpadded",[_i(e.body,t)],["vcenter"]);return new Wt("mrow",[n])}});Sn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new qt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=DH(e),r=[],s=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),r.push($l(o,"Typewriter-Regular",e.mode,s,["mord","texttt"]))}return Pt(["mord","text"].concat(s.sizingClasses(t)),ine(r),s)},mathmlBuilder(e,t){var n=new Go(DH(e)),r=new Wt("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var DH=e=>e.body.replace(/ /g,e.star?"␣":" "),np=cne,Hne=`[ \r
	]`,DEe="\\\\[a-zA-Z@]+",LEe="\\\\[^\uD800-\uDFFF]",PEe="("+DEe+")"+Hne+"*",OEe=`\\\\(
|[ \r	]+
?)[ \r	]*`,kI="[̀-ͯ]",$Ee=new RegExp(kI+"+$"),BEe="("+Hne+"+)|"+(OEe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(kI+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(kI+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+PEe)+("|"+LEe+")");class LH{constructor(t,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=n,this.tokenRegex=new RegExp(BEe,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){var t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new Xc("EOF",new cc(this,n,n));var r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new qt("Unexpected character: '"+t[n]+"'",new Xc(t[n],new cc(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=t.indexOf(`
`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Xc(s,new cc(this,n,this.tokenRegex.lastIndex))}}class zEe{constructor(t,n){t===void 0&&(t={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new qt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s<this.undefStack.length;s++)delete this.undefStack[s][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(t)&&(i[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var FEe=Mne;se("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});se("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});se("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});se("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});se("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});se("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");se("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var PH={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};se("\\char",function(e){var t=e.popToken(),n,r=0;if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")r=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new qt("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){if(r=PH[t.text],r==null||r>=n)throw new qt("Invalid base-"+n+" digit "+t.text);for(var s;(s=PH[e.future().text])!=null&&s<n;)r*=n,r+=s,e.popToken()}return"\\@char{"+r+"}"});var WD=(e,t,n,r)=>{var s=e.consumeArg().tokens;if(s.length!==1)throw new qt("\\newcommand's first argument must be a macro name");var i=s[0].text,o=e.isDefined(i);if(o&&!t)throw new qt("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new qt("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var l=0;if(s=e.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)c+=u.text,u=e.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new qt("Invalid number of arguments: "+c);l=parseInt(c),s=e.consumeArg().tokens}return o&&r||e.macros.set(i,{tokens:s,numArgs:l}),""};se("\\newcommand",e=>WD(e,!1,!0,!1));se("\\renewcommand",e=>WD(e,!0,!1,!1));se("\\providecommand",e=>WD(e,!0,!0,!0));se("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});se("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});se("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),np[n],Hi.math[n],Hi.text[n]),""});se("\\bgroup","{");se("\\egroup","}");se("~","\\nobreakspace");se("\\lq","`");se("\\rq","'");se("\\aa","\\r a");se("\\AA","\\r A");se("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");se("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");se("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");se("ℬ","\\mathscr{B}");se("ℰ","\\mathscr{E}");se("ℱ","\\mathscr{F}");se("ℋ","\\mathscr{H}");se("ℐ","\\mathscr{I}");se("ℒ","\\mathscr{L}");se("ℳ","\\mathscr{M}");se("ℛ","\\mathscr{R}");se("ℭ","\\mathfrak{C}");se("ℌ","\\mathfrak{H}");se("ℨ","\\mathfrak{Z}");se("\\Bbbk","\\Bbb{k}");se("\\llap","\\mathllap{\\textrm{#1}}");se("\\rlap","\\mathrlap{\\textrm{#1}}");se("\\clap","\\mathclap{\\textrm{#1}}");se("\\mathstrut","\\vphantom{(}");se("\\underbar","\\underline{\\text{#1}}");se("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');se("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");se("\\ne","\\neq");se("≠","\\neq");se("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");se("∉","\\notin");se("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");se("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");se("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");se("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");se("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");se("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");se("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");se("⟂","\\perp");se("‼","\\mathclose{!\\mkern-0.8mu!}");se("∌","\\notni");se("⌜","\\ulcorner");se("⌝","\\urcorner");se("⌞","\\llcorner");se("⌟","\\lrcorner");se("©","\\copyright");se("®","\\textregistered");se("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');se("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');se("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');se("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');se("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");se("⋮","\\vdots");se("\\varGamma","\\mathit{\\Gamma}");se("\\varDelta","\\mathit{\\Delta}");se("\\varTheta","\\mathit{\\Theta}");se("\\varLambda","\\mathit{\\Lambda}");se("\\varXi","\\mathit{\\Xi}");se("\\varPi","\\mathit{\\Pi}");se("\\varSigma","\\mathit{\\Sigma}");se("\\varUpsilon","\\mathit{\\Upsilon}");se("\\varPhi","\\mathit{\\Phi}");se("\\varPsi","\\mathit{\\Psi}");se("\\varOmega","\\mathit{\\Omega}");se("\\substack","\\begin{subarray}{c}#1\\end{subarray}");se("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");se("\\boxed","\\fbox{$\\displaystyle{#1}$}");se("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");se("\\implies","\\DOTSB\\;\\Longrightarrow\\;");se("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");se("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");se("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var OH={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},qEe=new Set(["bin","rel"]);se("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in OH?t=OH[n]:(n.slice(0,4)==="\\not"||n in Hi.math&&qEe.has(Hi.math[n].group))&&(t="\\dotsb"),t});var VD={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};se("\\dotso",function(e){var t=e.future().text;return t in VD?"\\ldots\\,":"\\ldots"});se("\\dotsc",function(e){var t=e.future().text;return t in VD&&t!==","?"\\ldots\\,":"\\ldots"});se("\\cdots",function(e){var t=e.future().text;return t in VD?"\\@cdots\\,":"\\@cdots"});se("\\dotsb","\\cdots");se("\\dotsm","\\cdots");se("\\dotsi","\\!\\cdots");se("\\dotsx","\\ldots\\,");se("\\DOTSI","\\relax");se("\\DOTSB","\\relax");se("\\DOTSX","\\relax");se("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");se("\\,","\\tmspace+{3mu}{.1667em}");se("\\thinspace","\\,");se("\\>","\\mskip{4mu}");se("\\:","\\tmspace+{4mu}{.2222em}");se("\\medspace","\\:");se("\\;","\\tmspace+{5mu}{.2777em}");se("\\thickspace","\\;");se("\\!","\\tmspace-{3mu}{.1667em}");se("\\negthinspace","\\!");se("\\negmedspace","\\tmspace-{4mu}{.2222em}");se("\\negthickspace","\\tmspace-{5mu}{.277em}");se("\\enspace","\\kern.5em ");se("\\enskip","\\hskip.5em\\relax");se("\\quad","\\hskip1em\\relax");se("\\qquad","\\hskip2em\\relax");se("\\tag","\\@ifstar\\tag@literal\\tag@paren");se("\\tag@paren","\\tag@literal{({#1})}");se("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new qt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});se("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");se("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");se("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");se("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");se("\\newline","\\\\\\relax");se("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Une=tn(dh["Main-Regular"][84][1]-.7*dh["Main-Regular"][65][1]);se("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Une+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");se("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Une+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");se("\\hspace","\\@ifstar\\@hspacer\\@hspace");se("\\@hspace","\\hskip #1\\relax");se("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");se("\\ordinarycolon",":");se("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");se("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');se("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');se("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');se("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');se("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');se("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');se("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');se("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');se("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');se("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');se("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');se("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');se("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');se("∷","\\dblcolon");se("∹","\\eqcolon");se("≔","\\coloneqq");se("≕","\\eqqcolon");se("⩴","\\Coloneqq");se("\\ratio","\\vcentcolon");se("\\coloncolon","\\dblcolon");se("\\colonequals","\\coloneqq");se("\\coloncolonequals","\\Coloneqq");se("\\equalscolon","\\eqqcolon");se("\\equalscoloncolon","\\Eqqcolon");se("\\colonminus","\\coloneq");se("\\coloncolonminus","\\Coloneq");se("\\minuscolon","\\eqcolon");se("\\minuscoloncolon","\\Eqcolon");se("\\coloncolonapprox","\\Colonapprox");se("\\coloncolonsim","\\Colonsim");se("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");se("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");se("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");se("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");se("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");se("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");se("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");se("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");se("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");se("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");se("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");se("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");se("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");se("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");se("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");se("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");se("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");se("\\nleqq","\\html@mathml{\\@nleqq}{≰}");se("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");se("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");se("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");se("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");se("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");se("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");se("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");se("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");se("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");se("\\imath","\\html@mathml{\\@imath}{ı}");se("\\jmath","\\html@mathml{\\@jmath}{ȷ}");se("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");se("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");se("⟦","\\llbracket");se("⟧","\\rrbracket");se("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");se("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");se("⦃","\\lBrace");se("⦄","\\rBrace");se("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");se("⦵","\\minuso");se("\\darr","\\downarrow");se("\\dArr","\\Downarrow");se("\\Darr","\\Downarrow");se("\\lang","\\langle");se("\\rang","\\rangle");se("\\uarr","\\uparrow");se("\\uArr","\\Uparrow");se("\\Uarr","\\Uparrow");se("\\N","\\mathbb{N}");se("\\R","\\mathbb{R}");se("\\Z","\\mathbb{Z}");se("\\alef","\\aleph");se("\\alefsym","\\aleph");se("\\Alpha","\\mathrm{A}");se("\\Beta","\\mathrm{B}");se("\\bull","\\bullet");se("\\Chi","\\mathrm{X}");se("\\clubs","\\clubsuit");se("\\cnums","\\mathbb{C}");se("\\Complex","\\mathbb{C}");se("\\Dagger","\\ddagger");se("\\diamonds","\\diamondsuit");se("\\empty","\\emptyset");se("\\Epsilon","\\mathrm{E}");se("\\Eta","\\mathrm{H}");se("\\exist","\\exists");se("\\harr","\\leftrightarrow");se("\\hArr","\\Leftrightarrow");se("\\Harr","\\Leftrightarrow");se("\\hearts","\\heartsuit");se("\\image","\\Im");se("\\infin","\\infty");se("\\Iota","\\mathrm{I}");se("\\isin","\\in");se("\\Kappa","\\mathrm{K}");se("\\larr","\\leftarrow");se("\\lArr","\\Leftarrow");se("\\Larr","\\Leftarrow");se("\\lrarr","\\leftrightarrow");se("\\lrArr","\\Leftrightarrow");se("\\Lrarr","\\Leftrightarrow");se("\\Mu","\\mathrm{M}");se("\\natnums","\\mathbb{N}");se("\\Nu","\\mathrm{N}");se("\\Omicron","\\mathrm{O}");se("\\plusmn","\\pm");se("\\rarr","\\rightarrow");se("\\rArr","\\Rightarrow");se("\\Rarr","\\Rightarrow");se("\\real","\\Re");se("\\reals","\\mathbb{R}");se("\\Reals","\\mathbb{R}");se("\\Rho","\\mathrm{P}");se("\\sdot","\\cdot");se("\\sect","\\S");se("\\spades","\\spadesuit");se("\\sub","\\subset");se("\\sube","\\subseteq");se("\\supe","\\supseteq");se("\\Tau","\\mathrm{T}");se("\\thetasym","\\vartheta");se("\\weierp","\\wp");se("\\Zeta","\\mathrm{Z}");se("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");se("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");se("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");se("\\bra","\\mathinner{\\langle{#1}|}");se("\\ket","\\mathinner{|{#1}\\rangle}");se("\\braket","\\mathinner{\\langle{#1}\\rangle}");se("\\Bra","\\left\\langle#1\\right|");se("\\Ket","\\left|#1\\right\\rangle");var Wne=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,s=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),l=t.macros.get("\\|");t.macros.beginGroup();var c=f=>m=>{e&&(m.macros.set("|",o),s.length&&m.macros.set("\\|",l));var p=f;if(!f&&s.length){var g=m.future();g.text==="|"&&(m.popToken(),p=!0)}return{tokens:p?s:r,numArgs:0}};t.macros.set("|",c(!1)),s.length&&t.macros.set("\\|",c(!0));var u=t.consumeArg().tokens,d=t.expandTokens([...i,...u,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};se("\\bra@ket",Wne(!1));se("\\bra@set",Wne(!0));se("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");se("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");se("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");se("\\angln","{\\angl n}");se("\\blue","\\textcolor{##6495ed}{#1}");se("\\orange","\\textcolor{##ffa500}{#1}");se("\\pink","\\textcolor{##ff00af}{#1}");se("\\red","\\textcolor{##df0030}{#1}");se("\\green","\\textcolor{##28ae7b}{#1}");se("\\gray","\\textcolor{gray}{#1}");se("\\purple","\\textcolor{##9d38bd}{#1}");se("\\blueA","\\textcolor{##ccfaff}{#1}");se("\\blueB","\\textcolor{##80f6ff}{#1}");se("\\blueC","\\textcolor{##63d9ea}{#1}");se("\\blueD","\\textcolor{##11accd}{#1}");se("\\blueE","\\textcolor{##0c7f99}{#1}");se("\\tealA","\\textcolor{##94fff5}{#1}");se("\\tealB","\\textcolor{##26edd5}{#1}");se("\\tealC","\\textcolor{##01d1c1}{#1}");se("\\tealD","\\textcolor{##01a995}{#1}");se("\\tealE","\\textcolor{##208170}{#1}");se("\\greenA","\\textcolor{##b6ffb0}{#1}");se("\\greenB","\\textcolor{##8af281}{#1}");se("\\greenC","\\textcolor{##74cf70}{#1}");se("\\greenD","\\textcolor{##1fab54}{#1}");se("\\greenE","\\textcolor{##0d923f}{#1}");se("\\goldA","\\textcolor{##ffd0a9}{#1}");se("\\goldB","\\textcolor{##ffbb71}{#1}");se("\\goldC","\\textcolor{##ff9c39}{#1}");se("\\goldD","\\textcolor{##e07d10}{#1}");se("\\goldE","\\textcolor{##a75a05}{#1}");se("\\redA","\\textcolor{##fca9a9}{#1}");se("\\redB","\\textcolor{##ff8482}{#1}");se("\\redC","\\textcolor{##f9685d}{#1}");se("\\redD","\\textcolor{##e84d39}{#1}");se("\\redE","\\textcolor{##bc2612}{#1}");se("\\maroonA","\\textcolor{##ffbde0}{#1}");se("\\maroonB","\\textcolor{##ff92c6}{#1}");se("\\maroonC","\\textcolor{##ed5fa6}{#1}");se("\\maroonD","\\textcolor{##ca337c}{#1}");se("\\maroonE","\\textcolor{##9e034e}{#1}");se("\\purpleA","\\textcolor{##ddd7ff}{#1}");se("\\purpleB","\\textcolor{##c6b9fc}{#1}");se("\\purpleC","\\textcolor{##aa87ff}{#1}");se("\\purpleD","\\textcolor{##7854ab}{#1}");se("\\purpleE","\\textcolor{##543b78}{#1}");se("\\mintA","\\textcolor{##f5f9e8}{#1}");se("\\mintB","\\textcolor{##edf2df}{#1}");se("\\mintC","\\textcolor{##e0e5cc}{#1}");se("\\grayA","\\textcolor{##f6f7f7}{#1}");se("\\grayB","\\textcolor{##f0f1f2}{#1}");se("\\grayC","\\textcolor{##e3e5e6}{#1}");se("\\grayD","\\textcolor{##d6d8da}{#1}");se("\\grayE","\\textcolor{##babec2}{#1}");se("\\grayF","\\textcolor{##888d93}{#1}");se("\\grayG","\\textcolor{##626569}{#1}");se("\\grayH","\\textcolor{##3b3e40}{#1}");se("\\grayI","\\textcolor{##21242c}{#1}");se("\\kaBlue","\\textcolor{##314453}{#1}");se("\\kaGreen","\\textcolor{##71B307}{#1}");var Vne={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class HEe{constructor(t,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new zEe(FEe,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new LH(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,r,s;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new Xc("EOF",r.loc)),this.pushTokens(s),new Xc("",cc.range(n,r))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],r=t&&t.length>0;r||this.consumeSpaces();var s=this.future(),i,o=0,l=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new qt("Extra }",i)}else if(i.text==="EOF")throw new qt("Unexpected end of input in a macro argument, expected '"+(t&&r?t[l]:"}")+"'",i);if(t&&r)if((o===0||o===1&&t[l]==="{")&&i.text===t[l]){if(++l,l===t.length){n.splice(-l,l);break}}else l=0}while(o!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new qt("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;s<r.length;s++){var i=this.popToken();if(r[s]!==i.text)throw new qt("Use of the macro doesn't match its definition",i)}}for(var o=[],l=0;l<t;l++)o.push(this.consumeArg(n&&n[l+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new qt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||t&&s.unexpandable){if(t&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new qt("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,o=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var l=i.length-1;l>=0;--l){var c=i[l];if(c.text==="#"){if(l===0)throw new qt("Incomplete placeholder at end of macro body",c);if(c=i[--l],c.text==="#")i.splice(l+1,1);else if(/^[1-9]$/.test(c.text))i.splice(l,2,...o[+c.text-1]);else throw new qt("Not a valid argument number",c)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Xc(t)]):void 0}expandTokens(t){var n=[],r=this.stack.length;for(this.pushTokens(t);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(r=>r.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var r=this.lexer.catcodes[t];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.includes("#"))for(var o=s.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var l=new LH(s,this.settings),c=[],u=l.lex();u.text!=="EOF";)c.push(u),u=l.lex();c.reverse();var d={tokens:c,numArgs:i};return d}return s}isDefined(t){return this.macros.has(t)||np.hasOwnProperty(t)||Hi.math.hasOwnProperty(t)||Hi.text.hasOwnProperty(t)||Vne.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:np.hasOwnProperty(t)&&!np[t].primitive}}var $H=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,k2=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),IA={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},BH={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};let Gne=class Kne{constructor(t,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new HEe(t,n,this.mode),this.settings=n,this.leftrightDepth=0,this.nextToken=null}expect(t,n){if(n===void 0&&(n=!0),this.fetch().text!==t)throw new qt("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var n=this.nextToken;this.consume(),this.gullet.pushToken(new Xc("}")),this.gullet.pushTokens(t);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(t,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Kne.endOfExpression.has(s.text)||n&&s.text===n||t&&np[s.text]&&np[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(t){for(var n=-1,r,s=0;s<t.length;s++){var i=t[s];if(i.type==="infix"){if(n!==-1)throw new qt("only one infix operator per group",i.token);n=s,r=i.replaceWith}}if(n!==-1&&r){var o,l,c=t.slice(0,n),u=t.slice(n+1);c.length===1&&c[0].type==="ordgroup"?o=c[0]:o={type:"ordgroup",mode:this.mode,body:c},u.length===1&&u[0].type==="ordgroup"?l=u[0]:l={type:"ordgroup",mode:this.mode,body:u};var d;return r==="\\\\abovefrac"?d=this.callFunction(r,[o,t[n],l],[]):d=this.callFunction(r,[o,l],[]),[d]}else return t}handleSupSubscript(t){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(t)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new qt("Expected group after '"+r+"'",n);return s}formatUnsupportedCmd(t){for(var n=[],r=0;r<t.length;r++)n.push({type:"textord",mode:"text",text:t[r]});var s={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return i}parseAtom(t){var n=this.parseGroup("atom",t);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var r,s;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){var o=i.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new qt("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new qt("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new qt("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new qt("Double superscript",i);var l={type:"textord",mode:this.mode,text:"\\prime"},c=[l];for(this.consume();this.fetch().text==="'";)c.push(l),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:c}}else if(k2[i.text]){var u=$H.test(i.text),d=[];for(d.push(new Xc(k2[i.text])),this.consume();;){var f=this.fetch().text;if(!k2[f]||$H.test(f)!==u)break;d.unshift(new Xc(k2[f])),this.consume()}var m=this.subparse(d);u?s={type:"ordgroup",mode:"math",body:m}:r={type:"ordgroup",mode:"math",body:m}}else break}return r||s?{type:"supsub",mode:this.mode,base:n,sup:r,sub:s}:n}parseFunction(t,n){var r=this.fetch(),s=r.text,i=np[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new qt("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new qt("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new qt("Can't use function '"+s+"' in math mode",r);var{args:o,optArgs:l}=this.parseArguments(s,i);return this.callFunction(s,o,l,r,t)}callFunction(t,n,r,s,i){var o={funcName:t,parser:this,token:s,breakOnTokenText:i},l=np[t];if(l&&l.handler)return l.handler(o,n,r);throw new qt("No function handler for "+t)}parseArguments(t,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var s=[],i=[],o=0;o<r;o++){var l=n.argTypes&&n.argTypes[o],c=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&l==null||n.type==="sqrt"&&o===1&&i[0]==null)&&(l="primitive");var u=this.parseGroupOfType("argument to '"+t+"'",l,c);if(c)i.push(u);else if(u!=null)s.push(u);else throw new qt("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(t,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var s=this.parseArgumentGroup(r,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text",resetFont:!0}:null}case"raw":{var i=this.parseStringGroup("raw",r);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(r)throw new qt("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new qt("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new qt("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),r.text=s,r}parseRegexGroup(t,n){for(var r=this.fetch(),s=r,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)s=o,i+=s.text,this.consume();if(i==="")throw new qt("Invalid "+n+": '"+r.text+"'",r);return r.range(s,i)}parseColorGroup(t){var n=this.parseStringGroup("color",t);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new qt("Invalid color: '"+n.text+"'",n);var s=r[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(t){var n,r=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",t),!n)return null;!t&&n.text.length===0&&(n.text="0pt",r=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!s)throw new qt("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!Zte(i))throw new qt("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:r}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(t,n){var r=this.gullet.scanArgument(t);if(r==null)return null;var s=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return n&&this.switchMode(s),o}parseGroup(t,n){var r=this.fetch(),s=r.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var o=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var l=this.parseExpression(!1,o),c=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:cc.range(r,c),body:l,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!Vne.hasOwnProperty(s)){if(this.settings.throwOnError)throw new qt("Undefined control sequence: "+s,r);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(t){for(var n=t.length-1,r=0;r<n;++r){var s=t[r];if(s.type==="textord"){var i=s.text,o=t[r+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var l=t[r+2];r+1<n&&l&&l.type==="textord"&&l.text==="-"?(t.splice(r,3,{type:"textord",mode:"text",loc:cc.range(s,l),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:cc.range(s,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(r,2,{type:"textord",mode:"text",loc:cc.range(s,o),text:i+i}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),s=r.charAt(0)==="*";if(s&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new qt(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}BH.hasOwnProperty(n[0])&&!Hi[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',t),n=BH[n[0]]+n.slice(1));var i=$Ee.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(Hi[this.mode][n]){this.settings.strict&&this.mode==="math"&&lI.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var l=Hi[this.mode][n].group,c=cc.range(t),u;iEe(l)?u={type:"atom",mode:this.mode,family:l,loc:c,text:n}:u={type:l,mode:this.mode,loc:c,text:n},o=u}else if(n.charCodeAt(0)>=128)this.settings.strict&&(Jte(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),t)),o={type:"textord",mode:"text",loc:cc.range(t),text:n};else return null;if(this.consume(),i)for(var d=0;d<i[0].length;d++){var f=i[0][d];if(!IA[f])throw new qt("Unknown accent ' "+f+"'",t);var m=IA[f][this.mode]||IA[f].text;if(!m)throw new qt("Accent "+f+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:cc.range(t),label:m,isStretchy:!1,isShifty:!0,base:o}}return o}};Gne.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var GD=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Gne(t,n);delete r.gullet.macros.current["\\df@tag"];var s=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new qt("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new Xc("\\df@tag")])}]}return s},KD=function(t,n,r){n.textContent="";var s=I5(t,r).toNode();n.appendChild(s)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),KD=function(){throw new qt("KaTeX doesn't work in quirks mode.")});var Yne=function(t,n){var r=I5(t,n).toMarkup();return r},Xne=function(t,n){var r=new RD(n);return GD(t,r)},Qne=function(t,n,r){if(r.throwOnError||!(t instanceof qt))throw t;var s=Pt(["katex-error"],[new nu(n)]);return s.setAttribute("title",t.toString()),s.setAttribute("style","color:"+r.errorColor),s},I5=function(t,n){var r=new RD(n);try{var s=GD(t,r);return Q8e(s,t,r)}catch(i){return Qne(i,t,r)}},Jne=function(t,n){var r=new RD(n);try{var s=GD(t,r);return J8e(s,t,r)}catch(i){return Qne(i,t,r)}},Zne="0.16.47",ere={Span:pv,Anchor:v5,SymbolNode:nu,SvgNode:Vf,PathNode:Rp,LineNode:aI},_I={version:Zne,render:KD,renderToString:Yne,ParseError:qt,SETTINGS_SCHEMA:ST,__parse:Xne,__renderToDomTree:I5,__renderToHTMLTree:Jne,__setFontMetrics:rne,__defineSymbol:O,__defineFunction:Sn,__defineMacro:se,__domTree:ere};const u9t=Object.freeze(Object.defineProperty({__proto__:null,ParseError:qt,SETTINGS_SCHEMA:ST,__defineFunction:Sn,__defineMacro:se,__defineSymbol:O,__domTree:ere,__parse:Xne,__renderToDomTree:I5,__renderToHTMLTree:Jne,__setFontMetrics:rne,default:_I,get render(){return KD},renderToString:Yne,version:Zne},Symbol.toStringTag,{value:"Module"})),UEe={};function zH(e){const t=this,n=e||UEe,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(J6e(n)),i.push(U6e()),o.push(W6e(n))}const FH=/[#.]/g;function WEe(e,t){const n=e||"",r={};let s=0,i,o;for(;s<n.length;){FH.lastIndex=s;const l=FH.exec(n),c=n.slice(s,l?l.index:n.length);c&&(i?i==="#"?r.id=c:Array.isArray(r.className)?r.className.push(c):r.className=[c]:o=c,s+=c.length),l&&(i=l[0],s++)}return{type:"element",tagName:o||t||"div",properties:r,children:[]}}function tre(e,t,n){const r=n?YEe(n):void 0;function s(i,o,...l){let c;if(i==null){c={type:"root",children:[]};const u=o;l.unshift(u)}else{c=WEe(i,t);const u=c.tagName.toLowerCase(),d=r?r.get(u):void 0;if(c.tagName=d||u,VEe(o))l.unshift(o);else for(const[f,m]of Object.entries(o))GEe(e,c.properties,f,m)}for(const u of l)SI(c.children,u);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return s}function VEe(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const s=t[r];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const i=s;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function GEe(e,t,n,r){const s=hD(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?s.spaceSeparated?i=oq(r):s.commaSeparated?i=tq(r):s.commaOrSpaceSeparated?i=oq(tq(r).join(" ")):i=qH(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?KEe(r):String(r);if(Array.isArray(i)){const o=[];for(const l of i)o.push(qH(s,s.property,l));i=o}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function SI(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)SI(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?SI(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function qH(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||yk(n)===yk(t)))return!0}return n}function KEe(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function YEe(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const XEe=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],QEe=tre(fD,"div"),JEe=tre(hv,"g",XEe),MA={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function ZEe(e,t){return nre(e,{})||{type:"root",children:[]}}function nre(e,t){const n=eAe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function eAe(e,t){switch(e.nodeType){case 1:return sAe(e,t);case 3:return nAe(e);case 8:return rAe(e);case 9:return HH(e,t);case 10:return tAe();case 11:return HH(e,t);default:return}}function HH(e,t){return{type:"root",children:rre(e,t)}}function tAe(){return{type:"doctype"}}function nAe(e){return{type:"text",value:e.nodeValue||""}}function rAe(e){return{type:"comment",value:e.nodeValue||""}}function sAe(e,t){const n=e.namespaceURI,r=n===MA.svg?JEe:QEe,s=n===MA.html?e.tagName.toLowerCase():e.tagName,i=n===MA.html&&s==="template"?e.content:e,o=e.getAttributeNames(),l={};let c=-1;for(;++c<o.length;)l[o[c]]=e.getAttribute(o[c])||"";return r(s,l,rre(i,t))}function rre(e,t){const n=e.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=nre(n[s],t);i!==void 0&&r.push(i)}return r}new DOMParser;function iAe(e,t){const n=oAe(e);return ZEe(n)}function oAe(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const UH=function(e,t,n){const r=k_(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]},u1=function(e){if(e==null)return cAe;if(typeof e=="string")return lAe(e);if(typeof e=="object")return aAe(e);if(typeof e=="function")return YD(e);throw new Error("Expected function, string, or array as `test`")};function aAe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=u1(e[n]);return YD(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function lAe(e){return YD(t);function t(n){return n.tagName===e}}function YD(e){return t;function t(n,r,s){return!!(uAe(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function cAe(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function uAe(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const WH=/\n/g,VH=/[\t ]+/g,CI=u1("br"),GH=u1(yAe),dAe=u1("p"),KH=u1("tr"),hAe=u1(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",bAe,vAe]),sre=u1(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function fAe(e,t){const n=t||{},r="children"in e?e.children:[],s=sre(e),i=are(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...ore(e,{breakBefore:!0,breakAfter:!0}));let l=-1;for(;++l<r.length;)o.push(...ire(r[l],e,{whitespace:i,breakBefore:l?void 0:s,breakAfter:l<r.length-1?CI(r[l+1]):s}));const c=[];let u;for(l=-1;++l<o.length;){const d=o[l];typeof d=="number"?u!==void 0&&d>u&&(u=d):d&&(u!==void 0&&u>-1&&c.push(`
`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function ire(e,t,n){return e.type==="element"?mAe(e,t,n):e.type==="text"?n.whitespace==="normal"?ore(e,n):pAe(e):[]}function mAe(e,t,n){const r=are(e,n),s=e.children||[];let i=-1,o=[];if(hAe(e))return o;let l,c;for(CI(e)||KH(e)&&UH(t,e,KH)?c=`
`:dAe(e)?(l=2,c=2):sre(e)&&(l=1,c=1);++i<s.length;)o=o.concat(ire(s[i],e,{whitespace:r,breakBefore:i?void 0:l,breakAfter:i<s.length-1?CI(s[i+1]):c}));return GH(e)&&UH(t,e,GH)&&o.push("	"),l&&o.unshift(l),c&&o.push(c),o}function ore(e,t){const n=String(e.value),r=[],s=[];let i=0;for(;i<=n.length;){WH.lastIndex=i;const c=WH.exec(n),u=c&&"index"in c?c.index:n.length;r.push(gAe(n.slice(i,u).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,u===n.length?t.breakAfter:!0)),i=u+1}let o=-1,l;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(s.push(r[o]),l=void 0):r[o]?(typeof l=="number"&&s.push(l),s.push(r[o]),l=0):(o===0||o===r.length-1)&&s.push(0);return s}function pAe(e){return[String(e.value)]}function gAe(e,t,n){const r=[];let s=0,i;for(;s<e.length;){VH.lastIndex=s;const o=VH.exec(e);i=o?o.index:e.length,!s&&!i&&o&&!t&&r.push(""),s!==i&&r.push(e.slice(s,i)),s=o?i+o[0].length:i}return s!==i&&!n&&r.push(""),r.join(" ")}function are(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function bAe(e){return!!(e.properties||{}).hidden}function yAe(e){return e.tagName==="td"||e.tagName==="th"}function vAe(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const wAe={},xAe=[];function YH(e){const t=e||wAe;return function(n,r){TD(n,"element",function(s,i){const o=Array.isArray(s.properties.className)?s.properties.className:xAe,l=o.includes("language-math"),c=o.includes("math-display"),u=o.includes("math-inline");let d=c;if(!l&&!c&&!u)return;let f=i[i.length-1],m=s;if(s.tagName==="code"&&l&&f&&f.type==="element"&&f.tagName==="pre"&&(m=f,f=i[i.length-2],d=!0),!f)return;const p=fAe(m,{whitespace:"pre"});let g;try{g=_I.renderToString(p,{...t,displayMode:d,throwOnError:!0})}catch(w){const y=w,v=y.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:y,place:s.position,ruleId:v,source:"rehype-katex"});try{g=_I.renderToString(p,{...t,displayMode:d,strict:"ignore",throwOnError:!1})}catch{g=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(w)},children:[{type:"text",value:p}]}]}}typeof g=="string"&&(g=iAe(g).children);const b=f.children.indexOf(m);return f.children.splice(b,1,...g),bte})}}const lre=[{id:"abap",name:"ABAP",import:()=>fe(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>fe(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>fe(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>fe(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>fe(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>fe(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>fe(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>fe(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>fe(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>fe(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>fe(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>fe(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>fe(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>fe(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>fe(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>fe(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>fe(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>fe(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>fe(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>fe(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>fe(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>fe(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>fe(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>fe(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>fe(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>fe(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>fe(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>fe(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>fe(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>fe(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>fe(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>fe(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>fe(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>fe(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>fe(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>fe(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>fe(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>fe(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>fe(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>fe(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>fe(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>fe(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>fe(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>fe(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>fe(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>fe(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>fe(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>fe(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>fe(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>fe(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>fe(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>fe(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>fe(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>fe(()=>import("./erb-BYTLMnw6.js"),__vite__mapDeps([31,1,2,3,32,33,7,8,14,34,11,35,36,21,22,23,24,26,37,38]))},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>fe(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>fe(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>fe(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>fe(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>fe(()=>import("./fortran-fixed-form-TqA4NnZg.js"),__vite__mapDeps([39,40]))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>fe(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>fe(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>fe(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>fe(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>fe(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>fe(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>fe(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>fe(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>fe(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>fe(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>fe(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>fe(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>fe(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>fe(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>fe(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>fe(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>fe(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>fe(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>fe(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>fe(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>fe(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>fe(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>fe(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>fe(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>fe(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>fe(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>fe(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>fe(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>fe(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>fe(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>fe(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>fe(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>fe(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>fe(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>fe(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>fe(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>fe(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>fe(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>fe(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>fe(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>fe(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>fe(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>fe(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>fe(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>fe(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>fe(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>fe(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>fe(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>fe(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>fe(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>fe(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>fe(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>fe(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>fe(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>fe(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>fe(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>fe(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>fe(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>fe(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>fe(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>fe(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>fe(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>fe(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>fe(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>fe(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>fe(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>fe(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>fe(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>fe(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>fe(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>fe(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>fe(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>fe(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>fe(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>fe(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>fe(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>fe(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>fe(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>fe(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>fe(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>fe(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>fe(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>fe(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>fe(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>fe(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>fe(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>fe(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>fe(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>fe(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>fe(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>fe(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>fe(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>fe(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>fe(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>fe(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>fe(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>fe(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>fe(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>fe(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>fe(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>fe(()=>import("./rst-4NLicBqY.js"),__vite__mapDeps([75,28,1,2,3,21,22,23,24,14,18,26,38,76,32,33,7,8,34,11,35,36,37]))},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>fe(()=>import("./ruby-DeZ3UC14.js"),__vite__mapDeps([32,1,2,3,33,7,8,14,34,11,35,36,21,22,23,24,26,37,38]))},{id:"rust",name:"Rust",aliases:["rs"],import:()=>fe(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>fe(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>fe(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>fe(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>fe(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>fe(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>fe(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>fe(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>fe(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>fe(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>fe(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>fe(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>fe(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>fe(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>fe(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>fe(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>fe(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>fe(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>fe(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>fe(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>fe(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>fe(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>fe(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>fe(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>fe(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>fe(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>fe(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>fe(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>fe(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>fe(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>fe(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>fe(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>fe(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>fe(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>fe(()=>import("./twig-NC5TFiHP.js"),__vite__mapDeps([89,3,2,5,70,1,7,8,14,9,18,32,33,34,11,35,36,21,22,23,24,26,37,38]))},{id:"typescript",name:"TypeScript",aliases:["ts"],import:()=>fe(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>fe(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>fe(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>fe(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>fe(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>fe(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>fe(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>fe(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>fe(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>fe(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>fe(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>fe(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>fe(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>fe(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>fe(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>fe(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>fe(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>fe(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>fe(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>fe(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>fe(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>fe(()=>import("./zig-BVz_zdnA.js"),[])}],kAe=Object.fromEntries(lre.map(e=>[e.id,e.import])),_Ae=Object.fromEntries(lre.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),SAe={...kAe,..._Ae},CAe=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>fe(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>fe(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>fe(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>fe(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>fe(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>fe(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>fe(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>fe(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>fe(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>fe(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>fe(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>fe(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>fe(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>fe(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>fe(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>fe(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>fe(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>fe(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>fe(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>fe(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>fe(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>fe(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>fe(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>fe(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>fe(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>fe(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>fe(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>fe(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>fe(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>fe(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>fe(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>fe(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>fe(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>fe(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>fe(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>fe(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>fe(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>fe(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>fe(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>fe(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>fe(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>fe(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>fe(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>fe(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>fe(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>fe(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>fe(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>fe(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>fe(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>fe(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>fe(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>fe(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>fe(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>fe(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],TAe=Object.fromEntries(CAe.map(e=>[e.id,e.import]));let If=class extends Error{constructor(t){super(t),this.name="ShikiError"}},XD=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function EAe(){return 2147483648}function AAe(){return typeof performance<"u"?performance.now():Date.now()}const jAe=(e,t)=>e+(t-e%t)%t;async function NAe(e){let t,n;const r={};function s(p){n=p,r.HEAPU8=new Uint8Array(p),r.HEAPU32=new Uint32Array(p)}function i(p,g,b){r.HEAPU8.copyWithin(p,g,g+b)}function o(p){try{return t.grow(p-n.byteLength+65535>>>16),s(t.buffer),1}catch{}}function l(p){const g=r.HEAPU8.length;p=p>>>0;const b=EAe();if(p>b)return!1;for(let w=1;w<=4;w*=2){let y=g*(1+.2/w);y=Math.min(y,p+100663296);const v=Math.min(b,jAe(Math.max(p,y),65536));if(o(v))return!0}return!1}const c=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(p,g,b=1024){const w=g+b;let y=g;for(;p[y]&&!(y>=w);)++y;if(y-g>16&&p.buffer&&c)return c.decode(p.subarray(g,y));let v="";for(;g<y;){let x=p[g++];if(!(x&128)){v+=String.fromCharCode(x);continue}const k=p[g++]&63;if((x&224)===192){v+=String.fromCharCode((x&31)<<6|k);continue}const S=p[g++]&63;if((x&240)===224?x=(x&15)<<12|k<<6|S:x=(x&7)<<18|k<<12|S<<6|p[g++]&63,x<65536)v+=String.fromCharCode(x);else{const T=x-65536;v+=String.fromCharCode(55296|T>>10,56320|T&1023)}}return v}function d(p,g){return p?u(r.HEAPU8,p,g):""}const f={emscripten_get_now:AAe,emscripten_memcpy_big:i,emscripten_resize_heap:l,fd_write:()=>0};async function m(){const g=await e({env:f,wasi_snapshot_preview1:f});t=g.memory,s(t.buffer),Object.assign(r,g),r.UTF8ToString=d}return await m(),r}var IAe=Object.defineProperty,MAe=(e,t,n)=>t in e?IAe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ua=(e,t,n)=>(MAe(e,typeof t!="symbol"?t+"":t,n),n);let Ra=null;function RAe(e){throw new XD(e.UTF8ToString(e.getLastOnigError()))}class M5{constructor(t){ua(this,"utf16Length"),ua(this,"utf8Length"),ua(this,"utf16Value"),ua(this,"utf8Value"),ua(this,"utf16OffsetToUtf8"),ua(this,"utf8OffsetToUtf16");const n=t.length,r=M5._utf8ByteLength(t),s=r!==n,i=s?new Uint32Array(n+1):null;s&&(i[n]=r);const o=s?new Uint32Array(r+1):null;s&&(o[r]=n);const l=new Uint8Array(r);let c=0;for(let u=0;u<n;u++){const d=t.charCodeAt(u);let f=d,m=!1;if(d>=55296&&d<=56319&&u+1<n){const p=t.charCodeAt(u+1);p>=56320&&p<=57343&&(f=(d-55296<<10)+65536|p-56320,m=!0)}s&&(i[u]=c,m&&(i[u+1]=c),f<=127?o[c+0]=u:f<=2047?(o[c+0]=u,o[c+1]=u):f<=65535?(o[c+0]=u,o[c+1]=u,o[c+2]=u):(o[c+0]=u,o[c+1]=u,o[c+2]=u,o[c+3]=u)),f<=127?l[c++]=f:f<=2047?(l[c++]=192|(f&1984)>>>6,l[c++]=128|(f&63)>>>0):f<=65535?(l[c++]=224|(f&61440)>>>12,l[c++]=128|(f&4032)>>>6,l[c++]=128|(f&63)>>>0):(l[c++]=240|(f&1835008)>>>18,l[c++]=128|(f&258048)>>>12,l[c++]=128|(f&4032)>>>6,l[c++]=128|(f&63)>>>0),m&&u++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=l,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let r=0,s=t.length;r<s;r++){const i=t.charCodeAt(r);let o=i,l=!1;if(i>=55296&&i<=56319&&r+1<s){const c=t.charCodeAt(r+1);c>=56320&&c<=57343&&(o=(i-55296<<10)+65536|c-56320,l=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,l&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Vd=class{constructor(e){if(ua(this,"id",++Vd.LAST_ID),ua(this,"_onigBinding"),ua(this,"content"),ua(this,"utf16Length"),ua(this,"utf8Length"),ua(this,"utf16OffsetToUtf8"),ua(this,"utf8OffsetToUtf16"),ua(this,"ptr"),!Ra)throw new XD("Must invoke loadWasm first.");this._onigBinding=Ra,this.content=e;const t=new M5(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!Vd._sharedPtrInUse?(Vd._sharedPtr||(Vd._sharedPtr=Ra.omalloc(1e4)),Vd._sharedPtrInUse=!0,Ra.HEAPU8.set(t.utf8Value,Vd._sharedPtr),this.ptr=Vd._sharedPtr):this.ptr=t.createString(Ra)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===Vd._sharedPtr?Vd._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let T_=Vd;ua(T_,"LAST_ID",0);ua(T_,"_sharedPtr",0);ua(T_,"_sharedPtrInUse",!1);class DAe{constructor(t){if(ua(this,"_onigBinding"),ua(this,"_ptr"),!Ra)throw new XD("Must invoke loadWasm first.");const n=[],r=[];for(let l=0,c=t.length;l<c;l++){const u=new M5(t[l]);n[l]=u.createString(Ra),r[l]=u.utf8Length}const s=Ra.omalloc(4*t.length);Ra.HEAPU32.set(n,s/4);const i=Ra.omalloc(4*t.length);Ra.HEAPU32.set(r,i/4);const o=Ra.createOnigScanner(s,i,t.length);for(let l=0,c=t.length;l<c;l++)Ra.ofree(n[l]);Ra.ofree(i),Ra.ofree(s),o===0&&RAe(Ra),this._onigBinding=Ra,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof t=="string"){t=new T_(t);const i=this._findNextMatchSync(t,n,!1,s);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,s)}_findNextMatchSync(t,n,r,s){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),s);if(o===0)return null;const l=i.HEAPU32;let c=o/4;const u=l[c++],d=l[c++],f=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(l[c++]),g=t.convertUtf8OffsetToUtf16(l[c++]);f[m]={start:p,end:g,length:g-p}}return{index:u,captureIndices:f}}}function LAe(e){return typeof e.instantiator=="function"}function PAe(e){return typeof e.default=="function"}function OAe(e){return typeof e.data<"u"}function $Ae(e){return typeof Response<"u"&&e instanceof Response}function BAe(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let _2;function zAe(e){if(_2)return _2;async function t(){Ra=await NAe(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),LAe(r)?r=await r.instantiator(n):PAe(r)?r=await r.default(n):(OAe(r)&&(r=r.data),$Ae(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await FAe(r)(n):r=await qAe(r)(n):BAe(r)?r=await RA(r)(n):r instanceof WebAssembly.Module?r=await RA(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await RA(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return _2=t(),_2}function RA(e){return t=>WebAssembly.instantiate(e,t)}function FAe(e){return t=>WebAssembly.instantiateStreaming(e,t)}function qAe(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let HAe;function UAe(){return HAe}async function cre(e){return e&&await zAe(e),{createScanner(t){return new DAe(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new T_(t)}}}function WAe(e){return QD(e)}function QD(e){return Array.isArray(e)?VAe(e):e instanceof RegExp?e:typeof e=="object"?GAe(e):e}function VAe(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=QD(e[n]);return t}function GAe(e){let t={};for(let n in e)t[n]=QD(e[n]);return t}function ure(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function dre(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?dre(e.substring(0,e.length-1)):e.substr(~t+1)}var DA=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,S2=class{static hasCaptures(e){return e===null?!1:(DA.lastIndex=0,DA.test(e))}static replaceCaptures(e,t,n){return e.replace(DA,(r,s,i,o)=>{let l=n[parseInt(s||i,10)];if(l){let c=t.substring(l.start,l.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function hre(e,t){return e<t?-1:e>t?1:0}function fre(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let i=hre(e[s],t[s]);if(i!==0)return i}return 0}return n-r}function XH(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function mre(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var pre=class{constructor(e){Ue(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},NT=class{constructor(e,t,n){Ue(this,"_cachedMatchRoot",new pre(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(XAe(e),t)}static createFromParsedTheme(e,t){return JAe(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>KAe(e.parent,s.parentScopes));return r?new gre(r.fontStyle,r.foreground,r.background):null}},LA=class i4{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new i4(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new i4(n,t[r]);return n}push(t){return new i4(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function KAe(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!YAe(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function YAe(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var gre=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function XAe(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,i=t.length;s<i;s++){let o=t[s];if(!o.settings)continue;let l;if(typeof o.scope=="string"){let f=o.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),l=f.split(",")}else Array.isArray(o.scope)?l=o.scope:l=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let f=o.settings.fontStyle.split(" ");for(let m=0,p=f.length;m<p;m++)switch(f[m]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let u=null;typeof o.settings.foreground=="string"&&XH(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&XH(o.settings.background)&&(d=o.settings.background);for(let f=0,m=l.length;f<m;f++){let g=l[f].trim().split(" "),b=g[g.length-1],w=null;g.length>1&&(w=g.slice(0,g.length-1),w.reverse()),n[r++]=new QAe(b,w,s,c,u,d)}}return n}var QAe=class{constructor(e,t,n,r,s,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=i}},Sf=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Sf||{});function JAe(e,t){e.sort((c,u)=>{let d=hre(c.scope,u.scope);return d!==0||(d=fre(c.parentScopes,u.parentScopes),d!==0)?d:c.index-u.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let i=new ZAe(t),o=new gre(n,i.getId(r),i.getId(s)),l=new tje(new TI(0,null,-1,0,0),[]);for(let c=0,u=e.length;c<u;c++){let d=e[c];l.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new NT(i,o,l)}var ZAe=class{constructor(e){Ue(this,"_isFrozen");Ue(this,"_lastColorId");Ue(this,"_id2color");Ue(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},eje=Object.freeze([]),TI=class bre{constructor(t,n,r,s,i){Ue(this,"scopeDepth");Ue(this,"parentScopes");Ue(this,"fontStyle");Ue(this,"foreground");Ue(this,"background");this.scopeDepth=t,this.parentScopes=n||eje,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new bre(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},tje=class EI{constructor(t,n=[],r={}){Ue(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const i=n.parentScopes[s].length-t.parentScopes[r].length;if(i!==0)return i;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,i;if(r===-1?(s=t,i=""):(s=t.substring(0,r),i=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(EI._cmpBySpecificity),n}insert(t,n,r,s,i,o){if(n===""){this._doInsertHere(t,r,s,i,o);return}let l=n.indexOf("."),c,u;l===-1?(c=n,u=""):(c=n.substring(0,l),u=n.substring(l+1));let d;this._children.hasOwnProperty(c)?d=this._children[c]:(d=new EI(this._mainRule.clone(),TI.cloneArr(this._rulesWithParentScopes)),this._children[c]=d),d.insert(t+1,u,r,s,i,o)}_doInsertHere(t,n,r,s,i){if(n===null){this._mainRule.acceptOverwrite(t,r,s,i);return}for(let o=0,l=this._rulesWithParentScopes.length;o<l;o++){let c=this._rulesWithParentScopes[o];if(fre(c.parentScopes,n)===0){c.acceptOverwrite(t,r,s,i);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new TI(t,n,r,s,i))}},jy=class fu{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=fu.getLanguageId(t),r=fu.getTokenType(t),s=fu.getFontStyle(t),i=fu.getForeground(t),o=fu.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,i,o,l){let c=fu.getLanguageId(t),u=fu.getTokenType(t),d=fu.containsBalancedBrackets(t)?1:0,f=fu.getFontStyle(t),m=fu.getForeground(t),p=fu.getBackground(t);return n!==0&&(c=n),r!==8&&(u=r),s!==null&&(d=s?1:0),i!==-1&&(f=i),o!==0&&(m=o),l!==0&&(p=l),(c<<0|u<<8|d<<10|f<<11|m<<15|p<<24)>>>0}};function IT(e,t){const n=[],r=nje(e);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let u=o();if(n.push({matcher:u,priority:c}),s!==",")break;s=r.next()}return n;function i(){if(s==="-"){s=r.next();const c=i();return u=>!!c&&!c(u)}if(s==="("){s=r.next();const c=l();return s===")"&&(s=r.next()),c}if(QH(s)){const c=[];do c.push(s),s=r.next();while(QH(s));return u=>t(c,u)}return null}function o(){const c=[];let u=i();for(;u;)c.push(u),u=i();return d=>c.every(f=>f(d))}function l(){const c=[];let u=o();for(;u&&(c.push(u),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");u=o()}return d=>c.some(f=>f(d))}}function QH(e){return!!e&&!!e.match(/[\w\.:]+/)}function nje(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function yre(e){typeof e.dispose=="function"&&e.dispose()}var _k=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},rje=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},sje=class{constructor(){Ue(this,"_references",[]);Ue(this,"_seenReferenceKeys",new Set);Ue(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},ije=class{constructor(e,t){Ue(this,"seenFullScopeRequests",new Set);Ue(this,"seenPartialScopeRequests",new Set);Ue(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new _k(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new sje;for(const n of e)oje(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof _k){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function oje(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof _k?o4({baseGrammar:i,selfGrammar:s},r):AI(e.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);const o=n.injections(e.scopeName);if(o)for(const l of o)r.add(new _k(l))}function AI(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];MT([r],t,n)}}function o4(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&MT(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&MT(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function MT(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?ure({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&MT(r.patterns,{...t,repository:s},n);const i=r.include;if(!i)continue;const o=vre(i);switch(o.kind){case 0:o4({...t,selfGrammar:t.baseGrammar},n);break;case 1:o4(t,n);break;case 2:AI(o.ruleName,{...t,repository:s},n);break;case 3:case 4:const l=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const c={baseGrammar:t.baseGrammar,selfGrammar:l,repository:s};o.kind===4?AI(o.ruleName,c,n):o4(c,n)}else o.kind===4?n.add(new rje(o.scopeName,o.ruleName)):n.add(new _k(o.scopeName));break}}}var aje=class{constructor(){Ue(this,"kind",0)}},lje=class{constructor(){Ue(this,"kind",1)}},cje=class{constructor(e){Ue(this,"kind",2);this.ruleName=e}},uje=class{constructor(e){Ue(this,"kind",3);this.scopeName=e}},dje=class{constructor(e,t){Ue(this,"kind",4);this.scopeName=e,this.ruleName=t}};function vre(e){if(e==="$base")return new aje;if(e==="$self")return new lje;const t=e.indexOf("#");if(t===-1)return new uje(e);if(t===0)return new cje(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new dje(n,r)}}var hje=/\\(\d+)/,JH=/\\(\d+)/g,fje=-1,wre=-2;var E_=class{constructor(t,n,r,s){Ue(this,"$location");Ue(this,"id");Ue(this,"_nameIsCapturing");Ue(this,"_name");Ue(this,"_contentNameIsCapturing");Ue(this,"_contentName");this.$location=t,this.id=n,this._name=r||null,this._nameIsCapturing=S2.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=S2.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${dre(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,n){return!this._nameIsCapturing||this._name===null||t===null||n===null?this._name:S2.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:S2.replaceCaptures(this._contentName,t,n)}},mje=class extends E_{constructor(t,n,r,s,i){super(t,n,r,s);Ue(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,r,s){throw new Error("Not supported!")}},pje=class extends E_{constructor(t,n,r,s,i){super(t,n,r,null);Ue(this,"_match");Ue(this,"captures");Ue(this,"_cachedCompiledPatterns");this._match=new Sk(s,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ck,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ZH=class extends E_{constructor(t,n,r,s,i){super(t,n,r,s);Ue(this,"hasMissingPatterns");Ue(this,"patterns");Ue(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ck,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},jI=class extends E_{constructor(t,n,r,s,i,o,l,c,u,d){super(t,n,r,s);Ue(this,"_begin");Ue(this,"beginCaptures");Ue(this,"_end");Ue(this,"endHasBackReferences");Ue(this,"endCaptures");Ue(this,"applyEndPatternLast");Ue(this,"hasMissingPatterns");Ue(this,"patterns");Ue(this,"_cachedCompiledPatterns");this._begin=new Sk(i,this.id),this.beginCaptures=o,this._end=new Sk(l||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=u||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,s)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ck;for(const r of this.patterns)t.getRule(r).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},RT=class extends E_{constructor(t,n,r,s,i,o,l,c,u){super(t,n,r,s);Ue(this,"_begin");Ue(this,"beginCaptures");Ue(this,"whileCaptures");Ue(this,"_while");Ue(this,"whileHasBackReferences");Ue(this,"hasMissingPatterns");Ue(this,"patterns");Ue(this,"_cachedCompiledPatterns");Ue(this,"_cachedCompiledWhilePatterns");this._begin=new Sk(i,this.id),this.beginCaptures=o,this.whileCaptures=c,this._while=new Sk(l,wre),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ck;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,r,s){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,s)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ck,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},xre=class vl{static createCaptureRule(t,n,r,s,i){return t.registerRule(o=>new mje(n,o,r,s,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new pje(t.$vscodeTextmateLocation,t.id,t.name,t.match,vl._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=ure({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new ZH(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,vl._compilePatterns(i,n,r))}return t.while?new RT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,vl._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,vl._compileCaptures(t.whileCaptures||t.captures,n,r),vl._compilePatterns(t.patterns,n,r)):new jI(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,vl._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,vl._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,vl._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let i=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);l>i&&(i=l)}for(let o=0;o<=i;o++)s[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);let c=0;t[o].patterns&&(c=vl.getCompiledRuleId(t[o],n,r)),s[l]=vl.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let i=0,o=t.length;i<o;i++){const l=t[i];let c=-1;if(l.include){const u=vre(l.include);switch(u.kind){case 0:case 1:c=vl.getCompiledRuleId(r[l.include],n,r);break;case 2:let d=r[u.ruleName];d&&(c=vl.getCompiledRuleId(d,n,r));break;case 3:case 4:const f=u.scopeName,m=u.kind===4?u.ruleName:null,p=n.getExternalGrammar(f,r);if(p)if(m){let g=p.repository[m];g&&(c=vl.getCompiledRuleId(g,n,p.repository))}else c=vl.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=vl.getCompiledRuleId(l,n,r);if(c!==-1){const u=n.getRule(c);let d=!1;if((u instanceof ZH||u instanceof jI||u instanceof RT)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},Sk=class kre{constructor(t,n){Ue(this,"source");Ue(this,"ruleId");Ue(this,"hasAnchor");Ue(this,"hasBackReferences");Ue(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let s=0,i=[],o=!1;for(let l=0;l<r;l++)if(t.charAt(l)==="\\"&&l+1<r){const u=t.charAt(l+1);u==="z"?(i.push(t.substring(s,l)),i.push("$(?!\\n)(?<!\\n)"),s=l+2):(u==="A"||u==="G")&&(o=!0),l++}this.hasAnchor=o,s===0?this.source=t:(i.push(t.substring(s,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=hje.test(this.source):this.hasBackReferences=!1}clone(){return new kre(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>t.substring(s.start,s.end));return JH.lastIndex=0,this.source.replace(JH,(s,i)=>mre(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],s=[],i,o,l,c;for(i=0,o=this.source.length;i<o;i++)l=this.source.charAt(i),t[i]=l,n[i]=l,r[i]=l,s[i]=l,l==="\\"&&i+1<o&&(c=this.source.charAt(i+1),c==="A"?(t[i+1]="",n[i+1]="",r[i+1]="A",s[i+1]="A"):c==="G"?(t[i+1]="",n[i+1]="G",r[i+1]="",s[i+1]="G"):(t[i+1]=c,n[i+1]=c,r[i+1]=c,s[i+1]=c),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Ck=class{constructor(){Ue(this,"_items");Ue(this,"_hasAnchors");Ue(this,"_cached");Ue(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new eU(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(s=>s.resolveAnchors(t,n));return new eU(e,r,this._items.map(s=>s.ruleId))}},eU=class{constructor(e,t,n){Ue(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push("   - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},PA=class{constructor(e,t){this.languageId=e,this.tokenType=t}},bf,gje=(bf=class{constructor(t,n){Ue(this,"_defaultAttributes");Ue(this,"_embeddedLanguagesMatcher");Ue(this,"_getBasicScopeAttributes",new pre(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new PA(n,r)}));this._defaultAttributes=new PA(t,8),this._embeddedLanguagesMatcher=new bje(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?bf._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(bf.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},Ue(bf,"_NULL_SCOPE_METADATA",new PA(0,0)),Ue(bf,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),bf),bje=class{constructor(e){Ue(this,"values");Ue(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>mre(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},tU=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function _re(e,t,n,r,s,i,o,l){const c=t.content.length;let u=!1,d=-1;if(o){const p=yje(e,t,n,r,s,i);s=p.stack,r=p.linePos,n=p.isFirstLine,d=p.anchorPosition}const f=Date.now();for(;!u;){if(l!==0&&Date.now()-f>l)return new tU(s,!0);m()}return new tU(s,!1);function m(){const p=vje(e,t,n,r,s,d);if(!p){i.produce(s,c),u=!0;return}const g=p.captureIndices,b=p.matchedRuleId,w=g&&g.length>0?g[0].end>r:!1;if(b===fje){const y=s.getRule(e);i.produce(s,g[0].start),s=s.withContentNameScopesList(s.nameScopesList),sx(e,t,n,s,i,y.endCaptures,g),i.produce(s,g[0].end);const v=s;if(s=s.parent,d=v.getAnchorPos(),!w&&v.getEnterPos()===r){s=v,i.produce(s,c),u=!0;return}}else{const y=e.getRule(b);i.produce(s,g[0].start);const v=s,x=y.getName(t.content,g),k=s.contentNameScopesList.pushAttributed(x,e);if(s=s.push(b,r,d,g[0].end===c,null,k,k),y instanceof jI){const S=y;sx(e,t,n,s,i,S.beginCaptures,g),i.produce(s,g[0].end),d=g[0].end;const T=S.getContentName(t.content,g),_=k.pushAttributed(T,e);if(s=s.withContentNameScopesList(_),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(t.content,g))),!w&&v.hasSameRuleAs(s)){s=s.pop(),i.produce(s,c),u=!0;return}}else if(y instanceof RT){const S=y;sx(e,t,n,s,i,S.beginCaptures,g),i.produce(s,g[0].end),d=g[0].end;const T=S.getContentName(t.content,g),_=k.pushAttributed(T,e);if(s=s.withContentNameScopesList(_),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(t.content,g))),!w&&v.hasSameRuleAs(s)){s=s.pop(),i.produce(s,c),u=!0;return}}else if(sx(e,t,n,s,i,y.captures,g),i.produce(s,g[0].end),s=s.pop(),!w){s=s.safePop(),i.produce(s,c),u=!0;return}}g[0].end>r&&(r=g[0].end,n=!1)}}function yje(e,t,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1;const l=[];for(let c=s;c;c=c.pop()){const u=c.getRule(e);u instanceof RT&&l.push({rule:u,stack:c})}for(let c=l.pop();c;c=l.pop()){const{ruleScanner:u,findOptions:d}=kje(c.rule,e,c.stack.endRule,n,r===o),f=u.findNextMatchSync(t,r,d);if(f){if(f.ruleId!==wre){s=c.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(i.produce(c.stack,f.captureIndices[0].start),sx(e,t,n,c.stack,i,c.rule.whileCaptures,f.captureIndices),i.produce(c.stack,f.captureIndices[0].end),o=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function vje(e,t,n,r,s,i){const o=wje(e,t,n,r,s,i),l=e.getInjections();if(l.length===0)return o;const c=xje(l,e,t,n,r,s,i);if(!c)return o;if(!o)return c;const u=o.captureIndices[0].start,d=c.captureIndices[0].start;return d<u||c.priorityMatch&&d===u?c:o}function wje(e,t,n,r,s,i){const o=s.getRule(e),{ruleScanner:l,findOptions:c}=Sre(o,e,s.endRule,n,r===i),u=l.findNextMatchSync(t,r,c);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function xje(e,t,n,r,s,i,o){let l=Number.MAX_VALUE,c=null,u,d=0;const f=i.contentNameScopesList.getScopeNames();for(let m=0,p=e.length;m<p;m++){const g=e[m];if(!g.matcher(f))continue;const b=t.getRule(g.ruleId),{ruleScanner:w,findOptions:y}=Sre(b,t,null,r,s===o),v=w.findNextMatchSync(n,s,y);if(!v)continue;const x=v.captureIndices[0].start;if(!(x>=l)&&(l=x,c=v.captureIndices,u=v.ruleId,d=g.priority,l===s))break}return c?{priorityMatch:d===-1,captureIndices:c,matchedRuleId:u}:null}function Sre(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function kje(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function sx(e,t,n,r,s,i,o){if(i.length===0)return;const l=t.content,c=Math.min(i.length,o.length),u=[],d=o[0].end;for(let f=0;f<c;f++){const m=i[f];if(m===null)continue;const p=o[f];if(p.length===0)continue;if(p.start>d)break;for(;u.length>0&&u[u.length-1].endPos<=p.start;)s.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?s.produceFromScopes(u[u.length-1].scopes,p.start):s.produce(r,p.start),m.retokenizeCapturedWithRuleId){const b=m.getName(l,o),w=r.contentNameScopesList.pushAttributed(b,e),y=m.getContentName(l,o),v=w.pushAttributed(y,e),x=r.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,w,v),k=e.createOnigString(l.substring(0,p.end));_re(e,k,n&&p.start===0,p.start,x,s,!1,0),yre(k);continue}const g=m.getName(l,o);if(g!==null){const w=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).pushAttributed(g,e);u.push(new _je(w,p.end))}}for(;u.length>0;)s.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var _je=class{constructor(e,t){Ue(this,"scopes");Ue(this,"endPos");this.scopes=e,this.endPos=t}};function Sje(e,t,n,r,s,i,o,l){return new Tje(e,t,n,r,s,i,o,l)}function nU(e,t,n,r,s){const i=IT(t,DT),o=xre.getCompiledRuleId(n,r,s.repository);for(const l of i)e.push({debugSelector:t,matcher:l.matcher,ruleId:o,grammar:s,priority:l.priority})}function DT(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let s=n;s<t.length;s++)if(Cje(t[s],r))return n=s+1,!0;return!1})}function Cje(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var Tje=class{constructor(e,t,n,r,s,i,o,l){Ue(this,"_rootId");Ue(this,"_lastRuleId");Ue(this,"_ruleId2desc");Ue(this,"_includedGrammars");Ue(this,"_grammarRepository");Ue(this,"_grammar");Ue(this,"_injections");Ue(this,"_basicScopeAttributesProvider");Ue(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=l,this._basicScopeAttributesProvider=new gje(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=rU(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const u=IT(c,DT);for(const d of u)this._tokenTypeMatchers.push({matcher:d.matcher,type:s[c]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const s=r.injections;if(s)for(let o in s)nU(t,o,s[o],this,r);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const l=this.getExternalGrammar(o);if(l){const c=l.injectionSelector;c&&nU(t,c,l,this,l)}})}return t.sort((s,i)=>s.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=rU(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=xre.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===NI.NULL){s=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),f=jy.set(0,u.languageId,u.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),m=this.getRule(this._rootId).getName(null,null);let p;m?p=Fx.createRootAndLookUpScopeName(m,f,this):p=Fx.createRoot("unknown",f),t=new NI(null,this._rootId,-1,-1,!1,null,p,p)}else s=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,l=new Aje(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=_re(this,i,s,0,t,l,!0,r);return yre(i),{lineLength:o,lineTokens:l,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function rU(e,t){return e=WAe(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Fx=class Gd{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,s=(t==null?void 0:t.scopePath)??null;for(const i of n)s=LA.push(s,i.scopeNames),r=new Gd(r,s,i.encodedTokenAttributes);return r}static createRoot(t,n){return new Gd(null,new LA(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new LA(null,t),o=r.themeProvider.themeMatch(i),l=Gd.mergeAttributes(n,s,o);return new Gd(null,i,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Gd.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let s=-1,i=0,o=0;return r!==null&&(s=r.fontStyle,i=r.foregroundId,o=r.backgroundId),jy.set(t,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Gd._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const i of r)s=Gd._pushAttributed(s,i,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),i=t.scopePath.push(n),o=r.themeProvider.themeMatch(i),l=Gd.mergeAttributes(t.tokenAttributes,s,o);return new Gd(t,i,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var s;const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((s=r.parent)==null?void 0:s.scopePath)??null)}),r=r.parent;return r===t?n.reverse():void 0}},_u,NI=(_u=class{constructor(t,n,r,s,i,o,l,c){Ue(this,"_stackElementBrand");Ue(this,"_enterPos");Ue(this,"_anchorPos");Ue(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=l,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}equals(t){return t===null?!1:_u._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Fx.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){_u._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,o,l){return new _u(this,t,n,r,s,i,o,l)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var r,s;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new _u(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const r=Fx.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new _u(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Fx.fromExtension(r,n.contentNameScopesList))}},Ue(_u,"NULL",new _u(null,0,0,0,!1,null,null,null)),_u),Eje=class{constructor(e,t){Ue(this,"balancedBracketScopes");Ue(this,"unbalancedBracketScopes");Ue(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):IT(n,DT).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>IT(n,DT).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Aje=class{constructor(e,t,n,r){Ue(this,"_emitBinaryTokens");Ue(this,"_lineText");Ue(this,"_tokens");Ue(this,"_binaryTokens");Ue(this,"_lastTokenEndIndex");Ue(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var r;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let s=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(e==null?void 0:e.getScopeNames())??[];for(const l of this._tokenTypeOverrides)l.matcher(o)&&(s=jy.set(s,0,l.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(s=jy.set(s,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},jje=class{constructor(e,t){Ue(this,"_grammars",new Map);Ue(this,"_rawGrammars",new Map);Ue(this,"_injectionGrammars",new Map);Ue(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,s){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,Sje(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},Nje=class{constructor(t){Ue(this,"_options");Ue(this,"_syncRegistry");Ue(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new jje(NT.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(NT.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new Eje(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,i){const o=new ije(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(l=>this._loadSingleGrammar(l.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,r,s,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,s=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,s)}_grammarForScopeName(t,n=0,r=null,s=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,r,s,i)}},II=NI.NULL;const Ije=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Mje=/["&'<>`]/g,Rje=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Dje=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Lje=/[|\\{}()[\]^$+*?.]/g,sU=new WeakMap;function Pje(e,t){if(e=e.replace(t.subset?Oje(t.subset):Mje,r),t.subset||t.escapeOnly)return e;return e.replace(Rje,n).replace(Dje,r);function n(s,i,o){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function r(s,i,o){return t.format(s.charCodeAt(0),o.charCodeAt(i+1),t)}}function Oje(e){let t=sU.get(e);return t||(t=$je(e),sU.set(e,t)),t}function $je(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Lje,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Bje=/[\dA-Fa-f]/;function zje(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Bje.test(String.fromCharCode(t))?r:r+";"}const Fje=/\d/;function qje(e,t,n){const r="&#"+String(e);return n&&t&&!Fje.test(String.fromCharCode(t))?r:r+";"}const Hje=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],OA={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Uje=["cent","copy","divide","gt","lt","not","para","times"],Cre={}.hasOwnProperty,MI={};let C2;for(C2 in OA)Cre.call(OA,C2)&&(MI[OA[C2]]=C2);const Wje=/[^\dA-Za-z]/;function Vje(e,t,n,r){const s=String.fromCharCode(e);if(Cre.call(MI,s)){const i=MI[s],o="&"+i;return n&&Hje.includes(i)&&!Uje.includes(i)&&(!r||t&&t!==61&&Wje.test(String.fromCharCode(t)))?o:o+";"}return""}function Gje(e,t,n){let r=zje(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Vje(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=qje(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function ey(e,t){return Pje(e,Object.assign({format:Gje},t))}const Kje=/^>|^->|<!--|-->|--!>|<!-$/g,Yje=[">"],Xje=["<",">"];function Qje(e,t,n,r){return r.settings.bogusComments?"<?"+ey(e.value,Object.assign({},r.settings.characterReferences,{subset:Yje}))+">":"<!--"+e.value.replace(Kje,s)+"-->";function s(i){return ey(i,Object.assign({},r.settings.characterReferences,{subset:Xje}))}}function Jje(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const ba=Ere(1),Tre=Ere(-1),Zje=[];function Ere(e){return t;function t(n,r,s){const i=n?n.children:Zje;let o=(r||0)+e,l=i[o];if(!s)for(;l&&f5(l);)o+=e,l=i[o];return l}}const e7e={}.hasOwnProperty;function Are(e){return t;function t(n,r,s){return e7e.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const JD=Are({body:n7e,caption:$A,colgroup:$A,dd:o7e,dt:i7e,head:$A,html:t7e,li:s7e,optgroup:a7e,option:l7e,p:r7e,rp:iU,rt:iU,tbody:u7e,td:oU,tfoot:d7e,th:oU,thead:c7e,tr:h7e});function $A(e,t,n){const r=ba(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&f5(r.value.charAt(0)))}function t7e(e,t,n){const r=ba(n,t);return!r||r.type!=="comment"}function n7e(e,t,n){const r=ba(n,t);return!r||r.type!=="comment"}function r7e(e,t,n){const r=ba(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function s7e(e,t,n){const r=ba(n,t);return!r||r.type==="element"&&r.tagName==="li"}function i7e(e,t,n){const r=ba(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function o7e(e,t,n){const r=ba(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function iU(e,t,n){const r=ba(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function a7e(e,t,n){const r=ba(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function l7e(e,t,n){const r=ba(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function c7e(e,t,n){const r=ba(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function u7e(e,t,n){const r=ba(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function d7e(e,t,n){return!ba(n,t)}function h7e(e,t,n){const r=ba(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function oU(e,t,n){const r=ba(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const f7e=Are({body:g7e,colgroup:b7e,head:p7e,html:m7e,tbody:y7e});function m7e(e){const t=ba(e,-1);return!t||t.type!=="comment"}function p7e(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function g7e(e){const t=ba(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&f5(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function b7e(e,t,n){const r=Tre(n,t),s=ba(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&JD(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function y7e(e,t,n){const r=Tre(n,t),s=ba(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&JD(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const T2={name:[[`	
\f\r &/=>`.split(""),`	
\f\r "&'/=>\``.split("")],[`\0	
\f\r "&'/<=>`.split(""),`\0	
\f\r "&'/<=>\``.split("")]],unquoted:[[`	
\f\r &>`.split(""),`\0	
\f\r "&'<=>\``.split("")],[`\0	
\f\r "&'<=>\``.split(""),`\0	
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function v7e(e,t,n,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const l=[];let c;s.space==="html"&&e.tagName==="svg"&&(r.schema=hv);const u=w7e(r,e.properties),d=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,d&&(o=!1),(u||!i||!f7e(e,t,n))&&(l.push("<",e.tagName,u?" "+u:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(c=u.charAt(u.length-1),(!r.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(d),!o&&(!i||!JD(e,t,n))&&l.push("</"+e.tagName+">"),l.join("")}function w7e(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const i=x7e(e,s,t[s]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function x7e(e,t,n){const r=hD(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,l;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const c=ey(r.attribute,Object.assign({},e.settings.characterReferences,{subset:T2.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Pee:Uee)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(l=ey(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:T2.unquoted[s][i]}))),l!==n&&(e.settings.quoteSmart&&kT(n,o)>kT(n,e.alternative)&&(o=e.alternative),l=o+ey(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?T2.single:T2.double)[s][i],attribute:!0}))+o),c+(l&&"="+l))}const k7e=["<","&"];function jre(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:ey(e.value,Object.assign({},r.settings.characterReferences,{subset:k7e}))}function _7e(e,t,n,r){return r.settings.allowDangerousHtml?e.value:jre(e,t,n,r)}function S7e(e,t,n,r){return r.all(e)}const C7e=w5e("type",{invalid:T7e,unknown:E7e,handlers:{comment:Qje,doctype:Jje,element:v7e,raw:_7e,root:S7e,text:jre}});function T7e(e){throw new Error("Expected node, not `"+e+"`")}function E7e(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const A7e={},j7e={},N7e=[];function I7e(e,t){const n=A7e,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:M7e,all:R7e,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Ije,characterReferences:n.characterReferences||j7e,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?hv:fD,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function M7e(e,t,n){return C7e(e,t,n,this)}function R7e(e){const t=[],n=e&&e.children||N7e;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function D7e(e){return Array.isArray(e)?e:[e]}function R5(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const l=t?n[o]+(n[o+1]||""):n[o];s.push([l,r]),r+=n[o].length,r+=((i=n[o+1])==null?void 0:i.length)||0}return s}function ZD(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Nre(e){return e==="ansi"||ZD(e)}function eL(e){return e==="none"}function Ire(e){return eL(e)}function Mre(e,t){var r;if(!t)return e;e.properties||(e.properties={}),(r=e.properties).class||(r.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const s of n)s&&!e.properties.class.includes(s)&&e.properties.class.push(s);return e}function L7e(e,t){let n=0;const r=[];for(const s of t)s>n&&r.push({...e,content:e.content.slice(n,s),offset:e.offset+n}),n=s;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function P7e(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((r,s)=>r-s);return n.length?e.map(r=>r.flatMap(s=>{const i=n.filter(o=>s.offset<o&&o<s.offset+s.content.length).map(o=>o-s.offset).sort((o,l)=>o-l);return i.length?L7e(s,i):s})):e}async function Rre(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function LT(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[s,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[s]=i:s===r&&Object.assign(n,i);return n}function pg(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function Dre(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Sf.Italic&&(t["font-style"]="italic"),e.fontStyle&Sf.Bold&&(t["font-weight"]="bold"),e.fontStyle&Sf.Underline&&(t["text-decoration"]="underline")),t}function O7e(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function $7e(e){const t=R5(e,!0).map(([s])=>s);function n(s){if(s===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=s,o=0;for(const l of t){if(i<l.length)break;i-=l.length,o++}return{line:o,character:i}}function r(s,i){let o=0;for(let l=0;l<s;l++)o+=t[l].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:r}}class zl extends Error{constructor(t){super(t),this.name="ShikiError"}}const Lre=new WeakMap;function D5(e,t){Lre.set(e,t)}function Tk(e){return Lre.get(e)}class yv{constructor(...t){Ue(this,"_stacks",{});Ue(this,"lang");if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,s]=t;this.lang=r,this._stacks={[s]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new yv(Object.fromEntries(D7e(n).map(r=>[r,II])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return aU(this._stacks[this.theme])}getScopes(t=this.theme){return aU(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function aU(e){const t=[],n=new Set;function r(s){var o;if(n.has(s))return;n.add(s);const i=(o=s==null?void 0:s.nameScopesList)==null?void 0:o.scopeName;i&&t.push(i),s.parent&&r(s.parent)}return r(e),t}function B7e(e,t){if(!(e instanceof yv))throw new zl("Invalid grammar state");return e.getInternalStack(t)}function z7e(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new zl(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...s.indexToPos(o),offset:o}}else{const l=s.lines[o.line];if(l===void 0)throw new zl(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${s.lines.length}`);if(o.character<0||o.character>l.length)throw new zl(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${l.length}`);return{...o,offset:s.posToIndex(o.line,o.character)}}};const s=$7e(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));F7e(i),e.set(n.meta,{decorations:i,converter:s,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var o;if(!((o=this.options.decorations)!=null&&o.length))return;const s=t(this).decorations.flatMap(l=>[l.start.offset,l.end.offset]);return P7e(n,s)},code(n){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const r=t(this),s=Array.from(n.children).filter(f=>f.type==="element"&&f.tagName==="span");if(s.length!==r.converter.lines.length)throw new zl(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(f,m,p,g){const b=s[f];let w="",y=-1,v=-1;if(m===0&&(y=0),p===0&&(v=0),p===Number.POSITIVE_INFINITY&&(v=b.children.length),y===-1||v===-1)for(let k=0;k<b.children.length;k++)w+=Pre(b.children[k]),y===-1&&w.length===m&&(y=k+1),v===-1&&w.length===p&&(v=k+1);if(y===-1)throw new zl(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(v===-1)throw new zl(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const x=b.children.slice(y,v);if(!g.alwaysWrap&&x.length===b.children.length)l(b,g,"line");else if(!g.alwaysWrap&&x.length===1&&x[0].type==="element")l(x[0],g,"token");else{const k={type:"element",tagName:"span",properties:{},children:x};l(k,g,"wrapper"),b.children.splice(y,x.length,k)}}function o(f,m){s[f]=l(s[f],m,"line")}function l(f,m,p){var w;const g=m.properties||{},b=m.transform||(y=>y);return f.tagName=m.tagName||"span",f.properties={...f.properties,...g,class:f.properties.class},(w=m.properties)!=null&&w.class&&Mre(f,m.properties.class),f=b(f,p)||f,f}const c=[],u=r.decorations.sort((f,m)=>m.start.offset-f.start.offset);for(const f of u){const{start:m,end:p}=f;if(m.line===p.line)i(m.line,m.character,p.character,f);else if(m.line<p.line){i(m.line,m.character,Number.POSITIVE_INFINITY,f);for(let g=m.line+1;g<p.line;g++)c.unshift(()=>o(g,f));i(p.line,0,p.character,f)}}c.forEach(f=>f())}}}function F7e(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new zl(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const s=e[r],i=n.start.offset<s.start.offset&&s.start.offset<n.end.offset,o=n.start.offset<s.end.offset&&s.end.offset<n.end.offset,l=s.start.offset<n.start.offset&&n.start.offset<s.end.offset,c=s.start.offset<n.end.offset&&n.end.offset<s.end.offset;if(i||o||l||c){if(o&&o||l&&c)continue;throw new zl(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Pre(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Pre).join(""):""}const q7e=[z7e()];function PT(e){return[...e.transformers||[],...q7e]}var gg=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],BA={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function H7e(e,t){const n=e.indexOf("\x1B[",t);if(n!==-1){const r=e.indexOf("m",n);return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function lU(e,t){let n=1;const r=e[t+n++];let s;if(r==="2"){const i=[e[t+n++],e[t+n++],e[t+n]].map(o=>Number.parseInt(o));i.length===3&&!i.some(o=>Number.isNaN(o))&&(s={type:"rgb",rgb:i})}else if(r==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(s={type:"table",index:Number(i)})}return[n,s]}function U7e(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],s=Number.parseInt(r);if(!Number.isNaN(s))if(s===0)t.push({type:"resetAll"});else if(s<=9)BA[s]&&t.push({type:"setDecoration",value:BA[s]});else if(s<=29){const i=BA[s-20];i&&t.push({type:"resetDecoration",value:i})}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:gg[s-30]}});else if(s===38){const[i,o]=lU(e,n);o&&t.push({type:"setForegroundColor",value:o}),n+=i}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:gg[s-40]}});else if(s===48){const[i,o]=lU(e,n);o&&t.push({type:"setBackgroundColor",value:o}),n+=i}else s===49?t.push({type:"resetBackgroundColor"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:gg[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:gg[s-100+8]}})}return t}function W7e(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const o=H7e(r,i),l=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(l.length>0&&s.push({value:l,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const c=U7e(o.sequence);for(const u of c)u.type==="resetAll"?(e=null,t=null,n.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroundColor"?t=null:u.type==="resetDecoration"&&n.delete(u.value);for(const u of c)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&n.add(u.value)}i=o.position}while(i<r.length);return s}}}var V7e={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function G7e(e=V7e){function t(l){return e[l]}function n(l){return`#${l.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let u=0;u<gg.length;u++)r.push(t(gg[u]));let l=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let d=0;d<6;d++)for(let f=0;f<6;f++)r.push(n([l[u],l[d],l[f]]));let c=8;for(let u=0;u<24;u++,c+=10)r.push(n([c,c,c]));return r}function i(l){return s()[l]}function o(l){switch(l.type){case"named":return t(l.name);case"rgb":return n(l.rgb);case"table":return i(l.index)}}return{value:o}}function K7e(e,t,n){const r=LT(e,n),s=R5(t),i=G7e(Object.fromEntries(gg.map(l=>{var c;return[l,(c=e.colors)==null?void 0:c[`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`]]}))),o=W7e();return s.map(l=>o.parse(l[0]).map(c=>{let u,d;c.decorations.has("reverse")?(u=c.background?i.value(c.background):e.bg,d=c.foreground?i.value(c.foreground):e.fg):(u=c.foreground?i.value(c.foreground):e.fg,d=c.background?i.value(c.background):void 0),u=pg(u,r),d=pg(d,r),c.decorations.has("dim")&&(u=Y7e(u));let f=Sf.None;return c.decorations.has("bold")&&(f|=Sf.Bold),c.decorations.has("italic")&&(f|=Sf.Italic),c.decorations.has("underline")&&(f|=Sf.Underline),{content:c.value,offset:l[1],color:u,bgColor:d,fontStyle:f}}))}function Y7e(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t)if(t[3]){const r=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${r}`}else return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(r=>`${r}${r}`).join("")}80`;const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function tL(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(ZD(r)||eL(s))return R5(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:i,colorMap:o}=e.setTheme(s);if(r==="ansi")return K7e(i,t,n);const l=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==l.name)throw new If(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${l.name}"`);if(!n.grammarState.themes.includes(i.name))throw new If(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Q7e(t,l,i,o,n)}function X7e(...e){if(e.length===2)return Tk(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(ZD(s)||eL(i))throw new If("Plain language does not have grammar state");if(s==="ansi")throw new If("ANSI language does not have grammar state");const{theme:o,colorMap:l}=t.setTheme(i),c=t.getLanguage(s);return new yv(OT(n,c,o,l,r).stateStack,c.name,o.name)}function Q7e(e,t,n,r,s){const i=OT(e,t,n,r,s),o=new yv(OT(e,t,n,r,s).stateStack,t.name,n.name);return D5(i.tokens,o),i.tokens}function OT(e,t,n,r,s){const i=LT(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:l=500}=s,c=R5(e);let u=s.grammarState?B7e(s.grammarState,n.name)??II:s.grammarContextCode!=null?OT(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:II,d=[];const f=[];for(let m=0,p=c.length;m<p;m++){const[g,b]=c[m];if(g===""){d=[],f.push([]);continue}if(o>0&&g.length>=o){d=[],f.push([{content:g,offset:b,color:"",fontStyle:0}]);continue}let w,y,v;s.includeExplanation&&(w=t.tokenizeLine(g,u),y=w.tokens,v=0);const x=t.tokenizeLine2(g,u,l),k=x.tokens.length/2;for(let S=0;S<k;S++){const T=x.tokens[2*S],_=S+1<k?x.tokens[2*S+2]:g.length;if(T===_)continue;const C=x.tokens[2*S+1],j=pg(r[jy.getForeground(C)],i),E=jy.getFontStyle(C),L={content:g.substring(T,_),offset:b+T,color:j,fontStyle:E};if(s.includeExplanation){const D=[];if(s.includeExplanation!=="scopeName")for(const R of n.settings){let $;switch(typeof R.scope){case"string":$=R.scope.split(/,/).map(B=>B.trim());break;case"object":$=R.scope;break;default:continue}D.push({settings:R,selectors:$.map(B=>B.split(/ /))})}L.explanation=[];let M=0;for(;T+M<_;){const R=y[v],$=g.substring(R.startIndex,R.endIndex);M+=$.length,L.explanation.push({content:$,scopes:s.includeExplanation==="scopeName"?J7e(R.scopes):Z7e(D,R.scopes)}),v+=1}}d.push(L)}f.push(d),d=[],u=x.ruleStack}return{tokens:f,stateStack:u}}function J7e(e){return e.map(t=>({scopeName:t}))}function Z7e(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];n[r]={scopeName:i,themeMatches:tNe(e,i,t.slice(0,r))}}return n}function cU(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function eNe(e,t,n){if(!cU(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)cU(e[r],n[s])&&(r-=1),s-=1;return r===-1}function tNe(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const o of s)if(eNe(o,t,n)){r.push(i);break}return r}function Ore(e,t,n){const r=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),s=r.map(c=>{const u=tL(e,t,{...n,theme:c.theme}),d=Tk(u),f=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:u,state:d,theme:f}}),i=nNe(...s.map(c=>c.tokens)),o=i[0].map((c,u)=>c.map((d,f)=>{const m={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(m.explanation=d.explanation),i.forEach((p,g)=>{const{content:b,explanation:w,offset:y,...v}=p[u][f];m.variants[r[g].color]=v}),m})),l=s[0].state?new yv(Object.fromEntries(s.map(c=>{var u;return[c.theme,(u=c.state)==null?void 0:u.getInternalStack(c.theme)]})),s[0].state.lang):void 0;return l&&D5(o,l),o}function nNe(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(c=>c[r]),i=t.map(()=>[]);t.forEach((c,u)=>c.push(i[u]));const o=s.map(()=>0),l=s.map(c=>c[0]);for(;l.every(c=>c);){const c=Math.min(...l.map(u=>u.content.length));for(let u=0;u<n;u++){const d=l[u];d.content.length===c?(i[u].push(d),o[u]+=1,l[u]=s[u][o[u]]):(i[u].push({...d,content:d.content.slice(0,c)}),l[u]={...d,content:d.content.slice(c),offset:d.offset+c})}}}return t}function $T(e,t,n){let r,s,i,o,l,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:d="--shiki-"}=n,f=Object.entries(n.themes).filter(w=>w[1]).map(w=>({color:w[0],theme:w[1]})).sort((w,y)=>w.color===u?-1:y.color===u?1:0);if(f.length===0)throw new If("`themes` option must not be empty");const m=Ore(e,t,n);if(c=Tk(m),u&&!f.find(w=>w.color===u))throw new If(`\`themes\` option must contain the defaultColor key \`${u}\``);const p=f.map(w=>e.getTheme(w.theme)),g=f.map(w=>w.color);i=m.map(w=>w.map(y=>rNe(y,g,d,u))),c&&D5(i,c);const b=f.map(w=>LT(w.theme,n));s=f.map((w,y)=>(y===0&&u?"":`${d+w.color}:`)+(pg(p[y].fg,b[y])||"inherit")).join(";"),r=f.map((w,y)=>(y===0&&u?"":`${d+w.color}-bg:`)+(pg(p[y].bg,b[y])||"inherit")).join(";"),o=`shiki-themes ${p.map(w=>w.name).join(" ")}`,l=u?void 0:[s,r].join(";")}else if("theme"in n){const u=LT(n.theme,n);i=tL(e,t,n);const d=e.getTheme(n.theme);r=pg(d.bg,u),s=pg(d.fg,u),o=d.name,c=Tk(i)}else throw new If("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:l,grammarState:c}}function rNe(e,t,n,r){const s={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(c=>Dre(e.variants[c])),o=new Set(i.flatMap(c=>Object.keys(c))),l={};return i.forEach((c,u)=>{for(const d of o){const f=c[d]||"inherit";if(u===0&&r)l[d]=f;else{const m=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[u]+(d==="color"?"":m);l[p]=f}}}),s.htmlStyle=l,s}function BT(e,t,n,r={meta:{},options:n,codeToHast:(s,i)=>BT(e,s,i),codeToTokens:(s,i)=>$T(e,s,i)}){var p,g;let s=t;for(const b of PT(n))s=((p=b.preprocess)==null?void 0:p.call(r,s,n))||s;let{tokens:i,fg:o,bg:l,themeName:c,rootStyle:u,grammarState:d}=$T(e,s,n);const{mergeWhitespaces:f=!0}=n;f===!0?i=iNe(i):f==="never"&&(i=oNe(i));const m={...r,get source(){return s}};for(const b of PT(n))i=((g=b.tokens)==null?void 0:g.call(m,i))||i;return sNe(i,{...n,fg:o,bg:l,themeName:c,rootStyle:u},m,d)}function sNe(e,t,n,r=Tk(e)){var g,b,w;const s=PT(t),i=[],o={type:"root",children:[]},{structure:l="classic",tabindex:c="0"}=t;let u={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...c!==!1&&c!=null?{tabindex:c.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([y])=>!y.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const f=[],m={...n,structure:l,addClassToHast:Mre,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((y,v)=>{var S,T;v&&(l==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&i.push({type:"text",value:`
`}));let x={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const _ of y){let C={type:"element",tagName:"span",properties:{..._.htmlAttrs},children:[{type:"text",value:_.content}]};_.htmlStyle;const j=O7e(_.htmlStyle||Dre(_));j&&(C.properties.style=j);for(const E of s)C=((S=E==null?void 0:E.span)==null?void 0:S.call(m,C,v+1,k,x,_))||C;l==="inline"?o.children.push(C):l==="classic"&&x.children.push(C),k+=_.content.length}if(l==="classic"){for(const _ of s)x=((T=_==null?void 0:_.line)==null?void 0:T.call(m,x,v+1))||x;f.push(x),i.push(x)}}),l==="classic"){for(const y of s)d=((g=y==null?void 0:y.code)==null?void 0:g.call(m,d))||d;u.children.push(d);for(const y of s)u=((b=y==null?void 0:y.pre)==null?void 0:b.call(m,u))||u;o.children.push(u)}let p=o;for(const y of s)p=((w=y==null?void 0:y.root)==null?void 0:w.call(m,p))||p;return r&&D5(p,r),p}function iNe(e){return e.map(t=>{const n=[];let r="",s=0;return t.forEach((i,o)=>{const c=!(i.fontStyle&&i.fontStyle&Sf.Underline);c&&i.content.match(/^\s+$/)&&t[o+1]?(s||(s=i.offset),r+=i.content):r?(c?n.push({...i,offset:s,content:r+i.content}):n.push({content:r,offset:s},i),s=0,r=""):n.push(i)}),n})}function oNe(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,i,o]=r;if(!s&&!o)return n;const l=[{...n,offset:n.offset+s.length,content:i}];return s&&l.unshift({content:s,offset:n.offset}),o&&l.push({content:o,offset:n.offset+s.length+i.length}),l}))}function aNe(e,t,n){var i;const r={meta:{},options:n,codeToHast:(o,l)=>BT(e,o,l),codeToTokens:(o,l)=>$T(e,o,l)};let s=I7e(BT(e,t,n,r));for(const o of PT(n))s=((i=o.postprocess)==null?void 0:i.call(r,s,n))||s;return s}const uU={light:"#333333",dark:"#bbbbbb"},dU={light:"#fffffe",dark:"#1e1e1e"},hU="__shiki_resolved";function nL(e){var l,c,u,d,f;if(e!=null&&e[hU])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:r}=t;if(!n||!r){const m=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(l=m==null?void 0:m.settings)!=null&&l.foreground&&(r=m.settings.foreground),(c=m==null?void 0:m.settings)!=null&&c.background&&(n=m.settings.background),!r&&((u=t==null?void 0:t.colors)!=null&&u["editor.foreground"])&&(r=t.colors["editor.foreground"]),!n&&((d=t==null?void 0:t.colors)!=null&&d["editor.background"])&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?uU.light:uU.dark),n||(n=t.type==="light"?dU.light:dU.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const i=new Map;function o(m){var g;if(i.has(m))return i.get(m);s+=1;const p=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(g=t.colorReplacements)!=null&&g[`#${p}`]?o(m):(i.set(m,p),p)}t.settings=t.settings.map(m=>{var w,y;const p=((w=m.settings)==null?void 0:w.foreground)&&!m.settings.foreground.startsWith("#"),g=((y=m.settings)==null?void 0:y.background)&&!m.settings.background.startsWith("#");if(!p&&!g)return m;const b={...m,settings:{...m.settings}};if(p){const v=o(m.settings.foreground);t.colorReplacements[v]=m.settings.foreground,b.settings.foreground=v}if(g){const v=o(m.settings.background);t.colorReplacements[v]=m.settings.background,b.settings.background=v}return b});for(const m of Object.keys(t.colors||{}))if((m==="editor.foreground"||m==="editor.background"||m.startsWith("terminal.ansi"))&&!((f=t.colors[m])!=null&&f.startsWith("#"))){const p=o(t.colors[m]);t.colorReplacements[p]=t.colors[m],t.colors[m]=p}return Object.defineProperty(t,hU,{enumerable:!1,writable:!1,value:!0}),t}async function $re(e){return Array.from(new Set((await Promise.all(e.filter(t=>!Nre(t)).map(async t=>await Rre(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Bre(e){return(await Promise.all(e.map(async n=>Ire(n)?null:nL(await Rre(n))))).filter(n=>!!n)}class lNe extends Nje{constructor(n,r,s,i={}){super(n);Ue(this,"_resolvedThemes",new Map);Ue(this,"_resolvedGrammars",new Map);Ue(this,"_langMap",new Map);Ue(this,"_langGraph",new Map);Ue(this,"_textmateThemeCache",new WeakMap);Ue(this,"_loadedThemesCache",null);Ue(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=s,this._alias=i,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=nL(n);return r.name&&(this._resolvedThemes.set(r.name,r),this._loadedThemesCache=null),r}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let r=this._textmateThemeCache.get(n);r||(r=NT.createFromRawTheme(n),this._textmateThemeCache.set(n,r)),this._syncRegistry.setTheme(r)}getGrammar(n){if(this._alias[n]){const r=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],r.has(n))throw new zl(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,l,c,u;if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(d=>{var f;return(f=d.embeddedLangsLazy)==null?void 0:f.includes(n.name)}));this._resolver.addLanguage(n);const s={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,s);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(d=>{this._alias[d]=n.name}),this._loadedLanguagesCache=null,r.size)for(const d of r)this._resolvedGrammars.delete(d.name),this._loadedLanguagesCache=null,(l=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||l.delete(d.scopeName),(u=(c=this._syncRegistry)==null?void 0:c._grammars)==null||u.delete(d.scopeName),this.loadLanguage(this._langMap.get(d.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const r=Array.from(this._langGraph.entries()),s=r.filter(([i,o])=>!o);if(s.length){const i=r.filter(([o,l])=>{var c;return l&&((c=l.embeddedLangs)==null?void 0:c.some(u=>s.map(([d])=>d).includes(u)))}).filter(o=>!s.includes(o));throw new zl(`Missing languages ${s.map(([o])=>`\`${o}\``).join(", ")}, required by ${i.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[i,o]of r)this._resolver.addLanguage(o);for(const[i,o]of r)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const r of n.embeddedLangs)this._langGraph.set(r,this._langMap.get(r))}}class cNe{constructor(t,n){Ue(this,"_langs",new Map);Ue(this,"_scopeToLang",new Map);Ue(this,"_injections",new Map);Ue(this,"_onigLib");this._onigLib={createOnigScanner:r=>t.createScanner(r),createOnigString:r=>t.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let r=[];for(let s=1;s<=n.length;s++){const i=n.slice(0,s).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let Nw=0;function uNe(e){Nw+=1,e.warnings!==!1&&Nw>=10&&Nw%10===0&&console.warn(`[Shiki] ${Nw} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new zl("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(nL),s=new cNe(e.engine,n),i=new lNe(s,r,n,e.langAlias);let o;function l(v){w();const x=i.getGrammar(typeof v=="string"?v:v.name);if(!x)throw new zl(`Language \`${v}\` not found, you may need to load it first`);return x}function c(v){if(v==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();const x=i.getTheme(v);if(!x)throw new zl(`Theme \`${v}\` not found, you may need to load it first`);return x}function u(v){w();const x=c(v);o!==v&&(i.setTheme(x),o=v);const k=i.getColorMap();return{theme:x,colorMap:k}}function d(){return w(),i.getLoadedThemes()}function f(){return w(),i.getLoadedLanguages()}function m(...v){w(),i.loadLanguages(v.flat(1))}async function p(...v){return m(await $re(v))}function g(...v){w();for(const x of v.flat(1))i.loadTheme(x)}async function b(...v){return w(),g(await Bre(v))}function w(){if(t)throw new zl("Shiki instance has been disposed")}function y(){t||(t=!0,i.dispose(),Nw-=1)}return{setTheme:u,getTheme:c,getLanguage:l,getLoadedThemes:d,getLoadedLanguages:f,loadLanguage:p,loadLanguageSync:m,loadTheme:b,loadThemeSync:g,dispose:y,[Symbol.dispose]:y}}async function dNe(e={}){e.loadWasm;const[t,n,r]=await Promise.all([Bre(e.themes||[]),$re(e.langs||[]),e.engine||cre(e.loadWasm||UAe())]);return uNe({...e,themes:t,langs:n,engine:r})}async function hNe(e={}){const t=await dNe(e);return{getLastGrammarState:(...n)=>X7e(t,...n),codeToTokensBase:(n,r)=>tL(t,n,r),codeToTokensWithThemes:(n,r)=>Ore(t,n,r),codeToTokens:(n,r)=>$T(t,n,r),codeToHast:(n,r)=>BT(t,n,r),codeToHtml:(n,r)=>aNe(t,n,r),...t,getInternalContext:()=>t}}function fNe(e,t,n){let r,s,i;{const l=e;r=l.langs,s=l.themes,i=l.engine}async function o(l){function c(p){if(typeof p=="string"){if(Nre(p))return[];const g=r[p];if(!g)throw new If(`Language \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}function u(p){if(Ire(p))return"none";if(typeof p=="string"){const g=s[p];if(!g)throw new If(`Theme \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}const d=(l.themes??[]).map(p=>u(p)),f=(l.langs??[]).map(p=>c(p)),m=await hNe({engine:l.engine??i(),...l,themes:d,langs:f});return{...m,loadLanguage(...p){return m.loadLanguage(...p.map(c))},loadTheme(...p){return m.loadTheme(...p.map(u))}}}return o}const mNe=fNe({langs:SAe,themes:TAe,engine:()=>cre(fe(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const pNe=["github-light-default","github-dark-default"];let E2=null,RI=null;const DI=new Set,zA=new Map,fU=new Set,gNe=128,ix=new Map;function zre(e,t,n){return`${t}\0${n}\0${e}`}function bNe(e,t){if(ix.size>=gNe){const n=ix.keys().next().value;n!==void 0&&ix.delete(n)}ix.set(e,t)}function yNe(e,t,n){return ix.get(zre(e,t,n))??null}function vNe(){return E2||(E2=mNe({langs:[],themes:pNe}).then(e=>(RI=e,e)).catch(e=>{throw E2=null,e})),E2}async function Fre(e){const t=await vNe();if(DI.has(e))return t;if(fU.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=zA.get(e);return n||(n=t.loadLanguage(e).then(()=>{DI.add(e)}).catch(r=>{throw fU.add(e),r}).finally(()=>{zA.delete(e)}),zA.set(e,n)),await n,t}const wNe=1e5,xNe=2e4;function LI(e){if(e.length>wNe)return!0;let t=0;const n=e.length;for(let r=0;r<=n;r++)if(r===n||e.charCodeAt(r)===10){if(r-t>xNe)return!0;t=r+1}return!1}function mU(e,t,n,r=!0){if(RI&&DI.has(t))try{const s=RI.codeToHtml(e,{lang:t,theme:n});return r&&bNe(zre(e,t,n),s),s}catch(s){return console.warn("[web-shell] sync highlight failed for lang=%s",t,s),null}return null}const kNe=()=>{},_Ne=()=>kNe,qre=h.createContext(_Ne);function SNe(){return h.useContext(qre)}function Hre(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=Hre(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ure(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Hre(e))&&(r&&(r+=" "),r+=t);return r}const pU=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,gU=Ure,d1=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return gU(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],f=i==null?void 0:i[u];if(d===null)return null;const m=pU(d)||pU(f);return s[u][m]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:m,...p}=d;return Object.entries(p).every(g=>{let[b,w]=g;return Array.isArray(w)?w.includes({...i,...l}[b]):{...i,...l}[b]===w})?[...u,f,m]:u},[]);return gU(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};function bU(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function CNe(...e){return t=>{let n=!1;const r=e.map(s=>{const i=bU(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():bU(e[s],null)}}}}function Nr(...e){return h.useCallback(CNe(...e),e)}function Pp(e){const t=h.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,l=!1;const c=[];yU(s)&&typeof A2=="function"&&(s=A2(s._payload)),h.Children.forEach(s,m=>{var p;if(NNe(m)){l=!0;const g=m;let b="child"in g.props?g.props.child:g.props.children;yU(b)&&typeof A2=="function"&&(b=A2(b._payload)),o=ENe(g,b),c.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else c.push(m)}),o?o=h.cloneElement(o,void 0,c):!l&&h.Children.count(s)===1&&h.isValidElement(s)&&(o=s);const u=o?jNe(o):void 0,d=Nr(r,u);if(!o){if(s||s===0)throw new Error(l?DNe(e):RNe(e));return s}const f=ANe(i,o.props??{});return o.type!==h.Fragment&&(f.ref=r?d:u),h.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var rL=Pp("Slot"),Wre=Symbol.for("radix.slottable");function TNe(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=Wre,t}var ENe=(e,t)=>{if("child"in e.props){const n=e.props.child;return h.isValidElement(n)?h.cloneElement(n,void 0,e.props.children(n.props.children)):null}return h.isValidElement(t)?t:null};function ANe(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function jNe(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)}function NNe(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Wre}var INe=Symbol.for("react.lazy");function yU(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===INe&&"_payload"in e&&MNe(e._payload)}function MNe(e){return typeof e=="object"&&e!==null&&"then"in e}var RNe=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,DNe=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,A2=B3[" use ".trim().toString()],LNe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],nr=LNe.reduce((e,t)=>{const n=Pp(`Primitive.${t}`),r=h.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Vre(e,t){e&&xd.flushSync(()=>e.dispatchEvent(t))}var Gre=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"}),PNe="VisuallyHidden",Kre=h.forwardRef((e,t)=>a.jsx(nr.span,{...e,ref:t,style:{...Gre,...e.style}}));Kre.displayName=PNe;var ONe=Kre;function Nl(e,t=[]){let n=[];function r(i,o){const l=h.createContext(o);l.displayName=i+"Context";const c=n.length;n=[...n,o];const u=f=>{var y;const{scope:m,children:p,...g}=f,b=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,w=h.useMemo(()=>g,Object.values(g));return a.jsx(b.Provider,{value:w,children:p})};u.displayName=i+"Provider";function d(f,m,p={}){var y;const{optional:g=!1}=p,b=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,w=h.useContext(b);if(w)return w;if(o!==void 0)return o;if(!g)throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=n.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,$Ne(s,...t)]}function $Ne(...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(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function sL(e){const t=e+"CollectionProvider",[n,r]=Nl(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:w,children:y}=b,v=h.useRef(null),x=h.useRef(new Map).current;return a.jsx(s,{scope:w,itemMap:x,collectionRef:v,children:y})};o.displayName=t;const l=e+"CollectionSlot",c=Pp(l),u=h.forwardRef((b,w)=>{const{scope:y,children:v}=b,x=i(l,y),k=Nr(w,x.collectionRef);return a.jsx(c,{ref:k,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=Pp(d),p=h.forwardRef((b,w)=>{const{scope:y,children:v,...x}=b,k=h.useRef(null),S=Nr(w,k),T=i(d,y);return h.useEffect(()=>(T.itemMap.set(k,{ref:k,...x}),()=>void T.itemMap.delete(k))),a.jsx(m,{[f]:"",ref:S,children:v})});p.displayName=d;function g(b){const w=i(e+"CollectionConsumer",b);return h.useCallback(()=>{const v=w.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(w.itemMap.values()).sort((T,_)=>x.indexOf(T.ref.current)-x.indexOf(_.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,r]}function bn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)}}var Fa=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},BNe=B3[" useInsertionEffect ".trim().toString()]||Fa;function Ql({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=zNe({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s;{const d=h.useRef(e!==void 0);h.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"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.`),d.current=l},[l,r])}const u=h.useCallback(d=>{var f;if(l){const m=FNe(d)?d(e):d;m!==e&&((f=o.current)==null||f.call(o,m))}else i(d)},[l,e,i,o]);return[c,u]}function zNe({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),s=h.useRef(n),i=h.useRef(t);return BNe(()=>{i.current=t},[t]),h.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function FNe(e){return typeof e=="function"}function qNe(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var Il=e=>{const{present:t,children:n}=e,r=HNe(t),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),i=UNe(r.ref,WNe(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:i}):null};Il.displayName="Presence";function HNe(e){const[t,n]=h.useState(),r=h.useRef(null),s=h.useRef(e),i=h.useRef("none"),o=h.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=qNe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{c==="mounted"?(i.current=o.current??Iw(r.current),o.current=void 0):i.current="none"},[c]),Fa(()=>{const d=r.current,f=s.current;if(f!==e){const p=i.current,g=Iw(d);e?(o.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),Fa(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,m=g=>{const w=Iw(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&w&&(u("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=g=>{g.target===t&&(i.current=Iw(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:h.useCallback(d=>{if(d){const f=getComputedStyle(d);r.current=f,o.current=Iw(f)}else r.current=null;n(d)},[])}}function vU(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function UNe(...e){const t=h.useRef(e);return t.current=e,h.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const l=vU(o,n);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let o=0;o<i.length;o++){const l=i[o];typeof l=="function"?l():vU(r[o],null)}}},[])}function Iw(e){return(e==null?void 0:e.animationName)||"none"}function WNe(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 VNe=B3[" useId ".trim().toString()]||(()=>{}),GNe=0;function bc(e){const[t,n]=h.useState(VNe());return Fa(()=>{n(r=>r??String(GNe++))},[e]),t?`radix-${t}`:""}var KNe=h.createContext(void 0);function vv(e){const t=h.useContext(KNe);return e||t||"ltr"}function ru(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var YNe="DismissableLayer",PI="dismissableLayer.update",XNe="dismissableLayer.pointerDownOutside",QNe="dismissableLayer.focusOutside",wU,iL=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),wv=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:c,...u}=e,d=h.useContext(iL),[f,m]=h.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=h.useState({}),b=Nr(t,m),w=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=y?w.indexOf(y):-1,x=f?w.indexOf(f):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,S=x>=v,T=h.useRef(!1),_=nIe(L=>{i==null||i(L),l==null||l(L),L.defaultPrevented||c==null||c()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:h.useCallback(L=>{if(!(L instanceof Node))return!1;const D=[...d.branches].some(M=>M.contains(L));return S&&!D},[d.branches,S])}),C=rIe(L=>{if(r&&T.current)return;const D=L.target;[...d.branches].some(R=>R.contains(D))||(o==null||o(L),l==null||l(L),L.defaultPrevented||c==null||c())},p),j=f?x===w.length-1:!1,E=ru(L=>{L.key==="Escape"&&(s==null||s(L),!L.defaultPrevented&&c&&(L.preventDefault(),c()))});return h.useEffect(()=>{if(j)return p.addEventListener("keydown",E,{capture:!0}),()=>p.removeEventListener("keydown",E,{capture:!0})},[p,j,E]),h.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(wU=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),xU(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=wU))}},[f,p,n,d]),h.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),xU())},[f,d]),h.useEffect(()=>{const L=()=>g({});return document.addEventListener(PI,L),()=>document.removeEventListener(PI,L)},[]),a.jsx(nr.div,{...u,ref:b,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:bn(e.onFocusCapture,C.onFocusCapture),onBlurCapture:bn(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:bn(e.onPointerDownCapture,_.onPointerDownCapture)})});wv.displayName=YNe;var JNe="DismissableLayerBranch",ZNe=h.forwardRef((e,t)=>{const n=h.useContext(iL),r=h.useRef(null),s=Nr(t,r);return h.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(nr.div,{...e,ref:s})});ZNe.displayName=JNe;function eIe(){const e=h.useContext(iL),[t,n]=h.useState(null);return h.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var tIe=()=>!0;function nIe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=tIe}=t,l=ru(e),c=h.useRef(!1),u=h.useRef(!1),d=h.useRef(new Map),f=h.useRef(()=>{});return h.useEffect(()=>{function m(){u.current=!1,s.current=!1,d.current.clear()}function p(){return Array.from(d.current.values()).some(Boolean)}function g(x){if(!u.current)return;const k=x.target;k instanceof Node&&[...i].some(T=>T.contains(k))||d.current.set(x.type,!0),x.type==="click"&&window.setTimeout(()=>{u.current&&f.current()},0)}function b(x){u.current&&d.current.set(x.type,!1)}const w=x=>{if(x.target&&!c.current){let k=function(){n.removeEventListener("click",f.current);const T=p();m(),T||Yre(XNe,l,S,{discrete:!0})};if(!o(x.target)){n.removeEventListener("click",f.current),m(),c.current=!1;return}const S={originalEvent:x};u.current=!0,s.current=r&&x.button===0,d.current.clear(),!r||x.button!==0?k():(n.removeEventListener("click",f.current),f.current=k,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),m();c.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const x of y)n.addEventListener(x,g,!0),n.addEventListener(x,b);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",w),n.removeEventListener("click",f.current);for(const x of y)n.removeEventListener(x,g,!0),n.removeEventListener(x,b)}},[n,l,r,s,i,o]),{onPointerDownCapture:()=>c.current=!0}}function rIe(e,t=globalThis==null?void 0:globalThis.document){const n=ru(e),r=h.useRef(!1);return h.useEffect(()=>{const s=i=>{i.target&&!r.current&&Yre(QNe,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function xU(){const e=new CustomEvent(PI);document.dispatchEvent(e)}function Yre(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Vre(s,i):s.dispatchEvent(i)}var FA="focusScope.autoFocusOnMount",qA="focusScope.autoFocusOnUnmount",kU={bubbles:!1,cancelable:!0},sIe="FocusScope",A_=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,c]=h.useState(null),u=ru(s),d=ru(i),f=h.useRef(null),m=Nr(t,c),p=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let b=function(x){if(p.paused||!l)return;const k=x.target;l.contains(k)?f.current=k:Rm(f.current,{select:!0})},w=function(x){if(p.paused||!l)return;const k=x.relatedTarget;k!==null&&(l.contains(k)||Rm(f.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const S of x)S.removedNodes.length>0&&Rm(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",w);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",w),v.disconnect()}}},[r,l,p.paused]),h.useEffect(()=>{if(l){SU.add(p);const b=document.activeElement;if(!l.contains(b)){const y=new CustomEvent(FA,kU);l.addEventListener(FA,u),l.dispatchEvent(y),y.defaultPrevented||(iIe(uIe(Xre(l)),{select:!0}),document.activeElement===b&&Rm(l))}return()=>{l.removeEventListener(FA,u),setTimeout(()=>{const y=new CustomEvent(qA,kU);l.addEventListener(qA,d),l.dispatchEvent(y),y.defaultPrevented||Rm(b??document.body,{select:!0}),l.removeEventListener(qA,d),SU.remove(p)},0)}}},[l,u,d,p]);const g=h.useCallback(b=>{if(!n&&!r||p.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(w&&y){const v=b.currentTarget,[x,k]=oIe(v);x&&k?!b.shiftKey&&y===k?(b.preventDefault(),n&&Rm(x,{select:!0})):b.shiftKey&&y===x&&(b.preventDefault(),n&&Rm(k,{select:!0})):y===v&&b.preventDefault()}},[n,r,p.paused]);return a.jsx(nr.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});A_.displayName=sIe;function iIe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Rm(r,{select:t}),document.activeElement!==n)return}function oIe(e){const t=Xre(e),n=_U(t,e),r=_U(t.reverse(),e);return[n,r]}function Xre(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 _U(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):aIe(r,{upTo:t})))return r}function aIe(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 lIe(e){return e instanceof HTMLInputElement&&"select"in e}function Rm(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&lIe(e)&&t&&e.select()}}var SU=cIe();function cIe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=CU(e,t),e.unshift(t)},remove(t){var n;e=CU(e,t),(n=e[0])==null||n.resume()}}}function CU(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function uIe(e){return e.filter(t=>t.tagName!=="A")}var dIe="Portal",xv=h.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=h.useState(!1);Fa(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?xd.createPortal(a.jsx(nr.div,{...r,ref:t}),o):null});xv.displayName=dIe;var j2=0,Bd=null;function L5(){h.useEffect(()=>{Bd||(Bd={start:TU(),end:TU()});const{start:e,end:t}=Bd;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),j2++,()=>{j2===1&&(Bd==null||Bd.start.remove(),Bd==null||Bd.end.remove(),Bd=null),j2=Math.max(0,j2-1)}},[])}function TU(){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 sh=function(){return sh=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},sh.apply(this,arguments)};function Qre(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 hIe(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var a4="right-scroll-bar-position",l4="width-before-scroll-bar",fIe="with-scroll-bars-hidden",mIe="--removed-body-scroll-bar-size";function HA(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pIe(e,t){var n=h.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 gIe=typeof window<"u"?h.useLayoutEffect:h.useEffect,EU=new WeakMap;function bIe(e,t){var n=pIe(null,function(r){return e.forEach(function(s){return HA(s,r)})});return gIe(function(){var r=EU.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(l){i.has(l)||HA(l,null)}),i.forEach(function(l){s.has(l)||HA(l,o)})}EU.set(n,e)},[e]),n}function yIe(e){return e}function vIe(e,t){t===void 0&&(t=yIe);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(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return s}function wIe(e){e===void 0&&(e={});var t=vIe(null);return t.options=sh({async:!0,ssr:!1},e),t}var Jre=function(e){var t=e.sideCar,n=Qre(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 h.createElement(r,sh({},n))};Jre.isSideCarExport=!0;function xIe(e,t){return e.useMedium(t),Jre}var Zre=wIe(),UA=function(){},P5=h.forwardRef(function(e,t){var n=h.useRef(null),r=h.useState({onScrollCapture:UA,onWheelCapture:UA,onTouchMoveCapture:UA}),s=r[0],i=r[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,b=e.inert,w=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,x=e.gapMode,k=Qre(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,T=bIe([n,t]),_=sh(sh({},k),s);return h.createElement(h.Fragment,null,d&&h.createElement(S,{sideCar:Zre,removeScrollBar:u,shards:f,noRelative:p,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!w,lockRef:n,gapMode:x}),o?h.cloneElement(h.Children.only(l),sh(sh({},_),{ref:T})):h.createElement(v,sh({},_,{className:c,ref:T}),l))});P5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};P5.classNames={fullWidth:l4,zeroRight:a4};var kIe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function _Ie(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kIe();return t&&e.setAttribute("nonce",t),e}function SIe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function CIe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var TIe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=_Ie())&&(SIe(t,n),CIe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},EIe=function(){var e=TIe();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ese=function(){var e=EIe(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},AIe={left:0,top:0,right:0,gap:0},WA=function(e){return parseInt(e||"",10)||0},jIe=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[WA(n),WA(r),WA(s)]},NIe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return AIe;var t=jIe(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])}},IIe=ese(),ty="data-scroll-locked",MIe=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(fIe,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(l,"px ").concat(r,`;
  }
  body[`).concat(ty,`] {
    overflow: hidden `).concat(r,`;
    overscroll-behavior: contain;
    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
    padding-left: `.concat(s,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(l,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(a4,` {
    right: `).concat(l,"px ").concat(r,`;
  }
  
  .`).concat(l4,` {
    margin-right: `).concat(l,"px ").concat(r,`;
  }
  
  .`).concat(a4," .").concat(a4,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(l4," .").concat(l4,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(ty,`] {
    `).concat(mIe,": ").concat(l,`px;
  }
`)},AU=function(){var e=parseInt(document.body.getAttribute(ty)||"0",10);return isFinite(e)?e:0},RIe=function(){h.useEffect(function(){return document.body.setAttribute(ty,(AU()+1).toString()),function(){var e=AU()-1;e<=0?document.body.removeAttribute(ty):document.body.setAttribute(ty,e.toString())}},[])},DIe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;RIe();var i=h.useMemo(function(){return NIe(s)},[s]);return h.createElement(IIe,{styles:MIe(i,!t,s,n?"":"!important")})},OI=!1;if(typeof window<"u")try{var N2=Object.defineProperty({},"passive",{get:function(){return OI=!0,!0}});window.addEventListener("test",N2,N2),window.removeEventListener("test",N2,N2)}catch{OI=!1}var Y1=OI?{passive:!1}:!1,LIe=function(e){return e.tagName==="TEXTAREA"},tse=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!LIe(e)&&n[t]==="visible")},PIe=function(e){return tse(e,"overflowY")},OIe=function(e){return tse(e,"overflowX")},jU=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=nse(e,r);if(s){var i=rse(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$Ie=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},BIe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},nse=function(e,t){return e==="v"?PIe(t):OIe(t)},rse=function(e,t){return e==="v"?$Ie(t):BIe(t)},zIe=function(e,t){return e==="h"&&t==="rtl"?-1:1},FIe=function(e,t,n,r,s){var i=zIe(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,m=0;do{if(!l)break;var p=rse(e,l),g=p[0],b=p[1],w=p[2],y=b-w-i*g;(g||y)&&nse(e,l)&&(f+=y,m+=g);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(u=!0),u},I2=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},NU=function(e){return[e.deltaX,e.deltaY]},IU=function(e){return e&&"current"in e?e.current:e},qIe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},HIe=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},UIe=0,X1=[];function WIe(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(UIe++)[0],i=h.useState(ese)[0],o=h.useRef(e);h.useEffect(function(){o.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var b=hIe([e.lockRef.current],(e.shards||[]).map(IU),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(b,w){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var y=I2(b),v=n.current,x="deltaX"in b?b.deltaX:v[0]-y[0],k="deltaY"in b?b.deltaY:v[1]-y[1],S,T=b.target,_=Math.abs(x)>Math.abs(k)?"h":"v";if("touches"in b&&_==="h"&&T.type==="range")return!1;var C=window.getSelection(),j=C&&C.anchorNode,E=j?j===T||j.contains(T):!1;if(E)return!1;var L=jU(_,T);if(!L)return!0;if(L?S=_:(S=_==="v"?"h":"v",L=jU(_,T)),!L)return!1;if(!r.current&&"changedTouches"in b&&(x||k)&&(r.current=S),!S)return!0;var D=r.current||S;return FIe(D,w,b,D==="h"?x:k)},[]),c=h.useCallback(function(b){var w=b;if(!(!X1.length||X1[X1.length-1]!==i)){var y="deltaY"in w?NU(w):I2(w),v=t.current.filter(function(S){return S.name===w.type&&(S.target===w.target||w.target===S.shadowParent)&&qIe(S.delta,y)})[0];if(v&&v.should){w.cancelable&&w.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(IU).filter(Boolean).filter(function(S){return S.contains(w.target)}),k=x.length>0?l(w,x[0]):!o.current.noIsolation;k&&w.cancelable&&w.preventDefault()}}},[]),u=h.useCallback(function(b,w,y,v){var x={name:b,delta:w,target:y,should:v,shadowParent:VIe(y)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(k){return k!==x})},1)},[]),d=h.useCallback(function(b){n.current=I2(b),r.current=void 0},[]),f=h.useCallback(function(b){u(b.type,NU(b),b.target,l(b,e.lockRef.current))},[]),m=h.useCallback(function(b){u(b.type,I2(b),b.target,l(b,e.lockRef.current))},[]);h.useEffect(function(){return X1.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Y1),document.addEventListener("touchmove",c,Y1),document.addEventListener("touchstart",d,Y1),function(){X1=X1.filter(function(b){return b!==i}),document.removeEventListener("wheel",c,Y1),document.removeEventListener("touchmove",c,Y1),document.removeEventListener("touchstart",d,Y1)}},[]);var p=e.removeScrollBar,g=e.inert;return h.createElement(h.Fragment,null,g?h.createElement(i,{styles:HIe(s)}):null,p?h.createElement(DIe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function VIe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const GIe=xIe(Zre,WIe);var j_=h.forwardRef(function(e,t){return h.createElement(P5,sh({},e,{ref:t,sideCar:GIe}))});j_.classNames=P5.classNames;var KIe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Q1=new WeakMap,M2=new WeakMap,R2={},VA=0,sse=function(e){return e&&(e.host||sse(e.parentNode))},YIe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=sse(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})},XIe=function(e,t,n,r){var s=YIe(t,Array.isArray(e)?e:[e]);R2[n]||(R2[n]=new WeakMap);var i=R2[n],o=[],l=new Set,c=new Set(s),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(l.has(m))d(m);else try{var p=m.getAttribute(r),g=p!==null&&p!=="false",b=(Q1.get(m)||0)+1,w=(i.get(m)||0)+1;Q1.set(m,b),i.set(m,w),o.push(m),b===1&&g&&M2.set(m,!0),w===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),l.clear(),VA++,function(){o.forEach(function(f){var m=Q1.get(f)-1,p=i.get(f)-1;Q1.set(f,m),i.set(f,p),m||(M2.has(f)||f.removeAttribute(r),M2.delete(f)),p||f.removeAttribute(n)}),VA--,VA||(Q1=new WeakMap,Q1=new WeakMap,M2=new WeakMap,R2={})}},O5=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=KIe(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),XIe(r,s,n,"aria-hidden")):function(){return null}},$5="Dialog",[ise,ose]=Nl($5),[QIe,Sd]=ise($5),B5=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=h.useRef(null),c=h.useRef(null),[u,d]=Ql({prop:r,defaultProp:s??!1,onChange:i,caller:$5});return a.jsx(QIe,{scope:t,triggerRef:l,contentRef:c,contentId:bc(),titleId:bc(),descriptionId:bc(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};B5.displayName=$5;var ase="DialogTrigger",lse=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Sd(ase,n),i=Nr(t,s.triggerRef);return a.jsx(nr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":lL(s.open),...r,ref:i,onClick:bn(e.onClick,s.onOpenToggle)})});lse.displayName=ase;var oL="DialogPortal",[JIe,cse]=ise(oL,{forceMount:void 0}),z5=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=Sd(oL,t);return a.jsx(JIe,{scope:t,forceMount:n,children:h.Children.map(r,o=>a.jsx(Il,{present:n||i.open,children:a.jsx(xv,{asChild:!0,container:s,children:o})}))})};z5.displayName=oL;var zT="DialogOverlay",F5=h.forwardRef((e,t)=>{const n=cse(zT,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Sd(zT,e.__scopeDialog);return i.modal?a.jsx(Il,{present:r||i.open,children:a.jsx(eMe,{...s,ref:t})}):null});F5.displayName=zT;var ZIe=Pp("DialogOverlay.RemoveScroll"),eMe=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Sd(zT,n),i=eIe(),o=Nr(t,i);return a.jsx(j_,{as:ZIe,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(nr.div,{"data-state":lL(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),Ny="DialogContent",q5=h.forwardRef((e,t)=>{const n=cse(Ny,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Sd(Ny,e.__scopeDialog);return a.jsx(Il,{present:r||i.open,children:i.modal?a.jsx(tMe,{...s,ref:t}):a.jsx(nMe,{...s,ref:t})})});q5.displayName=Ny;var tMe=h.forwardRef((e,t)=>{const n=Sd(Ny,e.__scopeDialog),r=h.useRef(null),s=Nr(t,n.contentRef,r);return h.useEffect(()=>{const i=r.current;if(i)return O5(i)},[]),a.jsx(use,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:bn(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:bn(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:bn(e.onFocusOutside,i=>i.preventDefault())})}),nMe=h.forwardRef((e,t)=>{const n=Sd(Ny,e.__scopeDialog),r=h.useRef(!1),s=h.useRef(!1);return a.jsx(use,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),use=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=Sd(Ny,n);return L5(),a.jsx(a.Fragment,{children:a.jsx(A_,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(wv,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":lL(l.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),dse="DialogTitle",H5=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Sd(dse,n);return a.jsx(nr.h2,{id:s.titleId,...r,ref:t})});H5.displayName=dse;var hse="DialogDescription",aL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Sd(hse,n);return a.jsx(nr.p,{id:s.descriptionId,...r,ref:t})});aL.displayName=hse;var fse="DialogClose",kv=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Sd(fse,n);return a.jsx(nr.button,{type:"button",...r,ref:t,onClick:bn(e.onClick,()=>s.onOpenChange(!1))})});kv.displayName=fse;function lL(e){return e?"open":"closed"}var mse="AlertDialog",[rMe,p9t]=Nl(mse,[ose]),lm=ose(),pse=e=>{const{__scopeAlertDialog:t,...n}=e,r=lm(t);return a.jsx(B5,{...r,...n,modal:!0})};pse.displayName=mse;var sMe="AlertDialogTrigger",iMe=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lm(n);return a.jsx(lse,{...s,...r,ref:t})});iMe.displayName=sMe;var oMe="AlertDialogPortal",gse=e=>{const{__scopeAlertDialog:t,...n}=e,r=lm(t);return a.jsx(z5,{...r,...n})};gse.displayName=oMe;var aMe="AlertDialogOverlay",bse=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lm(n);return a.jsx(F5,{...s,...r,ref:t})});bse.displayName=aMe;var yse="AlertDialogContent",[lMe,cMe]=rMe(yse),vse=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,i=lm(n),o=h.useRef(null),l=Nr(t,o),c=h.useRef(null);return a.jsx(lMe,{scope:n,cancelRef:c,children:a.jsx(q5,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:bn(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:r})})});vse.displayName=yse;var uMe="AlertDialogTitle",wse=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lm(n);return a.jsx(H5,{...s,...r,ref:t})});wse.displayName=uMe;var dMe="AlertDialogDescription",xse=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lm(n);return a.jsx(aL,{...s,...r,ref:t})});xse.displayName=dMe;var hMe="AlertDialogAction",kse=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lm(n);return a.jsx(kv,{...s,...r,ref:t})});kse.displayName=hMe;var _se="AlertDialogCancel",Sse=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=cMe(_se,n),i=lm(n),o=Nr(t,s);return a.jsx(kv,{...i,...r,ref:o})});Sse.displayName=_se;var fMe=pse,mMe=gse,pMe=bse,gMe=vse,bMe=kse,yMe=Sse,vMe=wse,wMe=xse;function U5(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function W5(e){const[t,n]=h.useState(void 0);return Fa(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var V5="Checkbox",[xMe,g9t]=Nl(V5),[kMe,cL]=xMe(V5);function _Me(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[m,p]=Ql({prop:n,defaultProp:s??!1,onChange:c,caller:V5}),[g,b]=h.useState(null),[w,y]=h.useState(null),v=h.useRef(!1),x=g?!!o||!!g.closest("form"):!0,k={checked:m,disabled:i,setChecked:p,control:g,setControl:b,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:wp(s)?!1:s,isFormControl:x,bubbleInput:w,setBubbleInput:y};return a.jsx(kMe,{scope:t,...k,children:SMe(f)?f(k):r})}var Cse="CheckboxTrigger",Tse=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=cL(Cse,e),b=Nr(s,d),w=h.useRef(c);return h.useEffect(()=>{const y=i==null?void 0:i.form;if(y){const v=()=>f(w.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[i,f]),a.jsx(nr.button,{type:"button",role:"checkbox","aria-checked":wp(c)?"mixed":c,"aria-required":u,"data-state":Mse(c),"data-disabled":l?"":void 0,disabled:l,value:o,...r,ref:b,onKeyDown:bn(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:bn(n,y=>{f(v=>wp(v)?!0:!v),g&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});Tse.displayName=Cse;var Ese=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return a.jsx(_Me,{__scopeCheckbox:n,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(Tse,{...f,ref:t,__scopeCheckbox:n}),m&&a.jsx(Ise,{__scopeCheckbox:n})]})})});Ese.displayName=V5;var Ase="CheckboxIndicator",jse=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,i=cL(Ase,n);return a.jsx(Il,{present:r||wp(i.checked)||i.checked===!0,children:a.jsx(nr.span,{"data-state":Mse(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});jse.displayName=Ase;var Nse="CheckboxBubbleInput",Ise=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:p}=cL(Nse,e),g=Nr(n,p),b=U5(i),w=W5(r);h.useEffect(()=>{const v=m;if(!v)return;const x=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(x,"checked").set,T=!s.current;if(b!==i&&S){const _=new Event("click",{bubbles:T});v.indeterminate=wp(i),S.call(v,wp(i)?!1:i),v.dispatchEvent(_)}},[m,b,i,s]);const y=h.useRef(wp(i)?!1:i);return a.jsx(nr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ise.displayName=Nse;function SMe(e){return typeof e=="function"}function wp(e){return e==="indeterminate"}function Mse(e){return wp(e)?"indeterminate":e?"checked":"unchecked"}const CMe=["top","right","bottom","left"],Op=Math.min,Mf=Math.max,FT=Math.round,D2=Math.floor,Rf=e=>({x:e,y:e}),TMe={left:"right",right:"left",bottom:"top",top:"bottom"};function Rse(e,t,n){return Mf(e,Op(t,n))}function Gf(e,t){return typeof e=="function"?e(t):e}function $p(e){return e.split("-")[0]}function _v(e){return e.split("-")[1]}function uL(e){return e==="x"?"y":"x"}function dL(e){return e==="y"?"height":"width"}function hh(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function hL(e){return uL(hh(e))}function EMe(e,t,n){n===void 0&&(n=!1);const r=_v(e),s=hL(e),i=dL(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=qT(o)),[o,qT(o)]}function AMe(e){const t=qT(e);return[$I(e),t,$I(t)]}function $I(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const MU=["left","right"],RU=["right","left"],jMe=["top","bottom"],NMe=["bottom","top"];function IMe(e,t,n){switch(e){case"top":case"bottom":return n?t?RU:MU:t?MU:RU;case"left":case"right":return t?jMe:NMe;default:return[]}}function MMe(e,t,n,r){const s=_v(e);let i=IMe($p(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map($I)))),i}function qT(e){const t=$p(e);return TMe[t]+e.slice(t.length)}function RMe(e){var t,n,r,s;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(s=e.left)!=null?s:0}}function Dse(e){return typeof e!="number"?RMe(e):{top:e,right:e,bottom:e,left:e}}function HT(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 DU(e,t,n){let{reference:r,floating:s}=e;const i=hh(t),o=hL(t),l=dL(o),c=$p(t),u=i==="y",d=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,m=r[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-s.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-s.width,y:f};break;default:p={x:r.x,y:r.y}}const g=_v(t);return g&&(p[o]+=m*(g==="end"?1:-1)*(n&&u?-1:1)),p}async function DMe(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Gf(t,e),g=Dse(p),w=l[m?f==="floating"?"reference":"floating":f],y=HT(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),k=await(i.isElement==null?void 0:i.isElement(x))&&await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1},S=HT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-S.top+g.top)/k.y,bottom:(S.bottom-y.bottom+g.bottom)/k.y,left:(y.left-S.left+g.left)/k.x,right:(S.right-y.right+g.right)/k.x}}const LMe=50,PMe=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:DMe},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=DU(u,r,c),m=r,p=0;const g={};for(let b=0;b<i.length;b++){const w=i[b];if(!w)continue;const{name:y,fn:v}=w,{x,y:k,data:S,reset:T}=await v({x:d,y:f,initialPlacement:r,placement:m,strategy:s,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:t}});d=x??d,f=k??f,g[y]={...g[y],...S},T&&p<LMe&&(p++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(u=T.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):T.rects),{x:d,y:f}=DU(u,m,c)),b=-1)}return{x:d,y:f,placement:m,strategy:s,middlewareData:g}},OMe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Gf(e,t)||{};if(u==null)return{};const f=Dse(d),m={x:n,y:r},p=hL(s),g=dL(p),b=await o.getDimensions(u),w=p==="y",y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",k=i.reference[g]+i.reference[p]-m[p]-i.floating[g],S=m[p]-i.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let _=T?T[x]:0;(!_||!await(o.isElement==null?void 0:o.isElement(T)))&&(_=l.floating[x]||i.floating[g]);const C=k/2-S/2,j=_/2-b[g]/2-1,E=Op(f[y],j),L=Op(f[v],j),D=_-b[g]-L,M=_/2-b[g]/2+C,R=Rse(E,M,D),$=!c.arrow&&_v(s)!=null&&M!==R&&i.reference[g]/2-(M<E?E:L)-b[g]/2<0,B=$?M<E?M-E:M-D:0;return{[p]:m[p]+B,data:{[p]:R,centerOffset:M-R-B,...$&&{alignmentOffset:B}},reset:$}}}),$Me=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...w}=Gf(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=$p(s),v=hh(l),x=$p(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=m||(x||!b?[qT(l)]:AMe(l)),T=g!=="none";!m&&T&&S.push(...MMe(l,b,g,k));const _=[l,...S],C=await c.detectOverflow(t,w),j=[];let E=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&j.push(C[y]),f){const R=EMe(s,o,k);j.push(C[R[0]],C[R[1]])}if(E=[...E,{placement:s,overflows:j}],!j.every(R=>R<=0)){var L,D;const R=(((L=i.flip)==null?void 0:L.index)||0)+1,$=_[R];if($&&(!(f==="alignment"?v!==hh($):!1)||E.every(z=>hh(z.placement)===v?z.overflows[0]>0:!0)))return{data:{index:R,overflows:E},reset:{placement:$}};let B=(D=E.filter(N=>N.overflows[0]<=0).sort((N,z)=>N.overflows[1]-z.overflows[1])[0])==null?void 0:D.placement;if(!B)switch(p){case"bestFit":{var M;const N=(M=E.filter(z=>{if(T){const G=hh(z.placement);return G===v||G==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(G=>G>0).reduce((G,I)=>G+I,0)]).sort((z,G)=>z[1]-G[1])[0])==null?void 0:M[0];N&&(B=N);break}case"initialPlacement":B=l;break}if(s!==B)return{reset:{placement:B}}}return{}}}};function LU(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function PU(e){return CMe.some(t=>e[t]>=0)}const BMe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=Gf(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=LU(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:PU(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),l=LU(o,n.floating);return{data:{escapedOffsets:l,escaped:PU(l)}}}default:return{}}}}},Lse=new Set(["left","top"]);async function zMe(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=$p(n),l=_v(n),c=hh(n)==="y",u=Lse.has(o)?-1:1,d=i&&c?-1:1,f=Gf(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const FMe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=t,c=await zMe(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},qMe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:v=>{let{x,y:k}=v;return{x,y:k}}},...u}=Gf(e,t),d={x:n,y:r},f=await i.detectOverflow(t,u),m=hh(s),p=uL(m);let g=d[p],b=d[m];const w=(v,x)=>Rse(x+f[v==="y"?"top":"left"],x,x-f[v==="y"?"bottom":"right"]);o&&(g=w(p,g)),l&&(b=w(m,b));const y=c.fn({...t,[p]:g,[m]:b});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:o,[m]:l}}}}}},HMe=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:s,y:i,placement:o,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=Gf(e,t),m={x:s,y:i},p=hh(o),g=uL(p);let b=m[g],w=m[p];const y=Gf(u,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(r=y.crossAxis)!=null?r:0};if(d){const S=g==="y"?"height":"width",T=l.reference[g]-l.floating[S]+v.mainAxis,_=l.reference[g]+l.reference[S]-v.mainAxis;b<T?b=T:b>_&&(b=_)}if(f){var x,k;const S=g==="y"?"width":"height",T=Lse.has($p(o)),_=l.reference[p]-l.floating[S]+(T&&((x=c.offset)==null?void 0:x[p])||0)+(T?0:v.crossAxis),C=l.reference[p]+l.reference[S]+(T?0:((k=c.offset)==null?void 0:k[p])||0)-(T?v.crossAxis:0);w<_?w=_:w>C&&(w=C)}return{[g]:b,[p]:w}}}},UMe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:s,elements:i}=t,{apply:o=()=>{},...l}=Gf(e,t),c=await s.detectOverflow(t,l),u=$p(n),d=_v(n),f=hh(n)==="y",{width:m,height:p}=r.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const w=p-c.top-c.bottom,y=m-c.left-c.right,v=Op(p-c[g],w),x=Op(m-c[b],y),k=t.middlewareData.shift,S=!k;let T=v,_=x;k!=null&&k.enabled.x&&(_=y),k!=null&&k.enabled.y&&(T=w),S&&!d&&(f?_=m-2*Mf(c.left,c.right):T=p-2*Mf(c.top,c.bottom)),await o({...t,availableWidth:_,availableHeight:T});const C=await s.getDimensions(i.floating);return m!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}};function G5(){return typeof window<"u"}function Sv(e){return Pse(e)?(e.nodeName||"").toLowerCase():"#document"}function yc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cm(e){var t;return(t=(Pse(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Pse(e){return G5()?e instanceof Node||e instanceof yc(e).Node:!1}function _h(e){return G5()?e instanceof Element||e instanceof yc(e).Element:!1}function l0(e){return G5()?e instanceof HTMLElement||e instanceof yc(e).HTMLElement:!1}function OU(e){return!G5()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yc(e).ShadowRoot}function K5(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Sh(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function WMe(e){return/^(table|td|th)$/.test(Sv(e))}function Y5(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const VMe=/transform|translate|scale|rotate|perspective|filter/,GMe=/paint|layout|strict|content/,W0=e=>!!e&&e!=="none";let GA;function fL(e){const t=_h(e)?Sh(e):e;return W0(t.transform)||W0(t.translate)||W0(t.scale)||W0(t.rotate)||W0(t.perspective)||!mL()&&(W0(t.backdropFilter)||W0(t.filter))||VMe.test(t.willChange||"")||GMe.test(t.contain||"")}function KMe(e){let t=zg(e);for(;l0(t)&&!Ek(t);){if(fL(t))return t;if(Y5(t))return null;t=zg(t)}return null}function mL(){return GA==null&&(GA=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),GA}function Ek(e){return/^(html|body|#document)$/.test(Sv(e))}function Sh(e){return yc(e).getComputedStyle(e)}function X5(e){return _h(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zg(e){if(Sv(e)==="html")return e;const t=e.assignedSlot||e.parentNode||OU(e)&&e.host||cm(e);return OU(t)?t.host:t}function Ose(e){const t=zg(e);return Ek(t)?(e.ownerDocument||e).body:l0(t)&&K5(t)?t:Ose(t)}function Ak(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Ose(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=yc(s);if(i){const l=BI(o);return t.concat(o,o.visualViewport||[],K5(s)?s:[],l&&n?Ak(l):[])}else return t.concat(s,Ak(s,[],n))}function BI(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $se(e){const t=Sh(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=l0(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=FT(n)!==i||FT(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function pL(e){return _h(e)?e:e.contextElement}function ny(e){const t=pL(e);if(!l0(t))return Rf(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=$se(t);let o=(i?FT(n.width):n.width)/r,l=(i?FT(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const YMe=Rf(0);function Bse(e){const t=yc(e);return!mL()||!t.visualViewport?YMe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function XMe(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===yc(e)}function Fg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=pL(e);let o=Rf(1);t&&(r?_h(r)&&(o=ny(r)):o=ny(e));const l=XMe(i,n,r)?Bse(i):Rf(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(i&&r){const m=yc(i),p=_h(r)?yc(r):r;let g=m,b=BI(g);for(;b&&p!==g;){const w=ny(b),y=b.getBoundingClientRect(),v=Sh(b),x=y.left+(b.clientLeft+parseFloat(v.paddingLeft))*w.x,k=y.top+(b.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,f*=w.y,c+=x,u+=k,g=yc(b),b=BI(g)}}return HT({width:d,height:f,x:c,y:u})}function Q5(e,t){const n=X5(e).scrollLeft;return t?t.left+n:Fg(cm(e)).left+n}function zse(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Q5(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function QMe(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=cm(r),l=t?Y5(t.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Rf(1);const d=Rf(0),f=l0(r);if((f||!i)&&((Sv(r)!=="body"||K5(o))&&(c=X5(r)),f)){const p=Fg(r);u=ny(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const m=o&&!f&&!i?zse(o,c):Rf(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function JMe(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ZMe(e){const t=X5(e),n=e.ownerDocument.body,r=Mf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=Mf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+Q5(e);const o=-t.scrollTop;return Sh(n).direction==="rtl"&&(i+=Mf(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:o}}const eRe=25;function tRe(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",s=yc(e),i=cm(e),o=s.visualViewport;let l=i.clientWidth,c=i.clientHeight,u=0,d=0;if(o){const m=!mL()||t==="fixed";r?m||(u=-o.offsetLeft,d=-o.offsetTop):(l=o.width,c=o.height,m&&(u=o.offsetLeft,d=o.offsetTop))}if(Q5(i)<=0){const m=i.ownerDocument,p=m.body,g=getComputedStyle(p),b=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,w=Math.abs(i.clientWidth-p.clientWidth-b),y=getComputedStyle(i).scrollbarGutter==="stable both-edges"?w/2:w;y<=eRe&&(l-=y)}return{width:l,height:c,x:u,y:d}}function nRe(e,t){const n=Fg(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=ny(e),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:l,x:c,y:u}}function $U(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=tRe(e,n,t);else if(t==="document")r=ZMe(cm(e));else if(_h(t))r=nRe(t,n);else{const s=Bse(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return HT(r)}function rRe(e,t){const n=t.get(e);if(n)return n;let r=Ak(e,[],!1).filter(l=>_h(l)&&Sv(l)!=="body"),s=null;const i=Sh(e).position==="fixed";let o=i?zg(e):e;for(;_h(o)&&!Ek(o);){const l=Sh(o),c=fL(o),u=s?s.position:i?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&l.position==="static")?r=r.filter(f=>f!==o):s=l,o=zg(o)}return t.set(e,r),r}function sRe(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Y5(t)?[]:rRe(t,this._c):[].concat(n),r],l=$U(t,o[0],s);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let m=1;m<o.length;m++){const p=$U(t,o[m],s);c=Mf(p.top,c),u=Op(p.right,u),d=Op(p.bottom,d),f=Mf(p.left,f)}return{width:u-f,height:d-c,x:f,y:c}}function iRe(e){const{width:t,height:n}=$se(e);return{width:t,height:n}}function oRe(e,t,n){const r=l0(t),s=cm(t),i=n==="fixed",o=Fg(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Rf(0);if((r||!i)&&((Sv(t)!=="body"||K5(s))&&(l=X5(t)),r)){const m=Fg(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}!r&&s&&(c.x=Q5(s));const u=s&&!r&&!i?zse(s,l):Rf(0),d=o.left+l.scrollLeft-c.x-u.x,f=o.top+l.scrollTop-c.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function KA(e){return Sh(e).position==="static"}function BU(e,t){if(!l0(e)||Sh(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return cm(e)===n&&(n=n.ownerDocument.body),n}function Fse(e,t){const n=yc(e);if(Y5(e))return n;if(!l0(e)){let s=zg(e);for(;s&&!Ek(s);){if(_h(s)&&!KA(s))return s;s=zg(s)}return n}let r=BU(e,t);for(;r&&WMe(r)&&KA(r);)r=BU(r,t);return r&&Ek(r)&&KA(r)&&!fL(r)?n:r||KMe(e)||n}const aRe=async function(e){const t=this.getOffsetParent||Fse,n=this.getDimensions,r=await n(e.floating);return{reference:oRe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lRe(e){return Sh(e).direction==="rtl"}const cRe={convertOffsetParentRelativeRectToViewportRelativeRect:QMe,getDocumentElement:cm,getClippingRect:sRe,getOffsetParent:Fse,getElementRects:aRe,getClientRects:JMe,getDimensions:iRe,getScale:ny,isElement:_h,isRTL:lRe};function qse(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uRe(e,t,n){let r=null,s;const i=cm(e);function o(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function l(d,f){d===void 0&&(d=!1),f===void 0&&(f=1),o();const m=e.getBoundingClientRect(),{left:p,top:g,width:b,height:w}=m;if(d||t(),!b||!w)return;const y=D2(g),v=D2(i.clientWidth-(p+b)),x=D2(i.clientHeight-(g+w)),k=D2(p),T={rootMargin:-y+"px "+-v+"px "+-x+"px "+-k+"px",threshold:Mf(0,Op(1,f))||1};let _=!0;function C(j){const E=j[0].intersectionRatio;if(!qse(m,e.getBoundingClientRect()))return l();if(E!==f){if(!_)return l();E?l(!1,E):s=setTimeout(()=>{l(!1,1e-7)},1e3)}_=!1}try{r=new IntersectionObserver(C,{...T,root:i.ownerDocument})}catch{r=new IntersectionObserver(C,T)}r.observe(e)}const c=yc(e),u=()=>l(n);return c.addEventListener("resize",u),l(!0),()=>{c.removeEventListener("resize",u),o()}}function dRe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=pL(e),d=s||i?[...u?Ak(u):[],...t?Ak(t):[]]:[];d.forEach(y=>{s&&y.addEventListener("scroll",n),i&&y.addEventListener("resize",n)});const f=u&&l?uRe(u,n,i):null;let m=-1,p=null;o&&(p=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),u&&!c&&p.observe(u),t&&p.observe(t));let g,b=c?Fg(e):null;c&&w();function w(){const y=Fg(e);b&&!qse(b,y)&&n(),b=y,g=requestAnimationFrame(w)}return n(),()=>{var y;d.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const hRe=FMe,fRe=qMe,mRe=$Me,pRe=UMe,gRe=BMe,zU=OMe,bRe=HMe,yRe=(e,t,n)=>{const r=new Map,s=n??{},i={...cRe,...s.platform,_c:r};return PMe(e,t,{...s,platform:i})};var vRe=typeof document<"u",wRe=function(){},c4=vRe?h.useLayoutEffect:wRe;function UT(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(!UT(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 i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!UT(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Hse(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function FU(e,t){const n=Hse(e);return Math.round(t*n)/n}function YA(e){const t=h.useRef(e);return c4(()=>{t.current=e}),t}function xRe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=h.useState(r);UT(m,r)||p(r);const[g,b]=h.useState(null),[w,y]=h.useState(null),v=h.useCallback(z=>{z!==T.current&&(T.current=z,b(z))},[]),x=h.useCallback(z=>{z!==_.current&&(_.current=z,y(z))},[]),k=i||g,S=o||w,T=h.useRef(null),_=h.useRef(null),C=h.useRef(d),j=c!=null,E=YA(c),L=YA(s),D=YA(u),M=h.useCallback(()=>{if(!T.current||!_.current)return;const z={placement:t,strategy:n,middleware:m};L.current&&(z.platform=L.current),yRe(T.current,_.current,z).then(G=>{const I={...G,isPositioned:D.current!==!1};R.current&&!UT(C.current,I)&&(C.current=I,xd.flushSync(()=>{f(I)}))})},[m,t,n,L,D]);c4(()=>{u===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,f(z=>({...z,isPositioned:!1})))},[u]);const R=h.useRef(!1);c4(()=>(R.current=!0,()=>{R.current=!1}),[]),c4(()=>{if(k&&(T.current=k),S&&(_.current=S),k&&S){if(E.current)return E.current(k,S,M);M()}},[k,S,M,E,j]);const $=h.useMemo(()=>({reference:T,floating:_,setReference:v,setFloating:x}),[v,x]),B=h.useMemo(()=>({reference:k,floating:S}),[k,S]),N=h.useMemo(()=>{const z={position:n,left:0,top:0};if(!B.floating)return z;const G=FU(B.floating,d.x),I=FU(B.floating,d.y);return l?{...z,transform:"translate("+G+"px, "+I+"px)",...Hse(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:I}},[n,l,B.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:M,refs:$,elements:B,floatingStyles:N}),[d,M,$,B,N])}const kRe=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?zU({element:r.current,padding:s}).fn(n):{}:r?zU({element:r,padding:s}).fn(n):{}}}},_Re=(e,t)=>{const n=hRe(e);return{name:n.name,fn:n.fn,options:[e,t]}},SRe=(e,t)=>{const n=fRe(e);return{name:n.name,fn:n.fn,options:[e,t]}},CRe=(e,t)=>({fn:bRe(e).fn,options:[e,t]}),TRe=(e,t)=>{const n=mRe(e);return{name:n.name,fn:n.fn,options:[e,t]}},ERe=(e,t)=>{const n=pRe(e);return{name:n.name,fn:n.fn,options:[e,t]}},ARe=(e,t)=>{const n=gRe(e);return{name:n.name,fn:n.fn,options:[e,t]}},jRe=(e,t)=>{const n=kRe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var NRe="Arrow",Use=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return a.jsx(nr.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});Use.displayName=NRe;var IRe=Use,gL="Popper",[Wse,c0]=Nl(gL),[MRe,Vse]=Wse(gL),Gse=e=>{const{__scopePopper:t,children:n}=e,[r,s]=h.useState(null),[i,o]=h.useState(void 0);return a.jsx(MRe,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};Gse.displayName=gL;var Kse="PopperAnchor",Yse=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=Vse(Kse,n),o=h.useRef(null),l=i.onAnchorChange,c=h.useCallback(g=>{o.current=g,g&&l(g)},[l]),u=Nr(t,c),d=h.useRef(null);h.useEffect(()=>{if(!r)return;const g=d.current;d.current=r.current,g!==d.current&&l(d.current)});const f=i.placementState&&yL(i.placementState),m=f==null?void 0:f[0],p=f==null?void 0:f[1];return r?null:a.jsx(nr.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...s,ref:u})});Yse.displayName=Kse;var bL="PopperContent",[RRe,DRe]=Wse(bL),Xse=h.forwardRef((e,t)=>{var ce,ie,Z,ee,oe,we;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...b}=e,w=Vse(bL,n),[y,v]=h.useState(null),x=Nr(t,v),[k,S]=h.useState(null),T=W5(k),_=(T==null?void 0:T.width)??0,C=(T==null?void 0:T.height)??0,j=r+(i!=="center"?"-"+i:""),E=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},L=Array.isArray(u)?u:[u],D=L.length>0,M={padding:E,boundary:L.filter(PRe),altBoundary:D},{refs:R,floatingStyles:$,placement:B,isPositioned:N,middlewareData:z}=xRe({strategy:"fixed",placement:j,whileElementsMounted:(...pe)=>dRe(...pe,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[_Re({mainAxis:s+C,alignmentAxis:o}),c&&SRe({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?CRe():void 0,...M}),c&&TRe({...M}),ERe({...M,apply:({elements:pe,rects:he,availableWidth:X,availableHeight:ye})=>{const{width:Ce,height:ae}=he.reference,me=pe.floating.style;me.setProperty("--radix-popper-available-width",`${X}px`),me.setProperty("--radix-popper-available-height",`${ye}px`),me.setProperty("--radix-popper-anchor-width",`${Ce}px`),me.setProperty("--radix-popper-anchor-height",`${ae}px`)}}),k&&jRe({element:k,padding:l}),ORe({arrowWidth:_,arrowHeight:C}),m&&ARe({strategy:"referenceHidden",...M,boundary:D?M.boundary:void 0})]}),G=w.setPlacementState;Fa(()=>(G(B),()=>{G(void 0)}),[B,G]);const[I,Y]=yL(B),U=ru(g);Fa(()=>{N&&(U==null||U())},[N,U]);const P=(ce=z.arrow)==null?void 0:ce.x,F=(ie=z.arrow)==null?void 0:ie.y,te=((Z=z.arrow)==null?void 0:Z.centerOffset)!==0,[W,K]=h.useState();return Fa(()=>{y&&K(window.getComputedStyle(y).zIndex)},[y]),a.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:N?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:W,"--radix-popper-transform-origin":[(ee=z.transformOrigin)==null?void 0:ee.x,(oe=z.transformOrigin)==null?void 0:oe.y].join(" "),...((we=z.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(RRe,{scope:n,placedSide:I,placedAlign:Y,onArrowChange:S,arrowX:P,arrowY:F,shouldHideArrow:te,children:a.jsx(nr.div,{"data-side":I,"data-align":Y,...b,ref:x,style:{...b.style,animation:N?void 0:"none"}})})})});Xse.displayName=bL;var Qse="PopperArrow",LRe={top:"bottom",right:"left",bottom:"top",left:"right"},Jse=h.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=DRe(Qse,r),o=LRe[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(IRe,{...s,ref:n,style:{...s.style,display:"block"}})})});Jse.displayName=Qse;function PRe(e){return e!==null}var ORe=e=>({name:"transformOrigin",options:e,fn(t){var w,y,v;const{placement:n,rects:r,middlewareData:s}=t,o=((w=s.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=yL(n),f={start:"0%",center:"50%",end:"100%"}[d],m=(((y=s.arrow)==null?void 0:y.x)??0)+l/2,p=(((v=s.arrow)==null?void 0:v.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=o?f:`${m}px`,b=`${-c}px`):u==="top"?(g=o?f:`${m}px`,b=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=o?f:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,b=o?f:`${p}px`),{data:{x:g,y:b}}}});function yL(e){const[t,n="center"]=e.split("-");return[t,n]}var N_=Gse,I_=Yse,J5=Xse,Z5=Jse,XA=!1;function $Re(){const[e,t]=h.useState(XA);return h.useEffect(()=>{XA||(XA=!0,t(!0))},[]),e}var Zse=B3[" useSyncExternalStore ".trim().toString()];function BRe(){return()=>{}}function zRe(){return Zse(BRe,()=>!0,()=>!1)}var FRe=typeof Zse=="function"?zRe:$Re,QA="rovingFocusGroup.onEntryFocus",qRe={bubbles:!1,cancelable:!0},M_="RovingFocusGroup",[zI,eie,HRe]=sL(M_),[URe,u0]=Nl(M_,[HRe]),[WRe,VRe]=URe(M_),tie=h.forwardRef((e,t)=>a.jsx(zI.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(zI.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(GRe,{...e,ref:t})})}));tie.displayName=M_;var GRe=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=h.useRef(null),p=Nr(t,m),g=vv(i),[b,w]=Ql({prop:o,defaultProp:l??null,onChange:c,caller:M_}),[y,v]=h.useState(!1),x=ru(u),k=eie(n),S=h.useRef(!1),[T,_]=h.useState(0);return h.useEffect(()=>{const C=m.current;if(C)return C.addEventListener(QA,x),()=>C.removeEventListener(QA,x)},[x]),a.jsx(WRe,{scope:n,orientation:r,dir:g,loop:s,currentTabStopId:b,onItemFocus:h.useCallback(C=>w(C),[w]),onItemShiftTab:h.useCallback(()=>v(!0),[]),onFocusableItemAdd:h.useCallback(()=>_(C=>C+1),[]),onFocusableItemRemove:h.useCallback(()=>_(C=>C-1),[]),children:a.jsx(nr.div,{tabIndex:y||T===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:bn(e.onMouseDown,()=>{S.current=!0}),onFocus:bn(e.onFocus,C=>{const j=!S.current;if(C.target===C.currentTarget&&j&&!y){const E=new CustomEvent(QA,qRe);if(C.currentTarget.dispatchEvent(E),!E.defaultPrevented){const L=k().filter(B=>B.focusable),D=L.find(B=>B.active),M=L.find(B=>B.id===b),$=[D,M,...L].filter(Boolean).map(B=>B.ref.current);sie($,d)}}S.current=!1}),onBlur:bn(e.onBlur,()=>v(!1))})})}),nie="RovingFocusGroupItem",rie=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...l}=e,c=bc(),u=i||c,d=VRe(nie,n),f=d.currentTabStopId===u,m=eie(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:b}=d,w=FRe();return Fa(()=>{if(!(!w||!r))return p(),()=>g()},[w,r,p,g]),h.useEffect(()=>{if(!(w||!r))return p(),()=>g()},[w,r,p,g]),a.jsx(zI.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:a.jsx(nr.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:bn(e.onMouseDown,y=>{r?d.onItemFocus(u):y.preventDefault()}),onFocus:bn(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:bn(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=XRe(y,d.orientation,d.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let k=m().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")k.reverse();else if(v==="prev"||v==="next"){v==="prev"&&k.reverse();const S=k.indexOf(y.currentTarget);k=d.loop?QRe(k,S+1):k.slice(S+1)}setTimeout(()=>sie(k))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:b!=null}):o})})});rie.displayName=nie;var KRe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function YRe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function XRe(e,t,n){const r=YRe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return KRe[r]}function sie(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function QRe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var e6=tie,t6=rie,FI=["Enter"," "],JRe=["ArrowDown","PageUp","Home"],iie=["ArrowUp","PageDown","End"],ZRe=[...JRe,...iie],e9e={ltr:[...FI,"ArrowRight"],rtl:[...FI,"ArrowLeft"]},t9e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},R_="Menu",[jk,n9e,r9e]=sL(R_),[h1,oie]=Nl(R_,[r9e,c0,u0]),D_=c0(),aie=u0(),[lie,d0]=h1(R_),[s9e,L_]=h1(R_),cie=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=e,l=D_(t),[c,u]=h.useState(null),d=h.useRef(!1),f=ru(i),m=vv(s);return h.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),h.useEffect(()=>{if(!n)return;const p=()=>f(!1);return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[n,f]),a.jsx(N_,{...l,children:a.jsx(lie,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(s9e,{scope:t,onClose:h.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:o,children:r})})})};cie.displayName=R_;var i9e="MenuAnchor",vL=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=D_(n);return a.jsx(I_,{...s,...r,ref:t})});vL.displayName=i9e;var wL="MenuPortal",[o9e,uie]=h1(wL,{forceMount:void 0}),die=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,i=d0(wL,t);return a.jsx(o9e,{scope:t,forceMount:n,children:a.jsx(Il,{present:n||i.open,children:a.jsx(xv,{asChild:!0,container:s,children:r})})})};die.displayName=wL;var Bu="MenuContent",[a9e,xL]=h1(Bu),hie=h.forwardRef((e,t)=>{const n=uie(Bu,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=d0(Bu,e.__scopeMenu),o=L_(Bu,e.__scopeMenu);return a.jsx(jk.Provider,{scope:e.__scopeMenu,children:a.jsx(Il,{present:r||i.open,children:a.jsx(jk.Slot,{scope:e.__scopeMenu,children:o.modal?a.jsx(l9e,{...s,ref:t}):a.jsx(c9e,{...s,ref:t})})})})}),l9e=h.forwardRef((e,t)=>{const n=d0(Bu,e.__scopeMenu),r=h.useRef(null),s=Nr(t,r);return h.useEffect(()=>{const i=r.current;if(i)return O5(i)},[]),a.jsx(kL,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:bn(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),c9e=h.forwardRef((e,t)=>{const n=d0(Bu,e.__scopeMenu);return a.jsx(kL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),u9e=Pp("MenuContent.ScrollLock"),kL=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:p,disableOutsideScroll:g,...b}=e,w=d0(Bu,n),y=L_(Bu,n),v=D_(n),x=aie(n),k=n9e(n),[S,T]=h.useState(null),_=h.useRef(null),C=Nr(t,_,w.onContentChange),j=h.useRef(0),E=h.useRef(""),L=h.useRef(0),D=h.useRef(null),M=h.useRef("right"),R=h.useRef(0),$=g?j_:h.Fragment,B=g?{as:u9e,allowPinchZoom:!0}:void 0,N=G=>{var K,ce;const I=E.current+G,Y=k().filter(ie=>!ie.disabled),U=document.activeElement,P=(K=Y.find(ie=>ie.ref.current===U))==null?void 0:K.textValue,F=Y.map(ie=>ie.textValue),te=k9e(F,I,P),W=(ce=Y.find(ie=>ie.textValue===te))==null?void 0:ce.ref.current;(function ie(Z){E.current=Z,window.clearTimeout(j.current),Z!==""&&(j.current=window.setTimeout(()=>ie(""),1e3))})(I),W&&setTimeout(()=>W.focus())};h.useEffect(()=>()=>window.clearTimeout(j.current),[]),L5();const z=h.useCallback(G=>{var Y,U;return M.current===((Y=D.current)==null?void 0:Y.side)&&S9e(G,(U=D.current)==null?void 0:U.area)},[]);return a.jsx(a9e,{scope:n,searchRef:E,onItemEnter:h.useCallback(G=>{z(G)&&G.preventDefault()},[z]),onItemLeave:h.useCallback(G=>{var I;z(G)||((I=_.current)==null||I.focus(),T(null))},[z]),onTriggerLeave:h.useCallback(G=>{z(G)&&G.preventDefault()},[z]),pointerGraceTimerRef:L,onPointerGraceIntentChange:h.useCallback(G=>{D.current=G},[]),children:a.jsx($,{...B,children:a.jsx(A_,{asChild:!0,trapped:s,onMountAutoFocus:bn(i,G=>{var I;G.preventDefault(),(I=_.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(wv,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:p,children:a.jsx(e6,{asChild:!0,...x,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:T,onEntryFocus:bn(c,G=>{y.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(J5,{role:"menu","aria-orientation":"vertical","data-state":jie(w.open),"data-radix-menu-content":"",dir:y.dir,...v,...b,ref:C,style:{outline:"none",...b.style},onKeyDown:bn(b.onKeyDown,G=>{const Y=G.target.closest("[data-radix-menu-content]")===G.currentTarget,U=G.ctrlKey||G.altKey||G.metaKey,P=G.key.length===1;Y&&(G.key==="Tab"&&G.preventDefault(),!U&&P&&N(G.key));const F=_.current;if(G.target!==F||!ZRe.includes(G.key))return;G.preventDefault();const W=k().filter(K=>!K.disabled).map(K=>K.ref.current);iie.includes(G.key)&&W.reverse(),w9e(W)}),onBlur:bn(e.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(j.current),E.current="")}),onPointerMove:bn(e.onPointerMove,Nk(G=>{const I=G.target,Y=R.current!==G.clientX;if(G.currentTarget.contains(I)&&Y){const U=G.clientX>R.current?"right":"left";M.current=U,R.current=G.clientX}}))})})})})})})});hie.displayName=Bu;var d9e="MenuGroup",_L=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(nr.div,{role:"group",...r,ref:t})});_L.displayName=d9e;var h9e="MenuLabel",fie=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(nr.div,{...r,ref:t})});fie.displayName=h9e;var WT="MenuItem",qU="menu.itemSelect",n6=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,i=h.useRef(null),o=L_(WT,e.__scopeMenu),l=xL(WT,e.__scopeMenu),c=Nr(t,i),u=h.useRef(!1),d=()=>{const f=i.current;if(!n&&f){const m=new CustomEvent(qU,{bubbles:!0,cancelable:!0});f.addEventListener(qU,p=>r==null?void 0:r(p),{once:!0}),Vre(f,m),m.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(mie,{...s,ref:c,disabled:n,onClick:bn(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:bn(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:bn(e.onKeyDown,f=>{n||f.target!==f.currentTarget||l.searchRef.current!==""&&f.key===" "||FI.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});n6.displayName=WT;var mie=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=e,o=xL(WT,n),l=aie(n),c=h.useRef(null),u=Nr(t,c),[d,f]=h.useState(!1),[m,p]=h.useState("");return h.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),a.jsx(jk.ItemSlot,{scope:n,disabled:r,textValue:s??m,children:a.jsx(t6,{asChild:!0,...l,focusable:!r,children:a.jsx(nr.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:bn(e.onPointerMove,Nk(g=>{r?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:bn(e.onPointerLeave,Nk(g=>o.onItemLeave(g))),onFocus:bn(e.onFocus,()=>f(!0)),onBlur:bn(e.onBlur,()=>f(!1))})})})}),f9e="MenuCheckboxItem",pie=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(wie,{scope:e.__scopeMenu,checked:n,children:a.jsx(n6,{role:"menuitemcheckbox","aria-checked":VT(n)?"mixed":n,...s,ref:t,"data-state":TL(n),onSelect:bn(s.onSelect,()=>r==null?void 0:r(VT(n)?!0:!n),{checkForDefaultPrevented:!1})})})});pie.displayName=f9e;var gie="MenuRadioGroup",[m9e,p9e]=h1(gie,{value:void 0,onValueChange:()=>{}}),bie=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,i=ru(r);return a.jsx(m9e,{scope:e.__scopeMenu,value:n,onValueChange:i,children:a.jsx(_L,{...s,ref:t})})});bie.displayName=gie;var yie="MenuRadioItem",vie=h.forwardRef((e,t)=>{const{value:n,...r}=e,s=p9e(yie,e.__scopeMenu),i=n===s.value;return a.jsx(wie,{scope:e.__scopeMenu,checked:i,children:a.jsx(n6,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":TL(i),onSelect:bn(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});vie.displayName=yie;var SL="MenuItemIndicator",[wie,g9e]=h1(SL,{checked:!1}),xie=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,i=g9e(SL,n);return a.jsx(Il,{present:r||VT(i.checked)||i.checked===!0,children:a.jsx(nr.span,{...s,ref:t,"data-state":TL(i.checked)})})});xie.displayName=SL;var b9e="MenuSeparator",kie=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(nr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});kie.displayName=b9e;var y9e="MenuArrow",_ie=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=D_(n);return a.jsx(Z5,{...s,...r,ref:t})});_ie.displayName=y9e;var CL="MenuSub",[v9e,Sie]=h1(CL),Cie=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:s}=e,i=d0(CL,t),o=D_(t),[l,c]=h.useState(null),[u,d]=h.useState(null),f=ru(s);return h.useEffect(()=>(i.open===!1&&f(!1),()=>f(!1)),[i.open,f]),a.jsx(N_,{...o,children:a.jsx(lie,{scope:t,open:r,onOpenChange:f,content:u,onContentChange:d,children:a.jsx(v9e,{scope:t,contentId:bc(),triggerId:bc(),trigger:l,onTriggerChange:c,children:n})})})};Cie.displayName=CL;var ox="MenuSubTrigger",Tie=h.forwardRef((e,t)=>{const n=d0(ox,e.__scopeMenu),r=L_(ox,e.__scopeMenu),s=Sie(ox,e.__scopeMenu),i=xL(ox,e.__scopeMenu),o=h.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);h.useEffect(()=>d,[d]),h.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),c(null)}},[l,c]);const f=Nr(t,s.onTriggerChange);return a.jsx(vL,{asChild:!0,...u,children:a.jsx(mie,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?s.contentId:void 0,"data-state":jie(n.open),...e,ref:f,onClick:m=>{var p;(p=e.onClick)==null||p.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:bn(e.onPointerMove,Nk(m=>{i.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:bn(e.onPointerLeave,Nk(m=>{var g,b;d();const p=(g=n.content)==null?void 0:g.getBoundingClientRect();if(p){const w=(b=n.content)==null?void 0:b.dataset.side,y=w==="right",v=y?-5:5,x=p[y?"left":"right"],k=p[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+v,y:m.clientY},{x,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x,y:p.bottom}],side:w}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:bn(e.onKeyDown,m=>{var g;e.disabled||m.target!==m.currentTarget||i.searchRef.current!==""&&m.key===" "||e9e[r.dir].includes(m.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),m.preventDefault())})})})});Tie.displayName=ox;var Eie="MenuSubContent",Aie=h.forwardRef((e,t)=>{const n=uie(Bu,e.__scopeMenu),{forceMount:r=n.forceMount,align:s="start",...i}=e,o=d0(Bu,e.__scopeMenu),l=L_(Bu,e.__scopeMenu),c=Sie(Eie,e.__scopeMenu),u=h.useRef(null),d=Nr(t,u);return a.jsx(jk.Provider,{scope:e.__scopeMenu,children:a.jsx(Il,{present:r||o.open,children:a.jsx(jk.Slot,{scope:e.__scopeMenu,children:a.jsx(kL,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:d,align:s,side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var m;l.isUsingKeyboardRef.current&&((m=u.current)==null||m.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:bn(e.onFocusOutside,f=>{f.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:bn(e.onEscapeKeyDown,f=>{l.onClose(),f.preventDefault()}),onKeyDown:bn(e.onKeyDown,f=>{var g;const m=f.currentTarget.contains(f.target),p=t9e[l.dir].includes(f.key);m&&p&&(o.onOpenChange(!1),(g=c.trigger)==null||g.focus(),f.preventDefault())})})})})})});Aie.displayName=Eie;function jie(e){return e?"open":"closed"}function VT(e){return e==="indeterminate"}function TL(e){return VT(e)?"indeterminate":e?"checked":"unchecked"}function w9e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function x9e(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function k9e(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=x9e(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function _9e(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],u=l.x,d=l.y,f=c.x,m=c.y;d>r!=m>r&&n<(f-u)*(r-d)/(m-d)+u&&(s=!s)}return s}function S9e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return _9e(n,t)}function Nk(e){return t=>t.pointerType==="mouse"?e(t):void 0}var C9e=cie,T9e=vL,E9e=die,A9e=hie,j9e=_L,N9e=fie,I9e=n6,M9e=pie,R9e=bie,D9e=vie,L9e=xie,P9e=kie,O9e=_ie,$9e=Cie,B9e=Tie,z9e=Aie,r6="DropdownMenu",[F9e,b9t]=Nl(r6,[oie]),Ml=oie(),[q9e,Nie]=F9e(r6),Iie=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=Ml(t),u=h.useRef(null),[d,f]=Ql({prop:s,defaultProp:i??!1,onChange:o,caller:r6});return a.jsx(q9e,{scope:t,triggerId:bc(),triggerRef:u,contentId:bc(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),modal:l,children:a.jsx(C9e,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};Iie.displayName=r6;var Mie="DropdownMenuTrigger",Rie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,i=Nie(Mie,n),o=Ml(n),l=Nr(t,i.triggerRef);return a.jsx(T9e,{asChild:!0,...o,children:a.jsx(nr.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:l,onPointerDown:bn(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:bn(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});Rie.displayName=Mie;var H9e="DropdownMenuPortal",Die=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ml(t);return a.jsx(E9e,{...r,...n})};Die.displayName=H9e;var Lie="DropdownMenuContent",Pie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Nie(Lie,n),i=Ml(n),o=h.useRef(!1);return a.jsx(A9e,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:t,onCloseAutoFocus:bn(e.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:bn(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Pie.displayName=Lie;var U9e="DropdownMenuGroup",Oie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(j9e,{...s,...r,ref:t})});Oie.displayName=U9e;var W9e="DropdownMenuLabel",V9e=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(N9e,{...s,...r,ref:t})});V9e.displayName=W9e;var G9e="DropdownMenuItem",$ie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(I9e,{...s,...r,ref:t})});$ie.displayName=G9e;var K9e="DropdownMenuCheckboxItem",Y9e=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(M9e,{...s,...r,ref:t})});Y9e.displayName=K9e;var X9e="DropdownMenuRadioGroup",Bie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(R9e,{...s,...r,ref:t})});Bie.displayName=X9e;var Q9e="DropdownMenuRadioItem",zie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(D9e,{...s,...r,ref:t})});zie.displayName=Q9e;var J9e="DropdownMenuItemIndicator",Fie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(L9e,{...s,...r,ref:t})});Fie.displayName=J9e;var Z9e="DropdownMenuSeparator",qie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(P9e,{...s,...r,ref:t})});qie.displayName=Z9e;var eDe="DropdownMenuArrow",tDe=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(O9e,{...s,...r,ref:t})});tDe.displayName=eDe;var nDe=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:s,defaultOpen:i}=e,o=Ml(t),[l,c]=Ql({prop:r,defaultProp:i??!1,onChange:s,caller:"DropdownMenuSub"});return a.jsx($9e,{...o,open:l,onOpenChange:c,children:n})},rDe="DropdownMenuSubTrigger",Hie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(B9e,{...s,...r,ref:t})});Hie.displayName=rDe;var sDe="DropdownMenuSubContent",Uie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ml(n);return a.jsx(z9e,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Uie.displayName=sDe;var iDe=Iie,oDe=Rie,aDe=Die,lDe=Pie,cDe=Oie,uDe=$ie,dDe=Bie,hDe=zie,fDe=Fie,mDe=qie,pDe=nDe,gDe=Hie,bDe=Uie,yDe="Label",Wie=h.forwardRef((e,t)=>a.jsx(nr.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Wie.displayName=yDe;var vDe=Wie;function HU(e,[t,n]){return Math.min(n,Math.max(t,e))}var s6="Popover",[Vie,y9t]=Nl(s6,[c0]),P_=c0(),[wDe,h0]=Vie(s6),Gie=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,l=P_(t),c=h.useRef(null),[u,d]=h.useState(!1),[f,m]=Ql({prop:r,defaultProp:s??!1,onChange:i,caller:s6});return a.jsx(N_,{...l,children:a.jsx(wDe,{scope:t,contentId:bc(),triggerRef:c,open:f,onOpenChange:m,onOpenToggle:h.useCallback(()=>m(p=>!p),[m]),hasCustomAnchor:u,onCustomAnchorAdd:h.useCallback(()=>d(!0),[]),onCustomAnchorRemove:h.useCallback(()=>d(!1),[]),modal:o,children:n})})};Gie.displayName=s6;var Kie="PopoverAnchor",Yie=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=h0(Kie,n),i=P_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return h.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(I_,{...i,...r,ref:t})});Yie.displayName=Kie;var Xie="PopoverTrigger",Qie=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=h0(Xie,n),i=P_(n),o=Nr(t,s.triggerRef),l=a.jsx(nr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":noe(s.open),...r,ref:o,onClick:bn(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(I_,{asChild:!0,...i,children:l})});Qie.displayName=Xie;var EL="PopoverPortal",[xDe,kDe]=Vie(EL,{forceMount:void 0}),Jie=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=h0(EL,t);return a.jsx(xDe,{scope:t,forceMount:n,children:a.jsx(Il,{present:n||i.open,children:a.jsx(xv,{asChild:!0,container:s,children:r})})})};Jie.displayName=EL;var Iy="PopoverContent",Zie=h.forwardRef((e,t)=>{const n=kDe(Iy,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=h0(Iy,e.__scopePopover);return a.jsx(Il,{present:r||i.open,children:i.modal?a.jsx(SDe,{...s,ref:t}):a.jsx(CDe,{...s,ref:t})})});Zie.displayName=Iy;var _De=Pp("PopoverContent.RemoveScroll"),SDe=h.forwardRef((e,t)=>{const n=h0(Iy,e.__scopePopover),r=h.useRef(null),s=Nr(t,r),i=h.useRef(!1);return h.useEffect(()=>{const o=r.current;if(o)return O5(o)},[]),a.jsx(j_,{as:_De,allowPinchZoom:!0,children:a.jsx(eoe,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bn(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:bn(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:bn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),CDe=h.forwardRef((e,t)=>{const n=h0(Iy,e.__scopePopover),r=h.useRef(!1),s=h.useRef(!1);return a.jsx(eoe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),eoe=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,m=h0(Iy,n),p=P_(n);return L5(),a.jsx(A_,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(wv,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:a.jsx(J5,{"data-state":noe(m.open),role:"dialog",id:m.contentId,...p,...f,ref:t,style:{...f.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)"}})})})}),toe="PopoverClose",TDe=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=h0(toe,n);return a.jsx(nr.button,{type:"button",...r,ref:t,onClick:bn(e.onClick,()=>s.onOpenChange(!1))})});TDe.displayName=toe;var EDe="PopoverArrow",ADe=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=P_(n);return a.jsx(Z5,{...s,...r,ref:t})});ADe.displayName=EDe;function noe(e){return e?"open":"closed"}var jDe=Gie,NDe=Yie,IDe=Qie,MDe=Jie,RDe=Zie,AL="Radio",[DDe,roe]=Nl(AL),[LDe,i6]=DDe(AL);function soe(e){const{__scopeRadio:t,checked:n=!1,children:r,disabled:s,form:i,name:o,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,m]=h.useState(null),[p,g]=h.useState(null),b=h.useRef(!1),w=f?!!i||!!f.closest("form"):!0,y={checked:n,disabled:s,required:c,name:o,form:i,value:u,control:f,setControl:m,hasConsumerStoppedPropagationRef:b,isFormControl:w,bubbleInput:p,setBubbleInput:g,onCheck:()=>l==null?void 0:l()};return a.jsx(LDe,{scope:t,...y,children:ODe(d)?d(y):r})}var ioe="RadioTrigger",jL=h.forwardRef(({__scopeRadio:e,onClick:t,...n},r)=>{const{checked:s,disabled:i,value:o,setControl:l,onCheck:c,hasConsumerStoppedPropagationRef:u,isFormControl:d,bubbleInput:f}=i6(ioe,e),m=Nr(r,l);return a.jsx(nr.button,{type:"button",role:"radio","aria-checked":s,"data-state":coe(s),"data-disabled":i?"":void 0,disabled:i,value:o,...n,ref:m,onClick:bn(t,p=>{s||c(),f&&d&&(u.current=p.isPropagationStopped(),u.current||p.stopPropagation())})})});jL.displayName=ioe;var PDe=h.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s,required:i,disabled:o,value:l,onCheck:c,form:u,...d}=e;return a.jsx(soe,{__scopeRadio:n,checked:s,disabled:o,required:i,onCheck:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(jL,{...d,ref:t,__scopeRadio:n}),f&&a.jsx(NL,{__scopeRadio:n})]})})});PDe.displayName=AL;var ooe="RadioIndicator",aoe=h.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,i=i6(ooe,n);return a.jsx(Il,{present:r||i.checked,children:a.jsx(nr.span,{"data-state":coe(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})})});aoe.displayName=ooe;var loe="RadioBubbleInput",NL=h.forwardRef(({__scopeRadio:e,...t},n)=>{const{control:r,checked:s,required:i,disabled:o,name:l,value:c,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:m}=i6(loe,e),p=Nr(n,f),g=U5(s),b=W5(r);h.useEffect(()=>{const y=d;if(!y)return;const v=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(v,"checked").set,S=!m.current;if(g!==s&&k){const T=new Event("click",{bubbles:S});k.call(y,s),y.dispatchEvent(T)}},[d,g,s,m]);const w=h.useRef(s);return a.jsx(nr.input,{type:"radio","aria-hidden":!0,defaultChecked:w.current,required:i,disabled:o,name:l,value:c,form:u,...t,tabIndex:-1,ref:p,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});NL.displayName=loe;function ODe(e){return typeof e=="function"}function coe(e){return e?"checked":"unchecked"}var $De=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],o6="RadioGroup",[BDe,v9t]=Nl(o6,[u0,roe]),uoe=u0(),a6=roe(),[zDe,FDe]=BDe(o6),doe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,form:s,defaultValue:i,value:o,required:l=!1,disabled:c=!1,orientation:u,dir:d,loop:f=!0,onValueChange:m,...p}=e,g=uoe(n),b=vv(d),[w,y]=Ql({prop:o,defaultProp:i??null,onChange:m,caller:o6}),[v,x]=h.useState(null),k=Nr(t,x),S=h.useRef(w);return h.useEffect(()=>{const T=s?v==null?void 0:v.ownerDocument.getElementById(s):v==null?void 0:v.closest("form");if(T instanceof HTMLFormElement){const _=()=>y(S.current);return T.addEventListener("reset",_),()=>T.removeEventListener("reset",_)}},[v,s,y]),a.jsx(zDe,{scope:n,name:r,form:s,required:l,disabled:c,value:w,onValueChange:y,children:a.jsx(e6,{asChild:!0,...g,orientation:u,dir:b,loop:f,children:a.jsx(nr.div,{role:"radiogroup","aria-required":l,"aria-orientation":u,"data-disabled":c?"":void 0,dir:b,...p,ref:k})})})});doe.displayName=o6;var qDe="RadioGroupItem",HDe="RadioGroupItemProvider",hoe="RadioGroupItemTrigger",UDe="RadioGroupItemBubbleInput";function WDe(e){const{__scopeRadioGroup:t,value:n,disabled:r,children:s,internal_do_not_use_render:i}=e,o=FDe(HDe,t),l=a6(t),c=o.disabled||r;return a.jsx(soe,{...l,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:i,children:s})}var foe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=uoe(n),i=a6(n),{checked:o,disabled:l}=i6(hoe,i.__scopeRadio),c=h.useRef(null),u=Nr(t,c),d=h.useRef(!1);return h.useEffect(()=>{const f=p=>{$De.includes(p.key)&&(d.current=!0)},m=()=>d.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",m)}},[]),a.jsx(t6,{asChild:!0,...s,focusable:!l,active:o,children:a.jsx(jL,{...i,...r,ref:u,onKeyDown:bn(r.onKeyDown,f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:bn(r.onFocus,()=>{var f;d.current&&((f=c.current)==null||f.click())})})})});foe.displayName=hoe;var moe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,value:r,disabled:s,...i}=e;return a.jsx(WDe,{__scopeRadioGroup:n,value:r,disabled:s,internal_do_not_use_render:({isFormControl:o})=>a.jsxs(a.Fragment,{children:[a.jsx(foe,{...i,ref:t,__scopeRadioGroup:n}),o&&a.jsx(poe,{__scopeRadioGroup:n})]})})});moe.displayName=qDe;var poe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=a6(n);return a.jsx(NL,{...s,...r,ref:t})});poe.displayName=UDe;var VDe="RadioGroupIndicator",goe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=a6(n);return a.jsx(aoe,{...s,...r,ref:t})});goe.displayName=VDe;var GDe=[" ","Enter","ArrowUp","ArrowDown"],KDe=[" ","Enter"],qg="Select",[l6,c6,YDe]=sL(qg),[f1,w9t]=Nl(qg,[YDe,c0]),u6=c0(),[XDe,f0]=f1(qg),[QDe,JDe]=f1(qg),ZDe="SelectProvider";function boe(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:p,form:g,internal_do_not_use_render:b}=e,w=u6(t),[y,v]=h.useState(null),[x,k]=h.useState(null),[S,T]=h.useState(!1),_=vv(u),[C,j]=Ql({prop:r,defaultProp:s??!1,onChange:i,caller:qg}),[E,L]=Ql({prop:o,defaultProp:l,onChange:c,caller:qg}),D=h.useRef(null),M=h.useRef(E);h.useEffect(()=>{const U=g?y==null?void 0:y.ownerDocument.getElementById(g):y==null?void 0:y.form;if(U instanceof HTMLFormElement){const P=()=>L(M.current);return U.addEventListener("reset",P),()=>U.removeEventListener("reset",P)}},[g,y,L]);const R=y?!!g||!!y.closest("form"):!0,[$,B]=h.useState(new Set),N=bc(),z=Array.from($).map(U=>U.props.value).join(";"),G=h.useCallback(U=>{B(P=>new Set(P).add(U))},[]),I=h.useCallback(U=>{B(P=>{const F=new Set(P);return F.delete(U),F})},[]),Y={required:p,trigger:y,onTriggerChange:v,valueNode:x,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:T,contentId:N,value:E,onValueChange:L,open:C,onOpenChange:j,dir:_,triggerPointerDownPosRef:D,disabled:m,name:d,autoComplete:f,form:g,nativeOptions:$,nativeSelectKey:z,isFormControl:R};return a.jsx(N_,{...w,children:a.jsx(XDe,{scope:t,...Y,children:a.jsx(l6.Provider,{scope:t,children:a.jsx(QDe,{scope:t,onNativeOptionAdd:G,onNativeOptionRemove:I,children:pLe(b)?b(Y):n})})})})}boe.displayName=ZDe;var yoe=e=>{const{__scopeSelect:t,children:n,...r}=e;return a.jsx(boe,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>a.jsxs(a.Fragment,{children:[n,s?a.jsx(Woe,{__scopeSelect:t}):null]})})};yoe.displayName=qg;var voe="SelectTrigger",woe=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=u6(n),o=f0(voe,n),l=o.disabled||r,c=Nr(t,o.onTriggerChange),u=c6(n),d=h.useRef("touch"),[f,m,p]=Voe(b=>{const w=u().filter(x=>!x.disabled),y=w.find(x=>x.value===o.value),v=Goe(w,b,y);v!==void 0&&o.onValueChange(v.value)}),g=b=>{l||(o.onOpenChange(!0),p()),b&&(o.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return a.jsx(I_,{asChild:!0,...i,children:a.jsx(nr.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":d6(o.value)?"":void 0,...s,ref:c,onClick:bn(s.onClick,b=>{b.currentTarget.focus(),d.current!=="mouse"&&g(b)}),onPointerDown:bn(s.onPointerDown,b=>{d.current=b.pointerType;const w=b.target;w.hasPointerCapture(b.pointerId)&&w.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(g(b),b.preventDefault())}),onKeyDown:bn(s.onKeyDown,b=>{const w=f.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(w&&b.key===" ")&&GDe.includes(b.key)&&(g(),b.preventDefault())})})})});woe.displayName=voe;var xoe="SelectValue",koe=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...l}=e,c=f0(xoe,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=Nr(t,c.onValueNodeChange);Fa(()=>{u(d)},[u,d]);const m=d6(c.value);return a.jsx(nr.span,{...l,asChild:m?!1:l.asChild,ref:f,style:{pointerEvents:"none"},children:a.jsx(h.Fragment,{children:m?o:i},m?"placeholder":"value")})});koe.displayName=xoe;var eLe="SelectIcon",_oe=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(nr.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});_oe.displayName=eLe;var Soe="SelectPortal",[tLe,nLe]=f1(Soe,{forceMount:void 0}),Coe=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return a.jsx(tLe,{scope:e.__scopeSelect,forceMount:n,children:a.jsx(xv,{asChild:!0,...r})})};Coe.displayName=Soe;var Bp="SelectContent",Toe=h.forwardRef((e,t)=>{const n=nLe(Bp,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=f0(Bp,e.__scopeSelect),[o,l]=h.useState();return Fa(()=>{l(new DocumentFragment)},[]),a.jsx(Il,{present:r||i.open,children:({present:c})=>c?a.jsx(joe,{...s,ref:t}):a.jsx(Eoe,{...s,fragment:o})})});Toe.displayName=Bp;var Eoe=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?xd.createPortal(a.jsx(Aoe,{scope:n,children:a.jsx(l6.Slot,{scope:n,children:a.jsx("div",{ref:t,children:r})})}),s):null});Eoe.displayName="SelectContentFragment";var id=10,[Aoe,m0]=f1(Bp),rLe="SelectContentImpl",sLe=Pp("SelectContent.RemoveScroll"),joe=h.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:w,...y}=e,v=f0(Bp,n),[x,k]=h.useState(null),[S,T]=h.useState(null),_=Nr(t,k),[C,j]=h.useState(null),[E,L]=h.useState(null),D=c6(n),[M,R]=h.useState(!1),$=h.useRef(!1);h.useEffect(()=>{if(x)return O5(x)},[x]),L5();const B=h.useCallback(K=>{const[ce,...ie]=D().map(oe=>oe.ref.current),[Z]=ie.slice(-1),ee=document.activeElement;for(const oe of K)if(oe===ee||(oe==null||oe.scrollIntoView({block:"nearest"}),oe===ce&&S&&(S.scrollTop=0),oe===Z&&S&&(S.scrollTop=S.scrollHeight),oe==null||oe.focus(),document.activeElement!==ee))return},[D,S]),N=h.useCallback(()=>B([C,x]),[B,C,x]);h.useEffect(()=>{M&&N()},[M,N]);const{onOpenChange:z,triggerPointerDownPosRef:G}=v;h.useEffect(()=>{if(x){let K={x:0,y:0};const ce=Z=>{var ee,oe;K={x:Math.abs(Math.round(Z.pageX)-(((ee=G.current)==null?void 0:ee.x)??0)),y:Math.abs(Math.round(Z.pageY)-(((oe=G.current)==null?void 0:oe.y)??0))}},ie=Z=>{K.x<=10&&K.y<=10?Z.preventDefault():Z.composedPath().includes(x)||z(!1),document.removeEventListener("pointermove",ce),G.current=null};return G.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",ie,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",ie,{capture:!0})}}},[x,z,G]),h.useEffect(()=>{const K=()=>z(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[z]);const[I,Y]=Voe(K=>{const ce=D().filter(ee=>!ee.disabled),ie=ce.find(ee=>ee.ref.current===document.activeElement),Z=Goe(ce,K,ie);Z&&setTimeout(()=>{var ee;return(ee=Z.ref.current)==null?void 0:ee.focus()})}),U=h.useCallback((K,ce,ie)=>{const Z=!$.current&&!ie;(v.value!==void 0&&v.value===ce||Z)&&(j(K),Z&&($.current=!0))},[v.value]),P=h.useCallback(()=>x==null?void 0:x.focus(),[x]),F=h.useCallback((K,ce,ie)=>{const Z=!$.current&&!ie;(v.value!==void 0&&v.value===ce||Z)&&L(K)},[v.value]),te=r==="popper"?qI:Noe,W=te===qI?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:w}:{};return a.jsx(Aoe,{scope:n,content:x,viewport:S,onViewportChange:T,itemRefCallback:U,selectedItem:C,onItemLeave:P,itemTextRefCallback:F,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:M,searchRef:I,children:a.jsx(j_,{as:sLe,allowPinchZoom:!0,children:a.jsx(A_,{asChild:!0,trapped:v.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:bn(s,K=>{var ce;(ce=v.trigger)==null||ce.focus({preventScroll:!0}),K.preventDefault()}),children:a.jsx(wv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:a.jsx(te,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:K=>K.preventDefault(),...y,...W,onPlaced:()=>R(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:bn(y.onKeyDown,K=>{const ce=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!ce&&K.key.length===1&&Y(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let Z=D().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);if(["ArrowUp","End"].includes(K.key)&&(Z=Z.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const ee=K.target,oe=Z.indexOf(ee);Z=Z.slice(oe+1)}setTimeout(()=>B(Z)),K.preventDefault()}})})})})})})});joe.displayName=rLe;var iLe="SelectItemAlignedPosition",Noe=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=f0(Bp,n),o=m0(Bp,n),[l,c]=h.useState(null),[u,d]=h.useState(null),f=Nr(t,d),m=c6(n),p=h.useRef(!1),g=h.useRef(!0),{viewport:b,selectedItem:w,selectedItemText:y,focusSelectedItem:v}=o,x=h.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&b&&w&&y){const _=i.trigger.getBoundingClientRect(),C=u.getBoundingClientRect(),j=i.valueNode.getBoundingClientRect(),E=y.getBoundingClientRect();if(i.dir!=="rtl"){const ee=E.left-C.left,oe=j.left-ee,we=_.left-oe,pe=_.width+we,he=Math.max(pe,C.width),X=window.innerWidth-id,ye=HU(oe,[id,Math.max(id,X-he)]);l.style.minWidth=pe+"px",l.style.left=ye+"px"}else{const ee=C.right-E.right,oe=window.innerWidth-j.right-ee,we=window.innerWidth-_.right-oe,pe=_.width+we,he=Math.max(pe,C.width),X=window.innerWidth-id,ye=HU(oe,[id,Math.max(id,X-he)]);l.style.minWidth=pe+"px",l.style.right=ye+"px"}const L=m(),D=window.innerHeight-id*2,M=b.scrollHeight,R=window.getComputedStyle(u),$=parseInt(R.borderTopWidth,10),B=parseInt(R.paddingTop,10),N=parseInt(R.borderBottomWidth,10),z=parseInt(R.paddingBottom,10),G=$+B+M+z+N,I=Math.min(w.offsetHeight*5,G),Y=window.getComputedStyle(b),U=parseInt(Y.paddingTop,10),P=parseInt(Y.paddingBottom,10),F=_.top+_.height/2-id,te=D-F,W=w.offsetHeight/2,K=w.offsetTop+W,ce=$+B+K,ie=G-ce;if(ce<=F){const ee=L.length>0&&w===L[L.length-1].ref.current;l.style.bottom="0px";const oe=u.clientHeight-b.offsetTop-b.offsetHeight,we=Math.max(te,W+(ee?P:0)+oe+N),pe=ce+we;l.style.height=pe+"px"}else{const ee=L.length>0&&w===L[0].ref.current;l.style.top="0px";const we=Math.max(F,$+b.offsetTop+(ee?U:0)+W)+ie;l.style.height=we+"px",b.scrollTop=ce-F+b.offsetTop}l.style.margin=`${id}px 0`,l.style.minHeight=I+"px",l.style.maxHeight=D+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[m,i.trigger,i.valueNode,l,u,b,w,y,i.dir,r]);Fa(()=>x(),[x]);const[k,S]=h.useState();Fa(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const T=h.useCallback(_=>{_&&g.current===!0&&(x(),v==null||v(),g.current=!1)},[x,v]);return a.jsx(aLe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:a.jsx(nr.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Noe.displayName=iLe;var oLe="SelectPopperPosition",qI=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=id,...i}=e,o=u6(n);return a.jsx(J5,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.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)"}})});qI.displayName=oLe;var[aLe,IL]=f1(Bp,{}),HI="SelectViewport",Ioe=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=m0(HI,n),o=IL(HI,n),l=Nr(t,i.onViewportChange),c=h.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(l6.Slot,{scope:n,children:a.jsx(nr.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:bn(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-id*2,b=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),y=Math.max(b,w);if(y<g){const v=y+p,x=Math.min(g,v),k=v-x;f.style.height=x+"px",f.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Ioe.displayName=HI;var Moe="SelectGroup",[lLe,cLe]=f1(Moe),Roe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=bc();return a.jsx(lLe,{scope:n,id:s,children:a.jsx(nr.div,{role:"group","aria-labelledby":s,...r,ref:t})})});Roe.displayName=Moe;var Doe="SelectLabel",uLe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=cLe(Doe,n);return a.jsx(nr.div,{id:s.id,...r,ref:t})});uLe.displayName=Doe;var GT="SelectItem",[dLe,Loe]=f1(GT),Poe=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,l=f0(GT,n),c=m0(GT,n),u=l.value===r,[d,f]=h.useState(i??""),[m,p]=h.useState(!1),g=ru(x=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,x,r,s)}),b=Nr(t,g),w=bc(),y=h.useRef("touch"),v=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};return a.jsx(dLe,{scope:n,value:r,disabled:s,textId:w,isSelected:u,onItemTextChange:h.useCallback(x=>{f(k=>k||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(l6.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:a.jsx(nr.div,{role:"option","aria-labelledby":w,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:b,onFocus:bn(o.onFocus,()=>p(!0)),onBlur:bn(o.onBlur,()=>p(!1)),onClick:bn(o.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:bn(o.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:bn(o.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:bn(o.onPointerMove,x=>{var k;y.current=x.pointerType,s?(k=c.onItemLeave)==null||k.call(c):y.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:bn(o.onPointerLeave,x=>{var k;x.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:bn(o.onKeyDown,x=>{var S;s||x.target!==x.currentTarget||((S=c.searchRef)==null?void 0:S.current)!==""&&x.key===" "||(KDe.includes(x.key)&&v(),x.key===" "&&x.preventDefault())})})})})});Poe.displayName=GT;var ax="SelectItemText",Ooe=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=f0(ax,n),l=m0(ax,n),c=Loe(ax,n),u=JDe(ax,n),[d,f]=h.useState(null),m=ru(v=>{var x;return(x=l.itemTextRefCallback)==null?void 0:x.call(l,v,c.value,c.disabled)}),p=Nr(t,f,c.onItemTextChange,m),g=d==null?void 0:d.textContent,b=h.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:w,onNativeOptionRemove:y}=u;return Fa(()=>(w(b),()=>y(b)),[w,y,b]),a.jsxs(a.Fragment,{children:[a.jsx(nr.span,{id:c.textId,...i,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!d6(o.value)?xd.createPortal(i.children,o.valueNode):null]})});Ooe.displayName=ax;var $oe="SelectItemIndicator",Boe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Loe($oe,n).isSelected?a.jsx(nr.span,{"aria-hidden":!0,...r,ref:t}):null});Boe.displayName=$oe;var UI="SelectScrollUpButton",zoe=h.forwardRef((e,t)=>{const n=m0(UI,e.__scopeSelect),r=IL(UI,e.__scopeSelect),[s,i]=h.useState(!1),o=Nr(t,r.onScrollButtonChange);return Fa(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(qoe,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});zoe.displayName=UI;var WI="SelectScrollDownButton",Foe=h.forwardRef((e,t)=>{const n=m0(WI,e.__scopeSelect),r=IL(WI,e.__scopeSelect),[s,i]=h.useState(!1),o=Nr(t,r.onScrollButtonChange);return Fa(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(qoe,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Foe.displayName=WI;var qoe=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=m0("SelectScrollButton",n),o=h.useRef(null),l=c6(n),c=h.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),Fa(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(nr.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:bn(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:bn(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:bn(s.onPointerLeave,()=>{c()})})}),hLe="SelectSeparator",fLe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(nr.div,{"aria-hidden":!0,...r,ref:t})});fLe.displayName=hLe;var Hoe="SelectArrow",mLe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=u6(n);return m0(Hoe,n).position==="popper"?a.jsx(Z5,{...s,...r,ref:t}):null});mLe.displayName=Hoe;var Uoe="SelectBubbleInput",Woe=h.forwardRef(({__scopeSelect:e,...t},n)=>{const r=f0(Uoe,e),{value:s,onValueChange:i,required:o,disabled:l,name:c,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:m}=r,p=h.useRef(null),g=Nr(n,p),b=s??"",w=U5(b),y=Array.from(f).some(v=>(v.props.value??"")==="");return h.useEffect(()=>{const v=p.current;if(!v)return;const x=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(x,"value").set;if(w!==b&&S){const T=new Event("change",{bubbles:!0});S.call(v,b),v.dispatchEvent(T)}},[w,b]),a.jsxs(nr.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:u,disabled:l,form:d,onChange:v=>i(v.target.value),...t,style:{...Gre,...t.style},ref:g,defaultValue:b,children:[d6(s)&&!y?a.jsx("option",{value:""}):null,Array.from(f)]},m)});Woe.displayName=Uoe;function pLe(e){return typeof e=="function"}function d6(e){return e===""||e===void 0}function Voe(e){const t=ru(e),n=h.useRef(""),r=h.useRef(0),s=h.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function Goe(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=gLe(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function gLe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var bLe="Separator",UU="horizontal",yLe=["horizontal","vertical"],Koe=h.forwardRef((e,t)=>{const{decorative:n,orientation:r=UU,...s}=e,i=vLe(r)?r:UU,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(nr.div,{"data-orientation":i,...l,...s,ref:t})});Koe.displayName=bLe;function vLe(e){return yLe.includes(e)}var wLe=Koe,h6="Switch",[xLe,x9t]=Nl(h6),[kLe,ML]=xLe(h6);function _Le(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[m,p]=Ql({prop:n,defaultProp:s??!1,onChange:c,caller:h6}),[g,b]=h.useState(null),[w,y]=h.useState(null),v=h.useRef(!1),x=g?!!o||!!g.closest("form"):!0,k={checked:m,setChecked:p,disabled:i,control:g,setControl:b,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:s,isFormControl:x,bubbleInput:w,setBubbleInput:y};return a.jsx(kLe,{scope:t,...k,children:SLe(f)?f(k):r})}var Yoe="SwitchTrigger",Xoe=h.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{const{control:s,form:i,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=ML(Yoe,e),b=Nr(r,d),w=h.useRef(c);return h.useEffect(()=>{const y=i?s==null?void 0:s.ownerDocument.getElementById(i):s==null?void 0:s.form;if(y instanceof HTMLFormElement){const v=()=>f(w.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[s,i,f]),a.jsx(nr.button,{type:"button",role:"switch","aria-checked":c,"aria-required":u,"data-state":nae(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:b,onClick:bn(t,y=>{f(v=>!v),g&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});Xoe.displayName=Yoe;var Qoe=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return a.jsx(_Le,{__scopeSwitch:n,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(Xoe,{...f,ref:t,__scopeSwitch:n}),m&&a.jsx(tae,{__scopeSwitch:n})]})})});Qoe.displayName=h6;var Joe="SwitchThumb",Zoe=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=ML(Joe,n);return a.jsx(nr.span,{"data-state":nae(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});Zoe.displayName=Joe;var eae="SwitchBubbleInput",tae=h.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:p}=ML(eae,e),g=Nr(n,p),b=U5(i),w=W5(r);h.useEffect(()=>{const v=m;if(!v)return;const x=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(x,"checked").set,T=!s.current;if(b!==i&&S){const _=new Event("click",{bubbles:T});S.call(v,i),v.dispatchEvent(_)}},[m,b,i,s]);const y=h.useRef(i);return a.jsx(nr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});tae.displayName=eae;function SLe(e){return typeof e=="function"}function nae(e){return e?"checked":"unchecked"}var f6="Tabs",[CLe,k9t]=Nl(f6,[u0]),rae=u0(),[TLe,RL]=CLe(f6),sae=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=vv(l),[f,m]=Ql({prop:r,onChange:s,defaultProp:i??"",caller:f6});return a.jsx(TLe,{scope:n,baseId:bc(),value:f,onValueChange:m,orientation:o,dir:d,activationMode:c,children:a.jsx(nr.div,{dir:d,"data-orientation":o,...u,ref:t})})});sae.displayName=f6;var iae="TabsList",oae=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,i=RL(iae,n),o=rae(n);return a.jsx(e6,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(nr.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});oae.displayName=iae;var aae="TabsTrigger",lae=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=e,o=RL(aae,n),l=rae(n),c=dae(o.baseId,r),u=hae(o.baseId,r),d=r===o.value;return a.jsx(t6,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(nr.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:t,onMouseDown:bn(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:bn(e.onKeyDown,f=>{s||f.target!==f.currentTarget||[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:bn(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!s&&f&&o.onValueChange(r)})})})});lae.displayName=aae;var cae="TabsContent",uae=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=e,l=RL(cae,n),c=dae(l.baseId,r),u=hae(l.baseId,r),d=r===l.value,f=h.useRef(d);return h.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Il,{present:s||d,children:({present:m})=>a.jsx(nr.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&i})})});uae.displayName=cae;function dae(e,t){return`${e}-trigger-${t}`}function hae(e,t){return`${e}-content-${t}`}var ELe=sae,ALe=oae,jLe=lae,NLe=uae,fae="Toggle",mae=h.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:s,...i}=e,[o,l]=Ql({prop:n,onChange:s,defaultProp:r??!1,caller:fae});return a.jsx(nr.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:bn(e.onClick,()=>{e.disabled||l(!o)})})});mae.displayName=fae;var p0="ToggleGroup",[pae,_9t]=Nl(p0,[u0]),gae=u0(),DL=h.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const s=r;return a.jsx(ILe,{role:"radiogroup",...s,ref:t})}if(n==="multiple"){const s=r;return a.jsx(MLe,{role:"toolbar",...s,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${p0}\``)});DL.displayName=p0;var[bae,yae]=pae(p0),ILe=h.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,l]=Ql({prop:n,defaultProp:r??"",onChange:s,caller:p0});return a.jsx(bae,{scope:e.__scopeToggleGroup,type:"single",value:h.useMemo(()=>o?[o]:[],[o]),onItemActivate:l,onItemDeactivate:h.useCallback(()=>l(""),[l]),children:a.jsx(vae,{...i,ref:t})})}),MLe=h.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,l]=Ql({prop:n,defaultProp:r??[],onChange:s,caller:p0}),c=h.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=h.useCallback(d=>l((f=[])=>f.filter(m=>m!==d)),[l]);return a.jsx(bae,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:a.jsx(vae,{...i,ref:t})})});DL.displayName=p0;var[RLe,DLe]=pae(p0),vae=h.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:s=!0,orientation:i,dir:o,loop:l=!0,...c}=e,u=gae(n),d=vv(o),f={dir:d,...c};return a.jsx(RLe,{scope:n,rovingFocus:s,disabled:r,children:s?a.jsx(e6,{asChild:!0,...u,orientation:i,dir:d,loop:l,children:a.jsx(nr.div,{...f,ref:t})}):a.jsx(nr.div,{...f,ref:t})})}),KT="ToggleGroupItem",wae=h.forwardRef((e,t)=>{const n=yae(KT,e.__scopeToggleGroup),r=DLe(KT,e.__scopeToggleGroup),s=gae(e.__scopeToggleGroup),i=n.value.includes(e.value),o=r.disabled||e.disabled,l={...e,pressed:i,disabled:o},c=h.useRef(null);return r.rovingFocus?a.jsx(t6,{asChild:!0,...s,focusable:!o,active:i,ref:c,children:a.jsx(WU,{...l,ref:t})}):a.jsx(WU,{...l,ref:t})});wae.displayName=KT;var WU=h.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...s}=e,i=yae(KT,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},l=i.type==="single"?o:void 0;return a.jsx(mae,{...l,...s,ref:t,onPressedChange:c=>{c?i.onItemActivate(r):i.onItemDeactivate(r)}})}),[m6,S9t]=Nl("Tooltip",[c0]),p6=c0(),xae="TooltipProvider",LLe=700,VI="tooltip.open",[PLe,LL]=m6(xae),kae=e=>{const{__scopeTooltip:t,delayDuration:n=LLe,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,o=h.useRef(!0),l=h.useRef(!1),c=h.useRef(0);return h.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(PLe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:h.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:h.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};kae.displayName=xae;var Ik="Tooltip",[OLe,O_]=m6(Ik),_ae=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,c=LL(Ik,e.__scopeTooltip),u=p6(t),[d,f]=h.useState(null),m=bc(),p=h.useRef(0),g=o??c.disableHoverableContent,b=l??c.delayDuration,w=h.useRef(!1),[y,v]=Ql({prop:r,defaultProp:s??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(VI))):c.onClose(),i==null||i(_)},caller:Ik}),x=h.useMemo(()=>y?w.current?"delayed-open":"instant-open":"closed",[y]),k=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,v(!0)},[v]),S=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),T=h.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,v(!0),p.current=0},b)},[b,v]);return h.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(N_,{...u,children:a.jsx(OLe,{scope:t,contentId:m,open:y,stateAttribute:x,trigger:d,onTriggerChange:f,onTriggerEnter:h.useCallback(()=>{c.isOpenDelayedRef.current?T():k()},[c.isOpenDelayedRef,T,k]),onTriggerLeave:h.useCallback(()=>{g?S():(window.clearTimeout(p.current),p.current=0)},[S,g]),onOpen:k,onClose:S,disableHoverableContent:g,children:n})})};_ae.displayName=Ik;var GI="TooltipTrigger",Sae=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=O_(GI,n),i=LL(GI,n),o=p6(n),l=h.useRef(null),c=Nr(t,l,s.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),f=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(I_,{asChild:!0,...o,children:a.jsx(nr.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:bn(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:bn(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:bn(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:bn(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:bn(e.onBlur,s.onClose),onClick:bn(e.onClick,s.onClose)})})});Sae.displayName=GI;var PL="TooltipPortal",[$Le,BLe]=m6(PL,{forceMount:void 0}),Cae=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,i=O_(PL,t);return a.jsx($Le,{scope:t,forceMount:n,children:a.jsx(Il,{present:n||i.open,children:a.jsx(xv,{asChild:!0,container:s,children:r})})})};Cae.displayName=PL;var My="TooltipContent",Tae=h.forwardRef((e,t)=>{const n=BLe(My,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=O_(My,e.__scopeTooltip);return a.jsx(Il,{present:r||o.open,children:o.disableHoverableContent?a.jsx(Eae,{side:s,...i,ref:t}):a.jsx(zLe,{side:s,...i,ref:t})})}),zLe=h.forwardRef((e,t)=>{const n=O_(My,e.__scopeTooltip),r=LL(My,e.__scopeTooltip),s=h.useRef(null),i=Nr(t,s),[o,l]=h.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:f}=r,m=h.useCallback(()=>{l(null),f(!1)},[f]),p=h.useCallback((g,b)=>{const w=g.currentTarget,y={x:g.clientX,y:g.clientY},v=WLe(y,w.getBoundingClientRect()),x=VLe(y,v),k=GLe(b.getBoundingClientRect()),S=YLe([...x,...k]);l(S),f(!0)},[f]);return h.useEffect(()=>()=>m(),[m]),h.useEffect(()=>{if(c&&d){const g=w=>p(w,d),b=w=>p(w,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",b)}}},[c,d,p,m]),h.useEffect(()=>{if(o){const g=b=>{const w=b.target,y={x:b.clientX,y:b.clientY},v=(c==null?void 0:c.contains(w))||(d==null?void 0:d.contains(w)),x=!KLe(y,o);v?m():x&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,m]),a.jsx(Eae,{...e,ref:i})}),[FLe,qLe]=m6(Ik,{isInside:!1}),HLe=TNe("TooltipContent"),Eae=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=O_(My,n),u=p6(n),{onClose:d}=c;return h.useEffect(()=>(document.addEventListener(VI,d),()=>document.removeEventListener(VI,d)),[d]),h.useEffect(()=>{if(c.trigger){const f=m=>{m.target instanceof Node&&m.target.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(wv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(J5,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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:[a.jsx(HLe,{children:r}),a.jsx(FLe,{scope:n,isInside:!0,children:a.jsx(ONe,{id:c.contentId,role:"tooltip",children:s||r})})]})})});Tae.displayName=My;var Aae="TooltipArrow",ULe=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=p6(n);return qLe(Aae,n).isInside?null:a.jsx(Z5,{...s,...r,ref:t})});ULe.displayName=Aae;function WLe(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function VLe(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 GLe(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 KLe(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],u=l.x,d=l.y,f=c.x,m=c.y;d>r!=m>r&&n<(f-u)*(r-d)/(m-d)+u&&(s=!s)}return s}function YLe(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),XLe(t)}function XLe(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 i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.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 i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.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 jae=kae,Nae=_ae,Iae=Sae,Mae=Cae,Rae=Tae;const QLe=(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},JLe=(e,t)=>({classGroupId:e,validator:t}),Dae=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),YT="-",VU=[],ZLe="arbitrary..",ePe=e=>{const t=nPe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return tPe(o);const l=o.split(YT),c=l[0]===""&&l.length>1?1:0;return Lae(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],u=n[o];return c?u?QLe(u,c):c:u||VU}return n[o]||VU}}},Lae=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],i=n.nextPart.get(s);if(i){const u=Lae(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const l=t===0?e.join(YT):e.slice(t).join(YT),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(l))return d.classGroupId}},tPe=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?ZLe+r:void 0})(),nPe=e=>{const{theme:t,classGroups:n}=e;return rPe(n,t)},rPe=(e,t)=>{const n=Dae();for(const r in e){const s=e[r];OL(s,n,r,t)}return n},OL=(e,t,n,r)=>{const s=e.length;for(let i=0;i<s;i++){const o=e[i];sPe(o,t,n,r)}},sPe=(e,t,n,r)=>{if(typeof e=="string"){iPe(e,t,n);return}if(typeof e=="function"){oPe(e,t,n,r);return}aPe(e,t,n,r)},iPe=(e,t,n)=>{const r=e===""?t:Pae(t,e);r.classGroupId=n},oPe=(e,t,n,r)=>{if(lPe(e)){OL(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(JLe(n,e))},aPe=(e,t,n,r)=>{const s=Object.entries(e),i=s.length;for(let o=0;o<i;o++){const[l,c]=s[o];OL(c,Pae(t,l),n,r)}},Pae=(e,t)=>{let n=e;const r=t.split(YT),s=r.length;for(let i=0;i<s;i++){const o=r[i];let l=n.nextPart.get(o);l||(l=Dae(),n.nextPart.set(o,l)),n=l}return n},lPe=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,cPe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(i,o)=>{n[i]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return s(i,o),o},set(i,o){i in n?n[i]=o:s(i,o)}}},KI="!",GU=":",uPe=[],KU=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),dPe=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const i=[];let o=0,l=0,c=0,u;const d=s.length;for(let b=0;b<d;b++){const w=s[b];if(o===0&&l===0){if(w===GU){i.push(s.slice(c,b)),c=b+1;continue}if(w==="/"){u=b;continue}}w==="["?o++:w==="]"?o--:w==="("?l++:w===")"&&l--}const f=i.length===0?s:s.slice(c);let m=f,p=!1;f.endsWith(KI)?(m=f.slice(0,-1),p=!0):f.startsWith(KI)&&(m=f.slice(1),p=!0);const g=u&&u>c?u-c:void 0;return KU(i,p,m,g)};if(t){const s=t+GU,i=r;r=o=>o.startsWith(s)?i(o.slice(s.length)):KU(uPe,!1,o,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},hPe=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const o=n[i],l=o[0]==="[",c=t.has(o);l||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},fPe=e=>({cache:cPe(e.cacheSize),parseClassName:dPe(e),sortModifiers:hPe(e),postfixLookupClassGroupIds:mPe(e),...ePe(e)}),mPe=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},pPe=/\s+/,gPe=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i,postfixLookupClassGroupIds:o}=t,l=[],c=e.trim().split(pPe);let u="";for(let d=c.length-1;d>=0;d-=1){const f=c[d],{isExternal:m,modifiers:p,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let y=!!w,v;if(y){const _=b.substring(0,w);v=r(_);const C=v&&o[v]?r(b):void 0;C&&C!==v&&(v=C,y=!1)}else v=r(b);if(!v){if(!y){u=f+(u.length>0?" "+u:u);continue}if(v=r(b),!v){u=f+(u.length>0?" "+u:u);continue}y=!1}const x=p.length===0?"":p.length===1?p[0]:i(p).join(":"),k=g?x+KI:x,S=k+v;if(l.indexOf(S)>-1)continue;l.push(S);const T=s(v,y);for(let _=0;_<T.length;++_){const C=T[_];l.push(k+C)}u=f+(u.length>0?" "+u:u)}return u},bPe=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Oae(n))&&(s&&(s+=" "),s+=r);return s},Oae=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Oae(e[r]))&&(n&&(n+=" "),n+=t);return n},yPe=(e,...t)=>{let n,r,s,i;const o=c=>{const u=t.reduce((d,f)=>f(d),e());return n=fPe(u),r=n.cache.get,s=n.cache.set,i=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=gPe(c,n);return s(c,d),d};return i=o,(...c)=>i(bPe(...c))},vPe=[],sa=e=>{const t=n=>n[e]||vPe;return t.isThemeGetter=!0,t},$ae=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Bae=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wPe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,xPe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kPe=/\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$/,_Pe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,SPe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,CPe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,jm=e=>wPe.test(e),Gr=e=>!!e&&!Number.isNaN(Number(e)),zd=e=>!!e&&Number.isInteger(Number(e)),JA=e=>e.endsWith("%")&&Gr(e.slice(0,-1)),nf=e=>xPe.test(e),zae=()=>!0,TPe=e=>kPe.test(e)&&!_Pe.test(e),$L=()=>!1,EPe=e=>SPe.test(e),APe=e=>CPe.test(e),jPe=e=>!Pn(e)&&!Bn(e),NPe=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),IPe=e=>g0(e,Hae,$L),Pn=e=>$ae.test(e),V0=e=>g0(e,Uae,TPe),YU=e=>g0(e,BPe,Gr),MPe=e=>g0(e,Vae,zae),RPe=e=>g0(e,Wae,$L),XU=e=>g0(e,Fae,$L),DPe=e=>g0(e,qae,APe),L2=e=>g0(e,Gae,EPe),Bn=e=>Bae.test(e),Mw=e=>m1(e,Uae),LPe=e=>m1(e,Wae),QU=e=>m1(e,Fae),PPe=e=>m1(e,Hae),OPe=e=>m1(e,qae),P2=e=>m1(e,Gae,!0),$Pe=e=>m1(e,Vae,!0),g0=(e,t,n)=>{const r=$ae.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},m1=(e,t,n=!1)=>{const r=Bae.exec(e);return r?r[1]?t(r[1]):n:!1},Fae=e=>e==="position"||e==="percentage",qae=e=>e==="image"||e==="url",Hae=e=>e==="length"||e==="size"||e==="bg-size",Uae=e=>e==="length",BPe=e=>e==="number",Wae=e=>e==="family-name",Vae=e=>e==="number"||e==="weight",Gae=e=>e==="shadow",zPe=()=>{const e=sa("color"),t=sa("font"),n=sa("text"),r=sa("font-weight"),s=sa("tracking"),i=sa("leading"),o=sa("breakpoint"),l=sa("container"),c=sa("spacing"),u=sa("radius"),d=sa("shadow"),f=sa("inset-shadow"),m=sa("text-shadow"),p=sa("drop-shadow"),g=sa("blur"),b=sa("perspective"),w=sa("aspect"),y=sa("ease"),v=sa("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...k(),Bn,Pn],T=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],C=()=>[Bn,Pn,c],j=()=>[jm,"full","auto",...C()],E=()=>[zd,"none","subgrid",Bn,Pn],L=()=>["auto",{span:["full",zd,Bn,Pn]},zd,Bn,Pn],D=()=>[zd,"auto",Bn,Pn],M=()=>["auto","min","max","fr",Bn,Pn],R=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...C()],N=()=>[jm,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],z=()=>[jm,"screen","full","dvw","lvw","svw","min","max","fit",...C()],G=()=>[jm,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],I=()=>[e,Bn,Pn],Y=()=>[...k(),QU,XU,{position:[Bn,Pn]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",PPe,IPe,{size:[Bn,Pn]}],F=()=>[JA,Mw,V0],te=()=>["","none","full",u,Bn,Pn],W=()=>["",Gr,Mw,V0],K=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[Gr,JA,QU,XU],Z=()=>["","none",g,Bn,Pn],ee=()=>["none",Gr,Bn,Pn],oe=()=>["none",Gr,Bn,Pn],we=()=>[Gr,Bn,Pn],pe=()=>[jm,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[nf],breakpoint:[nf],color:[zae],container:[nf],"drop-shadow":[nf],ease:["in","out","in-out"],font:[jPe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[nf],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[nf],shadow:[nf],spacing:["px",Gr],text:[nf],"text-shadow":[nf],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",jm,Pn,Bn,w]}],container:["container"],"container-type":[{"@container":["","normal","size",Bn,Pn]}],"container-named":[NPe],columns:[{columns:[Gr,Pn,Bn,l]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"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:S()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:j()}],"inset-x":[{"inset-x":j()}],"inset-y":[{"inset-y":j()}],start:[{"inset-s":j(),start:j()}],end:[{"inset-e":j(),end:j()}],"inset-bs":[{"inset-bs":j()}],"inset-be":[{"inset-be":j()}],top:[{top:j()}],right:[{right:j()}],bottom:[{bottom:j()}],left:[{left:j()}],visibility:["visible","invisible","collapse"],z:[{z:[zd,"auto",Bn,Pn]}],basis:[{basis:[jm,"full","auto",l,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Gr,jm,"auto","initial","none",Pn]}],grow:[{grow:["",Gr,Bn,Pn]}],shrink:[{shrink:["",Gr,Bn,Pn]}],order:[{order:[zd,"first","last","none",Bn,Pn]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[l,"screen",...N()]}],"min-w":[{"min-w":[l,"screen","none",...N()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",n,Mw,V0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,$Pe,MPe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",JA,Pn]}],"font-family":[{font:[LPe,RPe,t]}],"font-features":[{"font-features":[Pn]}],"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,Bn,Pn]}],"line-clamp":[{"line-clamp":[Gr,"none",Bn,YU]}],leading:[{leading:[i,...C()]}],"list-image":[{"list-image":["none",Bn,Pn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Bn,Pn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[Gr,"from-font","auto",Bn,V0]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Gr,"auto",Bn,Pn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"tab-size":[{tab:[zd,Bn,Pn]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Bn,Pn]}],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",Bn,Pn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},zd,Bn,Pn],radial:["",Bn,Pn],conic:[zd,Bn,Pn]},OPe,DPe]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:F()}],"gradient-via-pos":[{via:F()}],"gradient-to-pos":[{to:F()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Gr,Bn,Pn]}],"outline-w":[{outline:["",Gr,Mw,V0]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",d,P2,L2]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",f,P2,L2]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Gr,V0]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",m,P2,L2]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Gr,Bn,Pn]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Gr]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Bn,Pn]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":k()}],"mask-image-conic-pos":[{"mask-conic":[Gr]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Bn,Pn]}],filter:[{filter:["","none",Bn,Pn]}],blur:[{blur:Z()}],brightness:[{brightness:[Gr,Bn,Pn]}],contrast:[{contrast:[Gr,Bn,Pn]}],"drop-shadow":[{"drop-shadow":["","none",p,P2,L2]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Gr,Bn,Pn]}],"hue-rotate":[{"hue-rotate":[Gr,Bn,Pn]}],invert:[{invert:["",Gr,Bn,Pn]}],saturate:[{saturate:[Gr,Bn,Pn]}],sepia:[{sepia:["",Gr,Bn,Pn]}],"backdrop-filter":[{"backdrop-filter":["","none",Bn,Pn]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[Gr,Bn,Pn]}],"backdrop-contrast":[{"backdrop-contrast":[Gr,Bn,Pn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Gr,Bn,Pn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Gr,Bn,Pn]}],"backdrop-invert":[{"backdrop-invert":["",Gr,Bn,Pn]}],"backdrop-opacity":[{"backdrop-opacity":[Gr,Bn,Pn]}],"backdrop-saturate":[{"backdrop-saturate":[Gr,Bn,Pn]}],"backdrop-sepia":[{"backdrop-sepia":["",Gr,Bn,Pn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Bn,Pn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Gr,"initial",Bn,Pn]}],ease:[{ease:["linear","initial",y,Bn,Pn]}],delay:[{delay:[Gr,Bn,Pn]}],animate:[{animate:["none",v,Bn,Pn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Bn,Pn]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[Bn,Pn,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":["translate-none"],zoom:[{zoom:[zd,Bn,Pn]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",Bn,Pn]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"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",Bn,Pn]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Gr,Mw,V0,YU]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},FPe=yPe(zPe);function ln(...e){return FPe(Ure(e))}const qPe=d1("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),Zt=h.forwardRef(function({className:t,variant:n="default",size:r="default",asChild:s=!1,...i},o){const l=s?rL:"button";return a.jsx(l,{ref:o,"data-slot":"button","data-variant":n,"data-size":r,className:ln(qPe({variant:n,size:r,className:t})),...i})}),rp=h.forwardRef(function({className:t,...n},r){return a.jsx(Ese,{ref:r,"data-slot":"checkbox",className:ln("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",t),...n,children:a.jsx(jse,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:a.jsx(kh,{})})})});function zp({...e}){return a.jsx(B5,{"data-slot":"dialog",...e})}function HPe({container:e,...t}){const n=Gu();return a.jsx(z5,{"data-slot":"dialog-portal",container:e??n??void 0,...t})}function YI({...e}){return a.jsx(kv,{"data-slot":"dialog-close",...e})}const UPe=h.forwardRef(function({className:t,...n},r){return a.jsx(F5,{ref:r,"data-slot":"dialog-overlay",className:ln("fixed inset-0 isolate z-[var(--web-shell-dialog-backdrop-z-index,50)] bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),Fp=h.forwardRef(function({className:t,children:n,showCloseButton:r=!0,overlayProps:s,...i},o){return a.jsxs(HPe,{children:[a.jsx(UPe,{...s}),a.jsxs(q5,{ref:o,"data-slot":"dialog-content",className:ln("fixed top-1/2 left-1/2 z-[var(--web-shell-dialog-backdrop-z-index,50)] grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...i,children:[n,r&&a.jsx(kv,{"data-slot":"dialog-close",asChild:!0,children:a.jsxs(Zt,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[a.jsx(cv,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})});function qp({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:ln("flex flex-col gap-2",e),...t})}function Hp({className:e,showCloseButton:t=!1,children:n,...r}){return a.jsxs("div",{"data-slot":"dialog-footer",className:ln("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&a.jsx(kv,{asChild:!0,children:a.jsx(Zt,{variant:"outline",children:"Close"})})]})}function Up({className:e,...t}){return a.jsx(H5,{"data-slot":"dialog-title",className:ln("text-base leading-none font-medium",e),...t})}function Hg({className:e,...t}){return a.jsx(aL,{"data-slot":"dialog-description",className:ln("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const Us=h.forwardRef(function({className:t,type:n,...r},s){return a.jsx("input",{ref:s,type:n,"data-slot":"input",className:ln("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...r})});function Ug({className:e,...t}){return a.jsx(vDe,{"data-slot":"label",className:ln("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function Kf({...e}){return a.jsx(jDe,{"data-slot":"popover",...e})}const Wp=h.forwardRef(function(t,n){return a.jsx(IDe,{ref:n,"data-slot":"popover-trigger",...t})}),Yf=h.forwardRef(function({className:t,align:n="center",sideOffset:r=4,...s},i){const o=Gu();return a.jsx(MDe,{container:o??void 0,children:a.jsx(RDe,{ref:i,"data-slot":"popover-content",align:n,sideOffset:r,className:ln("z-[var(--web-shell-popover-z-index,1000)] flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...s})})}),JU=h.forwardRef(function(t,n){return a.jsx(NDe,{ref:n,"data-slot":"popover-anchor",...t})});function WPe({className:e,...t}){return a.jsx("div",{"data-slot":"popover-header",className:ln("flex flex-col gap-0.5 text-sm",e),...t})}function VPe({className:e,...t}){return a.jsx("div",{"data-slot":"popover-title",className:ln("font-medium",e),...t})}function Sl({...e}){return a.jsx(yoe,{"data-slot":"select",...e})}function Kae({className:e,...t}){return a.jsx(Roe,{"data-slot":"select-group",className:ln("scroll-my-1 p-1",e),...t})}function Cl({...e}){return a.jsx(koe,{"data-slot":"select-value",...e})}const Tl=h.forwardRef(function({className:t,size:n="default",children:r,...s},i){return a.jsxs(woe,{ref:i,"data-slot":"select-trigger","data-size":n,className:ln("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[r,a.jsx(_oe,{asChild:!0,children:a.jsx(Oc,{className:"pointer-events-none size-4 text-muted-foreground"})})]})});function El({className:e,children:t,position:n="item-aligned",align:r="center",...s}){const i=Gu();return a.jsx(Coe,{container:i??void 0,children:a.jsxs(Toe,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:ln("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",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,align:r,...s,children:[a.jsx(GPe,{}),a.jsx(Ioe,{"data-position":n,className:ln("data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",n==="popper"&&""),children:t}),a.jsx(KPe,{})]})})}function Ti({className:e,children:t,...n}){return a.jsxs(Poe,{"data-slot":"select-item",className:ln("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[a.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:a.jsx(Boe,{children:a.jsx(kh,{className:"pointer-events-none"})})}),a.jsx(Ooe,{children:t})]})}function GPe({className:e,...t}){return a.jsx(zoe,{"data-slot":"select-scroll-up-button",className:ln("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:a.jsx(_xe,{})})}function KPe({className:e,...t}){return a.jsx(Foe,{"data-slot":"select-scroll-down-button",className:ln("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:a.jsx(Oc,{})})}function Cd({delayDuration:e=0,...t}){return a.jsx(jae,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function qu({...e}){return a.jsx(Nae,{"data-slot":"tooltip",...e})}function Hu({...e}){return a.jsx(Iae,{"data-slot":"tooltip-trigger",...e})}function Uu({className:e,sideOffset:t=8,children:n,...r}){const s=Gu();return a.jsx(Mae,{container:s??void 0,children:a.jsx(Rae,{"data-slot":"tooltip-content",sideOffset:t,className:ln("relative z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground before:pointer-events-none before:absolute before:size-2.5 before:rotate-45 before:rounded-[2px] before:bg-popover before:border-border before:content-[''] has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:before:-top-[5px] data-[side=bottom]:before:left-1/2 data-[side=bottom]:before:-translate-x-1/2 data-[side=bottom]:before:border-t data-[side=bottom]:before:border-l data-[side=left]:before:top-1/2 data-[side=left]:before:-right-[5px] data-[side=left]:before:-translate-y-1/2 data-[side=left]:before:border-t data-[side=left]:before:border-r data-[side=right]:before:top-1/2 data-[side=right]:before:-left-[5px] data-[side=right]:before:-translate-y-1/2 data-[side=right]:before:border-b data-[side=right]:before:border-l data-[side=top]:before:-bottom-[6px] data-[side=top]:before:left-1/2 data-[side=top]:before:-translate-x-1/2 data-[side=top]:before:border-r data-[side=top]:before:border-b 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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-[state=instant-open]:animate-in data-[state=instant-open]:fade-in-0 data-[state=instant-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:n})})}const YPe="_tableShell_1jw48_1",XPe="_columnsPopover_1jw48_13",QPe="_densityCompact_1jw48_17",JPe="_densityStandard_1jw48_29",ZPe="_densityComfortable_1jw48_39",eOe="_toolbar_1jw48_49",tOe="_summary_1jw48_71",nOe="_toolbarSpacer_1jw48_76",rOe="_selection_1jw48_80",sOe="_selectionStats_1jw48_85",iOe="_selectionMetric_1jw48_94",oOe="_selectionMetricValue_1jw48_99",aOe="_selectionCopyButton_1jw48_105",lOe="_toolbarControl_1jw48_112",cOe="_densityTrigger_1jw48_119",uOe="_densityMenu_1jw48_141",dOe="_iconButton_1jw48_147",hOe="_scroller_1jw48_171",fOe="_frozenColumnShadow_1jw48_186",mOe="_table_1jw48_1",pOe="_actionColumn_1jw48_207",gOe="_fillerColumn_1jw48_213",bOe="_headerCell_1jw48_217",yOe="_cell_1jw48_218",vOe="_fillerHeaderCell_1jw48_223",wOe="_fillerCell_1jw48_224",xOe="_frozenHeaderCell_1jw48_252",kOe="_headerControls_1jw48_257",_Oe="_headerText_1jw48_269",SOe="_filterTrigger_1jw48_277",COe="_sortTrigger_1jw48_278",TOe="_activeHeaderCell_1jw48_305",EOe="_resizeHandle_1jw48_309",AOe="_filterTriggerActive_1jw48_328",jOe="_sortTriggerActive_1jw48_333",NOe="_columnContextMenu_1jw48_337",IOe="_columnContextMenuAction_1jw48_350",MOe="_cellContent_1jw48_382",ROe="_detailValueContent_1jw48_383",DOe="_cellText_1jw48_389",LOe="_detailValueText_1jw48_390",POe="_cellContentCollapsed_1jw48_396",OOe="_detailValueCollapsed_1jw48_397",$Oe="_dragging_1jw48_404",BOe="_selectedCell_1jw48_416",zOe="_actionHeaderCell_1jw48_422",FOe="_actionCell_1jw48_423",qOe="_stickyActionHeaderCell_1jw48_431",HOe="_stickyActionCell_1jw48_432",UOe="_frozenCell_1jw48_450",WOe="_hasFrozenColumn_1jw48_456",VOe="_rowDetailButton_1jw48_494",GOe="_detailRow_1jw48_520",KOe="_detailCell_1jw48_524",YOe="_detailPanel_1jw48_536",XOe="_detailItem_1jw48_552",QOe="_detailLabel_1jw48_562",JOe="_detailValue_1jw48_383",ZOe="_emptyValue_1jw48_577",e$e="_emptyState_1jw48_582",t$e="_selectionMetricSecondary_1jw48_590",hn={tableShell:YPe,columnsPopover:XPe,densityCompact:QPe,densityStandard:JPe,densityComfortable:ZPe,toolbar:eOe,summary:tOe,toolbarSpacer:nOe,selection:rOe,selectionStats:sOe,selectionMetric:iOe,selectionMetricValue:oOe,selectionCopyButton:aOe,toolbarControl:lOe,densityTrigger:cOe,densityMenu:uOe,iconButton:dOe,scroller:hOe,frozenColumnShadow:fOe,table:mOe,actionColumn:pOe,fillerColumn:gOe,headerCell:bOe,cell:yOe,fillerHeaderCell:vOe,fillerCell:wOe,frozenHeaderCell:xOe,headerControls:kOe,headerText:_Oe,filterTrigger:SOe,sortTrigger:COe,activeHeaderCell:TOe,resizeHandle:EOe,filterTriggerActive:AOe,sortTriggerActive:jOe,columnContextMenu:NOe,columnContextMenuAction:IOe,cellContent:MOe,detailValueContent:ROe,cellText:DOe,detailValueText:LOe,cellContentCollapsed:POe,detailValueCollapsed:OOe,dragging:$Oe,selectedCell:BOe,actionHeaderCell:zOe,actionCell:FOe,stickyActionHeaderCell:qOe,stickyActionCell:HOe,frozenCell:UOe,hasFrozenColumn:WOe,rowDetailButton:VOe,detailRow:GOe,detailCell:KOe,detailPanel:YOe,detailItem:XOe,detailLabel:QOe,detailValue:JOe,emptyValue:ZOe,emptyState:e$e,selectionMetricSecondary:t$e},n$e={contains:"markdownTable.filter.text.contains",equals:"markdownTable.filter.text.equals",notEquals:"markdownTable.filter.text.notEquals",startsWith:"markdownTable.filter.text.startsWith",endsWith:"markdownTable.filter.text.endsWith"},r$e={gt:"markdownTable.filter.number.gt",gte:"markdownTable.filter.number.gte",lt:"markdownTable.filter.number.lt",lte:"markdownTable.filter.number.lte",between:"markdownTable.filter.number.between"},s$e=500,i$e=50,u4=40,Db=160,o$e=72,Yae=80,Xae=640,ZU=16,Qae="application/x-qwen-web-shell-table-column",a$e=60,l$e=3,c$e=["standard","compact","comfortable"],u$e={width:u4,minWidth:u4,maxWidth:u4};function eW(e){return Math.min(Xae,Math.max(Yae,e))}function ZA(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function d$e(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function bg(e,t){return h.isValidElement(e)&&e.type===t}function h$e(e){return e.replace(/\s+/g," ").trim()}function ej(e){return e.length>a$e||e.split(/\r\n|\r|\n/).length>l$e}function f$e(e){switch(e){case"compact":return hn.densityCompact;case"comfortable":return hn.densityComfortable;case"standard":default:return hn.densityStandard}}function m$e(e){let t=e;for(;t;){const n=window.getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return t;t=t.parentElement}return null}function XI(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(XI).join(""):h.isValidElement(e)?e.type==="img"?e.props.alt??"":XI(e.props.children):""}function p$e(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function Jae(e,t){const n=h.Children.toArray(e.props.children).filter(r=>bg(r,"td")||bg(r,"th"));return{key:t,cells:n.map((r,s)=>{var o;const i=XI(r.props.children);return{key:`${t}-${s}`,content:r.props.children,text:h$e(i),rawText:i,isHeader:r.type==="th",textAlign:(o=r.props.style)==null?void 0:o.textAlign}})}}function tj(e,t){return h.Children.toArray(e.props.children).filter(n=>bg(n,"tr")).map((n,r)=>Jae(n,`${t}-${r}`))}function g$e(e,t){return{...e,cells:Array.from({length:t},(n,r)=>e.cells[r]??p$e(e.key,r))}}function b$e(e,t){const n=h.Children.toArray(e),r=[],s=[],i=[];if(n.forEach((d,f)=>{bg(d,"thead")?r.push(...tj(d,`head-${f}`)):bg(d,"tbody")?s.push(...tj(d,`body-${f}`)):bg(d,"tfoot")?s.push(...tj(d,`foot-${f}`)):bg(d,"tr")&&i.push(Jae(d,`row-${f}`))}),i.length>0){const[d,...f]=i;d!=null&&d.cells.some(m=>m.isHeader)?(r.push(d),s.push(...f)):s.push(...i)}const o=[...r,...s],l=Math.max(0,...o.map(d=>d.cells.length)),c=r[0];return{headers:Array.from({length:l},(d,f)=>{const m=c==null?void 0:c.cells[f];if(m)return m;const p=t(f);return{key:`header-${f}`,content:p,text:p,rawText:p,isHeader:!0}}),rows:s.map(d=>g$e(d,l)),columnCount:l}}function Df(e){const t=e.trim(),n=t.endsWith("%"),s=(n?t.slice(0,-1):t).replace(/[$€£¥₹,\s]/g,"");if(!/^-?(\d+(\.\d+)?|\.\d+)$/.test(s))return null;const i=Number(s);return Number.isFinite(i)?n?i/100:i:null}function Zae(e,t){const n=Df(e),r=Df(t);return n!==null&&r!==null&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function XT(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function BL(e,t){if(!e)return[];const n=t.indexOf(e.anchorCol),r=t.indexOf(e.focusCol);if(n===-1||r===-1)return[];const s=Math.min(n,r),i=Math.max(n,r);return t.slice(s,i+1)}function QT(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function QI(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function nj(e){return e.rawText||e.text}function tW(e,t,n){if((e[t]??Db)===n)return e;if(n===Db){const s={...e};return delete s[t],s}return{...e,[t]:n}}function nW(e,t,n){if(!e)return"";const{minRow:r,maxRow:s}=XT(e),i=BL(e,n);if(i.length===0)return"";const o=[];for(let l=r;l<=s;l++){const c=t[l];c&&o.push(i.map(u=>QT(QI(c.cells[u]))).join("	"))}return o.join(`
`)}function y$e(e,t,n){return n.length===0?"":[n.map(s=>QT(QI(e[s]))).join("	"),...t.map(s=>n.map(i=>QT(QI(s.cells[i]))).join("	"))].join(`
`)}function v$e(e,t,n){if(!e)return null;const{minRow:r,maxRow:s}=XT(e),i=BL(e,n);if(i.length===0)return null;let o=0,l=0,c=0,u=0,d=1/0,f=-1/0,m=!0,p=!0,g;for(let w=r;w<=s;w++){const y=t[w];y&&i.forEach(v=>{const x=y.cells[v];if(!x)return;o+=1;const k=x.text.trim();if(!k)return;l+=1;const S=Df(k);if(S===null)return;c+=1,u+=S,d=Math.min(d,S),f=Math.max(f,S),m=m&&k.endsWith("%");const T=k.match(/[$€£¥₹]/g),_=(T==null?void 0:T.length)===1?T[0]:void 0;_?g===void 0?g=_:g!==_&&(p=!1):p=!1})}if(o===0)return null;const b=c>0&&m?"percent":c>0&&p&&g?"currency":"number";return{selectedCount:o,nonEmptyCount:l,numericCount:c,sum:u,average:c>0?u/c:0,min:c>0?d:0,max:c>0?f:0,format:b,currencySymbol:g}}function O2(e,t,n){const r=Object.is(e,-0)?0:e,s=n==="en"?"en-US":n;if(t.format==="percent")return new Intl.NumberFormat(s,{style:"percent",maximumFractionDigits:6}).format(r);const i=new Intl.NumberFormat(s,{maximumFractionDigits:6}).format(Math.abs(r));return t.format==="currency"&&t.currencySymbol?`${r<0?"-":""}${t.currencySymbol}${i}`:r<0?`-${i}`:i}function w$e(e,t,n){if(t===n)return e;const r=e.indexOf(t),s=e.indexOf(n);if(r===-1||s===-1)return e;const i=[...e],[o]=i.splice(r,1);return o===void 0?e:(i.splice(s,0,o),i)}function rf(e){return Array.from({length:e},(t,n)=>n)}function rW(e){return Array.from(e.types).includes(Qae)}function qx(e){var t,n;return e?!!(e.selectedValues!==void 0||(t=e.textFilter)!=null&&t.value.trim()||(n=e.numberFilter)!=null&&n.value.trim()):!1}function x$e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=e.toLowerCase(),r=t.value.trim().toLowerCase();switch(t.operator){case"equals":return n===r;case"notEquals":return n!==r;case"startsWith":return n.startsWith(r);case"endsWith":return n.endsWith(r);case"contains":default:return n.includes(r)}}function k$e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Df(e),r=Df(t.value);if(n===null||r===null)return!1;switch(t.operator){case"gt":return n>r;case"gte":return n>=r;case"lt":return n<r;case"lte":return n<=r;case"between":{const s=Df(t.valueTo??"");if(s===null)return!1;const i=Math.min(r,s),o=Math.max(r,s);return n>=i&&n<=o}default:return!0}}function _$e(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:x$e(e,t.textFilter)&&k$e(e,t.numberFilter)}function sW(e,t,n){const r=Object.entries(t).map(([s,i])=>[Number(s),i]).filter(([s,i])=>s!==n&&qx(i));return r.length===0?e:e.filter(s=>r.every(([i,o])=>{var l;return _$e(((l=s.cells[i])==null?void 0:l.text)??"",o)}))}function S$e(e,t){return t?e.map((n,r)=>({row:n,index:r})).sort((n,r)=>{var o,l;const s=Zae(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((l=r.row.cells[t.columnIndex])==null?void 0:l.text)??""),i=t.direction==="asc"?s:-s;return i===0?n.index-r.index:i}).map(({row:n})=>n):e}function C$e(e,t,n){const r=new Map;return e.forEach(s=>{var o;const i=((o=s.cells[t])==null?void 0:o.text)??"";r.set(i,(r.get(i)??0)+1)}),Array.from(r.entries()).map(([s,i])=>({value:s,label:s||n,count:i})).sort((s,i)=>Zae(s.value,i.value))}function T$e(e,t){let n=0,r=0;return e.forEach(s=>{var o;const i=((o=s.cells[t])==null?void 0:o.text)??"";i&&(n+=1,Df(i)!==null&&(r+=1))}),n>0&&r/n>=.7}function E$e(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function A$e(e,t){var r,s,i;const n={};if(e.selectedValues!==void 0&&!E$e(e.selectedValues,t)&&(n.selectedValues=e.selectedValues),(r=e.textFilter)!=null&&r.value.trim()&&(n.textFilter={operator:e.textFilter.operator,value:e.textFilter.value.trim()}),(s=e.numberFilter)!=null&&s.value.trim()){const o=e.numberFilter.value.trim(),l=(i=e.numberFilter.valueTo)==null?void 0:i.trim();Df(o)!==null&&(e.numberFilter.operator!=="between"||Df(l??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:l})}return qx(n)?n:void 0}function j$e({columnIndex:e,columnName:t,search:n,searchInputRef:r,filteredOptions:s,visibleOptions:i,selectedValues:o,allFilteredSelected:l,onSearchChange:c,onFilteredSelectionChange:u,onToggleValue:d}){const{t:f}=rt();return a.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[a.jsx(Us,{ref:r,className:"h-7 text-xs",value:n,onChange:m=>c(m.currentTarget.value),placeholder:f("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":f("markdownTable.filter.searchAria",{column:t})}),a.jsxs(Ug,{htmlFor:`markdown-table-filter-all-${e}`,className:"min-h-7 cursor-pointer gap-2 px-1.5 py-1 text-xs font-normal hover:bg-muted",children:[a.jsx(rp,{id:`markdown-table-filter-all-${e}`,name:`markdown-table-filter-all-${e}`,"data-name":`markdown-table-filter-all-${e}`,checked:l,onCheckedChange:m=>u(m===!0)}),a.jsx("span",{children:f("markdownTable.filter.selectVisible")}),a.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:s.length})]}),a.jsxs("div",{className:"max-h-[170px] overflow-auto rounded-md border bg-muted/50",children:[i.map((m,p)=>a.jsxs(Ug,{htmlFor:`markdown-table-filter-option-${e}-${p}`,className:"min-h-7 cursor-pointer gap-2 px-1.5 py-1 text-xs font-normal hover:bg-muted",children:[a.jsx(rp,{id:`markdown-table-filter-option-${e}-${p}`,name:`markdown-table-filter-option-${e}-${p}`,"data-name":`markdown-table-filter-option-${e}-${p}`,checked:o.has(m.value),onCheckedChange:()=>d(m.value)}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label}),a.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:m.count})]},m.value)),s.length>i.length&&a.jsx("div",{className:"p-2 text-center text-muted-foreground",children:f("markdownTable.filter.optionLimit",{count:i.length})}),s.length===0&&a.jsx("div",{className:"p-2 text-center text-muted-foreground",children:f("markdownTable.filter.noOptions")})]})]})}function N$e({overlayId:e,columnIndex:t,columnName:n,isNumeric:r,textOperator:s,textValue:i,numberOperator:o,numberValue:l,numberValueTo:c,onTextOperatorChange:u,onTextValueChange:d,onNumberOperatorChange:f,onNumberValueChange:m,onNumberValueToChange:p}){const{t:g}=rt();return a.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[a.jsx("div",{className:"font-semibold text-muted-foreground",children:g("markdownTable.filter.custom")}),r?a.jsxs(a.Fragment,{children:[a.jsxs(Sl,{value:o,name:`markdown-table-number-operator-${t}`,onValueChange:b=>f(b),children:[a.jsx(Tl,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-number-operator-${t}`,"aria-label":g("markdownTable.filter.numberAria",{column:n}),children:a.jsx(Cl,{})}),a.jsx(El,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(r$e).map(([b,w])=>a.jsx(Ti,{value:b,"data-value":b,className:"text-xs",children:g(w)},b))})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx(Us,{className:"h-7 text-xs",value:l,onChange:b=>m(b.currentTarget.value),placeholder:g("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${t}`}),o==="between"&&a.jsx(Us,{className:"h-7 text-xs",value:c,onChange:b=>p(b.currentTarget.value),placeholder:g("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${t}`})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Sl,{value:s,name:`markdown-table-text-operator-${t}`,onValueChange:b=>u(b),children:[a.jsx(Tl,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-text-operator-${t}`,"aria-label":g("markdownTable.filter.textAria",{column:n}),children:a.jsx(Cl,{})}),a.jsx(El,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(n$e).map(([b,w])=>a.jsx(Ti,{value:b,"data-value":b,className:"text-xs",children:g(w)},b))})]}),a.jsx(Us,{className:"h-7 text-xs",value:i,onChange:b=>d(b.currentTarget.value),placeholder:g("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${t}`})]})]})}function I$e({onClear:e,onClose:t,onApply:n}){const{t:r}=rt();return a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2",children:[a.jsx(Zt,{variant:"outline",size:"sm",type:"button",onClick:e,children:r("markdownTable.filter.reset")}),a.jsx("span",{className:"flex-1"}),a.jsx(Zt,{variant:"outline",size:"sm",type:"button",onClick:t,children:r("markdownTable.filter.cancel")}),a.jsx(Zt,{size:"sm",type:"button",onClick:n,children:r("markdownTable.filter.confirm")})]})}function M$e({id:e,columnName:t,columnIndex:n,filter:r,isNumeric:s,options:i,onApply:o,onClose:l}){var $,B,N,z,G;const c=h.useMemo(()=>i.map(I=>I.value),[i]),[u,d]=h.useState(""),[f,m]=h.useState(()=>new Set((r==null?void 0:r.selectedValues)??c)),[p,g]=h.useState((($=r==null?void 0:r.textFilter)==null?void 0:$.operator)??"contains"),[b,w]=h.useState(((B=r==null?void 0:r.textFilter)==null?void 0:B.value)??""),[y,v]=h.useState(((N=r==null?void 0:r.numberFilter)==null?void 0:N.operator)??"gt"),[x,k]=h.useState(((z=r==null?void 0:r.numberFilter)==null?void 0:z.value)??""),[S,T]=h.useState(((G=r==null?void 0:r.numberFilter)==null?void 0:G.valueTo)??""),_=h.useRef(null);h.useEffect(()=>{var I;(I=_.current)==null||I.focus()},[]);const C=h.useMemo(()=>{const I=u.trim().toLowerCase();return I?i.filter(Y=>Y.label.toLowerCase().includes(I)):i},[i,u]),j=C.slice(0,500),E=C.length>0&&C.every(I=>f.has(I.value)),L=I=>{m(Y=>{const U=new Set(Y);return C.forEach(P=>{I?U.add(P.value):U.delete(P.value)}),U})},D=I=>{m(Y=>{const U=new Set(Y);return U.has(I)?U.delete(I):U.add(I),U})},M=()=>{o(n,A$e({selectedValues:Array.from(f),textFilter:{operator:p,value:b},numberFilter:{operator:y,value:x,valueTo:S}},c))},R=()=>{o(n,void 0)};return a.jsxs(Yf,{id:e,"data-markdown-table-filter-owner":e,align:"end",sideOffset:2,collisionPadding:6,onCloseAutoFocus:I=>{document.activeElement&&document.activeElement!==document.body&&I.preventDefault()},className:"max-h-[min(430px,calc(100vh-16px))] w-[300px] max-w-[80vw] gap-0 overflow-auto p-0 text-xs",role:"dialog","aria-labelledby":`${e}-title`,children:[a.jsx(WPe,{className:"border-b px-2.5 py-2",children:a.jsx(VPe,{id:`${e}-title`,className:"truncate text-xs font-bold",children:t})}),a.jsx(j$e,{columnIndex:n,columnName:t,search:u,searchInputRef:_,filteredOptions:C,visibleOptions:j,selectedValues:f,allFilteredSelected:E,onSearchChange:d,onFilteredSelectionChange:L,onToggleValue:D}),a.jsx(N$e,{overlayId:e,columnIndex:n,columnName:t,isNumeric:s,textOperator:p,textValue:b,numberOperator:y,numberValue:x,numberValueTo:S,onTextOperatorChange:g,onTextValueChange:w,onNumberOperatorChange:v,onNumberValueChange:k,onNumberValueToChange:T}),a.jsx(I$e,{onClear:R,onClose:l,onApply:M})]})}function R$e({children:e,fallback:t,toolbarExtra:n}){const{t:r}=rt(),s=h.useMemo(()=>b$e(e,i=>r("markdownTable.column",{index:i+1})),[e,r]);return s.columnCount===0?a.jsx(a.Fragment,{children:t??a.jsx("table",{children:e})}):s.rows.length>s$e||s.columnCount>i$e?a.jsx(a.Fragment,{children:t??a.jsx("table",{children:e})}):a.jsx(L$e,{table:s,toolbarExtra:n})}function D$e({headers:e,columnOrder:t,hiddenColumns:n,detailColumns:r,onToggleTableColumn:s,onToggleAllTableColumns:i,onToggleDetailColumn:o,onToggleAllDetailColumns:l,onReset:c,onDragStart:u,onDragEnd:d,onDragOver:f,onDrop:m}){const{t:p}=rt(),g=h.useId(),b=e.length-n.size,w=b===e.length,y=r.size===e.length,v=b===0?!1:w?!0:"indeterminate",x=r.size===0?!1:y?!0:"indeterminate";return a.jsxs(Kf,{children:[a.jsx(Wp,{asChild:!0,children:a.jsxs(Zt,{variant:"ghost",size:"sm",className:hn.toolbarControl,type:"button",children:[a.jsx(fxe,{}),p("markdownTable.customColumns")]})}),a.jsxs(Yf,{align:"end",className:`${hn.columnsPopover} max-h-[min(520px,calc(100vh-16px))] w-80 max-w-[85vw] gap-0 overflow-auto p-0`,children:[a.jsxs("div",{className:"flex items-center gap-3 border-b px-3 py-3",children:[a.jsx(rp,{checked:v,onCheckedChange:k=>i(k===!0),"aria-label":p("markdownTable.customColumns.toggleAllTable")}),a.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:p("markdownTable.customColumns.tableSection")}),a.jsx(Zt,{variant:"ghost",size:"sm",type:"button",onClick:c,children:p("markdownTable.customColumns.reset")})]}),a.jsx("div",{className:"p-2",children:t.map(k=>{const S=e[k];if(!S)return null;const T=S.text||p("markdownTable.column",{index:k+1});return a.jsxs("div",{className:"flex min-h-9 items-center gap-2 rounded-md px-1.5 hover:bg-muted",onDragOver:f,onDrop:_=>m(_,k),children:[a.jsx("button",{className:"flex size-7 shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground hover:bg-muted-foreground/10 active:cursor-grabbing",type:"button",draggable:!0,onDragStart:_=>u(_,k),onDragEnd:d,"aria-label":p("markdownTable.moveColumn",{column:T}),children:a.jsx(Eke,{className:"size-3.5"})}),a.jsx(rp,{id:`${g}-table-${k}`,checked:!n.has(k),onCheckedChange:()=>s(k)}),a.jsx(Ug,{htmlFor:`${g}-table-${k}`,className:"min-w-0 flex-1 cursor-pointer truncate font-normal",children:T})]},S.key)})}),a.jsxs("div",{className:"flex items-center gap-3 border-y px-3 py-3",children:[a.jsx(rp,{checked:x,onCheckedChange:k=>l(k===!0),"aria-label":p("markdownTable.customColumns.toggleAllDetails")}),a.jsx("span",{className:"text-xs text-muted-foreground",children:p("markdownTable.customColumns.detailSection")})]}),a.jsx("div",{className:"p-2",children:e.map((k,S)=>{const T=k.text||p("markdownTable.column",{index:S+1});return a.jsxs("div",{className:"flex min-h-9 items-center gap-2 rounded-md px-1.5 hover:bg-muted",children:[a.jsx(rp,{id:`${g}-detail-${S}`,checked:r.has(S),onCheckedChange:()=>o(S)}),a.jsx(Ug,{htmlFor:`${g}-detail-${S}`,className:"min-w-0 flex-1 cursor-pointer truncate font-normal",children:T})]},`${k.key}-detail`)})})]})]})}function L$e({table:e,toolbarExtra:t}){const{language:n,t:r}=rt(),s=SNe(),i=h.useId(),[o,l]=h.useState(null),[c,u]=h.useState({}),[d,f]=h.useState(null),[m,p]=h.useState(null),[g,b]=h.useState(null),[w,y]=h.useState(()=>new Set),[v,x]=h.useState(()=>new Set(rf(e.columnCount))),[k,S]=h.useState({}),[T,_]=h.useState(()=>rf(e.columnCount)),[C,j]=h.useState(null),[E,L]=h.useState(!1),[D,M]=h.useState(null),[R,$]=h.useState(null),[B,N]=h.useState(null),[z,G]=h.useState(!1),[I,Y]=h.useState("standard"),[U,P]=h.useState(null),[F,te]=h.useState(!1),[W,K]=h.useState(!1),[ce,ie]=h.useState(!1),[Z,ee]=h.useState(!1),oe=h.useRef(!1),we=h.useRef(null),pe=h.useRef(null),he=h.useRef(null),X=h.useRef(0),ye=h.useRef(0),Ce=h.useRef(0),ae=h.useRef(!0),me=h.useRef(null),We=h.useRef(null),Oe=h.useRef(null),Mt=h.useRef(null),$t=h.useRef(null),St=h.useRef(null),ue=h.useRef(null),Ee=h.useRef(null),tt=h.useRef(0),ut=h.useRef(0),Ct=h.useRef(null),Ze=h.useRef(null),Et=h.useMemo(()=>`${e.columnCount}\0${e.headers.map(xe=>xe.text).join("\0")}`,[e.columnCount,e.headers]),Nt=h.useRef(Et),gt=h.useCallback(()=>{p(null)},[]),Je=h.useCallback(()=>{X.current+=1,we.current&&(clearTimeout(we.current),we.current=null),K(!1)},[]),Ae=h.useCallback(()=>{ye.current+=1,pe.current&&(clearTimeout(pe.current),pe.current=null),ie(!1)},[]),de=h.useCallback(()=>{Ce.current+=1,he.current&&(clearTimeout(he.current),he.current=null),ee(!1)},[]),nt=h.useCallback(()=>{tt.current&&(cancelAnimationFrame(tt.current),tt.current=0);const xe=Ee.current;Ee.current=null,xe&&f($e=>$e&&{...$e,focusRow:xe.rowIndex,focusCol:xe.columnIndex})},[]),ve=h.useCallback(()=>{nt(),oe.current=!1,te(!1)},[nt]);h.useEffect(()=>{const xe=()=>{document.hidden&&ve()};return window.addEventListener("mouseup",ve),window.addEventListener("blur",ve),document.addEventListener("visibilitychange",xe),()=>{window.removeEventListener("mouseup",ve),window.removeEventListener("blur",ve),document.removeEventListener("visibilitychange",xe),tt.current&&cancelAnimationFrame(tt.current)}},[ve]),h.useEffect(()=>{Nt.current!==Et&&(Nt.current=Et,l(null),u({}),f(null),p(null),b(null),y(new Set),x(new Set(rf(e.columnCount))),S({}),_(rf(e.columnCount)),j(null),L(!1),M(null),$(null),N(null),G(!1),Y("standard"),Je(),Ae(),de(),oe.current=!1,Ze.current=null,te(!1))},[Ae,de,Je,e.columnCount,Et]),h.useEffect(()=>{Ae()},[Ae,d]),h.useEffect(()=>(ae.current=!0,()=>{ae.current=!1,we.current&&(clearTimeout(we.current),we.current=null),pe.current&&(clearTimeout(pe.current),pe.current=null),he.current&&(clearTimeout(he.current),he.current=null)}),[]),h.useEffect(()=>{if(!m)return;const xe=`${i}-filter-${m.columnIndex}`,$e=Ft=>{if(Ft.target instanceof Element){const On=Ft.target.closest("[data-markdown-table-filter-owner]");if((On==null?void 0:On.getAttribute("data-markdown-table-filter-owner"))===xe)return}p(null)},it=()=>p(null);return document.addEventListener("scroll",$e,!0),window.addEventListener("resize",it),()=>{document.removeEventListener("scroll",$e,!0),window.removeEventListener("resize",it)}},[m,i]),h.useEffect(()=>{if(!g)return;const xe=Ft=>{var Yn;const On=Ft.target;(Yn=$t.current)!=null&&Yn.contains(On)||b(null)},$e=Ft=>{Ft.key==="Escape"&&(Ft.preventDefault(),b(null))},it=()=>b(null);return document.addEventListener("mousedown",xe),document.addEventListener("keydown",$e),document.addEventListener("scroll",it,!0),window.addEventListener("resize",it),()=>{document.removeEventListener("mousedown",xe),document.removeEventListener("keydown",$e),document.removeEventListener("scroll",it,!0),window.removeEventListener("resize",it)}},[g]),h.useEffect(()=>{const xe=it=>{var On,Yn;const Ft=it.target;Ft instanceof Node&&!((On=me.current)!=null&&On.contains(Ft))&&!((Yn=$t.current)!=null&&Yn.contains(Ft))&&j(null)},$e=it=>{it.defaultPrevented||m||B||g||it.key==="Escape"&&j(null)};return document.addEventListener("mousedown",xe),document.addEventListener("keydown",$e),()=>{document.removeEventListener("mousedown",xe),document.removeEventListener("keydown",$e)}},[B,g,m]),h.useEffect(()=>{if(!d)return;const xe=$e=>{var Ft;const it=$e.target;it instanceof Node&&!((Ft=me.current)!=null&&Ft.contains(it))&&(ve(),f(null))};return document.addEventListener("mousedown",xe),()=>{document.removeEventListener("mousedown",xe)}},[d,ve]);const Ke=h.useMemo(()=>sW(e.rows,c),[c,e.rows]),le=h.useMemo(()=>S$e(Ke,o),[Ke,o]);h.useEffect(()=>{f(xe=>xe&&(XT(xe).maxRow<le.length?xe:null))},[le.length]);const Le=h.useMemo(()=>{if(!m)return[];const xe=m.columnIndex;return C$e(sW(e.rows,c,xe),xe,r("markdownTable.blank"))},[c,m,r,e.rows]),dt=h.useMemo(()=>e.headers.map((xe,$e)=>T$e(e.rows,$e)),[e.headers,e.rows]),Fe=h.useMemo(()=>T.filter(xe=>xe>=0&&xe<e.columnCount).filter(xe=>!w.has(xe)),[T,w,e.columnCount]),Ge=h.useMemo(()=>rf(e.columnCount).filter(xe=>v.has(xe)),[v,e.columnCount]),un=E?Fe[0]:void 0,Wn=Fe.reduce((xe,$e)=>xe+(k[$e]??0),0),Me=Fe.filter(xe=>k[xe]===void 0).length,yt=Me===0,cn=h.useMemo(()=>{if(!B)return null;const xe=le.find($e=>$e.key===B.rowKey);return(xe==null?void 0:xe.cells[B.columnIndex])??null},[B,le]),Re=cn==null?void 0:cn.text;h.useEffect(()=>{Je()},[Je,Fe,le]),h.useEffect(()=>{if(!D)return;const xe=()=>{const On=Ct.current;Ct.current=null,ut.current&&(cancelAnimationFrame(ut.current),ut.current=0),On!==null&&S(Yn=>tW(Yn,D.columnIndex,On))},$e=On=>{Ct.current=eW(D.startWidth+On.clientX-D.startX),!ut.current&&(ut.current=requestAnimationFrame(xe))},it=()=>{xe(),M(null)},Ft=()=>{document.hidden&&it()};return window.addEventListener("mousemove",$e),window.addEventListener("mouseup",it),window.addEventListener("blur",it),document.addEventListener("visibilitychange",Ft),()=>{window.removeEventListener("mousemove",$e),window.removeEventListener("mouseup",it),window.removeEventListener("blur",it),document.removeEventListener("visibilitychange",Ft),ut.current&&(cancelAnimationFrame(ut.current),ut.current=0),Ct.current=null}},[D]),h.useEffect(()=>{R&&!le.some(xe=>xe.key===R)&&$(null),B&&!le.some(xe=>xe.key===B.rowKey&&xe.cells[B.columnIndex])&&N(null)},[B,R,le]),h.useLayoutEffect(()=>{const xe=Mt.current;if(Mt.current=null,!(xe!=null&&xe.element.isConnected))return;const $e=xe.element.getBoundingClientRect().top-xe.top;$e!==0&&(xe.scrollContainer?xe.scrollContainer.scrollTop+=$e:window.scrollBy(0,$e))},[R]),h.useEffect(()=>{if(B)return s()},[B,s]),h.useEffect(()=>{B&&de()},[B,Re,de]),h.useEffect(()=>{if(B)return()=>{const xe=ue.current;ue.current=null,xe!=null&&xe.isConnected&&xe.focus()}},[B]);const et=(xe,$e)=>{f(null),u(it=>{const Ft={...it};return $e&&qx($e)?Ft[xe]=$e:delete Ft[xe],Ft}),gt()},bt=xe=>{f(null),j(xe),l($e=>($e==null?void 0:$e.columnIndex)!==xe?{columnIndex:xe,direction:"asc"}:$e.direction==="asc"?{columnIndex:xe,direction:"desc"}:null)},rn=(xe,$e)=>{if(!$e){p(it=>(it==null?void 0:it.columnIndex)===xe?null:it);return}f(null),j(xe),b(null),p({columnIndex:xe})},qn=xe=>{f(null),j($e=>$e===xe?null:$e),gt(),u($e=>{const it={...$e};return delete it[xe],it}),l($e=>($e==null?void 0:$e.columnIndex)===xe?null:$e),y($e=>{const it=new Set($e);return it.has(xe)?it.delete(xe):it.add(xe),it})},ft=xe=>{if(f(null),j(null),gt(),xe){y(new Set);return}y(new Set(rf(e.columnCount))),u({}),l(null)},He=xe=>{x($e=>{const it=new Set($e);return it.has(xe)?it.delete(xe):it.add(xe),it})},Ye=xe=>{x(xe?new Set(rf(e.columnCount)):new Set)},Yt=()=>{f(null),j(null),gt(),_(rf(e.columnCount)),y(new Set),x(new Set(rf(e.columnCount)))},Cn=()=>{L(xe=>!xe),b(null)},Tn=(xe,$e)=>{if($e!==Fe[0])return;xe.preventDefault(),f(null),j($e),p(null),b({left:Math.max(6,Math.min(xe.clientX,window.innerWidth-220-6)),top:Math.max(6,Math.min(xe.clientY,window.innerHeight-72-6))})},zr=(xe,$e)=>{var it;R!==xe&&$e&&(Mt.current={element:$e,scrollContainer:m$e(((it=me.current)==null?void 0:it.parentElement)??null),top:$e.getBoundingClientRect().top}),f(null),N(null),de(),$(Ft=>Ft===xe?null:xe)},Ns=(xe,$e)=>{ue.current=document.activeElement instanceof HTMLElement?document.activeElement:null,f(null),p(null),$(null),de(),N({rowKey:xe,columnIndex:$e})},kr=()=>{N(null),de()},si=()=>{if(Re==null||!navigator.clipboard)return;const xe=Ce.current;navigator.clipboard.writeText(QT(Re)).then(()=>{ae.current&&Ce.current===xe&&(he.current&&clearTimeout(he.current),ee(!0),he.current=setTimeout(()=>ee(!1),2e3))}).catch($e=>console.warn("[web-shell] clipboard write failed:",$e))},Fr=h.useMemo(()=>d?XT(d):null,[d]),At=h.useMemo(()=>new Set(BL(d,Fe)),[d,Fe]),Xn=(xe,$e)=>{if(!Fr)return!1;const{minRow:it,maxRow:Ft}=Fr;return xe>=it&&xe<=Ft&&At.has($e)},_e=(xe,$e,it)=>`max(${xe}px, calc((100cqw - ${u4}px - ${$e}px) / ${it}))`,Vt=xe=>{const $e=k[xe];return $e!==void 0?{width:$e}:{width:_e(I==="compact"?o$e:Db,Wn,Me)}};h.useLayoutEffect(()=>{if(!E||un===void 0){P(null);return}const xe=me.current,$e=Oe.current;if(!xe||!$e)return;const it=()=>{const On=xe.getBoundingClientRect(),Yn=$e.getBoundingClientRect();P(Math.max(0,Yn.right-On.left-xe.clientLeft))};if(it(),typeof ResizeObserver>"u")return window.addEventListener("resize",it),()=>window.removeEventListener("resize",it);const Ft=new ResizeObserver(it);return Ft.observe(xe),Ft.observe($e),()=>Ft.disconnect()},[k,I,E,un,Fe]);const Dt=(xe,$e)=>{xe.preventDefault(),xe.stopPropagation();const it=xe.currentTarget.closest("th"),Ft=it==null?void 0:it.getBoundingClientRect().width;M({columnIndex:$e,startX:xe.clientX,startWidth:k[$e]??(Ft?Math.round(Ft):Db)})},Kn=(xe,$e)=>{if(xe.ctrlKey||xe.metaKey||xe.altKey||xe.shiftKey)return;let it=0;if(xe.key==="ArrowRight"?it=ZU:xe.key==="ArrowLeft"&&(it=-ZU),it===0)return;xe.preventDefault(),xe.stopPropagation();const Ft=xe.currentTarget.closest("th"),On=Ft==null?void 0:Ft.getBoundingClientRect().width;S(Yn=>{const Is=Yn[$e]??(On?Math.round(On):Db),Wr=eW(Is+it);return tW(Yn,$e,Wr)})},Vn=(xe,$e)=>{xe.stopPropagation(),j($e),Ze.current=$e,xe.dataTransfer.effectAllowed="move",xe.dataTransfer.setData(Qae,String($e))},ds=()=>{Ze.current=null},hs=xe=>{Ze.current===null||!rW(xe.dataTransfer)||(xe.preventDefault(),xe.dataTransfer.dropEffect="move")},vs=(xe,$e)=>{const it=Ze.current;ds(),!(it===null||!rW(xe.dataTransfer))&&(xe.preventDefault(),xe.stopPropagation(),f(null),j(it),_(Ft=>w$e(Ft,it,$e)))},Mr=(xe,$e)=>{m!==null&&p(null),j(null),oe.current=!0,f({anchorRow:xe,anchorCol:$e,focusRow:xe,focusCol:$e})},ji=(xe,$e,it)=>{var Ft;xe.button!==0||ZA(xe.target)||(xe.preventDefault(),(Ft=We.current)==null||Ft.focus({preventScroll:!0}),Mr($e,it))},os=(xe,$e)=>{oe.current&&(te(!0),Ee.current={rowIndex:xe,columnIndex:$e},!tt.current&&(tt.current=requestAnimationFrame(()=>{tt.current=0;const it=Ee.current;Ee.current=null,it&&f(Ft=>Ft&&{...Ft,focusRow:it.rowIndex,focusCol:it.columnIndex})})))},zt=xe=>{var Yn;const $e=document.elementFromPoint(xe.clientX,xe.clientY),it=$e==null?void 0:$e.closest("[data-row-index][data-column-index]");if(!it||!((Yn=me.current)!=null&&Yn.contains(it)))return null;const Ft=Number(it.dataset.rowIndex),On=Number(it.dataset.columnIndex);return!Number.isInteger(Ft)||!Number.isInteger(On)?null:{rowIndex:Ft,columnIndex:On}},Ni=(xe,$e,it)=>{xe.touches.length!==1||ZA(xe.target)||Mr($e,it)},Ur=xe=>{if(!oe.current||xe.touches.length!==1)return;const $e=xe.touches[0];if(!$e)return;const it=zt($e);it&&(xe.preventDefault(),os(it.rowIndex,it.columnIndex))},vo=()=>{const xe=nW(d,le,Fe);if(!xe||!navigator.clipboard)return;const $e=ye.current;navigator.clipboard.writeText(xe).then(()=>{ae.current&&ye.current===$e&&(pe.current&&clearTimeout(pe.current),ie(!0),pe.current=setTimeout(()=>ie(!1),2e3))}).catch(it=>console.warn("[web-shell] clipboard write failed:",it))},wo=()=>{const xe=y$e(e.headers,le,Fe);if(!xe||!navigator.clipboard)return;const $e=X.current;navigator.clipboard.writeText(xe).then(()=>{ae.current&&X.current===$e&&(we.current&&clearTimeout(we.current),K(!0),we.current=setTimeout(()=>K(!1),2e3))}).catch(it=>console.warn("[web-shell] clipboard write failed:",it))},Ps=xe=>{if(d$e())return;const $e=nW(d,le,Fe);$e&&(xe.preventDefault(),xe.clipboardData.setData("text/plain",$e))},Gt=h.useMemo(()=>v$e(d,le,Fe),[Fe,d,le]),_r=(Gt==null?void 0:Gt.selectedCount)??0,Er=Object.values(c).filter(qx).length,Do=h.useMemo(()=>le.some(xe=>Fe.some($e=>{const it=xe.cells[$e];return it?ej(nj(it)):!1})),[Fe,le]),fs=le.length===e.rows.length?r("markdownTable.rows",{count:e.rows.length}):r("markdownTable.rowsFiltered",{visible:le.length,total:e.rows.length}),di=(xe,$e)=>{const it=nj(xe),Ft=ej(it);return a.jsx("div",{className:`${hn.cellContent} ${Ft&&!$e?hn.cellContentCollapsed:""}`,title:Ft&&!$e?it:void 0,children:a.jsx("div",{className:hn.cellText,children:xe.content})})},ws=(xe,$e)=>{const it=xe.text.length===0,Ft=nj(xe),On=ej(Ft);return a.jsx("div",{className:`${hn.detailValueContent} ${On&&!$e?hn.detailValueCollapsed:""} ${it?hn.emptyValue:""}`,title:On&&!$e?Ft:void 0,children:a.jsx("div",{className:hn.detailValueText,children:it?r("markdownTable.emptyValue"):xe.content})})};return a.jsxs("div",{ref:me,className:`${hn.tableShell} ${f$e(I)} ${E?hn.hasFrozenColumn:""} ${F?hn.dragging:""}`,children:[a.jsx(Cd,{delayDuration:300,children:a.jsxs("div",{className:hn.toolbar,children:[a.jsx("span",{className:hn.summary,children:fs}),Er>0&&a.jsx("span",{className:hn.selection,children:r("markdownTable.filtersActive",{count:Er})}),_r>0&&Gt&&a.jsxs("div",{className:hn.selectionStats,children:[a.jsxs("span",{className:hn.selectionMetric,children:[r("markdownTable.selection.selected")," ",a.jsx("strong",{className:hn.selectionMetricValue,children:Gt.selectedCount})]}),a.jsxs("span",{className:hn.selectionMetric,children:[r("markdownTable.selection.nonEmpty")," ",a.jsx("strong",{className:hn.selectionMetricValue,children:Gt.nonEmptyCount})]}),a.jsxs("span",{className:hn.selectionMetric,children:[r("markdownTable.selection.numeric")," ",a.jsx("strong",{className:hn.selectionMetricValue,children:Gt.numericCount})]}),a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx(Zt,{variant:"outline",size:"xs",className:hn.selectionCopyButton,type:"button",onClick:vo,"aria-label":r("markdownTable.copyTsv"),children:r(ce?"code.copied":"markdownTable.copyTsv")})}),a.jsx(Uu,{side:"top",children:r("markdownTable.copyTsvHint")})]}),Gt.numericCount>0&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:`${hn.selectionMetric} ${hn.selectionMetricSecondary}`,children:[r("markdownTable.selection.sum")," ",a.jsx("strong",{className:hn.selectionMetricValue,children:O2(Gt.sum,Gt,n)})]}),a.jsxs("span",{className:`${hn.selectionMetric} ${hn.selectionMetricSecondary}`,children:[r("markdownTable.selection.average")," ",a.jsx("strong",{className:hn.selectionMetricValue,children:O2(Gt.average,Gt,n)})]}),a.jsxs("span",{className:`${hn.selectionMetric} ${hn.selectionMetricSecondary}`,children:[r("markdownTable.selection.min")," ",a.jsx("strong",{className:hn.selectionMetricValue,children:O2(Gt.min,Gt,n)})]}),a.jsxs("span",{className:`${hn.selectionMetric} ${hn.selectionMetricSecondary}`,children:[r("markdownTable.selection.max")," ",a.jsx("strong",{className:hn.selectionMetricValue,children:O2(Gt.max,Gt,n)})]})]})]}),a.jsx("span",{className:hn.toolbarSpacer}),a.jsxs(Sl,{value:I,onValueChange:xe=>Y(xe),children:[a.jsx(Tl,{size:"sm",className:hn.densityTrigger,"aria-label":r("markdownTable.densityLabel"),children:a.jsx(Cl,{children:r("markdownTable.densityCurrent",{density:r(`markdownTable.density.${I}`)})})}),a.jsx(El,{className:hn.densityMenu,children:c$e.map(xe=>a.jsx(Ti,{value:xe,"data-value":xe,children:r(`markdownTable.density.${xe}`)},xe))})]}),a.jsx(D$e,{headers:e.headers,columnOrder:T,hiddenColumns:w,detailColumns:v,onToggleTableColumn:qn,onToggleAllTableColumns:ft,onToggleDetailColumn:He,onToggleAllDetailColumns:Ye,onReset:Yt,onDragStart:Vn,onDragEnd:ds,onDragOver:hs,onDrop:vs}),Do&&a.jsx(Zt,{variant:"ghost",size:"sm",className:hn.toolbarControl,type:"button",onClick:()=>G(xe=>!xe),children:r(z?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsxs("button",{className:hn.iconButton,type:"button",onClick:wo,"aria-label":r("markdownTable.copyVisible"),children:[W?a.jsxs(a.Fragment,{children:[a.jsx(kh,{"aria-hidden":"true"}),a.jsx("span",{className:"sr-only",children:"✓"})]}):a.jsx(J9,{"aria-hidden":"true"}),a.jsx("span",{className:"sr-only",children:r(W?"code.copied":"markdownTable.copyVisible")})]})}),a.jsx(Uu,{side:"top",children:r(W?"code.copied":"markdownTable.copyVisible")})]}),t]})}),a.jsxs("div",{ref:We,className:hn.scroller,tabIndex:0,onCopy:Ps,children:[a.jsxs("table",{className:hn.table,children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:hn.actionColumn,style:u$e}),Fe.map(xe=>a.jsx("col",{style:Vt(xe)},`column-${xe}`)),yt&&a.jsx("col",{className:hn.fillerColumn})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:`${hn.headerCell} ${hn.actionHeaderCell} ${E?hn.stickyActionHeaderCell:""}`,children:a.jsx("span",{className:"sr-only",children:r("markdownTable.actions")})}),Fe.map(xe=>{const $e=e.headers[xe];if(!$e)return null;const it=(o==null?void 0:o.columnIndex)===xe,Ft=qx(c[xe]),On=(m==null?void 0:m.columnIndex)===xe,Yn=$e.text||r("markdownTable.column",{index:xe+1}),Is=it?r(o.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:Yn}):r("markdownTable.sortByColumn",{column:Yn}),Wr=it?o.direction==="asc"?"ascending":"descending":"none",cr=`${i}-filter-${xe}`,Gs=$e.textAlign?{textAlign:$e.textAlign}:void 0,Qr=un===xe,vr=C===xe;return a.jsxs("th",{ref:Qr?Oe:void 0,className:`${hn.headerCell} ${Qr?hn.frozenHeaderCell:""} ${vr?hn.activeHeaderCell:""}`,"aria-sort":Wr,onContextMenu:xr=>Tn(xr,xe),style:Gs,title:Yn,children:[a.jsxs("div",{className:hn.headerControls,children:[a.jsx("span",{className:hn.headerText,style:Gs,children:$e.content}),a.jsxs(Kf,{open:On,onOpenChange:xr=>rn(xe,xr),children:[a.jsx(Wp,{asChild:!0,children:a.jsx("button",{className:`${hn.filterTrigger} ${Ft?hn.filterTriggerActive:""}`,type:"button","aria-label":r("markdownTable.filterColumn",{column:Yn}),"aria-controls":On?cr:void 0,children:a.jsx(bke,{"aria-hidden":"true"})})}),On&&a.jsx(M$e,{id:cr,columnName:Yn,columnIndex:xe,filter:c[xe],isNumeric:dt[xe]??!1,options:Le,onApply:et,onClose:gt},xe)]}),a.jsx("button",{className:`${hn.sortTrigger} ${it?hn.sortTriggerActive:""}`,type:"button",onClick:()=>bt(xe),"aria-label":Is,children:it?o.direction==="asc"?a.jsx(cxe,{"aria-hidden":"true"}):a.jsx(sxe,{"aria-hidden":"true"}):a.jsx(nxe,{"aria-hidden":"true"})})]}),a.jsx("button",{className:hn.resizeHandle,type:"button",onMouseDown:xr=>Dt(xr,xe),onKeyDown:xr=>Kn(xr,xe),role:"separator","aria-label":r("markdownTable.resizeColumn",{column:Yn}),"aria-orientation":"vertical","aria-valuemin":Yae,"aria-valuemax":Xae,"aria-valuenow":k[xe]??Db})]},$e.key)}),yt&&a.jsx("th",{className:hn.fillerHeaderCell,"aria-hidden":"true"})]})}),a.jsx("tbody",{children:le.map((xe,$e)=>{const it=R===xe.key,Ft=`${i}-detail-${xe.key}`;return a.jsxs(h.Fragment,{children:[a.jsxs("tr",{children:[a.jsx("td",{className:`${hn.cell} ${hn.actionCell} ${E?hn.stickyActionCell:""}`,children:a.jsx("button",{className:hn.rowDetailButton,type:"button",onClick:On=>zr(xe.key,On.currentTarget.closest("tr")),"aria-expanded":it,"aria-controls":Ft,"aria-label":r(it?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:$e+1}),children:it?a.jsx(Wke,{"aria-hidden":"true"}):a.jsx(Wf,{"aria-hidden":"true"})})}),Fe.map(On=>{const Yn=xe.cells[On];if(!Yn)return null;const Is=Yn.textAlign?{textAlign:Yn.textAlign}:void 0,Wr=un===On;return a.jsx("td",{className:`${hn.cell} ${Xn($e,On)?hn.selectedCell:""} ${Wr?hn.frozenCell:""}`,style:Is,"data-row-index":$e,"data-column-index":On,onMouseDown:cr=>ji(cr,$e,On),onMouseEnter:()=>os($e,On),onTouchStart:cr=>Ni(cr,$e,On),onTouchMove:Ur,onTouchEnd:ve,onTouchCancel:ve,onDoubleClick:cr=>{ZA(cr.target)||Ns(xe.key,On)},children:di(Yn,z)},Yn.key)}),yt&&a.jsx("td",{className:hn.fillerCell,"aria-hidden":"true"})]}),it&&a.jsx("tr",{id:Ft,className:hn.detailRow,children:a.jsx("td",{className:hn.detailCell,colSpan:Fe.length+1+(yt?1:0),children:a.jsxs("div",{className:hn.detailPanel,children:[a.jsx("span",{className:"sr-only",children:r("markdownTable.detailsHeader")}),Ge.map(On=>{const Yn=e.headers[On],Is=xe.cells[On];return!Yn||!Is?null:a.jsxs("div",{className:hn.detailItem,children:[a.jsx("div",{className:hn.detailLabel,title:Yn.text,children:Yn.content}),a.jsx("div",{className:hn.detailValue,children:ws(Is,z)})]},`${xe.key}-detail-${On}`)}),Ge.length===0&&a.jsx("div",{className:hn.emptyValue,children:r("markdownTable.customColumns.noDetails")})]})})})]},xe.key)})})]}),le.length===0&&a.jsx("div",{className:hn.emptyState,children:e.rows.length===0?r("markdownTable.empty"):r("markdownTable.emptyFiltered")})]}),E&&U!==null&&a.jsx("div",{className:hn.frozenColumnShadow,style:{left:U},"aria-hidden":"true"}),g&&Fe.length>0&&a.jsx("div",{ref:$t,className:hn.columnContextMenu,style:{left:g.left,top:g.top},role:"menu",children:a.jsx("button",{className:hn.columnContextMenuAction,type:"button",role:"menuitem",onClick:Cn,children:r(E?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),a.jsx(zp,{open:B!==null&&cn!==null,onOpenChange:xe=>{xe||kr()},children:cn&&a.jsxs(Fp,{ref:St,className:"sm:max-w-lg",showCloseButton:!1,overlayProps:{onMouseDown:kr},onOpenAutoFocus:xe=>{var $e;xe.preventDefault(),($e=St.current)==null||$e.focus()},tabIndex:-1,children:[a.jsx(YI,{asChild:!0,children:a.jsxs(Zt,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm","aria-label":r("markdownTable.close"),children:[a.jsx(cv,{className:"size-3.5",strokeWidth:1.5}),a.jsx("span",{className:"sr-only",children:r("markdownTable.close")})]})}),a.jsx(qp,{children:a.jsx(Up,{children:r("markdownTable.cellDialogTitle")})}),a.jsx("div",{className:"max-h-[200px] min-h-[100px] cursor-text overflow-auto rounded-lg border bg-background/70 p-3 leading-relaxed font-semibold whitespace-pre-wrap break-words select-text",children:cn.content}),a.jsxs(Hp,{children:[a.jsx(Zt,{variant:"outline",onClick:si,children:r(Z?"code.copied":"markdownTable.copyCell")}),a.jsx(YI,{asChild:!0,children:a.jsx(Zt,{children:r("markdownTable.close")})})]})]})})]})}var ele={exports:{}};/* @license
Papa Parse
v5.5.4
https://github.com/mholt/PapaParse
License: MIT
*/(function(e,t){((n,r)=>{e.exports=r()})(tk,function n(){var r=typeof self<"u"?self:typeof window<"u"?window:r!==void 0?r:{},s,i=!r.document&&!!r.postMessage,o=r.IS_PAPA_WORKER||!1,l={},c=0,u={};function d(j){return j.charCodeAt(0)===65279?j.slice(1):j}function f(j){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(E){var L=T(E);L.chunkSize=parseInt(L.chunkSize),E.step||E.chunk||(L.chunkSize=null),this._handle=new w(L),(this._handle.streamer=this)._config=L}).call(this,j),this.parseChunk=function(E,L){var D=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<D){let R=this._config.newline;R||(M=this._config.quoteChar||'"',R=this._handle.guessLineEndings(E,M)),E=[...E.split(R).slice(D)].join(R)}this.isFirstChunk&&C(this._config.beforeFirstChunk)&&(M=this._config.beforeFirstChunk(E))!==void 0&&(E=M),this.isFirstChunk=!1,this._halted=!1;var D=this._partialLine+E,M=(this._partialLine="",this._handle.parse(D,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(E=M.meta.cursor,D=(this._finished||(this._partialLine=D.substring(E-this._baseIndex),this._baseIndex=E),M&&M.data&&(this._rowCount+=M.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)r.postMessage({results:M,workerId:u.WORKER_ID,finished:D});else if(C(this._config.chunk)&&!L){if(this._config.chunk(M,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=M=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(M.data),this._completeResults.errors=this._completeResults.errors.concat(M.errors),this._completeResults.meta=M.meta),this._completed||!D||!C(this._config.complete)||M&&M.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),D||M&&M.meta.paused||this._nextChunk(),M}this._halted=!0},this._sendError=function(E){C(this._config.error)?this._config.error(E):o&&this._config.error&&r.postMessage({workerId:u.WORKER_ID,error:E,finished:!1})}}function m(j){var E;(j=j||{}).chunkSize||(j.chunkSize=u.RemoteChunkSize),f.call(this,j),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(L){this._input=L,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(E=new XMLHttpRequest,this._config.withCredentials&&(E.withCredentials=this._config.withCredentials),i||(E.onload=_(this._chunkLoaded,this),E.onerror=_(this._chunkError,this)),E.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var L,D=this._config.downloadRequestHeaders;for(L in D)E.setRequestHeader(L,D[L])}var M;this._config.chunkSize&&(M=this._start+this._config.chunkSize-1,E.setRequestHeader("Range","bytes="+this._start+"-"+M));try{E.send(this._config.downloadRequestBody)}catch(R){this._chunkError(R.message)}i&&E.status===0&&this._chunkError()}},this._chunkLoaded=function(){E.readyState===4&&(E.status<200||400<=E.status?this._chunkError():(this._start+=this._config.chunkSize||E.responseText.length,this._finished=!this._config.chunkSize||this._start>=(L=>(L=L.getResponseHeader("Content-Range"))!==null?parseInt(L.substring(L.lastIndexOf("/")+1)):-1)(E),this.parseChunk(E.responseText)))},this._chunkError=function(L){L=E.statusText||L,this._sendError(new Error(L))}}function p(j){(j=j||{}).chunkSize||(j.chunkSize=u.LocalChunkSize),f.call(this,j);var E,L,D=typeof FileReader<"u";this.stream=function(M){this._input=M,L=M.slice||M.webkitSlice||M.mozSlice,D?((E=new FileReader).onload=_(this._chunkLoaded,this),E.onerror=_(this._chunkError,this)):E=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var M=this._input,R=(this._config.chunkSize&&(R=Math.min(this._start+this._config.chunkSize,this._input.size),M=L.call(M,this._start,R)),E.readAsText(M,this._config.encoding));D||this._chunkLoaded({target:{result:R}})},this._chunkLoaded=function(M){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(M.target.result)},this._chunkError=function(){this._sendError(E.error)}}function g(j){var E;f.call(this,j=j||{}),this.stream=function(L){return E=L,this._nextChunk()},this._nextChunk=function(){var L,D;if(!this._finished)return L=this._config.chunkSize,E=L?(D=E.substring(0,L),E.substring(L)):(D=E,""),this._finished=!E,this.parseChunk(D)}}function b(j){f.call(this,j=j||{});var E=[],L=!0,D=!1;this.pause=function(){f.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){f.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(M){this._input=M,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){D&&E.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),E.length?this.parseChunk(E.shift()):L=!0},this._streamData=_(function(M){try{E.push(typeof M=="string"?M:M.toString(this._config.encoding)),L&&(L=!1,this._checkIsFinished(),this.parseChunk(E.shift()))}catch(R){this._streamError(R)}},this),this._streamError=_(function(M){this._streamCleanUp(),this._sendError(M)},this),this._streamEnd=_(function(){this._streamCleanUp(),D=!0,this._streamData("")},this),this._streamCleanUp=_(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function w(j){var E,L,D,M,R=Math.pow(2,53),$=-R,B=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,N=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,z=this,G=0,I=0,Y=!1,U=!1,P=[],F={data:[],errors:[],meta:{}};function te(ie){return j.skipEmptyLines==="greedy"?ie.join("").trim()==="":ie.length===1&&ie[0].length===0}function W(){if(F&&D&&(ce("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),D=!1),j.skipEmptyLines&&(F.data=F.data.filter(function(oe){return!te(oe)})),K()){let oe=function(we,pe){we=d(we),C(j.transformHeader)&&(we=j.transformHeader(we,pe)),P.push(we)};if(F)if(Array.isArray(F.data[0])){for(var ie=0;K()&&ie<F.data.length;ie++)F.data[ie].forEach(oe);F.data.splice(0,1)}else F.data.forEach(oe)}function Z(oe,we){for(var pe=j.header?{}:[],he=0;he<oe.length;he++){var X=he,ye=oe[he],ye=((Ce,ae)=>(me=>(j.dynamicTypingFunction&&j.dynamicTyping[me]===void 0&&(j.dynamicTyping[me]=j.dynamicTypingFunction(me)),(j.dynamicTyping[me]||j.dynamicTyping)===!0))(Ce)?ae==="true"||ae==="TRUE"||ae!=="false"&&ae!=="FALSE"&&((me=>{if(B.test(me)&&(me=parseFloat(me),$<me&&me<R))return 1})(ae)?parseFloat(ae):N.test(ae)?new Date(ae):ae===""?null:ae):ae)(X=j.header?he>=P.length?"__parsed_extra":P[he]:X,ye=j.transform?j.transform(ye,X):ye);X==="__parsed_extra"?(pe[X]=pe[X]||[],pe[X].push(ye)):pe[X]=ye}return j.header&&(he>P.length?ce("FieldMismatch","TooManyFields","Too many fields: expected "+P.length+" fields but parsed "+he,I+we):he<P.length&&ce("FieldMismatch","TooFewFields","Too few fields: expected "+P.length+" fields but parsed "+he,I+we)),pe}var ee;F&&(j.header||j.dynamicTyping||j.transform)&&(ee=1,!F.data.length||Array.isArray(F.data[0])?(F.data=F.data.map(Z),ee=F.data.length):F.data=Z(F.data,0),j.header&&F.meta&&(F.meta.fields=P),I+=ee)}function K(){return j.header&&P.length===0}function ce(ie,Z,ee,oe){ie={type:ie,code:Z,message:ee},oe!==void 0&&(ie.row=oe),F.errors.push(ie)}C(j.step)&&(M=j.step,j.step=function(ie){F=ie,K()?W():(W(),F.data.length!==0&&(G+=ie.data.length,j.preview&&G>j.preview?L.abort():(F.data=F.data[0],M(F,z))))}),this.parse=function(ie,Z,ee){var oe=j.quoteChar||'"',oe=(j.newline||(j.newline=this.guessLineEndings(ie,oe)),D=!1,j.delimiter?C(j.delimiter)&&(j.delimiter=j.delimiter(ie),F.meta.delimiter=j.delimiter):((oe=((we,pe,he,X,ye)=>{var Ce,ae,me,We;ye=ye||[",","	","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var Oe=0;Oe<ye.length;Oe++){for(var Mt,$t=ye[Oe],St=0,ue=0,Ee=0,tt=(me=void 0,new v({comments:X,delimiter:$t,newline:pe,preview:10}).parse(we)),ut=0;ut<tt.data.length;ut++)he&&te(tt.data[ut])?Ee++:(Mt=tt.data[ut].length,ue+=Mt,me===void 0?me=Mt:0<Mt&&(St+=Math.abs(Mt-me),me=Mt));0<tt.data.length&&(ue/=tt.data.length-Ee),(ae===void 0||St<=ae)&&(We===void 0||We<ue)&&1.99<ue&&(ae=St,Ce=$t,We=ue)}return{successful:!!(j.delimiter=Ce),bestDelimiter:Ce}})(ie,j.newline,j.skipEmptyLines,j.comments,j.delimitersToGuess)).successful?j.delimiter=oe.bestDelimiter:(D=!0,j.delimiter=u.DefaultDelimiter),F.meta.delimiter=j.delimiter),T(j));return j.preview&&j.header&&oe.preview++,E=ie,L=new v(oe),F=L.parse(E,Z,ee),W(),Y?{meta:{paused:!0}}:F||{meta:{paused:!1}}},this.paused=function(){return Y},this.pause=function(){Y=!0,L.abort(),E=C(j.chunk)?"":E.substring(L.getCharIndex())},this.resume=function(){z.streamer._halted?(Y=!1,z.streamer.parseChunk(E,!0)):setTimeout(z.resume,3)},this.aborted=function(){return U},this.abort=function(){U=!0,L.abort(),F.meta.aborted=!0,C(j.complete)&&j.complete(F),E=""},this.guessLineEndings=function(we,oe){we=we.substring(0,1048576);var oe=new RegExp(y(oe)+"([^]*?)"+y(oe),"gm"),ee=(we=we.replace(oe,"")).split("\r"),oe=we.split(`
`),we=1<oe.length&&oe[0].length<ee[0].length;if(ee.length===1||we)return`
`;for(var pe=0,he=0;he<ee.length;he++)ee[he][0]===`
`&&pe++;return pe>=ee.length/2?`\r
`:"\r"}}function y(j){return j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function v(j){var E=(j=j||{}).delimiter,L=j.newline,D=j.comments,M=j.step,R=j.preview,$=j.fastMode,B=null,N=!1,z=j.quoteChar==null?'"':j.quoteChar,G=z;if(j.escapeChar!==void 0&&(G=j.escapeChar),(typeof E!="string"||-1<u.BAD_DELIMITERS.indexOf(E))&&(E=","),D===E)throw new Error("Comment character same as delimiter");D===!0?D="#":(typeof D!="string"||-1<u.BAD_DELIMITERS.indexOf(D))&&(D=!1),L!==`
`&&L!=="\r"&&L!==`\r
`&&(L=`
`);var I=0,Y=!1;this.parse=function(U,P,F){if(typeof U!="string")throw new Error("Input must be a string");var te=U.length,W=E.length,K=L.length,ce=D.length,ie=C(M),Z=[],ee=[],oe=[],we=I=0;if(!U)return St();if($||$!==!1&&U.indexOf(z)===-1){for(var pe=U.split(L),he=0;he<pe.length;he++){if(oe=pe[he],I+=oe.length,he!==pe.length-1)I+=L.length;else if(F)return St();if(!D||oe.substring(0,ce)!==D){if(ie){if(Z=[],We(oe.split(E)),ue(),Y)return St()}else We(oe.split(E));if(R&&R<=he)return Z=Z.slice(0,R),St(!0)}}return St()}for(var X=U.indexOf(E,I),ye=U.indexOf(L,I),Ce=new RegExp(y(G)+y(z),"g"),ae=U.indexOf(z,I);;)if(U[I]===z)for(ae=I,I++;;){if((ae=U.indexOf(z,ae+1))===-1)return F||ee.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Z.length,index:I}),Mt();if(ae===te-1)return Mt(U.substring(I,ae).replace(Ce,z));if(z===G&&U[ae+1]===G)ae++;else if(z===G||ae===0||U[ae-1]!==G){X!==-1&&X<ae+1&&(X=U.indexOf(E,ae+1));var me=Oe((ye=ye!==-1&&ye<ae+1?U.indexOf(L,ae+1):ye)===-1?X:Math.min(X,ye));if(U.substr(ae+1+me,W)===E){oe.push(U.substring(I,ae).replace(Ce,z)),U[I=ae+1+me+W]!==z&&(ae=U.indexOf(z,I)),X=U.indexOf(E,I),ye=U.indexOf(L,I);break}if(me=Oe(ye),U.substring(ae+1+me,ae+1+me+K)===L){if(oe.push(U.substring(I,ae).replace(Ce,z)),$t(ae+1+me+K),X=U.indexOf(E,I),ae=U.indexOf(z,I),ie&&(ue(),Y))return St();if(R&&Z.length>=R)return St(!0);break}ee.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Z.length,index:I}),ae++}}else if(D&&oe.length===0&&U.substring(I,I+ce)===D){if(ye===-1)return St();I=ye+K,ye=U.indexOf(L,I),X=U.indexOf(E,I)}else if(X!==-1&&(X<ye||ye===-1))oe.push(U.substring(I,X)),I=X+W,X=U.indexOf(E,I);else{if(ye===-1)break;if(oe.push(U.substring(I,ye)),$t(ye+K),ie&&(ue(),Y))return St();if(R&&Z.length>=R)return St(!0)}return Mt();function We(Ee){Z.push(Ee),we=I}function Oe(Ee){var tt=0;return tt=Ee!==-1&&(Ee=U.substring(ae+1,Ee))&&Ee.trim()===""?Ee.length:tt}function Mt(Ee){return F||(Ee===void 0&&(Ee=U.substring(I)),oe.push(Ee),I=te,We(oe),ie&&ue()),St()}function $t(Ee){I=Ee,We(oe),oe=[],ye=U.indexOf(L,I)}function St(Ee){if(j.header&&!P&&Z.length&&!N){var tt=Z[0],ut=Object.create(null),Ct=new Set(tt);let Ze=!1;for(let Et=0;Et<tt.length;Et++){let Nt=d(tt[Et]);if(ut[Nt=C(j.transformHeader)?j.transformHeader(Nt,Et):Nt]){let gt,Je=ut[Nt];for(;gt=Nt+"_"+Je,Je++,Ct.has(gt););Ct.add(gt),tt[Et]=gt,ut[Nt]++,Ze=!0,(B=B===null?{}:B)[gt]=Nt}else ut[Nt]=1,tt[Et]=Nt;Ct.add(Nt)}Ze&&console.warn("Duplicate headers found and renamed."),N=!0}return{data:Z,errors:ee,meta:{delimiter:E,linebreak:L,aborted:Y,truncated:!!Ee,cursor:we+(P||0),renamedHeaders:B}}}function ue(){M(St()),Z=[],ee=[]}},this.abort=function(){Y=!0},this.getCharIndex=function(){return I}}function x(j){var E=j.data,L=l[E.workerId],D=!1;if(E.error)L.userError(E.error,E.file);else if(E.results&&E.results.data){var M={abort:function(){D=!0,k(E.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:S,resume:S};if(C(L.userStep)){for(var R=0;R<E.results.data.length&&(L.userStep({data:E.results.data[R],errors:E.results.errors,meta:E.results.meta},M),!D);R++);delete E.results}else C(L.userChunk)&&(L.userChunk(E.results,M,E.file),delete E.results)}E.finished&&!D&&k(E.workerId,E.results)}function k(j,E){var L=l[j];C(L.userComplete)&&L.userComplete(E),L.terminate(),delete l[j]}function S(){throw new Error("Not implemented.")}function T(j){if(typeof j!="object"||j===null)return j;var E,L=Array.isArray(j)?[]:{};for(E in j)L[E]=T(j[E]);return L}function _(j,E){return function(){j.apply(E,arguments)}}function C(j){return typeof j=="function"}return u.parse=function(j,E){var L=(E=E||{}).dynamicTyping||!1;if(C(L)&&(E.dynamicTypingFunction=L,L={}),E.dynamicTyping=L,E.transform=!!C(E.transform)&&E.transform,!E.worker||!u.WORKERS_SUPPORTED)return L=null,u.NODE_STREAM_INPUT,typeof j=="string"?(j=d(j),L=new(E.download?m:g)(E)):j.readable===!0&&C(j.read)&&C(j.on)?L=new b(E):(r.File&&j instanceof File||j instanceof Object)&&(L=new p(E)),L.stream(j);(L=(()=>{var D;return!!u.WORKERS_SUPPORTED&&(D=(()=>{var M=r.URL||r.webkitURL||null,R=n.toString();return u.BLOB_URL||(u.BLOB_URL=M.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",R,")();"],{type:"text/javascript"})))})(),(D=new r.Worker(D)).onmessage=x,D.id=c++,l[D.id]=D)})()).userStep=E.step,L.userChunk=E.chunk,L.userComplete=E.complete,L.userError=E.error,E.step=C(E.step),E.chunk=C(E.chunk),E.complete=C(E.complete),E.error=C(E.error),delete E.worker,L.postMessage({input:j,config:E,workerId:L.id})},u.unparse=function(j,E){var L=!1,D=!0,M=",",R=`\r
`,$='"',B=$+$,N=!1,z=null,G=!1,I=((()=>{if(typeof E=="object"){if(typeof E.delimiter!="string"||u.BAD_DELIMITERS.filter(function(P){return E.delimiter.indexOf(P)!==-1}).length||(M=E.delimiter),typeof E.quotes!="boolean"&&typeof E.quotes!="function"&&!Array.isArray(E.quotes)||(L=E.quotes),typeof E.skipEmptyLines!="boolean"&&typeof E.skipEmptyLines!="string"||(N=E.skipEmptyLines),typeof E.newline=="string"&&(R=E.newline),typeof E.quoteChar=="string"&&($=E.quoteChar,B=$+$),typeof E.header=="boolean"&&(D=E.header),Array.isArray(E.columns)){if(E.columns.length===0)throw new Error("Option columns is empty");z=E.columns}E.escapeChar!==void 0&&(B=E.escapeChar+$),E.escapeFormulae instanceof RegExp?G=E.escapeFormulae:typeof E.escapeFormulae=="boolean"&&E.escapeFormulae&&(G=/^[=+\-@\t\r].*$/)}})(),new RegExp(y($),"g"));if(typeof j=="string"&&(j=JSON.parse(j)),Array.isArray(j)){if(!j.length||Array.isArray(j[0]))return Y(null,j,N);if(typeof j[0]=="object")return Y(z||Object.keys(j[0]),j,N)}else if(typeof j=="object")return typeof j.data=="string"&&(j.data=JSON.parse(j.data)),Array.isArray(j.data)&&(j.fields||(j.fields=j.meta&&j.meta.fields||z),j.fields||(j.fields=Array.isArray(j.data[0])?j.fields:typeof j.data[0]=="object"?Object.keys(j.data[0]):[]),Array.isArray(j.data[0])||typeof j.data[0]=="object"||(j.data=[j.data])),Y(j.fields||[],j.data||[],N);throw new Error("Unable to serialize unrecognized input");function Y(P,F,te){var W="",K=(typeof P=="string"&&(P=JSON.parse(P)),typeof F=="string"&&(F=JSON.parse(F)),Array.isArray(P)&&0<P.length),ce=!Array.isArray(F[0]);if(K&&D){for(var ie=0;ie<P.length;ie++)0<ie&&(W+=M),W+=U(P[ie],ie);0<F.length&&(W+=R)}for(var Z=0;Z<F.length;Z++){var ee=(K?P:F[Z]).length,oe=!1,we=K?Object.keys(F[Z]).length===0:F[Z].length===0;if(te&&!K&&(oe=te==="greedy"?F[Z].join("").trim()==="":F[Z].length===1&&F[Z][0].length===0),te==="greedy"&&K){for(var pe=[],he=0;he<ee;he++){var X=ce?P[he]:he;pe.push(F[Z][X])}oe=pe.join("").trim()===""}if(!oe){for(var ye=0;ye<ee;ye++){0<ye&&!we&&(W+=M);var Ce=K&&ce?P[ye]:ye;W+=U(F[Z][Ce],ye)}Z<F.length-1&&(!te||0<ee&&!we)&&(W+=R)}}return W}function U(P,F){var te,W,K;return P==null?"":P.constructor===Date?JSON.stringify(P).slice(1,25):(K=!1,G&&typeof P=="string"&&G.test(P)&&(P="'"+P,K=!0),W=(te=P.toString()).replace(I,B),(K=K||L===!0||typeof L=="function"&&L(P,F)||Array.isArray(L)&&L[F]||((ce,ie)=>{for(var Z=0;Z<ie.length;Z++)if(-1<ce.indexOf(ie[Z]))return!0;return!1})(W,u.BAD_DELIMITERS)||-1<W.indexOf(M)||-1<te.indexOf($)||W.charAt(0)===" "||W.charAt(W.length-1)===" ")?$+W+$:W)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!i&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=v,u.ParserHandle=w,u.NetworkStreamer=m,u.FileStreamer=p,u.StringStreamer=g,u.ReadableStreamStreamer=b,r.jQuery&&((s=r.jQuery).fn.parse=function(j){var E=j.config||{},L=[];return this.each(function(R){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var $=0;$<this.files.length;$++)L.push({file:this.files[$],inputElem:this,instanceConfig:s.extend({},E)})}),D(),this;function D(){if(L.length===0)C(j.complete)&&j.complete();else{var R,$,B,N,z=L[0];if(C(j.before)){var G=j.before(z.file,z.inputElem);if(typeof G=="object"){if(G.action==="abort")return R="AbortError",$=z.file,B=z.inputElem,N=G.reason,void(C(j.error)&&j.error({name:R},$,B,N));if(G.action==="skip")return void M();typeof G.config=="object"&&(z.instanceConfig=s.extend(z.instanceConfig,G.config))}else if(G==="skip")return void M()}var I=z.instanceConfig.complete;z.instanceConfig.complete=function(Y){C(I)&&I(Y,z.file,z.inputElem),M()},u.parse(z.file,z.instanceConfig)}}function M(){L.splice(0,1),D()}}),o&&(r.onmessage=function(j){j=j.data,u.WORKER_ID===void 0&&j&&(u.WORKER_ID=j.workerId),typeof j.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(j.input,j.config),finished:!0}):(r.File&&j.input instanceof File||j.input instanceof Object)&&(j=u.parse(j.input,j.config))&&r.postMessage({workerId:u.WORKER_ID,results:j,finished:!0})}),(m.prototype=Object.create(f.prototype)).constructor=m,(p.prototype=Object.create(f.prototype)).constructor=p,(g.prototype=Object.create(g.prototype)).constructor=g,(b.prototype=Object.create(f.prototype)).constructor=b,u})})(ele);var P$e=ele.exports;const O$e=i_(P$e);var tle=/^echarts-chatbi_query_(\d+)-(\d+)$/,nle=/^echarts-chatbi_sandbox_filepath_(\S+)$/i;function $$e(e){return tle.test(e)}function rle(e){return nle.test(e)}function B$e(e){return $$e(e)||rle(e)}function z$e(e,t){const n=tle.exec(e);if(!n)throw new gn("SCHEMA_INVALID",`Invalid temporary EChart query language: ${e}`);const r=Number(n[2]);if(!Number.isSafeInteger(r))throw new gn("SCHEMA_INVALID","Temporary EChart query index is too large");return{language:e,jobId:`chatbi_query_${n[1]}`,index:r,source:t.trim()}}function F$e(e,t){const n=nle.exec(e),r=n==null?void 0:n[1];if(!r)throw new gn("SCHEMA_INVALID",`Invalid temporary EChart sandbox file language: ${e}`);return{language:e,filePath:r,source:t.trim()}}var iW=new Set(["__proto__","prototype","constructor"]);function q$e(e){return new TextEncoder().encode(e).byteLength}function J1(e,t){throw new gn("SCHEMA_INVALID",e,{cause:t})}function H$e(e,t){if(q$e(e)>t.maxArtifactContentBytes)throw new gn("LIMIT_EXCEEDED",`ArtifactContent exceeds the ${t.maxArtifactContentBytes} UTF-8 byte limit`);let n;const r=new Set,s=new Set;let i;try{n=O$e.parse(e,{dynamicTyping:!1,header:!0,preview:t.maxRows+1,skipEmptyLines:"greedy",transformHeader(f,m){if(s.has(m))return f;if(f.length===0?i="ArtifactContent CSV column names must not be empty":iW.has(f.toLowerCase())?i=`ArtifactContent CSV column ${f} is not allowed`:r.has(f)&&(i=`ArtifactContent CSV column ${f} is duplicated; column names must be unique`),i)throw new Error(i);return s.add(m),r.add(f),f}})}catch(f){return J1(i??"ArtifactContent is not valid CSV",f)}const o=n.errors.filter(f=>f.code!=="UndetectableDelimiter");if(o.length>0){const f=o[0];return J1(`ArtifactContent is not valid CSV: ${(f==null?void 0:f.message)??"parse error"}`)}const l=n.meta.fields??[];if(l.length===0)return J1("ArtifactContent CSV must have a header row");const c=new Set;for(const f of l){if(f.length===0)return J1("ArtifactContent CSV column names must not be empty");if(iW.has(f.toLowerCase()))return J1(`ArtifactContent CSV column ${f} is not allowed`);if(c.has(f))return J1(`ArtifactContent CSV column ${f} is duplicated`);c.add(f)}if(l.length>t.maxColumns)throw new gn("LIMIT_EXCEEDED",`ArtifactContent CSV exceeds the ${t.maxColumns} column limit`);if(n.data.length>t.maxRows)throw new gn("LIMIT_EXCEEDED",`ArtifactContent CSV exceeds the ${t.maxRows} row limit`);if(n.data.length*l.length>t.maxCells)throw new gn("LIMIT_EXCEEDED",`ArtifactContent CSV exceeds the ${t.maxCells} cell limit`);const d=n.data.map(f=>{const m={};for(const p of l)m[p]=f[p]??"";return m});return{kind:"inline",dimensions:l,source:d}}var U$e="//#end",W$e=[/^\s*(?:(?:const|let|var)\s+)?[\w$]*\s*=?\s*echarts\.init\([^;]*\);?\s*$/,/^\s*[\w$]+\.setOption\([^;]*\);?\s*$/];function V$e(e){return e.split(`
`).map(t=>t.split(U$e).join("")).filter(t=>!W$e.some(n=>n.test(t.trim()))).join(`
`).trim()}var JI="@datafe-open/markdown-chart/legacy-echart-query",G$e=["default-src 'none'","script-src 'unsafe-inline' 'unsafe-eval'","worker-src blob:","connect-src 'none'","img-src 'none'","style-src 'none'","font-src 'none'","object-src 'none'","media-src 'none'","frame-src 'none'","base-uri 'none'","form-action 'none'"].join("; "),K$e=`
(function () {
  'use strict';
  var handled = false;

  function disableGlobal(name) {
    try {
      Object.defineProperty(globalThis, name, {
        value: undefined,
        writable: false,
        configurable: false
      });
    } catch (_) {
      try { globalThis[name] = undefined; } catch (_) {}
    }
  }

  globalThis.onmessage = function (event) {
    if (handled) return;
    handled = true;
    var request = event.data;
    var port = event.ports && event.ports[0];
    if (!request || request.type !== 'execute' || typeof request.source !== 'string' || !port) {
      return;
    }

    var stringify = JSON.stringify.bind(JSON);
    var parse = JSON.parse.bind(JSON);
    var send;
    try {
      send = MessagePort.prototype.postMessage.bind(port);
      Object.defineProperty(globalThis, 'inputData', {
        value: request.inputData,
        writable: false,
        configurable: false
      });
      [
        'fetch',
        'XMLHttpRequest',
        'WebSocket',
        'WebSocketStream',
        'EventSource',
        'WebTransport',
        'importScripts',
        'Worker',
        'SharedWorker',
        'postMessage',
        'close'
      ].forEach(disableGlobal);
      try {
        if (globalThis.navigator) {
          Object.defineProperty(globalThis.navigator, 'sendBeacon', {
            value: undefined,
            writable: false,
            configurable: false
          });
        }
      } catch (_) {}

      var option = (0, eval)(request.source + '\\n;typeof option === "undefined" ? undefined : option;');
      var serialized = stringify(option);
      if (serialized === undefined) throw new Error('missing option');
      send({ type: 'result', option: parse(serialized) });
    } catch (_) {
      try {
        if (send) send({ type: 'error', code: 'EXECUTION_FAILED' });
      } catch (_) {}
    } finally {
      try { port.close(); } catch (_) {}
    }
  };
})();`;function oW(e){return JSON.stringify(e).replace(/</g,"\\u003c")}var Y$e=`
(function () {
  'use strict';
  var CHANNEL = ${oW(JI)};
  var WORKER_SCRIPT = ${oW(K$e)};
  var handled = false;
  var activeWorker;

  function fixedError(requestId) {
    parent.postMessage({
      channel: CHANNEL,
      type: 'error',
      requestId: requestId,
      code: 'EXECUTION_FAILED'
    }, '*');
  }

  window.addEventListener('message', function (event) {
    var request = event.data;
    if (
      handled
      || event.source !== parent
      || !request
      || request.channel !== CHANNEL
      || request.type !== 'execute'
      || typeof request.requestId !== 'string'
      || typeof request.source !== 'string'
    ) {
      return;
    }
    handled = true;

    var blobUrl;
    var port1;
    var done = false;
    function cleanup() {
      if (activeWorker) {
        activeWorker.terminate();
        activeWorker = undefined;
      }
      if (port1) {
        port1.onmessage = null;
        try { port1.close(); } catch (_) {}
      }
      if (blobUrl) {
        URL.revokeObjectURL(blobUrl);
        blobUrl = undefined;
      }
    }
    function settle(payload) {
      if (done) return;
      done = true;
      cleanup();
      parent.postMessage(payload, '*');
    }

    try {
      blobUrl = URL.createObjectURL(new Blob([WORKER_SCRIPT], { type: 'text/javascript' }));
      activeWorker = new Worker(blobUrl);
      URL.revokeObjectURL(blobUrl);
      blobUrl = undefined;
      var messageChannel = new MessageChannel();
      port1 = messageChannel.port1;
      port1.onmessage = function (workerEvent) {
        var response = workerEvent.data;
        if (response && response.type === 'result') {
          settle({
            channel: CHANNEL,
            type: 'result',
            requestId: request.requestId,
            option: response.option
          });
          return;
        }
        settle({
          channel: CHANNEL,
          type: 'error',
          requestId: request.requestId,
          code: 'EXECUTION_FAILED'
        });
      };
      activeWorker.onerror = function (workerError) {
        workerError.preventDefault();
        settle({
          channel: CHANNEL,
          type: 'error',
          requestId: request.requestId,
          code: 'EXECUTION_FAILED'
        });
      };
      activeWorker.postMessage({
        type: 'execute',
        source: request.source,
        inputData: request.inputData
      }, [messageChannel.port2]);
    } catch (_) {
      cleanup();
      fixedError(request.requestId);
    }
  });
})();`,X$e=`<!doctype html>
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${G$e}"></head>
<body><script>${Y$e}<\/script></body></html>`;function Q$e(){const e=globalThis.crypto;if(!(e!=null&&e.getRandomValues))throw new gn("LEGACY_SANDBOX_UNAVAILABLE","Secure random values are required by the temporary legacy sandbox");const t=new Uint32Array(4);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(8,"0")).join("")}function aW(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function J$e(e){if(e.signal.aborted)return Promise.reject(aW());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new gn("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new gn("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=Q$e(),n=document.createElement("iframe");return n.hidden=!0,n.setAttribute("aria-hidden","true"),n.setAttribute("title","Temporary chart sandbox"),n.setAttribute("sandbox","allow-scripts"),n.srcdoc=X$e,new Promise((r,s)=>{let i=!1,o=!1,l;const c=()=>{window.removeEventListener("message",m),e.signal.removeEventListener("abort",f),n.onload=null,n.onerror=null,l!==void 0&&clearTimeout(l),n.remove()},u=(p,g)=>{i||(i=!0,c(),p(g))},d=p=>{i||(i=!0,c(),s(p))},f=()=>d(aW()),m=p=>{if(!(p.source!==n.contentWindow||!js(p.data))&&!(p.data.channel!==JI||p.data.requestId!==t)){if(p.data.type==="error"){d(new gn("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(p.data.type==="result")try{const g=kte(p.data.option);if(!js(g))throw new gn("SCHEMA_INVALID","Temporary legacy chart source must produce a JSON object option");u(r,g)}catch(g){d(g)}}};window.addEventListener("message",m),e.signal.addEventListener("abort",f,{once:!0}),n.onerror=()=>d(new gn("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to load")),n.onload=()=>{var p;if(!o){if(o=!0,n.onload=null,i||e.signal.aborted){f();return}(p=n.contentWindow)==null||p.postMessage({channel:JI,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>d(new gn("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var sle=class extends Error{constructor(t,n,r){super(n,r&&"cause"in r?{cause:r.cause}:void 0);Ue(this,"code");Ue(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=r==null?void 0:r.cause}},Z$e=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function eBe(e,t){const n={...Z$e,...e,...t};for(const[r,s]of Object.entries(n))if(!Number.isSafeInteger(s)||s<=0)throw new gn("SCHEMA_INVALID",`legacyArtifactLimits.${r} must be a positive safe integer`);return n}async function ile(e){let t;try{t=await e.resolveContent()}catch(i){throw e.signal.aborted||e.preserveLegacySandboxError&&i instanceof sle?i:new gn("REF_RESOLUTION_FAILED",e.resolutionError,{cause:i})}if(typeof t!="string")throw new gn("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=H$e(t,e.limits),r=V$e(e.source);if(!r)throw new gn("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const s=await J$e({source:r,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:s}}async function tBe(e){return ile({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveArtifactContent({language:e.block.language,jobId:e.block.jobId,index:e.block.index,signal:e.signal}),resolutionError:"The temporary ChatBI ArtifactContent could not be resolved",returnTypeError:"resolveLegacyArtifactContent must return the raw CSV ArtifactContent string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}async function nBe(e){return ile({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveSandboxFileContent({language:e.block.language,filePath:e.block.filePath,signal:e.signal}),resolutionError:"The temporary ChatBI sandbox file could not be resolved",returnTypeError:"resolveLegacySandboxFileContent must return a raw CSV string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}var rBe=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),sBe=new Set(["angleAxis","aria","animation","animationDelay","animationDelayUpdate","animationDuration","animationDurationUpdate","animationEasing","animationEasingUpdate","animationThreshold","axisPointer","backgroundColor","blendMode","brush","calendar","color","darkMode","dataset","dataZoom","geo","grid","hoverLayerThreshold","legend","parallel","parallelAxis","polar","progressive","progressiveChunkMode","progressiveThreshold","radar","radiusAxis","series","singleAxis","stateAnimation","textStyle","title","tooltip","useUTC","visualMap","xAxis","yAxis"]),iBe=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),oBe=/(?:url|uri|href|src|link)$/i,aBe=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,lW=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,lBe=/\burl\s*\(/i,cBe=/<\s*\/?\s*[a-z][^>]*>/i,uBe=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,dBe=/^[A-Za-z_][A-Za-z0-9_]*$/;function zs(e){throw new gn("SCHEMA_INVALID",e)}function ZI(e,t,n){for(const r of Object.keys(e))t.has(r)||zs(`${n}.${r} is not allowed`)}function cW(e,t){if(!Array.isArray(e)||e.length===0)return zs(`${t} must be a non-empty array`);const n=e.map((r,s)=>typeof r!="string"||!dBe.test(r)?zs(`${t}[${s}] must be a stable ASCII identifier`):r);return new Set(n).size!==n.length?zs(`${t} must not contain duplicate dimensions`):n}function hBe(e,t){if(!js(e)||typeof e.kind!="string")return zs("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){ZI(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=cW(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return zs("echarts-fulldata.data.source must be an array");e.source.forEach((s,i)=>{Array.isArray(s)||zs(`echarts-fulldata.data.source[${i}] must be an array`),s.length!==n.length&&zs(`echarts-fulldata.data.source[${i}] must contain ${n.length} cells`)});const r=g6(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:r}}if(e.kind==="ref"){if(ZI(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return zs("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return zs("echarts-fulldata.data.format must be csv or json");const n=cW(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return zs(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function ole(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[r,s]of n.entries()){if(!js(s)||typeof s.text!="string")continue;const i=s.text.trim();if(i)return{index:r,isArray:t,title:s,text:i}}}function fBe(e){var t;return(t=ole(e))==null?void 0:t.text}function mBe(e,t){const n=ole(e);if(!(!n||n.text!==t.trim())){if(Object.prototype.hasOwnProperty.call(n.title,"subtext")){delete n.title.text;return}if(n.isArray){e.title.splice(n.index,1);return}delete e.title}}function Xf(e){return Array.isArray(e)?e.map(t=>Xf(t)):js(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Xf(n)])):e}function ale(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&zs(`${t} must be an array of non-empty strings`),[...e]}function g6(e,t,n){if(Array.isArray(e)||zs(`${n} must be an array`),e.length>t.maxRows)throw new gn("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxRows} row limit`);let r=0;const s=e.map((i,o)=>{if(Array.isArray(i)){const l=i.map((c,u)=>(c!==null&&!["string","number","boolean"].includes(typeof c)&&zs(`${n}[${o}][${u}] must be a JSON scalar`),c));return r+=l.length,l}if(js(i)){const l={};for(const[c,u]of Object.entries(i))u!==null&&!["string","number","boolean"].includes(typeof u)&&zs(`${n}[${o}].${c} must be a JSON scalar`),l[c]=u,r+=1;return l}return zs(`${n}[${o}] must be an array or object`)});if(r>t.maxCells)throw new gn("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return s}function pBe(e,t){if(!js(e)||typeof e.kind!="string")return zs("echarts.data must be an inline or ref dataset object");const n=ale(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const r=g6(e.source,t,"echarts.data.source");return n?{kind:"inline",dimensions:n,source:r}:{kind:"inline",source:r}}return e.kind==="ref"?typeof e.ref!="string"||e.ref.length===0?zs("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?zs("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:zs(`Unsupported echarts.data.kind: ${e.kind}`)}function uW(e,t){if(aBe.test(e))throw new gn("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),r=e.trim();if(lW.test(r)||lW.test(n.trim())||lBe.test(e)||cBe.test(e)||uBe.test(e))throw new gn("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function gBe(e,t){for(const s of Object.keys(e))if(!sBe.has(s))throw new gn("UNSAFE_SPEC",`echarts.option.${s} is not allowed`);let n=0;const r=(s,i,o)=>{if(n+=1,n>t.maxNodes)throw new gn("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(o>t.maxDepth)throw new gn("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof s=="string"){uW(s,i);return}if(Array.isArray(s)){s.forEach((l,c)=>r(l,`${i}[${c}]`,o+1));return}if(js(s))for(const[l,c]of Object.entries(s)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new gn("UNSAFE_SPEC",`${i}.${l} must be a string`);uW(c,`${i}.${l}`);continue}if(iBe.has(u)||oBe.test(l))throw new gn("UNSAFE_SPEC",`${i}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new gn("UNSAFE_SPEC","Custom ECharts series are not allowed");r(c,`${i}.${l}`,o+1)}};if(r(e,"echarts.option",0),Array.isArray(e.series)&&e.series.length>t.maxSeries)throw new gn("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxSeries} series limit`);e.dataset!==void 0&&(Array.isArray(e.dataset)?e.dataset:[e.dataset]).forEach((i,o)=>{js(i)||zs(`echarts.option.dataset[${o}] must be an object`),i.source!==void 0&&g6(i.source,t,`echarts.option.dataset[${o}].source`)})}function eM(e,t,n){if(!js(e))return zs("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return zs("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const r=Xf(e),s=t===void 0?void 0:pBe(t,n);return s&&Object.prototype.hasOwnProperty.call(r,"dataset")?zs("echarts.option.dataset cannot be combined with echarts.data"):(gBe(r,n),{option:r,data:s})}function bBe(e,t){if(!js(e))return zs("echarts-fulldata must contain an object");if(ZI(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new gn("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return zs("echarts-fulldata.data is required");if(!js(e.option))return zs("echarts-fulldata.option must be an object");const n=hBe(e.data,t);return eM(e.option,n,t)}function yBe(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new gn("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function dW(e,t){const n=g6(e.source,t,"resolvedDataset.source"),r=e.dimensions?ale(e.dimensions,"resolvedDataset.dimensions"):void 0;return r?{data:{kind:"inline",dimensions:r,source:n},option:{dimensions:r,source:n}}:{data:{kind:"inline",source:n},option:{source:n}}}var vBe={light:{background:"#ffffff",foreground:"#343434",legendText:"#555555",titleText:"#343434",subtext:"#aaaaaa",axisLine:"#5d666f",valueAxisLine:"#6E7079",axisLabel:"#838d95",splitLine:"#e0e6f1",splitAreaA:"rgba(250,250,250,0.2)",splitAreaB:"rgba(210,219,238,0.2)",seriesBorder:"#ffffff",pointer:"#7c8a96",tooltipBg:"#ffffff",primary:"#6250f9",palette:["#6250F9","#33AFA9","#AB7BFF","#5F99F9","#A9AFFF","#60CCC5","#C2A5FF","#8EB8FE","#E0E3FE","#98E3DD","#E8E1FA","#D7E6FF"]},dark:{background:"#0d0d0d",foreground:"#f4f7ff",legendText:"#c8cad0",titleText:"#e0e2e8",subtext:"#8a8d93",axisLine:"#555a63",valueAxisLine:"#555a63",axisLabel:"#9da1a8",splitLine:"#3a3e47",splitAreaA:"rgba(60,60,70,0.2)",splitAreaB:"rgba(80,80,90,0.2)",seriesBorder:"#2a2d35",pointer:"#6a707a",tooltipBg:"rgba(30, 32, 40, 0.95)",primary:"#8aa0ff",palette:["#8EA0FF","#61D6D1","#C8A7FF","#8EB8FE","#C7CCFF","#8DE7E2","#D8C5FF","#B8D2FF","#EEF0FF","#C2F0ED","#F0EAFE","#E8F1FF"]}};function ud(e,t){const n={...Xf(e),...t};for(const[r,s]of Object.entries(e)){const i=t[r];js(s)&&js(i)&&(n[r]=ud(s,i))}return n}function lx(e,t){return Array.isArray(e)?e.map(n=>js(n)?ud(t,n):n):js(e)?ud(t,e):e??Xf(t)}function lle(e){const t=n=>js(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function Mk(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function wBe(e,t){const n=r=>{if(!Mk(r,"top")&&!Mk(r,"bottom"))return ud(t,r);const s=Xf(t);return delete s.top,delete s.bottom,ud(s,r)};return Array.isArray(e)?e.map(r=>js(r)?n(r):r):js(e)?n(e):e??Xf(t)}var xBe=740,cle=10,hW=xBe*cle/100,kBe=24,_Be=24,fW=16,SBe=24;function ule(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=hW?e:null;if(typeof e!="string")return null;const t=e.trim();if(t==="top")return 0;const n=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+))%$/.exec(t);if(!n)return null;const r=Number(n[1]);return Number.isFinite(r)&&r>=0&&r<=cle?hW:null}function CBe(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function TBe(e){return e.show===!1||!CBe(e)?null:Mk(e,"top")?ule(e.top):Mk(e,"bottom")?null:0}function EBe(e){return e.show===!1||!Mk(e,"top")?null:ule(e.top)}function mW(e){return Array.isArray(e)?e.filter(js):js(e)?[e]:[]}function ABe(e,t){const n=mW(e).flatMap(s=>{const i=TBe(s);return i===null?[]:[i+kBe+fW]}),r=mW(t).flatMap(s=>{const i=EBe(s);return i===null?[]:[i+_Be+fW]});return Math.max(SBe,...n,...r)}function pW(e,t){return Array.isArray(e)?e.map((n,r)=>js(n)?ud(t(r),n):n):js(e)?ud(t(0),e):e}function gW(e,t){const n=typeof e.type=="string"?e.type:void 0;let r={emphasis:{focus:"series",itemStyle:{borderColor:t.seriesBorder,borderWidth:2}},labelLayout:{hideOverlap:!0}};n==="line"?r=ud(r,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?r=ud(r,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(r=ud(r,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const s=ud(r,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(s.tooltip=lle(lx(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),s}var dle=new Set(["pie","funnel","gauge","radar","treemap"]),jBe=new Set([...dle,"graph","chord","themeRiver"]);function hle(e){return Array.isArray(e.series)?e.series.filter(js):js(e.series)?[e.series]:[]}function NBe(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=hle(e);return t.some(n=>typeof n.type=="string"&&jBe.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function IBe(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=hle(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&dle.has(n.type))?"item":"axis"}function MBe(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function RBe(e,t="light"){const n=vBe[t],r=Xf(e);return r.backgroundColor??(r.backgroundColor=n.background),r.color??(r.color=[...n.palette]),r.textStyle=lx(r.textStyle,{color:n.foreground,fontFamily:"'pingfang SC', 'helvetica neue', arial, 'hiragino sans gb', 'microsoft yahei ui', 'microsoft yahei', sans-serif"}),r.title!==void 0&&(r.title=lx(r.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),r.tooltip=lle(lx(r.tooltip,{trigger:IBe(e),appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText",backgroundColor:n.tooltipBg,borderColor:n.splitLine,borderWidth:1,padding:[8,10],textStyle:{color:n.titleText,fontSize:12},axisPointer:{lineStyle:{color:n.pointer,width:1},crossStyle:{color:n.pointer,width:1}}})),NBe(e)&&(r.legend=wBe(r.legend,{type:"scroll",bottom:8,padding:[4,16],textStyle:{color:n.legendText,fontSize:12},pageIconColor:n.primary,pageIconInactiveColor:n.splitLine,pageTextStyle:{color:n.legendText}})),r.grid=lx(r.grid,{top:ABe(r.title,r.legend),right:36,bottom:48,left:24,containLabel:!0}),r.xAxis!==void 0&&(r.xAxis=pW(r.xAxis,()=>({axisLine:{show:!0,lineStyle:{color:n.axisLine}},axisTick:{show:!0,lineStyle:{color:n.axisLine}},axisLabel:{color:n.axisLabel,fontSize:12,hideOverlap:!0},splitLine:{show:!1,lineStyle:{color:n.splitLine}},splitArea:{show:!1,areaStyle:{color:[n.splitAreaA,n.splitAreaB]}},nameTextStyle:{color:n.axisLabel}}))),r.yAxis!==void 0&&(r.yAxis=pW(r.yAxis,s=>({alignTicks:!0,axisLine:{show:!1,lineStyle:{color:n.valueAxisLine}},axisTick:{show:!1,lineStyle:{color:n.valueAxisLine}},axisLabel:{color:n.axisLabel,fontSize:12,hideOverlap:!0},splitLine:{show:s===0,lineStyle:{color:n.splitLine}},splitArea:{show:!1,areaStyle:{color:[n.splitAreaA,n.splitAreaB]}},nameGap:12,nameTextStyle:{color:n.axisLabel,align:s===0?"left":"right"}}))),Array.isArray(r.series)?r.series=r.series.map(s=>js(s)?gW(s,n):s):js(r.series)&&(r.series=gW(r.series,n)),r}var rj={dispose(){}};function DBe(e={}){var l,c;const t={...rBe,...e.limits},n=(l=e.legacySandbox)==null?void 0:l.resolveLegacyArtifactContent,r=(c=e.legacySandbox)==null?void 0:c.resolveLegacySandboxFileContent,s=e.legacySandbox?eBe({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,i=e.loadECharts??(async()=>await fe(()=>import("./index-C2GE3DAF.js"),[])),o=async(u,d)=>{if(e.validateDataRef&&!e.validateDataRef(u.ref))throw new gn("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new gn("REF_RESOLVER_MISSING","A resolveDataRef callback is required");let f;try{f=await e.resolveDataRef(u.ref,{format:u.format,dimensions:u.dimensions,signal:d})}catch(p){if(d.aborted)return;throw new gn("REF_RESOLUTION_FAILED","The chart dataset could not be resolved",{cause:p})}if(d.aborted)return;const m=f.dimensions||!u.dimensions?f:{...f,dimensions:u.dimensions};return dW(m,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:B$e,parse(u,d){return d.language==="echarts-fulldata"?bBe(u,t):eM(u,d.data,t)},parseSource(u,d){return rle(d.language)?{option:{},data:void 0,legacyEChartSandboxFile:F$e(d.rawLanguage??d.language,u)}:{option:{},data:void 0,legacyEChartQuery:z$e(d.language,u)}},getTitle(u){return fBe(u.option)},async materialize(u,d){var g,b;if(!u.legacyEChartQuery&&!u.legacyEChartSandboxFile){if(((g=u.data)==null?void 0:g.kind)==="ref"){const w=await o(u.data,d.signal);return w?{parsed:{...u,data:w},data:w}:{parsed:u,data:d.data}}return{parsed:u,data:u.data}}if(u.legacyEChartQuery&&!n)throw new gn("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(u.legacyEChartSandboxFile&&!r)throw new gn("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let f;try{u.legacyEChartSandboxFile?f=await nBe({block:u.legacyEChartSandboxFile,signal:d.signal,resolveSandboxFileContent:r,limits:s,preserveLegacySandboxError:e.legacySandbox!==void 0}):f=await tBe({block:u.legacyEChartQuery,signal:d.signal,resolveArtifactContent:n,limits:s,preserveLegacySandboxError:!0})}catch(w){if(d.signal.aborted)return{parsed:u,data:d.data};throw w instanceof gn||w instanceof sle?w:new gn("REF_RESOLUTION_FAILED","The temporary ChatBI chart could not be resolved",{cause:w})}if(d.signal.aborted)return{parsed:u,data:d.data};let m;try{m=kte(f,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(w){throw w instanceof gn?w:new gn("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:w})}if(!js(m))return zs("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(m,"data")||!Object.prototype.hasOwnProperty.call(m,"spec"))return zs("Temporary ChatBI resolver must return data and spec");const p=eM(m.spec,m.data,t);return((b=p.data)==null?void 0:b.kind)!=="inline"?zs("Temporary ChatBI resolver must return inline data"):{parsed:p,data:p.data}},async mount(u,d,f){if(d.legacyEChartQuery||d.legacyEChartSandboxFile)return zs("Temporary ChatBI charts must be materialized before mounting");const m=Xf(d.option);if(f.externalizedTitle&&mBe(m,f.externalizedTitle),d.data){let v;if(d.data.kind==="inline")v=d.data;else{const k=await o(d.data,f.signal);if(!k)return rj;v=k}const x=dW(v,t);m.dataset=x.option}if(f.signal.aborted)return rj;let p;try{p=yBe(await i())}catch(v){throw v instanceof gn?v:new gn("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:v})}if(f.signal.aborted)return rj;let g,b;try{const v=typeof f.theme=="string"||js(f.theme)?f.theme:void 0;g=p.init(u,v);const x=MBe(f.theme),k=e.defaultStyle===!1||!x?m:RBe(m,x);g.setOption(k,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(b=new ResizeObserver(()=>g==null?void 0:g.resize()),b.observe(u))}catch(v){try{b==null||b.disconnect()}catch{}try{g==null||g.dispose()}catch{}throw new gn("RENDER_FAILED","ECharts failed to render the chart",{cause:v})}const w=g;let y=!1;return{resize:()=>w.resize(),dispose(){y||(y=!0,b==null||b.disconnect(),w.dispose())}}}}}var zL=h.createContext(null);function LBe(e){if(h.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function PBe(e){const t=e.source??LBe(e.children),n=h.useMemo(()=>({registry:e.registry,theme:e.theme,streaming:e.streaming??!1,source:t,loadingLabel:e.loadingLabel,labels:e.labels,onError:e.onError}),[e.registry,e.theme,e.streaming,t,e.loadingLabel,e.labels,e.onError]);return h.createElement(zL.Provider,{value:n},e.children)}function OBe(e){const t=h.useContext(zL);if(!t)throw new Error("MarkdownChartBlock must be rendered inside MarkdownChartProvider");const n=h.useRef(null),r=e.streaming??t.streaming,s=e.loadingLabel??t.loadingLabel,i=e.labels??t.labels,o=h.useMemo(()=>Ste(i),[i]);h.useEffect(()=>{const c=n.current;if(!c)return;const u=new L3e(t.registry);let d=!1;return u.render(c,{language:e.language,source:e.source,theme:t.theme,streaming:r,...s!==void 0?{loadingLabel:s}:{},...i!==void 0?{labels:i}:{}}).catch(f=>{var m;d||(c.classList.add("markdown-chart-error"),c.setAttribute("role","alert"),c.textContent=o.chartUnavailable,(m=t.onError)==null||m.call(t,f,{language:e.language,source:e.source}))}),()=>{d=!0,u.dispose()}},[t.registry,t.theme,t.onError,s,i,o,e.language,e.source,r]);const l=["markdown-chart-placeholder",r?"markdown-chart-streaming":void 0,e.className].filter(Boolean).join(" ");return h.createElement("div",{ref:n,className:l,style:e.style,"aria-label":o.chart,"aria-busy":r||void 0,"data-markdown-chart-complete":String(!r)})}function $Be(e,t){var l,c,u,d;const n=(c=(l=t==null?void 0:t.position)==null?void 0:l.start)==null?void 0:c.offset,r=(d=(u=t==null?void 0:t.position)==null?void 0:u.end)==null?void 0:d.offset;if(e===void 0||n===void 0||r===void 0)return!1;const s=e.lastIndexOf(`
`,Math.max(0,n-1))+1,i=e.slice(s,n),o=/^(?: {0,3}>[ \t]?)+$/.test(i)?s:n;return Tte(e.slice(o,r))||e.slice(r).trim().length>0}function fle(e,t){return e===n4||(t==null?void 0:t.has(e))===!0}function BBe(e={}){return{code({node:n,...r}){return h.createElement("code",r)},pre:function({node:r,children:s,...i}){const o=h.useContext(zL);if(h.isValidElement(s)){const l=s,c=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??""),u=c==null?void 0:c[1],d=u==null?void 0:u.toLowerCase();if(u&&d&&fle(d,o==null?void 0:o.registry)){const f=h.Children.toArray(l.props.children).map(m=>typeof m=="string"||typeof m=="number"?String(m):"").join("");return h.createElement(OBe,{language:u,source:f,streaming:(o==null?void 0:o.streaming)===!0&&!$Be(o.source,r),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return h.createElement("pre",i,s)}}}const zBe=3e4,FBe=["artifact://","session-file://"],qBe=/^[a-z]:/i;function HBe(e={}){const{resolveDataRef:t,validateDataRef:n=KBe,...r}=e,s=e.validateDataRef===void 0,i=t?async(o,l)=>{const c=s?mle(o):o;if(!c)throw new Error("Chart data reference is not supported.");return YBe(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new v3e().register(DBe({...r,resolveDataRef:i,validateDataRef:n}))}const UBe={registry:HBe()};function WBe(e,t={}){const n=BBe(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:s,...i}){var o;if(h.isValidElement(s)){const l=s,c=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??""),u=(o=c==null?void 0:c[1])==null?void 0:o.toLowerCase();if(u&&fle(u,e))return h.createElement(n,i,s)}return h.createElement(h.Fragment,null,s)}}function VBe({customization:e,source:t,streaming:n,theme:r,children:s}){const i=GBe(e.labels),{t:o}=rt();return a.jsx(PBe,{registry:e.registry,source:t,streaming:n,theme:r,loadingLabel:e.loadingLabel??o("echartsChart.rendering"),labels:i,onError:e.onError,children:s})}function GBe(e){const{t}=rt();return h.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:r,visibleColumns:s,totalColumns:i})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:r,visibleColumns:s,totalColumns:i,omittedRows:r-n,omittedColumns:i-s}),...e}),[e,t])}function bW(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function mle(e){if(e.trim()!==e||!e||bW(e))return;const t=e.toLowerCase(),n=FBe.find(o=>t.startsWith(o));if(!n)return;const r=e.slice(n.length);if(!r||/[?#\\]/.test(r))return;let s;try{s=decodeURIComponent(r)}catch{return}if(/[%?#\\]/.test(s)||bW(s))return;const i=s.split("/");if(!i.some(o=>o.length===0||o==="."||o===".."||qBe.test(o)))return`${n}${i.join("/")}`}function KBe(e){return mle(e)!==void 0}function YBe(e,t){return new Promise((n,r)=>{const s=globalThis.setTimeout(()=>r(new Error(`${t} timed out.`)),zBe);e.then(n,r).finally(()=>globalThis.clearTimeout(s))})}const XBe="_content_1n6wo_1",QBe="_inlineCode_1n6wo_127",JBe="_link_1n6wo_139",ZBe="_tableWrapper_1n6wo_149",eze="_table_1n6wo_149",tze="_image_1n6wo_179",nze="_codeBlock_1n6wo_187",rze="_codeBlockHeader_1n6wo_196",sze="_codeBlockLang_1n6wo_205",ize="_codeBlockCopy_1n6wo_213",oze="_codeBlockContent_1n6wo_236",aze="_codeBlockPlain_1n6wo_256",lze="_mermaidBlock_1n6wo_274",cze="_mermaidInline_1n6wo_286",uze="_mermaidLoading_1n6wo_305",dze="_mermaidActions_1n6wo_312",hze="_mermaidZoomWrapper_1n6wo_317",fze="_mermaidDragging_1n6wo_325",Yr={content:XBe,inlineCode:QBe,link:JBe,tableWrapper:ZBe,table:eze,image:tze,codeBlock:nze,codeBlockHeader:rze,codeBlockLang:sze,codeBlockCopy:ize,codeBlockContent:oze,codeBlockPlain:aze,mermaidBlock:lze,mermaidInline:cze,mermaidLoading:uze,mermaidActions:dze,mermaidZoomWrapper:hze,mermaidDragging:fze},mze=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","fsharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),yW={"c++":"cpp","c#":"csharp","f#":"fsharp",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function FL(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(yW,t)?yW[t]:t,r=mze.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:r}}const ple=/^(https?:|mailto:)/i,pze=/^data:image\/(png|jpeg|gif|webp);base64,/i;function gle(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:ple.test(t):!1}function Cv(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||pze.test(t)?!0:ple.test(t):!1}let vW,gze=0;function bze({code:e}){const{t}=rt(),n=rm(),[r,s]=h.useState(null),[i,o]=h.useState(null),[l,c]=h.useState("diagram"),[u,d]=h.useState(!1),[f,m]=h.useState(1),[p,g]=h.useState({x:0,y:0}),[b,w]=h.useState(!1),y=h.useRef(null),v=n==="light"?"default":"dark",x=.5,k=3,S=.25,T=()=>{m(L=>Math.min(k,Math.round((L+S)*100)/100))},_=()=>{m(L=>Math.max(x,Math.round((L-S)*100)/100))},C=h.useCallback(()=>{y.current=null,w(!1),m(1),g({x:0,y:0})},[]),j=h.useCallback(L=>{L.preventDefault(),w(!0),y.current={startX:L.clientX,startY:L.clientY,origX:p.x,origY:p.y}},[p]);h.useEffect(()=>{if(!b)return;const L=M=>{if(!y.current)return;const R=M.clientX-y.current.startX,$=M.clientY-y.current.startY,B=1500;g({x:y.current.origX+R,y:Math.max(-B,Math.min(B,y.current.origY+$))})},D=()=>{y.current=null,w(!1)};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",D),window.addEventListener("blur",D),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",D),window.removeEventListener("blur",D)}},[b]),h.useEffect(()=>{m(1),g({x:0,y:0})},[e]),h.useEffect(()=>{let L=!1;s(null),o(null);const D=setTimeout(()=>{fe(()=>import("./mermaid.core-ZUtnug0n.js").then(M=>M.bm),[]).then(async M=>{if(L)return;const R=M.default;vW!==v&&(R.initialize({startOnLoad:!1,theme:v,securityLevel:"strict",suppressErrorRendering:!0,flowchart:{wrappingWidth:300,useMaxWidth:!1}}),vW=v);try{const $=`mermaid-${++gze}`,{svg:B}=await R.render($,e.trim());L||s(B)}catch($){L||o($ instanceof Error?$.message:"Mermaid render failed")}})},150);return()=>{L=!0,clearTimeout(D)}},[e,v]);const E=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?a.jsxs("div",{className:Yr.codeBlock,children:[a.jsx("div",{className:Yr.codeBlockHeader,children:a.jsx("span",{className:Yr.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Yr.codeBlockContent} ${Yr.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Yr.codeBlock,children:[a.jsxs("div",{className:Yr.codeBlockHeader,children:[a.jsx("span",{className:Yr.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Yr.mermaidActions,children:[l==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Yr.codeBlockCopy,onClick:_,title:t("mermaid.zoomOut"),disabled:f<=x,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Yr.codeBlockCopy,onClick:C,title:t("mermaid.zoomReset"),disabled:f===1&&p.x===0&&p.y===0,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Yr.codeBlockCopy,onClick:T,title:t("mermaid.zoomIn"),disabled:f>=k,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Yr.codeBlockCopy,onClick:()=>c(l==="diagram"?"code":"diagram"),children:t(l==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Yr.codeBlockCopy,onClick:E,children:t(u?"code.copied":"code.copy")})]})]}),l==="code"?a.jsx("pre",{className:`${Yr.codeBlockContent} ${Yr.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Yr.mermaidZoomWrapper} ${b?Yr.mermaidDragging:""}`,onMouseDown:j,onDoubleClick:C,children:a.jsx("div",{className:`${Yr.mermaidBlock} ${Yr.mermaidInline}`,style:{transform:`translate(${p.x}px, ${p.y}px) scale(${f})`,transformOrigin:"top center"},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Yr.mermaidBlock} ${Yr.mermaidLoading} ${Yr.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function yze({className:e,children:t,isStreaming:n}){const{t:r}=rt(),s=rm(),[i,o]=h.useState(null),[l,c]=h.useState(!1),{label:u,lang:d,resolvedLang:f}=FL(ble(e)),m=String(t).replace(/\n$/,""),p=s==="light"?"github-light-default":"github-dark-default";h.useEffect(()=>{if(n||d==="mermaid"||f==="text"||LI(m)){o(null);return}const b=yNe(m,f,p);if(b!==null){o(b);return}const w=mU(m,f,p,!0);if(w!==null){o(w);return}o(null);let y=!1;return Fre(f).then(()=>{if(y)return;const v=mU(m,f,p,!0);v!==null&&o(v)}).catch(v=>{y||(console.warn("[web-shell] highlight failed for lang=%s",f,v),o(null))}),()=>{y=!0}},[m,d,f,p,n]);const g=()=>{navigator.clipboard.writeText(m).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)},()=>{})};return d==="mermaid"&&!n?a.jsx(bze,{code:m}):a.jsxs("div",{className:Yr.codeBlock,children:[a.jsxs("div",{className:Yr.codeBlockHeader,children:[a.jsx("span",{className:Yr.codeBlockLang,children:u}),a.jsx("button",{className:Yr.codeBlockCopy,onClick:g,children:r(l?"code.copied":"code.copy")})]}),!n&&i!==null?a.jsx("div",{className:Yr.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${Yr.codeBlockContent} ${Yr.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function ble(e){var i;const t=((i=e==null?void 0:e.match(/(?:^|\s)language-([^\s]+)/))==null?void 0:i[1])??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const r=n[1]??"",s=t[r.length];return!s||s==="{"||s===":"?r:""}function vze({children:e}){return a.jsx("code",{className:Yr.inlineCode,children:e})}function wW({children:e}){return a.jsx("div",{className:Yr.tableWrapper,children:a.jsx("table",{className:Yr.table,children:e})})}const yle=h.createContext(!1),vle=h.createContext(void 0),wle=h.createContext(void 0);function wze(e,t,n){var i,o;if(!n||e===void 0)return!1;const r=(i=t==null?void 0:t.position)==null?void 0:i.start.offset,s=(o=t==null?void 0:t.position)==null?void 0:o.end.offset;return r===void 0||s===void 0?!1:!Tte(e.slice(r,s))&&e.slice(s).trim().length===0}function xze({className:e,children:t,node:n}){const r=h.useContext(yle),s=h.useContext(wle);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?a.jsx(kze,{className:e,isStreaming:r,isIncomplete:wze(s,n,r),children:t}):a.jsx(vze,{children:t})}function kze({className:e,children:t,isStreaming:n,isIncomplete:r}){var p;const s=h.useContext(vle),i=rm(),{markdown:o}=Vu(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(yze,{className:e,isStreaming:n,children:l}),d=ble(e),{resolvedLang:f}=FL(d);if(!!s&&!!e&&!!d)try{const g=(p=o==null?void 0:o.renderCodeBlock)==null?void 0:p.call(o,{language:d,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!r,source:s,theme:i});if(g!=null&&typeof g!="boolean")return a.jsx(Uf,{fallback:u,label:`custom code block component render (lang=${d})`,resetKeys:[d,s,i,n?"streaming":"settled",r?"incomplete":"complete",c],children:g})}catch(g){console.error("[web-shell] custom code block renderer call failed (lang=%s):",d,g)}return u}function _ze({children:e}){return a.jsx(a.Fragment,{children:e})}const tM=/^qwen-session:\/\//i;function Sze(e){return tM.test(e.trim())?e:wte(e)}function Cze({href:e,children:t}){const n=uD();if(e&&tM.test(e.trim())){if(n==="readonly")return a.jsx("span",{className:Yr.link,children:t});const s=e.trim().replace(tM,"");return a.jsx("a",{href:"#",role:"button",className:Yr.link,onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:s}))},children:t})}const r=gle(e)?e:void 0;return a.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:Yr.link,children:t})}function Tze({src:e,alt:t}){const n=Cv(e)?e:void 0;return a.jsx("img",{src:n,alt:t||"",className:Yr.image})}function xle(e="basic",t=""){return{code:xze,pre:_ze,a:Cze,img:Tze,table({children:n}){if(e==="advanced"){const r=a.jsx(wW,{children:n});return a.jsx(Uf,{fallback:r,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(R$e,{fallback:r,children:n})})}return a.jsx(wW,{children:n})}}}const Eze=xle(),Qf=h.memo(function({content:t,source:n,isStreaming:r,tableMode:s}){const{markdown:i,markdownTableMode:o}=Vu(),l=rm(),c=n?i:void 0,u=t&&n&&(c!=null&&c.transformMarkdown)?c.transformMarkdown(t,{source:n}):t,d=r?"basic":s??o??"basic",f=h.useMemo(()=>d==="advanced"?xle("advanced",u):Eze,[d,u]),m=c==null?void 0:c.components,p=h.useMemo(()=>m?{...f,...m,...d==="advanced"?{table:f.table}:{}}:f,[f,d,m]),g=n==="assistant"&&!(m!=null&&m.code)&&!(m!=null&&m.pre)?(c==null?void 0:c.chart)??(c!=null&&c.renderCodeBlock?void 0:UBe):void 0,b=h.useMemo(()=>g?WBe(g.registry,{chartClassName:g.chartClassName,chartStyle:{minHeight:360,...g.chartStyle}}):void 0,[g]),w=h.useMemo(()=>b?{...p,pre:b}:p,[b,p]);if(!t)return null;const y=c!=null&&c.remarkPlugins?[eH,zH,...c.remarkPlugins]:[eH,zH],v=c!=null&&c.rehypePlugins?[YH,...c.rehypePlugins]:[YH],x=a.jsx(c3e,{remarkPlugins:y,rehypePlugins:v,components:w,urlTransform:Sze,children:u}),k=g?a.jsx(VBe,{customization:g,source:u,streaming:!!r,theme:l,children:x}):x;return a.jsx("div",{className:n!=="thinking"?Yr.content:void 0,"data-markdown-source":n,children:a.jsx(yle.Provider,{value:!!r,children:a.jsx(vle.Provider,{value:n,children:a.jsx(wle.Provider,{value:u,children:k})})})})});let nM=[],kle=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?kle:nM).push(n=n+e[t])})();function Aze(e){if(e<768)return!1;for(let t=0,n=nM.length;;){let r=t+n>>1;if(e<nM[r])n=r;else if(e>=kle[r])t=r+1;else return!0;if(t==n)return!1}}function xW(e){return e>=127462&&e<=127487}const kW=8205;function jze(e,t,n=!0,r=!0){return(n?_le:Nze)(e,t,r)}function _le(e,t,n){if(t==e.length)return t;t&&Sle(e.charCodeAt(t))&&Cle(e.charCodeAt(t-1))&&t--;let r=sj(e,t);for(t+=_W(r);t<e.length;){let s=sj(e,t);if(r==kW||s==kW||n&&Aze(s))t+=_W(s),r=s;else if(xW(s)){let i=0,o=t-2;for(;o>=0&&xW(sj(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function Nze(e,t,n){for(;t>0;){let r=_le(e,t-2,n);if(r<t)return r;t--}return 0}function sj(e,t){let n=e.charCodeAt(t);if(!Cle(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Sle(r)?(n-55296<<10)+(r-56320)+65536:n}function Sle(e){return e>=56320&&e<57344}function Cle(e){return e>=55296&&e<56320}function _W(e){return e<65536?1:2}class As{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,r){[t,n]=Ry(this,t,n);let s=[];return this.decompose(0,t,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),ih.from(s,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=Ry(this,t,n);let r=[];return this.decompose(t,n,r,0),ih.from(r,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),s=new Hx(this),i=new Hx(t);for(let o=n,l=n;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(l+=s.value.length,s.done||l>=r)return!0}}iter(t=1){return new Hx(this,t)}iterRange(t,n=this.length){return new Tle(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(t).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new Ele(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?As.empty:t.length<=32?new jo(t):ih.from(jo.split(t,[]))}}class jo extends As{constructor(t,n=Ize(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.text[i],l=s+o.length;if((n?r:l)>=t)return new Mze(s,l,r,o);s=l+1,r++}}decompose(t,n,r,s){let i=t<=0&&n>=this.length?this:new jo(SW(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(s&1){let o=r.pop(),l=d4(i.text,o.text.slice(),0,i.length);if(l.length<=32)r.push(new jo(l,o.length+i.length));else{let c=l.length>>1;r.push(new jo(l.slice(0,c)),new jo(l.slice(c)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof jo))return super.replace(t,n,r);[t,n]=Ry(this,t,n);let s=d4(this.text,d4(r.text,SW(this.text,0,t)),n),i=this.length+r.length-(n-t);return s.length<=32?new jo(s,i):ih.from(jo.split(s,[]),i)}sliceString(t,n=this.length,r=`
`){[t,n]=Ry(this,t,n);let s="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let l=this.text[o],c=i+l.length;i>t&&o&&(s+=r),t<c&&n>i&&(s+=l.slice(Math.max(0,t-i),n-i)),i=c+1}return s}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],s=-1;for(let i of t)r.push(i),s+=i.length+1,r.length==32&&(n.push(new jo(r,s)),r=[],s=-1);return s>-1&&n.push(new jo(r,s)),n}}class ih extends As{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.children[i],l=s+o.length,c=r+o.lines-1;if((n?c:l)>=t)return o.lineInner(t,n,r,s);s=l+1,r=c+1}}decompose(t,n,r,s){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let l=this.children[i],c=o+l.length;if(t<=c&&n>=o){let u=s&((o<=t?1:0)|(c>=n?2:0));o>=t&&c<=n&&!u?r.push(l):l.decompose(t-o,n-o,r,u)}o=c+1}}replace(t,n,r){if([t,n]=Ry(this,t,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],l=i+o.length;if(t>=i&&n<=l){let c=o.replace(t-i,n-i,r),u=this.lines-o.lines+c.lines;if(c.lines<u>>4&&c.lines>u>>6){let d=this.children.slice();return d[s]=c,new ih(d,this.length-(n-t)+r.length)}return super.replace(i,l,c)}i=l+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=`
`){[t,n]=Ry(this,t,n);let s="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let l=this.children[i],c=o+l.length;o>t&&i&&(s+=r),t<c&&n>o&&(s+=l.sliceString(t-o,n-o,r)),o=c+1}return s}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof ih))return 0;let r=0,[s,i,o,l]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==o||i==l)return r;let c=this.children[s],u=t.children[i];if(c!=u)return r+c.scanIdentical(u,n);r+=c.length+1}}static from(t,n=t.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let p of t)r+=p.lines;if(r<32){let p=[];for(let g of t)g.flatten(p);return new jo(p,n)}let s=Math.max(32,r>>5),i=s<<1,o=s>>1,l=[],c=0,u=-1,d=[];function f(p){let g;if(p.lines>i&&p instanceof ih)for(let b of p.children)f(b);else p.lines>o&&(c>o||!c)?(m(),l.push(p)):p instanceof jo&&c&&(g=d[d.length-1])instanceof jo&&p.lines+g.lines<=32?(c+=p.lines,u+=p.length+1,d[d.length-1]=new jo(g.text.concat(p.text),g.length+1+p.length)):(c+p.lines>s&&m(),c+=p.lines,u+=p.length+1,d.push(p))}function m(){c!=0&&(l.push(d.length==1?d[0]:ih.from(d,u)),u=-1,c=d.length=0)}for(let p of t)f(p);return m(),l.length==1?l[0]:new ih(l,n)}}As.empty=new jo([""],0);function Ize(e){let t=-1;for(let n of e)t+=n.length+1;return t}function d4(e,t,n=0,r=1e9){for(let s=0,i=0,o=!0;i<e.length&&s<=r;i++){let l=e[i],c=s+l.length;c>=n&&(c>r&&(l=l.slice(0,r-s)),s<n&&(l=l.slice(n-s)),o?(t[t.length-1]+=l,o=!1):t.push(l)),s=c+1}return t}function SW(e,t,n){return d4(e,[""],t,n)}class Hx{constructor(t,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[n>0?1:(t instanceof jo?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],o=i>>1,l=s instanceof jo?s.text.length:s.children.length;if(o==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(s instanceof jo){let c=s.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,t))return this.value=t==0?c:n>0?c.slice(t):c.slice(0,c.length-t),this;t-=c.length}else{let c=s.children[o+(n<0?-1:0)];t>c.length?(t-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof jo?c.text.length:c.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Tle{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new Hx(t,n>r?-1:1),this.pos=n>r?t.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:s}=this.cursor.next(t);return this.pos+=(s.length+t)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ele{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:r,value:s}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(As.prototype[Symbol.iterator]=function(){return this.iter()},Hx.prototype[Symbol.iterator]=Tle.prototype[Symbol.iterator]=Ele.prototype[Symbol.iterator]=function(){return this});class Mze{constructor(t,n,r,s){this.from=t,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function Ry(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Ba(e,t,n=!0,r=!0){return jze(e,t,n,r)}function Rze(e){return e>=56320&&e<57344}function Dze(e){return e>=55296&&e<56320}function uc(e,t){let n=e.charCodeAt(t);if(!Dze(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Rze(r)?(n-55296<<10)+(r-56320)+65536:n}function qL(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function oh(e){return e<65536?1:2}const rM=/\r\n?|\n/;var Ul=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Ul||(Ul={}));class wh{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n<this.sections.length;n+=2)t+=this.sections[n];return t}get newLength(){let t=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];t+=r<0?this.sections[n]:r}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(r,s,i),s+=i):s+=o,r+=i}}iterChangedRanges(t,n=!1){sM(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?t.push(r,s):t.push(s,r)}return new wh(t)}composeDesc(t){return this.empty?t:t.empty?this:Ale(this,t)}mapDesc(t,n=!1){return t.empty?this:iM(this,t,n)}mapPos(t,n=-1,r=Ul.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],c=this.sections[o++],u=s+l;if(c<0){if(u>t)return i+(t-s);i+=l}else{if(r!=Ul.Simple&&u>=t&&(r==Ul.TrackDel&&s<t&&u>t||r==Ul.TrackBefore&&s<t||r==Ul.TrackAfter&&u>t))return null;if(u>t||u==t&&n<0&&!l)return t==s||n<0?i:i+c;i+=c}s=u}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return i}touchesRange(t,n=t){for(let r=0,s=0;r<this.sections.length&&s<=n;){let i=this.sections[r++],o=this.sections[r++],l=s+i;if(o>=0&&s<=n&&l>=t)return s<t&&l>n?"cover":!0;s=l}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];t+=(t?" ":"")+r+(s>=0?":"+s:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new wh(t)}static create(t){return new wh(t)}}class da extends wh{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return sM(this,(n,r,s,i,o)=>t=t.replace(s,s+(r-n),o),!1),t}mapDesc(t,n=!1){return iM(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let o=n[s],l=n[s+1];if(l>=0){n[s]=l,n[s+1]=o;let c=s>>1;for(;r.length<c;)r.push(As.empty);r.push(o?t.slice(i,i+o):As.empty)}i+=o}return new da(n,r)}compose(t){return this.empty?t:t.empty?this:Ale(this,t,!0)}map(t,n=!1){return t.empty?this:iM(this,t,n,!0)}iterChanges(t,n=!1){sM(this,t,n)}get desc(){return wh.create(this.sections)}filter(t){let n=[],r=[],s=[],i=new Rk(this);e:for(let o=0,l=0;;){let c=o==t.length?1e9:t[o++];for(;l<c||l==c&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,c-l);wl(s,d,-1);let f=i.ins==-1?-1:i.off==0?i.ins:0;wl(n,d,f),f>0&&sp(r,n,i.text),i.forward(d),l+=d}let u=t[o++];for(;l<u;){if(i.done)break e;let d=Math.min(i.len,u-l);wl(n,d,-1),wl(s,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),l+=d}}return{changes:new da(n,r),filtered:wh.create(s)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?t.push(r):s==0?t.push([r]):t.push([r].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,r){let s=[],i=[],o=0,l=null;function c(d=!1){if(!d&&!s.length)return;o<n&&wl(s,n-o,-1);let f=new da(s,i);l=l?l.compose(f.map(l)):f,s=[],i=[],o=0}function u(d){if(Array.isArray(d))for(let f of d)u(f);else if(d instanceof da){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);c(),l=l?l.compose(d.map(l)):d}else{let{from:f,to:m=f,insert:p}=d;if(f>m||f<0||m>n)throw new RangeError(`Invalid change range ${f} to ${m} (in doc of length ${n})`);let g=p?typeof p=="string"?As.of(p.split(r||rM)):p:As.empty,b=g.length;if(f==m&&b==0)return;f<o&&c(),f>o&&wl(s,f-o,-1),wl(s,m-f,b),sp(i,s,g),o=m}}return u(t),c(!l),l}static empty(t){return new da(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<t.length;s++){let i=t[s];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<s;)r.push(As.empty);r[s]=As.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new da(n,r)}static createSet(t,n){return new da(t,n)}}function wl(e,t,n,r=!1){if(t==0&&n<=0)return;let s=e.length-2;s>=0&&n<=0&&n==e[s+1]?e[s]+=t:s>=0&&t==0&&e[s]==0?e[s+1]+=n:r?(e[s]+=t,e[s+1]+=n):e.push(t,n)}function sp(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(As.empty);e.push(n)}}function sM(e,t,n){let r=e.inserted;for(let s=0,i=0,o=0;o<e.sections.length;){let l=e.sections[o++],c=e.sections[o++];if(c<0)s+=l,i+=l;else{let u=s,d=i,f=As.empty;for(;u+=l,d+=c,c&&r&&(f=f.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],c=e.sections[o++];t(s,u,i,d,f),s=u,i=d}}}function iM(e,t,n,r=!1){let s=[],i=r?[]:null,o=new Rk(e),l=new Rk(t);for(let c=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);wl(s,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!n))){let u=l.len;for(wl(s,l.ins,-1);u;){let d=Math.min(o.len,u);o.ins>=0&&c<o.i&&o.len<=d&&(wl(s,0,o.ins),i&&sp(i,s,o.text),c=o.i),o.forward(d),u-=d}l.next()}else if(o.ins>=0){let u=0,d=o.len;for(;d;)if(l.ins==-1){let f=Math.min(d,l.len);u+=f,d-=f,l.forward(f)}else if(l.ins==0&&l.len<d)d-=l.len,l.next();else break;wl(s,u,c<o.i?o.ins:0),i&&c<o.i&&sp(i,s,o.text),c=o.i,o.forward(o.len-d)}else{if(o.done&&l.done)return i?da.createSet(s,i):wh.create(s);throw new Error("Mismatched change set lengths")}}}function Ale(e,t,n=!1){let r=[],s=n?[]:null,i=new Rk(e),o=new Rk(t);for(let l=!1;;){if(i.done&&o.done)return s?da.createSet(r,s):wh.create(r);if(i.ins==0)wl(r,i.len,0,l),i.next();else if(o.len==0&&!o.done)wl(r,0,o.ins,l),s&&sp(s,r,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let c=Math.min(i.len2,o.len),u=r.length;if(i.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;wl(r,c,d,l),s&&d&&sp(s,r,o.text)}else o.ins==-1?(wl(r,i.off?0:i.len,c,l),s&&sp(s,r,i.textBit(c))):(wl(r,i.off?0:i.len,o.off?0:o.ins,l),s&&!o.off&&sp(s,r,o.text));l=(i.ins>c||o.ins>=0&&o.len>c)&&(l||r.length>u),i.forward2(c),o.forward(c)}}}}class Rk{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length?As.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?As.empty:n[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class yg{constructor(t,n,r){this.from=t,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,n=-1){let r,s;return this.empty?r=s=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new yg(r,s,this.flags)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return ht.range(t,n,void 0,void 0,r);let s=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return ht.range(this.anchor,s,void 0,void 0,r)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ht.range(t.anchor,t.head)}static create(t,n,r){return new yg(t,n,r)}}class ht{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:ht.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(t.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ht([this.main],0)}addRange(t,n=!0){return ht.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,ht.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ht(t.ranges.map(n=>yg.fromJSON(n)),t.main)}static single(t,n=t){return new ht([ht.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<t.length;s++){let i=t[s];if(i.empty?i.from<=r:i.from<r)return ht.normalized(t.slice(),n);r=i.to}return new ht(t,n)}static cursor(t,n=0,r,s){return yg.create(t,t,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(t,n,r,s,i){let o=(r??16777215)<<6|(s==null?7:Math.min(6,s));return!i&&t!=n&&(i=n<t?1:-1),n<t?yg.create(n,t,48|o):yg.create(t,n,(i?i<0?8:16:0)|o)}static normalized(t,n=0){let r=t[n];t.sort((s,i)=>s.from-i.from),n=t.indexOf(r);for(let s=1;s<t.length;s++){let i=t[s],o=t[s-1];if(i.empty?i.from<=o.to:i.from<o.to){let l=o.from,c=Math.max(i.to,o.to);s<=n&&n--,t.splice(--s,2,i.anchor>i.head?ht.range(c,l):ht.range(l,c))}}return new ht(t,n)}}function jle(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let HL=0;class jn{constructor(t,n,r,s,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=HL++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new jn(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:UL),!!t.static,t.enables)}of(t){return new h4([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new h4(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new h4(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function UL(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class h4{constructor(t,n,r,s){this.dependencies=t,this.facet=n,this.type=r,this.value=s,this.id=HL++}dynamicSlot(t){var n;let r=this.value,s=this.facet.compareInput,i=this.id,o=t[i]>>1,l=this.type==2,c=!1,u=!1,d=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?u=!0:((n=t[f.id])!==null&&n!==void 0?n:1)&1||d.push(t[f.id]);return{create(f){return f.values[o]=r(f),1},update(f,m){if(c&&m.docChanged||u&&(m.docChanged||m.selection)||oM(f,d)){let p=r(f);if(l?!CW(p,f.values[o],s):!s(p,f.values[o]))return f.values[o]=p,1}return 0},reconfigure:(f,m)=>{let p,g=m.config.address[i];if(g!=null){let b=ZT(m,g);if(this.dependencies.every(w=>w instanceof jn?m.facet(w)===f.facet(w):w instanceof hl?m.field(w,!1)==f.field(w,!1):!0)||(l?CW(p=r(f),b,s):s(p=r(f),b)))return f.values[o]=b,0}else p=r(f);return f.values[o]=p,1}}}}function CW(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function oM(e,t){let n=!1;for(let r of t)Ux(e,r)&1&&(n=!0);return n}function Lze(e,t,n){let r=n.map(c=>e[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),o=e[t.id]>>1;function l(c){let u=[];for(let d=0;d<r.length;d++){let f=ZT(c,r[d]);if(s[d]==2)for(let m of f)u.push(m);else u.push(f)}return t.combine(u)}return{create(c){for(let u of r)Ux(c,u);return c.values[o]=l(c),1},update(c,u){if(!oM(c,i))return 0;let d=l(c);return t.compare(d,c.values[o])?0:(c.values[o]=d,1)},reconfigure(c,u){let d=oM(c,r),f=u.config.facets[t.id],m=u.facet(t);if(f&&!d&&UL(n,f))return c.values[o]=m,0;let p=l(c);return t.compare(p,m)?(c.values[o]=m,0):(c.values[o]=p,1)}}}const $2=jn.define({static:!0});class hl{constructor(t,n,r,s,i){this.id=t,this.createF=n,this.updateF=r,this.compareF=s,this.spec=i,this.provides=void 0}static define(t){let n=new hl(HL++,t.create,t.update,t.compare||((r,s)=>r===s),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet($2).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],o=this.updateF(i,s);return this.compareF(i,o)?0:(r.values[n]=o,1)},reconfigure:(r,s)=>{let i=r.facet($2),o=s.facet($2),l;return(l=i.find(c=>c.field==this))&&l!=o.find(c=>c.field==this)?(r.values[n]=l.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(t){return[this,$2.of({field:this,create:t})]}get extension(){return this}}const ug={lowest:4,low:3,default:2,high:1,highest:0};function Rw(e){return t=>new Nle(t,e)}const b0={highest:Rw(ug.highest),high:Rw(ug.high),default:Rw(ug.default),low:Rw(ug.low),lowest:Rw(ug.lowest)};class Nle{constructor(t,n){this.inner=t,this.prec=n}}class p1{of(t){return new aM(this,t)}reconfigure(t){return p1.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class aM{constructor(t,n){this.compartment=t,this.inner=n}}class JT{constructor(t,n,r,s,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(t){let n=this.address[t.id];return n==null?t.default:this.staticValues[n>>1]}static resolve(t,n,r){let s=[],i=Object.create(null),o=new Map;for(let m of Pze(t,n,o))m instanceof hl?s.push(m):(i[m.facet.id]||(i[m.facet.id]=[])).push(m);let l=Object.create(null),c=[],u=[];for(let m of s)l[m.id]=u.length<<1,u.push(p=>m.slot(p));let d=r==null?void 0:r.config.facets;for(let m in i){let p=i[m],g=p[0].facet,b=d&&d[m]||[];if(p.every(w=>w.type==0))if(l[g.id]=c.length<<1|1,UL(b,p))c.push(r.facet(g));else{let w=g.combine(p.map(y=>y.value));c.push(r&&g.compare(w,r.facet(g))?r.facet(g):w)}else{for(let w of p)w.type==0?(l[w.id]=c.length<<1|1,c.push(w.value)):(l[w.id]=u.length<<1,u.push(y=>w.dynamicSlot(y)));l[g.id]=u.length<<1,u.push(w=>Lze(w,g,p))}}let f=u.map(m=>m(l));return new JT(t,o,f,l,c,i)}}function Pze(e,t,n){let r=[[],[],[],[],[]],s=new Map;function i(o,l){let c=s.get(o);if(c!=null){if(c<=l)return;let u=r[c].indexOf(o);u>-1&&r[c].splice(u,1),o instanceof aM&&n.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let u of o)i(u,l);else if(o instanceof aM){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(o.compartment)||o.inner;n.set(o.compartment,u),i(u,l)}else if(o instanceof Nle)i(o.inner,o.prec);else if(o instanceof hl)r[l].push(o),o.provides&&i(o.provides,l);else if(o instanceof h4)r[l].push(o),o.facet.extensions&&i(o.facet.extensions,ug.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(u,l)}}return i(e,ug.default),r.reduce((o,l)=>o.concat(l))}function Ux(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;e.status[n]=4;let s=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|s}function ZT(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const Ile=jn.define(),lM=jn.define({combine:e=>e.some(t=>t),static:!0}),Mle=jn.define({combine:e=>e.length?e[0]:void 0,static:!0}),Rle=jn.define(),Dle=jn.define(),Lle=jn.define(),Ple=jn.define({combine:e=>e.length?e[0]:!1});class um{constructor(t,n){this.type=t,this.value=n}static define(){return new Oze}}class Oze{of(t){return new um(this,t)}}class $ze{constructor(t){this.map=t}of(t){return new Tr(this,t)}}class Tr{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new Tr(this.type,n)}is(t){return this.type==t}static define(t={}){return new $ze(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let r=[];for(let s of t){let i=s.map(n);i&&r.push(i)}return r}}Tr.reconfigure=Tr.define();Tr.appendConfig=Tr.define();class fa{constructor(t,n,r,s,i,o){this.startState=t,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,r&&jle(r,n.newLength),i.some(l=>l.type==fa.time)||(this.annotations=i.concat(fa.time.of(Date.now())))}static create(t,n,r,s,i,o){return new fa(t,n,r,s,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(fa.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}fa.time=um.define();fa.userEvent=um.define();fa.addToHistory=um.define();fa.remote=um.define();function Bze(e,t){let n=[];for(let r=0,s=0;;){let i,o;if(r<e.length&&(s==t.length||t[s]>=e[r]))i=e[r++],o=e[r++];else if(s<t.length)i=t[s++],o=t[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Ole(e,t,n){var r;let s,i,o;return n?(s=t.changes,i=da.empty(t.changes.length),o=e.changes.compose(t.changes)):(s=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(i):(r=e.selection)===null||r===void 0?void 0:r.map(s),effects:Tr.mapEffects(e.effects,s).concat(Tr.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function cM(e,t,n){let r=t.selection,s=ry(t.annotations);return t.userEvent&&(s=s.concat(fa.userEvent.of(t.userEvent))),{changes:t.changes instanceof da?t.changes:da.of(t.changes||[],n,e.facet(Mle)),selection:r&&(r instanceof ht?r:ht.single(r.anchor,r.head)),effects:ry(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function $le(e,t,n){let r=cM(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let o=!!t[i].sequential;r=Ole(r,cM(e,t[i],o?r.changes.newLength:e.doc.length),o)}let s=fa.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Fze(n?zze(s):s)}function zze(e){let t=e.startState,n=!0;for(let s of t.facet(Rle)){let i=s(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:Bze(n,i))}if(n!==!0){let s,i;if(n===!1)i=e.changes.invertedDesc,s=da.empty(t.doc.length);else{let o=e.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=fa.create(t,s,e.selection&&e.selection.map(i),Tr.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Dle);for(let s=r.length-1;s>=0;s--){let i=r[s](e);i instanceof fa?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof fa?e=i[0]:e=$le(t,ry(i),!1)}return e}function Fze(e){let t=e.startState,n=t.facet(Lle),r=e;for(let s=n.length-1;s>=0;s--){let i=n[s](e);i&&Object.keys(i).length&&(r=Ole(r,cM(t,i,e.changes.newLength),!0))}return r==e?e:fa.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const qze=[];function ry(e){return e==null?qze:Array.isArray(e)?e:[e]}var qi=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(qi||(qi={}));const Hze=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let uM;try{uM=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Uze(e){if(uM)return uM.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Hze.test(n)))return!0}return!1}function Wze(e){return t=>{if(!/\S/.test(t))return qi.Space;if(Uze(t))return qi.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return qi.Word;return qi.Other}}class gs{constructor(t,n,r,s,i,o){this.config=t,this.doc=n,this.selection=r,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Ux(this,l<<1);this.computeSlot=null}field(t,n=!0){let r=this.config.address[t.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return Ux(this,r),ZT(this,r)}update(...t){return $le(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:s}=n;for(let l of t.effects)l.is(p1.reconfigure)?(n&&(s=new Map,n.compartments.forEach((c,u)=>s.set(u,c)),n=null),s.set(l.value.compartment,l.value.extension)):l.is(Tr.reconfigure)?(n=null,r=l.value):l.is(Tr.appendConfig)&&(n=null,r=ry(r).concat(l.value));let i;n?i=t.startState.values.slice():(n=JT.resolve(r,s,this),i=new gs(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=t.startState.facet(lM)?t.newSelection:t.newSelection.asSingle();new gs(n,t.newDoc,o,i,(l,c)=>c.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:ht.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),s=this.changes(r.changes),i=[r.range],o=ry(r.effects);for(let l=1;l<n.ranges.length;l++){let c=t(n.ranges[l]),u=this.changes(c.changes),d=u.map(s);for(let m=0;m<l;m++)i[m]=i[m].map(d);let f=s.mapDesc(u,!0);i.push(c.range.map(f)),s=s.compose(d),o=Tr.mapEffects(o,d).concat(Tr.mapEffects(ry(c.effects),f))}return{changes:s,selection:ht.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof da?t:da.of(t,this.doc.length,this.facet(gs.lineSeparator))}toText(t){return As.of(t.split(this.facet(gs.lineSeparator)||rM))}sliceDoc(t=0,n=this.doc.length){return this.doc.sliceString(t,n,this.lineBreak)}facet(t){let n=this.config.address[t.id];return n==null?t.default:(Ux(this,n),ZT(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let r in t){let s=t[r];s instanceof hl&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(t[r]),this))}return n}static fromJSON(t,n={},r){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(t,i)){let o=r[i],l=t[i];s.push(o.init(c=>o.spec.fromJSON(l,c)))}}return gs.create({doc:t.doc,selection:ht.fromJSON(t.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(t={}){let n=JT.resolve(t.extensions||[],new Map),r=t.doc instanceof As?t.doc:As.of((t.doc||"").split(n.staticFacet(gs.lineSeparator)||rM)),s=t.selection?t.selection instanceof ht?t.selection:ht.single(t.selection.anchor,t.selection.head):ht.single(0);return jle(s,r.length),n.staticFacet(lM)||(s=s.asSingle()),new gs(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(gs.tabSize)}get lineBreak(){return this.facet(gs.lineSeparator)||`
`}get readOnly(){return this.facet(Ple)}phrase(t,...n){for(let r of this.facet(gs.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),t}languageDataAt(t,n,r=-1){let s=[];for(let i of this.facet(Ile))for(let o of i(this,n,r))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return Wze(n.length?n[0]:"")}wordAt(t){let{text:n,from:r,length:s}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-r,l=t-r;for(;o>0;){let c=Ba(n,o,!1);if(i(n.slice(c,o))!=qi.Word)break;o=c}for(;l<s;){let c=Ba(n,l);if(i(n.slice(l,c))!=qi.Word)break;l=c}return o==l?null:ht.range(o+r,l+r)}}gs.allowMultipleSelections=lM;gs.tabSize=jn.define({combine:e=>e.length?e[0]:4});gs.lineSeparator=Mle;gs.readOnly=Ple;gs.phrases=jn.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(s=>e[s]==t[s])}});gs.languageData=Ile;gs.changeFilter=Rle;gs.transactionFilter=Dle;gs.transactionExtender=Lle;p1.reconfigure=Tr.define();function Lh(e,t,n={}){let r={};for(let s of e)for(let i of Object.keys(s)){let o=s[i],l=r[i];if(l===void 0)r[i]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](l,o);else throw new Error("Config merge conflict for field "+i)}for(let s in t)r[s]===void 0&&(r[s]=t[s]);return r}class Vp{eq(t){return this==t}range(t,n=t){return dM.create(t,n,this)}}Vp.prototype.startSide=Vp.prototype.endSide=0;Vp.prototype.point=!1;Vp.prototype.mapMode=Ul.TrackDel;function WL(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let dM=class Ble{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new Ble(t,n,r)}};function hM(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class VL{constructor(t,n,r,s){this.from=t,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,n,r,s=0){let i=r?this.to:this.from;for(let o=s,l=i.length;;){if(o==l)return o;let c=o+l>>1,u=i[c]-t||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==o)return u>=0?o:l;u>=0?l=c:o=c+1}}between(t,n,r,s){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,i);i<o;i++)if(s(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let r=[],s=[],i=[],o=-1,l=-1;for(let c=0;c<this.value.length;c++){let u=this.value[c],d=this.from[c]+t,f=this.to[c]+t,m,p;if(d==f){let g=n.mapPos(d,u.startSide,u.mapMode);if(g==null||(m=p=g,u.startSide!=u.endSide&&(p=n.mapPos(d,u.endSide),p<m)))continue}else if(m=n.mapPos(d,u.startSide),p=n.mapPos(f,u.endSide),m>p||m==p&&u.startSide>0&&u.endSide<=0)continue;(p-m||u.endSide-u.startSide)<0||(o<0&&(o=m),u.point&&(l=Math.max(l,p-m)),r.push(u),s.push(m-o),i.push(p-o))}return{mapped:r.length?new VL(s,i,r,l):null,pos:o}}}class ss{constructor(t,n,r,s){this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(t,n,r,s){return new ss(t,n,r,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(hM)),this.isEmpty)return n.length?ss.of(n):this;let l=new zle(this,null,-1).goto(0),c=0,u=[],d=new Ch;for(;l.value||c<n.length;)if(c<n.length&&(l.from-n[c].from||l.startSide-n[c].value.startSide)>=0){let f=n[c++];d.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(l.chunkIndex)<n[c].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||i<this.chunkPos[l.chunkIndex])&&d.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||i<l.from||o(l.from,l.to,l.value))&&(d.addInner(l.from,l.to,l.value)||u.push(dM.create(l.from,l.to,l.value))),l.next());return d.finishInner(this.nextLayer.isEmpty&&!u.length?ss.empty:this.nextLayer.update({add:u,filter:o,filterFrom:s,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],c=this.chunk[o],u=t.touchesRange(l,l+c.length);if(u===!1)s=Math.max(s,c.maxPoint),n.push(c),r.push(t.mapPos(l));else if(u===!0){let{mapped:d,pos:f}=c.map(l,t);d&&(s=Math.max(s,d.maxPoint),n.push(d),r.push(f))}}let i=this.nextLayer.map(t);return n.length==0?i:new ss(r,n,i||ss.empty,s)}between(t,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],o=this.chunk[s];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return Dk.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return Dk.from(t).goto(n)}static compare(t,n,r,s,i=-1){let o=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=i),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=i),c=TW(o,l,r),u=new Dw(o,c,i),d=new Dw(l,c,i);r.iterGaps((f,m,p)=>EW(u,f,d,m,p,s)),r.empty&&r.length==0&&EW(u,0,d,0,0,s)}static eq(t,n,r=0,s){s==null&&(s=999999999);let i=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let l=TW(i,o),c=new Dw(i,l,0).goto(r),u=new Dw(o,l,0).goto(r);for(;;){if(c.to!=u.to||!fM(c.active,u.active)||c.point&&(!u.point||!WL(c.point,u.point)))return!1;if(c.to>s)return!0;c.next(),u.next()}}static spans(t,n,r,s,i=-1){let o=new Dw(t,null,i).goto(n),l=n,c=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let d=o.activeForPoint(o.to),f=o.pointFrom<n?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,c);s.point(l,u,o.point,d,f,o.pointRank),c=Math.min(o.openEnd(u),d.length)}else u>l&&(s.span(l,u,o.active,c),c=o.openEnd(u));if(o.to>r)return c+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(t,n=!1){let r=new Ch;for(let s of t instanceof dM?[t]:n?Vze(t):t)r.add(s.from,s.to,s.value);return r.finish()}static join(t){if(!t.length)return ss.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let s=t[r];s!=ss.empty;s=s.nextLayer)n=new ss(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}ss.empty=new ss([],[],null,-1);function Vze(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(hM(t,r)>0)return e.slice().sort(hM);t=r}return e}ss.empty.nextLayer=ss.empty;class Ch{finishChunk(t){this.chunks.push(new VL(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,r){this.addInner(t,n,r)||(this.nextLayer||(this.nextLayer=new Ch)).add(t,n,r)}addInner(t,n,r){let s=t-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+t,this.lastTo=n.to[r]+t,!0}finish(){return this.finishInner(ss.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=ss.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function TW(e,t,n){let r=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&r.set(i.chunk[o],i.chunkPos[o]);let s=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let l=r.get(i.chunk[o]);l!=null&&(n?n.mapPos(l):l)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(l,l+i.chunk[o].length))&&s.add(i.chunk[o])}return s}class zle{constructor(t,n,r,s=0){this.layer=t,this.skip=n,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,n,!1),this}gotoInner(t,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<t||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(t,n){(this.to-t||this.endSide-n)<0&&this.gotoInner(t,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=t+n.from[this.rangeIndex];if(this.from=r,this.to=t+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class Dk{constructor(t){this.heap=t}static from(t,n=null,r=-1){let s=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new zle(o,n,r,i));return s.length==1?s[0]:new Dk(s)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let r of this.heap)r.goto(t,n);for(let r=this.heap.length>>1;r>=0;r--)ij(this.heap,r);return this.next(),this}forward(t,n){for(let r of this.heap)r.forward(t,n);for(let r=this.heap.length>>1;r>=0;r--)ij(this.heap,r);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),ij(this.heap,0)}}}function ij(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let s=e[r];if(r+1<e.length&&s.compare(e[r+1])>=0&&(s=e[r+1],r++),n.compare(s)<0)break;e[r]=n,e[t]=s,t=r}}class Dw{constructor(t,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Dk.from(t,n,r)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){B2(this.active,t),B2(this.activeTo,t),B2(this.activeRank,t),this.minActive=AW(this.active,this.activeTo)}addActive(t){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||s-this.activeTo[n])>0;)n++;z2(this.active,n,r),z2(this.activeTo,n,s),z2(this.activeRank,n,i),t&&z2(t,n,this.cursor.from),this.minActive=AW(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>t){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&B2(r,s)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<t;s--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(t){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)n++;return n}}function EW(e,t,n,r,s,i){e.goto(t),n.goto(r);let o=r+s,l=r,c=r-t,u=!!i.boundChange;for(let d=!1;;){let f=e.to+c-n.to,m=f||e.endSide-n.endSide,p=m<0?e.to+c:n.to,g=Math.min(p,o);if(e.point||n.point?(e.point&&n.point&&WL(e.point,n.point)&&fM(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(l,g,e.point,n.point),d=!1):(d&&i.boundChange(l),g>l&&!fM(e.active,n.active)&&i.compareRange(l,g,e.active,n.active),u&&g<o&&(f||e.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;l=p,m<=0&&e.next(),m>=0&&n.next()}}function fM(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!WL(e[n],t[n]))return!1;return!0}function B2(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function z2(e,t,n){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=n}function AW(e,t){let n=-1,r=1e9;for(let s=0;s<t.length;s++)(t[s]-r||e[s].endSide-e[n].endSide)<0&&(n=s,r=t[s]);return n}function Tv(e,t,n=e.length){let r=0;for(let s=0;s<n&&s<e.length;)e.charCodeAt(s)==9?(r+=t-r%t,s++):(r++,s=Ba(e,s));return r}function mM(e,t,n,r){for(let s=0,i=0;;){if(i>=t)return s;if(s==e.length)break;i+=e.charCodeAt(s)==9?n-i%n:1,s=Ba(e,s)}return r===!0?-1:e.length}const pM="ͼ",jW=typeof Symbol>"u"?"__"+pM:Symbol.for(pM),gM=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),NW=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Gp{constructor(t,n){this.rules=[];let{finish:r}=n||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,l,c,u){let d=[],f=/^@(\w+)\b/.exec(o[0]),m=f&&f[1]=="keyframes";if(f&&l==null)return c.push(o[0]+";");for(let p in l){let g=l[p];if(/&/.test(p))i(p.split(/,\s*/).map(b=>o.map(w=>b.replace(/&/,w))).reduce((b,w)=>b.concat(w)),g,c);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");i(s(p),g,d,m)}else g!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||m)&&c.push((r&&!f&&!u?o.map(r):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in t)i(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=NW[jW]||1;return NW[jW]=t+1,pM+t.toString(36)}static mount(t,n,r){let s=t[gM],i=r&&r.nonce;s?i&&s.setNonce(i):s=new Gze(t,i),s.mount(Array.isArray(n)?n:[n],t)}}let IW=new Map;class Gze{constructor(t,n){let r=t.ownerDocument||t,s=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let i=IW.get(r);if(i)return t[gM]=i;this.sheet=new s.CSSStyleSheet,IW.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[gM]=this}mount(t,n){let r=this.sheet,s=0,i=0;for(let o=0;o<t.length;o++){let l=t[o],c=this.modules.indexOf(l);if(c<i&&c>-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,l),r)for(let u=0;u<l.rules.length;u++)r.insertRule(l.rules[u],s++)}else{for(;i<c;)s+=this.modules[i++].rules.length;s+=l.rules.length,i++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let c=0;c<this.modules.length;c++)o+=this.modules[c].getRules()+`
`;this.styleTag.textContent=o;let l=n.head||n;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var Kp={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Lk={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kze=typeof navigator<"u"&&/Mac/.test(navigator.platform),Yze=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var il=0;il<10;il++)Kp[48+il]=Kp[96+il]=String(il);for(var il=1;il<=24;il++)Kp[il+111]="F"+il;for(var il=65;il<=90;il++)Kp[il]=String.fromCharCode(il+32),Lk[il]=String.fromCharCode(il);for(var oj in Kp)Lk.hasOwnProperty(oj)||(Lk[oj]=Kp[oj]);function Xze(e){var t=Kze&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Yze&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Lk:Kp)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function ai(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?e.setAttribute(r,s):s!=null&&(e[r]=s)}t++}for(;t<arguments.length;t++)Fle(e,arguments[t]);return e}function Fle(e,t){if(typeof t=="string")e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)Fle(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}let Bl=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},bM=typeof document<"u"?document:{documentElement:{style:{}}};const yM=/Edge\/(\d+)/.exec(Bl.userAgent),qle=/MSIE \d/.test(Bl.userAgent),vM=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Bl.userAgent),b6=!!(qle||vM||yM),MW=!b6&&/gecko\/(\d+)/i.test(Bl.userAgent),aj=!b6&&/Chrome\/(\d+)/.exec(Bl.userAgent),RW="webkitFontSmoothing"in bM.documentElement.style,wM=!b6&&/Apple Computer/.test(Bl.vendor),DW=wM&&(/Mobile\/\w+/.test(Bl.userAgent)||Bl.maxTouchPoints>2);var An={mac:DW||/Mac/.test(Bl.platform),windows:/Win/.test(Bl.platform),linux:/Linux|X11/.test(Bl.platform),ie:b6,ie_version:qle?bM.documentMode||6:vM?+vM[1]:yM?+yM[1]:0,gecko:MW,gecko_version:MW?+(/Firefox\/(\d+)/.exec(Bl.userAgent)||[0,0])[1]:0,chrome:!!aj,chrome_version:aj?+aj[1]:0,ios:DW,android:/Android\b/.test(Bl.userAgent),webkit:RW,webkit_version:RW?+(/\bAppleWebKit\/(\d+)/.exec(Bl.userAgent)||[0,0])[1]:0,safari:wM,safari_version:wM?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Bl.userAgent)||[0,0])[1]:0,tabSize:bM.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function GL(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const e3=Object.create(null);function KL(e,t,n){if(e==t)return!0;e||(e=e3),t||(t=e3);let r=Object.keys(e),s=Object.keys(t);if(r.length-0!=s.length-0)return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function Qze(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]==null&&e.removeAttribute(r)}for(let n in t){let r=t[n];n=="style"?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function LW(e,t,n){let r=!1;if(t)for(let s in t)n&&s in n||(r=!0,s=="style"?e.style.cssText="":e.removeAttribute(s));if(n)for(let s in n)t&&t[s]==n[s]||(r=!0,s=="style"?e.style.cssText=n[s]:e.setAttribute(s,n[s]));return r}function Jze(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}class ou{eq(t){return!1}updateDOM(t,n,r){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var dl=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(dl||(dl={}));class Un extends Vp{constructor(t,n,r,s){super(),this.startSide=t,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(t){return new $_(t)}static widget(t){let n=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return n+=r&&!t.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Wg(t,n,n,r,t.widget||null,!1)}static replace(t){let n=!!t.block,r,s;if(t.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:o}=Hle(t,n);r=(i?n?-3e8:-1:5e8)-1,s=(o?n?2e8:1:-6e8)+1}return new Wg(t,r,s,n,t.widget||null,!0)}static line(t){return new B_(t)}static set(t,n=!1){return ss.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Un.none=ss.empty;class $_ extends Un{constructor(t){let{start:n,end:r}=Hle(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?GL(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||e3}eq(t){return this==t||t instanceof $_&&this.tagName==t.tagName&&KL(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}$_.prototype.point=!1;class B_ extends Un{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof B_&&this.spec.class==t.spec.class&&KL(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}B_.prototype.mapMode=Ul.TrackBefore;B_.prototype.point=!0;class Wg extends Un{constructor(t,n,r,s,i,o){super(n,r,i,t),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?Ul.TrackBefore:Ul.TrackAfter:Ul.TrackDel}get type(){return this.startSide!=this.endSide?dl.WidgetRange:this.startSide<=0?dl.WidgetBefore:dl.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Wg&&Zze(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}Wg.prototype.point=!0;function Hle(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n==null&&(n=e.inclusive),r==null&&(r=e.inclusive),{start:n??t,end:r??t}}function Zze(e,t){return e==t||!!(e&&t&&e.compare(t))}function sy(e,t,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=e?n[s]=Math.max(n[s],t):n.push(e,t)}class Pk extends Vp{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof Pk&&this.tagName==t.tagName&&KL(this.attributes,t.attributes)}static create(t){return new Pk(t.tagName,t.attributes||e3,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return ss.of(t,n)}}Pk.prototype.startSide=Pk.prototype.endSide=-1;function Ok(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function xM(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Wx(e,t){if(!t.anchorNode)return!1;try{return xM(e,t.anchorNode)}catch{return!1}}function Vx(e){return e.nodeType==3?Bk(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function Gx(e,t,n,r){return n?PW(e,t,n,r,-1)||PW(e,t,n,r,1):!1}function Yp(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function t3(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function PW(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:Jf(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Yp(e)+(s<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(s<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=s<0?Jf(e):0}else return!1}}function Jf(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function $k(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function eFe(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Ule(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function tFe(e,t,n,r,s,i,o,l){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,f=!1;d&&!f;)if(d.nodeType==1){let m,p=d==c.body,g=1,b=1;if(p)m=eFe(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(f=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let v=d.getBoundingClientRect();({scaleX:g,scaleY:b}=Ule(d,v)),m={left:v.left,right:v.left+d.clientWidth*g,top:v.top,bottom:v.top+d.clientHeight*b}}let w=0,y=0;if(s=="nearest")t.top<m.top+o?(y=t.top-(m.top+o),n>0&&t.bottom>m.bottom+y&&(y=t.bottom-m.bottom+o)):t.bottom>m.bottom-o&&(y=t.bottom-m.bottom+o,n<0&&t.top-y<m.top&&(y=t.top-(m.top+o)));else{let v=t.bottom-t.top,x=m.bottom-m.top;y=(s=="center"&&v<=x?t.top+v/2-x/2:s=="start"||s=="center"&&n<0?t.top-o:t.bottom-x+o)-m.top}if(r=="nearest"?t.left<m.left+i?(w=t.left-(m.left+i),n>0&&t.right>m.right+w&&(w=t.right-m.right+i)):t.right>m.right-i&&(w=t.right-m.right+i,n<0&&t.left<m.left+w&&(w=t.left-(m.left+i))):w=(r=="center"?t.left+(t.right-t.left)/2-(m.right-m.left)/2:r=="start"==l?t.left-i:t.right-(m.right-m.left)+i)-m.left,w||y)if(p)u.scrollBy(w,y);else{let v=0,x=0;if(y){let k=d.scrollTop;d.scrollTop+=y/b,x=(d.scrollTop-k)*b}if(w){let k=d.scrollLeft;d.scrollLeft+=w/g,v=(d.scrollLeft-k)*g}t={left:t.left-v,top:t.top-x,right:t.right-v,bottom:t.bottom-x},v&&Math.abs(v-w)<1&&(r="nearest"),x&&Math.abs(x-y)<1&&(s="nearest")}if(p)break;(t.top<m.top||t.bottom>m.bottom||t.left<m.left||t.right>m.right)&&(t={left:Math.max(t.left,m.left),right:Math.min(t.right,m.right),top:Math.max(t.top,m.top),bottom:Math.min(t.bottom,m.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function Wle(e,t=!0){let n=e.ownerDocument,r=null,s=null;for(let i=e.parentNode;i&&!(i==n.body||(!t||r)&&s);)if(i.nodeType==1)!s&&i.scrollHeight>i.clientHeight&&(s=i),t&&!r&&i.scrollWidth>i.clientWidth&&(r=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:r,y:s}}class nFe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:r}=t;this.set(n,Math.min(t.anchorOffset,n?Jf(n):0),r,Math.min(t.focusOffset,r?Jf(r):0))}set(t,n,r,s){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let rg=null;An.safari&&An.safari_version>=26&&(rg=!1);function Vle(e){if(e.setActive)return e.setActive();if(rg)return e.focus(rg);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(rg==null?{get preventScroll(){return rg={preventScroll:!0},!0}}:void 0),!rg){rg=!1;for(let n=0;n<t.length;){let r=t[n++],s=t[n++],i=t[n++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=i&&(r.scrollLeft=i)}}}let OW;function Bk(e,t,n=t){let r=OW||(OW=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function iy(e,t,n,r){let s={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function rFe(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function sFe(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Jf(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=Jf(n))}else{if(n==e)return!0;r=Yp(n),n=n.parentNode}}function Gle(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Kle(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=Jf(n)}else if(n.parentNode&&!t3(n))r=Yp(n),n=n.parentNode;else return null}}function Yle(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!t3(n))r=Yp(n)+1,n=n.parentNode;else return null}}class dd{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new dd(t.parentNode,Yp(t),n)}static after(t,n){return new dd(t.parentNode,Yp(t)+1,n)}}var wi=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(wi||(wi={}));const Vg=wi.LTR,YL=wi.RTL;function Xle(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const iFe=Xle("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),oFe=Xle("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),kM=Object.create(null),Fd=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);kM[t]=n,kM[n]=-t}function Qle(e){return e<=247?iFe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?oFe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const aFe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class fh{get dir(){return this.level%2?YL:Vg}constructor(t,n,r){this.from=t,this.to=n,this.level=r}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,r,s){let i=-1;for(let o=0;o<t.length;o++){let l=t[o];if(l.from<=n&&l.to>=n){if(l.level==r)return o;(i<0||(s!=0?s<0?l.from<n:l.to>n:t[i].level>l.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function Jle(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],s=t[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!Jle(r.inner,s.inner))return!1}return!0}const yi=[];function lFe(e,t,n,r,s){for(let i=0;i<=r.length;i++){let o=i?r[i-1].to:t,l=i<r.length?r[i].from:n,c=i?256:s;for(let u=o,d=c,f=c;u<l;u++){let m=Qle(e.charCodeAt(u));m==512?m=d:m==8&&f==4&&(m=16),yi[u]=m==4?2:m,m&7&&(f=m),d=m}for(let u=o,d=c,f=c;u<l;u++){let m=yi[u];if(m==128)u<l-1&&d==yi[u+1]&&d&24?m=yi[u]=d:yi[u]=256;else if(m==64){let p=u+1;for(;p<l&&yi[p]==64;)p++;let g=u&&d==8||p<n&&yi[p]==8?f==1?1:8:256;for(let b=u;b<p;b++)yi[b]=g;u=p-1}else m==8&&f==1&&(yi[u]=1);d=m,m&7&&(f=m)}}}function cFe(e,t,n,r,s){let i=s==1?2:1;for(let o=0,l=0,c=0;o<=r.length;o++){let u=o?r[o-1].to:t,d=o<r.length?r[o].from:n;for(let f=u,m,p,g;f<d;f++)if(p=kM[m=e.charCodeAt(f)])if(p<0){for(let b=l-3;b>=0;b-=3)if(Fd[b+1]==-p){let w=Fd[b+2],y=w&2?s:w&4?w&1?i:s:0;y&&(yi[f]=yi[Fd[b]]=y),l=b;break}}else{if(Fd.length==189)break;Fd[l++]=f,Fd[l++]=m,Fd[l++]=c}else if((g=yi[f])==2||g==1){let b=g==s;c=b?0:1;for(let w=l-3;w>=0;w-=3){let y=Fd[w+2];if(y&2)break;if(b)Fd[w+2]|=2;else{if(y&4)break;Fd[w+2]|=4}}}}}function uFe(e,t,n,r){for(let s=0,i=r;s<=n.length;s++){let o=s?n[s-1].to:e,l=s<n.length?n[s].from:t;for(let c=o;c<l;){let u=yi[c];if(u==256){let d=c+1;for(;;)if(d==l){if(s==n.length)break;d=n[s++].to,l=s<n.length?n[s].from:t}else if(yi[d]==256)d++;else break;let f=i==1,m=(d<t?yi[d]:r)==1,p=f==m?f?1:2:r;for(let g=d,b=s,w=b?n[b-1].to:e;g>c;)g==w&&(g=n[--b].from,w=b?n[b-1].to:e),yi[--g]=p;c=d}else i=u,c++}}}function _M(e,t,n,r,s,i,o){let l=r%2?2:1;if(r%2==s%2)for(let c=t,u=0;c<n;){let d=!0,f=!1;if(u==i.length||c<i[u].from){let b=yi[c];b!=l&&(d=!1,f=b==16)}let m=!d&&l==1?[]:null,p=d?r:r+1,g=c;e:for(;;)if(u<i.length&&g==i[u].from){if(f)break e;let b=i[u];if(!d)for(let w=b.to,y=u+1;;){if(w==n)break e;if(y<i.length&&i[y].from==w)w=i[y++].to;else{if(yi[w]==l)break e;break}}if(u++,m)m.push(b);else{b.from>c&&o.push(new fh(c,b.from,p));let w=b.direction==Vg!=!(p%2);SM(e,w?r+1:r,s,b.inner,b.from,b.to,o),c=b.to}g=b.to}else{if(g==n||(d?yi[g]!=l:yi[g]==l))break;g++}m?_M(e,c,g,r+1,s,m,o):c<g&&o.push(new fh(c,g,p)),c=g}else for(let c=n,u=i.length;c>t;){let d=!0,f=!1;if(!u||c>i[u-1].to){let b=yi[c-1];b!=l&&(d=!1,f=b==16)}let m=!d&&l==1?[]:null,p=d?r:r+1,g=c;e:for(;;)if(u&&g==i[u-1].to){if(f)break e;let b=i[--u];if(!d)for(let w=b.from,y=u;;){if(w==t)break e;if(y&&i[y-1].to==w)w=i[--y].from;else{if(yi[w-1]==l)break e;break}}if(m)m.push(b);else{b.to<c&&o.push(new fh(b.to,c,p));let w=b.direction==Vg!=!(p%2);SM(e,w?r+1:r,s,b.inner,b.from,b.to,o),c=b.from}g=b.from}else{if(g==t||(d?yi[g-1]!=l:yi[g-1]==l))break;g--}m?_M(e,g,c,r+1,s,m,o):g<c&&o.push(new fh(g,c,p)),c=g}}function SM(e,t,n,r,s,i,o){let l=t%2?2:1;lFe(e,s,i,r,l),cFe(e,s,i,r,l),uFe(s,i,r,l),_M(e,s,i,t,n,r,o)}function dFe(e,t,n){if(!e)return[new fh(0,0,t==YL?1:0)];if(t==Vg&&!n.length&&!aFe.test(e))return Zle(e.length);if(n.length)for(;e.length>yi.length;)yi[yi.length]=256;let r=[],s=t==Vg?0:1;return SM(e,s,s,n,0,e.length,r),r}function Zle(e){return[new fh(0,e,0)]}let ece="";function hFe(e,t,n,r,s){var i;let o=r.head-e.from,l=fh.find(t,o,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=t[l],u=c.side(s,n);if(o==u){let m=l+=s?1:-1;if(m<0||m>=t.length)return null;c=t[l=m],o=c.side(!s,n),u=c.side(s,n)}let d=Ba(e.text,o,c.forward(s,n));(d<c.from||d>c.to)&&(d=u),ece=e.text.slice(Math.min(o,d),Math.max(o,d));let f=l==(s?t.length-1:0)?null:t[l+(s?1:-1)];return f&&d==u&&f.level+(s?0:1)<c.level?ht.cursor(f.side(!s,n)+e.from,f.forward(s,n)?1:-1,f.level):ht.cursor(d+e.from,c.forward(s,n)?-1:1,c.level)}function fFe(e,t,n){for(let r=t;r<n;r++){let s=Qle(e.charCodeAt(r));if(s==1)return Vg;if(s==2||s==4)return YL}return Vg}const tce=jn.define(),nce=jn.define(),rce=jn.define(),sce=jn.define(),CM=jn.define(),ice=jn.define(),oce=jn.define(),XL=jn.define(),QL=jn.define(),ace=jn.define({combine:e=>e.some(t=>t)}),lce=jn.define({combine:e=>e.some(t=>t)}),cce=jn.define();class oy{constructor(t,n,r,s,i,o=!1){this.range=t,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new oy(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new oy(ht.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const F2=Tr.define({map:(e,t)=>e.map(t)}),uce=Tr.define();function fc(e,t,n){let r=e.facet(sce);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const pf=jn.define({combine:e=>e.length?e[0]:!0});let mFe=0;const Lb=jn.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}});class Ui{constructor(t,n,r,s,i){this.id=t,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Lb.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Lb.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new Ui(mFe++,t,r,s,l=>{let c=[];return o&&c.push(y6.of(u=>{let d=u.plugin(l);return d?o(d):Un.none})),i&&c.push(i(l)),c})}static fromClass(t,n){return Ui.define((r,s)=>new t(r,s),n)}}class lj{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(fc(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){fc(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){fc(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const dce=jn.define(),JL=jn.define(),y6=jn.define(),hce=jn.define(),ZL=jn.define(),z_=jn.define(),fce=jn.define();function $W(e,t){let n=e.state.facet(fce);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(e):i),s=[];return ss.spans(r,t.from,t.to,{point(){},span(i,o,l,c){let u=i-t.from,d=o-t.from,f=s;for(let m=l.length-1;m>=0;m--,c--){let p=l[m].spec.bidiIsolate,g;if(p==null&&(p=fFe(t.text,u,d)),c>0&&f.length&&(g=f[f.length-1]).to==u&&g.direction==p)g.to=d,f=g.inner;else{let b={from:u,to:d,direction:p,inner:[]};f.push(b),f=b.inner}}}}),s}const mce=jn.define();function eP(e){let t=0,n=0,r=0,s=0;for(let i of e.state.facet(mce)){let o=i(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:n,top:r,bottom:s}}const cx=jn.define();class ju{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new ju(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,r=this;for(;n>0;n--){let s=t[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),t.splice(n-1,1)}}return t.splice(n,0,r),t}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let s=0,i=0,o=0;;){let l=s<t.length?t[s].fromB:1e9,c=i<n.length?n[i]:1e9,u=Math.min(l,c);if(u==1e9)break;let d=u+o,f=u,m=d;for(;;)if(i<n.length&&n[i]<=f){let p=n[i+1];i+=2,f=Math.max(f,p);for(let g=s;g<t.length&&t[g].fromB<=f;g++)o=t[g].toA-t[g].toB;m=Math.max(m,p+o)}else if(s<t.length&&t[s].fromB<=f){let p=t[s++];f=Math.max(f,p.toB),m=Math.max(m,p.toA),o=p.toA-p.toB}else break;r.push(new ju(d,m,u,f))}return r}}class n3{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=da.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,o,l,c)=>s.push(new ju(i,o,l,c))),this.changedRanges=s}static create(t,n,r){return new n3(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const pFe=[];class bo{constructor(t,n,r=0){this.dom=t,this.length=n,this.flags=r,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return pFe}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&Qze(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let r=n;for(let s of this.children){if(s==t)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n){return null}domPosFor(t,n){let r=Yp(this.dom),s=this.length?t>0:n>0;return new dd(this.parent.dom,r+(s?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof w6)return t;return null}static get(t){return t.cmTile}}class v6 extends bo{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,r=null,s,i=(t==null?void 0:t.node)==n?t:null,o=0;for(let l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,s=r?r.nextSibling:n.firstChild,i&&s!=l.dom&&(i.written=!0),l.dom.parentNode==n)for(;s&&s!=l.dom;)s=BW(s);else n.insertBefore(l.dom,s);r=l.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=BW(s);this.length=o}}function BW(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class w6 extends v6{constructor(t,n){super(n),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let n=bo.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],r=this,s=0,i=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&i++,s=n.pop()}else{let o=r.children[s++];if(o instanceof Lf)n.push(s),r=o,s=0;else{let l=i+o.length,c=t(o,i);if(c!==void 0)return c;i=l+o.breakAfter}}}resolveBlock(t,n){let r,s=-1,i,o=-1;if(this.blockTiles((l,c)=>{let u=c+l.length;if(t>=c&&t<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(r=void 0)}(c<t||t==u&&(n<-1?l.length:l.covers(1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,s=t-c),(u>t||t==c&&(n>1?l.length:l.covers(-1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,o=t-c)}}),!r&&!i)throw new Error("No tile at position "+t);return r&&n<0||!i?{tile:r,offset:s}:{tile:i,offset:o}}}class Lf extends v6{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new Lf(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class Dy extends v6{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new Dy(n||document.createElement("div"),t);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,n,r){let s=null,i=-1,o=null,l=-1;function c(d,f){for(let m=0,p=0;m<d.children.length&&p<=f;m++){let g=d.children[m],b=p+g.length;b>=f&&(g.isComposite()?c(g,f-p):(!o||o.isHidden&&(n>0||r&&bFe(o,g)))&&(b>f||g.flags&32)?(o=g,l=f-p):(p<f||g.flags&16&&!g.isHidden)&&(s=g,i=f-p)),p=b}}c(this,t);let u=(n<0?s:o)||s||o;return u?{tile:u,offset:u==s?i:l}:null}coordsIn(t,n){let r=this.resolveInline(t,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):gFe(this)}domIn(t,n){let r=this.resolveInline(t,n);if(r){let{tile:s,offset:i}=r;if(this.dom.contains(s.dom))return s.isText()?new dd(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:n);let o=r.tile.parent,l=!1;for(let c of o.children){if(l)return new dd(c.dom,0);c==r.tile&&(l=!0)}}return new dd(this.dom,0)}}function gFe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Vx(t);return n[n.length-1]||null}function bFe(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class dc extends v6{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new dc(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class vg extends bo{constructor(t,n){super(t,n.length),this.text=n}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,n){let r=this.dom.nodeValue.length;t>r&&(t=r);let s=t,i=t,o=0;t==0&&n<0||t==r&&n>=0?An.chrome||An.gecko||(t?(s--,o=1):i<r&&(i++,o=-1)):n<0?s--:i<r&&i++;let l=Bk(this.dom,s,i).getClientRects();if(!l.length)return null;let c=l[(o?o<0:n>=0)?0:l.length-1];return An.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(l,u=>u.width)||c),o?$k(c,o<0):c||null}static of(t,n){let r=new vg(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Gg extends bo{constructor(t,n,r,s){super(t,n,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,r){let s=this.widget.coordsAt(this.dom,t,n);if(s)return s;if(r)return $k(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let c=l?i.length-1:0;o=i[c],!(t>0?c==0:c==i.length-1||o.top<o.bottom);c+=l?-1:1);return $k(o,!l)}}get overrideDOMText(){if(!this.length)return As.empty;let{root:t}=this;if(!t)return As.empty;let n=this.posAtStart;return t.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,s,i){return i||(i=t.toDOM(n),t.editable||(i.contentEditable="false")),new Gg(i,r,t,s)}}class r3 extends bo{constructor(t){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,t)}get isHidden(){return!0}get overrideDOMText(){return As.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class yFe{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,r){let{tile:s,index:i,beforeBreak:o,parents:l}=this;for(;t||n>0;)if(s.isComposite())if(o){if(!t)break;r&&r.break(),t--,o=!1}else if(i==s.children.length){if(!t&&!l.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:i}=l.pop(),i++}else{let c=s.children[i],u=c.breakAfter;(n>0?c.length<=t:c.length<t)&&(!r||r.skip(c,0,c.length)!==!1||!c.isComposite)?(o=!!u,i++,t-=c.length):(l.push({tile:s,index:i}),s=c,i=0,r&&c.isComposite()&&r.enter(c))}else if(i==s.length)o=!!s.breakAfter,{tile:s,index:i}=l.pop(),i++;else if(t){let c=Math.min(t,s.length-i);r&&r.skip(s,i,i+c),t-=c,i+=c}else break;return this.tile=s,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class vFe{constructor(t,n,r,s){this.from=t,this.to=n,this.wrapper=r,this.rank=s}}class wFe{constructor(t,n,r){this.cache=t,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,r,s){var i;this.flushBuffer();let o=this.ensureMarks(n,r),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+t.length<512){this.cache.reused.set(l,2);let c=o.children[o.children.length-1]=new vg(l.dom,l.text+t);c.parent=o}else o.append(s||vg.of(t,(i=this.cache.find(vg))===null||i===void 0?void 0:i.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?cj(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let l=n.marks.length-1;l>=0;l--){let c=n.marks[l],u=s.lastChild;if(u instanceof dc&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(cj(c.dom)),s=u;else{if(this.cache.reused.get(c)){let f=bo.get(c.dom);f&&f.setDOM(cj(c.dom))}let d=dc.of(c.mark,c.dom);s.append(d),s=d}this.cache.reused.set(c,2)}let i=bo.get(t.text);i&&this.cache.reused.set(i,2);let o=new vg(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,s.append(o)}addInlineWidget(t,n,r){let s=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);s||this.flushBuffer();let i=this.ensureMarks(n,r);!s&&!(t.flags&16)&&i.append(this.getBuffer(1)),i.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var r;t||(t=pce);let s=Dy.start(t,n||((r=this.cache.find(Dy))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var r;let s=this.curLine;for(let i=t.length-1;i>=0;i--){let o=t[i],l;if(n>0&&(l=s.lastChild)&&l instanceof dc&&l.mark.eq(o))s=l,n--;else{let c=dc.of(o,(r=this.cache.find(dc,u=>u.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(c),s=c,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!zW(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(An.ios&&zW(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(uj,0,32)||new Gg(uj.toDOM(),0,uj,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let n=t.rank*102+t.value.rank,r=new vFe(t.from,t.to,t.value,n),s=this.wrappers.length;for(;s>0&&(this.wrappers[s-1].rank-r.rank||this.wrappers[s-1].to-r.to)<0;)s--;this.wrappers.splice(s,0,r)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let s=n.lastChild;if(r.from<this.pos&&s instanceof Lf&&s.wrapper.eq(r.wrapper))n=s;else{let i=Lf.of(r.wrapper,(t=this.cache.find(Lf,o=>o.wrapper.eq(r.wrapper)))===null||t===void 0?void 0:t.dom);n.append(i),n=i}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),r=this.cache.find(r3,void 0,1);return r&&(r.flags=n),r||new r3(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class xFe{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:s,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(t,s.length);return i?null:s.slice(0,l)}let n=Math.min(this.text.length,this.textOff+t),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const s3=[Gg,Dy,vg,dc,r3,Lf,w6];for(let e=0;e<s3.length;e++)s3[e].bucket=e;class kFe{constructor(t){this.view=t,this.buckets=s3.map(()=>[]),this.index=s3.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,r=this.buckets[n];r.length<6?r.push(t):r[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,r=2){let s=t.bucket,i=this.buckets[s],o=this.index[s];for(let l=i.length-1;l>=0;l--){let c=(l+o)%i.length,u=i[c];if((!n||n(u))&&!this.reused.has(u))return i.splice(c,1),c<o&&this.index[s]--,this.reused.set(u,r),u}return null}findWidget(t,n,r){let s=this.buckets[0];if(s.length)for(let i=0,o=0;;i++){if(i==s.length){if(o)return null;o=1,i=0}let l=s[i];if(!this.reused.has(l)&&(o==0?l.widget.compare(t):l.widget.constructor==t.constructor&&t.updateDOM(l.dom,this.view,l.widget)))return s.splice(i,1),i<this.index[0]&&this.index[0]--,l.widget==t&&l.length==n&&(l.flags&497)==r?(this.reused.set(l,1),l):(this.reused.set(l,2),new Gg(l.dom,n,t,l.flags&-498|r))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,n=2){if(!this.reused.has(t))return this.reused.set(t,n),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class _Fe{constructor(t,n,r,s,i){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new kFe(t),this.text=new xFe(t.state.doc),this.builder=new wFe(this.cache,new w6(t,t.contentDOM),ss.iter(r)),this.cache.reused.set(n,2),this.old=new yFe(n),this.reuseWalker={skip:(o,l,c)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,n){let r=n&&this.getCompositionContext(n.text);for(let s=0,i=0,o=0;;){let l=o<t.length?t[o++]:null,c=l?l.fromA:this.old.root.length;if(c>s){let u=c-s;this.preserve(u,!o,!l),s=c,i+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(i,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,l.toA),this.emit(n.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(i,l.toB)),i=l.toB,s=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,r){let s=TFe(this.old),i=this.openMarks;this.old.advance(t,r?1:-1,{skip:(o,l,c)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(c-l);else{let u=c>0||l<o.length?Gg.of(o.widget,this.view,c-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);u.flags&256?(u.flags&=-2,this.builder.addBlockWidget(u)):(this.builder.ensureLine(null),this.builder.addInlineWidget(u,s,i),i=s.length)}else if(o.isText())this.builder.ensureLine(null),!l&&c==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,s,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,c),s,i)),i=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof r3)this.cache.add(o);else if(o instanceof dc)this.builder.ensureLine(null),this.builder.addMark(o,s,i),this.cache.reused.set(o,1),i=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof dc&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof dc&&(s.shift(),i=Math.min(i,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let r=null,s=this.builder,i=0,o=ss.spans(this.decorations,t,n,{point:(l,c,u,d,f,m)=>{if(u instanceof Wg){if(this.disallowBlockEffectsFor[m]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=d.length,f>d.length)s.continueWidget(c-l);else{let p=u.widget||(u.block?Ly.block:Ly.inline),g=SFe(u),b=this.cache.findWidget(p,c-l,g)||Gg.of(p,this.view,c-l,g);u.block?(u.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(b)):(s.ensureLine(r),s.addInlineWidget(b,d,f))}r=null}else r=CFe(r,u);c>l&&this.text.skip(c-l)},span:(l,c,u,d)=>{for(let f=l;f<c;){let m=this.text.next(Math.min(512,c-f));m==null?(s.addLineStartIfNotCovered(r),s.addBreak(),f++):(s.ensureLine(r),s.addText(m,u,f==l?d:u.length),f+=m.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=o>i,this.openMarks=o}forward(t,n,r=1){n-t<=10?this.old.advance(n-t,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(t){let n=[],r=null;for(let s=t.parentNode;;s=s.parentNode){let i=bo.get(s);if(s==this.view.contentDOM)break;i instanceof dc?n.push(i):i!=null&&i.isLine()?r=i:i instanceof Lf||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new Dy(s,pce):r||n.push(dc.of(new $_({tagName:s.nodeName.toLowerCase(),attributes:Jze(s)}),s)))}return{line:r,marks:n}}}function zW(e,t){let n=r=>{for(let s of r.children)if((t?s.isText():s.length)||n(s))return!0;return!1};return n(e)}function SFe(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}const pce={class:"cm-line"};function CFe(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&GL(n,e),r&&(e.class+=" "+r)),e}function TFe(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof dc&&t.push(r.mark)}return t}function cj(e){let t=bo.get(e);return t&&t.setDOM(e.cloneNode()),e}class Ly extends ou{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ly.inline=new Ly("span");Ly.block=new Ly("div");const uj=new class extends ou{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class FW{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Un.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new w6(t,t.contentDOM),this.updateInner([new ju(0,0,0,t.state.doc.length)],null)}update(t){var n;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:f})=>f<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!LFe(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let i=s>-1?AFe(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;r=new ju(d,f,t.changes.mapPos(d,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(An.ie||An.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let c=IFe(o,this.decorations,t.changes);c.length&&(r=ju.extendWithRanges(r,c));let u=RFe(l,this.blockWrappers,t.changes);return u.length&&(r=ju.extendWithRanges(r,u)),i&&!r.some(d=>d.fromA<=i.range.fromA&&d.toA>=i.range.toA)&&(r=i.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,i),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||t.length){let o=this.tile,l=new _Fe(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&bo.get(n.text)&&l.cache.reused.set(bo.get(n.text),2),this.tile=l.run(t,n),TM(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=An.chrome||An.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||r.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.tile.children)i.isWidget()&&i.widget instanceof dj&&s.push(i.dom);r.updateGaps(s)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let n of t.transactions)for(let r of n.effects)r.is(uce)&&(this.editContextFormatting=r.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,i=s==r,o=!i&&!(this.view.state.facet(pf)||r.tabIndex>-1)&&Wx(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(i||n||o))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,u,d;if(c.empty?d=u=this.inlineDOMNearPos(c.anchor,c.assoc||1):(d=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),u=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),An.gecko&&c.empty&&!this.hasComposition&&EFe(u)){let m=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(m,u.node.childNodes[u.offset]||null)),u=d=new dd(m,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Gx(u.node,u.offset,f.anchorNode,f.anchorOffset)||!Gx(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{An.android&&An.chrome&&r.contains(f.focusNode)&&DFe(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let m=Ok(this.view.root);if(m)if(c.empty){if(An.gecko){let p=jFe(u.node,u.offset);if(p&&p!=3){let g=(p==1?Kle:Yle)(u.node,u.offset);g&&(u=new dd(g.node,g.offset))}}m.collapse(u.node,u.offset),c.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=c.bidiLevel)}else if(m.extend){m.collapse(u.node,u.offset);try{m.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),p.setEnd(d.node,d.offset),p.setStart(u.node,u.offset),m.removeAllRanges(),m.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new dd(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new dd(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&Gx(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,r=Ok(t.root),{anchorNode:s,anchorOffset:i}=t.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let c=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!c||!u||c.bottom>u.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(d.node,d.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(s,i)}posFromDOM(t,n){let r=this.tile.nearest(t);if(!r)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let i;if(t==r.dom)i=r.dom.childNodes[n];else{let o=Jf(t)==0?0:n==0?-1:1;for(;;){let l=t.parentNode;if(l==r.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?i=t:i=t.nextSibling}if(i==r.dom.firstChild)return s;for(;i&&!bo.get(i);)i=i.nextSibling;if(!i)return s+r.length;for(let o=0,l=s;;o++){let c=r.children[o];if(c.dom==i)return l;l+=c.length+c.breakAfter}}else return r.isText()?t==r.dom?s+n:s+(n?r.length:0):s}domAtPos(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.domPosFor(t,n):r.domIn(s,n)}inlineDOMNearPos(t,n){let r,s=-1,i=!1,o,l=-1,c=!1;return this.tile.blockTiles((u,d)=>{if(u.isWidget()){if(u.flags&32&&d>=t)return!0;u.flags&16&&(i=!0)}else{let f=d+u.length;if(d<=t&&(r=u,s=t-d,i=f<t),f>=t&&!o&&(o=u,l=t-d,c=d>t),d>t&&o)return!0}}),!r&&!o?this.domAtPos(t,n):(i&&o?r=null:c&&r&&(o=null),r&&n<0||!o?r.domIn(s,n):o.domIn(l,n))}coordsAt(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.widget instanceof dj?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n)}lineAt(t,n){let{tile:r}=this.tile.resolveBlock(t,n);return r.isLine()?r:null}coordsForChar(t){let{tile:n,offset:r}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function s(i,o){if(i.isComposite())for(let l of i.children){if(l.length>=o){let c=s(l,o);if(c)return c}if(o-=l.length,o<0)break}else if(i.isText()&&o<i.length){let l=Ba(i.text,o);if(l==o)return null;let c=Bk(i.dom,o,l).getClientRects();for(let u=0;u<c.length;u++){let d=c[u];if(u==c.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return s(n,r)}measureVisibleLineHeights(t){let n=[],{from:r,to:s}=t,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==wi.LTR,u=0,d=(f,m,p)=>{for(let g=0;g<f.children.length&&!(m>s);g++){let b=f.children[g],w=m+b.length,y=b.dom.getBoundingClientRect(),{height:v}=y;if(p&&!g&&(u+=y.top-p.top),b instanceof Lf)w>r&&d(b,m,y);else if(m>=r&&(u>0&&n.push(-u),n.push(v+u),u=0,o)){let x=b.dom.lastChild,k=x?Vx(x):[];if(k.length){let S=k[k.length-1],T=c?S.right-y.left:y.right-S.left;T>l&&(l=T,this.minWidth=i,this.minWidthFrom=m,this.minWidthTo=w)}}p&&g==f.children.length-1&&(u+=p.bottom-y.bottom),m=w+b.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?wi.RTL:wi.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,c;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=Vx(u.dom);if(d.length!=1)return;l+=d[0].width,c=d[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:c}}});if(t)return t;let n=document.createElement("div"),r,s,i;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=Vx(n.firstChild)[0];r=n.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,i=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:i}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],o=i?i.from-1:this.view.state.doc.length;if(o>r){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;t.push(Un.replace({widget:new dj(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!i)break;r=i.to+1}return Un.set(t)}updateDeco(){let t=1,n=this.view.state.facet(y6).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(ZL).map((i,o)=>{let l=typeof i=="function";return l&&(r=!0),l?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[t++]=r,n.push(ss.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(hce).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(t){var n;if(t.isSnapshot){let d=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=d.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let d of this.view.state.facet(cce))try{if(d(this.view,t.range,t))return!0}catch(f){fc(this.view.state,f,"scroll handler")}let{range:r}=t,s=this.coordsAt(r.head,(n=r.assoc)!==null&&n!==void 0?n:r.empty?0:r.head>r.anchor?-1:1),i;if(!s)return;!r.empty&&(i=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(s={left:Math.min(s.left,i.left),top:Math.min(s.top,i.top),right:Math.max(s.right,i.right),bottom:Math.max(s.bottom,i.bottom)});let o=eP(this.view),l={left:s.left-o.left,top:s.top-o.top,right:s.right+o.right,bottom:s.bottom+o.bottom},{offsetWidth:c,offsetHeight:u}=this.view.scrollDOM;if(tFe(this.view.scrollDOM,l,r.head<r.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,c),-c),Math.max(Math.min(t.yMargin,u),-u),this.view.textDirection==wi.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(s.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||s.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(r.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){TM(this.tile)}}function TM(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)TM(r,t)}}function EFe(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function gce(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Kle(n.focusNode,n.focusOffset),s=Yle(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let l=bo.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)i=s;else if(e.docView.lastCompositionAfterCursor){let c=bo.get(r.node);!c||c.isText()&&c.text!=r.node.nodeValue||(i=s)}}if(e.docView.lastCompositionAfterCursor=i!=r,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function AFe(e,t,n){let r=gce(e,n);if(!r)return null;let{node:s,from:i,to:o}=r,l=s.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(r.from,r.to)!=l)return null;let c=t.invertedDesc;return{range:new ju(c.mapPos(i),c.mapPos(o),i,o),text:s}}function jFe(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable=="false"?2:0)}let NFe=class{constructor(){this.changes=[]}compareRange(t,n){sy(t,n,this.changes)}comparePoint(t,n){sy(t,n,this.changes)}boundChange(t){sy(t,t,this.changes)}};function IFe(e,t,n){let r=new NFe;return ss.compare(e,t,n,r),r.changes}class MFe{constructor(){this.changes=[]}compareRange(t,n){sy(t,n,this.changes)}comparePoint(){}boundChange(t){sy(t,t,this.changes)}}function RFe(e,t,n){let r=new MFe;return ss.compare(e,t,n,r),r.changes}function DFe(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function LFe(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}class dj extends ou{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function PFe(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),i=t-s.from;if(s.length==0)return ht.cursor(t);i==0?n=1:i==s.length&&(n=-1);let o=i,l=i;n<0?o=Ba(s.text,i,!1):l=Ba(s.text,i);let c=r(s.text.slice(o,l));for(;o>0;){let u=Ba(s.text,o,!1);if(r(s.text.slice(u,o))!=c)break;o=u}for(;l<s.length;){let u=Ba(s.text,l);if(r(s.text.slice(l,u))!=c)break;l=u}return ht.range(o+s.from,l+s.from)}function OFe(e,t,n,r,s){let i=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(e.defaultLineHeight-l)*.5)/l);i+=c*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+mM(o,i,e.state.tabSize)}function EM(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!s||i.type==dl.Text&&(s.type!=i.type||(n<0?i.from<t:i.to>t)))&&(s=i)}}return s||r}return r}function $Fe(e,t,n,r){let s=EM(e,t.head,t.assoc||-1),i=!r||s.type!=dl.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),l=e.textDirectionAt(s.from),c=e.posAtCoords({x:n==(l==wi.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(c!=null)return ht.cursor(c,n?-1:1)}return ht.cursor(n?s.to:s.from,n?-1:1)}function qW(e,t,n,r){let s=e.state.doc.lineAt(t.head),i=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let l=t,c=null;;){let u=hFe(s,i,o,l,n),d=ece;if(!u){if(s.number==(n?e.state.doc.lines:1))return l;d=`
`,s=e.state.doc.line(s.number+(n?1:-1)),i=e.bidiSpans(s),u=e.visualLineSide(s,!n)}if(c){if(!c(d))return l}else{if(!r)return u;c=r(d)}l=u}}function BFe(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return i=>{let o=r(i);return s==qi.Space&&(s=o),s==o}}function zFe(e,t,n,r){let s=t.head,i=n?1:-1;if(s==(n?e.state.doc.length:0))return ht.cursor(s,t.assoc);let o=t.goalColumn,l,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(s,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)o==null&&(o=u.left-c.left),l=i<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(s);o==null&&(o=Math.min(c.right-c.left,e.defaultCharacterWidth*(s-g.from))),l=(i<0?g.top:g.bottom)+d}let f=c.left+o,m=e.viewState.heightOracle.textHeight>>1,p=r??m;for(let g=0;;g+=m){let b=l+(p+g)*i,w=AM(e,{x:f,y:b},!1,i);if(n?b>c.bottom:b<c.top)return ht.cursor(w.pos,w.assoc);let y=e.coordsAtPos(w.pos,w.assoc),v=y?(y.top+y.bottom)/2:0;if(!y||(n?v>l:v<l))return ht.cursor(w.pos,w.assoc,void 0,o)}}function Kx(e,t,n){for(;;){let r=0;for(let s of e)s.between(t-1,t+1,(i,o,l)=>{if(t>i&&t<o){let c=r||n||(t-i<o-t?-1:1);t=c<0?i:o,r=c}});if(!r)return t}}function bce(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let s=t.ranges[r],i=null;if(s.empty){let o=Kx(e,s.from,0);o!=s.from&&(i=ht.cursor(o,-1))}else{let o=Kx(e,s.from,-1),l=Kx(e,s.to,1);(o!=s.from||l!=s.to)&&(i=ht.range(s.from==s.anchor?o:l,s.from==s.head?o:l))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?ht.create(n,t.mainIndex):t}function hj(e,t,n){let r=Kx(e.state.facet(z_).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:ht.cursor(r,r<n.from?1:-1)}class ah{constructor(t,n){this.pos=t,this.assoc=n}}function AM(e,t,n,r){let s=e.contentDOM.getBoundingClientRect(),i=s.top+e.viewState.paddingTop,{x:o,y:l}=t,c=l-i,u;for(;;){if(c<0)return new ah(0,1);if(c>e.viewState.docHeight)return new ah(e.state.doc.length,-1);if(u=e.elementAtHeight(c),r==null)break;if(u.type==dl.Text){if(r<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let m=e.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(m&&(r<0?m.top<=c+i:m.bottom>=c+i))break}let f=e.viewState.heightOracle.textHeight/2;c=r>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==dl.Text){let f=OFe(e,s,u,o,l);return new ah(f,f==u.from?1:-1)}}if(u.type!=dl.Text)return c<(u.top+u.bottom)/2?new ah(u.from,1):new ah(u.to,-1);let d=e.docView.lineAt(u.from,2);return(!d||d.length!=u.length)&&(d=e.docView.lineAt(u.from,-2)),new FFe(e,o,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class FFe{constructor(t,n,r,s){this.view=t,this.x=n,this.y=r,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[fh.find(s,t-r.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[fh.find(s,t-r.from,-1,n)].dir}bidiIn(t,n){let{spans:r,line:s}=this.bidiSpansAt(t);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<n)}scan(t,n,r=!1){let s=0,i=t.length-1,o=new Set,l=this.bidiIn(t[0],t[i]),c,u,d=-1,f=1e9,m;e:for(;s<i;){let g=i-s,b=s+i>>1;t:if(o.has(b)){let y=s+Math.floor(Math.random()*g);for(let v=0;v<g;v++){if(!o.has(y)){b=y;break t}y++,y==i&&(y=s)}break e}o.add(b);let w=n(b);if(w)for(let y=0;y<w.length;y++){let v=w[y],x=0;if(!(v.width==0&&w.length>1)){if(v.bottom<this.y)(!c||c.bottom<v.bottom)&&(c=v),x=1;else if(v.top>this.y)(!u||u.top>v.top)&&(u=v),x=-1;else{let k=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,S=Math.abs(k);S<f&&(d=b,f=S,m=v),k&&(x=k<0==(this.baseDir==wi.LTR)?-1:1)}x==-1&&(!l||this.baseDirAt(t[b],1))?i=b:x==1&&(!l||this.baseDirAt(t[b+1],-1))&&(s=b+1)}}}if(!m){if(!u&&!c)return{i:t[0],after:!1};let g=c&&(!u||this.y-c.bottom<u.top-this.y)?c:u;return this.y=(g.top+g.bottom)/2,this.scan(t,n,!0)}if(f&&!r){let{top:g,bottom:b}=m;if(c&&c.bottom>(g+g+b)/3)return this.y=c.bottom-1,this.scan(t,n,!0);if(u&&u.top<(g+b+b)/3)return this.y=u.top+1,this.scan(t,n,!0)}let p=(l?this.dirAt(t[d],1):this.baseDir)==wi.LTR;return{i:d,after:this.x>(m.left+m.right)/2==p}}scanText(t,n){let r=[];for(let i=0;i<t.length;i=Ba(t.text,i))r.push(n+i);r.push(n+t.length);let s=this.scan(r,i=>{let o=r[i]-n,l=r[i+1]-n;return Bk(t.dom,o,l).getClientRects()});return s.after?new ah(r[s.i+1],-1):new ah(r[s.i],1)}scanTile(t,n){if(!t.length)return new ah(n,1);if(t.children.length==1){let l=t.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let r=[n];for(let l=0,c=n;l<t.children.length;l++)r.push(c+=t.children[l].length);let s=this.scan(r,l=>{let c=t.children[l];return c.flags&48?null:(c.dom.nodeType==1?c.dom:Bk(c.dom,0,c.length)).getClientRects()}),i=t.children[s.i],o=r[s.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):s.after?new ah(r[s.i+1],-1):new ah(o,1)}}const bb="";class qFe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(gs.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=bb}readRange(t,n){if(!t)return this;let r=t.parentNode;for(let s=t;;){this.findPointBefore(r,s);let i=this.text.length;this.readNode(s);let o=bo.get(s),l=s.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let c=bo.get(l);(o&&c?o.breakAfter:(o?o.breakAfter:t3(s))||t3(l)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!UFe(l,n)&&this.lineBreak(),s=l}return this.findPointBefore(r,n),this}readTextNode(t){let n=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,l;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=s.exec(n))&&(i=l.index,o=l[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=o-1);r=i+o}}readNode(t){let n=bo.get(t),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(t,n){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(HFe(t,r.node,r.offset)?n:0))}}function HFe(e,t,n){for(;;){if(!t||n<Jf(t))return!1;if(t==e)return!0;n=Yp(t)+1,t=t.parentNode}}function UFe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=bo.get(e);if(!(r!=null&&r.isWidget()))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s!=null&&s.length)return!1}return!0}class HW{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class WFe{constructor(t,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=t.docView,l=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=yce(t.docView.tile,n,r,0))){let c=i||o?[]:GFe(t),u=new qFe(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=KFe(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!xM(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!xM(t.contentDOM,c.anchorNode)?l.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((An.ios||An.chrome)&&l.main.empty&&u!=d&&(f.from>0||f.to<t.state.doc.length)){let m=Math.min(u,d),p=Math.max(u,d),g=f.from-m,b=f.to-p;(g==0||g==1||m==0)&&(b==0||b==-1||p==t.state.doc.length)&&(u=0,d=t.state.doc.length)}if(t.inputState.composing>-1&&l.ranges.length>1)this.newSel=l.replaceRange(ht.range(d,u));else if(t.lineWrapping&&d==u&&!(l.main.empty&&l.main.head==u)&&t.inputState.lastTouchTime>Date.now()-100){let m=t.coordsAtPos(u,-1),p=0;m&&(p=t.inputState.lastTouchY<=m.bottom?-1:1),this.newSel=ht.create([ht.cursor(u,p)])}else this.newSel=ht.single(d,u)}}}function yce(e,t,n,r){if(e.isComposite()){let s=-1,i=-1,o=-1,l=-1;for(let c=0,u=r,d=r;c<e.children.length;c++){let f=e.children[c],m=u+f.length;if(u<t&&m>n)return yce(f,t,n,u);if(m>=t&&s==-1&&(s=c,i=u),u>n&&f.dom.parentNode==e.dom){o=c,l=d;break}d=m,u=m+f.breakAfter}return{from:i,to:l<0?r+e.length:l,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function vce(e,t){let n,{newSel:r}=t,{state:s}=e,i=s.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:c}=t.bounds,u=i.from,d=null;(o===8||An.android&&t.text.length<c-l)&&(u=i.to,d="end");let f=s.doc.sliceString(l,c,bb),m,p;!i.empty&&i.from>=l&&i.to<=c&&(t.typeOver||f!=t.text)&&f.slice(0,i.from-l)==t.text.slice(0,i.from-l)&&f.slice(i.to-l)==t.text.slice(m=t.text.length-(f.length-(i.to-l)))?n={from:i.from,to:i.to,insert:As.of(t.text.slice(i.from-l,m).split(bb))}:(p=wce(f,t.text,u-l,d))&&(An.chrome&&o==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==bb+bb&&p.toB--,n={from:l+p.from,to:l+p.toA,insert:As.of(t.text.slice(p.from,p.toB).split(bb))})}else r&&(!e.hasFocus&&s.facet(pf)||i3(r,i))&&(r=null);if(!n&&!r)return!1;if((An.mac||An.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=ht.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:As.of([n.insert.toString().replace("."," ")])}):s.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:s.toText(e.inputState.insertingText)}:An.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(r&&(r=ht.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:As.of([" "])}),n)return tP(e,n,r,o);if(r&&!i3(r,i)){let l=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(l=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bce(s.facet(z_).map(u=>u(e)),r))),e.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function tP(e,t,n,r=-1){if(An.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(An.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&e.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&iy(e.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&iy(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&iy(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,l=()=>o||(o=VFe(e,t,n));return e.state.facet(ice).some(c=>c(e,t.from,t.to,i,l))||e.dispatch(l()),!0}function VFe(e,t,n){let r,s=e.state,i=s.selection.main,o=-1;if(t.from==t.to&&t.from<i.from||t.from>i.to){let c=t.from<i.from?-1:1,u=c<0?i.from:i.to,d=Kx(s.facet(z_).map(f=>f(e)),u,c);t.from==d&&(o=d)}if(o>-1)r={changes:t,selection:ht.cursor(t.from+t.insert.length,-1)};else if(t.from>=i.from&&t.to<=i.to&&t.to-t.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let c=i.from<t.from?s.sliceDoc(i.from,t.from):"",u=i.to>t.to?s.sliceDoc(t.to,i.to):"";r=s.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=s.changes(t),u=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let d=e.state.sliceDoc(t.from,t.to),f,m=n&&gce(e,n.main.head);if(m){let g=t.insert.length-(t.to-t.from);f={from:m.from,to:m.to-g}}else f=e.state.doc.lineAt(i.head);let p=i.to-t.to;r=s.changeByRange(g=>{if(g.from==i.from&&g.to==i.to)return{changes:c,range:u||g.map(c)};let b=g.to-p,w=b-d.length;if(e.state.sliceDoc(w,b)!=d||b>=f.from&&w<=f.to)return{range:g};let y=s.changes({from:w,to:b,insert:t.insert}),v=g.to-i.to;return{changes:y,range:u?ht.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):g.map(y)}})}else r={changes:c,selection:u&&s.selection.replaceRange(u)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:l,scrollIntoView:!0})}function wce(e,t,n,r){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==s&&e.length==t.length)return null;let o=e.length,l=t.length;for(;o>0&&l>0&&e.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(r=="end"){let c=Math.max(0,i-Math.min(o,l));n-=o+c-i}if(o<i&&e.length<t.length){let c=n<=i&&n>=o?i-n:0;i-=c,l=i+(l-o),o=i}else if(l<i){let c=n<=i&&n>=l?i-n:0;i-=c,o=i+(o-l),l=i}return{from:i,toA:o,toB:l}}function GFe(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new HW(n,r)),(s!=n||i!=r)&&t.push(new HW(s,i))),t}function KFe(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?ht.single(n+t,r+t):null}function i3(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class YFe{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,An.safari&&t.contentDOM.addEventListener("input",()=>null),An.gecko&&uqe(t.contentDOM.ownerDocument)}handleEvent(t){!rqe(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let r=this.handlers[t];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=XFe(t),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,l=r[i];l&&o!=!l.handlers.length&&(s.removeEventListener(i,this.handleEvent),l=null),l||s.addEventListener(i,this.handleEvent,{passive:o})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&kce.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),An.android&&An.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return An.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=xce.find(r=>r.keyCode==t.keyCode))&&!t.ctrlKey||QFe.indexOf(t.key)>-1&&t.ctrlKey)?(this.pendingIOSKey=n||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,iy(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:An.safari&&!An.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function UW(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){fc(n.state,s)}}}function XFe(e){let t=Object.create(null);function n(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of e){let s=r.spec,i=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(i)for(let l in i){let c=i[l];c&&n(l).handlers.push(UW(r.value,c))}if(o)for(let l in o){let c=o[l];c&&n(l).observers.push(UW(r.value,c))}}for(let r in yd)n(r).handlers.push(yd[r]);for(let r in wc)n(r).observers.push(wc[r]);return t}const xce=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],QFe="dthko",kce=[16,17,18,20,91,92,224,225],q2=6;function H2(e){return Math.max(0,e)*.7+8}function JFe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class ZFe{constructor(t,n,r,s){this.view=t,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Wle(t.contentDOM),this.atoms=t.state.facet(z_).map(o=>o(t));let i=t.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(gs.allowMultipleSelections)&&eqe(t,n),this.dragging=nqe(t,n)&&Cce(n)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&JFe(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,s=0,i=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=eP(this.view);t.clientX-c.left<=s+q2?n=-H2(s-t.clientX):t.clientX+c.right>=o-q2&&(n=H2(t.clientX-o)),t.clientY-c.top<=i+q2?r=-H2(i-t.clientY):t.clientY+c.bottom>=l-q2&&(r=H2(t.clientY-l)),this.setScrollSpeed(n,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,r=bce(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function eqe(e,t){let n=e.state.facet(tce);return n.length?n[0](t):An.mac?t.metaKey:t.ctrlKey}function tqe(e,t){let n=e.state.facet(nce);return n.length?n[0](t):An.mac?!t.altKey:!t.ctrlKey}function nqe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Ok(e.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function rqe(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=bo.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const yd=Object.create(null),wc=Object.create(null),_ce=An.ie&&An.ie_version<15||An.ios&&An.webkit_version<604;function sqe(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),Sce(e,n.value)},50)}function x6(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Sce(e,t){t=x6(e.state,XL,t);let{state:n}=e,r,s=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(jM!=null&&n.selection.ranges.every(c=>c.empty)&&jM==i.toString()){let c=-1;r=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let f=n.toText((o?i.line(s++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:f},range:ht.cursor(u.from+f.length)}})}else o?r=n.changeByRange(c=>{let u=i.line(s++);return{changes:{from:c.from,to:c.to,insert:u.text},range:ht.cursor(c.from+u.length)}}):r=n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}wc.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};wc.wheel=wc.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};yd.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);wc.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};wc.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};yd.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(rce))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=oqe(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new ZFe(e,t,n,r)),r&&e.observer.ignore(()=>{Vle(e.contentDOM);let i=e.root.activeElement;i&&!i.contains(e.contentDOM)&&i.blur()});let s=e.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function WW(e,t,n,r){if(r==1)return ht.cursor(t,n);if(r==2)return PFe(e.state,t,n);{let s=e.docView.lineAt(t,n),i=e.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:i.from,l=s?s.posAtEnd:i.to;return l<e.state.doc.length&&l==i.to&&l++,ht.range(o,l)}}const iqe=An.ie&&An.ie_version<=11;let VW=null,GW=0,KW=0;function Cce(e){if(!iqe)return e.detail;let t=VW,n=KW;return VW=e,KW=Date.now(),GW=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(GW+1)%3:1}function oqe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Cce(t),s=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,o,l){let c=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),u,d=WW(e,c.pos,c.assoc,r);if(n.pos!=c.pos&&!o){let f=WW(e,n.pos,n.assoc,r),m=Math.min(f.from,d.from),p=Math.max(f.to,d.to);d=m<d.from?ht.range(m,p,d.assoc):ht.range(p,m,d.assoc)}return o?s.replaceRange(s.main.extend(d.from,d.to,d.assoc)):l&&r==1&&s.ranges.length>1&&(u=aqe(s,c.pos))?u:l?s.addRange(d):ht.create([d])}}}function aqe(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:s}=e.ranges[n];if(r<=t&&s>=t)return ht.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}yd.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let s=e.docView.tile.nearest(t.target);if(s&&s.isWidget()){let i=s.posAtStart,o=i+s.length;(i>=n.to||o<=n.from)&&(n=ht.range(i,o))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",x6(e.state,QL,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};yd.dragend=e=>(e.inputState.draggedContent=null,!1);function YW(e,t,n,r){if(n=x6(e.state,XL,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=r&&i&&tqe(e,t)?{from:i.from,to:i.to}:null,l={from:s,insert:n},c=e.state.changes(o?[o,l]:l);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}yd.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&YW(e,t,r.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let l=new FileReader;l.onerror=i,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),i()},l.readAsText(n[o])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return YW(e,t,r,!0),!0}return!1};yd.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=_ce?null:t.clipboardData;return n?(Sce(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(sqe(e),!1)};function lqe(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function cqe(e){let t=[],n=[],r=!1;for(let s of e.selection.ranges)s.empty||(t.push(e.sliceDoc(s.from,s.to)),n.push(s));if(!t.length){let s=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>s&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),s=o.number}r=!0}return{text:x6(e,QL,t.join(e.lineBreak)),ranges:n,linewise:r}}let jM=null;yd.copy=yd.cut=(e,t)=>{if(!Wx(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=cqe(e.state);if(!n&&!s)return!1;jM=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=_ce?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(lqe(e,n),!1)};const Tce=um.define();function Ece(e,t){let n=[];for(let r of e.facet(oce)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:Tce.of(!0)}):null}function Ace(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Ece(e.state,t);n?e.dispatch(n):e.update([])}},10)}wc.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Ace(e)};wc.blur=e=>{e.observer.clearSelectionRange(),Ace(e)};wc.compositionstart=wc.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};wc.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,An.chrome&&An.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};wc.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};yd.beforeinput=(e,t)=>{var n,r;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let i=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let l=o[0],c=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return tP(e,{from:c,to:u,insert:e.state.toText(i)},null),!0}}let s;if(An.chrome&&An.android&&(s=xce.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return An.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),An.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>wc.compositionend(e,t),20),!1};const XW=new Set;function uqe(e){XW.has(e)||(XW.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const QW=["pre-wrap","normal","pre-line","break-spaces"];let Py=!1;function JW(){Py=!1}class dqe{constructor(t){this.lineWrapping=t,this.doc=As.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return QW.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let r=0;r<t.length;r++){let s=t[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(t,n,r,s,i,o){let l=QW.indexOf(t)>-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let u=0;u<o.length;u++){let d=o[u];d<0?u++:this.heightSamples[Math.floor(d*10)]=!0}}return c}}class hqe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class cd{constructor(t,n,r,s,i){this.from=t,this.length=n,this.top=r,this.height=s,this._content=i}get type(){return typeof this._content=="number"?dl.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Wg?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new cd(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Ci=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Ci||(Ci={}));const f4=.001;class Xl{constructor(t,n,r=2){this.length=t,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>f4&&(Py=!0),this.height=t)}replace(t,n,r){return Xl.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,s){let i=this,o=r.doc;for(let l=s.length-1;l>=0;l--){let{fromA:c,toA:u,fromB:d,toB:f}=s[l],m=i.lineAt(c,Ci.ByPosNoHeight,r.setDoc(n),0,0),p=m.to>=u?m:i.lineAt(u,Ci.ByPosNoHeight,r,0,0);for(f+=p.to-u,u=p.to;l>0&&m.from<=s[l-1].toA;)c=s[l-1].fromA,d=s[l-1].fromB,l--,c<m.from&&(m=i.lineAt(c,Ci.ByPosNoHeight,r,0,0));d+=m.from-c,c=m.from;let g=nP.build(r.setDoc(o),t,d,f);i=o3(i,i.replace(c,u,g))}return i.updateHeight(r,0)}static empty(){return new $c(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,s=0,i=0;for(;;)if(n==r)if(s>i*2){let l=t[n-1];l.break?t.splice(--n,1,l.left,null,l.right):t.splice(--n,1,l.left,l.right),r+=1+l.break,s-=l.size}else if(i>s*2){let l=t[r];l.break?t.splice(r,1,l.left,null,l.right):t.splice(r,1,l.left,l.right),r+=2+l.break,i-=l.size}else break;else if(s<i){let l=t[n++];l&&(s+=l.size)}else{let l=t[--r];l&&(i+=l.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,r++),new mqe(Xl.of(t.slice(0,n)),o,Xl.of(t.slice(r)))}}function o3(e,t){return e==t?e:(e.constructor!=t.constructor&&(Py=!0),t)}Xl.prototype.size=1;const fqe=Un.replace({});class jce extends Xl{constructor(t,n,r){super(t,n),this.deco=r,this.spaceAbove=0}mainBlock(t,n){return new cd(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,n,r,s){return this.spaceAbove&&t<r+this.spaceAbove?new cd(s,0,r,this.spaceAbove,fqe):this.mainBlock(r,s)}lineAt(t,n,r,s,i){let o=this.mainBlock(s,i);return this.spaceAbove?this.blockAt(0,r,s,i).join(o):o}forEachLine(t,n,r,s,i,o){t<=i+this.length&&n>=i&&o(this.lineAt(0,Ci.ByPos,r,s,i))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class $c extends jce{constructor(t,n,r){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(t,n){return new cd(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let s=r[0];return r.length==1&&(s instanceof $c||s instanceof nl&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof nl?s=new $c(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Xl.of(r)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class nl extends Xl{constructor(t){super(t,0)}heightMetrics(t,n){let r=t.doc.lineAt(n).number,s=t.doc.lineAt(n+this.length).number,i=s-r+1,o,l=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*i);o=c/i,this.length>i+1&&(l=(this.height-c)/(this.length-i-1))}else o=this.height/i;return{firstLine:r,lastLine:s,perLine:o,perChar:l}}blockAt(t,n,r,s){let{firstLine:i,lastLine:o,perLine:l,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let u=s+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length)),d=n.doc.lineAt(u),f=l+d.length*c,m=Math.max(r,t-f/2);return new cd(d.from,d.length,m,f,0)}else{let u=Math.max(0,Math.min(o-i,Math.floor((t-r)/l))),{from:d,length:f}=n.doc.line(i+u);return new cd(d,f,r+l*u,l,0)}}lineAt(t,n,r,s,i){if(n==Ci.ByHeight)return this.blockAt(t,r,s,i);if(n==Ci.ByPosNoHeight){let{from:p,to:g}=r.doc.lineAt(t);return new cd(p,g-p,0,0,0)}let{firstLine:o,perLine:l,perChar:c}=this.heightMetrics(r,i),u=r.doc.lineAt(t),d=l+u.length*c,f=u.number-o,m=s+l*f+c*(u.from-i-f);return new cd(u.from,u.length,Math.max(s,Math.min(m,s+this.height-d)),d,0)}forEachLine(t,n,r,s,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:l,perLine:c,perChar:u}=this.heightMetrics(r,i);for(let d=t,f=s;d<=n;){let m=r.doc.lineAt(d);if(d==t){let g=m.number-l;f+=c*g+u*(t-i-g)}let p=c+u*m.length;o(new cd(m.from,m.length,f,p,0)),f+=p,d=m.to+1}}replace(t,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof nl?r[r.length-1]=new nl(i.length+s):r.push(null,new nl(s-1))}if(t>0){let i=r[0];i instanceof nl?r[0]=new nl(t+i.length):r.unshift(new nl(t-1),null)}return Xl.of(r)}decomposeLeft(t,n){n.push(new nl(t-1),null)}decomposeRight(t,n){n.push(null,new nl(this.length-t-1))}updateHeight(t,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let o=[],l=Math.max(n,s.from),c=-1;for(s.from>n&&o.push(new nl(s.from-n-1).updateHeight(t,n));l<=i&&s.more;){let d=t.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],m=0;f<0&&(m=-f,f=s.heights[s.index++]),c==-1?c=f:Math.abs(f-c)>=f4&&(c=-2);let p=new $c(d,f,m);p.outdated=!1,o.push(p),l+=d+1}l<=i&&o.push(null,new nl(i-l).updateHeight(t,l));let u=Xl.of(o);return(c<0||Math.abs(u.height-this.height)>=f4||Math.abs(c-this.heightMetrics(t,n).perLine)>=f4)&&(Py=!0),o3(this,u)}else(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class mqe extends Xl{constructor(t,n,r){super(t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,n,r,s){let i=r+this.left.height;return t<i?this.left.blockAt(t,n,r,s):this.right.blockAt(t,n,i,s+this.left.length+this.break)}lineAt(t,n,r,s,i){let o=s+this.left.height,l=i+this.left.length+this.break,c=n==Ci.ByHeight?t<o:t<l,u=c?this.left.lineAt(t,n,r,s,i):this.right.lineAt(t,n,r,o,l);if(this.break||(c?u.to<l:u.from>l))return u;let d=n==Ci.ByPosNoHeight?Ci.ByPosNoHeight:Ci.ByPos;return c?u.join(this.right.lineAt(l,d,r,o,l)):this.left.lineAt(l,d,r,s,i).join(u)}forEachLine(t,n,r,s,i,o){let l=s+this.left.height,c=i+this.left.length+this.break;if(this.break)t<c&&this.left.forEachLine(t,n,r,s,i,o),n>=c&&this.right.forEachLine(t,n,r,l,c,o);else{let u=this.lineAt(c,Ci.ByPos,r,s,i);t<u.from&&this.left.forEachLine(t,u.from-1,r,s,i,o),u.to>=t&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,c,o)}}replace(t,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(t,n,r),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,n-s,r));let i=[];t>0&&this.decomposeLeft(t,i);let o=i.length;for(let l of r)i.push(l);if(t>0&&ZW(i,o-1),n<this.length){let l=i.length;this.decomposeRight(n,i),ZW(i,l)}return Xl.of(i)}decomposeLeft(t,n){let r=this.left.length;if(t<=r)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(r++,t>=r&&n.push(null)),t>r&&this.right.decomposeLeft(t-r,n)}decomposeRight(t,n){let r=this.left.length,s=r+this.break;if(t>=s)return this.right.decomposeRight(t-s,n);t<r&&this.left.decomposeRight(t,n),this.break&&t<s&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?Xl.of(this.break?[t,null,n]:[t,n]):(this.left=o3(this.left,t),this.right=o3(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,r=!1,s){let{left:i,right:o}=this,l=n+i.length+this.break,c=null;return s&&s.from<=n+i.length&&s.more?c=i=i.updateHeight(t,n,r,s):i.updateHeight(t,n,r),s&&s.from<=l+o.length&&s.more?c=o=o.updateHeight(t,l,r,s):o.updateHeight(t,l,r),c?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ZW(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof nl&&(r=e[t+1])instanceof nl&&e.splice(t-1,3,new nl(n.length+1+r.length))}const pqe=5;class nP{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof $c?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new $c(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,r){if(t<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=n-t;r.block?this.addBlock(new jce(o,s,r)):(o||i||s>=pqe)&&this.addLineDeco(s,i,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new $c(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new nl(n-t);return this.oracle.doc.lineAt(t).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof $c)return t;let n=new $c(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof $c)&&!this.isCovered?this.nodes.push(new $c(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=t;for(let s of this.nodes)s instanceof $c&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let i=new nP(r,t);return ss.spans(n,r,s,i,0),i.finish(r)}}function gqe(e,t,n){let r=new bqe;return ss.compare(e,t,n,r,0),r.changes}class bqe{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,r,s){(t<n||r&&r.heightRelevant||s&&s.heightRelevant)&&sy(t,n,this.changes,5)}}function yqe(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),o=Math.min(s.innerWidth,n.right),l=Math.max(0,n.top),c=Math.min(s.innerHeight,n.bottom);for(let u=e.parentNode;u&&u!=r.body;)if(u.nodeType==1){let d=u,f=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&f.overflow!="visible"){let m=d.getBoundingClientRect();i=Math.max(i,m.left),o=Math.min(o,m.right),l=Math.max(l,m.top),c=Math.min(u==e.parentNode?s.innerHeight:c,m.bottom)}u=f.position=="absolute"||f.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:l-(n.top+t),bottom:Math.max(l,c)-(n.top+t)}}function vqe(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function wqe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class fj{constructor(t,n,r,s){this.from=t,this.to=n,this.size=r,this.displaySize=s}static same(t,n){if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++){let s=t[r],i=n[r];if(s.from!=i.from||s.to!=i.to||s.size!=i.size)return!1}return!0}draw(t,n){return Un.replace({widget:new xqe(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class xqe extends ou{constructor(t,n){super(),this.size=t,this.vertical=n}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class eV{constructor(t,n){this.view=t,this.state=n,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=tV,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=wi.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(JL).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new dqe(r),this.stateDeco=nV(n),this.heightMap=Xl.empty().applyChanges(this.stateDeco,As.empty,this.heightOracle.setDoc(n.doc),[new ju(0,0,0,n.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Un.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!t.some(({from:i,to:o})=>s>=i&&s<=o)){let{from:i,to:o}=this.lineBlockAt(s);t.push(new U2(i,o))}}return this.viewports=t.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?tV:new rP(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(ux(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=nV(this.state);let s=t.changedRanges,i=ju.extendWithRanges(s,gqe(r,this.stateDeco,t?t.changes:da.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);JW(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||Py)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let c=i.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.head<c.from||n.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,t.flags|=this.updateForViewport(),(u||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(lce)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?wi.RTL:wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),c=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,d=0;if(l.width&&l.height){let{scaleX:S,scaleY:T}=Ule(n,l);(S>.005&&Math.abs(this.scaleX-S)>.005||T>.005&&Math.abs(this.scaleY-T)>.005)&&(this.scaleX=S,this.scaleY=T,u|=16,o=c=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,m=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=m)&&(this.paddingTop=f,this.paddingBottom=m,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let p=Wle(this.view.contentDOM,!1).y;p!=this.scrollParent&&(this.scrollParent=p,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=Gle(this.scrollParent||t.win);let b=(this.printing?wqe:yqe)(n,this.paddingTop),w=b.top-this.pixelViewport.top,y=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(c=!0)),!this.inView&&!this.scrollTarget&&!vqe(t.dom))return 0;let x=l.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let S=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(S)&&(o=!0),o||s.lineWrapping&&Math.abs(x-this.contentDOMWidth)>s.charWidth){let{lineHeight:T,charWidth:_,textHeight:C}=t.docView.measureTextSize();o=T>0&&s.refresh(i,T,_,C,Math.max(5,x/_),S),o&&(t.docView.minWidth=0,u|=16)}w>0&&y>0?d=Math.max(w,y):w<0&&y<0&&(d=Math.min(w,y)),JW();for(let T of this.viewports){let _=T.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(T);this.heightMap=(o?Xl.empty().applyChanges(this.stateDeco,As.empty,this.heightOracle,[new ju(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new hqe(T.from,_))}Py&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,c=new U2(s.lineAt(o-r*1e3,Ci.ByHeight,i,0,0).from,s.lineAt(l+(1-r)*1e3,Ci.ByHeight,i,0,0).to);if(n){let{head:u}=n.range;if(u<c.from||u>c.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(u,Ci.ByPos,i,0,0),m;n.y=="center"?m=(f.top+f.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u<c.from?m=f.top:m=f.bottom-d,c=new U2(s.lineAt(m-1e3/2,Ci.ByHeight,i,0,0).from,s.lineAt(m+d+1e3/2,Ci.ByHeight,i,0,0).to)}}return c}mapViewport(t,n){let r=n.mapPos(t.from,-1),s=n.mapPos(t.to,1);return new U2(this.heightMap.lineAt(r,Ci.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ci.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,Ci.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Ci.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(t==0||s<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=l+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&i<l+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let r=[];for(let s of t)n.touchesRange(s.from,s.to)||r.push(new fj(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(t,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,i=s>>1,o=s<<1;if(this.defaultTextDirection!=wi.LTR&&!r)return[];let l=[],c=(d,f,m,p)=>{if(f-d<i)return;let g=this.state.selection.main,b=[g.from];g.empty||b.push(g.to);for(let y of b)if(y>d&&y<f){c(d,y-10,m,p),c(y+10,f,m,p);return}let w=_qe(t,y=>y.from>=m.from&&y.to<=m.to&&Math.abs(y.from-d)<i&&Math.abs(y.to-f)<i&&!b.some(v=>y.from<v&&y.to>v));if(!w){if(f<m.to&&n&&r&&n.visibleRanges.some(x=>x.from<=f&&x.to>=f)){let x=n.moveToLineBoundary(ht.cursor(f),!1,!0).head;x>d&&(f=x)}let y=this.gapSize(m,d,f,p),v=r||y<2e6?y:2e6;w=new fj(d,f,y,v)}l.push(w)},u=d=>{if(d.length<o||d.type!=dl.Text)return;let f=kqe(d.from,d.to,this.stateDeco);if(f.total<o)return;let m=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(r){let b=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,w,y;if(m!=null){let v=V2(f,m),x=((this.visibleBottom-this.visibleTop)/2+b)/d.height;w=v-x,y=v+x}else w=(this.visibleTop-d.top-b)/d.height,y=(this.visibleBottom-d.top+b)/d.height;p=W2(f,w),g=W2(f,y)}else{let b=f.total*this.heightOracle.charWidth,w=s*this.heightOracle.charWidth,y=0;if(b>2e6)for(let T of t)T.from>=d.from&&T.from<d.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=T.size-T.displaySize);let v=this.pixelViewport.left+y,x=this.pixelViewport.right+y,k,S;if(m!=null){let T=V2(f,m),_=((x-v)/2+w)/b;k=T-_,S=T+_}else k=(v-w)/b,S=(x+w)/b;p=W2(f,k),g=W2(f,S)}p>d.from&&c(d.from,p,d,f),g<d.to&&c(g,d.to,d,f)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(u):u(d);return l}gapSize(t,n,r,s){let i=V2(s,r)-V2(s,n);return this.heightOracle.lineWrapping?t.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(t){fj.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Un.set(t.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];ss.spans(n,this.viewport.from,this.viewport.to,{span(i,o){r.push({from:i,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i<r.length&&!(s&8);i++){let o=this.visibleRanges[i],l=r[i];(o.from!=l.from||o.to!=l.to)&&(s|=4,t&&t.mapPos(o.from,-1)==l.from&&t.mapPos(o.to,1)==l.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||ux(this.heightMap.lineAt(t,Ci.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=t&&n.bottom>=t)||ux(this.heightMap.lineAt(this.scaler.fromDOM(t),Ci.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let n=this.lineBlockAtHeight(t+8);return n.from>=this.viewport.from||this.viewportLines[0].top-t>200?n:this.viewportLines[0]}elementAtHeight(t){return ux(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class U2{constructor(t,n){this.from=t,this.to=n}}function kqe(e,t,n){let r=[],s=e,i=0;return ss.spans(n,e,t,{span(){},point(o,l){o>s&&(r.push({from:s,to:o}),i+=o-s),s=l}},20),s<t&&(r.push({from:s,to:t}),i+=t-s),{total:i,ranges:r}}function W2({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let s=0;;s++){let{from:i,to:o}=t[s],l=o-i;if(r<=l)return i+r;r-=l}}function V2(e,t){let n=0;for(let{from:r,to:s}of e.ranges){if(t<=s){n+=t-r;break}n+=s-r}return n/e.total}function _qe(e,t){for(let n of e)if(t(n))return n}const tV={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function nV(e){let t=e.facet(y6).filter(r=>typeof r!="function"),n=e.facet(ZL).filter(r=>typeof r!="function");return n.length&&t.push(ss.join(n)),t}class rP{constructor(t,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:l,to:c})=>{let u=n.lineAt(l,Ci.ByPos,t,0,0).top,d=n.lineAt(c,Ci.ByPos,t,0,0).bottom;return s+=d-u,{from:l,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let l of this.viewports)l.domTop=o+(l.top-i)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),i=l.bottom}toDOM(t){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return s+(t-r)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);r=i.bottom,s=i.domBottom}}fromDOM(t){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return r+(t-s)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);r=i.bottom,s=i.domBottom}}eq(t){return t instanceof rP?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,r)=>n.from==t.viewports[r].from&&n.to==t.viewports[r].to):!1}}function ux(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new cd(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>ux(s,t)):e._content)}const G2=jn.define({combine:e=>e.join(" ")}),NM=jn.define({combine:e=>e.indexOf(!0)>-1}),IM=Gp.newName(),Nce=Gp.newName(),Ice=Gp.newName(),Mce={"&light":"."+Nce,"&dark":"."+Ice};function MM(e,t,n){return new Gp(t,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return e;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):e+" "+r}})}const Sqe=MM("."+IM,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Mce),Cqe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},mj=An.ie&&An.ie_version<=11;class Tqe{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new nFe,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(An.ie&&An.ie_version<=11||An.ios&&t.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&An.android&&t.constructor.EDIT_CONTEXT!==!1&&!(An.chrome&&An.chrome_version<126)&&(this.editContext=new Aqe(t),t.state.facet(pf)&&(t.contentDOM.editContext=this.editContext.editContext)),mj&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,r)=>n!=t[r]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(pf)?r.root.activeElement!=this.dom:!Wx(this.dom,s))return;let i=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(An.ie&&An.ie_version<=11||An.android&&An.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Gx(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Ok(t.root);if(!n)return!1;let r=An.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&Eqe(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Wx(this.dom,r);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&sFe(this.dom,r)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(t,n){this.selectionRange.set(t.node,t.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&t<this.scrollTargets.length&&this.scrollTargets[t]==r?t++:n||(n=this.scrollTargets.slice(0,t)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(t<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,t)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Cqe),mj&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),mj&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,n){var r;if(!this.delayedAndroidKey){let s=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&iy(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of t){let o=this.readMutation(i);o&&(o.typeOver&&(s=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:t,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Wx(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new WFe(this.view,t,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=vce(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!i3(this.view.state.selection,n.newSel.main))&&this.view.update([]),s}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let r=rV(n,t.previousSibling||t.target.previousSibling,-1),s=rV(n,t.nextSibling||t.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(pf)!=t.state.facet(pf)&&(t.view.contentDOM.editContext=t.state.facet(pf)?this.editContext.editContext:null))}destroy(){var t,n,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function rV(e,t,n){for(;t;){let r=bo.get(t);if(r&&r.parent==e)return r;let s=t.parentNode;t=s!=e.dom?s:n>0?t.nextSibling:t.previousSibling}return null}function sV(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return Gx(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function Eqe(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return sV(e,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?sV(e,n):null}class Aqe{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=r=>{let s=t.state.selection.main,{anchor:i,head:o}=s,l=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let u=c-l>r.text.length;l==this.from&&i<this.from?l=i:c==this.to&&i>this.to&&(c=i);let d=wce(t.state.sliceDoc(l,c),r.text,(u?s.from:s.to)-l,u?"end":null);if(!d){let m=ht.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));i3(m,s)||t.dispatch({selection:m,userEvent:"select"});return}let f={from:d.from+l,to:d.toA+l,insert:As.of(r.text.slice(d.from,d.toB).split(`
`))};if((An.mac||An.android)&&f.from==o-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:c,insert:As.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let m=this.to-this.from+(f.to-f.from+f.insert.length);tP(t,f,ht.single(this.toEditorPos(r.selectionStart,m),this.toEditorPos(r.selectionEnd,m)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from<f.to&&!f.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let o=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);o<l;o++){let c=t.coordsForChar(o);i=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||i||new DOMRect,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.getTextFormats()){let o=i.underlineStyle,l=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let c=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);if(c<u){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(Un.mark({attributes:{style:d}}).range(c,u))}}}t.dispatch({effects:uce.of(Un.set(s))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(t.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Ok(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,r=!1,s=this.pendingContextChange;return t.changes.iterChanges((i,o,l,c,u)=>{if(r)return;let d=u.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(u)){s=this.pendingContextChange=null,n+=d,this.to+=d;return}else s=null,this.revertPending(t.state);if(i+=n,o+=n,o<=this.from)this.from+=d,this.to+=d;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),u.toString()),this.to+=d}n+=d}),s&&!r&&this.revertPending(t.state),!r}update(t){let n=this.pendingContextChange,r=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(r.from,r.to)&&t.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to<t.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let r=this.composing;return r&&r.drifted?r.editorBase+(t-r.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class en{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:r}=t;this.dispatchTransactions=t.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||rFe(t.parent)||document,this.viewState=new eV(this,t.state||gs.create(t)),t.scrollTo&&t.scrollTo.is(F2)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Lb).map(s=>new lj(s));for(let s of this.plugins)s.update(this);this.observer=new Tqe(this),this.inputState=new YFe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new FW(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let n=t.length==1&&t[0]instanceof fa?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let m of t){if(m.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=m.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,l=0,c=null;t.some(m=>m.annotation(Tce))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Ece(i,o),c||(l=1));let u=this.observer.delayedAndroidKey,d=null;if(u?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(d=null)):this.observer.clear(),i.facet(gs.phrases)!=this.state.facet(gs.phrases))return this.setState(i);s=n3.create(this,i,t),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let m of t){if(f&&(f=f.map(m.changes)),m.scrollIntoView){let{main:p}=m.state.selection,{x:g,y:b}=this.state.facet(en.cursorScrollMargin);f=new oy(p.empty?p:ht.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",b,g)}for(let p of m.effects)p.is(F2)&&(f=p.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=a3.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(cx)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(m=>m.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(G2)!=s.state.facet(G2)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let m of this.state.facet(CM))try{m(s)}catch(p){fc(this.state,p,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!vce(this,d)&&u.force&&iy(this.contentDOM,u.key,u.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new eV(this,t),this.plugins=t.facet(Lb).map(r=>new lj(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new FW(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet(Lb),r=t.state.facet(Lb);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new lj(i));else{let l=this.plugins[o];l.mustUpdate=t,s.push(l)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let n=t.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){fc(this.state,r,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Gle(r||this.win))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);i=p.from,o=p.top}this.updateState=1;let c=this.viewState.measure();if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(p=>{try{return p.read(this)}catch(g){return fc(this.state,g),iV}}),f=n3.create(this,this.state,[]),m=!1;f.flags|=c,n?n.flags|=c:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),m=this.docView.update(f),m&&this.docViewUpdate());for(let p=0;p<u.length;p++)if(d[p]!=iV)try{let g=u[p];g.write&&g.write(d[p],this)}catch(g){fc(this.state,g)}if(m&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o)/this.scaleY;if((g>1||g<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+g,r?r.scrollTop+=g:this.win.scrollBy(0,g),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(CM))l(n)}get themeClasses(){return IM+" "+(this.state.facet(NM)?Ice:Nce)+" "+this.state.facet(G2)}updateAttrs(){let t=oV(this,dce,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(pf)?"true":"false",class:"cm-content",style:`${An.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),oV(this,JL,n);let r=this.observer.ignore(()=>{let s=LW(this.contentDOM,this.contentAttrs,n),i=LW(this.dom,this.editorAttrs,t);return s||i});return this.editorAttrs=t,this.contentAttrs=n,r}showAnnouncements(t){let n=!0;for(let r of t)for(let s of r.effects)if(s.is(en.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(cx);let t=this.state.facet(en.cspNonce);Gp.mount(this.root,this.styleModules.concat(Sqe).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key){this.measureRequests[n]=t;return}}this.measureRequests.push(t)}}plugin(t){let n=this.pluginMap.get(t);return(n===void 0||n&&n.plugin!=t)&&this.pluginMap.set(t,n=this.plugins.find(r=>r.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,r){return hj(this,t,qW(this,t,n,r))}moveByGroup(t,n){return hj(this,t,qW(this,t,n,r=>BFe(this,t.head,r)))}visualLineSide(t,n){let r=this.bidiSpans(t),s=this.textDirectionAt(t.from),i=r[n?r.length-1:0];return ht.cursor(i.side(n,s)+t.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(t,n,r=!0){return $Fe(this,t,n,r)}moveVertically(t,n,r){return hj(this,t,zFe(this,t,n,r))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let r=AM(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),AM(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.docView.coordsAt(t,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(t),i=this.bidiSpans(s),o=i[fh.find(i,t-s.from,-1,n)];return $k(r,o.dir==wi.LTR==n>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(ace)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>jqe)return Zle(t.length);let n=this.textDirectionAt(t.from),r;for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||Jle(i.isolates,r=$W(this,t))))return i.order;r||(r=$W(this,t));let s=dFe(t.text,n,r);return this.bidiCache.push(new a3(t.from,t.to,n,r,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||An.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Vle(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var r,s,i,o;return F2.of(new oy(typeof t=="number"?ht.cursor(t):t,(r=n.y)!==null&&r!==void 0?r:"nearest",(s=n.x)!==null&&s!==void 0?s:"nearest",(i=n.yMargin)!==null&&i!==void 0?i:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return F2.of(new oy(ht.cursor(r.from),"start","start",r.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return Ui.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Ui.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=Gp.newName(),s=[G2.of(r),cx.of(MM(`.${r}`,t))];return n&&n.dark&&s.push(NM.of(!0)),s}static baseTheme(t){return b0.lowest(cx.of(MM("."+IM,t,Mce)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),s=r&&bo.get(r)||bo.get(t);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}en.styleModule=cx;en.inputHandler=ice;en.clipboardInputFilter=XL;en.clipboardOutputFilter=QL;en.scrollHandler=cce;en.focusChangeEffect=oce;en.perLineTextDirection=ace;en.exceptionSink=sce;en.updateListener=CM;en.editable=pf;en.mouseSelectionStyle=rce;en.dragMovesSelection=nce;en.clickAddsSelectionRange=tce;en.decorations=y6;en.blockWrappers=hce;en.outerDecorations=ZL;en.atomicRanges=z_;en.bidiIsolatedRanges=fce;en.cursorScrollMargin=jn.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r=="number"?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}});en.scrollMargins=mce;en.darkTheme=NM;en.cspNonce=jn.define({combine:e=>e.length?e[0]:""});en.contentAttributes=JL;en.editorAttributes=dce;en.lineWrapping=en.contentAttributes.of({class:"cm-lineWrapping"});en.announce=Tr.define();const jqe=4096,iV={};class a3{constructor(t,n,r,s,i,o){this.from=t,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let r=[],s=t.length?t[t.length-1].dir:wi.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new a3(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function oV(e,t,n){for(let r=e.state.facet(t),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(e):i;o&&GL(o,n)}return n}const Nqe=An.mac?"mac":An.windows?"win":An.linux?"linux":"key";function Iqe(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,o,l;for(let c=0;c<n.length-1;++c){const u=n[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))s=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))t=="mac"?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),l&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function K2(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n!==!1&&t.shiftKey&&(e="Shift-"+e),e}const Mqe=b0.default(en.domEventHandlers({keydown(e,t){return Dce(Rce(t.state),e,t,"editor")}})),Oy=jn.define({enables:Mqe}),aV=new WeakMap;function Rce(e){let t=e.facet(Oy),n=aV.get(t);return n||aV.set(t,n=Lqe(t.reduce((r,s)=>r.concat(s),[]))),n}function Rqe(e,t,n){return Dce(Rce(e.state),t,e,n)}let Gm=null;const Dqe=4e3;function Lqe(e,t=Nqe){let n=Object.create(null),r=Object.create(null),s=(o,l)=>{let c=r[o];if(c==null)r[o]=l;else if(c!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,l,c,u,d)=>{var f,m;let p=n[o]||(n[o]=Object.create(null)),g=l.split(/ (?!$)/).map(y=>Iqe(y,t));for(let y=1;y<g.length;y++){let v=g.slice(0,y).join(" ");s(v,!0),p[v]||(p[v]={preventDefault:!0,stopPropagation:!1,run:[x=>{let k=Gm={view:x,prefix:v,scope:o};return setTimeout(()=>{Gm==k&&(Gm=null)},Dqe),!0}]})}let b=g.join(" ");s(b,!1);let w=p[b]||(p[b]={preventDefault:!1,stopPropagation:!1,run:((m=(f=p._any)===null||f===void 0?void 0:f.run)===null||m===void 0?void 0:m.slice())||[]});c&&w.run.push(c),u&&(w.preventDefault=!0),d&&(w.stopPropagation=!0)};for(let o of e){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let m in d)d[m].run.push(p=>f(p,RM))}let c=o[t]||o.key;if(c)for(let u of l)i(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return n}let RM=null;function Dce(e,t,n,r){RM=t;let s=Xze(t),i=uc(s,0),o=oh(i)==s.length&&s!=" ",l="",c=!1,u=!1,d=!1;Gm&&Gm.view==n&&Gm.scope==r&&(l=Gm.prefix+" ",kce.indexOf(t.keyCode)<0&&(u=!0,Gm=null));let f=new Set,m=w=>{if(w){for(let y of w.run)if(!f.has(y)&&(f.add(y),y(n)))return w.stopPropagation&&(d=!0),!0;w.preventDefault&&(w.stopPropagation&&(d=!0),u=!0)}return!1},p=e[r],g,b;return p&&(m(p[l+K2(s,t,!o)])?c=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(An.windows&&t.ctrlKey&&t.altKey)&&!(An.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=Kp[t.keyCode])&&g!=s?(m(p[l+K2(g,t,!0)])||t.shiftKey&&(b=Lk[t.keyCode])!=s&&b!=g&&m(p[l+K2(b,t,!1)]))&&(c=!0):o&&t.shiftKey&&m(p[l+K2(s,t,!0)])&&(c=!0),!c&&m(p._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),RM=null,c}class Ng{constructor(t,n,r,s,i){this.className=t,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,r){if(r.empty){let s=t.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=Lce(t);return[new Ng(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return Pqe(t,n,r)}}function Lce(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==wi.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function lV(e,t,n,r){let s=e.coordsAtPos(t,n*2);if(!s)return r;let i=e.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=e.posAtCoords({x:i.left+1,y:o}),c=e.posAtCoords({x:i.right-1,y:o});return l==null||c==null?r:{from:Math.max(r.from,Math.min(l,c)),to:Math.min(r.to,Math.max(l,c))}}function Pqe(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),s=Math.min(n.to,e.viewport.to),i=e.textDirection==wi.LTR,o=e.contentDOM,l=o.getBoundingClientRect(),c=Lce(e),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),f=l.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),m=l.right-(d?parseInt(d.paddingRight):0),p=EM(e,r,1),g=EM(e,s,-1),b=p.type==dl.Text?p:null,w=g.type==dl.Text?g:null;if(b&&(e.lineWrapping||p.widgetLineBreaks)&&(b=lV(e,r,1,b)),w&&(e.lineWrapping||g.widgetLineBreaks)&&(w=lV(e,s,-1,w)),b&&w&&b.from==w.from&&b.to==w.to)return v(x(n.from,n.to,b));{let S=b?x(n.from,null,b):k(p,!1),T=w?x(null,n.to,w):k(g,!0),_=[];return(b||p).to<(w||g).from-(b&&w?1:0)||p.widgetLineBreaks>1&&S.bottom+e.defaultLineHeight/2<T.top?_.push(y(f,S.bottom,m,T.top)):S.bottom<T.top&&e.elementAtHeight((S.bottom+T.top)/2).type==dl.Text&&(S.bottom=T.top=(S.bottom+T.top)/2),v(S).concat(_).concat(v(T))}function y(S,T,_,C){return new Ng(t,S-c.left,T-c.top,Math.max(0,_-S),C-T)}function v({top:S,bottom:T,horizontal:_}){let C=[];for(let j=0;j<_.length;j+=2)C.push(y(_[j],S,_[j+1],T));return C}function x(S,T,_){let C=1e9,j=-1e9,E=[];function L(R,$,B,N,z){let G=e.coordsAtPos(R,R==_.to?-2:2),I=e.coordsAtPos(B,B==_.from?2:-2);!G||!I||(C=Math.min(G.top,I.top,C),j=Math.max(G.bottom,I.bottom,j),z==wi.LTR?E.push(i&&$?f:G.left,i&&N?m:I.right):E.push(!i&&N?f:I.left,!i&&$?m:G.right))}let D=S??_.from,M=T??_.to;for(let R of e.visibleRanges)if(R.to>D&&R.from<M)for(let $=Math.max(R.from,D),B=Math.min(R.to,M);;){let N=e.state.doc.lineAt($);for(let z of e.bidiSpans(N)){let G=z.from+N.from,I=z.to+N.from;if(G>=B)break;I>$&&L(Math.max(G,$),S==null&&G<=D,Math.min(I,B),T==null&&I>=M,z.dir)}if($=N.to+1,$>=B)break}return E.length==0&&L(D,S==null,M,T==null,e.textDirection),{top:C,bottom:j,horizontal:E}}function k(S,T){let _=l.top+(T?S.top:S.bottom);return{top:_,bottom:_,horizontal:[]}}}function Oqe(e,t){return e.constructor==t.constructor&&e.eq(t)}class $qe{constructor(t,n){this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}update(t){t.startState.facet(m4)!=t.state.facet(m4)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,r=t.facet(m4);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:n}=this.view;(t!=this.scaleX||n!=this.scaleY)&&(this.scaleX=t,this.scaleY=n,this.dom.style.transform=`scale(${1/t}, ${1/n})`)}draw(t){if(t.length!=this.drawn.length||t.some((n,r)=>!Oqe(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of t)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=t,An.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const m4=jn.define();function Pce(e){return[Ui.define(t=>new $qe(t,e)),m4.of(e)]}const $y=jn.define({combine(e){return Lh(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function Oce(e={}){return[$y.of(e),Bqe,zqe,Fqe,lce.of(!0)]}function $ce(e){return e.startState.facet($y)!=e.state.facet($y)}const Bqe=Pce({above:!0,markers(e){let{state:t}=e,n=t.facet($y),r=[];for(let s of t.selection.ranges){let i=s==t.selection.main;if(s.empty||n.drawRangeCursor&&!(i&&An.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:ht.cursor(s.head,s.assoc);for(let c of Ng.forRange(e,o,l))r.push(c)}}return r},update(e,t){e.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=$ce(e);return n&&cV(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){cV(t.state,e)},class:"cm-cursorLayer"});function cV(e,t){t.style.animationDuration=e.facet($y).cursorBlinkRate+"ms"}const zqe=Pce({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let s of r)if(!s.empty)for(let i of Ng.forRange(e,"cm-selectionBackground",s))t.push(i);if(An.ios&&!n.empty&&e.state.facet($y).iosSelectionHandles){for(let s of Ng.forRange(e,"cm-selectionHandle cm-selectionHandle-start",ht.cursor(n.from,1)))t.push(s);for(let s of Ng.forRange(e,"cm-selectionHandle cm-selectionHandle-end",ht.cursor(n.to,1)))t.push(s)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||$ce(e)},class:"cm-selectionLayer"}),Fqe=b0.highest(en.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Bce=Tr.define({map(e,t){return e==null?null:t.mapPos(e)}}),dx=hl.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,r)=>r.is(Bce)?r.value:n,e)}}),qqe=Ui.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(dx);n==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(dx)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(dx),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(dx)!=e&&this.view.dispatch({effects:Bce.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Hqe(){return[dx,qqe]}function uV(e,t,n,r,s){t.lastIndex=0;for(let i=e.iterRange(n,r),o=n,l;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;l=t.exec(i.value);)s(o+l.index,l)}function Uqe(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(e.state.doc.lineAt(s).from,s-t),i=Math.min(e.state.doc.lineAt(i).to,i+t),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class Wqe{constructor(t){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:o=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(l,c,u,d)=>s(d,u,u+l[0].length,l,c);else if(typeof r=="function")this.addMatch=(l,c,u,d)=>{let f=r(l,c,u);f&&d(u,u+l[0].length,f)};else if(r)this.addMatch=(l,c,u,d)=>d(u,u+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(t){let n=new Ch,r=n.add.bind(n);for(let{from:s,to:i}of Uqe(t,this.maxLength))uV(t.state.doc,this.regexp,s,i,(o,l)=>this.addMatch(l,t,o,r));return n.finish()}updateDeco(t,n){let r=1e9,s=-1;return t.docChanged&&t.changes.iterChanges((i,o,l,c)=>{c>=t.view.viewport.from&&l<=t.view.viewport.to&&(r=Math.min(l,r),s=Math.max(c,s))}),t.viewportMoved||s-r>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,n.map(t.changes),r,s):n}updateRange(t,n,r,s){for(let i of t.visibleRanges){let o=Math.max(i.from,r),l=Math.min(i.to,s);if(l>=o){let c=t.state.doc.lineAt(o),u=c.to<l?t.state.doc.lineAt(l):c,d=Math.max(i.from,c.from),f=Math.min(i.to,u.to);if(this.boundary){for(;o>c.from;o--)if(this.boundary.test(c.text[o-1-c.from])){d=o;break}for(;l<u.to;l++)if(this.boundary.test(u.text[l-u.from])){f=l;break}}let m=[],p,g=(b,w,y)=>m.push(y.range(b,w));if(c==u)for(this.regexp.lastIndex=d-c.from;(p=this.regexp.exec(c.text))&&p.index<f-c.from;)this.addMatch(p,t,p.index+c.from,g);else uV(t.state.doc,this.regexp,d,f,(b,w)=>this.addMatch(w,t,b,g));n=n.update({filterFrom:d,filterTo:f,filter:(b,w)=>b<d||w>f,add:m})}}return n}}const DM=/x/.unicode!=null?"gu":"g",Vqe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,DM),Gqe={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let pj=null;function Kqe(){var e;if(pj==null&&typeof document<"u"&&document.body){let t=document.body.style;pj=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return pj||!1}const p4=jn.define({combine(e){let t=Lh(e,{render:null,specialChars:Vqe,addSpecialChars:null});return(t.replaceTabs=!Kqe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,DM)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,DM)),t}});function zce(e={}){return[p4.of(e),Yqe()]}let dV=null;function Yqe(){return dV||(dV=Ui.fromClass(class{constructor(e){this.view=e,this.decorations=Un.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(p4)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Wqe({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:s}=n.state,i=uc(t[0],0);if(i==9){let o=s.lineAt(r),l=n.state.tabSize,c=Tv(o.text,l,r-o.from);return Un.replace({widget:new Zqe((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Un.replace({widget:new Jqe(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(p4);e.startState.facet(p4)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const Xqe="•";function Qqe(e){return e>=32?Xqe:e==10?"␤":String.fromCharCode(9216+e)}class Jqe extends ou{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=Qqe(this.code),r=t.state.phrase("Control character")+" "+(Gqe[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Zqe extends ou{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="	",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function eHe(){return nHe}const tHe=Un.line({class:"cm-activeLine"}),nHe=Ui.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let s=e.lineBlockAt(r.head);s.from>t&&(n.push(tHe.range(s.from)),t=s.from)}return Un.set(n)}},{decorations:e=>e.decorations});class rHe extends ou{constructor(t){super(),this.content=t}toDOM(t){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(t){let n=t.firstChild?Vx(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),s=$k(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function hV(e){let t=Ui.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Un.set([Un.widget({widget:new rHe(e),side:1}).range(0)]):Un.none}get decorations(){return this.view.state.doc.length?Un.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,en.contentAttributes.of({"aria-placeholder":e})]:t}const LM=2e3;function sHe(e,t,n){let r=Math.min(t.line,n.line),s=Math.max(t.line,n.line),i=[];if(t.off>LM||n.off>LM||t.col<0||n.col<0){let o=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let c=r;c<=s;c++){let u=e.doc.line(c);u.length<=l&&i.push(ht.range(u.from+o,u.to+l))}}else{let o=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let c=r;c<=s;c++){let u=e.doc.line(c),d=mM(u.text,o,e.tabSize,!0);if(d<0)i.push(ht.cursor(u.to));else{let f=mM(u.text,l,e.tabSize);i.push(ht.range(u.from+d,u.from+f))}}}return i}function iHe(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function fV(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),s=n-r.from,i=s>LM?-1:s==r.length?iHe(e,t.clientX):Tv(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function oHe(e,t){let n=fV(e,t),r=e.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),o=s.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(s.changes)}},get(s,i,o){let l=fV(e,s);if(!l)return r;let c=sHe(e.state,n,l);return c.length?o?ht.create(c.concat(r.ranges)):ht.create(c):r}}:null}function aHe(e){let t=n=>n.altKey&&n.button==0;return en.mouseSelectionStyle.of((n,r)=>t(r)?oHe(n,r):null)}const lHe={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},cHe={style:"cursor: crosshair"};function uHe(e={}){let[t,n]=lHe[e.key||"Alt"],r=Ui.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==t||n(s))},keyup(s){(s.keyCode==t||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,en.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?cHe:null})]}const Y2="-10000px";class Fce{constructor(t,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=r(o,i))}update(t,n){var r;let s=t.state.facet(this.facet),i=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(t);return!1}let o=[],l=n?[]:null;for(let c=0;c<i.length;c++){let u=i[c],d=-1;if(u){for(let f=0;f<this.tooltips.length;f++){let m=this.tooltips[f];m&&m.create==u.create&&(d=f)}if(d<0)o[c]=this.createTooltipView(u,c?o[c-1]:null),l&&(l[c]=!!u.above);else{let f=o[c]=this.tooltipViews[d];l&&(l[c]=n[d]),f.update&&f.update(t)}}}for(let c of this.tooltipViews)o.indexOf(c)<0&&(this.removeTooltipView(c),(r=c.destroy)===null||r===void 0||r.call(c));return n&&(l.forEach((c,u)=>n[u]=c),n.length=l.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function dHe(e={}){return g4.of(e)}function hHe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const g4=jn.define({combine:e=>{var t,n,r;return{position:An.ios?"absolute":((t=e.find(s=>s.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=e.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||hHe}}}),mV=new WeakMap,sP=Ui.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(g4);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Fce(e,iP,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(g4);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=Y2,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(e=r.destroy)===null||e===void 0||e.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(An.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=eP(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(g4).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=e,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let c=this.manager.tooltips[l],u=this.manager.tooltipViews[l],{dom:d}=u,f=e.pos[l],m=e.size[l];if(!f||c.clip!==!1&&(f.bottom<=Math.max(n.top,r.top)||f.top>=Math.min(n.bottom,r.bottom)||f.right<Math.max(n.left,r.left)-.1||f.left>Math.min(n.right,r.right)+.1)){d.style.top=Y2;continue}let p=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,b=m.right-m.left,w=(t=mV.get(u))!==null&&t!==void 0?t:m.bottom-m.top,y=u.offset||mHe,v=this.view.textDirection==wi.LTR,x=m.width>r.right-r.left?v?r.left:r.right-m.width:v?Math.max(r.left,Math.min(f.left-(p?14:0)+y.x,r.right-b)):Math.min(Math.max(r.left,f.left-b+(p?14:0)-y.x),r.right-b),k=this.above[l];!c.strictSide&&(k?f.top-w-g-y.y<r.top:f.bottom+w+g+y.y>r.bottom)&&k==r.bottom-f.bottom>f.top-r.top&&(k=this.above[l]=!k);let S=(k?f.top-r.top:r.bottom-f.bottom)-g;if(S<w&&u.resize!==!1){if(S<this.view.defaultLineHeight){d.style.top=Y2;continue}mV.set(u,w),d.style.height=(w=S)/i+"px"}else d.style.height&&(d.style.height="");let T=k?f.top-w-g-y.y:f.bottom+g+y.y,_=x+b;if(u.overlap!==!0)for(let C of o)C.left<_&&C.right>x&&C.top<T+w&&C.bottom>T&&(T=k?C.top-w-2-g:C.bottom+g+2);if(this.position=="absolute"?(d.style.top=(T-e.parent.top)/i+"px",pV(d,(x-e.parent.left)/s)):(d.style.top=T/i+"px",pV(d,x/s)),p){let C=f.left+(v?y.x:-y.x)-(x+14-7);p.style.left=C/s+"px"}u.overlap!==!0&&o.push({left:x,top:T,right:_,bottom:T+w}),d.classList.toggle("cm-tooltip-above",k),d.classList.toggle("cm-tooltip-below",!k),u.positioned&&u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=Y2}},{eventObservers:{scroll(){this.maybeMeasure()}}});function pV(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const fHe=en.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),mHe={x:0,y:0},iP=jn.define({enables:[sP,fHe]}),l3=jn.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class k6{static create(t){return new k6(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Fce(t,l3,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(t,n){let r=t.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let n of this.manager.tooltipViews)n.mount&&n.mount(t);this.mounted=!0}positioned(t){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let n of this.manager.tooltipViews)(t=n.destroy)===null||t===void 0||t.call(n)}passProp(t){let n;for(let r of this.manager.tooltipViews){let s=r[t];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const pHe=iP.compute([l3],e=>{let t=e.facet(l3);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:k6.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),qce=jn.define();class gHe{constructor(t,n,r,s,i,o){this.view=t,this.source=n,this.field=r,this.locked=s,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(t){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:n}=this,r=t.docView.tile.nearest(n.target);if(!r)return;let s,i=1;if(r.isWidget())s=r.posAtStart;else{if(s=t.posAtCoords(n),s==null)return;let o=t.coordsAtPos(s);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-t.defaultCharacterWidth||n.x>o.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(s)).find(u=>u.from<=s&&u.to>=s),c=l&&l.dir==wi.RTL?-1:1;i=n.x<o.left?-c:c}this.activateHover(t,s,i)}activateHover(t,n,r,s){let i=this.source(t,n,r),o=l=>{if(l&&!(Array.isArray(l)&&!l.length)){let c=Array.isArray(l)?l:[l];s&&this.locked.set(c,s),t.dispatch({effects:this.setHover.of(c)})}};if(i&&"then"in i){let l=this.pending={pos:n};i.then(c=>{this.pending==l&&(this.pending=null,o(c))},c=>fc(t.state,c,"hover tooltip"))}else o(i)}get tooltip(){let t=this.view.plugin(sP),n=t?t.manager.tooltips.findIndex(r=>r.create==k6.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&!this.locked.has(s)&&i&&!bHe(i.dom,t)||this.pending){let{pos:o}=s[0]||this.pending,l=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!yHe(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=r=>{t.removeEventListener("mouseleave",n);let{active:s}=this;s.length&&!this.locked.has(s)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const X2=4;function bHe(e,t){let{left:n,right:r,top:s,bottom:i}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),i=Math.max(l.bottom,i)}return t.clientX>=n-X2&&t.clientX<=r+X2&&t.clientY>=s-X2&&t.clientY<=i+X2}function yHe(e,t,n,r,s,i){let o=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>s||Math.min(o.bottom,l)<s)return!1;let c=e.posAtCoords({x:r,y:s},!1);return c>=t&&c<=n}function vHe(e,t={}){let n=Tr.define(),r=new WeakMap,s=hl.define({create(){return[]},update(o,l){let c=r.get(o);if(o.length&&(t.hideOnChange&&(l.docChanged||l.selection)?o=[]:c&&c(l)?o=[]:t.hideOn&&(o=o.filter(u=>!t.hideOn(l,u)))),l.docChanged&&o.length){let u=[];for(let d of o){let f=l.changes.mapPos(d.pos,-1,Ul.TrackDel);if(f!=null){let m=Object.assign(Object.create(null),d);m.pos=f,m.end!=null&&(m.end=l.changes.mapPos(m.end)),u.push(m)}}o=u}for(let u of l.effects)u.is(n)&&(o=u.value,c=void 0),(u.is(xHe)&&!u.value||u.value==s)&&(o=[]);return o.length&&c&&r.set(o,c),o},provide:o=>l3.from(o)});const i=Ui.define(o=>new gHe(o,e,s,r,n,t.hoverTime||300));return{active:s,extension:[s,i,qce.of(i),pHe]}}function wHe(e,t,n,r={}){var s;let i=e.state.facet(qce).map(o=>e.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=i.find(l=>l.field==r.tooltip.active);o&&(i=[o])}for(let o of i)o.activateHover(e,t,n,(s=r.until)!==null&&s!==void 0?s:()=>!1)}function Hce(e,t){let n=e.plugin(sP);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const xHe=Tr.define(),gV=jn.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function oP(e,t){let n=e.plugin(Uce),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const Uce=Ui.fromClass(class{constructor(e){this.input=e.state.facet(zk),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(gV);this.top=new Q2(e,!0,t.topContainer),this.bottom=new Q2(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(gV);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Q2(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Q2(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(zk);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],o=[],l=[];for(let c of r){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),l.push(d)):(d=this.panels[u],d.update&&d.update(e)),s.push(d),(d.top?i:o).push(d)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(o);for(let c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>en.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Q2{constructor(t,n,r){this.view=t,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let n of this.panels)n.destroy&&t.indexOf(n)<0&&n.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let t=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;t!=n.dom;)t=bV(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=bV(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function bV(e){let t=e.nextSibling;return e.remove(),t}const zk=jn.define({enables:Uce});function kHe(e,t){let n,r=new Promise(o=>n=o),s=o=>_He(o,t,n);e.state.field(gj,!1)?e.dispatch({effects:Wce.of(s)}):e.dispatch({effects:Tr.appendConfig.of(gj.init(()=>[s]))});let i=Vce.of(s);return{close:i,result:r.then(o=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(gj).indexOf(s)>-1&&e.dispatch({effects:i})}),o))}}const gj=hl.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(Wce)?e=[n.value].concat(e):n.is(Vce)&&(e=e.filter(r=>r!=n.value));return e},provide:e=>zk.computeN([e],t=>t.field(e))}),Wce=Tr.define(),Vce=Tr.define();function _He(e,t,n){let r=t.content?t.content(e,()=>o(null)):null;if(!r){if(r=ai("form"),t.input){let l=ai("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),r.appendChild(ai("label",(t.label||"")+": ",l))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(ai("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let s=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let l=0;l<s.length;l++){let c=s[l];c.addEventListener("keydown",u=>{u.keyCode==27?(u.preventDefault(),o(null)):u.keyCode==13&&(u.preventDefault(),o(c))}),c.addEventListener("submit",u=>{u.preventDefault(),o(c)})}let i=ai("div",r,ai("button",{onclick:()=>o(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(i.className=t.class),i.classList.add("cm-dialog");function o(l){i.contains(i.ownerDocument.activeElement)&&e.focus(),n(l)}return{dom:i,top:t.top,mount:()=>{if(t.focus){let l;typeof t.focus=="string"?l=r.querySelector(t.focus):l=r.querySelector("input")||r.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class Zf extends Vp{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Zf.prototype.elementClass="";Zf.prototype.toDOM=void 0;Zf.prototype.mapMode=Ul.TrackBefore;Zf.prototype.startSide=Zf.prototype.endSide=-1;Zf.prototype.point=!0;const b4=jn.define(),SHe=jn.define(),CHe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ss.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Yx=jn.define();function THe(e){return[Gce(),Yx.of({...CHe,...e})]}const yV=jn.define({combine:e=>e.some(t=>t)});function Gce(e){return[EHe]}const EHe=Ui.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Yx).map(t=>new wV(e,t)),this.fixed=!e.state.facet(yV);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(yV)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ss.iter(this.view.state.facet(b4),this.view.viewport.from),r=[],s=this.gutters.map(i=>new AHe(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let o=!0;for(let l of i.type)if(l.type==dl.Text&&o){PM(n,r,l.from);for(let c of s)c.line(this.view,l,r);o=!1}else if(l.widget)for(let c of s)c.widget(this.view,l)}else if(i.type==dl.Text){PM(n,r,i.from);for(let o of s)o.line(this.view,i,r)}else if(i.widget)for(let o of s)o.widget(this.view,i);for(let i of s)i.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Yx),n=e.state.facet(Yx),r=e.docChanged||e.heightChanged||e.viewportChanged||!ss.eq(e.startState.facet(b4),e.state.facet(b4),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let s of this.gutters)s.update(e)&&(r=!0);else{r=!0;let s=[];for(let i of n){let o=t.indexOf(i);o<0?s.push(new wV(this.view,i)):(this.gutters[o].update(e),s.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>en.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,s=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==wi.LTR?{left:r,right:s}:{right:r,left:s}})});function vV(e){return Array.isArray(e)?e:[e]}function PM(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class AHe{constructor(t,n,r){this.gutter=t,this.height=r,this.i=0,this.cursor=ss.iter(t.markers,n.from)}addElement(t,n,r){let{gutter:s}=this,i=(n.top-this.height)/t.scaleY,o=n.height/t.scaleY;if(this.i==s.elements.length){let l=new Kce(t,o,i,r);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(t,o,i,r);this.height=n.bottom,this.i++}line(t,n,r){let s=[];PM(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(t,n,s);i&&s.unshift(i);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(t,n,s)}widget(t,n){let r=this.gutter.config.widgetMarker(t,n.widget,n),s=r?[r]:null;for(let i of t.state.facet(SHe)){let o=i(t,n.widget,n);o&&(s||(s=[])).push(o)}s&&this.addElement(t,n,s)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class wV{constructor(t,n){this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let c=i.getBoundingClientRect();o=(c.top+c.bottom)/2}else o=s.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[r](t,l,s)&&s.preventDefault()});this.markers=vV(n.markers(t)),n.initialSpacer&&(this.spacer=new Kce(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let n=this.markers;if(this.markers=vV(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],t);s!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[s])}let r=t.view.viewport;return!ss.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class Kce{constructor(t,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,r,s)}update(t,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),jHe(this.markers,s)||this.setMarkers(t,s)}setMarkers(t,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,o=0;;){let l=o,c=i<n.length?n[i++]:null,u=!1;if(c){let d=c.elementClass;d&&(r+=" "+d);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(c)){l=f,u=!0;break}}else l=this.markers.length;for(;o<l;){let d=this.markers[o++];if(d.toDOM){d.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!c)break;c.toDOM&&(u?s=s.nextSibling:this.dom.insertBefore(c.toDOM(t),s)),u&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function jHe(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}const NHe=jn.define(),IHe=jn.define(),Pb=jn.define({combine(e){return Lh(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,n){let r=Object.assign({},t);for(let s in n){let i=r[s],o=n[s];r[s]=i?(l,c,u)=>i(l,c,u)||o(l,c,u):o}return r}})}});class bj extends Zf{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function yj(e,t){return e.state.facet(Pb).formatNumber(t,e.state)}const MHe=Yx.compute([Pb],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(NHe)},lineMarker(t,n,r){return r.some(s=>s.toDOM)?null:new bj(yj(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let s of t.state.facet(IHe)){let i=s(t,n,r);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet(Pb)!=t.state.facet(Pb),initialSpacer(t){return new bj(yj(t,xV(t.state.doc.lines)))},updateSpacer(t,n){let r=yj(n.view,xV(n.view.state.doc.lines));return r==t.number?t:new bj(r)},domEventHandlers:e.facet(Pb).domEventHandlers,side:"before"}));function RHe(e={}){return[Pb.of(e),Gce(),MHe]}function xV(e){let t=9;for(;t<e;)t=t*10+9;return t}const DHe=new class extends Zf{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},LHe=b4.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.head).from;s>n&&(n=s,t.push(DHe.range(s)))}return ss.of(t)});function PHe(){return LHe}const OHe=1024;let $He=0;class vj{constructor(t,n){this.from=t,this.to=n}}class ys{constructor(t={}){this.id=$He++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Wu.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}ys.closedBy=new ys({deserialize:e=>e.split(" ")});ys.openedBy=new ys({deserialize:e=>e.split(" ")});ys.group=new ys({deserialize:e=>e.split(" ")});ys.isolate=new ys({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});ys.contextHash=new ys({perNode:!0});ys.lookAhead=new ys({perNode:!0});ys.mounted=new ys({perNode:!0});class Xx{constructor(t,n,r,s=!1){this.tree=t,this.overlay=n,this.parser=r,this.bracketed=s}static get(t){return t&&t.props&&t.props[ys.mounted.id]}}const BHe=Object.create(null);class Wu{constructor(t,n,r,s=0){this.name=t,this.props=n,this.id=r,this.flags=s}static define(t){let n=t.props&&t.props.length?Object.create(null):BHe,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new Wu(t.name||"",n,t.id,r);if(t.props){for(let i of t.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(ys.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let r in t)for(let s of r.split(" "))n[s]=t[r];return r=>{for(let s=r.prop(ys.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}Wu.none=new Wu("",Object.create(null),0,8);const J2=new WeakMap,kV=new WeakMap;var No;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(No||(No={}));class cl{constructor(t,n,r,s,i){if(this.type=t,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,l]of i)this.props[typeof o=="number"?o:o.id]=l}}toString(){let t=Xx.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(t=0){return new $M(this.topNode,t)}cursorAt(t,n=0,r=0){let s=J2.get(this)||this.topNode,i=new $M(s);return i.moveTo(t,n),J2.set(this,i._tree),i}get topNode(){return new Qp(this,0,0,null)}resolve(t,n=0){let r=Fk(J2.get(this)||this.topNode,t,n,!1);return J2.set(this,r),r}resolveInner(t,n=0){let r=Fk(kV.get(this)||this.topNode,t,n,!0);return kV.set(this,r),r}resolveStack(t,n=0){return qHe(this,t,n)}iterate(t){let{enter:n,leave:r,from:s=0,to:i=this.length}=t,o=t.mode||0,l=(o&No.IncludeAnonymous)>0;for(let c=this.cursor(o|No.IncludeAnonymous);;){let u=!1;if(c.from<=i&&c.to>=s&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&r&&(l||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:cP(Wu.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new cl(this.type,n,r,s,this.propValues),t.makeTree||((n,r,s)=>new cl(Wu.none,n,r,s)))}static build(t){return HHe(t)}}cl.empty=new cl(Wu.none,[],[],0);class aP{constructor(t,n){this.buffer=t,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new aP(this.buffer,this.index)}}class Xp{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return Wu.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],r=this.buffer[t+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),t+=4,r==t)return i;let o=[];for(;t<r;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,r,s,i){let{buffer:o}=this,l=-1;for(let c=t;c!=n&&!(Yce(i,s,o[c+1],o[c+2])&&(l=c,r>0));c=o[c+3]);return l}slice(t,n,r){let s=this.buffer,i=new Uint16Array(n-t),o=0;for(let l=t,c=0;l<n;){i[c++]=s[l++],i[c++]=s[l++]-r;let u=i[c++]=s[l++]-r;i[c++]=s[l++]-t,o=Math.max(o,u)}return new Xp(i,o,this.set)}}function Yce(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function Fk(e,t,n,r){for(var s;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!r&&e instanceof Qp&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=r?0:No.IgnoreOverlays;if(r)for(let o=e,l=o.parent;l;o=l,l=o.parent)o instanceof Qp&&o.index<0&&((s=l.enter(t,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(e=l);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class Xce{cursor(t=0){return new $M(this,t)}getChild(t,n=null,r=null){let s=_V(this,t,n,r);return s.length?s[0]:null}getChildren(t,n=null,r=null){return _V(this,t,n,r)}resolve(t,n=0){return Fk(this,t,n,!1)}resolveInner(t,n=0){return Fk(this,t,n,!0)}matchContext(t){return OM(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}let Qp=class y4 extends Xce{constructor(t,n,r,s){super(),this._tree=t,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,s,i=0){for(let o=this;;){for(let{children:l,positions:c}=o._tree,u=n>0?l.length:-1;t!=u;t+=n){let d=l[t],f=c[t]+o.from,m;if(!(!(i&No.EnterBracketed&&d instanceof cl&&(m=Xx.get(d))&&!m.overlay&&m.bracketed&&r>=f&&r<=f+d.length)&&!Yce(s,r,f,f+d.length))){if(d instanceof Xp){if(i&No.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-f,s);if(p>-1)return new ip(new zHe(o,d,t,f),null,p)}else if(i&No.IncludeAnonymous||!d.type.isAnonymous||lP(d)){let p;if(!(i&No.IgnoreMounts)&&(p=Xx.get(d))&&!p.overlay)return new y4(p.tree,f,t,o);let g=new y4(d,f,t,o);return i&No.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,r,s,i)}}}if(i&No.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,r=0){let s;if(!(r&No.IgnoreOverlays)&&(s=Xx.get(this._tree))&&s.overlay){let i=t-this.from,o=r&No.EnterBracketed&&s.bracketed;for(let{from:l,to:c}of s.overlay)if((n>0||o?l<=i:l<i)&&(n<0||o?c>=i:c>i))return new y4(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function _V(e,t,n,r){let s=e.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(t)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function OM(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class zHe{constructor(t,n,r,s){this.parent=t,this.buffer=n,this.index=r,this.start=s}}class ip extends Xce{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,r){super(),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],t,n-this.context.start,r);return i<0?null:new ip(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,r=0){if(r&No.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new ip(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new ip(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ip(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];t.push(r.slice(s,i,o)),n.push(0)}return new cl(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Qce(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let r=n instanceof Qp&&n.index<0?null:n.parent,s=e.slice();return r?s[t]=r:s.splice(t,1),new FHe(s,n)}class FHe{constructor(t,n){this.heads=t,this.node=n}get next(){return Qce(this.heads)}}function qHe(e,t,n){let r=e.resolveInner(t,n),s=null;for(let i=r instanceof Qp?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(t,n)),i=o}else{let o=Xx.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let l=new Qp(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Fk(l,t,n,!1))}}return s?Qce(s):r}class $M{get name(){return this.type.name}constructor(t,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~No.EnterBracketed,t instanceof Qp)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[t]],this.from=r+s.buffer[t+1],this.to=r+s.buffer[t+2],!0}yield(t){return t?t instanceof Qp?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],t,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,r=this.mode){return this.buffer?r&No.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&No.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&No.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(t<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,r,{buffer:s}=this;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+t,o=t<0?-1:r._tree.children.length;i!=o;i+=t){let l=r._tree.children[i];if(this.mode&No.IncludeAnonymous||l instanceof Xp||!l.type.isAnonymous||lP(l))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,n););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,n=null,r=0;if(t&&t.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=t;o;o=o._parent)if(o.index==s){if(s==this.index)return o;n=o,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new ip(this.buffer,n,this.stack[s]);return this.bufferNode=new ip(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(t){if(!this.buffer)return OM(this.node.parent,t);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=t.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return OM(this._tree,t,s);let o=r[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(t[s]&&t[s]!=o.name)return!1;s--}}return!0}}function lP(e){return e.children.some(t=>t instanceof Xp||!t.type.isAnonymous||lP(t))}function HHe(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:s=OHe,reused:i=[],minRepeatType:o=r.types.length}=e,l=Array.isArray(n)?new aP(n,n.length):n,c=r.types,u=0,d=0;function f(S,T,_,C,j,E){let{id:L,start:D,end:M,size:R}=l,$=d,B=u;if(R<0)if(l.next(),R==-1){let Y=i[L];_.push(Y),C.push(D-S);return}else if(R==-3){u=L;return}else if(R==-4){d=L;return}else throw new RangeError(`Unrecognized record size: ${R}`);let N=c[L],z,G,I=D-S;if(M-D<=s&&(G=w(l.pos-T,j))){let Y=new Uint16Array(G.size-G.skip),U=l.pos-G.size,P=Y.length;for(;l.pos>U;)P=y(G.start,Y,P);z=new Xp(Y,M-G.start,r),I=G.start-S}else{let Y=l.pos-R;l.next();let U=[],P=[],F=L>=o?L:-1,te=0,W=M;for(;l.pos>Y;)F>=0&&l.id==F&&l.size>=0?(l.end<=W-s&&(g(U,P,D,te,l.end,W,F,$,B),te=U.length,W=l.end),l.next()):E>2500?m(D,Y,U,P):f(D,Y,U,P,F,E+1);if(F>=0&&te>0&&te<U.length&&g(U,P,D,te,D,W,F,$,B),U.reverse(),P.reverse(),F>-1&&te>0){let K=p(N,B);z=cP(N,U,P,0,U.length,0,M-D,K,K)}else z=b(N,U,P,M-D,$-M,B)}_.push(z),C.push(I)}function m(S,T,_,C){let j=[],E=0,L=-1;for(;l.pos>T;){let{id:D,start:M,end:R,size:$}=l;if($>4)l.next();else{if(L>-1&&M<L)break;L<0&&(L=R-s),j.push(D,M,R),E++,l.next()}}if(E){let D=new Uint16Array(E*4),M=j[j.length-2];for(let R=j.length-3,$=0;R>=0;R-=3)D[$++]=j[R],D[$++]=j[R+1]-M,D[$++]=j[R+2]-M,D[$++]=$;_.push(new Xp(D,j[2]-M,r)),C.push(M-S)}}function p(S,T){return(_,C,j)=>{let E=0,L=_.length-1,D,M;if(L>=0&&(D=_[L])instanceof cl){if(!L&&D.type==S&&D.length==j)return D;(M=D.prop(ys.lookAhead))&&(E=C[L]+D.length+M)}return b(S,_,C,j,E,T)}}function g(S,T,_,C,j,E,L,D,M){let R=[],$=[];for(;S.length>C;)R.push(S.pop()),$.push(T.pop()+_-j);S.push(b(r.types[L],R,$,E-j,D-E,M)),T.push(j-_)}function b(S,T,_,C,j,E,L){if(E){let D=[ys.contextHash,E];L=L?[D].concat(L):[D]}if(j>25){let D=[ys.lookAhead,j];L=L?[D].concat(L):[D]}return new cl(S,T,_,C,L)}function w(S,T){let _=l.fork(),C=0,j=0,E=0,L=_.end-s,D={size:0,start:0,skip:0};e:for(let M=_.pos-S;_.pos>M;){let R=_.size;if(_.id==T&&R>=0){D.size=C,D.start=j,D.skip=E,E+=4,C+=4,_.next();continue}let $=_.pos-R;if(R<0||$<M||_.start<L)break;let B=_.id>=o?4:0,N=_.start;for(_.next();_.pos>$;){if(_.size<0)if(_.size==-3||_.size==-4)B+=4;else break e;else _.id>=o&&(B+=4);_.next()}j=N,C+=R,E+=B}return(T<0||C==S)&&(D.size=C,D.start=j,D.skip=E),D.size>4?D:void 0}function y(S,T,_){let{id:C,start:j,end:E,size:L}=l;if(l.next(),L>=0&&C<o){let D=_;if(L>4){let M=l.pos-(L-4);for(;l.pos>M;)_=y(S,T,_)}T[--_]=D,T[--_]=E-S,T[--_]=j-S,T[--_]=C}else L==-3?u=C:L==-4&&(d=C);return _}let v=[],x=[];for(;l.pos>0;)f(e.start||0,e.bufferStart||0,v,x,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:v.length?x[0]+v[0].length:0;return new cl(c[e.topID],v.reverse(),x.reverse(),k)}const SV=new WeakMap;function v4(e,t){if(!e.isAnonymous||t instanceof Xp||t.type!=e)return 1;let n=SV.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof cl)){n=1;break}n+=v4(e,r)}SV.set(t,n)}return n}function cP(e,t,n,r,s,i,o,l,c){let u=0;for(let g=r;g<s;g++)u+=v4(e,t[g]);let d=Math.ceil(u*1.5/8),f=[],m=[];function p(g,b,w,y,v){for(let x=w;x<y;){let k=x,S=b[x],T=v4(e,g[x]);for(x++;x<y;x++){let _=v4(e,g[x]);if(T+_>=d)break;T+=_}if(x==k+1){if(T>d){let _=g[k];p(_.children,_.positions,0,_.children.length,b[k]+v);continue}f.push(g[k])}else{let _=b[x-1]+g[x-1].length-S;f.push(cP(e,g,b,k,x,S,_,null,c))}m.push(S+v-i)}}return p(t,n,r,s,0),(l||c)(f,m,o)}class Ig{constructor(t,n,r,s,i=!1,o=!1){this.from=t,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let s=[new Ig(0,t.length,t,0,!1,r)];for(let i of n)i.to>t.length&&s.push(i);return s}static applyChanges(t,n,r=128){if(!n.length)return t;let s=[],i=1,o=t.length?t[0]:null;for(let l=0,c=0,u=0;;l++){let d=l<n.length?n[l]:null,f=d?d.fromA:1e9;if(f-c>=r)for(;o&&o.from<f;){let m=o;if(c>=m.from||f<=m.to||u){let p=Math.max(m.from,c)-u,g=Math.min(m.to,f)-u;m=p>=g?null:new Ig(p,g,m.tree,m.offset+u,l>0,!!d)}if(m&&s.push(m),o.to>f)break;o=i<t.length?t[i++]:null}if(!d)break;c=d.toA,u=d.toA-d.toB}return s}}class UHe{startParse(t,n,r){return typeof t=="string"&&(t=new WHe(t)),r=r?r.length?r.map(s=>new vj(s.from,s.to)):[new vj(0,0)]:[new vj(0,t.length)],this.createParse(t,n||[],r)}parse(t,n,r){let s=this.startParse(t,n,r);for(;;){let i=s.advance();if(i)return i}}}class WHe{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}new ys({perNode:!0});let VHe=0;class ku{constructor(t,n,r,s){this.name=t,this.set=n,this.base=r,this.modified=s,this.id=VHe++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let r=typeof t=="string"?t:"?";if(t instanceof ku&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new ku(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(t){let n=new c3(t);return r=>r.modified.indexOf(n)>-1?r:c3.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let GHe=0;class c3{constructor(t){this.name=t,this.instances=[],this.id=GHe++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(l=>l.base==t&&KHe(n,l.modified));if(r)return r;let s=[],i=new ku(t.name,s,t,n);for(let l of n)l.instances.push(i);let o=YHe(n);for(let l of t.set)if(!l.modified.length)for(let c of o)s.push(c3.get(l,c));return i}}function KHe(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function YHe(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,s=t.length;r<s;r++)t.push(t[r].concat(e[n]));return t.sort((n,r)=>r.length-n.length)}function XHe(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let m=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!m)throw new RangeError("Invalid path: "+s);if(i.push(m[0]=="*"?"":m[0][0]=='"'?JSON.parse(m[0]):m[0]),f+=m[0].length,f==s.length)break;let p=s[f++];if(f==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let c=i.length-1,u=i[c];if(!u)throw new RangeError("Invalid path: "+s);let d=new qk(r,o,c>0?i.slice(0,c):null);t[u]=d.sort(t[u])}}return Jce.add(t)}const Jce=new ys({combine(e,t){let n,r,s;for(;e||t;){if(!e||t&&e.depth>=t.depth?(s=t,t=t.next):(s=e,e=e.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new qk(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class qk{constructor(t,n,r,s){this.tags=t,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}qk.empty=new qk([],2,null);function Zce(e,t){let n=Object.create(null);for(let i of e)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:r,all:s=null}=t||{};return{style:i=>{let o=s;for(let l of i)for(let c of l.set){let u=n[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function QHe(e,t){let n=null;for(let r of e){let s=r.style(t);s&&(n=n?n+" "+s:s)}return n}function JHe(e,t,n,r=0,s=e.length){let i=new ZHe(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,s,"",i.highlighters),i.flush(s)}class ZHe{constructor(t,n,r){this.at=t,this.highlighters=n,this.span=r,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,r,s,i){let{type:o,from:l,to:c}=t;if(l>=r||c<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=s,d=eUe(t)||qk.empty,f=QHe(i,d.tags);if(f&&(u&&(u+=" "),u+=f,d.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(n,l),u),d.opaque)return;let m=t.tree&&t.tree.prop(ys.mounted);if(m&&m.overlay){let p=t.node.enter(m.overlay[0].from+l,1),g=this.highlighters.filter(w=>!w.scope||w.scope(m.tree.type)),b=t.firstChild();for(let w=0,y=l;;w++){let v=w<m.overlay.length?m.overlay[w]:null,x=v?v.from+l:c,k=Math.max(n,y),S=Math.min(r,x);if(k<S&&b)for(;t.from<S&&(this.highlightRange(t,k,S,s,i),this.startSpan(Math.min(S,t.to),u),!(t.to>=x||!t.nextSibling())););if(!v||x>r)break;y=v.to+l,y>n&&(this.highlightRange(p.cursor(),Math.max(n,v.from+l),Math.min(r,y),"",g),this.startSpan(Math.min(r,y),u))}b&&t.parent()}else if(t.firstChild()){m&&(s="");do if(!(t.to<=n)){if(t.from>=r)break;this.highlightRange(t,n,r,s,i),this.startSpan(Math.min(r,t.to),u)}while(t.nextSibling());t.parent()}}}function eUe(e){let t=e.type.prop(Jce);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const pn=ku.define,Z2=pn(),zm=pn(),CV=pn(zm),TV=pn(zm),Fm=pn(),eC=pn(Fm),wj=pn(Fm),Kd=pn(),G0=pn(Kd),qd=pn(),Hd=pn(),BM=pn(),Lw=pn(BM),tC=pn(),xn={comment:Z2,lineComment:pn(Z2),blockComment:pn(Z2),docComment:pn(Z2),name:zm,variableName:pn(zm),typeName:CV,tagName:pn(CV),propertyName:TV,attributeName:pn(TV),className:pn(zm),labelName:pn(zm),namespace:pn(zm),macroName:pn(zm),literal:Fm,string:eC,docString:pn(eC),character:pn(eC),attributeValue:pn(eC),number:wj,integer:pn(wj),float:pn(wj),bool:pn(Fm),regexp:pn(Fm),escape:pn(Fm),color:pn(Fm),url:pn(Fm),keyword:qd,self:pn(qd),null:pn(qd),atom:pn(qd),unit:pn(qd),modifier:pn(qd),operatorKeyword:pn(qd),controlKeyword:pn(qd),definitionKeyword:pn(qd),moduleKeyword:pn(qd),operator:Hd,derefOperator:pn(Hd),arithmeticOperator:pn(Hd),logicOperator:pn(Hd),bitwiseOperator:pn(Hd),compareOperator:pn(Hd),updateOperator:pn(Hd),definitionOperator:pn(Hd),typeOperator:pn(Hd),controlOperator:pn(Hd),punctuation:BM,separator:pn(BM),bracket:Lw,angleBracket:pn(Lw),squareBracket:pn(Lw),paren:pn(Lw),brace:pn(Lw),content:Kd,heading:G0,heading1:pn(G0),heading2:pn(G0),heading3:pn(G0),heading4:pn(G0),heading5:pn(G0),heading6:pn(G0),contentSeparator:pn(Kd),list:pn(Kd),quote:pn(Kd),emphasis:pn(Kd),strong:pn(Kd),link:pn(Kd),monospace:pn(Kd),strikethrough:pn(Kd),inserted:pn(),deleted:pn(),changed:pn(),invalid:pn(),meta:tC,documentMeta:pn(tC),annotation:pn(tC),processingInstruction:pn(tC),definition:ku.defineModifier("definition"),constant:ku.defineModifier("constant"),function:ku.defineModifier("function"),standard:ku.defineModifier("standard"),local:ku.defineModifier("local"),special:ku.defineModifier("special")};for(let e in xn){let t=xn[e];t instanceof ku&&(t.name=e)}Zce([{tag:xn.link,class:"tok-link"},{tag:xn.heading,class:"tok-heading"},{tag:xn.emphasis,class:"tok-emphasis"},{tag:xn.strong,class:"tok-strong"},{tag:xn.keyword,class:"tok-keyword"},{tag:xn.atom,class:"tok-atom"},{tag:xn.bool,class:"tok-bool"},{tag:xn.url,class:"tok-url"},{tag:xn.labelName,class:"tok-labelName"},{tag:xn.inserted,class:"tok-inserted"},{tag:xn.deleted,class:"tok-deleted"},{tag:xn.literal,class:"tok-literal"},{tag:xn.string,class:"tok-string"},{tag:xn.number,class:"tok-number"},{tag:[xn.regexp,xn.escape,xn.special(xn.string)],class:"tok-string2"},{tag:xn.variableName,class:"tok-variableName"},{tag:xn.local(xn.variableName),class:"tok-variableName tok-local"},{tag:xn.definition(xn.variableName),class:"tok-variableName tok-definition"},{tag:xn.special(xn.variableName),class:"tok-variableName2"},{tag:xn.definition(xn.propertyName),class:"tok-propertyName tok-definition"},{tag:xn.typeName,class:"tok-typeName"},{tag:xn.namespace,class:"tok-namespace"},{tag:xn.className,class:"tok-className"},{tag:xn.macroName,class:"tok-macroName"},{tag:xn.propertyName,class:"tok-propertyName"},{tag:xn.operator,class:"tok-operator"},{tag:xn.comment,class:"tok-comment"},{tag:xn.meta,class:"tok-meta"},{tag:xn.invalid,class:"tok-invalid"},{tag:xn.punctuation,class:"tok-punctuation"}]);var xj;const hx=new ys,tUe=new ys;class mh{constructor(t,n,r=[],s=""){this.data=t,this.name=s,gs.prototype.hasOwnProperty("tree")||Object.defineProperty(gs.prototype,"tree",{get(){return Al(this)}}),this.parser=n,this.extension=[Jp.of(this),gs.languageData.of((i,o,l)=>{let c=EV(i,o,l),u=c.type.prop(hx);if(!u)return[];let d=i.facet(u),f=c.type.prop(tUe);if(f){let m=c.resolve(o-c.from,l);for(let p of f)if(p.test(m,i)){let g=i.facet(p.facet);return p.type=="replace"?g:g.concat(d)}}return d})].concat(r)}isActiveAt(t,n,r=-1){return EV(t,n,r).type.prop(hx)==this.data}findRegions(t){let n=t.facet(Jp);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,o)=>{if(i.prop(hx)==this.data){r.push({from:o,to:o+i.length});return}let l=i.prop(ys.mounted);if(l){if(l.tree.prop(hx)==this.data){if(l.overlay)for(let c of l.overlay)r.push({from:c.from+o,to:c.to+o});else r.push({from:o,to:o+i.length});return}else if(l.overlay){let c=r.length;if(s(l.tree,l.overlay[0].from+o),r.length>c)return}}for(let c=0;c<i.children.length;c++){let u=i.children[c];u instanceof cl&&s(u,i.positions[c]+o)}};return s(Al(t),0),r}get allowsNesting(){return!0}}mh.setState=Tr.define();function EV(e,t,n){let r=e.facet(Jp),s=Al(e).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(t,n,No.ExcludeBuffers|No.EnterBracketed))i.type.isTop&&(s=i);return s}function Al(e){let t=e.field(mh.state,!1);return t?t.tree:cl.empty}class nUe{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let r=this.cursorPos-this.string.length;return t<r||n>=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-r,n-r)}}let Pw=null;class u3{constructor(t,n,r=[],s,i,o,l,c){this.parser=t,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new u3(t,n,[],cl.empty,0,r,[],null)}startParse(){return this.parser.startParse(new nUe(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=cl.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t=="number"){let s=Date.now()+t;t=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Ig.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,n;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Ig.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Pw;Pw=this;try{return t()}finally{Pw=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=AV(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let c=[];if(t.iterChangedRanges((u,d,f,m)=>c.push({fromA:u,toA:d,fromB:f,toB:m})),r=Ig.applyChanges(r,c),s=cl.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);d<f&&l.push({from:d,to:f})}}}return new u3(this.parser,n,r,s,i,o,l,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<t.to&&i>t.from&&(this.fragments=AV(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends UHe{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let c=Pw;if(c){for(let u of s)c.tempSkipped.push(u);t&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,t]):t)}return this.parsedPos=o,new cl(Wu.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return Pw}}function AV(e,t,n){return Ig.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class By{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new By(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=u3.create(t.facet(Jp).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new By(r)}}mh.state=hl.define({create:By.init,update(e,t){for(let n of t.effects)if(n.is(mh.setState))return n.value;return t.startState.facet(Jp)!=t.state.facet(Jp)?By.init(t.state):e.apply(t)}});let eue=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(eue=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const kj=typeof navigator<"u"&&(!((xj=navigator.scheduling)===null||xj===void 0)&&xj.isInputPending)?()=>navigator.scheduling.isInputPending():null,rUe=Ui.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(mh.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(mh.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=eue(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(mh.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!kj?Math.max(25,t.timeRemaining()-5):1e9),l=i.context.treeLen<s&&r.doc.length>s+1e3,c=i.context.work(()=>kj&&kj()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:mh.setState.of(new By(i.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>fc(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Jp=jn.define({combine(e){return e.length?e[0]:null},enables:e=>[mh.state,rUe,en.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),sUe=jn.define(),uP=jn.define({combine:e=>{if(!e.length)return"  ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function d3(e){let t=e.facet(uP);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Hk(e,t){let n="",r=e.tabSize,s=e.facet(uP)[0];if(s=="	"){for(;t>=r;)n+="	",t-=r;s=" "}for(let i=0;i<t;i++)n+=s;return n}function dP(e,t){e instanceof gs&&(e=new _6(e));for(let r of e.state.facet(sUe)){let s=r(e,t);if(s!==void 0)return s}let n=Al(e.state);return n.length>=t?oUe(e,n,t):null}class _6{constructor(t,n={}){this.state=t,this.options=n,this.unit=d3(t)}lineAt(t,n=1){let r=this.state.doc.lineAt(t),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==t?{text:"",from:t}:(n<0?s<t:s<=t)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(t,n);return r.slice(t-s,Math.min(r.length,t+100-s))}column(t,n=1){let{text:r,from:s}=this.lineAt(t,n),i=this.countColumn(r,t-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(r,r.search(/\S|$/))),i}countColumn(t,n=t.length){return Tv(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:r,from:s}=this.lineAt(t,n),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const iUe=new ys;function oUe(e,t,n){let r=t.resolveStack(n),s=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return tue(r,e,n)}function tue(e,t,n){for(let r=e;r;r=r.next){let s=lUe(r.node);if(s)return s(hP.create(t,n,r))}return 0}function aUe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function lUe(e){let t=e.type.prop(iUe);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(ys.closedBy))){let s=e.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>hUe(o,!0,1,void 0,i&&!aUe(o)?s.from:void 0)}return e.parent==null?cUe:null}function cUe(){return 0}class hP extends _6{constructor(t,n,r){super(t.state,t.options),this.base=t,this.pos=n,this.context=r}get node(){return this.context.node}static create(t,n,r){return new hP(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(uUe(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tue(this.context.next,this.base,this.pos)}}function uUe(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function dUe(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let s=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let l=n.to;;){let c=t.childAfter(l);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=o)return null;let u=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+u}}l=c.to}}function hUe(e,t,n,r,s){let i=e.textAfter,o=i.match(/^\s*/)[0].length,l=r&&i.slice(o,o+r.length)==r||s==e.pos+o,c=dUe(e);return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const fUe=200;function mUe(){return gs.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,s=n.lineAt(r);if(r>s.from+fUe)return e;let i=n.sliceString(s.from,r);if(!t.some(u=>u.test(i)))return e;let{state:o}=e,l=-1,c=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==l)continue;l=d.from;let f=dP(o,d.from);if(f==null)continue;let m=/^\s*/.exec(d.text)[0],p=Hk(o,f);m!=p&&c.push({from:d.from,to:d.from+m.length,insert:p})}return c.length?[e,{changes:c,sequential:!0}]:e})}const pUe=jn.define(),gUe=new ys;function bUe(e,t,n){let r=Al(e);if(r.length<n)return null;let s=r.resolveStack(n,1),i=null;for(let o=s;o;o=o.next){let l=o.node;if(l.to<=n||l.from>n)continue;if(i&&l.from<t)break;let c=l.type.prop(gUe);if(c&&(l.to<r.length-50||r.length==e.doc.length||!yUe(l))){let u=c(l,e);u&&u.from<=n&&u.from>=t&&u.to>n&&(i=u)}}return i}function yUe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function h3(e,t,n){for(let r of e.facet(pUe)){let s=r(e,t,n);if(s)return s}return bUe(e,t,n)}function nue(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const S6=Tr.define({map:nue}),F_=Tr.define({map:nue});function rue(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(r=>r.from<=n&&r.to>=n)||t.push(e.lineBlockAt(n));return t}const Kg=hl.define({create(){return Un.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((n,r)=>e=jV(e,n,r)),e=e.map(t.changes);for(let n of t.effects)if(n.is(S6)&&!vUe(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(oue),s=r?Un.replace({widget:new TUe(r(t.state,n.value))}):NV;e=e.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(F_)&&(e=e.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=jV(e,t.selection.main.head)),e},provide:e=>en.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],s=e[n++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");t.push(NV.range(r,s))}return Un.set(t,!0)}});function jV(e,t,n=t){let r=!1;return e.between(t,n,(s,i)=>{s<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(s,i)=>s>=n||i<=t}):e}function f3(e,t,n){var r;let s=null;return(r=e.field(Kg,!1))===null||r===void 0||r.between(t,n,(i,o)=>{(!s||s.from>i)&&(s={from:i,to:o})}),s}function vUe(e,t,n){let r=!1;return e.between(t,t,(s,i)=>{s==t&&i==n&&(r=!0)}),r}function sue(e,t){return e.field(Kg,!1)?t:t.concat(Tr.appendConfig.of(aue()))}const wUe=e=>{for(let t of rue(e)){let n=h3(e.state,t.from,t.to);if(n)return e.dispatch({effects:sue(e.state,[S6.of(n),iue(e,n)])}),!0}return!1},xUe=e=>{if(!e.state.field(Kg,!1))return!1;let t=[];for(let n of rue(e)){let r=f3(e.state,n.from,n.to);r&&t.push(F_.of(r),iue(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function iue(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,s=e.state.doc.lineAt(t.to).number;return en.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${s}.`)}const kUe=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let s=e.lineBlockAt(r),i=h3(t,s.from,s.to);i&&n.push(S6.of(i)),r=(i?e.lineBlockAt(i.to):s).to+1}return n.length&&e.dispatch({effects:sue(e.state,n)}),!!n.length},_Ue=e=>{let t=e.state.field(Kg,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(r,s)=>{n.push(F_.of({from:r,to:s}))}),e.dispatch({effects:n}),!0},SUe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:wUe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:xUe},{key:"Ctrl-Alt-[",run:kUe},{key:"Ctrl-Alt-]",run:_Ue}],CUe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oue=jn.define({combine(e){return Lh(e,CUe)}});function aue(e){return[Kg,jUe]}function lue(e,t){let{state:n}=e,r=n.facet(oue),s=o=>{let l=e.lineBlockAt(e.posAtDOM(o.target)),c=f3(e.state,l.from,l.to);c&&e.dispatch({effects:F_.of(c)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,s,t);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const NV=Un.replace({widget:new class extends ou{toDOM(e){return lue(e,null)}}});class TUe extends ou{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return lue(t,this.value)}}const EUe={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class _j extends Zf{constructor(t,n){super(),this.config=t,this.open=n}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=t.state.phrase(this.open?"Fold line":"Unfold line"),n}}function AUe(e={}){let t={...EUe,...e},n=new _j(t,!0),r=new _j(t,!1),s=Ui.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Jp)!=o.state.facet(Jp)||o.startState.field(Kg,!1)!=o.state.field(Kg,!1)||Al(o.startState)!=Al(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Ch;for(let c of o.viewportLineBlocks){let u=f3(o.state,c.from,c.to)?r:h3(o.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:i}=t;return[s,THe({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||ss.empty},initialSpacer(){return new _j(t,!1)},domEventHandlers:{...i,click:(o,l,c)=>{if(i.click&&i.click(o,l,c))return!0;let u=f3(o.state,l.from,l.to);if(u)return o.dispatch({effects:F_.of(u)}),!0;let d=h3(o.state,l.from,l.to);return d?(o.dispatch({effects:S6.of(d)}),!0):!1}}}),aue()]}const jUe=en.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class C6{constructor(t,n){this.specs=t;let r;function s(l){let c=Gp.newName();return(r||(r=Object.create(null)))["."+c]=l,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof mh?l=>l.prop(hx)==o.data:o?l=>l==o:void 0,this.style=Zce(t.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=r?new Gp(r):null,this.themeType=n.themeType}static define(t,n){return new C6(t,n||{})}}const zM=jn.define(),cue=jn.define({combine(e){return e.length?[e[0]]:null}});function w4(e){let t=e.facet(zM);return t.length?t:e.facet(cue)}function uue(e,t){let n=[IUe],r;return e instanceof C6&&(e.module&&n.push(en.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(cue.of(e)):r?n.push(zM.computeN([en.darkTheme],s=>s.facet(en.darkTheme)==(r=="dark")?[e]:[])):n.push(zM.of(e)),n}function E9t(e,t,n){let r=w4(e),s=null;if(r){for(let i of r)if(!i.scope||n){let o=i.style(t);o&&(s=s?s+" "+o:o)}}return s}class NUe{constructor(t){this.markCache=Object.create(null),this.tree=Al(t.state),this.decorations=this.buildDeco(t,w4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Al(t.state),r=w4(t.state),s=r!=w4(t.startState),{viewport:i}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=i.to)}buildDeco(t,n){if(!n||!this.tree.length)return Un.none;let r=new Ch;for(let{from:s,to:i}of t.visibleRanges)JHe(this.tree,n,(o,l,c)=>{r.add(o,l,this.markCache[c]||(this.markCache[c]=Un.mark({class:c})))},s,i);return r.finish()}}const IUe=b0.high(Ui.fromClass(NUe,{decorations:e=>e.decorations})),due=C6.define([{tag:xn.meta,color:"#404740"},{tag:xn.link,textDecoration:"underline"},{tag:xn.heading,textDecoration:"underline",fontWeight:"bold"},{tag:xn.emphasis,fontStyle:"italic"},{tag:xn.strong,fontWeight:"bold"},{tag:xn.strikethrough,textDecoration:"line-through"},{tag:xn.keyword,color:"#708"},{tag:[xn.atom,xn.bool,xn.url,xn.contentSeparator,xn.labelName],color:"#219"},{tag:[xn.literal,xn.inserted],color:"#164"},{tag:[xn.string,xn.deleted],color:"#a11"},{tag:[xn.regexp,xn.escape,xn.special(xn.string)],color:"#e40"},{tag:xn.definition(xn.variableName),color:"#00f"},{tag:xn.local(xn.variableName),color:"#30a"},{tag:[xn.typeName,xn.namespace],color:"#085"},{tag:xn.className,color:"#167"},{tag:[xn.special(xn.variableName),xn.macroName],color:"#256"},{tag:xn.definition(xn.propertyName),color:"#00c"},{tag:xn.comment,color:"#940"},{tag:xn.invalid,color:"#f00"}]),MUe=en.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),hue=1e4,fue="()[]{}",mue=jn.define({combine(e){return Lh(e,{afterCursor:!0,brackets:fue,maxScanDistance:hue,renderMatch:LUe})}}),RUe=Un.mark({class:"cm-matchingBracket"}),DUe=Un.mark({class:"cm-nonmatchingBracket"});function LUe(e){let t=[],n=e.matched?RUe:DUe;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function IV(e){let t=[],n=e.facet(mue);for(let r of e.selection.ranges){if(!r.empty)continue;let s=ph(e,r.head,-1,n)||r.head>0&&ph(e,r.head-1,1,n)||n.afterCursor&&(ph(e,r.head,1,n)||r.head<e.doc.length&&ph(e,r.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e)))}return Un.set(t,!0)}const PUe=Ui.fromClass(class{constructor(e){this.paused=!1,this.decorations=IV(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=IV(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),OUe=[PUe,MUe];function $Ue(e={}){return[mue.of(e),OUe]}const BUe=new ys;function FM(e,t,n){let r=e.prop(t<0?ys.openedBy:ys.closedBy);if(r)return r;if(e.name.length==1){let s=n.indexOf(e.name);if(s>-1&&s%2==(t<0?1:0))return[n[s+t]]}return null}function qM(e){let t=e.type.prop(BUe);return t?t(e.node):e}function ph(e,t,n,r={}){let s=r.maxScanDistance||hue,i=r.brackets||fue,o=Al(e),l=o.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=FM(c.type,n,i);if(u&&c.from<c.to){let d=qM(c);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return zUe(e,t,n,c,d,u,i)}}return FUe(e,t,n,o,l.type,s,i)}function zUe(e,t,n,r,s,i,o){let l=r.parent,c={from:s.from,to:s.to},u=0,d=l==null?void 0:l.cursor();if(d&&(n<0?d.childBefore(r.from):d.childAfter(r.to)))do if(n<0?d.to<=r.from:d.from>=r.to){if(u==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let f=qM(d);return{start:c,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(FM(d.type,n,o))u++;else if(FM(d.type,-n,o)){if(u==0){let f=qM(d);return{start:c,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}while(n<0?d.prevSibling():d.nextSibling());return{start:c,matched:!1}}function FUe(e,t,n,r,s,i,o){if(n<0?!t:t==e.doc.length)return null;let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(l);if(c<0||c%2==0!=n>0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let m=0;!d.next().done&&m<=i;){let p=d.value;n<0&&(m+=p.length);let g=t+m*n;for(let b=n>0?0:p.length-1,w=n>0?p.length:-1;b!=w;b+=n){let y=o.indexOf(p[b]);if(!(y<0||r.resolveInner(g+b,1).type!=s))if(y%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:g+b,to:g+b+1},matched:y>>1==c>>1};f--}}n>0&&(m+=p.length)}return d.done?{start:u,matched:!1}:null}const qUe=Object.create(null),MV=[Wu.none],RV=[],DV=Object.create(null),HUe=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])HUe[e]=UUe(qUe,t);function Sj(e,t){RV.indexOf(e)>-1||(RV.push(e),console.warn(t))}function UUe(e,t){let n=[];for(let l of t.split(" ")){let c=[];for(let u of l.split(".")){let d=e[u]||xn[u];d?typeof d=="function"?c.length?c=c.map(d):Sj(u,`Modifier ${u} used at start of tag`):c.length?Sj(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:Sj(u,`Unknown highlighting tag ${u}`)}for(let u of c)n.push(u)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),s=r+" "+n.map(l=>l.id),i=DV[s];if(i)return i.id;let o=DV[s]=Wu.define({id:MV.length,name:r,props:[XHe({[r]:n})]});return MV.push(o),o.id}wi.RTL,wi.LTR;const WUe=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=mP(e.state,n.from);return r.line?VUe(e):r.block?KUe(e):!1};function fP(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=e(t,n);return s?(r(n.update(s)),!0):!1}}const VUe=fP(QUe,0),GUe=fP(pue,0),KUe=fP((e,t)=>pue(e,t,XUe(t)),0);function mP(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Ow=50;function YUe(e,{open:t,close:n},r,s){let i=e.sliceDoc(r-Ow,r),o=e.sliceDoc(s,s+Ow),l=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(o)[0].length,u=i.length-l;if(i.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-r<=2*Ow?d=f=e.sliceDoc(r,s):(d=e.sliceDoc(r,r+Ow),f=e.sliceDoc(s-Ow,s));let m=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,g=f.length-p-n.length;return d.slice(m,m+t.length)==t&&f.slice(g,g+n.length)==n?{open:{pos:r+m+t.length,margin:/\s/.test(d.charAt(m+t.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function XUe(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),s=n.to<=r.to?r:e.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=s.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return t}function pue(e,t,n=t.selection.ranges){let r=n.map(i=>mP(t,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>YUe(t,r[o],i.from,i.to));if(e!=2&&!s.every(i=>i))return{changes:t.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(e!=1&&s.some(i=>i)){let i=[];for(let o=0,l;o<s.length;o++)if(l=s[o]){let c=r[o],{open:u,close:d}=l;i.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:i}}return null}function QUe(e,t,n=t.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let l=r.length,c=1e9,u;for(let d=i;d<=o;){let f=t.doc.lineAt(d);if(u==null&&(u=mP(t,f.from).line,!u))continue e;if(f.from>s&&(i==o||o>f.from)){s=f.from;let m=/^\s*/.exec(f.text)[0].length,p=m==f.length,g=f.text.slice(m,m+u.length)==u?m:-1;m<f.text.length&&m<c&&(c=m),r.push({line:f,comment:g,token:u,indent:m,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=l;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==l+1&&(r[l].single=!0)}if(e!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&i.push({from:l.from+u,insert:c+" "});let o=t.changes(i);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:l,token:c}of r)if(l>=0){let u=o.from+l,d=u+c.length;o.text[d-o.from]==" "&&d++,i.push({from:u,to:d})}return{changes:i}}return null}const HM=um.define(),JUe=um.define(),ZUe=jn.define(),gue=jn.define({combine(e){return Lh(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,s)=>t(r,s)||n(r,s)})}}),bue=hl.define({create(){return gh.empty},update(e,t){let n=t.state.facet(gue),r=t.annotation(HM);if(r){let c=mc.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=m3(d,d.length,n.minDepth,c):d=wue(d,t.startState.selection),new gh(u==0?r.rest:d,u==0?d:r.rest)}let s=t.annotation(JUe);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(fa.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=mc.fromTransaction(t),o=t.annotation(fa.time),l=t.annotation(fa.userEvent);return i?e=e.addChanges(i,o,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,l,n.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new gh(e.done.map(mc.fromJSON),e.undone.map(mc.fromJSON))}});function pP(e={}){return[bue,gue.of(e),en.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?yue:t.inputType=="historyRedo"?UM:null;return r?(t.preventDefault(),r(n)):!1}})]}function T6(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(bue,!1);if(!s)return!1;let i=s.pop(e,n,t);return i?(r(i),!0):!1}}const yue=T6(0,!1),UM=T6(1,!1),eWe=T6(0,!0),tWe=T6(1,!0);class mc{constructor(t,n,r,s,i){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(t){return new mc(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new mc(t.changes&&da.fromJSON(t.changes),[],t.mapped&&wh.fromJSON(t.mapped),t.startSelection&&ht.fromJSON(t.startSelection),t.selectionsAfter.map(ht.fromJSON))}static fromTransaction(t,n){let r=Nu;for(let s of t.startState.facet(ZUe)){let i=s(t);i.length&&(r=r.concat(i))}return!r.length&&t.changes.empty?null:new mc(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Nu)}static selection(t){return new mc(void 0,Nu,void 0,void 0,t)}}function m3(e,t,n,r){let s=t+1>n+20?t-n-1:0,i=e.slice(s,t);return i.push(r),i}function nWe(e,t){let n=[],r=!1;return e.iterChangedRanges((s,i)=>n.push(s,i)),t.iterChangedRanges((s,i,o,l)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];l>=u&&o<=d&&(r=!0)}}),r}function rWe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function vue(e,t){return e.length?t.length?e.concat(t):e:t}const Nu=[],sWe=200;function wue(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-sWe));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),m3(e,e.length-1,1e9,n.setSelAfter(r)))}else return[mc.selection([t])]}function iWe(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Cj(e,t){if(!e.length)return e;let n=e.length,r=Nu;for(;n;){let s=oWe(e[n-1],t,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=e.slice(0,n);return i[n-1]=s,i}else t=s.mapped,n--,r=s.selectionsAfter}return r.length?[mc.selection(r)]:Nu}function oWe(e,t,n){let r=vue(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):Nu,n);if(!e.changes)return mc.selection(r);let s=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new mc(s,Tr.mapEffects(e.effects,t),o,e.startSelection.map(i),r)}const aWe=/^(input\.type|delete)($|\.)/;class gh{constructor(t,n,r=0,s=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new gh(this.done,this.undone):this}addChanges(t,n,r,s,i){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||aWe.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,nWe(l.changes,t.changes))||r=="input.type.compose")?o=m3(o,o.length-1,s.minDepth,new mc(t.changes.compose(l.changes),vue(Tr.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,Nu)):o=m3(o,o.length,s.minDepth,t),new gh(o,Nu,n,r)}addSelection(t,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Nu;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&rWe(i[i.length-1],t)?this:new gh(wue(this.done,t),this.undone,n,r)}addMapping(t){return new gh(Cj(this.done,t),Cj(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let s=t==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:HM.of({side:t,rest:iWe(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let l=s.length==1?Nu:s.slice(0,s.length-1);return i.mapped&&(l=Cj(l,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:HM.of({side:t,rest:l,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}gh.empty=new gh(Nu,Nu);const gP=[{key:"Mod-z",run:yue,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:UM,preventDefault:!0},{linux:"Ctrl-Shift-z",run:UM,preventDefault:!0},{key:"Mod-u",run:eWe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:tWe,preventDefault:!0}];function Ev(e,t){return ht.create(e.ranges.map(t),e.mainIndex)}function Td(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Ed({state:e,dispatch:t},n){let r=Ev(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Td(e,r)),!0)}function E6(e,t){return ht.cursor(t?e.to:e.from)}function xue(e,t){return Ed(e,n=>n.empty?e.moveByChar(n,t):E6(n,t))}function Rl(e){return e.textDirectionAt(e.state.selection.main.head)==wi.LTR}const kue=e=>xue(e,!Rl(e)),_ue=e=>xue(e,Rl(e));function Sue(e,t){return Ed(e,n=>n.empty?e.moveByGroup(n,t):E6(n,t))}const lWe=e=>Sue(e,!Rl(e)),cWe=e=>Sue(e,Rl(e));function uWe(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function A6(e,t,n){let r=Al(e).resolveInner(t.head),s=n?ys.closedBy:ys.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;uWe(e,u,s)?r=u:c=n?u.to:u.from}let i=r.type.prop(s),o,l;return i&&(o=n?ph(e,r.from,1):ph(e,r.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?r.to:r.from,ht.cursor(l,n?-1:1)}const dWe=e=>Ed(e,t=>A6(e.state,t,!Rl(e))),hWe=e=>Ed(e,t=>A6(e.state,t,Rl(e)));function Cue(e,t){return Ed(e,n=>{if(!n.empty)return E6(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Tue=e=>Cue(e,!1),Eue=e=>Cue(e,!0);function Aue(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let i of e.state.facet(en.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function jue(e,t){let n=Aue(e),{state:r}=e,s=Ev(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):E6(o,t));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(r.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>c&&o.bottom<u&&(i=en.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-c}))}return e.dispatch(Td(r,s),{effects:i}),!0}const LV=e=>jue(e,!1),WM=e=>jue(e,!0);function y0(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&t.head!=r.from+i&&(s=ht.cursor(r.from+i))}return s}const fWe=e=>Ed(e,t=>y0(e,t,!0)),mWe=e=>Ed(e,t=>y0(e,t,!1)),pWe=e=>Ed(e,t=>y0(e,t,!Rl(e))),gWe=e=>Ed(e,t=>y0(e,t,Rl(e))),bWe=e=>Ed(e,t=>ht.cursor(e.lineBlockAt(t.head).from,1)),yWe=e=>Ed(e,t=>ht.cursor(e.lineBlockAt(t.head).to,-1));function vWe(e,t,n){let r=!1,s=Ev(e.selection,i=>{let o=ph(e,i.head,-1)||ph(e,i.head,1)||i.head>0&&ph(e,i.head-1,1)||i.head<e.doc.length&&ph(e,i.head+1,-1);if(!o||!o.end)return i;r=!0;let l=o.start.from==i.head?o.end.to:o.end.from;return ht.cursor(l)});return r?(t(Td(e,s)),!0):!1}const wWe=({state:e,dispatch:t})=>vWe(e,t);function Ku(e,t){let n=Ev(e.state.selection,r=>{let s=t(r);return ht.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Td(e.state,n)),!0)}function Nue(e,t){return Ku(e,n=>e.moveByChar(n,t))}const Iue=e=>Nue(e,!Rl(e)),Mue=e=>Nue(e,Rl(e));function Rue(e,t){return Ku(e,n=>e.moveByGroup(n,t))}const xWe=e=>Rue(e,!Rl(e)),kWe=e=>Rue(e,Rl(e)),_We=e=>Ku(e,t=>A6(e.state,t,!Rl(e))),SWe=e=>Ku(e,t=>A6(e.state,t,Rl(e)));function Due(e,t){return Ku(e,n=>e.moveVertically(n,t))}const Lue=e=>Due(e,!1),Pue=e=>Due(e,!0);function Oue(e,t){return Ku(e,n=>e.moveVertically(n,t,Aue(e).height))}const PV=e=>Oue(e,!1),OV=e=>Oue(e,!0),CWe=e=>Ku(e,t=>y0(e,t,!0)),TWe=e=>Ku(e,t=>y0(e,t,!1)),EWe=e=>Ku(e,t=>y0(e,t,!Rl(e))),AWe=e=>Ku(e,t=>y0(e,t,Rl(e))),jWe=e=>Ku(e,t=>ht.cursor(e.lineBlockAt(t.head).from)),NWe=e=>Ku(e,t=>ht.cursor(e.lineBlockAt(t.head).to)),$V=({state:e,dispatch:t})=>(t(Td(e,{anchor:0})),!0),BV=({state:e,dispatch:t})=>(t(Td(e,{anchor:e.doc.length})),!0),zV=({state:e,dispatch:t})=>(t(Td(e,{anchor:e.selection.main.anchor,head:0})),!0),FV=({state:e,dispatch:t})=>(t(Td(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),IWe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),MWe=({state:e,dispatch:t})=>{let n=j6(e).map(({from:r,to:s})=>ht.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:ht.create(n),userEvent:"select"})),!0},RWe=({state:e,dispatch:t})=>{let n=Ev(e.selection,r=>{let s=Al(e),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:l}=o;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&o.next)return ht.range(l.to,l.from)}return r});return n.eq(e.selection)?!1:(t(Td(e,n)),!0)};function $ue(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(t?o.to<e.state.doc.length:o.from>0)for(let l=i;;){let c=e.moveVertically(l,t);if(c.head<o.from||c.head>o.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==r.ranges.length?!1:(e.dispatch(Td(n,ht.create(s,s.length-1))),!0)}const DWe=e=>$ue(e,!1),LWe=e=>$ue(e,!0),PWe=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=ht.create([n.main]):n.main.empty||(r=ht.create([ht.cursor(n.main.head)])),r?(t(Td(e,r)),!0):!1};function q_(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(i=>{let{from:o,to:l}=i;if(o==l){let c=t(i);c<o?(n="delete.backward",c=nC(e,c,!1)):c>o&&(n="delete.forward",c=nC(e,c,!0)),o=Math.min(o,c),l=Math.max(l,c)}else o=nC(e,o,!1),l=nC(e,l,!0);return o==l?{range:i}:{changes:{from:o,to:l},range:ht.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?en.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function nC(e,t,n){if(e instanceof en)for(let r of e.state.facet(en.atomicRanges).map(s=>s(e)))r.between(t,t,(s,i)=>{s<t&&i>t&&(t=n?i:s)});return t}const Bue=(e,t,n)=>q_(e,r=>{let s=r.from,{state:i}=e,o=i.doc.lineAt(s),l,c;if(n&&!t&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,s-o.from))){if(l[l.length-1]=="	")return s-1;let u=Tv(l,i.tabSize),d=u%d3(i)||d3(i);for(let f=0;f<d&&l[l.length-1-f]==" ";f++)s--;c=s}else c=Ba(o.text,s-o.from,t,t)+o.from,c==s&&o.number!=(t?i.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,s-o.from))&&(c=Ba(o.text,c-o.from,!1,!1)+o.from);return c}),VM=e=>Bue(e,!1,!0),zue=e=>Bue(e,!0,!1),Fue=(e,t)=>q_(e,n=>{let r=n.head,{state:s}=e,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let l=null;;){if(r==(t?i.to:i.from)){r==n.head&&i.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let c=Ba(i.text,r-i.from,t)+i.from,u=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),d=o(u);if(l!=null&&d!=l)break;(u!=" "||r!=n.head)&&(l=d),r=c}return r}),que=e=>Fue(e,!1),OWe=e=>Fue(e,!0),$We=e=>q_(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),BWe=e=>q_(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),zWe=e=>q_(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),FWe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:As.of(["",""])},range:ht.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},qWe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,i=e.doc.lineAt(s),o=s==i.from?s-1:Ba(i.text,s-i.from,!1)+i.from,l=s==i.to?s+1:Ba(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:l,insert:e.doc.slice(s,l).append(e.doc.slice(o,s))},range:ht.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function j6(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=e.doc.lineAt(r.to-1)),n>=s.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(r)}else t.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return t}function Hue(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let i of j6(e)){if(n?i.to==e.doc.length:i.from==0)continue;let o=e.doc.lineAt(n?i.to+1:i.from-1),l=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let c of i.ranges)s.push(ht.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let c of i.ranges)s.push(ht.range(c.anchor-l,c.head-l))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:ht.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const HWe=({state:e,dispatch:t})=>Hue(e,t,!1),UWe=({state:e,dispatch:t})=>Hue(e,t,!0);function Uue(e,t,n){if(e.readOnly)return!1;let r=[];for(let i of j6(e))n?r.push({from:i.from,insert:e.doc.slice(i.from,i.to)+e.lineBreak}):r.push({from:i.to,insert:e.lineBreak+e.doc.slice(i.from,i.to)});let s=e.changes(r);return t(e.update({changes:s,selection:e.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const WWe=({state:e,dispatch:t})=>Uue(e,t,!1),VWe=({state:e,dispatch:t})=>Uue(e,t,!0),GWe=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(j6(t).map(({from:s,to:i})=>(s>0?s--:i<t.doc.length&&i++,{from:s,to:i}))),r=Ev(t.selection,s=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(s.head),l=e.coordsAtPos(s.head,s.assoc||1);l&&(i=o.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,i)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function KWe(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Al(e).resolveInner(t),r=n.childBefore(t),s=n.childAfter(t),i;return r&&s&&r.to<=t&&s.from>=t&&(i=r.type.prop(ys.closedBy))&&i.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const qV=Wue(!1),YWe=Wue(!0);function Wue(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:i,to:o}=s,l=t.doc.lineAt(i),c=!e&&i==o&&KWe(t,i);e&&(i=o=(o<=l.to?l:t.doc.lineAt(o)).to);let u=new _6(t,{simulateBreak:i,simulateDoubleBreak:!!c}),d=dP(u,i);for(d==null&&(d=Tv(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;c?{from:i,to:o}=c:i>l.from&&i<l.from+100&&!/\S/.test(l.text.slice(0,i))&&(i=l.from);let f=["",Hk(t,d)];return c&&f.push(Hk(t,u.lineIndent(l.from,-1))),{changes:{from:i,to:o,insert:As.of(f)},range:ht.cursor(i+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function bP(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let l=e.doc.lineAt(o);l.number>n&&(r.empty||r.to>l.from)&&(t(l,s,r),n=l.number),o=l.to+1}let i=e.changes(s);return{changes:s,range:ht.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const XWe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new _6(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=bP(e,(i,o,l)=>{let c=dP(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let u=/^\s*/.exec(i.text)[0],d=Hk(e,c);(u!=d||l.from<i.from+u.length)&&(n[i.from]=c,o.push({from:i.from,to:i.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},QWe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(bP(e,(n,r)=>{r.push({from:n.from,insert:e.facet(uP)})}),{userEvent:"input.indent"})),!0),JWe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(bP(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Tv(s,e.tabSize),o=0,l=Hk(e,Math.max(0,i-d3(e)));for(;o<s.length&&o<l.length&&s.charCodeAt(o)==l.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),ZWe=e=>(e.setTabFocusMode(),!0),eVe=[{key:"Ctrl-b",run:kue,shift:Iue,preventDefault:!0},{key:"Ctrl-f",run:_ue,shift:Mue},{key:"Ctrl-p",run:Tue,shift:Lue},{key:"Ctrl-n",run:Eue,shift:Pue},{key:"Ctrl-a",run:bWe,shift:jWe},{key:"Ctrl-e",run:yWe,shift:NWe},{key:"Ctrl-d",run:zue},{key:"Ctrl-h",run:VM},{key:"Ctrl-k",run:$We},{key:"Ctrl-Alt-h",run:que},{key:"Ctrl-o",run:FWe},{key:"Ctrl-t",run:qWe},{key:"Ctrl-v",run:WM}],tVe=[{key:"ArrowLeft",run:kue,shift:Iue,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:lWe,shift:xWe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:pWe,shift:EWe,preventDefault:!0},{key:"ArrowRight",run:_ue,shift:Mue,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:cWe,shift:kWe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:gWe,shift:AWe,preventDefault:!0},{key:"ArrowUp",run:Tue,shift:Lue,preventDefault:!0},{mac:"Cmd-ArrowUp",run:$V,shift:zV},{mac:"Ctrl-ArrowUp",run:LV,shift:PV},{key:"ArrowDown",run:Eue,shift:Pue,preventDefault:!0},{mac:"Cmd-ArrowDown",run:BV,shift:FV},{mac:"Ctrl-ArrowDown",run:WM,shift:OV},{key:"PageUp",run:LV,shift:PV},{key:"PageDown",run:WM,shift:OV},{key:"Home",run:mWe,shift:TWe,preventDefault:!0},{key:"Mod-Home",run:$V,shift:zV},{key:"End",run:fWe,shift:CWe,preventDefault:!0},{key:"Mod-End",run:BV,shift:FV},{key:"Enter",run:qV,shift:qV},{key:"Mod-a",run:IWe},{key:"Backspace",run:VM,shift:VM,preventDefault:!0},{key:"Delete",run:zue,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:que,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:OWe,preventDefault:!0},{mac:"Mod-Backspace",run:BWe,preventDefault:!0},{mac:"Mod-Delete",run:zWe,preventDefault:!0}].concat(eVe.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),yP=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:dWe,shift:_We},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:hWe,shift:SWe},{key:"Alt-ArrowUp",run:HWe},{key:"Shift-Alt-ArrowUp",run:WWe},{key:"Alt-ArrowDown",run:UWe},{key:"Shift-Alt-ArrowDown",run:VWe},{key:"Mod-Alt-ArrowUp",run:DWe},{key:"Mod-Alt-ArrowDown",run:LWe},{key:"Escape",run:PWe},{key:"Mod-Enter",run:YWe},{key:"Alt-l",mac:"Ctrl-l",run:MWe},{key:"Mod-i",run:RWe,preventDefault:!0},{key:"Mod-[",run:JWe},{key:"Mod-]",run:QWe},{key:"Mod-Alt-\\",run:XWe},{key:"Shift-Mod-k",run:GWe},{key:"Shift-Mod-\\",run:wWe},{key:"Mod-/",run:WUe},{key:"Alt-A",run:GUe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:ZWe}].concat(tVe);class Vue{constructor(t,n,r,s){this.state=t,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=Al(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(Gue(t,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,r){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function HV(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function nVe(e){let t=Object.create(null),n=Object.create(null);for(let{label:s}of e){t[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=HV(t)+HV(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function rVe(e){let t=e.map(s=>typeof s=="string"?{label:s}:s),[n,r]=t.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:nVe(t);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:t,validFor:n}:null}}class UV{constructor(t,n,r,s){this.completion=t,this.source=n,this.match=r,this.score=s}}function Mg(e){return e.selection.main.from}function Gue(e,t){var n;let{source:r}=e,s=t&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?e:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const Kue=um.define();function sVe(e,t,n,r){let{main:s}=e.selection,i=n-s.from,o=r-s.from;return{...e.changeByRange(l=>{if(l!=s&&n!=r&&e.sliceDoc(l.from+i,l.from+o)!=e.sliceDoc(n,r))return{range:l};let c=e.toText(t);return{changes:{from:l.from+i,to:r==s.from?l.to:l.from+o,insert:c},range:ht.cursor(l.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const WV=new WeakMap;function iVe(e){if(!Array.isArray(e))return e;let t=WV.get(e);return t||WV.set(e,t=rVe(e)),t}const p3=Tr.define(),Uk=Tr.define();class oVe{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<t.length;){let r=uc(t,n),s=oh(r);this.chars.push(r);let i=t.slice(n,n+s),o=i.toUpperCase();this.folded.push(uc(o==i?i.toLowerCase():o,0)),n+=s}this.astral=t.length!=this.chars.length}ret(t,n){return this.score=t,this.matched=n,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let v=uc(t,0),x=oh(v),k=x==t.length?0:-100;if(v!=n[0])if(v==r[0])k+=-200;else return null;return this.ret(k,[0,x])}let l=t.indexOf(this.pattern);if(l==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,u=0;if(l<0){for(let v=0,x=Math.min(t.length,200);v<x&&u<c;){let k=uc(t,v);(k==n[u]||k==r[u])&&(s[u++]=v),v+=oh(k)}if(u<c)return null}let d=0,f=0,m=!1,p=0,g=-1,b=-1,w=/[a-z]/.test(t),y=!0;for(let v=0,x=Math.min(t.length,200),k=0;v<x&&f<c;){let S=uc(t,v);l<0&&(d<c&&S==n[d]&&(i[d++]=v),p<c&&(S==n[p]||S==r[p]?(p==0&&(g=v),b=v+1,p++):p=0));let T,_=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(T=qL(S))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!v||_==1&&w||k==0&&_!=0)&&(n[f]==S||r[f]==S&&(m=!0)?o[f++]=v:o.length&&(y=!1)),k=_,v+=oh(S)}return f==c&&o[0]==0&&y?this.result(-100+(m?-200:0),o,t):p==c&&g==0?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):p==c?this.ret(-900-t.length,[g,b]):f==c?this.result(-100+(m?-200:0)+-700+(y?0:-1100),o,t):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,t)}result(t,n,r){let s=[],i=0;for(let o of n){let l=o+(this.astral?oh(uc(r,o)):1);i&&s[i-1]==o?s[i-1]=l:(s[i++]=o,s[i++]=l)}return this.ret(t-r.length,s)}}class aVe{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let n=t.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(t.length==this.pattern.length?0:-100),this)}}const $a=jn.define({combine(e){return Lh(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:lVe,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>r=>VV(t(r),n(r)),optionClass:(t,n)=>r=>VV(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function VV(e,t){return e?t?e+" "+t:e:t}function lVe(e,t,n,r,s,i){let o=e.textDirection==wi.RTL,l=o,c=!1,u="top",d,f,m=t.left-s.left,p=s.right-t.right,g=r.right-r.left,b=r.bottom-r.top;if(l&&m<Math.min(g,p)?l=!1:!l&&p<Math.min(g,m)&&(l=!0),g<=(l?m:p))d=Math.max(s.top,Math.min(n.top,s.bottom-b))-t.top,f=Math.min(400,l?m:p);else{c=!0,f=Math.min(400,(o?t.right:s.right-t.left)-30);let v=s.bottom-t.bottom;v>=b||v>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let w=(t.bottom-t.top)/i.offsetHeight,y=(t.right-t.left)/i.offsetWidth;return{style:`${u}: ${d/w}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":l?"left":"right")}}const vP=Tr.define();function cVe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),t.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let u=0;u<i.length;){let d=i[u++],f=i[u++];d>c&&o.appendChild(document.createTextNode(l.slice(c,d)));let m=o.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(l.slice(d,f))),m.className="cm-completionMatchedText",c=f}return c<l.length&&o.appendChild(document.createTextNode(l.slice(c))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),t.sort((n,r)=>n.position-r.position).map(n=>n.render)}function Tj(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let s=Math.floor(t/n);return{from:s*n,to:(s+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}class uVe{constructor(t,n,r){this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=t.state.field(n),{options:i,selected:o}=s.open,l=t.state.facet($a);this.optionContent=cVe(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Tj(i.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=t.state.field(n).open;for(let d=c.target,f;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(f=/-(\d+)$/.exec(d.id))&&+f[1]<u.length){this.applyCompletion(t,u[+f[1]]),c.preventDefault();return}if(c.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&c.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&c.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:vP.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet($a).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:Uk.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let r=t.state.field(this.stateField),s=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=s){let{options:i,selected:o,disabled:l}=r.open;(!s.open||s.open.options!=i)&&(this.range=Tj(i.length,o,t.state.facet($a).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),l!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=Tj(n.options.length,n.selected,this.view.state.facet($a).maxRenderedOptions),this.showOptions(n.options,t.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(l,s)}).catch(l=>fc(this.view.state,l,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:s,destroy:i}=t;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==t?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&hVe(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=t.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet($a).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:l,match:c}=t[o],{section:u}=l;if(u){let m=typeof u=="string"?u:u.name;if(m!=i&&(o>r.from||r.from==0))if(i=m,typeof u!="string"&&u.header)s.appendChild(u.header(u));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=m}}const d=s.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let f=this.optionClass(l);f&&(d.className=f);for(let m of this.optionContent){let p=m(l,this.view.state,this.view,c);p&&d.appendChild(p)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<t.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function dVe(e,t){return n=>new uVe(n,e,t)}function hVe(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/s)}function GV(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function fVe(e,t){let n=[],r=null,s=null,i=d=>{n.push(d);let{section:f}=d.completion;if(f){r||(r=[]);let m=typeof f=="string"?f:f.name;r.some(p=>p.name==m)||r.push(typeof f=="string"?{name:m}:f)}},o=t.facet($a);for(let d of e)if(d.hasResult()){let f=d.result.getMatch;if(d.result.filter===!1)for(let m of d.result.options)i(new UV(m,d.source,f?f(m):[],1e9-n.length));else{let m=t.sliceDoc(d.from,d.to),p,g=o.filterStrict?new aVe(m):new oVe(m);for(let b of d.result.options)if(p=g.match(b.label)){let w=b.displayLabel?f?f(b,p.matched):[]:p.matched,y=p.score+(b.boost||0);if(i(new UV(b,d.source,w,y)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;s||(s=Object.create(null)),s[v]=Math.max(y,s[v]||-1e9)}}}}if(r){let d=Object.create(null),f=0,m=(p,g)=>(p.rank==="dynamic"&&g.rank==="dynamic"?s[g.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(p.name<g.name?-1:1);for(let p of r.sort(m))f-=1e5,d[p.name]=f;for(let p of n){let{section:g}=p.completion;g&&(p.score+=d[typeof g=="string"?g:g.name])}}let l=[],c=null,u=o.compareCompletions;for(let d of n.sort((f,m)=>m.score-f.score||u(f.completion,m.completion))){let f=d.completion;!c||c.label!=f.label||c.detail!=f.detail||c.type!=null&&f.type!=null&&c.type!=f.type||c.apply!=f.apply||c.boost!=f.boost?l.push(d):GV(d.completion)>GV(c)&&(l[l.length-1]=d),c=d.completion}return l}class Ob{constructor(t,n,r,s,i,o){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new Ob(this.options,KV(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,s,i,o){if(s&&!o&&t.some(u=>u.isPending))return s.setDisabled();let l=fVe(t,n);if(!l.length)return s&&t.some(u=>u.isPending)?s.setDisabled():null;let c=n.facet($a).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let u=s.options[s.selected].completion;for(let d=0;d<l.length;d++)if(l[d].completion==u){c=d;break}}return new Ob(l,KV(r,c),{pos:t.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:vVe,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(t){return new Ob(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ob(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class g3{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new g3(bVe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet($a),i=(r.override||n.languageDataAt("autocomplete",Mg(n)).map(iVe)).map(c=>(this.active.find(d=>d.source==c)||new Iu(c,this.active.some(d=>d.state!=0)?1:0)).update(t,r));i.length==this.active.length&&i.every((c,u)=>c==this.active[u])&&(i=this.active);let o=this.open,l=t.effects.some(c=>c.is(wP));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!mVe(i,this.active)||l?o=Ob.build(i,n,this.id,o,r,l):o&&o.disabled&&!i.some(c=>c.isPending)&&(o=null),!o&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new Iu(c.source,0):c));for(let c of t.effects)c.is(vP)&&(o=o&&o.setSelected(c.value,this.id));return i==this.active&&o==this.open?this:new g3(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?pVe:gVe}}function mVe(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let s=n==e.length,i=r==t.length;if(s||i)return s==i;if(e[n++].result!=t[r++].result)return!1}}const pVe={"aria-autocomplete":"list"},gVe={};function KV(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const bVe=[];function Yue(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(Kue);if(r&&t.activateOnCompletion(r))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Iu{constructor(t,n,r=!1){this.source=t,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=Yue(t,n),s=this;(r&8||r&16&&this.touches(t))&&(s=new Iu(s.source,0)),r&4&&s.state==0&&(s=new Iu(this.source,1)),s=s.updateFor(t,r);for(let i of t.effects)if(i.is(p3))s=new Iu(s.source,1,i.value);else if(i.is(Uk))s=new Iu(s.source,0);else if(i.is(wP))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Mg(t.state))}}class ay extends Iu{constructor(t,n,r,s,i,o){super(t,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(t,n){var r;if(!(n&3))return this.map(t.changes);let s=this.result;s.map&&!t.changes.empty&&(s=s.map(s,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=Mg(t.state);if(l>o||!s||n&2&&(Mg(t.startState)==this.from||l<this.limit))return new Iu(this.source,n&4?1:0);let c=t.changes.mapPos(this.limit);return yVe(s.validFor,t.state,i,o)?new ay(this.source,this.explicit,c,s,i,o):s.update&&(s=s.update(s,i,o,new Vue(t.state,l,!1)))?new ay(this.source,this.explicit,c,s,s.from,(r=s.to)!==null&&r!==void 0?r:Mg(t.state)):new Iu(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new ay(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new Iu(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function yVe(e,t,n,r){if(!e)return!1;let s=t.sliceDoc(n,r);return typeof e=="function"?e(s,n,r,t):Gue(e,!0).test(s)}const wP=Tr.define({map(e,t){return e.map(n=>n.map(t))}}),Fl=hl.define({create(){return g3.start()},update(e,t){return e.update(t)},provide:e=>[iP.from(e,t=>t.tooltip),en.contentAttributes.from(e,t=>t.attrs)]});function xP(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Fl).active.find(s=>s.source==t.source);return r instanceof ay?(typeof n=="string"?e.dispatch({...sVe(e.state,n,r.from,r.to),annotations:Kue.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const vVe=dVe(Fl,xP);function op(e,t="option"){return n=>{let r=n.state.field(Fl,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet($a).interactionDelay)return!1;let s=1,i;t=="page"&&(i=Hce(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,l=r.open.selected>-1?r.open.selected+s*(e?1:-1):e?0:o-1;return l<0?l=t=="page"?0:o-1:l>=o&&(l=t=="page"?o-1:0),n.dispatch({effects:vP.of(l)}),!0}}const Xue=e=>{let t=e.state.field(Fl,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet($a).interactionDelay?!1:xP(e,t.open.options[t.open.selected])},x4=e=>e.state.field(Fl,!1)?(e.dispatch({effects:p3.of(!0)}),!0):!1,k4=e=>{let t=e.state.field(Fl,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:Uk.of(null)}),!0)};class wVe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const xVe=50,kVe=1e3,_Ve=Ui.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Fl).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Fl),n=e.state.facet($a);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Fl)==t)return;let r=e.transactions.some(i=>{let o=Yue(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>xVe&&Date.now()-o.time>kVe){for(let l of o.context.abortListeners)try{l()}catch(c){fc(this.view.state,c)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(i=>i.effects.some(o=>o.is(p3)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of e.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Fl);for(let n of t.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet($a).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Mg(t),r=new Vue(t,n,e.explicit,this.view),s=new wVe(e,r);this.running.push(s),Promise.resolve(e.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Uk.of(null)}),fc(this.view.state,i)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet($a).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet($a),r=this.view.state.field(Fl);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let l=Mg(i.updates.length?i.updates[0].startState:this.view.state),c=Math.min(l,i.done.from+(i.active.explicit?0:1)),u=new ay(i.active.source,i.active.explicit,c,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:l);for(let d of i.updates)u=u.update(d,n);if(u.hasResult()){t.push(u);continue}}let o=r.active.find(l=>l.source==i.active.source);if(o&&o.isPending)if(i.done==null){let l=new Iu(i.active.source,0);for(let c of i.updates)l=l.update(c,n);l.isPending||t.push(l)}else this.startQuery(o)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:wP.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Fl,!1);if(t&&t.tooltip&&this.view.state.facet($a).closeOnBlur){let n=t.open&&Hce(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Uk.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:p3.of(!1)}),20),this.composing=0}}}),SVe=typeof navigator=="object"&&/Win/.test(navigator.platform),CVe=b0.highest(en.domEventHandlers({keydown(e,t){let n=t.state.field(Fl,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(SVe&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&xP(t,r),!1}})),TVe=en.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Wk={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},wg=Tr.define({map(e,t){let n=t.mapPos(e,-1,Ul.TrackAfter);return n??void 0}}),kP=new class extends Vp{};kP.startSide=1;kP.endSide=-1;const Que=hl.define({create(){return ss.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of t.effects)n.is(wg)&&(e=e.update({add:[kP.range(n.value,n.value+1)]}));return e}});function EVe(){return[jVe,Que]}const Ej="()[]{}<>«»»«［］｛｝";function Jue(e){for(let t=0;t<Ej.length;t+=2)if(Ej.charCodeAt(t)==e)return Ej.charAt(t+1);return qL(e<128?e:e+1)}function Zue(e,t){return e.languageDataAt("closeBrackets",t)[0]||Wk}const AVe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),jVe=en.inputHandler.of((e,t,n,r)=>{if((AVe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let s=e.state.selection.main;if(r.length>2||r.length==2&&oh(uc(r,0))==1||t!=s.from||n!=s.to)return!1;let i=MVe(e.state,r);return i?(e.dispatch(i),!0):!1}),NVe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Zue(e,e.selection.main.head).brackets||Wk.brackets,s=null,i=e.changeByRange(o=>{if(o.empty){let l=RVe(e.doc,o.head);for(let c of r)if(c==l&&N6(e.doc,o.head)==Jue(uc(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:ht.cursor(o.head-c.length)}}return{range:s=o}});return s||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},IVe=[{key:"Backspace",run:NVe}];function MVe(e,t){let n=Zue(e,e.selection.main.head),r=n.brackets||Wk.brackets;for(let s of r){let i=Jue(uc(s,0));if(t==s)return i==s?PVe(e,s,r.indexOf(s+s+s)>-1,n):DVe(e,s,i,n.before||Wk.before);if(t==i&&ede(e,e.selection.main.from))return LVe(e,s,i)}return null}function ede(e,t){let n=!1;return e.field(Que).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function N6(e,t){let n=e.sliceString(t,t+2);return n.slice(0,oh(uc(n,0)))}function RVe(e,t){let n=e.sliceString(t-2,t);return oh(uc(n,0))==n.length?n:n.slice(1)}function DVe(e,t,n,r){let s=null,i=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:wg.of(o.to+t.length),range:ht.range(o.anchor+t.length,o.head+t.length)};let l=N6(e.doc,o.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+n,from:o.head},effects:wg.of(o.head+t.length),range:ht.cursor(o.head+t.length)}:{range:s=o}});return s?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function LVe(e,t,n){let r=null,s=e.changeByRange(i=>i.empty&&N6(e.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:ht.cursor(i.head+n.length)}:r={range:i});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function PVe(e,t,n,r){let s=r.stringPrefixes||Wk.stringPrefixes,i=null,o=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:wg.of(l.to+t.length),range:ht.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=N6(e.doc,c),d;if(u==t){if(YV(e,c))return{changes:{insert:t+t,from:c},effects:wg.of(c+t.length),range:ht.cursor(c+t.length)};if(ede(e,c)){let m=n&&e.sliceDoc(c,c+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+m.length,insert:m},range:ht.cursor(c+m.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=XV(e,c-2*t.length,s))>-1&&YV(e,d))return{changes:{insert:t+t+t+t,from:c},effects:wg.of(c+t.length),range:ht.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=qi.Word&&XV(e,c,s)>-1&&!OVe(e,c,t,s))return{changes:{insert:t+t,from:c},effects:wg.of(c+t.length),range:ht.cursor(c+t.length)}}return{range:i=l}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function YV(e,t){let n=Al(e).resolveInner(t+1);return n.parent&&n.from==t}function OVe(e,t,n,r){let s=Al(e).resolveInner(t,-1),i=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=e.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=l.indexOf(n);if(!c||c>-1&&r.indexOf(l.slice(0,c))>-1){let d=s.firstChild;for(;d&&d.from==s.from&&d.to-d.from>n.length+c;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=s.to==t&&s.parent;if(!u)break;s=u}return!1}function XV(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=qi.Word)return t;for(let s of n){let i=t-s.length;if(e.sliceDoc(i,t)==s&&r(e.sliceDoc(i-1,i))!=qi.Word)return i}return-1}function tde(e={}){return[CVe,Fl,$a.of(e),_Ve,$Ve,TVe]}const nde=[{key:"Ctrl-Space",run:x4},{mac:"Alt-`",run:x4},{mac:"Alt-i",run:x4},{key:"Escape",run:k4},{key:"ArrowDown",run:op(!0)},{key:"ArrowUp",run:op(!1)},{key:"PageDown",run:op(!0,"page")},{key:"PageUp",run:op(!1,"page")},{key:"Enter",run:Xue}],$Ve=b0.highest(Oy.computeN([$a],e=>e.facet($a).defaultKeymap?[nde]:[]));function jc(e){let t=e.field(Fl,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const QV=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class zy{constructor(t,n,r=0,s=t.length,i,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,s),this.bufferStart=r,this.normalize=i?l=>i(QV(l)):QV,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return uc(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=qL(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=oh(t);let s=this.normalize(n);if(s.length)for(let i=0,o=r,l=!0;;i++){let c=s.charCodeAt(i),u=this.match(c,o,l,this.bufferPos+this.bufferStart,i==s.length-1);if(u)return this.value=u,this;if(i==s.length-1)break;l&&i<n.length&&n.charCodeAt(i)==c?o++:l=!1}}}match(t,n,r,s,i){let o=null;for(let l=0;l<this.matches.length;){let c=this.matches[l],u=!1;this.query.charCodeAt(c.index)==t&&(c.index==this.query.length-1?o={from:c.from,to:s,precise:i&&c.precise}:(c.index++,u=!0)),u?l++:this.matches.splice(l,1)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:n,to:s,precise:r&&i}:this.matches.push({from:n,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(zy.prototype[Symbol.iterator]=function(){return this});const rde={from:-1,to:-1,match:/.*/.exec(""),precise:!0},_P="gm"+(/x/.unicode==null?"":"u");class sde{constructor(t,n,r,s=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=rde,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new ide(t,n,r,s,i);this.re=new RegExp(n,_P+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=t.iter();let o=t.lineAt(s);this.curLineStart=o.from,this.matchPos=b3(t,s),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=b3(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,precise:!0,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const Aj=new WeakMap;class ly{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let s=Aj.get(t);if(!s||s.from>=r||s.to<=n){let l=new ly(n,t.sliceString(n,r));return Aj.set(t,l),l}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=t.sliceString(n,o)+i,o=n),s.to<r&&(i+=t.sliceString(s.to,r)),Aj.set(t,new ly(o,i)),new ly(n,i.slice(n-o,r-o))}}class ide{constructor(t,n,r,s,i){this.text=t,this.to=i,this.done=!1,this.value=rde,this.matchPos=b3(t,s),this.re=new RegExp(n,_P+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=ly.get(t,s,this.chunkEnd(s+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,precise:!0,match:n},this.matchPos=b3(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ly.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(sde.prototype[Symbol.iterator]=ide.prototype[Symbol.iterator]=function(){return this});function BVe(e){try{return new RegExp(e,_P),!0}catch{return!1}}function b3(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}const zVe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:s}=kHe(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return s.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){e.dispatch({effects:r});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=o,m=d?+d.slice(1):0,p=u?+u:l.number;if(u&&f){let w=p/100;c&&(w=w*(c=="-"?-1:1)+l.number/t.doc.lines),p=Math.round(t.doc.lines*w)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),b=ht.cursor(g.from+Math.max(0,Math.min(m,g.length)));e.dispatch({effects:[r,en.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},FVe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},qVe=jn.define({combine(e){return Lh(e,FVe,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function HVe(e){return[KVe,GVe]}const UVe=Un.mark({class:"cm-selectionMatch"}),WVe=Un.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function JV(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=qi.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=qi.Word)}function VVe(e,t,n,r){return e(t.sliceDoc(n,n+1))==qi.Word&&e(t.sliceDoc(r-1,r))==qi.Word}const GVe=Ui.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(qVe),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Un.none;let s=r.main,i,o=null;if(s.empty){if(!t.highlightWordAroundCursor)return Un.none;let c=n.wordAt(s.head);if(!c)return Un.none;o=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return Un.none;if(t.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(JV(o,n,s.from,s.to)&&VVe(o,n,s.from,s.to)))return Un.none}else if(i=n.sliceDoc(s.from,s.to),!i)return Un.none}let l=[];for(let c of e.visibleRanges){let u=new zy(n.doc,i,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!o||JV(o,n,d,f))&&(s.empty&&d<=s.from&&f>=s.to?l.push(WVe.range(d,f)):(d>=s.to||f<=s.from)&&l.push(UVe.range(d,f)),l.length>t.maxMatches))return Un.none}}return Un.set(l)}},{decorations:e=>e.decorations}),KVe=en.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),YVe=({state:e,dispatch:t})=>{let{selection:n}=e,r=ht.create(n.ranges.map(s=>e.wordAt(s.head)||ht.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function XVe(e,t){let{main:n,ranges:r}=e.selection,s=e.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,l=new zy(e.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new zy(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(c=>c.from==l.value.from))continue;if(i){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const QVe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(i=>i.from===i.to))return YVe({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=r))return!1;let s=XVe(e,r);return s?(t(e.update({selection:e.selection.addRange(ht.range(s.from,s.to),!1),effects:en.scrollIntoView(s.to)})),!0):!1},Av=jn.define({combine(e){return Lh(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new dGe(t),scrollToMatch:t=>en.scrollIntoView(t)})}});class ode{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||BVe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
`:r=="r"?"\r":r=="t"?"	":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new rGe(this):new eGe(this)}getCursor(t,n=0,r){let s=t.doc?t:gs.create({doc:t});return r==null&&(r=s.doc.length),this.regexp?vb(this,s,n,r):yb(this,s,n,r)}}class ade{constructor(t){this.spec=t}}function JVe(e,t,n){return(r,s,i,o)=>{if(n&&!n(r,s,i,o))return!1;let l=r>=o&&s<=o+i.length?i.slice(r-o,s-o):t.doc.sliceString(r,s);return e(l,t,r,s)}}function yb(e,t,n,r){let s;return e.wholeWord&&(s=ZVe(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(s=JVe(e.test,t,s)),new zy(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:i=>i.toLowerCase(),s)}function ZVe(e,t){return(n,r,s,i)=>((i>n||i+s.length<r)&&(i=Math.max(0,n-2),s=e.sliceString(i,Math.min(e.length,r+2))),(t(y3(s,n-i))!=qi.Word||t(v3(s,n-i))!=qi.Word)&&(t(v3(s,r-i))!=qi.Word||t(y3(s,r-i))!=qi.Word))}class eGe extends ade{constructor(t){super(t)}nextMatch(t,n,r){let s=yb(this.spec,t,r,t.doc.length).nextOverlapping();if(s.done){let i=Math.min(t.doc.length,n+this.spec.unquoted.length);s=yb(this.spec,t,0,i).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(t,n,r){for(let s=r;;){let i=Math.max(n,s-1e4-this.spec.unquoted.length),o=yb(this.spec,t,i,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(i==n)return null;s-=1e4}}prevMatch(t,n,r){let s=this.prevMatchInRange(t,0,n);return s||(s=this.prevMatchInRange(t,Math.max(0,r-this.spec.unquoted.length),t.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let r=yb(this.spec,t,0,t.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(t,n,r,s){let i=yb(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function tGe(e,t,n){return(r,s,i)=>(!n||n(r,s,i))&&e(i[0],t,r,s)}function vb(e,t,n,r){let s;return e.wholeWord&&(s=nGe(t.charCategorizer(t.selection.main.head))),e.test&&(s=tGe(e.test,t,s)),new sde(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:s},n,r)}function y3(e,t){return e.slice(Ba(e,t,!1),t)}function v3(e,t){return e.slice(t,Ba(e,t))}function nGe(e){return(t,n,r)=>!r[0].length||(e(y3(r.input,r.index))!=qi.Word||e(v3(r.input,r.index))!=qi.Word)&&(e(v3(r.input,r.index+r[0].length))!=qi.Word||e(y3(r.input,r.index+r[0].length))!=qi.Word)}class rGe extends ade{nextMatch(t,n,r){let s=vb(this.spec,t,r,t.doc.length).next();return s.done&&(s=vb(this.spec,t,0,n).next()),s.done?null:s.value}prevMatchInRange(t,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),o=vb(this.spec,t,i,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(i==n||l.from>i+10))return l;if(i==n)return null}}prevMatch(t,n,r){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return t.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i<t.match.length)return t.match[i]+r.slice(s)}return n})}matchAll(t,n){let r=vb(this.spec,t,0,t.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(t,n,r,s){let i=vb(this.spec,t,Math.max(0,n-250),Math.min(r+250,t.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Vk=Tr.define(),SP=Tr.define(),xp=hl.define({create(e){return new jj(GM(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Vk)?e=new jj(n.value.create(),e.panel):n.is(SP)&&(e=new jj(e.query,n.value?CP:null));return e},provide:e=>zk.from(e,t=>t.panel)});class jj{constructor(t,n){this.query=t,this.panel=n}}const sGe=Un.mark({class:"cm-searchMatch"}),iGe=Un.mark({class:"cm-searchMatch cm-searchMatch-selected"}),oGe=Ui.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(xp))}update(e){let t=e.state.field(xp);(t!=e.startState.field(xp)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Un.none;let{view:n}=this,r=new Ch;for(let s=0,i=n.visibleRanges,o=i.length;s<o;s++){let{from:l,to:c}=i[s];for(;s<o-1&&c>i[s+1].from-2*250;)c=i[++s].to;e.highlight(n.state,l,c,(u,d)=>{let f=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);r.add(u,d,f?iGe:sGe)})}return r.finish()}},{decorations:e=>e.decorations});function H_(e){return t=>{let n=t.state.field(xp,!1);return n&&n.query.spec.valid?e(t,n):ude(t)}}const w3=H_((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let s=ht.single(r.from,r.to),i=e.state.facet(Av);return e.dispatch({selection:s,effects:[TP(e,r),i.scrollToMatch(s.main,e)],userEvent:"select.search"}),cde(e),!0}),x3=H_((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,s=t.prevMatch(n,r,r);if(!s)return!1;let i=ht.single(s.from,s.to),o=e.state.facet(Av);return e.dispatch({selection:i,effects:[TP(e,s),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),cde(e),!0}),aGe=H_((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:ht.create(n.map(r=>ht.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),lGe=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],o=0;for(let l=new zy(e.doc,e.sliceDoc(r,s));!l.next().done;){if(i.length>1e3)return!1;l.value.from==r&&(o=i.length),i.push(ht.range(l.value.from,l.value.to))}return t(e.update({selection:ht.create(i,o),userEvent:"select.search.matches"})),!0},ZV=H_((e,{query:t})=>{let{state:n}=e,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=t.nextMatch(n,r,r);if(!i)return!1;let o=i,l=[],c,u,d=[];o.precise?o.from==r&&o.to==s&&(u=n.toText(t.getReplacement(o)),l.push({from:o.from,to:o.to,insert:u}),d.push(en.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=t.nextMatch(n,o.from,o.to);let f=e.state.changes(l);return o&&(c=ht.single(o.from,o.to).map(f),d.push(TP(e,o)),d.push(n.facet(Av).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),cGe=H_((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let s of t.matchAll(e.state,1e9)){let{from:i,to:o,precise:l}=s;l&&n.push({from:i,to:o,insert:t.getReplacement(s)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:en.announce.of(r),userEvent:"input.replace.all"}),!0});function CP(e){return e.state.facet(Av).createPanel(e)}function GM(e,t){var n,r,s,i,o;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(Av);return new ode({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=t==null?void 0:t.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(s=t==null?void 0:t.literal)!==null&&s!==void 0?s:u.literal,regexp:(i=t==null?void 0:t.regexp)!==null&&i!==void 0?i:u.regexp,wholeWord:(o=t==null?void 0:t.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function lde(e){let t=oP(e,CP);return t&&t.dom.querySelector("[main-field]")}function cde(e){let t=lde(e);t&&t==e.root.activeElement&&t.select()}const ude=e=>{let t=e.state.field(xp,!1);if(t&&t.panel){let n=lde(e);if(n&&n!=e.root.activeElement){let r=GM(e.state,t.query.spec);r.valid&&e.dispatch({effects:Vk.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[SP.of(!0),t?Vk.of(GM(e.state,t.query.spec)):Tr.appendConfig.of(fGe)]});return!0},dde=e=>{let t=e.state.field(xp,!1);if(!t||!t.panel)return!1;let n=oP(e,CP);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:SP.of(!1)}),!0},uGe=[{key:"Mod-f",run:ude,scope:"editor search-panel"},{key:"F3",run:w3,shift:x3,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:w3,shift:x3,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:dde,scope:"editor search-panel"},{key:"Mod-Shift-l",run:lGe},{key:"Mod-Alt-g",run:zVe},{key:"Mod-d",run:QVe,preventDefault:!0}];class dGe{constructor(t){this.view=t;let n=this.query=t.state.field(xp).query.spec;this.commit=this.commit.bind(this),this.searchField=ai("input",{value:n.search,placeholder:Nc(t,"Find"),"aria-label":Nc(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ai("input",{value:n.replace,placeholder:Nc(t,"Replace"),"aria-label":Nc(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ai("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ai("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ai("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,o){return ai("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=ai("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>w3(t),[Nc(t,"next")]),r("prev",()=>x3(t),[Nc(t,"previous")]),r("select",()=>aGe(t),[Nc(t,"all")]),ai("label",null,[this.caseField,Nc(t,"match case")]),ai("label",null,[this.reField,Nc(t,"regexp")]),ai("label",null,[this.wordField,Nc(t,"by word")]),...t.state.readOnly?[]:[ai("br"),this.replaceField,r("replace",()=>ZV(t),[Nc(t,"replace")]),r("replaceAll",()=>cGe(t),[Nc(t,"replace all")])],ai("button",{name:"close",onclick:()=>dde(t),"aria-label":Nc(t,"close"),type:"button"},["×"])])}commit(){let t=new ode({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Vk.of(t)}))}keydown(t){Rqe(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?x3:w3)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),ZV(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(Vk)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Av).top}}function Nc(e,t){return e.state.phrase(t)}const rC=30,sC=/[\s\.,:;?!]/;function TP(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),s=e.state.doc.lineAt(n).to,i=Math.max(r.from,t-rC),o=Math.min(s,n+rC),l=e.state.sliceDoc(i,o);if(i!=r.from){for(let c=0;c<rC;c++)if(!sC.test(l[c+1])&&sC.test(l[c])){l=l.slice(c);break}}if(o!=s){for(let c=l.length-1;c>l.length-rC;c--)if(!sC.test(l[c-1])&&sC.test(l[c])){l=l.slice(0,c);break}}return en.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}const hGe=en.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),fGe=[xp,b0.low(oGe),hGe];class eG{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class dg{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let s=r.facet(Gk).markerFilter;s&&(t=s(t,r));let i=t.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new Ch,l=[],c=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!l.length)break;let b,w;if(l.length)b=c,w=l.reduce((x,k)=>Math.min(x,k.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>f)break;w=g.to,l.push(g),p++}for(;p<i.length;){let x=i[p];if(x.from==b&&(x.to>x.from||x.to==b))l.push(x),p++,w=Math.min(x.to,w);else{w=Math.min(x.from,w);break}}w=Math.min(w,f);let y=!1;if(l.some(x=>x.from==b&&(x.to==w||w==f))&&(y=b==w,!y&&w-b<10)){let x=b-(d+u.value.length);x>0&&(u.next(x),d=b);for(let k=b;;){if(k>=w){y=!0;break}if(!u.lineBreak&&d+u.value.length>k)break;k=d+u.value.length,d+=u.value.length,u.next()}}let v=TGe(l);if(y)o.add(b,b,Un.widget({widget:new kGe(v),diagnostics:l.slice()}));else{let x=l.reduce((k,S)=>S.markClass?k+" "+S.markClass:k,"");o.add(b,w,Un.mark({class:"cm-lintRange cm-lintRange-"+v+x,diagnostics:l.slice(),inclusiveEnd:l.some(k=>k.to>w)}))}if(c=w,c==f)break;for(let x=0;x<l.length;x++)l[x].to<=c&&l.splice(x--,1)}let m=o.finish();return new dg(m,n,Zp(m))}}function Zp(e,t=null,n=0){let r=null;return e.between(n,1e9,(s,i,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(!r)r=new eG(s,i,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new eG(r.from,i,r.diagnostic)}}),r}function mGe(e,t){let n=t.pos,r=t.end||n,s=e.state.facet(Gk).hideOn(e,n,r);if(s!=null)return s;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(hde))||e.changes.touchesRange(i.from,Math.max(i.to,r)))}function pGe(e,t){return e.field(Hc,!1)?t:t.concat(Tr.appendConfig.of(EGe))}const hde=Tr.define(),EP=Tr.define(),fde=Tr.define(),Hc=hl.define({create(){return new dg(Un.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,s=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Zp(n,e.selected.diagnostic,i)||Zp(n,null,i)}!n.size&&s&&t.state.facet(Gk).autoPanel&&(s=null),e=new dg(n,s,r)}for(let n of t.effects)if(n.is(hde)){let r=t.state.facet(Gk).autoPanel?n.value.length?Kk.open:null:e.panel;e=dg.init(n.value,r,t.state)}else n.is(EP)?e=new dg(e.diagnostics,n.value?Kk.open:null,e.selected):n.is(fde)&&(e=new dg(e.diagnostics,e.panel,n.value));return e},provide:e=>[zk.from(e,t=>t.panel),en.decorations.from(e,t=>t.diagnostics)]}),gGe=Un.mark({class:"cm-lintRange cm-lintRange-active"});function bGe(e,t,n){let{diagnostics:r}=e.state.field(Hc),s,i=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(t<u||n<0)))return s=d.diagnostics,i=c,o=u,!1});let l=e.state.facet(Gk).tooltipFilter;return s&&l&&(s=l(s,e.state)),s?{pos:i,end:o,above:!0,create(){return{dom:yGe(e,s)}}}:null}function yGe(e,t){return ai("ul",{class:"cm-tooltip-lint"},t.map(n=>pde(e,n,!1)))}const vGe=e=>{let t=e.state.field(Hc,!1);(!t||!t.panel)&&e.dispatch({effects:pGe(e.state,[EP.of(!0)])});let n=oP(e,Kk.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},tG=e=>{let t=e.state.field(Hc,!1);return!t||!t.panel?!1:(e.dispatch({effects:EP.of(!1)}),!0)},wGe=e=>{let t=e.state.field(Hc,!1);if(!t)return!1;let n=e.state.selection.main,r=Zp(t.diagnostics,null,n.to+1);return!r&&(r=Zp(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),wHe(e,r.from,1,{tooltip:gde,until:s=>s.docChanged||s.newSelection.main.head<r.from||s.newSelection.main.head>r.to}),!0)},xGe=[{key:"Mod-Shift-m",run:vGe,preventDefault:!0},{key:"F8",run:wGe}],Gk=jn.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Lh(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:nG,tooltipFilter:nG,needsRefresh:(t,n)=>t?n?r=>t(r)||n(r):t:n,hideOn:(t,n)=>t?n?(r,s,i)=>t(r,s,i)||n(r,s,i):t:n,autoPanel:(t,n)=>t||n})}}});function nG(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function mde(e){let t=[];if(e)e:for(let{name:n}of e){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!t.some(i=>i.toLowerCase()==s.toLowerCase())){t.push(s);continue e}}t.push("")}return t}function pde(e,t,n){var r;let s=n?mde(t.actions):[];return ai("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},ai("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((i,o)=>{let l=!1,c=p=>{if(p.preventDefault(),l)return;l=!0;let g=Zp(e.state.field(Hc).diagnostics,t);g&&i.apply(e,g.from,g.to)},{name:u}=i,d=s[o]?u.indexOf(s[o]):-1,f=d<0?u:[u.slice(0,d),ai("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return ai("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${s[o]})"`}.`},f)}),t.source&&ai("div",{class:"cm-diagnosticSource"},t.source))}class kGe extends ou{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return ai("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class rG{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=pde(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Kk{constructor(t){this.view=t,this.items=[];let n=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)tG(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=mde(i.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==s.keyCode){let c=Zp(this.view.state.field(Hc).diagnostics,i);c&&i.actions[l].apply(t,c.from,c.to)}}else return;s.preventDefault()}},r=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=ai("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=ai("div",{class:"cm-panel-lint"},this.list,ai("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>tG(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Hc).selected;if(!t)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==t.diagnostic)return n;return-1}update(){let{diagnostics:t,selected:n}=this.view.state.field(Hc),r=0,s=!1,i=null,o=new Set;for(t.between(0,this.view.state.doc.length,(l,c,{spec:u})=>{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let f=-1,m;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==d){f=p;break}f<0?(m=new rG(this.view,d),this.items.splice(r,0,m),s=!0):(m=this.items[f],f>r&&(this.items.splice(r,f-r),s=!0)),n&&m.diagnostic==n.diagnostic?m.dom.hasAttribute("aria-selected")||(m.dom.setAttribute("aria-selected","true"),i=m):m.dom.hasAttribute("aria-selected")&&m.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new rG(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.top<c.top?this.list.scrollTop-=(c.top-l.top)/u:l.bottom>c.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let t=this.list.firstChild;function n(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)n();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Hc),r=Zp(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:fde.of(r)})}static open(t){return new Kk(t)}}function _Ge(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function iC(e){return _Ge(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const SGe=en.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:iC("#f11")},".cm-lintRange-warning":{backgroundImage:iC("orange")},".cm-lintRange-info":{backgroundImage:iC("#999")},".cm-lintRange-hint":{backgroundImage:iC("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function CGe(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function TGe(e){let t="hint",n=1;for(let r of e){let s=CGe(r.severity);s>n&&(n=s,t=r.severity)}return t}const gde=vHe(bGe,{hideOn:mGe}),EGe=[Hc,en.decorations.compute([Hc],e=>{let{selected:t,panel:n}=e.field(Hc);return!t||!n||t.from==t.to?Un.none:Un.set([gGe.range(t.from,t.to)])}),gde,SGe],bde=[RHe(),PHe(),zce(),pP(),AUe(),Oce(),Hqe(),gs.allowMultipleSelections.of(!0),mUe(),uue(due,{fallback:!0}),$Ue(),EVe(),tde(),aHe(),uHe(),eHe(),HVe(),Oy.of([...IVe,...yP,...uGe,...gP,...SUe,...nde,...xGe])],AGe=[zce(),pP(),Oce(),uue(due,{fallback:!0}),Oy.of([...yP,...gP])];/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const jGe="(hover: none) and (pointer: coarse)";function fx(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(jGe).matches}function NGe(){if(typeof window<"u"){const e=new URLSearchParams(window.location.search).get("composer");if(e==="textarea")return!0;if(e==="codemirror")return!1}return fx()}function IGe(){const[e]=h.useState(NGe);return e}/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const AP={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let e="̀".codePointAt(0);e<="ͯ".codePointAt(0);++e){const t=String.fromCodePoint(e);for(const n of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const s=(n+t).normalize().codePointAt(0);s>126&&(AP[s]=n)}}const Nj={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(Nj)){const t=e.toUpperCase();for(let n=Nj[e][0];n<=Nj[e][1];++n)AP[n]=n%2===0?t:e}function U_(e){if(e<192||e>8580)return e;const t=AP[e];return t!==void 0?t.codePointAt(0):e}function qm(e,t){return e>t?e:t}const yde=e=>e.split("").map(t=>t.codePointAt(0)),MGe=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)MGe.add(e);const Fy="".codePointAt(0),Yk="A".codePointAt(0),Xk="Z".codePointAt(0),vde="a".codePointAt(0),wde="z".codePointAt(0),RGe="0".codePointAt(0),DGe="9".codePointAt(0);function $b(e,t,n){return n?e:t-e-1}const Qk=16,KM=-3,k3=-1,Yg=Qk/2,LGe=Qk/2,PGe=Yg+k3,xde=4,kde=2;function YM(e){return e?new Set:null}function $w(e,t,n){if(t!==null&&t.i16.length>e+n){const r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function sG(e,t,n){if(t!==null&&t.i32.length>e+n){const r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function _de(e){return e>=vde&&e<=wde?1:e>=Yk&&e<=Xk?2:e>=RGe&&e<=DGe?4:0}function Sde(e){const t=String.fromCodePoint(e);return t!==t.toUpperCase()?1:t!==t.toLowerCase()?2:t.match(new RegExp("\\p{Number}","gu"))!==null?4:t.match(new RegExp("\\p{Letter}","gu"))!==null?3:0}function _3(e){return e<=Fy?_de(e):Sde(e)}function jP(e,t){return e===0&&t!==0?Yg:e===1&&t===2||e!==4&&t===4?PGe:t===0?LGe:0}function OGe(e,t){return t===0?Yg:jP(_3(e[t-1]),_3(e[t]))}function $Ge(e,t,n,r){let s=e.slice(r),i=s.indexOf(n);if(i===0)return r;if(!t&&n>=vde&&n<=wde){i>0&&(s=s.slice(0,i));const o=s.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:r+i}function iG(e){for(const t of e)if(t>=128)return!1;return!0}function NP(e,t,n){if(!iG(e))return 0;if(!iG(t))return-1;let r=0,s=0;for(let i=0;i<t.length;i++){if(s=$Ge(e,n,t[i],s),s<0)return-1;i===0&&s>0&&(r=s-1),s++}return r}const BGe=(e,t,n,r,s,i,o)=>{const l=s.length;if(l===0)return[{start:0,end:0,score:0},YM(i)];const c=r.length;if(o!==null&&c*l>o.i16.length)return Tde(e,t,n,r,s,i);const u=NP(r,s,e);if(u<0)return[{start:-1,end:-1,score:0},null];let d=0,f=0,m=null,p=null,g=null,b=null;[d,m]=$w(d,o,c),[d,p]=$w(d,o,c),[d,g]=$w(d,o,c),[f,b]=sG(f,o,l);const[,w]=sG(f,o,c);for(let U=0;U<w.length;U++)w[U]=r[U];let y=0,v=0,x=0,k=0;const S=s[0];let T=s[0],_=0,C=0,j=!1,E=w.subarray(u),L=m.subarray(u).subarray(0,E.length),D=p.subarray(u).subarray(0,E.length),M=g.subarray(u).subarray(0,E.length);for(let[U,P]of E.entries()){let F=null;P<=Fy?(F=_de(P),!e&&F===2&&(P+=32)):(F=Sde(P),!e&&F===2&&(P=String.fromCodePoint(P).toLowerCase().codePointAt(0)),t&&(P=U_(P))),E[U]=P;const te=jP(C,F);if(M[U]=te,C=F,P===T&&(x<l&&(b[x]=u+U,x++,T=s[Math.min(x,l-1)]),k=u+U),P===S){const W=Qk+te*kde;if(L[U]=W,D[U]=1,l===1&&(n&&W>y||!n&&W>=y)&&(y=W,v=u+U,n&&te===Yg))break;j=!1}else j?L[U]=qm(_+k3,0):L[U]=qm(_+KM,0),D[U]=0,j=!0;_=L[U]}if(x!==l)return[{start:-1,end:-1,score:0},null];if(l===1){const U={start:v,end:v+1,score:y};if(!i)return[U,null];const P=new Set;return P.add(v),[U,P]}const R=b[0],$=k-R+1;let B=null;[d,B]=$w(d,o,$*l);{const U=m.subarray(R,k+1);for(const[P,F]of U.entries())B[P]=F}let[,N]=$w(d,o,$*l);{const U=p.subarray(R,k+1);for(const[P,F]of U.entries())N[P]=F}const z=b.subarray(1),G=s.slice(1).slice(0,z.length);for(const[U,P]of z.entries()){let F=!1;const te=G[U],W=U+1,K=W*$,ce=w.subarray(P,k+1),ie=g.subarray(P).subarray(0,ce.length),Z=N.subarray(K+P-R).subarray(0,ce.length),ee=N.subarray(K+P-R-1-$).subarray(0,ce.length),oe=B.subarray(K+P-R).subarray(0,ce.length),we=B.subarray(K+P-R-1-$).subarray(0,ce.length),pe=B.subarray(K+P-R-1).subarray(0,ce.length);pe[0]=0;for(const[he,X]of ce.entries()){const ye=he+P;let Ce=0,ae=0,me=0;if(F?ae=pe[he]+k3:ae=pe[he]+KM,te===X){Ce=we[he]+Qk;let Oe=ie[he];me=ee[he]+1,Oe===Yg?me=1:me>1&&(Oe=qm(Oe,qm(xde,g[ye-me+1]))),Ce+Oe<ae?(Ce+=ie[he],me=0):Ce+=Oe}Z[he]=me,F=Ce<ae;const We=qm(qm(Ce,ae),0);W===l-1&&(n&&We>y||!n&&We>=y)&&(y=We,v=ye),oe[he]=We}}const I=YM(i);let Y=R;if(i&&I!==null){let U=l-1;Y=v;let P=!0;for(;;){const F=U*$,te=Y-R,W=B[F+te];let K=0,ce=0;if(U>0&&Y>=b[U]&&(K=B[F-$+te-1]),Y>b[U]&&(ce=B[F+te-1]),W>K&&(W>ce||W===ce&&P)){if(I.add(Y),U===0)break;U--}P=N[F+te]>1||F+$+te+1<N.length&&N[F+$+te+1]>0,Y--}}return[{start:Y,end:v+1,score:y},I]};function Cde(e,t,n,r,s,i,o){let l=0,c=0,u=!1,d=0,f=0;const m=YM(o);let p=0;s>0&&(p=_3(n[s-1]));for(let g=s;g<i;g++){let b=n[g];const w=_3(b);if(e||(b>=Yk&&b<=Xk?b+=32:b>Fy&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=U_(b)),b===r[l]){o&&m!==null&&m.add(g),c+=Qk;let y=jP(p,w);d===0?f=y:(y===Yg&&(f=y),y=qm(qm(y,f),xde)),l===0?c+=y*kde:c+=y,u=!1,d++,l++}else u?c+=k3:c+=KM,u=!0,d=0,f=0;p=w}return[c,m]}const Tde=(e,t,n,r,s,i,o)=>{if(s.length===0)return[{start:0,end:0,score:0},null];if(NP(r,s,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,c=-1,u=-1;const d=r.length,f=s.length;for(let m=0;m<d;m++){let p=r[$b(m,d,n)];e||(p>=Yk&&p<=Xk?p+=32:p>Fy&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=U_(p));const g=s[$b(l,f,n)];if(p===g&&(c<0&&(c=m),l++,l===f)){u=m+1;break}}if(c>=0&&u>=0){l--;for(let g=u-1;g>=c;g--){const b=$b(g,d,n);let w=r[b];e||(w>=Yk&&w<=Xk?w+=32:w>Fy&&(w=String.fromCodePoint(w).toLowerCase().codePointAt(0)));const y=$b(l,f,n),v=s[y];if(w===v&&(l--,l<0)){c=g;break}}if(!n){const g=c;c=d-u,u=d-g}const[m,p]=Cde(e,t,r,s,c,u,i);return[{start:c,end:u,score:m},p]}return[{start:-1,end:-1,score:0},null]},zGe=(e,t,n,r,s,i,o)=>{if(s.length===0)return[{start:0,end:0,score:0},null];const l=r.length,c=s.length;if(l<c)return[{start:-1,end:-1,score:0},null];if(NP(r,s,e)<0)return[{start:-1,end:-1,score:0},null];let u=0,d=-1,f=0,m=-1;for(let p=0;p<l;p++){const g=$b(p,l,n);let b=r[g];e||(b>=Yk&&b<=Xk?b+=32:b>Fy&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=U_(b));const w=$b(u,c,n);if(s[w]===b){if(w===0&&(f=OGe(r,g)),u++,u===c){if(f>m&&(d=p,m=f),f===Yg)break;p-=u-1,u=0,f=0}}else p-=u,u=0,f=0}if(d>=0){let p=0,g=0;n?(p=d-c+1,g=d+1):(p=l-(d+1),g=l-(d-c+1));const[b]=Cde(e,t,r,s,p,g,!1);return[{start:p,end:g,score:b},null]}return[{start:-1,end:-1,score:0},null]},FGe=100*1024,qGe=2048;function HGe(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const UGe=HGe(FGe,qGe),WGe=(e,t,n)=>{let r=!1;switch(t){case"smart-case":e.toLowerCase()!==e&&(r=!0);break;case"case-sensitive":r=!0;break;case"case-insensitive":e=e.toLowerCase(),r=!1;break}let s=yde(e);return n&&(s=s.map(U_)),{queryRunes:s,caseSensitive:r}};function VGe(e,t){const n=Object.keys(e).map(s=>parseInt(s,10)).sort((s,i)=>i-s);let r=[];for(const s of n)if(r=r.concat(e[s]),r.length>=t)break;return r}function GGe(e,t,n){return r=>{const s=this.runesList[r];if(t.length>s.length)return;let[i,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,s,t,!0,UGe);if(i.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let c=i.start;c<i.end;++c)o.add(c)}const l=this.opts.sort?i.score:0;e[l]===void 0&&(e[l]=[]),e[l].push({item:this.items[r],...i,positions:o??new Set})}}function KGe(e){const{queryRunes:t,caseSensitive:n}=WGe(e,this.opts.casing,this.opts.normalize),r={},s=GGe.bind(this)(r,t,n);for(let i=0,o=this.runesList.length;i<o;++i)s(i);return VGe(r,this.opts.limit)}const Ede={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class YGe{constructor(t,...n){switch(this.opts={...Ede,...n[0]},this.items=t,this.runesList=t.map(r=>yde(this.opts.selector(r).normalize())),this.algoFn=zGe,this.opts.fuzzy){case"v2":this.algoFn=BGe;break;case"v1":this.algoFn=Tde;break}}}const XGe={...Ede,match:KGe};class QGe extends YGe{constructor(t,...n){super(t,...n),this.opts={...XGe,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(JGe);t=t.normalize();let n=this.opts.match.bind(this)(t);return ZGe(n,this.opts)}}const JGe=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function ZGe(e,t){if(t.sort){const{selector:n}=t;e.sort((r,s)=>{if(r.score===s.score)for(const i of t.tiebreakers){const o=i(r,s,n);if(o!==0)return o}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}class eKe{constructor(t,...n){this.finder=new QGe(t,...n),this.find=this.finder.find.bind(this.finder)}}const Jk=["custom","skill","system"];function XM(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function tKe(e,t,n=Jk){return oG(XM(e),n)-oG(XM(t),n)}function oG(e,t=Jk){const n=t.indexOf(e);return n>=0?n:t.length+Jk.indexOf(e)}const IP=String.raw`([^\s/]+)`,I6={agents:[{name:"manage",description:"管理现有 subagents"},{name:"create",description:"创建新的 subagent"}],theme:[{name:"light",description:"切换到浅色主题"},{name:"dark",description:"切换到深色主题"}],export:[{name:"md",description:"将会话导出为 Markdown 文件"},{name:"html",description:"将会话导出为 HTML 文件"},{name:"json",description:"将会话导出为 JSON 文件"},{name:"jsonl",description:"将会话导出为 JSONL 文件（每行一条消息）"}],language:[{name:"ui",description:"设置 UI 语言",children:[{name:"en",description:"English"},{name:"zh-CN",description:"中文"}]},{name:"output",description:"设置 LLM 输出语言"}],extensions:[{name:"manage",description:"管理扩展"},{name:"install",description:"安装扩展"}]},M6={agents:[{name:"manage",description:"Manage existing subagents"},{name:"create",description:"Create a new subagent"}],theme:[{name:"light",description:"Switch to light theme"},{name:"dark",description:"Switch to dark theme"}],export:[{name:"md",description:"Export as Markdown"},{name:"html",description:"Export as HTML"},{name:"json",description:"Export as JSON"},{name:"jsonl",description:"Export as JSONL"}],language:[{name:"ui",description:"Set UI language",children:[{name:"en",description:"English"},{name:"zh-CN",description:"中文"}]},{name:"output",description:"Set LLM output language"}],extensions:[{name:"manage",description:"Manage installed extensions"},{name:"install",description:"Install an extension from a source"}]},R6={context:[{name:"detail",description:"显示详细上下文信息"}],copy:[{name:"code",description:"复制代码块"},{name:"latex",description:"复制 LaTeX 公式"},{name:"inline-latex",description:"复制行内 LaTeX 公式"}],tools:[{name:"desc",description:"显示工具详细描述"}],stats:[{name:"model",description:"显示各模型使用统计"},{name:"tools",description:"显示工具使用统计"}],mcp:[{name:"desc",description:"显示 MCP server 和工具描述"},{name:"nodesc",description:"隐藏 MCP server 和工具描述"},{name:"schema",description:"显示工具参数 schema"}],memory:[{name:"show",description:"查看 memory 文件"},{name:"add",description:"新增 memory"},{name:"refresh",description:"刷新 memory 文件列表"}]},D6={context:[{name:"detail",description:"Show detailed context info"}],copy:[{name:"code",description:"Copy code blocks"},{name:"latex",description:"Copy LaTeX formula"},{name:"inline-latex",description:"Copy inline LaTeX formula"}],tools:[{name:"desc",description:"Show tool descriptions"}],stats:[{name:"model",description:"Show per-model usage statistics"},{name:"tools",description:"Show tool usage statistics"}],mcp:[{name:"desc",description:"Show MCP server and tool descriptions"},{name:"nodesc",description:"Hide MCP server and tool descriptions"},{name:"schema",description:"Show tool parameter schemas"}],memory:[{name:"show",description:"Show memory files"},{name:"add",description:"Add memory"},{name:"refresh",description:"Refresh memory files"}]};function nKe(e,t,n,r,s){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(l=>({name:l.name,description:l.description}));let o=(r==="zh-CN"?I6:M6)[e];if(o||(o=(r==="zh-CN"?R6:D6)[e]),!o&&t.length===0&&(s!=null&&s.length)&&(o=s.map(l=>({name:l,description:""}))),!o)return null;for(const l of t){const c=o.find(u=>u.name===l);if(!(c!=null&&c.children))return null;o=c.children}return o}function rKe(e,t,n){const r=e.toLowerCase(),s=t.toLowerCase(),i=r.startsWith(n),o=s.startsWith(n);return i!==o?i?-1:1:e.localeCompare(t)}function sKe(e,t,n,r){const s=tKe(e,t,r);return s!==0?s:0}const iKe={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"},aG=50;function oKe(e,t){if(!e||e.includes(" ")||/^[/@!?]/.test(e))return null;const n=e.toLowerCase(),r=t.find(s=>s.name.toLowerCase().startsWith(n));return r?`/${r.name} `:null}function aKe(e,t,n){var u;const r=e.match(new RegExp(`^/${IP}\\s+$`));if(!r)return null;const s=r[1],i=t.find(d=>d.name===s),o=n==="zh-CN"?I6:M6;if((u=i==null?void 0:i.subcommands)!=null&&u.length||o[s]||s==="skills")return null;const c=(n==="zh-CN"?R6:D6)[s];return!c||c.length===0?null:`/${s} ${c[0].name} `}function lKe(e,t,n){var d,f;const r=e.match(new RegExp(`^/${IP}(\\s*)$`));if(!r)return null;const s=r[1],i=t.find(m=>m.name===s);if(!i)return null;const o=(d=i.argumentHint)==null?void 0:d.trim();if(o)return o;const l=n==="zh-CN"?I6:M6;if((f=i.subcommands)!=null&&f.length||l[s]||s==="skills")return null;const u=(n==="zh-CN"?R6:D6)[s];return!u||u.length===0?null:`[${u.map(m=>m.name).join("|")}]`}function cKe(e,t){const n=Math.max(0,Math.min(t,e.length)),r=e.lastIndexOf(`
`,Math.max(0,n-1))+1,s=e.indexOf(`
`,n),i=s===-1?e.length:s;return{lineStart:r,lineEnd:i,lineText:e.slice(r,i),textBefore:e.slice(r,n),cursor:n}}const lG=new WeakMap;function uKe(e){let t=lG.get(e);if(!t){const n=[],r=new Map;for(const s of e)r.has(s.name)||(n.push(s.name),r.set(s.name,s));t={fzf:new eKe(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:r},lG.set(e,t)}return t}function dKe(e,t){try{const{fzf:n,byName:r}=uKe(e),s=[];for(const i of n.find(t)){const o=r.get(i.item);o&&s.push(o)}return s}catch(n){console.warn("[web-shell] slash fuzzy search failed, falling back to substring match:",n);const r=t.toLowerCase();return e.filter(s=>s.name.toLowerCase().includes(r))}}function hKe(e,t,n,r=[],s="en",i=l=>l,o=Jk){var v,x;const{lineStart:l,lineEnd:c,lineText:u,textBefore:d,cursor:f}=cKe(e,t),m=d.match(new RegExp(`^/${IP}\\s+(.*)$`));if(m){const[,k,S]=m,T=n.find(I=>I.name===k),_=s==="zh-CN"?I6:M6,C=s==="zh-CN"?R6:D6,j=!!_[k]||k==="skills",E=!!C[k];if(!((v=T==null?void 0:T.subcommands)!=null&&v.length)&&!j&&!E)return null;const L=S.split(/\s+/),D=L.pop()||"",M=L;if(!((x=T==null?void 0:T.subcommands)!=null&&x.length)&&!j&&E&&!D)return null;const R=nKe(k,M,r,s,T==null?void 0:T.subcommands);if(!R)return null;const $=D.toLowerCase(),B=`/${k} ${M.length>0?M.join(" ")+" ":""}`,N=R.filter(I=>!D||I.name.toLowerCase().includes($)).sort((I,Y)=>D?rKe(I.name,Y.name,$):0),z=k==="skills"&&M.length===0,G=N.slice(0,aG).map(I=>{const Y=`${B}${I.name}`;return{id:Y,label:I.name,detail:I.description||void 0,apply:`${Y} `,...z?{type:"skill"}:{}}});return G.length===0?null:{kind:"subcommand",from:l,to:f,query:D,items:G}}const p=u.match(/^\/([^\s/]*)$/);if(!p)return null;const g=p[1],b=g.length===0,y=(b?[...n].sort((k,S)=>sKe(k,S,"",o)):dKe(n,g)).slice(0,aG).map(k=>{const S=`/${k.name} `,T=XM(k),_=T==="custom"||T==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:S,category:T,...b?{section:i(iKe[T])}:{},..._&&k.description?{type:"command-info"}:{}}});return y.length===0?null:{kind:"command",from:l,to:c,query:g,items:y}}const QM="qwen-web-shell-history",MP=100;function cG(e){return e?`${QM}:${encodeURIComponent(e)}`:QM}function S3(e){try{const t=localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}catch{return[]}}function JM(e,t){const n=S3(e);return n.length===0&&t?S3(t):n}function C3(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-MP)))}catch{}}function fKe(e,t,n){const r=JM(e,n);if(r[r.length-1]===t){n&&S3(e).length===0&&C3(e,r);return}r.push(t),r.length>MP&&r.shift(),C3(e,r)}function uG(e=QM,t){const n=h.useRef(e),r=h.useRef(t),s=h.useRef(e),i=h.useRef(t);n.current=e,r.current=t;const o=h.useRef([]),l=h.useRef(!1);l.current||(o.current=JM(e,t),l.current=!0);const c=h.useRef(-1),u=h.useRef(""),d=h.useRef(-1),[f,m]=h.useState(()=>({canUp:o.current.length>0,canDown:!1})),p=h.useCallback(()=>{const _=o.current,C=c.current;m({canUp:_.length>0&&(C===-1||C>0),canDown:C!==-1})},[]);h.useEffect(()=>{s.current===e&&i.current===t||(s.current=e,i.current=t,o.current=JM(e,t),c.current=-1,u.current="",d.current=-1,p())},[t,e,p]);const g=h.useCallback(_=>{const C=o.current;if(C[C.length-1]===_){r.current&&S3(n.current).length===0&&C3(n.current,C);return}C.push(_),C.length>MP&&C.shift(),C3(n.current,C),c.current=-1,p()},[p]),b=h.useCallback(_=>{const C=o.current;if(C.length===0)return null;if(c.current===-1)u.current=_,c.current=C.length-1;else if(c.current>0)c.current--;else return null;return p(),C[c.current]},[p]),w=h.useCallback(()=>{const _=o.current;return c.current===-1?null:c.current<_.length-1?(c.current++,p(),_[c.current]):(c.current=-1,p(),u.current)},[p]),y=h.useCallback(()=>c.current!==-1,[]),v=h.useCallback(()=>{c.current=-1,d.current=-1,p()},[p]),x=h.useCallback(_=>{const C=o.current;if(C.length===0||!_)return null;const j=d.current===-1?C.length-1:d.current-1;if(j<0)return d.current=-1,null;const E=_.toLowerCase();for(let L=j;L>=0;L--)if(C[L].toLowerCase().includes(E))return d.current=L,C[L];return d.current=-1,null},[]),k=h.useCallback(_=>{const C=_.trim().toLowerCase();return o.current.slice().reverse().filter(j=>!C||j.toLowerCase().includes(C))},[]),S=h.useCallback(_=>{const C=o.current;if(!_)return C.length>0?C[C.length-1]:null;for(let j=C.length-1;j>=0;j--)if(_(C[j]))return C[j];return null},[]),T=h.useCallback(()=>{d.current=-1},[]);return{push:g,navigateUp:b,navigateDown:w,isNavigating:y,reset:v,searchReverse:x,getReverseMatches:k,getLastEntry:S,resetSearch:T,nav:f}}function oC(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function ZM(e,t,n){let r=e.get(t);return r||(r=n().catch(s=>{throw e.delete(t),s}),e.set(t,r)),r}const mKe=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,pKe=[],dG=150,kp=50,Ade=kp+1,el="files",jv="extensions",rl="mcp-resources",jde=[el,jv,rl],gKe="\x1B",Nde=new RegExp(`${gKe}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),Ide=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,Zk="[invalid]",bKe=/[^\p{L}\p{N}_./-]/gu;function yKe(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(r=>{const s=e[r],i=t[r];return Object.is(s,i)?!0:Array.isArray(s)&&Array.isArray(i)&&s.length===i.length&&s.every((o,l)=>Object.is(o,i[l]))})}function vKe(e,t){return e.length===t.length&&e.every((n,r)=>{const s=t[r];return s!==void 0&&n.id===s.id&&n.textValue===s.textValue&&Object.is(n.label,s.label)&&n.description===s.description&&n.tabs===s.tabs&&n.selectedTabId===s.selectedTabId&&n.renderItem===s.renderItem})}function _4(e){return jde.includes(e)}function wKe(e,t){var r;if(t===void 0||t===!0)return!0;if(t===!1)return!1;if(Array.isArray(t))return t.includes(e);const n=t;return!(n.enabled===!1||n.include&&!n.include.includes(e)||(r=n.exclude)!=null&&r.includes(e))}function xKe(e){const t=new Set(jde),n=[];for(const r of e){if(t.has(r.id)){console.error(`[@mention] duplicate provider id="${r.id}" ignored`);continue}t.add(r.id),n.push(r)}return n}function hG(e){return(e.textValue===void 0?void 0:ui(e.textValue))??(typeof e.label=="string"?ui(e.label)??void 0:void 0)??em(e.id)??Zk}function Mde(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function Pf(e){const t=[];for(const n of e.split("/"))if(!(!n||n===".")){if(n===".."){t.pop();continue}t.push(n)}return t.length>0?t.join("/"):"."}function kKe(e){return Array.from(e,t=>/[a-z]/i.test(t)?`[${t.toLowerCase()}${t.toUpperCase()}]`:/[\\*?[{\]}()!@+|]/.test(t)?`\\${t}`:t).join("")}function eR(e){const t=L6(e).replace(/^\.\//,"");return t?`**/*${kKe(t)}*`:"**/*"}function T3(e,...t){const n=e.toLowerCase();return t.some(r=>r==null?void 0:r.toLowerCase().includes(n))}function fG(e){const t=Pf(e),n=Th(t);return t==="."?"@./ ":`@${Xg(n)}/ `}function _Ke(e,t){return`${e}:${t}`}function Xg(e){return e.replace(bKe,"\\$&")}function L6(e){return e.replace(/\\(.)/g,"$1")}function Rde(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function SKe(e,t){return`@${Xg(_Ke(Th(e),Th(t)))} `}function CKe(e,t,n){const r=L6(e);return t===rl&&n&&r.startsWith(`${n}:`)?{providerId:rl,serverName:n,itemQuery:r.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:jv,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:rl,itemQuery:e.slice(4)}:null}function TKe(e,t,n){if(e===jv&&t.startsWith("ext:")||e===rl&&t.startsWith("mcp:"))return t.slice(4);const r=L6(t);return e===rl&&n&&r.startsWith(`${n}:`)?r.slice(n.length+1):!_4(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function EKe(e,t,n,r){if(n!=null&&n.aborted)return!1;const s=r??(e==null?void 0:e.loadMcpStatus);if(!s)return!1;try{const i=await s();return n!=null&&n.aborted?!1:i.servers.some(o=>o.name===t&&!o.disabled)}catch(i){return console.warn(`Failed to verify @ MCP server "${t}" status`,i),!1}}function AKe(e){const t=Pf(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function Dde(e,t){const n=L6(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),r=n.lastIndexOf("/");if(r<0)return{dirPath:Pf(t),entryQuery:n};const s=n.slice(0,r),i=Pf(t),o=i==="."?s:Mde(i,s);return{dirPath:Pf(o),entryQuery:n.slice(r+1)}}function jKe(e){if(!e)return null;const t=e.state.selection.main;if(!t.empty)return null;const n=e.state.doc.lineAt(t.head),s=n.text.slice(0,t.head-n.from).match(mKe);if(!s)return null;const i=t.head-s[0].length;if(i>n.from){const o=e.state.doc.sliceString(i-1,i);if(!/[\s([{'"]/.test(o))return null}return{from:i,to:t.head,query:s[1]??""}}function ui(e){const t=e.replace(Nde,"").replace(Ide,"").split("").filter(Rde).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function Th(e){const t=e.replace(Nde,"").replace(Ide,"").split("").filter(Rde).join("");return t.length>0?t:Zk}function em(e){return e===void 0?Zk:ui(e)??Zk}function NKe(e){if(e!==void 0)return Th(e).trim()}function IKe(e){if(!e)return;const t=e.kind===void 0?void 0:ui(e.kind);return{id:ui(e.id)??Zk,label:e.label===void 0?void 0:ui(e.label),value:e.value===void 0?void 0:ui(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:NKe(e.serialized)}}function MKe(e,t){const n={...e,label:ui(e.label)??em(e.id),description:e.description===void 0?void 0:ui(e.description),subtitle:e.subtitle===void 0?void 0:ui(e.subtitle),detail:e.detail===void 0?void 0:ui(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:ui(e.iconTooltip),insertText:e.insertText===void 0?void 0:Th(e.insertText),composerTag:IKe(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const r={...n};return delete r.targetPath,delete r.serverName,{...r,kind:"insert"}}function RKe(e,t,n){var s;const r=n.trim();return r?t.composerTag?{...t.composerTag,serialized:((s=t.composerTag.serialized)==null?void 0:s.trim())||r}:e===jv?{id:`extension:${r}`,kind:"extension",value:t.label,serialized:r}:e===rl?{id:`mcp:${r}`,kind:"mcp",value:t.label,serialized:r}:e===el?{id:`file:${r}`,kind:"file",value:t.description??t.label,serialized:r}:null:null}function DKe(e,t,n,r,s){return{id:el,label:r,description:s,order:1,async search({query:i,signal:o}){const l=e(),c=Pf(t()),u=l==null?void 0:l.listDirectory;if(u&&(!i||!(l!=null&&l.globWorkspace)))try{const{dirPath:f,entryQuery:m}=Dde(i,c),p=m.toLowerCase(),g=await ZM(n().directories,f,()=>u(f,{signal:o}));if(o.aborted)return[];const b=g.entries.filter(y=>!y.ignored).filter(y=>y.name.toLowerCase().includes(p)).sort((y,v)=>y.kind==="directory"&&v.kind!=="directory"?-1:y.kind!=="directory"&&v.kind==="directory"?1:y.name.localeCompare(v.name)),w={id:`current:${f}`,label:fG(f).trim(),description:ui(f),insertText:fG(f),kind:"insert"};return[...m?[]:[w],...b.map(y=>{const v=Mde(f,y.name),x=em(y.name),k=ui(v),S=Th(v);return y.kind==="directory"?{id:`dir:${v}`,label:`${x}/`,description:k,kind:"directory",targetPath:v}:{id:`file:${v}`,label:x,description:k,insertText:`@${Xg(S)} `,kind:"insert"}})].slice(0,m?kp:Ade)}catch(f){return o.aborted||console.warn("Failed to load @ file suggestions",f),[]}const d=l==null?void 0:l.globWorkspace;if(!d)return console.warn("[@mention] file provider unavailable: workspace actions are not configured"),[];try{const f=eR(i),m=await ZM(n().globResults,f,()=>d(f,{maxResults:kp,signal:o}));return o.aborted?[]:m.matches.filter(p=>p!==".").map(p=>({id:p,label:em(p),insertText:`@${Xg(Th(p))} `,kind:"insert"}))}catch(f){return o.aborted||console.warn("Failed to load @ file suggestions",f),[]}}}}function LKe(e,t,n,r){return{id:jv,label:n,description:r,order:2,async search({query:s,signal:i}){var l;const o=(l=e())==null?void 0:l.loadExtensionsStatus;if(!o)return[];try{const c=t();c.extensionsStatus??(c.extensionsStatus=o().catch(f=>{throw c.extensionsStatus=void 0,f}));const u=await c.extensionsStatus;if(i.aborted)return[];const d=s.toLowerCase();return u.extensions.filter(f=>f.isActive).map(f=>{const m=em(f.name),g=`@ext:${Xg(Th(f.name))}`,b=ui(f.displayName??""),w=ui(f.description??"");return{id:f.name,label:m,description:b&&b!==m?b:w,detail:b&&w?`${b} - ${w}`:b??w,composerTag:{id:`extension:${g}`,kind:"extension",value:b||m,serialized:g},insertText:`${g} `}}).filter(f=>T3(d,f.label,f.description)).sort((f,m)=>{const p=f.label.toLowerCase(),g=m.label.toLowerCase(),b=p.startsWith(d)?0:1,w=g.startsWith(d)?0:1;return b!==w?b-w:p.localeCompare(g)}).slice(0,kp)}catch(c){return i.aborted||console.warn("Failed to load @ extension suggestions",c),[]}}}}function PKe(e,t,n,r,s){return{id:rl,label:n,description:r,order:3,async search({query:i,signal:o}){var c;const l=(c=e())==null?void 0:c.loadMcpStatus;if(!l)return[];try{const u=t();u.mcpStatus??(u.mcpStatus=l().catch(m=>{throw u.mcpStatus=void 0,m}));const d=await u.mcpStatus;if(o.aborted)return[];const f=i.toLowerCase();return d.servers.filter(m=>!m.disabled).map(m=>{const p=Th(m.name),g=m.resourceCount===void 0?void 0:s(m.resourceCount);return m.resourceCount===0?{id:`mcp-server-ref:${m.name}`,label:em(m.name),description:ui(m.description??""),detail:ui(m.description??""),insertText:`@mcp:${Xg(p)} `,kind:"insert"}:{id:`mcp-server:${m.name}`,label:em(m.name),description:g===void 0?ui(m.description??""):g,detail:ui(m.description??""),kind:"mcp-server",serverName:m.name}}).filter(m=>T3(f,m.label,m.description)).sort((m,p)=>m.label.localeCompare(p.label)).slice(0,kp)}catch(u){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",u),[]}}}}function OKe(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function $Ke({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:r,workspaceKey:s,builtinProviders:i,providers:o=pKe,createInlineTagEffect:l}){const{t:c}=rt(),[u,d]=h.useState(null),f=h.useRef(null),m=h.useRef(0),p=h.useRef(null),g=h.useRef(null),b=h.useRef("."),w=h.useRef(oC()),y=h.useRef(null),v=h.useRef(null),x=h.useRef(!1),k=h.useMemo(()=>[...[DKe(()=>r.current,()=>b.current,()=>w.current,c("at.category.files"),c("at.category.files.description")),LKe(()=>r.current,()=>w.current,c("at.category.extensions"),c("at.category.extensions.description")),PKe(()=>r.current,()=>w.current,c("at.category.mcpResources"),c("at.category.mcpResources.description"),K=>c("mcp.resourceCount",{count:K}))].filter(K=>wKe(K.id,i)),...xKe(o)].sort((K,ce)=>(K.order??0)-(ce.order??0)),[i,o,c,r]),S=h.useRef(k);S.current=k;const T=h.useMemo(()=>k.map(W=>({id:W.id,provider:W,textValue:hG(W),label:typeof W.label=="string"?hG(W):W.label,description:W.description===void 0?void 0:ui(W.description),tabs:W.tabs,renderItem:W.renderItem})),[k]),_=h.useRef(T);_.current=T;const C=h.useCallback(W=>{const K=typeof W=="function"?W(f.current):W;yKe(f.current,K)||(f.current=K,d(K))},[]);h.useEffect(()=>{var W;(W=p.current)==null||W.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null),b.current=".",w.current=oC(),f.current=null,d(null)},[s]);const j=h.useCallback(()=>{var W;(W=p.current)==null||W.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null)},[]),E=h.useCallback((W={})=>{if(f.current===null&&p.current===null&&g.current===null&&y.current===null&&v.current===null&&!x.current)return;j(),w.current=oC();const K=W.preserveProviderSelection||x.current;x.current=!1,K||(y.current=null,v.current=null),C(null)},[j,C]),L=h.useCallback(()=>{const W=f.current;return W?W.level==="items"?(j(),C({...W,level:"categories",selectedProviderId:void 0,selectedIndex:0,query:"",items:[],loading:!1,itemMode:void 0,mcpServerName:void 0,fileDirectory:void 0,inputMode:void 0,tabs:void 0,selectedTabId:void 0}),"categories"):(E(),"closed"):!1},[j,E,C]);h.useEffect(()=>()=>{var W;g.current&&clearTimeout(g.current),(W=p.current)==null||W.abort(),p.current=null,b.current=".",w.current=oC()},[]);const D=h.useCallback((W,K,ce)=>{const ie=f.current;return(ie==null?void 0:ie.level)!=="items"||ie.selectedProviderId!==W||ie.selectedTabId!==ce.selectedTabId||ie.itemMode!==ce.itemMode||ie.mcpServerName!==ce.mcpServerName||ie.fileDirectory!==ce.fileDirectory?[]:ie.query!==K&&!_4(W)?[]:W===el&&K===""&&b.current==="."?[]:ie.items},[]),M=h.useCallback((W,K)=>{const ce=r.current,ie=w.current;if(W===el){if(K&&(ce!=null&&ce.globWorkspace))return ie.globResults.has(eR(K));if(ce!=null&&ce.listDirectory){const{dirPath:ee}=Dde(K,Pf(b.current));return ie.directories.has(ee)}const Z=eR(K);return!!(ce!=null&&ce.globWorkspace)&&ie.globResults.has(Z)}return W===jv?ie.extensionsStatus!==void 0:W===rl?ie.mcpStatus!==void 0:!1},[r]),R=h.useCallback((W,K,ce,ie={})=>{var pe;const Z=S.current.find(he=>he.id===W);if(!Z){console.warn(`[@mention] provider="${W}" not found (may have been removed)`),C(null);return}(pe=p.current)==null||pe.abort();const ee=new AbortController;p.current=ee;const oe=m.current+1;m.current=oe;const we=D(W,K,ce);ie.loadingAlreadySet||C({...ce,items:we,loading:!0}),Promise.resolve().then(()=>Z.search({query:K,signal:ee.signal,tabId:ce.selectedTabId})).then(he=>{ee.signal.aborted||m.current!==oe||C(X=>{if(!X||X.level!=="items")return X;const ye=W===el&&K.length===0?Ade:kp;return{...X,items:he.slice(0,ye).map(Ce=>MKe(Ce,{customProvider:!_4(W)})),selectedIndex:0,loading:!1}})}).catch(he=>{ee.signal.aborted||m.current!==oe||(console.warn(`[@mention] provider="${W}" query=<redacted> failed`,he),C(X=>!X||X.level!=="items"?X:{...X,items:[],selectedIndex:0,loading:!1}))})},[D,C]),$=h.useCallback((W,K,ce)=>{var Z;g.current&&clearTimeout(g.current),(Z=p.current)==null||Z.abort(),p.current=null;const ie=D(W,K,ce);if(C({...ce,items:ie,loading:!0}),M(W,K)){R(W,K,ce,{loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,R(W,K,ce,{loadingAlreadySet:!0})},dG)},[D,M,R,C]),B=h.useCallback((W,K,ce,ie={})=>{var ye,Ce;const Z=r.current,ee=Z==null?void 0:Z.loadMcpResources;if(!ee){console.warn(`[@mention] loadMcpResources not available for server="${W}"`),C({...ce,items:[],loading:!1});return}(ye=p.current)==null||ye.abort();const oe=new AbortController;p.current=oe;const we=m.current+1;m.current=we;const pe=((Ce=f.current)==null?void 0:Ce.level)==="items"&&f.current.itemMode==="mcpResources"&&f.current.mcpServerName===W?f.current.items:[];ie.loadingAlreadySet||C({...ce,items:pe,loading:!0});const he=Z==null?void 0:Z.loadMcpStatus;(ie.validateServer?EKe(Z,W,oe.signal,he?()=>{const ae=w.current;return ae.mcpStatus??(ae.mcpStatus=he().catch(me=>{throw ae.mcpStatus=void 0,me})),ae.mcpStatus}:void 0):Promise.resolve(!0)).then(ae=>oe.signal.aborted?{resources:[]}:ae?ZM(w.current.mcpResources,W,()=>ee(W,{signal:oe.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:W}),{resources:[]})).then(ae=>{if(oe.signal.aborted||m.current!==we)return;const me=ae.resources.map(We=>{const Oe=ui(We.title??"")??ui(We.name??"")??em(We.uri);return{id:`mcp-resource:${W}:${We.uri}`,label:Oe,description:ui(We.description??"")??ui(We.mimeType??""),detail:em(We.uri),insertText:SKe(W,We.uri),kind:"insert"}}).filter(We=>T3(K,We.label,We.description,We.detail)).sort((We,Oe)=>We.label.localeCompare(Oe.label)).slice(0,kp);C(We=>!We||We.level!=="items"?We:{...We,items:me,selectedIndex:0,loading:!1})}).catch(ae=>{oe.signal.aborted||m.current!==we||(console.warn("Failed to load @ MCP resources",ae),C(me=>!me||me.level!=="items"?me:{...me,items:[],selectedIndex:0,loading:!1}))})},[C,r]),N=h.useCallback((W,K,ce,ie={})=>{var ee,oe;g.current&&clearTimeout(g.current),(ee=p.current)==null||ee.abort(),p.current=null;const Z=((oe=f.current)==null?void 0:oe.level)==="items"&&f.current.itemMode==="mcpResources"&&f.current.mcpServerName===W&&ce.itemMode==="mcpResources"?f.current.items:[];if(C({...ce,items:Z,loading:!0}),w.current.mcpResources.has(W)){B(W,K,ce,{...ie,loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,B(W,K,ce,{...ie,loadingAlreadySet:!0})},dG)},[B,C]),z=h.useCallback(W=>{if(t.current||n.current)return E(),!1;const K=jKe(W);if(!K)return E(),!1;const ce=f.current;if((ce==null?void 0:ce.level)==="items"&&ce.from===K.from&&(ce.to===K.to||ce.inputMode==="search"&&K.to>=ce.to||ce.inputMode==="context"&&K.to>=ce.to)&&ce.selectedProviderId!==void 0&&_.current.some(ee=>ee.id===ce.selectedProviderId)){if(!ce.selectedProviderId)return!0;const ee=ce.selectedProviderId,oe=ce.inputMode==="context"?TKe(ee,K.query,ce.mcpServerName):ce.query;if(oe!==ce.query){const we={...ce,from:K.from,to:K.to,query:oe,selectedIndex:0,providers:_.current};return ee===rl&&ce.itemMode==="mcpResources"&&ce.mcpServerName?(N(ce.mcpServerName,oe,we,{validateServer:ce.validateMcpServer}),!0):($(ee,oe,we),!0)}return C({...ce,from:K.from,to:K.to,query:oe,providers:_.current}),!0}const Z=_.current.filter(ee=>T3(K.query,ee.textValue,ee.description)).slice(0,kp);if((ce==null?void 0:ce.level)==="categories"&&ce.from===K.from&&ce.to===K.to&&ce.query===K.query&&vKe(ce.providers,Z))return!0;if(Z.length===0&&K.query){const ee=CKe(K.query,y.current,v.current);if(ee&&_.current.some(we=>we.id===ee.providerId))return ee.providerId===rl&&ee.serverName?(v.current=ee.serverName,N(ee.serverName,ee.itemQuery,{from:K.from,to:K.to,query:ee.itemQuery,level:"items",selectedProviderId:rl,selectedIndex:0,providers:_.current,itemMode:"mcpResources",mcpServerName:ee.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:ee.validateServer},{validateServer:ee.validateServer}),!0):($(ee.providerId,ee.itemQuery,{from:K.from,to:K.to,query:ee.itemQuery,level:"items",selectedProviderId:ee.providerId,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:ee.providerId===el?b.current:void 0,inputMode:"context"}),!0);const oe=_.current.find(we=>!_4(we.id)&&K.query.startsWith(`${we.id}:`));if(oe){const we=K.query.slice(oe.id.length+1);return $(oe.id,we,{from:K.from,to:K.to,query:we,level:"items",selectedProviderId:oe.id,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(_.current.some(we=>we.id===el))return b.current=".",$(el,K.query,{from:K.from,to:K.to,query:K.query,level:"items",selectedProviderId:el,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:b.current,inputMode:"context"}),!0}return C({from:K.from,to:K.to,query:K.query,level:"categories",selectedIndex:0,providers:Z,items:[],loading:!1,inputMode:void 0}),!0},[E,t,$,N,C,n]),G=h.useCallback(W=>{const K=f.current;if(!K)return!1;const ce=K.level==="categories"?K.providers.length:K.items.length;if(ce<=0)return!0;const ie=OKe(K.selectedIndex,ce,W);return ie===null||C({...K,selectedIndex:ie}),!0},[C]),I=h.useCallback(W=>{const K=f.current;if(!K)return!1;const ce=K.level==="categories"?K.providers.length:K.items.length;return W<0||W>=ce?!1:(C({...K,selectedIndex:W}),!0)},[C]),Y=h.useCallback(W=>{var Z,ee;const K=f.current;if(!K||K.level!=="categories")return!1;const ce=K.providers[W??K.selectedIndex];if(!ce)return!1;y.current=ce.id,ce.id===el&&(b.current=".");const ie=(ee=(Z=ce.tabs)==null?void 0:Z.find(oe=>!oe.disabled))==null?void 0:ee.id;return $(ce.id,K.query,{...K,level:"items",selectedProviderId:ce.id,selectedIndex:0,tabs:ce.tabs,selectedTabId:ie,itemMode:ce.id===rl?"mcpServers":"default",mcpServerName:void 0,fileDirectory:ce.id===el?b.current:void 0,inputMode:"search"}),!0},[$]),U=h.useCallback(W=>{const K=f.current;if(!K||K.level!=="items"||!K.selectedProviderId)return!1;const ce={...K,query:W,selectedIndex:0,inputMode:"search"};return K.selectedProviderId===rl&&K.itemMode==="mcpResources"&&K.mcpServerName?(N(K.mcpServerName,W,ce,{validateServer:K.validateMcpServer}),!0):($(K.selectedProviderId,W,ce),!0)},[$,N]),P=h.useCallback(W=>{var ie;const K=f.current;if(!K||K.level!=="items"||!K.selectedProviderId||!((ie=K.tabs)!=null&&ie.some(Z=>Z.id===W&&!Z.disabled)))return!1;if(K.selectedTabId===W)return!0;const ce={...K,selectedTabId:W,selectedIndex:0,inputMode:"search"};return $(K.selectedProviderId,K.query,ce),!0},[$]),F=h.useCallback(()=>{const W=f.current;if(!W||W.level!=="items")return!1;if(W.selectedProviderId===rl&&W.itemMode==="mcpResources")return $(rl,"",{...W,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(W.selectedProviderId===el){const K=Pf(W.fileDirectory??b.current);if(K!==".")return b.current=AKe(K),$(el,"",{...W,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),"items"}return C({...W,level:"categories",selectedProviderId:void 0,selectedIndex:0,query:"",items:[],loading:!1,itemMode:void 0,mcpServerName:void 0,fileDirectory:void 0,inputMode:void 0,tabs:void 0,selectedTabId:void 0}),j(),"categories"},[j,$,C]),te=h.useCallback(W=>{const K=f.current;if(!K)return!1;if(K.level==="categories")return Y(W);const ce=e.current;if(!ce)return!1;if(K.loading)return!0;const ie=K.items[W??K.selectedIndex];if(!ie)return!1;if(K.selectedProviderId&&(y.current=K.selectedProviderId),K.selectedProviderId===el&&ie.kind==="directory"&&ie.targetPath)return b.current=Pf(ie.targetPath),$(el,"",{...K,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),!0;if(K.selectedProviderId===rl&&ie.kind==="mcp-server"&&ie.serverName)return v.current=ie.serverName,N(ie.serverName,"",{...K,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:ie.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const Z=ie.insertText??`@${Xg(Th(ie.label))} `,ee=ie.composerTag&&!/\s$/.test(Z)?`${Z} `:Z,oe=ce.state.doc.length;if(K.from<0||K.to<K.from||K.to>oe)return console.warn("[@mention] stale insertion range",{from:K.from,to:K.to,docLength:oe}),E(),!0;if(!ce.state.doc.sliceString(K.from,K.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:K.from,to:K.to}),E(),!0;x.current=!0;const pe=RKe(K.selectedProviderId,ie,ee),he=ee.trimEnd(),X=pe&&l?[l({from:K.from,to:K.from+he.length,tag:pe})]:void 0;return ce.dispatch({changes:{from:K.from,to:K.to,insert:ee},...X?{effects:X}:{},selection:{anchor:K.from+ee.length},scrollIntoView:!0}),ce.focus(),E({preserveProviderSelection:!0}),!0},[E,Y,l,$,N,e]);return{state:u,close:E,closeIfOpen:L,refreshForView:z,moveSelection:G,select:I,accept:te,enterCategory:Y,selectTab:P,backToCategories:F,updateSearch:U}}const BKe=Un.mark({class:"cm-input-slash"}),zKe=Un.mark({class:"cm-input-at"}),FKe=Un.mark({class:"cm-input-code"});class qKe extends ou{constructor(t){super(),this.text=t}eq(t){return t.text===this.text}toDOM(){const t=document.createElement("span");return t.className="cm-input-slash-argument-hint",t.textContent=this.text,t}ignoreEvent(){return!0}}function mG(e,t,n){const r=new Ch,s=e.state.doc,i=[];let o=0,l=null,c=null;for(const u of e.visibleRanges){const d=s.lineAt(u.from).number,f=s.lineAt(u.to).number;for(let m=d;m<=f;m++){if(m<=o)continue;o=m;const p=s.line(m),g=p.text,b=p.from;if(g.startsWith("/")){const x=g.indexOf(" "),k=x===-1?g.length:x;i.push({from:b,to:b+k,deco:BKe}),l??(l=t()),c??(c=n());const S=lKe(g,l,c);if(S){const T=g.endsWith(" ")?"":" ";i.push({from:b+g.length,to:b+g.length,deco:Un.widget({widget:new qKe(`${T}${S}`),side:1})})}}const w=/@[^\s]+/g;let y;for(;(y=w.exec(g))!==null;)i.push({from:b+y.index,to:b+y.index+y[0].length,deco:zKe});const v=/`[^`]+`/g;for(;(y=v.exec(g))!==null;)i.push({from:b+y.index,to:b+y.index+y[0].length,deco:FKe})}}i.sort((u,d)=>u.from-d.from||u.to-d.to);for(const{from:u,to:d,deco:f}of i)r.add(u,d,f);return r.finish()}function HKe(e=()=>[],t=()=>"en"){return Ui.fromClass(class{constructor(n){Ue(this,"decorations");this.decorations=mG(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=mG(n.view,e,t))}},{decorations:n=>n.decorations})}const UKe=en.baseTheme({".cm-input-slash":{color:"var(--agent-blue-500, #4a9eff)",fontWeight:"bold"},".cm-input-at":{color:"var(--success-color, #48bb78)"},".cm-input-code":{background:"rgba(255, 255, 255, 0.06)",borderRadius:"3px",color:"var(--muted-foreground, #a0aec0)"},".cm-input-slash-argument-hint":{color:"color-mix(in srgb, var(--muted-foreground) 70%, transparent)",pointerEvents:"none"}});function Qg(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function P6(e){return`url("${e.replace(/["\\\n\r\f]/g,n=>{switch(n){case'"':case"\\":return`\\${n}`;case`
`:return"\\A ";case"\r":return"\\D ";case"\f":return"\\C ";default:return""}})}")`}function ap(e,t){return{[e]:P6(t)}}const WKe=1e3,VKe=10,pG="web-shell-tooltip-styles",GKe=`
[data-web-shell-tooltip-portal] {
  pointer-events: none;
}

[data-web-shell-tooltip-portal] .cm-tooltip {
  z-index: var(--web-shell-tooltip-z-index, 1000);
  pointer-events: auto;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete {
  --web-shell-completion-label-width: 20ch;
  --web-shell-completion-column-gap: 2ch;
  --web-shell-completion-detail-start: calc(
    var(--web-shell-completion-label-width) +
      var(--web-shell-completion-column-gap)
  );
  min-width: 500px !important;
  max-width: 700px !important;
  max-height: 400px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  background: var(--background, #0d0d0d) !important;
  border: 1px solid var(--border, #2a2a2a) !important;
  border-radius: 6px !important;
  overflow: visible;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete > ul {
  max-height: 380px !important;
  overflow: auto;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete > ul::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete > ul::-webkit-scrollbar-track {
  background: transparent;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete > ul::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li {
  display: flex !important;
  align-items: center;
  min-width: 0;
  padding: 4px 8px !important;
  color: var(--foreground, #e4e4e4) !important;
  overflow: hidden;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete .cm-at-ref-completion-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-right: 10px;
  background: currentColor;
  mask: var(--composer-tag-icon-url) center / contain no-repeat;
  -webkit-mask: var(--composer-tag-icon-url) center / contain no-repeat;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li:hover {
  background: var(--secondary, #1e1e1e) !important;
  color: var(--foreground, #e4e4e4) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li[aria-selected] {
  background: var(--secondary, #1e1e1e) !important;
  color: var(--foreground, #e4e4e4) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li:is(:hover, [aria-selected]) .cm-completionLabel {
  color: var(--agent-blue-500, #4a9eff);
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section {
  display: block !important;
  height: auto;
  margin: 6px 10px 4px;
  padding: 2px 0 4px !important;
  line-height: 1.2;
  color: var(--muted-foreground, #a1a1aa) !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section:first-of-type {
  margin-top: 6px;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete .cm-completionLabel {
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
  width: var(--web-shell-completion-label-width);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-extension .cm-completionLabel,
[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-mcp .cm-completionLabel,
[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-file .cm-completionLabel {
  width: calc(var(--web-shell-completion-label-width) - 20px);
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete .cm-completionDetail {
  flex: 1 1 auto;
  min-width: 0;
  font-style: normal;
  color: var(--muted-foreground);
  font-size: 13px;
  margin-left: var(--web-shell-completion-column-gap);
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-file-completion .cm-completionLabel {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: none;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-command-info-completion {
  display: grid !important;
  grid-template-columns: var(--web-shell-completion-label-width) minmax(0, 1fr);
  column-gap: var(--web-shell-completion-column-gap);
  align-items: baseline !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-command-info-completion .cm-completionLabel {
  min-width: 0;
  max-width: none;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-command-info-completion .cm-completionDetail {
  margin-left: 0;
  white-space: nowrap;
}

[data-web-shell-tooltip-portal] .cm-tooltip.cm-completionInfo {
  z-index: calc(var(--web-shell-tooltip-z-index, 1000) + 1);
  width: min(320px, calc(100vw - 32px));
  max-width: min(320px, calc(100vw - 32px)) !important;
  max-height: min(280px, calc(100vh - 32px));
  padding: 8px 10px;
  overflow: auto;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  background: var(--muted, #161616);
  color: var(--foreground, #e4e4e4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

[data-web-shell-tooltip-portal] .cm-completionInfo-hover {
  pointer-events: auto;
  z-index: calc(var(--web-shell-tooltip-z-index, 1000) + 1);
}

[data-web-shell-tooltip-portal] .cm-tooltip.cm-completionInfo::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-web-shell-tooltip-portal] .cm-tooltip.cm-completionInfo::-webkit-scrollbar-track {
  background: transparent;
}

[data-web-shell-tooltip-portal] .cm-tooltip.cm-completionInfo::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-right {
  margin-left: var(--web-shell-completion-column-gap);
}

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-right-narrow {
  left: var(--web-shell-completion-detail-start);
}

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-left {
  margin-right: var(--web-shell-completion-column-gap);
}

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-left-narrow {
  right: var(--web-shell-completion-detail-start);
}
`;function gG(e){if(e.getElementById(pG))return;const n=(e instanceof Document?e:e.ownerDocument).createElement("style");n.id=pG,n.textContent=GKe,e instanceof Document?e.head.appendChild(n):e.appendChild(n)}function bG(e){const t=e.getRootNode();return t instanceof ShadowRoot?t:e.ownerDocument}function KKe(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function YKe(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function RP(e){return YKe(e)}function XKe(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function QKe(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function JKe(e,t,n){if(!t.detail||!RP(t))return;const r=e.closest("[data-web-shell-tooltip-portal]");if(!r)return;let s=r.querySelector(".cm-completionInfo-hover");s||(s=document.createElement("div"),s.className="cm-tooltip cm-completionInfo cm-completionInfo-hover cm-completionInfo-right-narrow",r.appendChild(s)),s.textContent=`${XKe(t)}

${t.detail}`;const i=s.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete s.dataset.hideTimerId);const o=s.getBoundingClientRect(),l=18,c=12,u=12,d=window.innerWidth,f=window.innerHeight,m=n.clientX+l,p=m+o.width+u>d?Math.max(u,n.clientX-o.width-l):m,g=Math.min(Math.max(u,n.clientY+c),Math.max(u,f-o.height-u));s.style.position="fixed",s.style.left=`${p}px`,s.style.top=`${g}px`,s.style.right="auto",s.style.bottom="auto"}function ZKe(e){const t=e.querySelector(".cm-completionInfo-hover");if(!t)return;const n=window.setTimeout(()=>{t.remove()},180);t.dataset.hideTimerId=String(n),t.addEventListener("mouseenter",()=>{window.clearTimeout(n),delete t.dataset.hideTimerId},{once:!0}),t.addEventListener("mouseleave",()=>{t.remove()},{once:!0})}function eYe(e){if(!e.detail||!RP(e))return null;const t=document.createElement("span");return t.className="cm-command-hover-info-anchor",t.setAttribute("aria-hidden","true"),queueMicrotask(()=>{const n=t.closest("li");!n||n.hasAttribute("data-web-shell-hover-info")||(n.setAttribute("data-web-shell-hover-info","true"),n.addEventListener("mouseenter",r=>{JKe(t,e,r)}),n.addEventListener("mouseleave",()=>{const r=t.closest("[data-web-shell-tooltip-portal]");r&&ZKe(r)}))}),t}function tYe(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function nYe(e){return[...e].length>WKe||e.split(`
`).length>VKe}function Lde(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rYe(e,t,n){const s=`[Pasted Content ${[...n].length} chars]`,i=t===1?s:`${s} #${t}`;return e.set(i,n),{placeholderText:i,nextPasteId:t+1}}function sYe(e,t){if(e.size===0)return null;const n=[...e.keys()].sort((i,o)=>o.length-i.length),r=new RegExp(n.map(Lde).join("|"),"g"),s=new Set;for(const i of t.matchAll(r))s.add(i[0]);for(const i of e.keys())s.has(i)||e.delete(i);return e.size===0?1:null}function aC(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((s,i)=>i.length-s.length),r=new RegExp(n.map(Lde).join("|"),"g");return t.replace(r,s=>e.get(s)??s)}function Qx(e){return h5(e)}function iYe(e){return e.map(Qx).join(`
`)}function O6(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function $6(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function DP(e){return $6(e)||O6(e)||e.id}function oYe(e,t){const n=iYe(t);return n?e?`${n}

${e}`:n:e}function aYe(e,t){const n=t.filter(i=>i.start>=0&&i.end>i.start&&i.end<=e.length).slice().sort((i,o)=>i.start-o.start);if(n.length===0)return e;let r=0;const s=[];for(const i of n)i.start<r||(s.push(e.slice(r,i.start)),s.push(Qx(i.tag)),r=i.end);return s.push(e.slice(r)),s.join("")}function B6(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const sg=Tr.define({map:e=>e}),E3=Tr.define(),Dc=Tr.define();let lYe=0;class cYe extends ou{constructor(n){super();Ue(this,"contentRoot",null);Ue(this,"tooltipRoot",null);this.tag=n}eq(n){return this.tag.id===n.tag.id&&this.tag.label===n.tag.label&&this.tag.value===n.tag.value&&this.tag.kind===n.tag.kind&&this.tag.icon===n.tag.icon&&this.tag.serialized===n.tag.serialized&&this.tag.removable===n.tag.removable&&this.tag.iconUrl===n.tag.iconUrl&&this.tag.renderContent===n.tag.renderContent&&this.tag.tooltip===n.tag.tooltip&&this.tag.tooltipText===n.tag.tooltipText&&this.tag.onClick===n.tag.onClick}toDOM(n){var m,p,g;const r=document.createElement("span"),s=B6(this.tag);r.style.cssText="position:relative;display:inline-flex;align-items:center;max-width:min(44ch,100%);min-height:20px;margin:0 0.25ch;border:1px solid var(--border);border-radius:4px;background:var(--secondary);color:var(--foreground);font-family:var(--font-mono,monospace);font-size:12px;line-height:1.2;vertical-align:baseline;",this.tag.onClick&&(r.setAttribute("role","button"),r.tabIndex=0,r.style.cursor="pointer",r.addEventListener("pointerdown",b=>{b.preventDefault(),b.stopPropagation()}),r.addEventListener("mousedown",b=>{b.preventDefault(),b.stopPropagation()}),r.addEventListener("click",b=>{var w,y;b.stopPropagation(),(y=(w=this.tag).onClick)==null||y.call(w,{tag:s,placement:"composer",readonly:!1,anchorRect:r.getBoundingClientRect()})}),r.addEventListener("keydown",b=>{var w,y;b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),(y=(w=this.tag).onClick)==null||y.call(w,{tag:s,placement:"composer",readonly:!1,anchorRect:r.getBoundingClientRect()}))}));const i=O6(this.tag),o=$6(this.tag),l=this.tag.kind?"":i,c=this.tag.iconUrl??a1(this.tag.kind),u=c&&(lD(c)||Cv(c))?c:void 0;let d;try{d=(p=(m=this.tag).renderContent)==null?void 0:p.call(m,{tag:s,placement:"composer",readonly:!1})}catch(b){console.warn("[WebShell] inline tag renderContent failed",b)}let f=!1;if(d!=null){const b=document.createElement("span");b.style.cssText="display:inline-flex;align-items:center;min-width:0;max-width:100%;";try{this.contentRoot=TN.createRoot(b),this.contentRoot.render(d),r.appendChild(b),f=!0}catch(w){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",w)}}if(!f&&u){const b=document.createElement("span");b.style.cssText="display:block;width:12px;height:12px;flex:0 0 auto;margin-left:7px;background:currentColor;mask:var(--composer-tag-icon-url) center / contain no-repeat;-webkit-mask:var(--composer-tag-icon-url) center / contain no-repeat;",b.style.setProperty("--composer-tag-icon-url",P6(u)),r.appendChild(b)}return f||this.appendDefaultContent(r,l,o),this.tag.tooltip!==void 0&&this.tag.tooltip!==null&&this.appendTooltip(r,this.tag.tooltip),this.tag.removable!==!1&&this.appendRemoveButton(r,n),r}appendDefaultContent(n,r,s){if(r){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=r,n.appendChild(i)}if(s){const i=document.createElement("span");i.style.cssText="max-width:32ch;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 0.5ch;color:var(--foreground, #e4e4e4);",i.textContent=s,n.appendChild(i)}else if(!r){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=this.tag.id,n.appendChild(i)}}appendTooltip(n,r){var l;const s=document.createElement("span");s.setAttribute("role","tooltip"),s.style.cssText="position:absolute;z-index:calc(var(--web-shell-tooltip-z-index,1000) + 1);top:calc(100% + 6px);left:0;display:none;min-width:160px;max-width:min(320px,80vw);padding:8px 10px;border:1px solid var(--border);border-radius:6px;background:var(--background);box-shadow:0 8px 24px rgba(0,0,0,0.18);color:var(--foreground);font-family:var(--font-sans,system-ui,sans-serif);font-size:12px;line-height:1.5;white-space:normal;";try{this.tooltipRoot=TN.createRoot(s),this.tooltipRoot.render(r),n.appendChild(s),s.id=`composer-tag-tooltip-${++lYe}`,n.setAttribute("aria-describedby",s.id)}catch(c){(l=this.tooltipRoot)==null||l.unmount(),this.tooltipRoot=null,this.tag.tooltipText&&(n.title=this.tag.tooltipText),console.warn("[WebShell] inline tag tooltip render failed",c);return}const i=()=>{s.style.display="block"},o=()=>{s.style.display="none"};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("focusin",i),n.addEventListener("focusout",o)}appendRemoveButton(n,r){const s=document.createElement("button");s.type="button",s.setAttribute("aria-label",`Remove ${DP(this.tag)}`),s.style.cssText="flex:0 0 auto;width:22px;height:22px;padding:0;border:0;background:transparent;color:var(--muted-foreground);font:inherit;line-height:22px;cursor:pointer;",s.textContent="×",s.addEventListener("mousedown",i=>i.preventDefault()),s.addEventListener("keydown",i=>{if(i.key==="Enter"||i.key===" "){i.stopPropagation();return}i.key!=="Backspace"&&i.key!=="Delete"||(i.preventDefault(),i.stopPropagation(),s.click())}),s.addEventListener("click",i=>{i.stopPropagation();const o=[];r.state.field(gf).between(0,r.state.doc.length,(l,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:l,to:c,insert:""})}),o.length!==0&&(r.dispatch({changes:o,effects:E3.of({predicate:l=>l.id===this.tag.id}),scrollIntoView:!0}),r.focus())}),s.addEventListener("mouseenter",()=>{s.style.color="var(--error-color)"}),s.addEventListener("mouseleave",()=>{s.style.color="var(--muted-foreground)"}),n.appendChild(s)}destroy(){var n,r;(n=this.contentRoot)==null||n.unmount(),(r=this.tooltipRoot)==null||r.unmount(),this.contentRoot=null,this.tooltipRoot=null}ignoreEvent(){return!1}}function uYe(e){const t={widget:new cYe(e.tag),inclusive:!1,tag:e.tag};return Un.replace(t).range(e.from,e.to)}const gf=hl.define({create(){return Un.none},update(e,t){let n=e.map(t.changes);for(const r of t.effects)r.is(sg)?n=n.update({add:[uYe(r.value)]}):r.is(E3)?n=n.update({filter:(s,i,o)=>{const l=o.spec.tag;return l&&r.value.predicate?!r.value.predicate(l):!0}}):r.is(Dc)&&(n=Un.none);return n},provide:e=>[en.decorations.from(e),en.atomicRanges.of(t=>t.state.field(e))]});function yG(e){const t=[],n=e.state.field(gf,!1);return n==null||n.between(0,e.state.doc.length,(r,s,i)=>{const o=i.spec.tag;o&&t.push(B6(o))}),t}function vG(e){const t=e.state.field(gf,!1);if(!t)return!1;let n=!1;return t.between(0,e.state.doc.length,()=>(n=!0,!1)),n}function dYe(e){const t=[];return e.state.field(gf).between(0,e.state.doc.length,(n,r,s)=>{const i=s.spec.tag;i&&t.push({start:n,end:r,tag:B6(i)})}),t}const wG=new p1,xG=new p1,kG=new p1;function ig(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function hYe(e,t){const n=ig(e,t);if(!n||e.length===0)return null;const r=n.slice(e.length);return r.length>0?r:null}class fYe extends ou{constructor(t){super(),this.text=t}eq(t){return this.text===t.text}toDOM(){const t=document.createElement("span");return t.className="cm-followup-ghost",t.textContent=this.text,t}ignoreEvent(){return!0}}function _G(e){return Ui.fromClass(class{constructor(t){Ue(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return Un.none;const n=t.state.selection.main,r=t.state.doc.toString(),s=hYe(r,e);return!s||!n.empty||n.head!==r.length?Un.none:Un.set([Un.widget({widget:new fYe(s),side:1}).range(r.length)])}},{decorations:t=>t.decorations})}const mYe="qwen-web-shell-session-draft:",pYe="qwen-web-shell-pending-task-draft:",SG=2e3;function gYe(e,t){if(e)return`${mYe}${encodeURIComponent(e)}`;if(t)return`${pYe}${encodeURIComponent(t)}`}function S4(e){if(!e)return null;try{return localStorage.getItem(e)}catch{return null}}function mx(e,t){if(e)try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}}function bYe(e,t){e&&S4(e)===t&&mx(e,"")}function yYe(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(r=>r!=="items"?Object.is(e[r],t[r]):e.items.length===t.items.length&&e.items.every((s,i)=>{const o=t.items[i];if(!o)return!1;const l=Object.keys(s);return l.length===Object.keys(o).length&&l.every(c=>Object.is(s[c],o[c]))}))}function CG(e,t){const n=e.state.doc;if(n.lines<=1)return"history";const r=e.state.selection.main;if(!r.empty)return"editor";const s=r.head,i=n.lineAt(s);return t==="up"?i.number>1?"editor":s>i.from?(e.dispatch({selection:{anchor:i.from},scrollIntoView:!0}),"handled"):"history":i.number<n.lines?"editor":s<i.to?(e.dispatch({selection:{anchor:i.to},scrollIntoView:!0}),"handled"):"history"}function TG(e,t){let n=!1;for(const r of e)if(r.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(r.type)){n=!0;const s=r.getAsFile();if(!s)continue;const i=r.type,o=new FileReader;o.onload=()=>{const l=o.result.split(",")[1];t({data:l,media_type:i})},o.readAsDataURL(s)}return n}function vYe(e){const{onSubmit:t,onInputTextChange:n,onCycleMode:r,onToggleShortcuts:s,disabled:i=!1,placeholderText:o="Type a message...",commands:l,skills:c=[],slashCommandCategoryOrder:u,queuedMessages:d=[],onPopQueuedMessages:f,currentMode:m="default",onFocusFooter:p,dialogOpen:g=!1,followupState:b,onAcceptFollowup:w,onDismissFollowup:y,sessionId:v,sessionName:x,composerInput:k,composerInputVersion:S,builtinAtProviders:T,atProviders:_,atWorkspaceCwd:C,composerTagIcons:j,parseUserMessageContent:E,renderComposerTag:L,renderComposerTagTooltip:D,onComposerTagClick:M,editorTheme:R}=e,$=VZ(),{language:B,t:N}=rt(),z=Gu(),G=cG(C),I=cG(),Y=G===I?void 0:I,U=gYe(v,C),P=h.useRef(null),F=h.useRef(null),te=IGe(),W=h.useRef(null),K=h.useRef(null),[ce,ie]=h.useState(()=>te?S4(U)??"":""),Z=h.useRef(ce),ee=h.useRef(0),oe=h.useRef({sessionId:v,workspaceCwd:C,storageKey:U}),we=h.useRef(!1),pe=h.useRef(()=>{}),he=h.useRef(()=>{}),X=h.useRef({sessionId:v,promptHistoryStorageKey:G,promptHistoryFallbackStorageKey:Y,draftStorageKey:U});X.current={sessionId:v,promptHistoryStorageKey:G,promptHistoryFallbackStorageKey:Y,draftStorageKey:U};const ye=h.useRef(null),Ce=h.useRef(t);Ce.current=t;const ae=h.useRef(n);ae.current=n;const me=h.useCallback(re=>{var ge;ee.current+=1,Z.current=re,ie(re),oe.current.storageKey===void 0&&(we.current=!0),!_r.current&&!He.current&&he.current(),(ge=ae.current)==null||ge.call(ae,re)},[]);h.useEffect(()=>{var re;te&&Z.current&&((re=ae.current)==null||re.call(ae,Z.current))},[]);const We=h.useRef(r);We.current=r;const Oe=h.useRef(s);Oe.current=s;const Mt=h.useRef(i);Mt.current=i;const $t=h.useRef(l);$t.current=l;const St=h.useRef(c);St.current=c;const ue=h.useRef(u);ue.current=u;const Ee=h.useRef(N);Ee.current=N;const tt=h.useRef(d);tt.current=d;const ut=h.useRef(f);ut.current=f;const Ct=h.useRef(b);Ct.current=b;const Ze=h.useRef(w);Ze.current=w;const Et=h.useRef(y);Et.current=y;const Nt=h.useRef(p);Nt.current=p;const gt=h.useRef(B);gt.current=B;const Je=h.useRef(void 0);if($&&C){const re=$.client.workspaceByCwd(C);Je.current={...$.actions,async globWorkspace(ge,ze){var Bt,zn;(Bt=ze==null?void 0:ze.signal)==null||Bt.throwIfAborted();const ot=await re.glob(ge,{maxResults:ze==null?void 0:ze.maxResults,signal:ze==null?void 0:ze.signal});return(zn=ze==null?void 0:ze.signal)==null||zn.throwIfAborted(),{matches:Array.isArray(ot.matches)?ot.matches.filter(Zn=>typeof Zn=="string"):[]}},async listDirectory(ge,ze){var mn,Bt;if((mn=ze==null?void 0:ze.signal)!=null&&mn.aborted)return{kind:"list",path:ge,entries:[],truncated:!1};const ot=await re.dirList(ge);return(Bt=ze==null?void 0:ze.signal)!=null&&Bt.aborted?{kind:"list",path:ge,entries:[],truncated:!1}:ot}}}else Je.current=$==null?void 0:$.actions;const Ae=h.useRef(j);Ae.current=j;const de=h.useRef(E);de.current=E;const nt=h.useRef(L);nt.current=L;const ve=h.useRef(D);ve.current=D;const Ke=h.useRef(M);Ke.current=M;const le=h.useCallback(re=>{var Bt;const ge=re.icon??a1(re.kind,Ae.current),ze={tag:re,placement:"composer",readonly:!1};let ot;try{ot=(Bt=ve.current)==null?void 0:Bt.call(ve,ze)}catch(zn){console.warn("[WebShell] inline tag tooltip render failed",zn)}const mn=typeof ot=="string"||typeof ot=="number"?String(ot):void 0;return{...re,...ge?{iconUrl:ge}:{},...nt.current?{renderContent:nt.current}:{},...ot!=null?{tooltip:ot}:{},...mn?{tooltipText:mn}:{},...Ke.current?{onClick:Ke.current}:{}}},[]),[Le,dt]=h.useState(!1),Fe=h.useRef(Le);Fe.current=Le;const Ge=$Ke({viewRef:F,disabledRef:Mt,shellModeRef:Fe,workspaceActionsRef:Je,workspaceKey:C,builtinProviders:T,providers:_,createInlineTagEffect:re=>sg.of({...re,tag:le(re.tag)})}),un=Ge.close,Wn=Ge.refreshForView;h.useEffect(()=>{const re=F.current;if(!re)return;const ge=[Dc.of()];re.state.field(gf).between(0,re.state.doc.length,(ze,ot,mn)=>{const Bt=mn.spec.tag;Bt&&ge.push(sg.of({from:ze,to:ot,tag:le(B6(Bt))}))}),ge.length!==1&&re.dispatch({effects:ge})},[j,M,L,D,le]);const Me=h.useCallback(()=>{var re,ge,ze;(re=Ct.current)!=null&&re.isVisible&&((ge=Et.current)==null||ge.call(Et)),dt(ot=>!ot),(ze=F.current)==null||ze.focus()},[]),[yt,cn]=h.useState(!1),[Re,et]=h.useState(""),[bt,rn]=h.useState([]),[qn,ft]=h.useState(0),He=h.useRef(yt);He.current=yt;const Ye=h.useRef(null),Yt=h.useRef(null),Cn=h.useRef(""),[Tn,zr]=h.useState([]),Ns=h.useRef([]),kr=h.useRef(new Map),si=h.useRef(1),[Fr,At]=h.useState([]),Xn=h.useRef([]);Xn.current=Fr;const[_e,Vt]=h.useState(!1),Dt=h.useRef(!1),Kn=h.useRef(null),Vn=h.useCallback(()=>{Kn.current===null&&(Kn.current=[...Xn.current])},[]),ds=h.useCallback(()=>{const re=Kn.current;if(re===null)return;Kn.current=null;const ge=[...re];Xn.current=ge,At(ge)},[]),hs=h.useCallback(()=>{Kn.current=null},[]),vs=h.useCallback(()=>{Xn.current=[],At([])},[]),Mr=h.useCallback((re,ge)=>{vs(),re.dispatch({changes:{from:0,to:re.state.doc.length,insert:ge},effects:Dc.of(),selection:{anchor:ge.length}})},[vs]),ji=h.useCallback((re,ge)=>{const ze=oD(ge,de.current,"[WebShell] failed to parse composer history content",{requireSourcePreservation:!0}),ot=(ze==null?void 0:ze.some(zn=>zn.type==="tag"))??!1;if(!ze||!ot){Mr(re,ge);return}const mn=[Dc.of()];let Bt="";for(const zn of ze){if(zn.type==="text"){Bt+=zn.text;continue}const Zn=h5(zn.tag),Mn=Bt.length;Bt+=Zn,mn.push(sg.of({from:Mn,to:Bt.length,tag:le(zn.tag)}))}vs(),re.dispatch({changes:{from:0,to:re.state.doc.length,insert:Bt},effects:mn,selection:{anchor:Bt.length}})},[vs,le,Mr]),os=h.useCallback((re,ge)=>{if(Fe.current){Mr(re,ge);return}ji(re,ge)},[ji,Mr]),zt=h.useCallback(re=>{const ge=F.current;if(!ge){te&&me(re);return}os(ge,re)},[te,os,me]),Ni=h.useRef(k);Ni.current=k;const Ur=h.useRef(()=>!0),vo=h.useRef(null),[wo,Ps]=h.useState(null),Gt=h.useRef(null),_r=h.useRef(!1);h.useEffect(()=>{let re,ge=0,ze=!1;const ot=()=>{re!==void 0&&(window.clearTimeout(re),re=void 0)},mn=()=>{if(_r.current||He.current)return!1;const En=F.current,fi=En?aC(kr.current,En.state.doc.toString()):Z.current;return mx(oe.current.storageKey,fi),!0},Bt=()=>{ot(),ge=0,ze&&mn()&&(ze=!1)},zn=()=>{const En=ge-Date.now();if(En>0){re=window.setTimeout(zn,En);return}re=void 0,Bt()},Zn=()=>{ze=!0,ge=Date.now()+SG,re===void 0&&(re=window.setTimeout(zn,SG))};pe.current=Bt,he.current=Zn;const Mn=()=>{document.visibilityState==="hidden"&&Bt()},vn=()=>Bt();return document.addEventListener("visibilitychange",Mn),window.addEventListener("pagehide",vn),()=>{window.removeEventListener("pagehide",vn),document.removeEventListener("visibilitychange",Mn),Bt(),pe.current=()=>{},he.current=()=>{}}},[]);const Er=h.useCallback(re=>{yYe(Gt.current,re)||(Gt.current=re,Ps(re))},[]),Do=h.useCallback(()=>{const re=vo.current,ge=F.current;if(!re||!ge)return;const ze=ge.state.doc,ot=re.from+re.text.length;ze.length===ot&&ze.sliceString(re.from,ot)===re.text&&ge.dispatch({changes:{from:re.from,to:ot,insert:""}}),vo.current=null},[]),fs=h.useCallback(()=>{Do(),un()},[Do,un]),di=Ge.closeIfOpen,ws=h.useCallback(()=>{const re=di();return re?(re==="closed"&&Do(),!0):!1},[Do,di]),xe=h.useCallback((re,ge)=>{var Mn;if(!re||Mt.current||Fe.current){Er(null);return}if(_r.current){Er(null);return}const ze=re.state.selection.main;if(!ze.empty){Er(null);return}const ot=re.state.doc.lineAt(ze.head);if(!ot.text.startsWith("/")){Er(null);return}const mn=hKe(ot.text,ze.head-ot.from,$t.current,St.current,gt.current,vn=>Ee.current(vn),ue.current??Jk);if(!mn){Er(null);return}const Bt={...mn,from:ot.from+mn.from,to:ot.from+mn.to};fs();const zn=ge??((Mn=Gt.current)==null?void 0:Mn.selectedIndex)??0,Zn=Math.max(0,Math.min(zn,Bt.items.length-1));Er({...Bt,selectedIndex:Zn})},[fs,Er]),$e=h.useCallback(()=>{Er(null)},[Er]),it=h.useCallback(re=>{const ge=Gt.current;return!ge||re<0||re>=ge.items.length?!1:(ge.selectedIndex===re||Er({...ge,selectedIndex:re}),!0)},[Er]),Ft=h.useCallback(re=>{const ge=Gt.current;if(!ge)return!1;const ze=KKe(ge.selectedIndex,ge.items.length,re);return ze===null?!1:(Er({...ge,selectedIndex:ze}),!0)},[Er]),On=h.useCallback(re=>{const ge=F.current,ze=Gt.current;if(!ge||!ze)return!1;const ot=ze.items[re??ze.selectedIndex];return ot?(ge.dispatch({changes:{from:ze.from,to:ze.to,insert:ot.apply},selection:{anchor:ze.from+ot.apply.length},scrollIntoView:!0}),ge.focus(),!0):!1},[]),[Yn,Is]=h.useState(!1),Wr=h.useRef(!1),cr=h.useCallback(re=>{Wr.current!==re&&(Wr.current=re,Is(re))},[]);h.useEffect(()=>{const re=F.current,ge=re?re.state.doc.toString():ce,ze=ig(ge,b!=null&&b.isVisible?b.suggestion:null);cr(ge.trim().length>0||!!ze||Fr.length>0||Tn.length>0)},[Fr,Tn,ce,b==null?void 0:b.isVisible,b==null?void 0:b.suggestion,cr]);const Gs=uG(G,Y),Qr=uG("qwen-web-shell-command-history"),{push:vr,navigateUp:xr,navigateDown:xs,isNavigating:nn,reset:ks,getReverseMatches:Jr,getLastEntry:fn,resetSearch:Ks}=Gs,ur=h.useRef({push:vr,navigateUp:xr,navigateDown:xs,isNavigating:nn,reset:ks,getReverseMatches:Jr,getLastEntry:fn,resetSearch:Ks});ur.current={push:vr,navigateUp:xr,navigateDown:xs,isNavigating:nn,reset:ks,getReverseMatches:Jr,getLastEntry:fn,resetSearch:Ks};const je=h.useRef(Qr);je.current=Qr,Ns.current=Tn;const lt=h.useCallback(re=>{const ge=Fe.current,ot=(ge?je.current:ur.current).getReverseMatches(re);return ge?ot:ot.filter(mn=>!mn.trimStart().startsWith("/"))},[]),Xt=h.useCallback(()=>{if(Mt.current)return;const re=F.current;if(!re&&!te)return;pe.current(),$e(),fs();const ge=re?re.state.doc.toString():Z.current;Cn.current=ge,cn(!0),et("");const ze=Fe.current?je.current:ur.current;rn(lt("")),ft(0),ze.resetSearch(),setTimeout(()=>{var ot;return(ot=Ye.current)==null?void 0:ot.focus()},0)},[fs,$e,lt,te]),Nn=h.useRef(Xt);Nn.current=Xt;const Lt=h.useCallback(()=>{if(Mt.current)return;const re=F.current;if(!re)return;if(jc(re.state)==="active"){op(!1)(re),re.focus();return}if(re.state.doc.lines>1){re.focus();return}const ge=Fe.current?je.current:ur.current,ze=re.state.doc.toString();ge.isNavigating()||pe.current();const ot=ge.navigateUp(ze);ot!==null&&(_r.current=!0,Fe.current||Vn(),os(re,ot)),re.focus()},[Vn,os]),Be=h.useCallback(()=>{if(Mt.current)return;const re=F.current;if(!re)return;if(jc(re.state)==="active"){op(!0)(re),re.focus();return}if(re.state.doc.lines>1){re.focus();return}const ge=Fe.current?je.current:ur.current,ze=ge.navigateDown();if(ze!==null){const ot=!Fe.current&&!ge.isNavigating();_r.current=ge.isNavigating(),os(re,ze),ot&&ds()}re.focus()},[os,ds]),yn=h.useCallback(re=>{me(re.target.value)},[me]);h.useLayoutEffect(()=>{if(!te)return;const re=W.current;if(!re)return;const ge=parseFloat(getComputedStyle(re).maxHeight);K.current=Number.isFinite(ge)&&ge>0?ge:Number.POSITIVE_INFINITY},[te]),h.useEffect(()=>{var ge;if(!te)return;const re=W.current;if(re){if(typeof CSS<"u"&&((ge=CSS.supports)!=null&&ge.call(CSS,"field-sizing","content"))){re.style.height="";return}if(re.style.height="auto",re.scrollHeight>0){const ze=K.current??Number.POSITIVE_INFINITY,ot=Math.min(re.scrollHeight,ze);re.style.height=`${ot}px`}}},[te,ce]);const mr=h.useCallback(re=>{var ot;const ge=(ot=re.clipboardData)==null?void 0:ot.items;if(!ge)return;TG(ge,mn=>zr(Bt=>[...Bt,mn]))&&re.preventDefault()},[]),dr=(re,ge,ze,ot=!1)=>{const mn=ze===void 0&&re?dYe(re):[],Bt=re?re.state.doc.toString():Z.current,zn=Ct.current,Zn=ge===void 0&&!ot&&mn.length===0&&(zn!=null&&zn.isVisible)?ig(Bt,zn.suggestion):null,Mn=ge??Zn??Bt,vn=Mn.length-Mn.trimStart().length,En=Mn.trim(),fi=ge===void 0&&Zn===null?mn.map(gr=>({...gr,start:gr.start-vn,end:gr.end-vn})).filter(gr=>gr.end>0).map(gr=>({...gr,start:Math.max(0,gr.start)})):[],Vr=ze??Xn.current;if(!En&&Vr.length===0&&mn.length===0)return!0;const Po=ze===void 0?aYe(En,fi):En,Gi=aC(kr.current,Po),va=oYe(Gi,Vr),qr=Ns.current,$s=Fe.current,ei=$s?`!${va}`:va,mi=RSe(ei,[...Vr,...fi.map(gr=>gr.tag)]),Ua={...X.current},ii=aC(kr.current,Bt),wa=re==null?void 0:re.state.doc,Zo=ee.current,kt=Xn.current,Qt=Ns.current,ir=Fe.current;let wn=!1;const er=()=>{var Wa,jd,Cc;if(wn)return;wn=!0;const gr=X.current;if(F.current!==re||gr.sessionId!==Ua.sessionId||gr.promptHistoryStorageKey!==Ua.promptHistoryStorageKey){$s?je.current.push(Gi):gr.promptHistoryStorageKey===Ua.promptHistoryStorageKey?ur.current.push(Gi):fKe(Ua.promptHistoryStorageKey,Gi,Ua.promptHistoryFallbackStorageKey),bYe(Ua.draftStorageKey,ii);return}(Wa=Et.current)==null||Wa.call(Et),$s?(je.current.push(Gi),je.current.reset()):(ur.current.push(Gi),ur.current.reset());const Pi=(re?re.state.doc===wa:ee.current===Zo)&&Xn.current===kt&&Ns.current===Qt&&Fe.current===ir;_r.current=!1,Pi&&(mx(Ua.draftStorageKey,""),Er(null),Zn&&((jd=Ze.current)==null||jd.call(Ze,"enter",{skipOnAccept:!0})),(Cc=Et.current)==null||Cc.call(Et),kr.current.clear(),si.current=1,hs(),At([]),zr([]),re?re.dispatch({changes:{from:0,to:re.state.doc.length,insert:""},effects:Dc.of()}):me(""))};return Ce.current(ei,qr.length>0?[...qr]:void 0,er,mi.length>0?{inputAnnotations:mi}:void 0)===!1||er(),!0};Ur.current=dr,h.useEffect(()=>{var ii,wa,Zo;if(!P.current)return;const re=z??document.body;gG(bG(re));const ge=document.createElement("div");ye.current=ge,ge.setAttribute("data-web-shell-tooltip-portal",""),ge.style.position="fixed",ge.style.inset="0",ge.style.zIndex="var(--web-shell-tooltip-z-index)",ge.style.pointerEvents="none";const ze=/\b\S*theme(?:Dark|Light)\S*/gi,ot=()=>{var ir,wn;let kt=P.current,Qt=null;if(P.current){const er=getComputedStyle(P.current);for(let Rr=0;Rr<er.length;Rr+=1){const gr=er[Rr];gr.startsWith("--")&&ge.style.setProperty(gr,er.getPropertyValue(gr))}er.getPropertyValue("--web-shell-tooltip-z-index").trim()||ge.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;kt;){const er=(wn=(ir=kt.className)==null?void 0:ir.match)==null?void 0:wn.call(ir,ze);if(er){Qt=er[0];break}kt=kt.parentElement}Qt&&(ge.className=Qt)};ot(),re.appendChild(ge);const mn=new MutationObserver(ot);let Bt=P.current;for(;Bt&&(mn.observe(Bt,{attributes:!0,attributeFilter:["class","style"]}),!((wa=(ii=Bt.className)==null?void 0:ii.match)!=null&&wa.call(ii,ze)));)Bt=Bt.parentElement;const zn=(kt,Qt,ir,wn=!1)=>Ur.current(kt,Qt,ir,wn),Zn=kt=>(kt.dispatch(kt.state.replaceSelection(`
`)),!0),Mn=(kt,Qt)=>{var Rr;const ir=Ct.current,wn=ir==null?void 0:ir.suggestion,er=ig(kt.state.doc.toString(),wn);return!(ir!=null&&ir.isVisible)||!er?!1:(kt.dispatch({changes:{from:0,to:kt.state.doc.length,insert:er},selection:{anchor:er.length},scrollIntoView:!0}),kt.focus(),(Rr=Ze.current)==null||Rr.call(Ze,Qt,{skipOnAccept:!0}),!0)},vn=Oy.of([{key:"Backspace",run:kt=>{var er;const Qt=kt.state.selection.main;if(!Qt.empty||Qt.from!==0)return!1;let ir=!1;if(kt.state.field(gf).between(0,1,Rr=>{Rr===0&&(ir=!0)}),ir)return!1;let wn=-1;for(let Rr=Xn.current.length-1;Rr>=0;Rr-=1)if(((er=Xn.current[Rr])==null?void 0:er.removable)!==!1){wn=Rr;break}return wn<0?!1:(At(Rr=>Rr.filter((gr,Xs)=>Xs!==wn)),!0)}},{key:"Delete",run:kt=>{const Qt=kt.state.selection.main;if(!Qt.empty||Qt.from!==0)return!1;let ir=!1;if(kt.state.field(gf).between(0,1,er=>{er===0&&(ir=!0)}),ir)return!1;const wn=Xn.current.findIndex(er=>er.removable!==!1);return wn<0?!1:(At(er=>er.filter((Rr,gr)=>gr!==wn)),!0)}},{key:"Enter",run:kt=>{var er;if(Ge.accept())return!0;if(Gt.current)return On();if(jc(kt.state)==="active")return!1;const Qt=Ct.current,wn=vG(kt)?null:ig(kt.state.doc.toString(),Qt==null?void 0:Qt.suggestion);return Qt!=null&&Qt.isVisible&&wn?((er=Ze.current)==null||er.call(Ze,"enter",{skipOnAccept:!0}),zn(kt,wn)):zn(kt)}},{key:"Shift-Enter",run:Zn},{key:"Ctrl-j",run:Zn},{key:"Mod-Enter",run:Zn},{key:"Alt-Enter",run:Zn},{key:"Escape",run:()=>ws()?!0:Gt.current?($e(),!0):Fe.current?(dt(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:kt=>{var gr;const Qt=Fe.current?je.current:ur.current,ir=_r.current;if(ir)k4(kt),$e(),fs();else{if(Ge.moveSelection("up")||Ft("up"))return!0;if(jc(kt.state)==="active")return op(!1)(kt)}const wn=CG(kt,"up");if(wn==="handled")return!0;if(wn==="editor")return!1;if(Fe.current){const Xs=kt.state.doc.toString();ir||pe.current();const Pi=Qt.navigateUp(Xs);return Pi===null||(_r.current=!0,os(kt,Pi)),!0}if(tt.current.length>0&&(gr=ut.current)!=null&&gr.call(ut))return!0;const er=kt.state.doc.toString();ir||pe.current();const Rr=Qt.navigateUp(er);return Rr===null?!1:(Vn(),_r.current=!0,os(kt,Rr),!0)}},{key:"ArrowDown",run:kt=>{var gr;const Qt=Fe.current?je.current:ur.current;if(_r.current)k4(kt),$e(),fs();else{if(Ge.moveSelection("down")||Ft("down"))return!0;if(jc(kt.state)==="active")return op(!0)(kt)}const wn=CG(kt,"down");if(wn==="handled")return!0;if(wn==="editor")return!1;if(Fe.current){const Xs=Qt.navigateDown();return Xs===null||(_r.current=Qt.isNavigating(),os(kt,Xs)),!0}const er=Qt.navigateDown();if(er===null)return((gr=Nt.current)==null?void 0:gr.call(Nt))??!1;const Rr=!Qt.isNavigating();return _r.current=!Rr,os(kt,er),Rr&&ds(),!0}},{key:"Ctrl-r",run:()=>(Nn.current(),!0)},{key:"Tab",run:kt=>{if(Ge.accept()||Mn(kt,"tab"))return!0;if(Gt.current)return On();if(jc(kt.state)==="active")return Xue(kt);const Qt=kt.state.doc.toString(),ir=aKe(Qt,$t.current,gt.current);if(ir)return kt.dispatch({changes:{from:0,to:kt.state.doc.length,insert:ir},selection:{anchor:ir.length}}),!0;const wn=oKe(Qt,$t.current);return wn&&kt.dispatch({changes:{from:0,to:kt.state.doc.length,insert:wn},selection:{anchor:wn.length}}),!0}},{key:"ArrowRight",run:kt=>!!(jc(kt.state)!=="active"&&Mn(kt,"right"))},{key:"Shift-Tab",run:()=>{var kt;return(kt=We.current)==null||kt.call(We),!0}}]);let En=null,fi="";const Vr=kt=>(En!==kt.doc&&(En=kt.doc,fi=kt.doc.toString()),fi),Po=en.updateListener.of(kt=>{const Qt=kt.transactions.some(wn=>wn.isUserEvent("input")||wn.isUserEvent("delete")),ir=kt.transactions.some(wn=>wn.isUserEvent("input"));if(kt.docChanged&&ir&&kr.current.size>0){const wn=sYe(kr.current,Vr(kt.state));wn!==null&&(si.current=wn)}Qt&&(_r.current=!1),(kt.docChanged||kt.selectionSet)&&(xe(kt.view),_r.current?fs():Wn(kt.view)&&$e())});let Gi=!1;const va=en.updateListener.of(kt=>{const Qt=vo.current,ir=jc(kt.state)==="active";if(Qt){const wn=kt.state.doc;if(!(wn.length===Qt.from+Qt.text.length&&wn.sliceString(Qt.from)===Qt.text))vo.current=null;else if(Gi&&!ir){vo.current=null;const{view:Rr}=kt,{from:gr}=Qt;window.setTimeout(()=>{if(F.current!==Rr)return;const Xs=Rr.state.doc;Xs.length===gr+Qt.text.length&&Xs.sliceString(gr)===Qt.text&&Rr.dispatch({changes:{from:gr,to:gr+Qt.text.length,insert:""}})},0)}}Gi=ir,ir||QKe(ge)}),qr=gs.create({doc:S4(oe.current.storageKey)??"",extensions:[b0.highest(vn),AGe,pP(),Oy.of([...yP,...gP]),tde({override:[],activateOnTyping:!0,icons:!1,optionClass:kt=>{const Qt=[];return kt.type==="file"&&Qt.push("cm-file-completion"),RP(kt)&&Qt.push("cm-command-info-completion"),Qt.join(" ")},addToOptions:[{render:eYe,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(kt,Qt,ir,wn,er)=>{const Rr=wn.bottom-wn.top,gr=er.bottom-Qt.bottom,Xs=gr>=Rr||gr>Qt.top,Pi=Xs?"top":"bottom",Wa=Xs?ir.bottom-Qt.top:Qt.bottom-ir.top;return{style:`${Pi}: ${Wa}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:kt=>typeof kt.apply=="string"&&kt.apply.endsWith(" ")}),dHe({parent:ge}),xG.of(hV("")),kG.of(_G(null)),en.lineWrapping,wG.of(en.editable.of(!0)),HKe(()=>$t.current,()=>gt.current),UKe,gf,Po,va,en.updateListener.of(kt=>{var ir;if(kt.docChanged||kt.transactions.some(wn=>wn.effects.some(er=>er.is(sg)||er.is(E3)||er.is(Dc)))){const wn=vG(kt.view);Dt.current!==wn&&(Dt.current=wn,Vt(wn))}if(kt.docChanged){const wn=Vr(kt.state);oe.current.storageKey===void 0&&(we.current=!0),!_r.current&&!He.current&&he.current(),(ir=ae.current)==null||ir.call(ae,wn);const er=Ct.current,Rr=ig(wn,er!=null&&er.isVisible?er.suggestion:null);cr(wn.trim().length>0||!!Rr||Xn.current.length>0||Ns.current.length>0)}}),en.inputHandler.of((kt,Qt,ir,wn)=>{var er;return wn==="!"&&kt.state.doc.toString()===""&&jc(kt.state)!=="active"?(Me(),!0):wn==="?"&&kt.state.doc.toString()===""&&jc(kt.state)!=="active"?((er=Oe.current)==null||er.call(Oe),!0):!1}),en.domEventHandlers({blur(kt){return $e(),kt.relatedTarget instanceof Element&&kt.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const Qt=F.current;Qt!=null&&Qt.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||fs()},0),!1},paste(kt){var Xs,Pi,Wa,jd;const Qt=(Xs=kt.clipboardData)==null?void 0:Xs.items;if(!Qt)return!1;if(TG(Qt,Cc=>zr(w1=>[...w1,Cc])))return kt.preventDefault(),!0;const wn=tYe(((Pi=kt.clipboardData)==null?void 0:Pi.getData("text/plain"))??"");if(!wn||!nYe(wn))return!1;kt.preventDefault(),$s.state.doc.toString()===""&&((Wa=Ct.current)!=null&&Wa.isVisible)&&((jd=Et.current)==null||jd.call(Et));const{placeholderText:er,nextPasteId:Rr}=rYe(kr.current,si.current,wn);si.current=Rr;const gr=$s.state.selection.main;return $s.dispatch({changes:{from:gr.from,to:gr.to,insert:er},selection:{anchor:gr.from+er.length},scrollIntoView:!0}),!0}}),en.theme(R)]}),$s=new en({state:qr,parent:P.current});F.current=$s;const ei=()=>pe.current();$s.dom.addEventListener("blur",ei,!0),fx()||$s.focus();const mi=$s.state.doc.toString(),Ua=mi.trim();return mi&&((Zo=ae.current)==null||Zo.call(ae,mi)),cr(Ua.length>0||Xn.current.length>0||Ns.current.length>0),()=>{$s.dom.removeEventListener("blur",ei,!0),pe.current(),$s.dispatch({effects:Dc.of()}),$s.destroy(),F.current=null,mn.disconnect(),ge.remove(),ye.current=null}},[]),h.useEffect(()=>{const re=oe.current,ge=F.current,ze=re.sessionId!==v,ot=re.workspaceCwd!==C,mn=re.storageKey!==U,Bt=_r.current,zn=He.current;if(!ze&&!ot)return;ur.current.reset(),je.current.reset(),_r.current=!1,hs(),Cn.current="",cn(!1),et(""),rn([]),ft(0);const Zn=ge?aC(kr.current,ge.state.doc.toString()):Z.current;if(mn&&!Bt&&!zn&&mx(re.storageKey,Zn),oe.current={sessionId:v,workspaceCwd:C,storageKey:U},!mn||!ge&&!te)return;const Mn=S4(U),vn=!Bt&&!zn&&re.sessionId===void 0&&v===void 0&&re.workspaceCwd===void 0&&re.storageKey===void 0&&C!==void 0&&(we.current||Mn===null);we.current=!1;const En=vn?Zn:Mn??"";vn&&mx(U,Zn),kr.current.clear(),si.current=1,At([]),zr([]),ge?ge.dispatch({changes:{from:0,to:ge.state.doc.length,insert:En},effects:Dc.of(),selection:{anchor:En.length}}):me(En),U===void 0&&(we.current=!1)},[C,hs,U,te,v,me]),h.useEffect(()=>{const re=ye.current;if(!re)return;const ge=z??document.body;gG(bG(ge)),ge.appendChild(re)},[z]),h.useEffect(()=>{const re=F.current;re&&(re.dispatch({effects:wG.reconfigure(en.editable.of(!i))}),!i&&!fx()&&re.focus())},[i]);const as=!i&&(b!=null&&b.isVisible)&&b.suggestion?b.suggestion:null,Ht=as??(Le?N("editor.shellPlaceholder"):o);h.useEffect(()=>{const re=F.current;re&&re.dispatch({effects:[xG.reconfigure(hV(Ht)),kG.reconfigure(_G(as))]})},[Ht,as]),h.useEffect(()=>{const re=F.current;!re||jc(re.state)!=="active"||(k4(re),window.setTimeout(()=>{F.current===re&&x4(re)},0))},[B]);const hr=[l.map(re=>{var ge;return[re.name,re.description??"",re.source??"",re.displayCategory??"",re.argumentHint??"",((ge=re.subcommands)==null?void 0:ge.join(","))??""].join("\0")}).join(""),c.map(re=>[re.name,re.description].join("\0")).join(""),(u==null?void 0:u.join("|"))??""].join("");h.useEffect(()=>{Gt.current&&xe(F.current)},[hr,B,xe]),h.useEffect(()=>{const re=F.current;re&&(g?($e(),fs(),re.contentDOM.blur()):fx()||re.focus())},[fs,g,$e]),h.useEffect(()=>{const re=ge=>{var vn,En,fi;if(Mt.current||yt||g||ge.defaultPrevented)return;const ze=ge.target,ot=(vn=P.current)==null?void 0:vn.contains(ze),mn=document.activeElement===document.body;if(!ot&&!mn)return;const Bt=F.current,zn=Ct.current,Zn=ig((Bt==null?void 0:Bt.state.doc.toString())??"",zn==null?void 0:zn.suggestion);if(Bt&&!Bt.hasFocus&&(zn!=null&&zn.isVisible)&&Zn&&!Qg(ge.target)){if(ge.key==="Tab"&&!ge.shiftKey&&!ge.metaKey&&!ge.ctrlKey&&!ge.altKey&&jc(Bt.state)!=="active"){ge.preventDefault(),Bt.dispatch({changes:{from:0,to:Bt.state.doc.length,insert:Zn},selection:{anchor:Zn.length},scrollIntoView:!0}),Bt.focus(),(En=Ze.current)==null||En.call(Ze,"tab",{skipOnAccept:!0});return}if(ge.key==="ArrowRight"&&!ge.shiftKey&&!ge.metaKey&&!ge.ctrlKey&&!ge.altKey&&jc(Bt.state)!=="active"){ge.preventDefault(),Bt.dispatch({changes:{from:0,to:Bt.state.doc.length,insert:Zn},selection:{anchor:Zn.length},scrollIntoView:!0}),Bt.focus(),(fi=Ze.current)==null||fi.call(Ze,"right",{skipOnAccept:!0});return}}if(ge.metaKey||ge.ctrlKey||ge.altKey||ge.key.length!==1||Qg(ge.target)||!Bt||Bt.hasFocus)return;if(ge.preventDefault(),ge.key==="!"&&Bt.state.doc.toString()===""){Me();return}const Mn=Bt.state.selection.main;Bt.dispatch({changes:{from:Mn.from,to:Mn.to,insert:ge.key},selection:{anchor:Mn.from+ge.key.length},scrollIntoView:!0}),Bt.focus(),ge.key==="/"?window.setTimeout(()=>{xe(F.current)},0):ge.key==="@"&&window.setTimeout(()=>{const Vr=F.current;Vr&&Vr.hasFocus&&($e(),Wn(Vr))},0)};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[Wn,$e,yt,g,xe,Me]);const hi=h.useCallback(()=>{var re,ge;if(te){(re=W.current)==null||re.focus();return}(ge=F.current)==null||ge.focus()},[te]),Zr=h.useCallback((re,ge)=>{var vn;if(te){if(re)if((ge==null?void 0:ge.mode)==="replace")me(re);else{const En=W.current,fi=Z.current,Vr=En?En.selectionStart:fi.length,Po=En?En.selectionEnd:fi.length,Gi=Vr+re.length;me(fi.slice(0,Vr)+re+fi.slice(Po));const va=()=>{var qr;(qr=W.current)==null||qr.setSelectionRange(Gi,Gi)};typeof requestAnimationFrame=="function"?requestAnimationFrame(va):window.setTimeout(va,0)}(vn=W.current)==null||vn.focus();return}const ze=F.current;if(!ze||!re){ze==null||ze.focus();return}if((ge==null?void 0:ge.mode)==="replace"){ze.dispatch({changes:{from:0,to:ze.state.doc.length,insert:re},effects:Dc.of(),selection:{anchor:re.length},scrollIntoView:!0}),ze.focus();return}const ot=ze.state.selection.main;let mn=re,Bt=!1,zn=null;const Zn=re==="@";let Mn=re==="/";if(re==="/")ze.state.doc.lineAt(ot.head).text.startsWith("/")?Bt=!0:ze.state.doc.length>0&&(Bt=!0,Mn=!1);else if(re==="@"){const En=ot.from>0?ze.state.doc.sliceString(ot.from-1,ot.from):"";ze.state.doc.sliceString(ot.from,ot.from+1)==="@"?(Bt=!0,zn=ot.from+1):En==="@"?Bt=!0:En&&!/\s/.test(En)&&(mn=" @")}Bt?zn!==null&&ze.dispatch({selection:{anchor:zn},scrollIntoView:!0}):(ze.dispatch({changes:{from:ot.from,to:ot.to,insert:mn},selection:{anchor:ot.from+mn.length},scrollIntoView:!0}),Zn&&(vo.current={text:mn,from:ot.from})),ze.focus(),Mn?window.setTimeout(()=>{xe(F.current)},0):Zn&&window.setTimeout(()=>{const En=F.current;En&&En.hasFocus&&($e(),Wn(En))},0)},[$e,te,Wn,xe,me]),Os=h.useCallback(()=>{var re;return te?Z.current:((re=F.current)==null?void 0:re.state.doc.toString())??""},[te]),Vi=h.useCallback(re=>{if(te){me(re);return}const ge=F.current;ge&&(ge.dispatch({changes:{from:0,to:ge.state.doc.length,insert:re},effects:Dc.of(),selection:{anchor:re.length},scrollIntoView:!0}),ge.focus())},[te,me]),Ms=h.useCallback(re=>{const ge=F.current;if(!ge)return;const ze=[];ge.state.field(gf).between(0,ge.state.doc.length,(ot,mn,Bt)=>{const zn=Bt.spec.tag;zn&&(!re||re(zn))&&ze.push({from:ot,to:mn,insert:""})}),ze.length!==0&&ge.dispatch({changes:ze,effects:E3.of({predicate:re}),scrollIntoView:!0})},[]),Lo=h.useCallback(re=>{const ge=(re==null?void 0:re.text)??!0,ze=(re==null?void 0:re.tags)??!0,ot=F.current;ge&&ot&&ot.state.doc.length>0&&ot.dispatch({changes:{from:0,to:ot.state.doc.length,insert:""},effects:Dc.of()}),ge&&te&&me(""),ge&&(zr([]),kr.current.clear(),si.current=1),ze&&(At([]),ge||Ms())},[te,Ms,me]),Ys=h.useCallback(()=>{Lo({text:!0,tags:!1})},[Lo]),ya=h.useCallback((re,ge)=>{if(re.length!==0){if((ge==null?void 0:ge.placement)==="inline"&&!te){const ze=F.current;if(!ze)return;const ot=ze.state.selection.main;let mn=ot.from;const Bt=[],zn=re.map(Mn=>{const vn=Qx(Mn);return Bt.push({from:mn,to:mn+vn.length,tag:Mn}),mn+=vn.length+1,vn}).join(" "),Zn=zn?`${zn} `:"";ze.dispatch({changes:{from:ot.from,to:ot.to,insert:Zn},effects:Bt.length>0?Bt.map(Mn=>sg.of({...Mn,tag:le(Mn.tag)})):void 0,selection:{anchor:ot.from+Zn.length},scrollIntoView:!0}),ze.focus();return}At(ze=>{const ot=[...ze];for(const mn of re){const Bt=ot.findIndex(zn=>zn.id===mn.id);Bt>=0?ot[Bt]=mn:ot.push(mn)}return ot})}},[te,le]),Ss=h.useCallback(re=>{At(ge=>{const ze=ge.filter(ot=>ot.id!==re||ot.removable===!1);return ze.length===ge.length?ge:ze}),Ms(ge=>ge.id===re&&ge.removable!==!1)},[Ms]),Li=h.useCallback(()=>{var ge;return(te?Z.current:((ge=F.current)==null?void 0:ge.state.doc.toString())??"").trim().length>0||Xn.current.length>0||Ns.current.length>0},[te]),pr=h.useCallback(()=>(F.current?yG(F.current):[]).length>0||Xn.current.length>0||Ns.current.length>0,[]),xo=h.useCallback(re=>{const ge=F.current;if(!ge&&!te)return;const ze=ge?yG(ge):[];if((re==null?void 0:re.tagPlacement)==="inline"){Ur.current(ge,re.text??"",re.tags??ze);return}if((re==null?void 0:re.text)!==void 0&&re.tags===void 0&&ze.length>0){Ur.current(ge,re.text,ze);return}Ur.current(ge,re==null?void 0:re.text,re?re.tags??[]:void 0)},[te]),Qo=h.useCallback(()=>{const re=ur.current.getLastEntry(ze=>!ze.startsWith("/")&&!ze.startsWith("!"));!re||Ce.current(re)===!1||zr([])},[]),ko=h.useCallback(re=>{if(te){me(re);return}const ge=F.current;ge&&ge.dispatch({changes:{from:0,to:ge.state.doc.length,insert:re},selection:{anchor:re.length},scrollIntoView:!0})},[te,me]);h.useEffect(()=>{const re=Ni.current;if(!re)return;const ge=F.current;if(!ge&&!te)return;const ze=re.tagPlacement??"top";if(re.tags!==void 0&&ze==="top"&&At([...re.tags]),!ge){re.tags!==void 0&&ze==="inline"&&At([...re.tags]),re.text!==void 0&&me(re.text);let mn=null;return re.submit&&(mn=window.setTimeout(()=>{xo(re)},0)),()=>{mn!==null&&window.clearTimeout(mn)}}if(re.text!==void 0||ze==="inline"){const mn=ze==="inline"?[...re.tags??[]]:[],Bt=mn.map(Qx).join(" "),zn=ze==="inline"?Bt&&re.text?`${Bt} ${re.text}`:Bt||(re.text??""):re.text??"",Zn=[Dc.of()];if(mn.length>0){let Mn=0;for(const vn of mn){const En=Qx(vn);Zn.push(sg.of({from:Mn,to:Mn+En.length,tag:le(vn)})),Mn+=En.length+1}}ge.dispatch({changes:{from:0,to:ge.state.doc.length,insert:zn},effects:Zn,selection:{anchor:zn.length},scrollIntoView:!0})}else ge.dispatch({effects:Dc.of()});(re.text!==void 0||re.submit)&&!fx()&&ge.focus();let ot=null;return re.submit&&(ot=window.setTimeout(()=>{F.current&&xo(re)},0)),()=>{ot!==null&&window.clearTimeout(ot)}},[S,te,le,me,xo]);const _o=h.useCallback((re,ge=!0)=>{var ot;re&&ko(Cn.current),cn(!1),et(""),rn([]),ft(0),(Fe.current?je.current:ur.current).resetSearch(),ge&&((ot=F.current)==null||ot.focus())},[ko]);h.useEffect(()=>{if(!yt)return;const re=ge=>{if(ge instanceof MouseEvent&&ge.button!==0||ge.defaultPrevented)return;const ze=Yt.current,ot=ge.target;ze&&ot instanceof Node&&!ze.contains(ot)&&_o(!0,!1)};return window.addEventListener("mousedown",re),window.addEventListener("touchstart",re),()=>{window.removeEventListener("mousedown",re),window.removeEventListener("touchstart",re)}},[yt,_o]);const _c=h.useCallback(re=>{var Bt;const ge=F.current;if(!ge&&!te)return;if(_o(!1),!Fe.current){zt(re),Ur.current(ge,void 0,void 0,!0);return}const ze=re.trim();if(!ze)return;const ot=Ns.current;if(Ce.current(`!${ze}`,ot.length>0?[...ot]:void 0)===!1){zt(re);return}(Bt=Et.current)==null||Bt.call(Et),je.current.push(ze),je.current.reset(),zr([]),ko("")},[_o,te,ko,zt]),Ha=re=>{if(!re.nativeEvent.isComposing)if(re.key==="Escape")re.preventDefault(),_o(!0);else if(re.key==="Tab"){re.preventDefault();const ge=bt[qn];ge&&zt(ge),_o(!1)}else if(re.key==="Enter"){re.preventDefault();const ge=bt[qn];ge?_c(ge):_o(!1)}else re.key==="r"&&re.ctrlKey&&(re.preventDefault(),bt.length>0&&ft(ge=>(ge+1)%bt.length))},Cs=re=>{const ge=Fe.current?je.current:ur.current;rn(lt(re)),ft(0),ge.resetSearch()},lo=re=>{const ge=re.target.value;et(ge),!re.nativeEvent.isComposing&&Cs(ge)},Jo=re=>{const ge=re.currentTarget.value;et(ge),Cs(ge)},Sc=h.useCallback(re=>{zr(ge=>ge.filter((ze,ot)=>ot!==re))},[]),fl=!Le&&!yt&&!(b!=null&&b.isVisible)&&!i&&!g,ct=h.useCallback(re=>{zr(ge=>[...ge,...re])},[]),tr=h.useMemo(()=>({clearText:Ys,clear:Lo,focus:hi,getText:Os,hasAttachments:pr,hasInput:Li,setText:Vi,addTags:ya,removeTag:Ss,insertText:Zr,retryLast:Qo,restoreImages:ct,submit:xo}),[ya,Lo,Ys,hi,Os,pr,Li,Zr,Ss,ct,Qo,Vi,xo]);return{containerRef:P,viewRef:F,mobileComposer:te?{textareaRef:W,value:ce,onChange:yn,onBlur:()=>pe.current(),onPaste:mr,placeholder:Ht}:null,focus:hi,submitText:h.useCallback(()=>{const re=F.current;!re&&!te||Ur.current(re)},[te]),clearText:Ys,getText:Os,hasInput:Li,hasAttachments:_e||Fr.length>0||Tn.length>0,hasContent:Yn,handle:tr,pastedImages:Tn,removeImage:Sc,composerTags:Fr,removeTopTag:Ss,addTags:ya,removeInlineTags:Ms,insertText:Zr,setText:Vi,submit:xo,clear:Lo,retryLast:Qo,replaceEditorText:ko,shellMode:Le,setShellMode:dt,toggleShellMode:Me,currentMode:m,sessionName:x,searchState:{searchMode:yt,searchQuery:Re,searchMatches:bt,searchActiveIndex:qn,searchInputRef:Ye,searchUiRef:Yt,openHistorySearch:Xt,closeSearch:_o,submitSearchMatch:_c,restoreSearchMatch:zt,handleSearchKeyDown:Ha,handleSearchInput:lo,handleSearchCompositionEnd:Jo},navigatePrevHistory:Lt,navigateNextHistory:Be,showShortcutHints:fl,followupState:b,disabled:i,onAcceptFollowup:w,onDismissFollowup:y,slashMenu:wo,closeSlashMenu:$e,selectSlashCompletion:it,acceptSlashCompletion:On,atMenu:Ge.state,closeAtMenu:fs,selectAtCompletion:Ge.select,acceptAtCompletion:Ge.accept,enterAtCategory:Ge.enterCategory,backAtCategories:Ge.backToCategories,updateAtSearch:Ge.updateSearch,selectAtTab:Ge.selectTab}}const wYe="_flash_96ig5_1",e0={flash:wYe},xYe="_chatMessageRow_1ngib_41",kYe="_chatMessageColumn_1ngib_48",_Ye="_chatBubble_1ngib_55",SYe="_sendFailure_1ngib_68",CYe="_retryButton_1ngib_78",TYe="_chatContent_1ngib_106",EYe="_messageTag_1ngib_111",AYe="_messageTagTooltip_1ngib_128",jYe="_messageTagClickable_1ngib_162",NYe="_messageTagIcon_1ngib_172",IYe="_messageTagLabel_1ngib_183",MYe="_messageTagValue_1ngib_184",RYe="_chatContentCollapsed_1ngib_207",DYe="_toggleButton_1ngib_212",LYe="_toggleIcon_1ngib_233",PYe="_toggleIconExpanded_1ngib_240",OYe="_chatImages_1ngib_244",$Ye="_chatImageThumb_1ngib_251",oa={chatMessageRow:xYe,chatMessageColumn:kYe,chatBubble:_Ye,sendFailure:SYe,retryButton:CYe,chatContent:TYe,messageTag:EYe,messageTagTooltip:AYe,messageTagClickable:jYe,messageTagIcon:NYe,messageTagLabel:IYe,messageTagValue:MYe,chatContentCollapsed:RYe,toggleButton:DYe,toggleIcon:LYe,toggleIconExpanded:PYe,chatImages:OYe,chatImageThumb:$Ye};function BYe({composerTagIcons:e,content:t,inputAnnotations:n,onComposerTagClick:r,renderComposerTag:s,renderComposerTagTooltip:i}){const o=h.useMemo(()=>Iee(t,n),[t,n]);return a.jsx(a.Fragment,{children:o.map((l,c)=>l.type==="text"?a.jsx(h.Fragment,{children:l.text},c):a.jsx(LP,{composerTagIcons:e,onComposerTagClick:r,renderComposerTag:s,renderComposerTagTooltip:i,tag:l.tag,title:l.tag.serialized,preserveCustomKindLabel:!0},`${l.tag.id}:${c}`))})}const zYe=h.memo(function({content:t,images:n,inputAnnotations:r,isLocateFlashing:s=!1,sendFailed:i=!1,onRetrySend:o}){const{t:l}=rt(),{parseUserMessageContent:c,renderUserMessageContent:u,composerTagIcons:d,renderComposerTag:f,renderComposerTagTooltip:m,onComposerTagClick:p}=Vu(),g=h.useRef(null),[b,w]=h.useState(!1),[y,v]=h.useState(!1),x=h.useMemo(()=>{const S=u==null?void 0:u({content:t,images:n,inputAnnotations:r});if(S!=null)return S;if(r&&r.length>0)return a.jsx(BYe,{composerTagIcons:d,content:t,inputAnnotations:r,onComposerTagClick:p,renderComposerTag:f,renderComposerTagTooltip:m});const T=oD(t,c,"[WebShell] failed to parse user message content");return T?T.map((_,C)=>_.type==="text"?_.text:a.jsx(LP,{tag:_.tag,composerTagIcons:d,renderComposerTag:f,renderComposerTagTooltip:m,onComposerTagClick:p},`${_.tag.id}-${C}`)):t},[t,n,r,p,c,d,f,m,u]),k=h.useCallback(()=>{const S=g.current;S&&v(S.scrollHeight>400)},[]);return h.useLayoutEffect(()=>{w(!1),k()},[t,n==null?void 0:n.length,k]),h.useEffect(()=>{const S=g.current;if(!S||typeof ResizeObserver>"u")return;const T=new ResizeObserver(k);return T.observe(S),()=>T.disconnect()},[k]),a.jsx("div",{className:oa.chatMessageRow,children:a.jsxs("div",{className:oa.chatMessageColumn,children:[a.jsxs("div",{className:`${oa.chatBubble}${s?` ${e0.flash}`:""}`,children:[a.jsxs("div",{ref:g,className:`${oa.chatContent} ${y&&!b?oa.chatContentCollapsed:""}`,children:[n&&n.length>0&&a.jsx("div",{className:oa.chatImages,children:n.map((S,T)=>{const _=S.data.startsWith("data:")?S.data:`data:${S.mimeType};base64,${S.data}`;return Cv(_)?a.jsx("img",{src:_,alt:l("user.uploadedImage",{index:T+1}),className:oa.chatImageThumb,onLoad:k},T):null})}),x]}),y&&a.jsxs("button",{type:"button",className:oa.toggleButton,onClick:()=>w(S=>!S),children:[a.jsx("span",{children:l(b?"userMessage.showLess":"userMessage.showMore")}),a.jsx("svg",{className:`${oa.toggleIcon} ${b?oa.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),i&&o&&a.jsxs("div",{className:oa.sendFailure,children:[a.jsx("span",{children:l("userMessage.sendFailed")}),a.jsxs("button",{type:"button",className:oa.retryButton,onClick:o,"aria-label":l("userMessage.retrySend"),title:l("userMessage.retrySend"),children:[a.jsx($g,{"aria-hidden":"true"}),a.jsx("span",{children:l("common.retry")})]})]})]})})});function FYe(e){return DP(e)}function LP({tag:e,composerTagIcons:t,renderComposerTag:n,renderComposerTagTooltip:r,onComposerTagClick:s,title:i,preserveCustomKindLabel:o=!1}){const l={tag:e,placement:"user-message",readonly:!0};let c,u;try{c=n==null?void 0:n(l)}catch(v){console.warn("[WebShell] user message tag render failed",v)}try{u=r==null?void 0:r(l)}catch(v){console.warn("[WebShell] user message tag tooltip render failed",v)}const d=!!s,f=o?DSe(e,t):null,m=O6(e),p=(f==null?void 0:f.tagValue)??$6(e),g=(f==null?void 0:f.tagLabel)??(e.kind?"":m),b=(f==null?void 0:f.fallback)??e.id,w=e.icon??(f==null?void 0:f.iconUrl)??a1(e.kind,t),y=w&&(lD(w)||Cv(w))?w:void 0;return a.jsxs("span",{className:`${oa.messageTag}${d?` ${oa.messageTagClickable}`:""}`,role:d?"button":void 0,tabIndex:d?0:void 0,title:i??FYe(e),onClick:v=>{d&&(v.stopPropagation(),s==null||s({...l,anchorRect:v.currentTarget.getBoundingClientRect()}))},onKeyDown:v=>{d&&(v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),s==null||s({...l,anchorRect:v.currentTarget.getBoundingClientRect()})))},children:[c??a.jsxs(a.Fragment,{children:[y&&a.jsx("span",{className:oa.messageTagIcon,style:ap("--user-message-tag-icon-url",y),"aria-hidden":"true"}),g&&a.jsx("span",{className:oa.messageTagLabel,children:g}),p?a.jsx("span",{className:oa.messageTagValue,children:p}):g?null:a.jsx("span",{className:oa.messageTagLabel,children:b})]}),u!=null&&a.jsx("span",{className:oa.messageTagTooltip,role:"tooltip",children:u})]})}const qYe="_message_nn1j4_1",HYe="_customFooter_nn1j4_7",UYe="_messageFooter_nn1j4_11",WYe="_copyButton_nn1j4_27",VYe="_footerTime_nn1j4_53",GYe="_thinking_nn1j4_65",KYe="_thinkingBody_nn1j4_77",YYe="_thinkingHeader_nn1j4_108",XYe="_thinkingSummary_nn1j4_120",QYe="_translateButton_nn1j4_136",JYe="_thinkingHeaderExpanded_nn1j4_147",ZYe="_translationPopover_nn1j4_154",eXe="_translationTitle_nn1j4_159",tXe="_translationContent_nn1j4_164",nXe="_translationPending_nn1j4_171",rXe="_translationError_nn1j4_175",sXe="_translationFooter_nn1j4_179",iXe="_translationUsage_nn1j4_189",oXe="_translationActions_nn1j4_196",aXe="_thinkingSummaryTextActive_nn1j4_211",lXe="_thinkingSummaryIcon_nn1j4_218",cXe="_thinkingSummaryText_nn1j4_211",uXe="_thinkingChevronRight_nn1j4_275",dXe="_thinkingChevronDown_nn1j4_276",hXe="_thinkingExpandedWrap_nn1j4_339",fXe="_thinkingExpandedClip_nn1j4_343",mXe="_thinkingExpandedInner_nn1j4_350",pXe="_content_nn1j4_398",gXe="_contentBody_nn1j4_403",Es={message:qYe,customFooter:HYe,messageFooter:UYe,copyButton:WYe,footerTime:VYe,thinking:GYe,thinkingBody:KYe,thinkingHeader:YYe,thinkingSummary:XYe,translateButton:QYe,thinkingHeaderExpanded:JYe,translationPopover:ZYe,translationTitle:eXe,translationContent:tXe,translationPending:nXe,translationError:rXe,translationFooter:sXe,translationUsage:iXe,translationActions:oXe,thinkingSummaryTextActive:aXe,thinkingSummaryIcon:lXe,thinkingSummaryText:cXe,thinkingChevronRight:uXe,thinkingChevronDown:dXe,thinkingExpandedWrap:hXe,thinkingExpandedClip:fXe,thinkingExpandedInner:mXe,content:pXe,contentBody:gXe},bXe=80;function yXe(e,t){const[n,r]=h.useState(e),s=h.useRef(e),i=h.useRef(void 0);return s.current=e,h.useEffect(()=>{if(!t){i.current!==void 0&&(clearTimeout(i.current),i.current=void 0),n!==e&&r(e);return}i.current!==void 0||n===e||(i.current=setTimeout(()=>{i.current=void 0,r(s.current)},bXe))},[e,t,n]),h.useEffect(()=>()=>{i.current!==void 0&&clearTimeout(i.current)},[]),t&&e.startsWith(n)?n:e}const vXe=h.memo(function({content:t,isStreaming:n,timestamp:r,onBranchSession:s,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:l=!1,customFooterInfo:c}){const{t:u}=rt(),{renderAssistantTurnFooter:d}=Vu(),f=yXe(t,n),[m,p]=h.useState(!1),g=!!t&&!n&&i,b=h.useMemo(()=>c?d==null?void 0:d(c):void 0,[c,d]),w=h.useCallback(()=>{var v;const y=(v=navigator.clipboard)==null?void 0:v.writeText(t);y&&y.then(()=>{p(!0),window.setTimeout(()=>p(!1),2e3)}).catch(()=>{})},[t]);return a.jsxs("div",{className:Es.message,children:[t&&a.jsx("div",{className:`${Es.content}${l?` ${e0.flash}`:""}`,children:a.jsx("div",{className:Es.contentBody,children:a.jsx(Qf,{content:f,source:"assistant",isStreaming:n})})}),b&&a.jsx("div",{className:Es.customFooter,children:b}),g&&a.jsxs("div",{className:Es.messageFooter,children:[a.jsx("button",{type:"button",className:Es.copyButton,title:u("assistant.copy"),"aria-label":u("assistant.copy"),onClick:w,children:m?a.jsx(xXe,{}):a.jsx(wXe,{})}),o&&s&&a.jsx("button",{type:"button",className:Es.copyButton,title:u("assistant.branch"),"aria-label":u("assistant.branch"),onClick:s,children:a.jsx(kXe,{})}),r!==void 0&&a.jsx("span",{className:Es.footerTime,"aria-hidden":"true",children:Sy(r)})]})]})});function wXe(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.jsx("path",{d:"M5.2 4.4V3.2c0-.7.5-1.2 1.2-1.2h5.4c.7 0 1.2.5 1.2 1.2v5.4c0 .7-.5 1.2-1.2 1.2h-1.2",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.3"}),a.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function xXe(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function kXe(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.jsx("path",{d:"M5 3.5v5.2c0 2.1 1.7 3.8 3.8 3.8H11",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),a.jsx("path",{d:"M5 8.2h3.2c1.5 0 2.8-1.2 2.8-2.8V4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),a.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const hg=new Map,_Xe=200;function EG(e,t){if(hg.delete(e),hg.set(e,t),hg.size<=_Xe)return;const n=hg.keys().next().value;n!==void 0&&hg.delete(n)}const SXe=h.memo(function({messageId:t,content:n,isStreaming:r,timestamp:s,isLocateFlashing:i=!1,generateContent:o}){const{language:l,t:c}=rt(),u=h.useContext(e1),[d,f]=h.useState(!1),m=r===!0,p=h.useRef(s??Date.now()),g=h.useRef(m),[b,w]=h.useState(()=>Date.now()),[y,v]=h.useState(null),[x,k]=h.useState(!1),[S,T]=h.useState(),[_,C]=h.useState(!1),[j,E]=h.useState(!1),[L,D]=h.useState(!1),M=h.useRef(void 0);h.useEffect(()=>{if(!n||!m)return;w(Date.now());const Y=setInterval(()=>w(Date.now()),1e3);return()=>clearInterval(Y)},[n,m]),h.useEffect(()=>{if(n){if(m){g.current=!0,v(null);return}g.current&&y===null&&v(Date.now())}},[n,y,m]);const R=m||y!==null?(m?b:y)-p.current:void 0,$=CXe({isStreaming:r,durationMs:R}),B=R!==void 0?TXe(R):"",N=h.useCallback(()=>{f(Y=>!Y)},[]);h.useEffect(()=>()=>{var Y;(Y=M.current)==null||Y.abort()},[]);const z=h.useCallback(async(Y=!1)=>{var K;if(r||!o||_&&!Y)return;const U=`${l}:${t}:${n}`,P=hg.get(U);if(P&&!Y){EG(U,P),T(P);return}Y&&hg.delete(U),(K=M.current)==null||K.abort();const F=new AbortController;M.current=F,T({text:""}),E(!1),D(!1),C(!0);let te="",W=!1;try{const ie=`Translate the following model reasoning into ${l==="zh-CN"?"Simplified Chinese":"English"}. Preserve its meaning and Markdown formatting. Output only the translation.

${n}`;for await(const Z of o(ie,{signal:F.signal})){if(M.current!==F)return;if(Z.type==="thinking")E(!0);else if(Z.type==="delta")E(!1),te+=Z.text,T({text:te});else if(Z.type==="done"){if(!te.trim())throw new Error("Translation was empty");W=!0;const ee={text:te,inputTokens:Z.inputTokens,outputTokens:Z.outputTokens};EG(U,ee),T(ee)}else if(Z.type==="error")throw new Error(Z.message)}if(!W)throw new Error("Translation stream ended early")}catch{F.signal.aborted||D(!0)}finally{M.current===F&&(M.current=void 0,E(!1),C(!1))}},[n,o,r,l,t,_]),G=h.useCallback(Y=>{k(Y),Y&&z()},[z]),I=h.useCallback(()=>{const Y=M.current;M.current=void 0,Y==null||Y.abort(),E(!1),C(!1),k(!1)},[]);return a.jsx("div",{className:`${Es.message}${i?` ${e0.flash}`:""}`,children:n&&!u&&a.jsx("div",{className:Es.thinking,children:a.jsxs("div",{className:Es.thinkingBody,children:[a.jsxs("div",{className:`${Es.thinkingHeader}${d?` ${Es.thinkingHeaderExpanded}`:""}`,onClick:Y=>{Y.currentTarget.contains(Y.target)&&N()},children:[a.jsxs("button",{type:"button",className:Es.thinkingSummary,"aria-expanded":d,title:c(d?"thinking.collapse":"thinking.expand"),children:[a.jsx("span",{className:Es.thinkingSummaryIcon,"aria-hidden":"true",children:a.jsx(EXe,{})}),a.jsx("span",{className:m?`${Es.thinkingSummaryText} ${Es.thinkingSummaryTextActive}`:Es.thinkingSummaryText,children:c($,B?{duration:B}:{})})]}),l==="zh-CN"&&!m&&o&&a.jsxs(Kf,{open:x,onOpenChange:G,children:[a.jsx(Wp,{asChild:!0,children:a.jsx(Zt,{type:"button",variant:"secondary",size:"xs",className:Es.translateButton,title:c("thinking.translate"),onClick:Y=>Y.stopPropagation(),children:c("thinking.translate")})}),a.jsxs(Yf,{align:"start",className:Es.translationPopover,children:[a.jsx("div",{className:Es.translationTitle,children:c("thinking.translation")}),L?a.jsx("div",{className:Es.translationError,children:c("thinking.translationFailed")}):S!=null&&S.text?a.jsx("div",{className:`${Es.thinkingExpandedWrap} ${Es.translationContent}`,children:a.jsx(Qf,{content:S.text,source:"thinking",isStreaming:_})}):a.jsx("div",{className:Es.translationPending,children:c(j?"thinking.translationThinking":"thinking.translating")}),a.jsxs("div",{className:Es.translationFooter,children:[a.jsx("div",{className:Es.translationUsage,children:!_&&(S==null?void 0:S.text)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:c("thinking.inputTokens",{count:S.inputTokens??"--"})}),a.jsx("span",{children:c("thinking.outputTokens",{count:S.outputTokens??"--"})})]})}),a.jsxs("div",{className:Es.translationActions,children:[a.jsx(Zt,{type:"button",variant:"outline",size:"xs",onClick:()=>void z(!0),children:c("thinking.retranslate")}),a.jsx(Zt,{type:"button",variant:"outline",size:"xs",disabled:!_&&!(S!=null&&S.text)&&!L,onClick:I,children:c(_?"thinking.cancelTranslation":"thinking.closeTranslation")})]})]})]})]}),a.jsx("span",{className:d?Es.thinkingChevronDown:Es.thinkingChevronRight,"aria-hidden":"true"})]}),d&&a.jsx("div",{className:Es.thinkingExpandedClip,children:a.jsx("div",{className:Es.thinkingExpandedInner,children:a.jsx("div",{className:Es.thinkingExpandedWrap,children:a.jsx(Qf,{content:n,source:"thinking",isStreaming:r})})})})]})})})});function CXe({isStreaming:e,durationMs:t}){return e?"thinking.running":t!==void 0&&t<1e3?"thinking.doneBriefly":"thinking.done"}function TXe(e){const t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}function EXe(){return a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),a.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),a.jsx("path",{d:"M9.1 2.8c-3 0-5.1 2.3-5.1 5 0 1.7.8 3.1 2.1 4 .5.4.8.8.8 1.4h4.5c0-.6.3-1 .8-1.4 1.3-.9 2.1-2.3 2.1-4 0-.8-.2-1.6-.6-2.3",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M13.2 1.8 14 3.6l1.8.8-1.8.8-.8 1.8-.8-1.8-1.8-.8 1.8-.8.8-1.8Z",fill:"currentColor"})]})}const AXe="_panel_8ng9u_1",jXe="_title_8ng9u_16",NXe="_metaLine_8ng9u_22",IXe="_progress_8ng9u_32",MXe="_spacer_8ng9u_38",RXe="_row_8ng9u_42",DXe="_detailRow_8ng9u_43",LXe="_subDetailRow_8ng9u_44",PXe="_symbol_8ng9u_65",OXe="_label_8ng9u_69",$Xe="_value_8ng9u_73",BXe="_detailName_8ng9u_80",zXe="_sectionTitle_8ng9u_88",FXe="_detailSection_8ng9u_94",qXe="_skillBlock_8ng9u_100",HXe="_hint_8ng9u_105",UXe="_detailCommand_8ng9u_111",WXe="_bodyLoaded_8ng9u_132",VXe="_accent_8ng9u_137",GXe="_secondary_8ng9u_141",KXe="_warning_8ng9u_145",YXe="_error_8ng9u_149",XXe="_success_8ng9u_153",fr={panel:AXe,title:jXe,metaLine:NXe,progress:IXe,spacer:MXe,row:RXe,detailRow:DXe,subDetailRow:LXe,symbol:PXe,label:OXe,value:$Xe,detailName:BXe,sectionTitle:zXe,detailSection:FXe,skillBlock:qXe,hint:HXe,detailCommand:UXe,bodyLoaded:WXe,accent:VXe,secondary:GXe,warning:KXe,error:YXe,success:XXe},tR="web-shell:context-usage:v1:",Dm="█",Pde="▒",Ode="░",$de=30;function QXe(e){return`${tR}${JSON.stringify(e)}`}function JXe(e){if(!e.startsWith(tR))return null;try{const t=JSON.parse(e.slice(tR.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function Bde(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function qy(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function ZXe(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function eQe(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function tQe({usedPercentage:e,bufferPercentage:t}){const r=Math.round(Math.min(e,100)/100*56),s=Math.round(Math.min(t,Math.max(0,100-e))/100*56),i=Math.max(0,56-r-s),o=e>80?fr.error:e>60?fr.warning:fr.accent;return a.jsxs("div",{className:fr.progress,"aria-hidden":"true",children:[a.jsx("span",{className:o,children:Dm.repeat(Math.max(0,r))}),a.jsx("span",{className:fr.secondary,children:Ode.repeat(Math.max(0,i))}),a.jsx("span",{className:fr.warning,children:Pde.repeat(Math.max(0,s))})]})}function sf({symbol:e,label:t,tokens:n,tokenLabel:r,contextWindowSize:s,symbolClassName:i=fr.secondary,isOverLimit:o}){return a.jsxs("div",{className:fr.row,children:[a.jsx("span",{className:`${fr.symbol} ${i}`,children:e}),a.jsx("span",{className:fr.label,children:t}),a.jsxs("span",{className:o?fr.error:fr.value,children:[qy(n)," ",r," (",ZXe(n,s),"%)"]})]})}const Ij="/context detail";function nQe({hint:e,onShowDetail:t}){const n=t?e.indexOf(Ij):-1;return n<0?a.jsx("div",{className:fr.hint,children:e}):a.jsxs("div",{className:fr.hint,children:[e.slice(0,n),a.jsx("button",{type:"button",className:fr.detailCommand,onClick:t,children:Ij}),e.slice(n+Ij.length)]})}function rQe({name:e,tokens:t,tokenLabel:n}){return a.jsxs("div",{className:fr.detailRow,children:[a.jsxs("span",{className:fr.secondary,children:["└"," "]}),a.jsx("span",{className:fr.detailName,title:e,children:Bde(e,$de)}),a.jsxs("span",{className:fr.value,children:[qy(t)," ",n]})]})}function Mj({title:e,items:t,getName:n,tokenLabel:r}){const s=eQe(t);return s.length===0?null:a.jsxs("section",{className:fr.detailSection,children:[a.jsx("div",{className:fr.sectionTitle,children:e}),s.map(i=>a.jsx(rQe,{name:n(i),tokens:i.tokens,tokenLabel:r},n(i)))]})}function sQe({skills:e,labels:t}){const n=[...e].sort((r,s)=>r.loaded!==s.loaded?r.loaded?-1:1:s.tokens+(s.bodyTokens??0)-(r.tokens+(r.bodyTokens??0)));return n.length===0?null:a.jsxs("section",{className:fr.detailSection,children:[a.jsx("div",{className:fr.sectionTitle,children:t.skills}),n.map(r=>a.jsxs("div",{className:fr.skillBlock,children:[a.jsxs("div",{className:fr.detailRow,children:[a.jsxs("span",{className:fr.secondary,children:["└"," "]}),a.jsxs("span",{className:fr.detailName,title:r.name,children:[Bde(r.name,$de),r.loaded&&a.jsxs("span",{className:fr.success,children:[" ",t.active]})]}),a.jsxs("span",{className:fr.value,children:[qy(r.tokens)," ",t.tokens]})]}),r.loaded&&r.bodyTokens!=null&&r.bodyTokens>0&&a.jsxs("div",{className:fr.subDetailRow,children:[a.jsxs("span",{className:fr.secondary,children:["  └"," "]}),a.jsx("span",{className:fr.bodyLoaded,children:t.bodyLoaded}),a.jsxs("span",{className:fr.success,children:["+",qy(r.bodyTokens)," ",t.tokens]})]})]},r.name))]})}function iQe({status:e,onShowDetail:t}){const{t:n}=rt(),{usage:r}=e,{breakdown:s,contextWindowSize:i}=r,o=i>0?r.totalTokens/i*100:0,l=o>100,c=i>0?s.autocompactBuffer/i*100:0;return a.jsxs("div",{className:fr.panel,children:[a.jsx("div",{className:fr.title,children:n("contextUsage.title")}),r.isEstimated?a.jsx(a.Fragment,{children:a.jsxs("div",{className:fr.metaLine,children:[a.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),a.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",qy(i)," ",n("contextUsage.tokens")]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:fr.metaLine,children:[a.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),a.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",qy(i)," ",n("contextUsage.tokens")]})]}),l&&a.jsx("div",{className:fr.error,children:n("contextUsage.overLimit")})]}),a.jsx(tQe,{usedPercentage:Math.min(o,100),bufferPercentage:c}),a.jsx("div",{className:fr.spacer}),a.jsx(sf,{symbol:Dm,label:n("contextUsage.used"),tokens:r.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:l?fr.error:fr.accent,isOverLimit:l}),a.jsx(sf,{symbol:Ode,label:n("contextUsage.free"),tokens:s.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),a.jsx(sf,{symbol:Pde,label:n("contextUsage.autocompactBuffer"),tokens:s.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:fr.warning}),a.jsx("div",{className:fr.spacer}),a.jsx("div",{className:fr.sectionTitle,children:n("contextUsage.usageByCategory")}),a.jsx(sf,{symbol:Dm,label:n("contextUsage.systemPrompt"),tokens:s.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:fr.accent}),a.jsx(sf,{symbol:Dm,label:n("contextUsage.builtinTools"),tokens:s.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:fr.accent}),s.mcpTools>0&&a.jsx(sf,{symbol:Dm,label:n("contextUsage.mcpTools"),tokens:s.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:fr.accent}),a.jsx(sf,{symbol:Dm,label:n("contextUsage.memoryFiles"),tokens:s.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:fr.accent}),a.jsx(sf,{symbol:Dm,label:n("contextUsage.skills"),tokens:s.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:fr.accent}),!r.isEstimated&&a.jsx(sf,{symbol:Dm,label:n("contextUsage.messages"),tokens:s.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:fr.accent}),r.showDetails?a.jsxs(a.Fragment,{children:[a.jsx(Mj,{title:n("contextUsage.builtinTools"),items:r.builtinTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),a.jsx(Mj,{title:n("contextUsage.mcpTools"),items:r.mcpTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),a.jsx(Mj,{title:n("contextUsage.memoryFiles"),items:r.memoryFiles,getName:u=>"path"in u?u.path:u.name,tokenLabel:n("contextUsage.tokens")}),a.jsx(sQe,{skills:r.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):a.jsx(nQe,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const oQe={edit:"Edit",write_file:"WriteFile",read_file:"ReadFile",zoom_image:"ZoomImage",grep:"Grep",grep_search:"Grep",glob:"Glob",run_shell_command:"Shell",todo_write:"TodoList",get_goal:"Goal",update_goal:"UpdateGoal",save_memory:"SaveMemory",agent:"Agent",skill:"Skill",exit_plan_mode:"ExitPlanMode",web_fetch:"WebFetch",webfetch:"WebFetch",fetch:"WebFetch",list_directory:"ListFiles",lsp:"Lsp",ask_user_question:"AskUserQuestion",cron_create:"CronCreate",cron_list:"CronList",cron_delete:"CronDelete",loop_wakeup:"LoopWakeup",create_sub_session:"CreateSubSession",task_stop:"TaskStop",list_agents:"ListAgents",send_message:"SendMessage",structured_output:"StructuredOutput",monitor:"Monitor",notebook_edit:"NotebookEdit",tool_search:"ToolSearch",read_mcp_resource:"ReadMcpResource",enter_worktree:"EnterWorktree",exit_worktree:"ExitWorktree",enter_plan_mode:"EnterPlanMode",task_create:"TaskCreate",task_update:"TaskUpdate",task_list:"TaskList",team_create:"TeamCreate",team_delete:"TeamDelete",team_plan_approval:"TeamPlanApproval",workflow:"Workflow",artifact:"Artifact",record_artifact:"RecordArtifact",web_search:"WebSearch",image_gen:"ImageGen",bash:"Shell",shell:"Shell Command",read:"ReadFile",write:"WriteFile",search:"Grep"},aQe=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g;function C4(e){return e.replace(aQe,t=>{switch(t){case"\b":return"\\b";case"\f":return"\\f";case"\r":return"\\r";default:return`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`}})}function zde(e){if(!e.trim())return"Tool";const t=oQe[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function vd(e,t){const n=zde(e),r=[`toolName.${e}`,`toolName.${e.toLowerCase()}`,`toolName.${n.toLowerCase()}`];for(const s of r){const i=t(s);if(i!==s)return i}return n}function Ad(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Ko(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const cy=2e3;function PP(e,t){if(F6(e.toolName)){const s=z6(e.args,"skill");if(s)return Ko(s,cy)}const n=uQe(e,t);if(n)return Ko(n,cy);const r=qde(e,t);return r?Ko(r,cy):""}function Fde(e,t){if(!Uc(e.toolName))return PP(e,t);const n=z6(e.args,"description");if(n)return Ko(n,cy);const r=qde(e,t,{includeTimeout:!1});return r?Ko(r,cy):""}function lQe(e){return Uc(e.toolName)?z6(e.args,"description"):""}function xh(e){var t;if(!e.content)return rR(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return rR(e.rawOutput)}function cQe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=AG((rR(e.rawOutput)??"").trim());if(o)return o}const n=xh(e);if(!n)return"";const r=n.split(`
`),s=r.length;if(t==="read"||t==="read_file"||t==="readfile")return`${s} line(s)`;if(t==="glob")return`Found ${r.filter(l=>l.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${r.filter(l=>l.trim()).length} item(s)`;if(Uc(t)){if(s>3)return`${s} lines of output`;const o=r[0]||"";return Ko(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=AG(n.trim());return o||`${r.filter(c=>c.trim()).length} result(s)`}if(t==="edit"||t==="write"||t==="write_file"||t==="editfile")return"";if(t==="webfetch"||t==="web_fetch"||t==="fetch"){const o=r[0]||"";return Ko(o,80)}if(t==="websearch"||t==="web_search"){const o=r.filter(l=>l.trim()).length;return o>1?`${o} result(s)`:r[0]||""}if(Ad(t))return"";const i=r[0]||"";return Ko(i,80)}function uQe(e,t){if(!e.title)return null;const n=zde(e.toolName),r=e.title.trim();if(r===e.toolName||r===n)return null;const s=[n,e.toolName];for(const i of s)if(r.startsWith(i)){const o=r.slice(i.length);if(/^(:\s*|\s+)/.test(o))return jG(o.replace(/^:\s*|\s+/,""),t)}return jG(r,t)}function AG(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function qde(e,t,n={}){const r=e.args||{},s=e.toolName.toLowerCase(),i=n.includeTimeout??!0;if(r.command){let o=String(r.command);r.directory&&s!=="shell"&&(o+=` [in ${Bb(String(r.directory),t)}]`),r.is_background?o+=" [background]":i&&r.timeout&&(o+=` [timeout: ${String(r.timeout)}ms]`);const l=z6(r,"description");return l&&(o+=` (${l})`),Ko(o,cy)}if(s==="grep_search"||s==="grep"||s==="search"){const o=r.pattern??r.query;if(o){let l=`'${String(o)}'`;return r.path?l+=` in path '${String(r.path)}'`:(s==="grep_search"||s==="grep")&&(l+=" in path './'"),r.glob&&(l+=` (filter: '${String(r.glob)}')`),l}}if(s==="glob"&&r.pattern){let o=`'${String(r.pattern)}'`;return r.path&&(o+=` in path '${String(r.path)}'`),o}if(r.file_path)return r.description?String(r.description):Bb(String(r.file_path),t);if(r.url){const o=String(r.url),l=typeof r.prompt=="string"?r.prompt:void 0,c=l?`${o} — "${Ko(l,40)}"`:o;return Ko(c,80)}if(r.path)return Bb(String(r.path),t);if(r.query)return Ko(String(r.query),60);if(s==="list_directory"||s==="listfiles"){const o=r.path||r.directory||"";return Bb(String(o),t)}return r.description?String(r.description):""}function z6(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function Uc(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function F6(e){return e.toLowerCase()==="skill"}function wd(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(r=>wd(r,t)))??!1}function jG(e,t){const n=e.trim();return Hde(nR(n))?Bb(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,r=>Bb(r,t))}function Bb(e,t){const n=nR(e),r=t?nR(t).replace(/\/+$/,""):"";return r&&(n===r||n.startsWith(`${r}/`))?n.slice(r.length+1)||".":Hde(n)?dQe(n):n}function nR(e){return e.replace(/\\/g,"/")}function Hde(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function dQe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function W_(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function OP(e){if(!e.rawOutput||typeof e.rawOutput!="object")return"";const t=e.rawOutput,n=typeof t.terminateReason=="string"?t.terminateReason:"";return typeof t.reason=="string"&&t.reason||n&&n!=="GOAL"&&n||typeof t.error=="string"&&t.error||""}function e_(e){if(e.status==="failed")return"failed";if(!e.rawOutput||typeof e.rawOutput!="object")return e.status;const t=e.rawOutput,n=typeof t.status=="string"?t.status.toLowerCase():"",r=OP(e);return n==="cancelled"||n==="canceled"||r.toLowerCase().includes("cancel")?"failed":e.status}function $P(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const hQe="general-purpose";function BP(e){var r;const t=W_(e.rawOutput);if(t){const s=t.subagentName;if(typeof s=="string"&&s)return s}const n=(r=e.args)==null?void 0:r.subagent_type;return typeof n=="string"&&n?n:e.toolName==="task"?"task":hQe}function q6(e){var i,o;if(e.title){const l=e.title.indexOf(": ");if(l>0)return e.title.slice(l+2)}const t=(i=e.args)==null?void 0:i.description;if(typeof t=="string"&&t.trim())return t.trim();const n=W_(e.rawOutput),r=n==null?void 0:n.taskDescription;if(typeof r=="string"&&r.trim())return r.trim();const s=(o=e.args)==null?void 0:o.prompt;return typeof s=="string"&&s.trim()?s.trim().split(`
`)[0]??"":""}function fQe(e,t){var i,o;if(e.status!=="in_progress")return"";const n=e.subTools;if(!n||n.length===0)return"";const r=n[n.length-1];if(r.status!=="in_progress"&&r.status!=="pending")return"";let s=vd(r.toolName??"",t);if(r.title){const l=r.title.indexOf(": ");s+=" "+(l>0?r.title.slice(l+2):r.title)}else(i=r.args)!=null&&i.command?s+=" "+String(r.args.command):(o=r.args)!=null&&o.file_path&&(s+=" "+String(r.args.file_path));return Ko(s,50)}function rR(e){if(!e)return null;if(typeof e=="string")return e;if(typeof e!="object")return null;const t=e;return typeof t.output=="string"?t.output:typeof t.stdout=="string"?t.stdout:typeof t.content=="string"?t.content:typeof t.reason=="string"?t.reason:typeof t.terminateReason=="string"?t.terminateReason:typeof t.error=="string"?t.error:typeof t.text=="string"?t.text:null}const mQe="_panel_qchwm_1",pQe="_title_qchwm_17",gQe="_sectionTitle_qchwm_23",bQe="_spacer_qchwm_29",yQe="_pivotRow_qchwm_35",vQe="_metricCell_qchwm_41",wQe="_metricCellSection_qchwm_48",xQe="_metricCellSub_qchwm_56",kQe="_modelCell_qchwm_64",_Qe="_modelCellHeader_qchwm_71",SQe="_divider_qchwm_79",CQe="_kvRow_qchwm_87",TQe="_kvSubRow_qchwm_94",EQe="_kvLabel_qchwm_102",AQe="_kvValue_qchwm_106",jQe="_tableRow_qchwm_115",NQe="_modelUsageRow_qchwm_121",IQe="_tableNameCol_qchwm_129",MQe="_tableToolCol_qchwm_137",RQe="_tableNumCol_qchwm_145",DQe="_tableValueCol_qchwm_153",LQe="_success_qchwm_162",PQe="_error_qchwm_166",OQe="_secondary_qchwm_170",$Qe="_warning_qchwm_174",Kt={panel:mQe,title:pQe,sectionTitle:gQe,spacer:bQe,pivotRow:yQe,metricCell:vQe,metricCellSection:wQe,metricCellSub:xQe,modelCell:kQe,modelCellHeader:_Qe,divider:SQe,kvRow:CQe,kvSubRow:TQe,kvLabel:EQe,kvValue:AQe,tableRow:jQe,modelUsageRow:NQe,tableNameCol:IQe,tableToolCol:MQe,tableNumCol:RQe,tableValueCol:DQe,success:LQe,error:PQe,secondary:OQe,warning:$Qe},sR="web-shell:session-stats:v1:";function BQe(e,t="overview"){return`${sR}${JSON.stringify({_view:t,...e})}`}function zQe(e){if(!e.startsWith(sR))return null;try{const t=JSON.parse(e.slice(sR.length));if(!t||typeof t.durationMs!="number")return null;const n=t._view??"overview";return delete t._view,{view:n,status:t}}catch{return null}}function _p(e){if(e<=0)return"0s";if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=Math.floor(t%60),i=[];return n>0&&i.push(`${n}h`),r>0&&i.push(`${r}m`),s>0&&i.push(`${s}s`),i.join(" ")||"0s"}function fg({label:e,children:t}){return a.jsxs("div",{className:Kt.kvRow,children:[a.jsx("span",{className:Kt.kvLabel,children:e}),a.jsx("span",{className:Kt.kvValue,children:t})]})}function Jx({label:e,children:t}){return a.jsxs("div",{className:Kt.kvSubRow,children:[a.jsxs("span",{className:Kt.secondary,children:["»"," ",e]}),a.jsx("span",{className:Kt.kvValue,children:t})]})}function Ude(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const r=t.split("::"),s=r[0],i=r[1],o=i?`${s} (${i})`:s;return{key:t,label:o,metrics:n}})}function FQe(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function qQe(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function HQe(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Ud({metric:e,values:t,variant:n="normal"}){const r=n==="section"?Kt.metricCellSection:n==="sub"?Kt.metricCellSub:Kt.metricCell;return a.jsxs("div",{className:Kt.pivotRow,children:[a.jsx("span",{className:r,children:n==="sub"?`↳ ${e}`:e}),t.map((s,i)=>a.jsx("span",{className:Kt.modelCell,children:s},i))]})}function UQe({status:e}){const{t}=rt(),{models:n,tools:r,files:s}=e,i=Object.values(n).reduce((b,w)=>b+w.api.totalLatencyMs,0),o=r.totalDurationMs,l=i+o,c=l>0?i/l*100:0,u=l>0?o/l*100:0,d=r.totalCalls>0?r.totalSuccess/r.totalCalls*100:0,f=Ude(n),m=f.reduce((b,w)=>b+w.metrics.tokens.cached,0),p=f.reduce((b,w)=>b+w.metrics.tokens.prompt,0),g=p>0?m/p*100:0;return a.jsxs("div",{className:Kt.panel,children:[a.jsx("div",{className:Kt.title,children:t("stats.title")}),a.jsx("div",{className:Kt.sectionTitle,children:t("stats.overview")}),a.jsx(fg,{label:t("stats.duration"),children:_p(e.durationMs)}),a.jsx(fg,{label:t("stats.prompts"),children:e.promptCount}),a.jsx(fg,{label:t("stats.toolCalls"),children:a.jsxs("span",{children:[r.totalCalls," ",a.jsx("span",{className:Kt.secondary,children:"("}),a.jsxs("span",{className:Kt.success,children:["✓",r.totalSuccess]})," ",a.jsxs("span",{className:Kt.error,children:["✗",r.totalFail]}),a.jsx("span",{className:Kt.secondary,children:")"})]})}),a.jsx(fg,{label:t("stats.successRate"),children:a.jsxs("span",{className:d>=90?Kt.success:d>=70?Kt.warning:Kt.error,children:[d.toFixed(1),"%"]})}),(s.totalLinesAdded>0||s.totalLinesRemoved>0)&&a.jsx(fg,{label:t("stats.codeChanges"),children:a.jsxs("span",{children:[a.jsxs("span",{className:Kt.success,children:["+",s.totalLinesAdded]})," ",a.jsxs("span",{className:Kt.error,children:["-",s.totalLinesRemoved]})]})}),a.jsx("div",{className:Kt.spacer}),a.jsx("div",{className:Kt.sectionTitle,children:t("stats.performance")}),a.jsxs(Jx,{label:t("stats.apiTime"),children:[_p(i)," ",a.jsxs("span",{className:Kt.secondary,children:["(",c.toFixed(1),"%)"]})]}),a.jsxs(Jx,{label:t("stats.toolTime"),children:[_p(o)," ",a.jsxs("span",{className:Kt.secondary,children:["(",u.toFixed(1),"%)"]})]}),f.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Kt.spacer}),a.jsx("div",{className:Kt.sectionTitle,children:t("stats.modelUsage")}),a.jsx("div",{className:Kt.spacer}),a.jsxs("div",{className:`${Kt.tableRow} ${Kt.modelUsageRow}`,children:[a.jsx("span",{className:Kt.tableNameCol,children:t("stats.modelUsage")}),a.jsx("span",{className:Kt.tableValueCol,children:t("stats.reqs")}),a.jsx("span",{className:Kt.tableValueCol,children:t("stats.inputTokens")}),a.jsx("span",{className:Kt.tableValueCol,children:t("stats.outputTokens")})]}),a.jsx("div",{className:Kt.divider}),f.map(b=>a.jsxs("div",{className:`${Kt.tableRow} ${Kt.modelUsageRow}`,children:[a.jsx("span",{className:Kt.tableNameCol,children:b.label}),a.jsx("span",{className:Kt.tableValueCol,children:b.metrics.api.totalRequests}),a.jsx("span",{className:`${Kt.tableValueCol} ${Kt.warning}`,children:b.metrics.tokens.prompt.toLocaleString()}),a.jsx("span",{className:`${Kt.tableValueCol} ${Kt.warning}`,children:b.metrics.tokens.candidates.toLocaleString()})]},b.key)),g>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Kt.spacer}),a.jsxs("div",{children:[a.jsx("span",{className:Kt.success,children:t("stats.savingsHighlight")})," ",m.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),a.jsxs("div",{className:Kt.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function WQe({status:e}){const{t}=rt(),n=Ude(e.models);if(n.length===0)return a.jsxs("div",{className:Kt.panel,children:[a.jsx("div",{className:Kt.title,children:t("stats.modelStats")}),a.jsx("div",{children:t("stats.noApiCalls")})]});const r=n.some(o=>o.metrics.tokens.cached>0),s=n.some(o=>o.metrics.tokens.thoughts>0),i=o=>n.map(l=>o(l.metrics));return a.jsxs("div",{className:Kt.panel,children:[a.jsx("div",{className:Kt.title,children:t("stats.modelStats")}),a.jsx("div",{className:Kt.spacer}),a.jsxs("div",{className:Kt.pivotRow,children:[a.jsx("span",{className:Kt.metricCellSection,children:t("stats.metric")}),n.map(o=>a.jsx("span",{className:Kt.modelCellHeader,children:o.label},o.key))]}),a.jsx("div",{className:Kt.divider}),a.jsx(Ud,{metric:t("stats.api"),values:[],variant:"section"}),a.jsx(Ud,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),a.jsx(Ud,{metric:t("stats.errors"),values:i(o=>{const l=FQe(o);return a.jsxs("span",{className:o.api.totalErrors>0?Kt.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",l.toFixed(1),"%)"]})})}),a.jsx(Ud,{metric:t("stats.avgLatency"),values:i(o=>_p(qQe(o)))}),a.jsx("div",{className:Kt.spacer}),a.jsx(Ud,{metric:t("stats.tokens"),values:[],variant:"section"}),a.jsx(Ud,{metric:t("stats.total"),values:i(o=>a.jsx("span",{className:Kt.warning,children:o.tokens.total.toLocaleString()}))}),a.jsx(Ud,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),r&&a.jsx(Ud,{metric:t("stats.cached"),values:i(o=>a.jsxs("span",{className:Kt.success,children:[o.tokens.cached.toLocaleString()," (",HQe(o).toFixed(1),"%)"]})),variant:"sub"}),a.jsx(Ud,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),s&&a.jsx(Ud,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function VQe(e){return Object.entries(e).filter(([,t])=>t.count>0).sort((t,n)=>n[1].count-t[1].count).map(([t,n])=>({name:t,stats:n}))}function GQe({status:e}){const{t}=rt(),n=VQe(e.tools.byName);if(n.length===0)return a.jsxs("div",{className:Kt.panel,children:[a.jsx("div",{className:Kt.title,children:t("stats.toolStats")}),a.jsx("div",{children:t("stats.noToolCalls")})]});const r=Object.values(e.tools.byName).reduce((o,l)=>{var c,u,d;return o.accept+=((c=l.decisions)==null?void 0:c.accept)??0,o.reject+=((u=l.decisions)==null?void 0:u.reject)??0,o.modify+=((d=l.decisions)==null?void 0:d.modify)??0,o},{accept:0,reject:0,modify:0}),s=r.accept+r.reject+r.modify,i=s>0?r.accept/s*100:0;return a.jsxs("div",{className:Kt.panel,children:[a.jsx("div",{className:Kt.title,children:t("stats.toolStats")}),a.jsx("div",{className:Kt.spacer}),a.jsxs("div",{className:Kt.tableRow,children:[a.jsx("span",{className:Kt.tableToolCol,children:t("stats.toolName")}),a.jsx("span",{className:Kt.tableNumCol,children:t("stats.calls")}),a.jsx("span",{className:Kt.tableNumCol,children:t("stats.successRate")}),a.jsx("span",{className:Kt.tableNumCol,children:t("stats.avgDuration")})]}),a.jsx("div",{className:Kt.divider}),n.map(o=>{const l=o.stats.count>0?o.stats.success/o.stats.count*100:0,c=o.stats.count>0?o.stats.durationMs/o.stats.count:0;return a.jsxs("div",{className:Kt.tableRow,children:[a.jsx("span",{className:`${Kt.tableToolCol} ${Kt.metricCell}`,children:vd(o.name,t)}),a.jsx("span",{className:Kt.tableNumCol,children:o.stats.count}),a.jsxs("span",{className:`${Kt.tableNumCol} ${l>=90?Kt.success:l>=70?Kt.warning:Kt.error}`,children:[l.toFixed(1),"%"]}),a.jsx("span",{className:Kt.tableNumCol,children:_p(c)})]},o.name)}),a.jsx("div",{className:Kt.spacer}),a.jsx("div",{className:Kt.sectionTitle,children:t("stats.decisionSummary")}),a.jsx(fg,{label:t("stats.totalReviewed"),children:s}),a.jsx(Jx,{label:t("stats.accepted"),children:a.jsx("span",{className:Kt.success,children:r.accept})}),a.jsx(Jx,{label:t("stats.rejected"),children:a.jsx("span",{className:Kt.error,children:r.reject})}),a.jsx(Jx,{label:t("stats.modified"),children:a.jsx("span",{className:Kt.warning,children:r.modify})}),a.jsx("div",{className:Kt.divider}),a.jsx(fg,{label:t("stats.agreementRate"),children:a.jsx("span",{className:s>0?i>=90?Kt.success:i>=70?Kt.warning:Kt.error:void 0,children:s>0?`${i.toFixed(1)}%`:"--"})})]})}function KQe({view:e,status:t}){switch(e){case"model":return a.jsx(WQe,{status:t});case"tools":return a.jsx(GQe,{status:t});default:return a.jsx(UQe,{status:t})}}function H6(e){return{serialize(t){return`${e}${JSON.stringify(t)}`},parse(t){if(!t.startsWith(e))return null;try{const n=JSON.parse(t.slice(e.length));return!n||typeof n!="object"?null:n}catch{return null}}}}const YQe="_panel_13hcg_1",XQe="_title_13hcg_17",QQe="_row_13hcg_23",JQe="_rowGap_13hcg_31",ZQe="_label_13hcg_35",eJe="_value_13hcg_41",tJe="_accent_13hcg_46",xg={panel:YQe,title:XQe,row:QQe,rowGap:JQe,label:ZQe,value:eJe,accent:tJe},{serialize:nJe,parse:rJe}=H6("web-shell:status:v1:");function nd({label:e,children:t,gap:n}){return a.jsxs("div",{className:`${xg.row}${n?` ${xg.rowGap}`:""}`,children:[a.jsx("span",{className:xg.label,children:e}),a.jsx("span",{className:xg.value,children:t})]})}function sJe({info:e}){const{t}=rt();return a.jsxs("div",{className:xg.panel,children:[a.jsx("div",{className:xg.title,children:t("about.title")}),e.cliVersion&&a.jsx(nd,{label:t("about.qwenCode"),children:a.jsx("span",{className:xg.accent,children:e.cliVersion})}),e.runtime&&a.jsx(nd,{label:t("about.runtime"),children:e.runtime}),e.platform&&a.jsx(nd,{label:t("about.platform"),children:e.platform}),e.auth&&a.jsx(nd,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&a.jsx(nd,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&a.jsx(nd,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&a.jsx(nd,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&a.jsx(nd,{label:t("about.sessionId"),children:e.sessionId}),a.jsx(nd,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),a.jsx(nd,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&a.jsx(nd,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function iJe(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function Wde(e,t,n=50){const r=h.useRef(e);h.useEffect(()=>{r.current=e},[e]),h.useEffect(()=>{const s=o=>{o.defaultPrevented||Qg(o.target)&&!iJe(o.target)||r.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",s)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",s)}},t)}function Ao(e){if(e&&typeof e=="object"){const t=e.body;if(t&&typeof t=="object"){const n=t.data;if(n&&typeof n=="object"){const s=n.details;if(typeof s=="string"&&s)return s}const r=t.error;if(typeof r=="string"&&r)return r}if(e instanceof Error&&e.message)return e.message}return String(e)}const oJe="_panel_1jx2a_1",aJe="_title_1jx2a_13",lJe="_header_1jx2a_18",cJe="_startup_1jx2a_24",uJe="_note_1jx2a_28",dJe="_secondary_1jx2a_29",hJe="_row_1jx2a_39",fJe="_selected_1jx2a_48",mJe="_disabled_1jx2a_52",pJe="_pointer_1jx2a_56",gJe="_nameCell_1jx2a_62",bJe="_truncate_1jx2a_69",yJe="_separator_1jx2a_75",vJe="_sectionTitle_1jx2a_79",wJe="_groupTitle_1jx2a_80",xJe="_success_1jx2a_84",kJe="_warning_1jx2a_88",_Je="_error_1jx2a_92",SJe="_group_1jx2a_80",CJe="_list_1jx2a_102",TJe="_description_1jx2a_108",EJe="_schema_1jx2a_113",AJe="_shortcuts_1jx2a_131",jJe="_detail_1jx2a_137",NJe="_serverFields_1jx2a_143",IJe="_serverField_1jx2a_143",MJe="_serverFieldLabel_1jx2a_156",RJe="_detailBlock_1jx2a_160",DJe="_parameters_1jx2a_161",LJe="_invalidBlock_1jx2a_162",PJe="_parameterRow_1jx2a_172",OJe="_actionMessage_1jx2a_177",$Je="_oauthPage_1jx2a_183",BJe="_scrollHint_1jx2a_189",kn={panel:oJe,title:aJe,header:lJe,startup:cJe,note:uJe,secondary:dJe,row:hJe,selected:fJe,disabled:mJe,pointer:pJe,nameCell:gJe,truncate:bJe,separator:yJe,sectionTitle:vJe,groupTitle:wJe,success:xJe,warning:kJe,error:_Je,group:SJe,list:CJe,description:TJe,schema:EJe,shortcuts:AJe,detail:jJe,serverFields:NJe,serverField:IJe,serverFieldLabel:MJe,detailBlock:RJe,parameters:DJe,invalidBlock:LJe,parameterRow:PJe,actionMessage:OJe,oauthPage:$Je,scrollHint:BJe},iR="web-shell:mcp-panel-active",K0=10,{parse:zJe}=H6("web-shell:mcp-status:v1:");function FJe(e){const t=zJe(e);return!t||!t.status?null:t}function lC(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:kn.error};if(e.approvalState==="pending")return{icon:"!",text:t("mcp.status.needsApproval"),className:kn.warning};if(e.approvalState==="rejected")return{icon:"✗",text:t("mcp.status.rejected"),className:kn.warning};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:kn.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:kn.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:kn.error}}}function Vde(e){const t=e.schema,n=(t==null?void 0:t.parametersJsonSchema)??(t==null?void 0:t.parameters)??t;return n&&typeof n=="object"?n:null}function qJe(e){const t=Vde(e);return t?JSON.stringify(t,null,2):""}function HJe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function UJe(e,t){const n=e.source;return e.configOrigin==="project_mcp_json"||n==="project"&&e.removable===!1?t("mcp.source.project"):e.configOrigin==="workspace_settings"||n==="workspace"||n==="project"?t("mcp.source.workspace"):e.configOrigin==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function WJe(e,t){var r;const n=e.config;if(n!=null&&n.httpUrl)return`${n.httpUrl} (http)`;if(n!=null&&n.url)return`${n.url} (sse)`;if(n!=null&&n.command){const s=((r=n.args)==null?void 0:r.join(" "))??"";return`${n.command} ${s} (stdio)`.trim()}return e.transport?`(${e.transport})`:t("mcp.status.unknown")}function Rj(e,t){const n=e.annotations??{},r=[];return n.destructiveHint&&r.push(t("mcp.annotation.destructive")),n.readOnlyHint&&r.push(t("mcp.annotation.readOnly")),n.openWorldHint&&r.push(t("mcp.annotation.openWorld")),n.idempotentHint&&r.push(t("mcp.annotation.idempotent")),r.join(", ")}function NG(e,t){window.dispatchEvent(new CustomEvent(iR,{detail:{id:e,active:t}}))}function cC(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function VJe(e,t){return e?t("mcp.required"):""}function GJe(e,t){const n=Vde(e),r=n==null?void 0:n.properties,s=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!r||typeof r!="object"){const o=qJe(e);return o?a.jsx("pre",{className:kn.schema,children:o}):null}const i=Object.entries(r);return i.length===0?null:a.jsxs("div",{className:kn.parameters,children:[a.jsx("div",{className:kn.sectionTitle,children:t("mcp.parameters")}),i.map(([o,l])=>{const c=l&&typeof l=="object"?l:{},u=typeof c.type=="string"?c.type:"any",d=typeof c.description=="string"?c.description:"";return a.jsx("div",{className:kn.parameterRow,children:`• ${o}${VJe(s.has(o),t)}: ${u}${d?` - ${d}`:""}`},o)})]})}function KJe({message:e}){var Y;const{t}=rt(),n=X9({autoLoad:!1}),[r,s]=h.useState(e.status),[i,o]=h.useState(e.toolsByServer),[l,c]=h.useState(null),[u,d]=h.useState(!1),f=h.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[m,p]=h.useState(!0),[g,b]=h.useState("servers"),[w,y]=h.useState(0),[v,x]=h.useState(0),[k,S]=h.useState(0),T=h.useMemo(()=>r.servers??[],[r.servers]),_=T[w]??null,C=h.useMemo(()=>{var U;return _?((U=i[_.name])==null?void 0:U.tools)??[]:[]},[_,i]),j=C[k]??null,E=h.useMemo(()=>C.length<=K0||k<K0-1?0:Math.min(k-K0+1,C.length-K0),[k,C.length]),L=h.useMemo(()=>C.slice(E,E+K0),[C,E]),D=T.filter(U=>!U.disabled&&U.mcpStatus==="connecting").length,M=h.useMemo(()=>{const U=[];for(const P of T){const F=HJe(P,t),te=U.find(W=>W.label===F);te?te.servers.push(P):U.push({label:F,servers:[P]})}return U},[T,t]),R=h.useMemo(()=>T.length===0?20:Math.min(Math.max(...T.map(U=>U.name.length))+2,35),[T]),$=h.useMemo(()=>C.length===0?30:Math.min(Math.max(...C.map(U=>U.name.length))+2,50),[C]),B=h.useMemo(()=>{if(!_)return[];const U=[],P=!!_.approvalState;return!_.disabled&&!P&&C.length>0&&U.push({id:"view-tools",label:t("mcp.action.tools")}),!_.disabled&&!P&&_.mcpStatus==="disconnected"&&U.push({id:"reconnect",label:t("mcp.action.reconnect")}),!_.disabled&&P&&U.push({id:"approve",label:t("mcp.action.approve")}),(!(_.configOrigin==="extension"||_.source==="extension"||!!_.extensionName)||_.disabled)&&U.push({id:_.disabled?"enable":"disable",label:_.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!_.disabled&&!P&&(U.push({id:"authenticate",label:_.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),_.hasOAuthTokens&&U.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),U},[_,C.length,t]),N=h.useCallback(async()=>{var P;const U=await n.reload();if(U){s(U);const F=((P=U.servers)==null?void 0:P.find(te=>te.name===(_==null?void 0:_.name)))??null;if(F){if(F.approvalState)return;const te=await n.loadTools(F.name);o(W=>({...W,[F.name]:te}))}}},[n,_==null?void 0:_.name]),z=h.useCallback(async U=>{if(!(!_||U.disabled||u)){if(U.id==="view-tools"){b("tools"),S(0),c(null);return}d(!0),U.id==="authenticate"&&b("oauth"),c(U.id==="authenticate"?cC(_.name,t):t("mcp.action.running",{action:U.label}));try{let P=null;if(U.id==="reconnect"){const F=await n.restartServer(_.name);if("restarted"in F&&!F.restarted)throw new Error(t("mcp.reconnect.skipped",{reason:F.reason}));if("entries"in F&&(F.entries.length===0||F.entries.every(te=>!te.restarted)))throw new Error(t("mcp.reconnect.skipped",{reason:F.entries.map(te=>te.reason).filter(Boolean).join(", ")||"not connected"}))}else{const F=await n.manageServer(_.name,U.id),te=[...F.messages??[],...F.authUrl?[F.authUrl]:[]].join(`
`);te&&(P=U.id==="authenticate"?cC(_.name,t,te):te)}await N(),c(P??t("mcp.action.done",{action:U.label}))}catch(P){c(U.id==="authenticate"?cC(_.name,t,Ao(P)):t("mcp.action.failed",{error:Ao(P)}))}finally{d(!1)}}},[u,n,N,_,t]);if(h.useEffect(()=>{const U=f.current;return NG(U,m),()=>NG(U,!1)},[m]),h.useEffect(()=>{const U=P=>{const F=P.detail;F!=null&&F.active&&F.id&&F.id!==f.current&&p(!1)};return window.addEventListener(iR,U),()=>window.removeEventListener(iR,U)},[]),Wde(U=>{if(m){if(U.key==="Escape"){U.preventDefault(),U.stopPropagation(),g==="servers"?p(!1):g==="server"?(b("servers"),x(0),c(null)):g==="oauth"?(b("server"),c(null)):g==="tools"?(b("server"),S(0)):b("tools");return}if(U.key==="ArrowUp"||U.key==="ArrowDown"){U.preventDefault(),U.stopPropagation();const P=U.key==="ArrowUp"?-1:1;g==="servers"?(y(F=>Math.min(Math.max(F+P,0),T.length-1)),x(0)):g==="server"?x(F=>Math.min(Math.max(F+P,0),B.length-1)):g==="tools"&&S(F=>Math.min(Math.max(F+P,0),C.length-1));return}if(U.key==="Enter")if(U.preventDefault(),U.stopPropagation(),g==="servers"&&T.length>0)b("server"),x(0);else if(g==="server"&&B.length>0){const P=B[v];P&&z(P)}else g==="tools"&&C.length>0&&b("tool")}},[m,v,C.length,B,z,T.length,g]),!m)return null;if(T.length===0)return a.jsxs("div",{className:kn.panel,"data-keyboard-scope":!0,children:[a.jsxs("div",{className:kn.header,children:[a.jsx("div",{className:kn.title,children:t("mcp.manageServers")}),a.jsx("div",{className:kn.secondary,children:t("mcp.servers",{count:0})})]}),a.jsx("div",{className:kn.secondary,children:t("mcp.empty")}),a.jsx("div",{className:kn.shortcuts,children:t("mcp.shortcut.close")})]});const G=g==="servers"?t("mcp.manageServers"):g==="server"?(_==null?void 0:_.name)??t("mcp.manageServers"):g==="oauth"?t("mcp.oauth.title"):g==="tools"?t("mcp.toolsForServer",{name:(_==null?void 0:_.name)??t("common.server")}):(j==null?void 0:j.name)??t("mcp.toolDetail"),I=g==="servers"?t("mcp.servers",{count:T.length}):g==="server"||g==="oauth"?"":g==="tools"?t(C.length===1?"mcp.toolCount":"mcp.toolsCount",{count:C.length}):(j==null?void 0:j.serverToolName)??(_==null?void 0:_.name)??"";return a.jsxs("div",{className:kn.panel,"data-keyboard-scope":!0,children:[D>0&&a.jsxs("div",{children:[a.jsx("div",{className:kn.startup,children:t("mcp.starting",{count:D})}),a.jsx("div",{className:kn.note,children:t("mcp.startingNote")})]}),a.jsxs("div",{className:kn.header,children:[a.jsx("div",{className:kn.title,children:G}),I&&a.jsx("div",{className:kn.secondary,children:I})]}),g==="servers"&&a.jsx("div",{className:kn.list,children:M.map(U=>{let P=0;for(const F of M){if(F===U)break;P+=F.servers.length}return a.jsxs("div",{className:kn.group,children:[a.jsx("div",{className:kn.groupTitle,children:U.label}),U.servers.map((F,te)=>{const W=P+te,K=W===w,ce=lC(F,t);return a.jsxs("div",{className:K?`${kn.row} ${kn.selected}`:kn.row,onClick:()=>{y(W),b("server"),x(0)},onMouseEnter:()=>y(W),children:[a.jsx("span",{className:kn.pointer,children:K?"❯":""}),a.jsx("span",{className:kn.nameCell,style:{width:`${R}ch`},children:F.name}),a.jsx("span",{className:kn.separator,children:"·"}),a.jsxs("span",{className:ce.className,children:[ce.icon," ",ce.text]})]},F.name)})]},U.label)})}),g==="server"&&_&&a.jsxs("div",{className:kn.detail,children:[a.jsxs("div",{className:kn.serverFields,children:[a.jsxs("div",{className:kn.serverField,children:[a.jsxs("span",{className:kn.serverFieldLabel,children:[t("mcp.status"),":"]}),a.jsxs("span",{className:lC(_,t).className,children:[lC(_,t).icon," ",lC(_,t).text]})]}),a.jsxs("div",{className:kn.serverField,children:[a.jsxs("span",{className:kn.serverFieldLabel,children:[t("mcp.source"),":"]}),a.jsx("span",{children:UJe(_,t)})]}),a.jsxs("div",{className:kn.serverField,children:[a.jsxs("span",{className:kn.serverFieldLabel,children:[t("mcp.command"),":"]}),a.jsx("span",{className:kn.truncate,children:WJe(_,t)})]}),((Y=_.config)==null?void 0:Y.cwd)&&a.jsxs("div",{className:kn.serverField,children:[a.jsxs("span",{className:kn.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),a.jsx("span",{className:kn.truncate,children:_.config.cwd})]}),!_.disabled&&a.jsxs("div",{className:kn.serverField,children:[a.jsxs("span",{className:kn.serverFieldLabel,children:[t("mcp.tools"),":"]}),a.jsx("span",{children:t(C.length===1?"mcp.toolCount":"mcp.toolsCount",{count:C.length})})]})]}),a.jsx("div",{className:kn.list,children:B.map((U,P)=>{const F=P===v,te=[kn.row,F?kn.selected:"",U.disabled?kn.disabled:""].filter(Boolean).join(" ");return a.jsxs("div",{className:te,onClick:()=>{x(P),z(U)},children:[a.jsx("span",{className:kn.pointer,children:F?"❯":""}),a.jsx("span",{children:U.label})]},U.id)})}),l&&a.jsx("pre",{className:kn.actionMessage,children:l})]}),g==="oauth"&&a.jsx("div",{className:kn.oauthPage,children:a.jsx("pre",{className:kn.actionMessage,children:l??(_?cC(_.name,t):t("mcp.status.unknown"))})}),g==="tools"&&a.jsx("div",{className:kn.list,children:C.length===0?a.jsx("div",{className:kn.secondary,children:t("mcp.emptyTools")}):L.map((U,P)=>{const F=E+P,te=F===k,W=Rj(U,t);return a.jsxs("div",{className:te?`${kn.row} ${kn.selected}`:kn.row,onClick:()=>{S(F),b("tool")},onMouseEnter:()=>S(F),children:[a.jsx("span",{className:kn.pointer,children:te?"❯":""}),a.jsx("span",{className:kn.nameCell,style:{width:`${$}ch`},children:U.name}),U.isValid?W?a.jsx("span",{className:kn.secondary,children:W}):null:a.jsx("span",{className:kn.warning,children:t("mcp.invalidReason",{reason:U.invalidReason||t("mcp.status.unknown")})})]},U.name)})}),g==="tools"&&C.length>K0&&a.jsxs("div",{className:kn.scrollHint,children:[E>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:C.length}),E+K0<C.length?" ↓":""]}),g==="tool"&&j&&a.jsxs("div",{className:kn.detail,children:[!j.isValid&&a.jsxs("div",{className:kn.invalidBlock,children:[a.jsx("div",{className:kn.sectionTitle,children:t("mcp.invalidToolWarning")}),a.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",j.invalidReason||t("mcp.status.unknown")]}),a.jsx("div",{className:kn.secondary,children:t("mcp.invalidToolHelp")})]}),j.description&&a.jsxs("div",{className:kn.detailBlock,children:[a.jsx("div",{className:kn.sectionTitle,children:t("mcp.description")}),a.jsx("div",{className:kn.description,children:j.description.trim()})]}),Rj(j,t)&&a.jsxs("div",{className:kn.detailBlock,children:[a.jsx("span",{className:kn.sectionTitle,children:t("mcp.annotations")})," ",a.jsx("span",{children:Rj(j,t)})]}),GJe(j,t)]}),a.jsx("div",{className:kn.shortcuts,children:t(g==="servers"?"mcp.shortcut.selectClose":g==="server"||g==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}function zP(e){return e instanceof Error&&e.message.endsWith("Daemon session is not connected")}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const YJe=3;function A3(e){return e.kind==="agent"&&typeof e.id=="string"}function XJe(e){const t=e.filter(A3),n=new Map;for(const u of t)n.set(u.id,u);const r=new Map,s=[];for(const u of t){const d=u.parentAgentId;if(d!=null&&d!==u.id&&n.has(d)){const f=r.get(d);f?f.push(u):r.set(d,[u])}else s.push(u)}if(r.size===0)return[...e];const i=[],o=new Set,l=u=>{if(!o.has(u.id)){o.add(u.id),i.push(u);for(const d of r.get(u.id)??[])l(d)}};for(const u of s)l(u);for(const u of t)o.has(u.id)||(o.add(u.id),i.push(u));let c=0;return e.map(u=>A3(u)?i[c++]:u)}function Gde(e,t){const n=[],r=new Set(e.id!=null?[e.id]:[]);let s=e.parentAgentId;for(;;){if(s==null)return{chain:n,terminatedBy:"root"};if(r.has(s))return{chain:n,terminatedBy:"cycle"};const i=t(s);if(!i)return{chain:n,terminatedBy:"missing"};r.add(s),n.push(i),s=i.parentAgentId}}function QJe(e){const t=new Map;for(const r of e)A3(r)&&t.set(r.id,r);const n=new Map;for(const r of t.values()){const{chain:s,terminatedBy:i}=Gde(r,o=>t.get(o));n.set(r.id,{visibleDepth:i==="cycle"?0:s.length,orphaned:s.length===0&&i==="missing"})}return n}function JJe(e){const t=new Map;for(const r of e)A3(r)&&t.set(r.id,r);const n=new Set;for(const r of t.values()){if(r.isBackgrounded!==!1)continue;const{chain:s,terminatedBy:i}=Gde(r,o=>t.get(o));i==="root"&&s.every(o=>o.isBackgrounded===!1)&&n.add(r.id)}return n}function Hy(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60);if(r===0)return`${n}s`;const s=r%60,i=Math.floor(r/60);return i===0?`${s}m ${n}s`:`${i}h ${s}m`}const ZJe=d1("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Ai({className:e,variant:t="default",asChild:n=!1,...r}){const s=n?rL:"span";return a.jsx(s,{"data-slot":"badge","data-variant":t,className:ln(ZJe({variant:t}),e),...r})}const eZe="_panel_hlsct_1",tZe="_embeddedPanel_hlsct_12",nZe="_title_hlsct_19",rZe="_sectionTitle_hlsct_24",sZe="_overflowHint_hlsct_28",iZe="_header_hlsct_33",oZe="_secondary_hlsct_39",aZe="_row_hlsct_43",lZe="_selected_hlsct_51",cZe="_pointer_hlsct_55",uZe="_nameCell_hlsct_61",dZe="_treeMarker_hlsct_70",hZe="_orphanNote_hlsct_74",fZe="_status_hlsct_78",mZe="_chevronCell_hlsct_84",pZe="_chevron_hlsct_84",gZe="_chevronExpanded_hlsct_101",bZe="_separator_hlsct_111",yZe="_list_hlsct_115",vZe="_task_hlsct_121",wZe="_taskExpanded_hlsct_127",xZe="_success_hlsct_132",kZe="_warning_hlsct_136",_Ze="_error_hlsct_140",SZe="_detail_hlsct_144",CZe="_detailTop_hlsct_153",TZe="_monitorDetail_hlsct_160",EZe="_monitorOverview_hlsct_166",AZe="_monitorHeadingRow_hlsct_174",jZe="_monitorDescription_hlsct_182",NZe="_monitorStatusActions_hlsct_192",IZe="_monitorStatusTag_hlsct_199",MZe="_monitorStopButton_hlsct_231",RZe="_monitorActionError_hlsct_253",DZe="_monitorMetrics_hlsct_259",LZe="_monitorMetric_hlsct_259",PZe="_monitorMetricValue_hlsct_275",OZe="_monitorMetricLabel_hlsct_284",$Ze="_monitorSectionLabel_hlsct_285",BZe="_monitorCommandSection_hlsct_290",zZe="_monitorError_hlsct_291",FZe="_shellFields_hlsct_296",qZe="_shellFieldValue_hlsct_301",HZe="_shellError_hlsct_312",UZe="_monitorCommand_hlsct_290",WZe="_detailTopMain_hlsct_339",VZe="_inlineDetail_hlsct_379",GZe="_taskIcon_hlsct_401",KZe="_detailField_hlsct_430",YZe="_detailFieldLabel_hlsct_437",XZe="_detailContent_hlsct_443",QZe="_compactSummary_hlsct_450",JZe="_actionBar_hlsct_459",ZZe="_actionHint_hlsct_468",eet="_actionButton_hlsct_473",tet="_dangerButton_hlsct_493",net="_shortcuts_hlsct_497",ret="_confirmHint_hlsct_503",set="_statusBadge_hlsct_507",iet="_activityCurrent_hlsct_513",oet="_activityPast_hlsct_520",aet="_promptContent_hlsct_527",mt={panel:eZe,embeddedPanel:tZe,title:nZe,sectionTitle:rZe,overflowHint:sZe,header:iZe,secondary:oZe,row:aZe,selected:lZe,pointer:cZe,nameCell:uZe,treeMarker:dZe,orphanNote:hZe,status:fZe,chevronCell:mZe,chevron:pZe,chevronExpanded:gZe,separator:bZe,list:yZe,task:vZe,taskExpanded:wZe,success:xZe,warning:kZe,error:_Ze,detail:SZe,detailTop:CZe,monitorDetail:TZe,monitorOverview:EZe,monitorHeadingRow:AZe,monitorDescription:jZe,monitorStatusActions:NZe,monitorStatusTag:IZe,monitorStopButton:MZe,monitorActionError:RZe,monitorMetrics:DZe,monitorMetric:LZe,monitorMetricValue:PZe,monitorMetricLabel:OZe,monitorSectionLabel:$Ze,monitorCommandSection:BZe,monitorError:zZe,shellFields:FZe,shellFieldValue:qZe,shellError:HZe,monitorCommand:UZe,detailTopMain:WZe,inlineDetail:VZe,taskIcon:GZe,detailField:KZe,detailFieldLabel:YZe,detailContent:XZe,compactSummary:QZe,actionBar:JZe,actionHint:ZZe,actionButton:eet,dangerButton:tet,shortcuts:net,confirmHint:ret,statusBadge:set,activityCurrent:iet,activityPast:oet,promptContent:aet},t_="web-shell:tasks-panel-active",cet=3e3,IG=8,{parse:uet}=H6("web-shell:tasks-status:v1:");function det(e){const t=uet(e);return!t||!t.snapshot?null:t}function MG(e,t){window.dispatchEvent(new CustomEvent(t_,{detail:{id:e,active:t}}))}function RG(e){return e.status==="running"||e.status==="paused"}function het(e){return[...e].sort((t,n)=>{const r=RG(t),s=RG(n);return r!==s?r?-1:1:r?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function Dj(e){return XJe(het(e))}function DG(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Kde(e){switch(e){case"running":return mt.success;case"paused":return mt.warning;case"completed":return mt.success;case"failed":return mt.error;case"cancelled":return mt.warning;default:return""}}function FP(e,t){switch(e){case"running":return t("tasks.running");case"completed":return t("tasks.completed");case"failed":return t("tasks.failed");case"cancelled":return t("tasks.cancelled");case"paused":return t("tasks.paused");default:return e}}function fet(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function met({expanded:e}){return a.jsx("svg",{className:`${mt.chevron} ${e?mt.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function pet(e,t){switch(e.kind){case"agent":return t?`[blocking] ${e.label}`:e.label;case"shell":return`[shell] ${e.command}`;case"monitor":return`[monitor] ${e.description}`}}function get(e,t){if(e.length<=IG)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,IG-2),r=Math.max(0,Math.min(t-Math.floor(n/2),e.length-n)),s=Math.min(e.length,r+n);return{visible:e.slice(r,s),windowStart:r,hiddenAbove:r,hiddenBelow:e.length-s}}function bet(e,t,n){const r=vd(e,n),s=t?t.replace(/\s*\n\s*/g," ").trim():"",i=s?`${r}(${s})`:r;return C4(i)}function Yde({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:r,onOpenMonitor:s}){const{t:i}=rt(),o=nm(),[l,c]=h.useState(()=>Dj(e.snapshot.tasks)),[u,d]=h.useState(!0),[f,m]=h.useState("list"),[p,g]=h.useState(0),[b,w]=h.useState(null),[y,v]=h.useState(!1),[x,k]=h.useState(!1),[S,T]=h.useState(null),_=h.useRef(`tasks-${Math.random().toString(36).slice(2)}`),C=h.useRef(!1),j=h.useRef(null),E=l.length===0?0:Math.min(p,l.length-1),L=l[E]??null,D=h.useMemo(()=>QJe(l),[l]),M=h.useMemo(()=>JJe(l),[l]);h.useEffect(()=>{if(!u)return;const te=setInterval(()=>{C.current||(C.current=!0,o.getTasks().then(W=>{c(Dj(W.tasks)),k(!1)}).catch(W=>{if(zP(W)){k(!1);return}console.warn("[web-shell] failed to refresh tasks:",W),k(!0)}).finally(()=>{C.current=!1}))},cet);return()=>clearInterval(te)},[u,o]),h.useEffect(()=>{l.length===0&&p!==0&&g(0),p>=l.length&&l.length>0&&g(l.length-1)},[l.length,p]),h.useEffect(()=>{if(!u||f!=="detail"){j.current=null;return}if(!L){j.current=null,m("list");return}const F=j.current;if(!F||F.taskId!==L.id){j.current={taskId:L.id,status:L.status};return}F.status==="running"&&L.status!=="running"&&(w(null),m("list"))},[u,f,L]),h.useEffect(()=>{if(!n)return;const F=_.current;return MG(F,u),()=>MG(F,!1)},[u,n]),h.useEffect(()=>{if(!n)return;const F=te=>{const W=te.detail;W!=null&&W.active&&W.id&&W.id!==_.current&&d(!1)};return window.addEventListener(t_,F),()=>window.removeEventListener(t_,F)},[n]),h.useEffect(()=>{u||r==null||r()},[u,r]);const R=h.useCallback(async F=>{if(y)return;const te=F.status==="running",W=F.kind==="agent"&&F.status==="paused";if(!te&&!W)return;if(F.kind==="agent"&&M.has(F.id)&&b!==F.id){w(F.id);return}w(null),v(!0);try{if(!(await o.cancelTask(F.id,F.kind)).cancelled){T(i("tasks.alreadyStopped"));return}const ie=await o.getTasks();c(Dj(ie.tasks)),T(null)}catch(ce){console.warn("[web-shell] failed to cancel task:",ce),T(i("tasks.cancelFailed"))}finally{v(!1)}},[o,y,M,b,i]);if(Wde(F=>{if(u){if(F.key==="Escape"){if(F.preventDefault(),F.stopPropagation(),b){w(null);return}f==="detail"?m("list"):d(!1);return}if(F.key==="ArrowLeft"){F.preventDefault(),F.stopPropagation(),f==="detail"?(w(null),m("list")):d(!1);return}if((F.key==="ArrowUp"||F.key==="ArrowDown")&&f==="list"){if(F.preventDefault(),F.stopPropagation(),l.length===0)return;const te=F.key==="ArrowUp"?-1:1;g(W=>Math.min(Math.max(W+te,0),l.length-1)),w(null);return}if(F.key==="Enter"){F.preventDefault(),F.stopPropagation(),f==="list"&&L?t&&L.kind==="monitor"&&s?s(L):m("detail"):f==="detail"&&d(!1);return}if(F.key===" "&&f==="detail"){F.preventDefault(),F.stopPropagation(),d(!1);return}if(F.key==="x"&&!F.ctrlKey&&!F.metaKey){F.preventDefault(),F.stopPropagation(),L&&R(L);return}}},[t,u,f,l.length,L,R,s,b]),!u)return null;const $=b!==null&&L!==null&&b===L.id,B=[];$?(B.push(i("tasks.confirmStop")),B.push(i("tasks.shortcut.cancelConfirm"))):(B.push(i("tasks.shortcut.select")),B.push(i("tasks.shortcut.view")),(L==null?void 0:L.status)==="running"?B.push(i("tasks.shortcut.stop")):(L==null?void 0:L.kind)==="agent"&&(L==null?void 0:L.status)==="paused"&&B.push(i("tasks.shortcut.abandon")),B.push(i("tasks.shortcut.listClose")));const N=[];if($?(N.push(i("tasks.confirmStop")),N.push(i("tasks.shortcut.cancelConfirm"))):(N.push(i("tasks.shortcut.detailBack")),N.push(i("tasks.shortcut.detailClose")),(L==null?void 0:L.status)==="running"?N.push(i("tasks.shortcut.stop")):(L==null?void 0:L.kind)==="agent"&&(L==null?void 0:L.status)==="paused"&&N.push(i("tasks.shortcut.abandon"))),l.length===0)return a.jsxs("div",{className:t?`${mt.panel} ${mt.embeddedPanel}`:mt.panel,"data-keyboard-scope":!0,children:[(x||S||!t)&&a.jsxs("div",{className:mt.header,children:[!t&&a.jsx("div",{className:mt.title,children:i("tasks.title")}),x&&a.jsx("div",{className:mt.warning,children:i("tasks.refreshStale")}),S&&a.jsx("div",{className:mt.error,children:S})]}),a.jsx("div",{children:a.jsx("div",{className:mt.secondary,children:i("tasks.empty")})}),!t&&a.jsx("div",{className:mt.shortcuts,children:i("tasks.shortcut.close")})]});const{visible:z,windowStart:G,hiddenAbove:I,hiddenBelow:Y}=get(l,E),U=t?l:z,P=t?0:G;return a.jsxs("div",{className:t?`${mt.panel} ${mt.embeddedPanel}`:mt.panel,"data-keyboard-scope":!0,children:[(t||f==="list")&&(x||S||!t)&&a.jsxs("div",{className:mt.header,children:[!t&&a.jsx("div",{className:mt.title,children:i("tasks.title")}),x&&a.jsx("div",{className:mt.warning,children:i("tasks.refreshStale")}),S&&a.jsx("div",{className:mt.error,children:S})]}),(t||f==="list")&&a.jsxs("div",{className:mt.list,children:[!t&&a.jsxs("div",{className:mt.sectionTitle,children:[i("tasks.title")," ",a.jsxs("span",{className:mt.secondary,children:["(",l.length,")"]})]}),!t&&I>0&&a.jsx("div",{className:mt.overflowHint,children:i("tasks.moreAbove",{count:I})}),U.map((F,te)=>{const W=P+te,K=W===E,ce=Kde(F.status),ie=FP(F.status,i),Z=t&&K&&f==="detail",ee=t?Z:K,oe=F.kind==="agent"?D.get(F.id):void 0,we=Math.min((oe==null?void 0:oe.visibleDepth)??0,YJe),pe=F.kind==="agent"&&F.parentAgentId!=null,he=oe!=null&&oe.orphaned?F.kind==="agent"&&F.parentName?i("tasks.row.from",{parent:F.parentName}):i("tasks.row.nested"):null;return a.jsxs("div",{className:`${mt.task} ${Z?mt.taskExpanded:""}`,children:[a.jsxs("div",{className:ee?`${mt.row} ${mt.selected}`:mt.row,onClick:()=>{g(W),t&&F.kind==="monitor"&&s?s(F):m(t&&Z?"list":"detail")},onMouseEnter:()=>{t||g(W)},children:[a.jsx("span",{className:mt.pointer,children:ee?"❯":""}),t&&a.jsx("span",{className:mt.taskIcon,"aria-hidden":"true"}),a.jsxs("span",{className:mt.nameCell,style:we>0?{paddingLeft:`${we*16}px`}:void 0,children:[pe&&a.jsx("span",{className:mt.treeMarker,"aria-hidden":"true",children:"↳ "}),pet(F,M.has(F.id)),he&&a.jsxs("span",{className:mt.orphanNote,children:[" · ",he]})]}),a.jsx("span",{className:`${mt.status} ${ce}`,children:ie}),a.jsx("span",{className:mt.chevronCell,children:a.jsx(met,{expanded:Z})})]}),Z&&a.jsx("div",{className:mt.inlineDetail,children:a.jsx(LG,{task:F,t:i,hideHeader:!0,busy:y,showCancelConfirm:b===F.id,onCancel:()=>void R(F),onCancelConfirmDismiss:()=>w(null)})})]},F.id)}),!t&&Y>0&&a.jsx("div",{className:mt.overflowHint,children:i("tasks.moreBelow",{count:Y})})]}),!t&&f==="detail"&&L&&a.jsxs(a.Fragment,{children:[S&&a.jsx("div",{className:mt.error,children:S}),a.jsx(LG,{task:L,t:i,busy:y,showCancelConfirm:b===L.id,onCancel:()=>void R(L),onCancelConfirmDismiss:()=>w(null)})]}),!t&&a.jsx("div",{className:$?`${mt.shortcuts} ${mt.confirmHint}`:mt.shortcuts,children:(f==="list"?B:N).join(" · ")})]})}function yet(e,t){switch(e.kind){case"agent":return`${e.subagentType??t("common.agent")} › ${e.label}`;case"shell":return`${t("tasks.kind.shell")} › ${e.command}`;case"monitor":return`${t("tasks.kind.monitor")} › ${e.description}`}}function vet({task:e,actions:t}){const{t:n}=rt(),r=nm(),s=t??r,[i,o]=h.useState(e),[l,c]=h.useState(!1),[u,d]=h.useState(null);h.useEffect(()=>{o(m=>m.id===e.id&&m.status!=="running"&&e.status==="running"?m:e)},[e]),h.useEffect(()=>{d(null)},[e.id,e.status]);const f=h.useCallback(async()=>{if(!(l||i.status!=="running")){d(null),c(!0);try{if(!(await s.cancelTask(i.id,"monitor")).cancelled){d(n("tasks.alreadyStopped"));return}o({...i,status:"cancelled",endTime:Date.now()}),d(null);try{const g=(await s.getTasks()).tasks.find(b=>b.kind==="monitor"&&b.id===i.id);g&&g.status!=="running"&&o(g)}catch(p){console.warn("[web-shell] failed to refresh stopped monitor:",p)}}catch(m){console.warn("[web-shell] failed to cancel monitor:",m),d(n("tasks.cancelFailed"))}finally{c(!1)}}},[s,l,i,n]);return a.jsxs("div",{className:mt.monitorDetail,children:[a.jsxs("div",{className:mt.monitorOverview,children:[a.jsxs("div",{className:mt.monitorHeadingRow,children:[a.jsx("div",{className:mt.monitorDescription,children:i.description}),a.jsxs("div",{className:mt.monitorStatusActions,children:[a.jsx(Ai,{variant:"outline",className:mt.monitorStatusTag,"data-status":i.status,children:FP(i.status,n)}),i.status==="running"&&a.jsx("button",{type:"button",className:mt.monitorStopButton,disabled:l,onClick:()=>void f(),children:n(l?"common.loading":"tasks.action.stop")})]})]}),u&&a.jsx("div",{className:mt.monitorActionError,children:u}),a.jsxs("div",{className:mt.monitorMetrics,children:[a.jsx(df,{label:n("tasks.detail.runtime"),value:Hy(i.runtimeMs)}),a.jsx(df,{label:n("tasks.detail.eventCount"),value:String(i.eventCount)}),i.pid!==void 0&&a.jsx(df,{label:n("tasks.detail.pid"),value:String(i.pid)}),i.eventCount>0&&a.jsx(df,{label:n("tasks.detail.lastEvent"),value:new Date(i.lastEventTime).toLocaleTimeString()}),i.droppedLines>0&&a.jsx(df,{label:n("tasks.detail.droppedCount"),value:String(i.droppedLines)}),i.exitCode!==void 0&&a.jsx(df,{label:n("tasks.detail.exitCode"),value:String(i.exitCode)})]})]}),a.jsxs("div",{className:mt.monitorCommandSection,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.command")}),a.jsx("pre",{className:mt.monitorCommand,children:i.command})]}),i.error&&a.jsxs("div",{className:mt.monitorError,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.error")}),a.jsx("div",{children:i.error})]})]})}function wet({task:e,actions:t}){const{t:n}=rt(),r=nm(),s=t??r,[i,o]=h.useState(e),[l,c]=h.useState(!1),[u,d]=h.useState(null);h.useEffect(()=>{o(m=>m.id===e.id&&m.status!=="running"&&e.status==="running"?m:e)},[e]),h.useEffect(()=>{d(null)},[e.id,e.status]);const f=h.useCallback(async()=>{if(!(l||i.status!=="running")){d(null),c(!0);try{if(!(await s.cancelTask(i.id,"shell")).cancelled){d(n("tasks.alreadyStopped"));return}o({...i,status:"cancelled",endTime:Date.now()});try{const g=(await s.getTasks()).tasks.find(b=>b.kind==="shell"&&b.id===i.id);g&&g.status!=="running"&&o(g)}catch(p){console.warn("[web-shell] failed to refresh stopped shell task:",p)}}catch(m){console.warn("[web-shell] failed to cancel shell task:",m),d(n("tasks.cancelFailed"))}finally{c(!1)}}},[s,l,i,n]);return a.jsxs("div",{className:mt.monitorDetail,children:[a.jsxs("div",{className:mt.monitorOverview,children:[a.jsxs("div",{className:mt.monitorHeadingRow,children:[a.jsx("div",{className:mt.monitorDescription,children:n("tasks.kind.shell")}),a.jsxs("div",{className:mt.monitorStatusActions,children:[a.jsx(Ai,{variant:"outline",className:mt.monitorStatusTag,"data-status":i.status,children:FP(i.status,n)}),i.status==="running"&&a.jsx("button",{type:"button",className:mt.monitorStopButton,disabled:l,onClick:()=>void f(),children:n(l?"common.loading":"tasks.action.stop")})]})]}),a.jsx("pre",{className:mt.monitorCommand,children:i.command}),u&&a.jsx("div",{className:mt.monitorActionError,children:u}),a.jsxs("div",{className:mt.monitorMetrics,children:[a.jsx(df,{label:n("tasks.detail.runtime"),value:Hy(i.runtimeMs)}),i.pid!==void 0&&a.jsx(df,{label:n("tasks.detail.pid"),value:String(i.pid)}),i.exitCode!==void 0&&a.jsx(df,{label:n("tasks.detail.exitCode"),value:String(i.exitCode)})]})]}),a.jsxs("div",{className:mt.shellFields,children:[a.jsxs("div",{className:mt.monitorCommandSection,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.workingDir")}),a.jsx("div",{className:mt.shellFieldValue,children:i.cwd})]}),i.outputFile&&a.jsxs("div",{className:mt.monitorCommandSection,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.outputFile")}),a.jsx("div",{className:mt.shellFieldValue,children:i.outputFile})]})]}),i.error&&a.jsxs("div",{className:`${mt.monitorError} ${mt.shellError}`,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.error")}),a.jsx("div",{children:i.error})]})]})}function df({label:e,value:t}){return a.jsxs("div",{className:mt.monitorMetric,children:[a.jsx("div",{className:mt.monitorMetricValue,children:t}),a.jsx("div",{className:mt.monitorMetricLabel,children:e})]})}function LG({task:e,t,hideHeader:n=!1,busy:r=!1,showCancelConfirm:s=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,k,S;const l=fet(e.status),c=Kde(e.status),u=e.kind==="agent"&&e.status==="paused",d=e.status==="running"||u,f=t(u?"tasks.action.abandon":"tasks.action.stop"),m=t(u?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),p=[Hy(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:Hy(e.runtimeMs)}],b=e.kind==="agent"?((x=e.stats)==null?void 0:x.outputTokens)??((k=e.stats)==null?void 0:k.totalTokens):void 0;b&&(p.push(t("tasks.detail.tokens",{count:DG(b)})),g.push({label:t("tasks.detail.tokenCount"),value:DG(b)})),e.kind==="agent"&&((S=e.stats)==null?void 0:S.toolUses)!==void 0&&(p.push(t("tasks.detail.toolCalls",{count:e.stats.toolUses})),g.push({label:t("tasks.detail.toolCallCount"),value:String(e.stats.toolUses)})),e.kind!=="agent"&&e.pid!==void 0&&p.push(`pid ${e.pid}`),e.kind==="shell"&&e.exitCode!==void 0&&p.push(t("tasks.detail.exit",{exitCode:e.exitCode})),e.kind==="monitor"&&(p.push(t("tasks.detail.events",{count:e.eventCount})),e.droppedLines>0&&p.push(t("tasks.detail.dropped",{count:e.droppedLines})),e.exitCode!==void 0&&p.push(t("tasks.detail.exit",{exitCode:e.exitCode})));const w=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],y=d&&i?a.jsx("div",{className:mt.actionBar,children:s?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:mt.actionHint,children:t("tasks.action.confirmHint")}),a.jsx("button",{type:"button",className:`${mt.actionButton} ${mt.dangerButton}`,disabled:r,onClick:i,children:m}),a.jsx("button",{type:"button",className:mt.actionButton,onClick:o,children:t("common.cancel")})]}):a.jsx("button",{type:"button",className:`${mt.actionButton} ${mt.dangerButton}`,disabled:r,onClick:i,children:f})}):null,v=n?g.length>0?a.jsx("div",{className:mt.compactSummary,children:g.map(T=>`${T.label} ${T.value}`).join(" · ")}):null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:mt.title,children:yet(e,t)}),a.jsxs("div",{className:mt.statusBadge,children:[l&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:c,children:[l," ",t(`tasks.${e.status}`)]}),a.jsx("span",{className:mt.separator,children:"·"})]}),a.jsx("span",{className:mt.secondary,children:p.join(" · ")})]})]});return a.jsxs("div",{className:mt.detail,children:[(v||y)&&a.jsxs("div",{className:mt.detailTop,children:[v&&a.jsx("div",{className:mt.detailTopMain,children:v}),y]}),e.kind==="shell"&&a.jsxs(a.Fragment,{children:[a.jsx(Z1,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&a.jsx(Z1,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&a.jsx(Z1,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&a.jsx(Z1,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&a.jsx(Z1,{label:t("tasks.detail.nesting"),value:e.parentName?t("tasks.detail.nestingValue",{level:(e.depth??0)+1,parent:e.parentName}):t("tasks.detail.nestingLevel",{level:(e.depth??0)+1})}),e.kind==="agent"&&e.recentActivities&&e.recentActivities.length>0&&a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:mt.detailFieldLabel,children:t("tasks.detail.progress")}),a.jsx("div",{className:mt.detailContent,children:e.recentActivities.slice(-5).map((T,_,C)=>{const j=_===C.length-1,E=bet(T.name,T.description,t);return a.jsxs("div",{className:j?mt.activityCurrent:mt.activityPast,children:[j?"> ":"  ",E]},`${T.at}-${_}`)})})]}),e.kind==="agent"&&e.prompt&&a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:mt.detailFieldLabel,children:t("tasks.detail.prompt")}),a.jsx("div",{className:mt.promptContent,children:w.slice(0,5).map((T,_,C)=>a.jsx("div",{children:_===C.length-1&&w.length>5?`${T}…`:T||" "},_))})]}),e.kind==="agent"&&e.outputFile&&a.jsx(Z1,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:`${mt.detailFieldLabel} ${mt.error}`,children:t("tasks.detail.resumeBlocked")}),a.jsx("div",{className:mt.error,children:e.resumeBlockedReason})]}),e.error&&a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:`${mt.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?mt.warning:mt.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),a.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?mt.warning:mt.error,children:e.error})]})]})}function Z1({label:e,value:t}){return a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:mt.detailFieldLabel,children:e}),a.jsx("div",{className:mt.detailContent,children:t})]})}const xet="_message_fm8gc_1",ket="_body_fm8gc_15",_et="_title_fm8gc_20",Cet="_muted_fm8gc_24",Tet="_accent_fm8gc_28",Eet="_success_fm8gc_32",Aet="_error_fm8gc_36",jet="_warning_fm8gc_40",Net="_row_fm8gc_44",Iet="_label_fm8gc_50",Met="_value_fm8gc_55",lc={message:xet,body:ket,title:_et,muted:Cet,accent:Tet,success:Eet,error:Aet,warning:jet,row:Net,label:Iet,value:Met},oR="web-shell-goal-status-active",{serialize:PG,parse:Ret}=H6(wve),Det=new Set(["set","achieved","cleared","failed","aborted","checking"]);function j3(e){const t=typeof e=="string"?Ret(e):e;return Let(t)}function Let(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,r=t.condition;if(typeof n!="string"||!Det.has(n)||typeof r!="string")return null;const s=Lj(t.iterations),i=Lj(t.durationMs),o=Lj(t.setAt),l=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:r,...s!==void 0?{iterations:s}:{},...i!==void 0?{durationMs:i}:{},...o!==void 0?{setAt:o}:{},...l!==void 0?{lastReason:l}:{}}}function Lj(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Pet(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function Oet(e,t){switch(e.kind){case"checking":return{title:`${t("goal.check")}${e.iterations&&e.iterations>0?` · ${t("goal.turnLabel",{count:e.iterations})}`:""} · ${t("goal.notYetMet")}`,colorClass:lc.muted};case"set":return{title:t("goal.set"),colorClass:lc.accent};case"achieved":return{title:t("goal.achieved"),colorClass:lc.success};case"cleared":return{title:t("goal.cleared"),colorClass:lc.muted};case"failed":return{title:t("goal.failed"),colorClass:lc.error};case"aborted":return{title:t("goal.aborted"),colorClass:lc.warning}}}function $et({status:e,activateFooter:t=!1}){var u;const{t:n}=rt(),r=uD();h.useEffect(()=>{if(!t||r==="readonly")return;const d=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(oR,{detail:{active:d,condition:e.condition,setAt:e.setAt}}))},[t,r,e.condition,e.kind,e.setAt]);const s=Oet(e,n),i=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&i.push(Pet(e.iterations,n)),typeof e.durationMs=="number"&&i.push(Hy(e.durationMs)));const o=i.length>0?` · ${i.join(" · ")}`:"",l=(e.kind==="checking"||e.kind==="achieved"||e.kind==="failed"||e.kind==="aborted")&&((u=e.lastReason)==null?void 0:u.trim()),c=e.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return a.jsx("div",{className:lc.message,children:a.jsxs("div",{className:lc.body,children:[a.jsxs("div",{className:`${lc.title} ${s.colorClass}`,children:[s.title,o&&a.jsx("span",{className:lc.muted,children:o})]}),a.jsxs("div",{className:lc.row,children:[a.jsxs("span",{className:lc.label,children:[n("goal.label"),":"]}),a.jsx("span",{className:lc.value,children:e.condition})]}),l&&a.jsxs("div",{className:lc.muted,children:[c,": ",l]})]})})}const Bet="_message_14xa5_1",zet="_flushMessage_14xa5_12",Fet="_noMarker_14xa5_26",qet="_content_14xa5_30",Het="_notificationContent_14xa5_34",Uet="_notificationIcon_14xa5_40",Wet="_notificationText_14xa5_61",Vet="_info_14xa5_80",Get="_recap_14xa5_85",Ket="_modelSwitch_14xa5_98",Yet="_error_14xa5_102",Xet="_warning_14xa5_108",Qet="_retryHint_14xa5_114",Jet="_retryButton_14xa5_121",Zet="_cancelled_14xa5_139",Ea={message:Bet,flushMessage:zet,noMarker:Fet,content:qet,notificationContent:Het,notificationIcon:Uet,notificationText:Wet,info:Vet,recap:Get,modelSwitch:Ket,error:Yet,warning:Xet,retryHint:Qet,retryButton:Jet,cancelled:Zet},ett=h.memo(function({content:t,variant:n,source:r,data:s,onShowContextDetail:i,isLatest:o=!1,showRetryHint:l=!1,onRetryClick:c}){const{t:u}=rt();if(r==="prompt_cancelled")return a.jsx("div",{className:Ea.cancelled,role:"status",children:a.jsx("span",{children:u("turn.stopped")})});const d=n==="info"?JXe(t):null;if(d)return a.jsx("div",{className:Ea.flushMessage,children:a.jsx(iQe,{status:d,onShowDetail:i})});const f=n==="info"?zQe(t):null;if(f)return a.jsx("div",{className:Ea.flushMessage,children:a.jsx(KQe,{view:f.view,status:f.status})});const m=n==="info"?rJe(t):null;if(m)return a.jsx("div",{className:Ea.flushMessage,children:a.jsx(sJe,{info:m})});const p=n==="info"?FJe(t):null;if(p)return a.jsx("div",{className:Ea.flushMessage,children:a.jsx(KJe,{message:p})});const g=n==="info"?det(t):null;if(g)return a.jsx("div",{className:Ea.flushMessage,children:a.jsx(Yde,{message:g})});const b=n==="info"?j3(r==="goal"?s:t):null;if(b)return a.jsx("div",{className:Ea.flushMessage,children:a.jsx($et,{status:b,activateFooter:o})});const w=n==="info"&&r==="model_switch_summary",y=n==="info"&&r==="recap",v=n==="info"&&r==="background_notification",x=v&&typeof s=="object"&&s!==null&&"status"in s&&typeof s.status=="string"?s.status:void 0,k=u(x==="completed"?"system.taskCompleted":x==="failed"?"system.taskFailed":x==="cancelled"?"system.taskCancelled":"system.taskNotification"),S=x==="completed"?"success":x==="failed"?"error":"neutral",T=x==="completed"?u5:x==="failed"?fee:x==="cancelled"?Axe:d5,_=w?a.jsx("pre",{children:t}):n==="info"?a.jsx(Qf,{content:t}):a.jsx("pre",{children:t});return a.jsx("div",{className:`${Ea.message} ${Ea[n]} ${w?Ea.modelSwitch:""} ${y?Ea.recap:""} ${v?Ea.noMarker:""}`,children:a.jsxs("div",{className:Ea.content,children:[v?a.jsxs("div",{className:Ea.notificationContent,children:[a.jsx("span",{className:Ea.notificationIcon,"data-tone":S,role:"img","aria-label":k,title:k,children:a.jsx(T,{"aria-hidden":"true"})}),a.jsx("div",{className:Ea.notificationText,children:_})]}):_,l&&c&&a.jsx("div",{className:Ea.retryHint,children:a.jsx("button",{type:"button",className:Ea.retryButton,onClick:c,children:u("retry.hint")})})]})})}),ttt="_group_117nk_1",ntt="_chatSummaryGroup_117nk_14",rtt="_line_117nk_22",stt="_chatSummary_117nk_14",itt="_chatSummaryTextActive_117nk_49",ott="_chatSummaryIcon_117nk_55",att="_chatSummaryToolIcon_117nk_69",ltt="_chatSummaryText_117nk_49",ctt="_chatSummaryInline_117nk_85",utt="_chatChevronRight_117nk_122",dtt="_chatChevronDown_117nk_123",htt="_chatSummaryContentClip_117nk_184",ftt="_chatSummaryContentCollapsed_117nk_192",mtt="_chatSummaryContentInner_117nk_196",ptt="_lineMain_117nk_201",gtt="_icon_117nk_211",btt="_iconError_117nk_216",ytt="_lineName_117nk_221",vtt="_lineArg_117nk_225",wtt="_lineElapsed_117nk_233",xtt="_lineExpandable_117nk_239",ktt="_lineButton_117nk_246",_tt="_lineChevronRight_117nk_267",Stt="_lineChevronDown_117nk_268",Ctt="_lineOutput_117nk_305",Ttt="_expandedCard_117nk_314",Ett="_expandedCardHeader_117nk_324",Att="_expandedCardTitle_117nk_333",jtt="_expandedCardDetail_117nk_340",Ntt="_expandedCardBody_117nk_350",Itt="_expandedAgentCard_117nk_355",Mtt="_expandedLineOutput_117nk_365",Rtt="_lineDetail_117nk_369",Dtt="_markdownLineDetail_117nk_375",Ltt="_expandedBash_117nk_383",Ptt="_expandedRead_117nk_384",Ott="_expandedOutput_117nk_388",$tt="_expandedEdit_117nk_402",Btt="_todoProgress_117nk_416",ztt="_todoBody_117nk_423",Ftt="_compactGroup_117nk_431",qtt="_compactHeader_117nk_438",Htt="_compactCount_117nk_448",Utt="_compactHint_117nk_454",dn={group:ttt,chatSummaryGroup:ntt,line:rtt,chatSummary:stt,chatSummaryTextActive:itt,chatSummaryIcon:ott,chatSummaryToolIcon:att,chatSummaryText:ltt,chatSummaryInline:ctt,chatChevronRight:utt,chatChevronDown:dtt,chatSummaryContentClip:htt,chatSummaryContentCollapsed:ftt,chatSummaryContentInner:mtt,lineMain:ptt,icon:gtt,iconError:btt,lineName:ytt,lineArg:vtt,lineElapsed:wtt,lineExpandable:xtt,lineButton:ktt,lineChevronRight:_tt,lineChevronDown:Stt,lineOutput:Ctt,expandedCard:Ttt,expandedCardHeader:Ett,expandedCardTitle:Att,expandedCardDetail:jtt,expandedCardBody:Ntt,expandedAgentCard:Itt,expandedLineOutput:Mtt,lineDetail:Rtt,markdownLineDetail:Dtt,expandedBash:Ltt,expandedRead:Ptt,expandedOutput:Ott,expandedEdit:$tt,todoProgress:Btt,todoBody:ztt,compactGroup:Ftt,compactHeader:qtt,compactCount:Htt,compactHint:Utt};function Of({status:e}){const{t}=rt();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return a.jsx("span",{className:`${dn.icon} ${dn.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function V_(e,t){if(!e)return"";const n=Math.round(((t||Date.now())-e)/1e3);if(n<3)return"";if(n<60)return`${n}s`;const r=Math.floor(n/60),s=n%60;return`${r}m ${s}s`}function Xde(e){if(!e)return"";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return`${n}m ${r}s`}function Qde(e){const t=Math.max(1,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}const Wtt="_panel_rcjxd_1",Vtt="_header_rcjxd_11",Gtt="_desc_rcjxd_23",Ktt="_toggle_rcjxd_32",Ytt="_meta_rcjxd_38",Xtt="_body_rcjxd_44",Qtt="_content_rcjxd_55",Jtt="_stream_rcjxd_70",Ztt="_streamCollapsed_rcjxd_80",ent="_scrollWindow_rcjxd_88",tnt="_expandToggle_rcjxd_93",nnt="_sectionCap_rcjxd_110",rnt="_tools_rcjxd_128",snt="_step_rcjxd_142",int="_toolTimeRow_rcjxd_188",ont="_toolTimeTip_rcjxd_192",eo={panel:Wtt,header:Vtt,desc:Gtt,toggle:Ktt,meta:Ytt,body:Xtt,content:Qtt,stream:Jtt,streamCollapsed:Ztt,scrollWindow:ent,expandToggle:tnt,sectionCap:nnt,tools:rnt,step:snt,toolTimeRow:int,toolTimeTip:ont};function Jde(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function ant({timestamp:e,children:t}){return e===void 0?a.jsx(a.Fragment,{children:t}):a.jsxs("div",{className:eo.toolTimeRow,children:[t,a.jsx("span",{className:eo.toolTimeTip,"aria-hidden":"true",children:Sy(e)})]})}const lnt=h.memo(function({tool:t}){const n=t.subTools||t.subContent?a.jsx(qP,{tool:t}):a.jsx(dR,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return a.jsx(ant,{timestamp:t.startTime,children:n})});function cnt({tc:e}){const{t}=rt();return a.jsx("div",{className:dn.line,children:a.jsxs("div",{className:dn.lineMain,children:[a.jsx(Of,{status:e.status}),a.jsx("span",{className:dn.lineName,children:vd(e.name,t)})]})})}function unt(e){var t;if(e.rawOutput&&Jde(e.rawOutput)&&e.rawOutput.result)return e.rawOutput.result;if(e.content){for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text}if(e.rawOutput){if(typeof e.rawOutput=="string")return e.rawOutput;const n=e.rawOutput;if(typeof n.output=="string")return n.output;if(typeof n.result=="string")return n.result;if(typeof n.content=="string")return n.content;if(typeof n.reason=="string")return n.reason;if(typeof n.terminateReason=="string"&&n.terminateReason!=="GOAL")return n.terminateReason;if(typeof n.error=="string")return n.error;if(typeof n.text=="string")return n.text}return""}function dnt({text:e}){const{compactThinking:t}=Vu(),{t:n}=rt(),[r,s]=h.useState(!1),[i,o]=h.useState(!1),l=h.useRef(null),c=t&&!r;return h.useEffect(()=>{const u=l.current;!u||!c||(o(u.scrollHeight>u.clientHeight),u.scrollTop=u.scrollHeight)},[c,e]),h.useEffect(()=>{const u=l.current;if(!u||!c)return;const d=()=>o(u.scrollHeight>u.clientHeight),f=new ResizeObserver(d);return f.observe(u),()=>f.disconnect()},[c]),a.jsxs("div",{children:[a.jsx("pre",{ref:l,className:c?`${eo.stream} ${eo.streamCollapsed}`:eo.stream,children:e}),t&&(i||r)&&a.jsx("button",{className:eo.expandToggle,onClick:()=>s(u=>!u),"aria-expanded":r,"aria-label":n("subagent.toggleStream"),children:r?"▲":"▼"})]})}function hnt({content:e}){const{compactThinking:t}=Vu();return a.jsx("div",{className:t?eo.scrollWindow:void 0,children:a.jsx(Qf,{content:e,source:"assistant"})})}function OG({pinTail:e,itemCount:t,children:n}){const r=h.useRef(null);return h.useEffect(()=>{const s=r.current;s&&(s.scrollTop=e?s.scrollHeight:0)},[e,t]),a.jsx("div",{ref:r,className:`${eo.tools} ${eo.scrollWindow}`,children:n})}function qP({tool:e,defaultExpanded:t,hideHeader:n,inline:r}){var S,T,_,C;const{t:s}=rt(),i=e.status==="completed"||e.status==="failed",o=e_(e),[l,c]=h.useState(t??!1),u=Jde(e.rawOutput)?e.rawOutput:null,d=((S=e.subTools)==null?void 0:S.length)||((T=u==null?void 0:u.toolCalls)==null?void 0:T.length)||0,f=q6(e),m=BP(e),p=V_(e.startTime,e.endTime)||Xde((_=u==null?void 0:u.executionSummary)==null?void 0:_.totalDurationMs),g=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(C=u==null?void 0:u.executionSummary)==null?void 0:C.outputTokens,b=g?$P(g):"",w=i?unt(e):"",y=h.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),v=!!(e.subContent||w),x=!!(e.subTools&&e.subTools.length>0||y&&y.length>0),k=i&&v&&x;return a.jsxs("div",{className:r?void 0:eo.panel,children:[!n&&a.jsxs("div",{className:eo.header,onClick:()=>c(!l),children:[a.jsx(Of,{status:o}),a.jsxs("span",{className:dn.lineName,children:[m,":"]}),f&&a.jsx("span",{className:eo.desc,children:Ko(f,50)}),i&&d>0&&a.jsxs("span",{className:eo.meta,children:["· ",s("subagent.toolsCount",{count:d})]}),p&&a.jsxs("span",{className:eo.meta,children:["· ",p]}),b&&a.jsxs("span",{className:eo.meta,children:["· ",b]}),!i&&a.jsx("span",{className:eo.toggle,children:l?"▼":"▶"})]}),(l||n)&&a.jsxs("div",{className:eo.body,children:[i&&v&&a.jsxs("div",{className:eo.content,children:[k&&a.jsx("div",{className:eo.sectionCap,children:s("subagent.result")}),a.jsx(hnt,{content:e.subContent||w})]}),k&&a.jsx("div",{className:eo.sectionCap,children:s("subagent.tools",{count:d})}),e.subTools&&e.subTools.length>0&&a.jsx(OG,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(j=>a.jsx("div",{className:eo.step,"data-status":j.status,children:a.jsx(lnt,{tool:j})},j.callId))}),y&&y.length>0&&a.jsx(OG,{pinTail:!i,itemCount:y.length,children:y.map(j=>a.jsx("div",{className:eo.step,"data-status":j.status,children:a.jsx(cnt,{tc:j})},j.callId))}),!i&&e.subContent&&a.jsx("div",{className:eo.content,children:a.jsx(dnt,{text:e.subContent})})]})]})}const fnt="_view_1ycry_1",mnt="_stats_1ycry_7",pnt="_statAdd_1ycry_16",gnt="_statDel_1ycry_20",bnt="_lines_1ycry_24",ynt="_line_1ycry_24",vnt="_lineAdd_1ycry_36",wnt="_lineDel_1ycry_40",xnt="_lineHeader_1ycry_44",knt="_lineContext_1ycry_50",_nt="_lineNo_1ycry_54",Snt="_marker_1ycry_64",Cnt="_content_1ycry_79",Wd={view:fnt,stats:mnt,statAdd:pnt,statDel:gnt,lines:bnt,line:ynt,lineAdd:vnt,lineDel:wnt,lineHeader:xnt,lineContext:knt,lineNo:_nt,marker:Snt,content:Cnt};function Tnt(e){let t=0,n=0;const r=[];let s=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const l=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);l&&(s=parseInt(l[1],10),i=parseInt(l[2],10)),r.push({type:"header",content:o})}else o.startsWith("+")&&!o.startsWith("+++ ")?(t++,r.push({type:"add",content:o.slice(1),newLine:i}),i++):o.startsWith("-")&&!o.startsWith("--- ")?(n++,r.push({type:"del",content:o.slice(1),oldLine:s}),s++):(r.push({type:"context",content:o.startsWith(" ")?o.slice(1):o,oldLine:s,newLine:i}),s++,i++);return{lines:r,additions:t,deletions:n}}const Ent=h.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:r,deletions:s}=Tnt(t);return a.jsxs("div",{className:Wd.view,children:[a.jsxs("div",{className:Wd.stats,children:[r>0&&a.jsxs("span",{className:Wd.statAdd,children:["+",r]}),s>0&&a.jsxs("span",{className:Wd.statDel,children:["-",s]})]}),a.jsx("div",{className:Wd.lines,children:n.map((i,o)=>a.jsxs("div",{className:`${Wd.line} ${Wd[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[a.jsx("span",{className:Wd.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),a.jsx("span",{className:Wd.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),a.jsx("span",{className:Wd.content,children:i.content})]},o))})]})}),N3={30:"#4a4a4a",31:"#fc8181",32:"#48bb78",33:"#ecc94b",34:"#4a9eff",35:"#b794f4",36:"#76e4f7",37:"#e0e6f0",90:"#5a6a8a",91:"#feb2b2",92:"#9ae6b4",93:"#fefcbf",94:"#90cdf4",95:"#d6bcfa",96:"#b2f5ea",97:"#ffffff"},Pj=[0,95,135,175,215,255];function aR(e,t,n){let r="#";for(const s of[e,t,n]){if(s===void 0||!Number.isInteger(s)||s<0||s>255)return;r+=s.toString(16).padStart(2,"0")}return r}function Ant(e){if(e===void 0||!Number.isInteger(e)||e<0||e>255)return;if(e<8)return N3[30+e];if(e<16)return N3[90+(e-8)];if(e<232){const n=e-16;return aR(Pj[Math.floor(n/36)],Pj[Math.floor(n/6)%6],Pj[n%6])}const t=8+(e-232)*10;return aR(t,t,t)}function jnt(e){const t=[];let n,r=!1,s=!1,i=0;const o=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let l;for(;(l=o.exec(e))!==null;){l.index>i&&t.push({text:e.slice(i,l.index),color:n,bold:r,dim:s}),i=l.index+l[0].length;const c=l[1].split(";").map(Number);for(let u=0;u<c.length;u++){const d=c[u];if(d===38||d===48||d===58){const f=c[u+1];let m;if(f===5)m=Ant(c[u+2]),u+=2;else if(f===2)m=aR(c[u+2],c[u+3],c[u+4]),u+=4;else break;d===38&&m!==void 0&&(n=m)}else d===0?(n=void 0,r=!1,s=!1):d===1?r=!0:d===2?s=!0:d===22?(r=!1,s=!1):d>=30&&d<=37||d>=90&&d<=97?n=N3[d]:d===39&&(n=void 0)}}return i<e.length&&t.push({text:e.slice(i),color:n,bold:r,dim:s}),t}function Nnt(e){return new RegExp(String.raw`\x1b\[`).test(e)}function dm(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function Oj(e){const t=e.flatMap((n,r)=>{const s=M3(n),i=uC(s,"content");return i?[{id:uC(s,"id")??`plan-${r}`,content:i,status:qnt(uC(s,"status")),priority:Hnt(uC(s,"priority"))}]:[]});return t.length>0?t:void 0}function HP(e){if(!dm(e.toolName)&&e.kind!=="other")return;const t=BG(e.args);if(t)return Oj(t);const n=M3(e.rawOutput),r=BG(n);if(r)return Oj(r);const s=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return s?Oj(s):void 0}function Int(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function I3(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const $G={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function Mnt(e){let t=[],n=null,r=null,s=!1;for(const o of e){if(o.role==="user"||o.role==="user_shell"){s=!0;continue}if(o.role==="plan"){t=o.todos,n=o.id,r=null,s=!1;continue}if(o.role==="tool_group")for(const l of o.tools){const c=HP(l);c&&(t=c,n=o.id,r=l.callId,s=!1)}}if(t.length===0)return $G;const i=!Int(t);return s?$G:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:r}}function UP(e){return JSON.stringify([e.id,e.content])}function U6(e){if(e.role==="plan")return[{key:e.id,todos:e.todos}];if(e.role==="tool_group"){const t=[];for(const n of e.tools){const r=HP(n);r&&t.push({key:n.callId,todos:r,stats:Pnt(n)})}return t}return[]}function Rnt(e){const t=new Map,n=new Map;for(const r of e)for(const{key:s,todos:i}of U6(r)){const o=[];for(const l of i){const c=UP(l),u=n.get(c);l.status==="in_progress"&&u!=="in_progress"?o.push({kind:"started",id:l.id,content:l.content}):l.status==="completed"&&u!=="completed"&&u!==void 0&&o.push({kind:"completed",id:l.id,content:l.content}),n.set(c,l.status)}t.set(s,{events:o})}return t}function Dnt(e){const t=[];for(const n of e)for(const{key:r,todos:s}of U6(n))t.push(JSON.stringify([r,s.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function Lnt(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const r of n.tools)!dm(r.toolName)&&(r.startTime!==void 0||r.endTime!==void 0)&&t.push(JSON.stringify(["span",r.callId,r.startTime,r.endTime]));for(const{key:r,todos:s,stats:i}of U6(n))t.push(JSON.stringify([r,n.timestamp,s.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function Pnt(e){var o;const t=M3((o=M3(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=l=>{const c=t[l];return typeof c=="number"&&Number.isFinite(c)?c:void 0},r=n("promptTokens"),s=n("cachedTokens"),i=n("candidateTokens");if(!(r===void 0||s===void 0||i===void 0))return{promptTokens:r,cachedTokens:s,candidateTokens:i,apiTimeMs:n("apiTimeMs")??0}}function Ont(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools){if(dm(r.toolName))continue;const{startTime:s,endTime:i}=r;typeof s=="number"&&typeof i=="number"&&i>=s&&t.push({start:s,end:i})}return t.sort((n,r)=>n.start-r.start),t}function $nt(e,t,n){let r=0,s=e.length;for(;r<s;){const o=r+s>>>1;e[o].start<t?r=o+1:s=o}let i=0;for(let o=r;o<e.length&&e[o].start<=n;o++)i+=e[o].end-e[o].start;return i}function Bnt(e,t){const n=(r,s)=>Math.max(0,s-r);return{inputTokens:n(e.promptTokens,t.promptTokens),cachedTokens:n(e.cachedTokens,t.cachedTokens),outputTokens:n(e.candidateTokens,t.candidateTokens),apiTimeMs:n(e.apiTimeMs,t.apiTimeMs)}}function znt(e,t){const n={};return e&&(e.inputTokens>0||e.outputTokens>0||e.cachedTokens>0||e.apiTimeMs>0)&&(n.inputTokens=e.inputTokens,n.cachedTokens=e.cachedTokens,n.outputTokens=e.outputTokens,e.apiTimeMs>0&&(n.apiTimeMs=e.apiTimeMs)),t!==void 0&&t>0&&(n.toolTimeMs=t),Object.keys(n).length>0?n:void 0}function Fnt(e){var l;const t=new Map,n=new Map,r=new Map,s=new Set,i=Ont(e),o=c=>{let u=t.get(c);return u||(u={},t.set(c,u)),u};for(const c of e){const u=c.timestamp;for(const{todos:d,stats:f}of U6(c))for(const m of d){const p=UP(m),g=n.get(p);if(m.status==="in_progress"&&g!=="in_progress")s.has(p)&&(s.delete(p),r.delete(p),t.delete(p)),r.get(p)===void 0&&(r.set(p,f),u!==void 0&&(o(p).startTs=u));else if(m.status==="completed"&&g!=="completed"&&g!==void 0){const b=r.get(p),w=b&&f?Bnt(b,f):void 0,y=(l=t.get(p))==null?void 0:l.startTs,v=y!==void 0&&u!==void 0?$nt(i,y,u):void 0,x=znt(w,v);if(u!==void 0||x){const k=o(p);u!==void 0&&(k.endTs=u),x&&(k.resources=x)}}m.status==="completed"&&s.add(p),n.set(p,m.status)}}return t}function BG(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function qnt(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function Hnt(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function M3(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function uC(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const T4=new Set;let Bw=null,Zde=Date.now();function Unt(){Zde=Date.now();for(const e of T4)e()}function Wnt(e){return T4.add(e),Bw||(Bw=setInterval(Unt,1e3)),()=>{T4.delete(e),T4.size===0&&Bw&&(clearInterval(Bw),Bw=null)}}function WP(e){const[t,n]=h.useState(()=>Date.now());return h.useEffect(()=>{if(e)return n(Date.now()),Wnt(()=>n(Zde))},[e]),t}const ehe=h.createContext(void 0);function the({onOpen:e,children:t}){return a.jsx(ehe.Provider,{value:{onOpen:e},children:t})}function VP(){return h.useContext(ehe)}const nhe=h.createContext(void 0);function rhe({onOpen:e,children:t}){return a.jsx(nhe.Provider,{value:{onOpen:e},children:t})}function she(){return h.useContext(nhe)}const Vnt="_list_1bo8s_1",Gnt="_summary_1bo8s_2",Knt="_row_1bo8s_8",Ynt="_num_1bo8s_16",Xnt="_icon_1bo8s_23",Qnt="_text_1bo8s_29",Jnt="_inProgress_1bo8s_43",Znt="_completed_1bo8s_48",ert="_item_1bo8s_62",trt="_rowButton_1bo8s_69",nrt="_detailChevron_1bo8s_82",rrt="_detail_1bo8s_82",srt="_detailSection_1bo8s_100",irt="_detailSectionTitle_1bo8s_106",ort="_detailRows_1bo8s_114",art="_detailLabel_1bo8s_122",lrt="_detailValue_1bo8s_126",crt="_detailDuration_1bo8s_132",urt="_detailHint_1bo8s_136",_s={list:Vnt,summary:Gnt,row:Knt,num:Ynt,icon:Xnt,text:Qnt,inProgress:Jnt,completed:Znt,item:ert,rowButton:trt,detailChevron:nrt,detail:rrt,detailSection:srt,detailSectionTitle:irt,detailRows:ort,detailLabel:art,detailValue:lrt,detailDuration:crt,detailHint:urt};function lR(e){switch(e){case"completed":return _s.completed;case"in_progress":return _s.inProgress;case"pending":return""}}function ihe({todos:e,events:t}){const{t:n}=rt();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return a.jsx("div",{className:_s.summary,children:a.jsxs("div",{className:`${_s.row} ${_s.completed}`,children:[a.jsx("span",{className:_s.icon,"aria-hidden":"true",children:"✓"}),a.jsx("span",{className:_s.text,children:n("todo.allDone")})]})});const s=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return s?a.jsx("div",{className:_s.summary,children:a.jsxs("div",{className:`${_s.row} ${lR(s.status)}`,children:[a.jsx("span",{className:_s.icon,"aria-hidden":"true",children:I3(s.status)}),a.jsx("span",{className:_s.text,children:s.content})]})}):null}return a.jsx("div",{className:_s.summary,children:t.map(r=>a.jsxs("div",{className:`${_s.row} ${r.kind==="completed"?_s.completed:_s.inProgress}`,children:[a.jsx("span",{className:_s.icon,"aria-hidden":"true",children:I3(r.kind==="completed"?"completed":"in_progress")}),a.jsx("span",{className:_s.text,children:r.content})]},`${r.kind}-${r.id}`))})}function Y0({label:e,value:t,suffix:n}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:_s.detailLabel,children:e}),a.jsxs("span",{className:_s.detailValue,children:[t,n]})]})}function $j({title:e,children:t}){return a.jsxs("div",{className:_s.detailSection,children:[a.jsx("div",{className:_s.detailSectionTitle,children:e}),a.jsx("div",{className:_s.detailRows,children:t})]})}function drt({detail:e}){const{t}=rt(),{startTs:n,endTs:r,resources:s}=e,i=n!==void 0||r!==void 0,o=(s==null?void 0:s.inputTokens)!==void 0,l=(s==null?void 0:s.apiTimeMs)!==void 0||(s==null?void 0:s.toolTimeMs)!==void 0;return a.jsxs("div",{className:_s.detail,children:[i&&a.jsxs($j,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&a.jsx(Y0,{label:t("todo.detail.start"),value:Sy(n)}),r!==void 0&&a.jsx(Y0,{label:t("todo.detail.end"),value:Sy(r),suffix:n!==void 0?a.jsxs("span",{className:_s.detailDuration,children:[" ","(",_p(r-n),")"]}):void 0})]}),o&&a.jsxs($j,{title:t("todo.detail.sectionTokens"),children:[a.jsx(Y0,{label:t("todo.detail.input"),value:((s==null?void 0:s.inputTokens)??0).toLocaleString()}),a.jsx(Y0,{label:t("todo.detail.output"),value:((s==null?void 0:s.outputTokens)??0).toLocaleString()}),a.jsx(Y0,{label:t("todo.detail.cached"),value:((s==null?void 0:s.cachedTokens)??0).toLocaleString()})]}),l&&a.jsxs($j,{title:t("todo.detail.sectionSpent"),children:[(s==null?void 0:s.apiTimeMs)!==void 0&&a.jsx(Y0,{label:t("todo.detail.api"),value:_p(s.apiTimeMs)}),(s==null?void 0:s.toolTimeMs)!==void 0&&a.jsx(Y0,{label:t("todo.detail.tool"),value:_p(s.toolTimeMs)})]}),!s&&a.jsx("div",{className:_s.detailHint,children:t("todo.detail.noResources")})]})}function hrt(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function ohe({todos:e,numbered:t=!1}){const{t:n}=rt(),r=h.useContext(Ame),[s,i]=h.useState(()=>new Set),o=`${String(e.length).length+1}ch`,l=c=>i(u=>{const d=new Set(u);return d.has(c)?d.delete(c):d.add(c),d});return a.jsx("div",{className:_s.list,children:e.map((c,u)=>{const d=c.id||String(u),f=r.get(UP(c)),m=hrt(f),p=m&&s.has(d),g=a.jsxs(a.Fragment,{children:[t&&a.jsxs("span",{className:_s.num,style:{minWidth:o},children:[u+1,"."]}),a.jsx("span",{className:_s.icon,"aria-hidden":"true",children:I3(c.status)}),a.jsx("span",{className:_s.text,children:c.content}),m&&a.jsx("span",{className:_s.detailChevron,"aria-hidden":"true",children:p?"▾":"▸"})]});return a.jsxs("div",{className:_s.item,children:[m?a.jsx("button",{type:"button",className:`${_s.row} ${_s.rowButton} ${lR(c.status)}`,onClick:b=>{b.stopPropagation(),l(d)},"aria-expanded":p,title:n(p?"todo.detail.hide":"todo.detail.show"),children:g}):a.jsx("div",{className:`${_s.row} ${lR(c.status)}`,children:g}),p&&f&&a.jsx(drt,{detail:f})]},d)})})}function ahe(e,t,n){if(e.current)return;const r={};e.current=r,t().then(s=>{e.current===r&&!s&&n()},()=>{e.current===r&&n()}).finally(()=>{e.current===r&&(e.current=null)})}function frt(e){const t=e.toolName.toLowerCase();if(Ad(e.toolName))return!!xh(e);if(t==="write_file"||t==="writefile")return!!jrt(e)||zG(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(Uc(t)){const n=xh(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(F6(t))return!!uhe(e);if(t==="edit"||t==="write"||t==="editfile")return zG(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=xh(e);return!!n&&n.split(`
`).length>3}return!1}function mrt(e){const t=e.toolName.toLowerCase();return Uc(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||F6(t)||Ad(e.toolName)}function prt(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!lhe(e)}function zG(e){return prt(e)||!!xh(e)}function grt(e){const t=lhe(e);if(t)return t;if(e.content){const n=e.content.find(r=>r.type==="diff");if(n&&n.type==="diff")return vrt(n.oldText||"",n.newText||"")}return""}function lhe(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(brt(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function brt(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const yrt=25e4;function vrt(e,t){const n=e.split(`
`),r=t.split(`
`),s=n.length,i=r.length;if(s*i>yrt){const d=n.map(m=>m?`-${m}`:"-"),f=r.map(m=>m?`+${m}`:"+");return[...d,...f].join(`
`)}const o=Array.from({length:s+1},()=>Array(i+1).fill(0));for(let d=1;d<=s;d++)for(let f=1;f<=i;f++)o[d][f]=n[d-1]===r[f-1]?o[d-1][f-1]+1:Math.max(o[d-1][f],o[d][f-1]);const l=[];let c=s,u=i;for(;c>0||u>0;)c>0&&u>0&&n[c-1]===r[u-1]?(l.push(` ${n[c-1]}`),c--,u--):u>0&&(c===0||o[c][u-1]>=o[c-1][u])?(l.push(`+${r[u-1]}`),u--):(l.push(`-${n[c-1]}`),c--);return l.reverse().join(`
`)}const wrt=60,xrt=2e5,krt=1e3,_rt={cjs:"javascript",cts:"typescript",h:"c",hpp:"cpp",js:"javascript",jsx:"jsx",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",ts:"typescript",tsx:"tsx",yml:"yaml"};function Srt({tool:e}){const t=h.useMemo(()=>xh(e)||"",[e]),n=h.useMemo(()=>Nnt(t)?jnt(t):null,[t]);return a.jsx("div",{className:dn.expandedBash,children:a.jsx("pre",{className:dn.expandedOutput,children:n?n.map((r,s)=>a.jsx("span",{style:{color:r.color,fontWeight:r.bold?"bold":void 0,opacity:r.dim?.6:void 0},children:r.text},s)):t})})}function Crt({tool:e}){const t=h.useMemo(()=>xh(e)||"",[e]),n=che(Trt(e)),r=n==="text"||t.length>xrt||Ert(t,krt);return a.jsx("div",{className:dn.expandedRead,children:r?a.jsx("pre",{className:dn.expandedOutput,children:t}):a.jsx(Qf,{content:Art(n,t)})})}function Trt(e){var n,r;const t=((n=e.args)==null?void 0:n.file_path)??((r=e.args)==null?void 0:r.path);return typeof t=="string"?t:""}function Ert(e,t){let n=1;for(let r=0;r<e.length;r++)if(e.charCodeAt(r)===10&&++n>t)return!0;return!1}function che(e){var r,s;const t=(s=(r=e.split(/[?#]/,1)[0])==null?void 0:r.split(".").pop())==null?void 0:s.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";const n=_rt[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function Art(e,t){var s;const n=((s=t.match(/~{3,}/g))==null?void 0:s.reduce((i,o)=>Math.max(i,o.length),0))??0,r="~".repeat(Math.max(3,n+1));return`${r}${e}
${t}
${r}`}function FG({tool:e}){const t=h.useMemo(()=>grt(e),[e]),n=h.useMemo(()=>xh(e)||"",[e]);return!t&&!n?null:a.jsx("div",{className:dn.expandedEdit,children:t?a.jsx(Ent,{diff:t}):a.jsx("pre",{className:dn.expandedOutput,children:n})})}function cR({title:e,detail:t,children:n}){return a.jsxs("div",{className:dn.expandedCard,children:[a.jsxs("div",{className:dn.expandedCardHeader,children:[a.jsx("span",{className:dn.expandedCardTitle,children:e}),t&&a.jsx("span",{className:dn.expandedCardDetail,children:t})]}),n&&a.jsx("div",{className:dn.expandedCardBody,children:n})]})}function jrt(e){var n,r;if((n=e.args)!=null&&n.content)return e.args.content;if((r=e.args)!=null&&r.new_string)return e.args.new_string;const t=xh(e);if(t)return t;if(e.rawOutput&&typeof e.rawOutput=="object"){const s=e.rawOutput;if(typeof s.content=="string")return s.content;if(typeof s.newContent=="string")return s.newContent}return""}function Nrt({tool:e,todos:t,expanded:n,title:r}){var o;const i=((o=h.useContext(_O).get(e.callId))==null?void 0:o.events)??[];return n?a.jsx(cR,{title:r,children:a.jsx("div",{className:dn.todoBody,children:a.jsx(ohe,{todos:t})})}):a.jsx("div",{className:dn.todoBody,children:a.jsx(ihe,{todos:t,events:i})})}function Irt(e,t){var p,g;const n=W_(e.rawOutput),r=OP(e),s=e_(e),i=BP(e),o=Mrt(e),l=q6(e),c=((p=e.subTools)==null?void 0:p.length)||((g=n==null?void 0:n.toolCalls)==null?void 0:g.length)||0,u=n==null?void 0:n.executionSummary,d=u&&typeof u.totalDurationMs=="number"?Xde(u.totalDurationMs):V_(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),f=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:u&&typeof u.outputTokens=="number"&&u.outputTokens>0?u.outputTokens:0,m=f>0?$P(f):"";return{agentType:i,explicitAgentType:o,description:l,subToolCount:c,elapsed:d,tokens:m,status:s,reason:r}}function Mrt(e){var s;const t=W_(e.rawOutput),n=t==null?void 0:t.subagentName;if(typeof n=="string"&&n.trim())return n.trim();const r=(s=e.args)==null?void 0:s.subagent_type;return typeof r=="string"&&r.trim()?r.trim():""}function qG(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Ad(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||Uc(t))}function Rrt({tool:e}){const t=xh(e)||"";return a.jsx("pre",{className:dn.expandedOutput,children:t})}function Drt({tool:e}){var n;const t=uhe(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return a.jsx("pre",{className:dn.expandedOutput,children:t})}function uhe(e){var n,r;const t=(n=e.content)==null?void 0:n[0];return(t==null?void 0:t.type)!=="content"?"":typeof((r=t.content)==null?void 0:r.text)=="string"?t.content.text:""}function W6(e){const t=e.toolName.toLowerCase();return uv(e)?"agent":Ad(e.toolName)?"ask":Uc(t)?"shell":KP(t)?"fetch":dm(t)?"todo":t==="read"||t==="read_file"||t==="readfile"?"read":t==="edit"||t==="editfile"?"edit":t==="write"||t==="write_file"||t==="writefile"?"write":"other"}function Lrt({description:e,elapsed:t}){return a.jsxs(a.Fragment,{children:[e&&a.jsx("span",{className:dn.lineArg,children:e}),t&&a.jsx("span",{className:dn.lineElapsed,children:t})]})}function Zx({info:e}){const{renderToolHeaderExtra:t}=Vu(),n=t==null?void 0:t(e);return n?a.jsx(a.Fragment,{children:n}):a.jsx(Lrt,{description:e.description,elapsed:e.elapsed})}function Prt(e){return e.length>wrt||e.includes(`
`)}function g1(e){return e==="in_progress"||e==="pending"||e==="running"}function GP(e){return e.find(t=>g1(t.status))??e[e.length-1]}function Ort(e,t,n){if(fhe(e)){const s=e.find(o=>g1(o.status)&&!bd(o)),i=s??GP(e);return Ad(i.toolName)?t("toolGroup.summary.provideInformation"):!s&&bd(i)?t("subagent.background"):t("toolGroup.running",{name:vd(i.toolName,t),count:e.length,duration:n??""})}const r=zrt(e,t);return r||t("toolGroup.summary",{count:e.length})}function $rt(e,t,n){if(dm(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Ad(e.toolName))return g1(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:hhe(e)});const{displayName:r,description:s,hideDisplayName:i}=dhe(e,t,n);return[i?"":r,s].filter(Boolean).join(" ")}function dhe(e,t,n){const r=vd(e.toolName,t),s=Ko(Fde(e,n),120);return{kind:W6(e),tool:e,displayName:r,description:s,elapsed:"",workspaceCwd:n,hideDisplayName:!!lQe(e)}}function Brt({tool:e,runningDuration:t,workspaceCwd:n}){const{t:r}=rt(),s=Ad(e.toolName),i=g1(e.status),o=!s&&i?bd(e)?r("subagent.background"):r("toolGroup.runningPrefix").trim():"";if(dm(e.toolName)||s)return a.jsxs(a.Fragment,{children:[o&&a.jsxs("span",{children:[o," "]}),$rt(e,r,n),t&&a.jsxs("span",{children:[" ",t]})]});const l=dhe(e,r,n);return a.jsxs(a.Fragment,{children:[o&&a.jsxs("span",{children:[o," "]}),a.jsxs("span",{className:dn.chatSummaryInline,children:[!l.hideDisplayName&&a.jsx("span",{className:dn.lineName,children:l.displayName}),a.jsx(Zx,{info:l})]}),t&&a.jsxs("span",{children:[" ",t]})]})}function zrt(e,t){let n=0,r=0,s=0,i=0,o=0,l=0,c=0;for(const d of e){const f=d.toolName.toLowerCase();Uc(f)?r++:f==="edit"||f==="editfile"||f==="write"||f==="write_file"||f==="writefile"?n++:f==="read"||f==="read_file"||f==="readfile"?s++:f==="grep"||f==="grep_search"||f==="search"||f==="glob"||f==="web_search"||f==="websearch"?i++:dm(f)?o++:Ad(f)?l+=hhe(d):c++}return[n?t("toolGroup.summary.editedFiles",{count:n}):"",r?t("toolGroup.summary.ranCommands",{count:r}):"",s?t("toolGroup.summary.readFiles",{count:s}):"",i?t("toolGroup.summary.searched",{count:i}):"",o?t("toolGroup.summary.updatedTodos",{count:o}):"",l?t("toolGroup.summary.askedQuestions",{count:l}):"",c?t("toolGroup.summary.otherTools",{count:c}):""].filter(Boolean).join(" ")}function hhe(e){var n;const t=(n=e.args)==null?void 0:n.questions;return Array.isArray(t)&&t.length>0?t.length:1}function fhe(e){return e.some(t=>g1(t.status))}function Frt(){return a.jsxs("svg",{className:dn.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M12 20h9"}),a.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function mhe(){return a.jsxs("svg",{className:dn.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[a.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),a.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function qrt(){return a.jsxs("svg",{className:dn.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),a.jsx("path",{d:"M1.8 7h10.4M7 1.5c1.3 1.5 2 3.3 2 5.5s-.7 4-2 5.5M7 1.5C5.7 3 5 4.8 5 7s.7 4 2 5.5",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function Hrt(){return a.jsxs("svg",{className:dn.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[a.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),a.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function Urt(){return a.jsx("svg",{className:dn.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 4.2 4.2 5.4 6.1 3.3M7.5 4.5h3.6M3 9.1l1.2 1.2 1.9-2.1M7.5 9.4h3.6",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wrt(){return a.jsx("svg",{className:dn.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3.4 3.2h7.2c.7 0 1.25.55 1.25 1.25v3.4c0 .7-.55 1.25-1.25 1.25H7.5L4.5 11V9.1H3.4c-.7 0-1.25-.55-1.25-1.25v-3.4c0-.7.55-1.25 1.25-1.25Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function uR(){return a.jsx("svg",{className:dn.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function Vrt({tool:e}){const t=W6(e);return t==="agent"?a.jsx(uR,{}):t==="ask"?a.jsx(Wrt,{}):t==="edit"||t==="write"?a.jsx(Frt,{}):t==="fetch"?a.jsx(qrt,{}):t==="read"?a.jsx(Hrt,{}):t==="todo"?a.jsx(Urt,{}):a.jsx(mhe,{})}function KP(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const Grt=e_;function Krt({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:r}=rt(),s=GP(e),i=vd(s.toolName,r),o=Grt(s),l=PP(s,t),c=g1(s.status)&&bd(s)||Uc(s.toolName)||KP(s.toolName)?"":V_(s.startTime,s.endTime);return a.jsxs("div",{className:`${dn.compactGroup}${n?` ${e0.flash}`:""}`,children:[a.jsxs("div",{className:dn.compactHeader,children:[a.jsx(Of,{status:o}),a.jsx("span",{className:dn.lineName,children:i}),e.length>1&&a.jsxs("span",{className:dn.compactCount,children:["× ",e.length]}),a.jsx(Zx,{info:{kind:W6(s),tool:s,displayName:i,description:l,elapsed:c,workspaceCwd:t}})]}),a.jsx("div",{className:dn.compactHint,children:r("compact.hint")})]})}function Yrt(e,t){var s,i;if(((s=e.approval)==null?void 0:s.id)!==((i=t.approval)==null?void 0:i.id)||e.workspaceCwd!==t.workspaceCwd||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.forceExpandable!==t.forceExpandable||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;const n=e.tool,r=t.tool;return n.callId===r.callId&&n.toolName===r.toolName&&n.status===r.status&&n.startTime===r.startTime&&n.endTime===r.endTime&&n.subContent===r.subContent&&n.rawOutput===r.rawOutput&&n.args===r.args&&n.content===r.content&&n.title===r.title&&Xrt(n.subTools,r.subTools)}function Xrt(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],s=t[n];if(r.callId!==s.callId||r.toolName!==s.toolName||r.status!==s.status||r.endTime!==s.endTime||r.rawOutput!==s.rawOutput||r.args!==s.args||r.subContent!==s.subContent||r.title!==s.title)return!1}return!0}const HG=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function Bj(e,t){if(!e||!e.includes("qwen-session://"))return e;const n=[];let r=0,s;for(HG.lastIndex=0;(s=HG.exec(e))!==null;){s.index>r&&n.push(e.slice(r,s.index));const i=s[2];n.push(t==="readonly"?a.jsx("span",{style:{textDecoration:"underline"},children:s[1]},s.index):a.jsx("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:o=>{o.preventDefault(),o.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:i}))},children:s[1]},s.index)),r=s.index+s[0].length}return r<e.length&&n.push(e.slice(r)),n.length===1?n[0]:a.jsx(a.Fragment,{children:n})}const dR=h.memo(function({tool:t,approval:n,workspaceCwd:r,summaryOnly:s=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:l=!1,hideCollapsedOutput:c=!1}){const{t:u}=rt(),d=uD(),f=h.useContext(e1),m=VP(),p=she(),g=p!==void 0,[b,w]=h.useState(!1),[y,v]=h.useState(()=>i||!f&&qG(t)),x=h.useRef(null),k=h.useRef(!1);h.useEffect(()=>{v(i||(f?!1:qG(t))),w(!1),x.current=null,k.current=!1},[f,i,g,t.callId,t.toolName]);const S=uv(t),T=n&&n.toolCallId===t.callId,_=!T&&(n==null?void 0:n.toolCallId)&&S&&wd(t,n.toolCallId),C=S&&t.status==="in_progress",j=WP(C);if(h.useEffect(()=>{!i&&!S&&t.status==="completed"&&!k.current&&v(!1)},[i,S,t.status]),S){const X=Irt(t,j),ye=X.explicitAgentType?`${u("agent.label")} (${X.explicitAgentType})`:u("agent.label"),Ce=t.status==="completed"||t.status==="failed",ae=bd(t),We=[ae&&!Ce?u("subagent.background"):t.status==="pending"?u("subagent.pending"):u("subagent.running"),ae&&!Ce?"":X.elapsed].filter(Boolean).join(" · "),Oe=[X.subToolCount>0?u("subagent.toolsCount",{count:X.subToolCount}):"",X.elapsed,X.tokens,X.reason?Ko(X.reason,80):""].filter(Boolean).join(" · "),Mt=i||y||!!T||!!_,$t=a.jsx(qP,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return m&&!l?a.jsx("div",{className:dn.line,children:a.jsxs("button",{type:"button",className:`${dn.lineMain} ${dn.lineExpandable} ${dn.lineButton}`,onClick:()=>m.onOpen(t),children:[a.jsx(uR,{}),a.jsx(Of,{status:Ce?X.status:t.status}),a.jsx("span",{className:dn.lineName,children:ye}),a.jsx(Zx,{info:{kind:"agent",tool:t,displayName:ye,description:X.description?Ko(X.description,60):"",elapsed:Ce?Oe:We,workspaceCwd:r}}),a.jsx("span",{className:dn.lineChevronRight,"aria-hidden":"true"})]})}):a.jsxs("div",{className:dn.line,children:[!l&&a.jsxs("div",{className:`${dn.lineMain} ${dn.lineExpandable}`,onClick:()=>v(!y),children:[a.jsx(uR,{}),a.jsx(Of,{status:Ce?X.status:t.status}),a.jsx("span",{className:dn.lineName,children:ye}),a.jsx(Zx,{info:{kind:"agent",tool:t,displayName:ye,description:X.description?Ko(X.description,60):"",elapsed:Ce?Oe:We,workspaceCwd:r}}),a.jsx("span",{className:y?dn.lineChevronDown:dn.lineChevronRight,"aria-hidden":"true"})]}),Mt&&a.jsx("div",{className:dn.lineDetail,children:l?a.jsx("div",{className:dn.expandedAgentCard,children:$t}):$t})]})}const E=PP(t,r),L=cQe(t),M=s&&Uc(t.toolName)?Fde(t,r):E,R=vd(t.toolName,u),$=Uc(t.toolName)||KP(t.toolName)?"":V_(t.startTime,t.endTime),B=t.toolName.toLowerCase(),N=B==="monitor"&&g&&!b&&!l,z=dm(B),G=z?HP(t):void 0,I=!!G&&G.length>0,Y=G?G.filter(X=>X.status==="completed").length:0,U=Uc(B),P=B==="grep"||B==="grep_search"||B==="search"||B==="glob",F=B==="read"||B==="read_file"||B==="readfile",te=!z&&Prt(M),W=!i&&(o||(z?I:frt(t)||te)),K=N||W,ce=()=>{w(!0),W&&(k.current=!0,v(X=>!X))},ie=()=>{p&&ahe(x,()=>p.onOpen(t),ce)},Z=mrt(t),ee=y&&te,oe=F,we=ee&&!U&&!P&&!F,pe=E,he=!z&&y&&!Z&&(ee||L);return a.jsxs("div",{className:dn.line,children:[!l&&a.jsxs("div",{className:`${dn.lineMain} ${K?dn.lineExpandable:""}`,title:N?void 0:W?u(y?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":N?void 0:W?y:void 0,role:K?"button":void 0,tabIndex:K?0:void 0,onClick:K?()=>{if(N){ie();return}k.current=!0,v(X=>!X)}:void 0,onKeyDown:K?X=>{if(!(X.key!=="Enter"&&X.key!==" ")){if(X.preventDefault(),N){ie();return}k.current=!0,v(ye=>!ye)}}:void 0,children:[a.jsx(Of,{status:t.status}),a.jsx("span",{className:dn.lineName,children:R}),z&&I&&a.jsxs("span",{className:dn.todoProgress,children:[Y,"/",G.length]}),a.jsx(Zx,{info:{kind:W6(t),tool:t,displayName:R,description:z||we?"":M,elapsed:z?"":$,workspaceCwd:r}}),K&&a.jsx("span",{className:!N&&y?dn.lineChevronDown:dn.lineChevronRight,"aria-hidden":"true"})]}),(!s||y)&&z&&I&&a.jsx(Nrt,{tool:t,todos:G,expanded:y,title:R}),(!s||y)&&z&&!I&&L&&a.jsx("div",{className:dn.lineOutput,children:Bj(L,d)}),he&&a.jsx(cR,{title:R,detail:pe,children:L&&a.jsx("div",{className:`${dn.lineOutput} ${dn.expandedLineOutput}`,children:Bj(L,d)})}),!z&&!c&&L&&!he&&(!y||!Z)&&(!s||y)&&a.jsx("div",{className:y?`${dn.lineOutput} ${dn.expandedLineOutput}`:dn.lineOutput,children:Bj(L,d)}),!z&&y&&Z&&a.jsx("div",{className:oe?`${dn.lineDetail} ${dn.markdownLineDetail}`:dn.lineDetail,children:F?a.jsx(Crt,{tool:t}):a.jsxs(cR,{title:R,detail:pe,children:[Uc(B)&&a.jsx(Srt,{tool:t}),(B==="write_file"||B==="writefile")&&a.jsx(FG,{tool:t}),(B==="edit"||B==="write"||B==="editfile")&&a.jsx(FG,{tool:t}),Ad(t.toolName)&&a.jsx(Rrt,{tool:t}),F6(B)&&a.jsx(Drt,{tool:t})]})})]})},Yrt),Qrt=h.memo(function({tools:t,pendingApproval:n,workspaceCwd:r,isLocateFlashing:s=!1}){const{t:i}=rt(),o=h.useContext(e1),l=VP(),c=she(),u=c!==void 0,[d,f]=h.useState(!1),[m,p]=h.useState(!1),g=h.useRef(null),b=fhe(t),w=t.some(N=>N.status==="failed"),y=t.length>0?GP(t):void 0,v=t.length===1?t[0]:void 0,x=v&&uv(v)?v:void 0,k=v&&v.toolName.toLowerCase()==="monitor"?v:void 0,S=t.some(N=>g1(N.status)&&!bd(N)),T=b&&S,_=!!(x&&l),C=!!(k&&u&&!d),j=_||C,E=t[0]??y,L=h.useRef(Date.now()),D=WP(T),M=(n==null?void 0:n.toolCallId)&&t.some(N=>wd(N,n.toolCallId)),R=o&&!M,$=T?Qde(D-L.current):void 0;h.useEffect(()=>{T&&(L.current=Date.now())},[T,y==null?void 0:y.callId]),h.useEffect(()=>{f(!1),p(!1),g.current=null},[u,k==null?void 0:k.callId]);const B=()=>{!k||!c||ahe(g,()=>c.onOpen(k),()=>{f(!0),p(N=>!N)})};return R?a.jsx(Krt,{tools:t,workspaceCwd:r,isLocateFlashing:s}):M?a.jsx("div",{className:`${dn.group}${s?` ${e0.flash}`:""}`,children:t.map(N=>a.jsx(dR,{tool:N,approval:n,workspaceCwd:r},N.callId))}):a.jsxs("div",{className:s?e0.flash:void 0,children:[a.jsxs("button",{type:"button",className:dn.chatSummary,onClick:()=>{if(x&&l){l.onOpen(x);return}if(C&&k&&c){B();return}p(N=>!N)},"aria-expanded":j?void 0:m,title:j?void 0:i(m?"tool.collapseHint":"tool.expand"),children:[a.jsx("span",{className:dn.chatSummaryIcon,"aria-hidden":"true",children:E?a.jsx(Vrt,{tool:E}):a.jsx(mhe,{})}),w&&a.jsx(Of,{status:"failed"}),a.jsx("span",{className:T?`${dn.chatSummaryText} ${dn.chatSummaryTextActive}`:dn.chatSummaryText,children:v?a.jsx(Brt,{tool:v,runningDuration:$,workspaceCwd:r}):Ort(t,i,$)}),a.jsx("span",{className:m?dn.chatChevronDown:dn.chatChevronRight,"aria-hidden":"true"})]}),a.jsx("div",{className:m?dn.chatSummaryContentClip:`${dn.chatSummaryContentClip} ${dn.chatSummaryContentCollapsed}`,children:a.jsx("div",{className:dn.chatSummaryContentInner,children:a.jsx("div",{className:`${dn.group} ${dn.chatSummaryGroup}`,children:t.map(N=>a.jsx(dR,{tool:N,approval:n,workspaceCwd:r,summaryOnly:!v,forceExpanded:!!v,hideHeader:!!v},N.callId))})})})]})}),Jrt="_message_kwepu_1",Zrt="_header_kwepu_6",est="_chevron_kwepu_20",tst="_title_kwepu_26",nst="_progress_kwepu_35",zw={message:Jrt,header:Zrt,chevron:est,title:tst,progress:nst};function rst({id:e,todos:t}){var s;const r=((s=h.useContext(_O).get(e))==null?void 0:s.events)??[];return a.jsx(ihe,{todos:t,events:r})}const sst=h.memo(function({id:t,todos:n,isLocateFlashing:r=!1}){const{t:s}=rt(),[i,o]=h.useState(!1);if(n.length===0)return null;const l=n.length,c=n.filter(u=>u.status==="completed").length;return a.jsxs("div",{className:`${zw.message}${r?` ${e0.flash}`:""}`,children:[a.jsxs("button",{type:"button",className:zw.header,onClick:()=>o(u=>!u),"aria-expanded":i,title:s(i?"todo.collapse":"todo.expand"),children:[a.jsx("span",{className:zw.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),a.jsx("span",{className:zw.title,children:s("plan.title")}),a.jsxs("span",{className:zw.progress,children:[c,"/",l]})]}),i?a.jsx(ohe,{todos:n,numbered:!0}):a.jsx(rst,{id:t,todos:n})]})}),ist="_message_1abcu_1",ost="_content_1abcu_11",ast="_question_1abcu_17",lst="_prefix_1abcu_24",cst="_answer_1abcu_28",ust="_pending_1abcu_32",dst="_shortcuts_1abcu_36",X0={message:ist,content:ost,question:ast,prefix:lst,answer:cst,pending:ust,shortcuts:dst},phe=h.memo(function({question:t,answer:n,isPending:r}){const{t:s}=rt();return a.jsxs("div",{className:X0.message,children:[a.jsxs("div",{className:X0.content,children:[a.jsxs("div",{className:X0.question,children:[a.jsx("span",{className:X0.prefix,children:"/btw "}),a.jsx("span",{children:t})]}),a.jsx("div",{className:X0.answer,children:r?a.jsx("span",{className:X0.pending,children:s("btw.answering")}):a.jsx(Qf,{content:n})})]}),a.jsx("div",{className:X0.shortcuts,children:s(r?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),hst="_message_1q4dw_1",fst="_compact_1q4dw_16",mst="_header_1q4dw_21",pst="_status_1q4dw_30",gst="_name_1q4dw_35",bst="_command_1q4dw_42",yst="_output_1q4dw_51",vst="_compactHint_1q4dw_62",of={message:hst,compact:fst,header:mst,status:pst,name:gst,command:bst,output:yst,compactHint:vst},wst=h.memo(function({command:t,output:n}){const r=h.useContext(e1),{t:s}=rt();return a.jsxs("div",{className:r?`${of.message} ${of.compact}`:of.message,children:[a.jsxs("div",{className:of.header,children:[a.jsx("span",{className:of.status,children:"✓"}),a.jsx("span",{className:of.name,children:s("shell.command")}),t&&a.jsx("span",{className:of.command,children:t})]}),r?a.jsx("div",{className:of.compactHint,children:s("compact.hint")}):n&&a.jsx("pre",{className:of.output,children:n})]})}),xst="_progress_1j3ys_1",kst="_spinner_1j3ys_12",_st="_bar_1j3ys_19",Sst="_stage_1j3ys_25",Cst="_icon_1j3ys_29",Tst="_done_1j3ys_35",Est="_error_1j3ys_43",Ast="_detail_1j3ys_51",jst="_path_1j3ys_56",Ma={progress:xst,spinner:kst,bar:_st,stage:Sst,icon:Cst,done:Tst,error:Est,detail:Ast,path:jst},UG=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function Nst({progress:e}){const{stage:t,progress:n,detail:r,isComplete:s,error:i}=e,[o,l]=h.useState(0),c=30,u=Math.round(n/100*c),d=c-u,f="█".repeat(Math.max(0,u))+"░".repeat(Math.max(0,d));return h.useEffect(()=>{if(s||i)return;const m=setInterval(()=>{l(p=>(p+1)%UG.length)},120);return()=>clearInterval(m)},[s,i]),i?a.jsxs("div",{className:`${Ma.progress} ${Ma.error}`,children:[a.jsx("span",{className:Ma.icon,children:"✕"}),a.jsx("span",{className:Ma.stage,children:t}),a.jsx("div",{className:Ma.detail,children:i})]}):s?a.jsxs("div",{className:`${Ma.progress} ${Ma.done}`,children:[a.jsx("span",{className:Ma.icon,children:"✓"}),a.jsx("span",{className:Ma.stage,children:t})]}):a.jsxs("div",{className:Ma.progress,children:[a.jsx("span",{className:Ma.spinner,children:UG[o]}),a.jsx("span",{className:Ma.bar,children:f}),a.jsxs("span",{className:Ma.stage,children:[t,r?` (${r})`:""]})]})}function Ist({path:e}){const{t}=rt();return a.jsxs("div",{className:`${Ma.progress} ${Ma.done}`,children:[a.jsx("span",{className:Ma.icon,children:"✓"}),a.jsx("span",{className:Ma.stage,children:t("insight.ready")}),a.jsx("span",{className:Ma.path,children:e})]})}const Mst=h.memo(function({message:t,pendingApproval:n,onShowContextDetail:r,workspaceCwd:s,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:l,sendFailed:c=!1,onRetrySend:u,onBranchSession:d,showAssistantActions:f=!1,showAssistantBranch:m=!1,isLocateFlashing:p=!1,assistantTurnFooterInfo:g,generateContent:b}){const{t:w}=rt(),y=(()=>{switch(t.role){case"user":return a.jsx(zYe,{content:t.content,images:t.images,inputAnnotations:t.inputAnnotations,isLocateFlashing:p,sendFailed:c,onRetrySend:u});case"assistant":return a.jsx(vXe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:d,showFooterActions:f,showBranchAction:m,isLocateFlashing:p,customFooterInfo:g});case"thinking":return a.jsx(SXe,{messageId:t.id,content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:p,generateContent:b});case"tool_group":return a.jsx(Qrt,{tools:t.tools,pendingApproval:n,workspaceCwd:s,isLocateFlashing:p});case"plan":return a.jsx(sst,{id:t.id,todos:t.todos,isLocateFlashing:p});case"system":return a.jsx(ett,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:r,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:l});case"user_shell":return a.jsx(wst,{command:t.command,output:t.output});case"btw":return a.jsx(phe,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return a.jsx(Nst,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return a.jsx(Ist,{path:t.path});case"insight_error":return a.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(y===null)return null;const v=a.jsx(Uf,{label:`message:${t.role}`,resetKeys:[t],fallback:a.jsx(Rst,{align:t.role==="user"?"end":"start"}),children:y}),x=a.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:v});return t.role==="assistant"?f?x:a.jsx(WN,{timestamp:t.timestamp,children:x}):t.role==="system"&&t.source==="prompt_cancelled"?x:a.jsx(WN,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:w("common.copy"),children:x})},Dst);function Rst({align:e}){const{t}=rt();return a.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:a.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function Dst(e,t){var n,r;return((n=e.pendingApproval)==null?void 0:n.id)!==((r=t.pendingApproval)==null?void 0:r.id)||e.onShowContextDetail!==t.onShowContextDetail||e.workspaceCwd!==t.workspaceCwd||e.isLatest!==t.isLatest||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.sendFailed!==t.sendFailed||e.onRetrySend!==t.onRetrySend||e.onBranchSession!==t.onBranchSession||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.isLocateFlashing!==t.isLocateFlashing||e.generateContent!==t.generateContent||!Lst(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:Pst(e.message,t.message)}function Lst(e,t){return e===t?!0:!e||!t?!1:e.turnId===t.turnId&&e.message.id===t.message.id&&e.message.content===t.message.content&&e.message.isStreaming===t.message.isStreaming&&e.message.timestamp===t.message.timestamp}function Pst(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&Bst(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"thinking":return t.role==="thinking"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"system":return t.role==="system"&&e.content===t.content&&e.variant===t.variant&&e.retryable===t.retryable&&e.source===t.source&&e.data===t.data;case"user_shell":return t.role==="user_shell"&&e.command===t.command&&e.output===t.output&&e.cwd===t.cwd;case"btw":return t.role==="btw"&&e.question===t.question&&e.answer===t.answer&&e.isPending===t.isPending;case"insight_progress":return t.role==="insight_progress"&&e.stage===t.stage&&e.progress===t.progress&&e.detail===t.detail;case"insight_ready":return t.role==="insight_ready"&&e.path===t.path;case"insight_error":return t.role==="insight_error"&&e.error===t.error;case"plan":return t.role==="plan"&&Ost(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,r)=>ghe(n,t.tools[r]));default:return!1}}function Ost(e,t){return e.length===t.length&&e.every((n,r)=>{const s=t[r];return s&&n.id===s.id&&n.content===s.content&&n.status===s.status&&n.priority===s.priority})}function ghe(e,t){return t?e.callId===t.callId&&e.toolName===t.toolName&&e.status===t.status&&e.title===t.title&&e.kind===t.kind&&e.startTime===t.startTime&&e.endTime===t.endTime&&e.subContent===t.subContent&&Nm(e.args)===Nm(t.args)&&Nm(e.rawOutput)===Nm(t.rawOutput)&&Nm(e.locations)===Nm(t.locations)&&Nm(e.content)===Nm(t.content)&&$st(e.subTools,t.subTools):!1}function $st(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>ghe(n,t[r]))}const WG=new WeakMap;function Bst(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>n.data===t[r].data&&n.mimeType===t[r].mimeType)}function Nm(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=WG.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return WG.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function zst(e){const t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return null;const n=Number(t[1]),r=Number(t[2]);return n<0||n>23||r<0||r>59?null:{hh:n,mm:r}}function R3(e){if(e.frequency==="custom"){const n=e.customCron.trim();return n.length>0?n:null}if(e.frequency==="minutes"){const n=Math.floor(e.minuteInterval);return!Number.isFinite(n)||n<1||n>30||60%n!==0?null:`*/${n} * * * *`}const t=zst(e.time);if(!t)return null;switch(e.frequency){case"daily":return`${t.mm} ${t.hh} * * *`;case"weekdays":return`${t.mm} ${t.hh} * * 1-5`;case"weekly":return`${t.mm} ${t.hh} * * ${e.weekday}`;case"hourly":return`${t.mm} * * * *`;default:return null}}function n_(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[r,s,i,o,l]=n,c=d=>/^\d+$/.test(d),u=d=>d.padStart(2,"0");if(/^\*\/\d+$/.test(r)&&s==="*"&&i==="*"&&o==="*"&&l==="*"){const d=Number(r.slice(2));return Number.isInteger(d)&&d>=1&&d<=30&&60%d===0?t("scheduledTasks.human.everyMinutes",{n:d}):e}if(c(r)&&s==="*"&&i==="*"&&o==="*"&&l==="*")return t("scheduledTasks.human.hourly",{min:u(r)});if(c(r)&&c(s)&&i==="*"&&o==="*"&&l==="*")return t("scheduledTasks.human.daily",{time:`${u(s)}:${u(r)}`});if(c(r)&&c(s)&&i==="*"&&o==="*"&&l==="1-5")return t("scheduledTasks.human.weekdays",{time:`${u(s)}:${u(r)}`});if(c(r)&&c(s)&&i==="*"&&o==="*"&&c(l)&&Number(l)>=0&&Number(l)<=7){const d=t("scheduledTasks.weekdayNames").split(","),f=Number(l)===7?0:Number(l),m=d[f]??l;return t("scheduledTasks.human.weekly",{day:m,time:`${u(s)}:${u(r)}`})}return e}const Jd={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function Lm(e){const t=e.trim(),n={...Jd,frequency:"custom",customCron:t.length>0?t:Jd.customCron},r=t.split(/\s+/);if(r.length!==5)return n;const[s,i,o,l,c]=r,u=b=>/^\d+$/.test(b),d=b=>String(b).padStart(2,"0"),f=o==="*"&&l==="*";if(/^\*\/\d+$/.test(s)&&i==="*"&&f&&c==="*"){const b=Number(s.slice(2));return Number.isInteger(b)&&b>=1&&b<=30&&60%b===0?{...Jd,frequency:"minutes",minuteInterval:b}:n}if(!u(s))return n;const m=Number(s);if(m>59)return n;if(i==="*"&&f&&c==="*")return{...Jd,frequency:"hourly",time:`00:${d(m)}`};if(!u(i))return n;const p=Number(i);if(p>23)return n;const g=`${d(p)}:${d(m)}`;if(f&&c==="*")return{...Jd,frequency:"daily",time:g};if(f&&c==="1-5")return{...Jd,frequency:"weekdays",time:g};if(f&&u(c)){const b=Number(c);if(b>=0&&b<=7)return{...Jd,frequency:"weekly",time:g,weekday:b===7?0:b}}return n}function Fst(e,t){if(e<=0)return t("scheduledTasks.dueNow");const n=Math.floor(e/1e3),r=Math.floor(n/86400),s=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),o=n%60,l=(u,d)=>`${d}${t(`scheduledTasks.dur.${u}`)}`;let c;return r>0?c=s>0?[l("d",r),l("h",s)]:[l("d",r)]:s>0?c=i>0?[l("h",s),l("m",i)]:[l("h",s)]:i>0?c=o>0?[l("m",i),l("s",o)]:[l("m",i)]:c=[l("s",o)],c.join(" ")}function qst(e,t){const n=e.createdAt-e.createdAt%6e4;if(e.lastFiredAt===null||e.lastFiredAt<=n)return t("scheduledTasks.never");let r;try{r=new Date(e.lastFiredAt).toLocaleString()}catch{return t("scheduledTasks.never")}return t("scheduledTasks.lastFired",{when:r})}function bhe(e){switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";default:return e||"artifact"}}function Hst(e){var n;const t=(n=e.metadata)==null?void 0:n.artifactType;return typeof t=="string"&&t?t:bhe(e.kind)}function yhe(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const vhe={avif:"image/avif",bmp:"image/bmp",gif:"image/gif",ico:"image/x-icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",webp:"image/webp"},Ust=100*1024*1024,Wst=100*1024;function Vst(e){var n,r;const t=(r=(n=e.mimeType)==null?void 0:n.split(";",1)[0])==null?void 0:r.trim().toLowerCase();return t!=null&&t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(vhe).includes(t)?t:void 0:YP(e.workspacePath??"")}function YP(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?vhe[n]:void 0}async function Gst(e,t,n,r){var c,u,d,f;const s=[],i=r.maxBytes??Ust,o=await r.statFile(t);if((c=r.isCancelled)!=null&&c.call(r))throw new Error("Image loading was cancelled.");if(o.sizeBytes>i)throw new Error("Image is too large to preview or download.");let l=0;for(;;){if((u=r.isCancelled)!=null&&u.call(r))throw new Error("Image loading was cancelled.");const m=await e(t,{offset:l,maxBytes:Wst});if((d=r.isCancelled)!=null&&d.call(r))throw new Error("Image loading was cancelled.");if(m.sizeBytes!==o.sizeBytes)throw new Error("Image changed while loading. Please retry.");if(m.returnedBytes<=0&&l<o.sizeBytes)throw new Error("Image loading made no progress.");const p=atob(m.contentBase64),g=new Uint8Array(p.length);for(let b=0;b<p.length;b++)g[b]=p.charCodeAt(b);if(s.push(g),l=m.offset+m.returnedBytes,l>=o.sizeBytes){const b=await r.statFile(t);if((f=r.isCancelled)!=null&&f.call(r))throw new Error("Image loading was cancelled.");if(b.sizeBytes!==o.sizeBytes||b.modifiedMs!==o.modifiedMs)throw new Error("Image changed while loading. Please retry.");return new Blob(s,{type:n})}}}function Kst(e){return e.workspacePath??e.url??e.managedId??""}function Jg(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),r=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){r.length>0&&r.at(-1)!==".."?r.pop():n||r.push(i);continue}r.push(i)}const s=r.join("/");return n?`/${s}`:s}function hR(e,t){const n=Jg(e),r=Jg(t);if(!r)return n;if(n===r)return n.split("/").pop()??n;const s=`${r}/`;return n.startsWith(s)?n.slice(s.length):n}function whe(e,t,n){const r=hR(e??"",n),s=hR(t??"",n);return!!r&&r===s}const VG="default-src 'none'; base-uri 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:;";function Yst(e){if(typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${VG}"></head><body>${Xst(e)}</body></html>`;const t=new DOMParser().parseFromString(e,"text/html");t.querySelectorAll('noscript, meta[http-equiv="refresh" i], meta[http-equiv="Content-Security-Policy" i]').forEach(r=>r.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=VG,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function Xst(e){return e.replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?refresh["']?)[^>]*>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?Content-Security-Policy["']?)[^>]*>/gi,"")}function D3({additions:e,deletions:t,className:n,additionsClassName:r,deletionsClassName:s}){return e===void 0||t===void 0?null:a.jsxs("span",{className:n,children:[a.jsxs("span",{className:r,children:["+",e]}),a.jsxs("span",{className:s,children:["-",t]})]})}function xhe(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,n)=>({additions:t.additions+(n.additions??0),deletions:t.deletions+(n.deletions??0)}),{additions:0,deletions:0})}const Qst="_root_2vn1x_1",Jst="_card_2vn1x_7",Zst="_summary_2vn1x_14",eit="_icon_2vn1x_22",tit="_iconSvg_2vn1x_33",nit="_title_2vn1x_39",rit="_reviewSummary_2vn1x_46",sit="_reviewSummaryWithStats_2vn1x_53",iit="_reviewMeta_2vn1x_58",oit="_linkButton_2vn1x_65",ait="_reviewButton_2vn1x_66",lit="_showMoreButton_2vn1x_67",cit="_actions_2vn1x_96",uit="_list_2vn1x_114",dit="_fileRow_2vn1x_121",hit="_path_2vn1x_141",fit="_lineStats_2vn1x_150",mit="_additions_2vn1x_159",pit="_deletions_2vn1x_163",git="_chevronIcon_2vn1x_177",bit="_chevronIconOpen_2vn1x_185",yit="_artifactInfo_2vn1x_189",vit="_artifactMeta_2vn1x_194",jr={root:Qst,card:Jst,summary:Zst,icon:eit,iconSvg:tit,title:nit,reviewSummary:rit,reviewSummaryWithStats:sit,reviewMeta:iit,linkButton:oit,reviewButton:ait,showMoreButton:lit,actions:cit,list:uit,fileRow:dit,path:hit,lineStats:fit,additions:mit,deletions:pit,chevronIcon:git,chevronIconOpen:bit,artifactInfo:yit,artifactMeta:vit},khe=["file","artifact","scheduled_task"];function wit({turnId:e,changes:t,artifacts:n,scheduledTasks:r,workspaceCwd:s,onOpenRequest:i,onReviewChanges:o,onOpenArtifact:l,onOpenScheduledTask:c}){const{t:u}=rt(),[d,f]=h.useState(!1);if(t.length===0&&n.length===0&&r.length===0)return null;const m=d?t:t.slice(0,3),p=t.length-3,g=xhe(t),b=v=>{if(i){i({id:"review",kind:"review",title:u("turnOutputs.review"),turnId:e,changes:t,...s?{workspaceCwd:s}:{},...v?{selectedPath:v}:{}});return}o(t,v)},w=v=>{const x=jit(v,t,s);if(i){i({id:`artifact:${v.id}`,kind:"artifact",title:v.title??"Artifact",turnId:e,artifactId:v.id,...v.managedId?{managedId:v.managedId}:{},artifact:v,...x!==void 0?{previewContent:x}:{}});return}l(v.id,x)},y=v=>{if(i){i({id:`scheduled-task:${v.toolCallId}`,kind:"scheduled_task",title:u("scheduledTasks.title"),turnId:e,task:v});return}c(v)};return a.jsxs("div",{className:jr.root,children:[t.length>0&&a.jsxs("div",{className:jr.card,children:[a.jsxs("div",{className:jr.summary,children:[a.jsx("span",{className:jr.icon,"aria-hidden":"true",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:jr.iconSvg,children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),a.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),a.jsxs("div",{className:[jr.reviewSummary,g?jr.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[a.jsx("div",{className:jr.title,children:u("turnOutputs.filesEdited",{count:t.length})}),a.jsxs("div",{className:jr.reviewMeta,children:[a.jsx(D3,{additions:g==null?void 0:g.additions,deletions:g==null?void 0:g.deletions,className:jr.lineStats,additionsClassName:jr.additions,deletionsClassName:jr.deletions}),a.jsxs("button",{type:"button",className:jr.linkButton,onClick:()=>b(),children:[u("turnOutputs.viewChanges")," ↗"]})]})]}),a.jsx("div",{className:jr.actions,children:a.jsx("button",{type:"button",className:jr.reviewButton,onClick:()=>b(),children:u("turnOutputs.review")})})]}),a.jsxs("div",{className:jr.list,children:[m.map(v=>a.jsxs("button",{type:"button",className:jr.fileRow,onClick:()=>b(v.path),title:v.path,children:[a.jsx("span",{className:jr.path,children:V6(v.path,s)}),a.jsx(D3,{additions:v.additions,deletions:v.deletions,className:jr.lineStats,additionsClassName:jr.additions,deletionsClassName:jr.deletions})]},`${v.toolCallId}:${v.path}`)),p>0&&a.jsxs("button",{type:"button",className:jr.showMoreButton,onClick:()=>f(v=>!v),children:[a.jsx("span",{children:d?u("turnOutputs.collapseFiles"):u("turnOutputs.showMoreFiles",{count:p})}),a.jsx(Eit,{open:d})]})]})]}),n.map(v=>a.jsx(xit,{artifact:v,onOpen:()=>w(v)},v.id)),r.map(v=>a.jsx(Sit,{task:v,scheduleLabel:n_(v.cron,u),onOpen:()=>y(v)},v.toolCallId))]})}function xit({artifact:e,onOpen:t}){const{t:n}=rt(),r=yhe(e.sizeBytes),s=_it(e.kind);return a.jsx("div",{className:jr.card,children:a.jsxs("div",{className:jr.summary,children:[a.jsx("span",{className:jr.icon,"aria-hidden":"true",children:s?a.jsx(s,{className:jr.iconSvg,strokeWidth:1.8}):a.jsx(Cit,{})}),a.jsxs("div",{className:jr.artifactInfo,children:[a.jsx("div",{className:jr.title,children:e.title}),a.jsx("div",{className:jr.artifactMeta,children:[Hst(e),r].filter(Boolean).join(" · ")})]}),a.jsx("div",{className:jr.actions,children:a.jsx("button",{type:"button",className:jr.reviewButton,onClick:t,title:e.title,children:n("common.open")})})]})})}const kit={file:ike,link:Oke,html:Yxe,image:eke,video:nke,audio:Jxe,pdf:pee,notebook:Yke};function _it(e){return kit[e]}function Sit({task:e,scheduleLabel:t,onOpen:n}){const{t:r}=rt();return a.jsx("div",{className:jr.card,children:a.jsxs("div",{className:jr.summary,children:[a.jsx("span",{className:jr.icon,"aria-hidden":"true",children:a.jsx(Tit,{})}),a.jsxs("div",{className:jr.artifactInfo,children:[a.jsx("div",{className:jr.title,children:e.title}),a.jsx("div",{className:jr.artifactMeta,children:[t,e.recurring?r("scheduledTasks.repeats"):r("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),a.jsx("div",{className:jr.actions,children:a.jsx("button",{type:"button",className:jr.reviewButton,onClick:n,title:e.title,children:r("common.open")})})]})})}function Cit(){return a.jsxs("svg",{className:jr.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function Tit(){return a.jsxs("svg",{className:jr.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Eit({open:e}){return a.jsx("svg",{className:[jr.chevronIcon,e?jr.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}const Ait=h.memo(wit);function jit(e,t,n){if(!Nit(e)||!e.workspacePath)return;const r=t.find(s=>whe(s.path,e.workspacePath,n));if(r)return _he(r)}function _he(e){for(let t=e.diffs.length-1;t>=0;t--){const n=e.diffs[t];if(n!=null&&n.fullContent)return n.newText}}function Nit(e){var r,s;const t=((r=e.workspacePath)==null?void 0:r.toLowerCase())??"",n=((s=e.mimeType)==null?void 0:s.toLowerCase())??"";return e.kind==="html"||She(t)||n==="text/html"||n==="text/markdown"}function She(e){const t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||YP(t)!==void 0}function V6(e,t){return hR(e,t)}const Iit="_wrap_16iog_1",Mit="_summary_16iog_5",Rit="_summaryTextActive_16iog_27",Dit="_summaryIcon_16iog_33",Lit="_summaryStatus_16iog_47",Pit="_summaryToolIcon_16iog_54",Oit="_summaryText_16iog_27",$it="_summaryDot_16iog_96",Bit="_chevronRight_16iog_100",zit="_chevronDown_16iog_101",Fit="_group_16iog_161",qit="_list_16iog_193",Hit="_row_16iog_199",Uit="_rowStats_16iog_221",Wit="_rowDesc_16iog_229",Vit="_rowTool_16iog_239",Git="_detail_16iog_243",Kit="_track_16iog_249",Yit="_bar_16iog_257",Xit="_barRunning_16iog_265",Qit="_ruler_16iog_304",Jit="_tick_16iog_311",$i={wrap:Iit,summary:Mit,summaryTextActive:Rit,summaryIcon:Dit,summaryStatus:Lit,summaryToolIcon:Pit,summaryText:Oit,summaryDot:$it,chevronRight:Bit,chevronDown:zit,group:Fit,list:qit,row:Hit,rowStats:Uit,rowDesc:Wit,rowTool:Vit,detail:Git,track:Kit,bar:Yit,barRunning:Xit,ruler:Qit,tick:Jit};function Che(e){const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}function Zit(e,t){if(e.length<2)return null;const n=[];for(const f of e){if(typeof f.startTime!="number")return null;n.push(f.startTime)}const r=e.map((f,m)=>f.status==="in_progress"?Math.max(t,n[m]):Math.max(f.endTime??n[m],n[m])),s=Math.min(...n),i=Math.max(...r)-s;if(i<1e3)return null;const o=new Map;e.forEach((f,m)=>{const p=Math.max((r[m]-n[m])/i,.02),g=Math.min((n[m]-s)/i,1-p);o.set(f.callId,{leftPct:g*100,widthPct:p*100,running:f.status==="in_progress"})});const l=Math.max(i/1e3/2.2,1),c=Math.pow(10,Math.floor(Math.log10(l))),u=[5,2,1].map(f=>f*c).find(f=>f<=l)??c,d=[];for(let f=0;d.length<4;f++){const m=f*u*1e3;if(m>i*.92)break;d.push({leftPct:m/i*100,label:Che(m)})}return{rows:o,ticks:d}}function eot(e,t){const n=[],r=W_(e.rawOutput),s=r==null?void 0:r.executionSummary,i=s&&typeof s.totalDurationMs=="number"?Che(s.totalDurationMs):V_(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const o=r&&typeof r.tokenCount=="number"&&r.tokenCount>0?r.tokenCount:s&&typeof s.outputTokens=="number"&&s.outputTokens>0?s.outputTokens:0;o>0&&n.push($P(o));const l=OP(e);return l&&n.push(Ko(l,80)),n.join(" · ")}function tot(){return a.jsx("svg",{className:$i.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function not({agents:e,pendingApproval:t}){const{t:n}=rt(),r=VP(),[s,i]=h.useState(!1),[o,l]=h.useState(null),[c,u]=h.useState(()=>Date.now()),d=h.useRef(Date.now()),f=e.some(x=>x.status==="in_progress");h.useEffect(()=>{f&&(d.current=Date.now(),u(Date.now()))},[f]),h.useEffect(()=>{if(!f)return;const x=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(x)},[f]);const m=f?Qde(c-d.current):"",p=e.filter(x=>x.status==="completed"||x.status==="failed").length,g=e.length,b=t!=null&&t.toolCallId?e.find(x=>wd(x,t.toolCallId)):void 0,w=s||!!b,y=w?Zit(e,c):null,v=e.some(x=>e_(x)==="failed")?"failed":f?"in_progress":"completed";return a.jsxs("div",{className:$i.wrap,children:[a.jsxs("button",{type:"button",className:$i.summary,onClick:()=>i(x=>!x),"aria-expanded":w,title:n(w?"tool.collapseHint":"tool.expand"),children:[v==="failed"?a.jsx("span",{className:$i.summaryStatus,children:a.jsx(Of,{status:v})}):a.jsx("span",{className:$i.summaryIcon,"aria-hidden":"true",children:a.jsx(tot,{})}),a.jsxs("span",{className:f?`${$i.summaryText} ${$i.summaryTextActive}`:$i.summaryText,children:[n("parallelAgents.title"),m&&a.jsxs(a.Fragment,{children:[" ",m]}),a.jsx("span",{className:$i.summaryDot,children:"·"}),n("parallelAgents.done",{done:p,total:g})]}),a.jsx("span",{className:w?$i.chevronDown:$i.chevronRight,"aria-hidden":"true"})]}),w&&a.jsxs("div",{className:$i.group,children:[a.jsx("div",{className:$i.list,children:e.map(x=>{const k=BP(x),S=q6(x),T=fQe(x,n),_=eot(x,c),C=e_(x),j=o===x.callId,E=y==null?void 0:y.rows.get(x.callId);return a.jsxs("div",{children:[a.jsxs("button",{type:"button",className:$i.row,"aria-expanded":r?void 0:j,onClick:()=>{r?r.onOpen(x):l(j?null:x.callId)},children:[a.jsx(Of,{status:C}),a.jsxs("span",{className:$i.rowDesc,children:[Ko(S||k,50),T&&a.jsx("span",{className:$i.rowTool,children:` (${T})`})]}),_&&a.jsx("span",{className:$i.rowStats,children:_})]}),E&&a.jsx("div",{className:$i.track,"aria-hidden":"true",children:a.jsx("span",{className:E.running?`${$i.bar} ${$i.barRunning}`:$i.bar,style:{left:`${E.leftPct}%`,width:`${E.widthPct}%`}})}),!r&&j&&a.jsx("div",{className:$i.detail,children:a.jsx(qP,{tool:x,hideHeader:!0})})]},x.callId)})}),y&&y.ticks.length>=2&&a.jsx("div",{className:$i.ruler,"aria-hidden":"true",children:y.ticks.map(x=>a.jsx("span",{className:$i.tick,style:{left:`${x.leftPct}%`},children:x.label},x.label))})]})]})}const rot="_collapseRow_d7f01_1",sot="_collapseRowClickable_d7f01_14",iot="_collapseLabel_d7f01_19",oot="_processedLabel_d7f01_36",aot="_processedMeta_d7f01_43",lot="_hiddenMetrics_d7f01_47",cot="_summaryMetrics_d7f01_51",uot="_collapseIcon_d7f01_59",dot="_chevronRight_d7f01_72",hot="_chevronDown_d7f01_73",rd={collapseRow:rot,collapseRowClickable:sot,collapseLabel:iot,processedLabel:oot,processedMeta:aot,hiddenMetrics:lot,summaryMetrics:cot,collapseIcon:uot,chevronRight:dot,chevronDown:hot},fot="_list_p1edz_1",mot="_listWithWelcomeHeader_p1edz_12",pot="_historyStatus_p1edz_32",got="_virtualSizer_p1edz_48",bot="_virtualRow_p1edz_57",yot="_loadingSkeleton_p1edz_67",vot="_srOnly_p1edz_75",wot="_loadingSkeletonUserRow_p1edz_87",xot="_loadingSkeletonAssistantRow_p1edz_93",kot="_loadingSkeletonUserBubble_p1edz_99",_ot="_loadingSkeletonUserBubbleCompact_p1edz_100",Sot="_loadingSkeletonAssistantBlock_p1edz_114",Cot="_loadingSkeletonLineWide_p1edz_122",Tot="_loadingSkeletonLineMedium_p1edz_123",Eot="_loadingSkeletonLineShort_p1edz_124",Aot="_loadingSkeletonLineNarrow_p1edz_125",jot="_turnStatusRow_p1edz_165",Not="_turnAnswerRow_p1edz_166",Iot="_turnContentRow_p1edz_177",Mot="_sessionTimelineLayer_p1edz_181",Rot="_sessionTimelinePanel_p1edz_194",Dot="_sessionTimelineViewport_p1edz_205",Lot="_sessionTimelineList_p1edz_246",Pot="_sessionTimelineItem_p1edz_256",Oot="_sessionTimelineButton_p1edz_261",$ot="_sessionTimelineTick_p1edz_280",Bot="_sessionTimelineButtonInRange_p1edz_367",zot="_sessionTimelineButtonCurrent_p1edz_371",Fot="_sessionTimelineDetails_p1edz_382",qot="_sessionTimelineDetailsTitle_p1edz_416",Hot="_sessionTimelineDetailsIcon_p1edz_423",Uot="_sessionTimelineDetailsTitleText_p1edz_435",Wot="_sessionTimelineDetailsDetail_p1edz_445",Lr={list:fot,listWithWelcomeHeader:mot,historyStatus:pot,virtualSizer:got,virtualRow:bot,loadingSkeleton:yot,srOnly:vot,loadingSkeletonUserRow:wot,loadingSkeletonAssistantRow:xot,loadingSkeletonUserBubble:kot,loadingSkeletonUserBubbleCompact:_ot,loadingSkeletonAssistantBlock:Sot,loadingSkeletonLineWide:Cot,loadingSkeletonLineMedium:Tot,loadingSkeletonLineShort:Eot,loadingSkeletonLineNarrow:Aot,turnStatusRow:jot,turnAnswerRow:Not,turnContentRow:Iot,sessionTimelineLayer:Mot,sessionTimelinePanel:Rot,sessionTimelineViewport:Dot,sessionTimelineList:Lot,sessionTimelineItem:Pot,sessionTimelineButton:Oot,sessionTimelineTick:$ot,sessionTimelineButtonInRange:Bot,sessionTimelineButtonCurrent:zot,sessionTimelineDetails:Fot,sessionTimelineDetailsTitle:qot,sessionTimelineDetailsIcon:Hot,sessionTimelineDetailsTitleText:Uot,sessionTimelineDetailsDetail:Wot},zj=()=>{},Vot=12e4,Fj=180;function Got(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if((n==null?void 0:n.role)==="user")return n.id}return null}function Kot(e){return e[e.length-1]}function Yot(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&b1(n))return n.id}return null}function GG(e){return e.role==="tool_group"&&e.tools.length===1&&uv(e.tools[0])}function qj(e){return e.role==="tool_group"&&e.tools.length===1&&bd(e.tools[0])}function KG(e){return e.role==="thinking"}function YG(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>wd(n,t.toolCallId)))}function XG(e){return e.role==="thinking"}function Xot(e,t){const n=[];let r=0;for(;r<e.length;){const s=e[r];if(s.role!=="tool_group"||YG(s,t)){XG(s)||n.push(s),r++;continue}const i=[s];let o=r,l=r+1;for(;l<e.length;){const u=e[l];if(XG(u)){l++;continue}if(u.role==="tool_group"&&!YG(u,t)){i.push(u),o=l,l++;continue}break}if(i.length===1){n.push(s),r++;continue}const c=i.flatMap(u=>u.role==="tool_group"?u.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:c}),r=o+1}return n}function The(e){const t=[];let n=0;for(;n<e.length;){if(qj(e[n])){const r=[];let s=n;for(;s<e.length;){const i=e[s];if(qj(i)){r.push(i),s++;continue}if(KG(i)){let o=s+1;for(;o<e.length&&KG(e[o]);)o++;if(o<e.length&&qj(e[o])){s=o;continue}}break}if(r.length>=2){t.push({type:"parallel_agents",key:`par-${r[0].id}`,turnId:r[0].id,agents:r.map(i=>i.tools[0]),timestamp:r[0].timestamp}),n=s;continue}}if(GG(e[n])){const r=n;for(;n<e.length&&GG(e[n]);)n++;if(n-r>=2){const s=e.slice(r,n);t.push({type:"parallel_agents",key:`par-${s[0].id}`,turnId:s[0].id,agents:s.map(i=>i.tools[0]),timestamp:s[0].timestamp})}else t.push({type:"message",key:e[r].id,message:e[r]})}else t.push({type:"message",key:e[n].id,message:e[n]}),n++}return t}function Qot(e){if(e.type==="parallel_agents")return`group:${e.key}`;if(e.type==="turn_outputs")return`outputs:${e.key}`;if(e.type==="turn_collapse"){const t=e.turnCollapse.liveStartedAt;return t===void 0?`tc:${e.key}`:`tc:${e.key}:${t}`}return`msg:${e.key}`}function Jot(e,t,n,r,s){if((!n||n.size===0)&&(!r||r.size===0)&&(!s||s.size===0))return e;const i=[];let o=null;const l=(c,u)=>{if(u&&t||!c)return;const d=(n==null?void 0:n.get(c))??[],f=(r==null?void 0:r.get(c))??[],m=(s==null?void 0:s.get(c))??[];d.length===0&&f.length===0&&m.length===0||i.push({type:"turn_outputs",key:c,turnId:c,changes:d,artifacts:f,scheduledTasks:m})};for(const c of e)c.type==="message"&&b1(c.message)?(l(o,!1),o=c.message.id):!o&&c.type==="message"?o=c.message.id:!o&&c.type==="parallel_agents"&&(o=c.turnId),i.push(c);return l(o,!0),i}function Zot(e,t){return e.type==="message"&&(e.message.role==="assistant"||t&&e.message.role==="system"&&e.message.source==="background_notification")&&!!e.message.content&&e.message.content.trim().length>0}function XP(e,t,n,r=!0){let s=t;for(let i=n;i>t;i--)if(fat(e[i])){s=i;break}for(let i=n;i>s;i--)if(Zot(e[i],r))return i;return-1}function eat(e,t){const n=[];for(let s=0;s<e.length;s++){const i=e[s];i.type==="message"&&b1(i.message)&&n.push(s)}const r=new Map;for(let s=0;s<n.length;s++){if(s===n.length-1&&t)continue;const i=n[s],o=(s+1<n.length?n[s+1]:e.length)-1,l=e[i],c=XP(e,i,o,!1);if(c<0)continue;const u=e[c];(l==null?void 0:l.type)==="message"&&u.type==="message"&&u.message.role==="assistant"&&r.set(u.message.id,l.message.id)}return r}function QG(e,t){if(e.type==="parallel_agents")return!0;if(e.type==="turn_outputs"||e.type==="turn_collapse")return!1;switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return e.message.source==="background_notification"?!t:QP(e.message);case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return!1;default:return e.message,!1}}function QP(e){var t;return e.source==="mid_turn_message_injected"||((t=e.content)==null?void 0:t.startsWith("mid_turn_message_injected (unrecognized daemon event):"))===!0}function tat(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};if(e.type==="turn_outputs")return{kind:"none"};if(e.type!=="message")return{kind:"none"};const{message:n}=e;switch(n.role){case"thinking":return{kind:"thought",timestamp:n.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:n.timestamp}:Zg(n.content,1)?{kind:"commentary",timestamp:n.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:n.timestamp};case"tool_group":{const r=n.tools.length;return{kind:"tool",timestamp:n.timestamp,label:t?t("timeline.toolCalls",{count:r}):`${r} tool call${r===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:n.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return QP(n)?{kind:"status",timestamp:n.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:n.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:n.timestamp};default:return{kind:"none"}}}function Zg(e,t,n={}){const s=(n.stripMarkdown===!0?nat(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!s)return"";const i=Array.from(s);return i.length>t?`${i.slice(0,t-1).join("")}…`:s}function nat(e){if(!e)return"";const t=[],n=s=>{const i=`\0${t.length}\0`;return t.push(s),i};let r=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(s,i)=>n(i)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(s,i)=>n(i)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");r=Hj(r,"~~"),r=Hj(r,"**"),r=Hj(r,"__"),r=r.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(const[s,i]of t.entries())r=r.split(`\0${s}\0`).join(i);return r}function Hj(e,t){let n="",r=0;for(;r<e.length;){const s=e.indexOf(t,r);if(s===-1)return n+e.slice(r);const i=s+t.length,o=e.indexOf(t,i);if(o===-1)return n+e.slice(r);const l=e.slice(i,o);n+=l.trim().length===0?e.slice(r,o+t.length):e.slice(r,s)+l,r=o+t.length}return n}function rat(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",r=Zg(n,32);return r||(t?t("timeline.userTurn"):"User turn")}function sat(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function b1(e){return e.role==="user"||e.role==="user_shell"}function iat(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return Zg(e.content,120,{stripMarkdown:!0});case"tool_group":{const n=e.tools.length;return t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return QP(e)?Zg(e.content,120,{stripMarkdown:!0}):"";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return"";default:return""}}function oat(e,t){if(e.type==="parallel_agents"){const n=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:n}):`${n} parallel agent${n===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":iat(e.message,t)}function aat(e,t){return t?t(`timeline.kind.${e}`):Oat[e]}function lat(e,t,n,r){if(t!==null)for(const o of e){if(o.type!=="message")continue;const{message:l}=o;if(l.id!==t||l.role!=="assistant")continue;const c=Zg(l.content,180,{stripMarkdown:!0});if(c)return c}const s=[];for(let o=0;o<e.length;o+=1){const l=e[o];if(l.type==="message"&&t!==null&&l.message.id===t)continue;const c=oat(l,r);c&&s.push(c)}const i=Zg(s.join(" · "),180);return i||(n.length>0?n.map(o=>aat(o,r)).join(" · "):r?r("timeline.noActivity"):"No activity")}function cat(e,t){const n=[];let r=null,s=[];const i=()=>{if(!r)return;const o=The(s),l=XP(o,-1,o.length-1,!1),c=l>=0?o[l]:null,u=(c==null?void 0:c.type)==="message"&&c.message.role==="assistant"&&!c.message.isStreaming&&Zg(c.message.content,1,{stripMarkdown:!0}).length>0?c.message.id:null,d=[];for(const f of o){if(f.type==="message"&&u!==null&&f.message.id===u)continue;const m=tat(f,t);m.kind!=="none"&&!d.includes(m.kind)&&d.push(m.kind)}n.push({id:r.id,label:rat(r,t),detail:lat(o,u,d,t),timestamp:r.timestamp,nodeKinds:d,...sat(r)?{isScheduledTask:!0}:{}})};for(const o of e){if(b1(o)){i(),r=o,s=[];continue}r&&s.push(o)}return i(),n}function uat(){return a.jsxs("svg",{className:Lr.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),a.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function dat(e){var n,r,s;const t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0;return[e.callId,e.toolName,e.kind??"",e.status,e.parentToolCallId??"",e.subContent?"sub-content":"",((n=e.subTools)==null?void 0:n.length)??0,String(((r=e.args)==null?void 0:r.subagent_type)??""),((s=e.args)==null?void 0:s.run_in_background)===!0?"background":"",String((t==null?void 0:t.type)??""),String((t==null?void 0:t.status)??"")].join(":")}function hat(e){return e.map(t=>{const n=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${n}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${n}:${t.tools.map(dat).join(",")}`;case"system":return`${n}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${n}:${t.content}`;case"user_shell":return`${n}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return n;default:return n}}).join("|")}function fat(e){return e.type==="parallel_agents"?!0:e.type==="turn_outputs"||e.type==="turn_collapse"?!1:e.message.role==="tool_group"||e.message.role==="plan"}function JG(e){return e==="pending"||e==="running"||e==="in_progress"}function mat(e){if(e.type==="turn_outputs")return null;if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){const n=e.agents.filter(r=>JG(r.status));return n.length===0?null:`agents:${e.key}:${n.map(r=>r.callId).join(",")}`}if(e.message.role!=="tool_group")return null;const t=e.message.tools.filter(n=>JG(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function pat(e){for(let t=e.length-1;t>=0;t--){const n=mat(e[t]);if(n)return n}return null}function gat(e){if(!(e.type!=="message"||e.message.role!=="system"))return e.message.source==="prompt_cancelled"||e.message.source==="turn_error"?e.message.timestamp:void 0}function bat(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function yat(e){var t;if(!(e.type!=="message"||e.message.role!=="assistant"))return(t=e.message.content)!=null&&t.trim()?e.message.timestamp:void 0}function vat(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function Uj(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function ZG(e){if(e.parentToolCallId||!uv(e))return;const t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0,n=t!=null&&t.executionSummary&&typeof t.executionSummary=="object"?t.executionSummary:void 0,r=Uj(n==null?void 0:n.inputTokens),s=Uj(n==null?void 0:n.outputTokens);if(r===void 0&&s===void 0)return;const i=Uj(n==null?void 0:n.cachedTokens);return{callId:e.callId,usage:{inputTokens:r??0,outputTokens:s??0,...i!==void 0?{cachedTokens:i}:{}}}}function wat(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>ZG(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>ZG(t)??[])}function xat(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_outputs"||e.type==="turn_collapse"?0:e.message.role==="tool_group"?e.message.tools.length:0}function Ehe(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const r=e[n];if(r.type==="message"&&b1(r.message))return r.message.id}return null}function Ahe(e){const t=[];let n=null;for(const r of e)r.type==="message"&&b1(r.message)&&(n=r.message.id),t.push(n);return t}function eK(e,t,n,r){const s=r===void 0?Ehe(e,t):r[t]??null;return s?n.get(s)??null:null}function kat(e,t,n,r,s=Ahe(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const c of t){if(c<0||c>=e.length)continue;const u=eK(e,c,n,s);u!==null&&(i=Math.min(i,u),o=Math.max(o,u))}if(o<0)return null;const l=r==null?null:eK(e,r,n,s);return{startIndex:i,endIndex:o,currentIndex:l!==null&&l>=i&&l<=o?l:o}}function _at(e,t,n,r){if(!r)return!1;for(let s=t;s<=n;s++){const i=e[s];if(i.type==="parallel_agents"){if(i.agents.some(o=>wd(o,r)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>wd(o,r)))return!0}return!1}function Sat(e,{overrides:t,isResponding:n,activeTurnStartedAt:r,pendingApprovalCallId:s,includeSubagentToolUsageInMetrics:i=!0,enabled:o}){if(!o||e.length===0)return e;const l=[];for(let u=0;u<e.length;u++){const d=e[u];d.type==="message"&&b1(d.message)&&l.push(u)}if(l.length===0)return e;const c=[];for(let u=0;u<l[0];u++)c.push(e[u]);for(let u=0;u<l.length;u++){const d=l[u],f=(u+1<l.length?l[u+1]:e.length)-1,m=e[d],p=m.message.id,g=m.message.timestamp,b=u===l.length-1&&n,w=_at(e,d,f,s),y=XP(e,d,f);let v=0,x,k,S=0,T=0,_=0,C=0,j=0,E=!1;const L=new Set;let D=!1;for(let Y=d+1;Y<=f;Y++){const U=e[Y];QG(U,Y===y)&&v++,bat(U)&&(D=!0),C+=xat(U),U.type==="message"&&U.message.role==="thinking"&&j++;const F=gat(U);F!==void 0&&(x=x===void 0?F:Math.max(x,F));const te=yat(U);te!==void 0&&(k=k===void 0?te:Math.max(k,te));const W=vat(U);if(W&&(S+=W.inputTokens,T+=W.outputTokens,_+=W.cachedTokens??0,E=!0),i)for(const K of wat(U))L.has(K.callId)||(L.add(K.callId),S+=K.usage.inputTokens,T+=K.usage.outputTokens,_+=K.usage.cachedTokens??0,E=!0)}const M=b?r??g??Date.now():void 0,R=x??k,$=g!==void 0&&R!==void 0&&R>=g?R-g:void 0;if(w||v===0&&!(E||$!==void 0||M!==void 0)){for(let Y=d;Y<=f;Y++)c.push(e[Y]);continue}const N=b||D||y<0,G=!(v===0?!0:t.has(p)?t.get(p):N);c.push({type:"message",key:m.key,message:m.message});const I={turnId:p,collapsed:G,hiddenCount:v,...$!==void 0?{elapsedMs:$}:{},...E?{inputTokens:S,outputTokens:T}:{},..._>0?{cachedTokens:_}:{},...C>0?{toolCallCount:C}:{},...j>0?{thinkingCount:j}:{},...M!==void 0?{liveStartedAt:M}:{}};if(c.push({type:"turn_collapse",key:`tc-${p}`,turnCollapse:I}),!G){for(let Y=d+1;Y<=f;Y++){const U=e[Y];Y===y&&U.type==="message"&&U.message.role==="assistant"?c.push({...U,turnCollapse:I}):c.push(U)}continue}for(let Y=d+1;Y<=f;Y++){const U=e[Y];if(!(Y===y&&b)){if(Y===y&&U.type==="message"&&U.message.role==="assistant"){c.push({...U,turnCollapse:I});continue}QG(U,Y===y)||c.push(U)}}}return c}function Wj(e,t,n){for(let r=0;r<e.length;r++){const s=e[r];if(s.type==="message"){if(s.message.id===t||n&&s.message.role==="tool_group"&&s.message.tools.some(i=>wd(i,n)))return r}else{if(s.type==="parallel_agents"&&n&&s.agents.some(i=>wd(i,n)))return r;if(s.type==="turn_outputs")continue}}return-1}function tK(e,t){if(!t)return!1;const n=t.callId;return e.type==="message"?e.message.id===t.messageId?!0:!!n&&e.message.role==="tool_group"&&e.message.tools.some(r=>wd(r,n)):e.type==="parallel_agents"?!!n&&e.agents.some(r=>wd(r,n)):(e.type==="turn_outputs",!1)}const Vj=0,Cat=120,Tat=80,Eat=32,Aat=240,dC=30,nK=48,jhe=200,jat=4;function Nat(e,t=jhe){return e>t}function Iat(e){const t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t-n*60;return`${n}m ${r}s`}function Gj(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function Mat(e){return e!==void 0&&e>0?Iat(e):""}function Rat(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,r=n>0&&e.inputTokens>0?` (${Gj(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${Gj(e.inputTokens)}${r} ↓${Gj(e.outputTokens)}`}function rK(e,t){const n=[],r=Rat(e,t);return r&&n.push(r),e.toolCallCount!==void 0&&e.toolCallCount>0&&n.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&n.push(t("turn.thinkingCount",{count:e.thinkingCount})),n.join(" · ")}function Dat(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const Lat=h.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:r}=rt(),s=t.hiddenCount>0,i=t.liveStartedAt,o=s||i!==void 0||Dat(t),l=WP(i!==void 0&&o),c=h.useRef(0),u=h.useRef(i);u.current!==i&&(u.current=i,c.current=0);let d;i!==void 0&&o?(c.current=Math.max(c.current,Math.max(0,l-i)),d=c.current):o&&t.elapsedMs!==void 0?(c.current=0,d=t.elapsedMs):(c.current=0,d=void 0);const f=Mat(d),m=rK(t,r),p=rK(t,r),g=r(i!==void 0?"turn.processing":"turn.processed"),b=!!f&&o,w=!!m&&o,y=!!p&&o;if(!o)return null;const v=()=>{if(!s)return;const x=t.collapsed;n(t.turnId,x)};return a.jsxs("div",{className:s?`${rd.collapseRow} ${rd.collapseRowClickable}`:rd.collapseRow,role:s?"button":void 0,tabIndex:s?0:void 0,"aria-expanded":s?!t.collapsed:void 0,"aria-label":s?t.collapsed?r("turn.expand"):r("turn.collapse"):void 0,title:s?t.collapsed?r("turn.expand"):r("turn.collapse"):void 0,onClick:s?v:void 0,onKeyDown:s?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),v())}:void 0,children:[a.jsxs("span",{className:rd.collapseLabel,children:[a.jsxs("span",{className:rd.processedLabel,children:[g,b&&a.jsxs("span",{className:rd.processedMeta,children:[" ",f]})]}),y&&a.jsx("span",{className:rd.summaryMetrics,children:p}),w&&a.jsx("span",{className:rd.hiddenMetrics,children:m})]}),s&&a.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:rd.collapseIcon,onClick:x=>{x.stopPropagation(),v()},children:a.jsx("span",{className:t.collapsed?rd.chevronRight:rd.chevronDown,"aria-hidden":"true"})})]})});function Pat(e){if(e.type==="turn_collapse")return Lr.turnStatusRow;if(e.type==="turn_outputs")return Lr.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Lr.turnAnswerRow}const Oat={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},$at=["--background","--foreground","--muted-foreground","--border","--font-sans"],sK="session-timeline-detail-tooltip",Bat=h.memo(function({entries:t,currentTurnId:n,currentRange:r,hidden:s,onSelect:i}){const o=Gu(),{t:l}=rt(),c=h.useRef(null),u=h.useRef(null),d=h.useRef(null),f=h.useRef(!1),m=h.useRef(!1),p=h.useRef(null),g=h.useRef(null),[b,w]=h.useState(null),y=r!==null?r.currentIndex:t.findIndex(E=>E.id===n),v=h.useCallback(()=>w(null),[]),x=h.useCallback(()=>{f.current||m.current||v()},[v]),k=h.useCallback((E,L)=>{const D=c.current;if(!D)return null;const M=getComputedStyle(D),R=L.getBoundingClientRect();return{entry:E,top:R.top+R.height/2,left:R.right+8,clamped:!1,themeVars:Object.fromEntries($at.map($=>[$,M.getPropertyValue($)]))}},[]),S=h.useCallback(E=>{const L=u.current;if(!L)return null;const D=Array.from(L.querySelectorAll('[data-testid="session-timeline-entry"]')).find(M=>M.getAttribute("data-turn-id")===E.id);return(D==null?void 0:D.querySelector("button"))??null},[]),T=h.useCallback(E=>{const L=u.current;if(!L)return!1;const D=L.getBoundingClientRect(),M=E.getBoundingClientRect();return M.bottom>=D.top&&M.top<=D.bottom},[]),_=h.useCallback(()=>{w(E=>{if(!E)return null;const L=S(E.entry);return!L||!T(L)?null:k(E.entry,L)})},[k,S,T]),C=h.useCallback((E,L)=>{w(k(E,L))},[k]),j=h.useCallback(()=>{typeof window>"u"||(p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),m.current=!0,p.current=window.requestAnimationFrame(()=>{p.current=null,m.current=!1,_()}),g.current=window.setTimeout(()=>{g.current=null,m.current=!1},100))},[_]);return h.useLayoutEffect(()=>{if(s)return;const E=u.current;if(!E||y<0)return;const L=E.querySelector(`[data-timeline-index="${y}"]`);if(!L)return;const D=L.offsetTop+L.offsetHeight/2,M=E.scrollHeight-E.clientHeight,R=Math.max(0,Math.min(D-E.clientHeight/2,M));if(E.scrollTop===R)return;f.current=!0,E.scrollTop=R;const $=window.requestAnimationFrame(()=>{f.current=!1,_()}),B=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame($),window.clearTimeout(B),f.current=!1}},[y,s,_]),h.useLayoutEffect(()=>{if(!(!b||typeof window>"u"))return window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}},[_,b]),h.useLayoutEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),m.current=!1},[]),h.useLayoutEffect(()=>{if(!b||b.clamped)return;const E=c.current,L=d.current;if(!E||!L||typeof window>"u")return;const D=L.getBoundingClientRect(),M=12;let R=b.top;D.top<M?R+=M-D.top:D.bottom>window.innerHeight-M&&(R-=D.bottom-(window.innerHeight-M)),R!==b.top&&w($=>($==null?void 0:$.entry.id)===b.entry.id?{...$,top:R,clamped:!0}:$)},[b]),s||t.length===0?null:a.jsx("div",{className:Lr.sessionTimelineLayer,"aria-hidden":"false",children:a.jsxs("nav",{ref:c,className:Lr.sessionTimelinePanel,"aria-label":l("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:v,children:[a.jsx("div",{ref:u,className:Lr.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:x,children:a.jsx("ol",{className:Lr.sessionTimelineList,children:t.map((E,L)=>{const D=r!==null&&L>=r.startIndex&&L<=r.endIndex,M=r!==null?L===r.currentIndex:E.id===n,R=E.nodeKinds.join(","),$=[`${l("timeline.turnPrefix",{index:L+1})}: ${E.label}`,M?l("timeline.currentTurn"):null].filter(Boolean).join(". "),B=G=>C(E,G.currentTarget),N=G=>{j(),C(E,G.currentTarget)},z=(b==null?void 0:b.entry.id)===E.id;return a.jsx("li",{className:Lr.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":E.id,"data-timeline-index":L,"data-node-kinds":R,"data-in-current-range":D?"true":void 0,children:a.jsx("button",{type:"button",className:fR(Lr.sessionTimelineButton,D?Lr.sessionTimelineButtonInRange:void 0,M?Lr.sessionTimelineButtonCurrent:void 0),"aria-current":M?"step":void 0,"aria-describedby":z?sK:void 0,"aria-label":$,onClick:()=>i(E.id),onFocus:N,onBlur:v,onMouseEnter:B,onMouseLeave:v,children:a.jsx("span",{className:Lr.sessionTimelineTick})})},E.id)})})}),b&&typeof document<"u"&&xd.createPortal(a.jsxs("div",{ref:d,className:Lr.sessionTimelineDetails,id:sK,"data-testid":"session-timeline-detail","data-title":b.entry.label,"data-detail":b.entry.detail,"data-scheduled-task":b.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...b.themeVars,top:b.top,left:b.left},children:[a.jsxs("span",{className:Lr.sessionTimelineDetailsTitle,children:[b.entry.isScheduledTask&&a.jsx(uat,{}),a.jsx("span",{className:Lr.sessionTimelineDetailsTitleText,children:b.entry.label})]}),a.jsx("span",{className:Lr.sessionTimelineDetailsDetail,children:b.entry.detail})]}),o??document.body)]})})});function fR(...e){return e.filter(Boolean).join(" ")||void 0}const zat=[];function Fat({label:e}){return a.jsxs(a.Fragment,{children:[a.jsx("div",{role:"status","aria-live":"polite",className:Lr.srOnly,children:e}),a.jsxs("div",{className:Lr.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[a.jsx("div",{className:Lr.loadingSkeletonUserRow,children:a.jsxs("div",{className:Lr.loadingSkeletonUserBubble,children:[a.jsx("span",{className:Lr.loadingSkeletonLineWide}),a.jsx("span",{className:Lr.loadingSkeletonLineShort})]})}),a.jsx("div",{className:Lr.loadingSkeletonAssistantRow,children:a.jsxs("div",{className:Lr.loadingSkeletonAssistantBlock,children:[a.jsx("span",{className:Lr.loadingSkeletonLineMedium}),a.jsx("span",{className:Lr.loadingSkeletonLineWide}),a.jsx("span",{className:Lr.loadingSkeletonLineNarrow})]})}),a.jsx("div",{className:Lr.loadingSkeletonUserRow,children:a.jsx("div",{className:Lr.loadingSkeletonUserBubbleCompact,children:a.jsx("span",{className:Lr.loadingSkeletonLineMedium})})}),a.jsx("div",{className:Lr.loadingSkeletonAssistantRow,children:a.jsxs("div",{className:Lr.loadingSkeletonAssistantBlock,children:[a.jsx("span",{className:Lr.loadingSkeletonLineWide}),a.jsx("span",{className:Lr.loadingSkeletonLineMedium})]})})]})]})}const JP=h.memo(h.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:r,loadingTranscript:s,catchingUp:i,hasOlderHistory:o=!1,loadingOlderHistory:l=!1,historyCapacityReached:c=!1,historyPaginationError:u=!1,onLoadOlderHistory:d,transcriptBlockCount:f=0,transcriptActivity:m,onReloadTranscript:p,isResponding:g=!1,activeTurnStartedAt:b,welcomeHeader:w,centerWelcomeHeader:y=!1,workspaceCwd:v,tailContent:x,tailKey:k="tail",virtualScrollThreshold:S=jhe,autoScrollTailIntoView:T=!1,bottomOverlayInset:_=0,hideSessionTimeline:C=!1,hideFirstUserMessage:j=!1,firstTurnMetrics:E,includeSubagentToolUsageInMetrics:L=!0,showRetryHint:D=!1,onRetryClick:M,failedPromptMessageId:R,onRetryFailedPrompt:$,onBranchSession:B,onCanScrollToBottomChange:N,turnFileChanges:z,turnArtifacts:G,turnScheduledTasks:I,onReviewChanges:Y,onOpenArtifact:U,onOpenScheduledTask:P,onTurnOutputOpen:F,generateContent:te},W){var ur;const{t:K}=rt(),ce=h.useContext(e1),ie=h.useMemo(()=>ce?Xot(t,n):t,[ce,t,n]),Z=h.useMemo(()=>Jot(The(ie),g,z,G,I),[ie,g,z,G,I]),[ee,oe]=h.useState(!1),we=h.useRef(null),pe=h.useMemo(()=>{var lt,Xt;if(!ee)return zat;const je=hat(ie);return(((lt=we.current)==null?void 0:lt.signature)!==je||((Xt=we.current)==null?void 0:Xt.t)!==K)&&(we.current={signature:je,t:K,entries:cat(ie,K)}),we.current.entries},[ee,ie,K]),he=h.useMemo(()=>new Map(pe.map((je,lt)=>[je.id,lt])),[pe]),X=h.useMemo(()=>Yot(ie),[ie]),[ye,Ce]=h.useState(null),ae=ye!==null?((ur=pe[ye.currentIndex])==null?void 0:ur.id)??X:X,me=h.useMemo(()=>{var je;if(g)return null;for(let lt=ie.length-1;lt>=0;lt-=1){const Xt=ie[lt];if(Xt&&(Xt.role==="tool_group"||Xt.role==="plan"))return null;if((Xt==null?void 0:Xt.role)==="assistant"&&!Xt.isStreaming&&((je=Xt.content)!=null&&je.trim()))return Xt.id}return null},[g,ie]),We=h.useMemo(()=>eat(Z,g),[Z,g]),{collapseCompletedTurns:Oe}=Vu(),Mt=Oe??!0,[$t,St]=h.useState(()=>new Map),[ue,Ee]=h.useTransition(),tt=h.useRef(!1),ut=h.useRef(new Map),Ct=h.useRef(void 0),Ze=h.useRef([]),Et=h.useRef(!0),Nt=h.useRef(!1),gt=h.useRef(0),Je=h.useRef(0),Ae=h.useRef(!1),de=h.useRef(!1),nt=h.useRef(0),ve=h.useRef(null),Ke=h.useRef(null),le=h.useRef(!1),Le=h.useRef(null),dt=h.useRef(!1),Fe=h.useRef(s),Ge=h.useRef(!!s),un=h.useRef(void 0),Wn=h.useRef(void 0),Me=h.useRef(_),yt=h.useRef(null),cn=h.useRef(i),Re=h.useRef(i),et=h.useRef(!1),bt=h.useRef(!1),rn=h.useRef(void 0),qn=h.useRef(void 0);Re.current=i;const ft=h.useRef(null),He=h.useRef(!1),Ye=h.useRef(void 0),Yt=h.useRef(void 0),Cn=h.useRef(void 0),Tn=h.useRef(f),zr=h.useRef(g);Tn.current=f,zr.current=g;const Ns=h.useRef(null),[kr,si]=h.useState(null),[Fr,At]=h.useState(!1);h.useLayoutEffect(()=>{if(!kr)return;const je=ft.current;je&&(je.scrollTop=kr.scrollTop+Math.max(0,je.scrollHeight-kr.scrollHeight)),Ae.current=!1,si(null)},[kr]),h.useEffect(()=>{o||(He.current=!1,Ns.current=null)},[o]);const Xn=h.useCallback(()=>{const je=ft.current,lt=je?je.scrollHeight-je.scrollTop-je.clientHeight:0,Xt=!Et.current&&lt>1;Ke.current!==Xt&&(Ke.current=Xt,N==null||N(Xt))},[N]),_e=h.useCallback(()=>{qn.current!==void 0&&window.cancelAnimationFrame(qn.current),qn.current=window.requestAnimationFrame(Xn)},[Xn]),Vt=h.useCallback(je=>{Et.current!==je&&(Et.current=je,_e())},[_e]),Dt=h.useMemo(()=>{var Lt;const je=Sat(Z,{overrides:$t,isResponding:g,activeTurnStartedAt:b,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,includeSubagentToolUsageInMetrics:L,enabled:Mt});let lt=!1;const Xt=E?je.map(Be=>lt||Be.type!=="turn_collapse"?Be:(lt=!0,{...Be,turnCollapse:{...Be.turnCollapse,...E.durationMs!==void 0&&E.durationMs>0?{elapsedMs:E.durationMs}:{},...E.inputTokens!==void 0?{inputTokens:E.inputTokens}:{},...E.outputTokens!==void 0?{outputTokens:E.outputTokens}:{},...E.cachedTokens!==void 0?{cachedTokens:E.cachedTokens}:{}}})):je;if(!j)return Xt;const Nn=(Lt=ie.find(Be=>Be.role==="user"))==null?void 0:Lt.id;return Nn?Xt.filter(Be=>Be.type!=="message"||Be.message.id!==Nn):Xt},[Z,$t,g,b,n==null?void 0:n.toolCallId,Mt,j,E,L,ie]),Kn=h.useMemo(()=>Ahe(Dt),[Dt]),Vn=pe.length>=jat;h.useLayoutEffect(()=>{if(C){oe(Nn=>Nn&&!1);return}const je=ft.current;if(!je)return;const lt=()=>{const Lt=je.getBoundingClientRect().width>=1160;oe(Be=>Be===Lt?Be:Lt)};if(lt(),typeof ResizeObserver>"u")return;const Xt=new ResizeObserver(lt);return Xt.observe(je),()=>Xt.disconnect()},[C]);const ds=x!=null,hs=!!s,vs=!!w,Mr=vs?1:0,ji=Mr+Dt.length,os=ji+(ds?1:0),zt=Mr+Z.length+(ds?1:0),Ni=Nat(zt,S),Ur=h.useCallback(()=>ft.current,[]),vo=h.useCallback(()=>{const je=ft.current;if(!je)return;const Xt=je.scrollHeight-je.scrollTop-je.clientHeight<dC;Nt.current=!Xt,Vt(Xt),_e()},[_e,Vt]),wo=h.useCallback(()=>{gt.current=Date.now()+1e3},[]),Ps=h.useCallback(()=>{Ye.current!==void 0&&(window.clearTimeout(Ye.current),Ye.current=void 0)},[]),Gt=h.useCallback(()=>{var je;Ps(),(je=Yt.current)==null||je.abort(),Yt.current=void 0},[Ps]),_r=h.useCallback(()=>{Ps();const je=Cn.current;if(je){if((m==null?void 0:m.getSnapshot().lastEventId)===je.lastEventId&&Tn.current<=je.blockCount)return;Cn.current=void 0}!p||Yt.current!==void 0||Nt.current||zr.current||Tn.current<=V_e||(Ye.current=window.setTimeout(()=>{Ye.current=void 0;const lt=ft.current;if(!lt||lt.scrollHeight-lt.scrollTop-lt.clientHeight>=dC)return;const Nn=new AbortController;Yt.current=Nn,p(Nn.signal).then(()=>{var Be;if(Nn.signal.aborted)return;const Lt=m==null?void 0:m.getSnapshot();Cn.current={...(Lt==null?void 0:Lt.lastEventId)!==void 0?{lastEventId:Lt.lastEventId}:{},blockCount:((Be=Lt==null?void 0:Lt.blocks)==null?void 0:Be.length)??Tn.current}}).catch(Lt=>{Lt instanceof Error&&Lt.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Lt)}).finally(()=>{Yt.current===Nn&&(Yt.current=void 0)})},Vot))},[Ps,p,m]);h.useEffect(()=>{Cn.current=void 0},[m]),h.useEffect(()=>{if(!m)return Gt;let je=m.getSnapshot().lastEventId;const lt=m.subscribe(()=>{const Xt=m.getSnapshot().lastEventId;Xt!==je&&(je=Xt,_r())});return()=>{lt(),Gt()}},[m,_r,Gt]),h.useEffect(()=>{_r()},[g,_r,f]);const Er=h.useCallback(()=>{bt.current=!0,rn.current!==void 0&&window.cancelAnimationFrame(rn.current),rn.current=window.requestAnimationFrame(()=>{bt.current=!1,rn.current=void 0,vo()})},[vo]);h.useEffect(()=>()=>{rn.current!==void 0&&window.cancelAnimationFrame(rn.current),qn.current!==void 0&&window.cancelAnimationFrame(qn.current),Gt(),un.current!==void 0&&window.cancelAnimationFrame(un.current),Wn.current!==void 0&&window.cancelAnimationFrame(Wn.current)},[Gt]);const Do=h.useCallback((je,lt)=>{var Nn;const Xt=ft.current;(!Xt||Xt.scrollHeight>Xt.clientHeight+1)&&(Nt.current=!0,Vt(!1)),Er(),Ct.current!==void 0&&window.clearTimeout(Ct.current),ut.current.clear(),(Nn=ft.current)==null||Nn.querySelectorAll("[data-message-row-key]").forEach(Lt=>{const Be=Lt.dataset.messageRowKey;Be&&ut.current.set(Be,Lt.getBoundingClientRect().top)}),tt.current=!0,Ee(()=>{St(Lt=>{const Be=new Map(Lt);return Be.set(je,lt),Be})})},[Er,Vt]);h.useLayoutEffect(()=>{var lt;if(ue||!tt.current)return;tt.current=!1;for(const Xt of Ze.current)Xt.cancel();Ze.current=[];const je=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;je||(lt=ft.current)==null||lt.querySelectorAll("[data-message-row-key]").forEach(Xt=>{if(typeof Xt.animate!="function")return;const Nn=Xt.dataset.messageRowKey,Lt=Nn?ut.current.get(Nn):void 0;if(Lt===void 0){Ze.current.push(Xt.animate([{opacity:0},{opacity:1}],{duration:Fj,easing:"ease-out"}));return}const Be=Lt-Xt.getBoundingClientRect().top;Math.abs(Be)<1||Ze.current.push(Xt.animate([{translate:`0 ${Be}px`},{translate:"0 0"}],{duration:Fj,easing:"ease-out"}))}),ut.current.clear(),Ct.current=window.setTimeout(()=>{Ct.current=void 0,Er()},je?0:Fj)},[Er,ue]),h.useEffect(()=>()=>{Ct.current!==void 0&&window.clearTimeout(Ct.current);for(const je of Ze.current)je.cancel();Ze.current=[]},[]);const fs=h.useCallback(je=>{const lt=je.target;lt instanceof HTMLElement&&lt.closest("[aria-expanded]")&&(Nt.current=!0,Vt(!1),Er())},[Er,Vt]),di=h.useCallback(je=>{if(vs&&je===Vj)return"slot:header";if(ds&&je===ji)return`slot:tail:${k}`;const lt=Dt[je-Mr];return lt?Qot(lt):`slot:row:${je}`},[vs,ds,ji,k,Dt,Mr]),ws=h.useCallback((je="auto")=>{const lt=Ur();if(!lt||lt.scrollHeight<=lt.clientHeight)return;nt.current+=1;const Xt=nt.current;de.current=!0,je==="smooth"?lt.scrollTo({top:lt.scrollHeight,behavior:je}):lt.scrollTop=lt.scrollHeight,_e(),Je.current=Math.max(0,lt.scrollHeight-lt.clientHeight),Xn();const Nn=()=>{nt.current===Xt&&(de.current=!1)};je==="smooth"?setTimeout(Nn,350):requestAnimationFrame(Nn)},[Ur,Xn,_e]),xe=h.useCallback((je="smooth")=>{Nt.current=!1,Vt(!0),ws(je)},[ws,Vt]),$e=dSe({count:os,enabled:Ni,getScrollElement:Ur,getItemKey:di,estimateSize:je=>{if(vs&&je===Vj)return Cat;if(ds&&je===ji)return Aat;const lt=Dt[je-Mr];return(lt==null?void 0:lt.type)==="turn_collapse"?Eat:Tat},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),it=$e.getVirtualItems(),Ft=$e.getTotalSize(),On=h.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});On.current={entryIndexById:he,headerOffset:Mr,isVisible:ee,turnIdByDisplayIndex:Kn,visibleItems:Dt};const Yn=h.useCallback(()=>{const je=Ur(),lt=On.current;if(!je||!lt.isVisible||lt.entryIndexById.size===0){Ce(Ht=>Ht===null?Ht:null);return}const Xt=je.getBoundingClientRect(),Nn=Xt.top,Lt=Xt.bottom,Be=Nn+(Lt-Nn)/2,yn=[];let mr=null,dr=Number.POSITIVE_INFINITY;je.querySelectorAll("[data-index]").forEach(Ht=>{const hr=Ht.dataset.index;if(hr===void 0)return;const hi=Number(hr);if(!Number.isFinite(hi))return;const Zr=hi-lt.headerOffset;if(Zr<0||Zr>=lt.visibleItems.length)return;const Os=Ht.getBoundingClientRect();if(Os.bottom<Nn||Os.top>Lt)return;yn.push(Zr);const Vi=Os.top+(Os.bottom-Os.top)/2,Ms=Math.abs(Vi-Be);Ms<dr&&(dr=Ms,mr=Zr)});const as=kat(lt.visibleItems,yn,lt.entryIndexById,mr,lt.turnIdByDisplayIndex);Ce(Ht=>(Ht==null?void 0:Ht.startIndex)===(as==null?void 0:as.startIndex)&&(Ht==null?void 0:Ht.endIndex)===(as==null?void 0:as.endIndex)&&(Ht==null?void 0:Ht.currentIndex)===(as==null?void 0:as.currentIndex)?Ht:as)},[Ur]),Is=h.useCallback(()=>{ve.current!==null&&cancelAnimationFrame(ve.current),ve.current=requestAnimationFrame(()=>{ve.current=null,Yn()})},[Yn]);h.useEffect(()=>()=>{ve.current!==null&&(cancelAnimationFrame(ve.current),ve.current=null)},[]),h.useEffect(()=>{Is()},[Is,os,Ft,Ni,it.length,ee]);const[Wr,cr]=h.useState(null);h.useEffect(()=>{if(!Wr)return;const je=setTimeout(()=>cr(null),1600);return()=>clearTimeout(je)},[Wr]);const Gs=h.useCallback((je,lt)=>{var Nn,Lt;Nt.current=!0,Vt(!1),nt.current+=1;const Xt=nt.current;de.current=!0,Ni?$e.scrollToIndex(je,{align:"center"}):(Lt=(Nn=ft.current)==null?void 0:Nn.querySelector(`[data-index="${je}"]`))==null||Lt.scrollIntoView({block:"center"}),setTimeout(()=>{nt.current===Xt&&(de.current=!1,Is(),_e())},150),cr(null),requestAnimationFrame(()=>cr(lt))},[Ni,$e,Vt,Is,_e]),Qr=h.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Qr.current={visibleItems:Dt,displayItems:Z,headerOffset:Mr,performScrollToRow:Gs};const vr=h.useRef(null),xr=h.useCallback((je,lt)=>{const{visibleItems:Xt,displayItems:Nn,headerOffset:Lt,performScrollToRow:Be}=Qr.current,yn=Wj(Xt,je,lt);if(yn>=0)return vr.current=null,Be(yn+Lt,{messageId:je,callId:lt}),!0;const mr=Wj(Nn,je,lt);if(mr<0)return!1;const dr=Ehe(Nn,mr);return dr?(vr.current={messageId:je,callId:lt},St(as=>{if(as.get(dr)===!0)return as;const Ht=new Map(as);return Ht.set(dr,!0),Ht}),!0):!1},[]);h.useImperativeHandle(W,()=>({scrollToMessage:xr,scrollToBottom:xe}),[xr,xe]),h.useEffect(()=>{const je=vr.current;if(!je)return;const lt=Wj(Dt,je.messageId,je.callId);lt<0||(vr.current=null,Gs(lt+Mr,je))},[Dt,Mr,Gs]);const xs=h.useCallback(async(je=!1)=>{const lt=ft.current;if(!lt||!d||l||Ae.current||u||He.current&&!je)return;He.current=!1,Ae.current=!0,At(!je);const Xt=lt.scrollHeight,Nn=lt.scrollTop;Nt.current=!0;try{await d(),si({scrollHeight:Xt,scrollTop:Nn})}catch{He.current=!0,Ae.current=!1}finally{At(!1)}},[l,d,u]),nn=h.useCallback(()=>{const je=Ur();if(!je)return;const lt=je.scrollTop;if(o&&lt<=nK&&xs(!0),de.current){Je.current=lt;return}Is();const Xt=Je.current;Je.current=lt;const Nn=je.scrollHeight-lt-je.clientHeight;if(_e(),lt<Xt-1){const Lt=Nn<dC,Be=Date.now()<=gt.current;Lt?(Nt.current=!1,Vt(!0)):Be?(Gt(),Nt.current=!0,Vt(!1)):Nt.current||(Gt(),Vt(!1));return}Nn<dC?(Nt.current=!1,Vt(!0),_r()):Gt()},[Ur,o,xs,_e,Is,_r,Gt,Vt]);h.useEffect(()=>{const je=Ur();if(je)return je.addEventListener("scroll",nn,{passive:!0}),()=>je.removeEventListener("scroll",nn)},[Ur,nn]);const ks=h.useCallback(()=>{if(!o||l||i||hs)return;const je=Ur();if(!je||je.scrollHeight>je.clientHeight+1)return;const lt=Ns.current;if(lt!==null&&lt.loader===d&&lt.totalVirtualSize===Ft){He.current=!0;return}Ns.current={loader:d,totalVirtualSize:Ft},xs()},[i,Ur,o,xs,l,d,hs,Ft]);h.useEffect(()=>{ks()},[ks,Ft]),h.useEffect(()=>{const je=Ur();if(!je)return;const lt=()=>{He.current&&je.scrollTop<=nK&&xs(!0)},Xt=yn=>{wo(),yn.deltaY<0&&lt()},Nn=()=>{wo(),lt()},Lt=yn=>{const mr=je.getBoundingClientRect(),dr=20;(yn.clientX>=mr.right-dr||yn.clientY>=mr.bottom-dr)&&wo()},Be=yn=>{(yn.key==="ArrowUp"||yn.key==="ArrowDown"||yn.key==="PageUp"||yn.key==="PageDown"||yn.key==="Home"||yn.key==="End"||yn.key===" ")&&(wo(),(yn.key==="ArrowUp"||yn.key==="PageUp"||yn.key==="Home")&&lt())};return je.addEventListener("wheel",Xt,{passive:!0}),je.addEventListener("touchstart",Nn,{passive:!0}),je.addEventListener("pointerdown",Lt,{passive:!0}),je.addEventListener("keydown",Be,{passive:!0}),()=>{je.removeEventListener("wheel",Xt),je.removeEventListener("touchstart",Nn),je.removeEventListener("pointerdown",Lt),je.removeEventListener("keydown",Be)}},[Ur,xs,wo]),h.useEffect(()=>{const je=Ur();if(!je||typeof ResizeObserver>"u")return;const lt=new ResizeObserver(()=>{_e(),ks()});lt.observe(je);for(const Nn of Array.from(je.children))lt.observe(Nn);const Xt=new MutationObserver(Nn=>{for(const Lt of Nn){for(const Be of Array.from(Lt.addedNodes))Be instanceof HTMLElement&&lt.observe(Be);for(const Be of Array.from(Lt.removedNodes))Be instanceof HTMLElement&&lt.unobserve(Be)}_e()});return Xt.observe(je,{childList:!0}),_e(),()=>{lt.disconnect(),Xt.disconnect()}},[Ur,ks,_e]),h.useEffect(()=>{t.length===0&&(Nt.current=!1,Vt(!0),vr.current=null,St(je=>je.size?new Map:je))},[t.length,Vt]),h.useEffect(()=>{const je=ft.current;if(!je)return;const lt=new ResizeObserver(()=>{Is(),!Re.current&&(Nt.current||(Vt(!0),requestAnimationFrame(()=>{!Re.current&&!Nt.current&&ws()})))});return lt.observe(je),()=>lt.disconnect()},[ws,Is,Vt]),h.useLayoutEffect(()=>{const je=Got(t);if(i||s||Fe.current){Le.current=je,le.current=!0,dt.current=!1,Fe.current=s;return}if(Fe.current=s,!le.current){Le.current=je,le.current=!0,dt.current=!1;return}const lt=Kot(t);je&&(lt==null?void 0:lt.role)==="user"&&je!==Le.current?(Nt.current=!1,Vt(!0),vr.current=null,dt.current=!0):dt.current=!1,Le.current=je},[t,i,s,Vt]),h.useLayoutEffect(()=>{cn.current&&!i&&(Nt.current=!1,Vt(!0),ws("auto")),cn.current=i},[i,ws,Vt]),h.useLayoutEffect(()=>{if(s){Ge.current=!0;return}if(!Ge.current||i||t.length===0)return;Ge.current=!1,Nt.current=!1,Vt(!0),vr.current=null,un.current!==void 0&&window.cancelAnimationFrame(un.current),Wn.current!==void 0&&window.cancelAnimationFrame(Wn.current);const je=()=>{Re.current||Nt.current||(Vt(!0),ws("auto"))};un.current=window.requestAnimationFrame(()=>{un.current=void 0,je(),Wn.current=window.requestAnimationFrame(()=>{Wn.current=void 0,je()})})},[i,s,t.length,ws,Vt]),h.useLayoutEffect(()=>{const je=Me.current!==_;Me.current=_,je&&(i||Nt.current||(Vt(!0),requestAnimationFrame(()=>{!Re.current&&!Nt.current&&ws("auto")})))},[_,i,ws,Vt]);const Jr=h.useMemo(()=>pat(Dt),[Dt]);h.useLayoutEffect(()=>{if(!i){if(!Jr){yt.current=null;return}Jr!==yt.current&&(yt.current=Jr,(Et.current||!Nt.current)&&requestAnimationFrame(()=>{Nt.current||(Vt(!0),ws())}))}},[i,Jr,ws,Vt]),h.useEffect(()=>{T&&ds&&!et.current&&(Nt.current=!1,Vt(!0),requestAnimationFrame(()=>{Nt.current||ws()})),et.current=ds},[T,ds,ws,Vt]);const fn=h.useCallback(je=>{const lt=(Lt,Be)=>{if(Lt.type==="parallel_agents")return a.jsx(WN,{timestamp:Lt.timestamp,children:a.jsx("div",{className:tK(Lt,Wr)?e0.flash:void 0,children:a.jsx(not,{agents:Lt.agents,pendingApproval:n})})});if(Lt.type==="turn_outputs")return a.jsx(Ait,{changes:Lt.changes,turnId:Lt.turnId,artifacts:Lt.artifacts,scheduledTasks:Lt.scheduledTasks,workspaceCwd:v,onOpenRequest:F,onReviewChanges:Y??zj,onOpenArtifact:U??zj,onOpenScheduledTask:P??zj});if(Lt.type==="turn_collapse")return a.jsx(Lat,{turnCollapse:Lt.turnCollapse,onToggleCollapse:Do});const yn=Lt.message.role==="assistant"?We.get(Lt.message.id):void 0;let mr;return Lt.message.role==="assistant"&&yn&&(mr={turnId:yn,message:{id:Lt.message.id,content:Lt.message.content,isStreaming:Lt.message.isStreaming,timestamp:Lt.message.timestamp}}),a.jsx(Mst,{message:Lt.message,pendingApproval:n,onShowContextDetail:r,workspaceCwd:v,isLatest:Be,showRetryHint:D,onRetryClick:M,sendFailed:Lt.message.role==="user"&&Lt.message.id===R,onRetrySend:$,onBranchSession:B,showAssistantActions:Lt.message.role==="assistant"&&We.has(Lt.message.id),showAssistantBranch:Lt.message.role==="assistant"&&Lt.message.id===me,isLocateFlashing:tK(Lt,Wr),assistantTurnFooterInfo:mr,generateContent:te})};if(vs&&je===Vj)return w;if(ds&&je===ji)return x;const Xt=je-Mr,Nn=Dt[Xt];return Nn?lt(Nn,Xt===Dt.length-1):null},[vs,w,ds,x,ji,n,r,te,Mr,Dt,Wr,We,me,v,D,M,R,$,B,Do,U,P,Y,F]),Ks=h.useCallback(je=>je?Pat(je):void 0,[]);return h.useLayoutEffect(()=>{if(i)return;const je=dt.current;de.current&&!je||bt.current&&!je||(Et.current||je||!Nt.current)&&(Nt.current||Vt(!0),ws(je?"smooth":"auto"),dt.current=!1)},[Ft,t,os,i,ws,Vt]),h.useLayoutEffect(()=>{_e()},[t,_e,os,Ft]),a.jsxs("div",{ref:ft,className:fR(Lr.list,vs&&y?Lr.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:fs,children:[hs&&a.jsx(Fat,{label:K("editor.sessionLoading")}),l&&!hs&&!Fr&&a.jsx("div",{className:Lr.historyStatus,role:"status",children:K("history.loadingEarlier")}),c&&!hs&&a.jsx("div",{className:Lr.historyStatus,role:"status",children:K("history.capacityReached")}),u&&!hs&&!c&&a.jsx("div",{className:Lr.historyStatus,role:"status",children:K("history.paginationError")}),a.jsx(Bat,{entries:pe,currentTurnId:ae,currentRange:ye,hidden:!ee||!Vn,onSelect:xr}),Ni?a.jsx("div",{className:Lr.virtualSizer,style:{height:Ft},children:it.map(je=>a.jsx("div",{"data-index":je.index,ref:$e.measureElement,className:fR(Lr.virtualRow,Ks(Dt[je.index-Mr])),"data-message-row-key":String(di(je.index)),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${je.start}px)`},children:fn(je.index)},je.key))}):Array.from({length:os},(je,lt)=>{const Xt=di(lt),Nn=Dt[lt-Mr];return a.jsx("div",{"data-index":lt,className:Ks(Nn),"data-message-row-key":String(Xt),"data-web-shell-message-row":!0,children:fn(lt)},Xt)})]})}));function qat(e){var n;return(n=[typeof e.rawOutput=="string"?e.rawOutput:"",e.subContent??"",...(e.content??[]).map(r=>{var s;return((s=r.content)==null?void 0:s.text)??""})].join(`
`).match(/\bmon_[a-f0-9]{16}\b/i))==null?void 0:n[0]}function Nhe(e,t){const n=e.filter(i=>i.kind==="monitor"),r=n.find(i=>i.toolUseId===t.callId);if(r)return r;const s=qat(t);return s?n.find(i=>i.id===s&&i.toolUseId===void 0):void 0}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function Hat(e){const t=e.toLowerCase();return/^qwen3-asr-flash-realtime(?:-|$)/.test(t)||/^qwen3-asr-flash(?:-\d{4}-\d{2}-\d{2})?$/.test(t)||/^(fun-asr|paraformer).*realtime(?:-|$)/.test(t)}function Uat(e){const t=new Set,n=[];for(const r of(e==null?void 0:e.providers)??[])for(const s of r.models??[]){const i=s.baseModelId;!i||s.isRuntime||!Hat(i)||t.has(i)||(t.add(i),n.push({id:i,...s.name?{label:s.name}:{},...r.authType?{authType:r.authType}:{},...s.baseUrl?{baseUrl:s.baseUrl}:{},...typeof s.contextLimit=="number"?{contextWindow:s.contextLimit}:{},modalities:{audio:!0}}))}return n}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const Wat="voice_transcribe",Ihe="workspace_qualified_voice",Vat="workspace_qualified_rest_core",Gat="workspace_settings",Kat=new Set(["dynamic_workspace_registration","persistent_workspace_registration","scratch_workspace_registration","workspace_display_name","workspace_runtime_removal"]);function ZP(e){return JSON.stringify(e)}function Yat(e){return e.some(t=>Kat.has(t)||t.startsWith("multi_workspace_")||t.startsWith("workspace_qualified_"))}function Mhe(e,t){return{...e,...t?{sessionId:t}:{},ownerKey:ZP([e.workspaceKey,t?["session",t]:["draft"]])}}function Kj(e,t){return Mhe({route:"legacy-primary",...e?{cwd:e}:{},workspaceKey:ZP(["legacy-primary",e??null]),streamPath:"voice/stream"},t)}function Rhe({capabilities:e,intendedCwd:t,sessionId:n,workspaces:r}){var l;if(!e)return;const s=r??e.workspaces,i=((l=s==null?void 0:s.find(c=>c.primary))==null?void 0:l.cwd)??e.workspaceCwd,o=t??(n?void 0:i);if(s){if(!o)return;const c=s.filter(g=>g.cwd===o);if(c.length!==1)return;const u=c[0];if(u.primary)return Kj(u.cwd,n);if(!u.trusted)return;const d=u.id.trim()?u.id:void 0,m=d!==void 0&&s.filter(g=>g.id===d).length===1?{kind:"id",value:d}:{kind:"cwd",value:u.cwd},p=ZP(["workspace-qualified",m.kind,m.value,u.cwd]);return Mhe({route:"workspace-qualified",cwd:u.cwd,workspaceKey:p,selector:m,streamPath:`workspaces/${encodeURIComponent(m.value)}/voice/stream`},n)}if(e.workspaceCwd)return o!==e.workspaceCwd?void 0:Kj(e.workspaceCwd,n);if(!t&&!Yat(e.features))return Kj(void 0,n)}function Xat(e,t){return e?t.includes(e.route==="legacy-primary"?Wat:Ihe):!1}function hC(e,t){return e?e.route==="legacy-primary"?!0:[Ihe,Vat,Gat].every(n=>t.includes(n)):!1}function G6(e,t){if(t.route==="workspace-qualified")return t.selector.kind==="id"?e.workspaceById(t.selector.value):e.workspaceByCwd(t.selector.value)}async function Qat(e,t){const n=t.route==="legacy-primary"?await e.workspaceVoice():await G6(e,t).workspaceVoice();if(t.cwd&&n.workspaceCwd!==t.cwd)throw new Error("Voice status workspace does not match the selected target.");return n}async function Jat(e,t){const n=t.route==="legacy-primary"?await e.workspaceProviders():await G6(e,t).workspaceProviders();if(t.cwd&&n.workspaceCwd!==t.cwd)throw new Error("Voice provider workspace does not match the selected target.");return n}async function Zat(e,t){return t.route==="legacy-primary"?await e.workspaceSettings():await G6(e,t).workspaceSettings()}async function elt(e,t,n,r){return t.route==="workspace-qualified"&&n==="workspace"?await G6(e,t).setWorkspaceSetting("workspace","voiceModel",r):await e.setWorkspaceSetting(n,"voiceModel",r)}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function tlt(e,t,n,r){var p;const s=h.useRef(0),i=n&&(t==null?void 0:t.route)==="workspace-qualified"?t.ownerKey:void 0,o=i?JSON.stringify([i,r]):void 0,l=h.useRef(o);l.current=o;const[c,u]=h.useState({ownerKey:i,status:void 0}),d=h.useCallback(async()=>{const g=o;if(l.current!==g)return;const b=++s.current;if(!g||!i||!t||t.route!=="workspace-qualified"){u({ownerKey:i,status:void 0});return}u(w=>w.ownerKey===i?w:{ownerKey:i,status:void 0});try{const w=await Zat(e,t);return b===s.current&&l.current===g&&u({ownerKey:i,status:w}),w}catch{return}},[e,i,o,t]),f=h.useCallback(()=>{s.current++},[]);h.useEffect(()=>(d(),f),[f,d]);const m=c.ownerKey===i?c:void 0;return{descriptor:(p=m==null?void 0:m.status)==null?void 0:p.settings.find(g=>g.key==="voiceModel"),reload:d}}const Dhe="(prefers-reduced-motion: reduce)";function nlt(){return typeof window<"u"&&window.matchMedia(Dhe).matches}function eO(){const[e,t]=h.useState(nlt);return h.useEffect(()=>{const n=window.matchMedia(Dhe),r=()=>t(n.matches);return r(),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const rlt="_editorShell_1utqm_1",slt="_editorShellDropdownOpen_1utqm_7",ilt="_container_1utqm_11",olt="_content_1utqm_26",alt="_specularEffect_1utqm_42",llt="_atPortalLayer_1utqm_83",clt="_slashPanel_1utqm_111",ult="_slashPanelBody_1utqm_120",dlt="_slashList_1utqm_125",hlt="_slashEntry_1utqm_152",flt="_slashSection_1utqm_158",mlt="_slashSectionHeader_1utqm_164",plt="_slashSectionCount_1utqm_177",glt="_slashItem_1utqm_185",blt="_slashItemActive_1utqm_211",ylt="_slashCommand_1utqm_215",vlt="_slashDetail_1utqm_220",wlt="_slashDetailCommand_1utqm_230",xlt="_slashDetailText_1utqm_240",klt="_slashDescription_1utqm_260",_lt="_atPanel_1utqm_272",Slt="_atPanelHeaderWrap_1utqm_296",Clt="_atPanelHeader_1utqm_296",Tlt="_atBackButton_1utqm_311",Elt="_atPanelTitle_1utqm_333",Alt="_atTabsWrap_1utqm_342",jlt="_atTabs_1utqm_342",Nlt="_atTab_1utqm_342",Ilt="_atTabScrollButton_1utqm_366",Mlt="_atTabActive_1utqm_398",Rlt="_atSearchInput_1utqm_409",Dlt="_atList_1utqm_428",Llt="_atItem_1utqm_456",Plt="_atItemActive_1utqm_478",Olt="_atItemSingleLine_1utqm_482",$lt="_atItemMain_1utqm_488",Blt="_atItemLeading_1utqm_499",zlt="_atItemIcon_1utqm_509",Flt="_atItemImageIcon_1utqm_520",qlt="_atItemIconSpin_1utqm_528",Hlt="_atItemLabel_1utqm_532",Ult="_atItemSubtitle_1utqm_533",Wlt="_atItemDescription_1utqm_560",Vlt="_atItemTrailing_1utqm_571",Glt="_atEmpty_1utqm_578",Klt="_attachments_1utqm_584",Ylt="_tags_1utqm_594",Xlt="_tag_1utqm_594",Qlt="_tagContent_1utqm_617",Jlt="_tagTooltip_1utqm_625",Zlt="_tagLabel_1utqm_649",ect="_tagValue_1utqm_650",tct="_tagIcon_1utqm_654",nct="_tagRemove_1utqm_689",rct="_editorArea_1utqm_709",sct="_typewriterPlaceholder_1utqm_720",ict="_typewriterCaret_1utqm_733",oct="_typewriterCaretFinished_1utqm_743",act="_mobileTextarea_1utqm_751",lct="_shellPrefix_1utqm_801",cct="_toolbar_1utqm_871",uct="_toolbarLeading_1utqm_881",dct="_toolbarStart_1utqm_882",hct="_toolbarEnd_1utqm_883",fct="_toolbarLeft_1utqm_884",mct="_toolbarRight_1utqm_885",pct="_gitBranchChip_1utqm_918",gct="_gitBranchChipButton_1utqm_935",bct="_gitBranchIcon_1utqm_953",yct="_gitBranchText_1utqm_965",vct="_gitBranchIconWrap_1utqm_980",wct="_gitBranchBadgeDot_1utqm_988",xct="_gitBranchIndicators_1utqm_1007",kct="_gitBranchDirtyDot_1utqm_1014",_ct="_gitBranchAheadBehind_1utqm_1022",Sct="_gitBranchStash_1utqm_1027",Cct="_gitBranchConflicted_1utqm_1040",Tct="_gitBranchOperation_1utqm_1054",Ect="_gitBranchTooltip_1utqm_1062",Act="_gitBranchTooltipTitle_1utqm_1068",jct="_gitBranchTooltipRow_1utqm_1072",Nct="_workspaceChip_1utqm_1078",Ict="_workspaceChipAccented_1utqm_1097",Mct="_workspaceChipIcon_1utqm_1101",Rct="_workspaceChipText_1utqm_1117",Dct="_toolbarRightCustom_1utqm_1129",Lct="_toolbarMeasurements_1utqm_1135",Pct="_dropdownWrapper_1utqm_1146",Oct="_dropdownWrapperCompact_1utqm_1150",$ct="_dropdownList_1utqm_1155",Bct="_dropdownListConstrained_1utqm_1165",zct="_dropdownEmpty_1utqm_1169",Fct="_dropdownItem_1utqm_1176",qct="_dropdownRich_1utqm_1193",Hct="_dropdownCheck_1utqm_1202",Uct="_dropdownItemActive_1utqm_1214",Wct="_dropdownItemIcon_1utqm_1219",Vct="_dropdownItemCheck_1utqm_1220",Gct="_dropdownItemContent_1utqm_1237",Kct="_dropdownItemLabel_1utqm_1244",Yct="_dropdownItemDesc_1utqm_1254",Xct="_toolBtn_1utqm_1268",Qct="_modeToolBtn_1utqm_1286",Jct="_modelToolBtn_1utqm_1287",Zct="_workspaceSelectTrigger_1utqm_1296",eut="_gitBranchChipCompact_1utqm_1331",tut="_workspaceChipCompact_1utqm_1332",nut="_workspaceSelectTriggerCompact_1utqm_1333",rut="_toolBtnCompact_1utqm_1334",sut="_toolBtnText_1utqm_1354",iut="_toolBtnArrow_1utqm_1355",out="_toolBtnIcon_1utqm_1382",aut="_widthModeBtn_1utqm_1398",lut="_quickActionsBtn_1utqm_1407",cut="_toolBtnModeIcon_1utqm_1416",uut="_toolBtnModelIcon_1utqm_1417",dut="_quickActionsPanel_1utqm_1463",hut="_quickActionsHeader_1utqm_1476",fut="_quickActionsLayout_1utqm_1483",mut="_quickActionsGrid_1utqm_1490",put="_quickAction_1utqm_1407",gut="_quickActionLabel_1utqm_1521",but="_quickKeysGrid_1utqm_1536",yut="_quickKey_1utqm_1536",vut="_quickKeyLabel_1utqm_1565",wut="_sendBtn_1utqm_1578",xut="_sendBtnRunning_1utqm_1616",kut="_sendIcon_1utqm_1629",_ut="_stopIcon_1utqm_1635",Sut="_loadingIcon_1utqm_1642",Cut="_sendBtnArmed_1utqm_1654",Tut="_escLabel_1utqm_1722",Eut="_srOnly_1utqm_1730",Aut="_images_1utqm_1752",jut="_imageThumb_1utqm_1760",Nut="_imageRemove_1utqm_1775",Iut="_searchPanel_1utqm_1796",Mut="_searchBar_1utqm_1813",Rut="_searchLabel_1utqm_1821",Dut="_searchInput_1utqm_1826",Lut="_searchResults_1utqm_1840",Put="_searchResult_1utqm_1840",Out="_searchResultActive_1utqm_1873",$ut="_searchResultMarker_1utqm_1878",But="_searchResultText_1utqm_1883",zut="_searchEmpty_1utqm_1890",Te={editorShell:rlt,editorShellDropdownOpen:slt,container:ilt,content:olt,specularEffect:alt,atPortalLayer:llt,slashPanel:clt,slashPanelBody:ult,slashList:dlt,slashEntry:hlt,slashSection:flt,slashSectionHeader:mlt,slashSectionCount:plt,slashItem:glt,slashItemActive:blt,slashCommand:ylt,slashDetail:vlt,slashDetailCommand:wlt,slashDetailText:xlt,slashDescription:klt,atPanel:_lt,atPanelHeaderWrap:Slt,atPanelHeader:Clt,atBackButton:Tlt,atPanelTitle:Elt,atTabsWrap:Alt,atTabs:jlt,atTab:Nlt,atTabScrollButton:Ilt,atTabActive:Mlt,atSearchInput:Rlt,atList:Dlt,atItem:Llt,atItemActive:Plt,atItemSingleLine:Olt,atItemMain:$lt,atItemLeading:Blt,atItemIcon:zlt,atItemImageIcon:Flt,atItemIconSpin:qlt,atItemLabel:Hlt,atItemSubtitle:Ult,atItemDescription:Wlt,atItemTrailing:Vlt,atEmpty:Glt,attachments:Klt,tags:Ylt,tag:Xlt,tagContent:Qlt,tagTooltip:Jlt,tagLabel:Zlt,tagValue:ect,tagIcon:tct,tagRemove:nct,editorArea:rct,typewriterPlaceholder:sct,typewriterCaret:ict,typewriterCaretFinished:oct,mobileTextarea:act,shellPrefix:lct,toolbar:cct,toolbarLeading:uct,toolbarStart:dct,toolbarEnd:hct,toolbarLeft:fct,toolbarRight:mct,gitBranchChip:pct,gitBranchChipButton:gct,gitBranchIcon:bct,gitBranchText:yct,gitBranchIconWrap:vct,gitBranchBadgeDot:wct,gitBranchIndicators:xct,gitBranchDirtyDot:kct,gitBranchAheadBehind:_ct,gitBranchStash:Sct,gitBranchConflicted:Cct,gitBranchOperation:Tct,gitBranchTooltip:Ect,gitBranchTooltipTitle:Act,gitBranchTooltipRow:jct,workspaceChip:Nct,workspaceChipAccented:Ict,workspaceChipIcon:Mct,workspaceChipText:Rct,toolbarRightCustom:Dct,toolbarMeasurements:Lct,dropdownWrapper:Pct,dropdownWrapperCompact:Oct,dropdownList:$ct,dropdownListConstrained:Bct,dropdownEmpty:zct,dropdownItem:Fct,dropdownRich:qct,dropdownCheck:Hct,dropdownItemActive:Uct,dropdownItemIcon:Wct,dropdownItemCheck:Vct,dropdownItemContent:Gct,dropdownItemLabel:Kct,dropdownItemDesc:Yct,toolBtn:Xct,modeToolBtn:Qct,modelToolBtn:Jct,workspaceSelectTrigger:Zct,gitBranchChipCompact:eut,workspaceChipCompact:tut,workspaceSelectTriggerCompact:nut,toolBtnCompact:rut,toolBtnText:sut,toolBtnArrow:iut,toolBtnIcon:out,widthModeBtn:aut,quickActionsBtn:lut,toolBtnModeIcon:cut,toolBtnModelIcon:uut,quickActionsPanel:dut,quickActionsHeader:hut,quickActionsLayout:fut,quickActionsGrid:mut,quickAction:put,quickActionLabel:gut,quickKeysGrid:but,quickKey:yut,quickKeyLabel:vut,sendBtn:wut,sendBtnRunning:xut,sendIcon:kut,stopIcon:_ut,loadingIcon:Sut,sendBtnArmed:Cut,escLabel:Tut,srOnly:Eut,images:Aut,imageThumb:jut,imageRemove:Nut,searchPanel:Iut,searchBar:Mut,searchLabel:Rut,searchInput:Dut,searchResults:Lut,searchResult:Put,searchResultActive:Out,searchResultMarker:$ut,searchResultText:But,searchEmpty:zut},Fut=`#version 300 es
  in vec2 position;
  void main() {
    gl_Position = vec4(position, 0.0, 1.0);
  }
`,qut=`#version 300 es
  precision highp float;
  uniform vec2 center;
  uniform vec2 halfSize;
  uniform vec3 lineColor;
  uniform float radius;
  uniform float angle;
  uniform float intensity;
  uniform float px;
  uniform float shineSize;
  uniform float shineFade;
  uniform float thickness;
  out vec4 fragColor;

  float roundedRect(vec2 point) {
    vec2 edge = abs(point) - halfSize + radius;
    return length(max(edge, 0.0)) + min(max(edge.x, edge.y), 0.0) - radius;
  }

  float gaussianLine(float distanceToEdge, float sigma) {
    float normalized = distanceToEdge / (sigma + 0.000001);
    float falloff = mix(1.0, 1.6, smoothstep(0.0, 1.5, normalized));
    return exp(-falloff * normalized * normalized);
  }

  void main() {
    vec2 point = gl_FragCoord.xy - center;
    float distanceToEdge = roundedRect(point);
    vec2 light = vec2(cos(angle), sin(angle));
    vec2 normal = normalize(point / halfSize + 0.000001);
    float phi = acos(clamp(abs(dot(normal, light)), 0.0, 1.0));
    float rim = 1.0 - smoothstep(
      shineSize - shineFade,
      shineSize + shineFade + 0.0001,
      phi
    );
    float line = gaussianLine(distanceToEdge, thickness);
    float edgeClamp = 1.0 - smoothstep(
      0.5 * px,
      3.0 * px,
      abs(distanceToEdge)
    );
    float shine = line * rim * edgeClamp * intensity;
    fragColor = vec4(lineColor * shine, shine);
  }
`;function iK(e,t,n){const r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(e.deleteShader(r),null)):null}function Hut({targetRef:e}){const t=h.useRef(null),n=rm(),r=eO();return h.useEffect(()=>{var Z,ee,oe,we;const s=e.current,i=t.current;if(!s||!i||r)return;const o=document.createElement("canvas"),l=o.getContext("webgl2",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!l)return;const c=iK(l,l.VERTEX_SHADER,Fut),u=iK(l,l.FRAGMENT_SHADER,qut),d=l.createProgram();if(!c||!u||!d){c&&l.deleteShader(c),u&&l.deleteShader(u),d&&l.deleteProgram(d),(Z=l.getExtension("WEBGL_lose_context"))==null||Z.loseContext();return}if(l.attachShader(d,c),l.attachShader(d,u),l.linkProgram(d),!l.getProgramParameter(d,l.LINK_STATUS)){l.deleteProgram(d),l.deleteShader(c),l.deleteShader(u),(ee=l.getExtension("WEBGL_lose_context"))==null||ee.loseContext();return}const f=l.createBuffer();if(!f){l.deleteProgram(d),l.deleteShader(c),l.deleteShader(u),(oe=l.getExtension("WEBGL_lose_context"))==null||oe.loseContext();return}i.appendChild(o),l.bindBuffer(l.ARRAY_BUFFER,f),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),l.STATIC_DRAW);const m=l.getAttribLocation(d,"position");l.enableVertexAttribArray(m),l.vertexAttribPointer(m,2,l.FLOAT,!1,0,0),l.useProgram(d),l.enable(l.BLEND),l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA);const p=l.getUniformLocation(d,"center"),g=l.getUniformLocation(d,"halfSize"),b=l.getUniformLocation(d,"lineColor"),w=l.getUniformLocation(d,"radius"),y=l.getUniformLocation(d,"angle"),v=l.getUniformLocation(d,"intensity"),x=l.getUniformLocation(d,"px"),k=l.getUniformLocation(d,"shineSize"),S=l.getUniformLocation(d,"shineFade"),T=l.getUniformLocation(d,"thickness");let _=window.devicePixelRatio||1,C=1,j=1,E=12,L=null,D=2.4,M=2.4,R=0,$=0,B=!1,N=performance.now(),z=0,G=!1;const I=()=>{_=window.devicePixelRatio||1;const pe=s.getBoundingClientRect();C=pe.width,j=pe.height,E=Number.parseFloat(getComputedStyle(s).borderRadius)||12,o.width=Math.ceil((C+40)*_),o.height=Math.ceil((j+40)*_),l.viewport(0,0,o.width,o.height)},Y=pe=>{const he=s.querySelector("[data-web-shell-composer-editor]");return pe instanceof Node&&!!(he!=null&&he.contains(pe))},U=()=>{G||(G=!0,N=performance.now(),z=window.requestAnimationFrame(K))},P=pe=>{const he=s.getBoundingClientRect(),X=he.left+he.width/2,ye=he.top+he.height/2,Ce=Math.max(he.left-pe.clientX,0,pe.clientX-he.right),ae=Math.max(he.top-pe.clientY,0,pe.clientY-he.bottom),me=Math.hypot(Ce,ae);if(me===0){const Oe=(pe.clientX-X)/Math.max(he.width/2,1),Mt=(ye-pe.clientY)/Math.max(he.height/2,1);L=Math.atan2(2/he.height,-2/he.width)+Oe*.3+Mt*.15}else L=Math.atan2(ye-pe.clientY,pe.clientX-X);const We=Math.max(0,1-me/250);R=We*We*(3-2*We),U()},F=()=>{R=0,L=null},te=pe=>{Y(pe.target)&&(L=D,M=D,B=!0,U())},W=pe=>{Y(pe.target)&&!Y(pe.relatedTarget)&&(L=D,B=!1)},K=pe=>{const he=Math.min((pe-N)/1e3,.05);N=pe,B?M-=.85*he:M=D;const ye=(((B?M:L===null?D:L)-D+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI;if(D+=ye*(1-Math.exp(-he*7)),$+=((B?1.4:R)-$)*(1-Math.exp(-he*8)),$<.002&&!B&&R<.002){G=!1,z=0,l.clear(l.COLOR_BUFFER_BIT);return}l.uniform2f(p,(20+C/2)*_,(20+j/2)*_),l.uniform2f(g,C/2*_,j/2*_),l.uniform3f(b,n===Fs.Light?.2:.403922,n===Fs.Light?.360784:.521569,1),l.uniform1f(w,Math.min(E,j/2)*_),l.uniform1f(y,D),l.uniform1f(v,$),l.uniform1f(x,_),l.uniform1f(k,32*Math.PI/180),l.uniform1f(S,68*Math.PI/180),l.uniform1f(T,.5*_),l.clear(l.COLOR_BUFFER_BIT),l.drawArrays(l.TRIANGLES,0,3),z=window.requestAnimationFrame(K)},ce=new ResizeObserver(I);ce.observe(s),I(),window.addEventListener("pointermove",P,{passive:!0}),document.documentElement.addEventListener("pointerleave",F),s.addEventListener("focusin",te),s.addEventListener("focusout",W);const ie=document.activeElement;return B=ie!==null&&((we=s.querySelector("[data-web-shell-composer-editor]"))==null?void 0:we.contains(ie))===!0,U(),()=>{var pe;G=!1,window.cancelAnimationFrame(z),ce.disconnect(),window.removeEventListener("pointermove",P),document.documentElement.removeEventListener("pointerleave",F),s.removeEventListener("focusin",te),s.removeEventListener("focusout",W),o.remove(),l.deleteBuffer(f),l.deleteProgram(d),l.deleteShader(c),l.deleteShader(u),(pe=l.getExtension("WEBGL_lose_context"))==null||pe.loseContext()}},[r,e,n]),a.jsx("span",{ref:t,className:Te.specularEffect,"data-web-shell-composer-specular":!0,"data-theme":n,"aria-hidden":"true"})}const Uut=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function Wut({menu:e,anchorRef:t,panelRef:n,onSelect:r,onAccept:s,onBack:i,onSearch:o,onSelectTab:l}){const c=Gu(),{t:u}=rt(),d=h.useRef([]),f=h.useRef(null),m=h.useRef(null),[p,g]=h.useState(null),[b,w]=h.useState({});h.useEffect(()=>{var C;(C=d.current[e.selectedIndex])==null||C.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),h.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===f.current)return;const C=()=>{var L;return(L=f.current)==null?void 0:L.focus()},j=window.requestAnimationFrame(C),E=window.setTimeout(C,0);return()=>{window.cancelAnimationFrame(j),window.clearTimeout(E)}},[e.inputMode,e.level,e.selectedProviderId]),h.useLayoutEffect(()=>{const C=t.current;if(!C)return;const j=getComputedStyle(C);w(Object.fromEntries(Uut.map(E=>[E,j.getPropertyValue(E)])))},[t]),h.useLayoutEffect(()=>{const C=t.current;if(!C)return;let j=null;const E=()=>{var G;const M=C.getBoundingClientRect(),R=((G=n.current)==null?void 0:G.offsetWidth)??360,$=getComputedStyle(C),B=Number.parseFloat($.getPropertyValue("--web-shell-popover-safe-top"))||48,N=Math.max(96,Math.min(300,M.top-B-8)),z={left:Math.max(12,Math.min(M.left+16,window.innerWidth-R-12)),bottom:window.innerHeight-M.top+8,width:M.width,maxHeight:N};g(I=>I&&I.left===z.left&&I.bottom===z.bottom&&I.width===z.width&&I.maxHeight===z.maxHeight?I:z)},L=()=>{j===null&&(j=window.requestAnimationFrame(()=>{j=null,E()}))};E();const D=new ResizeObserver(L);return D.observe(C),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0),()=>{j!==null&&window.cancelAnimationFrame(j),D.disconnect(),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}},[t,n]);const y=e.level==="categories"?e.providers.map(C=>({id:C.id,label:C.label,labelTitle:C.textValue,description:C.description,trailing:"›",provider:C})):e.items.map(C=>({id:C.id,label:C.label,labelTitle:C.label,subtitle:C.subtitle,description:e.selectedProviderId===el?void 0:C.description??C.detail,icon:C.icon,iconMode:C.iconMode,iconColor:C.iconColor,iconSpin:C.iconSpin,iconTooltip:C.iconTooltip,trailing:C.kind==="directory"||C.kind==="mcp-server"?"›":"",item:C}));if(h.useEffect(()=>{d.current.length=y.length},[y.length]),!p)return null;const v=e.providers.find(C=>C.id===e.selectedProviderId),x=e.itemMode==="mcpResources"&&e.mcpServerName?ui(e.mcpServerName)??"[invalid]":(v==null?void 0:v.label)??"",k=e.itemMode==="mcpResources"&&e.mcpServerName?ui(e.mcpServerName)??"[invalid]":(v==null?void 0:v.textValue)??"",S=e.level==="items"?(v==null?void 0:v.textValue)??u("at.menu"):u("at.menu"),T="at-mention-listbox",_=e.selectedIndex>=0&&e.selectedIndex<y.length?`at-mention-option-${e.selectedIndex}`:void 0;return xd.createPortal(a.jsx("div",{className:Te.atPortalLayer,style:b,children:a.jsxs("div",{ref:n,className:Te.atPanel,"data-at-mention-panel":"true",style:{...b,left:p.left,bottom:p.bottom,"--at-anchor-width":`${p.width}px`,"--at-panel-max-height":`${p.maxHeight}px`},role:"region","aria-label":S,onMouseDown:C=>{C.target instanceof HTMLInputElement||C.preventDefault()},children:[e.level==="items"&&a.jsxs("div",{className:Te.atPanelHeaderWrap,children:[a.jsxs("div",{className:Te.atPanelHeader,children:[a.jsx("button",{type:"button",className:Te.atBackButton,"aria-label":u("common.back"),onMouseDown:C=>{C.preventDefault(),C.stopPropagation()},onClick:C=>{C.preventDefault(),C.stopPropagation(),i()},children:"‹"}),a.jsx("span",{className:Te.atPanelTitle,title:k,children:x})]}),a.jsx("input",{ref:f,className:Te.atSearchInput,value:e.query,placeholder:u("common.search"),"aria-label":u("common.search"),"aria-controls":T,"aria-activedescendant":_,onMouseDown:C=>C.stopPropagation(),onClick:C=>C.stopPropagation(),onChange:C=>o(C.currentTarget.value),onKeyDown:C=>{if(!(C.nativeEvent.isComposing||C.nativeEvent.keyCode===229)){if(C.key==="Escape")C.preventDefault(),C.stopPropagation(),i();else if(C.key==="Enter")C.preventDefault(),C.stopPropagation(),s();else if(C.key==="Tab"&&!C.shiftKey&&!C.altKey&&!C.ctrlKey&&!C.metaKey)C.preventDefault(),C.stopPropagation(),s();else if(C.key==="ArrowUp"){if(C.preventDefault(),C.stopPropagation(),y.length===0)return;r(Math.max(0,e.selectedIndex-1))}else if(C.key==="ArrowDown"){if(C.preventDefault(),C.stopPropagation(),y.length===0)return;r(Math.min(y.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&a.jsxs("div",{className:Te.atTabsWrap,children:[a.jsx("button",{type:"button",className:Te.atTabScrollButton,"aria-label":"Previous tab",onClick:C=>{C.preventDefault(),C.stopPropagation(),oK(m.current,"previous")},children:"‹"}),a.jsx("div",{ref:m,className:Te.atTabs,role:"tablist",children:e.tabs.map(C=>{const j=C.id===e.selectedTabId,E=C.textValue??(typeof C.label=="string"?C.label:C.id);return a.jsx("button",{type:"button",role:"tab","aria-selected":j,disabled:C.disabled,className:`${Te.atTab} ${j?Te.atTabActive:""}`,title:E,onClick:L=>{L.preventDefault(),L.stopPropagation(),l(C.id)},children:C.label},C.id)})}),a.jsx("button",{type:"button",className:Te.atTabScrollButton,"aria-label":"Next tab",onClick:C=>{C.preventDefault(),C.stopPropagation(),oK(m.current,"next")},children:"›"})]})]}),a.jsx("div",{id:T,className:Te.atList,role:y.length>0?"listbox":void 0,"aria-label":y.length>0?S:void 0,children:e.loading&&y.length===0?a.jsx("div",{className:Te.atEmpty,role:"status","aria-live":"polite",children:u("common.loading")}):y.length===0?a.jsx("div",{className:Te.atEmpty,role:"status","aria-live":"polite",children:u("common.noResults")}):y.map((C,j)=>{const E=j===e.selectedIndex,L="item"in C?v==null?void 0:v.provider:C.provider.provider;let D;if("item"in C&&(L!=null&&L.renderItem))try{D=L.renderItem({item:C.item,provider:L,selected:E})}catch(R){console.warn("[WebShell] at mention item render failed",R)}const M="icon"in C&&C.icon&&Cv(C.icon)?C.icon:void 0;return a.jsxs("button",{ref:R=>{d.current[j]=R},type:"button",id:`at-mention-option-${j}`,role:"option","aria-selected":E,className:`${Te.atItem} ${E?Te.atItemActive:""} ${C.description?"":Te.atItemSingleLine}`,style:{"--at-item-main-template":Vut(Gut(C.label,C.labelTitle),"subtitle"in C?C.subtitle:void 0)},onMouseEnter:()=>r(j),onMouseDown:R=>{R.preventDefault(),R.stopPropagation()},onClick:R=>{R.preventDefault(),R.stopPropagation(),s(j)},children:[D??a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:Te.atItemMain,children:[a.jsxs("span",{className:Te.atItemLeading,children:["icon"in C&&M&&(C.iconMode==="image"?a.jsx("img",{className:Te.atItemImageIcon,src:M,title:C.iconTooltip,alt:"","aria-hidden":"true"}):a.jsx("span",{className:`${Te.atItemIcon} ${C.iconSpin?Te.atItemIconSpin:""}`,style:{...ap("--at-item-icon-url",M),color:C.iconColor},title:C.iconTooltip,"aria-hidden":"true"})),a.jsx("span",{className:Te.atItemLabel,title:C.labelTitle,children:C.label})]}),"subtitle"in C&&C.subtitle&&a.jsx("span",{className:Te.atItemSubtitle,title:C.subtitle,children:C.subtitle})]}),C.description&&a.jsx("span",{className:Te.atItemDescription,title:C.description,children:C.description})]}),C.trailing&&a.jsx("span",{className:Te.atItemTrailing,"aria-hidden":"true",children:C.trailing})]},C.id)})})]})}),c??document.body)}function oK(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function Vut(e,t){if(!t)return"minmax(0, 1fr)";const n=aK(e);return aK(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function Gut(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function aK(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const Kut="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_46_02846'%3e%3crect%20x='-1.2000000476837158'%20y='-1.2000000476837158'%20width='18.40000009536743'%20height='18.40000009536743'%20rx='0'/%3e%3c/clipPath%3e%3cclipPath%20id='master_svg1_46_02850'%3e%3crect%20x='3.299999952316284'%20y='3.299999952316284'%20width='9.400000095367432'%20height='9.400000095367432'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_46_02846)'%3e%3cpath%20d='M2.40314639,2.758413L2.40292972,3.1950147L2.40178722,5.4973922L2.4000000999999997,8.3332543Q2.39999998,10.5420713,3.90192288,12.266657Q5.402200000000001,13.989353,8.1462374,14.904664L8.3362594,14.968048L8.526247999999999,14.904564Q11.2532721,13.993322,12.7668409,12.240547Q14.266665,10.5036879,14.266665,8.333632L14.266147,5.4975739L14.262505,2.7582424000000003L13.847304,2.6242929Q9.977867100000001,1.37595743,8.6663413,0.50089496L8.3334417,0.27878135000000004L8.0004754,0.5007948Q6.6891963,1.37512314,2.81864448,2.624314L2.40314639,2.758413ZM3.60271364,3.6308396L3.60178709,5.4979882L3.5999999000000003,8.3340111Q3.60000002,10.0927849,4.8068562,11.47856Q6.0415909,12.896347,8.3358369,13.701283Q10.6119351,12.899953,11.8586035,11.45626Q13.066666,10.0572739,13.066666,8.333632L13.066147,5.4977932L13.063664,3.6310089Q9.7833066,2.5506459,8.3332324,1.70592678Q6.8834386,2.5499707000000003,3.60271364,3.6308396Z'%20fill-rule='evenodd'%20fill='%230A0A0A'%20fill-opacity='1'/%3e%3cg%20clip-path='url(%23master_svg1_46_02850)'%3e%3cg%20transform='matrix(0,-0.9999712705612183,0.9999712705612183,0,-4.155969887971878,15.343589294701815)'%3e%3cpath%20d='M4.74521804,9.75L5.16948596,10.1742641L7.3436494,12.3484278L9.5178127,10.1742641L9.9420805,9.75L9.0935488,8.90146804L8.669284600000001,9.32573596L7.3436494,10.65137106L6.0180141,9.3257359L5.59375,8.90146804L4.74521804,9.75Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/g%3e%3cline%20x1='8.299999952316284'%20y1='9.587499976158142'%20x2='11.362499952316284'%20y2='9.587499976158142'%20fill-opacity='0'%20stroke-opacity='1'%20stroke='%230A0A0B'%20fill='none'%20stroke-width='1.2000000476837158'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Yut="/assets/default-aEtf0G7-.svg",Lhe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='13.101718187332153'%20height='12.118681192398071'%20viewBox='0%200%2013.101718187332153%2012.118681192398071'%3e%3cpath%20d='M3.728619923841858,11.142287023841858L11.844652023841858,3.025579823841858L12.268880023841858,2.6013156238418578L9.419035523841858,-0.24852800615814208L0.8780930338418579,8.292414323841857L-0.27773314615814204,12.298048023841858L3.728619923841858,11.142287023841858ZM10.571859023841858,2.6013509238418577L3.098784523841858,10.075047123841857L1.4777333738418579,10.542690823841857L1.945311323841858,8.922252323841859L9.419035523841858,1.448528053841858L10.571859023841858,2.6013509238418577ZM5.901715423841858,12.118684023841858L6.501718123841858,12.118682023841858L12.501718023841859,12.118682023841858L13.101720023841859,12.118684023841858L13.101720023841859,10.918678023841858L12.501718023841859,10.918681023841858L6.501718123841858,10.918682023841859L5.901715423841858,10.918678023841858L5.901715423841858,12.118684023841858Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/svg%3e",Xut="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_26_21323'%3e%3crect%20x='-0.6000000238418579'%20y='-0.6000000238418579'%20width='17.200000047683716'%20height='17.200000047683716'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_26_21323)'%3e%3cpath%20d='M6,2.484801532279053L5.5757358,2.9090694522790526L3.3333334,5.151471992279053L2.42426407,4.242402732279053L2,3.818134902279053L1.1514680400000001,4.666666892279053L1.57573596,5.090930892279053L3.3333334,6.848528392279053L6.424264,3.7575975622790527L6.8485317,3.3333334922790527L6,2.484801532279053ZM8.0666642,4.600002992279053L8.666667,4.600000192279053L14,4.600000292279053L14.600002,4.600002992279053L14.600002,3.3999974132790527L14,3.4000001552790526L8.666667499999999,3.4000001922790526L8.0666642,3.3999974132790527L8.0666642,4.600002992279053ZM8.0666642,8.600003292279052L8.666667,8.600000392279053L14,8.600000892279052L14.600002,8.600003292279052L14.600002,7.399997692279053L14,7.400000592279053L8.666667499999999,7.400000592279053L8.0666642,7.399997692279053L8.0666642,8.600003292279052ZM6,9.151468792279053L5.5757358,9.575736492279052L3.3333335,11.818139592279053L2.42426419,10.909069992279052L2,10.484801292279052L1.15146798,11.333333492279053L1.57573584,11.757597492279054L3.3333334,13.515196492279053L6.424264,10.424265392279054L6.8485317,10.000000492279053L6,9.151468792279053ZM8.0666642,12.600003692279053L8.666667,12.600000892279052L14,12.600000892279052L14.600002,12.600003692279053L14.600002,11.399997192279052L14,11.400000092279052L8.666667499999999,11.400001092279053L8.0666642,11.399997192279052L8.0666642,12.600003692279053Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",Qut="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='11.86667275428772'%20height='14.535494089126587'%20viewBox='0%200%2011.86667275428772%2014.535494089126587'%3e%3cpath%20d='M5.933441723841858,-0.12121862615814205L5.600475423841858,0.1007948238418579Q4.289196323841858,0.9751231638418579,0.4186445038418579,2.224314023841858L0.0031464138418578758,2.358413023841858L0.0017872438418579106,5.097392223841858L1.2384185787972513e-7,7.933254323841858Q3.8418579428878274e-9,10.142071323841858,1.5019229038418578,11.866657023841858Q3.002200023841858,13.589353023841857,5.746237423841858,14.504664023841858L5.936259423841858,14.568048023841857L6.126248023841858,14.504564023841858Q8.853272123841858,13.593322023841857,10.366840923841858,11.840547023841857Q11.866665023841858,10.103687923841857,11.866665023841858,7.933632023841858L11.866147023841858,5.097573923841858L11.862505023841859,2.3582424238418582L11.447304023841857,2.224292923841858Q7.577867123841858,0.9759574538418578,6.266341323841858,0.10089498384185791L5.933441723841858,-0.12121862615814205ZM5.933233823841858,1.3059267438418578Q4.483438623841858,2.149970723841858,1.202713663841858,3.2308396238418577L1.2017871138418579,5.097988223841858L1.199999923841858,7.934011123841858Q1.2000000438418579,9.692784923841858,2.406856223841858,11.078560023841858Q3.641590923841858,12.496347023841858,5.935836923841858,13.301283023841858Q8.211935123841858,12.499953023841858,9.458603523841857,11.056260023841858Q10.666666023841858,9.657273923841858,10.666666023841858,7.933632023841858L10.666147023841859,5.097793223841858L10.663664023841857,3.231008923841858Q7.383306623841858,2.150645923841858,5.933233823841858,1.3059267438418578ZM5.333330723841858,4.000322923841858L5.333333623841858,4.600325723841858L5.333333623841858,7.266992223841858L5.333330723841858,7.866995023841858L6.533336323841858,7.866995023841858L6.533333423841858,7.266992223841858L6.533333923841858,4.600325723841858L6.533336323841858,4.000322923841858L5.333330723841858,4.000322923841858ZM5.333330723841858,10.533662423841857L5.933333523841858,10.533659623841858L5.940000223841858,10.533659623841858L6.5400029238418576,10.533662423841857L6.5400029238418576,9.333655923841858L5.940000223841858,9.333658823841859L5.933333523841858,9.333659723841858L5.333330723841858,9.333655923841858L5.333330723841858,10.533662423841857Z'%20fill-rule='evenodd'%20fill='%230A0A0A'%20fill-opacity='1'/%3e%3c/svg%3e",Jut="_icon_i7y0u_1",Zut={icon:Jut},edt={auto:Kut,"auto-edit":Lhe,default:Yut,plan:Xut,yolo:Qut};function px({mode:e}){const t=edt[e];return t?a.jsx("span",{className:Zut.icon,style:ap("--mode-icon-url",t),"aria-hidden":"true"}):a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M6 18c.7-2.7 2.2-4 4.5-4H12M7 6h10M7 10h7M17.5 14.5l2 2-2 2",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function tdt(e,t){const n=new Map;if(t==="command")for(const s of e)s.section&&n.set(s.section,(n.get(s.section)??0)+1);let r;return e.map((s,i)=>{const o=s.section,l=t==="command"&&o!==void 0&&o!==r,c=l&&i>0;return r=o??r,{showHeader:l,showDivider:c,count:l&&o?n.get(o)??0:0}})}function lp(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const E4=16e3,ndt=4096,Phe=6e4,lK=6e4,rdt=E4*Int16Array.BYTES_PER_ELEMENT*(Phe/1e3);function sdt(e,t){const n=new URL(e),r=n.pathname.replace(/\/?$/,"/"),s=new URL(t.replace(/^\/+/,""),`${n.origin}${r}`);return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}const idt="qwen-bearer.",odt="qwen-ws";function adt(e){const t=new TextEncoder().encode(e);let n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);const r=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${idt}${r}`}function ldt(e){switch(e==null?void 0:e.name){case"NotAllowedError":case"SecurityError":return"Microphone blocked. Click the camera/lock icon in the address bar to allow the mic for this site, and enable your browser under System Settings → Privacy → Microphone, then retry.";case"NotFoundError":case"DevicesNotFoundError":case"OverconstrainedError":return"No microphone found. Connect one and retry.";case"NotReadableError":case"TrackStartError":return"Microphone is in use by another app. Close it and retry.";default:return e instanceof Error?e.message:String(e)}}function cdt(e){const t=new Int16Array(e.length);let n=0;for(let r=0;r<e.length;r++){let s=e[r];s>1?s=1:s<-1&&(s=-1),t[r]=s<0?s*32768:s*32767,n+=s*s}return{pcm:t.buffer,level:e.length?Math.sqrt(n/e.length):0}}function udt({baseUrl:e,token:t,target:n,onFinal:r,onError:s,onUnexpectedClose:i}){const[o,l]=h.useState("idle"),[c,u]=h.useState(""),[d,f]=h.useState(0),[m,p]=h.useState(),g=h.useRef({}),b=h.useRef(!0),w=h.useRef(0),y=h.useRef(!1),v=h.useRef("idle"),x=h.useRef(void 0),k=h.useCallback(N=>{v.current=N,l(N)},[]),S=h.useCallback(()=>{const N=g.current;N.transcribeTimeout&&(clearTimeout(N.transcribeTimeout),N.transcribeTimeout=void 0)},[]),T=h.useCallback(()=>{var z;const N=g.current;N.processor&&(N.processor.onaudioprocess=null);for(const G of[N.processor,N.source,N.sink])try{G==null||G.disconnect()}catch{}(z=N.stream)==null||z.getTracks().forEach(G=>G.stop()),N.context&&N.context.state!=="closed"&&N.context.close().catch(()=>{}),N.processor=void 0,N.source=void 0,N.sink=void 0,N.stream=void 0,N.context=void 0},[]),_=h.useCallback(()=>{w.current++,x.current=void 0,y.current=!1,T(),S();const N=g.current;if(N.ws){try{N.ws.onopen=null,N.ws.onmessage=null,N.ws.onerror=null,N.ws.onclose=null,N.ws.close()}catch{}N.ws=void 0}},[S,T]),C=h.useCallback(N=>b.current&&w.current===N.generation&&x.current===N,[]),j=h.useCallback((N,z)=>{var G;C(z)&&(_(),b.current&&(k("error"),u(""),f(0),p(N),(G=z.onError)==null||G.call(z,N)))},[k,_,C]),E=h.useCallback((N,z)=>{C(z)&&(_(),b.current&&(k("idle"),u(""),f(0),z.onFinal(N)))},[k,_,C]),L=h.useCallback(()=>{var z;const N=g.current;if(((z=N.ws)==null?void 0:z.readyState)===WebSocket.OPEN)try{N.ws.send(JSON.stringify({type:"abort"}))}catch{}_(),b.current&&(k("idle"),u(""),f(0),p(void 0))},[k,_]),D=h.useCallback((N,z)=>{T(),f(0),k("transcribing");try{N.send(JSON.stringify({type:"stop"})),S(),g.current.transcribeTimeout=setTimeout(()=>{C(z)&&v.current==="transcribing"&&j("Transcription timed out.",z)},lK)}catch{j("Failed to finalize voice transcription.",z)}},[k,S,j,C,T]),M=n?JSON.stringify([n.ownerKey,n.streamPath]):void 0,R=h.useRef(M);h.useLayoutEffect(()=>{R.current!==M&&(R.current=M,x.current?L():(k("idle"),u(""),f(0),p(void 0)))},[L,k,M]);const $=h.useCallback(()=>{var I;if(!n||v.current!=="idle"&&v.current!=="error")return;p(void 0),u(""),k("connecting");const N={generation:++w.current,ownerKey:n.ownerKey,streamPath:n.streamPath,onFinal:r,...s?{onError:s}:{},...i?{onUnexpectedClose:i}:{}};if(x.current=N,!((I=navigator.mediaDevices)!=null&&I.getUserMedia)){j(window.isSecureContext?"Microphone capture is not supported in this browser.":"Microphone needs a secure context — open the Web Shell via localhost/127.0.0.1 or https.",N);return}let z,G;try{if(z=new AudioContext({sampleRate:E4}),g.current.context=z,z.sampleRate!==E4)throw new Error(`Browser audio rate ${z.sampleRate} Hz is not the required ${E4} Hz.`);G=z.state==="suspended"?z.resume():Promise.resolve()}catch(Y){j(Y instanceof Error?Y.message:String(Y),N);return}S(),g.current.transcribeTimeout=setTimeout(()=>{C(N)&&v.current==="connecting"&&j("Voice capture timed out while starting.",N)},Phe),(async()=>{try{const Y=navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}).then(Z=>(C(N)?g.current.stream=Z:Z.getTracks().forEach(ee=>ee.stop()),Z),Z=>{throw new Error(ldt(Z))}),[U]=await Promise.all([Y,G]);if(!C(N))return;const P=z.createMediaStreamSource(U),F=z.createScriptProcessor(ndt,1,1),te=z.createGain();te.gain.value=0,g.current.source=P,g.current.processor=F,g.current.sink=te;const W=new WebSocket(sdt(e,N.streamPath),t?[odt,adt(t)]:void 0);W.binaryType="arraybuffer",g.current.ws=W;const K=[];let ce=0,ie=!1;F.onaudioprocess=Z=>{if(!C(N))return;const{pcm:ee,level:oe}=cdt(Z.inputBuffer.getChannelData(0));if(f(oe),ie)W.readyState===WebSocket.OPEN&&W.send(ee);else{if(ce+ee.byteLength>rdt){j("Voice capture buffer limit reached while starting.",N);return}K.push(ee),ce+=ee.byteLength}},y.current||(P.connect(F),F.connect(te),te.connect(z.destination)),W.onopen=()=>{if(!C(N)){try{W.close()}catch{}return}W.send(JSON.stringify({type:"start"})),ie=!0;for(const Z of K)W.send(Z);if(K.length=0,ce=0,S(),y.current){y.current=!1,D(W,N);return}g.current.transcribeTimeout=setTimeout(()=>{C(N)&&v.current==="recording"&&j("No response from server. Check that the voice model is running.",N)},lK),k("recording")},W.onmessage=Z=>{if(!C(N))return;(v.current==="connecting"||v.current==="recording")&&S();let ee;try{ee=JSON.parse(String(Z.data))}catch{return}ee.type==="interim"?u(ee.text??""):ee.type==="final"?E(ee.text??"",N):ee.type==="error"&&j(ee.message??ee.text??"Voice transcription failed.",N)},W.onerror=()=>{},W.onclose=Z=>{var we;if(!C(N)||!(v.current==="recording"||v.current==="connecting"||v.current==="transcribing"))return;const ee=Z.code||1006,oe=Z.reason||"none";try{(we=N.onUnexpectedClose)==null||we.call(N,{code:ee,reason:oe})}catch{}j(ee===1013?oe==="none"?"Voice capacity is temporarily unavailable. Retry shortly.":oe:`Voice connection closed (code=${ee}, reason=${oe}).`,N)}}catch(Y){j(Y instanceof Error?Y.message:String(Y),N)}})()},[k,e,S,j,D,E,s,r,i,C,n,t]),B=h.useCallback(()=>{const N=x.current,z=g.current.ws;if(!N||!z||z.readyState!==WebSocket.OPEN){if(N&&v.current==="connecting"){g.current.processor&&T(),y.current=!0,S();return}L();return}v.current!=="transcribing"&&D(z,N)},[L,S,D,T]);return h.useEffect(()=>(b.current=!0,()=>{b.current=!1,_()}),[_]),{status:o,interimText:c,audioLevel:d,errorMessage:m,start:$,stop:B,abort:L}}const ddt="_root_9hwm9_7",hdt="_iconBtn_9hwm9_14",fdt="_error_9hwm9_47",mdt="_connecting_9hwm9_51",pdt="_pill_9hwm9_56",gdt="_transcribing_9hwm9_75",bdt="_recDot_9hwm9_79",ydt="_wave_9hwm9_88",vdt="_bar_9hwm9_95",wdt="_time_9hwm9_103",xdt="_stop_9hwm9_111",kdt="_spinner_9hwm9_118",_dt="_interim_9hwm9_128",yl={root:ddt,iconBtn:hdt,error:fdt,connecting:mdt,pill:pdt,transcribing:gdt,recDot:bdt,wave:ydt,bar:vdt,time:wdt,stop:xdt,spinner:kdt,interim:_dt},cK=16,Sdt=2e3,Cdt=()=>a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[a.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),a.jsx("path",{d:"M17 11a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2Z"})]}),Tdt=()=>a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function Edt(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=String(t%60).padStart(2,"0");return`${n}:${r}`}function Adt({onInsert:e,onActiveChange:t,disabled:n,target:r,statusRevision:s={user:0,workspace:0}}){var ye;const i=yo(),o=qa(),l=Nh(),{t:c}=rt(),u=((ye=i.capabilities)==null?void 0:ye.features)??[],d=Xat(r,u),f=r!=null&&r.sessionId&&r.sessionId===o.sessionId&&(!r.cwd||r.cwd===o.workspaceCwd)?l==null?void 0:l.settingsVersion:void 0,[m,p]=h.useState(0),[g,b]=h.useState(!1),w=h.useMemo(()=>r?JSON.stringify([r.workspaceKey,r.ownerKey,f??null,s.user,s.workspace,m]):void 0,[m,f,s.user,s.workspace,r]),[y,v]=h.useState(()=>({queryKey:w,enabled:!1,mode:"hold"})),x=h.useRef(null),k=h.useRef(r);k.current=r;const S=h.useRef(0),T=h.useRef(0),_=h.useRef(!1);h.useEffect(()=>(_.current=!0,()=>{_.current=!1,T.current+=1}),[]),h.useEffect(()=>{const Ce=++S.current,ae=k.current;let me=!0;if(v({queryKey:w,enabled:!1,mode:"hold"}),!(!ae||!w||!d||g))return Qat(i.client,ae).then(We=>{me&&S.current===Ce&&v({queryKey:w,enabled:We.enabled===!0,mode:We.mode})}).catch(We=>{console.warn("[web-shell] Voice status probe failed:",We)}),()=>{me=!1}},[g,d,w,i.client]);const C=d&&!g&&y.queryKey===w&&y.enabled,[j,E]=h.useState(void 0);h.useEffect(()=>{if(!j)return;const Ce=window.setTimeout(()=>E(void 0),Sdt);return()=>window.clearTimeout(Ce)},[j]);const{status:L,interimText:D,audioLevel:M,errorMessage:R,start:$,stop:B,abort:N}=udt({baseUrl:i.baseUrl,token:i.token,target:r?{ownerKey:r.ownerKey,streamPath:r.streamPath}:void 0,onFinal:Ce=>{const ae=Ce.trim();ae?(E(void 0),e(ae)):E(c("voice.noSpeech"))},onUnexpectedClose:({code:Ce})=>{var Oe,Mt;if(Ce===1013||(p($t=>$t+1),Ce!==1012))return;const ae=(Oe=k.current)==null?void 0:Oe.ownerKey,me=++T.current;b(!0);const We=()=>{var $t;!_.current||T.current!==me||(($t=k.current)==null?void 0:$t.ownerKey)!==ae||(b(!1),p(St=>St+1))};try{const $t=(Mt=i.refreshCapabilities)==null?void 0:Mt.call(i);$t?$t.then(We,We):We()}catch{We()}}}),z=L==="connecting"||L==="recording"||L==="transcribing",G=L==="recording";h.useEffect(()=>{t==null||t(z)},[z,t]),h.useEffect(()=>()=>{t==null||t(!1)},[t]);const[I,Y]=h.useState(()=>new Array(cK).fill(0));h.useEffect(()=>{if(!G){Y(new Array(cK).fill(0));return}Y(Ce=>[...Ce.slice(1),Math.min(1,M*8)])},[M,G]);const[U,P]=h.useState(0);h.useEffect(()=>{if(!G){P(0);return}const Ce=performance.now(),ae=setInterval(()=>P(performance.now()-Ce),200);return()=>clearInterval(ae)},[G]),h.useLayoutEffect(()=>{!C&&(L==="recording"||L==="connecting"||L==="transcribing")&&N()},[N,L,C]);const F=h.useRef(r==null?void 0:r.ownerKey);if(h.useLayoutEffect(()=>{F.current!==(r==null?void 0:r.ownerKey)&&(F.current=r==null?void 0:r.ownerKey,T.current+=1,E(void 0),b(!1))},[r==null?void 0:r.ownerKey]),!C)return null;const te=L==="connecting",W=L==="transcribing",K=L==="error",ce=!!j&&!K,ie=G||te,Z=Ce=>{y.mode==="hold"&&Ce.detail!==0||(G?B():te?N():n||(E(void 0),$()))},ee=Ce=>{if(!(y.mode!=="hold"||Ce.button!==0||n||te||G)){Ce.preventDefault(),x.current=Ce.pointerId;try{Ce.currentTarget.setPointerCapture(Ce.pointerId)}catch{}E(void 0),$()}},oe=Ce=>{y.mode!=="hold"||x.current!==Ce.pointerId||(x.current=null,(te||G)&&B())},we=Ce=>{y.mode!=="hold"||x.current!==Ce.pointerId||(x.current=null,(te||G)&&N())},pe=G?c("voice.stopDictation"):W?c("voice.transcribing"):te?c("voice.starting"):K?c("voice.errorRetry",{message:R??""}):c(ce?"voice.noSpeechRetry":"voice.startDictation");let he;if(G)he=a.jsxs("button",{type:"button",className:yl.pill,onClick:Z,onPointerDown:ee,onPointerUp:oe,onPointerCancel:we,"aria-label":pe,title:pe,children:[a.jsx("span",{className:yl.recDot,"aria-hidden":"true"}),a.jsx("span",{className:yl.wave,"aria-hidden":"true",children:I.map((Ce,ae)=>a.jsx("span",{className:yl.bar,style:{height:`${2+Math.round(Ce*14)}px`}},ae))}),a.jsx("span",{className:yl.time,children:Edt(U)}),a.jsx("span",{className:yl.stop,"aria-hidden":"true",children:a.jsx(Tdt,{})})]});else if(W)he=a.jsxs("span",{className:`${yl.pill} ${yl.transcribing}`,role:"status","aria-label":pe,children:[a.jsx("span",{className:yl.spinner,"aria-hidden":"true"}),a.jsx("span",{className:yl.time,children:"…"})]});else{const Ce=[yl.iconBtn,K?yl.error:"",te?yl.connecting:""].filter(Boolean).join(" ");he=a.jsx("button",{type:"button",className:Ce,onClick:Z,onPointerDown:ee,onPointerUp:oe,onPointerCancel:we,disabled:!!n&&!ie,"aria-label":pe,title:R??j??pe,children:a.jsx(Cdt,{})})}const X=G&&D||K||ce;return a.jsxs("span",{className:yl.root,children:[he,X&&a.jsx("span",{role:"status","aria-live":"polite",className:`${yl.interim}${K?` ${yl.error}`:""}`,children:K?R||c("voice.error"):ce?j:D})]})}function jdt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[a.jsx("circle",{cx:"6",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("circle",{cx:"18",cy:"6",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("circle",{cx:"6",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M6 7.5v9M8.5 12h3.25A6.25 6.25 0 0 0 18 5.75",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function tO(e){const t=(e==null?void 0:e.staged)??0,n=(e==null?void 0:e.unstaged)??0,r=(e==null?void 0:e.untracked)??0,s=(e==null?void 0:e.conflicted)??0;return{detached:(e==null?void 0:e.detached)??!1,staged:t,unstaged:n,untracked:r,conflicted:s,ahead:(e==null?void 0:e.ahead)??0,behind:(e==null?void 0:e.behind)??0,stashCount:(e==null?void 0:e.stashCount)??0,operation:e==null?void 0:e.operation,dirty:t+n+r+s>0}}function Ndt(e){return e.conflicted>0?"error":e.operation||e.detached?"warning":e.dirty?"accent":null}function Ohe(e,t){const n=[];return e.operation&&n.push(t(`git.operation.${e.operation}`)),e.detached&&n.push(t("git.detached")),e.conflicted>0&&n.push(t("git.conflicted",{count:e.conflicted})),e.staged>0&&n.push(t("git.staged",{count:e.staged})),e.unstaged>0&&n.push(t("git.unstaged",{count:e.unstaged})),e.untracked>0&&n.push(t("git.untracked",{count:e.untracked})),e.ahead>0&&n.push(t("git.ahead",{count:e.ahead})),e.behind>0&&n.push(t("git.behind",{count:e.behind})),e.stashCount>0&&n.push(t("git.stash",{count:e.stashCount})),n}function $he(e,t,n){const r=Ohe(tO(t),n);return r.length>0?`${n("git.currentBranch",{branch:e})} — ${r.join(", ")}`:(t==null?void 0:t.computedAt)!==void 0?`${n("git.currentBranch",{branch:e})} — ${n("git.clean")}`:n("git.currentBranch",{branch:e})}function mR({branch:e,status:t,compact:n,worktree:r=!1}){const{t:s}=rt(),i=tO(t),o=Ndt(i);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:Te.gitBranchIconWrap,children:[a.jsx("span",{className:Te.gitBranchIcon,children:r?a.jsx(pT,{size:14,strokeWidth:1.5}):i.detached?a.jsx(hee,{}):a.jsx(jdt,{})}),n&&o&&a.jsx("span",{className:Te.gitBranchBadgeDot,"data-tone":o,"aria-hidden":"true"})]}),a.jsx("span",{className:Te.gitBranchText,children:e}),!n&&a.jsxs("span",{className:Te.gitBranchIndicators,"aria-hidden":"true",children:[i.operation&&a.jsx("span",{className:Te.gitBranchOperation,children:s(`git.operation.${i.operation}`)}),i.conflicted>0&&a.jsxs("span",{className:Te.gitBranchConflicted,children:[a.jsx(P_e,{}),i.conflicted]}),i.dirty&&a.jsx("span",{className:Te.gitBranchDirtyDot}),i.ahead>0&&a.jsxs("span",{className:Te.gitBranchAheadBehind,children:["↑",i.ahead]}),i.behind>0&&a.jsxs("span",{className:Te.gitBranchAheadBehind,children:["↓",i.behind]}),i.stashCount>0&&a.jsxs("span",{className:Te.gitBranchStash,children:[a.jsx(Ike,{}),i.stashCount]})]})]})}function Bhe({branch:e,status:t,compact:n=!1,onOpenDiff:r,worktree:s=!1}){const{t:i}=rt(),o=tO(t),l=Ohe(o,i),c=$he(e,t,i),u=`${Te.gitBranchChip} ${n?Te.gitBranchChipCompact:""} ${r?Te.gitBranchChipButton:""}`,d={"data-web-shell-git-branch":!0,"data-detached":o.detached?"true":void 0,"data-dirty":o.dirty?"true":void 0,"data-operation":o.operation??void 0,"data-clickable":r?"true":void 0,"data-worktree":s?"true":void 0},f=a.jsx(mR,{branch:e,status:t,compact:n,worktree:s});return a.jsx(Cd,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:r?a.jsx("button",{type:"button",className:u,"aria-label":c,onClick:r,...d,children:f}):a.jsx("output",{className:u,"aria-label":c,...d,children:f})}),a.jsx(Uu,{side:"top",children:a.jsxs("div",{className:Te.gitBranchTooltip,children:[a.jsx("div",{className:Te.gitBranchTooltipTitle,children:o.detached?`${i("git.detached")} (${e})`:e}),l.length>0?l.map(m=>a.jsx("div",{className:Te.gitBranchTooltipRow,children:m},m)):(t==null?void 0:t.computedAt)!==void 0?a.jsx("div",{className:Te.gitBranchTooltipRow,children:i("git.clean")}):null]})})]})})}const Idt="_wrap_11orh_1",Mdt="_chip_11orh_8",Rdt="_chipBranch_11orh_34",Ddt="_chipWorktree_11orh_44",Ldt="_chipCompact_11orh_54",Pdt="_chipIcon_11orh_57",Odt="_chipText_11orh_66",$dt="_chevron_11orh_71",Bdt="_chevronOpen_11orh_78",zdt="_clearBtn_11orh_82",Fdt="_popover_11orh_104",qdt="_header_11orh_110",Hdt="_option_11orh_120",Udt="_optionSelected_11orh_140",Wdt="_optionIcon_11orh_144",Vdt="_iconCurrent_11orh_159",Gdt="_iconBranch_11orh_164",Kdt="_iconWorktree_11orh_169",Ydt="_optionText_11orh_175",Xdt="_optionName_11orh_183",Qdt="_optionDesc_11orh_187",Jdt="_checkCurrent_11orh_193",Zdt="_checkBranch_11orh_194",eht="_checkWorktree_11orh_195",tht="_branchBox_11orh_213",nht="_branchRow_11orh_220",rht="_branchLabel_11orh_225",sht="_branchInputWrap_11orh_231",iht="_branchInput_11orh_231",oht="_branchInputInvalid_11orh_257",aht="_branchInputValid_11orh_261",lht="_branchStatus_11orh_266",cht="_branchHint_11orh_274",uht="_branchHintError_11orh_280",dht="_footer_11orh_285",hht="_cmd_11orh_294",fht="_confirmBranch_11orh_304",mht="_confirmWorktree_11orh_305",lr={wrap:Idt,chip:Mdt,chipBranch:Rdt,chipWorktree:Ddt,chipCompact:Ldt,chipIcon:Pdt,chipText:Odt,chevron:$dt,chevronOpen:Bdt,clearBtn:zdt,popover:Fdt,header:qdt,option:Hdt,optionSelected:Udt,optionIcon:Wdt,iconCurrent:Vdt,iconBranch:Gdt,iconWorktree:Kdt,optionText:Ydt,optionName:Xdt,optionDesc:Qdt,checkCurrent:Jdt,checkBranch:Zdt,checkWorktree:eht,branchBox:tht,branchRow:nht,branchLabel:rht,branchInputWrap:sht,branchInput:iht,branchInputInvalid:oht,branchInputValid:aht,branchStatus:lht,branchHint:cht,branchHintError:uht,footer:dht,cmd:hht,confirmBranch:fht,confirmWorktree:mht},pht=1e3,ght=200,uK=new TextEncoder;function pR(e){return e?!(/[^\p{L}\p{N}._/-]/u.test(e)||e.includes("..")||e.includes("//")||e.startsWith(".")||e.startsWith("-")||e.startsWith("/")||e.endsWith("/")||e.endsWith(".")||e.endsWith(".git")||e.includes("@{")||e.split("/").some(t=>t.startsWith(".")||t.endsWith(".lock"))||e.toUpperCase()==="HEAD"||uK.encode(e).length>pht||e.split("/").some(t=>uK.encode(t).length>ght)):!1}function bht({branch:e,compact:t=!1,intent:n,onIntentChange:r}){const{t:s}=rt(),[i,o]=h.useState(!1),[l,c]=h.useState(n.mode),[u,d]=h.useState(n.mode==="branch"?n.name:""),f=h.useRef(null),m=h.useMemo(()=>pR(u),[u]),p=h.useCallback(S=>{o(S),S&&(c(n.mode),d(n.mode==="branch"?n.name:""))},[n]),g=h.useCallback(()=>{r({mode:"current"}),o(!1)},[r]),b=h.useCallback(()=>{!u||!m||(r({mode:"branch",name:u}),o(!1))},[u,m,r]),w=h.useCallback(()=>{r({mode:"worktree"}),o(!1)},[r]),y=h.useCallback(S=>{S.stopPropagation(),r({mode:"current"}),o(!1)},[r]),v=n.mode==="branch",x=n.mode==="worktree",k=v?`→ ${n.name}`:x?s("gitMode.worktree"):e;return a.jsxs("span",{className:lr.wrap,children:[a.jsxs(Kf,{open:i,onOpenChange:p,children:[a.jsx(Wp,{asChild:!0,children:a.jsxs("button",{type:"button",className:`${lr.chip} ${v?lr.chipBranch:""} ${x?lr.chipWorktree:""} ${t?lr.chipCompact:""}`,"data-web-shell-git-branch":!0,"data-testid":"git-mode-chip","aria-label":`${s("gitMode.title")}: ${k}`,children:[a.jsx("span",{className:lr.chipIcon,children:x?a.jsx(pT,{size:14,strokeWidth:1.5}):a.jsx(ky,{size:15,strokeWidth:1.5})}),!t&&a.jsx("span",{className:lr.chipText,children:k}),a.jsx("svg",{className:`${lr.chevron} ${i?lr.chevronOpen:""}`,viewBox:"0 0 16 16",fill:"currentColor",width:9,height:9,"aria-hidden":"true",children:a.jsx("path",{d:"M4.427 7.427l3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"})})]})}),a.jsxs(Yf,{ref:f,side:"top",align:"end",sideOffset:8,className:lr.popover,onClick:S=>S.stopPropagation(),onOpenAutoFocus:S=>S.preventDefault(),onInteractOutside:S=>{var T;(T=f.current)!=null&&T.contains(S.target)&&S.preventDefault()},children:[a.jsx("div",{className:lr.header,children:s("gitMode.title")}),a.jsxs("button",{type:"button",role:"radio","aria-checked":l==="current",className:`${lr.option} ${l==="current"?lr.optionSelected:""}`,onClick:g,children:[a.jsx("span",{className:`${lr.optionIcon} ${lr.iconCurrent}`,children:a.jsx(hee,{size:15,strokeWidth:1.5})}),a.jsxs("span",{className:lr.optionText,children:[a.jsx("span",{className:lr.optionName,children:s("gitMode.current")}),a.jsx("span",{className:lr.optionDesc,children:s("gitMode.currentDesc",{branch:e})})]}),l==="current"&&a.jsx("span",{className:lr.checkCurrent,"aria-hidden":"true",children:"✓"})]}),a.jsxs("button",{type:"button",role:"radio","aria-checked":l==="branch",className:`${lr.option} ${l==="branch"?lr.optionSelected:""}`,onClick:()=>c("branch"),children:[a.jsx("span",{className:`${lr.optionIcon} ${lr.iconBranch}`,children:a.jsx(ky,{size:15,strokeWidth:1.5})}),a.jsxs("span",{className:lr.optionText,children:[a.jsx("span",{className:lr.optionName,children:s("gitMode.branch")}),a.jsx("span",{className:lr.optionDesc,children:s("gitMode.branchDesc",{branch:e})})]}),l==="branch"&&a.jsx("span",{className:lr.checkBranch,"aria-hidden":"true",children:"✓"})]}),l==="branch"&&a.jsxs("div",{className:lr.branchBox,children:[a.jsxs("div",{className:lr.branchRow,children:[a.jsx("label",{className:lr.branchLabel,htmlFor:"git-mode-branch-input",children:s("gitMode.branchLabel")}),a.jsxs("span",{className:lr.branchInputWrap,children:[a.jsx("input",{className:`${lr.branchInput} ${u&&!m?lr.branchInputInvalid:""} ${u&&m?lr.branchInputValid:""}`,value:u,onChange:S=>d(S.target.value),onKeyDown:S=>{S.key==="Enter"&&u&&m&&b()},placeholder:s("gitMode.branchPlaceholder"),autoFocus:!0,spellCheck:!1,autoComplete:"off",id:"git-mode-branch-input","data-testid":"git-mode-branch-input"}),u&&a.jsx("span",{className:lr.branchStatus,"aria-hidden":"true",style:{color:m?"var(--git-mode-valid)":"var(--git-mode-invalid)"},children:m?"✓":"✗"})]})]}),a.jsx("div",{className:`${lr.branchHint} ${u&&!m?lr.branchHintError:""}`,children:s(u&&!m?"gitMode.branchInvalidName":"gitMode.branchHint")}),u&&m&&a.jsx("div",{className:lr.branchHint,children:s("gitMode.branchConflictWarning")})]}),a.jsxs("button",{type:"button",role:"radio","aria-checked":l==="worktree",className:`${lr.option} ${l==="worktree"?lr.optionSelected:""}`,onClick:()=>c("worktree"),children:[a.jsx("span",{className:`${lr.optionIcon} ${lr.iconWorktree}`,children:a.jsx(pT,{size:15,strokeWidth:1.5})}),a.jsxs("span",{className:lr.optionText,children:[a.jsx("span",{className:lr.optionName,children:s("gitMode.worktree")}),a.jsx("span",{className:lr.optionDesc,children:s("gitMode.worktreeDesc")})]}),l==="worktree"&&a.jsx("span",{className:lr.checkWorktree,"aria-hidden":"true",children:"✓"})]}),a.jsxs("div",{className:lr.footer,children:[a.jsx("span",{className:lr.cmd,children:l==="branch"?`$ git checkout -b ${u||"…"} ← ${e}`:l==="worktree"?"$ git worktree add .qwen/worktrees/<slug>":`$ git checkout ${e}`}),l==="branch"&&a.jsx("button",{type:"button",className:lr.confirmBranch,disabled:!u||!m,onClick:b,"data-testid":"git-mode-confirm-branch",children:s("gitMode.confirmBranch")}),l==="worktree"&&a.jsx("button",{type:"button",className:lr.confirmWorktree,onClick:w,"data-testid":"git-mode-confirm-worktree",children:s("gitMode.confirmWorktree")})]})]})]}),(v||x)&&a.jsx("button",{type:"button",className:lr.clearBtn,onClick:y,"aria-label":s("gitMode.resetToCurrent"),title:s("gitMode.resetToCurrent"),"data-testid":"git-mode-clear",children:"✕"})]})}const yht="_picker_11vtj_1",vht="_searchWrap_11vtj_10",wht="_searchIcon_11vtj_18",xht="_searchInput_11vtj_23",kht="_list_11vtj_41",_ht="_section_11vtj_47",Sht="_sectionHeader_11vtj_51",Cht="_sectionChevron_11vtj_69",Tht="_sectionChevronCollapsed_11vtj_74",Eht="_item_11vtj_78",Aht="_itemActive_11vtj_101",jht="_itemIcon_11vtj_105",Nht="_itemStar_11vtj_112",Iht="_itemName_11vtj_116",Mht="_itemMeta_11vtj_122",Rht="_itemAheadBehind_11vtj_131",Dht="_itemUpstream_11vtj_137",Lht="_separator_11vtj_145",Pht="_actionItem_11vtj_151",Oht="_actionIcon_11vtj_176",$ht="_actionLabel_11vtj_183",Bht="_inlineInput_11vtj_187",zht="_inlineInputField_11vtj_194",Fht="_inlineInputFieldInvalid_11vtj_209",qht="_statusBar_11vtj_213",Hht="_statusBarError_11vtj_224",Uht="_statusBarSuccess_11vtj_229",Wht="_spin_11vtj_238",Vht="_empty_11vtj_247",Ght="_remoteGroupLabel_11vtj_254",Kht="_loading_11vtj_262",Qn={picker:yht,searchWrap:vht,searchIcon:wht,searchInput:xht,list:kht,section:_ht,sectionHeader:Sht,sectionChevron:Cht,sectionChevronCollapsed:Tht,item:Eht,itemActive:Aht,itemIcon:jht,itemStar:Nht,itemName:Iht,itemMeta:Mht,itemAheadBehind:Rht,itemUpstream:Dht,separator:Lht,actionItem:Pht,actionIcon:Oht,actionLabel:$ht,inlineInput:Bht,inlineInputField:zht,inlineInputFieldInvalid:Fht,statusBar:qht,statusBarError:Hht,statusBarSuccess:Uht,spin:Wht,empty:Vht,remoteGroupLabel:Ght,loading:Kht};function nO({open:e,onOpenChange:t,workspaceCwd:n,gitCwd:r,side:s="bottom",onBranchChanged:i,onOpenDiff:o,onOpenCommit:l,children:c}){const{t:u}=rt(),{client:d}=yo(),f=h.useMemo(()=>d.workspaceByCwd(n),[d,n]),[m,p]=h.useState(null),[g,b]=h.useState(!1),[w,y]=h.useState(null),[v,x]=h.useState(null),[k,S]=h.useState("info"),[T,_]=h.useState(""),[C,j]=h.useState(!1),[E,L]=h.useState(""),[D,M]=h.useState(!1),[R,$]=h.useState(""),[B,N]=h.useState(null),[z,G]=h.useState({recent:!1,local:!1,remote:!0,tags:!0}),I=h.useRef(null),Y=h.useRef(null),U=h.useRef(0),P=h.useCallback(async()=>{const ae=++U.current;b(!0),y(null);try{const me=await f.workspaceGitBranches(r);if(ae!==U.current)return;p(me)}catch(me){if(ae!==U.current)return;y(me instanceof Error?me.message:String(me))}finally{ae===U.current&&b(!1)}},[f,r]);h.useEffect(()=>{e&&(P(),_(""),j(!1),M(!1),L(""),$(""),x(null),setTimeout(()=>{var ae;return(ae=I.current)==null?void 0:ae.focus()},50))},[e,P]);const F=h.useCallback((ae,me="info")=>{x(ae),S(me)},[]),te=h.useCallback(async ae=>{if(!B){N("checkout");try{await f.workspaceGitCheckout(ae,r),F(u("branchPicker.checkedOut",{branch:ae}),"success"),i==null||i(),t(!1)}catch(me){F(me instanceof Error?me.message:String(me),"error")}finally{N(null)}}},[f,B,r,i,t,F,u]),W=h.useCallback(async()=>{if(!B){if(!pR(E)){E&&F(u("branchPicker.invalidBranchName"),"error");return}N("newBranch");try{await f.workspaceGitCreateBranch(E,void 0,r),F(u("branchPicker.createdBranch",{branch:E}),"success"),i==null||i(),t(!1)}catch(ae){F(ae instanceof Error?ae.message:String(ae),"error")}finally{N(null)}}},[f,B,r,E,i,t,F,u]),K=h.useCallback(async()=>{R.trim()&&await te(R.trim())},[R,te]),ce=h.useCallback(async()=>{if(!B){N("push");try{const ae=await f.workspaceGitPush({setUpstream:!0},r);F(ae.output||u("branchPicker.pushSuccess"),"success"),await P(),i==null||i()}catch(ae){F(ae instanceof Error?ae.message:String(ae),"error")}finally{N(null)}}},[f,B,r,P,i,F,u]),ie=h.useCallback(async()=>{if(!B){N("pull");try{const ae=await f.workspaceGitPull(void 0,r);F(ae.output||u("branchPicker.pullSuccess"),"success"),await P(),i==null||i()}catch(ae){F(ae instanceof Error?ae.message:String(ae),"error")}finally{N(null)}}},[f,B,r,P,i,F,u]),Z=T.toLowerCase().trim(),ee=h.useCallback(ae=>Z?ae.filter(me=>me.name.toLowerCase().includes(Z)):ae,[Z]),oe=h.useMemo(()=>m?ee(m.local):[],[m,ee]),we=h.useMemo(()=>m?ee(m.remote):[],[m,ee]),pe=h.useMemo(()=>m?Z?m.tags.filter(ae=>ae.name.toLowerCase().includes(Z)):m.tags:[],[m,Z]),he=h.useMemo(()=>m?Z?m.recent.filter(ae=>ae.toLowerCase().includes(Z)):m.recent:[],[m,Z]),X=h.useMemo(()=>{const ae=new Map;for(const me of we){const We=me.name.indexOf("/"),Oe=We>0?me.name.slice(0,We):"other";let Mt=ae.get(Oe);Mt||(Mt=[],ae.set(Oe,Mt)),Mt.push(me)}return ae},[we]),ye=!Z||u("branchPicker.action.pull").toLowerCase().includes(Z)||u("branchPicker.action.push").toLowerCase().includes(Z)||u("branchPicker.action.commit").toLowerCase().includes(Z)||u("branchPicker.action.newBranch").toLowerCase().includes(Z)||u("branchPicker.action.checkoutRef").toLowerCase().includes(Z)||u("branchPicker.action.viewChanges").toLowerCase().includes(Z);h.useEffect(()=>{ye||(j(!1),M(!1))},[ye]);const Ce=h.useCallback(ae=>G(me=>({...me,[ae]:!me[ae]})),[]);return a.jsxs(Kf,{open:e,onOpenChange:t,children:[a.jsx(Wp,{asChild:!0,children:c}),a.jsxs(Yf,{ref:Y,className:Qn.picker,side:s,align:"start",sideOffset:4,onClick:ae=>ae.stopPropagation(),onPointerDownOutside:ae=>{var me;(me=Y.current)!=null&&me.contains(ae.target)&&ae.preventDefault()},children:[a.jsxs("div",{className:Qn.searchWrap,children:[a.jsx(tu,{size:14,className:Qn.searchIcon}),a.jsx("input",{ref:I,className:Qn.searchInput,placeholder:u("branchPicker.search"),value:T,onChange:ae=>_(ae.target.value)})]}),a.jsxs("div",{className:Qn.list,children:[g&&a.jsx("div",{className:Qn.loading,children:u("branchPicker.loading")}),w&&a.jsx("div",{className:Qn.empty,children:w}),!g&&!w&&m&&a.jsxs(a.Fragment,{children:[ye&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:Qn.actionItem,disabled:!!B,onClick:()=>void ie(),children:[B==="pull"?a.jsx(Ag,{size:14,className:`${Qn.actionIcon} ${Qn.spin}`}):a.jsx(exe,{size:14,className:Qn.actionIcon}),a.jsx("span",{className:Qn.actionLabel,children:u("branchPicker.action.pull")})]}),l&&a.jsxs("button",{type:"button",className:Qn.actionItem,disabled:!!B,onClick:()=>{l(),t(!1)},children:[a.jsx(wke,{size:14,className:Qn.actionIcon}),a.jsx("span",{className:Qn.actionLabel,children:u("branchPicker.action.commit")})]}),a.jsxs("button",{type:"button",className:Qn.actionItem,disabled:!!B,onClick:()=>void ce(),children:[B==="push"?a.jsx(Ag,{size:14,className:`${Qn.actionIcon} ${Qn.spin}`}):a.jsx(axe,{size:14,className:Qn.actionIcon}),a.jsx("span",{className:Qn.actionLabel,children:u("branchPicker.action.push")})]}),o&&a.jsxs("button",{type:"button",className:Qn.actionItem,onClick:()=>{o(),t(!1)},children:[a.jsx(mee,{size:14,className:Qn.actionIcon}),a.jsx("span",{className:Qn.actionLabel,children:u("branchPicker.action.viewChanges")})]}),a.jsx("div",{className:Qn.separator}),a.jsxs("button",{type:"button",className:Qn.actionItem,onClick:()=>{j(!C),M(!1)},children:[a.jsx(Wf,{size:14,className:Qn.actionIcon}),a.jsx("span",{className:Qn.actionLabel,children:u("branchPicker.action.newBranch")})]}),C&&a.jsx("div",{className:Qn.inlineInput,children:a.jsx("input",{className:`${Qn.inlineInputField} ${E&&!pR(E)?Qn.inlineInputFieldInvalid:""}`,placeholder:u("branchPicker.newBranchPlaceholder"),value:E,onChange:ae=>L(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&W(),ae.key==="Escape"&&j(!1)},autoFocus:!0})}),a.jsxs("button",{type:"button",className:Qn.actionItem,onClick:()=>{M(!D),j(!1)},children:[a.jsx(YF,{size:14,className:Qn.actionIcon}),a.jsx("span",{className:Qn.actionLabel,children:u("branchPicker.action.checkoutRef")})]}),D&&a.jsx("div",{className:Qn.inlineInput,children:a.jsx("input",{className:Qn.inlineInputField,placeholder:u("branchPicker.checkoutRefPlaceholder"),value:R,onChange:ae=>$(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&K(),ae.key==="Escape"&&M(!1)},autoFocus:!0})}),a.jsx("div",{className:Qn.separator})]}),he.length>0&&a.jsx(fC,{label:u("branchPicker.section.recent"),sectionKey:"recent",collapsed:z.recent,onToggle:Ce,children:he.map(ae=>a.jsx(Yj,{name:ae,isHead:ae===m.head&&!m.detached,onClick:()=>void te(ae)},ae))}),a.jsx(fC,{label:u("branchPicker.section.local"),sectionKey:"local",collapsed:z.local,onToggle:Ce,children:oe.length===0?a.jsx("div",{className:Qn.empty,children:u("branchPicker.noBranches")}):oe.map(ae=>a.jsx(Yj,{name:ae.name,isHead:ae.isHead,ahead:ae.ahead,behind:ae.behind,upstream:ae.upstream,onClick:()=>void te(ae.name)},ae.name))}),a.jsx(fC,{label:u("branchPicker.section.remote"),sectionKey:"remote",collapsed:z.remote,onToggle:Ce,children:we.length===0?a.jsx("div",{className:Qn.empty,children:u("branchPicker.noBranches")}):Array.from(X.entries()).map(([ae,me])=>a.jsxs("div",{children:[a.jsx("div",{className:Qn.remoteGroupLabel,children:ae}),me.map(We=>{const Oe=We.name.indexOf("/"),Mt=Oe>0?We.name.slice(Oe+1):We.name;return a.jsx(Yj,{name:Mt,isHead:!1,onClick:()=>void te(We.name)},We.name)})]},ae))}),a.jsx(fC,{label:u("branchPicker.section.tags"),sectionKey:"tags",collapsed:z.tags,onToggle:Ce,children:pe.length===0?a.jsx("div",{className:Qn.empty,children:u("branchPicker.noTags")}):pe.map(ae=>a.jsxs("button",{type:"button",className:Qn.item,onClick:()=>void te(`refs/tags/${ae.name}`),children:[a.jsx(YF,{size:13,className:Qn.itemIcon}),a.jsx("span",{className:Qn.itemName,children:ae.name})]},ae.name))})]})]}),v&&a.jsx("div",{className:`${Qn.statusBar} ${k==="error"?Qn.statusBarError:k==="success"?Qn.statusBarSuccess:""}`,children:v})]})]})}function fC({label:e,sectionKey:t,collapsed:n,onToggle:r,children:s}){return a.jsxs("div",{className:Qn.section,children:[a.jsxs("button",{type:"button",className:Qn.sectionHeader,"aria-expanded":!n,onClick:()=>r(t),children:[a.jsx(Eu,{size:12,className:`${Qn.sectionChevron} ${n?Qn.sectionChevronCollapsed:""}`}),e]}),!n&&s]})}function Yj({name:e,isHead:t,ahead:n,behind:r,upstream:s,onClick:i}){return a.jsxs("button",{type:"button",className:`${Qn.item} ${t?Qn.itemActive:""}`,onClick:i,children:[t?a.jsx(A_e,{size:13,className:`${Qn.itemIcon} ${Qn.itemStar}`}):a.jsx(ky,{size:13,className:Qn.itemIcon}),a.jsx("span",{className:Qn.itemName,children:e}),a.jsxs("span",{className:Qn.itemMeta,children:[(n??0)>0||(r??0)>0?a.jsxs("span",{className:Qn.itemAheadBehind,children:[(n??0)>0&&a.jsxs("span",{children:["↑",n]}),(r??0)>0&&a.jsxs("span",{children:["↓",r]})]}):null,s&&a.jsx("span",{className:Qn.itemUpstream,children:s}),t&&a.jsx(kh,{size:12})]})]})}const Yht="_red_179c6_21",Xht="_orange_179c6_24",Qht="_yellow_179c6_27",Jht="_green_179c6_30",Zht="_blue_179c6_33",eft="_purple_179c6_36",rO={red:Yht,orange:Xht,yellow:Qht,green:Jht,blue:Zht,purple:eft};function tft(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4l2 2h7A1.5 1.5 0 0 1 19 8.5v8A1.5 1.5 0 0 1 17.5 18h-13A1.5 1.5 0 0 1 3 16.5Z",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"})})}function nft({name:e,title:t,ariaLabel:n,color:r,compact:s=!1}){const i=[Te.workspaceChip,s?Te.workspaceChipCompact:"",r?rO[r]:"",r?Te.workspaceChipAccented:""].filter(Boolean).join(" ");return a.jsx(Cd,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsxs("output",{className:i,"aria-label":n,"data-web-shell-workspace":!0,"data-web-shell-workspace-title":t,children:[a.jsx("span",{className:Te.workspaceChipIcon,children:a.jsx(tft,{})}),a.jsx("span",{className:Te.workspaceChipText,children:e})]})}),a.jsx(Uu,{side:"top",children:t})]})})}function Mu({...e}){return a.jsx(iDe,{"data-slot":"dropdown-menu",...e})}function rft({container:e,...t}){const n=Gu();return a.jsx(aDe,{"data-slot":"dropdown-menu-portal",container:e??n??void 0,...t})}const Ru=h.forwardRef(function(t,n){return a.jsx(oDe,{ref:n,"data-slot":"dropdown-menu-trigger",...t})});function Du({className:e,align:t="start",sideOffset:n=4,...r}){return a.jsx(rft,{children:a.jsx(lDe,{"data-slot":"dropdown-menu-content",sideOffset:n,align:t,className:ln("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r})})}function Sp({...e}){return a.jsx(cDe,{"data-slot":"dropdown-menu-group",...e})}function bi({className:e,inset:t,variant:n="default",...r}){return a.jsx(uDe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ln("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function sft({...e}){return a.jsx(dDe,{"data-slot":"dropdown-menu-radio-group",...e})}function ift({className:e,children:t,inset:n,...r}){return a.jsxs(hDe,{"data-slot":"dropdown-menu-radio-item","data-inset":n,className:ln("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:a.jsx(fDe,{children:a.jsx(kh,{})})}),t]})}function L3({className:e,...t}){return a.jsx(mDe,{"data-slot":"dropdown-menu-separator",className:ln("-mx-1 my-1 h-px bg-border",e),...t})}function zhe({...e}){return a.jsx(pDe,{"data-slot":"dropdown-menu-sub",...e})}const Fhe=h.forwardRef(function({className:t,inset:n,children:r,...s},i){return a.jsxs(gDe,{ref:i,"data-slot":"dropdown-menu-sub-trigger","data-inset":n,className:ln("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[r,a.jsx(Eu,{className:"ml-auto"})]})});function qhe({className:e,...t}){return a.jsx(bDe,{"data-slot":"dropdown-menu-sub-content",className:ln("z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...t})}function oft({workspaces:e,selectedWorkspaceCwd:t,disabled:n,busy:r,scratchSupported:s,existingFolderSupported:i,className:o,onSelectWorkspace:l,onCreateScratch:c,onOpenExistingFolder:u}){const{t:d}=rt(),[f,m]=h.useState(!1),[p,g]=h.useState(!1),b=h.useRef(!1),w=h.useRef(!1),y=e.find(x=>t?x.cwd===t:x.primary),v=s||i;return e.length<=1&&!v?null:a.jsx(Cd,{delayDuration:300,children:a.jsxs(Mu,{open:f,onOpenChange:x=>{b.current=x,m(x),x&&(w.current=!0,g(!1))},children:[a.jsxs(qu,{open:p,onOpenChange:x=>{x&&(f||w.current)||g(x)},children:[a.jsx(Hu,{asChild:!0,children:a.jsx(Ru,{asChild:!0,disabled:n||r,children:a.jsxs("button",{type:"button",className:o,"aria-label":d("sidebar.workspaceSelectLabel"),onPointerEnter:()=>{b.current||(w.current=!1)},onPointerLeave:()=>{w.current=!1,g(!1)},onBlur:()=>{b.current||(w.current=!1,g(!1))},children:[a.jsx(bk,{size:16,strokeWidth:1.2}),a.jsx("span",{"data-slot":"select-value",children:(y==null?void 0:y.label)??""})]})})}),a.jsx(Uu,{side:"top",children:y==null?void 0:y.label})]}),a.jsxs(Du,{align:"start",className:"min-w-56",children:[a.jsx(sft,{value:y==null?void 0:y.id,onValueChange:x=>{const k=e.find(S=>S.id===x);k!=null&&k.trusted&&l(k.primary?void 0:k.cwd)},children:e.map(x=>a.jsxs(ift,{value:x.id,disabled:!x.trusted,title:x.cwd,children:[a.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.label}),!x.trusted&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(zke,{}),d("sidebar.workspaceUntrusted")]})]},x.id))}),v&&a.jsxs(a.Fragment,{children:[a.jsx(L3,{}),a.jsxs(zhe,{children:[a.jsxs(Fhe,{disabled:r,children:[a.jsx(fke,{}),d("sidebar.newWorkspace")]}),a.jsxs(qhe,{children:[s&&a.jsx(bi,{onSelect:c,children:d("sidebar.startFromScratch")}),i&&a.jsx(bi,{onSelect:u,children:d("sidebar.useExistingFolder")})]})]})]})]})]})})}function aft(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(r=>`${r.label}
${r.searchText??""}`.toLocaleLowerCase().includes(n)):[...e]}function dK({availableWidth:e,items:t}){const n=Object.fromEntries(t.map(s=>[s.id,s.ready!==!1]));let r=t.reduce((s,i)=>s+(n[i.id]?i.expansionWidth:0),0);for(const s of t){if(r<=e)break;n[s.id]&&(n[s.id]=!1,r-=s.expansionWidth)}return n}function lft({availableWidth:e,items:t,currentVisibility:n,expansionMargin:r}){const s=dK({availableWidth:e,items:t}),i=dK({availableWidth:Math.max(0,e-r),items:t});return Object.fromEntries(t.map(o=>[o.id,n[o.id]?s[o.id]:i[o.id]]))}function cft({toolbarWidth:e,leadingWidth:t,rightWidth:n,currentExpansionWidth:r,gap:s}){const i=Math.max(0,t-r);return Math.max(0,e-n-i-s)}function uft({currentModelLabel:e,lastConfirmedModelLabel:t}){const n=e||t;return{modelLabel:n,modelLabelReady:!!n,nextConfirmedModelLabel:n}}const dft=["approvalMode","gitBranch","model","widthMode","voice","workspace"],hft=new Set(dft),fft={"&":{fontSize:"14px",background:"transparent",border:"none"},"&.cm-focused":{outline:"none"},".cm-scroller":{maxHeight:"var(--chat-editor-input-max-height, 300px)",overflowX:"hidden",overflowY:"auto"},".cm-content":{padding:"0",fontFamily:"var(--font-sans, system-ui, sans-serif)",color:"var(--chat-editor-text-primary, #e0e0e0)",caretColor:"var(--chat-editor-accent-color, #4a9eff)",fontSize:"14px",lineHeight:"1.6"},".cm-line":{padding:"0"},".cm-placeholder":{color:"var(--chat-editor-text-dimmed, #666)"},".cm-followup-ghost":{color:"var(--chat-editor-text-dimmed, #666)",opacity:"0.72",pointerEvents:"none",userSelect:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused .cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-cursor":{borderLeftColor:"var(--chat-editor-accent-color, #4a9eff)",borderLeftWidth:"2px"}};function hK(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}function mft({tag:e,content:t,tooltip:n,onActivate:r,onRemove:s}){const i=h.useRef(null),o=Gu(),l=n!=null,c=a.jsx("span",{className:Te.tagContent,"data-web-shell-composer-tag-trigger":!0,role:r?"button":void 0,tabIndex:r||l?0:void 0,onClick:d=>{var f;r&&(d.stopPropagation(),r(((f=i.current)==null?void 0:f.getBoundingClientRect())??d.currentTarget.getBoundingClientRect()))},onKeyDown:d=>{var f;r&&(d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),r(((f=i.current)==null?void 0:f.getBoundingClientRect())??d.currentTarget.getBoundingClientRect())))},children:t}),u=a.jsxs("span",{ref:i,className:Te.tag,"data-web-shell-composer-tag":!0,children:[l?a.jsx(Iae,{asChild:!0,children:c}):c,s&&a.jsx("button",{type:"button",className:Te.tagRemove,"aria-label":`Remove ${DP(e)}`,onMouseDown:d=>d.preventDefault(),onClick:d=>{d.stopPropagation(),s()},onKeyDown:d=>{if(d.key==="Enter"||d.key===" "){d.stopPropagation();return}d.key!=="Backspace"&&d.key!=="Delete"||(d.preventDefault(),d.stopPropagation(),s())},children:"×"})]});return l?a.jsxs(Nae,{disableHoverableContent:!1,children:[u,a.jsx(Mae,{container:o??void 0,children:a.jsx(Rae,{className:Te.tagTooltip,"data-web-shell-composer-tag-tooltip":!0,sideOffset:6,collisionPadding:8,avoidCollisions:!0,children:n})})]}):u}function pft(){return a.jsx("svg",{className:Te.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:a.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function gft(){return a.jsx("span",{className:Te.stopIcon,"aria-hidden":"true"})}function bft(){return a.jsx("span",{className:Te.loadingIcon,"aria-hidden":"true"})}function yft(){return a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>a.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function vft({text:e}){const r=eO(),[s,i]=h.useState(r?e:""),[o,l]=h.useState(!1);return h.useEffect(()=>{if(r){i(e),l(!1);return}let c=0,u=0;const d=()=>{let f=0;i(""),l(!1);const m=()=>{if(f+=1,i(e.slice(0,f)),f===e.length){c+=1,l(!0),c<2&&(u=window.setTimeout(d,3e3));return}u=window.setTimeout(m,45)};u=window.setTimeout(m,45)};return d(),()=>window.clearTimeout(u)},[r,e]),a.jsxs("span",{className:Te.typewriterPlaceholder,"data-web-shell-composer-typewriter":!0,"aria-hidden":"true",children:[s,!r&&a.jsx("span",{className:`${Te.typewriterCaret} ${o?Te.typewriterCaretFinished:""}`,children:"_"})]})}function wft({mode:e}){return e==="wide"?a.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[a.jsx("path",{d:"M550.012 486.537a8.16 8.16 0 0 1 8.17-8.17h305.36l-111.88-111.89c-3.19-3.19-3.19-8.4 0-11.59l25.08-25.08c3.19-3.19 8.4-3.19 11.59 0l168.61 168.6c3.19 3.19 3.19 8.4 0 11.59l-164.47 168.67c-3.19 3.19-8.4 3.19-11.59 0l-25.61-25.61c-3.19-3.19-3.19-8.4 0-11.59l106.58-110.78-303.62 0.11c-4.52 0-8.23-3.71-8.23-8.23v-36.03z",fill:"currentColor",transform:"translate(-483.41 0)"}),a.jsx("path",{d:"M473.532 524.327a8.16 8.16 0 0 1-8.17 8.17h-305.36l111.88 111.88c3.19 3.19 3.19 8.4 0 11.59l-25.09 25.09c-3.19 3.19-8.4 3.19-11.59 0l-168.6-168.61c-3.19-3.19-3.19-8.4 0-11.59l164.47-168.67c3.19-3.19 8.4-3.19 11.59 0l25.61 25.61c3.19 3.19 3.19 8.4 0 11.59l-106.59 110.78 303.62-0.11c4.52 0 8.23 3.71 8.23 8.23v36.04z",fill:"currentColor",transform:"translate(483.41 0)"})]}):a.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:a.jsx("path",{d:"M473.532 524.327a8.16 8.16 0 0 1-8.17 8.17h-305.36l111.88 111.88c3.19 3.19 3.19 8.4 0 11.59l-25.09 25.09c-3.19 3.19-8.4 3.19-11.59 0l-168.6-168.61c-3.19-3.19-3.19-8.4 0-11.59l164.47-168.67c3.19-3.19 8.4-3.19 11.59 0l25.61 25.61c3.19 3.19 3.19 8.4 0 11.59l-106.59 110.78 303.62-0.11c4.52 0 8.23 3.71 8.23 8.23v36.04zM550.012 486.537a8.16 8.16 0 0 1 8.17-8.17h305.36l-111.88-111.89c-3.19-3.19-3.19-8.4 0-11.59l25.08-25.08c3.19-3.19 8.4-3.19 11.59 0l168.61 168.6c3.19 3.19 3.19 8.4 0 11.59l-164.47 168.67c-3.19 3.19-8.4 3.19-11.59 0l-25.61-25.61c-3.19-3.19-3.19-8.4 0-11.59l106.58-110.78-303.62 0.11c-4.52 0-8.23-3.71-8.23-8.23v-36.03z",fill:"currentColor"})})}function Xj(){return a.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("path",{d:"M12 3.5 19.4 7.8v8.4L12 20.5l-7.4-4.3V7.8L12 3.5Z",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"}),a.jsx("path",{d:"m8.2 9.7 3.8 2.2 3.8-2.2M12 11.9v4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function xft(e){const n=(e.action.type==="run"?e.action.command:e.action.type==="insert"?e.action.text:"").trimStart().match(/^\/([^\s]+)/);return(n==null?void 0:n[1])??null}const kft=[{id:"tab",label:"Tab",descriptionKey:"quickKeys.tab",event:{key:"Tab",code:"Tab"}},{id:"escape",label:"Esc",descriptionKey:"quickKeys.escape",event:{key:"Escape",code:"Escape"}},{id:"arrow-up",label:"↑",descriptionKey:"quickKeys.history",event:{key:"ArrowUp",code:"ArrowUp"}},{id:"arrow-down",label:"↓",descriptionKey:"quickKeys.history",event:{key:"ArrowDown",code:"ArrowDown"}},{id:"arrow-left",label:"←",descriptionKey:"quickKeys.cursor",event:{key:"ArrowLeft",code:"ArrowLeft"}},{id:"arrow-right",label:"→",descriptionKey:"quickKeys.cursor",event:{key:"ArrowRight",code:"ArrowRight"}}];function _ft(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function Hhe(e,t){return{plan:t("mode.label.plan"),default:t("mode.label.default"),"auto-edit":t("mode.label.auto-edit"),auto:t("mode.label.auto"),yolo:t("mode.label.yolo")}[e]??e}function Sft(e,t){return{plan:t("mode.listLabel.plan"),default:t("mode.listLabel.default"),"auto-edit":t("mode.listLabel.auto-edit"),auto:t("mode.listLabel.auto"),yolo:t("mode.listLabel.yolo")}[e]??Hhe(e,t)}function fK({open:e,items:t,activeId:n,onOpenChange:r,onSelect:s,trigger:i,tooltip:o,showCheck:l=!1,searchable:c=!1,searchLabel:u,noResultsLabel:d}){const[f,m]=h.useState(""),[p,g]=h.useState(null),b=h.useRef(!1),w=h.useRef(!1),y=h.useRef(null),v=t.some(S=>S.description||S.icon),x=c?aft(t,f):t;h.useEffect(()=>{e||m("")},[e]);const k=v||l;return a.jsxs(Kf,{open:e,onOpenChange:S=>{var T;S&&(b.current=!1,w.current=!1,g(((T=y.current)==null?void 0:T.closest("[data-web-shell-root]"))??null)),r(S)},children:[o?a.jsx(Cd,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx(Wp,{ref:y,asChild:!0,children:i})}),a.jsx(Uu,{side:"top",children:o})]})}):a.jsx(Wp,{ref:y,asChild:!0,children:i}),a.jsxs(Yf,{side:"top",align:"start",collisionPadding:8,collisionBoundary:p??void 0,"data-web-shell-toolbar-popover":!0,onClick:S=>S.stopPropagation(),onPointerDownOutside:S=>{const T=S.target;T instanceof Element&&T.closest("[data-web-shell-toolbar-popover-trigger]")&&(w.current=!0)},onCloseAutoFocus:S=>{if(w.current){S.preventDefault(),w.current=!1;return}if(document.activeElement instanceof HTMLElement&&document.activeElement.closest("[data-web-shell-toolbar-popover]")){S.preventDefault();return}b.current&&(S.preventDefault(),b.current=!1)},children:[c&&a.jsx(Us,{type:"search",value:f,"aria-label":u,placeholder:u,autoComplete:"off",onChange:S=>m(S.target.value)}),a.jsxs("div",{className:`${Te.dropdownList} ${v?Te.dropdownRich:l?Te.dropdownCheck:""} ${c?Te.dropdownListConstrained:""}`,children:[x.map(S=>a.jsx("button",{type:"button",className:`${Te.dropdownItem} ${S.id===n?Te.dropdownItemActive:""}`,onClick:()=>{b.current=!0,s(S.id)},children:k?a.jsxs(a.Fragment,{children:[v&&a.jsx("span",{className:Te.dropdownItemIcon,children:S.icon}),a.jsxs("span",{className:Te.dropdownItemContent,children:[a.jsx("span",{className:Te.dropdownItemLabel,children:S.label}),S.description&&a.jsx("span",{className:Te.dropdownItemDesc,children:S.description})]}),a.jsx("span",{className:Te.dropdownItemCheck,children:S.id===n?a.jsx(_ft,{}):null})]}):S.label},S.id)),x.length===0&&d&&a.jsx("div",{className:Te.dropdownEmpty,role:"status",children:d(f)})]})]})]})}function Cft({menu:e,anchorRef:t,panelRef:n,detailRef:r,onClose:s,onSelect:i,onAccept:o}){const l=h.useRef([]),c=h.useRef(null),[u,d]=h.useState(null),[f,m]=h.useState(null);h.useEffect(()=>{var g;(g=l.current[e.selectedIndex])==null||g.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),h.useEffect(()=>{m(null)},[e.items]),h.useLayoutEffect(()=>{var g;d(((g=t.current)==null?void 0:g.closest("[data-web-shell-root]"))??null)},[t]),h.useEffect(()=>{const g=b=>{b.key!=="Escape"||!b.isComposing&&b.keyCode!==229||(Object.defineProperty(b,"key",{configurable:!0,value:"Process"}),window.addEventListener("keydown",w=>{w===b&&Reflect.deleteProperty(b,"key")},{once:!0}))};return window.addEventListener("keydown",g,{capture:!0}),()=>{window.removeEventListener("keydown",g,{capture:!0})}},[]);const p=tdt(e.items,e.kind);return a.jsxs(a.Fragment,{children:[a.jsxs(Kf,{open:!0,onOpenChange:g=>{g||s()},children:[a.jsx(JU,{virtualRef:t}),a.jsx(Yf,{ref:n,side:"top",align:"start",alignOffset:16,sideOffset:8,avoidCollisions:!1,collisionPadding:12,collisionBoundary:u??void 0,className:"duration-0 data-open:animate-none data-closed:animate-none",role:"listbox","data-web-shell-slash-menu":!0,onOpenAutoFocus:g=>g.preventDefault(),onCloseAutoFocus:g=>g.preventDefault(),onInteractOutside:g=>{var w,y;const b=g.target;b instanceof Node&&((w=t.current)!=null&&w.contains(b)||(y=r.current)!=null&&y.contains(b))&&g.preventDefault()},onMouseDown:g=>g.preventDefault(),onMouseLeave:g=>{var w;const b=g.relatedTarget;b instanceof Node&&((w=r.current)!=null&&w.contains(b))||m(null)},children:a.jsx("div",{className:Te.slashPanel,children:a.jsx("div",{className:Te.slashPanelBody,children:a.jsx("div",{className:Te.slashList,onScroll:()=>m(null),children:e.items.map((g,b)=>{const w=p[b];return a.jsxs("div",{className:Te.slashEntry,children:[w.showHeader&&a.jsxs(a.Fragment,{children:[w.showDivider&&a.jsx("div",{className:Te.slashSection}),a.jsxs("div",{className:Te.slashSectionHeader,children:[a.jsx("span",{children:g.section}),w.count>0?a.jsx("span",{className:Te.slashSectionCount,children:w.count}):null]})]}),a.jsxs("button",{ref:y=>{l.current[b]=y},type:"button",role:"option","aria-selected":b===e.selectedIndex,"data-has-description":g.detail?"":void 0,className:`${Te.slashItem} ${b===e.selectedIndex?Te.slashItemActive:""}`,onMouseEnter:y=>{if(i(b),!g.detail){m(null);return}c.current=y.currentTarget;const v=y.currentTarget.getBoundingClientRect(),x=u==null?void 0:u.getBoundingClientRect(),k=(x==null?void 0:x.left)??0,S=(x==null?void 0:x.right)??window.innerWidth,T=(x==null?void 0:x.top)??0,_=(x==null?void 0:x.bottom)??window.innerHeight,C=Math.min(320,S-k-24),j=S-v.right>=C+8?"right":v.left-k>=C+8?"left":v.top-T>=_-v.bottom?"top":"bottom";m({label:g.label,detail:g.detail,side:j})},onMouseDown:y=>{y.preventDefault(),y.stopPropagation(),o(b)},children:[a.jsx("span",{className:Te.slashCommand,children:g.label}),g.detail&&a.jsx("span",{className:Te.slashDescription,children:g.detail})]})]},`${g.id}:${b}`)})})})})})]}),a.jsxs(Kf,{open:!!f,onOpenChange:g=>{g||m(null)},children:[a.jsx(JU,{virtualRef:c}),f&&a.jsx(Yf,{ref:r,side:f.side,align:"start",sideOffset:8,collisionPadding:12,collisionBoundary:u??void 0,className:"duration-0 data-open:animate-none data-closed:animate-none","data-web-shell-slash-detail":!0,onOpenAutoFocus:g=>g.preventDefault(),onCloseAutoFocus:g=>g.preventDefault(),onMouseLeave:g=>{var w;const b=g.relatedTarget;b instanceof Node&&((w=n.current)!=null&&w.contains(b))||m(null)},children:a.jsxs("div",{className:Te.slashDetail,children:[a.jsx("div",{className:Te.slashDetailCommand,children:f.label}),a.jsx("div",{className:Te.slashDetailText,children:f.detail})]})})]})]})}function Tft({actions:e,onRun:t,onPressKey:n,showKeyHints:r=!0}){const{t:s}=rt();return a.jsxs("div",{className:Te.quickActionsPanel,onMouseDown:i=>i.stopPropagation(),onClick:i=>i.stopPropagation(),children:[a.jsx("div",{className:Te.quickActionsHeader,children:s("quickActions.title")}),a.jsxs("div",{className:Te.quickActionsLayout,children:[a.jsx("div",{className:Te.quickActionsGrid,children:e.map(i=>a.jsx("button",{type:"button",className:Te.quickAction,onClick:()=>t(i),children:a.jsx("span",{className:Te.quickActionLabel,children:i.label})},i.id))}),r&&a.jsx("div",{className:Te.quickKeysGrid,children:kft.map(i=>a.jsx("button",{type:"button",className:Te.quickKey,title:s(i.descriptionKey),onMouseDown:o=>o.preventDefault(),onClick:()=>n(i),children:a.jsx("span",{className:Te.quickKeyLabel,children:i.label})},i.id))})]})]})}const Uhe=h.memo(h.forwardRef(function(t,n){var Lt;const{onSubmit:r,onInputTextChange:s,onAttachmentsChange:i,onCycleMode:o,onToggleShortcuts:l,onCancel:c,isRunning:u=!1,isPreparing:d=!1,cancelArmed:f=!1,disabled:m=!1,placeholderText:p="Type a message...",commands:g,skills:b=[],slashCommandCategoryOrder:w,queuedMessages:y=[],onPopQueuedMessages:v,currentMode:x="default",currentModel:k="",gitBranch:S,gitWorktree:T,gitCwd:_,gitModeIntent:C,onGitModeIntentChange:j,gitStatus:E,onOpenGitDiff:L,onOpenCommit:D,workspaceName:M,workspaceTitle:R,workspaceColor:$,chatWidthMode:B="1000",showChatWidthToggle:N=!0,chatWidthToggleMin:z,visibleToolbarActions:G,availableModels:I=[],onSelectMode:Y,onSelectModel:U,workspaces:P,selectedWorkspaceCwd:F,workspaceSelectionDisabled:te=!1,onSelectWorkspace:W,scratchWorkspaceSupported:K=!1,existingFolderWorkspaceSupported:ce=!1,workspaceMutationBusy:ie=!1,onCreateScratchWorkspace:Z,onOpenExistingWorkspace:ee,atWorkspaceCwd:oe,onChatWidthModeChange:we,onFocusFooter:pe,dialogOpen:he=!1,followupState:X,onAcceptFollowup:ye,onDismissFollowup:Ce,sessionId:ae,sessionName:me,composerInput:We,composerInputVersion:Oe,builtinAtProviders:Mt,atProviders:$t,composerTagIcons:St,voiceTarget:ue,voiceStatusRevision:Ee}=t,{renderComposerToolbarStart:tt,renderComposerToolbarEnd:ut,renderComposerToolbarRight:Ct,renderComposerTag:Ze,renderComposerTagTooltip:Et,onComposerTagClick:Nt,parseUserMessageContent:gt}=Vu(),Je=vYe({onSubmit:r,onInputTextChange:s,onCycleMode:o,onToggleShortcuts:l,disabled:m,placeholderText:p,commands:g,skills:b,slashCommandCategoryOrder:w,queuedMessages:y,onPopQueuedMessages:v,currentMode:x,onFocusFooter:pe,dialogOpen:he,followupState:X,onAcceptFollowup:ye,onDismissFollowup:Ce,sessionId:ae,sessionName:me,composerInput:We,composerInputVersion:Oe,builtinAtProviders:Mt,atProviders:$t,atWorkspaceCwd:oe,composerTagIcons:St,parseUserMessageContent:gt,renderComposerTag:Ze,renderComposerTagTooltip:Et,onComposerTagClick:Nt,editorTheme:fft}),{t:Ae}=rt();h.useImperativeHandle(n,()=>Je.handle,[Je.handle]),h.useEffect(()=>{i==null||i(Je.hasAttachments)},[Je.hasAttachments,i]);const[de,nt]=h.useState(!1),[ve,Ke]=h.useState(!1),[le,Le]=h.useState(!1),[dt,Fe]=h.useState(!1),[Ge,un]=h.useState(hK),[Wn,Me]=h.useState(!1),yt=h.useRef(null),cn=h.useRef(null),Re=h.useRef(null),et=h.useRef(null),bt=h.useRef(null),rn=h.useRef(null),qn=h.useRef(null),ft=h.useRef(null),He=h.useRef(null),Ye=h.useRef(null),Yt=h.useRef(null),[Cn,Tn]=h.useState(!1),[zr,Ns]=h.useState(!1),[kr,si]=h.useState({workspaceSelect:!1,workspace:!1,gitBranch:!1,mode:!1,model:!1}),[Fr,At]=h.useState(""),Xn=Je.slashMenu,_e=Je.closeSlashMenu,Vt=Je.atMenu,Dt=Je.closeAtMenu,Kn=!!Xn,Vn=!!Vt,ds=!m&&!!p&&!Je.hasInput()&&!Wn&&!Je.shellMode&&!(X!=null&&X.isVisible);h.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Be=window.matchMedia("(hover: none), (pointer: coarse)"),yn=()=>un(hK());return yn(),Be.addEventListener("change",yn),()=>Be.removeEventListener("change",yn)},[]),h.useEffect(()=>{Ge||Le(!1)},[Ge]),h.useEffect(()=>{if(!Kn&&!Vn)return;const Be=yn=>{var as,Ht,hr;const mr=yn.target,dr=yt.current;mr instanceof Node&&dr&&!dr.contains(mr)&&!((as=cn.current)!=null&&as.contains(mr))&&!((Ht=Re.current)!=null&&Ht.contains(mr))&&!((hr=et.current)!=null&&hr.contains(mr))&&(_e(),Dt())};return window.addEventListener("mousedown",Be),window.addEventListener("touchstart",Be),()=>{window.removeEventListener("mousedown",Be),window.removeEventListener("touchstart",Be)}},[Vn,Kn,Dt,_e]),h.useEffect(()=>{const Be=yt.current,yn=z;if(!Be||yn===void 0){Tn(!1);return}const mr=()=>{Tn(Be.getBoundingClientRect().width>=yn-50)};mr();const dr=new ResizeObserver(mr);return dr.observe(Be),()=>dr.disconnect()},[z]);const hs=h.useMemo(()=>ov.map(Be=>({id:Be,label:Sft(Be,Ae),description:Ae(`mode.desc.${Be}`),icon:a.jsx(px,{mode:Be})})),[Ae]),vs=h.useMemo(()=>{if(!G)return null;const Be=G.filter(yn=>hft.has(yn));return new Set(Be)},[G]),Mr=Be=>vs?vs.has(Be):!0,ji=Mr("approvalMode"),os=Mr("model"),zt=h.useMemo(()=>new Set(g.map(Be=>Be.name.replace(/^\/+/,""))),[g]),Ni=h.useCallback(Be=>zt.has(Be),[zt]),Ur=h.useMemo(()=>[{id:"new",label:Ae("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:Ae("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:Ae("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:Ae("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:Ae("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:Ae("quickActions.historyQuestion"),action:{type:"key",item:{id:"ctrl-r",label:"Ctrl+R",descriptionKey:"quickKeys.searchHistory",event:{key:"r",code:"KeyR",ctrlKey:!0}}}},{id:"recap",label:Ae("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:Ae("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:Ae("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:Ae("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:Ae("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:Ae("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:Ae("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:Ae("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:Ae("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:Ae("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:Je.shellMode?Ae("quickActions.exitShellMode"):Ae("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:Ae("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Be=>{const yn=xft(Be);return!yn||Ni(yn)}),[Je.shellMode,Ni,Ae]),vo=h.useMemo(()=>I.map(Be=>({id:Be.id,label:lp(Be.label||Be.id),searchText:`${Be.label??""}
${Be.id}`})),[I]),wo=h.useCallback(Be=>{Y==null||Y(Be),nt(!1),Je.focus()},[Y,Je]),Ps=h.useCallback(Be=>{U==null||U(Be),Ke(!1),Je.focus()},[U,Je]),Gt=h.useCallback(Be=>{if(Je.mobileComposer){Be.ctrlKey&&Be.key==="r"&&Je.searchState.openHistorySearch();return}const yn=Je.viewRef.current;yn&&(yn.focus(),yn.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Be,bubbles:!0,cancelable:!0})))},[Je]),_r=h.useCallback(Be=>{if(Le(!1),nt(!1),Ke(!1),Je.closeSlashMenu(),Je.closeAtMenu(),Be.action.type==="insert"){Je.insertText(Be.action.text,{mode:"replace"});return}if(Be.action.type==="shell"){Je.toggleShellMode();return}if(Be.action.type==="key"){Gt(Be.action.item.event);return}r(Be.action.command)},[Je,Gt,r]),Er=h.useCallback(Be=>{Gt(Be.event),Be.id==="ctrl-r"&&Le(!1)},[Gt]),{searchMode:Do,searchQuery:fs,searchMatches:di,searchActiveIndex:ws,searchInputRef:xe,searchUiRef:$e,closeSearch:it,restoreSearchMatch:Ft,handleSearchKeyDown:On,handleSearchInput:Yn,handleSearchCompositionEnd:Is}=Je.searchState,Wr=Be=>{const yn=Ze==null?void 0:Ze({tag:Be,placement:"composer",readonly:!1});if(yn!=null)return yn;const mr=O6(Be),dr=$6(Be),as=Be.kind?"":mr,Ht=Be.icon??a1(Be.kind,St),hr=Ht&&(lD(Ht)||Cv(Ht))?Ht:void 0;return!as&&!dr?a.jsx("span",{className:Te.tagLabel,children:Be.id}):a.jsxs(a.Fragment,{children:[hr&&a.jsx("span",{className:Te.tagIcon,style:ap("--composer-tag-icon-url",hr),"aria-hidden":"true"}),as&&a.jsx("span",{className:Te.tagLabel,children:as}),dr&&a.jsx("span",{className:Te.tagValue,children:dr})]})},cr=Hhe(x,Ae),Gs=k?((Lt=I.find(Be=>Be.id===k))==null?void 0:Lt.label)??(k.startsWith("qwen-route:")?"":lp(k)):"",{modelLabel:Qr,modelLabelReady:vr}=uft({currentModelLabel:Gs,lastConfirmedModelLabel:Fr}),xr=P==null?void 0:P.find(Be=>F?Be.cwd===F:Be.primary),xs=(xr==null?void 0:xr.label)??"",nn=!!(P&&W&&(P.length>1||K||ce)),ks=!!(M&&Mr("workspace")),Jr=!!(S&&Mr("gitBranch"));h.useLayoutEffect(()=>{Gs&&Gs!==Fr&&At(Gs)},[Gs,Fr]);const fn=kr.workspaceSelect,Ks=kr.workspace,ur=kr.gitBranch,je=kr.mode,lt=kr.model,Xt=u&&!Je.hasContent,Nn=Ge&&zr;return h.useEffect(()=>{Nn&&Le(!1)},[Nn]),h.useLayoutEffect(()=>{const Be=bt.current,yn=rn.current,mr=qn.current,dr=Yt.current;if(!Be||!yn||!mr||!dr)return;const as=()=>{const Os=pr=>{const xo=dr.querySelector(`[data-toolbar-measure="${pr}:collapsed"]`),Qo=dr.querySelector(`[data-toolbar-measure="${pr}:expanded"]`);return Math.max(0,Math.ceil((Qo==null?void 0:Qo.getBoundingClientRect().width)??0)-Math.ceil((xo==null?void 0:xo.getBoundingClientRect().width)??0))},Vi=[...nn?[{id:"workspaceSelect",expansionWidth:Os("workspaceSelect")}]:[],...ks?[{id:"workspace",expansionWidth:Os("workspace")}]:[],...Jr?[{id:"gitBranch",expansionWidth:Os("gitBranch")}]:[],...ji?[{id:"mode",expansionWidth:Os("mode")}]:[],...os?[{id:"model",expansionWidth:Os("model"),ready:vr}]:[]],Ms=Vi.reduce((pr,xo)=>pr+(kr[xo.id]?xo.expansionWidth:0),0),Lo=yn.scrollWidth,Ys=Math.ceil(Number.parseFloat(getComputedStyle(Be).columnGap)||0),ya=cft({toolbarWidth:Math.floor(Be.getBoundingClientRect().width),leadingWidth:Lo,rightWidth:Math.ceil(mr.getBoundingClientRect().width),currentExpansionWidth:Ms,gap:Ys}),Ss=lft({availableWidth:ya,items:Vi,currentVisibility:kr,expansionMargin:Vi.length}),Li={workspaceSelect:Ss.workspaceSelect??!1,workspace:Ss.workspace??!1,gitBranch:Ss.gitBranch??!1,mode:Ss.mode??!1,model:Ss.model??!1};si(pr=>Object.keys(Li).every(Qo=>pr[Qo]===Li[Qo])?pr:Li)};as();const Ht=new ResizeObserver(as);Ht.observe(Be),Ht.observe(yn),Ht.observe(mr);for(const Os of dr.children)Ht.observe(Os);const hr=[ft.current,He.current,Ye.current].filter(Os=>Os!==null),hi=()=>{for(const Os of hr){Ht.observe(Os);for(const Vi of Os.children)Ht.observe(Vi)}};hi();const Zr=new MutationObserver(()=>{hi(),as()});for(const Os of hr)Zr.observe(Os,{attributes:!0,characterData:!0,childList:!0,subtree:!0});return()=>{Zr.disconnect(),Ht.disconnect()}},[ut,Ct,tt,m,S,Jr,u,Qr,vr,cr,me,os,ji,kr,ks,M,nn,xs]),a.jsxs("div",{className:`${Te.editorShell} ${de||ve?Te.editorShellDropdownOpen:""}`,"data-composer":!0,"data-web-shell-composer":!0,children:[a.jsxs("div",{ref:yt,className:Te.container,"data-web-shell-composer-surface":!0,"data-typewriter-visible":ds||void 0,onClick:()=>{nt(!1),Ke(!1),Le(!1),Je.focus()},children:[a.jsx(Hut,{targetRef:yt}),Do&&a.jsxs("div",{ref:$e,className:Te.searchPanel,onMouseDown:Be=>Be.stopPropagation(),onClick:Be=>Be.stopPropagation(),children:[a.jsxs("div",{className:Te.searchBar,children:[a.jsx("span",{className:Te.searchLabel,children:Ae("editor.searchLabel")}),a.jsx("input",{ref:xe,className:Te.searchInput,value:fs,onChange:Yn,onCompositionEnd:Is,onKeyDown:On,placeholder:Ae("editor.searchPlaceholder")})]}),di.length>0&&a.jsx("div",{className:Te.searchResults,children:di.map((Be,yn)=>a.jsxs("button",{type:"button",className:`${Te.searchResult} ${yn===ws?Te.searchResultActive:""}`,onMouseDown:mr=>{mr.preventDefault(),Ft?Ft(Be):Je.replaceEditorText(Be),it(!1)},children:[a.jsx("span",{className:Te.searchResultMarker,children:yn===ws?"›":""}),a.jsx("span",{className:Te.searchResultText,children:Be})]},`${Be}-${yn}`))}),di.length===0&&a.jsx("div",{className:Te.searchEmpty,children:Ae("editor.noHistory")})]}),a.jsxs("div",{className:Te.content,children:[(Je.composerTags.length>0||Je.pastedImages.length>0)&&a.jsxs("div",{className:Te.attachments,"data-web-shell-composer-attachments":!0,children:[Je.composerTags.length>0&&a.jsx(jae,{delayDuration:0,disableHoverableContent:!1,children:a.jsx("div",{className:Te.tags,children:Je.composerTags.map(Be=>{const yn={tag:Be,placement:"composer",readonly:!1};let mr;try{mr=Et==null?void 0:Et(yn)}catch(dr){console.warn("[WebShell] composer tag tooltip render failed",dr)}return a.jsx(mft,{tag:Be,content:Wr(Be),tooltip:mr,onActivate:Nt?dr=>Nt({...yn,anchorRect:dr}):void 0,onRemove:Be.removable!==!1?()=>{var dr;Je.removeTopTag(Be.id),(dr=Je.viewRef.current)==null||dr.focus()}:void 0},Be.id)})})}),Je.pastedImages.length>0&&a.jsx("div",{className:Te.images,children:Je.pastedImages.map((Be,yn)=>a.jsxs("div",{className:Te.imageThumb,children:[a.jsx("img",{src:`data:${Be.media_type};base64,${Be.data}`,alt:""}),a.jsx("button",{className:Te.imageRemove,onClick:mr=>{mr.stopPropagation(),Je.removeImage(yn)},children:"×"})]},yn))})]}),Je.slashMenu&&a.jsx(Cft,{menu:Je.slashMenu,anchorRef:yt,panelRef:cn,detailRef:Re,onClose:Je.closeSlashMenu,onSelect:Je.selectSlashCompletion,onAccept:Je.acceptSlashCompletion}),Je.atMenu&&a.jsx(Wut,{menu:Je.atMenu,anchorRef:yt,panelRef:et,onSelect:Je.selectAtCompletion,onAccept:Je.acceptAtCompletion,onBack:()=>{const Be=Je.backAtCategories();return Be==="categories"&&window.setTimeout(()=>Je.focus(),0),!!Be},onSearch:Je.updateAtSearch,onSelectTab:Je.selectAtTab}),a.jsxs("div",{className:Te.editorArea,onPointerDownCapture:()=>Me(!0),onKeyDownCapture:()=>Me(!0),onBlurCapture:Be=>{Be.currentTarget.contains(Be.relatedTarget)||Me(!1)},children:[ds&&a.jsx(vft,{text:p}),Je.shellMode&&a.jsx("span",{className:Te.shellPrefix,"aria-hidden":"true",children:"!"}),Je.mobileComposer?a.jsx("textarea",{ref:Je.mobileComposer.textareaRef,className:Te.mobileTextarea,value:Je.mobileComposer.value,onChange:Je.mobileComposer.onChange,onBlur:Je.mobileComposer.onBlur,onPaste:Je.mobileComposer.onPaste,placeholder:Je.mobileComposer.placeholder,disabled:Je.disabled,rows:1,enterKeyHint:"enter",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"data-web-shell-composer-editor":!0}):a.jsx("div",{ref:Je.containerRef,"data-web-shell-composer-editor":!0})]}),a.jsxs("div",{ref:bt,className:Te.toolbar,"data-mobile-voice-active":Nn||void 0,children:[a.jsxs("div",{ref:rn,className:Te.toolbarLeading,"data-web-shell-toolbar-leading":!0,children:[tt&&a.jsx("div",{ref:ft,className:Te.toolbarStart,children:a.jsx(tt,{disabled:m,isRunning:u,currentMode:x,currentModel:k,sessionName:me})}),a.jsxs("div",{className:Te.toolbarLeft,children:[nn&&P&&W&&a.jsx(oft,{workspaces:P,selectedWorkspaceCwd:F,disabled:te,busy:ie,scratchSupported:K,existingFolderSupported:ce,className:`${Te.toolBtn} ${Te.workspaceSelectTrigger} ${fn?"":Te.workspaceSelectTriggerCompact}`,onSelectWorkspace:W,onCreateScratch:Z??(()=>{}),onOpenExistingFolder:ee??(()=>{})}),ks&&M&&a.jsx(nft,{name:M,title:R??M,color:$,compact:!Ks,ariaLabel:Ae("workspace.paneLabel",{name:M})}),Jr&&S&&(C&&j?a.jsx(bht,{branch:S,compact:!ur,intent:C,onIntentChange:j}):a.jsx(nO,{open:dt,onOpenChange:Fe,workspaceCwd:(xr==null?void 0:xr.cwd)??"",gitCwd:_,onOpenDiff:L,onOpenCommit:D,children:a.jsx("button",{type:"button",className:Te.gitBranchChipButton,"aria-label":$he(S,E,Ae),children:a.jsx(Bhe,{branch:S,status:E,compact:!ur,worktree:T})})})),ji&&a.jsx("div",{className:`${Te.dropdownWrapper} ${je?"":Te.dropdownWrapperCompact}`,children:a.jsx(fK,{open:de,items:hs,activeId:x,onOpenChange:Be=>{nt(Be),Be&&Ke(!1)},onSelect:wo,tooltip:cr,trigger:a.jsxs("button",{className:`${Te.toolBtn} ${Te.modeToolBtn} ${je?"":Te.toolBtnCompact}`,"data-web-shell-mode-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Be=>{Be.stopPropagation(),Je.closeSlashMenu(),Je.closeAtMenu(),Le(!1)},"aria-label":Ae("status.mode"),children:[a.jsx("span",{className:Te.toolBtnModeIcon,children:a.jsx(px,{mode:x})}),je&&a.jsx("span",{className:Te.toolBtnText,children:cr}),a.jsx("span",{className:Te.toolBtnArrow,children:a.jsx(Oc,{})})]})})}),os&&a.jsx("div",{className:`${Te.dropdownWrapper} ${lt?"":Te.dropdownWrapperCompact}`,children:a.jsx(fK,{open:ve,items:vo,activeId:k,onOpenChange:Be=>{Ke(Be),Be&&nt(!1)},onSelect:Ps,tooltip:Qr,showCheck:!0,searchable:!0,searchLabel:Ae("common.search"),noResultsLabel:Be=>Ae("model.noMatch",{query:Be}),trigger:a.jsxs("button",{className:`${Te.toolBtn} ${Te.modelToolBtn} ${lt?"":Te.toolBtnCompact}`,"data-web-shell-model-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Be=>{Be.stopPropagation(),Je.closeSlashMenu(),Je.closeAtMenu(),Le(!1)},"aria-label":Ae("model.select"),children:[a.jsx("span",{className:Te.toolBtnModelIcon,children:a.jsx(Xj,{})}),lt&&a.jsx("span",{className:Te.toolBtnText,children:Qr}),a.jsx("span",{className:Te.toolBtnArrow,children:a.jsx(Oc,{})})]})})}),ut&&a.jsx("div",{ref:He,className:Te.toolbarEnd,children:a.jsx(ut,{disabled:m,isRunning:u,currentMode:x,currentModel:k,sessionName:me})})]})]}),a.jsxs("div",{ref:qn,className:Te.toolbarRight,children:[Ge&&Ur.length>0&&a.jsx("button",{className:`${Te.toolBtn} ${Te.quickActionsBtn}`,"data-hide-during-mobile-voice":!0,onClick:Be=>{Be.stopPropagation(),Je.closeSlashMenu(),Je.closeAtMenu(),nt(!1),Ke(!1),Le(yn=>!yn)},"aria-expanded":le,"aria-label":Ae("quickActions.open"),title:Ae("quickActions.open"),"data-tooltip":Ae("quickActions.open"),children:a.jsx("span",{className:Te.toolBtnIcon,children:a.jsx(yft,{})})}),Ct&&a.jsx("div",{ref:Ye,className:Te.toolbarRightCustom,"data-hide-during-mobile-voice":!0,children:a.jsx(Ct,{disabled:m,isRunning:u,currentMode:x,currentModel:k,sessionName:me})}),N&&Cn&&Mr("widthMode")&&a.jsx("button",{className:`${Te.toolBtn} ${Te.widthModeBtn}`,"data-hide-during-mobile-voice":!0,onClick:Be=>{Be.stopPropagation(),we==null||we(B==="wide"?"1000":"wide")},disabled:!we,"aria-label":Ae(B==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:Ae(B==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":Ae(B==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:a.jsx("span",{className:Te.toolBtnIcon,children:a.jsx(wft,{mode:B})})}),Mr("voice")&&a.jsx(Adt,{disabled:m,onActiveChange:Ns,target:ue,statusRevision:Ee,onInsert:Be=>{const yn=Je.getText(),mr=yn&&!/\s$/.test(yn)?" ":"";Je.insertText(`${mr}${Be} `),Je.focus()}}),a.jsx("button",{className:d||Xt?`${Te.sendBtn} ${Te.sendBtnRunning}${f?` ${Te.sendBtnArmed}`:""}`:Te.sendBtn,disabled:d?!0:Xt?!c:Je.disabled||!Je.hasContent,"data-web-shell-composer-submit":!0,onClick:Be=>{if(Be.stopPropagation(),!d){if(Xt){c==null||c();return}Je.submitText()}},"aria-label":Ae(d?"common.loading":Xt?f?"stream.cancelArmed":"stream.cancel":"editor.send"),title:u&&f?Ae("stream.cancelArmed"):void 0,children:d?a.jsx(bft,{}):Xt?f?a.jsx("span",{className:Te.escLabel,"aria-hidden":"true",children:"Esc"}):a.jsx(gft,{}):a.jsx(pft,{})}),a.jsx("span",{role:"status","aria-live":"polite",className:Te.srOnly,children:u&&f?Ae("stream.cancelArmed"):""})]})]}),a.jsxs("div",{ref:Yt,className:Te.toolbarMeasurements,"aria-hidden":"true",children:[nn&&xr&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{"data-toolbar-measure":"workspaceSelect:collapsed",className:`${Te.toolBtn} ${Te.workspaceSelectTrigger} ${Te.workspaceSelectTriggerCompact}`,children:[a.jsx(bk,{size:16,strokeWidth:1.2}),a.jsx("span",{className:Te.toolBtnText,children:xs}),a.jsx("span",{className:Te.toolBtnArrow,children:a.jsx(Oc,{})})]}),a.jsxs("span",{"data-toolbar-measure":"workspaceSelect:expanded",className:`${Te.toolBtn} ${Te.workspaceSelectTrigger}`,children:[a.jsx(bk,{size:16,strokeWidth:1.2}),a.jsx("span",{className:Te.toolBtnText,children:xs}),a.jsx("span",{className:Te.toolBtnArrow,children:a.jsx(Oc,{})})]})]}),ks&&M&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{"data-toolbar-measure":"workspace:collapsed",className:`${Te.workspaceChip} ${Te.workspaceChipCompact}`,children:[a.jsx("span",{className:Te.workspaceChipIcon}),a.jsx("span",{className:Te.workspaceChipText,children:M})]}),a.jsxs("span",{"data-toolbar-measure":"workspace:expanded",className:Te.workspaceChip,children:[a.jsx("span",{className:Te.workspaceChipIcon}),a.jsx("span",{className:Te.workspaceChipText,children:M})]})]}),Jr&&S&&a.jsxs(a.Fragment,{children:[a.jsx("span",{"data-toolbar-measure":"gitBranch:collapsed",className:`${Te.gitBranchChip} ${Te.gitBranchChipCompact}`,children:a.jsx(mR,{branch:S,status:E,compact:!0,worktree:T})}),a.jsx("span",{"data-toolbar-measure":"gitBranch:expanded",className:Te.gitBranchChip,children:a.jsx(mR,{branch:S,status:E,compact:!1,worktree:T})})]}),a.jsxs("span",{"data-toolbar-measure":"mode:collapsed",className:`${Te.toolBtn} ${Te.modeToolBtn} ${Te.toolBtnCompact}`,children:[a.jsx("span",{className:Te.toolBtnModeIcon,children:a.jsx(px,{mode:x})}),a.jsx("span",{className:Te.toolBtnText,children:cr}),a.jsx("span",{className:Te.toolBtnArrow,children:a.jsx(Oc,{})})]}),a.jsxs("span",{"data-toolbar-measure":"mode:expanded",className:`${Te.toolBtn} ${Te.modeToolBtn}`,children:[a.jsx("span",{className:Te.toolBtnModeIcon,children:a.jsx(px,{mode:x})}),a.jsx("span",{className:Te.toolBtnText,children:cr}),a.jsx("span",{className:Te.toolBtnArrow,children:a.jsx(Oc,{})})]}),a.jsxs("span",{"data-toolbar-measure":"model:collapsed",className:`${Te.toolBtn} ${Te.modelToolBtn} ${Te.toolBtnCompact}`,children:[a.jsx("span",{className:Te.toolBtnModelIcon,children:a.jsx(Xj,{})}),a.jsx("span",{className:Te.toolBtnText,children:Qr}),a.jsx("span",{className:Te.toolBtnArrow,children:a.jsx(Oc,{})})]}),a.jsxs("span",{"data-toolbar-measure":"model:expanded",className:`${Te.toolBtn} ${Te.modelToolBtn}`,children:[a.jsx("span",{className:Te.toolBtnModelIcon,children:a.jsx(Xj,{})}),a.jsx("span",{className:Te.toolBtnText,children:Qr}),a.jsx("span",{className:Te.toolBtnArrow,children:a.jsx(Oc,{})})]})]})]})]}),Ge&&le&&Ur.length>0&&a.jsx(Tft,{actions:Ur,onRun:_r,onPressKey:Er,showKeyHints:!Je.mobileComposer})]})}));function Eft(e){return e.kind!=="agent"}const Aft="_bar_17p6f_1",jft="_left_17p6f_12",Nft="_right_17p6f_13",Ift="_settingsButton_17p6f_23",Mft="_modeButton_17p6f_49",Rft="_modeHint_17p6f_62",Dft="_modeLabel_17p6f_67",Lft="_modeDefault_17p6f_71",Pft="_modePlan_17p6f_75",Oft="_modeAutoEdit_17p6f_79",$ft="_modeAuto_17p6f_79",Bft="_modeYolo_17p6f_87",zft="_shortcutsButton_17p6f_96",Fft="_modelButton_17p6f_114",qft="_model_17p6f_114",Hft="_contextButton_17p6f_138",Uft="_context_17p6f_138",Wft="_goal_17p6f_161",Vft="_goalButton_17p6f_167",Gft="_separator_17p6f_184",Kft="_taskPill_17p6f_188",ho={bar:Aft,left:jft,right:Nft,settingsButton:Ift,modeButton:Mft,modeHint:Rft,modeLabel:Dft,modeDefault:Lft,modePlan:Pft,modeAutoEdit:Oft,modeAuto:$ft,modeYolo:Bft,shortcutsButton:zft,modelButton:Fft,model:qft,contextButton:Hft,context:Uft,goal:Wft,goalButton:Vft,separator:Gft,taskPill:Kft},Yft=1e3;function Xft(e,t){switch(e){case"default":return{label:t("mode.default"),className:ho.modeDefault};case"plan":return{label:t("mode.plan"),className:ho.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:ho.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:ho.modeAuto};case"yolo":return{label:t("mode.yolo"),className:ho.modeYolo};default:return null}}function Qft(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"3"}),a.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function mK(e,t,n,r){return r(e===1?t:n,{count:e})}function Jft(e,t){const n=e.filter(Eft);if(n.length===0)return"";const r=n.filter(s=>s.status==="running");if(r.length>0){const s={shell:0,monitor:0};for(const o of r)o.kind==="shell"&&(s.shell+=1),o.kind==="monitor"&&(s.monitor+=1);const i=[];return s.shell>0&&i.push(mK(s.shell,"tasks.pill.shell","tasks.pill.shells",t)),s.monitor>0&&i.push(mK(s.monitor,"tasks.pill.monitor","tasks.pill.monitors",t)),i.join(", ")}return t(n.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:n.length})}function Zft(e){if(e<1e3)return"";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}const emt=h.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:r,onOpenSettings:s,onOpenTasks:i,onReturnToInput:o,tasks:l,activeGoal:c,onOpenGoals:u,hideSettings:d,onToggleShortcuts:f,compact:m=!1},p){const g=qa(),b=g.status==="connected",w=g.currentModel??"",y=g.currentMode??"",v=g.tokenCount??0,x=g.contextWindow??0,{t:k}=rt(),T=(x>0?v/x*100:0).toFixed(1),_=Xft(y,k),[,C]=h.useState(0),j=h.useRef(null);h.useEffect(()=>{if(!c)return;const N=setInterval(()=>C(z=>(z+1)%1e6),Yft);return()=>clearInterval(N)},[c]);const E=h.useMemo(()=>Jft(l,k),[l,k]),L=!m&&(b||!!_),D=c?Zft(Date.now()-c.setAt):"",M=c?`◎ ${k("goal.statusActive")}${D?` (${D})`:""}`:"",R=!!E||!m,$=!m&&!!w||!m&&x>0&&v>0||!!M;if(h.useImperativeHandle(p,()=>({focusTaskPill(){var N;return E?((N=j.current)==null||N.focus({preventScroll:!0}),!0):!1}}),[E]),!R&&!$)return null;const B=N=>{if(N.key==="Enter"||N.key==="ArrowDown"||N.key==="n"&&N.ctrlKey){N.preventDefault(),N.stopPropagation(),i==null||i();return}if(N.key==="ArrowUp"||N.key==="Escape"||N.key==="p"&&N.ctrlKey){N.preventDefault(),N.stopPropagation(),o==null||o();return}N.key.length===1&&!N.metaKey&&!N.ctrlKey&&!N.altKey&&(N.preventDefault(),N.stopPropagation(),o==null||o(N.key))};return a.jsxs("div",{className:ho.bar,children:[a.jsxs("div",{className:ho.left,children:[b&&!d&&!m&&a.jsx("button",{type:"button",className:ho.settingsButton,onClick:s,onMouseDown:N=>N.stopPropagation(),onTouchStart:N=>N.stopPropagation(),title:k("settings.title"),"aria-label":k("settings.title"),"aria-haspopup":"dialog",children:a.jsx(Qft,{})}),_&&!m&&a.jsxs("button",{type:"button",className:ho.modeButton,onClick:t,onMouseDown:N=>N.stopPropagation(),onTouchStart:N=>N.stopPropagation(),title:k("mode.select"),"aria-haspopup":"listbox",children:[a.jsx("span",{className:`${ho.modeLabel} ${_.className}`,children:_.label}),!m&&a.jsx("span",{className:ho.modeHint,children:k("status.modeHint")})]}),!m&&a.jsx(a.Fragment,{children:f?a.jsx("button",{type:"button",className:ho.shortcutsButton,onClick:f,onMouseDown:N=>N.stopPropagation(),onTouchStart:N=>N.stopPropagation(),"aria-haspopup":"dialog","aria-label":k("status.shortcuts"),children:k("status.shortcuts")}):a.jsx("span",{children:k("status.shortcuts")})}),E&&a.jsxs(a.Fragment,{children:[L&&a.jsx("span",{className:ho.separator,children:"·"}),a.jsx("button",{ref:j,type:"button",className:ho.taskPill,onClick:i,onKeyDown:B,disabled:!i,children:E})]})]}),a.jsxs("div",{className:ho.right,children:[!m&&w&&a.jsx("button",{type:"button",className:ho.modelButton,onClick:n,onMouseDown:N=>N.stopPropagation(),onTouchStart:N=>N.stopPropagation(),title:k("model.select"),"aria-haspopup":"listbox",children:a.jsx("span",{className:ho.model,children:w})}),!m&&x>0&&v>0&&a.jsx("button",{type:"button",className:ho.contextButton,onClick:r,title:k("contextUsage.title"),children:a.jsx("span",{className:ho.context,children:k("status.contextUsed",{pct:T})})}),M&&(u?a.jsx("button",{type:"button",className:ho.goalButton,onClick:u,title:c==null?void 0:c.condition,"aria-label":c!=null&&c.condition?`${k("sidebar.goals")}: ${c.condition}`:k("sidebar.goals"),children:a.jsx("span",{className:ho.goal,children:M})}):a.jsx("span",{className:ho.goal,title:c==null?void 0:c.condition,children:M}))]})]})}),tmt=15e3,nmt=["I'm Feeling Lucky","Shipping awesomeness... ","Painting the serifs back on...","Consulting the digital spirits...","Reticulating splines...","Generating witty retort...","Polishing the algorithms...","Don't rush perfection (or my code)...","Brewing fresh bytes...","Counting electrons...","Engaging cognitive processors...","Checking for syntax errors in the universe...","One moment, optimizing humor...","Untangling neural nets...","Compiling brilliance...","Loading wit.exe...","Preparing a witty response...","Just a sec, I'm debugging reality...","Crafting a response worthy of your patience...","Resolving dependencies... and existential crises...","Garbage collecting... be right back...","Converting coffee into code...","Looking for a misplaced semicolon...","Pre-heating the servers...","Loading the next great idea...","Just a moment, I'm in the zone...","Hold tight, I'm crafting a masterpiece...","Warp speed engaged...","Don't panic...","Following the white rabbit...","The truth is in here... somewhere...","Loading... Do a barrel roll!","Finding a suitable loading screen pun...","Distracting you with this witty phrase...","Almost there... probably...","Hmmm... let me think...","That's not a bug, it's an undocumented feature...","Engage.","I'll be back... with an answer.","Letting the thoughts marinate...","Initiating thoughtful gaze...","Dividing by zero... just kidding!","Buffering... because even AIs need a moment.","Entangling quantum particles for a faster response...","Recalibrating the humor-o-meter.","Enhancing... Enhancing... Still loading.","Have you tried turning it off and on again? (The loading screen, not me.)","Constructing additional pylons...","New line? That's Ctrl+J."],rmt=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function pK(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?rmt:nmt}function smt(){const e=c5(),t=Y9(),n=e!=="idle",r=h.useRef(0),s=h.useRef(0),[i,o]=h.useState({estimatedOutputTokens:0,isReceivingContent:!1}),l=h.useMemo(()=>{let u=0,d=0,f=!1;const m=new Set;let p=-1;for(let g=t.length-1;g>=0;g--)if(t[g].kind==="user"){p=g;break}for(let g=p+1;g<t.length;g++){const b=t[g];if(b.kind==="assistant"&&!b.parentToolCallId&&(u+=b.text.length,b.streaming&&(f=!0)),b.kind==="tool"&&!b.parentToolCallId){if(b.rawInput!==void 0)try{u+=JSON.stringify(b.rawInput).length}catch{}const w=imt(b.rawOutput);w!==void 0&&!m.has(b.toolCallId)&&(d+=w,m.add(b.toolCallId))}}return{chars:u,agentTokens:d,isReceiving:f}},[t]),c=h.useRef(l);return c.current=l,l.chars<s.current&&(r.current=l.chars),s.current=l.chars,h.useEffect(()=>{if(!n){r.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const u=setInterval(()=>{const{chars:d,agentTokens:f,isReceiving:m}=c.current;if(d<r.current){r.current=d,o({estimatedOutputTokens:f+Math.round(d/4),isReceivingContent:m});return}const p=d-r.current;if(p<=0){o(w=>{const y={estimatedOutputTokens:f+Math.round(r.current/4),isReceivingContent:m};return w.estimatedOutputTokens===y.estimatedOutputTokens&&w.isReceivingContent===y.isReceivingContent?w:y});return}let g;p<70?g=3:p<=200?g=Math.max(3,Math.round(p*.2)):g=50;const b=Math.min(r.current+g,d);r.current=b,o({estimatedOutputTokens:f+Math.round(b/4),isReceivingContent:m})},100);return()=>clearInterval(u)},[n]),i}function imt(e){if(typeof e!="object"||e===null||!("type"in e)||e.type!=="task_execution")return;const t=e,n=t.tokenCount;if(typeof n=="number"&&n>0)return n;const r=t.executionSummary;if(typeof r=="object"&&r!==null){const s=r.outputTokens;if(typeof s=="number"&&s>0)return s}}function omt(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function zb(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const amt="_status_zld2v_1",lmt="_spinner_zld2v_11",cmt="_label_zld2v_15",umt="_meta_zld2v_19",mC={status:amt,spinner:lmt,label:cmt,meta:umt},Qj=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function Whe({startedAt:e,showPhrase:t=!0}){const n=c5(),{estimatedOutputTokens:r,isReceivingContent:s}=smt(),{language:i,t:o}=rt(),{loadingPhrases:l}=Vu(),c=h.useRef(l);c.current=l;const u=h.useCallback(T=>{var _;try{return((_=c.current)==null?void 0:_.call(c,T))??pK(T)}catch(C){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",C),pK(T)}},[]),[d,f]=h.useState(0),m=h.useRef(Date.now()),[p,g]=h.useState(0),[b,w]=h.useState(()=>u(i)[0]??""),y=n!=="idle";if(h.useEffect(()=>{if(!y){f(0);return}m.current=e??Date.now(),f(gK(m.current));const T=setInterval(()=>{f(gK(m.current))},1e3);return()=>clearInterval(T)},[y,e]),h.useEffect(()=>{if(!t)return;if(n==="idle"){w(u(i)[0]??"");return}const T=()=>{const C=u(i),j=Math.floor(Math.random()*C.length);w(C[j]??"")};T();const _=setInterval(T,tmt);return()=>clearInterval(_)},[i,n,u,t]),h.useEffect(()=>{if(n==="idle")return;const T=setInterval(()=>{g(_=>(_+1)%Qj.length)},250);return()=>clearInterval(T)},[n]),n==="idle")return null;const v=Qj[p%Qj.length],x=s?"↓":"↑",k=d<60?`${d}s`:dmt(d*1e3),S=r>0?` · ${x} ${o("stream.tokens",{count:omt(r)})}`:"";return a.jsxs("div",{className:mC.status,children:[a.jsx("span",{className:mC.spinner,children:v}),t&&b&&a.jsx("span",{className:mC.label,children:b}),a.jsxs("span",{className:mC.meta,children:["(",k,S," · ",o("stream.cancel"),")"]})]})}function dmt(e){if(e<=0)return"0s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60,i=[];return n>0&&i.push(`${n}h`),r>0&&i.push(`${r}m`),s>0&&i.push(`${s}s`),i.length>0?i.join(" "):"0s"}function gK(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const hmt="_host_1scjy_1",fmt="_toast_1scjy_13",mmt="_message_1scjy_31",pmt="_close_1scjy_39",gmt="_info_1scjy_58",bmt="_success_1scjy_62",ymt="_warning_1scjy_66",vmt="_error_1scjy_70",gx={host:hmt,toast:fmt,message:mmt,close:pmt,info:gmt,success:bmt,warning:ymt,error:vmt};function wmt({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:a.jsx("div",{className:gx.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(r=>a.jsx(xmt,{toast:r,onDismiss:t,autoDismissMs:n},r.id))})}function xmt({toast:e,onDismiss:t,autoDismissMs:n}){const{t:r}=rt();return h.useEffect(()=>{const s=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(s)},[n,t,e.id]),a.jsxs("div",{className:`${gx.toast} ${gx[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[a.jsx("div",{className:gx.message,children:e.message}),a.jsx("button",{type:"button",className:gx.close,onClick:()=>t(e.id),"aria-label":r("toast.dismiss"),title:r("toast.dismissShort"),children:"x"})]})}const kmt="_panel_n876c_1",_mt="_summary_n876c_10",Smt="_progressRing_n876c_27",Cmt="_stepText_n876c_41",Tmt="_statusSegmentWrap_n876c_48",Emt="_separator_n876c_55",Amt="_statusSegment_n876c_48",jmt="_statusSegmentButton_n876c_61",Nmt="_fullText_n876c_83",Imt="_compactText_n876c_87",Mmt="_detail_n876c_106",Rmt="_item_n876c_138",Dmt="_icon_n876c_148",Lmt="_loadingIcon_n876c_156",Pmt="_content_n876c_165",Omt="_completed_n876c_173",$mt="_inProgress_n876c_187",Bmt="_pending_n876c_192",Ia={panel:kmt,summary:_mt,progressRing:Smt,stepText:Cmt,statusSegmentWrap:Tmt,separator:Emt,statusSegment:Amt,statusSegmentButton:jmt,fullText:Nmt,compactText:Imt,detail:Mmt,item:Rmt,icon:Dmt,loadingIcon:Lmt,content:Pmt,completed:Omt,inProgress:$mt,pending:Bmt};function zmt(e){switch(e){case"completed":return Ia.completed;case"in_progress":return Ia.inProgress;case"pending":return Ia.pending}}const Fmt=h.memo(function({todos:t,title:n,statusItems:r=[]}){const{t:s}=rt();if(t.length===0&&r.length===0)return null;const i=t.length,o=i>0,l=t.findIndex(p=>p.status==="in_progress"),c=l>=0?l:t.findIndex(p=>p.status==="pending"),u=o?c>=0?c+1:i:0,d=o?u/i:0,f=r.map(p=>p.ariaLabel??p.title??(typeof p.label=="string"?p.label:void 0)).filter(Boolean).join(", ")||void 0,m=o?s("todo.stepProgress",{current:u,total:i}):f;return a.jsxs("section",{className:Ia.panel,"aria-label":n??(o?s("todo.title"):f),tabIndex:0,children:[a.jsxs("div",{className:Ia.summary,"aria-label":m,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Ia.progressRing,style:{"--todo-progress":String(d)},"aria-hidden":"true"}),a.jsxs("span",{className:Ia.stepText,children:[a.jsx("span",{className:Ia.fullText,children:s("todo.stepProgress",{current:u,total:i})}),a.jsx("span",{className:Ia.compactText,children:s("todo.stepFraction",{current:u,total:i})})]})]}),r.map((p,g)=>a.jsxs("span",{className:Ia.statusSegmentWrap,children:[(i>0||g>0)&&a.jsx("span",{className:Ia.separator,"aria-hidden":"true",children:"·"}),p.onClick?a.jsx("button",{type:"button",className:Ia.statusSegmentButton,title:p.title,"aria-label":p.ariaLabel,onClick:p.onClick,children:p.label}):a.jsx("span",{className:Ia.statusSegment,title:p.title,children:p.label})]},p.id))]}),i>0&&a.jsx("div",{className:Ia.detail,role:"tooltip",children:t.map((p,g)=>a.jsxs("div",{className:`${Ia.item} ${zmt(p.status)}`,children:[a.jsx("span",{className:Ia.icon,"aria-hidden":"true",children:p.status==="in_progress"?a.jsx("span",{className:Ia.loadingIcon}):I3(p.status)}),a.jsx("span",{className:Ia.content,title:p.content,children:p.content})]},`${p.id||g}:${p.content}`))})]})}),qmt="_panel_180sr_1",Hmt="_floating_180sr_16",Umt="_section_180sr_26",Wmt="_sectionHeader_180sr_40",Vmt="_sectionContent_180sr_72",Gmt="_row_180sr_76",Kmt="_workspaceIcon_180sr_119",Ymt="_rowActionIcon_180sr_123",Xmt="_branchName_180sr_129",Qmt="_value_180sr_137",Jmt="_tasks_180sr_147",Zmt="_task_180sr_147",ept="_taskIcon_180sr_185",tpt="_taskLabel_180sr_196",npt="_agentName_180sr_204",rpt="_taskName_180sr_205",spt="_agentColor_180sr_216",ipt="_agentTag_180sr_225",opt="_taskStatus_180sr_236",apt="_statusRunning_180sr_257",Ts={panel:qmt,floating:Hmt,section:Umt,sectionHeader:Wmt,sectionContent:Vmt,row:Gmt,workspaceIcon:Kmt,rowActionIcon:Ymt,branchName:Xmt,value:Qmt,tasks:Jmt,task:Zmt,taskIcon:ept,taskLabel:tpt,agentName:npt,taskName:rpt,agentColor:spt,agentTag:ipt,taskStatus:opt,statusRunning:apt},lpt=["environment","subagents","backgroundTasks"],cpt={red:"#e5484d",blue:"var(--agent-blue-500)",green:"var(--success-color)",yellow:"#d6a900",purple:"var(--agent-purple-600)",orange:"var(--accent-orange)",pink:"#d6409f",cyan:"#0e9888"};function bK(e){switch(e.kind){case"agent":return e.label;case"shell":return e.command;case"monitor":return e.description}}function upt(e){switch(e.kind){case"agent":return a.jsx(Xb,{});case"shell":return a.jsx(_ee,{});case"monitor":return a.jsx(kee,{})}}function yK(e){return`tasks.${e}`}function vK(e){return e==="completed"?a.jsx(u5,{}):e==="running"?a.jsx(Ag,{className:Ts.statusRunning}):e==="failed"?a.jsx(fee,{}):e==="cancelled"?a.jsx(Mxe,{}):null}function gR(e){var t;return((t=e.subagentType)==null?void 0:t.toLowerCase())==="fork"}function dpt(e){return gR(e)?e.label.replace(/^fork:\s*/i,"").trim():e.label}function hpt(e){return e&&cpt[e]||"var(--muted-foreground)"}function fpt({floating:e=!1,hidden:t=!1,workspaceCwd:n,gitWorkspaceCwd:r,gitCwd:s,branch:i,gitStatus:o,tasks:l,agentTasks:c,items:u=lpt,onOpenGitDiff:d,onOpenGitCommit:f,onOpenAgent:m,onOpenTask:p,onDismiss:g}){const{t:b}=rt(),w=h.useRef(null),y=c??l.filter(M=>M.kind==="agent"),v=l.filter(M=>M.kind!=="agent"),[x,k]=h.useState(!0),[S,T]=h.useState(!1),[_,C]=h.useState(!1),[j,E]=h.useState(!1),L=i??(o==null?void 0:o.branch);h.useEffect(()=>{(t||!x||!r||!L)&&E(!1)},[L,x,r,t]),h.useEffect(()=>{if(!e||t||!g||j)return;const M=R=>{var $;R.composedPath().some(B=>B instanceof Element&&B.hasAttribute("data-web-shell-environment-toggle"))||R.target instanceof Node&&!(($=w.current)!=null&&$.contains(R.target))&&g()};return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[j,e,t,g]);const D=[o!=null&&o.operation?b(`git.operation.${o.operation}`):void 0,o!=null&&o.detached?b("git.detached"):void 0,o!=null&&o.staged?b("git.staged",{count:o.staged}):void 0,o!=null&&o.unstaged?b("git.unstaged",{count:o.unstaged}):void 0,o!=null&&o.untracked?b("git.untracked",{count:o.untracked}):void 0,o!=null&&o.conflicted?b("git.conflicted",{count:o.conflicted}):void 0,o!=null&&o.ahead?b("git.ahead",{count:o.ahead}):void 0,o!=null&&o.behind?b("git.behind",{count:o.behind}):void 0,o!=null&&o.stashCount?b("git.stash",{count:o.stashCount}):void 0].filter(M=>!!M);return a.jsxs("aside",{ref:w,className:`${Ts.panel} ${e?Ts.floating:""}`,"aria-label":b("environment.title"),"data-testid":"environment-panel","data-floating":e,hidden:t,children:[u.includes("environment")&&a.jsxs("section",{className:Ts.section,children:[a.jsxs("button",{type:"button",className:Ts.sectionHeader,"aria-expanded":x,onClick:()=>k(M=>!M),children:[a.jsx("span",{children:b("environment.title")}),!x&&a.jsx(Eu,{})]}),x&&a.jsxs("div",{className:Ts.sectionContent,children:[a.jsxs("button",{type:"button",className:Ts.row,disabled:!d,onClick:d,children:[a.jsx(mee,{}),a.jsx("span",{children:b("environment.changes")}),a.jsx("span",{className:Ts.value,children:o===void 0?b("environment.unavailable"):D.length>0?D.join(" · "):b("environment.clean")})]}),a.jsxs("div",{className:Ts.row,title:n,children:[a.jsx(bk,{className:Ts.workspaceIcon}),a.jsx("span",{children:b("environment.workspace")}),a.jsx("span",{className:Ts.value,children:(n==null?void 0:n.split(/[/\\]/).filter(Boolean).at(-1))??b("environment.unavailable")})]}),r&&L?a.jsx(nO,{open:j,onOpenChange:E,workspaceCwd:r,gitCwd:s,side:"left",onOpenDiff:d,onOpenCommit:f,children:a.jsxs("button",{type:"button",className:Ts.row,title:L,children:[a.jsx(ky,{}),a.jsx("span",{className:Ts.branchName,children:L}),a.jsx(Eu,{className:Ts.rowActionIcon})]})}):a.jsxs("div",{className:Ts.row,title:L??void 0,children:[a.jsx(ky,{}),a.jsx("span",{className:Ts.branchName,children:L??b("environment.unavailable")})]})]})]}),u.includes("subagents")&&y.length>0&&a.jsxs("section",{className:Ts.section,children:[a.jsxs("button",{type:"button",className:Ts.sectionHeader,"aria-expanded":S,onClick:()=>T(M=>!M),children:[a.jsx("span",{children:b("environment.agents")}),!S&&a.jsx(Eu,{})]}),S&&a.jsx("ul",{className:Ts.tasks,children:y.map((M,R)=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:Ts.task,disabled:!m,onClick:()=>m==null?void 0:m(M),children:[a.jsxs("span",{className:Ts.taskLabel,children:[!gR(M)&&a.jsx("span",{className:Ts.agentColor,"data-agent-color":M.color??"default",style:{backgroundColor:hpt(M.color)},"aria-hidden":"true"}),gR(M)&&a.jsx("span",{className:Ts.agentTag,children:"fork"}),a.jsx("span",{className:Ts.agentName,children:(()=>{const $=dpt(M).trim();return $&&$.toLowerCase()!=="agent"?$:b("environment.unnamedAgent",{index:R+1})})()})]}),a.jsxs("span",{className:Ts.taskStatus,"data-status":M.status,children:[vK(M.status),b(yK(M.status))]})]})},M.id))})]}),u.includes("backgroundTasks")&&v.length>0&&a.jsxs("section",{className:Ts.section,children:[a.jsxs("button",{type:"button",className:Ts.sectionHeader,"aria-expanded":_,onClick:()=>C(M=>!M),children:[a.jsx("span",{children:b("tasks.title")}),!_&&a.jsx(Eu,{})]}),_&&a.jsx("ul",{className:Ts.tasks,children:v.map(M=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:Ts.task,onClick:()=>p(M),children:[a.jsx("span",{className:Ts.taskIcon,children:upt(M)}),a.jsx("span",{className:Ts.taskLabel,children:a.jsx("span",{className:Ts.taskName,title:bK(M),children:bK(M)})}),a.jsxs("span",{className:Ts.taskStatus,"data-status":M.status,children:[vK(M.status),b(yK(M.status))]})]})},`${M.kind}:${M.id}`))})]})]})}const mpt="_header_kkzqp_1",ppt="_content_kkzqp_11",gpt="_actions_kkzqp_22",bpt="_action_kkzqp_22",Fw={header:mpt,content:ppt,actions:gpt,action:bpt};function ypt({content:e,environmentOpen:t,environmentAvailable:n,rightPanelOpen:r,rightPanelAvailable:s,onToggleEnvironment:i,onToggleRightPanel:o}){const{t:l}=rt();return a.jsxs("header",{className:Fw.header,"data-testid":"chat-context-header",children:[a.jsx("div",{className:Fw.content,children:e}),a.jsxs("div",{className:Fw.actions,children:[n&&a.jsx("button",{type:"button",className:Fw.action,"data-web-shell-environment-toggle":!0,"aria-label":l("chatHeader.toggleEnvironment"),"aria-pressed":t,title:l("chatHeader.toggleEnvironment"),onClick:i,children:a.jsx(Lke,{})}),s&&a.jsx("button",{type:"button",className:Fw.action,"aria-label":l("chatHeader.toggleRightPanel"),"aria-pressed":r,title:l("chatHeader.toggleRightPanel"),onClick:o,children:a.jsx(vee,{})})]})]})}const vpt="_header_leiy3_1",wpt="_titleRow_leiy3_11",xpt="_title_leiy3_11",kpt="_subtitle_leiy3_31",pC={header:vpt,titleRow:wpt,title:xpt,subtitle:kpt};function _pt(e){const{t}=rt();return a.jsxs("div",{className:pC.header,children:[a.jsxs("div",{className:pC.titleRow,children:[a.jsx("span",{children:t("welcome.titlePrefix")}),a.jsx("span",{className:pC.title,children:"Qwen Code"})]}),a.jsx("div",{className:pC.subtitle,children:t("welcome.prompt")})]})}const Spt="_root_kd322_1",Cpt={root:Spt};function Tpt(){const e=h.useRef(null),t=h.useRef(null),n=rm(),r=eO();return h.useEffect(()=>{const s=e.current,i=t.current,o=i==null?void 0:i.getContext("2d",{alpha:!0});if(!s||!i||!o)return;const l=[],c={x:-9999,y:-9999,previousX:-9999,previousY:-9999,speed:0};let u=0,d=0,f=0,m=0,p=0,g=!1,b=!0,w;const y=()=>{l.length=0;const _=15,C=Math.floor(u/_),j=Math.floor(d/_),E=u%_/2,L=d%_/2;for(let D=0;D<j;D+=1)for(let M=0;M<C;M+=1){const R=E+M*_+_/2,$=L+D*_+_/2;l.push({anchorX:R,anchorY:$,x:R,y:$})}},v=()=>{const _=Math.min(c.speed/5,1);f+=(_-f)*.06,f<.001&&(f=0),m+=(f-m)*.08;let C=f===0&&m<.001;if(C){for(const E of l)if(Math.abs(E.x-E.anchorX)>.01||Math.abs(E.y-E.anchorY)>.01){C=!1;break}}if(C&&!b){g=!1,p=0;return}o.clearRect(0,0,u,d),o.fillStyle=n===Fs.Light?"rgba(172, 191, 255, 0.85)":"rgba(172, 191, 255, 0.42)",o.beginPath();const j=500*500;for(const E of l){const L=c.x-E.anchorX,D=c.y-E.anchorY,M=L*L+D*D;if(!r&&M<j&&f>.01){const $=1-Math.sqrt(M)/500,B=$*$*67*f,N=Math.atan2(D,L);E.x+=(E.anchorX-Math.cos(N)*B-E.x)*.15,E.y+=(E.anchorY-Math.sin(N)*B-E.y)*.15}else E.x+=(E.anchorX-E.x)*.1,E.y+=(E.anchorY-E.y)*.1;o.moveTo(E.x+.5,E.y),o.arc(E.x,E.y,.5,0,Math.PI*2)}if(o.fill(),!r&&m>.001){const E=o.createRadialGradient(c.x,c.y,0,c.x,c.y,160);E.addColorStop(0,"rgba(0, 0, 0, 1)"),E.addColorStop(1,"rgba(0, 0, 0, 0)"),o.globalAlpha=m,o.globalCompositeOperation="destination-out",o.fillStyle=E,o.fillRect(c.x-160,c.y-160,320,320),o.globalCompositeOperation="source-over",o.globalAlpha=1}b=!1,r||(p=window.requestAnimationFrame(v))},x=()=>{!r&&!g&&(g=!0,p=window.requestAnimationFrame(v))},k=()=>{const _=Math.min(window.devicePixelRatio||1,2),C=s.getBoundingClientRect();u=C.width,d=C.height,i.width=Math.ceil(u*_),i.height=Math.ceil(d*_),o.setTransform(_,0,0,_,0,0),y(),b=!0,r?v():x()},S=_=>{const C=s.getBoundingClientRect(),j=_.clientX-C.left,E=_.clientY-C.top;c.previousX===-9999&&(c.previousX=j,c.previousY=E),c.x=j,c.y=E,x()},T=new ResizeObserver(k);return T.observe(s),k(),r||(window.addEventListener("pointermove",S,{passive:!0}),w=window.setInterval(()=>{const _=c.previousX-c.x,C=c.previousY-c.y,j=Math.hypot(_,C);c.speed+=(j-c.speed)*.5,c.speed<.001&&(c.speed=0),c.previousX=c.x,c.previousY=c.y,c.speed>0&&x()},20)),()=>{window.cancelAnimationFrame(p),w!==void 0&&window.clearInterval(w),T.disconnect(),window.removeEventListener("pointermove",S)}},[r,n]),a.jsx("div",{ref:e,className:Cpt.root,"data-web-shell-new-session-dot-field":!0,"aria-hidden":"true",children:a.jsx("canvas",{ref:t})})}const Ept="_themeDark_1tp31_1",Apt="_themeLight_1tp31_25",wK={themeDark:Ept,themeLight:Apt},jpt={sm:"sm:max-w-[420px]",md:"sm:max-w-[560px]",lg:"sm:max-w-[720px]",xl:"sm:max-w-[900px]"},Npt=["a[href]:not([hidden])","button:not([disabled]):not([hidden])","input:not([disabled]):not([hidden])","select:not([disabled]):not([hidden])","textarea:not([disabled]):not([hidden])",'[tabindex]:not([tabindex="-1"]):not([hidden])'].join(",");function xK(e){return e?Array.from(e.querySelectorAll(Npt)):[]}const Fb=[],Vhe=h.createContext(null);function bR(e){return e===null?!0:Fb[Fb.length-1]===e}function zi({title:e,subtitle:t,size:n="md",allowFullscreen:r=!1,dismissible:s=!0,onClose:i,children:o}){const{t:l}=rt(),c=rm(),[u,d]=h.useState(!1),f=h.useRef(null),m=h.useRef(i);m.current=i;const[p]=h.useState(()=>typeof document<"u"?document.activeElement:null),g=h.useRef(!1),b=h.useRef(!1),w=h.useRef(null);w.current===null&&(w.current={}),h.useEffect(()=>{const S=w.current;Fb.push(S);const T=_=>{_.key!=="Escape"||!_.isComposing&&_.keyCode!==229||!bR(S)||(Object.defineProperty(_,"key",{configurable:!0,value:"Process"}),document.addEventListener("keydown",C=>{C===_&&Reflect.deleteProperty(_,"key")},{capture:!0,once:!0}))};return window.addEventListener("keydown",T,{capture:!0}),()=>{var L,D;window.removeEventListener("keydown",T,{capture:!0});const _=Fb.indexOf(S);if(_>=0&&Fb.splice(_,1),Fb.length===0){(L=p==null?void 0:p.focus)==null||L.call(p);return}const C=Array.from(document.querySelectorAll("[data-keyboard-scope]")),j=C[C.length-1];(D=xK(j).find(M=>!M.hasAttribute("data-dialog-close"))??j)==null||D.focus()}},[p]);const y=S=>{g.current=S.target===S.currentTarget,b.current=!1},v=S=>{b.current=S.target===S.currentTarget},x=S=>{const T=g.current&&b.current&&S.target===S.currentTarget;g.current=!1,b.current=!1,T&&s&&i()},k=c===Fs.Light?wK.themeLight:wK.themeDark;return a.jsx(zp,{open:!0,onOpenChange:S=>{!S&&s&&i()},children:a.jsx(Vhe.Provider,{value:w.current,children:a.jsxs(Fp,{ref:f,showCloseButton:!1,overlayProps:{onMouseDown:y,onMouseUp:v,onClick:x},className:`${k} ${c===Fs.Dark?"dark":""} flex max-h-[min(80vh,calc(100vh-48px))] flex-col gap-0 overflow-hidden p-0 font-mono text-sm ${u?"h-[calc(100vh-32px)] max-h-[calc(100vh-32px)] max-w-[calc(100vw-32px)] sm:max-w-[calc(100vw-32px)]":jpt[n]}`,"aria-label":e,"data-keyboard-scope":!0,"data-web-shell-dialog":!0,"data-web-shell-dialog-title":e,onPointerDownOutside:S=>S.preventDefault(),onEscapeKeyDown:S=>{S.defaultPrevented||S.isComposing||S.keyCode===229||bR(w.current)&&(S.preventDefault(),s&&m.current())},onOpenAutoFocus:S=>{var _;S.preventDefault(),(_=xK(f.current).find(C=>!C.hasAttribute("data-dialog-close"))??f.current)==null||_.focus()},onCloseAutoFocus:S=>S.preventDefault(),children:[a.jsxs(qp,{className:"flex-row items-center gap-2 border-b px-4 py-2.5 text-left",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx(Up,{children:e}),t&&a.jsx(Hg,{className:"mt-0.5 text-xs",children:t})]}),r&&a.jsx(Zt,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>d(S=>!S),"aria-label":l(u?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":u,title:l(u?"common.exitFullscreen":"common.fullscreen"),children:u?a.jsx(yee,{}):a.jsx(bee,{})}),s&&a.jsx(YI,{asChild:!0,children:a.jsx(Zt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":l("common.close"),title:l("common.close"),"data-dialog-close":!0,children:a.jsx(cv,{})})})]}),a.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4","data-dialog-fullscreen":u?"":void 0,children:o})]})})})}function gC(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const Ipt=new Set(["button","submit","reset"]),Mpt=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function kK(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;if(t==="BUTTON"||t==="A"||t==="TEXTAREA")return!0;if(t==="INPUT")return Ipt.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function Jj(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!Mpt.has(e.type):e.isContentEditable===!0}function v0({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r,enabled:s=!0}){const i=h.useContext(Vhe),o=h.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r};const[l,c]=h.useState(!1);return h.useEffect(()=>{if(!s)return;const u=()=>c(!0),d=()=>c(!1),f=m=>{if(!bR(i)||m.defaultPrevented||m.isComposing||m.keyCode===229||m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;const{itemCount:p,activeIndex:g}=o.current;if(!(p<=0))switch(m.key){case"ArrowDown":m.preventDefault(),u(),o.current.onActiveIndexChange(gC(g+1,p));break;case"ArrowUp":m.preventDefault(),u(),o.current.onActiveIndexChange(gC(g-1,p));break;case"Home":if(Jj())return;m.preventDefault(),u(),o.current.onActiveIndexChange(0);break;case"End":if(Jj())return;m.preventDefault(),u(),o.current.onActiveIndexChange(p-1);break;case"Enter":{if(kK()||g<0)return;m.preventDefault(),o.current.onConfirm(gC(g,p));break}case" ":{if(kK()||Jj()||g<0)return;m.preventDefault(),o.current.onConfirm(gC(g,p));break}}};return window.addEventListener("keydown",f),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",f),window.removeEventListener("mousemove",d)}},[i,s]),{keyboardMode:l}}const Rpt="_picker_5cmbf_4",Dpt="_selected_5cmbf_98",Lpt="_disabled_5cmbf_114",Ppt={picker:Rpt,"picker-in-shell":"_picker-in-shell_5cmbf_15","picker-search":"_picker-search_5cmbf_22","picker-search-label":"_picker-search-label_5cmbf_31","picker-search-input":"_picker-search-input_5cmbf_35","picker-search-hint":"_picker-search-hint_5cmbf_45","picker-sep":"_picker-sep_5cmbf_49","picker-list":"_picker-list_5cmbf_54","picker-list-compact":"_picker-list-compact_5cmbf_67","picker-empty":"_picker-empty_5cmbf_71","picker-item":"_picker-item_5cmbf_77","picker-session-item":"_picker-session-item_5cmbf_93",selected:Dpt,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:Lpt,"picker-item-row":"_picker-item-row_5cmbf_119","picker-item-title":"_picker-item-title_5cmbf_128","picker-item-checkbox":"_picker-item-checkbox_5cmbf_139","picker-item-checkbox-checked":"_picker-item-checkbox-checked_5cmbf_153","picker-item-meta":"_picker-item-meta_5cmbf_163","picker-item-detail":"_picker-item-detail_5cmbf_171","dialog-current":"_dialog-current_5cmbf_185","picker-item-confirmed":"_picker-item-confirmed_5cmbf_186","picker-item-badge":"_picker-item-badge_5cmbf_217","tools-status-badge":"_tools-status-badge_5cmbf_226","tools-status-badge-enabled":"_tools-status-badge-enabled_5cmbf_237","tools-status-badge-disabled":"_tools-status-badge-disabled_5cmbf_241","tools-status-badge-busy":"_tools-status-badge-busy_5cmbf_245","tools-picker-item":"_tools-picker-item_5cmbf_249","tools-picker-item-expanded":"_tools-picker-item-expanded_5cmbf_260","tools-item-icon":"_tools-item-icon_5cmbf_264","tools-item-chevron":"_tools-item-chevron_5cmbf_296","tools-item-chevron-expanded":"_tools-item-chevron-expanded_5cmbf_308","tools-item-detail":"_tools-item-detail_5cmbf_312","mcp-status":"_mcp-status_5cmbf_317","mcp-status-connected":"_mcp-status-connected_5cmbf_321","mcp-status-connecting":"_mcp-status-connecting_5cmbf_325","mcp-status-disconnected":"_mcp-status-disconnected_5cmbf_329","mcp-status-disabled":"_mcp-status-disabled_5cmbf_333","mcp-status-unknown":"_mcp-status-unknown_5cmbf_334","dialog-inline-button":"_dialog-inline-button_5cmbf_338","dialog-primary-button":"_dialog-primary-button_5cmbf_339","dialog-danger-button":"_dialog-danger-button_5cmbf_340","dialog-inline-actions":"_dialog-inline-actions_5cmbf_363","dialog-footer-actions":"_dialog-footer-actions_5cmbf_369","dialog-form":"_dialog-form_5cmbf_387","dialog-form-row":"_dialog-form-row_5cmbf_415","dialog-textarea":"_dialog-textarea_5cmbf_421","dialog-split":"_dialog-split_5cmbf_426","dialog-split-list":"_dialog-split-list_5cmbf_433","tools-desc-expanded":"_tools-desc-expanded_5cmbf_437","tools-desc-body":"_tools-desc-body_5cmbf_447","extensions-toolbar":"_extensions-toolbar_5cmbf_454","extensions-row-button":"_extensions-row-button_5cmbf_458","extensions-detail":"_extensions-detail_5cmbf_473","extensions-detail-actions":"_extensions-detail-actions_5cmbf_484","extensions-detail-grid":"_extensions-detail-grid_5cmbf_491","extensions-detail-field":"_extensions-detail-field_5cmbf_497","extensions-detail-label":"_extensions-detail-label_5cmbf_504","extensions-detail-value":"_extensions-detail-value_5cmbf_510","extensions-confirm":"_extensions-confirm_5cmbf_517","dialog-detail":"_dialog-detail_5cmbf_527","dialog-detail-title":"_dialog-detail-title_5cmbf_535","dialog-detail-shortcut":"_dialog-detail-shortcut_5cmbf_543","dialog-detail-meta":"_dialog-detail-meta_5cmbf_550","dialog-detail-body":"_dialog-detail-body_5cmbf_555"};function _n(...e){return e.filter(t=>!!t).map(t=>Ppt[t]).filter(Boolean).join(" ")}const Opt="_list_jbgdx_1",$pt="_row_jbgdx_16",Bpt="_selected_jbgdx_32",zpt="_keyboardOnly_jbgdx_39",Fpt="_modeName_jbgdx_47",qpt="_modeIcon_jbgdx_51",Hpt="_modeText_jbgdx_67",Upt="_modeDesc_jbgdx_83",Im={list:Opt,row:$pt,selected:Bpt,keyboardOnly:zpt,modeName:Fpt,modeIcon:qpt,modeText:Hpt,modeDesc:Upt};function Wpt({currentMode:e,onSelect:t}){const{t:n}=rt(),r=h.useRef(null),s=ov.map(m=>({id:m,name:n(`mode.listLabel.${m}`),description:n(`mode.desc.${m}`)})),i=s.findIndex(m=>m.id===e),[o,l]=h.useState(i>=0?i:0),c=h.useRef(!1);h.useEffect(()=>{c.current||i<0||l(i)},[i]);const u=m=>{c.current=!0,l(m)},d=m=>{const p=s[m];p&&t(p.id)},{keyboardMode:f}=v0({itemCount:s.length,activeIndex:o,onActiveIndexChange:u,onConfirm:d});return h.useEffect(()=>{var p;const m=(p=r.current)==null?void 0:p.children[o];m==null||m.scrollIntoView({block:"nearest"})},[o]),a.jsx("div",{className:`${Im.list} ${f?Im.keyboardOnly:""}`,ref:r,role:"listbox",tabIndex:0,"aria-activedescendant":s.length>0?`mode-opt-${o}`:void 0,"aria-label":n("mode.select"),"data-web-shell-approval-mode-dialog":!0,children:s.map((m,p)=>{const g=p===o,b=m.id===e;return a.jsxs("div",{id:`mode-opt-${p}`,role:"option","aria-selected":b,className:`${Im.row} ${g?Im.selected:""} ${b?_n("dialog-current"):""}`,"data-web-shell-approval-mode-option":!0,"data-mode-id":m.id,onClick:()=>d(p),onMouseMove:()=>u(p),children:[a.jsx("span",{className:Im.modeIcon,children:a.jsx(px,{mode:m.id})}),a.jsxs("span",{className:Im.modeText,children:[a.jsx("span",{className:Im.modeName,children:m.name}),a.jsx("span",{className:Im.modeDesc,children:m.description})]})]},m.id)})})}function K6(e){const[t,n]=h.useState(""),[r,s]=h.useState(""),i=h.useRef(!1),o=h.useRef(""),l=h.useRef(e);l.current=e;const c=h.useCallback(m=>{var p;m!==o.current&&(o.current=m,s(m),(p=l.current)==null||p.call(l,m))},[]),u=h.useCallback(m=>{const p=m.target.value;n(p),i.current||c(p)},[c]),d=h.useCallback(()=>{i.current=!0},[]),f=h.useCallback(m=>{i.current=!1;const p=m.currentTarget.value;n(p),c(p)},[c]);return{filterValue:r,inputProps:{value:t,onChange:u,onCompositionStart:d,onCompositionEnd:f}}}function Uy(e,t){const n=Date.now()-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return t("time.justNow");if(r<60)return t("time.minutesAgo",{count:r});const s=Math.floor(r/60);if(s<24)return t("time.hoursAgo",{count:s});const i=Math.floor(s/24);return i<7?t("time.daysAgo",{count:i}):new Date(e).toLocaleDateString()}function sO({session:e,active:t,current:n,confirmed:r,disabled:s,currentLabel:i,optionId:o,ariaSelected:l,leading:c,trailing:u,resumeSelector:d,onClick:f,onActivate:m}){const{t:p}=rt(),g=e.updatedAt||e.createdAt;return a.jsxs("div",{id:o,role:"option","aria-selected":l??n,"aria-current":n?"true":void 0,"aria-disabled":s||void 0,className:_n("picker-item","picker-session-item",t?"selected":void 0,n?"dialog-current":void 0,r?"picker-item-confirmed":void 0,s?"disabled":void 0),title:n?i:void 0,"data-web-shell-resume-session":d?"":void 0,"data-session-id":d?e.sessionId:void 0,onClick:f,onMouseMove:m,children:[a.jsxs("div",{className:_n("picker-item-row"),children:[c,a.jsx("span",{className:_n("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),u]}),a.jsxs("div",{className:_n("picker-item-meta"),children:[a.jsx("span",{children:g&&Uy(g,p)}),a.jsx("span",{className:_n("picker-item-detail"),children:p("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&a.jsx("span",{className:_n("picker-item-detail"),children:p("resume.activePrompt")})]})]})}function G_(e,t={}){const{autoLoad:n=!1,enabled:r=!0,pageSize:s,archiveState:i,view:o,group:l}=t,c=JC({autoLoad:n,enabled:r&&!e,pageSize:s,archiveState:i,view:o,group:l,sourceType:rh}),{reload:u,deleteSession:d,deleteSessions:f}=c,m=yo(),p=h.useRef(0),[g,b]=h.useState({sessions:[],loading:!1}),w=h.useCallback(async()=>{if(!e||!r)return[];const S=++p.current;b(T=>({cwd:e,sessions:T.cwd===e?T.sessions:[],loading:!0}));try{const _=(await m.client.workspaceByCwd(e).listWorkspaceSessions({pageSize:s,archiveState:i,view:o,group:l,sourceType:rh})).map(C=>({...C,workspaceCwd:e}));return p.current===S&&b({cwd:e,sessions:_,loading:!1}),_}catch(T){const _=T instanceof Error?T:new Error(String(T));throw p.current===S&&b({cwd:e,sessions:[],loading:!1,error:_}),_}},[i,r,l,s,o,m.client,e]);h.useEffect(()=>{if(e)return p.current+=1,b({cwd:e,sessions:[],loading:n&&r}),n&&r&&w().catch(()=>{}),()=>{p.current+=1}},[n,r,w,e]);const y=h.useCallback(()=>e?w():u(),[u,w,e]),v=h.useCallback(async S=>{if(!e)return f(S);const T=await m.client.workspaceByCwd(e).deleteSessionsData(S);return await w(),T},[f,w,m.client,e]),x=h.useCallback(async S=>{if(!e)return d(S);const T=await v([S]);if(T.errors.length>0)throw new Error(T.errors[0].error);return T.removed.length>0||T.notFound.length>0},[d,v,e]);if(!e)return c;const k=g.cwd===e?g:void 0;return{sessions:(k==null?void 0:k.sessions)??[],loading:(k==null?void 0:k.loading)??(n&&r),error:k==null?void 0:k.error,reload:y,deleteSession:x,deleteSessions:v,releaseSession:c.releaseSession}}const yR="resume-session-list",_K=e=>`${yR}-opt-${e}`;function Vpt({onSelect:e,onClose:t,workspaceCwd:n}){const{t:r}=rt(),s=qa(),{sessions:i,loading:o,error:l}=G_(n,{autoLoad:!0}),c=s.sessionId,[u,d]=h.useState(-1),{filterValue:f,inputProps:m}=K6(()=>d(-1)),p=h.useRef(null),g=h.useRef(null),b=f?i.filter(v=>{const x=f.toLowerCase();return(v.displayName||"").toLowerCase().includes(x)||v.sessionId.toLowerCase().includes(x)}):i;h.useEffect(()=>{u>=b.length&&b.length>0&&d(b.length-1)},[b.length,u]),h.useEffect(()=>{var x;const v=(x=p.current)==null?void 0:x.children[u];v==null||v.scrollIntoView({block:"nearest"})},[u]);const w=v=>{const x=b[v];x&&(e(x.sessionId),t())},{keyboardMode:y}=v0({itemCount:b.length,activeIndex:u,onActiveIndexChange:d,onConfirm:w});return h.useEffect(()=>{var v;(v=g.current)==null||v.focus()},[]),a.jsxs("div",{className:_n("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[a.jsxs("div",{className:_n("picker-search"),children:[a.jsxs("span",{className:_n("picker-search-label"),children:[r("resume.search"),":"," "]}),a.jsx("input",{ref:g,className:_n("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":yR,"aria-activedescendant":u>=0&&u<b.length?_K(u):void 0,...m,placeholder:""})]}),a.jsx("div",{className:_n("picker-sep")}),a.jsxs("div",{id:yR,role:"listbox",className:_n("picker-list",y?"picker-keyboard-only":void 0),ref:p,children:[o&&a.jsx("div",{className:_n("picker-empty"),children:r("common.loading")}),!o&&l&&a.jsx("div",{className:_n("picker-empty"),children:l.message||r("resume.failedToLoad")}),!o&&!l&&b.length===0&&a.jsx("div",{className:_n("picker-empty"),children:f?r("resume.noMatch",{query:f}):r("resume.none")}),!o&&b.map((v,x)=>a.jsx(sO,{session:v,optionId:_K(x),active:x===u,current:v.sessionId===c,currentLabel:r("resume.current"),resumeSelector:!0,onClick:()=>w(x),onActivate:()=>d(x)},v.sessionId))]})]})}const Gpt="_layout_1sigx_1",Kpt="_list_1sigx_9",Ypt="_row_1sigx_23",Xpt="_selected_1sigx_39",Qpt="_keyboardOnly_1sigx_46",Jpt="_label_1sigx_54",Zpt="_divider_1sigx_58",e0t="_number_1sigx_65",t0t="_provider_1sigx_71",n0t="_badge_1sigx_86",r0t="_detail_1sigx_92",s0t="_detailRow_1sigx_104",i0t="_detailLabel_1sigx_111",o0t="_detailValue_1sigx_117",a0t="_empty_1sigx_122",Pl={layout:Gpt,list:Kpt,row:Ypt,selected:Xpt,keyboardOnly:Qpt,label:Jpt,divider:Zpt,number:e0t,provider:t0t,badge:n0t,detail:r0t,detailRow:s0t,detailLabel:i0t,detailValue:o0t,empty:a0t};function l0t(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function c0t(e,t){if(!e)return t("model.modality.textOnly");const n=[];return e.image&&n.push(t("model.modality.image")),e.pdf&&n.push(t("model.modality.pdf")),e.audio&&n.push(t("model.modality.audio")),e.video&&n.push(t("model.modality.video")),n.length===0?t("model.modality.textOnly"):`${t("model.modality.text")} · ${n.join(" · ")}`}function SK(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function u0t(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function d0t(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function h0t(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function bC({label:e,value:t}){return a.jsxs("div",{className:Pl.detailRow,children:[a.jsx("span",{className:Pl.detailLabel,children:e}),a.jsx("span",{className:Pl.detailValue,children:t})]})}function f0t({mode:e="main",onSelect:t,models:n,currentModelId:r}){const s=qa(),i=r??s.currentModel??"",o=h.useMemo(()=>n??s.models??[],[n,s.models]),{t:l}=rt(),c=h.useRef(null),u=e==="fast",d=e==="voice",f=e==="vision",m=o.findIndex(k=>k.id===i),[p,g]=h.useState(m>=0?m:0),b=h.useRef(!1);h.useEffect(()=>{b.current||o.length===0||g(m>=0?m:0)},[o.length,m]);const w=k=>{b.current=!0,g(k)};h.useEffect(()=>{p>=o.length&&o.length>0&&g(o.length-1)},[o.length,p]);const y=o[p]??o[0],v=k=>{const S=o[k];S&&t(h0t(S,u))},{keyboardMode:x}=v0({itemCount:o.length,activeIndex:p,onActiveIndexChange:w,onConfirm:v});return h.useEffect(()=>{var S;const k=(S=c.current)==null?void 0:S.children[p];k==null||k.scrollIntoView({block:"nearest"})},[p]),a.jsxs("div",{className:Pl.layout,children:[a.jsxs("div",{className:`${Pl.list} ${x?Pl.keyboardOnly:""}`,ref:c,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${p}`:void 0,"aria-label":l(u?"model.setFast":d?"model.setVoice":f?"model.setVision":"model.select"),"data-web-shell-model-dialog":!0,children:[o.length===0?a.jsx("div",{className:Pl.empty,children:l("model.none")}):null,o.map((k,S)=>{const T=S===p,_=S===m,C=SK(k);return a.jsxs("div",{id:`model-opt-${S}`,role:"option","aria-selected":_,className:`${Pl.row} ${T?Pl.selected:""} ${_?_n("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":k.id,onClick:()=>v(S),onMouseMove:()=>w(S),children:[a.jsxs("span",{className:Pl.number,children:[S+1,"."]}),C?a.jsxs("span",{className:Pl.provider,children:["[",C,"]"]}):null,a.jsx("span",{className:Pl.label,children:u0t(k)}),k.isRuntime?a.jsx("span",{className:Pl.badge,children:l("common.runtime")}):null]},d0t(k))})]}),y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Pl.divider}),a.jsxs("div",{className:Pl.detail,children:[a.jsx(bC,{label:l("model.modality"),value:c0t(y.modalities,l)}),a.jsx(bC,{label:l("model.contextWindow"),value:l0t(y.contextWindow,l)}),SK(y)!=="qwen-oauth"?a.jsxs(a.Fragment,{children:[a.jsx(bC,{label:l("model.baseUrl"),value:y.baseUrl??l("model.default")}),a.jsx(bC,{label:l("model.apiKey"),value:y.envKey??l("model.notSet")})]}):null]})]}):null]})}const m0t="_body_2kfet_1",p0t="_hint_2kfet_8",g0t="_list_2kfet_13",b0t="_empty_2kfet_21",y0t="_row_2kfet_27",v0t="_rowSelected_2kfet_51",w0t="_badge_2kfet_56",x0t="_label_2kfet_74",k0t="_footer_2kfet_78",_0t="_count_2kfet_86",S0t="_actions_2kfet_91",C0t="_cancel_2kfet_96",T0t="_confirm_2kfet_97",Ic={body:m0t,hint:p0t,list:g0t,empty:b0t,row:y0t,rowSelected:v0t,badge:w0t,label:x0t,footer:k0t,count:_0t,actions:S0t,cancel:C0t,confirm:T0t};function E0t({models:e,current:t,max:n,onConfirm:r,onClose:s}){const{t:i}=rt(),[o,l]=h.useState(()=>{const d=new Set,f=[];for(const m of t){const p=m.trim();if(!(!p||d.has(p))&&(d.add(p),f.push(p),f.length>=n))break}return f}),c=h.useMemo(()=>{const d=new Set(e.map(m=>m.baseId)),f=o.filter(m=>!d.has(m)).map(m=>({baseId:m,label:m}));return[...e,...f]},[e,o]),u=d=>{l(f=>f.includes(d)?f.filter(m=>m!==d):f.length>=n?f:[...f,d])};return a.jsxs("div",{className:Ic.body,children:[a.jsx("div",{className:Ic.hint,children:i("settings.models.fallbacks.hint",{max:n})}),a.jsxs("div",{className:Ic.list,role:"group","aria-label":i("settings.models.fallbacks.title"),children:[c.length===0&&a.jsx("div",{className:Ic.empty,children:i("settings.models.fallbacks.empty")}),c.map(d=>{const f=o.indexOf(d.baseId),m=f>=0,p=o.length>=n&&!m;return a.jsxs("button",{type:"button","aria-pressed":m,className:`${Ic.row} ${m?Ic.rowSelected:""}`,"aria-disabled":p||void 0,title:p?i("settings.models.fallbacks.limitReached",{max:n}):void 0,onClick:()=>u(d.baseId),children:[a.jsx("span",{className:Ic.badge,children:m?f+1:""}),a.jsx("span",{className:Ic.label,children:d.label})]},d.baseId)})]}),a.jsxs("div",{className:Ic.footer,children:[a.jsxs("span",{className:Ic.count,children:[o.length,"/",n]}),a.jsxs("div",{className:Ic.actions,children:[a.jsx("button",{type:"button",className:Ic.cancel,onClick:s,children:i("settings.models.cancel")}),a.jsx("button",{type:"button",className:Ic.confirm,onClick:()=>r(o),children:i("settings.models.fallbacks.confirm")})]})]})]})}function A0t(e,t,n="all"){const r=t.trim().toLowerCase();return e.filter(s=>n!=="all"&&s.level!==n?!1:r?s.name.toLowerCase().includes(r):!0)}function CK(e,t){return e?t.find(n=>n.name===e.name&&n.level===e.level)??null:null}function TK(e,t){return e.level!=="user"?!1:t.some(n=>n.level==="project"&&n.name===e.name)}function j0t(e){return(e.level==="project"||e.level==="user")&&!e.isBuiltin}function EK(e){if(e==="project")return"workspace";if(e==="user")return"global"}function iO({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return a.jsx(wLe,{"data-slot":"separator",decorative:n,orientation:t,className:ln("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...r})}function uy({className:e,...t}){return a.jsx("div",{"data-slot":"field-group",className:ln("group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...t})}const N0t=d1("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function fo({className:e,orientation:t="vertical",...n}){return a.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:ln(N0t({orientation:t}),e),...n})}function Ghe({className:e,...t}){return a.jsx("div",{"data-slot":"field-content",className:ln("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...t})}function aa({className:e,...t}){return a.jsx(Ug,{"data-slot":"field-label",className:ln("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function I0t({className:e,...t}){return a.jsx("div",{"data-slot":"field-label",className:ln("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function ld({className:e,...t}){return a.jsx("p",{"data-slot":"field-description",className:ln("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function M0t({className:e,children:t,errors:n,...r}){const s=h.useMemo(()=>{var o;if(t)return t;if(!(n!=null&&n.length))return null;const i=[...new Map(n.map(l=>[l==null?void 0:l.message,l])).values()];return(i==null?void 0:i.length)==1?(o=i[0])==null?void 0:o.message:a.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((l,c)=>(l==null?void 0:l.message)&&a.jsx("li",{children:l.message},c))})},[t,n]);return s?a.jsx("div",{role:"alert","data-slot":"field-error",className:ln("text-sm font-normal text-destructive",e),...r,children:s}):null}const R0t=d1("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",success:"border-[var(--success-color)]/30 bg-[var(--success-bg)] text-[var(--success-color)] *:data-[slot=alert-description]:text-[var(--success-color)]"}},defaultVariants:{variant:"default"}});function oo({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:ln(R0t({variant:t}),e),...n})}function Wl({className:e,...t}){return a.jsx("div",{"data-slot":"alert-title",className:ln("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function ao({className:e,...t}){return a.jsx("div",{"data-slot":"alert-description",className:ln("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),...t})}function D0t({className:e,...t}){return a.jsx("div",{"data-slot":"alert-action",className:ln("absolute top-2 right-2",e),...t})}function Hr({className:e,...t}){return a.jsx(Ag,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:ln("size-4 animate-spin",e),...t})}function pc({children:e,closeLabel:t,noticeKey:n,onDismiss:r,tone:s,className:i}){const o=h.useRef(r);return o.current=r,h.useEffect(()=>{if(s==="error"||s==="progress")return;const l=window.setTimeout(()=>o.current(),3e3);return()=>window.clearTimeout(l)},[n,s]),a.jsxs(oo,{variant:s==="error"?"destructive":s==="success"?"success":"default",children:[s==="error"?a.jsx(Oa,{}):s==="success"?a.jsx(u5,{}):s==="progress"?a.jsx(Hr,{}):a.jsx(d5,{}),a.jsx(ao,{className:i,children:e}),s!=="progress"?a.jsx(D0t,{children:a.jsx(Zt,{type:"button",variant:"ghost",size:"icon-xs","aria-label":t,title:t,onClick:r,children:a.jsx(cv,{})})}):null]})}function y1({className:e,orientation:t="horizontal",...n}){return a.jsx(ELe,{orientation:t,"data-slot":"tabs","data-orientation":t,className:ln("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const L0t=d1("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function v1({className:e,variant:t="default",...n}){return a.jsx(ALe,{"data-slot":"tabs-list","data-variant":t,className:ln(L0t({variant:t}),e),...n})}function ci({className:e,...t}){return a.jsx(jLe,{"data-slot":"tabs-trigger",className:ln("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function Fi({className:e,...t}){return a.jsx(NLe,{"data-slot":"tabs-content",className:ln("flex-1 text-sm outline-none",e),...t})}function og({className:e,...t}){return a.jsx("textarea",{"data-slot":"textarea",className:ln("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function P0t(e,t){const n=new Set(Object.values(t).flatMap(r=>r.map(s=>s.name)));return e.filter(r=>r.enabled&&!r.name.startsWith("mcp__")&&!n.has(r.name))}function O0t(e){return e.filter(t=>!t.disabled&&(t.mcpStatus==="connected"||t.mcpStatus===void 0&&t.status==="ok")).map(t=>t.name)}function $0t(e,t){if(!e.trim())return;const n=JSON.parse(e);if(!Pm(n))throw new Error(`${t} must be a JSON object`);return n}function Pm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function B0t(e){return(e instanceof Error?e.message:String(e)).replace(/^[A-Z]+ \/\S+:\s*/,"")}function vR(e,t,n){const r=new Set(e);return n?r.add(t):r.delete(t),r}const AK=["inherit",...ov],z0t=1500,F0t=40;function jK({initialScope:e="global",agent:t,onCancel:n,onCreated:r}){var yt,cn;const{t:s}=rt(),{createAgent:i,updateAgent:o,generateContent:l}=lee({autoLoad:!1}),c=cee({autoLoad:!1}),u=X9({autoLoad:!1}),d=Q9({autoLoad:!0}),f=u.loadTools,m=u.initialize,p=u.reloadConfig,g=u.reload,b=c.preheat,w=c.reload,y=(t==null?void 0:t.level)==="user"?"global":"workspace",[v,x]=h.useState(t?y:e),[k,S]=h.useState((t==null?void 0:t.name)??""),[T,_]=h.useState((t==null?void 0:t.description)??""),[C,j]=h.useState((t==null?void 0:t.systemPrompt)??""),[E,L]=h.useState(()=>{var Re;return new Set((Re=t==null?void 0:t.tools)!=null&&Re.includes("*")?[]:(t==null?void 0:t.tools)??[])}),[D,M]=h.useState(()=>new Set((t==null?void 0:t.disallowedTools)??[])),[R,$]=h.useState((t==null?void 0:t.model)??""),[B,N]=h.useState((t==null?void 0:t.approvalMode)??"inherit"),z=B==="bubble"?[...AK,"bubble"]:AK,[G,I]=h.useState(((yt=t==null?void 0:t.maxTurns)==null?void 0:yt.toString())??""),[Y,U]=h.useState((t==null?void 0:t.color)??"inherit"),[P,F]=h.useState(()=>new Set(Object.keys((t==null?void 0:t.mcpServers)??{}))),[te,W]=h.useState(t!=null&&t.hooks?JSON.stringify(t.hooks,null,2):""),[K,ce]=h.useState(!1),[ie,Z]=h.useState(""),[ee,oe]=h.useState(""),[we,pe]=h.useState(""),[he,X]=h.useState({}),[ye,Ce]=h.useState(!1),[ae,me]=h.useState(null),[We,Oe]=h.useState(!0),[Mt,$t]=h.useState(null),[St,ue]=h.useState(!1),[Ee,tt]=h.useState(()=>new Set),[ut,Ct]=h.useState(null),[Ze,Et]=h.useState(null),Nt=h.useRef({description:0,systemPrompt:0}),gt=h.useRef({}),Je=h.useMemo(()=>P0t(c.tools,he),[he,c.tools]),Ae=h.useMemo(()=>{var Re;return((Re=u.status)==null?void 0:Re.servers)??[]},[(cn=u.status)==null?void 0:cn.servers]),de=h.useMemo(()=>{var bt;const Re=(bt=d.settings.find(rn=>rn.key==="mcpServers"))==null?void 0:bt.values,et=v==="global"?Re==null?void 0:Re.user:Re==null?void 0:Re.effective;return Pm(et)?et:{}},[v,d.settings]),nt=h.useMemo(()=>Ae.filter(Re=>{var et;return Pm(de[Re.name])||Pm((et=t==null?void 0:t.mcpServers)==null?void 0:et[Re.name])?!0:v==="workspace"&&Pm(Re.config)}),[t==null?void 0:t.mcpServers,de,Ae,v]),ve=h.useMemo(()=>O0t(nt),[nt]),Ke=ve.join("\0"),le=!!(k.trim()&&T.trim()&&C.trim());h.useEffect(()=>()=>{for(const Re of Object.values(gt.current))Re==null||Re.abort()},[]),h.useEffect(()=>{let Re=!0;return(async()=>{var bt,rn;Oe(!0),$t(null);try{if(!(await b(5e3)).ready)throw new Error(s("agent.create.tools.preheatFailed"));if(!Re)return;const ft=await w();if(!ft)throw new Error(s("agent.create.tools.loadFailed"));if((bt=ft.errors)!=null&&bt.length)throw new Error(ft.errors.map(Yt=>Yt.error||Yt.hint||Yt.kind).join(`
`));(await m()).accepted||await p();let Ye=!1;for(let Yt=0;Yt<F0t;Yt+=1){if(await new Promise(Tn=>window.setTimeout(Tn,z0t)),!Re)return;const Cn=await g();if(Cn){if((rn=Cn.errors)!=null&&rn.length)throw new Error(Cn.errors.map(Tn=>Tn.error||Tn.hint||Tn.kind).join(`
`));if(Cn.discoveryState==="completed"||Cn.initialized&&Cn.discoveryState==="not_started"&&Cn.servers.length===0){Ye=!0;break}}}if(!Ye)throw new Error(s("mcp.discovery.timeout"))}catch(qn){Re&&$t(qn instanceof Error?qn.message:String(qn))}finally{Re&&Oe(!1)}})(),()=>{Re=!1}},[m,b,g,p,w,s]),h.useEffect(()=>{if(We)return;if(!Ke){X({});return}let Re=!0;return Ce(!0),me(null),Promise.all(ve.map(async et=>{var rn;const bt=await f(et);return{serverName:et,tools:bt.tools.filter(qn=>qn.isValid),error:(rn=bt.errors)!=null&&rn.length?`${et}: ${bt.errors.map(qn=>qn.error||qn.hint||qn.kind).join(", ")}`:void 0}})).then(et=>{if(!Re)return;X(Object.fromEntries(et.map(({serverName:rn,tools:qn})=>[rn,qn])));const bt=et.flatMap(({error:rn})=>rn?[rn]:[]);me(bt.length>0?bt.join(`
`):null)}).catch(et=>{Re&&me(et instanceof Error?et.message:String(et))}).finally(()=>{Re&&Ce(!1)}),()=>{Re=!1}},[Ke,ve,We,f]);function Le(Re){var et;if(!Re){for(const bt of["description","systemPrompt"])Nt.current[bt]+=1,(et=gt.current[bt])==null||et.abort(),delete gt.current[bt];tt(new Set)}ce(Re)}function dt(){oe(T),pe(C),Et(null),ce(!0)}function Fe(Re){var et;Nt.current[Re]+=1,(et=gt.current[Re])==null||et.abort(),delete gt.current[Re],tt(bt=>{const rn=new Set(bt);return rn.delete(Re),rn})}async function Ge(Re){const et=ie.trim();if(!et||gt.current[Re])return;const bt=Nt.current[Re]+1;Nt.current[Re]=bt;const rn=new AbortController;gt.current[Re]=rn,tt(ft=>new Set(ft).add(Re)),Et(null);const qn=Re==="description"?oe:pe;qn("");try{const ft=Re==="description"?"Return only a concise one-sentence subagent description explaining when this subagent should be used. Do not return JSON, Markdown, a label, or commentary.":"Return only the complete subagent system prompt. Do not return JSON, a Markdown code block, a name, a description, or commentary.";let He="";for await(const Ye of l(`${et}

${ft}`,{signal:rn.signal})){if(Nt.current[Re]!==bt)return;if(Ye.type==="delta")He+=Ye.text,qn(He);else if(Ye.type==="error")throw new Error(Ye.message)}if(Nt.current[Re]!==bt)return;qn(He.trim())}catch(ft){if(Nt.current[Re]!==bt||rn.signal.aborted)return;Et(s("agent.create.generateFailed",{error:ft instanceof Error?ft.message:String(ft)}))}finally{Nt.current[Re]===bt&&(tt(ft=>{const He=new Set(ft);return He.delete(Re),He}),gt.current[Re]===rn&&delete gt.current[Re])}}function un(){_(ee.trim()),j(we.trim()),Le(!1)}function Wn(Re){var qn,ft;const et=(qn=t==null?void 0:t.mcpServers)==null?void 0:qn[Re];if(Pm(et))return et;const bt=de[Re];if(Pm(bt))return bt;const rn=v==="workspace"?(ft=Ae.find(He=>He.name===Re))==null?void 0:ft.config:void 0;return Pm(rn)?rn:void 0}async function Me(){if(!le){Ct(s("agent.create.required"));return}ue(!0),Ct(null);try{const Re=G.trim()?Number(G.trim()):void 0;if(Re!==void 0&&(!Number.isSafeInteger(Re)||Re<=0))throw new Error(s("agent.create.maxTurnsInvalid"));const et=[...E],bt=[...D],rn=$0t(te,"hooks"),qn=Object.fromEntries([...P].flatMap(Ye=>{const Yt=Wn(Ye);return Yt?[[Ye,Yt]]:[]})),ft={description:T.trim(),systemPrompt:C.trim(),tools:t||et.length>0?et:void 0,disallowedTools:t||bt.length>0?bt:void 0,mcpServers:t||Object.keys(qn).length>0?qn:void 0,hooks:t?rn??{}:rn},He=t?await o(t.name,{...ft,model:R.trim()||null,approvalMode:B==="inherit"?null:B,maxTurns:Re??null,color:Y==="inherit"?null:Y},v):await i({name:k.trim(),scope:v,...ft,model:R.trim()||void 0,approvalMode:B==="inherit"?void 0:B,maxTurns:Re,color:Y==="inherit"?void 0:Y});r(He.agent.name)}catch(Re){Ct(B0t(Re))}finally{ue(!1)}}return a.jsxs("div",{className:"flex w-full max-w-5xl flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:s(t?"agent.edit":"agent.create")}),a.jsxs(Zt,{type:"button",variant:"outline",onClick:dt,children:[a.jsx(Jb,{"data-icon":"inline-start"}),s("agent.create.modelGenerate")]})]}),ut?a.jsx(pc,{tone:"error",noticeKey:ut,closeLabel:s("common.close"),onDismiss:()=>Ct(null),children:ut}):null,a.jsxs(y1,{defaultValue:"overview",children:[a.jsxs(v1,{className:"max-w-full overflow-x-auto",children:[a.jsx(ci,{value:"overview",children:s("agent.detail.overview")}),a.jsx(ci,{value:"prompt",children:s("agent.detail.systemPrompt")}),a.jsx(ci,{value:"tools",children:s("agent.detail.tools")}),a.jsx(ci,{value:"mcp",children:s("agent.detail.mcp")}),a.jsx(ci,{value:"hooks",children:s("agent.detail.hooks")})]}),a.jsx(Fi,{value:"overview",className:"pt-4",children:a.jsxs(uy,{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"agent-scope",children:s("agent.create.scope")}),a.jsxs(Sl,{value:v,disabled:!!t,onValueChange:Re=>x(Re),children:[a.jsx(Tl,{id:"agent-scope",className:"w-full",children:a.jsx(Cl,{})}),a.jsxs(El,{children:[a.jsx(Ti,{value:"workspace",children:s("agent.create.project.cli")}),a.jsx(Ti,{value:"global",children:s("agent.create.user.cli")})]})]})]}),a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"agent-name",children:s("agent.create.name")}),a.jsx(Us,{id:"agent-name",value:k,onChange:Re=>S(Re.target.value),placeholder:s("agent.create.namePlaceholder"),disabled:!!t}),a.jsx(ld,{children:s("agent.create.nameHelp")})]}),a.jsxs(fo,{className:"lg:col-span-2",children:[a.jsx(aa,{htmlFor:"agent-description",children:s("agent.create.description")}),a.jsx(og,{id:"agent-description",value:T,onChange:Re=>_(Re.target.value),placeholder:s("agent.create.manualDescPlaceholder"),rows:3})]}),a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"agent-model",children:s("agent.create.model")}),a.jsx(Us,{id:"agent-model",value:R,onChange:Re=>$(Re.target.value),placeholder:"inherit / fast / provider:model"})]}),a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"agent-approval",children:s("agent.create.approvalMode")}),a.jsxs(Sl,{value:B,onValueChange:N,children:[a.jsx(Tl,{id:"agent-approval",className:"w-full",children:a.jsx(Cl,{children:MK(B,s)})}),a.jsx(El,{children:z.map(Re=>a.jsx(Ti,{value:Re,disabled:Re==="bubble",children:MK(Re,s)},Re))})]}),a.jsx(ld,{children:H0t(B,s)})]}),a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"agent-max-turns",children:s("agent.create.maxTurns")}),a.jsx(Us,{id:"agent-max-turns",type:"number",min:"1",step:"1",value:G,onChange:Re=>I(Re.target.value)}),a.jsx(ld,{children:s("agent.create.maxTurnsHelp")})]}),a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"agent-color",children:s("agent.create.color")}),a.jsxs(Sl,{value:Y,onValueChange:U,children:[a.jsx(Tl,{id:"agent-color",className:"w-full",children:a.jsx(Cl,{})}),a.jsx(El,{children:["inherit","auto","red","blue","green","yellow","purple","orange","pink","cyan"].map(Re=>a.jsx(Ti,{value:Re,children:Re},Re))})]})]})]})}),a.jsx(Fi,{value:"prompt",className:"pt-4",children:a.jsxs(fo,{children:[a.jsx(og,{id:"agent-prompt","aria-label":s("agent.create.prompt"),value:C,onChange:Re=>j(Re.target.value),placeholder:s("agent.create.promptPlaceholder.cli"),rows:16,className:"min-h-80 max-h-[60vh] overflow-y-auto"}),a.jsx(ld,{children:s("agent.create.promptHelp")})]})}),a.jsx(Fi,{value:"tools",className:"pt-4",children:a.jsxs(uy,{children:[a.jsxs(fo,{children:[a.jsx(aa,{children:s("agent.create.tools")}),a.jsx(ld,{children:s("agent.create.toolsSelectHelp")}),a.jsx(IK,{idPrefix:"agent-allowed-tool",selection:E,onSelectionChange:L,builtInTools:Je,mcpServers:nt,mcpTools:he,t:s}),We||ye?a.jsx(RK,{label:s("agent.create.tools.initializing")}):null,Mt||ae?a.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:Mt||ae}):null]}),a.jsxs(fo,{children:[a.jsx(aa,{children:s("agent.create.disallowedTools")}),a.jsx(IK,{idPrefix:"agent-disallowed-tool",selection:D,onSelectionChange:M,builtInTools:Je,mcpServers:nt,mcpTools:he,t:s})]})]})}),a.jsx(Fi,{value:"mcp",className:"pt-4",children:a.jsxs(fo,{children:[a.jsx(aa,{children:s("agent.create.mcpServers")}),a.jsx(q0t,{selection:P,onSelectionChange:F,servers:nt,t:s}),d.loading?a.jsx(RK,{label:s("common.loading")}):d.error?a.jsx(U0t,{error:d.error}):null]})}),a.jsx(Fi,{value:"hooks",className:"pt-4",children:a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"agent-hooks",children:"Hooks"}),a.jsx(og,{id:"agent-hooks",value:te,onChange:Re=>W(Re.target.value),placeholder:'{"PreToolUse":[...] }',rows:10,className:"min-h-64 max-h-[60vh] overflow-y-auto font-mono text-xs"}),a.jsx(ld,{children:s("agent.create.jsonObjectHelp")})]})})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx(Zt,{variant:"outline",onClick:n,disabled:St,children:s("common.cancel")}),a.jsxs(Zt,{onClick:()=>void Me(),disabled:!le||St,children:[St?a.jsx(Hr,{"data-icon":"inline-start"}):null,s(t?"agent.edit.save":"agent.create.save")]})]}),a.jsx(zp,{open:K,onOpenChange:Le,children:a.jsxs(Fp,{className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl",children:[a.jsxs(qp,{children:[a.jsx(Up,{children:s("agent.create.modelGenerate")}),a.jsx(Hg,{children:s("agent.create.modelGenerate.description")})]}),Ze?a.jsx(pc,{tone:"error",noticeKey:Ze,closeLabel:s("common.close"),onDismiss:()=>Et(null),children:Ze}):null,a.jsxs(uy,{children:[a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"agent-generation-requirements",children:s("agent.create.describeAgent")}),a.jsx(og,{id:"agent-generation-requirements",value:ie,onChange:Re=>Z(Re.target.value),placeholder:s("agent.create.qwenPlaceholder"),rows:4}),a.jsx(ld,{children:s("agent.create.qwenHint")})]}),a.jsxs(fo,{children:[a.jsx(NK,{htmlFor:"agent-generated-description",label:s("agent.create.generatedDescription"),active:Ee.has("description"),disabled:!ie.trim(),onGenerate:()=>void Ge("description"),onCancel:()=>Fe("description"),t:s}),a.jsx(og,{id:"agent-generated-description",value:ee,onChange:Re=>oe(Re.target.value),rows:3,readOnly:Ee.has("description")})]}),a.jsxs(fo,{children:[a.jsx(NK,{htmlFor:"agent-generated-prompt",label:s("agent.create.generatedSystemPrompt"),active:Ee.has("systemPrompt"),disabled:!ie.trim(),onGenerate:()=>void Ge("systemPrompt"),onCancel:()=>Fe("systemPrompt"),t:s}),a.jsx(og,{id:"agent-generated-prompt",value:we,onChange:Re=>pe(Re.target.value),rows:10,readOnly:Ee.has("systemPrompt"),className:"min-h-64 max-h-64 overflow-y-auto"})]})]}),a.jsxs(Hp,{children:[a.jsx(Zt,{type:"button",variant:"outline",onClick:()=>Le(!1),children:s("common.cancel")}),a.jsx(Zt,{type:"button",onClick:un,disabled:Ee.size>0||!ee.trim()||!we.trim(),children:s("agent.create.useGenerated")})]})]})})]})}function NK({htmlFor:e,label:t,active:n,disabled:r,onGenerate:s,onCancel:i,t:o}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(aa,{htmlFor:e,children:t}),n?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Hr,{className:"size-3"}),o("agent.create.generatingPrompt")]}),a.jsx(Zt,{type:"button",variant:"outline",size:"sm",className:"ml-auto",onClick:i,children:o("common.cancel")})]}):a.jsxs(Zt,{type:"button",variant:"outline",size:"sm",className:"ml-auto",disabled:r,onClick:s,children:[a.jsx(Jb,{"data-icon":"inline-start"}),o("agent.create.generate")]})]})}function IK({idPrefix:e,selection:t,onSelectionChange:n,builtInTools:r,mcpServers:s,mcpTools:i,t:o}){const[l,c]=h.useState("builtin"),[u,d]=h.useState(""),f=s.filter(g=>!g.disabled),m=l==="builtin"?r:i[u]??[],p=new Map;for(const g of r)p.set(g.name,g.displayName||g.name);for(const[g,b]of Object.entries(i))for(const w of b)p.set(w.name,`${g} / ${w.serverToolName||w.name}`);return a.jsxs("div",{className:"grid gap-3 rounded-lg border p-4",children:[a.jsxs("div",{className:`grid gap-3 ${l==="mcp"?"sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]":"sm:grid-cols-[minmax(0,1fr)]"}`,children:[a.jsxs(Sl,{value:l,onValueChange:g=>{c(g),d("")},children:[a.jsx(Tl,{id:`${e}-kind`,className:"w-full","aria-label":o("agent.create.tools.type"),children:a.jsx(Cl,{})}),a.jsxs(El,{children:[a.jsx(Ti,{value:"builtin",children:o("agent.create.tools.builtin")}),a.jsx(Ti,{value:"mcp",children:o("agent.create.tools.mcp")})]})]}),l==="mcp"?a.jsxs(Sl,{value:u||void 0,onValueChange:d,children:[a.jsx(Tl,{id:`${e}-server`,className:"w-full","aria-label":o("agent.create.tools.selectServer"),children:a.jsx(Cl,{placeholder:o("agent.create.tools.selectServer")})}),a.jsx(El,{children:f.map(g=>{var b;return a.jsxs(Ti,{value:g.name,disabled:g.mcpStatus!=="connected"&&(((b=i[g.name])==null?void 0:b.length)??0)===0,children:[g.name,g.mcpStatus?` · ${o(`mcp.status.${g.mcpStatus}`)}`:""]},g.name)})})]}):null]}),a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:m.length>0?a.jsx(Cd,{delayDuration:300,children:a.jsx("div",{className:"divide-y",children:m.map(g=>{const b=l==="builtin"?g.displayName||g.name:g.serverToolName||g.name;return a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(rp,{id:`${e}-${g.name}`,checked:t.has(g.name),onCheckedChange:w=>n(vR(t,g.name,w===!0))}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium",children:b}),g.description?a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:g.description})}),a.jsx(Uu,{className:"max-w-sm whitespace-normal",children:g.description})]}):null]})]},g.name)})})}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("agent.create.tools.empty")})}),t.size>0?a.jsx("div",{className:"flex flex-wrap gap-2",children:[...t].map(g=>a.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md bg-muted px-2 py-1 text-sm",title:g,children:[a.jsx("span",{className:"truncate",children:p.get(g)||g}),a.jsx("button",{type:"button",className:"rounded-sm text-muted-foreground hover:text-foreground","aria-label":o("agent.create.removeSelection",{name:g}),onClick:()=>n(vR(t,g,!1)),children:a.jsx(cv,{className:"size-3.5"})})]},g))}):a.jsx("div",{className:"text-sm text-muted-foreground",children:o("agent.create.tools.noneSelected")})]})}function q0t({selection:e,onSelectionChange:t,servers:n,t:r}){return a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border",children:n.length>0?a.jsx("div",{className:"divide-y",children:n.map(s=>a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(rp,{id:`agent-mcp-server-${s.name}`,checked:e.has(s.name),onCheckedChange:i=>t(vR(e,s.name,i===!0))}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s.name}),s.mcpStatus?a.jsx(Ai,{variant:"secondary",className:s.mcpStatus==="connected"?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:r(`mcp.status.${s.mcpStatus}`)}):null]},s.name))}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:r("agent.create.mcpServers.empty")})})}function MK(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.${e}`:`mode.listLabel.${e}`)}function H0t(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.desc.${e}`:`mode.desc.${e}`)}function RK({label:e}){return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Hr,{}),e]})}function U0t({error:e}){return a.jsx("div",{className:"text-sm text-destructive",children:e==null?void 0:e.message})}function Wy({...e}){return a.jsx(fMe,{"data-slot":"alert-dialog",...e})}function W0t({container:e,...t}){const n=Gu();return a.jsx(mMe,{"data-slot":"alert-dialog-portal",container:e??n??void 0,...t})}const V0t=h.forwardRef(function({className:t,...n},r){return a.jsx(pMe,{ref:r,"data-slot":"alert-dialog-overlay",className:ln("fixed inset-0 z-50 bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),Vy=h.forwardRef(function({className:t,size:n="default",...r},s){return a.jsxs(W0t,{children:[a.jsx(V0t,{}),a.jsx(gMe,{ref:s,"data-slot":"alert-dialog-content","data-size":n,className:ln("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none focus-visible:ring-3 focus-visible:ring-ring/50 data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=middle]:max-w-[calc(100%-2rem)] data-[size=default]:sm:max-w-sm data-[size=middle]:sm:max-w-xl data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...r})]})});function Gy({className:e,...t}){return a.jsx("div",{"data-slot":"alert-dialog-header",className:ln("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Ky({className:e,...t}){return a.jsx("div",{"data-slot":"alert-dialog-footer",className:ln("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function Yy({className:e,...t}){return a.jsx(vMe,{"data-slot":"alert-dialog-title",className:ln("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function Xy({className:e,...t}){return a.jsx(wMe,{"data-slot":"alert-dialog-description",className:ln("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function Y6({className:e,variant:t="default",size:n="default",...r}){return a.jsx(Zt,{variant:t,size:n,asChild:!0,children:a.jsx(bMe,{"data-slot":"alert-dialog-action",className:ln(e),...r})})}function Qy({className:e,variant:t="outline",size:n="default",...r}){return a.jsx(Zt,{variant:t,size:n,asChild:!0,children:a.jsx(yMe,{"data-slot":"alert-dialog-cancel",className:ln(e),...r})})}function t0({className:e,...t}){return a.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:ln(e),...t})}function n0({className:e,...t}){return a.jsx("ol",{"data-slot":"breadcrumb-list",className:ln("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function so({className:e,...t}){return a.jsx("li",{"data-slot":"breadcrumb-item",className:ln("inline-flex items-center gap-1",e),...t})}function bh({asChild:e,className:t,...n}){const r=e?rL:"a";return a.jsx(r,{"data-slot":"breadcrumb-link",className:ln("transition-colors hover:text-foreground",t),...n})}function ql({className:e,...t}){return a.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:ln("font-normal text-foreground",e),...t})}function yh({children:e,className:t,...n}){return a.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:ln("[&>svg]:size-3.5",t),...n,children:e??a.jsx(Eu,{})})}function Uo({className:e,size:t="default",...n}){return a.jsx("div",{"data-slot":"card","data-size":t,className:ln("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function Vl({className:e,...t}){return a.jsx("div",{"data-slot":"card-header",className:ln("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function Gl({className:e,...t}){return a.jsx("div",{"data-slot":"card-title",className:ln("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function Lu({className:e,...t}){return a.jsx("div",{"data-slot":"card-description",className:ln("text-sm text-muted-foreground",e),...t})}function Khe({className:e,...t}){return a.jsx("div",{"data-slot":"card-action",className:ln("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function hc({className:e,...t}){return a.jsx("div",{"data-slot":"card-content",className:ln("px-(--card-spacing)",e),...t})}function G0t({className:e,...t}){return a.jsx("div",{"data-slot":"card-footer",className:ln("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",e),...t})}function fd({className:e,...t}){return a.jsx("div",{"data-slot":"empty",className:ln("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...t})}function md({className:e,...t}){return a.jsx("div",{"data-slot":"empty-header",className:ln("flex max-w-sm flex-col items-center gap-2",e),...t})}const K0t=d1("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default"}});function pd({className:e,variant:t="default",...n}){return a.jsx("div",{"data-slot":"empty-icon","data-variant":t,className:ln(K0t({variant:t,className:e})),...n})}function gd({className:e,...t}){return a.jsx("div",{"data-slot":"empty-title",className:ln("text-sm font-medium tracking-tight",e),...t})}function Nv({className:e,...t}){return a.jsx("div",{"data-slot":"empty-description",className:ln("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Y0t({className:e,...t}){return a.jsx("div",{"data-slot":"empty-content",className:ln("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",e),...t})}const X0t=d1("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),Yhe=h.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function oO({className:e,variant:t,size:n,spacing:r=2,orientation:s="horizontal",children:i,...o}){return a.jsx(DL,{orientation:s,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":s,style:{"--gap":r},className:ln("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...o,children:a.jsx(Yhe.Provider,{value:{variant:t,size:n,spacing:r,orientation:s},children:i})})}function aO({className:e,children:t,variant:n="default",size:r="default",...s}){const i=h.useContext(Yhe);return a.jsx(wae,{"data-slot":"toggle-group-item","data-variant":i.variant||n,"data-size":i.size||r,"data-spacing":i.spacing,className:ln("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",X0t({variant:i.variant||n,size:i.size||r}),e),...s,children:t})}const Q0t="_agentGrid_bui90_1",J0t={agentGrid:Q0t};function Zj(e,t){return e==="project"?t("agent.level.project"):e==="user"?t("agent.level.user"):e==="builtin"?t("agent.level.builtin"):e==="extension"?t("agent.level.extension"):e}function Z0t(e,t){return e?e==="inherit"||e==="bubble"?t(`agent.approval.${e}`):ov.some(n=>n===e)?t(`mode.listLabel.${e}`):e:"—"}function Q0({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function DK(e){return e?JSON.stringify(e,null,2):"—"}function egt(e){return e.replace(/\r\n?/g,`
`).replace(new RegExp("(?<!\\n)\\n(?!\\n|[ \\t]*(?:#{1,6}\\s|[-*+]\\s|\\d+\\.\\s|```|>\\s|\\*\\*[^*\\n]+\\*\\*:))","g")," ")}function Xhe({onClose:e,embedded:t,initialCreateScope:n}){var ie,Z;const{t:r}=rt(),{agents:s,loading:i,error:o,reload:l,getAgent:c,deleteAgent:u}=lee({autoLoad:!0}),[d,f]=h.useState(""),[m,p]=h.useState("all"),[g,b]=h.useState(null),[w,y]=h.useState(null),[v,x]=h.useState(!1),[k,S]=h.useState(!1),[T,_]=h.useState(!1),[C,j]=h.useState(()=>!!n),[E,L]=h.useState(!1),[D,M]=h.useState(null),[R,$]=h.useState(null),[B,N]=h.useState(null),[z,G]=h.useState(!1),I=h.useMemo(()=>A0t(s,d,m),[s,d,m]),Y=h.useMemo(()=>CK(g,s),[s,g]),U=(g==null?void 0:g.name)??null;h.useEffect(()=>{b(ee=>CK(ee,s))},[s]),h.useEffect(()=>{t==null||t.onDetailChange(!!(U||C||E))},[C,E,t,U]),h.useEffect(()=>{if(!g){y(null),N(null);return}let ee=!0;return y(null),N(null),x(!0),c(g.name,EK(g.level)).then(oe=>{ee&&y(oe)}).catch(oe=>{ee&&N(oe instanceof Error?oe.message:String(oe))}).finally(()=>{ee&&x(!1)}),()=>{ee=!1}},[g,c]),h.useEffect(()=>{G(!1)},[o]),h.useEffect(()=>{n&&j(!0)},[n]);function P(){j(!1),L(!1),b(null),y(null),$(null),l()}async function F(){if(!w||!Y)return;const ee=EK(Y.level);if(ee){S(!0);try{await u(Y.name,ee),_(!1),b(null),y(null),M(r("agent.deleted",{name:w.name})),await l()}catch(oe){_(!1),$(oe instanceof Error?oe.message:String(oe))}finally{S(!1)}}}const te=[{value:"all",label:r("skills.filter.all")},{value:"project",label:r("agent.level.project")},{value:"user",label:r("agent.level.user")},{value:"builtin",label:r("agent.level.builtin")},{value:"extension",label:r("agent.level.extension")}],W=E?r("agent.edit"):U??(C?r("agent.create.button"):null),K=a.jsx(t0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(n0,{className:"text-base",children:[a.jsx(so,{children:a.jsx(Zt,{variant:"ghost",size:"icon",onClick:e,"aria-label":r("common.back"),children:a.jsx(v_,{})})}),a.jsx(so,{children:W?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:P,children:r("agents.title")})}):a.jsx(ql,{children:r("agents.title")})}),W?a.jsx(yh,{}):null,W?a.jsx(so,{children:a.jsx(ql,{children:W})}):null]})}),ce=t?W?a.jsx(t0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(n0,{className:"h-8 text-sm",children:[a.jsx(so,{children:a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{P(),t.onDetailChange(!1)},children:r("agents.title")})})}),a.jsx(yh,{}),a.jsx(so,{children:a.jsx(ql,{children:W})})]})}):null:K;if(C)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ce,a.jsx(jK,{initialScope:n??"global",onCancel:P,onCreated:ee=>{j(!1),M(r("agent.created",{name:ee})),l()}})]});if(E&&w)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ce,a.jsx(jK,{agent:w,onCancel:()=>L(!1),onCreated:ee=>{L(!1),b(null),y(null),M(r("agent.updated",{name:ee})),l()}})]});if(U&&w){const ee=j0t(w),oe=!w.tools||w.tools.length===0||w.tools.includes("*")?r("agent.create.tools.all"):w.tools.join(", "),we=((ie=w.disallowedTools)==null?void 0:ie.join(", "))||"—";return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ce,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(Xb,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold text-balance",children:w.name}),a.jsx(Ai,{variant:"outline",children:Zj(w.level,r)}),TK(w,s)?a.jsx(Ai,{variant:"secondary",children:r("agent.overriddenBadge")}):null]})}),ee?a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx(Zt,{variant:"ghost",size:"icon",disabled:k,"aria-label":r("agent.chooseAction",{name:w.name}),children:k?a.jsx(Hr,{}):a.jsx(tp,{})})}),a.jsx(Du,{align:"end",onCloseAutoFocus:pe=>pe.preventDefault(),children:a.jsxs(Sp,{children:[a.jsxs(bi,{onSelect:()=>L(!0),children:[a.jsx(_y,{"data-icon":"inline-start"}),r("agent.edit")]}),a.jsxs(bi,{variant:"destructive",disabled:k,onSelect:()=>_(!0),children:[a.jsx(kf,{"data-icon":"inline-start"}),r("agent.delete")]})]})})]}):null]}),R?a.jsx(pc,{tone:"error",noticeKey:R,closeLabel:r("common.close"),onDismiss:()=>$(null),children:R}):null,a.jsxs(y1,{defaultValue:"overview",children:[a.jsxs(v1,{className:"max-w-full overflow-x-auto",children:[a.jsx(ci,{value:"overview",children:r("agent.detail.overview")}),a.jsx(ci,{value:"prompt",children:r("agent.detail.systemPrompt")}),a.jsx(ci,{value:"tools",children:r("agent.detail.tools")}),a.jsx(ci,{value:"mcp",children:r("agent.detail.mcp")}),a.jsx(ci,{value:"hooks",children:r("agent.detail.hooks")})]}),a.jsx(Fi,{value:"overview",className:"pt-4",children:a.jsxs(Uo,{children:[a.jsxs(Vl,{children:[a.jsx(Gl,{className:"text-sm",children:r("agent.descriptionLabel")}),a.jsx(Lu,{children:w.description||"—"})]}),a.jsxs(hc,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(Q0,{label:r("agent.filePathLabel"),value:w.filePath||"—"}),a.jsx(Q0,{label:r("agent.modelLabel"),value:w.model||"—"}),a.jsx(Q0,{label:r("agent.level.label"),value:Zj(w.level,r)}),a.jsx(Q0,{label:r("agent.create.approvalMode"),value:Z0t(w.approvalMode||w.permissionMode,r)}),a.jsx(Q0,{label:r("agent.create.maxTurns"),value:((Z=w.maxTurns)==null?void 0:Z.toString())||"—"}),a.jsx(Q0,{label:r("agent.create.color"),value:w.color||"—"})]})]})}),a.jsx(Fi,{value:"prompt",className:"pt-4",children:a.jsx(Uo,{children:a.jsx(hc,{children:a.jsx("div",{className:"max-h-[60vh] w-full overflow-auto break-words whitespace-pre-line text-sm leading-6 text-muted-foreground",children:w.systemPrompt?egt(w.systemPrompt):"—"})})})}),a.jsx(Fi,{value:"tools",className:"pt-4",children:a.jsxs(Uo,{children:[a.jsxs(Vl,{children:[a.jsx(Gl,{className:"text-sm",children:r("agent.toolsLabel")}),a.jsx(Lu,{children:oe})]}),a.jsx(hc,{className:"flex flex-col gap-6",children:a.jsx(Q0,{label:r("agent.create.disallowedTools"),value:we})})]})}),a.jsx(Fi,{value:"mcp",className:"pt-4",children:a.jsxs(Uo,{children:[a.jsx(Vl,{children:a.jsx(Gl,{className:"text-sm",children:r("agent.create.mcpServers")})}),a.jsx(hc,{children:a.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:DK(w.mcpServers)})})]})}),a.jsx(Fi,{value:"hooks",className:"pt-4",children:a.jsxs(Uo,{children:[a.jsx(Vl,{children:a.jsx(Gl,{className:"text-sm",children:r("agent.detail.hooks")})}),a.jsx(hc,{children:a.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:DK(w.hooks)})})]})})]}),a.jsx(Wy,{open:T,onOpenChange:pe=>{!pe&&k||_(pe)},children:a.jsxs(Vy,{children:[a.jsxs(Gy,{children:[a.jsx(Yy,{children:r("agent.delete.title",{name:w.name})}),a.jsx(Xy,{children:r("agent.delete.confirm",{name:w.name})})]}),a.jsxs(Ky,{children:[a.jsx(Qy,{disabled:k,children:r("common.cancel")}),a.jsxs(Y6,{variant:"destructive",disabled:k,onClick:pe=>{pe.preventDefault(),F()},children:[k?a.jsx(Hr,{"data-icon":"inline-start"}):null,r("agent.delete.yes")]})]})]})})]})]})}return U&&v?a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ce,a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(Hr,{className:"size-6"})})]}):U&&B?a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ce,a.jsx(pc,{tone:"error",noticeKey:B,closeLabel:r("common.close"),onDismiss:P,children:B})]}):a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ce,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:r("agents.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:r("agent.count",{count:s.length})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Zt,{variant:"outline",disabled:i,onClick:()=>void l(),children:[i?a.jsx(Hr,{"data-icon":"inline-start"}):a.jsx($g,{"data-icon":"inline-start"}),r("common.refresh")]}),a.jsxs(Zt,{onClick:()=>j(!0),children:[a.jsx(Wf,{"data-icon":"inline-start"}),r("agent.create.button")]})]})]}),o&&!z?a.jsx(pc,{tone:"error",noticeKey:o.message,closeLabel:r("common.close"),onDismiss:()=>G(!0),children:o.message}):null,D?a.jsx(pc,{tone:"success",noticeKey:D,closeLabel:r("common.close"),onDismiss:()=>M(null),children:D}):null,a.jsxs("div",{className:"relative",children:[a.jsx(tu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Us,{name:"agent-search","aria-label":r("common.search"),autoComplete:"off",value:d,onChange:ee=>f(ee.target.value),placeholder:r("common.search"),className:"pl-9"})]}),a.jsx(oO,{type:"single",value:m,onValueChange:ee=>{ee&&p(ee)},variant:"outline",size:"sm","aria-label":r("agent.level.filter"),children:te.map(ee=>a.jsx(aO,{value:ee.value,children:ee.label},ee.value))}),I.length?a.jsx("div",{className:J0t.agentGrid,"data-column-count":Math.min(I.length,4),children:I.map(ee=>a.jsx(Uo,{size:"sm",role:"button",tabIndex:0,"aria-label":ee.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>{M(null),$(null),b({name:ee.name,level:ee.level})},onKeyDown:oe=>{(oe.key==="Enter"||oe.key===" ")&&(oe.preventDefault(),M(null),$(null),b({name:ee.name,level:ee.level}))},children:a.jsx(Vl,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(Xb,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(Gl,{className:"min-w-0 flex-1 truncate",children:ee.name}),a.jsxs("div",{className:"flex shrink-0 gap-1",children:[a.jsx(Ai,{variant:"outline",className:"text-[10px]",children:Zj(ee.level,r)}),TK(ee,s)?a.jsx(Ai,{variant:"secondary",className:"text-[10px]",children:r("agent.overriddenBadge")}):null]})]}),a.jsx(Lu,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Cd,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:ee.description||"—"})}),a.jsx(Uu,{children:ee.description||"—"})]})})})]})]})})},`${ee.level}:${ee.name}`))}):a.jsx(fd,{className:"border",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:d||m!=="all"?a.jsx(tu,{}):a.jsx(Xb,{})}),a.jsx(gd,{children:r(d||m!=="all"?"agent.noMatches":"agent.empty")})]})})]})]})}const tgt="_page_1np31_1",ngt="_tabs_1np31_11",rgt="_memoryCard_1np31_19",sgt="_memoryCardActive_1np31_35",igt="_memoryTitle_1np31_44",ogt="_detailPath_1np31_48",agt="_status_1np31_49",lgt="_actionButton_1np31_54",cgt="_primaryButton_1np31_55",ugt="_secondaryButton_1np31_56",dgt="_detail_1np31_48",hgt="_detailHeader_1np31_79",fgt="_detailTitleWrap_1np31_87",mgt="_actions_1np31_91",pgt="_content_1np31_105",ggt="_editor_1np31_106",bgt="_editorFooter_1np31_127",Za={page:tgt,tabs:ngt,memoryCard:rgt,memoryCardActive:sgt,memoryTitle:igt,detailPath:ogt,status:agt,actionButton:lgt,primaryButton:cgt,secondaryButton:ugt,detail:dgt,detailHeader:hgt,detailTitleWrap:fgt,actions:mgt,content:pgt,editor:ggt,editorFooter:bgt};function LK(e,t){return e.find(n=>n.scope===t)}function PK(e,t){return t(e==="global"?"memory.global":"memory.project")}function ygt({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:r}){var I,Y;const{t:s}=rt(),{files:i,loading:o,error:l,readFile:c,reload:u,writeMemory:d}=Awe({autoLoad:!0}),f=h.useRef(null),m=h.useRef(0),[p,g]=h.useState("workspace"),[b,w]=h.useState("view"),[y,v]=h.useState(""),[x,k]=h.useState(""),[S,T]=h.useState(!1),[_,C]=h.useState(!1),[j,E]=h.useState(null),L=h.useRef(0),D=h.useMemo(()=>{const U=LK(i,"global"),P=LK(i,"workspace");return[{scope:"workspace",title:s("memory.project"),description:s("memory.project.desc"),fallbackPath:"QWEN.md",file:P},{scope:"global",title:s("memory.global"),description:s("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:U}]},[i,s]),M=D.find(U=>U.scope===p)??D[0],R=h.useCallback((U,P)=>{const F=++m.current;if(w(P),E(null),v(""),k(""),!(U!=null&&U.file)){P==="edit"&&requestAnimationFrame(()=>{var te;return(te=f.current)==null?void 0:te.focus()});return}T(!0),c(U.file.path).then(te=>{F===m.current&&(v(te.content),k(te.content),te.truncated&&E(s("memory.fileTruncated")),requestAnimationFrame(()=>{var W;return(W=f.current)==null?void 0:W.focus()}))}).catch(te=>{if(F!==m.current)return;const W=te instanceof Error?te.message:String(te);E(W),U.scope!=="global"&&(r==null||r(W,"error"))}).finally(()=>{F===m.current&&T(!1)})},[r,c,s]);h.useEffect(()=>{M&&R(M,b)},[(I=M==null?void 0:M.file)==null?void 0:I.path,M==null?void 0:M.scope]),h.useEffect(()=>{l&&E(l.message)},[l]),h.useEffect(()=>{e<=0||u().then(()=>E(s("memory.refreshed"))).catch(U=>{const P=U instanceof Error?U.message:String(U);E(P),r==null||r(P,"error")})},[r,e,u,s]),h.useEffect(()=>{if(t<=0||L.current===t)return;L.current=t;const U=n==="global"?"global":"workspace";g(U);const P=D.find(F=>F.scope===U);R(P,"edit")},[n,t,D,R]);const $=U=>{g(U.scope),R(U,"view")},B=()=>{M&&R(M,"edit")},N=()=>{if(M){if(!x.trim()){E(s("memory.contentEmpty"));return}C(!0),E(null),d({scope:M.scope,mode:"replace",content:x}).then(U=>{const P=s("memory.saved",{scope:PK(M.scope,s),bytes:U.bytesWritten,path:U.filePath});v(x),w("view"),E(P),r==null||r(P,"status"),u().catch(()=>{})}).catch(U=>{const P=U instanceof Error?U.message:String(U);E(P),r==null||r(P,"error")}).finally(()=>C(!1))}},z=((Y=M==null?void 0:M.file)==null?void 0:Y.path)??(M==null?void 0:M.fallbackPath)??"",G=j??(o?s("memory.loading"):null);return a.jsxs("div",{className:Za.page,children:[a.jsx("nav",{className:Za.tabs,"aria-label":s("memory.menu"),children:D.map(U=>{const P=U.scope===p;return a.jsx("button",{type:"button",className:`${Za.memoryCard} ${P?Za.memoryCardActive:""}`,onClick:()=>$(U),children:a.jsx("span",{className:Za.memoryTitle,children:U.title})},U.scope)})}),a.jsxs("section",{className:Za.detail,children:[a.jsxs("header",{className:Za.detailHeader,children:[a.jsx("div",{className:Za.detailTitleWrap,children:a.jsx("div",{className:Za.detailPath,children:z})}),a.jsx("div",{className:Za.actions,children:a.jsx("button",{type:"button",className:Za.actionButton,onClick:B,children:s("settings.action.edit")})})]}),G&&a.jsx("div",{className:Za.status,children:G}),b==="edit"?a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:f,className:Za.editor,value:x,disabled:_||S,onChange:U=>k(U.target.value),placeholder:s("memory.placeholder",{scope:M?PK(M.scope,s):""})}),a.jsxs("div",{className:Za.editorFooter,children:[a.jsx("button",{type:"button",className:Za.secondaryButton,disabled:_,onClick:()=>{k(y),w("view")},children:s("common.cancel")}),a.jsx("button",{type:"button",className:Za.primaryButton,disabled:_||S,onClick:N,children:s(_?"memory.saving":"memory.save")})]})]}):a.jsx("pre",{className:Za.content,children:S?s("memory.loadingFile"):y||s("memory.noFiles")})]})]})}const vgt="_panel_cxp6w_1",wgt="_steps_cxp6w_10",xgt="_stepPill_cxp6w_18",kgt="_stepPillActive_cxp6w_29",_gt="_stepPillDone_cxp6w_34",Sgt="_stepNumber_cxp6w_38",Cgt="_stepLabel_cxp6w_49",Tgt="_body_cxp6w_55",Egt="_text_cxp6w_59",Agt="_muted_cxp6w_64",jgt="_options_cxp6w_68",Ngt="_option_cxp6w_68",Igt="_optionActive_cxp6w_90",Mgt="_label_cxp6w_94",Rgt="_optionText_cxp6w_98",Dgt="_description_cxp6w_112",Lgt="_input_cxp6w_119",Pgt="_preview_cxp6w_135",Ogt="_error_cxp6w_146",$gt="_link_cxp6w_150",Bgt="_terms_cxp6w_161",zgt="_actions_cxp6w_169",Fgt="_actionButton_cxp6w_177",Rs={panel:vgt,steps:wgt,stepPill:xgt,stepPillActive:kgt,stepPillDone:_gt,stepNumber:Sgt,stepLabel:Cgt,body:Tgt,text:Egt,muted:Agt,options:jgt,option:Ngt,optionActive:Igt,label:Mgt,optionText:Rgt,description:Dgt,input:Lgt,preview:Pgt,error:Ogt,link:$gt,terms:Bgt,actions:zgt,actionButton:Fgt};function qgt(e){return[{value:"openai",label:e("auth.protocol.openai"),description:e("auth.protocol.openaiDesc")},{value:"anthropic",label:e("auth.protocol.anthropic"),description:e("auth.protocol.anthropicDesc")},{value:"gemini",label:e("auth.protocol.gemini"),description:e("auth.protocol.geminiDesc")}]}function qw(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function OK(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function Hgt(e,t,n){var r;return e==="protocol"?n("auth.step.protocol"):e==="baseUrl"?((r=t.uiLabels)==null?void 0:r.baseUrlStepTitle)??n("auth.step.baseUrl"):n(e==="apiKey"?"auth.step.apiKey":e==="models"?"auth.step.models":"auth.step.advanced")}function Ugt(e,t){const n=e.trim();return n?n.length<=6?"***":`${n.slice(0,3)}...${n.slice(-4)}`:t?t("auth.notSet"):"(not set)"}function e7(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function Wgt({onMessage:e,onClose:t}){const{t:n}=rt(),r=ga(),[s,i]=h.useState("groups"),[o,l]=h.useState(0),[c,u]=h.useState(0),[d,f]=h.useState("providers"),[m,p]=h.useState(0),[g,b]=h.useState(),[w,y]=h.useState("alibaba"),[v,x]=h.useState(null),[k,S]=h.useState("openai"),[T,_]=h.useState(""),[C,j]=h.useState(""),[E,L]=h.useState(""),[D,M]=h.useState(!1),[R,$]=h.useState(!1),[B,N]=h.useState(!0),[z,G]=h.useState(!0),[I,Y]=h.useState(!1),[U,P]=h.useState(!1),[F,te]=h.useState(""),[W,K]=h.useState(!0),[ce,ie]=h.useState(!1),[Z,ee]=h.useState(null);h.useEffect(()=>{r.getAuthProviders().then(Ae=>{b(Ae),K(!1)}).catch(Ae=>{ee(Ae instanceof Error?Ae.message:String(Ae)),K(!1)})},[r]);const oe=h.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),we=h.useMemo(()=>{var de;return(((de=oe.find(nt=>nt.id===w))==null?void 0:de.providerIds)??[]).map(nt=>g==null?void 0:g.providers.find(ve=>ve.id===nt)).filter(nt=>!!nt)},[g,w,oe]),pe=h.useMemo(()=>(v==null?void 0:v.steps)??[],[v==null?void 0:v.steps]),he=pe[m],X=(v==null?void 0:v.showAdvancedConfig)===!0,ye=h.useMemo(()=>R?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[R]),Ce=ye.indexOf("context"),ae=he==="apiKey"||he==="models"||he==="baseUrl"&&!Array.isArray(v==null?void 0:v.baseUrl),[me,We]=h.useState(0),Oe=h.useCallback((Ae,de="providers")=>{var ve,Ke;x(Ae),f(de);const nt=((ve=Ae.protocolOptions)==null?void 0:ve[0])??Ae.protocol;S(nt),typeof Ae.baseUrl=="string"?_(Ae.baseUrl):Array.isArray(Ae.baseUrl)?_(((Ke=Ae.baseUrl[0])==null?void 0:Ke.url)??""):_(qw(nt)),j(""),L(OK(Ae)),M(!1),$(!1),N(!0),G(!0),Y(!1),P(!1),te(""),p(0),We(0),ee(null),i(Ae.steps.length>0?"step":"review")},[]),Mt=h.useCallback(()=>{if(ee(null),s==="groups"){t();return}if(s==="providers"){i("groups");return}if(s==="review"){if(pe.length===0){i(d);return}i("step"),p(Math.max(0,pe.length-1));return}if(m>0){p(Ae=>Ae-1),We(0);return}i(d)},[t,d,m,pe.length,s]),$t=h.useCallback(()=>{if(!v||ce)return;ie(!0),ee(null);const Ae=Number(F);r.installAuthProvider({providerId:v.id,protocol:k,baseUrl:T,apiKey:C,modelIds:e7(E),advancedConfig:D||R||Number.isFinite(Ae)&&Ae>0?{...D?{enableThinking:!0}:{},...R?{multimodal:{...B?{image:!0}:{},...z?{video:!0}:{},...I?{audio:!0}:{},...U?{pdf:!0}:{}}}:{},...Number.isFinite(Ae)&&Ae>0?{contextWindowSize:Ae}:{}}:void 0}).then(de=>{e(de.message),t()}).catch(de=>{const nt=de instanceof Error?de.message:String(de);ee(nt),e(nt,"error")}).finally(()=>ie(!1))},[C,T,F,R,I,B,U,z,E,t,e,k,v,ce,D,r]),St=h.useCallback(()=>{if(v){if(he==="baseUrl"){const Ae=T.trim()||qw(k);if(!Ae){ee(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(Ae)){ee(n("auth.baseUrlInvalid"));return}T.trim()||_(Ae)}if(he==="apiKey"&&C.trim().length===0){ee(n("auth.apiKeyRequired"));return}if(he==="models"&&e7(E).length===0){ee(n("auth.modelsRequired"));return}ee(null),m>=pe.length-1?X?i("review"):$t():(p(Ae=>Ae+1),We(0))}},[C,T,he,E,k,v,$t,X,m,pe.length,n]),ue=h.useCallback(Ae=>{switch(Ae){case"thinking":M(de=>!de);return;case"modality":$(de=>!de);return;case"image":N(de=>!de);return;case"video":G(de=>!de);return;case"audio":Y(de=>!de);return;case"pdf":P(de=>!de);return;case"context":St();return;default:return}},[St]),Ee=h.useCallback(()=>{if(s==="groups"){const Ae=oe[o];if(!Ae)return;if(Ae.id==="custom"){const de=Ae.providerIds.map(nt=>g==null?void 0:g.providers.find(ve=>ve.id===nt)).find(nt=>!!nt);de&&Oe(de,"groups");return}y(Ae.id),u(0),i("providers");return}if(s==="providers"){const Ae=we[c];Ae&&Oe(Ae,"providers");return}if(s==="review"){$t();return}if(!(!v||!he)){if(he==="protocol"){const Ae=(v.protocolOptions??[v.protocol])[me];Ae&&(S(Ae),v.baseUrl||_(qw(Ae))),St();return}if(he==="baseUrl"&&Array.isArray(v.baseUrl)){const Ae=v.baseUrl[me];Ae&&_(Ae.url),St();return}if(he==="advancedConfig"){ue(ye[me]);return}St()}},[he,g,St,o,oe,me,v,c,we,$t,Oe,s,ue,ye]),tt=h.useCallback(Ae=>{if(s==="groups"){const de=oe[Ae];if(!de)return;if(de.id==="custom"){const nt=de.providerIds.map(ve=>g==null?void 0:g.providers.find(Ke=>Ke.id===ve)).find(ve=>!!ve);nt&&Oe(nt,"groups");return}y(de.id),u(0),i("providers");return}if(s==="providers"){const de=we[Ae];de&&Oe(de,"providers");return}if(!v||!he){s==="review"&&$t();return}if(he==="protocol"){const de=(v.protocolOptions??[v.protocol])[Ae];de&&(S(de),v.baseUrl||_(qw(de))),St();return}if(he==="baseUrl"&&Array.isArray(v.baseUrl)){const de=v.baseUrl[Ae];de&&_(de.url),St();return}he==="advancedConfig"&&ue(ye[Ae])},[he,g,St,oe,ue,ye,v,we,$t,Oe,s]),ut=(Ae,de,nt)=>a.jsx("div",{className:Rs.options,children:Ae.map((ve,Ke)=>a.jsx("button",{type:"button",className:`${Rs.option} ${de===Ke?Rs.optionActive:""}`,onClick:()=>{nt(Ke),tt(Ke)},children:a.jsxs("div",{className:Rs.optionText,children:[a.jsx("div",{className:Rs.label,children:ve.label}),ve.description&&a.jsx("div",{className:Rs.description,children:ve.description})]})},ve.value))}),Ct=()=>{if(!v||!he)return null;if(he==="protocol"){const nt=v.protocolOptions??[v.protocol];return ut(qgt(n).filter(ve=>nt.includes(ve.value)),me,We)}if(he==="baseUrl")return Array.isArray(v.baseUrl)?ut(v.baseUrl.map(nt=>({value:nt.url,label:nt.label,description:nt.url})),me,We):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Rs.text,children:n("auth.baseUrlPrompt")}),a.jsx("input",{className:Rs.input,value:T,placeholder:qw(k),onChange:nt=>{_(nt.target.value),ee(null)},onKeyDown:nt=>{nt.key==="Enter"&&(nt.preventDefault(),nt.stopPropagation(),St())},autoFocus:!0}),v.documentationUrl&&a.jsx("a",{className:Rs.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(he==="apiKey")return a.jsxs(a.Fragment,{children:[v.documentationUrl&&a.jsxs("a",{className:Rs.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",v.documentationUrl]}),a.jsx("input",{className:Rs.input,type:"password",value:C,placeholder:v.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:nt=>{j(nt.target.value),ee(null)},onKeyDown:nt=>{nt.key==="Enter"&&(nt.preventDefault(),nt.stopPropagation(),St())},autoFocus:!0})]});if(he==="models"){const nt=OK(v);return a.jsxs(a.Fragment,{children:[nt&&a.jsx("div",{className:Rs.muted,children:n("auth.modelsPrompt",{modelIds:nt})}),a.jsx("input",{className:Rs.input,value:E,placeholder:nt||n("auth.modelsPlaceholder"),onChange:ve=>{L(ve.target.value),ee(null)},onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),ve.stopPropagation(),St())},autoFocus:!0})]})}const Ae=nt=>nt?"◉":"○",de=[{value:"thinking",label:`${Ae(D)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${Ae(R)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return R&&de.push({value:"image",label:`${Ae(B)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${Ae(z)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${Ae(I)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${Ae(U)} ${n("auth.advanced.modalityPdf")}`}),de.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${F||"auto"}`,description:n("auth.advanced.contextDesc")}),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Rs.text,children:n("auth.advanced.prompt")}),ut(de,me,We),a.jsx("input",{className:Rs.input,value:F,placeholder:n("common.auto"),onChange:nt=>te(nt.target.value.replace(/[^0-9]/g,"")),onFocus:()=>We(Ce),onKeyDown:nt=>{nt.key==="Enter"&&(nt.preventDefault(),nt.stopPropagation(),St())}})]})},Ze=h.useMemo(()=>{if(!v)return"";const Ae=v.envKey??`${k.toUpperCase()}_API_KEY`,de=e7(E),nt={};if(D&&(nt.extra_body={enable_thinking:!0}),R){const le={};B&&(le.image=!0),z&&(le.video=!0),I&&(le.audio=!0),U&&(le.pdf=!0),Object.keys(le).length>0&&(nt.modalities=le)}const ve=Number(F);Number.isFinite(ve)&&ve>0&&(nt.contextWindowSize=ve);const Ke=Object.keys(nt).length>0;return JSON.stringify({env:{[Ae]:Ugt(C,n)},modelProviders:{[k]:de.map(le=>({id:le,name:le,baseUrl:T.trim(),envKey:Ae,...Ke?{generationConfig:nt}:{}}))},security:{auth:{selectedType:k}},model:{name:de[0]}},null,2)},[C,T,F,R,I,B,U,z,E,k,v,n,D]),Et=h.useMemo(()=>{const Ae=[n("auth.step.group"),n("auth.step.provider")];return v&&(Ae.push(...pe.map(de=>Hgt(de,v,n))),X&&Ae.push(n("auth.review"))),Ae},[v,X,pe,n]),Nt=h.useMemo(()=>s==="groups"?1:s==="providers"?2:s==="step"?Math.min(3+m,Et.length):Et.length,[m,Et.length,s]),gt=W?a.jsx("div",{className:Rs.muted,children:n("common.loading")}):s==="groups"?a.jsxs(a.Fragment,{children:[ut(oe.map(Ae=>({value:Ae.id,label:n(Ae.label),description:n(Ae.description)})),o,l),a.jsxs("div",{className:Rs.terms,children:[a.jsxs("div",{children:[n("auth.termsTitle"),":"]}),a.jsx("a",{className:Rs.link,href:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/",target:"_blank",rel:"noreferrer",children:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/"})]})]}):s==="providers"?ut(we.map(Ae=>({value:Ae.id,label:n(Ae.label),description:n(Ae.description)})),c,u):s==="step"?Ct():a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Rs.text,children:n("auth.reviewText")}),a.jsx("div",{className:Rs.preview,children:Ze})]}),Je=()=>{if(s==="review"){$t();return}if(ae||he==="advancedConfig"){St();return}Ee()};return a.jsxs("div",{className:Rs.panel,children:[a.jsx("div",{className:Rs.steps,children:Et.map((Ae,de)=>{const nt=de+1;return a.jsxs("div",{className:`${Rs.stepPill} ${nt===Nt?Rs.stepPillActive:""} ${nt<Nt?Rs.stepPillDone:""}`,children:[a.jsx("span",{className:Rs.stepNumber,children:nt}),a.jsx("span",{className:Rs.stepLabel,children:Ae})]},`${nt}:${Ae}`)})}),a.jsx("div",{className:Rs.body,children:gt}),Z&&a.jsx("div",{className:Rs.error,children:Z}),a.jsxs("div",{className:Rs.actions,children:[a.jsx("button",{type:"button",className:Rs.actionButton,onClick:Mt,disabled:s==="groups"||W||ce,children:n("common.previous")}),a.jsx("button",{type:"button",className:Rs.actionButton,onClick:Je,disabled:W||ce,children:n(s==="review"?ce?"auth.saving":"auth.save":"common.next")})]})]})}function Vgt(e){return e.displayName||e.name}const Qhe="tools-list",$K=e=>`${Qhe}-opt-${e}`;function Ggt(){const{t:e}=rt(),{status:t,tools:n,loading:r,error:s}=cee({autoLoad:!0}),[i,o]=h.useState(0),[l,c]=h.useState(null),[u,d]=h.useState(()=>new Set),f=h.useRef(null);h.useEffect(()=>{var b,w;s?c(s.message):(w=(b=t==null?void 0:t.errors)==null?void 0:b[0])!=null&&w.error?c(t.errors[0].error):t&&c(null)},[t,s]);const m=h.useCallback(b=>{d(w=>w.has(b.name)?new Set:new Set([b.name]))},[]);h.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),h.useEffect(()=>{var w;const b=(w=f.current)==null?void 0:w.children[i];b==null||b.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:p}=v0({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:b=>{const w=n[b];w!=null&&w.description&&m(w)}}),g=h.useMemo(()=>{if(!t)return"";const b=n.filter(w=>w.enabled).length;return e("tools.summary",{enabled:b,total:n.length})},[t,n,e]);return a.jsxs("div",{className:_n("picker","picker-in-shell"),children:[g&&a.jsx("div",{className:_n("picker-search"),children:a.jsx("span",{className:_n("picker-search-hint"),children:g})}),(l||r)&&a.jsx("div",{className:_n("picker-search"),children:a.jsx("span",{className:_n("picker-search-hint"),children:l||e("tools.loading")})}),a.jsx("div",{className:_n("picker-sep")}),a.jsxs("div",{id:Qhe,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?$K(i):void 0,className:_n("picker-list",p?"picker-keyboard-only":void 0),ref:f,children:[!r&&n.length===0&&a.jsx("div",{className:_n("picker-empty"),children:e("tools.empty")}),n.map((b,w)=>{const y=u.has(b.name),v=b.description??"";return a.jsxs("div",{id:$K(w),role:"option","aria-selected":!1,"aria-expanded":v?y:void 0,className:_n("picker-item","picker-session-item","tools-picker-item",w===i?"selected":void 0,y?"tools-picker-item-expanded":void 0),onClick:()=>{o(w),b.description&&m(b)},onMouseMove:()=>o(w),children:[a.jsxs("div",{className:_n("picker-item-row"),children:[a.jsx("span",{className:_n("tools-item-icon"),"aria-hidden":"true"}),a.jsx("span",{className:_n("picker-item-title"),children:Vgt(b)}),a.jsx("span",{className:_n("tools-status-badge",b.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:b.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),v?a.jsx("svg",{className:_n("tools-item-chevron",y?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),y&&v&&a.jsx("div",{className:_n("tools-desc-expanded"),children:a.jsx("div",{className:_n("tools-desc-body"),children:v})})]},b.name)})]})]})}const Kgt="_content_xihrz_1",Ygt="_placeholder_xihrz_7",Xgt="_fileList_xihrz_13",Qgt="_file_xihrz_13",Jgt="_fileHeader_xihrz_25",Zgt="_fileStats_xihrz_43",e1t="_statAdd_xihrz_51",t1t="_statDel_xihrz_55",n1t="_fileBinary_xihrz_59",r1t="_filePath_xihrz_63",s1t="_fileOldPath_xihrz_71",i1t="_fileTag_xihrz_75",o1t="_fileBody_xihrz_85",a1t="_filePlaceholder_xihrz_89",l1t="_hiddenNote_xihrz_95",c1t="_diffLines_xihrz_101",u1t="_diffLine_xihrz_101",d1t="_diffLineAdd_xihrz_113",h1t="_diffLineDel_xihrz_117",f1t="_diffLineContext_xihrz_121",m1t="_diffLineMeta_xihrz_125",p1t="_diffOldNo_xihrz_131",g1t="_diffNewNo_xihrz_132",b1t="_diffMarker_xihrz_143",y1t="_diffContent_xihrz_159",ps={content:Kgt,placeholder:Ygt,fileList:Xgt,file:Qgt,fileHeader:Jgt,fileStats:Zgt,statAdd:e1t,statDel:t1t,fileBinary:n1t,filePath:r1t,fileOldPath:s1t,fileTag:i1t,fileBody:o1t,filePlaceholder:a1t,hiddenNote:l1t,diffLines:c1t,diffLine:u1t,diffLineAdd:d1t,diffLineDel:h1t,diffLineContext:f1t,diffLineMeta:m1t,diffOldNo:p1t,diffNewNo:g1t,diffMarker:b1t,diffContent:y1t},v1t={add:ps.diffLineAdd,del:ps.diffLineDel,context:ps.diffLineContext,meta:ps.diffLineMeta};function w1t(e){return e===Fs.Light?"github-light-default":"github-dark-default"}async function x1t(e,t,n){const{resolvedLang:r}=FL(che(t));let s=null;if(r!=="text")try{s=await Fre(r)}catch{s=null}const i=[];for(const o of e){const l=[],c=[];for(const y of o.lines){const v=y[0],x=y.slice(1);v==="+"?l.push(x):v==="-"?c.push(x):v===" "&&(l.push(x),c.push(x))}const u=l.join(`
`),d=c.join(`
`);let f=null,m=null;if(s){const y=r;if(!LI(u))try{f=s.codeToTokens(u,{lang:y,theme:n}).tokens}catch{f=null}if(!LI(d))try{m=s.codeToTokens(d,{lang:y,theme:n}).tokens}catch{m=null}}let p=0,g=0,b=o.oldStart,w=o.newStart;for(const y of o.lines){const v=y[0],x=y.slice(1);v==="+"?(i.push({type:"add",oldNo:null,newNo:w,text:x,tokens:(f==null?void 0:f[p])??null}),p++,w++):v==="-"?(i.push({type:"del",oldNo:b,newNo:null,text:x,tokens:(m==null?void 0:m[g])??null}),g++,b++):v===" "?(i.push({type:"context",oldNo:b,newNo:w,text:x,tokens:(f==null?void 0:f[p])??null}),p++,g++,b++,w++):i.push({type:"meta",oldNo:null,newNo:null,text:y,tokens:null})}}return i}function k1t(e){return!e.tokens||e.tokens.length===0?e.text:e.tokens.map((t,n)=>a.jsx("span",{style:t.color?{color:t.color}:void 0,children:t.content},n))}function _1t({hunks:e,path:t}){const{t:n}=rt(),r=rm(),s=w1t(r),[i,o]=h.useState(null),[l,c]=h.useState(!1);return h.useEffect(()=>{let u=!1;return o(null),c(!1),x1t(e,t,s).then(d=>{u||o(d)}).catch(()=>{u||c(!0)}),()=>{u=!0}},[e,t,s]),l?a.jsx("div",{className:ps.filePlaceholder,children:n("gitDiff.fileError")}):i===null?a.jsx("div",{className:ps.filePlaceholder,children:n("gitDiff.loading")}):a.jsx("div",{className:ps.diffLines,children:(i??[]).map((u,d)=>a.jsxs("div",{className:`${ps.diffLine} ${v1t[u.type]}`,children:[a.jsx("span",{className:ps.diffOldNo,children:u.oldNo??""}),a.jsx("span",{className:ps.diffNewNo,children:u.newNo??""}),a.jsx("span",{className:ps.diffMarker,children:u.type==="add"?"+":u.type==="del"?"-":u.type==="meta"?"":" "}),a.jsx("code",{className:ps.diffContent,children:k1t(u)})]},d))})}function S1t({workspaceCwd:e,gitCwd:t,file:n}){const{t:r}=rt(),{client:s}=yo(),[i,o]=h.useState(!1),[l,c]=h.useState(null),[u,d]=h.useState(!1),[f,m]=h.useState(!1),[p,g]=h.useState(!1),b=h.useRef(!1);h.useEffect(()=>(b.current=!1,()=>{b.current=!0}),[]);const w=()=>{const v=!i;o(v),v&&l===null&&!f&&!n.isBinary&&(m(!0),g(!1),s.workspaceByCwd(e).workspaceGitDiffFile(n.path,n.oldPath,t).then(x=>{b.current||(c(x.hunks),d(x.truncated===!0))}).catch(()=>{b.current||g(!0)}).finally(()=>{b.current||m(!1)}))},y=C4(n.path);return a.jsxs("div",{className:ps.file,children:[a.jsxs("button",{type:"button",className:ps.fileHeader,onClick:w,"aria-expanded":i,"aria-label":r(i?"gitDiff.collapse":"gitDiff.expand",{path:n.oldPath?`${C4(n.oldPath)} → ${y}`:y}),children:[a.jsx("span",{className:ps.fileStats,children:n.isBinary?a.jsx("span",{className:ps.fileBinary,children:r("gitDiff.binary")}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:ps.statAdd,children:["+",n.added??0]}),a.jsxs("span",{className:ps.statDel,children:["-",n.removed??0]})]})}),a.jsxs("span",{className:ps.filePath,title:y,children:[n.oldPath?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ps.fileOldPath,children:C4(n.oldPath)})," → "]}):null,y]}),n.isUntracked&&a.jsx("span",{className:ps.fileTag,children:r("gitDiff.untracked")}),n.isDeleted&&a.jsx("span",{className:ps.fileTag,children:r("gitDiff.deleted")})]}),i&&a.jsx("div",{className:ps.fileBody,children:n.isBinary?a.jsx("div",{className:ps.filePlaceholder,children:r("gitDiff.binary")}):f?a.jsx("div",{className:ps.filePlaceholder,children:r("gitDiff.loading")}):p?a.jsx("div",{className:ps.filePlaceholder,children:r("gitDiff.fileError")}):l&&l.length>0?a.jsxs(a.Fragment,{children:[a.jsx(_1t,{hunks:l,path:n.path}),u&&a.jsx("div",{className:ps.filePlaceholder,role:"note",children:r("gitDiff.truncated")})]}):a.jsx("div",{className:ps.filePlaceholder,children:r("gitDiff.noDiff")})})]})}function C1t({workspaceCwd:e,gitCwd:t,onSubtitleChange:n}){const{t:r}=rt(),{client:s}=yo(),[i,o]=h.useState(null),[l,c]=h.useState(!0),[u,d]=h.useState(!1);h.useEffect(()=>{let p=!1;return c(!0),d(!1),s.workspaceByCwd(e).workspaceGitDiff(t).then(g=>{p||o(g)}).catch(()=>{p||d(!0)}).finally(()=>{p||c(!1)}),()=>{p=!0}},[s,e,t]);const f=i&&i.available?r("gitDiff.summary",{count:i.filesCount,added:i.linesAdded,removed:i.linesRemoved}):void 0;h.useEffect(()=>{n==null||n(f)},[n,f]);let m;return l?m=a.jsx("div",{className:ps.placeholder,children:r("gitDiff.loading")}):u?m=a.jsx("div",{className:ps.placeholder,children:r("gitDiff.error")}):!i||!i.available?m=a.jsx("div",{className:ps.placeholder,children:r("gitDiff.unavailable")}):i.files.length===0?m=a.jsx("div",{className:ps.placeholder,children:r("gitDiff.empty")}):m=a.jsxs("div",{className:ps.fileList,children:[i.files.map(p=>a.jsx(S1t,{workspaceCwd:e,gitCwd:t,file:p},`${e}:${t??""}:${p.path}`)),i.hiddenCount>0&&a.jsx("div",{className:ps.hiddenNote,children:r("gitDiff.hidden",{count:i.hiddenCount})})]}),a.jsx("div",{className:ps.content,children:m})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Jhe(e,t,n){const r=Math.max(0,Math.floor(t-e)),s=new Intl.RelativeTimeFormat(n,{numeric:"auto"});if(r<60)return s.format(0,"second");const i=Math.floor(r/60);if(i<60)return s.format(-i,"minute");const o=Math.floor(i/60);if(o<24)return s.format(-o,"hour");const l=Math.floor(o/24);if(l<7)return s.format(-l,"day");const c=Math.floor(l/7);if(c<5)return s.format(-c,"week");const u=Math.floor(l/30);return u<12?s.format(-u,"month"):s.format(-Math.max(1,Math.floor(l/365)),"year")}const T1t="_content_18nyy_1",E1t="_placeholder_18nyy_7",A1t="_commitList_18nyy_13",j1t="_commitRow_18nyy_18",N1t="_commitHeader_18nyy_22",I1t="_commitToggle_18nyy_32",M1t="_commitSha_18nyy_47",R1t="_copyBtn_18nyy_54",D1t="_commitSubject_18nyy_78",L1t="_commitMeta_18nyy_86",P1t="_commitRefs_18nyy_93",O1t="_refTag_18nyy_99",$1t="_refHead_18nyy_109",B1t="_mergeIcon_18nyy_114",z1t="_commitDetail_18nyy_120",F1t="_commitBody_18nyy_126",q1t="_fileStats_18nyy_134",H1t="_fileStatHeader_18nyy_140",U1t="_fileStatRow_18nyy_146",W1t="_statNums_18nyy_154",V1t="_statAdd_18nyy_162",G1t="_statDel_18nyy_166",K1t="_fileStatPath_18nyy_170",Y1t="_fileBinary_18nyy_178",X1t="_hiddenNote_18nyy_182",Q1t="_detailError_18nyy_188",J1t="_loadMore_18nyy_194",ls={content:T1t,placeholder:E1t,commitList:A1t,commitRow:j1t,commitHeader:N1t,commitToggle:I1t,commitSha:M1t,copyBtn:R1t,commitSubject:D1t,commitMeta:L1t,commitRefs:P1t,refTag:O1t,refHead:$1t,mergeIcon:B1t,commitDetail:z1t,commitBody:F1t,fileStats:q1t,fileStatHeader:H1t,fileStatRow:U1t,statNums:W1t,statAdd:V1t,statDel:G1t,fileStatPath:K1t,fileBinary:Y1t,hiddenNote:X1t,detailError:Q1t,loadMore:J1t},BK=50;function Z1t(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean).slice(0,3).map(t=>{const n=t.startsWith("HEAD ->");return{label:n?t.replace("HEAD -> ",""):t,isHead:n}}):[]}function ebt({entry:e,workspaceCwd:t,gitCwd:n,now:r}){const{client:s}=yo(),{language:i,t:o}=rt(),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,m]=h.useState(!1),[p,g]=h.useState(!1),[b,w]=h.useState(!1),y=h.useRef(!1),v=()=>{navigator.clipboard.writeText(e.sha).then(()=>{w(!0),setTimeout(()=>w(!1),1500)}).catch(()=>{})};h.useEffect(()=>(y.current=!1,()=>{y.current=!0}),[]);const x=()=>{const _=!l;c(_),_&&u===null&&!f&&(m(!0),g(!1),s.workspaceByCwd(t).workspaceGitCommitDetail(e.sha,n).then(C=>{y.current||d(C)}).catch(()=>{y.current||g(!0)}).finally(()=>{y.current||m(!1)}))},k=Z1t(e.refs??""),S=e.parents.length>1;let T;return l&&(f?T=a.jsx("div",{className:ls.commitDetail,children:a.jsx("span",{className:ls.fileBinary,children:o("gitLog.loading")})}):p?T=a.jsx("div",{className:ls.commitDetail,children:a.jsx("span",{className:ls.detailError,children:o("gitLog.detailError")})}):u&&u.available?T=a.jsxs("div",{className:ls.commitDetail,children:[u.body&&a.jsx("pre",{className:ls.commitBody,children:u.body}),u.files&&a.jsxs("div",{className:ls.fileStats,children:[a.jsx("div",{className:ls.fileStatHeader,children:o("gitLog.files",{count:u.filesCount??0,added:u.linesAdded??0,removed:u.linesRemoved??0})}),u.files.map(_=>a.jsxs("div",{className:ls.fileStatRow,children:[_.isBinary?a.jsx("span",{className:ls.fileBinary,children:"~"}):a.jsxs("span",{className:ls.statNums,children:[a.jsxs("span",{className:ls.statAdd,children:["+",_.added]}),a.jsxs("span",{className:ls.statDel,children:["−",_.removed]})]}),a.jsx("span",{className:ls.fileStatPath,children:_.path})]},_.path)),(u.hiddenCount??0)>0&&a.jsx("div",{className:ls.hiddenNote,children:o("gitLog.hidden",{count:u.hiddenCount??0})})]})]}):u&&!u.available&&(T=a.jsx("div",{className:ls.commitDetail,children:a.jsx("span",{className:ls.detailError,children:o("gitLog.detailError")})}))),a.jsxs("div",{className:ls.commitRow,children:[a.jsxs("div",{className:ls.commitHeader,children:[a.jsxs("button",{type:"button",className:ls.commitToggle,onClick:x,"aria-expanded":l,children:[S&&a.jsx("span",{className:ls.mergeIcon,children:"⎇"}),a.jsx("span",{className:ls.commitSha,title:e.sha,children:e.shortSha}),a.jsx("span",{className:ls.commitSubject,children:e.subject}),k.length>0&&a.jsx("span",{className:ls.commitRefs,children:k.map(_=>a.jsx("span",{className:`${ls.refTag}${_.isHead?` ${ls.refHead}`:""}`,children:_.label},_.label))}),a.jsxs("span",{className:ls.commitMeta,children:[e.authorName," · ",Jhe(e.authorDate,r,i)]})]}),a.jsx("button",{type:"button",className:ls.copyBtn,onClick:v,"aria-label":o("gitLog.copySha",{sha:e.shortSha}),children:b?a.jsx(kh,{size:12}):a.jsx(J9,{size:12})})]}),T]})}function tbt({workspaceCwd:e,gitCwd:t,onSubtitleChange:n}){const{client:r}=yo(),{t:s}=rt(),[i,o]=h.useState(null),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,m]=h.useState(!1),[p,g]=h.useState(!1),[b,w]=h.useState(Date.now()/1e3),y=h.useRef(0);h.useEffect(()=>{const S=setInterval(()=>w(Date.now()/1e3),6e4);return()=>clearInterval(S)},[]),h.useEffect(()=>{let S=!1;return c(!0),d(!1),g(!1),y.current=0,r.workspaceByCwd(e).workspaceGitLog(BK,0,t).then(T=>{S||(y.current=T.entries.length,o(T))}).catch(()=>{S||d(!0)}).finally(()=>{S||c(!1)}),()=>{S=!0}},[r,e,t]);const v=h.useCallback(()=>{!i||f||(m(!0),r.workspaceByCwd(e).workspaceGitLog(BK,y.current,t).then(S=>{y.current+=S.entries.length,o(T=>{if(!T)return S;const _=new Set(T.entries.map(C=>C.sha));return{...T,entries:[...T.entries,...S.entries.filter(C=>!_.has(C.sha))],hasMore:S.hasMore}})}).catch(()=>{g(!0)}).finally(()=>{m(!1)}))},[r,e,t,i,f]),x=i!=null&&i.available?s("gitLog.subtitle",{count:i.entries.length}):void 0;h.useEffect(()=>{n==null||n(x)},[n,x]);let k;return l?k=a.jsx("div",{className:ls.placeholder,children:s("gitLog.loading")}):u?k=a.jsx("div",{className:ls.placeholder,children:s("gitLog.error")}):!i||!i.available?k=a.jsx("div",{className:ls.placeholder,children:s("gitLog.unavailable")}):i.entries.length===0?k=a.jsx("div",{className:ls.placeholder,children:s("gitLog.empty")}):k=a.jsxs(a.Fragment,{children:[a.jsx("div",{className:ls.commitList,children:i.entries.map(S=>a.jsx(ebt,{entry:S,workspaceCwd:e,gitCwd:t,now:b},S.sha))}),p&&a.jsx("div",{className:ls.placeholder,children:s("gitLog.error")}),i.hasMore&&a.jsx("button",{type:"button",className:ls.loadMore,onClick:()=>{g(!1),v()},disabled:f,children:s(f?"gitLog.loadingMore":"gitLog.loadMore")})]}),a.jsx("div",{className:ls.content,children:k})}const nbt="_content_fozmc_1",rbt="_placeholder_fozmc_7",sbt="_prList_fozmc_14",ibt="_prRow_fozmc_19",obt="_prLine_fozmc_43",abt="_stateOpen_fozmc_50",lbt="_stateDraft_fozmc_55",cbt="_prTitle_fozmc_60",ubt="_badge_fozmc_68",dbt="_badgeApproved_fozmc_77",hbt="_badgeChanges_fozmc_82",fbt="_badgeReviewRequired_fozmc_87",mbt="_checksPassing_fozmc_92",pbt="_checksFailing_fozmc_98",gbt="_checksPending_fozmc_104",bbt="_prMeta_fozmc_110",po={content:nbt,placeholder:rbt,prList:sbt,prRow:ibt,prLine:obt,stateOpen:abt,stateDraft:lbt,prTitle:cbt,badge:ubt,badgeApproved:dbt,badgeChanges:hbt,badgeReviewRequired:fbt,checksPassing:mbt,checksFailing:pbt,checksPending:gbt,prMeta:bbt};function ybt(e){const t=e&&typeof e=="object"?e.body:void 0,n=t&&typeof t=="object"?t.code:void 0;return typeof n=="string"?n:null}function vbt({checks:e}){const{t}=rt();switch(e){case"passing":return a.jsx("span",{className:po.checksPassing,title:t("githubPrs.checksPassing"),children:a.jsx(kh,{size:12})});case"failing":return a.jsx("span",{className:po.checksFailing,title:t("githubPrs.checksFailing"),children:a.jsx(cv,{size:12})});case"pending":return a.jsx("span",{className:po.checksPending,title:t("githubPrs.checksPending"),children:a.jsx(Lxe,{size:12})});default:return null}}function wbt({pr:e,now:t}){const{t:n,language:r}=rt(),s=e.state==="draft"?_ke:Cke,i=e.reviewDecision==="approved"?a.jsx("span",{className:`${po.badge} ${po.badgeApproved}`,children:n("githubPrs.reviewApproved")}):e.reviewDecision==="changes_requested"?a.jsx("span",{className:`${po.badge} ${po.badgeChanges}`,children:n("githubPrs.reviewChanges")}):e.reviewDecision==="review_required"?a.jsx("span",{className:`${po.badge} ${po.badgeReviewRequired}`,children:n("githubPrs.reviewRequired")}):null;return a.jsxs("button",{type:"button",className:po.prRow,"aria-label":n("githubPrs.open",{number:e.number}),onClick:()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},children:[a.jsxs("span",{className:po.prLine,children:[a.jsx(s,{size:12,className:e.state==="draft"?po.stateDraft:po.stateOpen}),a.jsx("span",{className:po.prTitle,children:e.title}),i,a.jsx(vbt,{checks:e.checks})]}),a.jsxs("span",{className:po.prMeta,children:["#",e.number," · ",e.headRefName,e.author?` · ${e.author}`:""," ·"," ",Jhe(e.updatedAt,t,r)]})]})}function xbt({workspaceCwd:e,onSubtitleChange:t}){const{client:n}=yo(),{t:r}=rt(),[s,i]=h.useState(null),[o,l]=h.useState(!0),[c,u]=h.useState(null),[d,f]=h.useState(Date.now()/1e3);h.useEffect(()=>{const g=setInterval(()=>f(Date.now()/1e3),6e4);return()=>clearInterval(g)},[]),h.useEffect(()=>{let g=!1;return l(!0),u(null),n.workspaceByCwd(e).workspaceGitHubPullRequests().then(b=>{g||i(b)}).catch(b=>{g||u(ybt(b)??"unknown")}).finally(()=>{g||l(!1)}),()=>{g=!0}},[n,e]);const m=s!=null&&s.available?r("githubPrs.subtitle",{count:s.pullRequests.length}):void 0;h.useEffect(()=>{t==null||t(m)},[t,m]);let p;return o?p=a.jsx("div",{className:po.placeholder,children:r("githubPrs.loading")}):c==="github_cli_unavailable"?p=a.jsx("div",{className:po.placeholder,children:r("githubPrs.cliUnavailable")}):c!==null?p=a.jsx("div",{className:po.placeholder,children:r("githubPrs.error")}):!s||!s.available?p=a.jsx("div",{className:po.placeholder,children:r("githubPrs.unavailable")}):s.pullRequests.length===0?p=a.jsx("div",{className:po.placeholder,children:r("githubPrs.empty")}):p=a.jsx("div",{className:po.prList,children:s.pullRequests.map(g=>a.jsx(wbt,{pr:g,now:d},g.number))}),a.jsx("div",{className:po.content,children:p})}const kbt="_content_a537a_1",_bt="_tabBar_a537a_7",Sbt="_tab_a537a_7",Cbt="_tabActive_a537a_27",Tbt="_tabPanel_a537a_36",Ebt="_commitPanel_a537a_44",Abt="_commitMessage_a537a_53",jbt="_commitStatus_a537a_79",Nbt="_commitStatusError_a537a_84",Ibt="_commitStatusSuccess_a537a_88",Mbt="_commitActions_a537a_92",Rbt="_commitBtn_a537a_98",Dbt="_commitBtnPrimary_a537a_116",Lbt="_commitBtnSecondary_a537a_125",Pbt="_spin_a537a_135",Obt="_prForm_a537a_149",$bt="_prInput_a537a_158",Bbt="_prBody_a537a_177",zbt="_prBodyWrap_a537a_202",Fbt="_prBodyToolbar_a537a_207",qbt="_prBodyTab_a537a_216",Hbt="_prBodyTabActive_a537a_232",Ubt="_prBodyPreview_a537a_242",Wbt="_prBodyEmpty_a537a_254",Vbt="_prFormRow_a537a_259",Gbt="_branchSelectTrigger_a537a_271",Kbt="_branchSelectValue_a537a_290",Ybt="_branchSelectPopover_a537a_298",Xbt="_branchSelectSearch_a537a_307",Qbt="_branchSelectInput_a537a_316",Jbt="_branchSelectList_a537a_329",Zbt="_branchSelectGroup_a537a_335",eyt="_branchSelectItem_a537a_344",tyt="_branchSelectItemActive_a537a_363",nyt="_branchSelectEmpty_a537a_368",ryt="_branchSelectRetry_a537a_375",rr={content:kbt,tabBar:_bt,tab:Sbt,tabActive:Cbt,tabPanel:Tbt,commitPanel:Ebt,commitMessage:Abt,commitStatus:jbt,commitStatusError:Nbt,commitStatusSuccess:Ibt,commitActions:Mbt,commitBtn:Rbt,commitBtnPrimary:Dbt,commitBtnSecondary:Lbt,spin:Pbt,prForm:Obt,prInput:$bt,prBody:Bbt,prBodyWrap:zbt,prBodyToolbar:Fbt,prBodyTab:qbt,prBodyTabActive:Hbt,prBodyPreview:Ubt,prBodyEmpty:Wbt,prFormRow:Vbt,branchSelectTrigger:Gbt,branchSelectValue:Kbt,branchSelectPopover:Ybt,branchSelectSearch:Xbt,branchSelectInput:Qbt,branchSelectList:Jbt,branchSelectGroup:Zbt,branchSelectItem:eyt,branchSelectItemActive:tyt,branchSelectEmpty:nyt,branchSelectRetry:ryt},syt="workspace_github_prs",zK={diff:"gitDiff.title",log:"gitLog.title",prs:"githubPrs.title",commit:"gitCommit.title"},FK=["diff","log","prs"],yC=3500;function iyt({workspaceCwd:e,gitCwd:t,initialView:n,sessionId:r,resolveSessionForWorkspace:s,onClose:i}){var St;const{t:o}=rt(),{client:l,capabilities:c}=yo(),u=((St=c==null?void 0:c.features)==null?void 0:St.includes(syt))===!0,d=u?FK:FK.filter(ue=>ue!=="prs"),[f,m]=h.useState(n),[p,g]=h.useState(),[b,w]=h.useState(""),[y,v]=h.useState(null),[x,k]=h.useState(!1),[S,T]=h.useState(!1),[_,C]=h.useState(!1),[j,E]=h.useState(""),[L,D]=h.useState(""),[M,R]=h.useState(""),[$,B]=h.useState(!1),[N,z]=h.useState(!1),[G,I]=h.useState(!1),[Y,U]=h.useState(null),[P,F]=h.useState(!1),te=h.useRef(null),[W,K]=h.useState(null),[ce,ie]=h.useState(null),Z=h.useRef(null),ee=h.useRef(s);ee.current=s;const oe=h.useRef(r);oe.current=r;const we=h.useCallback(async(ue,Ee,tt)=>{try{return await l.btwSession(ue,Ee,{signal:tt})}catch(ut){const Ct=ut instanceof Error?ut.message:String(ut);if(/no session/i.test(Ct)&&ee.current){const Ze=await ee.current(t??e,!0);if(Ze&&Ze!==ue&&!tt.aborted)return oe.current=Ze,l.btwSession(Ze,Ee,{signal:tt})}throw ut}},[l,e,t]),pe=h.useRef(we);pe.current=we;const he=h.useRef(n==="commit").current,X=f==="commit",ye=X?"diff":f;h.useEffect(()=>{if(!X)return;const ue=new AbortController;return k(!0),T(!1),w(""),(ee.current?ee.current(t??e):oe.current?Promise.resolve(oe.current):Promise.resolve(void 0)).then(tt=>{if(ue.signal.aborted)return;if(!tt){T(!0),k(!1);return}return l.workspaceByCwd(e).workspaceGitDiff(t).then(Ct=>{if(ue.signal.aborted)return;if(Ct.files.length===0){k(!1);return}const Ze=Ct.files.map(gt=>{const Je=gt.isUntracked?"new":gt.isDeleted?"deleted":"modified",Ae=gt.isBinary?" (binary)":` (+${gt.added??0} -${gt.removed??0})`,de=gt.oldPath?` (renamed from ${gt.oldPath})`:"";return`${Je}: ${gt.path}${Ae}${de}`});let Et=Ze.join(`
`);if(Et.length>yC){let gt="",Je=0;for(const Ae of Ze){if(gt.length+Ae.length+1>yC)break;gt+=(gt?`
`:"")+Ae,Je++}Et=gt+`
(…and ${Ze.length-Je} more files)`}const Nt=`Generate a concise git commit message for these changes. Reply with ONLY the commit message text, no quotes, no explanation.

${Et}`;return pe.current(tt,Nt,ue.signal).then(gt=>{ue.signal.aborted||gt.answer&&w(gt.answer.trim())})})}).catch(()=>{ue.signal.aborted||T(!0)}).finally(()=>{ue.signal.aborted||k(!1)}),()=>{ue.abort()}},[X,l,e,t]);const Ce=d.includes(ye)?ye:"diff",ae=h.useCallback(ue=>{g(void 0),m(ue)},[]),me=ue=>{var Ee;ae(ue),(Ee=document.getElementById(`git-dialog-tab-${ue}`))==null||Ee.focus()},We=ue=>{if(X){ue.key==="ArrowLeft"?(ue.preventDefault(),me(d[d.length-1])):ue.key==="ArrowRight"||ue.key==="Home"?(ue.preventDefault(),me(d[0])):ue.key==="End"&&ue.preventDefault();return}const Ee=d.indexOf(Ce);if(ue.key==="ArrowLeft"||ue.key==="ArrowRight"){ue.preventDefault();const tt=ue.key==="ArrowRight"?1:-1;me(d[(Ee+tt+d.length)%d.length]);return}if(ue.key==="Home"){ue.preventDefault(),me(d[0]);return}ue.key==="End"&&(ue.preventDefault(),me(d[d.length-1]))},Oe=h.useCallback(async ue=>{if(!(y||$||!b.trim())){v(ue?"push":"commit"),ie(null);try{const Ee=l.workspaceByCwd(e),tt=await Ee.workspaceGitCommit(b.trim(),{all:!0},t);if(ue)try{await Ee.workspaceGitPush({setUpstream:!0},t),w(""),ie({msg:o("gitCommit.commitPushSuccess",{sha:tt.sha}),type:"success"})}catch(ut){ie({msg:o("gitCommit.commitSuccessPushFailed",{sha:tt.sha,error:ut instanceof Error?ut.message:String(ut)}),type:"error"})}else w(""),ie({msg:o("gitCommit.commitSuccess",{sha:tt.sha}),type:"success"})}catch(Ee){ie({msg:Ee instanceof Error?Ee.message:String(Ee),type:"error"})}finally{v(null)}}},[l,e,t,b,y,$,o]),Mt=h.useCallback(()=>{const ue=l.workspaceByCwd(e);F(!1),ue.workspaceGitBranches(t).then(Ee=>{const tt=Ee.local.map(Ze=>Ze.name),ut=new Map;for(const Ze of Ee.remote){const Et=Ze.name.indexOf("/"),Nt=Et>0?Ze.name.slice(0,Et):"other";let gt=ut.get(Nt);gt||(gt=[],ut.set(Nt,gt)),gt.push(Ze.name)}U({local:tt,remotes:Array.from(ut.entries())});const Ct=Ee.local.find(Ze=>Ze.isHead);te.current=Ct?{hasUpstream:!!Ct.upstream}:null}).catch(()=>{U(null),F(!0),te.current=null})},[l,e,t]);h.useEffect(()=>{if(!_||!X)return;const ue=l.workspaceByCwd(e);Mt(),K(null),z(!0);const Ee=new AbortController,tt=ue.workspaceGitHubDefaultBranch().then(Ct=>Ct.branch).catch(()=>"origin/main"),ut=ee.current?ee.current(t??e):oe.current?Promise.resolve(oe.current):Promise.resolve(void 0);return Promise.all([tt,ut]).then(([Ct,Ze])=>{if(!Ee.signal.aborted){if(R(Ct),!Ze){ue.workspaceGit().then(Et=>{!Ee.signal.aborted&&Et.branch&&!Et.detached&&E(Et.branch)}).catch(()=>{}).finally(()=>{Ee.signal.aborted||z(!1)});return}return Promise.all([ue.workspaceGitLog(50,0,t,`${Ct}..HEAD`),ue.workspaceGitDiff(t)]).then(([Et,Nt])=>{if(Ee.signal.aborted)return;if(!Et.available){K({msg:o("gitCommit.prLogUnavailable"),type:"error"});return}const gt=Et.entries.length>0?Et.entries.map(nt=>`- ${nt.shortSha} ${nt.subject}`).join(`
`):"(no commits ahead of base)",Je=Nt.files.map(nt=>`${nt.isUntracked?"new":nt.isDeleted?"deleted":"modified"}: ${nt.path}`);let Ae=Je.join(`
`);if(Ae.length>yC){let nt="",ve=0;for(const Ke of Je){if(nt.length+Ke.length+1>yC)break;nt+=(nt?`
`:"")+Ke,ve++}Ae=nt+`
(…and ${Je.length-ve} more files)`}const de=`Generate a GitHub pull request title and body for the changes on this branch compared to ${Ct}. Use the commit history and conversation context to understand what was done and why.

Commits on this branch (not in ${Ct}):
${gt}

${Ae?`Uncommitted changes:
${Ae}

`:""}Follow these rules strictly:
1. Title: conventional commit format, e.g. "feat(web-shell): add branch picker". Under 70 chars.
2. Body must follow this exact template structure (fill in each section):

## What this PR does
<Describe the change in prose. Do NOT reference file names or function names.>

## Why it is needed
<Motivation, problem being solved, or user-facing benefit.>

## Reviewer Test Plan
### How to verify
<Steps a reviewer should follow to confirm the change works.>
### Evidence (Before & After)
N/A
### Tested on
|     OS     | Status |
| :--------: | :----: |
|  macOS  | ⚠️ |
| Windows | ⚠️ |
|  Linux  | ⚠️ |

## Risk & Scope
- Main risk or tradeoff: <fill in>
- Not validated / out of scope: <fill in>
- Breaking changes / migration notes: none

<details>
<summary>中文说明</summary>

<Full Chinese translation of the English body above, section by section.>

</details>

3. Do NOT hard-wrap paragraphs — write each paragraph as one long line.
4. Reply with the title on the first line, then a blank line, then the body. No extra explanation.`;return pe.current(Ze,de,Ee.signal).then(nt=>{if(!Ee.signal.aborted)if(nt.answer){const ve=nt.answer.trim().split(`
`);E(ve[0]??""),D(ve.slice(1).join(`
`).trim())}else console.warn("[GitDialog] btwSession returned null answer")})})}}).catch(Ct=>{Ee.signal.aborted||(console.error("[GitDialog] PR generation failed:",Ct),K({msg:Ct instanceof Error?Ct.message:String(Ct),type:"error"}),ue.workspaceGit().then(Ze=>{!Ee.signal.aborted&&Ze.branch&&!Ze.detached&&E(Ze.branch)}).catch(()=>{}))}).finally(()=>{Ee.signal.aborted||z(!1)}),()=>Ee.abort()},[_,X,l,e,t,o,Mt]);const $t=h.useCallback(async()=>{if(!(!j.trim()||N||$)){if(B(!0),K(null),te.current&&!te.current.hasUpstream){K({msg:o("gitCommit.prPushFirst"),type:"error"}),B(!1);return}try{const ue=l.workspaceByCwd(e),Ee=M.trim(),tt=((Y==null?void 0:Y.remotes)??[]).map(([Ze])=>Ze).sort((Ze,Et)=>Et.length-Ze.length).find(Ze=>Ee.startsWith(`${Ze}/`)),ut=tt?Ee.slice(tt.length+1):Ee,Ct=await ue.workspaceGitHubCreatePullRequest({title:j.trim(),body:L.trim()||void 0,base:ut||void 0},t);K({msg:o("gitCommit.prCreated",{number:Ct.number??""}),type:"success",url:Ct.url}),C(!1)}catch(ue){K({msg:ue instanceof Error?ue.message:String(ue),type:"error"})}finally{B(!1)}}},[l,e,t,j,L,M,Y,N,$,o]);return a.jsx(zi,{title:o(zK[X?"commit":Ce]),subtitle:p,size:"xl",allowFullscreen:!0,onClose:i,children:a.jsxs("div",{className:rr.content,children:[a.jsxs("div",{className:rr.tabBar,role:"tablist",children:[d.map(ue=>a.jsx("button",{id:`git-dialog-tab-${ue}`,type:"button",role:"tab","aria-selected":Ce===ue&&!X,"aria-controls":"git-dialog-panel",tabIndex:Ce===ue&&!X?0:-1,className:`${rr.tab}${Ce===ue&&!X?` ${rr.tabActive}`:""}`,onClick:()=>ae(ue),onKeyDown:We,children:o(zK[ue])},ue)),he&&a.jsx("button",{id:"git-dialog-tab-commit",type:"button",role:"tab","aria-selected":X,"aria-controls":"git-dialog-panel",tabIndex:X?0:-1,className:`${rr.tab}${X?` ${rr.tabActive}`:""}`,onKeyDown:We,onClick:()=>ae("commit"),children:o("gitCommit.title")})]}),a.jsx("div",{id:"git-dialog-panel",className:rr.tabPanel,role:"tabpanel","aria-labelledby":`git-dialog-tab-${X?"commit":Ce}`,children:Ce==="diff"||X?a.jsx(C1t,{workspaceCwd:e,gitCwd:t,onSubtitleChange:g}):Ce==="log"?a.jsx(tbt,{workspaceCwd:e,gitCwd:t,onSubtitleChange:g}):a.jsx(xbt,{workspaceCwd:e,onSubtitleChange:g})}),X&&a.jsxs("div",{className:rr.commitPanel,children:[a.jsx("textarea",{ref:Z,className:rr.commitMessage,placeholder:o(x?"gitCommit.generating":S?"gitCommit.genFailed":"gitCommit.messagePlaceholder"),value:b,disabled:x,onChange:ue=>w(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"&&(ue.metaKey||ue.ctrlKey)&&(ue.preventDefault(),Oe(!1))}}),ce&&a.jsx("div",{className:`${rr.commitStatus} ${ce.type==="error"?rr.commitStatusError:rr.commitStatusSuccess}`,children:ce.msg}),a.jsxs("div",{className:rr.commitActions,children:[a.jsxs("button",{type:"button",className:`${rr.commitBtn} ${rr.commitBtnPrimary}`,disabled:!b.trim()||!!y||$,onClick:()=>void Oe(!1),children:[y==="commit"&&a.jsx(Ag,{size:14,className:rr.spin}),o("gitCommit.commit")]}),a.jsxs("button",{type:"button",className:`${rr.commitBtn} ${rr.commitBtnSecondary}`,disabled:!b.trim()||!!y||$,onClick:()=>void Oe(!0),children:[y==="push"&&a.jsx(Ag,{size:14,className:rr.spin}),o("gitCommit.commitAndPush")]}),u&&a.jsx("button",{type:"button",className:`${rr.commitBtn} ${rr.commitBtnSecondary}`,disabled:!!y||$,onClick:()=>C(!_),children:o("gitCommit.createPr")})]}),_&&a.jsxs("div",{className:rr.prForm,children:[a.jsx("input",{className:rr.prInput,placeholder:o(N?"gitCommit.generating":"gitCommit.prTitlePlaceholder"),value:j,disabled:N,onChange:ue=>E(ue.target.value)}),a.jsxs("div",{className:rr.prBodyWrap,children:[a.jsxs("div",{className:rr.prBodyToolbar,children:[a.jsxs("button",{type:"button",className:`${rr.prBodyTab} ${G?"":rr.prBodyTabActive}`,onClick:()=>I(!1),children:[a.jsx(_y,{size:12}),o("gitCommit.prEdit")]}),a.jsxs("button",{type:"button",className:`${rr.prBodyTab} ${G?rr.prBodyTabActive:""}`,onClick:()=>I(!0),children:[a.jsx(Gxe,{size:12}),o("gitCommit.prPreview")]})]}),G?a.jsx("div",{className:rr.prBodyPreview,children:L?a.jsx(Qf,{content:L}):a.jsx("span",{className:rr.prBodyEmpty,children:o("gitCommit.prBodyPlaceholder")})}):a.jsx("textarea",{className:rr.prBody,placeholder:o(N?"gitCommit.generating":"gitCommit.prBodyPlaceholder"),value:L,disabled:N,onChange:ue=>D(ue.target.value)})]}),a.jsxs("div",{className:rr.prFormRow,children:[a.jsx(oyt,{value:M,onChange:R,branches:Y,error:P,onRetry:Mt}),a.jsxs("button",{type:"button",className:`${rr.commitBtn} ${rr.commitBtnPrimary}`,disabled:!j.trim()||$||N||!!y,onClick:()=>void $t(),children:[$&&a.jsx(Ag,{size:14,className:rr.spin}),o("gitCommit.prSubmit")]})]})]}),W&&a.jsx("div",{className:`${rr.commitStatus} ${W.type==="error"?rr.commitStatusError:rr.commitStatusSuccess}`,children:W.url?a.jsx("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",children:W.msg}):W.msg})]})]})})}function oyt({value:e,onChange:t,branches:n,error:r=!1,onRetry:s}){const{t:i}=rt(),[o,l]=h.useState(!1),[c,u]=h.useState(""),d=h.useRef(null),f=c.toLowerCase().trim(),m=n?n.remotes.map(([g,b])=>[g,b.filter(w=>!f||w.toLowerCase().includes(f))]).filter(([g,b])=>b.length>0||g.toLowerCase().includes(f)):[],p=n?n.local.filter(g=>!f||g.toLowerCase().includes(f)):[];return a.jsxs(Kf,{open:o,onOpenChange:g=>{l(g),g?setTimeout(()=>{var b;return(b=d.current)==null?void 0:b.focus()},50):u("")},children:[a.jsx(Wp,{asChild:!0,children:a.jsxs("button",{type:"button",className:rr.branchSelectTrigger,"aria-label":i("branchSelect.baseBranch"),children:[a.jsx("span",{className:rr.branchSelectValue,children:e?e.includes("/")?e.slice(e.indexOf("/")+1):e:"main"}),a.jsx(Oc,{size:12})]})}),a.jsxs(Yf,{className:rr.branchSelectPopover,side:"bottom",align:"start",sideOffset:4,children:[a.jsxs("div",{className:rr.branchSelectSearch,children:[a.jsx(tu,{size:13}),a.jsx("input",{ref:d,className:rr.branchSelectInput,placeholder:i("branchSelect.search"),"aria-label":i("branchSelect.search"),value:c,onChange:g=>u(g.target.value)})]}),a.jsxs("div",{className:rr.branchSelectList,children:[m.map(([g,b])=>a.jsxs("div",{children:[a.jsx("div",{className:rr.branchSelectGroup,children:g}),b.map(w=>a.jsx("button",{type:"button",className:`${rr.branchSelectItem} ${w===e?rr.branchSelectItemActive:""}`,onClick:()=>{t(w),l(!1)},children:w.includes("/")?w.slice(w.indexOf("/")+1):w},w))]},g)),p.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:rr.branchSelectGroup,children:i("branchSelect.local")}),p.map(g=>a.jsx("button",{type:"button",className:`${rr.branchSelectItem} ${g===e?rr.branchSelectItemActive:""}`,onClick:()=>{t(g),l(!1)},children:g},g))]}),!n&&(r?a.jsxs("div",{className:rr.branchSelectEmpty,children:[i("branchSelect.error"),s&&a.jsx("button",{type:"button",className:rr.branchSelectRetry,onClick:s,children:i("branchSelect.retry")})]}):a.jsx("div",{className:rr.branchSelectEmpty,children:i("branchSelect.loading")})),n&&m.length===0&&p.length===0&&a.jsx("div",{className:rr.branchSelectEmpty,children:i("branchSelect.noMatches")})]})]})]})}function ayt(e,t,n="all",r="all"){const s=t.trim().toLowerCase();return e.filter(i=>n!=="all"&&i.level!==n||r==="disabled"&&i.status!=="disabled"||r==="enabled"&&i.status==="disabled"?!1:s?i.name.toLowerCase().includes(s):!0)}function lyt(e,t){return e&&t.some(n=>n.name===e)?e:null}const cyt=6*1024*1024;function uyt(e,t){const n=e&&typeof e=="object"?e.body:void 0,r=n&&typeof n=="object"?n.code:void 0;return r==="invalid_skill_source"?t("skills.install.error.invalidSource"):r==="invalid_skill_scope"?t("skills.install.error.invalidScope"):r==="invalid_skill_name"?t("skills.install.error.invalidName"):r==="skill_manifest_missing"?t("skills.install.error.manifestMissing"):r==="invalid_skill_package"||r==="invalid_skill_manifest"||r==="skill_name_mismatch"||r==="unsafe_skill_path"?t("skills.install.error.invalidPackage"):r==="skill_package_too_large"?t("skills.install.error.zipTooLarge"):r==="invalid_skill_folder"?t("skills.install.error.invalidFolder"):r==="github_api_failed"||r==="github_skill_download_failed"?t("skills.install.error.githubFailed"):r==="skill_not_found"?t("skills.install.error.notFound"):r==="token_required"?t("skills.install.error.authentication"):r==="untrusted_workspace"?t("skills.install.error.untrusted"):Ao(e)||t("skills.install.failed")}async function dyt(e){const t=new Uint8Array(await e.arrayBuffer());let n="";for(let r=0;r<t.length;r+=32768)n+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(n)}function hyt({open:e,onOpenChange:t,onInstall:n}){const{t:r}=rt(),[s,i]=h.useState(""),[o,l]=h.useState("workspace"),[c,u]=h.useState("github"),[d,f]=h.useState(""),[m,p]=h.useState(""),[g,b]=h.useState(null),[w,y]=h.useState(!1),[v,x]=h.useState(null);function k(){i(""),l("workspace"),u("github"),f(""),p(""),b(null),x(null)}async function S(){y(!0),x(null);try{if(!s.trim())throw new Error(r("skills.install.error.nameRequired"));let T;if(c==="github"){if(!d.trim())throw new Error(r("skills.install.error.githubRequired"));T={type:"github",url:d.trim()}}else if(c==="folder"){if(!m.trim())throw new Error(r("skills.install.error.folderRequired"));T={type:"folder",path:m.trim()}}else{if(!g)throw new Error(r("skills.install.selectZip"));if(g.size>cyt)throw new Error(r("skills.install.error.zipTooLarge"));T={type:"zip",contentBase64:await dyt(g)}}await n({name:s.trim(),scope:o,source:T}),t(!1),k()}catch(T){x(uyt(T,r))}finally{y(!1)}}return a.jsx(zp,{open:e,onOpenChange:T=>{w||(t(T),T||k())},children:a.jsxs(Fp,{className:"sm:max-w-lg",showCloseButton:!1,onPointerDownOutside:T=>T.preventDefault(),children:[a.jsxs(qp,{children:[a.jsx(Up,{children:r("skills.install.title")}),a.jsx(Hg,{children:r("skills.install.description")})]}),a.jsxs("div",{className:"grid gap-4",children:[v?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(ao,{children:v})]}):null,a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("skills.install.name"),a.jsx(Us,{value:s,onChange:T=>i(T.target.value),placeholder:"my-skill",disabled:w})]}),a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("skills.install.scope"),a.jsxs(Sl,{value:o,onValueChange:T=>l(T),disabled:w,children:[a.jsx(Tl,{className:"w-full",children:a.jsx(Cl,{})}),a.jsxs(El,{children:[a.jsx(Ti,{value:"workspace",children:r("skills.install.scope.workspace")}),a.jsx(Ti,{value:"global",children:r("skills.install.scope.global")})]})]})]}),a.jsxs(y1,{value:c,onValueChange:T=>u(T),children:[a.jsxs(v1,{className:"grid w-full grid-cols-3",children:[a.jsx(ci,{value:"github",disabled:w,children:"GitHub"}),a.jsx(ci,{value:"folder",disabled:w,children:r("skills.install.folder")}),a.jsx(ci,{value:"zip",disabled:w,children:"ZIP"})]}),a.jsx(Fi,{value:"github",className:"pt-3",children:a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("skills.install.githubUrl"),a.jsx(Us,{type:"url",value:d,onChange:T=>f(T.target.value),placeholder:"https://github.com/owner/repo/blob/main/skill/SKILL.md",disabled:w})]})}),a.jsx(Fi,{value:"folder",className:"pt-3",children:a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("skills.install.folderPath"),a.jsx(Us,{value:m,onChange:T=>p(T.target.value),placeholder:"/absolute/path/to/my-skill",disabled:w})]})}),a.jsx(Fi,{value:"zip",className:"pt-3",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(Us,{type:"file",accept:".zip,application/zip",onChange:T=>{var C;const _=((C=T.target.files)==null?void 0:C[0])??null;b(_),_&&i(j=>j||_.name.replace(/\.zip$/i,""))},disabled:w}),g?a.jsx("div",{className:"text-xs text-muted-foreground",children:r("skills.install.zipSelected",{name:g.name})}):null]})})]})]}),a.jsxs(Hp,{children:[a.jsx(Zt,{variant:"outline",onClick:()=>{t(!1),k()},disabled:w,children:r("common.cancel")}),a.jsxs(Zt,{onClick:()=>void S(),disabled:w,children:[w?a.jsx(Hr,{"data-icon":"inline-start"}):a.jsx($_e,{"data-icon":"inline-start"}),r("skills.install.action")]})]})]})})}const fyt="_skillGrid_1hucr_1",myt={skillGrid:fyt};function qK(e,t){return t(`skills.level.${e.level}`)}function HK(e,t){return t(e.status==="disabled"?"skills.status.disabled":"skills.status.enabled")}function UK(e){return e.status==="disabled"?"":"bg-[var(--success-bg)] text-[var(--success-color)]"}function pyt(e,t){const n=e&&typeof e=="object"?e.body:void 0,r=n&&typeof n=="object"?n.code:void 0;return r==="skill_inactive_extension"?t("skills.error.inactiveExtension"):r==="skill_not_toggleable"?t("skills.notToggleable"):e instanceof Error?e.message:t("skills.toggleFailed")}function eb({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function WK({compact:e=!1}){const{t}=rt();return a.jsx(Cd,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx(Ai,{variant:"secondary",className:e?"text-[10px]":void 0,children:t("skills.manualReference")})}),a.jsx(Uu,{children:t("skills.manualReferenceHint")})]})})}function Zhe({onClose:e,onUseSkill:t,embedded:n}){var ee,oe,we,pe;const{t:r}=rt(),s=yo(),{status:i,skills:o,loading:l,error:c,reload:u,setEnabled:d,install:f,remove:m}=jwe({autoLoad:!0}),p=((ee=s.capabilities)==null?void 0:ee.features.includes("workspace_skill_toggle"))===!0,g=((oe=s.capabilities)==null?void 0:oe.features.includes("workspace_skill_manage"))===!0,[b,w]=h.useState(""),[y,v]=h.useState("all"),[x,k]=h.useState("enabled"),[S,T]=h.useState({}),[_,C]=h.useState(null),[j,E]=h.useState(null),[L,D]=h.useState(!1),[M,R]=h.useState(!1),[$,B]=h.useState(null),[N,z]=h.useState(null),G=h.useMemo(()=>o.map(he=>({...he,status:S[he.name]??he.status})),[o,S]),I=h.useMemo(()=>G.find(he=>he.name===_),[G,_]),Y=h.useMemo(()=>ayt(G,b,y,x),[G,y,b,x]),U=G.filter(he=>he.status==="disabled").length,P=(c==null?void 0:c.message)??((pe=(we=i==null?void 0:i.errors)==null?void 0:we[0])==null?void 0:pe.error),F=[{value:"all",label:r("skills.filter.all")},{value:"user",label:r("skills.filter.user")},{value:"project",label:r("skills.filter.project")},{value:"extension",label:r("skills.filter.extension")},{value:"bundled",label:r("skills.filter.bundled")}];h.useEffect(()=>{C(he=>lyt(he,G))},[G]),h.useEffect(()=>{T(he=>{const X={...he};let ye=!1;for(const Ce of o)X[Ce.name]===Ce.status&&(delete X[Ce.name],ye=!0);return ye?X:he})},[o]),h.useEffect(()=>{n==null||n.onDetailChange(!!I)},[n,I]);async function te(he){const X=he.status==="disabled";E(he.name),z(null);try{await d(he.name,X),T(ye=>({...ye,[he.name]:X?"ok":"disabled"})),await u(),z({skillName:he.name,text:r(X?"skills.enabled":"skills.disabled"),error:!1})}catch(ye){z({skillName:he.name,text:pyt(ye,r),error:!0})}finally{E(null)}}async function W(he){B(null),await f(he),B(r("skills.install.succeeded",{name:he.name.trim()})),await u().catch(()=>{})}async function K(){if(!I)return;const he=I.level==="project"?"workspace":"global";E(I.name);try{await m(I.name,he),R(!1),C(null),B(r("skills.delete.succeeded",{name:I.name})),await u().catch(()=>{})}catch(X){R(!1),z({skillName:I.name,text:X instanceof Error?X.message:r("skills.delete.failed"),error:!0})}finally{E(null)}}function ce(){C(null),u()}const ie=a.jsx(t0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(n0,{className:"text-base",children:[a.jsx(so,{children:a.jsx(Zt,{variant:"ghost",size:"icon",onClick:e,"aria-label":r("common.back"),children:a.jsx(v_,{})})}),a.jsx(so,{children:I?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:ce,children:r("skills.title")})}):a.jsx(ql,{children:r("skills.title")})}),I?a.jsx(yh,{}):null,I?a.jsx(so,{children:a.jsx(ql,{children:I.name})}):null]})}),Z=n?I?a.jsx(t0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(n0,{className:"h-8 text-sm",children:[a.jsx(so,{children:a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{ce(),n.onDetailChange(!1)},children:r("skills.title")})})}),a.jsx(yh,{}),a.jsx(so,{children:a.jsx(ql,{children:I.name})})]})}):null:ie;if(I){const he=`/${I.name}${I.argumentHint?` ${I.argumentHint}`:""}`;return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Z,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(Jb,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold text-balance",children:I.name}),a.jsx(Ai,{variant:"outline",children:qK(I,r)}),a.jsx(Ai,{variant:"secondary",className:UK(I),children:HK(I,r)}),I.modelInvocable?null:a.jsx(WK,{})]})}),a.jsxs(Zt,{disabled:I.status==="disabled",onClick:()=>t(I.name),children:[a.jsx(a_e,{"data-icon":"inline-start"}),r("skills.run")]}),a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx(Zt,{variant:"ghost",size:"icon",disabled:j!==null,"aria-label":r("skills.actions"),"data-testid":"skill-actions",children:j===I.name?a.jsx(Hr,{}):a.jsx(tp,{})})}),a.jsx(Du,{align:"end",onCloseAutoFocus:X=>X.preventDefault(),children:a.jsxs(Sp,{children:[a.jsx(bi,{disabled:j!==null||!p||I.userInvocable===!1,title:p?I.userInvocable===!1?r("skills.notToggleable"):void 0:r("skills.toggleUnsupported"),onSelect:()=>void te(I),children:r(I.status==="disabled"?"skills.enable":"skills.disable")}),g&&(I.level==="project"||I.level==="user")?a.jsx(bi,{variant:"destructive",disabled:j!==null,onSelect:()=>R(!0),children:r("skills.delete.action")}):null]})})]})]}),(N==null?void 0:N.skillName)===I.name?a.jsx(pc,{tone:N.error?"error":"success",noticeKey:N.text,closeLabel:r("common.close"),onDismiss:()=>z(null),children:N.text}):null,P||I.error?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(ao,{children:I.error||P})]}):null,a.jsxs(Uo,{children:[a.jsxs(Vl,{children:[a.jsx(Gl,{className:"text-sm",children:r("skills.details")}),a.jsx(Lu,{children:I.description||r("skills.noDescription")})]}),a.jsxs(hc,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(eb,{label:r("skills.invocation"),value:he}),a.jsx(eb,{label:r("skills.level"),value:qK(I,r)}),a.jsx(eb,{label:r("skills.modelAccess"),value:I.modelInvocable?r("skills.modelAccess.enabled"):r("skills.modelAccess.disabled")}),a.jsx(eb,{label:r("skills.model"),value:I.model||"-"}),a.jsx(eb,{label:r("skills.extension"),value:I.extensionName||"-"}),I.hint?a.jsx("div",{className:"sm:col-span-2",children:a.jsx(eb,{label:r("skills.hint"),value:I.hint})}):null]})]}),a.jsx(Wy,{open:M,onOpenChange:X=>{!X&&j!==null||R(X)},children:a.jsxs(Vy,{children:[a.jsxs(Gy,{children:[a.jsx(Yy,{children:r("skills.delete.title")}),a.jsx(Xy,{children:r("skills.delete.description",{name:I.name})})]}),a.jsxs(Ky,{children:[a.jsx(Qy,{disabled:j!==null,children:r("common.cancel")}),a.jsxs(Y6,{variant:"destructive",disabled:j!==null,onClick:X=>{X.preventDefault(),K()},children:[j?a.jsx(Hr,{"data-icon":"inline-start"}):null,r("skills.delete.action")]})]})]})})]})]})}return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Z,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:r("skills.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:r("skills.count",{count:o.length,enabled:o.length-U,disabled:U})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Zt,{variant:"outline",disabled:l,onClick:()=>void u(),children:[l?a.jsx(Hr,{"data-icon":"inline-start"}):a.jsx($g,{"data-icon":"inline-start"}),r("common.refresh")]}),g?a.jsxs(Zt,{onClick:()=>D(!0),children:[a.jsx(Wf,{"data-icon":"inline-start"}),r("skills.install.action")]}):null]})]}),P?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(ao,{children:P})]}):null,$?a.jsx(pc,{tone:"success",noticeKey:$,closeLabel:r("common.close"),onDismiss:()=>B(null),children:$}):null,a.jsxs("div",{className:"relative",children:[a.jsx(tu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Us,{name:"skill-search","aria-label":r("skills.search"),autoComplete:"off",value:b,onChange:he=>w(he.target.value),placeholder:r("skills.search"),className:"pl-9"})]}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsx(oO,{type:"single",value:y,onValueChange:he=>{he&&v(he)},variant:"outline",size:"sm","aria-label":r("skills.filter.label"),children:F.map(he=>a.jsx(aO,{value:he.value,children:he.label},he.value))}),a.jsxs(Sl,{value:x,onValueChange:he=>k(he),children:[a.jsx(Tl,{className:"w-32","aria-label":r("skills.filter.status.label"),children:a.jsx(Cl,{})}),a.jsxs(El,{children:[a.jsx(Ti,{value:"all",children:r("skills.filter.status.all")}),a.jsx(Ti,{value:"enabled",children:r("skills.filter.status.enabled")}),a.jsx(Ti,{value:"disabled",children:r("skills.filter.status.disabled")})]})]})]}),Y.length?a.jsx("div",{className:myt.skillGrid,"data-column-count":Math.min(Y.length,4),children:Y.map(he=>a.jsx(Uo,{size:"sm",role:"button",tabIndex:0,"aria-label":he.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>C(he.name),onKeyDown:X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),C(he.name))},children:a.jsx(Vl,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(Jb,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(Gl,{className:"min-w-0 flex-1 truncate",children:he.name}),a.jsxs("div",{className:"flex shrink-0 gap-1",children:[a.jsx(Ai,{variant:"secondary",className:`${UK(he)} text-[10px]`,children:HK(he,r)}),he.modelInvocable?null:a.jsx(WK,{compact:!0})]})]}),a.jsx(Lu,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Cd,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:he.description||r("skills.noDescription")})}),a.jsx(Uu,{children:he.description||r("skills.noDescription")})]})})})]})]})})},he.name))}):a.jsx(fd,{className:"border",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:b||y!=="all"||x!=="all"?a.jsx(tu,{}):a.jsx(Jb,{})}),a.jsx(gd,{children:r(b||y!=="all"||x!=="all"?"skills.noMatches":"skills.empty")})]})})]}),a.jsx(hyt,{open:L,onOpenChange:D,onInstall:W})]})}const gyt="_chart_1xbk4_1",byt="_plot_1xbk4_8",yyt="_svg_1xbk4_13",vyt="_cursor_1xbk4_30",wyt="_tooltip_1xbk4_40",xyt="_tooltipBelow_1xbk4_62",kyt="_tooltipTime_1xbk4_67",_yt="_tooltipRow_1xbk4_73",Syt="_tooltipLabel_1xbk4_79",Cyt="_tooltipValue_1xbk4_83",Tyt="_axis_1xbk4_91",Eyt="_legend_1xbk4_96",Ayt="_legendItem_1xbk4_105",jyt="_swatch_1xbk4_112",Nyt="_legendLabel_1xbk4_118",Iyt="_legendValue_1xbk4_123",Myt="_peak_1xbk4_131",Aa={chart:gyt,plot:byt,svg:yyt,cursor:vyt,tooltip:wyt,tooltipBelow:xyt,tooltipTime:kyt,tooltipRow:_yt,tooltipLabel:Syt,tooltipValue:Cyt,axis:Tyt,legend:Eyt,legendItem:Ayt,swatch:jyt,legendLabel:Nyt,legendValue:Iyt,peak:Myt},wR=320,bx=64,ic=3,vC=wR-ic*2,wC=bx-ic*2;function VK(e,t){return Number.isFinite(e)?e:t}const Ryt=84;function Dyt(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}function Lyt(e){return new Date(e).toLocaleTimeString()}function efe({series:e,timestamps:t,format:n=l=>String(Math.round(l)),formatTime:r=Lyt,zeroBased:s=!0,ariaLabel:i,peakLabel:o="peak"}){const l=h.useRef(null),[c,u]=h.useState(null),[d,f]=h.useState(!1),m=h.useRef(void 0),{paths:p,maxV:g,maxLen:b,min:w,span:y}=h.useMemo(()=>{const E=e.reduce((N,z)=>Math.max(N,z.values.length),0);let L=0,D=s?0:Number.POSITIVE_INFINITY;for(const N of e)for(const z of N.values)Number.isFinite(z)&&(z>L&&(L=z),z<D&&(D=z));Number.isFinite(D)||(D=0);const M=L-D||1,R=N=>E<=1?ic+vC/2:ic+N/(E-1)*vC,$=N=>ic+wC-(VK(N,D)-D)/M*wC;return{paths:e.map(N=>{const z=N.values.map((Y,U)=>`${U===0?"M":"L"}${R(U).toFixed(1)},${$(Y).toFixed(1)}`).join(" "),G=N.values.length-1,I=G>=0?{cx:R(G),cy:$(N.values[G]),color:N.color}:void 0;return{key:N.label,d:z,color:N.color,dot:I}}),maxV:L,maxLen:E,min:D,span:M}},[e,s]),v=b>0,x=E=>b<=1?ic+vC/2:ic+E/(b-1)*vC,k=E=>ic+wC-(VK(E,w)-w)/y*wC,S=E=>{const L=l.current;if(!L||b===0)return;const D=L.getBoundingClientRect();if(D.width===0)return;const M=(E.clientX-D.left)/D.width,R=Math.max(0,Math.min(b-1,Math.round(M*(b-1))));u(R),m.current===void 0&&(m.current=Dyt(L));const $=m.current,B=$?$.getBoundingClientRect().top:0;f(D.top-B<Ryt)},T=()=>u(null),_=c!=null&&c>=0&&c<b?c:null,C=_!=null?x(_):0,j=_!=null&&b>1?_/(b-1)*100:50;return a.jsxs("div",{className:Aa.chart,children:[a.jsxs("div",{className:Aa.plot,children:[a.jsxs("svg",{ref:l,viewBox:`0 0 ${wR} ${bx}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:Aa.svg,onPointerMove:S,onPointerLeave:T,children:[a.jsx("line",{x1:ic,y1:bx-ic,x2:wR-ic,y2:bx-ic,className:Aa.axis,vectorEffect:"non-scaling-stroke"}),p.map(E=>a.jsx("path",{d:E.d,fill:"none",stroke:E.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},E.key)),_!=null&&a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:C,y1:ic,x2:C,y2:bx-ic,className:Aa.cursor,vectorEffect:"non-scaling-stroke"}),e.map(E=>_<E.values.length?a.jsx("circle",{cx:C,cy:k(E.values[_]),r:2.5,fill:E.color,vectorEffect:"non-scaling-stroke"},`${E.label}-hover`):null)]}),_==null&&p.map(E=>E.dot?a.jsx("circle",{cx:E.dot.cx,cy:E.dot.cy,r:2,fill:E.dot.color,vectorEffect:"non-scaling-stroke"},`${E.key}-dot`):null)]}),_!=null&&a.jsxs("div",{className:`${Aa.tooltip} ${d?Aa.tooltipBelow:""}`,style:{left:`${j}%`},role:"tooltip",children:[t&&t[_]!=null&&a.jsx("div",{className:Aa.tooltipTime,children:r(t[_])}),e.map(E=>_<E.values.length?a.jsxs("div",{className:Aa.tooltipRow,children:[a.jsx("svg",{className:Aa.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:a.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:E.color})}),a.jsx("span",{className:Aa.tooltipLabel,children:E.label}),a.jsx("span",{className:Aa.tooltipValue,children:n(E.values[_])})]},E.label):null)]})]}),a.jsxs("div",{className:Aa.legend,children:[e.map(E=>{const L=E.values.length?E.values[E.values.length-1]:void 0;return a.jsxs("span",{className:Aa.legendItem,children:[a.jsx("svg",{className:Aa.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:a.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:E.color})}),a.jsx("span",{className:Aa.legendLabel,children:E.label}),L!==void 0&&a.jsx("span",{className:Aa.legendValue,children:n(L)})]},E.label)}),v&&a.jsx("span",{className:Aa.peak,children:`${o} ${n(g)}`})]})]})}const Pyt="_wrap_1icv6_1",Oyt="_tooltip_1icv6_11",$yt="_legend_1icv6_27",Byt="_legendLabel_1icv6_35",zyt="_scroll_1icv6_39",Fyt="_grid_1icv6_44",qyt="_month_1icv6_51",Hyt="_weekday_1icv6_59",Uyt="_cell_1icv6_69",Wyt="_legendCell_1icv6_75",Vyt="_lvl0_1icv6_82",Gyt="_lvl1_1icv6_85",Kyt="_lvl2_1icv6_88",Yyt="_lvl3_1icv6_91",Xyt="_lvl4_1icv6_94",Qyt="_today_1icv6_98",Ll={wrap:Pyt,tooltip:Oyt,legend:$yt,legendLabel:Byt,scroll:zyt,grid:Fyt,month:qyt,weekday:Hyt,cell:Uyt,legendCell:Wyt,lvl0:Vyt,lvl1:Gyt,lvl2:Kyt,lvl3:Yyt,lvl4:Xyt,today:Qyt},t7=864e5,Jyt=4;function n7(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function GK(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function Zyt(e){const t=e.filter(r=>r>0).sort((r,s)=>r-s);if(t.length===0)return[0,0,0];const n=r=>t[Math.min(t.length-1,Math.floor(r*(t.length-1)))];return[n(.25),n(.5),n(.75)]}function evt(e,[t,n,r]){return e<=0?0:e<=t?1:e<=n?2:e<=r?3:Jyt}function tvt(e,t,n){const r=Math.max(1,Math.floor(t)),s=n7(Date.now()),i=n7(s.getTime()-(r-1)*t7),o=(i.getDay()+6)%7,l=n7(i.getTime()-o*t7),c=Math.round((s.getTime()-l.getTime())/t7)+1,u=[],d=[],f=GK(s),m=new Date(l.getTime());for(let x=0;x<c;x++){const k=GK(m),S=e[k],T=(S==null?void 0:S.tokens)??0;d.push(T),u.push({dateKey:k,tokens:T,cacheReadRate:(S==null?void 0:S.cacheReadRate)??0,isToday:k===f,weekday:x%7,week:Math.floor(x/7)}),m.setDate(m.getDate()+1)}const p=Zyt(d),g=u.map(x=>({...x,level:evt(x.tokens,p)})),b=Math.ceil(c/7),w=[];let y=-1;const v=new Date(l.getTime());for(let x=0;x<b;x++){const k=v.getMonth();k!==y&&(w.push({week:x,text:v.toLocaleDateString(n,{month:"short"})}),y=k),v.setDate(v.getDate()+7)}return{cells:g,months:w,weeks:b}}function nvt({heatmap:e,days:t}){const{t:n,language:r}=rt(),s=h.useMemo(()=>tvt(e,t,r),[e,t,r]),i=h.useRef(null),[o,l]=h.useState(null),c={0:n("daemon.usage.dowMon"),2:n("daemon.usage.dowWed"),4:n("daemon.usage.dowFri")},u=d=>{const f=d.target.closest("[data-date]"),m=i.current;if(!f||!m)return;const p=f.dataset.date??"",g=Number(f.dataset.tokens??"0"),b=Number(f.dataset.cache??"0"),w=f.getBoundingClientRect(),y=m.getBoundingClientRect();l({left:w.left-y.left+w.width/2,top:w.top-y.top,text:n("daemon.usage.cellTokens",{date:p,tokens:zb(g),cache:Math.round(b*100)})})};return a.jsxs("div",{className:Ll.wrap,ref:i,children:[a.jsxs("div",{className:Ll.legend,children:[a.jsx("span",{className:Ll.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>a.jsx("span",{className:`${Ll.cell} ${Ll.legendCell} ${Ll[`lvl${d}`]}`},d)),a.jsx("span",{className:Ll.legendLabel,children:n("daemon.usage.high")})]}),a.jsx("div",{className:Ll.scroll,onMouseOver:u,onMouseLeave:()=>l(null),children:a.jsxs("div",{className:Ll.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${s.weeks}, var(--hm-cell))`},children:[s.months.map(d=>a.jsx("div",{className:Ll.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>a.jsx("div",{className:Ll.weekday,style:{gridColumn:1,gridRow:d+2},children:c[d]},`wd-${d}`)),s.cells.map(d=>a.jsx("div",{className:`${Ll.cell} ${Ll[`lvl${d.level}`]} ${d.isToday?Ll.today:""}`,style:{gridColumn:d.week+2,gridRow:d.weekday+2},"data-date":d.dateKey,"data-tokens":d.tokens,"data-cache":d.cacheReadRate},d.dateKey))]})}),o&&a.jsx("div",{className:Ll.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const rvt="_usage_1kfmt_1",svt="_toolbar_1kfmt_9",ivt="_segmented_1kfmt_14",ovt="_segment_1kfmt_14",avt="_segmentActive_1kfmt_41",lvt="_hero_1kfmt_48",cvt="_heroMain_1kfmt_59",uvt="_heroLabel_1kfmt_63",dvt="_heroNumber_1kfmt_71",hvt="_heroSub_1kfmt_82",fvt="_refresh_1kfmt_87",mvt="_stats_1kfmt_109",pvt="_stat_1kfmt_109",gvt="_statValue_1kfmt_121",bvt="_statLabel_1kfmt_130",yvt="_section_1kfmt_139",vvt="_sectionTitle_1kfmt_145",wvt="_sectionSub_1kfmt_154",xvt="_breakdown_1kfmt_161",kvt="_metric_1kfmt_167",_vt="_metricHead_1kfmt_173",Svt="_tick_1kfmt_179",Cvt="_tick_input_1kfmt_186",Tvt="_tick_output_1kfmt_190",Evt="_tick_cache_1kfmt_198",Avt="_metricLabel_1kfmt_202",jvt="_metricValue_1kfmt_209",Nvt="_metricHint_1kfmt_219",Ivt="_state_1kfmt_225",Mvt="_modelList_1kfmt_233",Rvt="_modelRow_1kfmt_239",Dvt="_modelHead_1kfmt_245",Lvt="_modelRank_1kfmt_251",Pvt="_modelMeta_1kfmt_262",Ovt="_modelName_1kfmt_267",$vt="_modelSub_1kfmt_277",Bvt="_modelShare_1kfmt_282",zvt="_modelTrack_1kfmt_289",Fvt="_modelFill_1kfmt_296",qvt="_modelFillCache_1kfmt_303",Hvt="_skillTable_1kfmt_310",Uvt="_right_1kfmt_334",Wvt="_bars_1kfmt_339",Vvt="_barsBody_1kfmt_345",Gvt="_barCol_1kfmt_352",Kvt="_bar_1kfmt_339",Yvt="_barsCaption_1kfmt_371",Fn={usage:rvt,toolbar:svt,segmented:ivt,segment:ovt,segmentActive:avt,hero:lvt,heroMain:cvt,heroLabel:uvt,heroNumber:dvt,heroSub:hvt,refresh:fvt,stats:mvt,stat:pvt,statValue:gvt,statLabel:bvt,section:yvt,sectionTitle:vvt,sectionSub:wvt,breakdown:xvt,metric:kvt,metricHead:_vt,tick:Svt,tick_input:Cvt,tick_output:Tvt,tick_cache:Evt,metricLabel:Avt,metricValue:jvt,metricHint:Nvt,state:Ivt,modelList:Mvt,modelRow:Rvt,modelHead:Dvt,modelRank:Lvt,modelMeta:Pvt,modelName:Ovt,modelSub:$vt,modelShare:Bvt,modelTrack:zvt,modelFill:Fvt,modelFillCache:qvt,skillTable:Hvt,right:Uvt,bars:Wvt,barsBody:Vvt,barCol:Gvt,bar:Kvt,barsCaption:Yvt},tfe=12,Xvt=Math.round(tfe*30.44),Qvt=["today","week","month"],Jvt={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},Zvt={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},ewt={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},KK=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function twt(e){return new Date(`${e}T00:00:00`).getTime()}function r7(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function nwt(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function xC({label:e,value:t}){return a.jsxs("div",{className:Fn.stat,children:[a.jsx("div",{className:Fn.statValue,children:t.toLocaleString()}),a.jsx("div",{className:Fn.statLabel,children:e})]})}function s7({accent:e,value:t,label:n,hint:r}){return a.jsxs("div",{className:Fn.metric,children:[a.jsxs("div",{className:Fn.metricHead,children:[a.jsx("span",{className:`${Fn.tick} ${Fn[`tick_${e}`]}`}),a.jsx("span",{className:Fn.metricLabel,children:n})]}),a.jsx("div",{className:Fn.metricValue,children:t}),a.jsx("div",{className:Fn.metricHint,children:r})]})}function rwt({rank:e,model:t,color:n}){const{t:r}=rt(),s=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return a.jsxs("div",{className:Fn.modelRow,children:[a.jsxs("div",{className:Fn.modelHead,children:[a.jsx("span",{className:Fn.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),a.jsxs("div",{className:Fn.modelMeta,children:[a.jsx("div",{className:Fn.modelName,children:t.model}),a.jsx("div",{className:Fn.modelSub,children:r("daemon.usage.modelMeta",{tokens:zb(t.totalTokens),cache:Math.round(i)})})]}),a.jsxs("span",{className:Fn.modelShare,style:{color:n},children:[Math.round(s),"%"]})]}),a.jsx("div",{className:Fn.modelTrack,children:a.jsx("div",{className:Fn.modelFill,style:{width:`${s}%`,background:n},children:a.jsx("div",{className:Fn.modelFillCache,style:{width:`${i}%`}})})})]})}function swt({points:e,format:t,locale:n}){const r=Math.max(1,...e.map(s=>s.value));return a.jsxs("div",{className:Fn.bars,children:[a.jsx("div",{className:Fn.barsBody,children:e.map((s,i)=>a.jsx("div",{className:Fn.barCol,title:`${r7(s.label,n)} · ${t(s.value)}`,children:a.jsx("div",{className:Fn.bar,style:{height:`${s.value/r*100}%`}})},`${s.label}-${i}`))}),e.length>1&&a.jsxs("div",{className:Fn.barsCaption,children:[a.jsx("span",{children:r7(e[0].label,n)}),a.jsx("span",{children:r7(e[e.length-1].label,n)})]})]})}function iwt(){const{t:e,language:t}=rt(),[n,r]=h.useState("today"),{dashboard:s,loading:i,error:o,reload:l}=Nwe({range:n,heatmapDays:Xvt,autoLoad:!0}),c=a.jsx("div",{className:Fn.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:Qvt.map(v=>a.jsx("button",{type:"button",className:`${Fn.segment} ${v===n?Fn.segmentActive:""}`,"aria-pressed":v===n,onClick:()=>r(v),children:e(Jvt[v])},v))});if(!s)return a.jsxs("div",{className:Fn.usage,children:[a.jsx("div",{className:Fn.toolbar,children:c}),i?a.jsx("div",{className:Fn.state,children:e("daemon.usage.loading")}):o?a.jsxs("div",{className:Fn.state,children:[e("daemon.usage.failed"),": ",o.message]}):a.jsx("div",{className:Fn.state,children:e("daemon.usage.empty")})]});const{summary:u,models:d,skills:f,daily:m,heatmap:p,heatmapDays:g}=s,b=u.linesAdded+u.linesRemoved,w=u.totalTokens>0||Object.keys(p).length>0,y=e(ewt[s.range]);return a.jsxs("div",{className:Fn.usage,"aria-busy":i,children:[a.jsx("div",{className:Fn.toolbar,children:c}),a.jsxs("header",{className:Fn.hero,children:[a.jsxs("div",{className:Fn.heroMain,children:[a.jsx("div",{className:Fn.heroLabel,children:e(Zvt[s.range])}),a.jsx("div",{className:Fn.heroNumber,children:zb(u.totalTokens)}),a.jsx("div",{className:Fn.heroSub,children:e("daemon.usage.tokensConsumed")})]}),a.jsx("button",{type:"button",className:Fn.refresh,onClick:()=>void l(),disabled:i,children:e("daemon.refresh")})]}),a.jsxs("div",{className:Fn.stats,children:[a.jsx(xC,{label:e("daemon.usage.sessions"),value:u.sessions}),a.jsx(xC,{label:e("daemon.usage.requests"),value:u.requests}),a.jsx(xC,{label:e("daemon.usage.tools"),value:u.toolCalls}),a.jsx(xC,{label:e("daemon.usage.changes"),value:b})]}),a.jsxs("section",{className:Fn.section,children:[a.jsx("h4",{className:Fn.sectionTitle,children:e("daemon.usage.breakdownTitle")}),a.jsxs("div",{className:Fn.breakdown,children:[a.jsx(s7,{accent:"input",value:zb(u.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),a.jsx(s7,{accent:"output",value:zb(u.outputTokens+u.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),a.jsx(s7,{accent:"cache",value:`${Math.round(u.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),a.jsxs("section",{className:Fn.section,children:[a.jsx("h4",{className:Fn.sectionTitle,children:e("daemon.usage.heatmapTitle")}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.heatmapSub",{months:tfe})}),w?a.jsx(nvt,{heatmap:p,days:g}):a.jsx("div",{className:Fn.state,children:e("daemon.usage.empty")})]}),d.length>0&&a.jsxs("section",{className:Fn.section,children:[a.jsxs("h4",{className:Fn.sectionTitle,children:[y," ",e("daemon.usage.modelShareTitle")]}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.modelShareSub")}),a.jsx("div",{className:Fn.modelList,children:d.map((v,x)=>a.jsx(rwt,{rank:x+1,model:v,color:KK[x%KK.length]},v.model))})]}),f.length>0&&a.jsxs("section",{className:Fn.section,children:[a.jsxs("h4",{className:Fn.sectionTitle,children:[y," ",e("daemon.usage.skillTitle")]}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.skillSub")}),a.jsxs("table",{className:Fn.skillTable,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:e("daemon.usage.skillName")}),a.jsx("th",{className:Fn.right,children:e("daemon.usage.skillCount")})]})}),a.jsx("tbody",{children:f.map(v=>a.jsxs("tr",{children:[a.jsx("td",{children:v.name}),a.jsx("td",{className:Fn.right,children:v.count.toLocaleString()})]},v.name))})]})]}),m.length>1&&a.jsxs("section",{className:Fn.section,children:[a.jsxs("h4",{className:Fn.sectionTitle,children:[y," ",e("daemon.usage.dailyTokensTitle")]}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.dailyTokensSub")}),a.jsx(efe,{series:[{label:e("daemon.usage.tokensConsumed"),values:m.map(v=>v.tokens),color:"var(--agent-blue-400)"}],timestamps:m.map(v=>twt(v.date)),format:zb,formatTime:v=>nwt(v,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),m.length>1&&a.jsxs("section",{className:Fn.section,children:[a.jsxs("h4",{className:Fn.sectionTitle,children:[y," ",e("daemon.usage.dailySessionsTitle")]}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.dailySessionsSub")}),a.jsx(swt,{points:m.map(v=>({label:v.date,value:v.sessions})),format:v=>v.toLocaleString(),locale:t})]})]})}const owt="_dialog_lw868_4",awt="_toolbar_lw868_12",lwt="_toolbarActions_lw868_19",cwt="_updatedAt_lw868_26",uwt="_refreshError_lw868_31",dwt="_refreshButton_lw868_36",hwt="_badge_lw868_51",fwt="_levelOk_lw868_61",mwt="_levelWarning_lw868_66",pwt="_levelError_lw868_71",gwt="_levelUnavailable_lw868_76",bwt="_tabs_lw868_81",ywt="_tab_lw868_81",vwt="_tabActive_lw868_106",wwt="_grid_lw868_114",xwt="_chartsGrid_lw868_113",kwt="_card_lw868_128",_wt="_cardTitle_lw868_135",Swt="_cardHeader_lw868_147",Cwt="_infoHint_lw868_162",Twt="_infoHintButton_lw868_168",Ewt="_infoHintTip_lw868_197",Awt="_row_lw868_231",jwt="_rowLabel_lw868_240",Nwt="_rowValue_lw868_244",Iwt="_pathRow_lw868_253",Mwt="_pathValue_lw868_247",Rwt="_empty_lw868_274",Dwt="_issueRow_lw868_279",Lwt="_issueMessage_lw868_286",Pwt="_featureChips_lw868_290",Owt="_featureChip_lw868_290",$wt="_summaryChip_lw868_311",Bwt="_sessionRow_lw868_320",zwt="_sessionName_lw868_329",Fwt="_sessionMeta_lw868_335",qwt="_activePrompt_lw868_344",Hwt="_workspaceRow_lw868_348",Uwt="_workspaceRowHead_lw868_357",Wwt="_workspaceName_lw868_363",Vwt="_workspaceDuration_lw868_367",Gwt="_workspaceError_lw868_374",Kwt="_workspaceSummary_lw868_381",Ywt="_workspaceCell_lw868_388",Xwt="_workspaceCellLabel_lw868_397",Qwt="_workspaceCellMessage_lw868_402",In={dialog:owt,toolbar:awt,toolbarActions:lwt,updatedAt:cwt,refreshError:uwt,refreshButton:dwt,badge:hwt,levelOk:fwt,levelWarning:mwt,levelError:pwt,levelUnavailable:gwt,tabs:bwt,tab:ywt,tabActive:vwt,grid:wwt,chartsGrid:xwt,card:kwt,cardTitle:_wt,cardHeader:Swt,infoHint:Cwt,infoHintButton:Twt,infoHintTip:Ewt,row:Awt,rowLabel:jwt,rowValue:Nwt,pathRow:Iwt,pathValue:Mwt,empty:Rwt,issueRow:Dwt,issueMessage:Lwt,featureChips:Pwt,featureChip:Owt,summaryChip:$wt,sessionRow:Bwt,sessionName:zwt,sessionMeta:Fwt,activePrompt:qwt,workspaceRow:Hwt,workspaceRowHead:Uwt,workspaceName:Wwt,workspaceDuration:Vwt,workspaceError:Gwt,workspaceSummary:Kwt,workspaceCell:Ywt,workspaceCellLabel:Xwt,workspaceCellMessage:Qwt},Jwt=5e3,tb=[{id:"overview",labelKey:"daemon.tab.overview"},{id:"usage",labelKey:"daemon.tab.usage"},{id:"metrics",labelKey:"daemon.tab.metrics"},{id:"diagnostics",labelKey:"daemon.tab.diagnostics"}];function nfe(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),i=t%60;return n>0?`${n}d ${r}h ${s}m`:r>0?`${r}h ${s}m ${i}s`:s>0?`${s}m ${i}s`:`${i}s`}function cp(e){return e=Math.max(0,e),e>=6e4?nfe(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function P3(e){const t=e/1024;if(t<1)return`${Math.round(e)} B`;const n=t/1024;return n<1?`${t.toFixed(t<10?1:0)} KB`:n>=1024?`${(n/1024).toFixed(2)} GB`:`${n.toFixed(1)} MB`}function Hw(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function Zwt(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function ext(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function YK(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const txt=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function nxt(e){if(!YK(e))return[];const t=[];for(const n of txt){const r=e[n];if(Array.isArray(r))for(const s of r){if(!YK(s))continue;const i=s.status;if(i!=="warning"&&i!=="error")continue;const o=String(s.kind??s.name??s.serverName??n),l=typeof s.error=="string"?s.error:typeof s.hint=="string"?s.hint:void 0;t.push({label:o,status:i,message:l})}}return t}function xR(e){switch(e){case"ok":return In.levelOk;case"warning":return In.levelWarning;case"error":return In.levelError;default:return In.levelUnavailable}}function Ds({label:e,value:t}){return a.jsxs("div",{className:In.row,children:[a.jsx("span",{className:In.rowLabel,children:e}),a.jsx("span",{className:In.rowValue,children:t})]})}function rxt({text:e}){return a.jsxs("span",{className:In.infoHint,children:[a.jsx("button",{type:"button",className:In.infoHintButton,"aria-label":e,children:a.jsx("span",{"aria-hidden":"true",children:"ⓘ"})}),a.jsx("span",{"aria-hidden":"true",className:In.infoHintTip,children:e})]})}function bu({title:e,help:t,children:n}){return a.jsxs("section",{className:In.card,children:[t?a.jsxs("div",{className:In.cardHeader,children:[a.jsx("h3",{className:In.cardTitle,children:e}),a.jsx(rxt,{text:t})]}):a.jsx("h3",{className:In.cardTitle,children:e}),n]})}function sxt({name:e,section:t}){const{t:n}=rt(),r=Object.entries(t.summary??{}),s=nxt(t.data);return a.jsxs("div",{className:In.workspaceRow,children:[a.jsxs("div",{className:In.workspaceRowHead,children:[a.jsx("span",{className:`${In.badge} ${xR(t.status)}`,children:n(`daemon.level.${t.status}`)}),a.jsx("span",{className:In.workspaceName,children:e}),a.jsx("span",{className:In.workspaceDuration,children:cp(t.durationMs)})]}),t.error&&a.jsx("div",{className:In.workspaceError,children:t.error.message}),s.map((i,o)=>a.jsxs("div",{className:In.workspaceCell,children:[a.jsx("span",{className:`${In.badge} ${xR(i.status)}`,children:n(`daemon.level.${i.status}`)}),a.jsx("span",{className:In.workspaceCellLabel,children:i.label}),i.message&&a.jsx("span",{className:In.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),r.length>0&&a.jsx("div",{className:In.workspaceSummary,children:r.map(([i,o])=>a.jsxs("span",{className:In.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function ixt({report:e}){const{t}=rt(),n=e.full;if(!n)return null;const r=Object.entries(n.workspace).sort(([s],[i])=>s.localeCompare(i));return a.jsxs(a.Fragment,{children:[a.jsx(bu,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?a.jsx("div",{className:In.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(s=>a.jsxs("div",{className:In.sessionRow,children:[a.jsx("div",{className:In.sessionName,children:s.displayName||s.sessionId}),a.jsxs("div",{className:In.sessionMeta,children:[a.jsx("span",{children:t("common.clients",{count:s.clientCount})}),a.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:s.pendingPromptCount})}),a.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:s.pendingPermissionCount})}),s.hasActivePrompt&&a.jsx("span",{className:In.activePrompt,children:t("daemon.full.session.prompting")})]})]},s.sessionId))}),a.jsx(bu,{title:t("daemon.full.workspace.title"),children:r.length===0?a.jsx("div",{className:In.empty,children:t("daemon.full.workspace.empty")}):r.map(([s,i])=>a.jsx(sxt,{name:s,section:i},s))}),a.jsxs(bu,{title:t("daemon.full.auth.title"),children:[a.jsx(Ds,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),a.jsx(Ds,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),a.jsx(Ds,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function oxt({series:e}){const{t}=rt();if(e.length===0)return a.jsx(bu,{title:t("daemon.charts.title"),children:a.jsx("div",{className:In.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),r=e.map(i=>i.t),s=(i,o,l,c)=>a.jsx(bu,{title:t(i),help:t(c),children:a.jsx(efe,{series:l,timestamps:r,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return a.jsxs("div",{className:`${In.grid} ${In.chartsGrid}`,children:[s("daemon.charts.concurrency",Hw,[{label:t("daemon.charts.activePrompts"),values:n(i=>i.activePrompts),color:"var(--primary)"},{label:t("daemon.charts.queuedPrompts"),values:n(i=>i.queuedPrompts),color:"var(--warning-color)"},{label:t("daemon.charts.activeSessions"),values:n(i=>i.activeSessions),color:"var(--muted-foreground)"}],"daemon.charts.concurrency.help"),s("daemon.charts.requests",Hw,[{label:t("daemon.charts.reqTotal"),values:n(i=>i.requests),color:"var(--success-color)"},{label:t("daemon.charts.reqErrors"),values:n(i=>i.errors),color:"var(--error-color)"},{label:t("daemon.charts.reqRejected"),values:n(i=>i.rateLimitRejected),color:"var(--warning-color)"}],"daemon.charts.requests.help"),s("daemon.charts.apiLatency",cp,[{label:"p50",values:n(i=>i.latencyP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.latencyP95Ms),color:"var(--warning-color)"}],"daemon.charts.apiLatency.help"),s("daemon.charts.llmLatency",cp,[{label:"p50",values:n(i=>i.llmApiP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.llmApiP95Ms),color:"var(--primary)"}],"daemon.charts.llmLatency.help"),s("daemon.charts.apiHealth",Hw,[{label:t("daemon.charts.apiErrors"),values:n(i=>i.llmApiErrors??0),color:"var(--error-color)"},{label:t("daemon.charts.apiRetries"),values:n(i=>i.llmApiRetries??0),color:"var(--warning-color)"}],"daemon.charts.apiHealth.help"),s("daemon.charts.promptLatency",cp,[{label:t("daemon.charts.queueWait"),values:n(i=>i.promptQueueWaitP95Ms),color:"var(--warning-color)"},{label:t("daemon.charts.promptDuration"),values:n(i=>i.promptDurationP95Ms),color:"var(--primary)"}],"daemon.charts.promptLatency.help"),s("daemon.charts.eventLoop",cp,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}],"daemon.charts.eventLoop.help"),s("daemon.charts.cpu",Zwt,[{label:t("daemon.charts.cpuDaemon"),values:n(i=>i.cpuPercent),color:"var(--muted-foreground)"},{label:t("daemon.charts.cpuChild"),values:n(i=>i.childCpuPercent),color:"var(--primary)"}],"daemon.charts.cpu.help"),s("daemon.charts.memory",P3,[{label:t("daemon.charts.rssDaemon"),values:n(i=>i.rssBytes),color:"var(--muted-foreground)"},{label:t("daemon.charts.heap"),values:n(i=>i.heapUsedBytes),color:"var(--agent-blue-400)"},{label:t("daemon.charts.rssChild"),values:n(i=>i.childRssBytes),color:"var(--primary)"}],"daemon.charts.memory.help"),s("daemon.charts.pipe",P3,[{label:t("daemon.charts.pipeIn"),values:n(i=>i.pipeInBytes),color:"var(--agent-blue-400)"},{label:t("daemon.charts.pipeOut"),values:n(i=>i.pipeOutBytes),color:"var(--success-color)"}],"daemon.charts.pipe.help"),s("daemon.charts.connections",Hw,[{label:"SSE",values:n(i=>i.sseConnections),color:"var(--primary)"},{label:"WS",values:n(i=>i.wsConnections),color:"var(--agent-blue-400)"},{label:"ACP",values:n(i=>i.acpConnections),color:"var(--muted-foreground)"}],"daemon.charts.connections.help"),s("daemon.charts.tokens",Hw,[{label:t("daemon.charts.tokensIn"),values:n(i=>i.tokensIn),color:"var(--agent-blue-400)"},{label:t("daemon.charts.tokensOut"),values:n(i=>i.tokensOut),color:"var(--success-color)"}],"daemon.charts.tokens.help")]})}function axt(){var C;const{t:e}=rt(),[t,n]=h.useState("overview"),r=h.useRef([]),s=(j,E)=>{var D;let L;if(j.key==="ArrowRight"||j.key==="ArrowDown")L=(E+1)%tb.length;else if(j.key==="ArrowLeft"||j.key==="ArrowUp")L=(E-1+tb.length)%tb.length;else if(j.key==="Home")L=0;else if(j.key==="End")L=tb.length-1;else return;j.preventDefault(),n(tb[L].id),(D=r.current[L])==null||D.focus()},i=FN({autoLoad:!0,detail:"summary"}),o=FN({autoLoad:!0,detail:"full"}),l=i.reload,c=o.reload,u=h.useRef(!1);h.useEffect(()=>{const j=window.setInterval(()=>{document.hidden||u.current||(u.current=!0,l().finally(()=>{u.current=!1}))},Jwt);return()=>window.clearInterval(j)},[l]);const d=h.useCallback(()=>{l(),c()},[l,c]),f=i.report??o.report,m=o.report,p=i.loading||o.loading,g=i.error??o.error;if(!f)return a.jsx("div",{className:In.dialog,children:a.jsx("div",{className:In.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const b=m??f,{daemon:w,runtime:y,security:v,limits:x,capabilities:k}=f,S=y.transport.acp,T=Object.values(y.rateLimit.rejectedSinceStart).reduce((j,E)=>j+E,0),_=j=>j===null?e("daemon.limits.unlimited"):j;return a.jsxs("div",{className:In.dialog,children:[a.jsxs("div",{className:In.toolbar,children:[a.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${b.status}`)}`,className:`${In.badge} ${xR(b.status)}`,children:e(`daemon.level.${b.status}`)}),a.jsx("span",{className:In.updatedAt,children:e("daemon.updatedAt",{time:new Date(f.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&a.jsx("span",{className:In.refreshError,children:e("daemon.loadFailed")}),a.jsx("div",{className:In.toolbarActions,children:a.jsx("button",{type:"button",className:In.refreshButton,onClick:d,disabled:p,children:e("daemon.refresh")})})]}),b.issues.length>0&&a.jsx(bu,{title:e("daemon.issues.title"),children:b.issues.map((j,E)=>a.jsxs("div",{className:In.issueRow,children:[a.jsx("span",{className:`${In.badge} ${j.severity==="error"?In.levelError:In.levelWarning}`,children:j.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),a.jsx("span",{className:In.issueMessage,children:j.message})]},`${j.code}-${E}`))}),a.jsx("div",{className:In.tabs,role:"tablist","aria-label":e("daemon.title"),children:tb.map((j,E)=>a.jsx("button",{ref:L=>{r.current[E]=L},type:"button",role:"tab",id:`daemon-tab-${j.id}`,"aria-selected":j.id===t,"aria-controls":`daemon-tabpanel-${j.id}`,tabIndex:j.id===t?0:-1,className:`${In.tab} ${j.id===t?In.tabActive:""}`,onClick:()=>n(j.id),onKeyDown:L=>s(L,E),children:e(j.labelKey)},j.id))}),t==="overview"&&a.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:In.grid,children:[a.jsxs(bu,{title:e("daemon.overview.title"),children:[w.qwenCodeVersion&&a.jsx(Ds,{label:e("daemon.overview.version"),value:w.qwenCodeVersion}),a.jsx(Ds,{label:e("daemon.overview.pid"),value:w.pid}),a.jsx(Ds,{label:e("daemon.overview.mode"),value:w.mode}),a.jsx(Ds,{label:e("daemon.overview.uptime"),value:nfe(w.uptimeMs)}),a.jsxs("div",{className:In.pathRow,children:[a.jsx("span",{className:In.rowLabel,children:e("daemon.overview.workspace")}),a.jsx("span",{className:In.pathValue,title:w.workspaceCwd,children:a.jsx("bdi",{children:w.workspaceCwd})})]})]}),a.jsxs(bu,{title:e("daemon.runtime.title"),children:[y.error?a.jsxs("div",{className:In.workspaceError,children:[e("daemon.runtime.startFailed"),": ",y.error]}):y.loading?a.jsx("div",{className:In.empty,children:e("daemon.runtime.startingUp")}):null,a.jsx(Ds,{label:e("daemon.runtime.activeSessions"),value:y.sessions.active}),y.activity&&a.jsxs(a.Fragment,{children:[a.jsx(Ds,{label:e("daemon.runtime.activePrompts"),value:y.activity.activePrompts}),a.jsx(Ds,{label:e("daemon.runtime.idle"),value:y.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):cp(y.activity.idleSinceMs)})]}),a.jsx(Ds,{label:e("daemon.runtime.pendingPermissions"),value:y.permissions.pending}),a.jsx(Ds,{label:e("daemon.runtime.permissionPolicy"),value:y.permissions.policy}),a.jsx(Ds,{label:e("daemon.runtime.channel"),value:y.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),y.channelWorker.enabled&&a.jsxs(a.Fragment,{children:[a.jsx(Ds,{label:e("daemon.runtime.channelWorker"),value:ext(y.channelWorker)}),y.channelWorker.error&&a.jsx("div",{className:In.workspaceError,children:y.channelWorker.error}),(y.channelWorker.restartCount??0)>0&&a.jsx(Ds,{label:e("daemon.runtime.channelWorkerRestarts"),value:y.channelWorker.restartCount})]}),a.jsx(Ds,{label:e("daemon.runtime.memory"),value:`${P3(y.process.rss)} / ${P3(y.process.heapUsed)}`})]}),a.jsxs(bu,{title:e("daemon.transport.title"),children:[a.jsx(Ds,{label:e("daemon.transport.restSse"),value:y.transport.restSseActive}),S.enabled?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{label:e("daemon.transport.acpConnections"),value:S.connections}),a.jsx(Ds,{label:e("daemon.transport.acpStreams"),value:`${S.sessionStreams} / ${S.sseStreams} / ${S.wsStreams}`}),a.jsx(Ds,{label:e("daemon.transport.pendingRequests"),value:S.pendingClientRequests})]}):a.jsx("div",{className:In.empty,children:e("daemon.transport.acpDisabled")}),a.jsx(Ds,{label:e("daemon.transport.rateLimitRejected"),value:y.rateLimit.enabled?T:e("common.disabled")})]}),a.jsxs(bu,{title:e("daemon.security.title"),children:[a.jsx(Ds,{label:e("daemon.security.token"),value:v.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),a.jsx(Ds,{label:e("daemon.security.requireAuth"),value:v.requireAuth?e("common.enabled"):e("common.disabled")}),a.jsx(Ds,{label:e("daemon.security.loopback"),value:v.loopbackBind?e("common.enabled"):e("common.disabled")}),a.jsx(Ds,{label:e("daemon.security.allowOrigin"),value:v.allowOriginMode}),a.jsx(Ds,{label:e("daemon.security.shell"),value:v.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),a.jsxs(bu,{title:e("daemon.limits.title"),children:[a.jsx(Ds,{label:e("daemon.limits.maxSessions"),value:_(x.maxSessions)}),a.jsx(Ds,{label:e("daemon.limits.maxPendingPrompts"),value:_(x.maxPendingPromptsPerSession)}),a.jsx(Ds,{label:e("daemon.limits.maxConnections"),value:_(x.listenerMaxConnections)}),a.jsx(Ds,{label:e("daemon.limits.eventRing"),value:x.eventRingSize}),a.jsx(Ds,{label:e("daemon.limits.promptDeadline"),value:x.promptDeadlineMs===null?e("daemon.limits.unlimited"):cp(x.promptDeadlineMs)}),a.jsx(Ds,{label:e("daemon.limits.sessionIdle"),value:cp(x.sessionIdleTimeoutMs)})]}),a.jsx(bu,{title:k.features.length?e("daemon.capabilities.titleCount",{count:k.features.length}):e("daemon.capabilities.title"),children:k.features.length===0?a.jsx("span",{className:In.empty,children:e("daemon.none")}):a.jsx("div",{className:In.featureChips,children:[...k.features].sort().map(j=>a.jsx("span",{className:In.featureChip,children:j},j))})})]}),t==="usage"&&a.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:a.jsx(Uf,{label:"daemon-usage",fallback:a.jsx("div",{className:In.empty,children:e("daemon.usage.failed")}),children:a.jsx(iwt,{})})}),t==="metrics"&&a.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:a.jsx(oxt,{series:((C=f.runtime.metrics)==null?void 0:C.series)??[]})}),t==="diagnostics"&&a.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:a.jsx(Uf,{label:"daemon-status-detail",fallback:a.jsx("div",{className:In.empty,children:e("daemon.details.failed")}),children:m!=null&&m.full?a.jsx(ixt,{report:m}):o.loading?a.jsx("div",{className:In.empty,children:e("daemon.details.loading")}):o.error?a.jsxs("div",{className:In.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):a.jsx("div",{className:In.empty,children:e("daemon.details.failed")})})})]})}function lxt(){const{t:e}=rt();return a.jsx(Uf,{label:"daemon-status",fallback:t=>a.jsx("div",{className:In.dialog,children:a.jsxs("div",{className:In.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:a.jsx(axt,{})})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function rfe(e,t){const n=e.match(/^(.*)\/session\/[^/]+\/?$/),r=(n==null?void 0:n[1])??e.replace(/\/$/,"");return t?`${r}/session/${encodeURIComponent(t)}`:r||"/"}function cxt(e){const t=e.match(/\/session\/([^/]+)\/?$/);if(t)try{return decodeURIComponent(t[1])}catch{return}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const sfe="split",Cp=6;function uxt(e,t,n){const r=new URL(t);return r.pathname=rfe(r.pathname,void 0),r.searchParams.set(sfe,e.join(",")),n&&(r.hash=new URLSearchParams({token:n}).toString()),r.toString()}function dxt(e){const t=new URLSearchParams(e).get(sfe);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}const lO="qwen-webshell-split-sessions";function hxt(e){const t=Array.from(new Set(e.filter(Boolean))).slice(0,Cp);try{sessionStorage.setItem(lO,JSON.stringify(t))}catch{}}function fxt(){try{const e=sessionStorage.getItem(lO);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?Array.from(new Set(t.filter(n=>typeof n=="string"&&n.length>0))).slice(0,Cp):[]}catch{return[]}}function mxt(){try{sessionStorage.removeItem(lO)}catch{}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ife(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function X6(e){var t;return((t=e.displayName)==null?void 0:t.trim())||ife(e.cwd)}function Q6(e,t){const n=t==null?void 0:t.find(r=>r.cwd===e);return n?X6(n):ife(e)}function cO(e){var t;return(((t=e==null?void 0:e.workspaces)==null?void 0:t.length)??0)>1}function pxt(e,t){return!!e&&!!t&&e!==t}function ofe(e,t){if(t.length===0)return e;const n=new Map;for(const r of e)n.set(r.sessionId,r);for(const r of t)n.has(r.sessionId)||n.set(r.sessionId,r);return[...n.values()]}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const kC=[];function afe(e=!0){var c;const t=yo(),n=t.client,r=e?(((c=t.capabilities)==null?void 0:c.workspaces)??[]).filter(u=>!u.primary&&u.trusted).map(u=>u.cwd).join(`
`):"",[s,i]=h.useState(kC),o=h.useCallback(async()=>{const u=r?r.split(`
`):[];if(u.length===0)return kC;const d=await Promise.allSettled(u.map(m=>n.listWorkspaceSessions(m,{pageSize:nh,archiveState:"active",sourceType:rh}))),f=[];return d.forEach((m,p)=>{m.status==="fulfilled"?f.push(...m.value):console.warn(`[useOtherWorkspaceSessions] failed to list sessions for ${u[p]}:`,m.reason)}),f.length===0?kC:f},[n,r]),l=h.useCallback(async()=>{r&&i(await o())},[r,o]);return h.useEffect(()=>{if(!r){i(d=>d.length===0?d:kC);return}let u=!1;return o().then(d=>{u||i(d)}),()=>{u=!0}},[r,o]),{sessions:s,reload:l}}function gxt(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?_xt(e):""}let ag;const bxt="qwen-daemon-auth",yxt=2500,lfe="qwen-daemon-token";function vxt(){try{return window.sessionStorage.getItem(lfe)||void 0}catch{return}}function wxt(e){try{window.sessionStorage.setItem(lfe,e)}catch{}}function cfe(){if(ag)return ag;if(typeof window>"u")return;const t=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||"";return t?(wxt(t),ag=t,ag):(ag=vxt(),ag)}function xxt(e=yxt){return typeof window>"u"||window.parent===window?Promise.resolve(void 0):new Promise(t=>{let n=!1;const r=o=>{n||(n=!0,window.removeEventListener("message",s),clearTimeout(i),ag=o,t(o))},s=o=>{if(o.source!==window.parent||!o.origin.startsWith("chrome-extension://")&&!o.origin.startsWith("moz-extension://"))return;const l=o.data;if((l==null?void 0:l.type)!==bxt)return;const c=typeof l.token=="string"?l.token:"";r(c.trim()||void 0)},i=setTimeout(()=>r(void 0),e);window.addEventListener("message",s)})}function kxt(){if(typeof window>"u")return;const e=new URL(window.location.href);let t=!1;if(e.searchParams.has("token")&&(e.searchParams.delete("token"),t=!0),e.hash){const n=new URLSearchParams(e.hash.replace(/^#/,""));if(n.has("token")){n.delete("token");const r=n.toString();e.hash=r?`#${r}`:"",t=!0}}t&&window.history.replaceState(null,"",e)}function _xt(e){try{const t=new URL(e,window.location.origin);if(!(t.protocol==="http:"||t.protocol==="https:"))return"";if(t.origin===window.location.origin)return t.origin;if(!(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"||t.hostname==="[::1]"))return"";const s=window.location.port||(window.location.protocol==="https:"?"443":"80");return(t.port||(t.protocol==="https:"?"443":"80"))!==s?"":t.origin}catch{return""}}const Sxt="_panel_1s6rs_1",Cxt="_toolbar_1s6rs_9",Txt="_count_1s6rs_16",Ext="_selectAll_1s6rs_21",Axt="_actionButton_1s6rs_30",jxt="_refreshButton_1s6rs_50",Nxt="_notice_1s6rs_61",Ixt="_grid_1s6rs_71",Mxt="_card_1s6rs_80",Rxt="_cardCurrent_1s6rs_91",Dxt="_cardTop_1s6rs_96",Lxt="_cardCheckbox_1s6rs_103",Pxt="_colorDot_1s6rs_108",Oxt="_cardLabel_1s6rs_115",$xt="_currentBadge_1s6rs_135",Bxt="_cardMeta_1s6rs_145",zxt="_metaItem_1s6rs_153",Fxt="_statusBadge_1s6rs_162",qxt="_statusApproval_1s6rs_172",Hxt="_statusRunning_1s6rs_181",Uxt="_statusIdle_1s6rs_190",Wxt="_workspaceBadge_1s6rs_202",Vxt="_workspaceBadgeOther_1s6rs_218",Gxt="_empty_1s6rs_223",Kxt="_colorRed_1s6rs_231",Yxt="_colorOrange_1s6rs_234",Xxt="_colorYellow_1s6rs_237",Qxt="_colorGreen_1s6rs_240",Jxt="_colorBlue_1s6rs_243",Zxt="_colorPurple_1s6rs_246",Kr={panel:Sxt,toolbar:Cxt,count:Txt,selectAll:Ext,actionButton:Axt,refreshButton:jxt,notice:Nxt,grid:Ixt,card:Mxt,cardCurrent:Rxt,cardTop:Dxt,cardCheckbox:Lxt,colorDot:Pxt,cardLabel:Oxt,currentBadge:$xt,cardMeta:Bxt,metaItem:zxt,statusBadge:Fxt,statusApproval:qxt,statusRunning:Hxt,statusIdle:Uxt,workspaceBadge:Wxt,workspaceBadgeOther:Vxt,empty:Gxt,colorRed:Kxt,colorOrange:Yxt,colorYellow:Xxt,colorGreen:Qxt,colorBlue:Jxt,colorPurple:Zxt},ekt=3e3,tkt=1e4,XK={needsApproval:0,running:1,idle:2};function nkt(e,t,n,r){const s=new Map(t.map(o=>[o.sessionId,o])),i=e.map(o=>{var d,f;const l=s.get(o.sessionId),c=o.hasActivePrompt??(l==null?void 0:l.hasActivePrompt)??!1,u=((l==null?void 0:l.pendingPermissionCount)??0)>0;return{sessionId:o.sessionId,label:((d=o.displayName)==null?void 0:d.trim())||o.sessionId.slice(0,8),status:u?"needsApproval":c?"running":"idle",clientCount:o.clientCount??(l==null?void 0:l.clientCount)??0,model:(f=l==null?void 0:l.currentModelId)!=null&&f.startsWith("qwen-route:")?void 0:l!=null&&l.currentModelId?lp(l.currentModelId):void 0,updatedAt:o.updatedAt||o.createdAt,color:o.color,isCurrent:o.sessionId===n,workspaceCwd:o.workspaceCwd,isNonPrimary:pxt(o.workspaceCwd,r)}});return i.sort((o,l)=>{const c=XK[o.status]-XK[l.status];return c!==0?c:(l.updatedAt??"").localeCompare(o.updatedAt??"")}),i}function _C(...e){return e.filter(Boolean).join(" ")}function rkt(e){switch(e){case"red":return Kr.colorRed;case"orange":return Kr.colorOrange;case"yellow":return Kr.colorYellow;case"green":return Kr.colorGreen;case"blue":return Kr.colorBlue;case"purple":return Kr.colorPurple;default:return}}function QK(e){switch(e){case"needsApproval":return Kr.statusApproval;case"running":return Kr.statusRunning;default:return Kr.statusIdle}}function skt({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:r}){var I,Y,U;const{t:s}=rt(),i=qa(),o=i.sessionId,l=((Y=(I=i.capabilities)==null?void 0:I.features)==null?void 0:Y.includes(Z9))??!1,{sessions:c,loading:u,error:d,reload:f}=G_(r,{autoLoad:!0,pageSize:nh,archiveState:"active",...l?{view:"organized",group:"all"}:{}}),{sessions:m,reload:p}=afe(n&&!r),g=h.useMemo(()=>ofe(c,m),[c,m]),b=!r&&n&&cO(i.capabilities),w=FN({autoLoad:!0,detail:"full"}),y=w.reload,v=w.report,[x,k]=h.useState(()=>new Set),[S,T]=h.useState(!1),_=h.useRef(!1);h.useEffect(()=>{const P=window.setInterval(()=>{document.hidden||_.current||(_.current=!0,Promise.all([f(),p()]).finally(()=>{_.current=!1}))},ekt);return()=>window.clearInterval(P)},[f,p]);const C=h.useRef(!1);h.useEffect(()=>{const P=window.setInterval(()=>{document.hidden||C.current||(C.current=!0,y().finally(()=>{C.current=!1}))},tkt);return()=>window.clearInterval(P)},[y]);const j=(U=i.capabilities)==null?void 0:U.workspaceCwd,E=h.useMemo(()=>{var P;return nkt(g,((P=v==null?void 0:v.full)==null?void 0:P.sessions)??[],o,j)},[g,v,o,j]),L=h.useCallback(P=>{k(F=>{const te=new Set(F);return te.has(P)?te.delete(P):te.add(P),te})},[]),D=E.map(P=>P.sessionId).filter(P=>x.has(P)),M=D.length,R=E.length>0&&M===E.length,$=D.slice(0,Cp),B=M>Cp,N=h.useCallback(()=>{k(P=>{const F=E.map(W=>W.sessionId);return F.length>0&&F.every(W=>P.has(W))?new Set:new Set(F)})},[E]);h.useEffect(()=>{k(P=>{if(P.size===0)return P;const F=new Set(E.map(K=>K.sessionId));let te=!1;const W=new Set;for(const K of P)F.has(K)?W.add(K):te=!0;return te?W:P})},[E]);const z=h.useCallback(()=>{if($.length===0)return;const P=uxt($,window.location.href,cfe()),F=window.open(P,"_blank");F&&(F.opener=null,F.focus()),T(!F)},[$]),G=h.useCallback(()=>{f(),p(),y()},[f,p,y]);return E.length===0?a.jsx("div",{className:Kr.panel,children:a.jsx("div",{className:Kr.empty,children:u?s("sessionsOverview.loading"):d?`${s("sessionsOverview.loadFailed")}: ${d.message}`:s("sessionsOverview.empty")})}):a.jsxs("div",{className:Kr.panel,children:[a.jsxs("div",{className:Kr.toolbar,children:[a.jsx("span",{className:Kr.count,children:s("sessionsOverview.count",{count:E.length})}),a.jsxs("label",{className:Kr.selectAll,children:[a.jsx("input",{type:"checkbox",checked:R,onChange:N}),s("sessionsOverview.selectAll")]}),a.jsx("button",{type:"button",className:Kr.actionButton,disabled:M===0,onClick:z,title:s("sessionsOverview.openInTabHint"),children:s("sessionsOverview.openInTab")}),t&&a.jsx("button",{type:"button",className:Kr.actionButton,disabled:M===0,onClick:()=>t($),title:s("sessionsOverview.openInSplitHint"),children:s("sessionsOverview.openInSplit")}),a.jsx("button",{type:"button",className:Kr.refreshButton,onClick:G,children:s("sessionsOverview.refresh")})]}),B&&a.jsx("div",{className:Kr.notice,role:"status",children:s("sessionsOverview.splitCap",{max:Cp})}),S&&a.jsx("div",{className:Kr.notice,role:"alert",children:s("sessionsOverview.popupBlocked")}),d&&a.jsxs("div",{className:Kr.notice,role:"alert",children:[s("sessionsOverview.loadFailed"),": ",d.message]}),a.jsx("ul",{className:Kr.grid,children:E.map(P=>{var F;return a.jsxs("li",{className:_C(Kr.card,QK(P.status),P.isCurrent&&Kr.cardCurrent),children:[a.jsxs("div",{className:Kr.cardTop,children:[a.jsx("input",{type:"checkbox",className:Kr.cardCheckbox,checked:x.has(P.sessionId),onChange:()=>L(P.sessionId),"aria-label":s("sessionsOverview.selectSession",{name:P.label})}),P.color&&a.jsx("span",{className:_C(Kr.colorDot,rkt(P.color)),"aria-hidden":"true"}),a.jsx("button",{type:"button",className:Kr.cardLabel,onClick:()=>e(P.sessionId),title:P.label,children:P.label}),P.isCurrent&&a.jsx("span",{className:Kr.currentBadge,children:s("sessionsOverview.current")})]}),a.jsxs("div",{className:Kr.cardMeta,children:[a.jsx("span",{className:_C(Kr.statusBadge,QK(P.status)),children:s(`sessionsOverview.status.${P.status}`)}),b&&a.jsx("span",{className:_C(Kr.workspaceBadge,P.isNonPrimary&&Kr.workspaceBadgeOther),title:P.workspaceCwd,children:Q6(P.workspaceCwd,(F=i.capabilities)==null?void 0:F.workspaces)}),P.model&&a.jsx("span",{className:Kr.metaItem,title:P.model,children:P.model}),P.clientCount>0&&a.jsx("span",{className:Kr.metaItem,title:s("sessionsOverview.openElsewhere"),children:s("common.clients",{count:P.clientCount})}),P.updatedAt&&a.jsx("span",{className:Kr.metaItem,children:Uy(P.updatedAt,s)})]})]},P.sessionId)})})]})}function ikt({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n=!0,workspaceCwd:r}){const{t:s}=rt();return a.jsx(Uf,{label:"session-overview",fallback:i=>a.jsx("div",{className:Kr.panel,children:a.jsxs("div",{className:Kr.empty,children:[s("sessionsOverview.loadFailed"),": ",i.message]})}),children:a.jsx(skt,{onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:r})})}function ufe(){const e=av(),t=h.useCallback(r=>{let s=null;const i=e.subscribe(()=>{s===null&&(s=window.requestAnimationFrame(()=>{s=null,r()}))});return()=>{i(),s!==null&&window.cancelAnimationFrame(s)}},[e]),n=h.useCallback(()=>e.getSnapshot().blocks,[e]);return h.useSyncExternalStore(t,n,n)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function okt(e){const t=new Map;for(const n of e){if(n.kind!=="assistant")continue;const r=Yo(n.meta);if((r==null?void 0:r.source)!=="background_notification"||r.qwenDiscreteMessage!==!0)continue;const s=Yo(r.backgroundTask),i=sl(s,"toolUseId"),o=sl(s,"status");(s==null?void 0:s.kind)!=="agent"||!i||!o||t.set(i,{status:o,endTime:n.serverTimestamp??n.clientReceivedAt})}return t}function akt(e,t){if(t)switch(t.status){case"completed":e.status="completed",e.endTime=t.endTime;break;case"failed":e.status="failed",e.endTime=t.endTime;break;case"cancelled":case"canceled":e.status="completed",e.endTime=t.endTime,e.rawOutput={...Yo(e.rawOutput)??{},status:"cancelled"};break}}function lkt(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("session_cwd_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function ckt(e,t){return e.errorKind==="model_stream_interrupted"||e.source==="turn_error"&&e.text.trim().toLowerCase()==="terminated"?(t==null?void 0:t.modelStreamInterrupted)??e.text:e.text}function ukt(e,t){return e===void 0?{}:t?{data:{...Yo(e)??{value:e},errorKind:t}}:{data:e}}function dkt(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.newSessionId=="string"?t.newSessionId.slice(0,8):null}function hkt(e){if(!e||typeof e!="object")return null;const t=e.messages;return Array.isArray(t)&&t.filter(r=>typeof r=="string").join(`
`).trim()||null}function JK(e){var n;return((n=e.meta)==null?void 0:n.source)==="background_notification"}function ZK(e){var n;return Yo((n=e.meta)==null?void 0:n.backgroundTask)??void 0}function eY(e){return e.text.length===0}function fkt(e){const t=e.flatMap((n,r)=>{const s=Yo(n),i=sl(s,"content");return i?[{id:sl(s,"id")??`plan-${r}`,content:i,status:wkt(sl(s,"status")),...(()=>{const l=xkt(sl(s,"priority"));return l?{priority:l}:{}})()}]:[]});return t.length>0?t:void 0}function tY(e,t){if(!e)return t;if(!t)return e;const n=(e.cachedTokens??0)+(t.cachedTokens??0);return{inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,...n>0?{cachedTokens:n}:{}}}function mkt(e,t={}){var d,f,m;const n=[],r=((d=t.labels)==null?void 0:d.promptCancelled)??"Request cancelled.",s=new Map,i=new Map,o=okt(e);let l=null,c=null,u=!1;for(let p=0;p<e.length;p++){const g=e[p],b=g.serverTimestamp??g.clientReceivedAt;switch(g.kind){case"user":{const w=g;if(JK(w)){l=null,c=null,u=!0,n.push({id:g.id,role:"system",content:w.text,variant:"info",source:"background_notification",data:ZK(w),timestamp:b});break}l=null,c=null,u=!1;const y=Yo(w.meta),v=sl(y,"source"),x=Array.isArray(y==null?void 0:y.inputAnnotations)?y.inputAnnotations:void 0,k={id:g.id,role:"user",content:w.text,timestamp:b,...v?{source:v}:{},...x?{inputAnnotations:x}:{}};w.images&&w.images.length>0&&(k.images=w.images.map(S=>({data:S.data,mimeType:S.mimeType||"image/*"}))),n.push(k);break}case"assistant":{const w=g;if(JK(w)){l=null,c=null,u=!0,n.push({id:g.id,role:"system",content:w.text,variant:"info",source:"background_notification",data:ZK(w),timestamp:b});break}if(!w.text&&!w.usage)break;const y=w.parentToolCallId?s.get(w.parentToolCallId):void 0;if(y){nY(y,w.text);break}const v=Dkt(w.text);if(v){let k=null,S=!1,T=0,_=0;for(const C of v)C.kind==="insight"?C.data.type==="insight_progress"?k=C.data:C.data.type==="insight_ready"?(S=!0,n.push({id:`${g.id}-ir-${T++}`,role:"insight_ready",path:C.data.path,timestamp:b})):C.data.type==="insight_error"&&(S=!0,n.push({id:`${g.id}-ie-${_++}`,role:"insight_error",error:C.data.error,timestamp:b})):(n.push({id:`${g.id}-t-${n.length}`,role:"assistant",content:C.text,timestamp:b}),l=n.length-1,c=null);k&&!S&&n.push({id:`${g.id}-ip`,role:"insight_progress",stage:k.stage,progress:k.progress,detail:k.detail,timestamp:b}),u=!0;break}const x=l!==null?n[l]:void 0;if(x&&x.role==="assistant"&&!u&&!eY(w)){const k=tY(x.usage,w.usage);n[l]={...x,content:x.content+w.text,isStreaming:w.streaming,...k?{usage:k}:{}},u=!1,c=null}else if(!eY(w))n.push({id:g.id,role:"assistant",content:w.text,isStreaming:w.streaming,timestamp:b,...w.usage?{usage:w.usage}:{}}),l=n.length-1,c=null,u=!1;else if(w.usage&&x&&x.role==="assistant"){const k=tY(x.usage,w.usage);n[l]={...x,...k?{usage:k}:{}}}break}case"thought":{const w=g,y=w.parentToolCallId?s.get(w.parentToolCallId):void 0;if(y){nY(y,w.text);break}const v=c!==null?n[c]:void 0;v&&v.role==="thinking"&&!u?(n[c]={...v,content:v.content+w.text,isStreaming:w.streaming},u=!1):(n.push({id:g.id,role:"thinking",content:w.text,isStreaming:w.streaming,timestamp:b}),c=n.length-1,u=!1),l=null;break}case"tool":{const y=kkt(g);akt(y,o.get(y.callId));const v=i.get(y.callId);v!=null&&v.title&&(y.title=v.title),!y.args&&(v!=null&&v.args)&&(y.args=v.args);const x=y.parentToolCallId?s.get(y.parentToolCallId):void 0,k=s.get(y.callId);if(k){rY(k,y);break}if(x){pkt(x,y),s.set(y.callId,y);break}i7(n,g.id,y,b),s.set(y.callId,y),l=null,c=null,u=!0;break}case"shell":{const w=g,y=n[n.length-1];if(y&&y.role==="tool_group"){const v=gkt(y.tools),x=y.tools[v];if(x){const k=typeof x.rawOutput=="string"?x.rawOutput:"",S={...x,rawOutput:k+w.text};n[n.length-1]={...y,tools:[...y.tools.slice(0,v),S,...y.tools.slice(v+1)]},s.get(x.callId)===x&&s.set(x.callId,S)}}else n.push({id:g.id,role:"tool_group",tools:[{callId:g.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:w.text}],timestamp:b}),u=!0;break}case"user_shell":{const w=g;n.push({id:g.id,role:"user_shell",command:w.command,output:w.text,...w.cwd?{cwd:w.cwd}:{},timestamp:b}),u=!0;break}case"permission":{const w=g;Skt(w,i);const y=_kt(w);if(!y)break;const v=dfe(y);if(!w.resolved)break;const x=s.get(y.callId);if(x){const k=x.status,S=x.endTime;y.toolName=x.toolName,w.resolved&&(o7(w.resolved)?y.status=v?y.status:"in_progress":(y.status="failed",y.endTime=w.updatedAt)),rY(x,y),(bkt(k)||w.resolved&&v&&o7(w.resolved))&&(x.status=k,x.endTime=S);break}if(w.resolved){o7(w.resolved)?(v||(y.status="in_progress"),i7(n,g.id,y,b),s.set(y.callId,y),u=!0):(y.status="failed",y.endTime=w.updatedAt,i7(n,g.id,y,b),s.set(y.callId,y),u=!0);break}break}case"status":case"debug":{const w=g,y=w.source==="session_branched"?dkt(w.data):null,v=w.source==="mid_turn_message_injected"?hkt(w.data):null,x=y&&((f=t.labels)!=null&&f.branchSuccess)?t.labels.branchSuccess(y):v&&((m=t.labels)!=null&&m.midTurnInserted)?t.labels.midTurnInserted(v):w.text;if(lkt(x))break;const k=vkt(x);if(k){n.push({id:g.id,role:"plan",todos:k,timestamp:b}),u=!0;break}n.push({id:g.id,role:"system",content:x,variant:"info",timestamp:b,...w.source?{source:w.source}:{},...w.data!==void 0?{data:w.data}:{}}),u=!0;break}case"error":{const w=g,y=w.errorKind;n.push({id:g.id,role:"system",content:ckt(w,t.labels),variant:"error",retryable:w.source==="turn_error",timestamp:b,...w.source?{source:w.source}:{},...ukt(w.data,y)}),u=!0;break}case"prompt_cancelled":n.push({id:g.id,role:"system",content:r,variant:"info",source:"prompt_cancelled",timestamp:b}),u=!0;break}}return n}function pkt(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function nY(e,t){e.subContent=(e.subContent||"")+t}function i7(e,t,n,r){const s=o=>dfe(o)||dm(o.toolName),i=e[e.length-1];if(i&&i.role==="tool_group"&&i.id.startsWith("tg-")&&!s(n)&&!i.tools.some(s)){i.tools.push(n);return}e.push({id:`tg-${t}`,role:"tool_group",tools:[n],timestamp:r})}function gkt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="execute"&&n.status==="in_progress")return t}for(let t=e.length-1;t>=0;t--)if(e[t].kind==="execute")return t;return e.length-1}function rY(e,t){e.status=t.status??e.status,e.title=t.title??e.title,e.toolName=t.toolName??e.toolName,e.kind=t.kind??e.kind,e.content=t.content??e.content,e.endTime=t.endTime??e.endTime,e.rawOutput=t.rawOutput??e.rawOutput,e.args=t.args??e.args,e.locations=t.locations??e.locations}function bkt(e){return e==="completed"||e==="failed"}function dfe(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||ykt(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function ykt(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function vkt(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),r=Yo(n);return(r==null?void 0:r.sessionUpdate)!=="plan"||!Array.isArray(r.entries)?void 0:fkt(r.entries)}catch{return}}function Yo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function sl(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function wkt(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function xkt(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function kkt(e){const t=Tkt(e),n=Ckt(e,t),r=Ekt(e.content),s={running:"in_progress",pending:"pending",confirming:"pending",background:"pending",completed:"completed",failed:"failed",cancelled:"completed",canceled:"completed",in_progress:"in_progress"},i=e.status==="completed"||e.status==="failed"||e.status==="cancelled"||e.status==="canceled";return{callId:e.toolCallId,toolName:e.toolName||"unknown",title:e.title,status:(n?"pending":s[e.status])||e.status||"in_progress",kind:ffe(e.toolName,e.toolKind),rawOutput:t,args:e.rawInput,parentToolCallId:e.parentToolCallId,startTime:e.createdAt,endTime:i&&!n?e.updatedAt:void 0,...r?{content:r}:{}}}function _kt(e){const t=Yo(e.toolCall);if(!t)return;const n=hfe(t);if(Array.isArray(n==null?void 0:n.questions))return;const r=Yo(t._meta),s=sl(t,"kind"),i=sl(r,"toolName")??sl(t,"toolName")??sl(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(s==="fetch"?"web_fetch":s),o=sl(t,"toolCallId")??sl(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:sl(t,"title")??e.title,status:"pending",kind:ffe(i,s),args:n,startTime:e.createdAt}}function Skt(e,t){const n=Yo(e.toolCall),r=sl(n,"toolCallId")??sl(n,"id");if(!r)return;const s=sl(n,"title")??e.title,i=n?hfe(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(r,{...s?{title:s}:{},...i?{args:i}:{}})}function o7(e){const[t="",n=""]=e.toLowerCase().split(":",2);return sY(t)?!0:t!=="selected"?!1:sY(n.trim())}function sY(e){return e==="allow"||e==="allowed"||e==="approve"||e==="approved"||e==="accept"||e==="accepted"||e==="confirm"||e==="confirmed"||e==="proceed"||e==="proceed_once"||e==="proceed_once_and_switch_to_default"||e==="proceed_always_project"||e==="proceed_always_user"||e==="allow_once"||e==="allow_always"||e==="success"||e==="succeeded"}function hfe(e){return Yo(e.rawInput)??Yo(e.input)??Yo(e.args)}function Ckt(e,t){var s;const n=(s=e.toolName)==null?void 0:s.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const r=Yo(t);return(r==null?void 0:r.status)==="background"}function Tkt(e){return Akt(e)&&e.status==="failed"?jkt(e)??e.details??e.rawOutput:!Nkt(e.status)||!e.details?e.rawOutput??e.details:e.rawOutput&&typeof e.rawOutput=="object"&&!Array.isArray(e.rawOutput)?{...e.rawOutput,status:e.status,reason:e.details}:{status:e.status,reason:e.details,text:typeof e.rawOutput=="string"&&e.rawOutput?e.rawOutput:e.details}}function Ekt(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const r=Yo(n);if(!r)return[];const s=r.type;if(s==="content"){const i=Yo(r.content);return!i||typeof i.type!="string"?[]:[{type:"content",content:{...i,type:i.type}}]}if(s==="diff"){const i=r.newText;if(typeof i!="string")return[];const o=r.path,l=r.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof l=="string"?{oldText:l}:{},newText:i}]}if(s==="terminal"){const i=r.terminalId;return[{type:"terminal",...typeof i=="string"?{terminalId:i}:{}}]}return[]});return t.length>0?t:void 0}function Akt(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function jkt(e){if(!Array.isArray(e.content))return;const t=e.content.map(n=>{var r;return(r=n==null?void 0:n.content)==null?void 0:r.text}).filter(n=>!!n);if(!(!t||t.length===0))return t.join(`
`)}function Nkt(e){return e==="cancelled"||e==="canceled"}const Ikt=['"insight_progress":','"insight_ready":','"insight_error":'];function Mkt(e){try{const t=JSON.parse(e),n=Yo(t.insight_progress);if(n&&typeof n.stage=="string"&&typeof n.progress=="number")return{type:"insight_progress",stage:n.stage,progress:n.progress,detail:typeof n.detail=="string"?n.detail:void 0};const r=Yo(t.insight_ready);if(r&&typeof r.path=="string")return{type:"insight_ready",path:r.path};const s=Yo(t.insight_error);if(s&&typeof s.error=="string")return{type:"insight_error",error:s.error}}catch{}return null}function Rkt(e,t){if(e[t]!=="{")return null;let n=0,r=!1,s=!1;for(let i=t;i<e.length;i++){const o=e[i];if(s){s=!1;continue}if(o==="\\"&&r){s=!0;continue}if(o==='"'){r=!r;continue}if(!r){if(o==="{")n++;else if(o==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function Dkt(e){const t=[];let n=0,r=0,s=!1;for(;r<e.length;){const o=e.indexOf("{",r);if(o===-1)break;const l=e.slice(o+1).trimStart();if(!Ikt.some(m=>l.startsWith(m))){r=o+1;continue}const u=Rkt(e,o);if(!u){r=o+1;continue}const d=Mkt(u);if(!d){r=o+1;continue}s=!0;const f=e.slice(n,o).trim();f&&t.push({kind:"text",text:f}),t.push({kind:"insight",data:d}),n=o+u.length,r=n}if(!s)return null;const i=e.slice(n).trim();return i&&t.push({kind:"text",text:i}),t.length>0?t:null}function ffe(e,t){if(t)return t;if(!e)return;const n=e.toLowerCase();if(n==="bash"||n==="execute")return"execute";if(n==="read")return"read";if(n==="edit"||n==="write")return"edit";if(n.includes("search")||n==="grep"||n==="glob")return"search";if(n==="agent"||n==="task")return"other"}function Lkt(e,t){return mkt(e,{labels:{promptCancelled:t("request.cancelled"),branchSuccess:n=>t("branch.success",{name:n}),midTurnInserted:n=>t("midTurn.inserted",{message:n}),modelStreamInterrupted:t("error.modelStreamInterrupted")}})}function mfe(e){return e==="pending"||e==="in_progress"||e==="running"}function uO(e){return e==="completed"||e==="failed"||e==="cancelled"||e==="canceled"}function iY(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function Pkt(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.kind!=="assistant")continue;const r=iY(n.meta),s=iY(r==null?void 0:r.backgroundTask),i=s==null?void 0:s.status;if((r==null?void 0:r.source)==="background_notification"&&(s==null?void 0:s.kind)==="agent"&&typeof i=="string"&&uO(i))return`${n.id}:${i}`}return""}function Okt(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools)mfe(r.status)&&bd(r)&&t.push(r.callId);return t.join("|")}function $kt(e,t){if(t.size===0)return e;let n=!1;const r=e.map(s=>{if(s.role!=="tool_group")return s;let i=!1;const o=s.tools.map(l=>{const c=t.get(l.callId);if(!c||!uO(c.status)||!mfe(l.status)||!bd(l))return l;i=!0;const u=c.status==="cancelled"||c.status==="canceled",d=c.status==="failed"?"failed":"completed";return{...l,status:d,...l.startTime!==void 0?{endTime:l.startTime+(c.durationMs??0)}:{},...u?{rawOutput:{...typeof l.rawOutput=="object"&&l.rawOutput!==null&&!Array.isArray(l.rawOutput)?l.rawOutput:{},status:"cancelled"}}:{}}});return i?(n=!0,{...s,tools:o}):s});return n?r:e}function dO(e,t){const n=yo(),r=qa(),s=h.useMemo(()=>Lkt(t,e),[t,e]),i=h.useMemo(()=>Okt(s),[s]),o=h.useMemo(()=>Pkt(t),[t]),[l,c]=h.useState(),u=h.useRef(void 0);return h.useEffect(()=>{const d=r.sessionId;if(!d||r.status!=="connected"||r.loadingTranscript||r.catchingUp||!i){(!d||r.status!=="connected"||r.loadingTranscript||r.catchingUp)&&(u.current=void 0);return}const f=`${d}:${i}:${o}`,m=u.current,p=i.split("|"),g=(m==null?void 0:m.key)===f?m.request:Promise.allSettled(p.map(async w=>{const y=await n.client.resolveSubagentSession(d,w);return[w,y]})).then(w=>{const y=new Map;return w.forEach(v=>{v.status==="fulfilled"&&uO(v.value[1].status)&&y.set(...v.value)}),y});u.current={key:f,request:g};let b=!0;return g.then(w=>{b&&c(y=>({sessionId:d,resolutions:new Map([...(y==null?void 0:y.sessionId)===d?y.resolutions:[],...w])}))}).catch(()=>{var w;((w=u.current)==null?void 0:w.request)===g&&(u.current=void 0)}),()=>{b=!1}},[o,r.catchingUp,r.loadingTranscript,r.sessionId,r.status,i,n.client]),h.useMemo(()=>!l||l.sessionId!==r.sessionId?s:$kt(s,l.resolutions),[r.sessionId,s,l])}function pfe(e){const t=Y9();return dO(e,t)}const Bkt="session_artifacts";function hO(){var S,T;const e=nm(),t=qa(),n=aee(),r=Nh(),s=r==null?void 0:r.artifactsVersion,i=t.status==="connected",o=((T=(S=t.capabilities)==null?void 0:S.features)==null?void 0:T.includes(Bkt))??!1,l=t.sessionId,[c,u]=h.useState([]),[d,f]=h.useState(!1),[m,p]=h.useState(null),g=h.useRef(0),b=h.useRef(void 0),w=h.useRef(n),y=h.useRef(s),v=h.useCallback(async()=>{const _=g.current+1;if(g.current=_,!l){b.current=void 0,u([]),p(null),f(!1);return}if(!i){b.current=void 0,u([]),p(null),f(!1);return}if(!o){b.current=void 0,u([]),p(null),f(!1);return}b.current!==void 0&&b.current!==l&&u([]),f(!0);try{const C=await e.loadArtifacts();if(g.current!==_)return;b.current=l,u(C.artifacts),p(null)}catch{if(g.current!==_)return;p(null)}finally{g.current===_&&f(!1)}},[e,i,l,o]),x=h.useRef(v);x.current=v,h.useEffect(()=>{v()},[v]),h.useEffect(()=>{const _=w.current;w.current=n,_!=="idle"&&n==="idle"&&x.current()},[n]),h.useEffect(()=>{const _=y.current;y.current=s,_!==void 0&&s!==void 0&&s!==_&&x.current()},[s]);const k=h.useMemo(()=>new Map(c.map(_=>[_.id,_])),[c]);return{artifacts:c,artifactById:k,loading:d,error:m,refresh:v}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function zkt(e,t,n,r){const s=[...e];let i=!1;for(const o of t)if(o.sessionId===n&&!(o.originatorClientId!==void 0&&o.originatorClientId!==r))for(const l of o.messages){const c=s.findIndex(u=>u.text===l&&(!u.images||u.images.length===0));c>=0&&(s.splice(c,1),i=!0)}return i?s:null}function Fkt(e,t,n,r){return e?!0:(r.append(t),!1)}function gfe(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const qkt=100;function Hkt(e,t){return e.trim()?e===t||e.startsWith(`${t}
`)?e:`${t}
${e}`:t}function oY(e,t){return e.length!==t.length?!1:e.every((n,r)=>{var i,o,l,c;const s=t[r];return s!==void 0&&n.id===s.id&&n.sessionId===s.sessionId&&n.text===s.text&&n.serverPromptId===s.serverPromptId&&n.serverState===s.serverState&&n.isEditing===s.isEditing&&n.isRemoving===s.isRemoving&&(((i=n.images)==null?void 0:i.length)??0)===(((o=s.images)==null?void 0:o.length)??0)&&(((l=n.inputAnnotations)==null?void 0:l.length)??0)===(((c=s.inputAnnotations)==null?void 0:c.length)??0)})}function aY(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function bfe({connected:e,sessionId:t,clientId:n,streamingState:r,sessionActions:s,store:i,editorRef:o,reportError:l,notifySuccess:c,t:u}){const[d,f]=h.useState([]),m=h.useRef([]),p=h.useRef(1),g=h.useRef(t),b=h.useRef(null),w=h.useRef(new Set),y=h.useRef(new Set),v=h.useRef(new Set),x=h.useRef(new Map),k=h.useRef(new Set),S=h.useRef([]),T=h.useRef(r),_=h.useRef(0);g.current=t,T.current=r;const C=h.useMemo(()=>d.map(ie=>ie.text),[d]);h.useEffect(()=>{m.current=d},[d]),h.useEffect(()=>{var ie;m.current=[],f([]),x.current.clear(),k.current.clear(),S.current=[];for(const Z of w.current)Z.abort();w.current.clear(),y.current.clear(),v.current.clear(),$.current=void 0,(ie=b.current)==null||ie.abort(),b.current=null},[t]);const j=h.useCallback((ie,Z)=>{const ee=m.current.filter(oe=>oe.serverPromptId?ie.some(we=>we.promptId===oe.serverPromptId):!0);for(const oe of ie){if(y.current.has(oe.promptId))continue;const we=ee.findIndex(X=>X.serverPromptId===oe.promptId),pe=v.current.has(oe.promptId);if(we!==-1){if(pe){ee.splice(we,1);continue}ee[we]={...ee[we],text:oe.text,serverState:oe.state};continue}const he=ee.filter(X=>!X.serverPromptId&&X.serverState==="submitting"&&X.text===oe.text);if(he.length===1){const X=ee.indexOf(he[0]);if(pe){ee.splice(X,1);continue}ee[X]={...he[0],serverPromptId:oe.promptId,serverState:oe.state};continue}oe.state==="running"||pe||ee.push({id:p.current++,sessionId:Z,text:oe.text,serverPromptId:oe.promptId,serverState:oe.state})}oY(m.current,ee)||(m.current=ee,f(ee))},[]),E=h.useCallback(async(ie=t)=>{if(!e||!ie||g.current!==ie)return"skipped";const Z=++_.current;try{const ee=await s.getPendingPrompts({sessionId:ie});return Z!==_.current?"superseded":g.current!==ie?"skipped":(j(ee.pendingPrompts.filter(oe=>oe.state==="queued"||oe.state==="running"),ie),"refreshed")}catch(ee){return console.warn("Failed to refresh pending prompts",ee),"failed"}},[e,s,t,j]),L=h.useCallback(ie=>{const Z=g.current,ee=ie.filter(he=>he.sessionId===void 0||he.sessionId===Z);if(ee.length===0)return;const oe=new Set(m.current.map(he=>he.id)),we=ee.filter(he=>!oe.has(he.id));if(we.length===0)return;const pe=[...m.current,...we].sort((he,X)=>he.id-X.id);m.current=pe,f(pe)},[]),D=h.useCallback((ie,Z,ee)=>{var pe,he,X,ye;if(ee!==void 0&&g.current!==ee)return;const oe=((pe=o.current)==null?void 0:pe.getText())??"",we=Hkt(oe,ie);we!==oe&&((he=o.current)==null||he.setText(we),Z&&Z.length>0&&((X=o.current)==null||X.restoreImages(Z))),(ye=o.current)==null||ye.focus()},[o]),M=h.useSyncExternalStore(ewe,Zve),R=h.useRef(M),$=h.useRef(void 0);h.useEffect(()=>{if(!e||!t)return;const ie=R.current!==M;if(R.current=M,!ie){if(m.current.length>0||r==="idle"||$.current===t)return;$.current=t}E()},[M,e,t,r,E]);const B=h.useSyncExternalStore(twe,PF,PF);h.useEffect(()=>{var Z;if(!t||B.length===0)return;const ie=[];for(const ee of B){if(ee.data.sessionId!==t)continue;ie.push(ee);const oe=ee.data.promptId;if(oe){if(ee.type==="pending_prompt_started"){if(y.current.has(oe))continue;if((ee.originatorClientId===void 0||ee.originatorClientId===n)&&!v.current.has(oe)){const pe=typeof ee.data.text=="string"?ee.data.text:"",he=m.current.find(ye=>ye.serverPromptId===oe)??m.current.find(ye=>!ye.serverPromptId&&ye.serverState==="submitting"&&ye.text===pe),X=(he==null?void 0:he.text)??"";X&&(v.current.add(oe),i.appendLocalUserMessage(X,aY(he==null?void 0:he.images),(Z=he==null?void 0:he.inputAnnotations)!=null&&Z.length?{inputAnnotations:he.inputAnnotations}:void 0))}E()}else if(ee.type==="turn_complete"){v.current.delete(oe);const we=x.current.get(oe);if(x.current.delete(oe),we)we();else if(!k.current.has(oe))for(k.current.add(oe),S.current.push(oe);S.current.length>qkt;){const pe=S.current.shift();pe&&k.current.delete(pe)}}else if(ee.type==="turn_error"||ee.type==="pending_prompt_completed"&&ee.data.state==="removed"){v.current.delete(oe);const we=x.current.get(oe);x.current.delete(oe),we==null||we(),k.current.delete(oe),S.current=S.current.filter(pe=>pe!==oe)}}}rwe(ie)},[B,t,n,i,E]);const N=h.useCallback((ie,Z)=>{if(k.current.delete(ie)){S.current=S.current.filter(ee=>ee!==ie),Z();return}x.current.set(ie,Z)},[]),z=h.useCallback((ie,Z,ee,oe)=>{const we=ie.trim();if(!we)return!0;const pe=p.current++,he=g.current,X=new AbortController;w.current.add(X);const ye=Z?[...Z]:void 0,Ce=oe?[...oe]:void 0,ae={id:pe,sessionId:he,text:we,images:ye,inputAnnotations:Ce,onComplete:ee,serverState:"submitting"};return m.current=[...m.current,ae],f(m.current),s.submitPrompt(we,{images:Z,inputAnnotations:Ce,optimisticUserMessage:!1,sessionId:he,signal:X.signal}).then(me=>{if(w.current.delete(X),g.current!==he){s.removePendingPrompt(me.promptId,{sessionId:he}).catch($t=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:he,promptId:me.promptId,error:$t})});return}if(T.current==="idle"){v.current.has(me.promptId)||(v.current.add(me.promptId),i.appendLocalUserMessage(we,aY(ye),Ce!=null&&Ce.length?{inputAnnotations:Ce}:void 0));const $t=m.current.filter(St=>St.id!==pe);m.current=$t,f($t),ee&&N(me.promptId,ee);return}const We=m.current,Oe=We.findIndex($t=>$t.id===pe);if(Oe===-1){s.removePendingPrompt(me.promptId,{sessionId:he}).then($t=>{$t.removed||E(he)},()=>{E(he)});return}const Mt=[...We];Mt[Oe]={...Mt[Oe],serverPromptId:me.promptId,serverState:"queued"},m.current=Mt,f(Mt),ee&&N(me.promptId,ee)}).catch(me=>{if(w.current.delete(X),g.current!==he||!m.current.some(Oe=>Oe.id===pe))return;const We=m.current.filter(Oe=>Oe.id!==pe);m.current=We,f(We),D(we,ye,he),l(me,u("queue.queueFailed"))}),!0},[E,l,D,s,N,i,u]);h.useEffect(()=>{if(r!=="idle")return;const ie=b.current;ie&&(ie.abort(),b.current=null)},[r]);const G=h.useCallback(ie=>{const Z=m.current;if(Z.length===0)return null;const ee=ie===void 0?Z.length-1:Z.findIndex(pe=>pe.id===ie);if(ee<0)return null;const oe=Z[ee],we=Z.filter((pe,he)=>he!==ee);return m.current=we,f(we),(oe==null?void 0:oe.text)??null},[]),I=h.useCallback((ie,Z)=>{const ee=m.current.map(oe=>oe.id===ie?{...oe,...Z}:oe);oY(ee,m.current)||(m.current=ee,f(ee))},[]),Y=h.useCallback(async(ie,Z,ee)=>{if(!ie.serverPromptId)return!0;if(ie.serverState!=="queued"||y.current.has(ie.serverPromptId))return!1;const oe=ie.sessionId;y.current.add(ie.serverPromptId),I(ie.id,Z);try{const we=await s.removePendingPrompt(ie.serverPromptId,{sessionId:oe});return y.current.delete(ie.serverPromptId),we.removed?(x.current.delete(ie.serverPromptId),await E(oe)==="failed"&&(I(ie.id,{isEditing:!1,isRemoving:!1}),l(new Error("Queue changed but pending prompts could not refresh"),ee)),!0):(I(ie.id,{isEditing:!1,isRemoving:!1}),await E(oe),l(new Error("Prompt could not be removed from queue"),ee),!1)}catch(we){return y.current.delete(ie.serverPromptId),I(ie.id,{isEditing:!1,isRemoving:!1}),await E(oe)!=="refreshed"&&L([ie]),l(we,ee),!1}},[E,l,L,s,I]),U=h.useCallback(ie=>{const Z=m.current.find(ee=>ee.id===ie);if((Z==null?void 0:Z.serverState)!=="submitting"&&Z){if(!Z.serverPromptId){const ee=m.current.filter(oe=>oe.id!==ie);m.current=ee,f(ee);return}Y(Z,{isRemoving:!0},u("queue.deleteFailed"))}},[Y,u]),P=h.useCallback(async ie=>{var he;const Z=m.current.find(X=>X.id===ie);if(!Z||(((he=Z.images)==null?void 0:he.length)??0)>0||Z.serverState==="submitting"||Z.isEditing||Z.isRemoving||gfe(Z.text))return;const ee=Z.serverPromptId?Z.onComplete??x.current.get(Z.serverPromptId):void 0,oe=()=>{Z.serverPromptId&&x.current.delete(Z.serverPromptId),ee==null||ee()};if(Z.serverPromptId&&!await Y(Z,{isRemoving:!0},u("queue.insertFailed")))return;let we=b.current;we||(we=new AbortController,b.current=we);let pe;try{pe=await s.enqueueMidTurnMessage(Z.text,{signal:we.signal})}catch(X){Z.serverPromptId&&(D(Z.text,Z.images,Z.sessionId),oe()),l(X,u("queue.insertFailed"));return}if(!pe.accepted){Z.serverPromptId&&(D(Z.text,Z.images,Z.sessionId),oe()),l(new Error("Queued message was not accepted for insertion"),u("queue.insertFailed"));return}if(oe(),!Z.serverPromptId){const X=m.current.filter(ye=>ye.id!==ie);m.current=X,f(X)}c(u("queue.inserted"))},[Y,c,l,D,s,u]),F=h.useCallback(async ie=>{const Z=m.current.find(oe=>oe.id===ie);if(!Z||Z.serverState==="submitting"||Z.isEditing||Z.isRemoving)return;if(Z.serverPromptId){if(!await Y(Z,{isEditing:!0},u("queue.editFailed")))return;D(Z.text,Z.images,Z.sessionId);return}const ee=G(ie);ee&&D(ee,Z.images,Z.sessionId)},[G,Y,D,u]),te=h.useCallback(()=>{const ie=m.current;if(ie.length===0)return!1;const Z=ie[ie.length-1];if(!Z)return!1;if(Z.serverState==="submitting"||Z.isEditing||Z.isRemoving)return!0;if(!Z.serverPromptId){const ee=G(Z.id);return ee?(D(ee,Z.images,Z.sessionId),!0):!1}return Z.serverState!=="queued"?!1:((async()=>{await Y(Z,{isEditing:!0},u("queue.editFailed"))&&D(Z.text,Z.images,Z.sessionId)})().catch(ee=>{l(ee,u("queue.editFailed"))}),!0)},[G,Y,l,D,u]),W=h.useCallback(()=>{if(m.current.length===0)return!1;const ie=g.current,Z=m.current.filter(X=>X.serverState==="submitting"),ee=m.current.filter(X=>X.serverState!=="submitting");for(const X of[...Z].reverse())D(X.text,X.images,X.sessionId);for(const X of w.current)X.abort();const oe=ee.filter(X=>X.serverPromptId);if(oe.length===0)return m.current=[],f([]),i.dispatch([{type:"status",text:u("queue.cleared")}]),!0;const we=new Set(m.current.map(X=>X.id)),pe=new Set(oe.map(X=>X.serverPromptId).filter(X=>!!X));for(const X of pe)y.current.add(X);const he=m.current.filter(X=>!we.has(X.id)).concat(oe.map(X=>({...X,isRemoving:!0})));return m.current=he,f(he),(async()=>{var ae;const X=[];if(await Promise.all(oe.map(async me=>{const We=me.serverPromptId;try{if((await s.removePendingPrompt(We,{sessionId:me.sessionId})).removed){x.current.delete(We);return}X.push(me)}catch{X.push(me)}finally{y.current.delete(We)}})),g.current!==ie)return;const ye=X.map(me=>({...me,isRemoving:!1})),Ce=m.current.filter(me=>me.serverPromptId?!pe.has(me.serverPromptId):!we.has(me.id)).concat(ye);if(m.current=Ce,f(Ce),X.length>0){l(new Error("Some prompts could not be removed from queue"),u("queue.deleteFailed")),E((ae=X[0])==null?void 0:ae.sessionId);return}i.dispatch([{type:"status",text:u("queue.cleared")}])})(),!0},[E,l,D,i,u,s]),{batches:K,consume:ce}=Lwe();return h.useEffect(()=>{if(!t||K.length===0)return;const ie=zkt(m.current,K,t,n);ie&&(m.current=ie,f(ie)),ce(K.filter(Z=>Z.sessionId===t))},[K,t,n,ce]),{queuedPrompts:d,queuedTexts:C,enqueuePrompt:z,removeQueuedPrompt:U,insertQueuedPrompt:P,editQueuedPrompt:F,editLastQueuedPrompt:te,clearQueuedPrompts:W}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function kR(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Ad(e.toolName):!0}const Ukt=3e4;function O3(e){return ov.includes(e)}async function Wkt({sessionActions:e,modelId:t,modeId:n,workspaceCwd:r,worktree:s,branch:i,onSessionCreated:o,onSessionAllocated:l,getCurrentSessionId:c,warn:u=console.warn}){const d=n&&O3(n)?n:void 0,{sessionId:f,worktree:m,branch:p}=await e.createSession({workspaceCwd:r,sourceType:rh,...d?{approvalMode:d}:{},...s?{worktree:s}:{},...i?{branch:i}:{}});l==null||l(f);let g="prepare new session";try{if(o){g="run onSessionCreated";let y;try{await Promise.race([o(f),new Promise((v,x)=>{y=setTimeout(()=>x(new Error("onSessionCreated timed out")),Ukt)})])}finally{clearTimeout(y)}}g="verify session identity";const b=c();if(b!==void 0&&b!==f)throw new Error(`Session changed before attach: expected ${f}, found ${b}`);g="attach new session",await e.attachSession(),g="verify attached session";const w=c();if(w!==void 0&&w!==f)throw new Error(`Session changed while attaching: expected ${f}, found ${w}`)}catch(b){u(`[WebShell] failed to ${g}:`,b),await e.releaseSession(f).catch(y=>{u("[WebShell] failed to release unattached session:",y)});const w=c();throw w===void 0||w===f?await e.clearSession().catch(y=>{u("[WebShell] failed to clear unattached session:",y)}):u(`[WebShell] skipping clearSession: expected ${f}, found ${w}`),b}return t&&await e.setModel(t).catch(b=>{u("[WebShell] failed to set model for new session:",b)}),{...m?{worktree:m}:{},...p?{branch:p}:{}}}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const Vkt=new Set(["coder-model(qwen-oauth)"]);function yx(e){return!Vkt.has(e.id)}function Gkt({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function yfe({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"loading":t||n?"processing":"idle"}function Kkt(e){switch(yfe(e)){case"loading":return"common.loading";case"processing":return"editor.processing";case"idle":return"editor.placeholder"}}function vfe({connectionStatus:e,hasSession:t,restartSseOnPrompt:n}){return e==="error"?!0:e==="disconnected"&&(!n||!t)}const wfe=/^\/([\w-]+)(?=\s|$)/;function xfe(e,t,n){if(!t)return!1;const r=e.match(wfe);if(!r)return!1;try{return t({command:r[1].toLowerCase(),args:e.slice(r[0].length).trim(),input:e})===!0}catch(s){return n(s,"onSlashCommand callback failed"),!1}}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const _R=["blue","green","purple","orange","yellow","red"];for(const e of _R){if(rO[e])continue;const t=`WorkspaceAccent.module.css is missing a class for the "${e}" accent`;console.error(t)}function Ykt(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function Xkt(e,t){if(!e)return;const r=((t==null?void 0:t.workspaces)??[]).findIndex(i=>i.cwd===e),s=r>=0?r:Ykt(e);return _R[s%_R.length]}function kfe(e,t={}){return[{name:"help",description:e("local.help")},{name:"theme",description:e("local.theme"),argumentHint:"light|dark",subcommands:["light","dark"]},{name:"language",description:e("local.language"),argumentHint:"ui [en|zh-CN]",subcommands:["ui"]},{name:"plan",description:e("local.plan"),argumentHint:"<prompt>"},{name:"btw",description:e("local.btw"),argumentHint:t.sideTaskAvailable?"[side] <your question>":"<your question>"},{name:"copy",description:e("local.copy"),argumentHint:"[code|<lang>|latex|inline-latex] [index]"},{name:"delete",description:e("local.delete")},{name:"release",description:e("local.release")},{name:"auth",description:e("local.auth")},{name:"approval-mode",description:e("local.approvalMode"),argumentHint:"<mode>"},{name:"model",description:e("local.model"),argumentHint:"[--fast|--voice|--vision] [<model>]"},{name:"mcp",description:e("local.mcp"),argumentHint:"desc|nodesc|schema"},{name:"skills",description:e("local.skills")},{name:"status",description:e("local.status")},{name:"stats",description:e("local.stats"),argumentHint:"[model|tools]",subcommands:["model","tools"]},{name:"tools",description:e("local.tools"),argumentHint:"[desc]"},{name:"memory",description:e("local.memory")},{name:"context",description:e("local.context"),argumentHint:"[detail]"},{name:"agents",description:e("local.agents"),argumentHint:"manage|create"},{name:"goal",description:e("local.goal"),argumentHint:"[<condition> | clear]"},{name:"tasks",description:e("local.tasks")},{name:"recap",description:e("local.recap")},{name:"rewind",description:e("local.rewind")},{name:"branch",description:e("local.branch"),argumentHint:"[<name>]"},{name:"diff",description:e("local.diff")},{name:"log",description:e("local.log")},{name:"prs",description:e("local.prs")},{name:"fork",description:e("local.fork"),argumentHint:"<directive>"},{name:"clear",description:e("local.clear")},{name:"new",description:e("local.new")},{name:"reset",description:e("local.reset")},{name:"rename",description:e("local.rename"),argumentHint:"[--auto] [<name>]"},{name:"resume",description:e("local.resume"),argumentHint:"<session-id>"},{name:"settings",description:e("local.settings")},{name:"schedule",description:e("local.schedule")},{name:"extensions",description:e("local.extensions"),argumentHint:"manage|install <source>",subcommands:["manage","install"]}].map(r=>({...r,source:"builtin-command"}))}const Qkt={bug:"local.bug",compress:"local.compress","compress-fast":"local.compressFast",config:"local.config",diff:"local.diff",directory:"local.directory",docs:"local.docs",doctor:"local.doctor",dream:"local.dream",effort:"local.effort",export:"local.export",forget:"local.forget",hooks:"local.hooks","import-config":"local.importConfig",init:"local.init",insight:"local.insight",lsp:"local.lsp",remember:"local.remember",summary:"local.summary",workflows:"local.workflows"},Jkt={batch:"skilldesc.batch",dataviz:"skilldesc.dataviz","extension-creator":"skilldesc.extensionCreator",loop:"skilldesc.loop","new-app":"skilldesc.newApp","qc-helper":"skilldesc.qcHelper",review:"skilldesc.review",simplify:"skilldesc.simplify",stuck:"skilldesc.stuck","agent-reproduce-align":"skilldesc.agentReproduceAlign","agent-reproduce-feature":"skilldesc.agentReproduceFeature",autofix:"skilldesc.autofix",bugfix:"skilldesc.bugfix",codegraph:"skilldesc.codegraph","create-issue":"skilldesc.createIssue","desktop-pet":"skilldesc.desktopPet","docs-audit-and-refresh":"skilldesc.docsAuditAndRefresh","docs-update-from-diff":"skilldesc.docsUpdateFromDiff","e2e-testing":"skilldesc.e2eTesting","feat-dev":"skilldesc.featDev","memory-leak-debug":"skilldesc.memoryLeakDebug","openwork-desktop-sync":"skilldesc.openworkDesktopSync","prepare-pr":"skilldesc.preparePr","qwen-code-claw":"skilldesc.qwenCodeClaw","structured-debugging":"skilldesc.structuredDebugging","terminal-capture":"skilldesc.terminalCapture","tmux-real-user-testing":"skilldesc.tmuxRealUserTesting",triage:"skilldesc.triage"};function _fe(e){return Jkt[e]}function Sfe(e,t){return e.map(n=>{const r=Qkt[n.name];return!r||n.source&&n.source!=="builtin-command"?n:{...n,description:t(r)}})}function Cfe(...e){const t=new Map;for(const n of e)for(const r of n){const s=t.get(r.name);s?t.set(r.name,{...s,...r,description:r.description||s.description,argumentHint:r.argumentHint??s.argumentHint}):t.set(r.name,r)}return[...t.values()]}const Zkt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='12.400195360183716'%20height='13.973437547683716'%20viewBox='0%200%2012.400195360183716%2013.973437547683716'%3e%3cpath%20d='M8.200192523841858,3.504687623841858L4.200002823841858,3.504687623841858L2.999997223841858,3.504690323841858L2.400195323841858,3.504687623841858L2.400195323841858,10.305688523841859L2.400198123841858,10.905691023841857L1.200192573841858,10.905691023841857L1.200195313841858,10.305688523841859L1.2001953738418578,3.504687623841858L0.6000000238418579,3.504687623841858L-0.0000027461581421084347,3.504690323841858L-0.0000027461581421084347,2.304684723841858L0.6000000238418579,2.304687523841858L2.999999923841858,2.304687523841858L2.999999923841858,3.8418579428878274e-9L9.400195723841858,3.8418579428878274e-9L9.400195723841858,2.304687523841858L11.800195023841859,2.304687523841858L12.400198023841858,2.304684723841858L12.400198023841858,3.504690323841858L11.800195023841859,3.5046874238418577L11.200000023841858,3.504687623841858L11.200000023841858,13.973437023841857L1.800195323841858,13.973437023841857L1.200192573841858,13.973440023841858L1.200192573841858,12.773435023841857L1.800195323841858,12.773437023841858L10.000000623841858,12.773437023841858L10.000000623841858,3.504687623841858L9.400197623841859,3.504687623841858L8.200192523841858,3.504690323841858L8.200192523841858,3.504687623841858ZM8.200195423841858,2.304687523841858L8.200195423841858,1.2000000438418579L4.199999923841858,1.2000000438418579L4.199999923841858,2.304687523841858L8.200195423841858,2.304687523841858ZM4.266598823841858,6.2031222238418575L4.266601723841858,6.803125023841858L4.266601723841858,9.482812523841858L4.266598823841858,10.082814823841858L5.466604323841858,10.082814823841858L5.466601523841858,9.482812523841858L5.466601523841858,6.803125023841858L5.466604323841858,6.2031222238418575L4.266598823841858,6.2031222238418575ZM6.933591023841858,6.2031222238418575L6.933593823841858,6.803125023841858L6.933593823841858,9.482812523841858L6.933591023841858,10.082814823841858L8.133596523841858,10.082814823841858L8.133593723841859,9.482812523841858L8.133593723841859,6.803125023841858L8.133596523841858,6.2031222238418575L6.933591023841858,6.2031222238418575Z'%20fill-rule='evenodd'%20fill='%23747476'%20fill-opacity='1'/%3e%3c/svg%3e",e_t="/assets/insert-DmRbh9Rv.svg",t_t="/assets/queue-DWpnpFgW.svg",n_t="_app_1rn92_1",r_t="_appChat_1rn92_43",s_t="_appChatEmpty_1rn92_49",i_t="_appShell_1rn92_54",o_t="_contextShell_1rn92_62",a_t="_chatHeaderRow_1rn92_71",l_t="_customChatHeader_1rn92_80",c_t="_contextBody_1rn92_85",u_t="_contextBodyWithEnvironmentPanel_1rn92_94",d_t="_chatPane_1rn92_94",h_t="_content_1rn92_95",f_t="_artifactResizeHandle_1rn92_114",m_t="_artifactPanelDock_1rn92_131",p_t="_artifactPanelClip_1rn92_139",g_t="_chatPaneShowingPage_1rn92_167",b_t="_fullPage_1rn92_173",y_t="_fullPageHeader_1rn92_182",v_t="_splitApprovalNotice_1rn92_192",w_t="_fullPageBack_1rn92_218",x_t="_fullPageTitle_1rn92_235",k_t="_fullPageBody_1rn92_240",__t="_mobileDrawer_1rn92_247",S_t="_mobileBackdrop_1rn92_251",C_t="_mobileDrawerForced_1rn92_258",T_t="_hamburgerButton_1rn92_286",E_t="_mobileDrawerOpen_1rn92_331",A_t="_hamburgerButtonFloating_1rn92_366",j_t="_appWithSidebar_1rn92_374",N_t="_themeDark_1rn92_384",I_t="_themeLight_1rn92_458",M_t="_contentHasMessages_1rn92_540",R_t="_missingSessionState_1rn92_549",D_t="_missingSessionMessage_1rn92_562",L_t="_missingSessionButton_1rn92_569",P_t="_panelHost_1rn92_604",O_t="_panelHeader_1rn92_612",$_t="_panelBack_1rn92_622",B_t="_panelTitle_1rn92_648",z_t="_panelBody_1rn92_657",F_t="_chatViewWrap_1rn92_669",q_t="_chatViewHidden_1rn92_677",H_t="_chatSubtree_1rn92_681",U_t="_chatSubtreeHidden_1rn92_685",W_t="_footer_1rn92_704",V_t="_bottomPanels_1rn92_714",G_t="_approvalOverlay_1rn92_729",K_t="_scrollToBottomLayer_1rn92_743",Y_t="_scrollToBottomLayerWithTodos_1rn92_754",X_t="_scrollToBottomButton_1rn92_761",Q_t="_scrollToBottomIcon_1rn92_790",J_t="_btwPanel_1rn92_796",Z_t="_composer_1rn92_803",eSt="_composerHeader_1rn92_808",tSt="_customFooter_1rn92_812",nSt="_escClearStatus_1rn92_818",rSt="_composerActionTip_1rn92_825",sSt="_composerActionTipIcon_1rn92_835",iSt="_composerActionTipText_1rn92_842",oSt="_composerActionTipActions_1rn92_849",aSt="_composerActionTipButton_1rn92_855",lSt="_composerActionTipButtonPrimary_1rn92_872",cSt="_emptyWelcomeFooter_1rn92_891",uSt="_mobileWelcomeFooterMiddle_1rn92_895",dSt="_mobileWelcomeGroup_1rn92_899",hSt="_chatPaneWithMobileComposerBottom_1rn92_904",fSt="_chatViewWithMobileComposerBottom_1rn92_909",mSt="_chatViewWithWelcomeMiddle_1rn92_922",pSt="_footerWithCustomFooter_1rn92_922",gSt="_desktopWelcomeFooter_1rn92_956",bSt="_queuedPrompts_1rn92_965",ySt="_queuedPrompt_1rn92_965",vSt="_queuedPromptIcon_1rn92_995",wSt="_queuedPromptMaskIcon_1rn92_1005",xSt="_queuedPromptActionIcon_1rn92_1006",kSt="_queuedPromptText_1rn92_1019",_St="_queuedPromptState_1rn92_1027",SSt="_queuedPromptSpinner_1rn92_1035",CSt="_queuedPromptActions_1rn92_1050",TSt="_queuedPromptAction_1rn92_1006",ESt="_queuedHint_1rn92_1095",Ot={app:n_t,appChat:r_t,appChatEmpty:s_t,appShell:i_t,contextShell:o_t,chatHeaderRow:a_t,customChatHeader:l_t,contextBody:c_t,contextBodyWithEnvironmentPanel:u_t,chatPane:d_t,content:h_t,artifactResizeHandle:f_t,artifactPanelDock:m_t,artifactPanelClip:p_t,chatPaneShowingPage:g_t,fullPage:b_t,fullPageHeader:y_t,splitApprovalNotice:v_t,fullPageBack:w_t,fullPageTitle:x_t,fullPageBody:k_t,mobileDrawer:__t,mobileBackdrop:S_t,mobileDrawerForced:C_t,hamburgerButton:T_t,mobileDrawerOpen:E_t,hamburgerButtonFloating:A_t,appWithSidebar:j_t,themeDark:N_t,themeLight:I_t,contentHasMessages:M_t,missingSessionState:R_t,missingSessionMessage:D_t,missingSessionButton:L_t,panelHost:P_t,panelHeader:O_t,panelBack:$_t,panelTitle:B_t,panelBody:z_t,chatViewWrap:F_t,chatViewHidden:q_t,chatSubtree:H_t,chatSubtreeHidden:U_t,footer:W_t,bottomPanels:V_t,approvalOverlay:G_t,scrollToBottomLayer:K_t,scrollToBottomLayerWithTodos:Y_t,scrollToBottomButton:X_t,scrollToBottomIcon:Q_t,btwPanel:J_t,composer:Z_t,composerHeader:eSt,customFooter:tSt,escClearStatus:nSt,composerActionTip:rSt,composerActionTipIcon:sSt,composerActionTipText:iSt,composerActionTipActions:oSt,composerActionTipButton:aSt,composerActionTipButtonPrimary:lSt,emptyWelcomeFooter:cSt,mobileWelcomeFooterMiddle:uSt,mobileWelcomeGroup:dSt,chatPaneWithMobileComposerBottom:hSt,chatViewWithMobileComposerBottom:fSt,chatViewWithWelcomeMiddle:mSt,footerWithCustomFooter:pSt,desktopWelcomeFooter:gSt,queuedPrompts:bSt,queuedPrompt:ySt,queuedPromptIcon:vSt,queuedPromptMaskIcon:wSt,queuedPromptActionIcon:xSt,queuedPromptText:kSt,queuedPromptState:_St,queuedPromptSpinner:SSt,queuedPromptActions:CSt,queuedPromptAction:TSt,queuedHint:ESt},ASt=240;function jSt(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function NSt(e,t){if(e.inputAnnotations&&e.inputAnnotations.length>0)return Iee(e.text,e.inputAnnotations).map(r=>r.type==="text"?r:{type:"tag",tag:r.tag,preserveCustomKindLabel:!0});const n=oD(e.text,t,"[WebShell] failed to parse queued prompt content",{requireSourcePreservation:!0});return n?n.map(r=>r.type==="text"?r:{type:"tag",tag:r.tag,preserveCustomKindLabel:!1}):[{type:"text",text:e.text}]}function ISt(e){const t=[];let n=ASt,r=!1;for(const i of e){if(i.type==="tag"){if(n<=0){r=!0;break}const l=jSt(i.tag).length;if(l>n){r=!0;break}t.push(i),n-=l;continue}let o=i.text.replace(/\s+/g," ");if(t.length===0&&(o=o.trimStart()),!!o){if(o.length>n){n>0&&t.push({type:"text",text:o.slice(0,n)}),r=!0;break}t.push({type:"text",text:o}),n-=o.length}}const s=t[t.length-1];if((s==null?void 0:s.type)==="text"){const i=s.text.trimEnd();i?s.text=i:t.pop()}return{parts:t,truncated:r}}function Tfe({prompts:e,t,onDelete:n,onInsert:r,onEdit:s}){const{parseUserMessageContent:i,composerTagIcons:o,renderComposerTag:l,renderComposerTagTooltip:c,onComposerTagClick:u}=Vu();return e.length===0?null:a.jsxs("div",{className:Ot.queuedPrompts,children:[e.map(d=>{var T;const f=ISt(NSt(d,i)),m=((T=d.images)==null?void 0:T.length)??0,p=gfe(d.text),g=d.serverState==="submitting",b=d.serverState==="queued",w=d.serverState==="running",y=d.isRemoving===!0,v=g||w||d.isEditing===!0||y;let x=t("queue.insertTip");v?x=t("queue.submittingDisabled"):p&&(x=t("queue.insertCommandDisabled"));let k=t("queue.editTip");v&&(k=t("queue.submittingDisabled"));const S=t(v?"queue.submittingDisabled":"queue.deleteTip");return a.jsxs("div",{className:Ot.queuedPrompt,children:[a.jsx("span",{className:Ot.queuedPromptIcon,"aria-hidden":"true",children:a.jsx("span",{className:Ot.queuedPromptMaskIcon,style:ap("--queued-icon-url",t_t)})}),a.jsxs("span",{className:Ot.queuedPromptText,children:[f.parts.map((_,C)=>_.type==="text"?a.jsx(h.Fragment,{children:_.text},C):a.jsx(LP,{tag:_.tag,composerTagIcons:o,renderComposerTag:l,renderComposerTagTooltip:c,onComposerTagClick:u,preserveCustomKindLabel:_.preserveCustomKindLabel},`${_.tag.id}:${C}`)),f.truncated?"...":null,m>0?` ${t("queue.imageCount",{count:m})}`:"",g||b||d.isEditing||y?a.jsxs("span",{className:Ot.queuedPromptState,role:"status",children:[(g||d.isEditing||y)&&a.jsx("span",{className:Ot.queuedPromptSpinner}),y?t("queue.removing"):d.isEditing?t("queue.editing"):t(b?"queue.serverQueued":"queue.submitting")]}):null]}),a.jsxs("span",{className:Ot.queuedPromptActions,children:[m===0&&!b&&a.jsxs("button",{type:"button",className:Ot.queuedPromptAction,onClick:()=>r(d.id),disabled:p||v,title:x,children:[a.jsx("span",{className:Ot.queuedPromptActionIcon,style:ap("--queued-icon-url",e_t),"aria-hidden":"true"}),t("queue.insert")]}),a.jsx("button",{type:"button",className:Ot.queuedPromptAction,onClick:()=>n(d.id),disabled:v,"aria-label":t("queue.delete"),title:S,children:a.jsx("span",{className:Ot.queuedPromptActionIcon,style:ap("--queued-icon-url",Zkt),"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:Ot.queuedPromptAction,onClick:()=>s(d.id),disabled:v,"aria-label":t("queue.edit"),title:k,children:a.jsx("span",{className:Ot.queuedPromptActionIcon,style:ap("--queued-icon-url",Lhe),"aria-hidden":"true"})})]})]},d.id)}),a.jsx("div",{className:Ot.queuedHint,children:t("queue.footer")})]})}const MSt="_approval_5nswb_1",RSt="_floating_5nswb_18",DSt="_header_5nswb_31",LSt="_icon_5nswb_41",PSt="_name_5nswb_56",OSt="_desc_5nswb_67",$St="_content_5nswb_87",BSt="_code_5nswb_105",zSt="_codeBlock_5nswb_113",FSt="_question_5nswb_136",qSt="_options_5nswb_148",HSt="_option_5nswb_148",USt="_optionPlain_5nswb_183",WSt="_optionSecondary_5nswb_193",VSt="_optionPrimary_5nswb_200",GSt="_optionActive_5nswb_211",KSt="_pointer_5nswb_215",YSt="_num_5nswb_219",XSt="_label_5nswb_223",To={approval:MSt,floating:RSt,header:DSt,icon:LSt,name:PSt,desc:OSt,content:$St,code:BSt,codeBlock:zSt,question:FSt,options:qSt,option:HSt,optionPlain:USt,optionSecondary:WSt,optionPrimary:VSt,optionActive:GSt,pointer:KSt,num:YSt,label:XSt};function QSt(e){if(!e)return{toolName:"",description:""};const t=e.indexOf(": ");if(t>0){const n=e.slice(0,t);return/^[A-Za-z][\w.-]{0,40}$/.test(n)?{toolName:n,description:e.slice(t+2)}:{toolName:e,description:""}}return{toolName:e,description:""}}function JSt(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function ZSt(e){var n;const t=(n=e.toolName)==null?void 0:n.toLowerCase();return e.kind==="bash"||e.kind==="exec"||e.kind==="execute"||e.kind==="shell"||t==="run_shell_command"}function e2t(e){if(!e.rawInput)return null;const t=e.rawInput;return typeof t.command=="string"?t.command:typeof t.input=="string"?t.input:null}function t2t(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function a7(e){if(e.length>1&&(e[0].kind==="allow_always"||e[0].kind==="reject_always")){const t=e.findIndex(n=>n.kind==="allow_once"||n.kind==="reject_once");return t>=0?t:1}return 0}function lY(e){return e.kind==="reject_once"||e.kind==="reject_always"?0:e.kind==="allow_always"&&e.id==="proceed_always_user"?1:e.kind==="allow_always"&&e.id==="proceed_always_project"?2:e.kind==="allow_always"&&(e.id==="proceed_always_server"||e.id==="proceed_always_tool")||e.kind==="allow_always"?3:e.kind==="allow_once"?4:5}function SC(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const r=lY(t.option)-lY(n.option);return r===0?t.index-n.index:r}).map(({option:t})=>t)}function n2t(e){if(e.id==="proceed_once_and_switch_to_default")return"approval.option.allowOnceAndSwitchToDefault";if(e.kind==="allow_once")return"approval.option.allowOnce";if(e.kind==="reject_once")return"approval.option.rejectOnce";if(e.kind==="allow_always"){if(e.id==="proceed_always_project")return"approval.option.allowAlwaysProject";if(e.id==="proceed_always_user")return"approval.option.allowAlwaysUser";if(e.id==="proceed_always_server")return"approval.option.allowAlwaysServer";if(e.id==="proceed_always_tool")return"approval.option.allowAlwaysTool";if(e.id==="proceed_always")return"approval.option.allowAllEdits"}}function r2t(e){return e.kind==="allow_once"?To.optionPrimary:e.kind==="allow_always"?To.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?To.optionPlain:To.optionSecondary}function Efe({request:e,onConfirm:t,variant:n="inline",keyboardActive:r=!0}){const{t:s}=rt(),i=h.useMemo(()=>SC(e.options),[e.options]),[o,l]=h.useState(()=>a7(SC(e.options))),c=h.useRef(e);c.current=e;const u=h.useRef(o);u.current=o;const d=h.useRef(!1),f=h.useRef([]),m=h.useId(),p=h.useId(),g=h.useId(),b=h.useId();h.useEffect(()=>{const B=a7(SC(c.current.options));d.current=!1,u.current=B,l(B)},[e.id]);const w=QSt(e.title),y=e.toolName||w.toolName||e.kind||"Tool",v=vd(y,s),x=t2t(e),k=JSt(e),S=h.useCallback(B=>{d.current||(d.current=!0,t(c.current.id,B))},[t]),T=h.useCallback(B=>{const N=f.current[B];N&&(document.activeElement===N&&N.blur(),N.focus())},[]),_=h.useRef(!1),C=h.useRef(e.id);h.useEffect(()=>{const B=_.current,N=C.current;if(_.current=r,C.current=e.id,!r)return;const z=e.id!==N;B&&!z||T(z?a7(SC(c.current.options)):u.current)},[r,e.id,T]);const j=h.useCallback(B=>{const N=i.length,z=(u.current+B+N)%N;u.current=z,l(z),T(z)},[i.length,T]),E=h.useCallback(B=>{const N=i.length;if(B.key==="ArrowDown"||B.key==="j")B.preventDefault(),j(1);else if(B.key==="ArrowUp"||B.key==="k")B.preventDefault(),j(-1);else if(B.key==="Home")B.preventDefault(),u.current=0,l(0),T(0);else if(B.key==="End"){B.preventDefault();const z=N-1;u.current=z,l(z),T(z)}else if(B.key==="Escape"){B.preventDefault();const z=c.current.options.find(G=>G.kind==="reject_once"||G.kind==="reject_always");z&&S(z.id)}else if(B.key>="1"&&B.key<="9"){const z=parseInt(B.key,10)-1;z<N&&(B.preventDefault(),S(i[z].id))}},[i,j,S,T]),L=ZSt(e),D=mbe(e.toolName),M=e2t(e),R=!!(L&&M||k&&k!==e.title),$=D?s("approval.launchAgentQuestion"):L?s("approval.execQuestion",{tool:v}):s("approval.changeQuestion");return a.jsxs("div",{className:n==="floating"?`${To.approval} ${To.floating}`:To.approval,"data-web-shell-permission-panel":!0,role:"alertdialog","aria-labelledby":m,"aria-describedby":[p,x?g:null,R?b:null].filter(Boolean).join(" "),onKeyDown:E,children:[a.jsxs("div",{className:To.header,children:[a.jsx("span",{className:To.icon,"aria-hidden":"true",children:"?"}),a.jsx("span",{className:To.name,id:m,children:v})]}),x&&a.jsx("div",{className:To.desc,id:g,title:x,children:x}),L&&M?a.jsx("div",{className:To.code,children:a.jsx("pre",{className:To.codeBlock,id:b,title:M,children:M})}):k&&k!==e.title?a.jsx("pre",{className:To.content,id:b,title:k,children:k}):null,a.jsx("div",{className:To.question,id:p,children:$}),a.jsx("div",{className:To.options,role:"radiogroup",children:i.map((B,N)=>{const z=N===o,G=n2t(B),I=G?s(G):B.label;return a.jsxs("button",{type:"button",ref:Y=>{f.current[N]=Y},className:`${To.option} ${r2t(B)} ${z?To.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":B.id,tabIndex:z?0:-1,role:"radio","aria-checked":z,"aria-keyshortcuts":N<9?String(N+1):void 0,onClick:()=>S(B.id),onFocus:()=>{u.current=N,l(N)},children:[a.jsx("span",{className:To.pointer,"aria-hidden":"true",children:z?"›":" "}),a.jsxs("span",{className:To.num,"aria-hidden":"true",children:[N+1,"."]}),a.jsx("span",{className:To.label,children:I})]},B.id)})})]})}const s2t="_question_171kf_1",i2t="_floating_171kf_18",o2t="_titleLine_171kf_30",a2t="_icon_171kf_38",l2t="_toolName_171kf_42",c2t="_toolDesc_171kf_46",u2t="_tabs_171kf_53",d2t="_topRight_171kf_63",h2t="_collapseButton_171kf_70",f2t="_collapseIcon_171kf_89",m2t="_collapseIconCollapsed_171kf_95",p2t="_collapsed_171kf_99",g2t="_tab_171kf_53",b2t="_tabActive_171kf_118",y2t="_text_171kf_135",v2t="_description_171kf_143",w2t="_multiHint_171kf_151",x2t="_options_171kf_157",k2t="_option_171kf_157",_2t="_customTrigger_171kf_190",S2t="_optionActive_171kf_199",C2t="_optionSelected_171kf_200",T2t="_optionLabel_171kf_205",E2t="_pointer_171kf_210",A2t="_optionNum_171kf_214",j2t="_editIcon_171kf_231",N2t="_optionContent_171kf_263",I2t="_optionPlaceholder_171kf_279",M2t="_optionDesc_171kf_284",R2t="_customInput_171kf_291",D2t="_actions_171kf_332",L2t="_button_171kf_340",P2t="_submitButton_171kf_366",O2t="_submitSpinner_171kf_375",$2t="_ignoreButton_171kf_380",$r={question:s2t,floating:i2t,titleLine:o2t,icon:a2t,toolName:l2t,toolDesc:c2t,tabs:u2t,topRight:d2t,collapseButton:h2t,collapseIcon:f2t,collapseIconCollapsed:m2t,collapsed:p2t,tab:g2t,tabActive:b2t,text:y2t,description:v2t,multiHint:w2t,options:x2t,option:k2t,customTrigger:_2t,optionActive:S2t,optionSelected:C2t,optionLabel:T2t,pointer:E2t,optionNum:A2t,editIcon:j2t,optionContent:N2t,optionPlaceholder:I2t,optionDesc:M2t,customInput:R2t,actions:D2t,button:L2t,submitButton:P2t,submitSpinner:O2t,ignoreButton:$2t};function Afe({request:e,onConfirm:t,onError:n,variant:r="inline",keyboardActive:s=!0}){const{t:i}=rt(),o=h.useMemo(()=>{var X;return Array.isArray((X=e.rawInput)==null?void 0:X.questions)?e.rawInput.questions:[]},[e.rawInput]),[l,c]=h.useState(0),[u,d]=h.useState(null),[f,m]=h.useState({}),[p,g]=h.useState({}),[b,w]=h.useState({}),[y,v]=h.useState(!1),[x,k]=h.useState(!1),[S,T]=h.useState(!1),_=h.useRef(!1),C=h.useRef(0),j=h.useRef([]),E=h.useRef(null),L=h.useRef(u);L.current=u;const D=h.useId(),M=h.useId();h.useEffect(()=>{const X=o[0];_.current=!1,C.current++,T(!1),k(!1),c(0),L.current=X!=null&&X.options.length?0:null,d(X!=null&&X.options.length?0:null),m(X&&!X.multiSelect&&X.options[0]?{0:X.options[0].label}:{}),g({}),w(X!=null&&X.multiSelect&&X.options[0]?{0:[X.options[0].label]}:{}),v(!1)},[o,e.id]);const R=o[l],$=(R==null?void 0:R.multiSelect)??!1,B=h.useCallback(()=>{const X={};for(let ye=0;ye<o.length;ye++){const Ce=o[ye];if(Ce)if(Ce.multiSelect){const ae=b[ye]||[],me=p[ye],We=me?[...ae,me]:ae;X[String(ye)]=We.join(", ")}else X[String(ye)]=f[ye]||p[ye]||""}return X},[o,b,p,f]),N=h.useCallback(async(X,ye)=>{if(_.current)return;_.current=!0;const Ce=++C.current;T(!0);try{if(!await t(e.id,X,ye))throw new Error(i("askUser.submitFailed"))}catch(ae){if(C.current!==Ce)return;_.current=!1,T(!1),n(ae,i("askUser.submitFailed"))}},[t,n,e.id,i]),z=h.useCallback(()=>{if(_.current)return;const X=e.options.find(ye=>ye.kind==="allow_once");if(!X){const ye=i("askUser.submitOptionUnavailable");n(new Error(ye),ye);return}N(X.id,B())},[B,n,e.options,N,i]),G=h.useCallback(()=>{if(_.current)return;const X=e.options.find(ye=>ye.kind==="reject_once"||ye.kind==="reject_always");X&&N(X.id)},[e.options,N]),I=h.useCallback(X=>{X!==void 0&&g(ye=>({...ye,[l]:X})),$||m(ye=>{if(!(l in ye))return ye;const Ce={...ye};return delete Ce[l],Ce}),v(!0)},[l,$]),Y=h.useCallback(X=>{if(!R)return;if(X===R.options.length){I();return}const Ce=R.options[X].label;if($){const ae=b[l]||[],me=ae.includes(Ce)?ae.filter(We=>We!==Ce):[...ae,Ce];w({...b,[l]:me})}else{const ae={...f,[l]:Ce};m(ae),g(me=>{if(!(l in me))return me;const We={...me};return delete We[l],We})}},[R,l,$,b,f,I]),U=h.useCallback(X=>{if(!R||!$)return;if(X===R.options.length){I();return}const ye=R.options[X].label,Ce=b[l]||[],ae=Ce.includes(ye)?Ce.filter(me=>me!==ye):[...Ce,ye];w({...b,[l]:ae})},[R,$,b,l,I]),P=h.useCallback(X=>{if(R){if(L.current=X,d(X),X===R.options.length){I();return}$?U(X):Y(X)}},[R,$,I,U,Y]),F=h.useCallback(X=>{var ye,Ce;R&&(L.current=X,d(X),X===R.options.length?((ye=E.current)==null||ye.focus(),$||m(ae=>{if(!(l in ae))return ae;const me={...ae};return delete me[l],me})):((Ce=j.current[X])==null||Ce.focus(),$||Y(X)))},[R,l,$,Y]),te=h.useCallback(X=>{if(!R)return;const ye=R.options.length+1,Ce=L.current??0;F((Ce+X+ye)%ye)},[R,F]),W=h.useCallback(X=>{if(Qg(X.target)||!X.target.closest("[data-web-shell-ask-option]")||!R)return;const ye=R.options.length+1;if(X.key==="ArrowDown"||X.key==="j")X.preventDefault(),te(1);else if(X.key==="ArrowUp"||X.key==="k")X.preventDefault(),te(-1);else if(X.key==="Home")X.preventDefault(),F(0);else if(X.key==="End")X.preventDefault(),F(ye-1);else if(X.key==="Escape")X.preventDefault(),G();else if(X.key>="1"&&X.key<="9"){const Ce=parseInt(X.key,10)-1;Ce<ye&&(X.preventDefault(),P(Ce))}},[R,te,F,G,P]),K=h.useRef(!1),ce=h.useRef(e.id),ie=h.useRef((R==null?void 0:R.options.length)??0);if(ie.current=(R==null?void 0:R.options.length)??0,h.useEffect(()=>{var ae,me;const X=K.current,ye=ce.current;if(K.current=s,ce.current=e.id,!s||X&&e.id===ye)return;const Ce=L.current??0;Ce===ie.current?(ae=E.current)==null||ae.focus():(me=j.current[Ce])==null||me.focus()},[s,e.id]),o.length===0)return null;const Z=X=>{const ye=o[X];return ye?ye.multiSelect?(b[X]||[]).length>0||!!p[X]:!!f[X]||!!p[X]:!1},ee=o.every((X,ye)=>Z(ye)),oe=Math.min(l,o.length-1),we=X=>{const ye=o[X];if(c(X),v(!1),!(ye!=null&&ye.options.length)){d(null);return}if(d(0),ye.multiSelect){w(Ce=>(Ce[X]||[]).length>0||p[X]?Ce:{...Ce,[X]:[ye.options[0].label]});return}m(Ce=>Ce[X]||p[X]?Ce:{...Ce,[X]:ye.options[0].label})},pe=()=>{l<=0||we(l-1)},he=()=>{l>=o.length-1||we(l+1)};return a.jsxs("div",{className:`${$r.question} ${r==="floating"?$r.floating:""} ${x?$r.collapsed:""}`,"data-web-shell-ask-panel":!0,role:"alertdialog","aria-label":vd("ask_user_question",i),"aria-labelledby":x?void 0:`${M} ${D}`,onKeyDown:W,children:[a.jsxs("div",{className:$r.titleLine,children:[a.jsx("span",{className:$r.icon,"aria-hidden":"true",children:"?"}),a.jsx("span",{className:$r.toolName,id:M,children:vd("ask_user_question",i)}),a.jsx("span",{className:$r.toolDesc,children:i("askUser.progress",{current:oe+1,total:o.length})}),a.jsxs("div",{className:$r.topRight,children:[a.jsx("div",{className:$r.tabs,children:o.map((X,ye)=>a.jsx("span",{className:`${$r.tab} ${ye===l?$r.tabActive:""}`,"aria-hidden":"true"},ye))}),a.jsx("button",{type:"button",className:$r.collapseButton,onClick:()=>k(X=>!X),"aria-expanded":!x,"aria-label":i(x?"common.expand":"common.collapse"),title:i(x?"common.expand":"common.collapse"),children:a.jsx("svg",{viewBox:"0 0 16 16",className:`${$r.collapseIcon} ${x?$r.collapseIconCollapsed:""}`,children:a.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!x&&a.jsxs(a.Fragment,{children:[R?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:$r.text,id:D,children:[R.question,$&&a.jsxs("span",{className:$r.multiHint,children:[" ","(",i("askUser.multiHint"),")"]})]}),a.jsx("p",{className:$r.description,children:i("askUser.selectAnswer")}),a.jsxs("div",{className:$r.options,role:$?"group":"radiogroup","aria-labelledby":D,children:[R.options.map((X,ye)=>{const Ce=ye===u,ae=$?(b[l]||[]).includes(X.label):f[l]===X.label;return a.jsxs("button",{type:"button",ref:me=>{j.current[ye]=me},className:`${$r.option} ${Ce?$r.optionActive:""} ${ae?$r.optionSelected:""}`,"data-web-shell-ask-option":!0,tabIndex:Ce?0:-1,role:$?void 0:"radio","aria-checked":$?void 0:ae,"aria-pressed":$?ae:void 0,"aria-keyshortcuts":ye<9?String(ye+1):void 0,disabled:S,onClick:()=>P(ye),onFocus:()=>d(ye),children:[a.jsx("span",{className:$r.pointer,"aria-hidden":"true",children:Ce?"›":" "}),a.jsx("span",{className:$r.optionNum,"aria-hidden":"true",children:ye+1}),a.jsxs("span",{className:$r.optionContent,children:[a.jsx("span",{className:$r.optionLabel,children:X.label}),X.description&&a.jsx("span",{className:$r.optionDesc,children:X.description})]})]},X.label)}),(()=>{const X=u===R.options.length,ye=!!p[l];return a.jsxs("div",{className:`${$r.option} ${X?$r.optionActive:""} ${ye?$r.optionSelected:""}`,onClick:()=>{S||P(R.options.length)},children:[a.jsx("span",{className:$r.pointer,"aria-hidden":"true",children:X?"›":" "}),a.jsx("span",{className:$r.editIcon,"aria-hidden":"true",children:a.jsx("svg",{viewBox:"0 0 16 16",children:a.jsx("path",{d:"M3.2 10.9 4 7.8 10.8 1l3.2 3.2-6.8 6.8-3 .8zM10 1.8l3.2 3.2M3 14h10",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}),y?a.jsx("input",{type:"text",className:$r.customInput,placeholder:i("askUser.typePlaceholder"),value:p[l]||"","aria-label":i("askUser.typePlaceholder"),disabled:S,onChange:Ce=>g({...p,[l]:Ce.target.value}),onClick:Ce=>Ce.stopPropagation(),onFocus:()=>d(R.options.length),onBlur:()=>v(!1),autoFocus:!0}):a.jsx("button",{type:"button",ref:E,className:`${$r.customTrigger} ${p[l]?"":$r.optionPlaceholder}`,"data-web-shell-ask-option":!0,tabIndex:X?0:-1,role:$?void 0:"radio","aria-checked":$?void 0:ye,"aria-pressed":$?ye:void 0,"aria-keyshortcuts":R.options.length<9?String(R.options.length+1):void 0,disabled:S,onFocus:()=>d(R.options.length),children:p[l]||i("askUser.typePlaceholder")})]})})()]})]}):null,a.jsxs("div",{className:$r.actions,children:[a.jsx("button",{type:"button",className:$r.ignoreButton,disabled:S,onClick:G,children:i("askUser.ignore")}),o.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:$r.button,disabled:S||l<=0,onClick:pe,children:i("common.previous")}),a.jsx("button",{type:"button",className:$r.button,disabled:S||l>=o.length-1,onClick:he,children:i("common.next")})]}),a.jsx("button",{type:"button",className:`${$r.button} ${$r.submitButton}`,disabled:S||!ee,"aria-busy":S,onClick:z,children:S?a.jsxs(a.Fragment,{children:[a.jsx(Hr,{className:$r.submitSpinner,"aria-hidden":"true"}),i("askUser.submitting")]}):i("askUser.submit")})]})]})]})}const B2t=1e6;function jfe(e){const t=new Set;e.callId&&t.add(e.callId),e.parentToolCallId&&t.add(e.parentToolCallId);for(const n of e.subTools??[])for(const r of jfe(n))t.add(r);return Array.from(t)}function fO(e,t,n){const r=new Map,s=[];let i=null;for(const l of e){if(l.role==="user"||l.role==="user_shell"){i=l.id;continue}if(i||(i=l.id),l.role==="tool_group")for(const c of l.tools){for(const u of jfe(c))r.set(u,i);Nfe(c,i,s)}}const o=new Map;for(const l of t){const c=z2t(s,l,n);if(c.size===0&&l.toolCallId){const u=r.get(l.toolCallId);u&&c.add(u)}for(const u of c){const d=o.get(u);d?d.some(f=>f.id===l.id)||d.push(l):o.set(u,[l])}}return o}function Nfe(e,t,n){e.toolName.toLowerCase()==="record_artifact"&&n.push({turnId:t,workspacePath:Cf(e.args,"workspacePath"),managedId:Cf(e.args,"managedId"),url:Cf(e.args,"url")});for(const r of e.subTools??[])Nfe(r,t,n)}function z2t(e,t,n){const r=new Set;for(const s of e){if(s.workspacePath&&t.workspacePath&&Ofe(s.workspacePath,t.workspacePath,n)){r.add(s.turnId);continue}if(s.managedId&&s.managedId===t.managedId){r.add(s.turnId);continue}s.url&&s.url===t.url&&r.add(s.turnId)}return r}function mO(e,t,n){const r=new Map;let s=null;for(const i of e){if(i.role==="user"||i.role==="user_shell"){s=i.id;continue}if(s||(s=i.id),i.role!=="tool_group")continue;const o=new Set((t.get(s)??[]).map(l=>Jg(l.workspacePath)).filter(l=>!!l));for(const l of i.tools)Rfe(l,s,o,r,n)}return r}function Ife(e){const t=new Map;let n=null;for(const r of e){if(r.role==="user"||r.role==="user_shell"){n=r.id;continue}if(n||(n=r.id),r.role==="tool_group")for(const s of r.tools)Mfe(s,n,t)}return t}function Mfe(e,t,n){const r=F2t(e);if(r){const s=n.get(t);s?s.push(r):n.set(t,[r])}for(const s of e.subTools??[])Mfe(s,t,n)}function F2t(e){if(e.status!=="completed"||e.toolName.toLowerCase()!=="cron_create")return null;const t=pO(e);if(t!=null&&t.error)return null;const n=Cf(e.args,"cron"),r=Cf(e.args,"prompt");if(!n||!r)return null;const s=Cf(t,"returnDisplay")??Cf(t,"llmContent")??(typeof e.rawOutput=="string"?e.rawOutput:void 0),i=s?Dfe(s):void 0;return{id:s?G2t(s)??e.callId:e.callId,toolCallId:e.callId,title:K2t(r),cron:n,prompt:r,recurring:cY(e.args,"recurring")??!0,durable:cY(e.args,"durable")??!1,...i?{display:i}:{}}}function Rfe(e,t,n,r,s){const i=q2t(e,n,s);if(i){const o=r.get(t);o?Y2t(o,i):r.set(t,[i])}for(const o of e.subTools??[])Rfe(o,t,n,r,s)}function q2t(e,t,n){if(e.status!=="completed")return null;const r=e.toolName.toLowerCase();if(r!=="write_file"&&r!=="edit")return null;const s=H2t(e);if(!s)return null;const i=Jg(s),o=U2t(e),l=V2t(e),c=W2t(l);return{path:s,status:o,toolCallId:e.callId,isArtifact:Array.from(t).some(u=>Ofe(i,u,n)),...c?{additions:c.additions,deletions:c.deletions}:{},diffs:l}}function H2t(e){var n,r;const t=A4(e.args,"file_path","filePath","path");if(t!==void 0&&t.length>0)return t;for(const s of e.content??[])if(s.path)return s.path;return(r=(n=e.locations)==null?void 0:n[0])==null?void 0:r.file}function Cf(e,...t){if(e)for(const n of t){const r=e[n];if(typeof r=="string"&&r.trim())return r}}function A4(e,...t){if(e)for(const n of t){const r=e[n];if(typeof r=="string")return r}}function U2t(e){if(e.toolName.toLowerCase()==="write_file")return"created";const t=pO(e),n=(Cf(t,"returnDisplay")??"").toLowerCase();return n.includes("created new file")||n.includes("successfully created")||n.includes("created and wrote")?"created":"modified"}function W2t(e){const t=Lfe(e);return t?Pfe(t.oldText,t.newText):void 0}function V2t(e){const t=pO(e),n=A4(t,"originalContent"),r=A4(t,"newContent");if(n!==void 0||r!==void 0)return[{oldText:n??"",newText:r??"",fileDiff:Cf(t,"fileDiff"),fullContent:!0}];const s=[];for(const i of e.content??[])i.type==="diff"&&s.push({oldText:i.oldText??"",newText:i.newText??""});if(s.length>0)return s;if(e.toolName.toLowerCase()==="write_file"){const i=A4(e.args,"content");return i!==void 0?[{oldText:"",newText:i,fullContent:!0}]:[]}return[]}function pO(e){return e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0}function cY(e,t){const n=e==null?void 0:e[t];return typeof n=="boolean"?n:void 0}function Dfe(e){return e.split(/\r\n|\r|\n/).map(t=>t.trim()).find(Boolean)}function G2t(e){const t=e.match(/\bScheduled\s+(?:(?:recurring job|one-shot task)\s+([a-z0-9_-]+)\b|([a-z0-9_-]+)\s*\()/i);return(t==null?void 0:t[1])??(t==null?void 0:t[2])}function K2t(e){const t=Dfe(e)??e.trim();return t.length>36?`${t.slice(0,36)}...`:t}function Y2t(e,t){const n=Jg(t.path),r=e.findIndex(f=>Jg(f.path)===n);if(r<0){e.push(t);return}const s=e[r],{additions:i,deletions:o,...l}=s,c=X2t(s.diffs,t.diffs),u=Lfe(c),d=u?Pfe(u.oldText,u.newText):void 0;e[r]={...l,status:s.status==="created"||t.status==="created"?"created":"modified",isArtifact:s.isArtifact||t.isArtifact,...d?{additions:d.additions,deletions:d.deletions}:{},diffs:c}}function X2t(e,t){const n=[...e,...t];if(!n.every(i=>i.fullContent))return n;const r=n[0],s=n.at(-1);return!r||!s?n:[{oldText:r.oldText,newText:s.newText,fullContent:!0}]}function Lfe(e){const t=e.at(-1);return t!=null&&t.fullContent?t:void 0}function Pfe(e,t){const n=uY(e),r=uY(t);if(n.length*r.length>B2t)return;const s=Q2t(n,r);return{additions:r.length-s,deletions:n.length-s}}function uY(e){return e?e.replace(/\r?\n$/,"").split(/\r\n|\r|\n/):[]}function Q2t(e,t){const n=new Array(t.length+1).fill(0),r=new Array(t.length+1).fill(0);for(const s of e){for(let i=0;i<t.length;i++)r[i+1]=s===t[i]?n[i]+1:Math.max(n[i+1],r[i]);for(let i=0;i<r.length;i++)n[i]=r[i];r.fill(0)}return n[t.length]??0}function Ofe(e,t,n){return whe(e,t,n)}const J2t="_pane_j8hlg_1",Z2t="_paneEmbedded_j8hlg_13",eCt="_footer_j8hlg_18",tCt="_header_j8hlg_22",nCt="_workspaceTag_j8hlg_45",rCt="_workspaceTagDot_j8hlg_61",sCt="_workspaceTagText_j8hlg_69",iCt="_connectionError_j8hlg_78",oCt="_connectionErrorText_j8hlg_86",aCt="_title_j8hlg_93",lCt="_headerActions_j8hlg_104",cCt="_headerActionsInline_j8hlg_113",uCt="_headerActionSlot_j8hlg_120",dCt="_headerActionsHostHidden_j8hlg_127",hCt="_headerTrailing_j8hlg_139",fCt="_headerOverflowPanel_j8hlg_146",mCt="_headerActionButton_j8hlg_154",pCt="_closeButton_j8hlg_155",gCt="_maximizeButton_j8hlg_156",bCt="_body_j8hlg_185",yCt="_approval_j8hlg_199",mo={pane:J2t,paneEmbedded:Z2t,footer:eCt,header:tCt,workspaceTag:nCt,workspaceTagDot:rCt,workspaceTagText:sCt,connectionError:iCt,connectionErrorText:oCt,title:aCt,headerActions:lCt,headerActionsInline:cCt,headerActionSlot:uCt,headerActionsHostHidden:dCt,headerTrailing:hCt,headerOverflowPanel:fCt,headerActionButton:mCt,closeButton:pCt,maximizeButton:gCt,body:bCt,approval:yCt},vCt=64,$fe='button, a[href], [role="button"], input[type="button"], input[type="submit"], summary';function Bfe(e){const t=[];for(const n of h.Children.toArray(e))if(h.isValidElement(n)){if(n.type===h.Fragment){const r=n.props.children;t.push(...Bfe(r));continue}t.push(n)}return t}function wCt(e,t){const n=e.props;return n["aria-label"]?n["aria-label"]:n.title?n.title:n.children!=null&&n.children!==!1&&(typeof n.children=="string"||typeof n.children=="number")?n.children:t}function gO(e,t){const n=e==null?void 0:e.querySelector(`[data-pane-header-action-index="${t}"]`);return n instanceof HTMLElement?n:null}function zfe(e){return e.querySelector($fe)??e}function xCt(e){let t="";const n=r=>{if(r.nodeType===Node.ELEMENT_NODE){const s=r;if(s.getAttribute("aria-hidden")==="true")return;for(const i of Array.from(s.childNodes))n(i);return}r.nodeType===Node.TEXT_NODE&&(t+=r.nodeValue??"")};for(const r of Array.from(e.childNodes))n(r);return t.trim()}function kCt(e,t,n,r){const s=gO(e,t);if(s){const i=zfe(s),o=i.getAttribute("aria-label");if(o)return o;const l=i.getAttribute("title");if(l)return l;const c=xCt(i);if(c)return c}return wCt(n,r)}function _Ct(e,t){const n=gO(e,t);n&&zfe(n).click()}function SCt(e,t){const n=gO(e,t);return n?n.querySelector($fe)!==null:!0}function CCt({children:e,trailing:t}){const{t:n}=rt(),r=h.useRef(null),s=h.useRef(null),i=h.useRef(null),o=h.useRef(0),[l,c]=h.useState(!1),u=e!=null&&e!==!1,d=u?Bfe(e):[],f=n("splitView.defaultActionLabel");return h.useLayoutEffect(()=>{var b;if(!u){o.current=0,c(!1);return}const m=(b=r.current)==null?void 0:b.parentElement;if(!m)return;const p=()=>{var L;s.current&&(o.current=s.current.scrollWidth);const w=o.current;if(w===0){c(!1);return}const y=((L=i.current)==null?void 0:L.offsetWidth)??0,v=getComputedStyle(m),x=parseFloat(v.gap)||0,k=r.current?getComputedStyle(r.current):null,S=y>0&&parseFloat((k==null?void 0:k.gap)??"")||0,T=(parseFloat(v.paddingLeft)||0)+(parseFloat(v.paddingRight)||0),_=m.querySelector("[data-web-shell-pane-workspace]"),C=(_==null?void 0:_.offsetWidth)??0,j=C>0?x:0,E=m.clientWidth-T-C-j-vCt-y-x-S;c(w>E)};p();const g=new ResizeObserver(p);return g.observe(m),s.current&&g.observe(s.current),i.current&&g.observe(i.current),()=>g.disconnect()},[u]),a.jsxs("div",{ref:r,className:mo.headerActions,"data-testid":"pane-header-actions",children:[u&&a.jsx("div",{ref:s,className:l?mo.headerActionsHostHidden:mo.headerActionsInline,"data-testid":l?"pane-header-actions-host":"pane-header-actions-inline","aria-hidden":l||void 0,children:d.map((m,p)=>a.jsx("span",{className:mo.headerActionSlot,"data-pane-header-action-index":String(p),children:m},m.key??`pane-header-action-${p}`))}),u&&l&&a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{type:"button",className:mo.headerActionButton,"aria-label":n("splitView.morePaneActions"),title:n("splitView.morePaneActions"),"data-testid":"pane-header-overflow",children:a.jsx(Wxe,{size:16,"aria-hidden":"true"})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40","data-testid":"pane-header-overflow-menu",children:a.jsx("div",{className:mo.headerOverflowPanel,children:d.map((m,p)=>SCt(s.current,p)?a.jsx(bi,{onSelect:()=>{_Ct(s.current,p)},children:kCt(s.current,p,m,f)},m.key??`pane-header-menu-${p}`):null)})})]}),t!=null&&a.jsx("div",{ref:i,className:mo.headerTrailing,children:t})]})}const dY=["approvalMode","model","voice"],TCt={};function ECt({enabled:e,onOpen:t,children:n}){return e?a.jsx(rhe,{onOpen:t,children:n}):n}function Ffe({title:e,workspaceCwd:t,renderHeaderActions:n,onClose:r,onToggleMaximize:s,isMaximized:i=!1,onError:o,onSlashCommand:l,onRightPanelOpen:c,onOpenMonitor:u,onPaneArtifactsChange:d,messageTurnOutputs:f,restartSseOnPrompt:m=!1,embedded:p=!1,onFirstPromptAdmitted:g,hidden:b=!1,voiceUserRevision:w=0,voiceWorkspaceRevisions:y=TCt,voiceWorkspaces:v}){var Re,et,bt,rn,qn;const{t:x}=rt(),{renderComposerFooter:k}=Vu(),S=qa(),T=nm(),_=ga(),C=yo(),j=ufe(),E=dO(x,j),L=K9(),D=av(),M=c5(),{artifacts:R}=hO(),$=h.useCallback(ft=>{var Yt;if(!S.sessionId||!c)return;const He=ft.rawOutput&&typeof ft.rawOutput=="object"?ft.rawOutput:void 0,Ye=(typeof((Yt=ft.args)==null?void 0:Yt.subagent_type)=="string"?ft.args.subagent_type:void 0)??(typeof(He==null?void 0:He.subagentName)=="string"?He.subagentName:void 0);c({id:`subagent:${S.sessionId}:${ft.callId}`,kind:"subagent",title:ft.title||Ye||x("agent.label"),turnId:ft.callId,tool:ft,sessionId:S.sessionId,workspaceCwd:S.workspaceCwd??t})},[S.sessionId,S.workspaceCwd,c,x,t]),B=h.useRef(S.sessionId);B.current=S.sessionId;const N=((Re=S.capabilities)==null?void 0:Re.features.includes(Cee))===!0&&u!==void 0,z=h.useCallback(async ft=>{const He=B.current;if(!He||!u)return!1;try{const Ye=await T.getTasks();if(B.current!==He||Ye.sessionId!==He)return!1;const Yt=Nhe(Ye.tasks,ft);return Yt?(u(Yt,He,T),!0):!1}catch{return!1}},[T,u]);h.useEffect(()=>{const ft=S.sessionId;if(ft)return d==null||d(ft,R,_),()=>{d==null||d(ft,[],_)}},[R,S.sessionId,d,_]);const G=h.useRef(M);G.current=M;const I=h.useRef(!1),Y=h.useCallback(async ft=>{S.sessionId&&await T.reloadSession(ft)},[T,S.sessionId]),U=((et=S.capabilities)==null?void 0:et.features.includes(See))===!0,P=h.useRef(null),{followupState:F,onAcceptFollowup:te,onDismissFollowup:W,clear:K}=uee({onAccept:ft=>{var He;(He=P.current)==null||He.insertText(ft)}}),ce=h.useCallback((ft,He)=>{o?o(ft,He):console.error(He,ft)},[o]),ie=h.useRef(l);ie.current=l;const Z=h.useCallback(ft=>D.dispatch([{type:"status",text:ft}]),[D]),ee=h.useMemo(()=>UN(j),[j]),oe=kR(ee),we=ee&&!oe?ee:null,pe=ee&&oe?ee:null,he=h.useRef(we);he.current=we;const X=we!==null||pe!==null,ye=S.sessionId&&S.workspaceCwd&&(!t||t===S.workspaceCwd)?S.workspaceCwd:void 0,Ce=h.useMemo(()=>Rhe({capabilities:C.capabilities,intendedCwd:ye,sessionId:S.sessionId,workspaces:v}),[S.sessionId,ye,v,C.capabilities]),ae=h.useMemo(()=>({user:w,workspace:Ce?y[Ce.workspaceKey]??0:0}),[Ce,w,y]),me=M!=="idle",We=h.useMemo(()=>fO(E,R,S.workspaceCwd||""),[E,R,S.workspaceCwd]),Oe=h.useMemo(()=>mO(E,We,S.workspaceCwd||""),[E,We,S.workspaceCwd]),Mt=h.useMemo(()=>Ife(E),[E]),$t=h.useMemo(()=>new Set(f??khe),[f]),{queuedPrompts:St,queuedTexts:ue,enqueuePrompt:Ee,removeQueuedPrompt:tt,insertQueuedPrompt:ut,editQueuedPrompt:Ct,editLastQueuedPrompt:Ze,clearQueuedPrompts:Et}=bfe({connected:S.status==="connected",sessionId:S.sessionId,clientId:S.clientId,streamingState:M,sessionActions:T,store:D,editorRef:P,reportError:ce,notifySuccess:Z,t:x}),Nt=h.useMemo(()=>{if(me)for(let ft=E.length-1;ft>=0;ft--){const He=E[ft];if((He==null?void 0:He.role)==="user")return He.timestamp}},[E,me]),gt=h.useCallback((ft,He,Ye,Yt)=>{const Cn=ft.trim();if(!Cn)return!1;if(xfe(ft,ie.current,ce))return!0;if(vfe({connectionStatus:S.status,hasSession:!!S.sessionId,restartSseOnPrompt:m}))return!1;const Tn=Yt==null?void 0:Yt.inputAnnotations;return G.current==="idle"?(T.sendPrompt(Cn,{...He&&He.length?{images:He}:{},...Tn?{inputAnnotations:Tn}:{},onAdmitted:()=>{!I.current&&g&&(I.current=!0,g(Cn)),K(),Ye==null||Ye()}}).catch(zr=>ce(zr,"Failed to send prompt")),!1):Tn?Ee(Cn,He,void 0,Tn):Ee(Cn,He)},[T,K,S.sessionId,S.status,Ee,g,ce,m]),Je=h.useCallback((ft,He,Ye)=>{T.submitPermission(ft,He,Ye).catch(Yt=>ce(Yt,"Failed to submit permission choice"))},[T,ce]),Ae=h.useCallback((ft,He,Ye)=>T.submitPermission(ft,He,Ye),[T]),de=h.useCallback(()=>{T.cancel().catch(ft=>ce(ft,"Failed to cancel request"))},[T,ce]),nt=h.useCallback(ft=>{if(c){if(ft.kind==="subagent"){c({...ft,sourceSessionId:S.sessionId});return}c({...ft,workspaceActions:_,sourceSessionId:S.sessionId})}},[S.sessionId,c,_]),ve=h.useMemo(()=>Sfe(Cfe(S.commands??[],kfe(x)),x).map(ft=>{const He=_fe(ft.name);return He?{...ft,displayCategory:"skill",description:x(He)}:ft}),[S.commands,x]),Ke=h.useMemo(()=>(S.models??[]).filter(yx).map(ft=>({id:ft.id,label:lp(ft.label||ft.id)})),[S.models]),le=h.useCallback(ft=>{if(!O3(ft)){ce(new Error(`Unsupported approval mode: ${ft}`),"Failed to set approval mode");return}T.setApprovalMode(ft).then(()=>{const He=he.current;if(!He||!(ft==="yolo"||ft==="auto-edit"&&He.toolKind==="edit"))return;const Yt=He.options.find(Cn=>Cn.kind==="allow_once");Yt&&T.submitPermission(He.id,Yt.id).catch(Cn=>ce(Cn,"Failed to auto-approve tool call"))}).catch(He=>ce(He,"Failed to set approval mode"))},[T,ce]),Le=h.useCallback(ft=>{T.setModel(ft).catch(He=>ce(He,"Failed to switch model"))},[T,ce]),dt=e||S.displayName||((bt=S.sessionId)==null?void 0:bt.slice(0,8))||"",Fe=t??S.workspaceCwd,Ge=cO(C.capabilities)&&!!Fe,un=h.useMemo(()=>Ge?[...dY,"workspace"]:dY,[Ge]),Wn=S.sessionId&&n?n({sessionId:S.sessionId,workspaceCwd:Fe||void 0}):null,Me=Ge&&Fe?Q6(Fe,(rn=C.capabilities)==null?void 0:rn.workspaces):void 0,yt=Ge?Xkt(Fe,C.capabilities):void 0,cn=yt?rO[yt]:void 0;return a.jsxs("section",{className:`${mo.pane} ${p?mo.paneEmbedded:""}`.trim(),"data-testid":"chat-pane","aria-label":dt,children:[!p&&a.jsxs("header",{className:`${mo.header} ${cn??""}`.trim(),children:[Me&&a.jsxs("span",{role:"img",className:mo.workspaceTag,title:Fe,"aria-label":x("workspace.paneLabel",{name:Me}),"data-web-shell-pane-workspace":!0,children:[a.jsx("span",{className:mo.workspaceTagDot,"aria-hidden":"true"}),a.jsx("span",{className:mo.workspaceTagText,children:Me})]}),a.jsx("span",{className:mo.title,title:dt,children:dt}),a.jsx(CCt,{trailing:s||r?a.jsxs(a.Fragment,{children:[s&&a.jsx("button",{type:"button",className:mo.maximizeButton,onClick:s,"aria-pressed":i,"aria-label":x(i?"splitView.restorePane":"splitView.maximizePane"),title:x(i?"splitView.restorePane":"splitView.maximizePane"),children:i?a.jsx(yee,{size:16,"aria-hidden":!0}):a.jsx(bee,{size:16,"aria-hidden":!0})}),r&&a.jsx("button",{type:"button",className:mo.closeButton,onClick:r,"aria-label":x("splitView.closePane"),title:x("splitView.closePane"),"data-testid":"pane-close",children:a.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:a.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}):null,children:Wn})]}),S.error&&a.jsx("div",{className:mo.connectionError,role:"alert",children:a.jsxs("span",{className:mo.connectionErrorText,children:[x("splitView.paneConnectionError"),": ",S.error]})}),a.jsx("div",{className:mo.body,children:a.jsx(ECt,{enabled:N,onOpen:z,children:a.jsx(the,{onOpen:$,children:a.jsx(JP,{messages:E,pendingApproval:we,loadingTranscript:S.loadingTranscript,catchingUp:S.catchingUp,hasOlderHistory:L.hasMore,loadingOlderHistory:L.loading,historyCapacityReached:L.capacityReached,historyPaginationError:L.paginationError,onLoadOlderHistory:L.loadMore,transcriptBlockCount:j.length,transcriptActivity:D,onReloadTranscript:U?Y:void 0,isResponding:me,workspaceCwd:S.workspaceCwd||"",hideSessionTimeline:!0,turnFileChanges:$t.has("file")?Oe:void 0,turnArtifacts:$t.has("artifact")?We:void 0,turnScheduledTasks:$t.has("scheduled_task")?Mt:void 0,onTurnOutputOpen:nt,generateContent:(qn=S.capabilities)!=null&&qn.features.includes("session_generation")?T.generateSessionContent:void 0})})})}),a.jsxs("div",{className:mo.footer,children:[we&&a.jsx("div",{className:mo.approval,"data-testid":"pane-approval",children:a.jsx(Efe,{request:we,onConfirm:Je,variant:"floating",keyboardActive:!1})}),pe&&a.jsx("div",{className:mo.approval,"data-testid":"pane-approval",children:a.jsx(Afe,{request:pe,onConfirm:Ae,onError:ce,variant:"floating",keyboardActive:!1})}),a.jsx(Whe,{startedAt:Nt,showPhrase:!1}),a.jsx(Tfe,{prompts:St,t:x,onDelete:tt,onInsert:ut,onEdit:Ct}),a.jsx(Uhe,{ref:P,onSubmit:gt,onCancel:de,isRunning:me,commands:ve,queuedMessages:ue,onPopQueuedMessages:Ze,onClearQueuedMessages:Et,visibleToolbarActions:un,workspaceName:Ge?Me:void 0,workspaceTitle:Fe,workspaceColor:yt,currentMode:S.currentMode??"default",currentModel:S.currentModel??"",availableModels:Ke,onSelectMode:le,onSelectModel:Le,dialogOpen:X,disabled:X,voiceTarget:b?void 0:Ce,voiceStatusRevision:ae,followupState:F,onAcceptFollowup:te,onDismissFollowup:W,sessionId:S.sessionId,atWorkspaceCwd:Fe,placeholderText:x("splitView.composerPlaceholder")}),k&&a.jsx(k,{disabled:X,isRunning:me,currentMode:S.currentMode??"default",currentModel:S.currentModel??"",sessionName:S.displayName})]})]})}const ACt="_split_99j2q_1",jCt="_toolbar_99j2q_9",NCt="_backButton_99j2q_18",ICt="_title_99j2q_35",MCt="_count_99j2q_40",RCt="_addWrap_99j2q_45",DCt="_addButton_99j2q_50",LCt="_picker_99j2q_70",PCt="_pickerItem_99j2q_87",OCt="_pickerItemLabel_99j2q_102",$Ct="_pickerItemWorkspace_99j2q_112",BCt="_panes_99j2q_131",zCt="_paneSlot_99j2q_140",FCt="_empty_99j2q_153",qCt="_paneError_99j2q_162",HCt="_paneErrorTitle_99j2q_175",UCt="_paneErrorMessage_99j2q_180",WCt="_paneErrorClose_99j2q_185",ja={split:ACt,toolbar:jCt,backButton:NCt,title:ICt,count:MCt,addWrap:RCt,addButton:DCt,picker:LCt,pickerItem:PCt,pickerItemLabel:OCt,pickerItemWorkspace:$Ct,panes:BCt,paneSlot:zCt,empty:FCt,paneError:qCt,paneErrorTitle:HCt,paneErrorMessage:UCt,paneErrorClose:WCt},l7=Cp;function VCt({sessionIds:e,onPanesChange:t,onExit:n,onError:r,onSlashCommand:s,onRightPanelOpen:i,onOpenMonitor:o,onPaneArtifactsChange:l,messageTurnOutputs:c,renderPaneHeaderActions:u,sessionListReloadToken:d,includeOtherWorkspaces:f=!0,workspaceCwd:m,restartSseOnPrompt:p,historyPageSize:g=eD,voiceUserRevision:b=0,voiceWorkspaceRevisions:w={},voiceWorkspaces:y}){var pe,he;const{t:v}=rt(),x=qa(),k=x.sessionId,S=((he=(pe=x.capabilities)==null?void 0:pe.features)==null?void 0:he.includes(Z9))??!1,{sessions:T,reload:_}=G_(m,{autoLoad:!0,pageSize:nh,archiveState:"active",...S?{view:"organized",group:"all"}:{}}),{sessions:C,reload:j}=afe(f&&!m),E=h.useMemo(()=>ofe(T,C),[T,C]),L=!m&&f&&cO(x.capabilities),D=!!m||L,M=e!==void 0,R=h.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,l7),[e]),[$,B]=h.useState(()=>R.length>0?R:k?[k]:[]),[N,z]=h.useState(!1),[G,I]=h.useState(null),Y=h.useRef(null),[U]=h.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));h.useEffect(()=>{M&&B(X=>X.length===R.length&&X.every((ye,Ce)=>ye===R[Ce])?X:R)},[R,M]);const P=h.useRef($);P.current=$,h.useEffect(()=>{if(!N)return;const X=Ce=>{var ae;(ae=Y.current)!=null&&ae.contains(Ce.target)||z(!1)},ye=Ce=>{Ce.key==="Escape"&&z(!1)};return document.addEventListener("mousedown",X),document.addEventListener("keydown",ye),()=>{document.removeEventListener("mousedown",X),document.removeEventListener("keydown",ye)}},[N]),h.useEffect(()=>{N&&(_(),j())},[N,_,j]);const F=h.useRef(d);h.useEffect(()=>{d!==void 0&&d!==F.current&&(F.current=d,_(),j())},[d,_,j]);const te=h.useMemo(()=>{var ye;const X=new Map;for(const Ce of E)X.set(Ce.sessionId,((ye=Ce.displayName)==null?void 0:ye.trim())||Ce.sessionId.slice(0,8));return X},[E]),W=h.useMemo(()=>{const X=new Map;for(const ye of E)X.set(ye.sessionId,ye.workspaceCwd);return k&&x.workspaceCwd&&!X.has(k)&&X.set(k,x.workspaceCwd),X},[E,k,x.workspaceCwd]),K=h.useCallback(X=>{const ye=P.current;if(ye.includes(X)||ye.length>=l7){z(!1);return}const Ce=[...ye,X];I(null),M?t==null||t(Ce):B(Ce),z(!1)},[t,M]),ce=h.useRef(!1);h.useEffect(()=>{$.length>0?ce.current=!0:ce.current&&n()},[$,n]),h.useEffect(()=>{M||t==null||t($)},[$,t,M]);const ie=h.useCallback(X=>{const ye=P.current;if(!ye.includes(X))return;const Ce=ye.filter(ae=>ae!==X);M?t==null||t(Ce):B(Ce)},[t,M]),Z=h.useCallback(X=>{I(ye=>ye===X?null:X)},[]);h.useEffect(()=>{G&&($.length<2||!$.includes(G))&&I(null)},[$,G]),h.useEffect(()=>{if(!G)return;const X=ye=>{ye.key!=="Escape"||ye.defaultPrevented||N||Qg(ye.target)||I(null)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[G,N]);const ee=h.useMemo(()=>E.filter(X=>!$.includes(X.sessionId)),[E,$]),oe=$.length<l7&&ee.length>0,we=$.length>1;return a.jsxs("div",{className:ja.split,"data-testid":"split-view",children:[a.jsxs("header",{className:ja.toolbar,children:[a.jsx("button",{type:"button",className:ja.backButton,onClick:n,"aria-label":v("common.back"),title:v("common.back"),children:a.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:a.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("span",{className:ja.title,children:v("splitView.title")}),a.jsx("span",{className:ja.count,children:v("splitView.count",{count:$.length})}),a.jsxs("div",{className:ja.addWrap,ref:Y,children:[a.jsxs("button",{type:"button",className:ja.addButton,disabled:!oe,"aria-haspopup":"listbox","aria-expanded":N,onClick:()=>z(X=>!X),children:["+ ",v("splitView.addPane")]}),N&&ee.length>0&&a.jsx("ul",{className:ja.picker,role:"listbox",children:ee.map(X=>{var ye;return a.jsx("li",{role:"option","aria-selected":"false",children:a.jsxs("button",{type:"button",className:ja.pickerItem,onClick:()=>K(X.sessionId),children:[a.jsx("span",{className:ja.pickerItemLabel,children:te.get(X.sessionId)??X.sessionId.slice(0,8)}),L&&a.jsx("span",{className:ja.pickerItemWorkspace,title:X.workspaceCwd,children:Q6(X.workspaceCwd,(ye=x.capabilities)==null?void 0:ye.workspaces)})]})},X.sessionId)})})]})]}),a.jsx("div",{className:ja.panes,children:$.length===0?a.jsx("div",{className:ja.empty,children:v("splitView.empty")}):$.map(X=>{const ye=W.get(X),Ce=G===X,ae=G!==null&&!Ce;return a.jsx("div",{className:ja.paneSlot,"data-pane-hidden":ae?"":void 0,children:a.jsx(Uf,{label:`split-pane:${X}`,resetKeys:[X],fallback:me=>a.jsxs("div",{className:ja.paneError,role:"alert",children:[a.jsx("div",{className:ja.paneErrorTitle,children:te.get(X)??X.slice(0,8)}),a.jsxs("div",{className:ja.paneErrorMessage,children:[v("splitView.paneError"),": ",me.message]}),a.jsx("button",{type:"button",className:ja.paneErrorClose,onClick:()=>ie(X),children:v("splitView.closePane")})]}),children:a.jsx(l5,{sessionId:X,workspaceCwd:D?ye??m:void 0,clientId:`split-pane:${U}:${X}`,historyPageSize:g,subagentTranscriptMode:"summary",maxBlocks:tD,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:p,children:a.jsx(Ffe,{title:te.get(X),workspaceCwd:ye,renderHeaderActions:u,hidden:ae,voiceUserRevision:b,voiceWorkspaceRevisions:w,voiceWorkspaces:y,onClose:()=>ie(X),onToggleMaximize:we?()=>Z(X):void 0,isMaximized:Ce,onError:r,onSlashCommand:s,onRightPanelOpen:i,onOpenMonitor:o,onPaneArtifactsChange:l,messageTurnOutputs:c,restartSseOnPrompt:p})})})},D?`${X}:${ye??""}`:X)})})]})}const GCt="_root_1l1wz_1",KCt="_intro_1l1wz_8",YCt="_toolbar_1l1wz_14",XCt="_count_1l1wz_22",QCt="_toolbarActions_1l1wz_28",JCt="_primaryButton_1l1wz_34",ZCt="_secondaryButton_1l1wz_35",e4t="_formFields_1l1wz_73",t4t="_field_1l1wz_79",n4t="_fieldGrow_1l1wz_86",r4t="_fieldLabel_1l1wz_90",s4t="_required_1l1wz_96",i4t="_input_1l1wz_107",o4t="_textarea_1l1wz_108",a4t="_select_1l1wz_109",l4t="_promptEditorWrap_1l1wz_127",c4t="_promptEditor_1l1wz_127",u4t="_promptPlaceholder_1l1wz_160",d4t="_promptTag_1l1wz_174",h4t="_promptTagIcon_1l1wz_190",f4t="_promptTagValue_1l1wz_201",m4t="_promptTagRemove_1l1wz_211",p4t="_referencePopover_1l1wz_239",g4t="_referenceBar_1l1wz_243",b4t="_referenceButton_1l1wz_250",y4t="_referenceButtonActive_1l1wz_267",v4t="_referenceButtonIcon_1l1wz_272",w4t="_referencePicker_1l1wz_282",x4t="_referenceItem_1l1wz_295",k4t="_referenceItemLabel_1l1wz_318",_4t="_referenceItemDescription_1l1wz_319",S4t="_referenceEmpty_1l1wz_336",C4t="_referenceError_1l1wz_337",T4t="_scheduleRow_1l1wz_347",E4t="_preview_1l1wz_359",A4t="_previewLabel_1l1wz_367",j4t="_previewCron_1l1wz_372",N4t="_previewInvalid_1l1wz_382",I4t="_formError_1l1wz_387",M4t="_loadError_1l1wz_388",R4t="_formActions_1l1wz_394",D4t="_empty_1l1wz_402",L4t="_list_1l1wz_409",P4t="_card_1l1wz_417",O4t="_cardDisabled_1l1wz_428",$4t="_cardHeader_1l1wz_432",B4t="_cardTitle_1l1wz_438",z4t="_cardMenu_1l1wz_449",F4t="_iconAction_1l1wz_456",q4t="_toggle_1l1wz_482",H4t="_toggleOn_1l1wz_501",U4t="_toggleKnob_1l1wz_505",W4t="_cardPrompt_1l1wz_520",V4t="_cardFooter_1l1wz_533",G4t="_schedulePill_1l1wz_542",K4t="_clockIcon_1l1wz_554",Y4t="_recurringTag_1l1wz_559",X4t="_workspacePill_1l1wz_567",Q4t="_workspaceIcon_1l1wz_584",J4t="_countdown_1l1wz_589",Z4t="_hourglassIcon_1l1wz_600",eTt="_lastFired_1l1wz_605",tTt="_runsToggle_1l1wz_613",nTt="_runsList_1l1wz_630",rTt="_runsItem_1l1wz_644",st={root:GCt,intro:KCt,toolbar:YCt,count:XCt,toolbarActions:QCt,primaryButton:JCt,secondaryButton:ZCt,formFields:e4t,field:t4t,fieldGrow:n4t,fieldLabel:r4t,required:s4t,input:i4t,textarea:o4t,select:a4t,promptEditorWrap:l4t,promptEditor:c4t,promptPlaceholder:u4t,promptTag:d4t,promptTagIcon:h4t,promptTagValue:f4t,promptTagRemove:m4t,referencePopover:p4t,referenceBar:g4t,referenceButton:b4t,referenceButtonActive:y4t,referenceButtonIcon:v4t,referencePicker:w4t,referenceItem:x4t,referenceItemLabel:k4t,referenceItemDescription:_4t,referenceEmpty:S4t,referenceError:C4t,scheduleRow:T4t,preview:E4t,previewLabel:A4t,previewCron:j4t,previewInvalid:N4t,formError:I4t,loadError:M4t,formActions:R4t,empty:D4t,list:L4t,card:P4t,cardDisabled:O4t,cardHeader:$4t,cardTitle:B4t,cardMenu:z4t,iconAction:F4t,toggle:q4t,toggleOn:H4t,toggleKnob:U4t,cardPrompt:W4t,cardFooter:V4t,schedulePill:G4t,clockIcon:K4t,recurringTag:Y4t,workspacePill:X4t,workspaceIcon:Q4t,countdown:J4t,hourglassIcon:Z4t,lastFired:eTt,runsToggle:tTt,runsList:nTt,runsItem:rTt},sTt="_panel_1w613_1",iTt="_panelDrawer_1w613_11",oTt="_header_1w613_18",aTt="_tabs_1w613_38",lTt="_tabItem_1w613_47",cTt="_tab_1w613_38",uTt="_tabTitle_1w613_75",dTt="_tabIcon_1w613_82",hTt="_tabIconSvg_1w613_92",fTt="_tabActive_1w613_99",mTt="_tabCloseButton_1w613_114",pTt="_tabCloseIcon_1w613_144",gTt="_iconButton_1w613_150",bTt="_iconButtonActive_1w613_169",yTt="_headerActions_1w613_173",vTt="_addButton_1w613_184",wTt="_panelToggleButton_1w613_188",xTt="_panelToggleIcon_1w613_200",kTt="_toolbarIcon_1w613_206",_Tt="_body_1w613_212",STt="_bodySideTask_1w613_219",CTt="_empty_1w613_224",TTt="_emptyActions_1w613_230",ETt="_emptyAction_1w613_230",ATt="_emptyActionIcon_1w613_264",jTt="_emptyActionTitle_1w613_278",NTt="_emptyActionHint_1w613_282",ITt="_emptyActionChevron_1w613_292",MTt="_sideTaskListTitle_1w613_299",RTt="_sideTaskListTime_1w613_307",DTt="_sideTaskNewIcon_1w613_315",LTt="_meta_1w613_352",PTt="_detail_1w613_357",OTt="_section_1w613_362",$Tt="_sectionTitle_1w613_367",BTt="_description_1w613_374",zTt="_actionsRow_1w613_378",FTt="_fieldGrid_1w613_385",qTt="_fieldLabel_1w613_392",HTt="_fieldValue_1w613_401",UTt="_link_1w613_406",WTt="_review_1w613_415",VTt="_reviewToolbar_1w613_422",GTt="_reviewToolbarTitle_1w613_431",KTt="_reviewToolbarActions_1w613_438",YTt="_reviewTotalsButton_1w613_444",XTt="_reviewContent_1w613_462",QTt="_reviewContentListOnly_1w613_472",JTt="_reviewContentStacked_1w613_476",ZTt="_reviewList_1w613_481",e3t="_reviewListWithExpanded_1w613_489",t3t="_reviewSplitHandle_1w613_502",n3t="_reviewItem_1w613_517",r3t="_reviewItemExpanded_1w613_522",s3t="_reviewRow_1w613_529",i3t="_reviewRowToggle_1w613_551",o3t="_reviewFileName_1w613_572",a3t="_reviewOpenButton_1w613_579",l3t="_fileIcon_1w613_597",c3t="_reviewPath_1w613_611",u3t="_treeName_1w613_612",d3t="_pathPrefix_1w613_628",h3t="_pathFileName_1w613_634",f3t="_lineStats_1w613_642",m3t="_additions_1w613_651",p3t="_deletions_1w613_655",g3t="_chevron_1w613_659",b3t="_chevronOpen_1w613_665",y3t="_chevronIcon_1w613_669",v3t="_diffPreview_1w613_675",w3t="_codeMirrorDiff_1w613_685",x3t="_codeMirrorDiffWrap_1w613_693",k3t="_diffError_1w613_701",_3t="_codeMirrorFile_1w613_726",S3t="_diffEmpty_1w613_792",C3t="_tree_1w613_612",T3t="_treeNode_1w613_805",E3t="_treeChildren_1w613_809",A3t="_treeRow_1w613_823",j3t="_treeFolder_1w613_856",N3t="_treeFile_1w613_860",I3t="_treeTwisty_1w613_869",M3t="_treeChevronIcon_1w613_878",R3t="_treeChevron_1w613_878",D3t="_treeChevronClosed_1w613_889",L3t="_treeContent_1w613_893",P3t="_reviewBadge_1w613_916",O3t="_htmlPreviewWrap_1w613_929",$3t="_markdownPreviewWrap_1w613_935",B3t="_imagePreviewWrap_1w613_941",z3t="_imagePreview_1w613_941",F3t="_imageDownloadButton_1w613_957",q3t="_htmlPreview_1w613_929",H3t="_previewError_1w613_999",U3t="_filePreviewWrap_1w613_1005",qe={panel:sTt,panelDrawer:iTt,header:oTt,tabs:aTt,tabItem:lTt,tab:cTt,tabTitle:uTt,tabIcon:dTt,tabIconSvg:hTt,tabActive:fTt,tabCloseButton:mTt,tabCloseIcon:pTt,iconButton:gTt,iconButtonActive:bTt,headerActions:yTt,addButton:vTt,panelToggleButton:wTt,panelToggleIcon:xTt,toolbarIcon:kTt,body:_Tt,bodySideTask:STt,empty:CTt,emptyActions:TTt,emptyAction:ETt,emptyActionIcon:ATt,emptyActionTitle:jTt,emptyActionHint:NTt,emptyActionChevron:ITt,sideTaskListTitle:MTt,sideTaskListTime:RTt,sideTaskNewIcon:DTt,meta:LTt,detail:PTt,section:OTt,sectionTitle:$Tt,description:BTt,actionsRow:zTt,fieldGrid:FTt,fieldLabel:qTt,fieldValue:HTt,link:UTt,review:WTt,reviewToolbar:VTt,reviewToolbarTitle:GTt,reviewToolbarActions:KTt,reviewTotalsButton:YTt,reviewContent:XTt,reviewContentListOnly:QTt,reviewContentStacked:JTt,reviewList:ZTt,reviewListWithExpanded:e3t,reviewSplitHandle:t3t,reviewItem:n3t,reviewItemExpanded:r3t,reviewRow:s3t,reviewRowToggle:i3t,reviewFileName:o3t,reviewOpenButton:a3t,fileIcon:l3t,reviewPath:c3t,treeName:u3t,pathPrefix:d3t,pathFileName:h3t,lineStats:f3t,additions:m3t,deletions:p3t,chevron:g3t,chevronOpen:b3t,chevronIcon:y3t,diffPreview:v3t,codeMirrorDiff:w3t,codeMirrorDiffWrap:x3t,diffError:k3t,codeMirrorFile:_3t,diffEmpty:S3t,tree:C3t,treeNode:T3t,treeChildren:E3t,treeRow:A3t,treeFolder:j3t,treeFile:N3t,treeTwisty:I3t,treeChevronIcon:M3t,treeChevron:R3t,treeChevronClosed:D3t,treeContent:L3t,reviewBadge:P3t,htmlPreviewWrap:O3t,markdownPreviewWrap:$3t,imagePreviewWrap:B3t,imagePreview:z3t,imageDownloadButton:F3t,htmlPreview:q3t,previewError:H3t,filePreviewWrap:U3t},W3t="_detail_56y5v_1",V3t="_state_56y5v_7",G3t="_overview_56y5v_15",K3t="_descriptionRow_56y5v_23",Y3t="_statusTag_56y5v_31",X3t="_statusActions_56y5v_36",Q3t="_stopButton_56y5v_43",J3t="_stopError_56y5v_65",Z3t="_description_56y5v_23",e5t="_prompt_56y5v_112",t5t="_transcript_56y5v_124",n5t="_retry_56y5v_133",Lc={detail:W3t,state:V3t,overview:G3t,descriptionRow:K3t,statusTag:Y3t,statusActions:X3t,stopButton:Q3t,stopError:J3t,description:Z3t,prompt:e5t,transcript:t5t,retry:n5t};function r5t(e,t){const n=typeof e.rawOutput=="object"&&e.rawOutput!==null?e.rawOutput:void 0,r=typeof(n==null?void 0:n.executionSummary)=="object"&&n.executionSummary!==null?n.executionSummary:void 0,s=r==null?void 0:r.totalDurationMs,i=r==null?void 0:r.inputTokens,o=r==null?void 0:r.outputTokens,l=r==null?void 0:r.cachedTokens;return{status:t.status,durationMs:typeof s=="number"?s:e.endTime&&e.startTime?Math.max(0,e.endTime-e.startTime):t.durationMs,inputTokens:typeof i=="number"?i:t.inputTokens,outputTokens:typeof o=="number"?o:t.outputTokens,cachedTokens:typeof l=="number"?l:t.cachedTokens}}function hY(){return`subagent-detail:${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)}`}function s5t(e,t){for(const n of e){if(n.role!=="tool_group")continue;const r=n.tools.find(s=>s.callId===t);if(r)return r}}function i5t(e,t){var r;const n=e.find(s=>s.role==="user");return((n==null?void 0:n.role)==="user"?n.content:"")||(typeof((r=t.args)==null?void 0:r.prompt)=="string"?t.args.prompt:"")}function o5t(e,t){switch(e){case"completed":case"success":return t("subagent.completed");case"failed":case"error":return t("subagent.failed");case"cancelled":case"canceled":return t("subagent.cancelled");case"paused":return t("subagent.paused");default:return t("subagent.running")}}function a5t({rootTool:e,resolution:t,onStop:n,onRightPanelOpen:r,onArtifactsChange:s}){const{t:i}=rt(),o=qa(),l=ga(),c=pfe(i),{artifacts:u}=hO(),d=h.useMemo(()=>fO(c,u,o.workspaceCwd||""),[u,o.workspaceCwd,c]),f=h.useMemo(()=>mO(c,d,o.workspaceCwd||""),[d,o.workspaceCwd,c]),m=q6(e),p=i5t(c,e),g=h.useMemo(()=>r5t(e,t),[t,e]),b=g.status==="running"||g.status==="in_progress",[w,y]=h.useState(!1),[v,x]=h.useState("");h.useEffect(()=>{const T=o.sessionId;if(T)return s==null||s(T,u,l),()=>{s==null||s(T,[],l)}},[u,o.sessionId,s,l]);const k=T=>{if(T.kind==="subagent"){r==null||r({...T,sourceSessionId:o.sessionId});return}r==null||r({...T,workspaceActions:l,sourceSessionId:o.sessionId})};h.useEffect(()=>{b||(y(!1),x(""))},[b]);const S=async()=>{if(!w){y(!0),x("");try{(await n()).cancelled||y(!1)}catch{y(!1),x(i("tasks.cancelFailed"))}}};return a.jsxs("div",{className:Lc.detail,children:[a.jsxs("div",{className:Lc.overview,children:[a.jsxs("div",{className:Lc.descriptionRow,children:[m&&a.jsx("div",{className:Lc.description,children:m}),a.jsxs("div",{className:Lc.statusActions,children:[a.jsx(Ai,{variant:"outline",className:Lc.statusTag,"data-status":g.status,children:o5t(g.status,i)}),b&&a.jsx("button",{type:"button",className:Lc.stopButton,disabled:w,onClick:()=>void S(),children:i(w?"common.loading":"tasks.action.stop")})]})]}),v&&a.jsx("div",{className:Lc.stopError,children:v}),p&&a.jsx("pre",{className:Lc.prompt,children:p})]}),a.jsx("div",{className:Lc.transcript,children:a.jsx(JP,{messages:c,pendingApproval:null,loadingTranscript:o.loadingTranscript,isResponding:b,workspaceCwd:o.workspaceCwd||"",hideSessionTimeline:!0,hideFirstUserMessage:!0,firstTurnMetrics:g,includeSubagentToolUsageInMetrics:!1,turnFileChanges:f,turnArtifacts:d,onTurnOutputOpen:k})})]})}function l5t({sessionId:e,rootToolCallId:t,initialRootTool:n,workspaceCwd:r,onRightPanelOpen:s,onArtifactsChange:i}){const{t:o}=rt(),l=yo(),c=qa(),u=pfe(o),d=(c.sessionId===e?s5t(u,t):void 0)??n,[f,m]=h.useState(()=>({key:0,clientId:hY()})),[p,g]=h.useState(),[b,w]=h.useState(!1);return h.useEffect(()=>{let y=!1,v=!1,x=0,k;g(void 0),w(!1);const S=async()=>{try{const T=await l.client.resolveSubagentSession(e,t);if(y)return;v=!0,g(T),T.status==="running"&&(k=setTimeout(()=>void S(),3e3))}catch{if(y)return;!v&&x<3?(x+=1,k=setTimeout(()=>void S(),3e3)):v?k=setTimeout(()=>void S(),3e3):w(!0)}};return S(),()=>{y=!0,k&&clearTimeout(k)}},[f.key,t,e,l.client]),b?a.jsxs("div",{className:Lc.state,children:[a.jsx("div",{children:o("subagent.detailsLoadFailed")}),a.jsx("button",{type:"button",className:Lc.retry,onClick:()=>m(y=>({key:y.key+1,clientId:hY()})),children:o("common.retry")})]}):p?a.jsx(l5,{sessionId:p.sessionId,workspaceCwd:r,clientId:f.clientId,maxQueued:256,subagentTranscriptMode:"full",suppressOwnUserEcho:!0,children:a.jsx(a5t,{rootTool:d,resolution:p,onRightPanelOpen:s,onArtifactsChange:i,onStop:()=>l.client.cancelSubagentSession(e,t)})},`${f.key}:${p.sessionId}`):a.jsx("div",{className:Lc.state,children:o("subagent.detailsLoading")})}const c5t=3;function u5t({tabId:e,sessionId:t,parentSessionId:n,workspaceCwd:r,title:s,shouldNameFromFirstPrompt:i,initialPrompt:o,createSession:l,onCreated:c,onTitleChange:u,onRightPanelOpen:d,onArtifactsChange:f,onError:m}){return t?a.jsx(l5,{sessionId:t,workspaceCwd:r,clientId:`side-task:${n}:${e}`,autoConnect:!0,historyPageSize:eD,subagentTranscriptMode:"summary",maxBlocks:tD,suppressOwnUserEcho:!0,children:a.jsx(h5t,{tabId:e,title:s,shouldNameFromFirstPrompt:i,initialPrompt:o,workspaceCwd:r,onTitleChange:u,onRightPanelOpen:d,onArtifactsChange:f,onError:m})}):a.jsx(d5t,{tabId:e,parentSessionId:n,title:s,createSession:l,onCreated:c,onTitleChange:u,onError:m})}function d5t({tabId:e,parentSessionId:t,title:n,createSession:r,onCreated:s,onTitleChange:i,onError:o}){const{t:l}=rt(),c=h.useRef(!1),u=h.useRef(!1),[d,f]=h.useState(),m=h.useCallback(async()=>{if(!c.current){c.current=!0,f(void 0);try{const p=await r(e,t,n);s(e,p.sessionId),p.displayName&&i(e,p.displayName)}catch(p){f(p),o==null||o(p,l("sideTask.createFailed"))}finally{c.current=!1}}},[r,s,o,i,t,l,e,n]);return h.useEffect(()=>{u.current||(u.current=!0,m())},[m]),d?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground",children:[a.jsx("span",{children:l("sideTask.createFailed")}),a.jsx(Zt,{type:"button",variant:"outline",onClick:()=>void m(),children:l("common.retry")})]}):a.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-sm text-muted-foreground",role:"status",children:[a.jsx(Hr,{}),a.jsx("span",{children:l("sideTask.creating")})]})}function h5t({tabId:e,title:t,shouldNameFromFirstPrompt:n,initialPrompt:r,workspaceCwd:s,onTitleChange:i,onRightPanelOpen:o,onArtifactsChange:l,onError:c}){var x;const{t:u}=rt(),d=qa(),f=nm(),m=Y9(),p=K9(),g=m.some(k=>k.kind==="user"),b=d.status==="connected"&&!d.loadingTranscript&&!d.catchingUp&&!p.loading&&!p.hasMore&&!p.capacityReached&&!p.paginationError&&!g,w=!g&&(n||b);h.useEffect(()=>{var S;const k=(S=d.displayName)==null?void 0:S.trim();k&&i(e,k)},[d.displayName,i,e]);const y=h.useCallback(k=>{const S=Array.from(k.trim()).slice(0,200).join("");S&&(i(e,S),(async()=>{let T;for(let _=0;_<c5t;_++)try{await f.renameSession(S),i(e,S,!0);return}catch(C){T=C}c==null||c(T,u("sideTask.renameFailed"))})())},[f,c,i,u,e]),v=h.useRef(!1);return h.useEffect(()=>{const k=r==null?void 0:r.trim();!k||!b||v.current||(v.current=!0,f.sendPrompt(k,{onAdmitted:()=>y(k)}).catch(S=>{v.current=!1,c==null||c(S,u("sideTask.promptFailed"))}))},[f,r,y,c,b,u]),d.sessionId?a.jsx(Ffe,{title:((x=d.displayName)==null?void 0:x.trim())||t,workspaceCwd:s,onError:c,embedded:!0,onFirstPromptAdmitted:w?y:void 0,onRightPanelOpen:o,onPaneArtifactsChange:l}):a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx(Hr,{})})}const f5t=700,m5t=["daily","weekdays","weekly","hourly","minutes","custom"],p5t=[1,2,3,4,5,6,10,12,15,20,30],g5t=(e,t)=>{},b5t=(e,t,n)=>{},y5t=()=>Promise.reject(new Error("Side-task session creation is unavailable")),v5t=["review","sideTask"];function fY({artifacts:e,tabs:t,activeTabId:n,reviewChanges:r,selectedReviewPath:s,panelWidth:i,workspaceCwd:o,loading:l,error:c,onSelectTab:u,onCloseTab:d,onOpenFilePreview:f,latestReviewAvailable:m=!1,onOpenLatestReview:p,items:g=v5t,sideTaskAvailable:b=!1,sideTasks:w=[],sideTasksLoading:y=!1,onCreateSideTask:v,onOpenSideTask:x,onCreateSideTaskSession:k,onSideTaskCreated:S,onSideTaskTitleChange:T,onNestedRightPanelOpen:_,onNestedArtifactsChange:C,onSideTaskError:j,onClose:E,variant:L="docked"}){const{t:D}=rt(),[M,R]=h.useState(!1),$=h.useRef(null),B=h.useCallback(()=>{$.current&&(clearTimeout($.current),$.current=null),R(!0)},[]),N=h.useCallback(()=>{$.current&&clearTimeout($.current),$.current=setTimeout(()=>{R(!1),$.current=null},120)},[]);h.useEffect(()=>()=>{$.current&&clearTimeout($.current)},[]);const z=t.find(F=>F.id===n)??t[0],G=g.includes("review")&&!t.some(F=>F.kind==="review"),I=g.includes("sideTask")&&b&&!!v,Y=!!z&&(G||I),U=ga(),P=z&&"workspaceActions"in z?z.workspaceActions??U:U;return a.jsxs("aside",{className:`${qe.panel} ${L==="drawer"?qe.panelDrawer:""}`,style:L==="docked"&&i?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:qe.header,children:[t.length>0&&a.jsx("div",{className:qe.tabs,role:"tablist","aria-label":"Right panel",children:t.map(F=>a.jsxs("div",{className:[qe.tabItem,F.id===(z==null?void 0:z.id)?qe.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":F.id===(z==null?void 0:z.id),className:qe.tab,onClick:()=>u(F.id),title:F.title,children:[a.jsx("span",{className:qe.tabIcon,"aria-hidden":"true",children:F.kind==="review"?a.jsx(c7,{}):F.kind==="artifact"||F.kind==="file"?a.jsx(k5t,{}):F.kind==="subagent"?a.jsx(w5t,{}):F.kind==="monitor"?a.jsx(kee,{className:qe.tabIconSvg,strokeWidth:1.6}):F.kind==="shell"?a.jsx(_ee,{className:qe.tabIconSvg,strokeWidth:1.6}):F.kind==="side_task"?a.jsx(u2,{className:qe.tabIconSvg,strokeWidth:1.6}):a.jsx(_5t,{})}),a.jsx("span",{className:qe.tabTitle,children:F.title})]}),a.jsx("button",{type:"button",className:qe.tabCloseButton,onClick:()=>d(F.id),"aria-label":`Close ${F.title}`,title:"Close",children:a.jsx(x5t,{})})]},F.id))}),a.jsxs("div",{className:qe.headerActions,children:[Y&&a.jsxs(Mu,{modal:!1,children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{type:"button",className:`${qe.iconButton} ${qe.addButton}`,"aria-label":D("rightPanel.add"),title:D("rightPanel.add"),children:a.jsx(Wf,{className:qe.toolbarIcon})})}),a.jsxs(Du,{align:"end",className:"w-64",children:[G&&a.jsxs(bi,{disabled:!m||!p,onSelect:p,children:[a.jsx(c7,{}),a.jsx("span",{className:qe.sideTaskListTitle,children:D("turnOutputs.review")})]}),G&&I&&a.jsx(L3,{}),I&&a.jsxs(bi,{disabled:y,onSelect:v,children:[a.jsx(u2,{className:qe.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:qe.sideTaskListTitle,children:D("sideTask.create")})]})]})]}),a.jsx("button",{type:"button",className:`${qe.iconButton} ${qe.panelToggleButton}`,onClick:E,"aria-label":D("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:D("chatHeader.toggleRightPanel"),children:a.jsx(vee,{className:qe.panelToggleIcon})})]})]}),a.jsx("div",{className:`${qe.body} ${(z==null?void 0:z.kind)==="side_task"?qe.bodySideTask:""}`.trim(),children:z?z.kind==="review"?a.jsx(T5t,{changes:z.changes??r,selectedPath:z.selectedPath??s,workspaceCwd:z.workspaceCwd??o,onOpenFilePreview:F=>f(F,P,z.workspaceCwd??o)}):z.kind==="file"?a.jsx(Vfe,{workspacePath:z.workspacePath,workspaceActions:P,previewContent:z.previewContent},z.id):z.kind==="artifact"?a.jsx(S5t,{artifacts:e,artifactId:z.artifactId,workspaceActions:P,previewContent:z.previewContent,loading:l,error:c},z.id):z.kind==="subagent"?a.jsx(l5t,{sessionId:z.sessionId,rootToolCallId:z.rootToolCallId,initialRootTool:z.rootTool,workspaceCwd:z.workspaceCwd??o,onRightPanelOpen:_,onArtifactsChange:C}):z.kind==="monitor"?a.jsx(vet,{task:z.task,actions:z.sessionActions},z.id):z.kind==="shell"?a.jsx(wet,{task:z.task,actions:z.sessionActions},z.id):z.kind==="side_task"?a.jsx(u5t,{tabId:z.id,sessionId:z.sessionId,parentSessionId:z.parentSessionId,workspaceCwd:z.workspaceCwd??o,title:z.title,shouldNameFromFirstPrompt:z.nameFromFirstPrompt,initialPrompt:z.initialPrompt,createSession:k??y5t,onCreated:S??g5t,onTitleChange:T??b5t,onRightPanelOpen:_,onArtifactsChange:C,onError:j},z.id):a.jsx(C5t,{task:z.task,actions:P},z.id):a.jsxs("div",{className:qe.emptyActions,"data-testid":"right-panel-empty-actions",children:[g.includes("review")&&a.jsxs("button",{type:"button",className:qe.emptyAction,disabled:!m||!p,onClick:p,children:[a.jsx("span",{className:qe.emptyActionIcon,"aria-hidden":"true",children:a.jsx(c7,{})}),a.jsx("span",{className:qe.emptyActionTitle,children:D("turnOutputs.review")}),a.jsx("span",{className:qe.emptyActionHint,children:D("turnOutputs.reviewLatest")}),a.jsx(Eu,{className:qe.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),g.includes("sideTask")&&b&&v&&(w.length===0?a.jsxs("button",{type:"button",className:qe.emptyAction,disabled:y,"aria-busy":y,onClick:v,children:[a.jsx("span",{className:qe.emptyActionIcon,"aria-hidden":"true",children:a.jsx(u2,{strokeWidth:1.6})}),a.jsx("span",{className:qe.emptyActionTitle,children:D("sideTask.title")}),a.jsx("span",{className:qe.emptyActionHint,children:D("sideTask.description")}),a.jsx(Eu,{className:qe.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Mu,{open:M,onOpenChange:R,modal:!1,children:[a.jsx(Ru,{asChild:!0,children:a.jsxs("button",{type:"button",className:qe.emptyAction,"aria-expanded":M,onMouseEnter:B,onMouseLeave:N,children:[a.jsx("span",{className:qe.emptyActionIcon,"aria-hidden":"true",children:a.jsx(u2,{strokeWidth:1.6})}),a.jsx("span",{className:qe.emptyActionTitle,children:D("sideTask.title")}),a.jsx("span",{className:qe.emptyActionHint,children:D("sideTask.description")}),a.jsx(Eu,{className:qe.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Du,{align:"end",className:"w-80",onMouseEnter:B,onMouseLeave:N,children:[w.map(F=>a.jsxs(bi,{onSelect:()=>x==null?void 0:x(F),children:[a.jsx("span",{className:qe.sideTaskListTitle,children:F.title}),F.updatedAt&&a.jsx("span",{className:qe.sideTaskListTime,children:Uy(F.updatedAt,D)})]},F.sessionId)),a.jsx(L3,{}),a.jsxs(bi,{onSelect:v,children:[a.jsx(Nxe,{className:qe.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:qe.sideTaskListTitle,children:D("sideTask.new")})]})]})]}))]})})]})}function w5t(){return a.jsxs("svg",{className:qe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M6.5 19c.7-3.1 2.5-4.7 5.5-4.7s4.8 1.6 5.5 4.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function x5t(){return a.jsx("svg",{className:qe.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function c7(){return a.jsxs("svg",{className:qe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),a.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function k5t(){return a.jsxs("svg",{className:qe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function _5t(){return a.jsxs("svg",{className:qe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function S5t({artifacts:e,artifactId:t,workspaceActions:n,previewContent:r,loading:s,error:i}){const o=e.find(l=>l.id===t);return o?a.jsx(O5t,{artifact:o,workspaceActions:n,previewContent:r}):s?a.jsx("div",{className:qe.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:qe.empty,children:i}):a.jsx("div",{className:qe.empty,children:"Artifact not found."})}function C5t({task:e,actions:t}){const{t:n}=rt(),[r,s]=h.useState(null),[i,o]=h.useState(!0),[l,c]=h.useState(null),[u,d]=h.useState(""),[f,m]=h.useState(e.prompt),[p,g]=h.useState(()=>Lm(e.cron)),[b,w]=h.useState(!1),[y,v]=h.useState(!1),[x,k]=h.useState(!1),[S,T]=h.useState(!1),[_,C]=h.useState(null),j=h.useCallback(async()=>{if(!e.durable){s(null),d(""),m(e.prompt),g(Lm(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const W=(await t.listScheduledTasks()).find(K=>K.id===e.id)??null;s(W),W?(d(W.name??""),m(W.prompt),g(Lm(W.cron))):(d(""),m(e.prompt),g(Lm(e.cron)))}catch(te){c(te instanceof Error?te.message:String(te))}finally{o(!1)}},[t,e.cron,e.durable,e.id,e.prompt]);h.useEffect(()=>{j()},[j]);const E=!e.durable,L=e.durable&&!i&&!l&&!r,D=!!r,M=(r==null?void 0:r.name)||(r==null?void 0:r.prompt)||e.title,R=(r==null?void 0:r.prompt)??e.prompt,$=(r==null?void 0:r.cron)??e.cron,B=(r==null?void 0:r.recurring)??e.recurring,N=r==null?void 0:r.enabled,z=h.useCallback(()=>{r&&(d(r.name??""),m(r.prompt),g(Lm(r.cron)),C(null),w(!0))},[r]),G=h.useCallback(()=>{w(!1),C(null),r&&(d(r.name??""),m(r.prompt),g(Lm(r.cron)))},[r]),I=h.useCallback(async()=>{if(!r)return;const te=R3(p);if(!te){C(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){C(n("scheduledTasks.error.emptyPrompt"));return}T(!0),C(null);try{const W=await t.updateScheduledTask(r.id,{cron:te,prompt:f.trim(),name:u.trim()||null});s(W),d(W.name??""),m(W.prompt),g(Lm(W.cron)),w(!1)}catch(W){C(W instanceof Error?W.message:String(W))}finally{T(!1)}},[t,p,r,u,f,n]),Y=h.useCallback(async()=>{if(r){k(!0),C(null);try{const te=await t.updateScheduledTask(r.id,{enabled:!r.enabled});s(te)}catch(te){C(te instanceof Error?te.message:String(te))}finally{k(!1)}}},[t,r]),U=h.useCallback(async()=>{if(r){k(!0),C(null);try{await t.deleteScheduledTask(r.id),s(null),v(!1)}catch(te){C(te instanceof Error?te.message:String(te))}finally{k(!1)}}},[t,r]),P=R3(p),F=P?n_(P,n):null;return a.jsxs("div",{className:qe.detail,children:[i&&a.jsx("div",{className:qe.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:st.loadError,children:l}),L&&a.jsx("div",{className:qe.empty,children:n("scheduledTasks.deletedSnapshot")}),E&&a.jsx("div",{className:qe.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!L&&a.jsx("div",{className:qe.section,children:a.jsxs("div",{className:qe.fieldGrid,children:[a.jsx("span",{className:qe.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:qe.fieldValue,children:M}),a.jsx("span",{className:qe.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:qe.fieldValue,children:e.id}),a.jsx("span",{className:qe.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:qe.fieldValue,children:n_($,n)}),a.jsx("span",{className:qe.fieldLabel,children:"Cron"}),a.jsx("span",{className:qe.fieldValue,children:$}),a.jsx("span",{className:qe.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:qe.fieldValue,children:n(B?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),N!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:qe.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:qe.fieldValue,children:n(N?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!L&&a.jsxs("div",{className:qe.section,children:[a.jsx("div",{className:qe.sectionTitle,children:"Prompt"}),a.jsx("div",{className:qe.description,children:R})]}),_&&a.jsx("div",{className:st.formError,children:_}),a.jsxs("div",{className:qe.actionsRow,children:[a.jsx("button",{type:"button",className:st.primaryButton,disabled:!D||x,onClick:z,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:st.secondaryButton,disabled:!D||x,onClick:()=>void Y(),children:r!=null&&r.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:st.secondaryButton,disabled:!D||x,onClick:()=>v(!0),children:n("scheduledTasks.delete")})]}),y&&r&&a.jsx(zi,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>v(!1),children:a.jsxs("div",{className:st.formFields,children:[a.jsx("div",{className:qe.description,children:n("scheduledTasks.deleteConfirm",{name:r.name||r.prompt})}),_&&a.jsx("div",{className:st.formError,children:_}),a.jsxs("div",{className:st.formActions,children:[a.jsx("button",{type:"button",className:st.secondaryButton,onClick:()=>v(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:st.primaryButton,onClick:()=>void U(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),b&&a.jsx(zi,{title:n("scheduledTasks.editTitle"),size:"md",onClose:G,children:a.jsxs("div",{className:st.formFields,children:[a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:st.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:te=>d(te.target.value)})]}),a.jsxs("label",{className:st.field,children:[a.jsxs("span",{className:st.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:st.required,children:"*"})]}),a.jsx("textarea",{className:st.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:te=>m(te.target.value)})]}),a.jsxs("div",{className:st.scheduleRow,children:[a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:st.select,value:p.frequency,onChange:te=>{const W=te.target.value;g(K=>({...K,frequency:W,...W==="hourly"?{time:"00:00"}:{}}))},children:m5t.map(te=>a.jsx("option",{value:te,children:n(`scheduledTasks.freq.${te}`)},te))})]}),(p.frequency==="daily"||p.frequency==="weekdays"||p.frequency==="weekly")&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:st.input,type:"time",value:p.time,onChange:te=>g(W=>({...W,time:te.target.value}))})]}),p.frequency==="weekly"&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:st.select,value:p.weekday,onChange:te=>g(W=>({...W,weekday:Number(te.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((te,W)=>a.jsx("option",{value:W,children:te},W))})]}),p.frequency==="minutes"&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:st.select,value:p.minuteInterval,onChange:te=>g(W=>({...W,minuteInterval:Number(te.target.value)})),children:p5t.map(te=>a.jsx("option",{value:te,children:te},te))})]}),p.frequency==="custom"&&a.jsxs("label",{className:`${st.field} ${st.fieldGrow}`,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:st.input,type:"text",value:p.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:te=>g(W=>({...W,customCron:te.target.value}))})]})]}),a.jsx("div",{className:st.preview,children:F?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:st.previewLabel,children:F}),a.jsx("code",{className:st.previewCron,children:P})]}):a.jsx("span",{className:st.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),_&&a.jsx("div",{className:st.formError,children:_}),a.jsxs("div",{className:st.formActions,children:[a.jsx("button",{type:"button",className:st.secondaryButton,onClick:G,disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:st.primaryButton,onClick:()=>void I(),disabled:S,children:n(S?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function T5t({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:r}){const{t:s}=rt(),[i,o]=h.useState(!1),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,m]=h.useState(520),p=h.useRef(f),g=h.useRef(null),b=h.useRef(null),[w,y]=h.useState(null),v=i,x=h.useMemo(()=>P5t(e,n),[e,n]);h.useEffect(()=>{y(t)},[t]),h.useEffect(()=>{p.current=f},[f]),h.useEffect(()=>{const _=g.current;if(!_)return;const C=()=>{d(_.clientWidth<f5t)};C();const j=new ResizeObserver(C);return j.observe(_),()=>j.disconnect()},[l]),h.useEffect(()=>()=>{var _;return(_=b.current)==null?void 0:_.call(b)},[]);const k=h.useCallback(_=>{const C=g.current;if(!C)return;_.preventDefault();const j=_.currentTarget;j.setPointerCapture(_.pointerId);const E=_.clientX,L=p.current,D=C.getBoundingClientRect().width,M=Math.max(180,D-180),R=document.body.style.cursor,$=document.body.style.userSelect;let B=L,N=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const z=()=>{N=null,m(B)},G=U=>{B=Math.min(M,Math.max(180,L+(U.clientX-E))),N===null&&(N=window.requestAnimationFrame(z))};let I=()=>{};const Y=U=>{b.current=null,N!==null&&(window.cancelAnimationFrame(N),N=null),U&&m(B),j.hasPointerCapture(_.pointerId)&&j.releasePointerCapture(_.pointerId),document.body.style.cursor=R,document.body.style.userSelect=$,window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I)};I=()=>Y(!0),b.current=()=>Y(!1),window.addEventListener("pointermove",G),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I)},[]);if(e.length===0)return a.jsx("div",{className:qe.empty,children:"No file changes to review."});const S=xhe(e),T=_=>{y(C=>C===_?null:_)};return a.jsxs("div",{className:qe.review,children:[a.jsxs("div",{className:qe.reviewToolbar,children:[a.jsxs("div",{className:qe.reviewToolbarTitle,children:[a.jsx("span",{children:s("turnOutputs.previousTurn")}),a.jsx(D3,{additions:S==null?void 0:S.additions,deletions:S==null?void 0:S.deletions,className:qe.lineStats,additionsClassName:qe.additions,deletionsClassName:qe.deletions})]}),a.jsxs("div",{className:qe.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:qe.reviewTotalsButton,onClick:()=>c(_=>!_),"aria-expanded":l,children:[a.jsx("span",{children:s("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[qe.chevron,l?qe.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(pY,{})})]}),a.jsx("button",{type:"button",className:[qe.iconButton,i?qe.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>o(_=>!_),"aria-label":s(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:s(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:i?a.jsx(D5t,{}):a.jsx(R5t,{})})]})]}),l&&a.jsxs("div",{ref:g,className:[qe.reviewContent,v?"":qe.reviewContentListOnly,v&&u?qe.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${f}px`},children:[a.jsx("div",{className:[qe.reviewList,w?qe.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(_=>{const C=w===_.path,j=She(_.path);return a.jsxs("div",{className:[qe.reviewItem,C?qe.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:qe.reviewRow,"data-selected":_.path===t||void 0,children:[a.jsx("button",{type:"button",className:qe.reviewRowToggle,onClick:()=>T(_.path),"aria-label":_.path,"aria-expanded":C}),a.jsx("span",{className:qe.fileIcon,children:Wfe(_.path)}),a.jsxs("span",{className:qe.reviewFileName,children:[a.jsx(N5t,{path:V6(_.path,n),title:_.path}),j&&a.jsx("button",{type:"button",className:qe.reviewOpenButton,onClick:()=>r(_),title:`${s("turnOutputs.preview")} ${_.path}`,children:s("turnOutputs.preview")})]}),a.jsx(D3,{additions:_.additions,deletions:_.deletions,className:qe.lineStats,additionsClassName:qe.additions,deletionsClassName:qe.deletions}),a.jsx("span",{className:[qe.chevron,C?qe.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(pY,{})})]}),C&&a.jsx(E5t,{change:_})]},`${_.toolCallId}:${_.path}`)})}),v&&!u&&a.jsx("div",{className:qe.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:k}),v&&a.jsx("div",{className:qe.tree,children:x.children.map(_=>a.jsx(qfe,{node:_,depth:0,selectedPath:t},_.path))})]})]})}function E5t({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:qe.diffEmpty,children:"No diff available."});const t=A5t(e.diffs);return a.jsx("div",{className:qe.diffPreview,children:t.map((n,r)=>a.jsx(j5t,{oldText:n.oldText,newText:n.newText},r))})}function A5t(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n!=null&&n.fullContent)return e.slice(t)}return e}function j5t({oldText:e,newText:t}){const n=h.useRef(null),[r,s]=h.useState(null),[i,o]=h.useState(null);return h.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>s(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),h.useEffect(()=>{const l=n.current;if(!l||r===null)return;l.replaceChildren(),o(null);let c=!1,u=null;const d=[bde,en.editable.of(!1),gs.readOnly.of(!0),en.lineWrapping],f={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return fe(async()=>{const{MergeView:p,unifiedMergeView:g}=await import("./index-Ww86nT9f.js");return{MergeView:p,unifiedMergeView:g}},[]).then(({MergeView:p,unifiedMergeView:g})=>{if(!c)try{if(r){u=new p({a:{doc:e,extensions:d},b:{doc:t,extensions:d},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:f});return}u=new en({doc:t,extensions:[...d,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:f})],parent:l})}catch(b){c||o(b instanceof Error?b.message:String(b))}}).catch(p=>{c||o(p instanceof Error?p.message:String(p))}),()=>{c=!0,u==null||u.destroy()}},[r,t,e]),a.jsxs("div",{className:qe.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:qe.codeMirrorDiff}),i&&a.jsxs("div",{className:qe.diffError,children:["Diff unavailable: ",i]})]})}function qfe({node:e,depth:t,selectedPath:n}){var d,f;const r=!!e.file,[s,i]=h.useState(!0),o=[qe.treeRow,r?qe.treeFile:qe.treeFolder].filter(Boolean).join(" "),l={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:qe.treeTwisty,children:!r&&a.jsx("span",{className:[qe.treeChevron,s?"":qe.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(L5t,{})})}),a.jsxs("span",{className:qe.treeContent,children:[r&&a.jsx("span",{className:qe.fileIcon,children:Wfe(e.path)}),a.jsx("span",{className:qe.treeName,children:e.name})]}),((d=e.file)==null?void 0:d.isArtifact)&&a.jsx("span",{className:qe.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:qe.treeNode,children:[r?a.jsx("div",{className:o,"data-selected":((f=e.file)==null?void 0:f.path)===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:o,"data-depth":t,style:l,title:e.path,"aria-expanded":s,onClick:()=>i(m=>!m),children:u}),!r&&s&&e.children.length>0&&a.jsx("div",{className:qe.treeChildren,style:c,children:e.children.map(m=>a.jsx(qfe,{node:m,depth:t+1,selectedPath:n},m.path))})]})}function N5t({path:e,title:t}){const n=h.useRef(null),[r,s]=h.useState(()=>Hfe(e));return h.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>s(I5t(e,i));o();const l=new ResizeObserver(o);return l.observe(i),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:qe.reviewPath,title:t??e,children:[r.prefix&&a.jsx("span",{className:qe.pathPrefix,children:r.prefix}),a.jsx("span",{className:qe.pathFileName,children:r.leaf})]})}function Hfe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let mY=null;function I5t(e,t){const n=Hfe(e),r=t.clientWidth;if(r<=0)return n;const s=M5t(t);if(s(e)<=r)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,l=s(o);if(i.length<=1||l+s(".../")>r)return{prefix:"",leaf:o};let c=".../";for(let u=1;u<i.length;u++){const f=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(s(f)+l>r)break;c=f}return{prefix:c,leaf:o}}function M5t(e){mY??(mY=document.createElement("canvas"));const t=mY.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),r=>(t==null?void 0:t.measureText(r).width)??r.length*8}function R5t(){return a.jsxs("svg",{className:qe.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 7.5h6l1.6 2h9.4v8.2a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M3.5 7.5V5.8a1.5 1.5 0 0 1 1.5-1.5h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.6",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function D5t(){return a.jsxs("svg",{className:qe.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 8.2V5.8A1.5 1.5 0 0 1 5 4.3h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.4",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M4.8 19.7h12.9a2 2 0 0 0 1.9-1.4l2-7H6.4l-2.8 7.1a.9.9 0 0 0 1.2 1.3Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function pY(){return a.jsx("svg",{className:qe.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function L5t(){return a.jsx("svg",{className:qe.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function P5t(e,t){const n={name:"",path:"",children:[]};for(const r of e){const s=V6(r.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<s.length;o++){const l=s[o],c=s.slice(0,o+1).join("/");let u=i.children.find(d=>d.name===l);u||(u={name:l,path:c,children:[]},i.children.push(u)),o===s.length-1&&(u.file=r),i=u}}return Ufe(n),n}function Ufe(e){e.children.sort((t,n)=>!!t.file!=!!n.file?t.file?1:-1:t.name.localeCompare(n.name));for(const t of e.children)Ufe(t)}function j4(e){return Jg(e).split("/").filter(Boolean).at(-1)??e}function Wfe(e){var s;const t=j4(e),n=t.includes(".")?(s=t.split(".").pop())==null?void 0:s.toLowerCase():"";return n?{css:"CSS",html:"HTML",js:"JS",json:"JSON",jsx:"JSX",md:"MD",ts:"TS",tsx:"TSX"}[n]??n.slice(0,3).toUpperCase():"FILE"}function O5t({artifact:e,workspaceActions:t,previewContent:n}){var c;const r=Kst(e),s=gle(e.url)?e.url:void 0,i=((c=e.metadata)==null?void 0:c.artifactType)==="automation_snapshot",o=e.storage==="workspace"&&!!e.workspacePath,l=Vst(e);return o&&e.workspacePath?a.jsx(Vfe,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t,previewContent:n,imageMimeType:l,previewKind:$5t(e)?"html":B5t(e)?"markdown":l?"image":"source"}):a.jsxs("div",{className:qe.detail,children:[a.jsxs("div",{className:qe.section,children:[a.jsx("div",{className:qe.sectionTitle,children:i?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:qe.fieldGrid,children:[a.jsx(Yd,{label:"Type",value:bhe(e.kind)}),a.jsx(Yd,{label:"Storage",value:e.storage}),a.jsx(Yd,{label:"Status",value:e.status}),a.jsx(Yd,{label:"Source",value:e.source}),a.jsx(Yd,{label:"Size",value:yhe(e.sizeBytes)}),a.jsx(Yd,{label:"Created",value:e.createdAt}),a.jsx(Yd,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(Yd,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(Yd,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:qe.section,children:[a.jsx("div",{className:qe.sectionTitle,children:"Description"}),a.jsx("div",{className:qe.description,children:e.description})]}),i&&e.metadata&&a.jsxs("div",{className:qe.section,children:[a.jsx("div",{className:qe.sectionTitle,children:"Details"}),a.jsxs("div",{className:qe.fieldGrid,children:[nb(e.metadata,"automationId","Automation ID"),nb(e.metadata,"schedule","Schedule"),nb(e.metadata,"timezone","Timezone"),nb(e.metadata,"status","Status"),nb(e.metadata,"nextRunAt","Next run"),nb(e.metadata,"prompt","Prompt")]})]}),(r||s)&&a.jsxs("div",{className:qe.section,children:[a.jsx("div",{className:qe.sectionTitle,children:"Location"}),s?a.jsx("a",{className:qe.link,href:s,target:"_blank",rel:"noreferrer",children:s}):a.jsx("div",{className:qe.meta,children:r})]})]})}function $5t(e){var r,s;const t=((r=e.workspacePath)==null?void 0:r.toLowerCase())??"",n=((s=e.mimeType)==null?void 0:s.toLowerCase())??"";return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function B5t(e){var n,r;const t=((n=e.workspacePath)==null?void 0:n.toLowerCase())??"";return t.endsWith(".md")||t.endsWith(".markdown")||((r=e.mimeType)==null?void 0:r.toLowerCase())==="text/markdown"}function Vfe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r,imageMimeType:s,previewKind:i}){const o=e.toLowerCase(),l=s??YP(e),c=i??(o.endsWith(".html")||o.endsWith(".htm")?"html":o.endsWith(".md")||o.endsWith(".markdown")?"markdown":l?"image":"source");return c==="html"?a.jsx(F5t,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r}):c==="markdown"?a.jsx(H5t,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r}):c==="image"&&l?a.jsx(z5t,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:l}):a.jsx(q5t,{workspacePath:e,artifactVersion:t,workspaceActions:n})}function z5t({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:r}){const[s,i]=h.useState(null),[o,l]=h.useState(null);return h.useEffect(()=>{let c=!1,u;return i(null),l(null),Gst((d,f)=>n.readFileBytes(d,f),e,r,{statFile:d=>n.stat(d),isCancelled:()=>c}).then(d=>{c||(u=URL.createObjectURL(d),i(u))}).catch(d=>{c||l(d instanceof Error?d.message:String(d))}),()=>{c=!0,u&&URL.revokeObjectURL(u)}},[t,r,n,e]),a.jsxs("div",{className:qe.imagePreviewWrap,children:[s?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:qe.imagePreview,src:s,alt:j4(e)}),a.jsx("a",{className:qe.imageDownloadButton,href:s,download:j4(e),"aria-label":`Download ${j4(e)}`,title:"Download",children:a.jsx(ZC,{size:16,strokeWidth:1.8})})]}):o?null:a.jsx("div",{className:qe.empty,children:"Loading image..."}),o&&a.jsx("div",{className:qe.previewError,children:o})]})}function bO({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r,truncatedMessage:s}){const[i,o]=h.useState(r??null),[l,c]=h.useState(null);return h.useEffect(()=>{let u=!1;return o(r??null),c(null),n.readWorkspaceFile(e).then(d=>{u||(o(d.content),d.truncated&&c(s))}).catch(d=>{u||c(d instanceof Error?d.message:String(d))}),()=>{u=!0}},[t,r,s,n,e]),{content:i,error:l}}function F5t({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r}){const{content:s,error:i}=bO({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r,truncatedMessage:"Preview is truncated because the file is too large."});return a.jsxs("div",{className:qe.htmlPreviewWrap,children:[s===null?a.jsx("div",{className:qe.empty,children:"Loading preview..."}):a.jsx("iframe",{className:qe.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:Yst(s),title:`Preview ${e}`}),i&&a.jsx("div",{className:qe.previewError,children:i})]})}function q5t({workspacePath:e,artifactVersion:t,workspaceActions:n}){const r=h.useRef(null),[s,i]=h.useState(null),{content:o,error:l}=bO({workspacePath:e,artifactVersion:t,workspaceActions:n,truncatedMessage:"File is truncated because it is too large."});return h.useEffect(()=>{const c=r.current;if(!c||o===null)return;c.replaceChildren(),i(null);let u;try{u=new en({doc:o,extensions:[bde,en.editable.of(!1),gs.readOnly.of(!0),en.lineWrapping],parent:c})}catch(d){i(d instanceof Error?d.message:String(d));return}return()=>u.destroy()},[o]),a.jsxs("div",{className:qe.filePreviewWrap,children:[o===null?a.jsx("div",{className:qe.empty,children:"Loading file..."}):a.jsx("div",{ref:r,className:qe.codeMirrorFile}),(l||s)&&a.jsx("div",{className:qe.previewError,children:l||s})]})}function H5t({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r}){const{content:s,error:i}=bO({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r,truncatedMessage:"Preview is truncated because the file is too large."});return a.jsxs("div",{className:qe.markdownPreviewWrap,children:[s===null?a.jsx("div",{className:qe.empty,children:"Loading preview..."}):a.jsx(Qf,{content:s}),i&&a.jsx("div",{className:qe.previewError,children:i})]})}function Yd({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:qe.fieldLabel,children:e}),a.jsx("span",{className:qe.fieldValue,children:t})]}):null}function nb(e,t,n){const r=e[t];return r==null||r===""?null:a.jsx(Yd,{label:n,value:String(r)},t)}function U5t(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 Gfe=Dn.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),K_=()=>{const e=Dn.useContext(Gfe);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};U5t(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
[data-state=closed]
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function W5t(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function V5t(){return yO(/^Mac/)}function G5t(){return yO(/^iPhone/)}function gY(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function K5t(){return yO(/^iPad/)||V5t()&&navigator.maxTouchPoints>1}function Kfe(){return G5t()||K5t()}function yO(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Y5t=24,X5t=typeof window<"u"?h.useLayoutEffect:h.useEffect;function bY(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const u7=typeof document<"u"&&window.visualViewport;function yY(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Yfe(e){for(yY(e)&&(e=e.parentElement);e&&!yY(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Q5t=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let CC=0,d7;function J5t(e={}){let{isDisabled:t}=e;X5t(()=>{if(!t)return CC++,CC===1&&Kfe()&&(d7=Z5t()),()=>{CC--,CC===0&&(d7==null||d7())}},[t])}function Z5t(){let e,t=0,n=f=>{e=Yfe(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},r=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,p=e.scrollTop,g=e.scrollHeight-e.clientHeight;g!==0&&((p<=0&&m>t||p>=g&&m<t)&&f.preventDefault(),t=m)},s=f=>{let m=f.target;SR(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=f=>{let m=f.target;SR(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",u7&&(u7.height<window.innerHeight?requestAnimationFrame(()=>{vY(m)}):u7.addEventListener("resize",()=>vY(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,u=bY(e6t(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=bY(Uw(document,"touchstart",n,{passive:!1,capture:!0}),Uw(document,"touchmove",r,{passive:!1,capture:!0}),Uw(document,"touchend",s,{passive:!1,capture:!0}),Uw(document,"focus",i,!0),Uw(window,"scroll",o));return()=>{u(),d(),window.scrollTo(l,c)}}function e6t(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Uw(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function vY(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Yfe(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,s=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const o=n.getBoundingClientRect().bottom+Y5t;i>o&&(n.scrollTop+=s-r)}e=n.parentElement}}function SR(e){return e instanceof HTMLInputElement&&!Q5t.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function t6t(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function n6t(...e){return t=>e.forEach(n=>t6t(n,t))}function Xfe(...e){return h.useCallback(n6t(...e),e)}const Qfe=new WeakMap;function ia(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([s,i])=>{if(s.startsWith("--")){e.style.setProperty(s,i);return}r[s]=e.style[s],e.style[s]=i}),!n&&Qfe.set(e,r)}function r6t(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Qfe.get(e);n&&(e.style[t]=n[t])}const Bo=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function TC(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let s=r.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[Bo(t)?13:12]):(s=r.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[Bo(t)?5:4]):null)}function s6t(e){return 8*(Math.log(e+1)-2)}function h7(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function i6t(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const to={DURATION:.5,EASE:[.32,.72,0,1]},Jfe=.4,o6t=.25,a6t=100,Zfe=8,J0=16,CR=26,f7="vaul-dragging";function eme(e){const t=Dn.useRef(e);return Dn.useEffect(()=>{t.current=e}),Dn.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function l6t({defaultProp:e,onChange:t}){const n=Dn.useState(e),[r]=n,s=Dn.useRef(r),i=eme(t);return Dn.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}function tme({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=l6t({defaultProp:t,onChange:n}),i=e!==void 0,o=i?e:r,l=eme(n),c=Dn.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else s(u)},[i,e,s,l]);return[o,c]}function c6t({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:s,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=tme({prop:e,defaultProp:n==null?void 0:n[0],onChange:t}),[m,p]=Dn.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);Dn.useEffect(()=>{function _(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const g=Dn.useMemo(()=>d===(n==null?void 0:n[n.length-1])||null,[n,d]),b=Dn.useMemo(()=>{var _;return(_=n==null?void 0:n.findIndex(C=>C===d))!=null?_:null},[n,d]),w=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===d||!n,y=Dn.useMemo(()=>{const _=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var C;return(C=n==null?void 0:n.map(j=>{const E=typeof j=="string";let L=0;if(E&&(L=parseInt(j,10)),Bo(l)){const M=E?L:m?j*_.height:0;return m?l==="bottom"?_.height-M:-_.height+M:M}const D=E?L:m?j*_.width:0;return m?l==="right"?_.width-D:-_.width+D:D}))!=null?C:[]},[n,m,c]),v=Dn.useMemo(()=>b!==null?y==null?void 0:y[b]:null,[y,b]),x=Dn.useCallback(_=>{var C;const j=(C=y==null?void 0:y.findIndex(E=>E===_))!=null?C:null;o(j),ia(r.current,{transition:`transform ${to.DURATION}s cubic-bezier(${to.EASE.join(",")})`,transform:Bo(l)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`}),y&&j!==y.length-1&&i!==void 0&&j!==i&&j<i?ia(s.current,{transition:`opacity ${to.DURATION}s cubic-bezier(${to.EASE.join(",")})`,opacity:"0"}):ia(s.current,{transition:`opacity ${to.DURATION}s cubic-bezier(${to.EASE.join(",")})`,opacity:"1"}),f(n==null?void 0:n[Math.max(j,0)])},[r.current,n,y,i,s,f]);Dn.useEffect(()=>{if(d||e){var _;const C=(_=n==null?void 0:n.findIndex(j=>j===e||j===d))!=null?_:-1;y&&C!==-1&&typeof y[C]=="number"&&x(y[C])}},[d,e,n,y,x]);function k({draggedDistance:_,closeDrawer:C,velocity:j,dismissible:E}){if(i===void 0)return;const L=l==="bottom"||l==="right"?(v??0)-_:(v??0)+_,D=b===i-1,M=b===0,R=_>0;if(D&&ia(s.current,{transition:`opacity ${to.DURATION}s cubic-bezier(${to.EASE.join(",")})`}),!u&&j>2&&!R){E?C():x(y[0]);return}if(!u&&j>2&&R&&y&&n){x(y[n.length-1]);return}const $=y==null?void 0:y.reduce((N,z)=>typeof N!="number"||typeof z!="number"?N:Math.abs(z-L)<Math.abs(N-L)?z:N),B=Bo(l)?window.innerHeight:window.innerWidth;if(j>Jfe&&Math.abs(_)<B*.4){const N=R?1:-1;if(N>0&&g&&n){x(y[n.length-1]);return}if(M&&N<0&&E&&C(),b===null)return;x(y[b+N]);return}x($)}function S({draggedDistance:_}){if(v===null)return;const C=l==="bottom"||l==="right"?v-_:v+_;(l==="bottom"||l==="right")&&C<y[y.length-1]||(l==="top"||l==="left")&&C>y[y.length-1]||ia(r.current,{transform:Bo(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`})}function T(_,C){if(!n||typeof b!="number"||!y||i===void 0)return null;const j=b===i-1;if(b>=i&&C)return 0;if(j&&!C)return 1;if(!w&&!j)return null;const L=j?b+1:b-1,D=j?y[L]-y[L-1]:y[L+1]-y[L],M=_/Math.abs(D);return j?1-M:M}return{isLastSnapPoint:g,activeSnapPoint:d,shouldFade:w,getPercentageDragged:T,setActiveSnapPoint:f,activeSnapPointIndex:b,onRelease:k,onDrag:S,snapPointsOffset:y}}const u6t=()=>()=>{};function d6t(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:s}=K_(),i=Dn.useRef(null),o=h.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-CR)/window.innerWidth}Dn.useEffect(()=>{if(t&&n){i.current&&clearTimeout(i.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;i6t(r&&!s?h7(document.body,{background:"black"}):u6t,h7(c,{transformOrigin:Bo(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${to.DURATION}s`,transitionTimingFunction:`cubic-bezier(${to.EASE.join(",")})`}));const u=h7(c,{borderRadius:`${Zfe}px`,overflow:"hidden",...Bo(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{u(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},to.DURATION*1e3)}}},[t,n,o])}let Ww=null;function h6t({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:s,noBodyStyles:i}){const[o,l]=Dn.useState(()=>typeof window<"u"?window.location.href:""),c=Dn.useRef(0),u=Dn.useCallback(()=>{if(gY()&&Ww===null&&e&&!i){Ww={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=m-window.innerHeight;p&&c.current>=m&&(document.body.style.top=`${-(c.current+p)}px`)}),300)}},[e]),d=Dn.useCallback(()=>{if(gY()&&Ww!==null&&!i){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Ww),window.requestAnimationFrame(()=>{if(s&&o!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),Ww=null}},[o]);return Dn.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),Dn.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||d()}},[t,d]),Dn.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{d()},500)):d())},[e,r,o,t,n,u,d]),{restorePositionSetting:d}}function f6t({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:s,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=o6t,scrollLockTimeout:u=a6t,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:g,fixed:b,modal:w=!0,onClose:y,nested:v,noBodyStyles:x=!1,direction:k="bottom",defaultOpen:S=!1,disablePreventScroll:T=!0,snapToSequentialPoint:_=!1,preventScrollRestoration:C=!1,repositionInputs:j=!0,onAnimationEnd:E,container:L,autoFocus:D=!1}){var M,R;const[$=!1,B]=tme({defaultProp:S,prop:e,onChange:ve=>{t==null||t(ve),!ve&&!v&&Ee(),setTimeout(()=>{E==null||E(ve)},to.DURATION*1e3),ve&&!w&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ve||(document.body.style.pointerEvents="auto")}}),[N,z]=Dn.useState(!1),[G,I]=Dn.useState(!1),[Y,U]=Dn.useState(!1),P=Dn.useRef(null),F=Dn.useRef(null),te=Dn.useRef(null),W=Dn.useRef(null),K=Dn.useRef(null),ce=Dn.useRef(!1),ie=Dn.useRef(null),Z=Dn.useRef(0),ee=Dn.useRef(!1),oe=Dn.useRef(!S),we=Dn.useRef(0),pe=Dn.useRef(null),he=Dn.useRef(((M=pe.current)==null?void 0:M.getBoundingClientRect().height)||0),X=Dn.useRef(((R=pe.current)==null?void 0:R.getBoundingClientRect().width)||0),ye=Dn.useRef(0),Ce=Dn.useCallback(ve=>{i&&ve===Mt.length-1&&(F.current=new Date)},[]),{activeSnapPoint:ae,activeSnapPointIndex:me,setActiveSnapPoint:We,onRelease:Oe,snapPointsOffset:Mt,onDrag:$t,shouldFade:St,getPercentageDragged:ue}=c6t({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:g,drawerRef:pe,fadeFromIndex:m,overlayRef:P,onSnapPointChange:Ce,direction:k,container:L,snapToSequentialPoint:_});J5t({isDisabled:!$||G||!w||Y||!N||!j||!T});const{restorePositionSetting:Ee}=h6t({isOpen:$,modal:w,nested:v??!1,hasBeenOpened:N,preventScrollRestoration:C,noBodyStyles:x});function tt(){return(window.innerWidth-CR)/window.innerWidth}function ut(ve){var Ke,le;!d&&!i||pe.current&&!pe.current.contains(ve.target)||(he.current=((Ke=pe.current)==null?void 0:Ke.getBoundingClientRect().height)||0,X.current=((le=pe.current)==null?void 0:le.getBoundingClientRect().width)||0,I(!0),te.current=new Date,Kfe()&&window.addEventListener("touchend",()=>ce.current=!1,{once:!0}),ve.target.setPointerCapture(ve.pointerId),Z.current=Bo(k)?ve.pageY:ve.pageX)}function Ct(ve,Ke){var le;let Le=ve;const dt=(le=window.getSelection())==null?void 0:le.toString(),Fe=pe.current?TC(pe.current,k):null,Ge=new Date;if(Le.tagName==="SELECT"||Le.hasAttribute("data-vaul-no-drag")||Le.closest("[data-vaul-no-drag]"))return!1;if(k==="right"||k==="left")return!0;if(F.current&&Ge.getTime()-F.current.getTime()<500)return!1;if(Fe!==null&&(k==="bottom"?Fe>0:Fe<0))return!0;if(dt&&dt.length>0)return!1;if(K.current&&Ge.getTime()-K.current.getTime()<u&&Fe===0||Ke)return K.current=Ge,!1;for(;Le;){if(Le.scrollHeight>Le.clientHeight){if(Le.scrollTop!==0)return K.current=new Date,!1;if(Le.getAttribute("role")==="dialog")return!0}Le=Le.parentNode}return!0}function Ze(ve){if(pe.current&&G){const Ke=k==="bottom"||k==="right"?1:-1,le=(Z.current-(Bo(k)?ve.pageY:ve.pageX))*Ke,Le=le>0,dt=i&&!d&&!Le;if(dt&&me===0)return;const Fe=Math.abs(le),Ge=document.querySelector("[data-vaul-drawer-wrapper]"),un=k==="bottom"||k==="top"?he.current:X.current;let Wn=Fe/un;const Me=ue(Fe,Le);if(Me!==null&&(Wn=Me),dt&&Wn>=1||!ce.current&&!Ct(ve.target,Le))return;if(pe.current.classList.add(f7),ce.current=!0,ia(pe.current,{transition:"none"}),ia(P.current,{transition:"none"}),i&&$t({draggedDistance:le}),Le&&!i){const cn=s6t(le),Re=Math.min(cn*-1,0)*Ke;ia(pe.current,{transform:Bo(k)?`translate3d(0, ${Re}px, 0)`:`translate3d(${Re}px, 0, 0)`});return}const yt=1-Wn;if((St||m&&me===m-1)&&(r==null||r(ve,Wn),ia(P.current,{opacity:`${yt}`,transition:"none"},!0)),Ge&&P.current&&o){const cn=Math.min(tt()+Wn*(1-tt()),1),Re=8-Wn*8,et=Math.max(0,14-Wn*14);ia(Ge,{borderRadius:`${Re}px`,transform:Bo(k)?`scale(${cn}) translate3d(0, ${et}px, 0)`:`scale(${cn}) translate3d(${et}px, 0, 0)`,transition:"none"},!0)}if(!i){const cn=Fe*Ke;ia(pe.current,{transform:Bo(k)?`translate3d(0, ${cn}px, 0)`:`translate3d(${cn}px, 0, 0)`})}}}Dn.useEffect(()=>{window.requestAnimationFrame(()=>{oe.current=!0})},[]),Dn.useEffect(()=>{var ve;function Ke(){if(!pe.current||!j)return;const le=document.activeElement;if(SR(le)||ee.current){var Le;const dt=((Le=window.visualViewport)==null?void 0:Le.height)||0,Fe=window.innerHeight;let Ge=Fe-dt;const un=pe.current.getBoundingClientRect().height||0,Wn=un>Fe*.8;ye.current||(ye.current=un);const Me=pe.current.getBoundingClientRect().top;if(Math.abs(we.current-Ge)>60&&(ee.current=!ee.current),i&&i.length>0&&Mt&&me){const yt=Mt[me]||0;Ge+=yt}if(we.current=Ge,un>dt||ee.current){const yt=pe.current.getBoundingClientRect().height;let cn=yt;yt>dt&&(cn=dt-(Wn?Me:CR)),b?pe.current.style.height=`${yt-Math.max(Ge,0)}px`:pe.current.style.height=`${Math.max(cn,dt-Me)}px`}else W5t()||(pe.current.style.height=`${ye.current}px`);i&&i.length>0&&!ee.current?pe.current.style.bottom="0px":pe.current.style.bottom=`${Math.max(Ge,0)}px`}}return(ve=window.visualViewport)==null||ve.addEventListener("resize",Ke),()=>{var le;return(le=window.visualViewport)==null?void 0:le.removeEventListener("resize",Ke)}},[me,i,Mt]);function Et(ve){gt(),y==null||y(),ve||B(!1),setTimeout(()=>{i&&We(i[0])},to.DURATION*1e3)}function Nt(){if(!pe.current)return;const ve=document.querySelector("[data-vaul-drawer-wrapper]"),Ke=TC(pe.current,k);ia(pe.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${to.DURATION}s cubic-bezier(${to.EASE.join(",")})`}),ia(P.current,{transition:`opacity ${to.DURATION}s cubic-bezier(${to.EASE.join(",")})`,opacity:"1"}),o&&Ke&&Ke>0&&$&&ia(ve,{borderRadius:`${Zfe}px`,overflow:"hidden",...Bo(k)?{transform:`scale(${tt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${tt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${to.DURATION}s`,transitionTimingFunction:`cubic-bezier(${to.EASE.join(",")})`},!0)}function gt(){!G||!pe.current||(pe.current.classList.remove(f7),ce.current=!1,I(!1),W.current=new Date)}function Je(ve){if(!G||!pe.current)return;pe.current.classList.remove(f7),ce.current=!1,I(!1),W.current=new Date;const Ke=TC(pe.current,k);if(!ve||!Ct(ve.target,!1)||!Ke||Number.isNaN(Ke)||te.current===null)return;const le=W.current.getTime()-te.current.getTime(),Le=Z.current-(Bo(k)?ve.pageY:ve.pageX),dt=Math.abs(Le)/le;if(dt>.05&&(U(!0),setTimeout(()=>{U(!1)},200)),i){Oe({draggedDistance:Le*(k==="bottom"||k==="right"?1:-1),closeDrawer:Et,velocity:dt,dismissible:d}),s==null||s(ve,!0);return}if(k==="bottom"||k==="right"?Le>0:Le<0){Nt(),s==null||s(ve,!0);return}if(dt>Jfe){Et(),s==null||s(ve,!1);return}var Fe;const Ge=Math.min((Fe=pe.current.getBoundingClientRect().height)!=null?Fe:0,window.innerHeight);var un;const Wn=Math.min((un=pe.current.getBoundingClientRect().width)!=null?un:0,window.innerWidth),Me=k==="left"||k==="right";if(Math.abs(Ke)>=(Me?Wn:Ge)*c){Et(),s==null||s(ve,!1);return}s==null||s(ve,!0),Nt()}Dn.useEffect(()=>($&&(ia(document.documentElement,{scrollBehavior:"auto"}),F.current=new Date),()=>{r6t(document.documentElement,"scrollBehavior")}),[$]);function Ae(ve){const Ke=ve?(window.innerWidth-J0)/window.innerWidth:1,le=ve?-J0:0;ie.current&&window.clearTimeout(ie.current),ia(pe.current,{transition:`transform ${to.DURATION}s cubic-bezier(${to.EASE.join(",")})`,transform:Bo(k)?`scale(${Ke}) translate3d(0, ${le}px, 0)`:`scale(${Ke}) translate3d(${le}px, 0, 0)`}),!ve&&pe.current&&(ie.current=setTimeout(()=>{const Le=TC(pe.current,k);ia(pe.current,{transition:"none",transform:Bo(k)?`translate3d(0, ${Le}px, 0)`:`translate3d(${Le}px, 0, 0)`})},500))}function de(ve,Ke){if(Ke<0)return;const le=(window.innerWidth-J0)/window.innerWidth,Le=le+Ke*(1-le),dt=-J0+Ke*J0;ia(pe.current,{transform:Bo(k)?`scale(${Le}) translate3d(0, ${dt}px, 0)`:`scale(${Le}) translate3d(${dt}px, 0, 0)`,transition:"none"})}function nt(ve,Ke){const le=Bo(k)?window.innerHeight:window.innerWidth,Le=Ke?(le-J0)/le:1,dt=Ke?-J0:0;Ke&&ia(pe.current,{transition:`transform ${to.DURATION}s cubic-bezier(${to.EASE.join(",")})`,transform:Bo(k)?`scale(${Le}) translate3d(0, ${dt}px, 0)`:`scale(${Le}) translate3d(${dt}px, 0, 0)`})}return Dn.useEffect(()=>{w||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[w]),Dn.createElement(B5,{defaultOpen:S,onOpenChange:ve=>{!d&&!ve||(ve?z(!0):Et(!0),B(ve))},open:$},Dn.createElement(Gfe.Provider,{value:{activeSnapPoint:ae,snapPoints:i,setActiveSnapPoint:We,drawerRef:pe,overlayRef:P,onOpenChange:t,onPress:ut,onRelease:Je,onDrag:Ze,dismissible:d,shouldAnimate:oe,handleOnly:f,isOpen:$,isDragging:G,shouldFade:St,closeDrawer:Et,onNestedDrag:de,onNestedOpenChange:Ae,onNestedRelease:nt,keyboardIsOpen:ee,modal:w,snapPointsOffset:Mt,activeSnapPointIndex:me,direction:k,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:x,container:L,autoFocus:D}},n))}const nme=Dn.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:s,shouldFade:i,isOpen:o,modal:l,shouldAnimate:c}=K_(),u=Xfe(t,n),d=r&&r.length>0;if(!l)return null;const f=Dn.useCallback(m=>s(m),[s]);return Dn.createElement(F5,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":o&&d?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":c!=null&&c.current?"true":"false",...e})});nme.displayName="Drawer.Overlay";const rme=Dn.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},s){const{drawerRef:i,onPress:o,onRelease:l,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:m,isOpen:p,direction:g,snapPoints:b,container:w,handleOnly:y,shouldAnimate:v,autoFocus:x}=K_(),[k,S]=Dn.useState(!1),T=Xfe(s,i),_=Dn.useRef(null),C=Dn.useRef(null),j=Dn.useRef(!1),E=b&&b.length>0;d6t();const L=(M,R,$=0)=>{if(j.current)return!0;const B=Math.abs(M.y),N=Math.abs(M.x),z=N>B,G=["bottom","right"].includes(R)?1:-1;if(R==="left"||R==="right"){if(!(M.x*G<0)&&N>=0&&N<=$)return z}else if(!(M.y*G<0)&&B>=0&&B<=$)return!z;return j.current=!0,!0};Dn.useEffect(()=>{E&&window.requestAnimationFrame(()=>{S(!0)})},[]);function D(M){_.current=null,j.current=!1,l(M)}return Dn.createElement(q5,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":k?"true":"false","data-vaul-snap-points":p&&E?"true":"false","data-vaul-custom-container":w?"true":"false","data-vaul-animate":v!=null&&v.current?"true":"false",...r,ref:T,style:d&&d.length>0?{"--snap-point-height":`${d[f??0]}px`,...t}:t,onPointerDown:M=>{y||(r.onPointerDown==null||r.onPointerDown.call(r,M),_.current={x:M.pageX,y:M.pageY},o(M))},onOpenAutoFocus:M=>{n==null||n(M),x||M.preventDefault()},onPointerDownOutside:M=>{if(e==null||e(M),!m||M.defaultPrevented){M.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:M=>{if(!m){M.preventDefault();return}},onPointerMove:M=>{if(C.current=M,y||(r.onPointerMove==null||r.onPointerMove.call(r,M),!_.current))return;const R=M.pageY-_.current.y,$=M.pageX-_.current.x,B=M.pointerType==="touch"?10:2;L({x:$,y:R},g,B)?c(M):(Math.abs($)>B||Math.abs(R)>B)&&(_.current=null)},onPointerUp:M=>{r.onPointerUp==null||r.onPointerUp.call(r,M),_.current=null,j.current=!1,l(M)},onPointerOut:M=>{r.onPointerOut==null||r.onPointerOut.call(r,M),D(C.current)},onContextMenu:M=>{r.onContextMenu==null||r.onContextMenu.call(r,M),C.current&&D(C.current)}})});rme.displayName="Drawer.Content";const m6t=250,p6t=120,g6t=Dn.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:s,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:m,onDrag:p}=K_(),g=Dn.useRef(null),b=Dn.useRef(!1);function w(){if(b.current){x();return}window.setTimeout(()=>{y()},p6t)}function y(){if(i||e||b.current){x();return}if(x(),!o||o.length===0){u||s();return}if(l===o[o.length-1]&&u){s();return}const S=o.findIndex(_=>_===l);if(S===-1)return;const T=o[S+1];c(T)}function v(){g.current=window.setTimeout(()=>{b.current=!0},m6t)}function x(){g.current&&window.clearTimeout(g.current),b.current=!1}return Dn.createElement("div",{onClick:w,onPointerCancel:x,onPointerDown:k=>{d&&m(k),v()},onPointerMove:k=>{d&&p(k)},ref:r,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},Dn.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});g6t.displayName="Drawer.Handle";function b6t(e){const t=K_(),{container:n=t.container,...r}=e;return Dn.createElement(z5,{container:n,...r})}const Y_={Root:f6t,Content:rme,Overlay:nme,Portal:b6t,Title:H5};function y6t({...e}){return a.jsx(Y_.Root,{"data-slot":"drawer",...e})}function v6t({container:e,...t}){const n=Gu();return a.jsx(Y_.Portal,{"data-slot":"drawer-portal",container:e??n??void 0,...t})}const w6t=h.forwardRef(function({className:t,...n},r){return a.jsx(Y_.Overlay,{ref:r,"data-slot":"drawer-overlay",className:ln("fixed inset-0 isolate z-[var(--web-shell-dialog-backdrop-z-index,50)] bg-black/10 duration-150 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",t),...n})}),x6t=h.forwardRef(function({className:t,children:n,overlayProps:r,...s},i){return a.jsxs(v6t,{children:[a.jsx(w6t,{...r}),a.jsx(Y_.Content,{ref:i,"data-slot":"drawer-content",className:ln("group/drawer-content fixed z-[var(--web-shell-dialog-backdrop-z-index,50)] flex h-auto flex-col bg-popover text-sm text-popover-foreground outline-none data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",t),...s,children:n})]})});function k6t({className:e,...t}){return a.jsx(Y_.Title,{"data-slot":"drawer-title",className:ln("text-base font-medium text-foreground",e),...t})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const _6t="(min-width: 1024px)";function m7(e=_6t){const[t,n]=h.useState(()=>S6t(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const r=window.matchMedia(e);n(r.matches);const s=i=>n(i.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t}function S6t(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function sme(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function C6t(e,t){const n=e.kind==="catch-up"?` · ${t("scheduledTasks.runKind.catchUp")}`:e.kind==="manual"?` · ${t("scheduledTasks.runKind.manual")}`:"",r=e.withheld?` · ${t("scheduledTasks.runKind.withheld")}`:"";return`${sme(e.at)}${n}${r}`}function Mm(e){return`${e.workspaceId??""}:${e.id}`}const T6t=["daily","weekdays","weekly","hourly","minutes","custom"],E6t=[1,2,3,4,5,6,10,12,15,20,30],A6t=2147483647,j6t=3,N6t=3e4,r_=1e5,I6t=/[^\p{L}\p{N}_.-]/gu,wY=/(^|[\s])(@(?:ext|mcp):(?:\\.[^\s\\]*|[^\s\\])+|\/(?:\\.[^\s\\/]*|[^\s\\/])+)(?=$|\s)/gu,M6t=["--background","--foreground","--muted","--muted-foreground","--border","--error-color","--font-mono"];function p7(e){return e.replace(I6t,"\\$&")}function g7(e){return e.replace(/\\(.)/g,"$1")}function R6t(e){if(e.startsWith("@ext:")){const t=g7(e.slice(5));return{id:`extension:${t}`,kind:"extension",label:t,insertText:e}}if(e.startsWith("@mcp:")){const t=g7(e.slice(5));return{id:`mcp:${t}`,kind:"mcp",label:t,insertText:e}}if(e.startsWith("/")){const t=g7(e.slice(1));return t?{id:`skill:${t}`,kind:"skill",label:t,insertText:e}:null}return null}function D6t(e){return e.displayName&&e.displayName!==e.name?e.displayName:e.description}function L6t(e){return e.description||e.argumentHint||e.level}function P6t(e){return e.description||e.mcpStatus}function ime(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";if(!(e instanceof HTMLElement))return"";const t=e.dataset.promptTagSerialized;if(t)return t;if(e.tagName==="BR")return`
`;let n="";return e.childNodes.forEach(r=>{n+=ime(r)}),e.tagName==="DIV"||e.tagName==="P"?`${n}
`:n}function ome(e){let t="";return e.childNodes.forEach(n=>{t+=ime(n)}),t}function ame(e){return e.replace(/\u00a0/g," ").replace(/\n$/,"")}function J6(e){return ame(ome(e))}function O6t(e){return ame(ome(e))}function vO(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function b7(e,t){t&&e.appendChild(document.createTextNode(t))}function lme(e,t,n){if(vO(e),!t)return;t.split(`
`).forEach((s,i)=>{i>0&&e.appendChild(document.createElement("br")),$6t(e,s,n)})}function y7(e,t){let n=J6(e);return n.length>r_?(n=n.slice(0,r_),lme(e,n,t)):n.trim().length===0&&(vO(e),n=""),n}function xY(e,t){const n=r_-J6(e).length;n<=0||document.execCommand("insertText",!1,t.slice(0,n))}function kY(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?{selection:t,text:O6t(n.cloneContents())}:null}function cme(e,t){const n=document.createElement("span");n.className=st.promptTag,n.contentEditable="false",n.dataset.promptTagSerialized=e.insertText.trim();const r=a1(e.kind);if(r){const o=document.createElement("span");o.className=st.promptTagIcon,o.style.setProperty("--composer-tag-icon-url",P6(r)),o.setAttribute("aria-hidden","true"),n.appendChild(o)}const s=document.createElement("span");s.className=st.promptTagValue,s.textContent=e.tagLabel??e.label,n.appendChild(s);const i=document.createElement("span");return i.className=st.promptTagRemove,i.setAttribute("role","button"),i.tabIndex=-1,i.dataset.promptTagRemove="",i.setAttribute("aria-label",`${t} ${e.label}`),n.appendChild(i),n}function $6t(e,t,n){let r=0;wY.lastIndex=0;for(const s of t.matchAll(wY)){const[i,o,l]=s,c=s.index??0,u=R6t(l);u&&(b7(e,t.slice(r,c)),b7(e,o),e.appendChild(cme(u,n)),r=c+i.length)}b7(e,t.slice(r))}function B6t(e,t,n){var c;const r=window.getSelection(),s=cme(t,n),i=document.createTextNode(" ");J6(e).trim().length===0&&vO(e);const o=((c=e.lastChild)==null?void 0:c.textContent)??"";e.childNodes.length>0&&!/\s$/.test(o)&&e.appendChild(document.createTextNode(" ")),e.appendChild(s),e.appendChild(i);const l=document.createRange();l.setStartAfter(i),l.collapse(!0),r==null||r.removeAllRanges(),r==null||r.addRange(l)}function z6t(e){const t=e.parentElement,n=e.previousSibling,r=e.nextSibling;e.remove(),(r==null?void 0:r.nodeType)===Node.TEXT_NODE&&/^[ \u00a0]/.test(r.textContent??"")?r.textContent=(r.textContent??"").slice(1):(n==null?void 0:n.nodeType)===Node.TEXT_NODE&&/[ \u00a0]$/.test(n.textContent??"")&&(n.textContent=(n.textContent??"").slice(0,-1)),t==null||t.normalize()}function F6t({value:e,label:t,placeholder:n,onChange:r,insertItem:s,onInserted:i}){const{t:o}=rt(),l=o("scheduledTasks.reference.remove"),c=h.useRef(null),u=h.useRef(""),d=h.useRef("");return h.useEffect(()=>{const f=c.current;f&&(e===u.current&&l===d.current||(lme(f,e,l),u.current=e,d.current=l))},[l,e]),h.useEffect(()=>{const f=c.current;if(!f||!s)return;B6t(f,s,l);const m=J6(f);u.current=m,r(m),f.focus(),i()},[s,r,i,l]),a.jsxs("div",{className:st.promptEditorWrap,children:[a.jsx("div",{ref:c,className:st.promptEditor,contentEditable:!0,role:"textbox","aria-label":t,"aria-multiline":"true","aria-placeholder":n,onMouseDown:f=>{f.target instanceof Element&&f.target.closest("[data-prompt-tag-remove]")&&f.preventDefault()},onClick:f=>{if(!(f.target instanceof Element))return;const m=f.target.closest("[data-prompt-tag-remove]"),p=m==null?void 0:m.closest("[data-prompt-tag-serialized]");if(!p||!f.currentTarget.contains(p))return;z6t(p);const g=y7(f.currentTarget,l);u.current=g,r(g),f.currentTarget.focus()},onInput:f=>{const m=y7(f.currentTarget,l);u.current=m,r(m)},onPaste:f=>{f.preventDefault(),xY(f.currentTarget,f.clipboardData.getData("text/plain"))},onDrop:f=>{f.preventDefault(),xY(f.currentTarget,f.dataTransfer.getData("text/plain"))},onCopy:f=>{const m=kY(f.currentTarget);m&&(f.preventDefault(),f.clipboardData.setData("text/plain",m.text))},onCut:f=>{const m=kY(f.currentTarget);if(!m)return;f.preventDefault(),f.clipboardData.setData("text/plain",m.text),m.selection.deleteFromDocument();const p=y7(f.currentTarget,l);u.current=p,r(p)}}),e.trim().length===0&&a.jsx("div",{className:st.promptPlaceholder,children:n})]})}function q6t({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,workspaces:r,lockedWorkspace:s,onError:i}){const{t:o}=rt(),l=ga(),c=Gu(),u=h.useMemo(()=>r??[],[r]),d=!s&&u.length>1,f=h.useMemo(()=>u.filter(le=>le.primary||le.trusted),[u]),m=h.useCallback(le=>le.primary?void 0:le.id,[]),p=s?m(s):void 0,[g,b]=h.useState(null),[w,y]=h.useState(null),[v,x]=h.useState(null),[k,S]=h.useState(null),[T,_]=h.useState(!1),[C,j]=h.useState(null),[E,L]=h.useState(p),[D,M]=h.useState(""),[R,$]=h.useState(""),[B,N]=h.useState(Jd),[z,G]=h.useState(!1),[I,Y]=h.useState(null),[U,P]=h.useState(null),[F,te]=h.useState([]),[W,K]=h.useState(!1),[ce,ie]=h.useState(null),[Z,ee]=h.useState(null),oe=h.useRef(null),we=h.useRef(null),[pe,he]=h.useState(null),[X,ye]=h.useState({}),[Ce,ae]=h.useState(null),[me,We]=h.useState(()=>Date.now()),Oe=h.useRef(!0),Mt=h.useRef(0),$t=h.useRef(0);h.useEffect(()=>(Oe.current=!0,()=>{Oe.current=!1}),[]);const St=h.useCallback(async()=>{const le=++Mt.current;try{let Le,dt=null;if(s?Le=(await l.listScheduledTasks(p)).map(Ge=>({...Ge,workspaceId:p,workspaceCwd:s.cwd})):d?Le=(await Promise.all(f.map(async un=>{try{return(await l.listScheduledTasks(m(un))).map(Me=>({...Me,workspaceId:m(un),workspaceCwd:un.cwd}))}catch(Wn){return dt||(dt=Wn instanceof Error?Wn.message:String(Wn)),[]}}))).flat():Le=await l.listScheduledTasks(),!Oe.current||le!==Mt.current)return;const Fe=[...Le].sort((Ge,un)=>un.createdAt-Ge.createdAt);b(Fe),y(dt)}catch(Le){if(!Oe.current||le!==Mt.current)return;y(Le instanceof Error?Le.message:String(Le)),b(dt=>dt??[])}},[l,d,s,p,f,m]);h.useEffect(()=>{St()},[St]);const ue=!!(g!=null&&g.some(le=>le.nextRunAt!=null));h.useEffect(()=>{if(!ue)return;const le=window.setInterval(()=>We(Date.now()),1e3);return()=>window.clearInterval(le)},[ue]);const Ee=h.useRef(0);h.useEffect(()=>{if(!g)return;let le=1/0;for(const Ge of g)Ge.nextRunAt!=null&&Ge.nextRunAt<le&&(le=Ge.nextRunAt);if(!Number.isFinite(le))return;const Le=le-Date.now();let dt;Le>0?(Ee.current=0,dt=Math.min(Le+2e3,A6t)):dt=Ee.current++<j6t?1e3:N6t;const Fe=window.setTimeout(()=>void St(),dt);return()=>window.clearTimeout(Fe)},[g,St]);const tt=R3(B),ut=tt?n_(tt,o):null,Ct=h.useCallback(()=>{const le=oe.current;if(!le){he(null);return}const Le=getComputedStyle(le);ye(Object.fromEntries(M6t.map(Me=>[Me,Le.getPropertyValue(Me)])));const dt=le.getBoundingClientRect(),Fe=Math.min(420,window.innerWidth-24),Ge=Math.max(12,Math.min(dt.left,window.innerWidth-Fe-12)),un=dt.bottom+6,Wn=Math.max(140,Math.min(320,window.innerHeight-un-12));he(Me=>{const yt={left:Ge,top:un,width:Fe,maxHeight:Wn};return Me&&Me.left===yt.left&&Me.top===yt.top&&Me.width===yt.width&&Me.maxHeight===yt.maxHeight?Me:yt})},[]),Ze=h.useCallback(()=>{$t.current+=1,P(null),te([]),K(!1),ie(null),ee(null),he(null),ye({})},[]),Et=h.useCallback(async le=>{const Le=++$t.current;if(U===le){Ze();return}Ct(),P(le),K(!0),ie(null),te([]);try{let dt;if(le==="extension"?dt=((await l.loadExtensionsStatus()).extensions??[]).filter(Ge=>Ge.isActive).map(Ge=>({id:Ge.id||Ge.name,kind:le,label:Ge.name,tagLabel:ui(Ge.displayName??"")||Ge.name,description:D6t(Ge),insertText:`@ext:${p7(Ge.name)} `})):le==="skill"?dt=((await l.loadSkillsStatus()).skills??[]).filter(Ge=>Ge.modelInvocable).map(Ge=>({id:Ge.name,kind:le,label:Ge.name,description:L6t(Ge),insertText:`/${p7(Ge.name)} `})):dt=((await l.loadMcpStatus()).servers??[]).filter(Ge=>!Ge.disabled).map(Ge=>({id:Ge.name,kind:le,label:Ge.name,description:P6t(Ge),insertText:`@mcp:${p7(Ge.name)} `})),!Oe.current||Le!==$t.current)return;te(dt)}catch(dt){if(!Oe.current||Le!==$t.current)return;ie(dt instanceof Error?dt.message:String(dt))}finally{Oe.current&&Le===$t.current&&K(!1)}},[l,U,Ze,Ct]);h.useEffect(()=>{if(!U)return;Ct();const le=Fe=>{const Ge=oe.current,un=we.current;Ge!=null&&Ge.contains(Fe.target)||un!=null&&un.contains(Fe.target)||Ze()},Le=Fe=>{Fe.key==="Escape"&&(Fe.preventDefault(),Fe.stopPropagation(),Ze())},dt=()=>Ct();return document.addEventListener("pointerdown",le),document.addEventListener("keydown",Le,!0),window.addEventListener("resize",dt),window.addEventListener("scroll",dt,!0),()=>{document.removeEventListener("pointerdown",le),document.removeEventListener("keydown",Le,!0),window.removeEventListener("resize",dt),window.removeEventListener("scroll",dt,!0)}},[U,Ze,Ct]);const Nt=h.useCallback(()=>{M(""),$(""),N(Jd),Y(null),_(!1),j(null),L(p),Ze()},[p,Ze]),gt=h.useCallback(()=>{j(null),L(p),M(""),$(""),N(Jd),Y(null),Ze(),_(!0)},[p,Ze]),Je=h.useCallback(le=>{j(le.id),L(le.workspaceId),M(le.name??""),$(le.prompt),N(Lm(le.cron)),Y(null),Ze(),_(!0)},[Ze]),Ae=h.useCallback(async()=>{const le=R3(B);if(!le){Y(o("scheduledTasks.error.invalidSchedule"));return}if(R.trim().length===0){Y(o("scheduledTasks.error.emptyPrompt"));return}if(R.length>r_){Y(o("scheduledTasks.error.promptTooLong",{max:r_}));return}G(!0),Y(null);try{if(C?await l.updateScheduledTask(C,{cron:le,prompt:R.trim(),name:D.trim()||null},E):await l.createScheduledTask({cron:le,prompt:R.trim(),name:D.trim()||null,recurring:!0,enabled:!0},E),!Oe.current)return;Nt(),await St()}catch(Le){if(!Oe.current)return;Y(Le instanceof Error?Le.message:String(Le))}finally{Oe.current&&G(!1)}},[l,B,C,E,D,R,St,Nt,o]),de=h.useCallback(async le=>{x(Mm(le));try{await l.updateScheduledTask(le.id,{enabled:!le.enabled},le.workspaceId),await St()}catch(Le){i(Le,o("scheduledTasks.error.toggleFailed"))}finally{Oe.current&&x(null)}},[l,i,St,o]),nt=h.useCallback(async le=>{if(!(!le.enabled||k!==null)){S(le.id);try{const Le=(await l.listScheduledTasks(le.workspaceId)).find(dt=>dt.id===le.id);if(!Le||!Le.enabled){await St().catch(()=>{}),i(new Error("This task is no longer runnable."),o("scheduledTasks.error.runFailed"));return}if(Le.recurring){await e(Le.prompt,Le.sessionId);try{await l.runScheduledTask(Le.id,le.workspaceId),await St()}catch(dt){i(dt,o("scheduledTasks.error.runFailed"))}}else{await l.runScheduledTask(Le.id,le.workspaceId),await St();try{await e(Le.prompt,Le.sessionId)}catch(dt){i(dt,o("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(Le){i(Le,o("scheduledTasks.error.runFailed"))}finally{S(null)}}},[l,i,e,St,k,o]),ve=h.useCallback(async le=>{const Le=le.name||le.prompt,dt=Le.length>60?`${Le.slice(0,57)}…`:Le;if(window.confirm(o("scheduledTasks.deleteConfirm",{name:dt}))){x(Mm(le));try{await l.deleteScheduledTask(le.id,le.workspaceId),await St()}catch(Fe){i(Fe,o("scheduledTasks.error.deleteFailed"))}finally{Oe.current&&x(null)}}},[l,i,St,o]),Ke=U&&pe?xd.createPortal(a.jsx("div",{ref:we,className:st.referencePicker,role:"listbox","aria-label":o("scheduledTasks.referencePicker"),style:{...X,left:pe.left,top:pe.top,width:pe.width,maxHeight:pe.maxHeight},onWheel:le=>{le.stopPropagation()},onTouchMove:le=>le.stopPropagation(),children:W?a.jsx("div",{className:st.referenceEmpty,children:o("scheduledTasks.reference.loading")}):ce?a.jsx("div",{className:st.referenceError,children:ce}):F.length===0?a.jsx("div",{className:st.referenceEmpty,children:o("scheduledTasks.reference.empty")}):F.map(le=>a.jsxs("button",{type:"button",className:st.referenceItem,role:"option","aria-selected":"false",onMouseDown:Le=>Le.preventDefault(),onClick:()=>{ee(le),P(null)},children:[a.jsx("span",{className:st.referenceItemLabel,children:le.label}),le.description&&a.jsx("span",{className:st.referenceItemDescription,children:le.description})]},`${le.kind}:${le.id}`))}),c??document.body):null;return a.jsxs("div",{className:st.root,children:[a.jsx("div",{className:st.intro,children:o("scheduledTasks.subtitle")}),a.jsxs("div",{className:st.toolbar,children:[a.jsx("div",{className:st.count,children:g===null?o("scheduledTasks.loading"):o("scheduledTasks.count",{count:g.length})}),a.jsxs("div",{className:st.toolbarActions,children:[a.jsx("button",{type:"button",className:st.secondaryButton,onClick:()=>void St(),children:o("scheduledTasks.refresh")}),a.jsx("button",{type:"button",className:st.secondaryButton,onClick:t,children:o("scheduledTasks.createViaChat")}),a.jsx("button",{type:"button",className:st.primaryButton,onClick:gt,children:o("scheduledTasks.new")})]})]}),T&&a.jsx(zi,{title:o(C?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:Nt,children:a.jsxs("div",{className:st.formFields,children:[d&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.workspace")}),a.jsx("select",{className:st.select,value:E??"",disabled:!!C||f.length<=1,onChange:le=>L(le.target.value||void 0),children:f.map(le=>a.jsx("option",{value:m(le)??"",children:X6(le)},le.id))})]}),a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.name")}),a.jsx("input",{className:st.input,type:"text",value:D,maxLength:200,placeholder:o("scheduledTasks.namePlaceholder"),onChange:le=>M(le.target.value)})]}),a.jsxs("label",{className:st.field,children:[a.jsxs("span",{className:st.fieldLabel,children:[o("scheduledTasks.prompt"),a.jsx("span",{className:st.required,children:"*"})]}),a.jsx(F6t,{value:R,label:o("scheduledTasks.prompt"),placeholder:o("scheduledTasks.promptPlaceholder"),onChange:$,insertItem:Z,onInserted:()=>ee(null)})]}),a.jsx("div",{ref:oe,className:st.referencePopover,children:a.jsx("div",{className:st.referenceBar,children:["extension","skill","mcp"].map(le=>{const Le=a1(le);return a.jsxs("button",{type:"button",className:`${st.referenceButton} ${U===le?st.referenceButtonActive:""}`,"aria-expanded":U===le,onClick:()=>void Et(le),children:[Le&&a.jsx("span",{className:st.referenceButtonIcon,style:{"--composer-tag-icon-url":P6(Le)},"aria-hidden":!0}),o(`scheduledTasks.reference.${le}`)]},le)})})}),a.jsxs("div",{className:st.scheduleRow,children:[a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.frequency")}),a.jsx("select",{className:st.select,value:B.frequency,onChange:le=>{const Le=le.target.value;N(dt=>({...dt,frequency:Le,...Le==="hourly"?{time:"00:00"}:{}}))},children:T6t.map(le=>a.jsx("option",{value:le,children:o(`scheduledTasks.freq.${le}`)},le))})]}),(B.frequency==="daily"||B.frequency==="weekdays"||B.frequency==="weekly")&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.time")}),a.jsx("input",{className:st.input,type:"time",value:B.time,onChange:le=>N(Le=>({...Le,time:le.target.value}))})]}),B.frequency==="weekly"&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.weekday")}),a.jsx("select",{className:st.select,value:B.weekday,onChange:le=>N(Le=>({...Le,weekday:Number(le.target.value)})),children:o("scheduledTasks.weekdayNames").split(",").map((le,Le)=>a.jsx("option",{value:Le,children:le},Le))})]}),B.frequency==="minutes"&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.interval")}),a.jsx("select",{className:st.select,value:B.minuteInterval,onChange:le=>N(Le=>({...Le,minuteInterval:Number(le.target.value)})),children:E6t.map(le=>a.jsx("option",{value:le,children:le},le))})]}),B.frequency==="custom"&&a.jsxs("label",{className:`${st.field} ${st.fieldGrow}`,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.cron")}),a.jsx("input",{className:st.input,type:"text",value:B.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:le=>N(Le=>({...Le,customCron:le.target.value}))})]})]}),a.jsx("div",{className:st.preview,children:ut?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:st.previewLabel,children:ut}),a.jsx("code",{className:st.previewCron,children:tt})]}):a.jsx("span",{className:st.previewInvalid,children:o("scheduledTasks.error.invalidSchedule")})}),I&&a.jsx("div",{className:st.formError,children:I}),a.jsxs("div",{className:st.formActions,children:[a.jsx("button",{type:"button",className:st.secondaryButton,onClick:Nt,disabled:z,children:o("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:st.primaryButton,onClick:()=>void Ae(),disabled:z,children:o(z?C?"scheduledTasks.saving":"scheduledTasks.creating":C?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),Ke,w&&a.jsx("div",{className:st.loadError,children:w}),g!==null&&g.length===0&&!w&&a.jsx("div",{className:st.empty,children:o("scheduledTasks.empty")}),a.jsx("div",{className:st.list,children:(g??[]).map(le=>{const Le=le.name||le.prompt,dt=v===Mm(le);return a.jsxs("div",{className:`${st.card} ${le.enabled?"":st.cardDisabled}`,children:[a.jsxs("div",{className:st.cardHeader,children:[a.jsx("button",{type:"button",role:"switch","aria-checked":le.enabled,"aria-label":le.enabled?o("scheduledTasks.disable"):o("scheduledTasks.enable"),className:`${st.toggle} ${le.enabled?st.toggleOn:""}`,onClick:()=>void de(le),disabled:dt,children:a.jsx("span",{className:st.toggleKnob})}),a.jsx("div",{className:st.cardTitle,title:Le,children:Le}),a.jsxs("div",{className:st.cardMenu,children:[a.jsx("button",{type:"button",className:st.iconAction,onClick:()=>void nt(le),disabled:!le.enabled||k!==null,title:o("scheduledTasks.runNow"),"aria-label":o("scheduledTasks.runNow"),children:"▶"}),a.jsx("button",{type:"button",className:st.iconAction,onClick:()=>Je(le),disabled:dt,title:o("scheduledTasks.edit"),"aria-label":o("scheduledTasks.edit"),children:"✎"}),a.jsx("button",{type:"button",className:st.iconAction,onClick:()=>void ve(le),disabled:dt,title:o("scheduledTasks.delete"),"aria-label":o("scheduledTasks.delete"),children:"✕"})]})]}),le.name&&a.jsx("div",{className:st.cardPrompt,title:le.prompt,children:le.prompt}),a.jsxs("div",{className:st.cardFooter,children:[d&&le.workspaceCwd&&a.jsxs("span",{className:st.workspacePill,title:le.workspaceCwd,children:[a.jsx("span",{className:st.workspaceIcon,"aria-hidden":"true",children:"⌂"}),Q6(le.workspaceCwd,u)]}),a.jsxs("span",{className:st.schedulePill,children:[a.jsx("span",{className:st.clockIcon,"aria-hidden":"true",children:"◷"}),n_(le.cron,o)]}),a.jsx("span",{className:st.recurringTag,children:o(le.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),le.nextRunAt!=null&&a.jsxs("span",{className:st.countdown,"data-testid":"scheduled-task-next-run",title:o("scheduledTasks.nextRunTooltip",{when:sme(le.nextRunAt)}),children:[a.jsx("span",{className:st.hourglassIcon,"aria-hidden":"true",children:"⏳"}),Fst(le.nextRunAt-me,o)]}),a.jsx("span",{className:st.lastFired,children:qst(le,o)}),le.sessionId&&n?a.jsx("button",{type:"button",className:st.runsToggle,onClick:()=>n(le.sessionId),title:o("scheduledTasks.viewHistoryHint"),children:le.runs.length>0?o("scheduledTasks.viewHistory",{count:le.runs.length}):o("scheduledTasks.viewHistoryEmpty")}):le.runs.length>0&&a.jsx("button",{type:"button",className:st.runsToggle,"aria-expanded":Ce===Mm(le),onClick:()=>ae(Fe=>Fe===Mm(le)?null:Mm(le)),children:o("scheduledTasks.runHistory",{count:le.runs.length})})]}),Ce===Mm(le)&&le.runs.length>0&&a.jsx("ul",{className:st.runsList,children:[...le.runs].reverse().map((Fe,Ge)=>a.jsx("li",{className:st.runsItem,children:C6t(Fe,o)},`${Fe.at}-${Ge}`))})]},Mm(le))})})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const H6t=new Set(["clear","stop","off","reset","none","cancel"]);function TR(e){return e.replace(/^\/goal\b/i,"").trim()}function U6t(e){return/^\/goal\b/i.test(e.trim())?wO(TR(e.trim())):!1}function wO(e){return H6t.has(e.trim().toLowerCase())}const W6t="_root_v50oc_1",V6t="_intro_v50oc_8",G6t="_toolbar_v50oc_14",K6t="_count_v50oc_22",Y6t="_toolbarActions_v50oc_28",X6t="_primaryButton_v50oc_34",Q6t="_secondaryButton_v50oc_35",J6t="_formFields_v50oc_80",Z6t="_field_v50oc_86",e8t="_fieldLabel_v50oc_93",t8t="_required_v50oc_102",n8t="_textarea_v50oc_59",r8t="_formHint_v50oc_126",s8t="_formError_v50oc_132",i8t="_loadError_v50oc_133",o8t="_degraded_v50oc_140",a8t="_formActions_v50oc_148",l8t="_empty_v50oc_156",c8t="_list_v50oc_163",u8t="_card_v50oc_169",d8t="_cardHeader_v50oc_180",h8t="_statusDot_v50oc_188",f8t="_statusDotRunning_v50oc_196",m8t="_cardTitle_v50oc_200",p8t="_cardMenu_v50oc_211",g8t="_iconAction_v50oc_218",b8t="_cardReason_v50oc_250",y8t="_reasonLabel_v50oc_262",v8t="_cardFooter_v50oc_266",w8t="_statusPill_v50oc_274",x8t="_meta_v50oc_285",k8t="_sessionLink_v50oc_290",ms={root:W6t,intro:V6t,toolbar:G6t,count:K6t,toolbarActions:Y6t,primaryButton:X6t,secondaryButton:Q6t,formFields:J6t,field:Z6t,fieldLabel:e8t,required:t8t,textarea:n8t,formHint:r8t,formError:s8t,loadError:i8t,degraded:o8t,formActions:a8t,empty:l8t,list:c8t,card:u8t,cardHeader:d8t,statusDot:h8t,statusDotRunning:f8t,cardTitle:m8t,cardMenu:p8t,iconAction:g8t,cardReason:b8t,reasonLabel:y8t,cardFooter:v8t,statusPill:w8t,meta:x8t,sessionLink:k8t},_8t=1e4,S8t=1e3;function C8t({onCreateGoal:e,onOpenSession:t,onError:n}){const{t:r}=rt(),s=ga(),[i,o]=h.useState(null),[l,c]=h.useState(0),[u,d]=h.useState(null),[f,m]=h.useState(null),[p,g]=h.useState(!1),[b,w]=h.useState(""),[y,v]=h.useState(!1),[x,k]=h.useState(null),[S,T]=h.useState(()=>Date.now()),_=h.useRef(!0),C=h.useRef(0);h.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]);const j=h.useCallback(async()=>{const R=++C.current;try{const $=await s.listGoals();if(!_.current||R!==C.current)return;o($.goals),c($.droppedCount),d(null)}catch($){if(!_.current||R!==C.current)return;d($ instanceof Error?$.message:String($)),o(B=>B??[]),c(0)}},[s]);h.useEffect(()=>{let R=!1,$=0;const B=async()=>{await j(),!R&&($=window.setTimeout(()=>void B(),_8t))};return B(),()=>{R=!0,window.clearTimeout($)}},[j]);const E=!!(i!=null&&i.length);h.useEffect(()=>{if(!E)return;const R=window.setInterval(()=>T(Date.now()),S8t);return()=>window.clearInterval(R)},[E]);const L=h.useCallback(()=>{w(""),k(null),g(!1)},[]),D=h.useCallback(async()=>{const R=b.trim();if(R.length===0){k(r("goals.error.emptyCondition"));return}if(wO(R)){k(r("goals.error.clearKeyword",{word:R}));return}v(!0),k(null);try{const $=await e(R);if(!_.current||$===!1)return;L()}catch($){if(!_.current){n($,r("goals.error.createFailed"));return}k($ instanceof Error?$.message:String($))}finally{_.current&&v(!1)}},[b,e,n,L,r]),M=h.useCallback(async R=>{const $=R.condition.length>60?`${R.condition.slice(0,57)}…`:R.condition;if(window.confirm(r("goals.clearConfirm",{condition:$}))){m(R.sessionId);try{await s.clearGoal(R.sessionId),await j()}catch(B){n(B,r("goals.error.clearFailed"))}finally{_.current&&m(null)}}},[s,n,j,r]);return a.jsxs("div",{className:ms.root,children:[a.jsx("div",{className:ms.intro,children:r("goals.subtitle")}),a.jsxs("div",{className:ms.toolbar,children:[a.jsx("div",{className:ms.count,children:i===null?r("goals.loading"):r("goals.count",{count:i.length})}),a.jsxs("div",{className:ms.toolbarActions,children:[a.jsx("button",{type:"button",className:ms.secondaryButton,onClick:()=>void j(),children:r("goals.refresh")}),a.jsx("button",{type:"button",className:ms.primaryButton,onClick:()=>{w(""),k(null),g(!0)},children:r("goals.new")})]})]}),p&&a.jsx(zi,{title:r("goals.new"),size:"md",onClose:L,children:a.jsxs("div",{className:ms.formFields,children:[a.jsxs("label",{className:ms.field,children:[a.jsxs("span",{className:ms.fieldLabel,children:[r("goals.condition"),a.jsx("span",{className:ms.required,children:"*"})]}),a.jsx("textarea",{className:ms.textarea,value:b,rows:4,placeholder:r("goals.conditionPlaceholder"),onChange:R=>w(R.target.value)})]}),a.jsx("div",{className:ms.formHint,children:r("goals.newHint")}),x&&a.jsx("div",{className:ms.formError,role:"alert",children:x}),a.jsxs("div",{className:ms.formActions,children:[a.jsx("button",{type:"button",className:ms.secondaryButton,onClick:L,disabled:y,children:r("goals.cancel")}),a.jsx("button",{type:"button",className:ms.primaryButton,onClick:()=>void D(),disabled:y,children:r(y?"goals.creating":"goals.create")})]})]})}),u&&a.jsx("div",{className:ms.loadError,role:"alert",children:u}),l>0&&a.jsx("div",{className:ms.degraded,"data-testid":"goals-dropped",children:r("goals.dropped",{count:l})}),i!==null&&i.length===0&&!u&&a.jsx("div",{className:ms.empty,children:r("goals.empty")}),a.jsx("div",{className:ms.list,role:"list",children:(i??[]).map(R=>{const $=f===R.sessionId;return a.jsxs("div",{className:ms.card,role:"listitem",children:[a.jsxs("div",{className:ms.cardHeader,children:[a.jsx("span",{className:`${ms.statusDot} ${R.hasActivePrompt?ms.statusDotRunning:""}`,"aria-hidden":"true"}),a.jsx("div",{className:ms.cardTitle,title:R.condition,children:R.condition}),a.jsx("div",{className:ms.cardMenu,children:a.jsx("button",{type:"button",className:ms.iconAction,onClick:()=>void M(R),disabled:$,title:r("goals.clear"),"aria-label":r("goals.clear"),children:"✕"})})]}),R.lastReason&&a.jsxs("div",{className:ms.cardReason,children:[a.jsxs("span",{className:ms.reasonLabel,children:[r("goal.lastCheck"),":"]})," ",R.lastReason]}),a.jsxs("div",{className:ms.cardFooter,children:[a.jsx("span",{className:ms.statusPill,children:r(R.hasActivePrompt?"goals.running":"goals.idle")}),a.jsx("span",{className:ms.meta,children:R.iterations>0?r(R.iterations===1?"goal.turn":"goal.turns",{count:R.iterations}):r("goals.notYetEvaluated")}),a.jsx("span",{className:ms.meta,"data-testid":"goal-elapsed",children:Hy(Math.max(0,S-R.setAt))}),a.jsx("button",{type:"button",className:ms.sessionLink,onClick:()=>t(R.sessionId),title:r("goals.openSessionHint"),"aria-label":`${r("goals.openSessionHint")}: ${R.displayName||R.sessionId}`,children:R.displayName||R.sessionId})]})]},R.sessionId)})})]})}function wb(e){return e.replace(/[：:\s]+$/u,"")}const T8t="_extensionGrid_1aki4_1",E8t={extensionGrid:T8t};function A8t(e,t){return e&&t.some(n=>n.name===e)?e:null}function j8t(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>[r.name,r.displayName,r.description].filter(s=>!!s).some(s=>s.toLowerCase().includes(n))):[...e]}function ume({className:e,...t}){return a.jsx(doe,{"data-slot":"radio-group",className:ln("grid w-full gap-2",e),...t})}function dme({className:e,...t}){return a.jsx(moe,{"data-slot":"radio-group-item",className:ln("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary",e),...t,children:a.jsx(goe,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:a.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}const _Y="update available";function Vw(e){return e.displayName||e.name}function ER(e){return e.workspaceActivation&&e.workspaceActivation!=="inherit"?e.workspaceActivation==="enabled":e.defaultActivation?e.defaultActivation==="enabled":e.isActive}function v7(e,t){return ER(e)?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function w7(e,t){switch(e){case"update available":return t("extensions.manage.updateAvailable");case"up to date":return t("extensions.manage.upToDate");case"not updatable":return t("extensions.manage.notUpdatable");case"checking for updates":return t("extensions.manage.checkingUpdates");case"updating":return t("extensions.manage.updating");case"updated":return t("extensions.manage.updateComplete");case"updated with warnings":return t("extensions.manage.updatedWithWarnings");case"updated, needs restart":return t("extensions.manage.restartRequired");case"error":return t("extensions.manage.updateError");case"unknown":case void 0:return t("extensions.manage.unknownUpdate")}}function EC(e,t,n){switch(e){case"enable":return n("extensions.manage.enabling",{name:t});case"disable":return n("extensions.manage.disabling",{name:t});case"uninstall":return n("extensions.manage.uninstalling",{name:t});case"update":return n("extensions.manage.updatingExtension",{name:t});default:return n("extensions.manage.queued",{name:t})}}function SY(e,t,n){switch(e){case"enable":return n("extensions.manage.enabled",{name:t});case"disable":return n("extensions.manage.disabled",{name:t});case"uninstall":return n("extensions.manage.uninstalled",{name:t});case"update":return n("extensions.manage.updated",{name:t});default:return n("extensions.manage.queued",{name:t})}}function af({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:wb(e)}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function Gw({items:e,empty:t,icon:n}){return e.length?a.jsx(Uo,{children:a.jsx(hc,{className:"flex flex-col",children:e.map((r,s)=>a.jsxs("div",{children:[s>0?a.jsx(iO,{}):null,a.jsxs("div",{className:"flex min-w-0 items-center gap-3 py-3 [contain-intrinsic-size:auto_44px] [content-visibility:auto]",children:[a.jsx(n,{className:"size-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 break-words",children:r})]})]},r))})}):a.jsx(fd,{className:"border",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:a.jsx(n,{})}),a.jsx(gd,{children:t})]})})}function CY({pendingInteraction:e,submitting:t,selectedPlugin:n,interactionValue:r,setSelectedPlugin:s,setInteractionValue:i,submit:o,t:l}){return a.jsx(zp,{open:!!e,onOpenChange:c=>{!c&&e&&!t&&o({cancelled:!0})},children:a.jsxs(Fp,{showCloseButton:!1,className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-3xl",children:[a.jsxs(qp,{className:"items-start px-3 text-left",children:[a.jsx(Up,{children:(e==null?void 0:e.interaction.kind)==="setting"?e.interaction.setting.name:l("extensions.manage.selectExtension")}),a.jsx(Hg,{children:(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?l("extensions.manage.installSelectPluginDescription",{marketplace:e.interaction.marketplace.name}):e==null?void 0:e.interaction.setting.description})]}),(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?a.jsx(ume,{"aria-label":l("extensions.manage.selectExtension"),value:n,onValueChange:s,className:"flex flex-col gap-2 px-3",children:e.interaction.plugins.map(c=>{var d;const u=`marketplace-plugin-${c.name}`;return a.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-border p-3 has-data-[state=checked]:bg-accent/50",children:[a.jsx(dme,{id:u,value:c.name,disabled:t,className:"mt-0.5"}),a.jsxs("label",{htmlFor:u,className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-1",children:[a.jsx("span",{className:"font-medium",children:c.name}),a.jsx("span",{className:"text-sm text-muted-foreground",children:c.description??c.category??(c.source==="."||c.source==="./"?l("extensions.manage.marketplaceRoot"):c.source)??l("extensions.manage.noDescription")}),(d=c.tags)!=null&&d.length?a.jsx("span",{className:"text-xs text-muted-foreground",children:c.tags.join(" · ")}):null]})]},c.name)})}):null,(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?a.jsxs(Hp,{children:[a.jsx(Zt,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:l("common.cancel")}),a.jsxs(Zt,{disabled:t||!n,onClick:()=>o({pluginName:n}),children:[t?a.jsx(Hr,{}):null,e.owner==="mutation"?l("extensions.manage.update"):l("extensions.manage.install")]})]}):(e==null?void 0:e.interaction.kind)==="setting"?a.jsxs(a.Fragment,{children:[a.jsx(Us,{autoComplete:"off","aria-label":e.interaction.setting.name,type:e.interaction.setting.sensitive?"password":"text",value:r,onChange:c=>i(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!t&&(c.preventDefault(),o({value:r}))}}),a.jsxs(Hp,{children:[a.jsx(Zt,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:l("common.cancel")}),a.jsxs(Zt,{disabled:t,onClick:()=>o({value:r}),children:[t?a.jsx(Hr,{}):null,e.owner==="mutation"?l("extensions.manage.update"):l("extensions.manage.install")]})]})]}):null]})})}function hme({onClose:e,initialFocusRef:t,embedded:n}){const{t:r}=rt(),s=qa(),i=yo(),o=ga(),l=Nh(),[c,u]=h.useState([]),[d,f]=h.useState(null),[m,p]=h.useState(""),[g,b]=h.useState({}),[w,y]=h.useState(!1),[v,x]=h.useState(null),[k,S]=h.useState(null),[T,_]=h.useState(null),[C,j]=h.useState("info"),[E,L]=h.useState(null),[D,M]=h.useState(null),[R,$]=h.useState(!1),[B,N]=h.useState(null),[z,G]=h.useState(!1),[I,Y]=h.useState(""),[U,P]=h.useState(!1),[F,te]=h.useState(null),[W,K]=h.useState(null),ce=h.useRef(null),[ie,Z]=h.useState(""),[ee,oe]=h.useState(""),[we,pe]=h.useState(!1),[he,X]=h.useState(!1),ye=h.useRef(!1),Ce=h.useRef(null),ae=h.useRef(null),me=h.useRef(new Map),We=h.useRef(null),[Oe,Mt]=h.useState(null),$t=h.useCallback(ve=>{ve&&ae.current!==ve||(ae.current=null,ce.current=null,K(null),Z(""),oe(""))},[]),St=h.useCallback((ve,Ke,le)=>{ce.current!==Ke.id&&(Z(""),oe(""),ce.current=Ke.id),ae.current=ve,K({operationId:ve,interaction:Ke,owner:le})},[]),ue=h.useCallback((ve=!1)=>{y(!0);const Ke=i.workspaceCwd?i.client.workspaceByCwd(i.workspaceCwd).workspaceExtensions().catch(()=>null):Promise.resolve(null);return Promise.all([o.loadExtensionsStatus(),Ke]).then(([le,Le])=>{var Ge,un,Wn;const dt=new Map(((Le==null?void 0:Le.extensions)??[]).map(Me=>[Me.extensionId,Me])),Fe=(le.extensions??[]).map(Me=>{const yt=dt.get(Me.id);return yt?{...Me,defaultActivation:yt.defaultActivation,workspaceActivation:yt.workspaceActivation??"inherit"}:Me});u(Me=>{const yt=Ce.current;if(!yt||Fe.some(Re=>Re.name===yt))return Fe;const cn=Me.find(Re=>Re.name===yt);return cn?[...Fe,cn]:Fe}),ve||(L(null),j((Ge=le.errors)!=null&&Ge[0]?"error":"info"),_(((Wn=(un=le.errors)==null?void 0:un[0])==null?void 0:Wn.error)??null)),f(Me=>Me&&Ce.current===Me?Me:A8t(Me,Fe))}).catch(le=>{ve||(L(null),j("error"),_(le instanceof Error?le.message:String(le)))}).finally(()=>y(!1))},[o,i.client,i.workspaceCwd]);h.useEffect(()=>{ue()},[ue]),h.useEffect(()=>{let ve=!1,Ke,le=2e3;const Le=async()=>{try{const{operations:dt}=await o.activeExtensionOperations();if(ve)return;const Fe=dt.filter(un=>un.operation==="install").sort((un,Wn)=>Wn.createdAt-un.createdAt)[0];Fe&&te(un=>un??{operationId:Fe.operationId,source:Fe.source??Fe.name??"extension"});const Ge=dt.find(un=>un.operation!=="install");Ge&&(ye.current=!0,Ge.operation==="uninstall"&&(Ce.current=Ge.name??"extension"),Mt(un=>un??{operationId:Ge.operationId,name:Ge.name??"extension",operation:Ge.operation}),S(un=>un??Ge.name??null)),M(null),X(!0)}catch(dt){ve||(M(dt instanceof Error?dt.message:String(dt)),Ke=setTimeout(()=>void Le(),le),le=Math.min(le*2,3e4))}};return Le(),()=>{ve=!0,Ke&&clearTimeout(Ke)}},[o]);const Ee=h.useRef((l==null?void 0:l.extensionsVersion)??0);h.useEffect(()=>{const ve=(l==null?void 0:l.extensionsVersion)??0;ve!==Ee.current&&(Ee.current=ve,b({}),ue(!0))},[ue,l==null?void 0:l.extensionsVersion]),h.useEffect(()=>{if(!F)return;let ve=!1,Ke,le=1e3;const Le=async()=>{var dt,Fe;try{const Ge=await o.extensionOperationStatus(F.operationId);if(ve)return;if(le=1e3,Ge.status==="waiting_for_input"){Ge.interaction?(St(Ge.operationId,Ge.interaction,"install"),Ke=setTimeout(()=>void Le(),5e3)):(j("error"),_(r("extensions.manage.operationFailed")),$t(F.operationId),te(null));return}if(Ge.status==="failed"){j("error"),_(r("extensions.install.failed",{source:F.source,error:Ge.error??""})),$t(F.operationId),te(null);return}if(Ge.status==="succeeded"||Ge.status==="succeeded_with_refresh_error"){j(Ge.status==="succeeded_with_refresh_error"?"error":"success"),_(Ge.status==="succeeded_with_refresh_error"?r("extensions.manage.refreshFailed",{error:((dt=Ge.result)==null?void 0:dt.error)??""}):r("extensions.install.installed",{name:((Fe=Ge.result)==null?void 0:Fe.name)??F.source})),$t(F.operationId),te(null),ue(!0);return}j("progress"),_(r("extensions.install.started",{source:F.source})),Ke=setTimeout(()=>void Le(),1e3)}catch(Ge){if(ve)return;if(j("error"),_(Ge instanceof Error?Ge.message:String(Ge)),Ge instanceof Zc&&Ge.status===404){$t(F.operationId),te(null);return}Ke=setTimeout(()=>void Le(),le),le=Math.min(le*2,3e4)}};return Le(),()=>{ve=!0,Ke&&clearTimeout(Ke)}},[o,$t,ue,F,St,r]);const tt=h.useCallback(ve=>{if(!W)return;const Ke=W.owner,le=()=>{Ke==="install"?te(Le=>Le&&{...Le}):Mt(Le=>Le&&{...Le})};pe(!0),o.respondToExtensionInteraction(W.operationId,W.interaction.id,ve,s.clientId).then(()=>{$t(W.operationId),le()}).catch(Le=>{j("error"),_(Le instanceof Error?Le.message:String(Le)),$t(W.operationId),le()}).finally(()=>pe(!1))},[o,$t,s.clientId,W]);h.useEffect(()=>{if(!Oe)return;let ve=!1,Ke,le=1e3;const Le=async()=>{var dt;try{const Fe=await o.extensionOperationStatus(Oe.operationId);if(ve)return;if(le=1e3,Fe.status==="waiting_for_input"){Fe.interaction?(St(Fe.operationId,Fe.interaction,"mutation"),Ke=setTimeout(()=>void Le(),5e3)):(j("error"),_(r("extensions.manage.operationFailed")),$t(Oe.operationId),Mt(null),S(null),ye.current=!1,Oe.operation==="uninstall"&&(Ce.current=null,ue(!0)));return}if(Fe.status==="failed"){j("error"),_(Fe.error??r("extensions.manage.operationFailed")),$t(Oe.operationId),Mt(null),S(null),ye.current=!1,Fe.operation==="uninstall"&&(Ce.current=null,ue(!0));return}if(Fe.status==="succeeded"||Fe.status==="succeeded_with_refresh_error"){Fe.status==="succeeded_with_refresh_error"?(j("error"),_(r("extensions.manage.refreshFailed",{error:((dt=Fe.result)==null?void 0:dt.error)??""}))):Fe.operation==="uninstall"?_(null):(j("success"),_(SY(Fe.operation,Oe.name,r))),$t(Oe.operationId),Mt(null),S(null),ye.current=!1,Fe.operation==="uninstall"&&(Ce.current=null,L(null),f(null)),Fe.operation==="update"&&b(Ge=>{const un={...Ge};return delete un[Oe.name],un}),ue(!0);return}j("progress"),_(EC(Fe.operation,Oe.name,r)),Ke=setTimeout(()=>void Le(),1e3)}catch(Fe){if(ve)return;if(j("error"),_(Fe instanceof Error?Fe.message:String(Fe)),Fe instanceof Zc&&Fe.status===404){$t(Oe.operationId),Mt(null),S(null),ye.current=!1,Oe.operation==="uninstall"&&(Ce.current=null,ue(!0));return}Ke=setTimeout(()=>void Le(),le),le=Math.min(le*2,3e4)}};return Le(),()=>{ve=!0,Ke&&clearTimeout(Ke)}},[o,$t,ue,Oe,St,r]);const ut=h.useCallback(()=>{L(null),j("info"),_(null),ue()},[ue]),Ct=h.useCallback(ve=>{x(ve),L(d===ve?ve:null),j("info"),_(null),b(Ke=>({...Ke,[ve]:"checking for updates"})),o.checkExtensionUpdates(s.clientId).then(Ke=>{b(Ke.states),_(w7(Ke.states[ve],r))}).catch(Ke=>{b(le=>({...le,[ve]:"error"})),j("error"),_(Ke instanceof Error?Ke.message:String(Ke))}).finally(()=>x(null))},[o,s.clientId,d,r]),Ze=h.useCallback(()=>{const ve=I.trim(),Ke=s.clientId;!ve||!he||F||Oe||ye.current||(P(!0),L(null),j("progress"),_(null),o.installExtension({source:ve,consent:!0},Ke).then(le=>{te({operationId:le.operationId,source:ve}),Y(""),G(!1)}).catch(le=>{j("error"),_(le instanceof Error?le.message:String(le))}).finally(()=>P(!1)))},[o,s.clientId,I,he,F,Oe]),Et=h.useCallback((ve,Ke,le={})=>{const Le=s.clientId;if(!he||F||Oe||v||ye.current)return!1;ye.current=!0,le.operation==="uninstall"&&(Ce.current=ve),S(ve),L(d===ve?ve:null),j("progress"),_(le.startMessage??null);let dt=!1;return Ke(Le).then(Fe=>{const Ge=Fe&&typeof Fe=="object"&&"operationId"in Fe&&typeof Fe.operationId=="string"?Fe.operationId:void 0;if(Ge){dt=!0,Mt({operationId:Ge,name:ve,operation:le.operation});return}_(r("extensions.manage.queued",{name:ve}))}).catch(Fe=>{j("error"),_(Fe instanceof Error?Fe.message:String(Fe))}).finally(()=>{dt||(ye.current=!1,S(null),le.operation==="uninstall"&&(Ce.current=null),ue(!0))}),!0},[s.clientId,v,ue,he,F,Oe,d,r]),Nt=h.useCallback(async(ve,Ke,le)=>{if(k||F||Oe||v||!i.workspaceCwd)return;const Le=le==="enabled"?"enable":le==="disabled"?"disable":"inherit";S(ve.name),L(ve.name),j("progress"),_(Le==="inherit"?r("extensions.manage.inheriting",{name:ve.name}):EC(Le,ve.name,r));try{const dt=Ke==="user"?await i.client.setExtensionDefaultActivation(ve.id,le):le==="inherit"?await i.client.workspaceByCwd(i.workspaceCwd).clearExtensionActivation(ve.id):await i.client.workspaceByCwd(i.workspaceCwd).setExtensionActivation(ve.id,le),Fe=await i.client.waitForExtensionOperation(dt);if(Fe.status==="failed")throw new Error(Fe.error??r("extensions.manage.operationFailed"));await ue(!0),j("success"),_(Le==="inherit"?r("extensions.manage.inherited",{name:ve.name}):SY(Le,ve.name,r))}catch(dt){j("error"),_(dt instanceof Error?dt.message:String(dt))}finally{S(null)}},[k,v,ue,F,Oe,r,i.client,i.workspaceCwd]),gt=h.useMemo(()=>c.find(ve=>ve.name===d),[c,d]);h.useEffect(()=>{n==null||n.onDetailChange(!!gt)},[n,gt]);const Je=h.useMemo(()=>j8t(c,m),[c,m]),Ae=h.useCallback(()=>{We.current=d,f(null)},[d]);h.useEffect(()=>{var ve;d||!We.current||((ve=me.current.get(We.current))==null||ve.focus(),We.current=null)},[d]);const de=a.jsx(t0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(n0,{className:"text-base",children:[a.jsx(so,{children:a.jsx(Zt,{variant:"ghost",size:"icon",onClick:e,"aria-label":r("common.back"),children:a.jsx(v_,{})})}),a.jsx(so,{children:gt?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:Ae,children:r("extensions.manage.title")})}):a.jsx(ql,{children:r("extensions.manage.title")})}),gt?a.jsx(yh,{}):null,gt?a.jsx(so,{children:a.jsx(ql,{children:Vw(gt)})}):null]})}),nt=n?gt?a.jsx(t0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(n0,{className:"h-8 text-sm",children:[a.jsx(so,{children:a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:n.onRoot,children:r("extensions.manage.title")})})}),a.jsx(yh,{}),a.jsx(so,{children:a.jsx(ql,{children:Vw(gt)})})]})}):null:de;if(gt){const ve=gt.details,Ke=g[gt.name]??gt.updateState,le=!he||F!==null||k!==null||Oe!==null,Le=v===gt.name,dt=gt.defaultActivation,Fe=gt.workspaceActivation,Ge=dt===void 0||Fe===void 0,un=(ve==null?void 0:ve.commands)??[],Wn=(ve==null?void 0:ve.skills)??[],Me=(ve==null?void 0:ve.agents)??[],yt=(ve==null?void 0:ve.mcpServers)??[],cn=(ve==null?void 0:ve.contextFiles)??[];return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[nt,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(WF,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold",children:Vw(gt)}),a.jsxs(Ai,{variant:"outline",children:["v",gt.version]}),a.jsx(Ai,{variant:"secondary",className:ER(gt)?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:v7(gt,r)})]})}),a.jsxs(Mu,{open:R,onOpenChange:$,children:[a.jsx(Ru,{asChild:!0,children:a.jsx(Zt,{variant:"ghost",size:"icon",disabled:le||Le,"aria-label":r("extensions.manage.actions"),children:le||Le?a.jsx(Hr,{}):a.jsx(tp,{})})}),a.jsxs(Du,{align:"end",children:[a.jsxs(Sp,{children:[a.jsx(bi,{disabled:le||v!==null,onSelect:()=>Ct(gt.name),children:r("extensions.manage.checkUpdates")}),a.jsx(bi,{disabled:le||Le||Ke!==_Y,onSelect:()=>Et(gt.name,Re=>o.updateExtension(gt.name,Re),{operation:"update",startMessage:EC("update",gt.name,r)}),children:r("extensions.manage.update")})]}),a.jsx(L3,{}),a.jsx(Sp,{children:a.jsx(bi,{variant:"destructive",disabled:le||Le,onSelect:Re=>{Re.preventDefault(),$(!1),N(gt.name)},children:r("extensions.manage.uninstallAction")})})]})]})]}),E===gt.name&&T?a.jsx(pc,{tone:C,noticeKey:T,closeLabel:r("common.close"),onDismiss:()=>_(null),className:"break-words",children:T}):null,Ge?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(ao,{children:r("extensions.manage.setting.unavailableDescription")})]}):null,a.jsx(Uo,{className:"gap-0 py-1",children:a.jsxs(hc,{className:"flex flex-col p-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium",children:r("extensions.manage.userSetting")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r("extensions.manage.userSettingDescription")})]}),a.jsxs(Sl,{value:dt,disabled:le||Le||Ge,onValueChange:Re=>void Nt(gt,"user",Re),children:[a.jsx(Tl,{className:"w-28 shrink-0",children:a.jsx(Cl,{placeholder:r("extensions.manage.setting.unknown")})}),a.jsxs(El,{children:[a.jsx(Ti,{value:"enabled",children:r("extensions.manage.setting.enabled")}),a.jsx(Ti,{value:"disabled",children:r("extensions.manage.setting.disabled")})]})]})]}),a.jsx(iO,{}),a.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium",children:r("extensions.manage.workspaceSetting")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r("extensions.manage.workspaceSettingDescription")})]}),a.jsxs(Sl,{value:Fe,disabled:le||Le||Ge,onValueChange:Re=>void Nt(gt,"workspace",Re),children:[a.jsx(Tl,{className:"w-28 shrink-0",children:a.jsx(Cl,{placeholder:r("extensions.manage.setting.unknown")})}),a.jsxs(El,{children:[a.jsx(Ti,{value:"inherit",children:r("extensions.manage.setting.default")}),a.jsx(Ti,{value:"enabled",children:r("extensions.manage.setting.enabled")}),a.jsx(Ti,{value:"disabled",children:r("extensions.manage.setting.disabled")})]})]})]})]})}),a.jsxs(y1,{defaultValue:"overview",children:[a.jsxs(v1,{className:"max-w-full overflow-x-auto",children:[a.jsx(ci,{value:"overview",children:r("extensions.manage.overview")}),a.jsxs(ci,{value:"commands",children:[wb(r("extensions.manage.commands"))," ",un.length]}),a.jsxs(ci,{value:"skills",children:[wb(r("extensions.manage.skills"))," ",Wn.length]}),a.jsxs(ci,{value:"agents",children:[wb(r("extensions.manage.agents"))," ",Me.length]}),a.jsxs(ci,{value:"mcp",children:[wb(r("extensions.manage.mcpServers"))," ",yt.length]}),a.jsxs(ci,{value:"context",children:[wb(r("extensions.manage.contextFiles"))," ",cn.length]})]}),a.jsx(Fi,{value:"overview",className:"pt-4",children:a.jsxs(Uo,{children:[a.jsxs(Vl,{children:[a.jsx(Gl,{children:r("extensions.manage.overview")}),gt.description?a.jsx(Lu,{children:gt.description}):null]}),a.jsxs(hc,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(af,{label:r("extensions.manage.name"),value:gt.name}),a.jsx(af,{label:r("extensions.manage.version"),value:gt.version}),a.jsx(af,{label:r("extensions.manage.status"),value:v7(gt,r)}),a.jsx(af,{label:r("extensions.manage.source"),value:gt.source??"-"}),a.jsx(af,{label:r("extensions.manage.path"),value:gt.path}),a.jsx(af,{label:r("extensions.manage.updateStatus"),value:w7(Ke,r)}),a.jsx(af,{label:r("extensions.manage.installType"),value:gt.installType??"-"}),a.jsx(af,{label:r("extensions.manage.origin"),value:gt.originSource??"-"}),a.jsx(af,{label:r("extensions.manage.settings"),value:((ve==null?void 0:ve.settings)??[]).join(", ")||"-"})]})]})}),a.jsx(Fi,{value:"commands",className:"pt-4",children:a.jsx(Gw,{items:un,empty:r("extensions.manage.emptyCommands"),icon:Bxe})}),a.jsx(Fi,{value:"skills",className:"pt-4",children:a.jsx(Gw,{items:Wn,empty:r("extensions.manage.emptySkills"),icon:Jb})}),a.jsx(Fi,{value:"agents",className:"pt-4",children:a.jsx(Gw,{items:Me,empty:r("extensions.manage.emptyAgents"),icon:Xb})}),a.jsx(Fi,{value:"mcp",className:"pt-4",children:a.jsx(Gw,{items:yt,empty:r("extensions.manage.emptyMcpServers"),icon:Qb})}),a.jsx(Fi,{value:"context",className:"pt-4",children:a.jsx(Gw,{items:cn,empty:r("extensions.manage.emptyContextFiles"),icon:pee})})]})]}),a.jsx(Wy,{open:B===gt.name,onOpenChange:Re=>{Re||N(null)},children:a.jsxs(Vy,{children:[a.jsxs(Gy,{className:"place-items-start text-left",children:[a.jsx(Yy,{children:r("extensions.manage.uninstallAction")}),a.jsx(Xy,{children:r("extensions.manage.uninstallConfirm",{name:gt.name})})]}),a.jsxs(Ky,{children:[a.jsx(Qy,{children:r("common.cancel")}),a.jsx(Y6,{variant:"destructive",onClick:()=>{B&&Et(B,Re=>o.uninstallExtension(B,Re),{operation:"uninstall",startMessage:EC("uninstall",B,r)})&&N(null)},children:r("extensions.manage.uninstallAction")})]})]})}),a.jsx(CY,{pendingInteraction:W,submitting:we,selectedPlugin:ee,interactionValue:ie,setSelectedPlugin:oe,setInteractionValue:Z,submit:tt,t:r})]})}return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[nt,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{ref:t,tabIndex:-1,className:"text-xl font-semibold outline-none",children:r("extensions.manage.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:r("extensions.manage.count",{count:c.length})})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs(Zt,{variant:"outline",disabled:w,onClick:ut,children:[w?a.jsx(Hr,{}):a.jsx($g,{"data-icon":"inline-start"}),r("common.refresh")]}),a.jsxs(Zt,{disabled:!he||!!(F||Oe||k),onClick:()=>G(!0),children:[a.jsx(Wf,{"data-icon":"inline-start"}),r("extensions.manage.add")]})]})]}),E===null&&T||D?a.jsx(pc,{tone:D?"error":C,noticeKey:(E===null?T:null)??D??"",closeLabel:r("common.close"),onDismiss:()=>{_(null),M(null)},className:"break-words",children:(E===null?T:null)??D}):null,a.jsxs("div",{className:"relative",children:[a.jsx(tu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Us,{name:"extension-search","aria-label":r("extensions.manage.search"),autoComplete:"off",value:m,onChange:ve=>p(ve.target.value),placeholder:r("extensions.manage.search"),className:"pl-9"})]}),Je.length?a.jsx("div",{className:E8t.extensionGrid,"data-column-count":Math.min(Je.length,4),children:Je.map(ve=>{const Ke=g[ve.name]??ve.updateState;return a.jsx(Uo,{ref:le=>{le?me.current.set(ve.name,le):me.current.delete(ve.name)},size:"sm",role:"button",tabIndex:0,"aria-label":Vw(ve),className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>f(ve.name),onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),f(ve.name))},children:a.jsx(Vl,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(WF,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(Gl,{className:"min-w-0 truncate",children:Vw(ve)}),a.jsx("div",{className:"flex shrink-0 justify-end",children:a.jsx(Ai,{variant:"secondary",className:ER(ve)?"bg-[var(--success-bg)] text-[10px] text-[var(--success-color)]":"text-[10px]",children:v7(ve,r)})})]}),Ke===_Y?a.jsx("div",{className:"mt-1",children:a.jsx(Ai,{className:"text-[10px]",children:w7(Ke,r)})}):null,a.jsx(Lu,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Cd,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:ve.description||r("extensions.manage.noDescription")})}),a.jsx(Uu,{children:ve.description||r("extensions.manage.noDescription")})]})})})]})]})})},ve.id||ve.name)})}):a.jsx(fd,{className:"border",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:m?a.jsx(tu,{}):a.jsx(gxe,{})}),a.jsx(gd,{children:r(m?"extensions.manage.noMatches":"extensions.manage.empty")}),m?null:a.jsx(Nv,{children:r("extensions.manage.emptyDescription")})]})})]}),a.jsx(Wy,{open:z,onOpenChange:ve=>{(ve||!U)&&G(ve)},children:a.jsxs(Vy,{size:"middle",children:[a.jsxs(Gy,{className:"place-items-start text-left",children:[a.jsx(Yy,{children:r("extensions.manage.add")}),a.jsx(Xy,{children:r("extensions.manage.installDescription")})]}),a.jsx(Us,{id:"extension-source",name:"extension-source","aria-label":r("extensions.manage.installDescription"),autoComplete:"off",value:I,onChange:ve=>Y(ve.target.value),placeholder:r("extensions.manage.sourcePlaceholder")}),a.jsxs(Ky,{children:[a.jsx(Qy,{disabled:U,children:r("common.cancel")}),a.jsxs(Zt,{disabled:U||!he||!!(F||Oe||k)||!I.trim(),onClick:Ze,children:[U?a.jsx(Hr,{}):null,r("extensions.manage.install")]})]})]})}),a.jsx(CY,{pendingInteraction:W,submitting:we,selectedPlugin:ee,interactionValue:ie,setSelectedPlugin:oe,setInteractionValue:Z,submit:tt,t:r})]})}const N8t="_connectedBadge_1erz5_1",I8t="_serverGrid_1erz5_6",fme={connectedBadge:N8t,serverGrid:I8t},AC=`{
  "command": "",
  "args": []
}`;function Z6(e){if(e.configOrigin)return e.configOrigin;if(e.extensionName||e.source==="extension")return"extension";const t=e.source;return t==="project"&&e.removable===!1?"project_mcp_json":t==="workspace"||t==="project"?"workspace_settings":e.removable?"user_settings":void 0}function N4(e){const t=Z6(e);return t==="workspace_settings"?"workspace":t==="extension"?"extension":"user"}function M8t(e){const t=Z6(e);return t==="extension"||t==="workspace_settings"||t==="user_settings"}function TY(e,t){const n=N4(e);return t(n==="workspace"?"mcp.source.workspace":n==="extension"?"mcp.source.extension":"mcp.source.user")}function EY(e,t){var r;const n=(r=e.settings.find(s=>s.key==="mcpServers"))==null?void 0:r.values[t];return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n))}function AY(e,t){return e.disabled?t("mcp.status.disabled"):e.approvalState==="pending"?t("mcp.status.needsApproval"):e.approvalState==="rejected"?t("mcp.status.rejected"):e.authenticationState==="pending"?t("mcp.status.authenticating"):e.mcpStatus==="connected"?t("mcp.status.connected"):e.mcpStatus==="connecting"?t("mcp.status.connecting"):t("mcp.status.disconnectedTitle")}function jY(e){return!e.disabled&&!e.approvalState&&e.mcpStatus==="connected"?fme.connectedBadge:""}function R8t(e,t){var r;const n=e.config;return n!=null&&n.httpUrl?`${n.httpUrl} (http)`:n!=null&&n.url?`${n.url} (sse)`:n!=null&&n.command?`${n.command} ${((r=n.args)==null?void 0:r.join(" "))??""} (stdio)`.trim():e.transport?`(${e.transport})`:t("mcp.status.unknown")}function D8t(e,t){const n=[],r=!!e.approvalState,s=Z6(e);return(s==="user_settings"||s==="workspace_settings")&&n.push({id:"edit",label:t("mcp.action.edit")}),!e.disabled&&!r&&!e.requiresAuth&&e.mcpStatus==="disconnected"&&n.push({id:"reconnect",label:t("mcp.action.reconnect")}),!e.disabled&&r&&n.push({id:"approve",label:t("mcp.action.approve")}),(s!=="extension"||e.disabled)&&n.push({id:e.disabled?"enable":"disable",label:e.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!e.disabled&&!r&&(e.mcpStatus!=="disconnected"||e.requiresAuth)&&(n.push({id:"authenticate",label:e.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),e.hasOAuthTokens&&n.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),e.removable&&n.push({id:"remove",label:t("mcp.action.remove")}),n}function x7(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,t("mcp.oauth.starting",{name:e}),n].filter(Boolean).join(`
`)}function L8t(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function P8t(e,t){const n=e.annotations??{},r=[];return n.destructiveHint&&r.push(t("mcp.annotation.destructive")),n.readOnlyHint&&r.push(t("mcp.annotation.readOnly")),n.openWorldHint&&r.push(t("mcp.annotation.openWorld")),n.idempotentHint&&r.push(t("mcp.annotation.idempotent")),r.join(", ")}function zc({label:e,value:t}){return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function O8t({tool:e,t}){var i;const n=P8t(e,t),r=e.schema,s=(r==null?void 0:r.parametersJsonSchema)??(r==null?void 0:r.parameters)??r;return a.jsxs("div",{className:"flex flex-col gap-5",children:[e.isValid?null:a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(Wl,{children:t("mcp.invalidToolWarning")}),a.jsxs(ao,{children:[e.invalidReason||t("mcp.status.unknown"),a.jsx("span",{className:"mt-1 block",children:t("mcp.invalidToolHelp")})]})]}),a.jsx(zc,{label:t("mcp.description"),value:((i=e.description)==null?void 0:i.trim())||t("mcp.noDescription")}),n?a.jsx(zc,{label:t("mcp.annotations"),value:n}):null,a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("div",{className:"text-sm font-medium",children:t("mcp.inputSchema")}),s?a.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg bg-muted p-4 text-xs leading-relaxed",children:JSON.stringify(s,null,2)}):a.jsx("div",{className:"text-sm text-muted-foreground",children:t("mcp.noSchema")})]})]})}function $8t({resource:e,t}){const n=e.title||e.name||"";return a.jsxs("div",{className:"flex flex-col gap-5",children:[a.jsx(zc,{label:t("mcp.resource.uriLabel"),value:e.uri}),n&&n!==e.uri?a.jsx(zc,{label:t("mcp.resource.nameLabel"),value:n}):null,e.mimeType?a.jsx(zc,{label:t("mcp.resource.mimeTypeLabel"),value:e.mimeType}):null,typeof e.size=="number"?a.jsx(zc,{label:t("mcp.resource.sizeLabel"),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?a.jsx(zc,{label:t("mcp.description"),value:e.description.trim()}):null]})}function mme({message:e,onClose:t,embedded:n}){var Fe,Ge,un,Wn;const{t:r}=rt(),s=X9({autoLoad:!1}),i=Q9({autoLoad:!1}),[o,l]=h.useState(e.status),[c,u]=h.useState(e.toolsByServer),[d,f]=h.useState(e.resourcesByServer??{}),[m,p]=h.useState(null),[g,b]=h.useState(null),[w,y]=h.useState(null),[v,x]=h.useState("overview"),[k,S]=h.useState(""),[T,_]=h.useState("all"),[C,j]=h.useState(null),[E,L]=h.useState(!1),[D,M]=h.useState(!1),[R,$]=h.useState(!1),[B,N]=h.useState(null),[z,G]=h.useState(""),[I,Y]=h.useState(""),[U,P]=h.useState("workspace"),[F,te]=h.useState(AC),[W,K]=h.useState(!1),[ce,ie]=h.useState(null),[Z,ee]=h.useState(null),[oe,we]=h.useState(null),pe=oe!=null&&oe.error?"error":oe!=null&&oe.success?"success":oe!=null&&oe.progress?"progress":"info",[he,X]=h.useState({}),ye=h.useRef(e.status.discoveryState==="completed"),Ce=h.useRef(!0);h.useEffect(()=>(Ce.current=!0,()=>{Ce.current=!1}),[]);const ae=h.useCallback(async()=>(await new Promise(Me=>window.setTimeout(Me,1500)),Ce.current),[]),me=h.useCallback(async(Me,yt=!0,cn=!1)=>{var Re;if(await(Me==="initialize"?s.initialize():s.reloadConfig()),!Ce.current)return!1;for(let et=0;et<40;et+=1){if(!await ae())return!1;const bt=await s.reload();if(!Ce.current)return!1;if(bt){if((!cn||bt.discoveryState==="completed")&&l(rn=>yt&&bt.servers.length===0&&rn.servers.length>0?{...bt,servers:rn.servers}:bt),(Re=bt.errors)!=null&&Re.length)return yt&&we({text:bt.errors.map(rn=>rn.error||rn.hint||rn.kind).join(`
`),error:!0}),!1;if(bt.discoveryState==="completed")return yt&&we(null),!0;if(bt.initialized&&bt.discoveryState==="not_started"&&bt.servers.length===0)return cn&&l(bt),yt&&we({text:r("mcp.discovery.empty")}),!0}}return yt&&we({text:r("mcp.discovery.timeout"),error:!0}),!1},[s,r,ae]);h.useEffect(()=>{ye.current||(ye.current=!0,L(!0),me("initialize").catch(Me=>{Ce.current&&we({text:Ao(Me),error:!0})}).finally(()=>{Ce.current&&L(!1)}))},[me]);const We=h.useMemo(()=>(o.servers??[]).filter(M8t),[o.servers]),Oe=We.find(Me=>Me.name===m)??null,Mt=Oe?((Fe=c[Oe.name])==null?void 0:Fe.tools)??[]:[],$t=Oe?((Ge=d[Oe.name])==null?void 0:Ge.resources)??[]:[],St=Mt.find(Me=>Me.name===g)??null,ue=$t.find(Me=>Me.uri===w)??null;h.useEffect(()=>{n==null||n.onDetailChange(!!Oe)},[n,Oe]);const Ee=h.useMemo(()=>{const Me=k.trim().toLowerCase();return We.filter(yt=>{var et,bt;const cn=T==="all"||N4(yt)===T,Re=!Me||yt.name.toLowerCase().includes(Me)||((et=yt.description)==null?void 0:et.toLowerCase().includes(Me))||((bt=yt.extensionName)==null?void 0:bt.toLowerCase().includes(Me));return cn&&!!Re})},[k,We,T]),tt=h.useCallback(async Me=>{const yt=[],[cn,Re]=await Promise.allSettled([s.loadTools(Me.name),Me.resourceCount?s.loadResources(Me.name):Promise.resolve(null)]);if(cn.status==="fulfilled")u(et=>({...et,[Me.name]:cn.value})),X(et=>({...et,[Me.name]:{...et[Me.name],tools:void 0}}));else{yt.push(cn.reason);const et=Ao(cn.reason);X(bt=>({...bt,[Me.name]:{...bt[Me.name],tools:et}}))}if(Re.status==="fulfilled"&&Re.value!==null){const et=Re.value;f(bt=>({...bt,[Me.name]:et})),X(bt=>({...bt,[Me.name]:{...bt[Me.name],resources:void 0}}))}else if(Re.status==="rejected"){yt.push(Re.reason);const et=Ao(Re.reason);X(bt=>({...bt,[Me.name]:{...bt[Me.name],resources:et}}))}else f(et=>{if(!(Me.name in et))return et;const bt={...et};return delete bt[Me.name],bt}),X(et=>({...et,[Me.name]:{...et[Me.name],resources:void 0}}));if(yt.length>0)throw new AggregateError(yt,`${Me.name}: ${yt.map(Ao).join("; ")}`)},[s]),ut=h.useCallback(async()=>{if(!D){M(!0),we(null);try{const Me=await s.reload();if(!Me)return;l(Me)}catch(Me){we({text:Ao(Me),error:!0})}finally{M(!1)}}},[s,D]),Ct=h.useCallback(async()=>{const Me=z.trim(),yt=B!==null;if(!Me){ie(r("mcp.add.nameRequired"));return}let cn;try{const et=JSON.parse(F);if(!et||typeof et!="object"||Array.isArray(et))throw new Error(r("mcp.add.configInvalid"));const bt=I.trim();cn={...et,...bt?{description:bt}:{}}}catch(et){ie(Ao(et));return}ie(null),K(!0);let Re=!1;try{await i.setValue(U,"mcpServers",cn,{mcpServerMutation:{operation:"set",name:Me}}),Re=!0,we(null);const et=await me("reload",!1).catch(()=>!1);we({...yt?{serverName:Me}:{},text:et?r(yt?"mcp.edit.done":"mcp.add.done",{name:Me}):r("mcp.runtime.notUpdated"),error:!et,success:et}),$(!1),N(null),G(""),Y(""),te(AC)}catch(et){Re?(we({...yt?{serverName:Me}:{},text:r("mcp.runtime.notUpdated"),error:!0}),$(!1),N(null),G(""),Y(""),te(AC)):ie(Ao(et))}finally{K(!1)}},[s,B,F,I,z,U,i,me,r]),Ze=h.useCallback(async()=>{if(!Z)return;j(Z.name);let Me=!1;try{const yt=await i.reload();if(!yt){we({serverName:Z.name,text:r("mcp.add.settingsUnavailable"),error:!0});return}const cn=N4(Z)==="workspace"?"workspace":"user",Re=EY(yt,cn);if(!(Z.name in Re)){we({serverName:Z.name,text:r("mcp.remove.notWorkspace"),error:!0});return}await i.setValue(cn,"mcpServers",{},{mcpServerMutation:{operation:"remove",name:Z.name}}),Me=!0,ee(null),we({serverName:Z.name,text:r("mcp.action.running",{action:r("mcp.action.remove")}),progress:!0}),await me("reload",!1,!0).catch(()=>!1)?(p(null),b(null),y(null),we(null)):we({serverName:Z.name,text:r("mcp.runtime.removeNotUpdated"),error:!0})}catch(yt){we({serverName:Z.name,text:Me?r("mcp.runtime.removeNotUpdated"):r("mcp.action.failed",{error:Ao(yt)}),error:!0})}finally{j(null)}},[Z,i,me,r]),Et=h.useCallback(async Me=>{if(C)return;const yt=Z6(Me);if(yt!=="user_settings"&&yt!=="workspace_settings")return;const cn=yt==="workspace_settings"?"workspace":"user";j(Me.name),we(null);try{const Re=await i.reload();if(!Re)throw new Error(r("mcp.add.settingsUnavailable"));const et=EY(Re,cn)[Me.name];if(!et||typeof et!="object"||Array.isArray(et))throw new Error(r("mcp.edit.notFound"));const bt={...et},rn=bt.description;delete bt.description,N(Me),G(Me.name),P(cn),Y(typeof rn=="string"?rn:""),te(JSON.stringify(bt,null,2)),ie(null),$(!0)}catch(Re){we({serverName:Me.name,text:r("mcp.action.failed",{error:Ao(Re)}),error:!0})}finally{j(null)}},[C,i,r]),Nt=h.useCallback(async(Me,yt)=>{var cn,Re,et,bt;if(!C){if(yt.id==="remove"){ee(Me);return}if(yt.id==="edit"){await Et(Me);return}j(Me.name),we({serverName:Me.name,text:yt.id==="authenticate"?x7(Me.name,r):r("mcp.action.running",{action:yt.label}),progress:!0});try{let rn="",qn,ft=!1;if(yt.id==="reconnect"){const Ye=await s.restartServer(Me.name);if(!Ce.current)return;if("restarted"in Ye&&!Ye.restarted)throw Ye.reason==="authentication_required"?new Error(r("mcp.reconnect.authenticationRequired")):new Error(r("mcp.reconnect.skipped",{reason:Ye.reason}));if("entries"in Ye&&(Ye.entries.length===0||Ye.entries.every(Yt=>!Yt.restarted)))throw new Error(r("mcp.reconnect.skipped",{reason:Ye.entries.map(Yt=>Yt.reason).filter(Boolean).join(", ")||"not connected"}))}else{const Ye=await s.manageServer(Me.name,yt.id);if(!Ce.current)return;qn=Ye.authUrl,rn=[...Ye.messages??[]].join(`
`),ft=yt.id==="authenticate"&&Ye.pending===!0,ft&&we({serverName:Me.name,text:x7(Me.name,r,rn),progress:!0,...qn?{authUrl:qn}:{}})}let He;if(ft){for(let Ye=0;Ye<400;Ye+=1){if(!await ae())return;const Yt=await s.reload();if(!Ce.current)return;if(!Yt)continue;l(Yt);const Cn=(cn=Yt.errors)==null?void 0:cn[0];if(Cn)throw new Error(Cn.error||Cn.hint||r("mcp.oauth.statusFailed"));const Tn=(Re=Yt.servers)==null?void 0:Re.find(zr=>zr.name===Me.name);if(!Tn)throw new Error(r("mcp.oauth.serverRemoved"));if(Tn.authenticationState==="failed")throw new Error(Tn.authenticationError||r("mcp.oauth.authenticationFailed"));if(Tn.authenticationState==="succeeded"||Tn.authenticationState===void 0&&Tn.mcpStatus==="connected"){He=Yt;break}}if(!He)throw new Error(r("mcp.oauth.timeout"))}else{if(He=await s.reload(),!Ce.current)return;for(let Ye=0;(He==null?void 0:He.discoveryState)!==void 0&&He.discoveryState!=="completed"&&!((et=He.errors)!=null&&et.length)&&Ye<40;Ye+=1){if(!await ae())return;const Yt=await s.reload();if(!Ce.current)return;Yt&&(He=Yt,l(Yt))}}if(He){l(He);const Ye=(bt=He.servers)==null?void 0:bt.find(Yt=>Yt.name===Me.name);if(Ye&&(He.discoveryState===void 0||He.discoveryState==="completed")){try{await tt(Ye)}catch{}if(!Ce.current)return}}we({serverName:Me.name,text:ft?r("mcp.action.done",{action:yt.label}):yt.id==="authenticate"&&rn?x7(Me.name,r,rn):rn||r("mcp.action.done",{action:yt.label}),success:!0,...!ft&&qn?{authUrl:qn}:{}})}catch(rn){Ce.current&&we({serverName:Me.name,text:r("mcp.action.failed",{error:Ao(rn)}),error:!0})}finally{Ce.current&&j(null)}}},[C,tt,s,Et,r,ae]),gt=Me=>{p(Me.name),x("overview"),b(null),y(null),we(null),!Me.approvalState&&tt(Me).catch(yt=>{we({serverName:Me.name,text:r("mcp.action.failed",{error:Ao(yt)}),error:!0})})},Je=()=>{C===null&&(p(null),b(null),y(null),M(!0),s.reload().then(Me=>{Me&&l(Me)}).catch(Me=>{we({text:Ao(Me),error:!0})}).finally(()=>M(!1)))},Ae=()=>{b(null),y(null)},de=a.jsx(t0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(n0,{className:"text-base",children:[a.jsx(so,{children:a.jsx(Zt,{variant:"ghost",size:"icon",disabled:C!==null,onClick:t,"aria-label":r("common.back"),children:a.jsx(v_,{})})}),a.jsx(so,{children:Oe?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",disabled:C!==null,onClick:Je,children:r("mcp.title")})}):a.jsx(ql,{children:r("mcp.title")})}),Oe?a.jsx(yh,{}):null,Oe?a.jsx(so,{children:St||ue?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:Ae,children:Oe.name})}):a.jsx(ql,{children:Oe.name})}):null,St||ue?a.jsx(yh,{}):null,St?a.jsx(so,{children:a.jsx(ql,{children:St.name})}):null,ue?a.jsx(so,{children:a.jsx(ql,{children:ue.title||ue.name||ue.uri})}):null]})}),nt=St?St.name:ue?ue.title||ue.name||ue.uri:Oe==null?void 0:Oe.name,ve=n?Oe?a.jsx(t0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(n0,{className:"h-8 text-sm",children:[a.jsx(so,{children:a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",disabled:C!==null,onClick:Je,children:r("mcp.title")})})}),a.jsx(yh,{}),a.jsx(so,{children:St||ue?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:Ae,children:Oe.name})}):a.jsx(ql,{children:Oe.name})}),St||ue?a.jsx(yh,{}):null,St||ue?a.jsx(so,{children:a.jsx(ql,{children:nt})}):null]})}):null:de,Ke=a.jsx(zp,{open:Z!==null,onOpenChange:Me=>!Me&&ee(null),children:a.jsxs(Fp,{showCloseButton:!1,children:[a.jsxs(qp,{children:[a.jsx(Up,{children:r("mcp.remove.title")}),a.jsx(Hg,{children:r(Z&&N4(Z)==="workspace"?"mcp.remove.description":"mcp.remove.description.global",{name:(Z==null?void 0:Z.name)??""})})]}),a.jsxs(Hp,{children:[a.jsx(Zt,{variant:"outline",onClick:()=>ee(null),disabled:C!==null,children:r("common.cancel")}),a.jsxs(Zt,{variant:"destructive",onClick:()=>void Ze(),disabled:C!==null,children:[C?a.jsx(Hr,{"data-icon":"inline-start"}):a.jsx(kf,{"data-icon":"inline-start"}),r("mcp.action.remove")]})]})]})}),le=a.jsx(zp,{open:R,onOpenChange:Me=>{W||($(Me),Me||N(null))},children:a.jsxs(Fp,{className:"sm:max-w-lg",showCloseButton:!1,children:[a.jsxs(qp,{children:[a.jsx(Up,{children:r(B?"mcp.edit.title":"mcp.add.title")}),a.jsx(Hg,{children:r(B?"mcp.edit.description":"mcp.add.description")})]}),a.jsxs("div",{className:"grid gap-4",children:[ce?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(ao,{children:ce})]}):null,a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("mcp.add.name"),a.jsx(Us,{value:z,onChange:Me=>G(Me.target.value),placeholder:"my-mcp-server",disabled:W||B!==null})]}),a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("mcp.add.serverDescription"),a.jsx(Us,{value:I,onChange:Me=>Y(Me.target.value),placeholder:r("mcp.add.serverDescriptionPlaceholder"),disabled:W})]}),a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("mcp.add.scope"),a.jsxs(Sl,{value:U,onValueChange:Me=>P(Me),disabled:W||B!==null,children:[a.jsx(Tl,{className:"w-full",children:a.jsx(Cl,{})}),a.jsxs(El,{children:[a.jsx(Ti,{value:"workspace",children:r("settings.scope.workspace")}),a.jsx(Ti,{value:"user",children:r("mcp.add.scope.global")})]})]})]}),a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("mcp.add.config"),a.jsx(og,{className:"min-h-44 font-mono text-xs",value:F,onChange:Me=>te(Me.target.value),disabled:W})]})]}),a.jsxs(Hp,{children:[a.jsx(Zt,{variant:"outline",onClick:()=>{$(!1),N(null)},disabled:W,children:r("common.cancel")}),a.jsxs(Zt,{onClick:()=>void Ct(),disabled:W,children:[W?a.jsx(Hr,{"data-icon":"inline-start"}):null,r(W?B?"mcp.edit.saving":"mcp.add.adding":B?"mcp.edit.save":"mcp.add.button")]})]})]})});if(St&&Oe)return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ve,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(HN,{})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"break-words text-xl font-semibold",children:St.name}),a.jsx("p",{className:"text-sm text-muted-foreground",children:St.serverToolName||Oe.name})]})]}),a.jsx(Uo,{children:a.jsx(hc,{children:a.jsx(O8t,{tool:St,t:r})})})]})]}),le]});if(ue&&Oe)return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ve,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(qN,{})}),a.jsx("h1",{className:"min-w-0 break-words text-xl font-semibold",children:ue.title||ue.name||ue.uri})]}),a.jsx(Uo,{children:a.jsx(hc,{children:a.jsx($8t,{resource:ue,t:r})})})]})]}),le]});if(Oe){const Me=Mt,yt=$t,cn=he[Oe.name],Re=D8t(Oe,r);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ve,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(Qb,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold",children:Oe.name}),a.jsx(Ai,{variant:"secondary",className:jY(Oe),children:AY(Oe,r)}),a.jsx(Ai,{variant:"outline",children:TY(Oe,r)})]})}),a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx(Zt,{variant:"ghost",size:"icon",disabled:C!==null,"aria-label":r("mcp.actions"),"data-testid":"mcp-server-actions",children:C===Oe.name?a.jsx(Hr,{}):a.jsx(tp,{})})}),a.jsx(Du,{align:"end",onCloseAutoFocus:et=>et.preventDefault(),children:a.jsx(Sp,{children:Re.map(et=>a.jsx(bi,{"data-testid":`mcp-server-action-${et.id}`,variant:et.id==="remove"?"destructive":"default",disabled:C!==null,onSelect:()=>void Nt(Oe,et),children:et.label},et.id))})})]})]}),(oe==null?void 0:oe.serverName)===Oe.name?a.jsxs(pc,{tone:pe,noticeKey:oe.text,closeLabel:r("common.close"),onDismiss:()=>we(null),className:"whitespace-pre-wrap break-words",children:[a.jsx("p",{children:oe.text}),oe.authUrl&&L8t(oe.authUrl)?a.jsx("a",{className:"mt-2 inline-block underline underline-offset-3",href:oe.authUrl,target:"_blank",rel:"noreferrer",children:r("mcp.oauth.open")}):null]}):null,a.jsxs(y1,{value:v,onValueChange:x,children:[a.jsxs(v1,{children:[a.jsx(ci,{value:"overview",children:r("mcp.basicInfo")}),a.jsxs(ci,{value:"tools",children:[r("mcp.tools")," ",Me.length]}),a.jsxs(ci,{value:"resources",children:[r("mcp.resources")," ",Oe.resourceCount??yt.length]})]}),a.jsx(Fi,{value:"overview",className:"pt-4",children:a.jsxs(Uo,{children:[a.jsxs(Vl,{children:[a.jsx(Gl,{className:"text-sm",children:r("mcp.descriptionTitle")}),a.jsx(Lu,{children:((un=Oe.description)==null?void 0:un.trim())||"-"})]}),a.jsxs(hc,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(zc,{label:r("mcp.source"),value:TY(Oe,r)}),a.jsx(zc,{label:r("mcp.transport"),value:Oe.transport}),a.jsx(zc,{label:r("mcp.command"),value:R8t(Oe,r)}),a.jsx(zc,{label:r("mcp.workingDirectory"),value:((Wn=Oe.config)==null?void 0:Wn.cwd)||o.workspaceCwd}),Oe.error?a.jsx(zc,{label:r("mcp.invalidReasonLabel"),value:Oe.error}):null,Oe.hint?a.jsx(zc,{label:r("mcp.description"),value:Oe.hint}):null]})]})}),a.jsx(Fi,{value:"tools",className:"pt-4",children:cn!=null&&cn.tools?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(Wl,{children:r("mcp.loadingTools")}),a.jsx(ao,{children:cn.tools})]}):Me.length?a.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:Me.map(et=>a.jsx(Uo,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>b(et.name),onKeyDown:bt=>{(bt.key==="Enter"||bt.key===" ")&&(bt.preventDefault(),b(et.name))},children:a.jsxs(Vl,{children:[a.jsx(Gl,{className:"break-words",children:et.name}),a.jsx(Lu,{className:"line-clamp-2 text-xs",children:et.description||r("mcp.noDescription")}),et.isValid?null:a.jsx(Khe,{children:a.jsx(Ai,{variant:"destructive",children:r("mcp.status.blocked")})})]})},et.name))}):a.jsx(fd,{className:"rounded-xl border border-dashed",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:a.jsx(HN,{})}),a.jsx(gd,{children:r("mcp.emptyTools")})]})})}),a.jsx(Fi,{value:"resources",className:"pt-4",children:cn!=null&&cn.resources?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(Wl,{children:r("mcp.resourcesUnavailable")}),a.jsx(ao,{children:cn.resources})]}):yt.length?a.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:yt.map(et=>a.jsx(Uo,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>y(et.uri),onKeyDown:bt=>{(bt.key==="Enter"||bt.key===" ")&&(bt.preventDefault(),y(et.uri))},children:a.jsxs(Vl,{children:[a.jsx(Gl,{className:"break-words",children:et.title||et.name||et.uri}),a.jsx(Lu,{className:"break-all",children:et.uri})]})},et.uri))}):a.jsx(fd,{className:"rounded-xl border border-dashed",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:a.jsx(qN,{})}),a.jsx(gd,{children:r("mcp.noResources")})]})})})]})]})]}),Ke,le]})}const Le=We.filter(Me=>!Me.disabled&&Me.mcpStatus==="connecting").length,dt=[{value:"all",label:r("mcp.source.all")},{value:"user",label:r("mcp.source.user")},{value:"workspace",label:r("mcp.source.workspace")},{value:"extension",label:r("mcp.source.extension")}];return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ve,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:r("mcp.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:r("mcp.servers",{count:We.length})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Zt,{variant:"outline",onClick:()=>void ut(),disabled:D,children:[D?a.jsx(Hr,{"data-icon":"inline-start"}):a.jsx($g,{"data-icon":"inline-start"}),r("common.refresh")]}),a.jsxs(Zt,{onClick:()=>{N(null),G(""),Y(""),P("workspace"),te(AC),ie(null),$(!0)},disabled:W,children:[a.jsx(Wf,{"data-icon":"inline-start"}),r("mcp.add.button")]})]})]}),E&&Le===0?a.jsx(pc,{tone:"progress",noticeKey:"mcp-initializing",closeLabel:r("common.close"),onDismiss:()=>{},children:a.jsxs("span",{className:"grid gap-1",children:[a.jsx("span",{className:"font-medium",children:r("mcp.discovery.initializing")}),a.jsx("span",{children:r("mcp.startingNote")})]})}):Le>0?a.jsx(pc,{tone:"progress",noticeKey:`mcp-connecting-${Le}`,closeLabel:r("common.close"),onDismiss:()=>{},children:a.jsxs("span",{className:"grid gap-1",children:[a.jsx("span",{className:"font-medium",children:r("mcp.starting",{count:Le})}),a.jsx("span",{children:r("mcp.startingNote")})]})}):null,oe&&!oe.serverName?a.jsx(pc,{tone:pe,noticeKey:oe.text,closeLabel:r("common.close"),onDismiss:()=>we(null),children:oe.text}):null,(o.errors??[]).map((Me,yt)=>a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(Wl,{children:Me.kind}),a.jsx(ao,{children:Me.error||Me.hint||r("mcp.status.unknown")})]},`${Me.kind}-${yt}`)),o.budgetMode&&o.budgetMode!=="off"?a.jsxs(oo,{children:[a.jsx(Oa,{}),a.jsx(ao,{children:r("mcp.clientBudget",{count:o.clientCount??0,budget:o.clientBudget??"∞"})})]}):null,a.jsxs("div",{className:"relative",children:[a.jsx(tu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Us,{className:"pl-9",value:k,onChange:Me=>S(Me.target.value),placeholder:`${r("common.search")} MCP…`})]}),a.jsx(oO,{type:"single",value:T,onValueChange:Me=>{Me&&_(Me)},variant:"outline",size:"sm","aria-label":r("mcp.source"),children:dt.map(Me=>a.jsx(aO,{value:Me.value,children:Me.label},Me.value))}),Ee.length?a.jsx("div",{className:fme.serverGrid,"data-column-count":Math.min(Ee.length,4),children:Ee.map(Me=>{var yt,cn;return a.jsx(Uo,{size:"sm",role:"button",tabIndex:0,"aria-label":Me.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>gt(Me),onKeyDown:Re=>{(Re.key==="Enter"||Re.key===" ")&&(Re.preventDefault(),gt(Me))},children:a.jsx(Vl,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(Qb,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(Gl,{className:"min-w-0 flex-1 truncate",children:Me.name}),a.jsx(Ai,{variant:"secondary",className:`${jY(Me)} shrink-0 text-[10px]`,children:AY(Me,r)})]}),a.jsx(Lu,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Cd,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:((yt=Me.description)==null?void 0:yt.trim())||"-"})}),a.jsx(Uu,{children:((cn=Me.description)==null?void 0:cn.trim())||"-"})]})})})]})]})})},Me.name)})}):a.jsx(fd,{className:"border",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:k||T!=="all"?a.jsx(tu,{}):a.jsx(Qb,{})}),a.jsx(gd,{children:r(k||T!=="all"?"mcp.noMatches":"mcp.empty")}),!k&&T==="all"?a.jsx(Nv,{children:r("mcp.emptyDescription")}):null]})})]}),le]})}function B8t({mcpMessage:e,loadMcpMessage:t,onClose:n,onUseSkill:r,initialFocusRef:s}){const{t:i}=rt(),[o,l]=h.useState("extensions"),[c,u]=h.useState(!1),[d,f]=h.useState(0),[m,p]=h.useState(!1),[g,b]=h.useState(null),w=h.useCallback(()=>{p(!1),b(null),t().then(()=>p(!0)).catch(k=>{b(k instanceof Error?k.message:String(k))})},[t]),y=h.useCallback(()=>{u(!1),f(k=>k+1)},[]),v=h.useMemo(()=>({onRoot:y,onDetailChange:u}),[y]),x=k=>{const S=k;l(S),u(!1),f(T=>T+1),S==="mcp"&&w()};return a.jsxs(y1,{value:o,onValueChange:x,className:"w-full",children:[c?null:a.jsx("div",{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(v1,{className:"h-8","aria-label":i("plugins.sections"),children:[a.jsx(ci,{ref:s,value:"extensions",children:i("plugins.extensions")}),a.jsx(ci,{value:"mcp",children:i("plugins.mcp")}),a.jsx(ci,{value:"skills",children:i("plugins.skills")}),a.jsx(ci,{value:"agents",children:i("plugins.agents")})]})}),a.jsx(Fi,{value:o,className:"mt-0",children:o==="extensions"?a.jsx(hme,{onClose:n,embedded:v},`extensions-${d}`):o==="skills"?a.jsx(Zhe,{onClose:n,onUseSkill:r,embedded:v},`skills-${d}`):o==="agents"?a.jsx(Xhe,{onClose:n,embedded:v},`agents-${d}`):g?a.jsxs(oo,{variant:"destructive",className:"mt-4",children:[a.jsx(Wl,{children:i("plugins.mcpLoadFailed")}),a.jsxs(ao,{className:"space-y-3",children:[a.jsx("p",{children:g}),a.jsx(Zt,{variant:"outline",size:"sm",onClick:w,children:i("common.retry")})]})]}):e&&m?a.jsx(mme,{message:e,onClose:n,embedded:v},`mcp-${d}`):a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8 pt-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(tu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Us,{"aria-label":i("common.search"),readOnly:!0,className:"pl-9",placeholder:`${i("common.search")} MCP…`})]}),a.jsx(fd,{className:"border",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:a.jsx(Qb,{})}),a.jsx(gd,{children:i("mcp.empty")}),a.jsx(Nv,{children:i("mcp.emptyDescription")})]})})]})})]})}function e8({className:e,size:t="default",...n}){return a.jsx(Qoe,{"data-slot":"switch","data-size":t,className:ln("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:a.jsx(Zoe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}const z8t="_platformHeader_1yzta_1",F8t="_platformMark_1yzta_7",q8t="_form_1yzta_21",H8t="_body_1yzta_28",U8t="_section_1yzta_38",W8t="_sectionHeading_1yzta_44",V8t="_field_1yzta_62",G8t="_fieldHeader_1yzta_68",K8t="_required_1yzta_76",Y8t="_hint_1yzta_80",X8t="_secretState_1yzta_85",Q8t="_secretStatus_1yzta_97",J8t="_secretActions_1yzta_105",Z8t="_policyGrid_1yzta_111",eEt="_policyCard_1yzta_117",tEt="_policyCopy_1yzta_137",nEt="_policyTitle_1yzta_143",rEt="_policyDescription_1yzta_148",Ji={platformHeader:z8t,platformMark:F8t,form:q8t,body:H8t,section:U8t,sectionHeading:W8t,field:V8t,fieldHeader:G8t,required:K8t,hint:Y8t,secretState:X8t,secretStatus:Q8t,secretActions:J8t,policyGrid:Z8t,policyCard:eEt,policyCopy:tEt,policyTitle:nEt,policyDescription:rEt},sEt="_panel_u207s_1",iEt="_header_u207s_11",oEt="_title_u207s_18",aEt="_description_u207s_23",lEt="_emptyDescription_u207s_24",cEt="_headerActions_u207s_31",uEt="_divider_u207s_38",dEt="_success_u207s_44",hEt="_empty_u207s_24",fEt="_emptyTitle_u207s_78",mEt="_list_u207s_83",pEt="_request_u207s_89",gEt="_approval_u207s_100",bEt="_approvalIdentity_u207s_111",yEt="_approvalSenderId_u207s_125",vEt="_allowlist_u207s_126",wEt="_requestIdentity_u207s_138",xEt="_senderName_u207s_144",kEt="_senderId_u207s_152",_Et="_requestTime_u207s_153",SEt="_code_u207s_161",Js={panel:sEt,header:iEt,title:oEt,description:aEt,emptyDescription:lEt,headerActions:cEt,divider:uEt,success:dEt,empty:hEt,emptyTitle:fEt,list:mEt,request:pEt,approval:gEt,approvalIdentity:bEt,approvalSenderId:yEt,allowlist:vEt,requestIdentity:wEt,senderName:xEt,senderId:kEt,requestTime:_Et,code:SEt};function NY(e){return e.senderName.trim()||e.senderId}function IY(e){if(!e||typeof e!="object")return;const t=e.body;if(!t||typeof t!="object")return;const n=t.code;return typeof n=="string"?n:void 0}function rb(e,t){if(!e||typeof e!="object"||!("status"in e))return t;const n=e.body,r=n&&typeof n=="object"?n.error:void 0;return typeof r=="string"&&r?r:t}function CEt({channelName:e,listRequests:t,approveRequest:n,listApprovals:r,revokeApproval:s,staticAllowedUsers:i=[]}){const{t:o}=rt(),l=h.useId(),c=h.useId(),u=h.useRef(!1),d=h.useRef(e);d.current=e;const[f,m]=h.useState([]),[p,g]=h.useState(!0),[b,w]=h.useState(0),[y,v]=h.useState(),[x,k]=h.useState(),[S,T]=h.useState(),[_,C]=h.useState([]),[j,E]=h.useState(!0),[L,D]=h.useState(0),[M,R]=h.useState(),[$,B]=h.useState(),[N,z]=h.useState(),[G,I]=h.useState();h.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]),h.useEffect(()=>{let P=!0;return g(!0),m([]),k(void 0),T(void 0),v(void 0),t(e).then(F=>{P&&(m(F.requests),g(!1))},F=>{P&&(k(rb(F,o("channels.editor.pairing.unavailable"))),g(!1))}),()=>{P=!1}},[e,t,b,o]),h.useEffect(()=>{let P=!0;return E(!0),C([]),R(void 0),B(void 0),z(void 0),I(void 0),r(e).then(F=>{P&&(C(F.senderIds),E(!1))},F=>{P&&(R(rb(F,o("channels.editor.pairing.approvals.unavailable"))),E(!1))}),()=>{P=!1}},[L,e,r,o]);const Y=async P=>{if(y)return;const F=e;v(P.code),k(void 0),T(void 0),B(void 0);try{const te=await n(e,P.code);if(!u.current||d.current!==F)return;m(te.requests),T(o("channels.editor.pairing.approved",{sender:NY(te.approved)})),D(W=>W+1)}catch(te){if(!u.current||d.current!==F)return;if(IY(te)==="channel_pairing_request_not_found")try{const W=await t(F);u.current&&d.current===F&&m(W.requests)}catch(W){u.current&&d.current===F&&k(rb(W,o("channels.editor.pairing.unavailable")));return}if(!u.current||d.current!==F)return;k(rb(te,o("channels.editor.pairing.unavailable")))}finally{u.current&&d.current===F&&v(void 0)}},U=async P=>{if(G)return;const F=e;z(void 0),I(P),R(void 0),B(void 0),T(void 0);try{const te=await s(e,P);if(!u.current||d.current!==F)return;C(te.senderIds),B(o("channels.editor.pairing.approvals.revoked",{senderId:P}))}catch(te){if(!u.current||d.current!==F)return;if(IY(te)==="channel_pairing_approval_not_found")try{const W=await r(F);u.current&&d.current===F&&C(W.senderIds);return}catch(W){u.current&&d.current===F&&R(rb(W,o("channels.editor.pairing.approvals.unavailable")));return}if(!u.current||d.current!==F)return;R(rb(te,o("channels.editor.pairing.approvals.unavailable")))}finally{u.current&&d.current===F&&I(void 0)}};return a.jsxs("section",{className:Js.panel,"aria-labelledby":l,children:[a.jsxs("div",{className:Js.header,children:[a.jsxs("div",{children:[a.jsx("h4",{id:l,className:Js.title,children:o("channels.editor.pairing.title")}),a.jsx("p",{className:Js.description,children:o("channels.editor.pairing.description")})]}),a.jsxs("div",{className:Js.headerActions,children:[a.jsx(Ai,{variant:"outline",children:f.length}),a.jsx(Zt,{type:"button",size:"icon-sm",variant:"ghost",disabled:p||!!y,"aria-label":o("channels.editor.pairing.refresh"),onClick:()=>{T(void 0),w(P=>P+1)},children:p?a.jsx(Hr,{}):a.jsx($g,{})})]})]}),x?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(Wl,{children:o("channels.editor.pairing.error")}),a.jsx(ao,{children:x}),a.jsx(Zt,{className:"mt-2 w-fit",type:"button",size:"sm",variant:"outline",disabled:p,onClick:()=>w(P=>P+1),children:o("channels.editor.pairing.retry")})]}):null,S?a.jsxs("div",{role:"status",className:Js.success,children:[a.jsx(kh,{}),S]}):null,!p&&!x&&f.length===0?a.jsxs("div",{className:Js.empty,children:[a.jsx(z_e,{"aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("p",{className:Js.emptyTitle,children:o("channels.editor.pairing.empty.title")}),a.jsx("p",{className:Js.emptyDescription,children:o("channels.editor.pairing.empty.description")})]})]}):null,f.length>0?a.jsx("ul",{className:Js.list,children:f.map(P=>{const F=NY(P);return a.jsxs("li",{className:Js.request,children:[a.jsxs("div",{className:Js.requestIdentity,children:[a.jsx("span",{className:Js.senderName,children:F}),F!==P.senderId?a.jsx("span",{className:Js.senderId,children:P.senderId}):null,a.jsx("span",{className:Js.requestTime,children:Uy(new Date(P.createdAt).toISOString(),o)})]}),a.jsx("code",{className:Js.code,children:P.code}),a.jsxs(Zt,{type:"button",size:"sm",disabled:!!y||!!G,"aria-label":o("channels.editor.pairing.approveFor",{sender:F,code:P.code}),onClick:()=>void Y(P),children:[y===P.code?a.jsx(Hr,{}):null,o("channels.editor.pairing.approve")]})]},P.code)})}):null,a.jsxs("section",{"aria-labelledby":c,children:[a.jsx("div",{className:Js.divider}),a.jsxs("div",{className:Js.header,children:[a.jsxs("div",{children:[a.jsx("h4",{id:c,className:Js.title,children:o("channels.editor.pairing.approvals.title")}),a.jsx("p",{className:Js.description,children:o("channels.editor.pairing.approvals.description")})]}),a.jsxs("div",{className:Js.headerActions,children:[a.jsx(Ai,{variant:"outline",children:_.length}),a.jsx(Zt,{type:"button",size:"icon-sm",variant:"ghost",disabled:j||!!G,"aria-label":o("channels.editor.pairing.approvals.refresh"),onClick:()=>{B(void 0),D(P=>P+1)},children:j?a.jsx(Hr,{}):a.jsx($g,{})})]})]}),M?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(Wl,{children:o("channels.editor.pairing.approvals.error")}),a.jsx(ao,{children:M}),a.jsx(Zt,{className:"mt-2 w-fit",type:"button",size:"sm",variant:"outline",disabled:j,onClick:()=>D(P=>P+1),children:o("channels.editor.pairing.retry")})]}):null,$?a.jsxs("div",{role:"status",className:Js.success,children:[a.jsx(kh,{}),$]}):null,!j&&!M&&_.length===0?a.jsxs("div",{className:Js.empty,children:[a.jsx(GF,{"aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("p",{className:Js.emptyTitle,children:o("channels.editor.pairing.approvals.empty.title")}),a.jsx("p",{className:Js.emptyDescription,children:o("channels.editor.pairing.approvals.empty.description")})]})]}):null,_.length>0?a.jsx("ul",{className:Js.list,children:_.map(P=>a.jsxs("li",{className:Js.approval,children:[a.jsxs("div",{className:Js.approvalIdentity,children:[a.jsx(GF,{"aria-hidden":"true"}),a.jsx("code",{className:Js.approvalSenderId,children:P})]}),a.jsxs(Zt,{type:"button",size:"sm",variant:"destructive",disabled:!!G||!!y,"aria-label":o("channels.editor.pairing.approvals.revokeFor",{senderId:P}),onClick:()=>z(P),children:[G===P?a.jsx(Hr,{}):a.jsx(kf,{}),o("channels.editor.pairing.approvals.revoke")]})]},P))}):null,i.length>0?a.jsxs(oo,{children:[a.jsx(d5,{}),a.jsx(Wl,{children:o("channels.editor.pairing.allowlist.title")}),a.jsxs(ao,{children:[a.jsx("p",{children:o("channels.editor.pairing.allowlist.description")}),a.jsx("code",{className:Js.allowlist,children:i.join(", ")})]})]}):null]}),a.jsx(Wy,{open:!!N,onOpenChange:P=>{P||z(void 0)},children:a.jsxs(Vy,{children:[a.jsxs(Gy,{children:[a.jsx(Yy,{children:o("channels.editor.pairing.approvals.confirm.title",{senderId:N??""})}),a.jsx(Xy,{children:o("channels.editor.pairing.approvals.confirm.description")})]}),a.jsxs(Ky,{children:[a.jsx(Qy,{type:"button",children:o("channels.editor.cancel")}),a.jsx(Y6,{type:"button",variant:"destructive",onClick:()=>{N&&U(N)},children:o("channels.editor.pairing.approvals.confirm.action")})]})]})})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function TEt(e,t){const n=t==null?void 0:t.config[e.key];return e.kind==="boolean"?typeof n=="boolean"?n:!1:e.kind==="number"?typeof n=="number"?String(n):"":typeof n=="string"?n:""}function MY(e,t){var i;const n={},r={};for(const o of e.fields){if(o.kind==="secret"){r[o.key]=(i=t==null?void 0:t.secrets[o.key])!=null&&i.present?{operation:"preserve"}:{operation:"replace",value:""};continue}n[o.key]=TEt(o,t)}const s=t==null?void 0:t.config.senderPolicy;return{name:(t==null?void 0:t.name)??"",values:n,secrets:r,senderPolicy:s==="pairing"||s==="open"?s:t?"":"pairing"}}function EEt(e,t){var r;if(e.kind==="secret"){const s=t.secrets[e.key];return(s==null?void 0:s.operation)==="preserve"?!1:(s==null?void 0:s.operation)==="clear"?!0:!((r=s==null?void 0:s.value)!=null&&r.trim())}const n=t.values[e.key];return typeof n=="string"?n.trim().length===0:!1}function AEt(e,t,n){const r={},s=t.name.trim();s?s==="all"||["__proto__","constructor","prototype"].includes(s)?r.name="invalid":n.includes(s)&&(r.name="duplicate"):r.name="required";for(const i of e.fields)i.required&&EEt(i,t)?r[i.key]="required":i.kind==="number"&&typeof t.values[i.key]=="string"&&t.values[i.key]!==""&&!Number.isFinite(Number(t.values[i.key]))&&(r[i.key]="number");return t.senderPolicy||(r.senderPolicy="policy"),r}function jEt(e,t,n){if(t.kind==="boolean"){e[t.key]=n===!0;return}const r=typeof n=="string"?n.trim():"";if(!r){delete e[t.key];return}e[t.key]=t.kind==="number"?Number(r):r}function NEt(e,t,n,r){const s={...(r==null?void 0:r.config)??{},type:e.type},i={};for(const o of e.fields){if(o.kind==="secret"){const l=t.secrets[o.key]??{operation:"preserve"};i[o.key]=l.operation==="replace"?{operation:"replace",value:l.value??""}:{operation:l.operation};continue}jEt(s,o,t.values[o.key])}return s.senderPolicy=t.senderPolicy,{expectedRevision:n,config:s,secrets:i}}const IEt={dingtalk:"D",wecom:"W",feishu:"F"},MEt={dingtalk:{clientId:"channels.editor.field.dingtalk.clientId",clientSecret:"channels.editor.field.dingtalk.clientSecret"},wecom:{botId:"channels.editor.field.wecom.botId",secret:"channels.editor.field.wecom.secret",wsUrl:"channels.editor.field.wecom.wsUrl"},feishu:{clientId:"channels.editor.field.feishu.clientId",clientSecret:"channels.editor.field.feishu.clientSecret"}};function REt(e){const t=e==null?void 0:e.config.allowedUsers;return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}function Kw({id:e,label:t,required:n,hint:r,error:s,children:i}){return a.jsxs("div",{className:Ji.field,children:[a.jsxs("div",{className:Ji.fieldHeader,children:[a.jsxs(Ug,{htmlFor:e,children:[t,n?a.jsx("span",{className:Ji.required,"aria-hidden":"true",children:"*"}):null]}),r?a.jsx("span",{className:Ji.hint,children:r}):null]}),i,s?a.jsx("p",{role:"alert",className:"text-xs text-destructive",children:s}):null]})}function DEt({open:e,descriptor:t,instance:n,expectedRevision:r,existingNames:s,onOpenChange:i,onSave:o,onReload:l,listPairingRequests:c,approvePairingRequest:u,listPairingApprovals:d,revokePairingApproval:f}){const{t:m}=rt(),p=h.useId(),[g,b]=h.useState(()=>MY(t,n)),[w,y]=h.useState({}),[v,x]=h.useState(),[k,S]=h.useState(!1),[T,_]=h.useState(!1);h.useEffect(()=>{e&&(b(MY(t,n)),y({}),x(void 0))},[t,n,e]);const C=R=>{var B;const $=(B=MEt[t.type])==null?void 0:B[R.key];return $?m($):R.label},j=(R,$)=>$==="duplicate"?m("channels.editor.validation.duplicate"):$==="invalid"?m("channels.editor.validation.invalidName"):$==="number"?m("channels.editor.validation.number"):$==="policy"?m("channels.editor.validation.policy"):m("channels.editor.validation.required",{label:R?C(R):m("channels.editor.instanceName")}),E=async R=>{R.preventDefault();const $=AEt(t,g,s);if(Object.keys($).length>0){y(Object.fromEntries(Object.entries($).map(([B,N])=>[B,j(t.fields.find(z=>z.key===B),N)])));return}S(!0),x(void 0);try{await o(g.name.trim(),NEt(t,g,r,n)),i(!1)}catch(B){x(Ao(B))}finally{S(!1)}},L=async()=>{_(!0);try{await l(),i(!1)}catch(R){x(Ao(R))}finally{_(!1)}},D=R=>{const $=`${p}-${R.key}`,B=n==null?void 0:n.secrets[R.key],N=g.secrets[R.key]??{operation:"replace",value:""},z=w[R.key],G=N.operation==="replace",I=R.required?["preserve","replace"]:["preserve","replace","clear"];return a.jsxs(Kw,{id:$,label:C(R),required:R.required,hint:R.envResolvable?m("channels.editor.environmentReference"):void 0,error:z,children:[B!=null&&B.present?a.jsxs("div",{className:Ji.secretState,children:[a.jsxs("span",{className:Ji.secretStatus,children:[a.jsx(u5,{size:15}),B.source==="environment"?m("channels.editor.secret.environment"):m("channels.editor.secret.stored")]}),a.jsx("div",{className:Ji.secretActions,children:I.map(Y=>a.jsx(Zt,{type:"button",size:"xs",variant:N.operation===Y?"secondary":"ghost","aria-pressed":N.operation===Y,onClick:()=>b(U=>({...U,secrets:{...U.secrets,[R.key]:Y==="replace"?{operation:Y,value:""}:{operation:Y}}})),children:m(`channels.editor.secret.${Y}`)},Y))})]}):null,G?a.jsx(Us,{id:$,type:"password",autoComplete:"new-password",value:N.value??"","aria-invalid":!!z,"aria-required":R.required,placeholder:m("channels.editor.secret.placeholder",{label:C(R)}),onChange:Y=>b(U=>({...U,secrets:{...U.secrets,[R.key]:{operation:"replace",value:Y.target.value}}}))}):null,N.operation==="clear"?a.jsx("p",{className:Ji.hint,children:m("channels.editor.secret.clearHint")}):null]},R.key)},M=R=>{var G;if(R.kind==="secret")return D(R);const $=`${p}-${R.key}`,B=g.values[R.key],N=w[R.key],z=I=>b(Y=>({...Y,values:{...Y.values,[R.key]:I}}));return R.kind==="boolean"?a.jsx(Kw,{id:$,label:C(R),required:R.required,error:N,children:a.jsx(e8,{id:$,checked:B===!0,"aria-required":R.required,onCheckedChange:I=>z(I)})},R.key):R.kind==="enum"?a.jsx(Kw,{id:$,label:C(R),required:R.required,error:N,children:a.jsxs(Sl,{value:String(B??""),onValueChange:z,children:[a.jsx(Tl,{id:$,className:"w-full","aria-required":R.required,children:a.jsx(Cl,{})}),a.jsx(El,{children:(G=R.options)==null?void 0:G.map(I=>a.jsx(Ti,{value:I.value,children:I.label},I.value))})]})},R.key):a.jsx(Kw,{id:$,label:C(R),required:R.required,hint:R.envResolvable?m("channels.editor.environmentReference"):void 0,error:N,children:a.jsx(Us,{id:$,type:R.kind==="number"?"number":"text",value:String(B??""),"aria-invalid":!!N,"aria-required":R.required,onChange:I=>z(I.target.value)})},R.key)};return a.jsx(zp,{open:e,onOpenChange:i,children:a.jsxs(Fp,{className:"max-w-[calc(100%-2rem)] p-5 sm:max-w-xl",children:[a.jsx(qp,{children:a.jsxs("div",{className:Ji.platformHeader,children:[a.jsx("span",{className:Ji.platformMark,"aria-hidden":"true",children:IEt[t.type]??t.displayName[0]}),a.jsxs("div",{children:[a.jsx(Up,{children:m(n?"channels.editor.editTitle":"channels.editor.addTitle",{platform:t.displayName})}),a.jsx(Hg,{className:"mt-1",children:m(n?"channels.editor.editDescription":"channels.editor.addDescription")})]})]})}),a.jsxs("form",{className:Ji.form,onSubmit:E,children:[a.jsxs("div",{className:Ji.body,children:[v?a.jsxs(oo,{variant:"destructive",children:[a.jsx(UF,{}),a.jsx(Wl,{children:m("channels.editor.saveError")}),a.jsx(ao,{children:v}),a.jsxs(Zt,{className:"mt-2 w-fit",type:"button",size:"sm",variant:"outline",disabled:T,onClick:()=>void L(),children:[T?a.jsx(Hr,{}):null,m("channels.editor.reloadLatest")]})]}):null,a.jsxs("section",{className:Ji.section,children:[a.jsx("h3",{className:Ji.sectionHeading,children:m("channels.editor.section.identity")}),a.jsx(Kw,{id:`${p}-name`,label:m("channels.editor.instanceName"),required:!0,error:w.name,children:a.jsx(Us,{id:`${p}-name`,value:g.name,disabled:!!n,"aria-invalid":!!w.name,"aria-required":!0,placeholder:m("channels.editor.instanceNamePlaceholder"),onChange:R=>b($=>({...$,name:R.target.value}))})})]}),a.jsxs("section",{className:Ji.section,children:[a.jsx("h3",{className:Ji.sectionHeading,children:m("channels.editor.section.credentials")}),t.fields.map(M)]}),a.jsxs("section",{className:Ji.section,children:[a.jsx("h3",{className:Ji.sectionHeading,children:m("channels.editor.section.access")}),a.jsx(ume,{className:Ji.policyGrid,value:g.senderPolicy,"aria-invalid":!!w.senderPolicy,onValueChange:R=>b($=>({...$,senderPolicy:R==="pairing"||R==="open"?R:""})),children:["pairing","open"].map(R=>a.jsxs(Ug,{className:Ji.policyCard,"data-selected":g.senderPolicy===R,children:[a.jsx(dme,{value:R}),a.jsxs("span",{className:Ji.policyCopy,children:[a.jsx("span",{className:Ji.policyTitle,children:m(`channels.editor.policy.${R}.title`)}),a.jsx("span",{className:Ji.policyDescription,children:m(`channels.editor.policy.${R}.description`)})]})]},R))}),w.senderPolicy?a.jsx("p",{role:"alert",className:"text-xs text-destructive",children:w.senderPolicy}):null,g.senderPolicy==="pairing"?(n==null?void 0:n.config.senderPolicy)==="pairing"?a.jsx(CEt,{channelName:n.name,listRequests:c,approveRequest:u,listApprovals:d,revokeApproval:f,staticAllowedUsers:REt(n)}):a.jsxs(oo,{children:[a.jsx(UF,{}),a.jsx(Wl,{children:m("channels.editor.pairing.saveFirst.title")}),a.jsx(ao,{children:m("channels.editor.pairing.saveFirst.description")})]}):null]})]}),a.jsxs(Hp,{className:"mt-4",children:[a.jsx(Zt,{type:"button",variant:"outline",onClick:()=>i(!1),children:m("channels.editor.cancel")}),a.jsxs(Zt,{type:"submit",disabled:k||T,children:[k?a.jsx(Hr,{}):null,m("channels.editor.save")]})]})]})]})})}const LEt="_page_1flo8_1",PEt="_pageHeader_1flo8_9",OEt="_titleGroup_1flo8_18",$Et="_titleCopy_1flo8_25",BEt="_title_1flo8_18",zEt="_summary_1flo8_37",FEt="_section_1flo8_46",qEt="_sectionHeader_1flo8_53",HEt="_sectionTitle_1flo8_60",UEt="_channelGrid_1flo8_65",WEt="_channelCard_1flo8_71",VEt="_channelActions_1flo8_98",GEt="_lifecycleActions_1flo8_106",KEt="_startupControl_1flo8_112",YEt="_errorAlert_1flo8_120",XEt="_platformGrid_1flo8_128",QEt="_platformCard_1flo8_134",JEt="_platformMark_1flo8_167",ZEt="_platformCopy_1flo8_182",eAt="_platformName_1flo8_186",tAt="_platformHint_1flo8_194",Qi={page:LEt,pageHeader:PEt,titleGroup:OEt,titleCopy:$Et,title:BEt,summary:zEt,section:FEt,sectionHeader:qEt,sectionTitle:HEt,channelGrid:UEt,channelCard:WEt,channelActions:VEt,lifecycleActions:GEt,startupControl:KEt,errorAlert:YEt,platformGrid:XEt,platformCard:QEt,platformMark:JEt,platformCopy:ZEt,platformName:eAt,platformHint:tAt};/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const nAt=new Set(["dingtalk","wecom","feishu"]);function pme(e){return typeof e=="string"&&nAt.has(e)}function rAt(e){return e.manageable&&pme(e.type)}const sAt={stopped:"channels.status.stopped",starting:"channels.status.starting",connected:"channels.status.connected",partial:"channels.status.partial",error:"channels.status.error"},iAt={dingtalk:"D",wecom:"W",feishu:"F"};function oAt(e){return e==="error"?"destructive":e==="connected"?"secondary":"outline"}function aAt({onClose:e,initialFocusRef:t}){var F,te;const{t:n}=rt(),r=yo(),s=((F=r.capabilities)==null?void 0:F.features.includes("channel_management"))===!0,{catalog:i,snapshot:o,channels:l,loading:c,error:u,reload:d,createOrUpdate:f,remove:m,setStartup:p,start:g,stop:b,restart:w,pairing:y}=Ewe({autoLoad:s,enabled:s}),v=s&&!!r.token,[x,k]=h.useState(null),[S,T]=h.useState({}),[_,C]=h.useState(),[j,E]=h.useState(),[L,D]=h.useState(),[M,R]=h.useState(!1);h.useEffect(()=>{k(null),T({}),C(void 0),E(void 0),D(void 0),R(!1)},[r.workspaceCwd]);const $=h.useMemo(()=>i.filter(rAt),[i]),B=h.useMemo(()=>Object.values(l).filter(W=>pme(W.config.type)).sort((W,K)=>W.name.localeCompare(K.name)),[l]),N=((te=r.workspaceCwd)==null?void 0:te.split(/[\\/]+/).filter(Boolean).at(-1))??n("channels.workspace.current"),z=h.useCallback(W=>{var ce;const K=String(W.config.type);return((ce=i.find(ie=>ie.type===K))==null?void 0:ce.displayName)??K},[i]),G=h.useCallback(W=>$.find(K=>K.type===W.config.type),[$]),I=h.useCallback((W,K)=>f(W,K),[f]),Y=h.useCallback(async()=>{if(!(!j||j.workspaceCwd!==r.workspaceCwd||!o||M)){R(!0),D(void 0);try{await m(j.instance.name,{expectedRevision:o.revision}),E(void 0)}catch(W){D(Ao(W))}finally{R(!1)}}},[j,M,m,o,r.workspaceCwd]),U=h.useCallback(async(W,K,ce)=>{if(!(!v||x)){k({name:W.name,action:K}),T(ie=>{const Z={...ie};return delete Z[W.name],Z});try{await ce()}catch(ie){T(Z=>({...Z,[W.name]:Ao(ie)}))}finally{k(null)}}},[x,v]),P=W=>{const K=!v||x!==null;return W.runtime.state==="stopped"?a.jsxs(Zt,{size:"sm",disabled:K,onClick:()=>void U(W,"start",()=>g(W.name)),children:[(x==null?void 0:x.name)===W.name&&x.action==="start"?a.jsx(Hr,{}):null,n("channels.action.start")]}):W.runtime.state==="error"?a.jsxs(Zt,{size:"sm",disabled:K,onClick:()=>void U(W,"restart",()=>w(W.name)),children:[(x==null?void 0:x.name)===W.name&&x.action==="restart"?a.jsx(Hr,{}):null,n("channels.action.retry")]}):a.jsxs(Zt,{size:"sm",variant:"outline",disabled:K,onClick:()=>void U(W,"stop",()=>b(W.name)),children:[(x==null?void 0:x.name)===W.name&&x.action==="stop"?a.jsx(Hr,{}):null,n("channels.action.stop")]})};return a.jsxs("div",{className:Qi.page,children:[a.jsx("header",{className:Qi.pageHeader,children:a.jsxs("div",{className:Qi.titleGroup,children:[a.jsx(Zt,{variant:"ghost",size:"icon",onClick:e,"aria-label":n("channels.action.back"),children:a.jsx(v_,{})}),a.jsxs("div",{className:Qi.titleCopy,children:[a.jsx("h1",{ref:t,tabIndex:-1,className:Qi.title,children:n("channels.title")}),a.jsx("p",{className:Qi.summary,children:n("channels.summary",{workspace:N,count:B.length})})]})]})}),s?null:a.jsxs(oo,{children:[a.jsx(Oa,{}),a.jsx(Wl,{children:n("channels.unsupported.title")}),a.jsx(ao,{children:n("channels.unsupported.description")})]}),s&&!r.token?a.jsxs(oo,{children:[a.jsx(Oa,{}),a.jsx(Wl,{children:n("channels.readOnly.title")}),a.jsx(ao,{children:n("channels.readOnly.description")})]}):null,c&&B.length===0?a.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Hr,{}),n("channels.loading")]}):null,u?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(Wl,{children:n("channels.loadError.title")}),a.jsx(ao,{children:Ao(u)}),a.jsx(Zt,{className:"mt-2 w-fit",size:"sm",variant:"outline",onClick:()=>void d(),children:n("channels.action.retry")})]}):null,a.jsxs("section",{className:Qi.section,"aria-labelledby":"configured-channels",children:[a.jsxs("div",{className:Qi.sectionHeader,children:[a.jsx("h2",{id:"configured-channels",className:Qi.sectionTitle,children:n("channels.configured")}),a.jsx(Ai,{variant:"outline",children:B.length})]}),!c&&!u&&B.length===0?a.jsx(fd,{className:"border",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:a.jsx(wee,{})}),a.jsx(gd,{children:n("channels.empty.title")}),a.jsx(Nv,{children:n("channels.empty.description")})]})}):null,B.length>0?a.jsx("div",{className:Qi.channelGrid,children:B.map(W=>{const K=G(W),ce=S[W.name]??W.runtime.lastError;return a.jsxs(Uo,{size:"sm",className:Qi.channelCard,"data-runtime-state":W.runtime.state,children:[a.jsxs(Vl,{children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs(Gl,{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx("span",{className:"truncate",children:W.name}),a.jsx(Ai,{variant:oAt(W.runtime.state),children:n(sAt[W.runtime.state])})]}),a.jsx(Lu,{children:z(W)})]}),a.jsx(Khe,{children:P(W)})]}),ce?a.jsx(hc,{children:a.jsxs(oo,{variant:"destructive",className:Qi.errorAlert,children:[a.jsx(Oa,{}),a.jsx(Wl,{children:n("channels.runtimeError")}),a.jsx(ao,{children:ce})]})}):null,a.jsxs(G0t,{className:Qi.channelActions,children:[a.jsxs("label",{className:Qi.startupControl,children:[a.jsx(e8,{size:"sm",checked:W.startsWithServe,disabled:!v||x!==null||!o,"aria-label":n("channels.action.startWithServeNamed",{name:W.name}),onCheckedChange:ie=>void U(W,"startup",()=>p(W.name,{expectedRevision:(o==null?void 0:o.revision)??"",enabled:ie}))}),n("channels.startsWithServe")]}),a.jsxs("div",{className:Qi.lifecycleActions,children:[W.runtime.state!=="stopped"&&W.runtime.state!=="error"?a.jsxs(Zt,{size:"sm",variant:"ghost",disabled:!v||x!==null,onClick:()=>void U(W,"restart",()=>w(W.name)),children:[(x==null?void 0:x.name)===W.name&&x.action==="restart"?a.jsx(Hr,{}):a.jsx(h_e,{}),n("channels.action.restart")]}):null,K?a.jsxs(Zt,{size:"sm",variant:"ghost",disabled:!v||x!==null||!o,"aria-label":n("channels.action.editNamed",{name:W.name}),onClick:()=>C({workspaceCwd:r.workspaceCwd,descriptor:K,instance:W}),children:[a.jsx(_y,{}),n("channels.action.edit")]}):null,a.jsxs(Zt,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",disabled:!v||x!==null||!o,"aria-label":n("channels.action.deleteNamed",{name:W.name}),onClick:()=>{D(void 0),E({workspaceCwd:r.workspaceCwd,instance:W})},children:[a.jsx(kf,{}),n("channels.action.delete")]})]})]})]},W.name)})}):null]}),$.length>0?a.jsxs("section",{className:Qi.section,"aria-labelledby":"channel-platforms",children:[a.jsxs("div",{children:[a.jsx("h2",{id:"channel-platforms",className:Qi.sectionTitle,children:n("channels.availablePlatforms")}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n("channels.availablePlatforms.description")})]}),a.jsx("div",{className:Qi.platformGrid,children:$.map(W=>a.jsxs("button",{type:"button",className:Qi.platformCard,"data-testid":`channel-platform-${W.type}`,disabled:!v||!o,"aria-label":n("channels.platform.configureNamed",{platform:W.displayName}),onClick:()=>C({workspaceCwd:r.workspaceCwd,descriptor:W}),children:[a.jsx("span",{className:Qi.platformMark,"aria-hidden":"true",children:iAt[W.type]}),a.jsxs("div",{className:Qi.platformCopy,children:[a.jsx("p",{className:Qi.platformName,children:W.displayName}),a.jsx("p",{className:Qi.platformHint,children:n("channels.platform.configure")})]})]},W.type))})]}):null,_&&_.workspaceCwd===r.workspaceCwd&&o?a.jsx(DEt,{open:!0,descriptor:_.descriptor,instance:_.instance,expectedRevision:o.revision,existingNames:B.filter(W=>{var K;return W.name!==((K=_.instance)==null?void 0:K.name)}).map(W=>W.name),onOpenChange:W=>{W||C(void 0)},onSave:I,onReload:d,listPairingRequests:y.list,approvePairingRequest:y.approve,listPairingApprovals:y.approvals,revokePairingApproval:y.revoke}):null,a.jsx(Wy,{open:!!(j&&j.workspaceCwd===r.workspaceCwd),onOpenChange:W=>{!W&&!M&&(E(void 0),D(void 0))},children:a.jsxs(Vy,{children:[a.jsxs(Gy,{children:[a.jsx(Yy,{children:n("channels.delete.title",{name:(j==null?void 0:j.instance.name)??""})}),a.jsx(Xy,{children:n("channels.delete.description")})]}),L?a.jsxs(oo,{variant:"destructive",children:[a.jsx(Oa,{}),a.jsx(Wl,{children:n("channels.delete.error")}),a.jsx(ao,{children:L}),a.jsx(Zt,{className:"mt-2 w-fit",size:"sm",variant:"outline",onClick:()=>{d().then(()=>{E(void 0),D(void 0)},W=>{D(Ao(W))})},children:n("channels.editor.reloadLatest")})]}):null,a.jsxs(Ky,{children:[a.jsx(Qy,{disabled:M,children:n("channels.editor.cancel")}),a.jsxs(Zt,{variant:"destructive",disabled:M,onClick:()=>void Y(),children:[M?a.jsx(Hr,{}):null,n("channels.action.delete")]})]})]})})]})}const lAt=new Set(["plugins","extensions","mcp","skills","agents","channels"]);function cAt(e){return e!==null&&lAt.has(e)}function uAt(e){return typeof e=="boolean"?{plugins:e,portals:e}:{plugins:(e==null?void 0:e.plugins)??!1,portals:(e==null?void 0:e.portals)??!1,styles:e==null?void 0:e.styles}}const RY=new WeakMap;function dAt(e){const t=e.querySelector('style[data-qwen-web-shell="component"]');return t!=null&&t.textContent?t.textContent:Array.from(e.querySelectorAll("style[data-vite-dev-id]")).filter(n=>{const r=n.dataset.viteDevId??"";return r.includes("/packages/web-shell/")||r.includes("/web-shell/client/")}).map(n=>n.textContent??"").filter(Boolean).join(`
`)}function gme(e,t){var s;const n=(s=e.defaultView)==null?void 0:s.CSSStyleSheet;if(!n||typeof n.prototype.replaceSync!="function")return null;const r=new n;return r.replaceSync(t),r}function hAt(e,t){const n=RY.get(e);if((n==null?void 0:n.css)===t)return n.sheet;const r=gme(e,t);return r&&RY.set(e,{css:t,sheet:r}),r}function bme(e,t){const n=dAt(e.ownerDocument),r=[n,t].filter(i=>!!i);try{const i=n?hAt(e.ownerDocument,n):null,o=t?gme(e.ownerDocument,t):null,l=[i,o].filter(c=>!!c);if(l.length===r.length&&l.length>0)return e.adoptedStyleSheets=[...e.adoptedStyleSheets,...l],()=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(c=>!l.includes(c))}}catch{}const s=r.map(i=>{const o=e.ownerDocument.createElement("style");return o.dataset.qwenWebShellShadow="",o.textContent=i,e.appendChild(o),o});return()=>{for(const i of s)i.remove()}}function fAt({children:e,enabled:t,language:n,themeClassName:r,styles:s,initialFocusRef:i}){const o=h.useRef(null),[l,c]=h.useState(null);return h.useLayoutEffect(()=>{if(!t||!o.current)return;o.current.style.setProperty("all","initial","important"),o.current.style.setProperty("display","block","important"),o.current.style.setProperty("min-width","0","important"),o.current.style.setProperty("width","100%","important");const u=o.current.shadowRoot??o.current.attachShadow({mode:"open"}),d=u.ownerDocument.createElement("div");d.dataset.webShellRoot="",d.dataset.webShellShadcn="",d.dataset.webShellShadowRoot="plugins";const f=bme(u,s);return u.appendChild(d),c(d),()=>{d.remove(),f(),c(null)}},[t,s]),h.useLayoutEffect(()=>{l&&(l.className=r,l.lang=n)},[n,l,r]),h.useLayoutEffect(()=>{var u;l&&((u=i==null?void 0:i.current)==null||u.focus())},[i,l]),t?a.jsx("div",{ref:o,"data-web-shell-shadow-host":"plugins",children:l?xd.createPortal(e,l):null}):e}const mAt="_section_1ghly_1",pAt="_header_1ghly_12",gAt="_title_1ghly_19",bAt="_addButton_1ghly_24",yAt="_hint_1ghly_38",vAt="_empty_1ghly_39",wAt="_provider_1ghly_45",xAt="_providerName_1ghly_51",kAt="_modelRow_1ghly_59",_At="_modelInfo_1ghly_70",SAt="_modelName_1ghly_78",CAt="_modelBaseUrl_1ghly_84",TAt="_currentBadge_1ghly_91",EAt="_runtimeBadge_1ghly_99",AAt="_modelActions_1ghly_107",jAt="_actionButton_1ghly_114",NAt="_deleteButton_1ghly_115",IAt="_confirmButton_1ghly_116",Oo={section:mAt,header:pAt,title:gAt,addButton:bAt,hint:yAt,empty:vAt,provider:wAt,providerName:xAt,modelRow:kAt,modelInfo:_At,modelName:SAt,modelBaseUrl:CAt,currentBadge:TAt,runtimeBadge:EAt,modelActions:AAt,actionButton:jAt,deleteButton:NAt,confirmButton:IAt};function I4(e,t){return`${e.authType}:${t.modelId}:${t.baseUrl??""}`}function MAt(e,t){const n=e.flatMap(s=>s.models.map(i=>({provider:s,model:i})));if(t){const s=n.find(({model:o})=>o.modelId===t);if(s)return I4(s.provider,s.model);const i=n.filter(({model:o})=>o.baseModelId===t);if(i.length===1)return I4(i[0].provider,i[0].model)}const r=n.find(({model:s})=>s.isCurrent);return r?I4(r.provider,r.model):void 0}function RAt({providers:e,currentModelId:t,loading:n,error:r,busy:s,onSelectModel:i,onDeleteModel:o,onAddModel:l}){const{t:c}=rt(),[u,d]=h.useState(null);h.useEffect(()=>{if(u===null)return;const p=g=>{g.key==="Escape"&&d(null)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[u]);const f=e.some(p=>p.models.length>0),m=MAt(e,t);return a.jsxs("div",{className:Oo.section,"data-testid":"model-management",children:[a.jsxs("div",{className:Oo.header,children:[a.jsx("span",{className:Oo.title,children:c("settings.models.title")}),a.jsx("button",{type:"button",className:Oo.addButton,disabled:s,onClick:l,children:c("settings.models.add")})]}),r&&a.jsx("div",{className:Oo.hint,children:r.message}),n&&!f&&a.jsx("div",{className:Oo.hint,children:c("settings.models.loading")}),!n&&!f&&!r&&a.jsx("div",{className:Oo.empty,children:c("settings.models.empty")}),e.map((p,g)=>p.models.length===0?null:a.jsxs("div",{className:Oo.provider,children:[a.jsx("div",{className:Oo.providerName,children:p.authType}),p.models.map(b=>{const w=I4(p,b),y=w===m,v=u===w,x=b.name||b.baseModelId;return a.jsxs("div",{className:Oo.modelRow,children:[a.jsxs("div",{className:Oo.modelInfo,children:[a.jsx("span",{className:Oo.modelName,children:b.name||b.baseModelId}),y&&a.jsx("span",{className:Oo.currentBadge,children:c("settings.models.current")}),b.isRuntime&&a.jsx("span",{className:Oo.runtimeBadge,children:c("settings.models.runtime")}),b.baseUrl&&a.jsx("span",{className:Oo.modelBaseUrl,children:b.baseUrl})]}),a.jsxs("div",{className:Oo.modelActions,children:[!y&&a.jsx("button",{type:"button",className:Oo.actionButton,disabled:s,"aria-label":`${c("settings.models.setCurrent")} ${x}`,onClick:()=>i(b.modelId),children:c("settings.models.setCurrent")}),!b.isRuntime&&(v?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:Oo.confirmButton,disabled:s,"aria-label":`${c("settings.models.confirmDelete")} ${x}`,onClick:()=>{d(null),o({authType:p.authType,modelId:b.baseModelId,...b.baseUrl?{baseUrl:b.baseUrl}:{}})},children:c("settings.models.confirmDelete")}),a.jsx("button",{type:"button",className:Oo.actionButton,disabled:s,"aria-label":`${c("settings.models.cancel")} ${x}`,onClick:()=>d(null),children:c("settings.models.cancel")})]}):a.jsx("button",{type:"button",className:Oo.deleteButton,disabled:s,"aria-label":`${c("settings.models.delete")} ${x}`,onClick:()=>d(w),children:c("settings.models.delete")}))]})]},w)})]},`${p.authType}:${g}`))]})}const DAt=new Set(["fastModel","visionModel","voiceModel","modelFallbacks"]),LAt=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline","mcpServers"]);function t8(e,t,n){const r=e(t);return r===t?n:r}function DY(e,t){return t8(t,`settings.category.${e}`,e)}function sb(e,t){return t8(t,`settings.label.${e.key}`,e.label)}function PAt(e,t){if(e.description)return t8(t,`settings.description.${e.key}`,e.description)}function yme(e,t,n,r){return t8(r,`settings.option.${e.key}.${String(t)}`,n)}function OAt(e,t,n){const r=wme(e,t);if(r==null)return"";if(e.key===mg){const i=cD(r,Fs.Dark);return n(`theme.${i}`)}if(e.key===bT){const i=rD(r);return i?sD(i):String(r)}if(e.type==="boolean")return n(r===!0?"settings.value.on":"settings.value.off");if(e.type==="enum"&&e.options){const i=e.options.find(o=>o.value===r);return i?yme(e,i.value,i.label,n):String(r)}const s=String(r);return s.length>24?`${s.slice(0,21)}…`:s}function vme(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function $At(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return vme(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function wme(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function BAt(e){const t=new Map;for(const n of e){let r=t.get(n.category);r||(r=[],t.set(n.category,r)),r.push(n)}return Array.from(t.entries()).map(([n,r])=>({category:n,items:r}))}function LY({category:e}){const t=e.toLowerCase(),n=t.includes("ui")?Jke:t.includes("tool")?HN:t.includes("context")?qN:t.includes("privacy")?w_e:t.includes("model")?Xb:t.includes("daemon")?Qb:t.includes("advanced")?k_e:t.includes("experimental")?ake:xee;return a.jsx(n,{"data-icon":"inline-start","aria-hidden":"true"})}function PY({title:e,description:t,metadata:n,control:r}){return a.jsxs(fo,{orientation:"responsive",className:"min-h-20 gap-6 px-5 py-4 max-md:px-4",children:[a.jsxs(Ghe,{className:"min-w-0",children:[a.jsxs(I0t,{children:[e,n]}),t&&a.jsx(ld,{className:"max-w-3xl",children:t})]}),a.jsx("div",{className:"flex min-w-0 justify-end max-md:justify-start",children:r})]})}function zAt({name:e,label:t,type:n,value:r,disabled:s,onCommit:i,onInvalid:o}){const l=String(r??""),[c,u]=h.useState(l);h.useEffect(()=>u(l),[l]);const d=()=>{if(n==="number"){const f=c.trim(),m=Number(f);if(!f||!Number.isFinite(m)){u(l),o();return}m!==r&&i(m);return}c!==l&&i(c)};return a.jsx(Us,{type:n,name:e,autoComplete:"off","aria-label":t,value:c,disabled:s,className:"w-[min(80px,50vw)] max-md:w-full",onChange:f=>u(f.target.value),onBlur:d,onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur(),f.key==="Escape"&&(u(l),f.currentTarget.blur())}})}function FAt({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:r,chatWidthMode:s,onChatWidthModeChange:i,modelManagement:o,embedded:l=!1}){const{language:c,t:u}=rt(),d=rm(),{status:f,settings:m,loading:p,error:g,reload:b,setValue:w}=e,[y,v]=h.useState("workspace"),[x,k]=h.useState(""),[S,T]=h.useState(null),[_,C]=h.useState(null),[j,E]=h.useState(!1),L=p&&!f,D=h.useMemo(()=>{const z=m.filter(U=>!LAt.has(U.key)),G=BAt(z).map(U=>({id:U.category,label:DY(U.category,u),items:U.items.map(P=>({type:"setting",setting:P}))})),I={type:"local",localKey:"chatWidth"},Y=G.find(U=>U.items.some(P=>P.type==="setting"&&P.setting.key===mg));if(Y){const U=Y.items.findIndex(P=>P.type==="setting"&&P.setting.key===mg);Y.items.splice(U+1,0,I)}else G.push({id:"UI",label:DY("UI",u),items:[I]});return G},[m,u]);h.useEffect(()=>{D.length!==0&&(D.some(z=>z.id===x)||k(D[0].id))},[x,D]),h.useEffect(()=>{var z;g?C(g.message):(z=f==null?void 0:f.warnings)!=null&&z.length?C(f.warnings.map(G=>u("settings.corrupted",{recovered:G.recovered?"true":"false"})).join("; ")):m.length>0&&C(null)},[g,m,f,u]);const M=h.useCallback((z,G)=>{j||C(null),T(z),w(y,z,G).then(async I=>{try{await b()}catch{}I!=null&&I.requiresRestart&&z!==bT&&E(!0)}).catch(I=>{C(I instanceof Error?I.message:String(I))}).finally(()=>T(null))},[b,j,y,w]),R=D.find(z=>z.id===x)??D[0],$=R==null?void 0:R.items.some(z=>z.type==="setting"&&z.setting.category==="Model"),B=(z,G,I,Y,U=!1)=>a.jsxs(Sl,{value:z,disabled:U,onValueChange:G,children:[a.jsx(Tl,{size:"sm","aria-label":Y,className:"w-[min(160px,50vw)] bg-background max-md:w-full",children:a.jsx(Cl,{})}),a.jsx(El,{position:"popper",align:"end",children:a.jsx(Kae,{children:I.map(P=>a.jsx(Ti,{value:P.value,children:P.label},P.value))})})]}),N=z=>{var U;const G=wme(z,y),Y=S===z.key;if(z.key===mg)return B(cD(G)??d,P=>{const F=P;r(F),M(mg,Dee(F))},Mee.map(P=>({value:P,label:u(`theme.${P}`)})),sb(z,u),Y);if(z.key===bT)return B(rD(G)??c,P=>t(P,y),fSe.map(P=>({value:P,label:sD(P)})),sb(z,u),Y);if(DAt.has(z.key))return a.jsx(Zt,{type:"button",variant:"outline",size:"sm",disabled:Y,className:"max-w-[260px] truncate",onClick:()=>n(z.key,y),children:OAt(z,y,u)||u("settings.action.select")});if(z.type==="boolean"){const P=G===!0;return a.jsx(e8,{checked:P,disabled:Y,onCheckedChange:F=>M(z.key,F),"aria-label":sb(z,u)})}if(z.type==="enum"&&((U=z.options)!=null&&U.length)){const P=z.options.findIndex(F=>F.value===G);return B(P>=0?String(P):"",F=>{var W;const te=(W=z.options)==null?void 0:W[Number(F)];te&&M(z.key,te.value)},z.options.map((F,te)=>({value:String(te),label:yme(z,F.value,F.label,u)})),sb(z,u),Y)}return a.jsx(zAt,{name:z.key,label:sb(z,u),type:z.type==="number"?"number":"text",value:G,disabled:Y,onCommit:P=>M(z.key,P),onInvalid:()=>C(u("settings.invalidNumber"))})};return a.jsxs("div",{className:l?"flex min-h-0 flex-1 flex-col text-sm text-foreground":"flex max-w-[min(var(--chat-regular-content-width,1000px),calc(100vw-64px))] flex-col overflow-hidden rounded-xl border border-border bg-background text-sm text-foreground","data-keyboard-scope":!0,children:[!l&&a.jsx("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:a.jsxs("div",{children:[a.jsx("h2",{className:"text-base font-semibold text-balance",children:u("settings.title")}),a.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:u("settings.scope.workspace")})]})}),(_||L)&&a.jsxs(oo,{className:"mx-4 mt-3 w-auto",children:[L&&a.jsx(Hr,{}),a.jsx(ao,{children:_||u("settings.loading")})]}),a.jsxs(y1,{value:y,className:"flex min-h-0 flex-1 flex-col gap-0",onValueChange:z=>{v(z)},children:[a.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border px-3 py-2",children:[a.jsxs(v1,{className:"p-0",children:[a.jsx(ci,{value:"workspace",children:u("settings.scope.workspace")}),a.jsx(ci,{value:"user",children:u("settings.scope.user")})]}),j&&a.jsx(Ai,{variant:"secondary",children:u("settings.requiresRestart")})]}),a.jsxs(Fi,{value:y,forceMount:!0,className:"grid min-h-0 flex-1 grid-cols-[190px_minmax(0,1fr)] outline-none max-md:grid-cols-1",children:[a.jsx("nav",{className:"flex min-h-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted/20 p-3 max-md:flex-row max-md:overflow-x-auto max-md:border-r-0 max-md:border-b","aria-label":u("settings.title"),children:D.map(z=>a.jsxs(Zt,{type:"button",variant:z.id===x?"secondary":"ghost",size:"sm","aria-current":z.id===x?"page":void 0,className:"w-full justify-start gap-2 px-2.5 max-md:w-auto max-md:shrink-0",onClick:()=>k(z.id),children:[a.jsx(LY,{category:z.id}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:z.label}),a.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:z.items.length})]},z.id))}),a.jsxs("section",{className:"min-h-0 min-w-0 overflow-y-auto bg-background p-5 max-md:p-3",children:[!p&&!R&&a.jsx(fd,{className:"min-h-60",children:a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:a.jsx(xee,{})}),a.jsx(gd,{children:u("settings.empty")}),a.jsx(Nv,{children:u("settings.empty")})]})}),R&&a.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[a.jsxs(Uo,{children:[a.jsx(Vl,{children:a.jsxs(Gl,{className:"flex items-center gap-2",children:[a.jsx(LY,{category:R.id}),R.label]})}),a.jsx(hc,{className:"-mb-(--card-spacing) p-0",children:a.jsx(uy,{className:"gap-0",children:R.items.map((z,G)=>{const I=G>0&&a.jsx(iO,{className:"mx-5 w-auto max-md:mx-4"});if(z.type==="local")return a.jsxs("div",{children:[I,a.jsx(PY,{title:u("settings.label.ui.chatWidth"),description:u("settings.description.ui.chatWidth"),control:B(s,W=>i(W),[{value:"1000",label:u("settings.option.ui.chatWidth.1000")},{value:"wide",label:u("settings.option.ui.chatWidth.wide")}],u("settings.label.ui.chatWidth"),!1)})]},z.localKey);const Y=z.setting,U=PAt(Y,u),P=$At(Y,y),F=vme(Y,y),te=P?u(P,{scope:u(y==="workspace"?"settings.scope.user":"settings.scope.workspace")}):void 0;return a.jsxs("div",{children:[I,a.jsx(PY,{title:sb(Y,u),description:[U,te].filter(Boolean).join(" · ")||void 0,metadata:F?a.jsx(Ai,{variant:"secondary",children:u(y==="workspace"?"settings.scope.workspace":"settings.scope.user")}):void 0,control:S===Y.key?a.jsx(Hr,{}):N(Y)})]},Y.key)})})})]}),$&&o&&a.jsx("div",{className:"mt-4",children:a.jsx(RAt,{...o})})]})]})]})]}),!l&&a.jsx("div",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:u("settings.footer")})]})}const qAt="_dialog_1ymqd_1",HAt="_toolbar_1ymqd_12",UAt="_tabs_1ymqd_21",WAt="_tab_1ymqd_21",VAt="_tabActive_1ymqd_39",GAt="_search_1ymqd_48",KAt="_general_1ymqd_60",YAt="_shortcuts_1ymqd_67",XAt="_shortcut_1ymqd_67",QAt="_shortcutKey_1ymqd_87",JAt="_shortcutDesc_1ymqd_95",ZAt="_commandList_1ymqd_101",ejt="_commandCard_1ymqd_108",tjt="_commandCardExpanded_1ymqd_115",njt="_commandRow_1ymqd_119",rjt="_commandName_1ymqd_135",sjt="_commandTag_1ymqd_142",ijt="_chevron_1ymqd_152",ojt="_chevronExpanded_1ymqd_160",ajt="_commandDetail_1ymqd_164",ljt="_commandDescription_1ymqd_174",cjt="_commandSubcommands_1ymqd_175",ujt="_empty_1ymqd_182",no={dialog:qAt,toolbar:HAt,tabs:UAt,tab:WAt,tabActive:VAt,search:GAt,general:KAt,shortcuts:YAt,shortcut:XAt,shortcutKey:QAt,shortcutDesc:JAt,commandList:ZAt,commandCard:ejt,commandCardExpanded:tjt,commandRow:njt,commandName:rjt,commandTag:sjt,chevron:ijt,chevronExpanded:ojt,commandDetail:ajt,commandDescription:ljt,commandSubcommands:cjt,empty:ujt},djt=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],hjt=new Set(["about","agents","approval-mode","arena","auth","branch","btw","bug","clear","compress","context","copy","release","diff","directory","docs","doctor","dream","editor","export","extensions","forget","goal","help","hooks","ide","init","insight","language","lsp","mcp","memory","model","new","permissions","plan","quit","recap","remember","rename","reset","restore","resume","rewind","settings","setup-github","skills","stats","status","statusline","summary","tasks","terminal-setup","theme","tools","trust","vim"]),fjt=[["@","help.shortcut.addContext"],["!","help.shortcut.shell"],["/","help.shortcut.commandMenu"],["Tab","help.shortcut.completion"],["Esc","help.shortcut.cancel"],["Ctrl+J","help.shortcut.newline"],["Ctrl+L","help.shortcut.clear"],["Ctrl+Y","help.shortcut.retry"],["Shift+Tab","help.shortcut.approvals"],["Alt+Left/Right","help.shortcut.altWords"],["Up/Down","help.shortcut.history"]];function mjt(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function AR(e){return!hjt.has(e.name)}function pjt(e,t){return AR(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function gjt(e,t,n){const r=n.trim().toLowerCase();return e.filter(s=>s.name&&s.description!==void 0).filter(s=>t==="commands"?!AR(s):t==="custom-commands"?AR(s):!0).filter(s=>r?s.name.toLowerCase().includes(r)||(s.description??"").toLowerCase().includes(r)||(s.argumentHint??"").toLowerCase().includes(r):!0).sort((s,i)=>s.name.localeCompare(i.name))}function bjt(){const{t:e}=rt();return a.jsx("div",{className:no.general,children:a.jsx("div",{className:no.shortcuts,children:fjt.map(([t,n])=>a.jsxs("div",{className:no.shortcut,children:[a.jsx("span",{className:no.shortcutDesc,children:e(n)}),a.jsx("span",{className:no.shortcutKey,children:t})]},t))})})}function yjt({commands:e,tab:t,query:n}){const{t:r}=rt(),[s,i]=h.useState(null),o=h.useMemo(()=>gjt(e,t,n),[e,n,t]);return o.length===0?a.jsx("div",{className:no.empty,children:r(t==="custom-commands"?"help.emptyCustom":"help.empty")}):a.jsx("div",{className:no.commandList,children:o.map(l=>{var u;const c=s===l.name;return a.jsxs("article",{className:`${no.commandCard} ${c?no.commandCardExpanded:""}`,children:[a.jsxs("button",{type:"button",className:no.commandRow,onClick:()=>i(c?null:l.name),"aria-expanded":c,children:[a.jsx("span",{className:no.commandName,children:mjt(l)}),a.jsx("span",{className:no.commandTag,children:pjt(l,r)}),a.jsx("svg",{className:`${no.chevron} ${c?no.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),c&&a.jsxs("div",{className:no.commandDetail,children:[l.description&&a.jsx("div",{className:no.commandDescription,children:l.description}),!!((u=l.subcommands)!=null&&u.length)&&a.jsxs("div",{className:no.commandSubcommands,children:[r("help.subcommands"),": ",l.subcommands.join(", ")]})]})]},l.name)})})}function vjt({commands:e}){const{t}=rt(),[n,r]=h.useState("general"),{filterValue:s,inputProps:i}=K6(),o=n!=="general";return a.jsxs("div",{className:no.dialog,children:[a.jsxs("div",{className:no.toolbar,children:[a.jsx("div",{className:no.tabs,children:djt.map(l=>a.jsx("button",{type:"button",className:`${no.tab} ${l.id===n?no.tabActive:""}`,onClick:()=>r(l.id),children:t(l.labelKey)},l.id))}),o&&a.jsx("input",{className:no.search,...i,placeholder:t("help.search")})]}),n==="general"?a.jsx(bjt,{}):a.jsx(yjt,{commands:e,tab:n,query:s})]})}function wjt({currentTheme:e,onSelect:t,onClose:n}){const{t:r}=rt(),s=Mee.map(d=>({id:d,label:r(`theme.${d}`),description:r(`theme.${d}.desc`)})),[i,o]=h.useState(()=>{const d=s.findIndex(f=>f.id===e);return d>=0?d:0}),l=h.useRef(null),c=d=>{const f=s[d];f&&(t(f.id),n())},{keyboardMode:u}=v0({itemCount:s.length,activeIndex:i,onActiveIndexChange:o,onConfirm:c});return h.useEffect(()=>{var f;const d=(f=l.current)==null?void 0:f.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),a.jsx("div",{className:_n("picker-list","picker-list-compact",u?"picker-keyboard-only":void 0),ref:l,role:"listbox","aria-label":r("theme.title"),tabIndex:0,"aria-activedescendant":s.length>0?`theme-opt-${i}`:void 0,"data-web-shell-theme-dialog":!0,children:s.map((d,f)=>{const m=d.id===e;return a.jsxs("div",{id:`theme-opt-${f}`,role:"option","aria-selected":m,className:_n("picker-item","picker-session-item",f===i?"selected":void 0,m?"dialog-current":void 0),"data-web-shell-theme-option":!0,"data-theme-id":d.id,onClick:()=>c(f),onMouseMove:()=>o(f),children:[a.jsx("div",{className:_n("picker-item-row"),children:a.jsx("span",{className:_n("picker-item-title"),children:d.label})}),a.jsx("div",{className:_n("picker-item-meta"),children:d.description})]},d.id)})})}const jR="delete-session-list",OY=e=>`${jR}-opt-${e}`;function xjt({onDeleted:e,onError:t,onClose:n,workspaceCwd:r}){const{t:s}=rt(),i=qa(),{sessions:o,loading:l,error:c,deleteSession:u,deleteSessions:d}=G_(r,{autoLoad:!0}),f=i.sessionId,[m,p]=h.useState(!1),[g,b]=h.useState(-1),[w,y]=h.useState(new Set),{filterValue:v,inputProps:x}=K6(()=>{b(-1),y(new Set)}),[k,S]=h.useState(null),T=h.useRef(null),_=h.useRef(null);h.useEffect(()=>{c&&S(c.message)},[c]);const C=h.useMemo(()=>v?o.filter(R=>{const $=v.toLowerCase();return(R.displayName||"").toLowerCase().includes($)||R.sessionId.toLowerCase().includes($)}):o,[o,v]),j=h.useCallback(R=>{R!==f&&y($=>{const B=new Set($);return B.has(R)?B.delete(R):B.add(R),B})},[f]);h.useEffect(()=>{if(w.size===0)return;const R=new Set(C.map($=>$.sessionId));y($=>{const B=new Set([...$].filter(N=>R.has(N)));return B.size===$.size?$:B})},[C,w.size]),h.useEffect(()=>{g>=C.length&&C.length>0&&b(C.length-1)},[C.length,g]),h.useEffect(()=>{var $;const R=($=T.current)==null?void 0:$.children[g];R==null||R.scrollIntoView({block:"nearest"})},[g]),h.useEffect(()=>{var R;(R=_.current)==null||R.focus()},[]);const{keyboardMode:E}=v0({itemCount:C.length,activeIndex:g,onActiveIndexChange:b,onConfirm:R=>{const $=C[R];$&&j($.sessionId)}}),L=h.useCallback(()=>{if(m)return;if(w.size>0){const $=new Set(C.map(N=>N.sessionId)),B=Array.from(w).filter(N=>$.has(N));if(B.length===0)return;p(!0),d(B).then(N=>{const z=N.removed.length+N.notFound.length,G=N.errors.length;if(G>0&&z>0){t(new Error(s("delete.partialFail",{removed:z,failed:G,detail:N.errors[0].error}))),n();return}if(G>0){S(s("delete.allFailed",{count:G,reason:N.errors[0].error})),p(!1),y(new Set);return}if(z===0){S(s("delete.nonRemoved")),p(!1),y(new Set);return}e([...N.removed,...N.notFound]),n()}).catch(N=>{t(N),p(!1)});return}const R=C[g];if(R){if(R.sessionId===f){S(s("delete.cannotCurrent"));return}p(!0),u(R.sessionId).then($=>{if(!$){S(s("delete.notFound")),p(!1);return}e([R.sessionId]),n()}).catch($=>{t($),p(!1)})}},[f,u,d,m,C,n,e,t,g,w,s]),D=w.size>0,M=!m&&!l&&D;return a.jsxs("div",{className:_n("picker","picker-in-shell"),children:[a.jsxs("div",{className:_n("picker-search"),children:[a.jsxs("span",{className:_n("picker-search-label"),children:[s("resume.search"),":"," "]}),a.jsx("input",{ref:_,className:_n("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":jR,"aria-activedescendant":g>=0&&g<C.length?OY(g):void 0,...x,placeholder:""}),a.jsx("span",{className:_n("picker-search-hint"),children:k||(m?s("delete.deleting"):l?s("common.loading"):D?s("delete.selected",{count:w.size}):v?s("delete.matches",{count:C.length}):"")})]}),a.jsx("div",{className:_n("picker-sep")}),a.jsxs("div",{id:jR,role:"listbox","aria-multiselectable":"true",className:_n("picker-list",E?"picker-keyboard-only":void 0),ref:T,children:[l&&a.jsx("div",{className:_n("picker-empty"),children:s("common.loading")}),!l&&c&&a.jsx("div",{className:_n("picker-empty"),children:c.message}),!l&&!c&&C.length===0&&a.jsx("div",{className:_n("picker-empty"),children:v?s("delete.noMatch",{query:v}):s("delete.none")}),!l&&C.map((R,$)=>{const B=R.sessionId===f,N=w.has(R.sessionId);return a.jsx(sO,{session:R,optionId:OY($),active:$===g,ariaSelected:N,current:!1,disabled:B,leading:a.jsx("span",{className:_n("picker-item-checkbox",N?"picker-item-checkbox-checked":void 0),children:N?"[x] ":"[ ] "}),trailing:B?a.jsx("span",{className:_n("picker-item-badge"),children:s("resume.current")}):void 0,onClick:()=>{b($),B||j(R.sessionId)},onActivate:()=>b($)},R.sessionId)})]}),a.jsx("div",{className:_n("picker-sep")}),a.jsxs("div",{className:_n("dialog-footer-actions"),children:[a.jsx("button",{type:"button",className:_n("dialog-inline-button"),onClick:n,disabled:m,children:s("common.cancel")}),a.jsx("button",{type:"button",className:_n("dialog-danger-button"),onClick:L,disabled:!M,children:s(m?"delete.deleting":"delete.action")})]})]})}const NR="release-session-list",$Y=e=>`${NR}-opt-${e}`;function kjt({onReleased:e,onError:t,onClose:n,workspaceCwd:r}){const{t:s}=rt(),i=qa(),{sessions:o,loading:l,error:c,releaseSession:u}=G_(r,{autoLoad:!0}),d=i.sessionId,[f,m]=h.useState(!1),[p,g]=h.useState(-1),[b,w]=h.useState(null),{filterValue:y,inputProps:v}=K6(()=>{g(-1),w(null)}),[x,k]=h.useState(null),S=h.useRef(null),T=h.useRef(null);h.useEffect(()=>{c&&k(c.message)},[c]);const _=y?o.filter(R=>{const $=y.toLowerCase();return(R.displayName||"").toLowerCase().includes($)||R.sessionId.toLowerCase().includes($)}):o,C=R=>{const $=_[R];if(!$)return;const B=$.sessionId===d,N=($.clientCount??0)>0||$.hasActivePrompt===!0;B||!N||(g(R),w($.sessionId))};h.useEffect(()=>{p>=_.length&&_.length>0&&g(_.length-1)},[_.length,p]),h.useEffect(()=>{var $;const R=($=S.current)==null?void 0:$.children[p];R==null||R.scrollIntoView({block:"nearest"})},[p]),h.useEffect(()=>{var R;(R=T.current)==null||R.focus()},[]);const{keyboardMode:j}=v0({itemCount:_.length,activeIndex:p,onActiveIndexChange:g,onConfirm:C}),E=h.useCallback(R=>{const $=R??_.find(N=>N.sessionId===b)??void 0;if(!$||f)return;if(!(($.clientCount??0)>0||$.hasActivePrompt===!0)){k(s("release.inactive"));return}if($.sessionId===d){k(s("release.cannotCurrent"));return}u&&(m(!0),u($.sessionId).then(()=>{e($.sessionId),n()}).catch(N=>{t(N),m(!1)}))},[d,f,_,n,t,e,u,b,s]),L=_.find(R=>R.sessionId===b)??void 0,D=L&&((L.clientCount??0)>0||L.hasActivePrompt===!0),M=!f&&!l&&!!L&&L.sessionId!==d&&!!D;return a.jsxs("div",{className:_n("picker","picker-in-shell"),children:[a.jsxs("div",{className:_n("picker-search"),children:[a.jsxs("span",{className:_n("picker-search-label"),children:[s("resume.search"),":"," "]}),a.jsx("input",{ref:T,className:_n("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":NR,"aria-activedescendant":p>=0&&p<_.length?$Y(p):void 0,...v,placeholder:""}),a.jsx("span",{className:_n("picker-search-hint"),children:x||(f?s("release.releasing"):l?s("common.loading"):y?s("release.matches",{count:_.length}):"")})]}),a.jsx("div",{className:_n("picker-sep")}),a.jsxs("div",{id:NR,role:"listbox",className:_n("picker-list",j?"picker-keyboard-only":void 0),ref:S,children:[l&&a.jsx("div",{className:_n("picker-empty"),children:s("common.loading")}),!l&&_.length===0&&a.jsx("div",{className:_n("picker-empty"),children:y?s("release.noMatch",{query:y}):s("release.none")}),!l&&_.map((R,$)=>{const B=R.sessionId===d,N=(R.clientCount??0)>0||R.hasActivePrompt===!0,z=B||!N;return a.jsx(sO,{session:R,optionId:$Y($),active:$===p,confirmed:R.sessionId===b,ariaSelected:R.sessionId===b,current:!1,disabled:z,trailing:B?a.jsx("span",{className:_n("picker-item-badge"),children:s("resume.current")}):N?void 0:a.jsx("span",{className:_n("picker-item-badge"),children:s("release.inactiveBadge")}),onClick:()=>C($),onActivate:()=>g($)},R.sessionId)})]}),a.jsx("div",{className:_n("picker-sep")}),a.jsxs("div",{className:_n("dialog-footer-actions"),children:[a.jsx("button",{type:"button",className:_n("dialog-inline-button"),onClick:n,disabled:f,children:s("common.cancel")}),a.jsx("button",{type:"button",className:_n("dialog-danger-button"),onClick:()=>E(),disabled:!M,children:s(f?"release.releasing":"release.action")})]})]})}const _jt="_root_ieg2d_1",Sjt="_list_ieg2d_8",Cjt="_item_ieg2d_21",Tjt="_itemCursor_ieg2d_42",Ejt="_itemSelected_ieg2d_49",Ajt="_prompt_ieg2d_61",jjt="_keyboardOnly_ieg2d_68",Njt="_itemDisabled_ieg2d_77",Ijt="_turn_ieg2d_91",Mjt="_time_ieg2d_96",Rjt="_footer_ieg2d_102",Djt="_footerMessage_ieg2d_112",Ljt="_dangerButton_ieg2d_118",Mc={root:_jt,list:Sjt,item:Cjt,itemCursor:Tjt,itemSelected:Ejt,prompt:Ajt,keyboardOnly:jjt,itemDisabled:Njt,turn:Ijt,time:Mjt,footer:Rjt,footerMessage:Djt,dangerButton:Ljt},Pjt="rewind-snapshot-list",BY=e=>`${Pjt}-opt-${e}`;function Ojt(e,t){let n=0;for(const r of e)if(r.kind==="user"){if(n===t)return r.text.trim();n+=1}return""}function $jt(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function Bjt({blocks:e,loadSnapshots:t,rewind:n,onError:r,onClose:s}){const{t:i}=rt(),[o,l]=h.useState([]),[c,u]=h.useState(!0),[d,f]=h.useState(null),[m,p]=h.useState(0),[g,b]=h.useState(null),[w,y]=h.useState(null);h.useEffect(()=>{let C=!0;return u(!0),t().then(j=>{C&&l(j.snapshots)}).catch(j=>{C&&r(j)}).finally(()=>{C&&u(!1)}),()=>{C=!1}},[t,r]);const v=h.useMemo(()=>o.map(C=>({snapshot:C,promptText:Ojt(e,C.turnIndex)})).sort((C,j)=>C.snapshot.turnIndex-j.snapshot.turnIndex),[e,o]);h.useEffect(()=>{m>=v.length&&v.length>0&&p(v.length-1)},[v.length,m]);const x=h.useRef(null),k=d!==null,S=C=>{!C||d||(f(C),y(null),n(C).then(()=>{s()}).catch(j=>{r(j),y(i("rewind.failed",{reason:j instanceof Error?j.message:String(j)})),f(null)}))},T=C=>{const j=v[C];j&&(p(C),b(j.snapshot.promptId))},{keyboardMode:_}=v0({itemCount:v.length,activeIndex:m,onActiveIndexChange:p,onConfirm:T,enabled:!k});return h.useEffect(()=>{var j;const C=(j=x.current)==null?void 0:j.children[m];C==null||C.scrollIntoView({block:"nearest"})},[m]),h.useEffect(()=>{var j;if(c||v.length===0)return;const C=document.activeElement;(C==null?void 0:C.getAttribute("role"))==="dialog"&&((j=x.current)==null||j.focus())},[c,v.length]),c?a.jsx("div",{className:_n("picker-empty"),children:i("rewind.loading")}):v.length===0?a.jsx("div",{className:_n("picker-empty"),children:i("rewind.empty")}):a.jsxs("div",{className:Mc.root,children:[a.jsx("div",{className:`${Mc.list} ${_?Mc.keyboardOnly:""}`,ref:x,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":v.length>0?BY(m):void 0,children:v.map(({snapshot:C,promptText:j},E)=>{const L=E===m,D=g===C.promptId,M=j||i("rewind.promptFallback",{id:C.promptId.slice(-8)});return a.jsxs("div",{id:BY(E),role:"option","aria-selected":D,"aria-disabled":k||void 0,className:`${Mc.item} ${L?Mc.itemCursor:""} ${D?Mc.itemSelected:""} ${k?Mc.itemDisabled:""}`,onClick:()=>{k||T(E)},onMouseMove:()=>p(E),children:[a.jsxs("div",{className:Mc.prompt,title:M,children:[a.jsxs("span",{className:Mc.turn,children:["#",C.turnIndex+1]})," ",M]}),a.jsx("div",{className:Mc.time,children:$jt(C.timestamp)})]},C.promptId)})}),a.jsxs("div",{className:Mc.footer,children:[w&&a.jsx("span",{className:Mc.footerMessage,role:"alert",children:w}),a.jsx("button",{type:"button",className:_n("dialog-inline-button"),onClick:s,disabled:d!==null,children:i("common.cancel")}),a.jsx("button",{type:"button",className:`${_n("dialog-danger-button")} ${Mc.dangerButton}`,onClick:()=>S(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const k7="add-workspace-hint",zY="add-workspace-display-name-hint",FY="add-workspace-error",jC="add-workspace-suggestions",zjt=150;function qY(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}function Fjt({onClose:e,onAdd:t,displayNameEnabled:n=!1,onSuggest:r,onPick:s,persistenceSupported:i=!0}){const{t:o}=rt(),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,m]=h.useState(null),[p,g]=h.useState(!1),[b,w]=h.useState(!0),[y,v]=h.useState([]),[x,k]=h.useState(!1),[S,T]=h.useState(-1),[_,C]=h.useState("/"),[j,E]=h.useState(!1),L=h.useRef(null),D=h.useRef(!1);D.current=x&&y.length>0;const M=h.useRef(0),R=h.useRef(!1);h.useEffect(()=>{var Y;(Y=L.current)==null||Y.focus()},[]);const $=h.useCallback(()=>{k(!1),T(-1)},[]);h.useEffect(()=>{if(!r)return;if(!qY(l)){v([]),$();return}const Y=++M.current,U=!R.current;R.current=!1;const P=setTimeout(()=>{r(l).then(F=>{Y===M.current&&(v(F.suggestions),C(F.sep||"/"),T(-1),(U||D.current)&&k(F.suggestions.length>0))},()=>{Y===M.current&&(v([]),$())})},zjt);return()=>clearTimeout(P)},[l,r,$]),h.useEffect(()=>{const Y=U=>{U.key!=="Escape"||!D.current||U.isComposing||U.keyCode===229||(U.preventDefault(),$())};return window.addEventListener("keydown",Y,{capture:!0}),()=>window.removeEventListener("keydown",Y,{capture:!0})},[$]);const B=h.useCallback(Y=>{var U;R.current=!1,c(Y.path+_),m(null),$(),(U=L.current)==null||U.focus()},[_,$]),N=h.useCallback(async()=>{if(s){E(!0),m(null);try{const Y=await s();Y&&(++M.current,c(Y),v([]),$())}catch{m(o("sidebar.addWorkspaceBrowseError"))}finally{E(!1)}}},[s,$,o]),z=h.useCallback(Y=>{const U=x&&y.length>0;if(Y.key==="ArrowDown"){if(Y.preventDefault(),!U){y.length>0&&k(!0);return}T(P=>(P+1)%y.length);return}if(Y.key==="ArrowUp"){if(!U)return;Y.preventDefault(),T(P=>(P<=0?y.length:P)-1);return}if(Y.key==="Tab"&&U&&!Y.shiftKey){const P=S>=0?y[S]:y.length===1?y[0]:void 0;P&&(Y.preventDefault(),B(P));return}Y.key==="Enter"&&U&&S>=0&&(Y.preventDefault(),B(y[S]))},[x,y,S,B]),G=h.useCallback(async Y=>{Y.preventDefault();const U=l.trim();if(U){if(!qY(U)){m(o("sidebar.addWorkspaceAbsError"));return}m(null),g(!0),$();try{const P=i?b:!1,F=n?u.trim():"";F?await t(U,P,F):await t(U,P),e()}catch(P){m(P instanceof Error?P.message:o("sidebar.addWorkspaceError"))}finally{g(!1)}}},[l,u,n,b,i,t,e,$,o]),I=x&&y.length>0;return a.jsx(zi,{title:o("sidebar.addWorkspaceTitle"),size:"md",onClose:e,children:a.jsxs("form",{className:"flex flex-col gap-6",onSubmit:G,children:[a.jsxs(uy,{children:[a.jsxs(fo,{"data-invalid":f?!0:void 0,children:[a.jsx(aa,{htmlFor:"add-workspace-path",children:o("sidebar.addWorkspacePath")}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Us,{ref:L,id:"add-workspace-path",type:"text",placeholder:"/absolute/path/to/project",value:l,onChange:Y=>{c(Y.target.value),f&&m(null)},onKeyDown:z,onBlur:()=>{setTimeout(()=>{R.current=!0,$()},100)},disabled:p||j,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,role:"combobox","aria-expanded":I,"aria-controls":I?jC:void 0,"aria-activedescendant":I&&S>=0?`${jC}-${S}`:void 0,"aria-describedby":f?`${FY} ${k7}`:k7,"aria-invalid":f?!0:void 0}),s&&a.jsxs(Zt,{type:"button",variant:"outline",onMouseDown:Y=>Y.preventDefault(),onClick:()=>void N(),disabled:p||j,children:[a.jsx(gee,{"aria-hidden":"true"}),o("sidebar.addWorkspaceBrowse")]})]}),I&&a.jsx("ul",{id:jC,role:"listbox","aria-label":o("sidebar.addWorkspaceSuggestions"),className:"absolute inset-x-0 top-full z-50 mt-1 max-h-56 overflow-y-auto rounded-md border bg-popover py-1 text-popover-foreground shadow-md",children:y.map((Y,U)=>a.jsxs("li",{id:`${jC}-${U}`,role:"option","aria-selected":U===S,className:`cursor-pointer truncate px-3 py-1.5 ${U===S?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:P=>{P.preventDefault(),B(Y)},onMouseEnter:()=>T(U),children:[Y.name,a.jsx("span",{className:"text-muted-foreground",children:_})]},Y.path))})]}),a.jsx(ld,{id:k7,children:o("sidebar.addWorkspaceHint")}),f&&a.jsx(M0t,{id:FY,children:f})]}),n&&a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"add-workspace-display-name",children:o("sidebar.addWorkspaceDisplayName")}),a.jsx(Us,{id:"add-workspace-display-name",type:"text",value:u,onChange:Y=>d(Y.target.value),disabled:p,maxLength:256,autoComplete:"off","aria-describedby":zY}),a.jsx(ld,{id:zY,children:o("sidebar.addWorkspaceDisplayNameHint")})]}),i&&a.jsxs(fo,{orientation:"horizontal",children:[a.jsxs(Ghe,{children:[a.jsx(aa,{htmlFor:"add-workspace-persist",children:o("sidebar.addWorkspacePersist")}),a.jsx(ld,{children:o("sidebar.addWorkspacePersistHint")})]}),a.jsx(e8,{id:"add-workspace-persist",checked:b,onCheckedChange:w,disabled:p})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Zt,{type:"button",variant:"outline",onClick:e,disabled:p,children:o("sidebar.addWorkspaceCancel")}),a.jsx(Zt,{type:"submit",disabled:p||!l.trim(),children:o(p?"sidebar.addWorkspaceAdding":"sidebar.addWorkspaceRegister")})]})]})})}const xme="qwen-code-web-shell-collapsed-session-groups",X_="ws:";function HY(e){return!e.startsWith(X_)}function qjt(e,t){return`${X_}${e}|group:${t}`}function kme(e){return`${X_}${e}|ungrouped`}function Hjt(e,t){return t.startsWith(`${X_}${e}|`)}function xO(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(xme);if(!e)return new Set;const t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(n=>typeof n=="string"&&n.trim().length>0)):new Set}catch{return new Set}}function Ujt(e){try{window.localStorage.setItem(xme,JSON.stringify(Array.from(e).sort()))}catch{}}function _me(e,t){const n=xO(),r=new Set(Array.from(n).filter(s=>!t(s)));for(const s of e)r.add(s);Ujt(r)}function Wjt(e){const t=xO(),n=new Set,r=`${X_}${e}|group:`,s=kme(e);for(const i of t)i===s?n.add("ungrouped"):i.startsWith(r)&&n.add(i.slice(r.length));return n}function Vjt(e,t){const n=new Set;for(const r of t)n.add(r==="ungrouped"?kme(e):qjt(e,r));_me(n,r=>Hjt(e,r))}const Gjt="_sidebar_cieuv_1",Kjt="_resizing_cieuv_20",Yjt="_collapsed_cieuv_24",Xjt="_newChatButton_cieuv_30",Qjt="_pluginButton_cieuv_31",Jjt="_footerButton_cieuv_32",Zjt="_collapseButton_cieuv_33",e7t="_projectRow_cieuv_34",t7t="_sessionRow_cieuv_35",n7t="_sessionGroupHeader_cieuv_36",r7t="_sessionGroupActionButton_cieuv_37",s7t="_retry_cieuv_38",i7t="_iconButton_cieuv_39",o7t="_projectIconButton_cieuv_40",a7t="_sessionActionButton_cieuv_41",l7t="_groupMenuItem_cieuv_42",c7t="_secondaryButton_cieuv_43",u7t="_dangerButton_cieuv_44",d7t="_primaryNav_cieuv_80",h7t="_navIcon_cieuv_129",f7t="_topRow_cieuv_155",m7t="_brandLogo_cieuv_170",p7t="_brandName_cieuv_186",g7t="_workspacePicker_cieuv_206",b7t="_workspacePickerLabel_cieuv_213",y7t="_workspacePickerHeader_cieuv_220",v7t="_workspaceAddIconButton_cieuv_227",w7t="_workspaceList_cieuv_247",x7t="_workspaceSessionBody_cieuv_253",k7t="_projectsHeader_cieuv_257",_7t="_pinnedSessionList_cieuv_267",S7t="_projectsHeaderToggle_cieuv_275",C7t="_projectsHeaderAction_cieuv_276",T7t="_projectsHeaderActions_cieuv_284",E7t="_projectSearch_cieuv_335",A7t="_addWorkspaceButton_cieuv_357",j7t="_body_cieuv_377",N7t="_sectionTitle_cieuv_387",I7t="_projectRowExpanded_cieuv_402",M7t="_workspaceHeaderActions_cieuv_428",R7t="_workspaceHeaderAction_cieuv_428",D7t="_projectName_cieuv_471",L7t="_sessionText_cieuv_472",P7t="_sessionBadgeIcon_cieuv_479",O7t="_projectHoverAction_cieuv_495",$7t="_sessionList_cieuv_504",B7t="_sessionGroupSection_cieuv_519",z7t="_sessionGroupHeaderRow_cieuv_525",F7t="_sessionGroupDot_cieuv_561",q7t="_sessionGroupDotMuted_cieuv_568",H7t="_sessionGroupTitle_cieuv_572",U7t="_sessionGroupCount_cieuv_579",W7t="_sessionGroupChevron_cieuv_584",V7t="_sessionGroupHeaderActions_cieuv_605",G7t="_sessionGroupList_cieuv_635",K7t="_currentSession_cieuv_653",Y7t="_busySession_cieuv_658",X7t="_floatingTooltip_cieuv_663",Q7t="_tooltipContent_cieuv_693",J7t="_tooltipTitle_cieuv_699",Z7t="_tooltipTags_cieuv_712",eNt="_tooltipTag_cieuv_712",tNt="_tooltipTagRunning_cieuv_732",nNt="_tooltipTagNew_cieuv_737",rNt="_sessionDetailsContent_cieuv_742",sNt="_sessionDetailsIdRow_cieuv_749",iNt="_sessionDetailsId_cieuv_749",oNt="_sessionDetailsCopyButton_cieuv_767",aNt="_sessionDetailsCopied_cieuv_792",lNt="_sessionStatusSlot_cieuv_806",cNt="_sessionStatusDot_cieuv_818",uNt="_sidebarPulse_cieuv_1",dNt="_sessionTitlePin_cieuv_828",hNt="_sessionMetaSlot_cieuv_860",fNt="_sessionAttention_cieuv_870",mNt="_sessionAttentionUserInput_cieuv_884",pNt="_sessionLoading_cieuv_889",gNt="_sessionTime_cieuv_899",bNt="_sidebarSpin_cieuv_1",yNt="_runningSession_cieuv_918",vNt="_sessionActions_cieuv_934",wNt="_activeSessionActionButton_cieuv_1000",xNt="_searchInput_cieuv_1019",kNt="_renameInput_cieuv_1033",_Nt="_dialogSelect_cieuv_1039",SNt="_dialogInput_cieuv_1049",CNt="_groupMenu_cieuv_42",TNt="_groupMenuItemActive_cieuv_1091",ENt="_groupMenuName_cieuv_1097",ANt="_groupMenuDot_cieuv_1105",jNt="_groupMenuEmptyDot_cieuv_1106",NNt="_groupMenuIcon_cieuv_1107",INt="_groupMenuCheck_cieuv_1135",MNt="_groupMenuSeparator_cieuv_1142",RNt="_groupColorRed_cieuv_1148",DNt="_groupColorOrange_cieuv_1152",LNt="_groupColorYellow_cieuv_1156",PNt="_groupColorGreen_cieuv_1160",ONt="_groupColorBlue_cieuv_1164",$Nt="_groupColorPurple_cieuv_1168",BNt="_groupColorCustom_cieuv_1172",zNt="_renameForm_cieuv_1182",FNt="_notice_cieuv_1198",qNt="_confirmContent_cieuv_1213",HNt="_confirmDescription_cieuv_1219",UNt="_workspaceRemovalActivityList_cieuv_1226",WNt="_confirmActions_cieuv_1234",VNt="_groupForm_cieuv_1240",GNt="_fieldStack_cieuv_1247",KNt="_groupCustomColorRow_cieuv_1275",YNt="_groupColorPicker_cieuv_1282",XNt="_groupHexField_cieuv_1292",QNt="_groupColorError_cieuv_1302",JNt="_footer_cieuv_32",ZNt="_footerPrimary_cieuv_1363",eIt="_footerActions_cieuv_1364",tIt="_footerButtonLabel_cieuv_1380",nIt="_footerCompact_cieuv_1387",rIt="_footerTight_cieuv_1388",sIt="_version_cieuv_1423",iIt="_resizeHandle_cieuv_1466",oIt="_sessionActionButtonActive_cieuv_1494",aIt="_menuActive_cieuv_1500",lIt="_actionMenu_cieuv_1504",cIt="_actionMenuItem_cieuv_1521",uIt="_actionMenuItemDanger_cieuv_1552",dIt="_actionMenuIcon_cieuv_1562",hIt="_actionMenuLabel_cieuv_1581",fIt="_archivedSection_cieuv_1589",mIt="_archivedHeader_cieuv_1596",pIt="_archivedChevron_cieuv_1622",gIt="_archivedTitle_cieuv_1641",bIt="_archivedCount_cieuv_1650",yIt="_archivedList_cieuv_1665",vIt="_archivedRow_cieuv_1672",wIt="_mobileOpen_cieuv_1681",Pe={sidebar:Gjt,resizing:Kjt,collapsed:Yjt,newChatButton:Xjt,pluginButton:Qjt,footerButton:Jjt,collapseButton:Zjt,projectRow:e7t,sessionRow:t7t,sessionGroupHeader:n7t,sessionGroupActionButton:r7t,retry:s7t,iconButton:i7t,projectIconButton:o7t,sessionActionButton:a7t,groupMenuItem:l7t,secondaryButton:c7t,dangerButton:u7t,primaryNav:d7t,navIcon:h7t,topRow:f7t,brandLogo:m7t,brandName:p7t,workspacePicker:g7t,workspacePickerLabel:b7t,workspacePickerHeader:y7t,workspaceAddIconButton:v7t,workspaceList:w7t,workspaceSessionBody:x7t,projectsHeader:k7t,pinnedSessionList:_7t,projectsHeaderToggle:S7t,projectsHeaderAction:C7t,projectsHeaderActions:T7t,projectSearch:E7t,addWorkspaceButton:A7t,body:j7t,sectionTitle:N7t,projectRowExpanded:I7t,workspaceHeaderActions:M7t,workspaceHeaderAction:R7t,projectName:D7t,sessionText:L7t,sessionBadgeIcon:P7t,projectHoverAction:O7t,sessionList:$7t,sessionGroupSection:B7t,sessionGroupHeaderRow:z7t,sessionGroupDot:F7t,sessionGroupDotMuted:q7t,sessionGroupTitle:H7t,sessionGroupCount:U7t,sessionGroupChevron:W7t,sessionGroupHeaderActions:V7t,sessionGroupList:G7t,currentSession:K7t,busySession:Y7t,floatingTooltip:X7t,tooltipContent:Q7t,tooltipTitle:J7t,tooltipTags:Z7t,tooltipTag:eNt,tooltipTagRunning:tNt,tooltipTagNew:nNt,sessionDetailsContent:rNt,sessionDetailsIdRow:sNt,sessionDetailsId:iNt,sessionDetailsCopyButton:oNt,sessionDetailsCopied:aNt,sessionStatusSlot:lNt,sessionStatusDot:cNt,sidebarPulse:uNt,sessionTitlePin:dNt,sessionMetaSlot:hNt,sessionAttention:fNt,sessionAttentionUserInput:mNt,sessionLoading:pNt,sessionTime:gNt,sidebarSpin:bNt,runningSession:yNt,sessionActions:vNt,activeSessionActionButton:wNt,searchInput:xNt,renameInput:kNt,dialogSelect:_Nt,dialogInput:SNt,groupMenu:CNt,groupMenuItemActive:TNt,groupMenuName:ENt,groupMenuDot:ANt,groupMenuEmptyDot:jNt,groupMenuIcon:NNt,groupMenuCheck:INt,groupMenuSeparator:MNt,groupColorRed:RNt,groupColorOrange:DNt,groupColorYellow:LNt,groupColorGreen:PNt,groupColorBlue:ONt,groupColorPurple:$Nt,groupColorCustom:BNt,renameForm:zNt,notice:FNt,confirmContent:qNt,confirmDescription:HNt,workspaceRemovalActivityList:UNt,confirmActions:WNt,groupForm:VNt,fieldStack:GNt,groupCustomColorRow:KNt,groupColorPicker:YNt,groupHexField:XNt,groupColorError:QNt,footer:JNt,footerPrimary:ZNt,footerActions:eIt,footerButtonLabel:tIt,footerCompact:nIt,footerTight:rIt,version:sIt,resizeHandle:iIt,sessionActionButtonActive:oIt,menuActive:aIt,actionMenu:lIt,actionMenuItem:cIt,actionMenuItemDanger:uIt,actionMenuIcon:dIt,actionMenuLabel:hIt,archivedSection:fIt,archivedHeader:mIt,archivedChevron:pIt,archivedTitle:gIt,archivedCount:bIt,archivedList:yIt,archivedRow:vIt,mobileOpen:wIt};function IR({label:e,count:t,expanded:n,color:r,children:s,onToggle:i,onRename:o,onDelete:l,renameLabel:c,deleteLabel:u,actionsDisabled:d}){const f=r!=null&&r.startsWith("#")?Pe.groupColorCustom:r?Pe[`groupColor${r[0].toUpperCase()}${r.slice(1)}`]:Pe.sessionGroupDotMuted,m=r!=null&&r.startsWith("#")?{"--session-group-custom-color":r}:void 0;return a.jsxs("section",{className:Pe.sessionGroupSection,"aria-label":e,children:[a.jsxs("div",{className:Pe.sessionGroupHeaderRow,children:[a.jsxs("button",{type:"button",className:Pe.sessionGroupHeader,"aria-expanded":n,onClick:i,children:[a.jsx("span",{className:`${Pe.sessionGroupDot} ${f}`,style:m,"aria-hidden":"true"}),a.jsx("span",{className:Pe.sessionGroupTitle,children:e}),a.jsxs("span",{className:Pe.sessionGroupCount,children:["· ",t]}),a.jsx("span",{className:Pe.sessionGroupChevron,"aria-hidden":"true",children:n?a.jsx(Oc,{}):a.jsx(Eu,{})})]}),(o||l)&&a.jsxs("div",{className:Pe.sessionGroupHeaderActions,children:[o&&a.jsx("button",{className:Pe.sessionGroupActionButton,type:"button",title:c,"aria-label":c,disabled:d,onClick:o,children:a.jsx(_y,{})}),l&&a.jsx("button",{className:Pe.sessionGroupActionButton,type:"button",title:u,"aria-label":u,disabled:d,onClick:l,children:a.jsx(kf,{})})]})]}),n&&a.jsx("div",{className:Pe.sessionGroupList,children:s})]})}const xIt="_section_kbnw6_1",kIt="_headerRow_kbnw6_6",_It="_header_kbnw6_6",SIt="_headerDisabled_kbnw6_34",CIt="_headerContent_kbnw6_42",TIt="_chevron_kbnw6_50",EIt="_folderIcon_kbnw6_55",AIt="_chevronOpen_kbnw6_59",jIt="_name_kbnw6_63",NIt="_badge_kbnw6_71",IIt="_gitPill_kbnw6_85",MIt="_sessions_kbnw6_107",RIt="_empty_kbnw6_114",DIt="_error_kbnw6_120",LIt="_sessionItemReadOnly_kbnw6_126",PIt="_sessionName_kbnw6_137",OIt="_sessionTime_kbnw6_144",Na={section:xIt,headerRow:kIt,header:_It,headerDisabled:SIt,headerContent:CIt,chevron:TIt,folderIcon:EIt,chevronOpen:AIt,name:jIt,badge:NIt,gitPill:IIt,sessions:MIt,empty:RIt,error:DIt,sessionItemReadOnly:LIt,sessionName:PIt,sessionTime:OIt};function UY(...e){return e.filter(Boolean).join(" ")}function $It(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:[\\/]/.test(e)}function BIt(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function zIt({open:e}){const t=e?gee:bk;return a.jsx(t,{className:Na.folderIcon,size:16,strokeWidth:1.2,"aria-hidden":"true"})}function FIt({workspace:e,renderHeader:t,client:n,reloadToken:r,untrustedLabel:s,readOnlyLabel:i,trustToOpenLabel:o,noSessionsLabel:l,loadErrorLabel:c,organizationEnabled:u,sourceMetadataEnabled:d=!1,ungroupedLabel:f,formatTime:m,searchQuery:p="",expanded:g,autoExpandKey:b,onExpandedChange:w,renderSessions:y=!0,renderSession:v,headerActions:x,onRenameGroup:k,onDeleteGroup:S,renameGroupLabel:T,deleteGroupLabel:_,groupActionsDisabled:C,excludePinned:j=!1,onOpenGitDiff:E,onOpenCommit:L}){const[D,M]=h.useState([]),[R,$]=h.useState([]),[B,N]=h.useState(!1),[z,G]=h.useState(!1),[I,Y]=h.useState(()=>Wjt(e.id)),[U,P]=h.useState(!1),[F,te]=h.useState(),[W,K]=h.useState(!1),{t:ce}=rt(),ie=g??z,Z=!e.primary&&!e.trusted,ee=e.primary&&!e.trusted;h.useEffect(()=>{g===void 0&&G(!1)},[g,e.id]),h.useEffect(()=>{Vjt(e.id,I)},[I,e.id]),h.useEffect(()=>{g===void 0&&b&&G(!0)},[b,g]);const oe=h.useCallback(async()=>{if(!ee)try{const ae=await n.workspaceByCwd(e.cwd).listWorkspaceSessions({pageSize:nh,archiveState:"active",...d?{sourceType:rh}:{},...u?{view:"organized",group:"all"}:{}});M(ae),N(!1)}catch(ae){console.warn("[WorkspaceSection] session poll failed:",ae),N(!0)}},[n,ee,u,d,e.cwd]);h.useEffect(()=>{if(!y||ee||!u){$([]);return}let ae=!1;return n.workspaceByCwd(e.cwd).listSessionGroups().then(me=>{ae||$(me.groups)}).catch(me=>{console.warn("[WorkspaceSection] group catalog load failed:",me)}),()=>{ae=!0}},[n,ee,u,r,y,e.cwd]),h.useEffect(()=>{if(!y||!ie&&!p.trim()||(oe(),Z))return;const ae=setInterval(()=>void oe(),1e4);return()=>clearInterval(ae)},[ie,oe,Z,r,y,p]);const we=$It(e.cwd)?e.cwd:void 0,pe=!!E,he=h.useRef(!1),X=h.useCallback(async()=>{if(!(!pe||!e.trusted||!we))try{const ae=await n.workspaceByCwd(we).workspaceGit({wait:!0});he.current=!1,te(ae)}catch(ae){he.current||(console.warn("[WorkspaceSection] git status poll failed:",ae),he.current=!0)}},[n,we,pe,e.trusted]);h.useEffect(()=>{if(!pe||!e.trusted||!we){te(void 0);return}X();const ae=()=>void X();window.addEventListener("focus",ae);const me=window.setInterval(()=>{document.visibilityState==="visible"&&X()},6e4);return()=>{window.removeEventListener("focus",ae),window.clearInterval(me)}},[we,pe,X,r,e.trusted]);const ye=h.useMemo(()=>{const ae=p.trim().toLowerCase();return D.filter(me=>j&&me.isPinned?!1:ae?(me.displayName||"").toLowerCase().includes(ae)||me.sessionId.toLowerCase().includes(ae):!0)},[j,p,D]),Ce=h.useMemo(()=>{if(!u||R.length===0)return null;const ae=new Set;return{sections:R.map(We=>{const Oe=ye.filter(Mt=>Mt.groupId===We.id);return Oe.forEach(Mt=>ae.add(Mt.sessionId)),{group:We,sessions:Oe}}),ungrouped:ye.filter(We=>!ae.has(We.sessionId))}},[R,u,ye]);return a.jsxs("div",{className:Na.section,children:[a.jsxs("div",{className:UY(Na.headerRow,ee&&Na.headerDisabled),onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),onFocus:()=>P(!0),onBlur:ae=>{ae.currentTarget.contains(ae.relatedTarget)||P(!1)},children:[a.jsx("button",{className:Na.header,type:"button",disabled:ee,"aria-expanded":ie,onClick:()=>{const ae=!ie;G(ae),w==null||w(ae)},children:t?t(ie):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:UY(Na.chevron,ie&&Na.chevronOpen),children:a.jsx(zIt,{open:ie})}),a.jsx("span",{className:Na.headerContent,children:a.jsx("span",{className:Na.name,children:X6(e)})}),!e.trusted&&a.jsx("span",{className:Na.badge,children:s}),Z&&a.jsx("span",{className:Na.badge,children:i})]})}),E&&e.trusted&&(F==null?void 0:F.branch)&&a.jsx(nO,{open:W,onOpenChange:K,workspaceCwd:e.cwd,onOpenDiff:()=>E(e.cwd),onOpenCommit:L?()=>L(e.cwd):void 0,children:a.jsx("button",{type:"button",className:Na.gitPill,"aria-label":`${ce("branchPicker.label")} — ${F.branch}`,children:a.jsx(Bhe,{branch:F.branch,status:F,compact:!0})})}),x==null?void 0:x(U)]}),y&&(ie||!!p.trim())&&!ee&&a.jsx("div",{className:Na.sessions,children:B?a.jsx("div",{className:Na.error,role:"status",children:c}):ye.length===0?a.jsx("div",{className:Na.empty,children:l}):Ce?a.jsxs(a.Fragment,{children:[Ce.sections.map(({group:ae,sessions:me})=>a.jsx(IR,{id:`group:${ae.id}`,label:ae.name,count:me.length,color:ae.color,expanded:!I.has(ae.id),onToggle:()=>{Y(We=>{const Oe=new Set(We);return Oe.has(ae.id)?Oe.delete(ae.id):Oe.add(ae.id),Oe})},onRename:k?()=>k(ae,e.cwd):void 0,onDelete:S?()=>S(ae,e.cwd):void 0,renameLabel:T,deleteLabel:_,actionsDisabled:C,children:me.map(We=>v(We))},ae.id)),Ce.ungrouped.length>0&&a.jsx(IR,{id:"ungrouped",label:f,count:Ce.ungrouped.length,expanded:!I.has("ungrouped"),onToggle:()=>{Y(ae=>{const me=new Set(ae);return me.has("ungrouped")?me.delete("ungrouped"):me.add("ungrouped"),me})},children:Ce.ungrouped.map(ae=>v(ae))})]}):ye.map(ae=>{if(!Z)return v(ae);const me=BIt(ae),We=ae.createdAt?m(ae.createdAt):"";return a.jsxs("div",{className:Na.sessionItemReadOnly,role:"note","aria-label":`${me}${We?`, ${We}`:""}. ${o}`,children:[a.jsx("span",{className:Na.sessionName,title:me,children:me}),We&&a.jsx("span",{className:Na.sessionTime,children:We})]},ae.sessionId)})})]})}const qIt=8;function WY({session:e,label:t,completedUnread:n,onError:r,getCollisionBoundary:s}){const{t:i}=rt(),[o,l]=h.useState(!1),[c,u]=h.useState(!1),d=h.useRef(0),f=h.useRef(e.sessionId);f.current=e.sessionId;const m=o?s():null;h.useEffect(()=>{u(!1)},[e.sessionId]),h.useEffect(()=>()=>{d.current+=1},[]);const p=h.useCallback(b=>{b||(d.current+=1),u(!1),l(b)},[]),g=h.useCallback(async()=>{var y;const b=e.sessionId,w=++d.current;try{if(typeof navigator>"u"||!((y=navigator.clipboard)!=null&&y.writeText))throw new Error("Clipboard API is unavailable");if(await navigator.clipboard.writeText(b),d.current!==w||f.current!==b)return;u(!0)}catch(v){if(d.current!==w||f.current!==b)return;u(!1),r(v,i("sidebar.copySessionIdFailed"))}},[r,e.sessionId,i]);return a.jsxs(zhe,{open:o,onOpenChange:p,children:[a.jsxs(Fhe,{children:[a.jsx(d5,{}),i("sidebar.details")]}),a.jsx(qhe,{avoidCollisions:!0,collisionBoundary:m??void 0,collisionPadding:qIt,updatePositionStrategy:"always",className:ln(Pe.sessionDetailsContent,"min-w-0 p-3"),children:a.jsxs("div",{className:Pe.tooltipContent,children:[a.jsx("div",{className:Pe.tooltipTitle,title:t,children:t}),a.jsxs("div",{className:Pe.tooltipTags,children:[e.hasActivePrompt&&a.jsx("span",{className:`${Pe.tooltipTag} ${Pe.tooltipTagRunning}`,children:i("sidebar.running")}),n&&a.jsx("span",{className:`${Pe.tooltipTag} ${Pe.tooltipTagNew}`,children:i("sidebar.completedUnread")}),a.jsx("span",{className:Pe.tooltipTag,children:i("sidebar.clients",{count:e.clientCount??0})})]}),a.jsxs("div",{className:Pe.sessionDetailsIdRow,children:[a.jsx("span",{className:Pe.sessionDetailsId,title:e.sessionId,children:e.sessionId}),a.jsx(bi,{className:ln(Pe.sessionDetailsCopyButton,"cursor-pointer"),"aria-label":i("sidebar.copySessionId"),title:i("sidebar.copySessionId"),onSelect:b=>{b.preventDefault(),g()},children:c?a.jsx(kh,{"aria-hidden":"true"}):a.jsx(J9,{"aria-hidden":"true"})})]}),a.jsx("span",{className:Pe.sessionDetailsCopied,role:"status","aria-live":"polite",children:c?i("sidebar.sessionIdCopied"):""})]})})]})}function HIt(e){return(e==null?void 0:e.closest("[data-web-shell-root]"))??e}const Sme="qwen-code-web-shell-sidebar-width",NC=260,UIt=220,VY=420,WIt=.5,VIt=344,GIt=250,Cme=200,KIt=56,GY=Cme-KIt,YIt=2e3,XIt=3e4,KY=96,QIt="recent",_7=240,ib=8,S7="__custom__",ob="#416ef5";function ab(e,t){return`${t??""}\0${e}`}const JIt=["settings","version","theme","sessionsOverview","splitView","daemonStatus","collapse"],ZIt=["newTask","plugins","channels","scheduledTasks","goals"],eMt=["details","rename","group","export","delete","pin","archive"],tMt=["pin","archive"],lb=["red","orange","yellow","green","blue","purple"];function sd(...e){return e.filter(Boolean).join(" ")}function YY(e){return e instanceof DOMException&&e.name==="AbortError"}function nMt(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function M4(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function rMt(e){const t=M4(e).replace(/\s+/g," ").trim();return t.length<=KY?t:`${t.slice(0,KY-3).trimEnd()}...`}function sMt(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function IC(e){return e[0]??"blue"}function MR(e){const t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase()}function XY(e,t){const n=e.trim();return t.includes(n)?n:MR(n)}function QY(e){if(e.startsWith("#"))return Pe.groupColorCustom;switch(e){case"red":return Pe.groupColorRed;case"orange":return Pe.groupColorOrange;case"yellow":return Pe.groupColorYellow;case"green":return Pe.groupColorGreen;case"blue":return Pe.groupColorBlue;case"purple":return Pe.groupColorPurple}}function iMt(e){return e.startsWith("#")?{backgroundColor:e}:void 0}function Tme(){return typeof window>"u"?VY:Math.max(VY,Math.floor(window.innerWidth*WIt))}function ek(e){return Math.min(Tme(),Math.max(UIt,e))}function oMt(e){return Math.min(Tme(),Math.max(Cme,e))}function aMt(){if(typeof window>"u")return NC;try{const e=window.localStorage.getItem(Sme),t=e?Number(e):NC;return Number.isFinite(t)?ek(t):NC}catch{return NC}}function JY(e){try{window.localStorage.setItem(Sme,String(ek(e)))}catch{}}function lMt(){return a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M12 5v14M5 12h14"})})}function cMt(){return a.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:a.jsx("path",{fill:"#6D44E8",d:"m140.93 85-16.35-28.33-1.93-3.34 8.66-15a3.323 3.323 0 0 0 0-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33 3.33 0 0 0-2.89-1.67H51.43c-.59 0-1.17.16-1.66.45-.5.29-.92.71-1.22 1.22L32.19 29.98l-1.92 3.33H12.96c-.59 0-1.17.16-1.66.45-.5.29-.93.71-1.22 1.22L.45 51.66a3.323 3.323 0 0 0 0 3.34l18.28 31.67-8.66 15a3.32 3.32 0 0 0 0 3.34l9.62 16.67c.3.51.72.93 1.22 1.22s1.07.45 1.67.45h36.56l8.66 15a3.35 3.35 0 0 0 2.89 1.67h19.25a3.34 3.34 0 0 0 2.89-1.67l18.28-31.67h17.32c.6 0 1.17-.16 1.67-.45s.92-.71 1.22-1.22l9.62-16.67a3.323 3.323 0 0 0 0-3.34ZM51.44 3.33 61.07 20l-9.63 16.66h76.98l-9.62 16.66H45.67l-11.54-20zM57.21 120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62 16.67L68.78 100l-11.55 20Zm61.59-33.34-9.62-16.67-38.49 66.67-9.63-16.67 9.63-16.66 26.94-46.67h23.1l17.32 30z"})})}function ZY({expanded:e}){return a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?a.jsx("path",{d:"m6 9 6 6 6-6"}):a.jsx("path",{d:"m9 6 6 6-6 6"})})}function uMt({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenPlugins:r,onOpenChannels:s,onOpenDaemonStatus:i,onOpenScheduledTasks:o,onOpenGoals:l,onOpenSessions:c,canOpenSessionsOverview:u,onOpenSplitView:d,canOpenSplitView:f,onNewSession:m,onLoadSession:p,onSelectCurrentSession:g,onError:b,theme:w,onThemeChange:y,mobileOpen:v,sessionListReloadToken:x,selectedWorkspaceCwd:k,onSelectWorkspace:S,onOpenGitDiff:T,onOpenCommit:_,onOpenAddWorkspace:C,workspaces:j,lockedWorkspaceCwd:E,lockedWorkspace:L,branding:D,primaryNav:M,hideProjectHeader:R,sessionActions:$,footer:B}){var Va,T0,E0,fm,T1,ka,Pv,Ov,$v,Z_,Bv,eS,zv,tS,nS,rS,E1,A0,Fv,j0,mm,qv,au,N0;const{t:N}=rt(),z=qa(),G=nm(),I=ga(),Y=yo(),U=h.useMemo(()=>new Set(B===!1?[]:(B==null?void 0:B.items)??JIt),[B]),P=h.useMemo(()=>new Set((M==null?void 0:M.items)??ZIt),[M==null?void 0:M.items]),F=h.useMemo(()=>new Set(($==null?void 0:$.items)??eMt),[$==null?void 0:$.items]),te=h.useMemo(()=>new Set(($==null?void 0:$.inlineItems)??tMt),[$==null?void 0:$.inlineItems]),W=D!==!1&&!(v&&((D==null?void 0:D.hideWhenCompact)??!0)),K=!!((T0=(Va=z.capabilities)==null?void 0:Va.features)!=null&&T0.includes(Z9)),ce=!!((fm=(E0=z.capabilities)==null?void 0:E0.features)!=null&&fm.includes("session_source_metadata")),ie=!!((ka=(T1=z.capabilities)==null?void 0:T1.features)!=null&&ka.includes("session_archive")),Z=!!((Ov=(Pv=z.capabilities)==null?void 0:Pv.features)!=null&&Ov.includes("workspace_qualified_rest_core")),ee=h.useMemo(()=>{var Q;return j??((Q=Y.capabilities)==null?void 0:Q.workspaces)??[]},[j,($v=Y.capabilities)==null?void 0:$v.workspaces]),oe=ee.length>0||((Z_=Y.capabilities)==null?void 0:Z_.workspaces)!==void 0||((Bv=z.capabilities)==null?void 0:Bv.workspaces)!==void 0,we=((eS=ee.find(Q=>Q.primary))==null?void 0:eS.cwd)??((zv=Y.capabilities)==null?void 0:zv.workspaceCwd)??z.workspaceCwd,pe=E?ee.find(Q=>Q.cwd===E):void 0,he=!E||(pe==null?void 0:pe.primary)===!0,{sessions:X,loading:ye,error:Ce,data:ae,reload:me,deleteSession:We,exportSession:Oe,archiveSession:Mt}=JC({autoLoad:!0,enabled:he,pageSize:nh,archiveState:"active",...ce?{sourceType:rh}:{},...K?{view:"organized",group:"all"}:{}}),$t=!K||!he||ae!==void 0,{sessions:St,reload:ue}=JC({autoLoad:K,enabled:K&&he,pageSize:nh,archiveState:"active",...ce?{sourceType:rh}:{},view:"organized",group:"pinned"}),[Ee,tt]=h.useState(!1),[ut,Ct]=h.useState(!0),[Ze,Et]=h.useState([]),{sessions:Nt,loading:gt,error:Je,reload:Ae,deleteSession:de,unarchiveSession:nt}=JC({autoLoad:!0,enabled:ie&&Ee&&he,pageSize:nh,archiveState:"archived",...ce?{sourceType:rh}:{},...K?{view:"organized",group:"all"}:{}}),[ve,Ke]=h.useState([]),[le,Le]=h.useState(!1),[dt,Fe]=h.useState(!1),[Ge,un]=h.useState(0),[Wn,Me]=h.useState([]),[yt,cn]=h.useState([]),[Re,et]=h.useState([]),[bt,rn]=h.useState(!1),[qn,ft]=h.useState(null),[He,Ye]=h.useState(""),[Yt,Cn]=h.useState(()=>new Set),Tn=h.useRef(new Set),[zr,Ns]=h.useState(()=>new Set),kr=h.useRef(new Set),[si,Fr]=h.useState(!1),At=h.useRef(!1),[Xn,_e]=h.useState(null),[Vt,Dt]=h.useState(null),[Kn,Vn]=h.useState(null),[ds,hs]=h.useState(""),[vs,Mr]=h.useState("blue"),[ji,os]=h.useState(ob),[zt,Ni]=h.useState(null),[Ur,vo]=h.useState(()=>new Set(Array.from(xO()).filter(HY))),wo=h.useRef(new Set),Ps=h.useRef(!0),[Gt,_r]=h.useState(!K),[Er,Do]=h.useState(K);Er!==K&&(Do(K),_r(!K));const[fs,di]=h.useState(aMt),[ws,xe]=h.useState(!1),[$e,it]=h.useState(!0),[Ft,On]=h.useState(!1),[Yn,Is]=h.useState(null),[Wr,cr]=h.useState(null),[Gs,Qr]=h.useState(!1),vr=h.useRef(!1),xr=h.useRef(!1),[xs,nn]=h.useState(!1),[ks,Jr]=h.useState(0),[fn,Ks]=h.useState(null),ur=h.useCallback(()=>{Jr(Q=>Q+1)},[]);h.useEffect(()=>(vr.current=!0,()=>{vr.current=!1,xr.current=!0}),[]);const[je,lt]=h.useState(""),[Xt,Nn]=h.useState(!1),[Lt,Be]=h.useState(()=>new Set),yn=h.useRef(null),mr=h.useRef(null),dr=h.useRef(!1),as=h.useRef(null),Ht=h.useRef(null),hr=h.useRef(!1),hi=h.useRef(null),Zr=z.sessionId,Os=!!((nS=(tS=z.capabilities)==null?void 0:tS.features)!=null&&nS.includes("workspace_runtime_removal")),Vi=((E1=(rS=z.capabilities)==null?void 0:rS.features)==null?void 0:E1.includes("session_export"))??!1,Ms=((Fv=(A0=z.capabilities)==null?void 0:A0.features)==null?void 0:Fv.includes("workspace_session_export"))??!1,Lo=((mm=(j0=z.capabilities)==null?void 0:j0.features)==null?void 0:mm.includes("workspace_archived_session_export"))??!1,Ys=Zr?ab(Zr,z.workspaceCwd||we):null,ya=nMt(z.workspaceCwd)||N("sidebar.projectFallback"),Ss=h.useMemo(()=>{const Q=ee.length>0?ee:[{id:"primary",cwd:z.workspaceCwd||ya,primary:!0,trusted:!0}];return E?Q.filter(De=>De.cwd===E):Q},[z.workspaceCwd,E,ya,ee]),Li=h.useMemo(()=>{const Q=new Map;for(const De of[...he?St:[],...Ze])Q.set(ab(De.sessionId,De.workspaceCwd||we),De);return[...Q.values()]},[he,we,St,Ze]),pr=h.useCallback(Q=>{const De=Q.workspaceCwd,Ve=De||we||"",Qe=ee.find(Tt=>Tt.cwd===Ve);return De&&!Qe?!oe&&Ve===we?{kind:"primary",cwd:Ve}:{kind:"unknown",cwd:Ve}:Qe&&!Qe.trusted?{kind:"untrusted",cwd:Ve,workspace:Qe}:Qe!=null&&Qe.primary||!De&&Ve===we?{kind:"primary",cwd:Ve}:Qe?E===Ve?{kind:"locked",cwd:Ve,workspace:Qe}:{kind:"restricted",cwd:Ve,workspace:Qe}:{kind:"unknown",cwd:Ve}},[E,we,oe,ee]),xo=h.useCallback(Q=>pr(Q).cwd,[pr]),Qo=h.useCallback(Q=>Q.kind==="primary"||Q.kind==="locked",[]),ko=h.useCallback(Q=>Q.kind==="primary"||Q.kind==="locked"&&Z,[Z]),_o=h.useCallback(Q=>Q.kind==="unknown"||Q.kind==="untrusted"?!1:Q.kind==="primary"||Z,[Z]),_c=h.useCallback(Q=>!Qo(pr(Q)),[Qo,pr]),Ha=h.useCallback(Q=>{const De=pr(Q);if(De.kind==="primary")return I;if(De.kind==="locked"||De.kind==="restricted")return Y.client.workspaceByCwd(De.cwd)},[pr,Y.client,I]),Cs=h.useCallback(Q=>ab(Q.sessionId,xo(Q)),[xo]),lo=h.useCallback(Q=>Ys===Cs(Q),[Ys,Cs]),Jo=h.useCallback(Q=>F.has("rename")&&lo(Q)&&Qo(pr(Q)),[lo,Qo,pr,F]),Sc=h.useCallback(Q=>F.has("delete")&&ko(pr(Q)),[ko,pr,F]),fl=h.useCallback(Q=>!lo(Q)&&Sc(Q),[Sc,lo]),ct=h.useCallback((Q,De)=>K&&F.has(De)&&_o(pr(Q)),[_o,K,pr,F]),tr=h.useCallback(Q=>pr({sessionId:"",workspaceCwd:Q}),[pr]),re=h.useCallback(Q=>K&&F.has("group")&&_o(tr(Q)),[_o,K,tr,F]),ge=h.useRef(null);ge.current={canOrganizeSession:ct,getSessionWorkspaceActions:Ha,resolveWorkspaceScope:tr};const ze=h.useCallback(Q=>{const De=pr(Q);return De.kind==="unknown"||De.kind==="untrusted"?!1:ie&&(De.kind==="primary"||Z)},[pr,ie,Z]),ot=h.useCallback(Q=>{const De=pr(Q);if(De.kind==="primary"&&Vi||De.kind==="locked"&&Ms)return De},[Vi,Ms,pr]),mn=h.useCallback(Q=>{const De=pr(Q);return Lo&&De.kind!=="unknown"&&De.kind!=="untrusted"?De.cwd:void 0},[Lo,pr]),Bt=h.useCallback(Q=>F.has("archive")&&!lo(Q)&&ze(Q),[ze,lo,F]),zn=h.useCallback(Q=>F.has("archive")&&ze(Q),[ze,F]);h.useEffect(()=>{if(!K){Et([]);return}const Q=Ss.filter(Ve=>!Ve.primary&&Ve.trusted);let De=!1;return Promise.allSettled(Q.map(async Ve=>(await Y.client.workspaceByCwd(Ve.cwd).listWorkspaceSessions({pageSize:nh,archiveState:"active",...ce?{sourceType:rh}:{},view:"organized",group:"pinned"})).map(Tt=>({...Tt,workspaceCwd:Ve.cwd})))).then(Ve=>{De||Et(Ve.flatMap(Qe=>Qe.status==="fulfilled"?Qe.value:[]))}),()=>{De=!0}},[Ss,K,ce,Y.client,ks]);const Zn=h.useMemo(()=>{const Q=new Map;for(const De of[...he?Nt:[],...ve])Q.set(Cs(De),De);return[...Q.values()]},[Nt,Cs,he,ve]),Mn=he&&gt||le,vn=he&&!!Je||dt;h.useEffect(()=>{if(!Ee)return;if(!ie||!Z){Ke([]),Le(!1),Fe(!1);return}const Q=Ss.filter(Ve=>!Ve.primary&&Ve.trusted);if(Q.length===0){Ke([]),Le(!1),Fe(!1);return}let De=!1;return Le(!0),Promise.allSettled(Q.map(async Ve=>(await Y.client.workspaceByCwd(Ve.cwd).listWorkspaceSessions({pageSize:nh,archiveState:"archived",...ce?{sourceType:rh}:{},...K?{view:"organized",group:"all"}:{}})).map(Tt=>({...Tt,workspaceCwd:Ve.cwd})))).then(Ve=>{if(De)return;const Qe=Ve.filter(Tt=>Tt.status==="rejected");Ke(Ve.flatMap(Tt=>Tt.status==="fulfilled"?Tt.value:[])),Fe(Qe.length>0);for(const Tt of Qe)console.warn("[WebShellSidebar] archived session load failed:",Tt.reason)}).finally(()=>{De||Le(!1)}),()=>{De=!0}},[Ee,Ss,K,Ge,ie,ce,Y.client,Z,ks]);const En=((qv=z.capabilities)==null?void 0:qv.qwenCodeVersion)||"",fi=En?/^\d/.test(En)?`v${En}`:En:"",Vr=!e&&fs<VIt,Po=!e&&fs<GIt,Gi={"--web-shell-sidebar-width":`${fs}px`},va=si;h.useEffect(()=>{var Ve;if(!Zr)return;const Q=Ss.find(Qe=>Qe.cwd===z.workspaceCwd)??(Ss.length===1&&((Ve=Ss[0])!=null&&Ve.primary)?Ss[0]:void 0);if(!Q)return;const De=`session:${Zr}:${Q.id}`;Ht.current!==De&&(Ht.current=De,it(!0),Q.primary?xe(!0):Ks({id:Q.id,key:De}))},[z.workspaceCwd,Zr,Ss]),h.useEffect(()=>{if(Zr||k!==void 0||!Y.capabilities)return;const Q=ee.find(Ve=>Ve.cwd===z.workspaceCwd),De=`new:${(Q==null?void 0:Q.id)??"primary"}`;if(Ht.current!==De){if(Ht.current=De,it(!0),Q&&!Q.primary){xe(!1),Ks({id:Q.id,key:De}),S==null||S(Q.cwd);return}xe(!0)}},[z.workspaceCwd,Zr,S,k,Y.capabilities,ee]);const qr=h.useCallback((Q,De,Ve)=>{const Qe=ab(Q,Ve||we),Tt=new Set(Tn.current);De?Tt.add(Qe):Tt.delete(Qe),Tn.current=Tt,Cn(Tt)},[we]),$s=h.useCallback(async()=>{if(!K){Me([]),et([]),_r(!0);return}try{const Q=await I.listSessionGroups();Me(Q.groups),cn(Q.groups),et(Q.colorOptions),_r(!0)}catch(Q){b(Q,N("sidebar.groupsLoadFailed"))}},[b,K,N,I]);h.useEffect(()=>{if(!K){Me([]),et([]),_r(!0);return}_r(!1),$s()},[K,$s]),h.useEffect(()=>{if(!Vt)return;const Q=Ve=>{var Qe;(Qe=mr.current)!=null&&Qe.contains(Ve.target)||Dt(null)},De=Ve=>{Ve.key==="Escape"&&Dt(null)};return document.addEventListener("mousedown",Q),document.addEventListener("keydown",De),()=>{document.removeEventListener("mousedown",Q),document.removeEventListener("keydown",De)}},[Vt]),h.useEffect(()=>{if(!Vt)return;const Q=window.requestAnimationFrame(()=>{var Qe;const De=Array.from(((Qe=mr.current)==null?void 0:Qe.querySelectorAll("button:not(:disabled)"))??[]),Ve=De.find(Tt=>Tt.getAttribute("aria-checked")==="true")??De[0];Ve==null||Ve.focus()});return()=>window.cancelAnimationFrame(Q)},[Vt]);const ei=h.useCallback(Q=>{var $n,Hn;const De=Array.from((($n=mr.current)==null?void 0:$n.querySelectorAll("button:not(:disabled)"))??[]);if(De.length===0)return;const Ve=De.indexOf(document.activeElement),Qe=Ve>=0?Ve:-1;let Tt;if(Q.key==="ArrowDown")Tt=(Qe+1)%De.length;else if(Q.key==="ArrowUp")Tt=(Qe-1+De.length)%De.length;else if(Q.key==="Home")Tt=0;else if(Q.key==="End")Tt=De.length-1;else if(Q.key==="Escape"){Q.preventDefault(),Dt(null);return}Tt!==void 0&&(Q.preventDefault(),(Hn=De[Tt])==null||Hn.focus())},[]);h.useEffect(()=>()=>{var Q;(Q=hi.current)==null||Q.call(hi,!1)},[]),h.useEffect(()=>{function Q(){di(De=>ek(De))}return window.addEventListener("resize",Q),()=>window.removeEventListener("resize",Q)},[]),h.useEffect(()=>{e&&(xe(!1),On(!1),lt(""))},[e]);const mi=h.useMemo(()=>X.some(Q=>Q.hasActivePrompt),[X]);h.useEffect(()=>{if(!ws&&!mi)return;const Q=mi&&!Ce?YIt:XIt,De=window.setInterval(()=>{document.hidden||hr.current||(hr.current=!0,me().finally(()=>{hr.current=!1}))},Q);return()=>window.clearInterval(De)},[Ce,mi,ws,me]);const Ua=h.useRef(x);h.useEffect(()=>{x!==void 0&&x!==Ua.current&&!document.hidden&&!hr.current&&(Ua.current=x,hr.current=!0,me().finally(()=>{hr.current=!1}))},[x,me]),h.useEffect(()=>{const Q=new Map(X.map(Ve=>[Cs(Ve),!!Ve.hasActivePrompt])),De=as.current;as.current=Q,De!==null&&Be(Ve=>{const Qe=new Set(Ve);let Tt=!1;for(const[$n,Hn]of De){const Dr=Q.get($n);Hn&&Dr===!1&&$n!==Ys&&!Qe.has($n)&&(Qe.add($n),Tt=!0)}for(const $n of Qe)($n===Ys||!Q.has($n)||Q.get($n))&&(Qe.delete($n),Tt=!0);return Tt?Qe:Ve})},[Ys,Cs,X]);const ii=h.useCallback(async Q=>{var De;if(vr.current){k===Q.cwd&&(S==null||S(void 0)),Jr(Ve=>Ve+1);try{await((De=Y.refreshCapabilities)==null?void 0:De.call(Y))}catch{}vr.current&&(Is(null),cr(null),nn(!1),me().catch(()=>{}),Ae().catch(()=>{}))}},[S,me,Ae,k,Y]),wa=h.useCallback(Q=>{Gs||(xr.current=!1,cr(null),nn(!1),Is(Q))},[Gs]),Zo=h.useCallback(async()=>{const Q=Yn;if(!Q||Gs)return;const De=Wr!==null;if(!(De&&z.sessionId&&z.workspaceCwd===Q.cwd)){Qr(!0);try{await I.removeWorkspace(Q.id,{force:De}),await ii(Q)}catch(Ve){if(!vr.current)return;if(Ve instanceof Zc){const Qe=Ve.body;if(Ve.status===409&&(Qe==null?void 0:Qe.code)==="workspace_busy"&&Qe.activity){cr(Qe.activity);return}if(Ve.status===400&&(Qe==null?void 0:Qe.code)==="workspace_mismatch"){await ii(Q);return}if(Ve.status===409&&((Qe==null?void 0:Qe.code)==="workspace_removal_in_progress"||(Qe==null?void 0:Qe.code)==="workspace_registration_in_progress")){nn(!0);let Tt=Ve,$n=!0;for(let Hn=0;Hn<20;Hn++){if(!vr.current||xr.current||(await new Promise(Dr=>window.setTimeout(Dr,250)),!vr.current||xr.current))return;try{await I.removeWorkspace(Q.id,{force:De}),await ii(Q);return}catch(Dr){if(!vr.current)return;if(Tt=Dr,Dr instanceof Zc){const wr=Dr.body;if(Dr.status===400&&(wr==null?void 0:wr.code)==="workspace_mismatch"){await ii(Q);return}if(Dr.status===409&&(wr==null?void 0:wr.code)==="workspace_busy"&&wr.activity){nn(!1),cr(wr.activity);return}if(Dr.status===409&&((wr==null?void 0:wr.code)==="workspace_removal_in_progress"||(wr==null?void 0:wr.code)==="workspace_registration_in_progress"))continue}$n=!1;break}}if(!vr.current||xr.current)return;nn(!1),b($n?new Error("Workspace removal remained in progress after retries."):Tt,N("sidebar.removeWorkspaceError"));return}}b(Ve,N("sidebar.removeWorkspaceError"))}finally{vr.current&&Qr(!1)}}},[z.sessionId,z.workspaceCwd,b,ii,N,I,Wr,Yn,Gs]),kt=h.useCallback(Q=>{At.current||(At.current=!0,Fr(!0),(async()=>{try{await m(Q)&&(me().catch(()=>{}),ur())}catch(De){YY(De)||b(De,N("sidebar.newSessionFailed"))}finally{At.current=!1,Fr(!1)}})())},[ur,b,m,me,N]),Qt=h.useCallback((Q,De)=>{const Ve=ab(Q,De||we);if(Ve===Ys){g==null||g();return}Tn.current.has(Ve)||(Be(Qe=>{if(!Qe.has(Ve))return Qe;const Tt=new Set(Qe);return Tt.delete(Ve),Tt}),qr(Q,!0,De),(async()=>{try{await p(Q,De)}catch(Qe){YY(Qe)||b(Qe,N("sidebar.switchFailed"))}finally{qr(Q,!1,De)}})())},[Ys,b,p,g,we,qr,N]),ir=h.useCallback(Q=>{Jo(Q)&&(ft(Cs(Q)),Ye(M4(Q)))},[Jo,Cs]),wn=h.useCallback(()=>{ft(null),Ye("")},[]);h.useEffect(()=>{const Q=Zr?{sessionId:Zr,workspaceCwd:z.workspaceCwd}:void 0;qn!==null&&(!Q||qn!==Ys||!Jo(Q))&&wn()},[Jo,wn,z.workspaceCwd,Zr,Ys,qn]);const er=h.useCallback(()=>{const Q=He.trim();if(!Q||!Zr||qn!==Ys||!Jo({sessionId:Zr,workspaceCwd:z.workspaceCwd})){wn();return}const De=Zr,Ve=Ys;!Ve||Tn.current.has(Ve)||(qr(De,!0,z.workspaceCwd),G.renameSession(Q).then(()=>{wn(),me(),ur()}).catch(Qe=>{b(Qe,N("sidebar.renameFailed")),wn()}).finally(()=>{qr(De,!1,z.workspaceCwd)}))},[G,ur,Jo,wn,z.workspaceCwd,Ys,Zr,He,qn,b,me,qr,N]),Rr=h.useCallback(Q=>{fl(Q)&&_e(Q)},[fl]),gr=h.useCallback((Q,De,Ve)=>{const Qe=ab(Q,Ve||we),Tt=new Set(kr.current);De?Tt.add(Qe):Tt.delete(Qe),kr.current=Tt,Ns(Tt)},[we]),Xs=h.useCallback(Q=>{const De=Q.sessionId,Ve=Cs(Q),Qe=Q.isArchived===!0,Tt=ot(Q);!F.has("export")||(Qe?!mn(Q):!Tt)||kr.current.has(Ve)||(gr(De,!0,Q.workspaceCwd),(async()=>{try{let $n;if(Qe){const wr=mn(Q);if(!wr)return;$n=await Y.client.workspaceByCwd(wr).exportArchivedSession(De,{format:"html"})}else if((Tt==null?void 0:Tt.kind)==="primary")$n=await Oe(De,"html");else if((Tt==null?void 0:Tt.kind)==="locked")$n=await Y.client.workspaceByCwd(Tt.cwd).exportSession(De,{format:"html"});else return;const Hn=new Blob([$n.content],{type:$n.mimeType||"text/html"}),Dr=URL.createObjectURL(Hn);try{const wr=document.createElement("a");wr.href=Dr,wr.download=$n.filename,document.body.appendChild(wr),wr.click(),wr.remove()}finally{URL.revokeObjectURL(Dr)}}catch($n){b($n,N("sidebar.exportFailed"))}finally{gr(De,!1,Q.workspaceCwd)}})())},[Oe,ot,mn,Cs,b,gr,F,N,Y.client]),Pi=h.useCallback(()=>{if(!Xn)return;const Q=Xn.sessionId,De=Cs(Xn);if(!fl(Xn)){_e(null);return}const Ve=pr(Xn),Qe=!!Xn.isArchived,Tt=Ve.kind==="locked"?async $n=>{const Dr=(await Y.client.workspaceByCwd(Ve.cwd).deleteSessionsData([$n])).errors.find(wr=>wr.sessionId===$n);if(Dr)throw new Error(Dr.error)}:Ve.kind==="primary"?Qe?de:We:void 0;_e(null),Tt&&(Tn.current.has(De)||(qr(Q,!0,Xn.workspaceCwd),Tt(Q).then(()=>{me(),Ae(),ur()}).catch($n=>b($n,N("sidebar.deleteFailed"))).finally(()=>{qr(Q,!1,Xn.workspaceCwd)})))},[ur,fl,de,Xn,We,Cs,b,me,Ae,pr,qr,N,Y.client]),Wa=h.useCallback(Q=>{lo(Q)&&ir(Q)},[lo,ir]),jd=h.useCallback(()=>{re()&&(Dt(null),hs(""),Mr(IC(Re)),os(ob),Vn({mode:"create"}))},[re,Re]),Cc=h.useCallback(Q=>{re(Q)&&(async()=>{try{const De=await Y.client.workspaceByCwd(Q).listSessionGroups();Dt(null),hs(""),Mr(IC(De.colorOptions)),os(ob),Vn({mode:"create",workspaceCwd:Q})}catch(De){b(De,N("sidebar.groupsLoadFailed"))}})()},[re,b,N,Y.client]),w1=h.useCallback(Q=>{ct(Q,"group")&&(Dt(null),hs(""),Mr(IC(Re)),os(ob),Vn({mode:"create",targetSession:Q,workspaceCwd:Q.workspaceCwd}))},[ct,Re]),ec=h.useCallback((Q,De)=>{re(De)&&(hs(Q.name),Mr(Q.color),os(MR(Q.color)??ob),Vn({mode:"edit",group:Q,workspaceCwd:De}))},[re]),Ph=h.useCallback(()=>{bt||(Vn(null),hs(""),Mr(IC(Re)),os(ob))},[Re,bt]),Oh=h.useCallback(()=>{if(!Kn)return;if(!re(Kn.workspaceCwd)||Kn.targetSession&&!ct(Kn.targetSession,"group")){Ph();return}const Q=ds.trim(),De=XY(vs,Re.length>0?Re:lb);!Q||!De||(async()=>{rn(!0);const Ve=Qe=>{Vn(null),hs(""),Kn.workspaceCwd?ur():$s().catch(()=>{}),b(Qe,N("sidebar.groupAssignFailedAfterCreate"))};try{const Qe=tr(Kn.workspaceCwd),Tt=Qe.kind==="primary"?I:Qe.kind==="locked"||Qe.kind==="restricted"?Y.client.workspaceByCwd(Qe.cwd):void 0;if(!Tt)return;const $n=Kn.mode==="create"?await Tt.createSessionGroup({name:Q,color:De}):await Tt.updateSessionGroup(Kn.group.id,{name:Q,color:De});if(Kn.mode==="create"&&Kn.targetSession)try{const Hn=ge.current,Dr=Hn==null?void 0:Hn.resolveWorkspaceScope(Kn.targetSession.workspaceCwd);if(!Hn||!Dr||!Hn.canOrganizeSession(Kn.targetSession,"group")||Dr.kind!==Qe.kind||Dr.cwd!==Qe.cwd){Ve(new Error(N("sidebar.groupAssignFailedAfterCreate")));return}const wr=Hn.getSessionWorkspaceActions(Kn.targetSession);if(!wr){Ve(new Error(N("sidebar.groupAssignFailedAfterCreate")));return}await wr.updateSessionOrganization(Kn.targetSession.sessionId,{groupId:$n.id,color:null}),Kn.workspaceCwd||me().catch(()=>{}),ur()}catch(Hn){Ve(Hn);return}Vn(null),hs(""),Kn.workspaceCwd?ur():$s().catch(()=>{})}catch(Qe){b(Qe,Kn.mode==="create"?N("sidebar.groupCreateFailed"):N("sidebar.groupUpdateFailed"))}finally{rn(!1)}})()},[ur,Re,vs,Kn,ds,ct,re,Ph,b,me,$s,tr,N,I,Y.client]),w0=h.useCallback((Q,De)=>{re(De)&&Ni({group:Q,workspaceCwd:De})},[re]),Iv=h.useCallback(()=>{if(!zt)return;if(!re(zt.workspaceCwd)){Ni(null);return}rn(!0);const Q=tr(zt.workspaceCwd),De=Q.kind==="primary"?I:Q.kind==="locked"||Q.kind==="restricted"?Y.client.workspaceByCwd(Q.cwd):void 0;if(!De){rn(!1);return}De.deleteSessionGroup(zt.group.id).then(()=>{Ni(null),zt.workspaceCwd?ur():me().catch(()=>{})}).catch(Ve=>b(Ve,N("sidebar.groupDeleteFailed"))).then(()=>zt.workspaceCwd?void 0:$s().catch(()=>{})).finally(()=>rn(!1))},[zt,re,b,me,$s,N,ur,tr,Y.client,I]);h.useEffect(()=>{Xn&&!fl(Xn)&&_e(null)},[fl,Xn]),h.useEffect(()=>{Vt&&!ct(Vt.session,"group")&&Dt(null)},[ct,Vt]),h.useEffect(()=>{Kn&&(!re(Kn.workspaceCwd)||Kn.targetSession&&!ct(Kn.targetSession,"group"))&&(Vn(null),hs(""))},[ct,re,Kn]),h.useEffect(()=>{zt&&!re(zt.workspaceCwd)&&Ni(null)},[re,zt]);const x1=h.useCallback(Q=>{const De=Q.sessionId,Ve=Cs(Q);if(!ct(Q,"pin")||Tn.current.has(Ve))return;qr(De,!0,Q.workspaceCwd);const Qe=Ha(Q);if(!Qe){qr(De,!1,Q.workspaceCwd);return}Qe.updateSessionOrganization(De,{isPinned:!Q.isPinned}).then(()=>{me().catch(()=>{}),ue().catch(()=>{}),ur()}).catch(Tt=>b(Tt,N("sidebar.organizationFailed"))).finally(()=>{qr(De,!1,Q.workspaceCwd)})},[ur,Cs,Ha,b,ct,me,ue,qr,N]),x0=h.useCallback(Q=>{const De=Q.sessionId,Ve=Cs(Q);Bt(Q)&&(Tn.current.has(Ve)||(qr(De,!0,Q.workspaceCwd),(async()=>{try{const Qe=pr(Q);if(Qe.kind==="locked"||Qe.kind==="restricted"){const $n=(await Y.client.workspaceByCwd(Qe.cwd).archiveSessionsData([De])).errors.find(Hn=>Hn.sessionId===De);$n&&b(new Error($n.error),N("sidebar.archiveFailed"))}else if(Qe.kind==="primary")await Mt(De);else return}catch(Qe){b(Qe,N("sidebar.archiveFailed"))}finally{me().catch(()=>{}),Ae().catch(()=>{}),ur(),qr(De,!1,Q.workspaceCwd)}})()))},[Mt,ur,Bt,Cs,b,me,Ae,qr,N,pr,Y.client]),$h=h.useCallback(Q=>{const De=Q.sessionId,Ve=Cs(Q);zn(Q)&&(Tn.current.has(Ve)||(qr(De,!0,Q.workspaceCwd),(async()=>{try{const Qe=pr(Q);if(Qe.kind==="locked"||Qe.kind==="restricted"){const $n=(await Y.client.workspaceByCwd(Qe.cwd).unarchiveSessionsData([De])).errors.find(Hn=>Hn.sessionId===De);$n&&b(new Error($n.error),N("sidebar.unarchiveFailed"))}else if(Qe.kind==="primary")await nt(De);else return}catch(Qe){b(Qe,N("sidebar.unarchiveFailed"))}finally{me().catch(()=>{}),Ae().catch(()=>{}),ur(),qr(De,!1,Q.workspaceCwd)}})()))},[ur,zn,Cs,b,me,Ae,qr,N,nt,pr,Y.client]),Mv=h.useCallback(async(Q,De)=>{if(!ct(De,"group"))return;let Ve=0;try{const Ga=Ha(De);if(!Ga)return;const ml=await Ga.listSessionGroups();if(!ct(De,"group"))return;cn(ml.groups),et(ml.colorOptions),Ve=ml.groups.length}catch(Ga){b(Ga,N("sidebar.groupsLoadFailed"));return}if(!Q.isConnected)return;const Qe=Q.getBoundingClientRect(),Tt=typeof window>"u"?Qe.right+_7:window.innerWidth,$n=typeof window>"u"?Qe.top+320:window.innerHeight,Hn=Math.min(320,34*(Ve+lb.length+2)+25),Dr=Qe.right+ib+_7<=Tt?Qe.right+ib:Math.max(ib,Qe.left-_7-ib),wr=Math.max(ib,Math.min(Qe.top,$n-Hn-ib));Dt({session:De,top:wr,left:Dr})},[ct,Ha,b,N]),Rv=h.useCallback((Q,De)=>{const Ve=Q.sessionId,Qe=Cs(Q);if(!ct(Q,"group")||Tn.current.has(Qe))return;Dt(null),qr(Ve,!0,Q.workspaceCwd);const Tt=Ha(Q);if(!Tt){qr(Ve,!1,Q.workspaceCwd);return}Tt.updateSessionOrganization(Ve,{groupId:De,color:null}).then(()=>{me().catch(()=>{}),ur()}).catch($n=>b($n,N("sidebar.organizationFailed"))).finally(()=>{qr(Ve,!1,Q.workspaceCwd)})},[ur,Cs,Ha,b,ct,me,qr,N]),Q_=h.useCallback((Q,De)=>{const Ve=Q.sessionId,Qe=Cs(Q);if(!ct(Q,"group")||Tn.current.has(Qe))return;Dt(null),qr(Ve,!0,Q.workspaceCwd);const Tt=Ha(Q);if(!Tt){qr(Ve,!1,Q.workspaceCwd);return}Tt.updateSessionOrganization(Ve,{color:De,groupId:null}).then(()=>{me().catch(()=>{}),ur()}).catch($n=>b($n,N("sidebar.organizationFailed"))).finally(()=>{qr(Ve,!1,Q.workspaceCwd)})},[ur,Cs,Ha,b,ct,me,qr,N]),Bh=h.useMemo(()=>{const Q=je.trim().toLowerCase(),De=X.filter(Tt=>!Tt.isPinned),Ve=Q?De.filter(Tt=>M4(Tt).toLowerCase().includes(Q)||Tt.sessionId.toLowerCase().includes(Q)):De.slice();if(K)return Ve;const Qe=new Map(Ve.map(Tt=>[Tt.sessionId,sMt(Tt)]));return Ve.sort((Tt,$n)=>(Qe.get($n.sessionId)??0)-(Qe.get(Tt.sessionId)??0))},[K,je,X]),zh=h.useMemo(()=>{if(!K)return[];const Q=je.trim().length>0,De=new Set(Wn.map(Hn=>Hn.id)),Ve=new Map,Qe=new Map;for(const Hn of Wn)Qe.set(Hn.id,[]);const Tt=[];for(const Hn of Bh){if(Hn.color&&lb.includes(Hn.color)){const wr=Ve.get(Hn.color)??[];wr.push(Hn),Ve.set(Hn.color,wr);continue}const Dr=Hn.groupId&&De.has(Hn.groupId)?Qe.get(Hn.groupId):void 0;Dr?Dr.push(Hn):Tt.push(Hn)}const $n=[];for(const Hn of lb){const Dr=Ve.get(Hn);!Dr||Dr.length===0||$n.push({id:`color:${Hn}`,kind:"color",label:N(`sidebar.groupColor.${Hn}`),countLabel:String(Dr.length),color:Hn,sessions:Dr})}for(const Hn of Wn){const Dr=Qe.get(Hn.id)??[];Q&&Dr.length===0||$n.push({id:`group:${Hn.id}`,kind:"group",label:Hn.name,countLabel:String(Dr.length),color:Hn.color,group:Hn,sessions:Dr})}return Tt.length>0&&$n.length>0&&$n.push({id:QIt,kind:"recent",label:N("sidebar.groupUngrouped"),countLabel:String(Tt.length),sessions:Tt}),$n},[Bh,Wn,K,je,N]);h.useEffect(()=>{if(!K||!Gt||!$t)return;const Q=zh.map(Ve=>Ve.id).filter(Ve=>!wo.current.has(Ve));if(Ps.current){Ps.current=!1;for(const Ve of Q)wo.current.add(Ve);return}if(Q.length!==0){for(const Ve of Q)wo.current.add(Ve);vo(Ve=>{const Qe=new Set(Ve);for(const Tt of Q)Qe.add(Tt);return Qe})}},[Gt,K,zh,$t]),h.useEffect(()=>{_me(Ur,HY)},[Ur]);const k1=h.useCallback(Q=>{vo(De=>{const Ve=new Set(De);return Ve.has(Q)?Ve.delete(Q):Ve.add(Q),Ve})},[]),xa=h.useCallback(()=>HIt(yn.current),[]),n8=h.useCallback(Q=>{var Fh;if(e)return;Q.preventDefault(),(Fh=hi.current)==null||Fh.call(hi,!0),Nn(!0);const De=Q.clientX,Ve=fs,Qe=document.body.style.cursor,Tt=document.body.style.userSelect;let $n=!1,Hn=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{Q.currentTarget.setPointerCapture(Q.pointerId)}catch{}function Dr(pl){return Ve+pl-De}function wr(){const pl=ek(Ve);di(pl),JY(pl)}function Ga(){$n||($n=!0,wr(),Hn(!0),t(!0))}function ml(pl){const cu=Dr(pl.clientX);if(cu<=GY){Ga();return}di(oMt(cu))}Hn=function(cu){document.body.style.cursor=Qe,document.body.style.userSelect=Tt,window.removeEventListener("pointermove",ml),window.removeEventListener("pointerup",Oi),window.removeEventListener("pointercancel",lu),hi.current=null,cu&&Nn(!1)};function Oi(pl){const cu=Dr(pl.clientX);if(cu<=GY){Ga();return}const Nd=ek(cu);di(Nd),JY(Nd),Hn(!0)}function lu(){Hn(!0)}hi.current=Hn,window.addEventListener("pointermove",ml),window.addEventListener("pointerup",Oi,{once:!0}),window.addEventListener("pointercancel",lu,{once:!0})},[e,t,fs]),k0=Xn?rMt(Xn):"",_1=Vt!=null&&Vt.session.color&&lb.includes(Vt.session.color)?Vt.session.color:null,S1=!_1&&(Vt!=null&&Vt.session.groupId)&&yt.some(Q=>Q.id===Vt.session.groupId)?Vt.session.groupId:null,_0=Re.length>0?Re:lb,C1=S1===null&&_1===null,hm=(zt==null?void 0:zt.group.name)??"",Dv=Re.length>0?Re:["blue"],Lv=XY(vs,Dv),S0=!Dv.includes(vs),J_=ds.trim().length>0&&Lv!==void 0&&!bt,C0=(Kn==null?void 0:Kn.mode)==="create"?N("sidebar.groupCreate"):N("sidebar.groupRename"),Yu=h.useCallback((Q,De={})=>{const{isArchived:Ve=!1}=De,Qe=De.readOnly??_c(Q),Tt=Cs(Q),$n=M4(Q),Hn=Q.updatedAt||Q.createdAt,Dr=Hn?Uy(Hn,N):"",wr=Yt.has(Tt),Ga=zr.has(Tt),ml=!lo(Q)&&Lt.has(Tt);if(Ve){const Qs=mn(Q),ea=F.has("details"),uu=F.has("export")&&!!Qs,iS=zn(Q),I0=fl(Q),gm=ea||uu||iS||I0;return a.jsxs("div",{className:sd(Pe.sessionRow,Pe.archivedRow,wr&&Pe.busySession),children:[a.jsx("span",{className:Pe.sessionText,title:$n,children:$n}),a.jsxs("div",{className:Pe.sessionMetaSlot,children:[a.jsx("span",{className:Pe.sessionTime,children:Dr}),gm&&a.jsx("div",{className:Pe.sessionActions,onClick:M0=>M0.stopPropagation(),onKeyDown:M0=>M0.stopPropagation(),children:a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{className:Pe.sessionActionButton,type:"button","aria-label":N("sidebar.moreActions"),title:N("sidebar.moreActions"),children:a.jsx(tp,{})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{dr.current=!0},onCloseAutoFocus:M0=>{dr.current&&(dr.current=!1,M0.preventDefault())},children:a.jsxs(Sp,{children:[ea&&a.jsx(WY,{session:Q,label:$n,completedUnread:ml,onError:b,getCollisionBoundary:xa}),uu&&a.jsxs(bi,{disabled:Ga,onSelect:()=>Xs(Q),children:[a.jsx(ZC,{}),N("sidebar.export")]}),iS&&a.jsxs(bi,{onSelect:()=>$h(Q),children:[a.jsx(Qwe,{}),N("sidebar.unarchive")]}),I0&&a.jsxs(bi,{variant:"destructive",onSelect:()=>Rr(Q),children:[a.jsx(kf,{}),N("sidebar.delete")]})]})})]})})]})]},Tt)}const Oi=lo(Q),lu=Oi&&qn===Tt,Fh=!Q.isWaitingForPermission&&Q.isWaitingForUserQuestion,pl=Q.isWaitingForPermission?N("sidebar.waitingForApproval"):Fh?N("sidebar.userInputNeeded"):null,cu=!_c(Q),Nd=ct(Q,"pin"),pm=F.has("archive")&&ze(Q),ti=F.has("rename")&&cu,sS=ot(Q),Hv=F.has("export")&&!!sS,Uv=Sc(Q);return a.jsx("div",{className:sd(Pe.sessionRow,Oi&&Pe.currentSession,Q.isPinned&&Pe.pinnedSession,Q.hasActivePrompt&&Pe.runningSession,wr&&Pe.busySession),role:"button",tabIndex:0,"aria-current":Oi?"page":void 0,onClick:()=>Qt(Q.sessionId,Q.workspaceCwd),onDoubleClick:()=>{!e&&Jo(Q)&&ir(Q)},onKeyDown:Qs=>{Qs.key==="Enter"&&Qt(Q.sessionId,Q.workspaceCwd)},children:!e&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Pe.sessionStatusSlot,children:ml?a.jsx("span",{className:Pe.sessionStatusDot,"aria-hidden":"true"}):null}),lu&&Jo(Q)?a.jsx("form",{className:Pe.renameForm,onClick:Qs=>Qs.stopPropagation(),onSubmit:Qs=>{Qs.preventDefault(),er()},children:a.jsx("input",{autoFocus:!0,className:Pe.renameInput,value:He,onChange:Qs=>Ye(Qs.target.value),onBlur:wn,onKeyDown:Qs=>{Qs.key==="Escape"&&(Qs.preventDefault(),wn())}})}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:Pe.sessionText,title:$n,children:[Q.worktree&&a.jsx(pT,{size:11,strokeWidth:1.5,className:Pe.sessionBadgeIcon,"aria-label":N("sidebar.newWorktreeTask")}),Q.branch&&a.jsx(ky,{size:11,strokeWidth:1.5,className:Pe.sessionBadgeIcon,"aria-label":Q.branch.name}),$n]}),a.jsxs("div",{className:Pe.sessionMetaSlot,children:[pl&&a.jsx("span",{className:sd(Pe.sessionAttention,Fh&&Pe.sessionAttentionUserInput),"aria-label":pl,children:pl}),Q.hasActivePrompt?a.jsx("span",{className:Pe.sessionLoading,"aria-label":N("sidebar.running")}):pl?null:a.jsx("span",{className:Pe.sessionTime,children:Dr}),Qe&&pm&&a.jsx("div",{className:Pe.sessionActions,onClick:Qs=>Qs.stopPropagation(),onKeyDown:Qs=>Qs.stopPropagation(),children:te.has("archive")?a.jsx("button",{className:Pe.sessionActionButton,type:"button",disabled:wr||Oi,"aria-label":N("sidebar.archive"),title:N(Oi?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>x0(Q),children:a.jsx(c2,{})}):a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{className:Pe.sessionActionButton,type:"button","aria-label":N("sidebar.moreActions"),title:N("sidebar.moreActions"),children:a.jsx(tp,{})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{dr.current=!0},onCloseAutoFocus:Qs=>{dr.current&&(dr.current=!1,Qs.preventDefault())},children:a.jsx(Sp,{children:a.jsxs(bi,{disabled:wr||Oi,title:Oi?N("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>x0(Q),children:[a.jsx(c2,{}),N("sidebar.archive")]})})})]})}),(!Qe||Nd)&&a.jsxs("div",{className:Pe.sessionActions,onClick:Qs=>Qs.stopPropagation(),onKeyDown:Qs=>Qs.stopPropagation(),children:[[{key:"pin",icon:a.jsx(VF,{size:16,strokeWidth:1.2}),label:Q.isPinned?N("sidebar.unpin"):N("sidebar.pin"),disabled:wr,active:Q.isPinned,visible:Nd&&te.has("pin"),onClick:()=>x1(Q)},{key:"archive",icon:a.jsx(c2,{size:16,strokeWidth:1.2}),label:N("sidebar.archive"),disabled:wr||Oi,title:N(Oi?"sidebar.archiveCurrentDisabled":"sidebar.archive"),visible:pm&&te.has("archive"),onClick:()=>x0(Q)},{key:"rename",icon:a.jsx(_y,{size:16,strokeWidth:1.2}),label:N("sidebar.rename"),disabled:!Oi,title:Oi?void 0:N("sidebar.renameCurrentOnly"),visible:ti&&te.has("rename"),onClick:()=>Wa(Q)},{key:"export",icon:a.jsx(ZC,{size:16,strokeWidth:1.2}),label:N("sidebar.export"),disabled:Ga,visible:Hv&&te.has("export"),onClick:()=>Xs(Q)},{key:"delete",icon:a.jsx(kf,{size:16,strokeWidth:1.2}),label:N("sidebar.delete"),disabled:Oi,destructive:!0,title:Oi?N("sidebar.currentDeleteDisabled"):void 0,visible:Uv&&te.has("delete"),onClick:()=>Rr(Q)}].filter(ea=>ea.visible).map(ea=>a.jsx("button",{className:sd(Pe.sessionActionButton,ea.active&&Pe.activeSessionActionButton),type:"button",disabled:ea.disabled,"aria-label":ea.label,title:ea.title??ea.label,onClick:ea.onClick,style:ea.destructive&&!ea.disabled?{color:"var(--destructive, #dc2626)"}:void 0,children:ea.icon??a.jsx("span",{style:{fontSize:12},children:ea.label})},ea.key)),Nd&&!te.has("pin")||pm&&!te.has("archive")||F.has("details")||ti&&!te.has("rename")||ct(Q,"group")||Hv&&!te.has("export")||Uv&&!te.has("delete")?a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{className:Pe.sessionActionButton,type:"button","aria-label":N("sidebar.moreActions"),title:N("sidebar.moreActions"),children:a.jsx(tp,{})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{dr.current=!0},onCloseAutoFocus:Qs=>{dr.current&&(dr.current=!1,Qs.preventDefault())},children:a.jsxs(Sp,{children:[Nd&&!te.has("pin")&&a.jsxs(bi,{disabled:wr,onSelect:()=>x1(Q),children:[a.jsx(VF,{}),Q.isPinned?N("sidebar.unpin"):N("sidebar.pin")]}),pm&&!te.has("archive")&&a.jsxs(bi,{disabled:wr||Oi,title:Oi?N("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>x0(Q),children:[a.jsx(c2,{}),N("sidebar.archive")]}),F.has("details")&&a.jsx(WY,{session:Q,label:$n,completedUnread:ml,onError:b,getCollisionBoundary:xa}),ti&&!te.has("rename")&&a.jsxs(bi,{disabled:!Oi,title:Oi?void 0:N("sidebar.renameCurrentOnly"),onSelect:()=>Wa(Q),children:[a.jsx(_y,{}),N("sidebar.rename")]}),ct(Q,"group")&&a.jsxs(bi,{disabled:wr,onSelect:Qs=>Mv(Qs.currentTarget,Q),children:[a.jsx(uke,{}),N("sidebar.sessionGroup")]}),Hv&&!te.has("export")&&a.jsxs(bi,{disabled:Ga,onSelect:()=>Xs(Q),children:[a.jsx(ZC,{}),N("sidebar.export")]}),Uv&&!te.has("delete")&&a.jsxs(bi,{variant:"destructive",disabled:Oi,title:Oi?N("sidebar.currentDeleteDisabled"):void 0,onSelect:()=>Rr(Q),children:[a.jsx(kf,{}),N("sidebar.delete")]})]})})]}):null]})]})]})]})},Tt)},[Yt,fl,Sc,ct,Jo,zn,ze,wn,e,Lt,He,qn,zr,mn,ot,Cs,xa,b,x0,Rr,Xs,Qt,Wa,x1,$h,lo,Mv,er,F,te,_c,ir,N]),r8=h.useMemo(()=>ye&&X.length===0?a.jsx("div",{className:Pe.notice,children:N("sidebar.loadingSessions")}):Ce&&X.length===0?a.jsx("button",{className:Pe.retry,type:"button",onClick:me,children:N("sidebar.loadFailed")}):Bh.length===0&&(je.trim()||!K||zh.length===0)?a.jsx("div",{className:Pe.notice,children:N("sidebar.searchEmpty")}):K?zh.length===0?Bh.map(Q=>Yu(Q)):zh.map(Q=>{const De=!Ur.has(Q.id),Ve=Q.group;return a.jsx(IR,{id:Q.id,label:Q.label,count:Q.sessions.length,color:Q.color,expanded:De,onToggle:()=>k1(Q.id),onRename:Q.kind==="group"&&Ve&&re()?()=>ec(Ve):void 0,onDelete:Q.kind==="group"&&Ve&&re()?()=>w0(Ve):void 0,renameLabel:N("sidebar.groupRename"),deleteLabel:N("sidebar.groupDelete"),actionsDisabled:bt,children:Q.sessions.map(Qe=>Yu(Qe))},Q.id)}):Bh.map(Q=>Yu(Q)),[Ur,re,Ce,Bh,bt,w0,ec,ye,K,me,Yu,je,zh,X.length,N,k1]),s8=h.useMemo(()=>{if(!ie||e||je.trim())return null;const Q=a.jsxs("button",{type:"button",className:Pe.archivedHeader,"aria-expanded":Ee,onClick:()=>tt(Qe=>!Qe),children:[a.jsx("span",{className:Pe.archivedTitle,style:{flex:"0 1 auto"},children:N("sidebar.archivedTitle")}),a.jsx("span",{className:Pe.archivedChevron,"aria-hidden":"true",children:Ee?a.jsx(Oc,{}):a.jsx(Eu,{})}),Ee&&Zn.length>0&&a.jsx("span",{className:Pe.archivedCount,children:Zn.length})]});if(!Ee)return a.jsx("div",{className:Pe.archivedSection,children:Q});const De=a.jsx("button",{className:Pe.retry,type:"button",onClick:()=>{Ae(),un(Qe=>Qe+1)},children:N("sidebar.loadFailed")});let Ve;return Mn&&Zn.length===0?Ve=a.jsx("div",{className:Pe.notice,children:N("sidebar.loadingSessions")}):vn&&Zn.length===0?Ve=De:Zn.length===0?Ve=a.jsx("div",{className:Pe.notice,children:N("sidebar.archivedEmpty")}):Ve=a.jsxs(a.Fragment,{children:[Zn.map(Qe=>Yu(Qe,{isArchived:!0})),vn&&De]}),a.jsxs("div",{className:Pe.archivedSection,children:[Q,a.jsx("div",{className:Pe.archivedList,children:Ve})]})},[Ee,Zn,e,vn,Mn,Ae,Yu,je,ie,un,N]);return a.jsx(a.Fragment,{children:a.jsxs("aside",{ref:yn,className:sd(Pe.sidebar,e&&Pe.collapsed,Xt&&Pe.resizing,v&&Pe.mobileOpen),"aria-label":N("sidebar.label"),style:Gi,children:[Vt&&a.jsxs("div",{ref:mr,className:Pe.groupMenu,role:"menu","aria-label":N("sidebar.sessionGroup"),style:{top:Vt.top,left:Vt.left},onClick:Q=>Q.stopPropagation(),onKeyDown:ei,onMouseDown:Q=>Q.stopPropagation(),children:[a.jsxs("button",{className:sd(Pe.groupMenuItem,C1&&Pe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":C1,onClick:()=>Rv(Vt.session,null),children:[a.jsx("span",{className:Pe.groupMenuEmptyDot}),a.jsx("span",{className:Pe.groupMenuName,children:N("sidebar.groupUngrouped")}),C1&&a.jsx("span",{className:Pe.groupMenuCheck,children:"✓"})]}),_0.map(Q=>{const De=_1===Q;return a.jsxs("button",{className:sd(Pe.groupMenuItem,De&&Pe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":De,onClick:()=>Q_(Vt.session,Q),children:[a.jsx("span",{className:sd(Pe.groupMenuDot,QY(Q))}),a.jsx("span",{className:Pe.groupMenuName,children:N(`sidebar.groupColor.${Q}`)}),De&&a.jsx("span",{className:Pe.groupMenuCheck,children:"✓"})]},`color:${Q}`)}),yt.map(Q=>{const De=S1===Q.id;return a.jsxs("button",{className:sd(Pe.groupMenuItem,De&&Pe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":De,onClick:()=>Rv(Vt.session,Q.id),children:[a.jsx("span",{className:sd(Pe.groupMenuDot,QY(Q.color)),style:iMt(Q.color)}),a.jsx("span",{className:Pe.groupMenuName,children:Q.name}),De&&a.jsx("span",{className:Pe.groupMenuCheck,children:"✓"})]},Q.id)}),a.jsx("div",{className:Pe.groupMenuSeparator}),a.jsxs("button",{className:Pe.groupMenuItem,type:"button",role:"menuitem",onClick:()=>w1(Vt.session),children:[a.jsx("span",{className:Pe.groupMenuIcon,children:a.jsx(lMt,{})}),a.jsx("span",{className:Pe.groupMenuName,children:N("sidebar.groupCreate")})]})]}),Xn&&a.jsx(zi,{title:N("delete.title"),size:"sm",onClose:()=>_e(null),children:a.jsxs("div",{className:Pe.confirmContent,children:[a.jsx("p",{className:Pe.confirmDescription,children:N("sidebar.deleteConfirmDescription",{name:k0})}),a.jsxs("div",{className:Pe.confirmActions,children:[a.jsx("button",{className:Pe.secondaryButton,type:"button",onClick:()=>_e(null),children:N("common.cancel")}),a.jsx("button",{className:Pe.dangerButton,type:"button",onClick:Pi,children:N("sidebar.delete")})]})]})}),Yn&&a.jsx(zi,{title:N("sidebar.removeWorkspaceTitle"),size:"sm",onClose:()=>{(!Gs||xs)&&(xr.current=!0,Is(null),cr(null),nn(!1))},children:a.jsxs("div",{className:Pe.confirmContent,children:[a.jsx("p",{className:Pe.confirmDescription,children:Wr?N("sidebar.removeWorkspaceBusy",{name:Yn.cwd}):N("sidebar.removeWorkspaceConfirm",{name:Yn.cwd})}),Wr&&a.jsxs("ul",{className:Pe.workspaceRemovalActivityList,children:[a.jsx("li",{children:N("sidebar.removeWorkspaceSessions",{count:Wr.sessions})}),a.jsx("li",{children:N("sidebar.removeWorkspacePrompts",{count:Wr.activePrompts})}),a.jsx("li",{children:N("sidebar.removeWorkspaceStarts",{count:Wr.pendingSessionStarts})}),a.jsx("li",{children:N("sidebar.removeWorkspaceConnections",{count:Wr.acpConnections})}),a.jsx("li",{children:N("sidebar.removeWorkspaceMemoryTasks",{count:Wr.memoryTasks})}),a.jsx("li",{children:N("sidebar.removeWorkspaceWorkers",{count:Wr.channelWorkers})}),a.jsx("li",{children:N("sidebar.removeWorkspaceVoiceSessions",{count:Wr.voiceSessions??0})})]}),Wr&&z.sessionId&&z.workspaceCwd===Yn.cwd&&a.jsx("p",{className:Pe.confirmDescription,children:N("sidebar.removeWorkspaceCurrentSession")}),xs&&a.jsx("p",{className:Pe.confirmDescription,children:N("sidebar.removeWorkspaceInProgress")}),a.jsxs("div",{className:Pe.confirmActions,children:[a.jsx("button",{className:Pe.secondaryButton,type:"button",disabled:Gs&&!xs,onClick:()=>{xr.current=!0,Is(null),cr(null),nn(!1)},children:N("common.cancel")}),a.jsx("button",{className:Pe.dangerButton,type:"button",disabled:Gs||xs||Wr!==null&&!!z.sessionId&&z.workspaceCwd===Yn.cwd,onClick:()=>void Zo(),children:N(Wr?"sidebar.forceRemoveWorkspace":"sidebar.removeWorkspace")})]})]})}),Kn&&a.jsx(zi,{title:C0,size:"sm",onClose:Ph,children:a.jsxs("form",{className:"flex flex-col gap-6",onSubmit:Q=>{Q.preventDefault(),Oh()},children:[a.jsxs(uy,{children:[a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"session-group-name",children:N("sidebar.groupNamePrompt")}),a.jsx(Us,{id:"session-group-name",value:ds,autoFocus:!0,maxLength:64,onChange:Q=>hs(Q.target.value)})]}),a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"session-group-color",children:N("sidebar.groupColor")}),a.jsxs(Sl,{value:S0?S7:vs,onValueChange:Q=>{Mr(Q===S7?ji:Q)},children:[a.jsx(Tl,{id:"session-group-color",className:"w-full",children:a.jsx(Cl,{})}),a.jsx(El,{children:a.jsxs(Kae,{children:[Dv.map(Q=>a.jsx(Ti,{value:Q,children:N(`sidebar.groupColor.${Q}`)},Q)),a.jsx(Ti,{value:S7,children:N("sidebar.groupColor.custom")})]})})]})]}),S0&&a.jsxs(fo,{children:[a.jsx(aa,{htmlFor:"session-group-hex-color",children:N("sidebar.groupColor.hex")}),a.jsxs("div",{className:Pe.groupCustomColorRow,children:[a.jsx(Us,{className:Pe.groupColorPicker,type:"color",value:ji,"aria-label":N("sidebar.groupColor.picker"),onChange:Q=>{const De=Q.target.value.toLowerCase();os(De),Mr(De)}}),a.jsx(Us,{id:"session-group-hex-color",value:vs,maxLength:7,spellCheck:!1,"aria-invalid":Lv===void 0,onChange:Q=>{const De=Q.target.value,Ve=De.trim(),Qe=Ve&&!Ve.startsWith("#")?`#${Ve}`:De;Mr(Qe);const Tt=MR(Qe);Tt&&os(Tt)}})]}),Lv===void 0&&a.jsx("span",{className:Pe.groupColorError,role:"alert",children:N("sidebar.groupColor.invalid")})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Zt,{type:"button",variant:"outline",disabled:bt,onClick:Ph,children:N("common.cancel")}),a.jsx(Zt,{type:"submit",disabled:!J_,children:N("common.save")})]})]})}),zt&&a.jsx(zi,{title:N("sidebar.groupDelete"),size:"sm",onClose:()=>{bt||Ni(null)},children:a.jsxs("div",{className:Pe.confirmContent,children:[a.jsx("p",{className:Pe.confirmDescription,children:N("sidebar.groupDeleteConfirm",{name:hm})}),a.jsxs("div",{className:Pe.confirmActions,children:[a.jsx("button",{className:Pe.secondaryButton,type:"button",disabled:bt,onClick:()=>Ni(null),children:N("common.cancel")}),a.jsx("button",{className:Pe.dangerButton,type:"button",disabled:bt,onClick:Iv,children:N("sidebar.groupDelete")})]})]})}),W&&a.jsx("div",{className:Pe.topRow,children:D!=null&&D.render?D.render():a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Pe.brandLogo,"aria-hidden":"true",children:a.jsx(cMt,{})}),!e&&a.jsx("span",{className:Pe.brandName,children:"Qwen Code"})]})}),a.jsxs("div",{className:Pe.primaryNav,children:[P.has("newTask")&&a.jsxs("button",{className:Pe.newChatButton,type:"button",title:N("sidebar.newTask"),"aria-label":N("sidebar.newTask"),disabled:va,onClick:()=>kt(),children:[a.jsx("span",{className:Pe.navIcon,children:a.jsx(KF,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:N("sidebar.newTask")})]}),P.has("plugins")&&a.jsxs("button",{className:Pe.pluginButton,type:"button",title:N("sidebar.plugins"),"aria-label":N("sidebar.plugins"),onClick:r,children:[a.jsx("span",{className:Pe.navIcon,children:a.jsx(dxe,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:N("sidebar.plugins")})]}),P.has("channels")&&a.jsxs("button",{className:Pe.pluginButton,type:"button",title:N("sidebar.channels"),"aria-label":N("sidebar.channels"),onClick:s,children:[a.jsx("span",{className:Pe.navIcon,children:a.jsx(wee,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:N("sidebar.channels")})]}),P.has("scheduledTasks")&&a.jsxs("button",{className:Pe.pluginButton,type:"button",title:N("sidebar.scheduledTasks"),"aria-label":N("sidebar.scheduledTasks"),onClick:o,children:[a.jsx("span",{className:Pe.navIcon,children:a.jsx(yxe,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:N("sidebar.scheduledTasks")})]}),P.has("goals")&&a.jsxs("button",{className:Pe.pluginButton,type:"button",title:N("sidebar.goals"),"aria-label":N("sidebar.goals"),onClick:l,children:[a.jsx("span",{className:Pe.navIcon,children:a.jsx(R_e,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:N("sidebar.goals")})]}),(au=M==null?void 0:M.render)==null?void 0:au.call(M)]}),a.jsx("div",{className:Pe.body,children:a.jsxs("div",{className:Pe.sessionList,children:[!e&&Li.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Pe.projectsHeader,children:a.jsxs("button",{className:Pe.projectsHeaderToggle,type:"button","aria-expanded":ut,onClick:()=>Ct(Q=>!Q),children:[a.jsx("span",{children:N("sidebar.pinnedSessions")}),a.jsx(ZY,{expanded:ut})]})}),ut&&a.jsx("div",{className:Pe.pinnedSessionList,children:Li.map(Q=>Yu(Q,{readOnly:_c(Q)}))})]}),!e&&!R&&a.jsxs("div",{className:Pe.projectsHeader,children:[a.jsxs("button",{className:Pe.projectsHeaderToggle,type:"button","aria-expanded":$e,onClick:()=>it(Q=>!Q),children:[a.jsx("span",{children:N("sidebar.project")}),a.jsx(ZY,{expanded:$e})]}),a.jsxs("div",{className:Pe.projectsHeaderActions,children:[a.jsx("button",{className:Pe.projectsHeaderAction,type:"button",title:N("sidebar.search"),"aria-label":N("sidebar.search"),onClick:()=>{On(Q=>(Q&&lt(""),!Q)),it(!0)},children:a.jsx(tu,{})}),!E&&C&&a.jsx("button",{className:Pe.projectsHeaderAction,type:"button",title:N("sidebar.addWorkspace"),"aria-label":N("sidebar.addWorkspace"),onClick:C,children:a.jsx(Wf,{})})]})]}),Ft&&!e&&!R&&a.jsxs("div",{className:Pe.projectSearch,children:[a.jsx(tu,{"aria-hidden":"true"}),a.jsx(Us,{value:je,placeholder:N("sidebar.searchPlaceholder"),"aria-label":N("sidebar.search"),autoFocus:!0,onChange:Q=>lt(Q.target.value),onKeyDown:Q=>{Q.key==="Escape"&&(lt(""),On(!1))}})]}),(e||$e)&&a.jsx(a.Fragment,{children:!e&&a.jsx("div",{className:Pe.workspacePicker,children:a.jsx("div",{className:Pe.workspaceList,children:Ss.map(Q=>a.jsxs(h.Fragment,{children:[a.jsx(FIt,{workspace:Q,renderHeader:E&&(L!=null&&L.render)?De=>{var Ve;return(Ve=L.render)==null?void 0:Ve.call(L,Q,{expanded:De})}:void 0,client:Y.client,reloadToken:ks,untrustedLabel:N("sidebar.workspaceUntrusted"),readOnlyLabel:N("sidebar.workspaceReadOnly"),trustToOpenLabel:N("sidebar.workspaceTrustToOpen"),noSessionsLabel:N("sidebar.noSessions"),loadErrorLabel:N("sidebar.loadFailed"),organizationEnabled:K,sourceMetadataEnabled:ce,ungroupedLabel:N("sidebar.groupUngrouped"),onRenameGroup:re(Q.cwd)?ec:void 0,onDeleteGroup:re(Q.cwd)?w0:void 0,renameGroupLabel:N("sidebar.groupRename"),deleteGroupLabel:N("sidebar.groupDelete"),groupActionsDisabled:bt,excludePinned:!0,onOpenGitDiff:T,onOpenCommit:_,formatTime:De=>Uy(De,N),searchQuery:je,expanded:Q.primary?ws:void 0,autoExpandKey:(fn==null?void 0:fn.id)===Q.id?fn==null?void 0:fn.key:void 0,onExpandedChange:Q.primary?xe:void 0,renderSessions:!Q.primary,renderSession:De=>Yu({...De,workspaceCwd:Q.cwd},{readOnly:_c({...De,workspaceCwd:Q.cwd})}),headerActions:De=>{if(E&&(L!=null&&L.render))return null;const Ve=!E&&Os&&!Q.primary&&Q.removable===!0;if(!Q.trusted&&!Ve)return null;const Qe=Q.primary?void 0:Q.cwd;return a.jsxs("div",{className:Pe.workspaceHeaderActions,style:{visibility:De?"visible":"hidden"},children:[Q.trusted&&a.jsxs(a.Fragment,{children:[re(Q.cwd)&&a.jsx("button",{className:Pe.workspaceHeaderAction,type:"button","aria-label":N("sidebar.groupCreate"),onClick:Tt=>{Tt.preventDefault(),Tt.stopPropagation(),Q.primary?jd():Cc(Q.cwd)},children:a.jsx(Wf,{size:16,strokeWidth:1.2})}),a.jsx("button",{className:Pe.workspaceHeaderAction,type:"button",title:N("sidebar.newTask"),"aria-label":N("sidebar.newTask"),onClick:Tt=>{Tt.preventDefault(),Tt.stopPropagation(),kt(Qe)},children:a.jsx(KF,{size:16,strokeWidth:1.2})})]}),Ve&&a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{className:Pe.workspaceHeaderAction,type:"button","aria-label":N("sidebar.workspaceActions"),disabled:Gs&&(Yn==null?void 0:Yn.id)===Q.id,children:a.jsx(tp,{size:16,strokeWidth:1.2})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40",children:a.jsxs(bi,{variant:"destructive","aria-label":`${N("sidebar.removeWorkspace")}: ${Q.cwd}`,onSelect:()=>wa(Q),children:[a.jsx(kf,{}),N("sidebar.removeWorkspace")]})})]})]})}}),Q.primary&&(ws||je.trim())?a.jsx("div",{className:Pe.workspaceSessionBody,children:r8}):null]},Q.id))})})}),s8]})}),B!==!1&&a.jsxs("div",{className:sd(Pe.footer,Vr&&Pe.footerCompact,Po&&Pe.footerTight),children:[a.jsxs("div",{className:Pe.footerPrimary,children:[B&&typeof B=="object"&&((N0=B.render)==null?void 0:N0.call(B)),U.has("settings")&&a.jsxs("button",{className:Pe.footerButton,type:"button",title:N("sidebar.settings"),"aria-label":N("sidebar.settings"),onClick:n,children:[a.jsx("span",{className:`${Pe.navIcon} ${Pe.settingsIcon}`,children:a.jsx(b_e,{size:16,strokeWidth:1.2})}),!e&&!Vr&&a.jsx("span",{className:Pe.footerButtonLabel,children:N("sidebar.settings")})]}),!e&&!Po&&fi&&U.has("version")&&a.jsx("span",{className:Pe.version,title:`Qwen Code ${fi}`,children:fi})]}),a.jsxs("div",{className:Pe.footerActions,children:[U.has("theme")&&a.jsx("button",{className:Pe.collapseButton,type:"button",title:w===Fs.Dark?N("sidebar.themeLight"):N("sidebar.themeDark"),"aria-label":w===Fs.Dark?N("sidebar.themeLight"):N("sidebar.themeDark"),onClick:()=>y(w===Fs.Dark?Fs.Light:Fs.Dark),children:w===Fs.Dark?a.jsx(N_e,{size:16,strokeWidth:1.2}):a.jsx(Gke,{size:16,strokeWidth:1.2})}),u&&U.has("sessionsOverview")&&a.jsx("button",{className:Pe.collapseButton,type:"button",title:N("sidebar.sessionsOverview"),"aria-label":N("sidebar.sessionsOverview"),onClick:c,children:a.jsx(Rke,{size:16,strokeWidth:1.2})}),f&&U.has("splitView")&&a.jsx("button",{className:Pe.collapseButton,type:"button",title:N("sidebar.splitView"),"aria-label":N("sidebar.splitView"),onClick:d,children:a.jsx(Oxe,{size:16,strokeWidth:1.2})}),U.has("daemonStatus")&&a.jsx("button",{className:Pe.collapseButton,type:"button",title:N("sidebar.daemonStatus"),"aria-label":N("sidebar.daemonStatus"),onClick:i,children:a.jsx(Ywe,{size:16,strokeWidth:1.2})}),!v&&U.has("collapse")&&a.jsx("button",{className:Pe.collapseButton,type:"button",title:N(e?"sidebar.expand":"sidebar.collapse"),"aria-label":N(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:e?a.jsx(n_e,{size:16,strokeWidth:1.2}):a.jsx(e_e,{size:16,strokeWidth:1.2})})]})]}),a.jsx("div",{className:Pe.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:n8})]})})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function dMt(e){return e.key!=="b"&&e.key!=="B"||e.altKey||e.shiftKey?!1:e.metaKey!==e.ctrlKey}const hMt=3e3,fMt=2;function eX(e){return e.some(t=>t.status==="running"||t.status==="paused")}function mMt(e,t,n,r=0){const s=nm(),[i,o]=h.useState([]),[l,c]=h.useState(!1),[u,d]=h.useState(!1),f=h.useRef(0),m=h.useRef(null);h.useEffect(()=>{o([]),c(!1),f.current=0},[n,e]),h.useEffect(()=>{!n||!e||!t||(f.current=0,c(!0))},[n,e,t]),h.useEffect(()=>{!n||!e||r===0||(f.current=0,c(!0))},[n,r,e]),h.useEffect(()=>{if(u||!n||!e||!l)return;let g=!1;const b=()=>{var v;if(((v=m.current)==null?void 0:v.sessionId)===e)return;const y={};m.current={sessionId:e,request:y},s.getTasks().then(x=>{if(!(g||x.sessionId!==e)){if(o(x.tasks),x.tasks.length===0){f.current+=1,f.current>=fMt&&c(!1);return}f.current=0,eX(x.tasks)||c(!1)}}).catch(x=>{if(!g){if(zP(x)){c(!1);return}console.warn("[web-shell] failed to refresh tasks:",x)}}).finally(()=>{var x;((x=m.current)==null?void 0:x.request)===y&&(m.current=null)})};b();const w=setInterval(b,hMt);return()=>{g=!0,clearInterval(w)}},[s,n,l,e,u]);const p=h.useRef(i);return p.current=i,h.useEffect(()=>{const g=b=>{const w=b.detail,y=(w==null?void 0:w.active)===!0;d(y),!y&&eX(p.current)&&c(!0)};return window.addEventListener(t_,g),()=>window.removeEventListener(t_,g)},[]),i}function pMt(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>i===t[o]);const n=Object.keys(e),r=t,s=e;return n.length!==Object.keys(r).length?!1:n.every(i=>{const o=s[i],l=r[i];return o===l?!0:Array.isArray(o)&&Array.isArray(l)?o.length===l.length&&o.every((c,u)=>c===l[u]):!1})}function gMt(e){const t=h.useRef(e);return pMt(t.current,e)||(t.current=e),t.current}function bMt(e,t){const n=h.useRef(e);return e.length!==n.current.length?(n.current=e,e):(e.some((s,i)=>t(s)!==t(n.current[i]))&&(n.current=e),n.current)}const ca={NO_OUTPUT:"No output in history",NO_TEXT:"Last AI output contains no text to copy.",CODE_MISSING:"No matching code block found in the last AI output.",LATEX_MISSING:"No matching LaTeX block found in the last AI output.",INLINE_LATEX_MISSING:"No matching inline LaTeX expression found in the last AI output.",OUTPUT_COPIED:"Last output copied to the clipboard",CLIPBOARD_PREFIX:"Failed to copy to the clipboard. ",COPIED_SUFFIX:" copied to the clipboard"},tX=1024,yMt=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${tX}}\S\$)([^$\n]{1,${tX}})\$(?![\w$])`,"g");function vMt(e){var u,d,f;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=new Map;let i=null,o=null,l=null,c=[];for(const m of n){const p=m.match(r);if(!i){if(p){if(i=p[1]??null,o=((d=(u=p[2])==null?void 0:u.trim().split(/\s+/)[0])==null?void 0:d.toLowerCase())||null,o){const g=(s.get(o)??0)+1;s.set(o,g),l=g}else l=null;c=[]}continue}if(p&&((f=p[1])!=null&&f.startsWith(i[0]??""))&&p[1].length>=i.length){t.push({lang:o,content:c.join(`
`),index:t.length+1,langIndex:l}),i=null,o=null,l=null,c=[];continue}c.push(m)}return t}function wMt(e){var c;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1,l=[];for(const u of n){const d=u.match(r);if(i){d&&((c=d[1])!=null&&c.startsWith(i[0]??""))&&d[1].length>=i.length&&(i=null);continue}if(!o){if(d){i=d[1]??null;continue}s.test(u)&&(o=!0,l=[]);continue}if(s.test(u)){t.push({content:l.join(`
`),index:t.length+1}),o=!1,l=[];continue}l.push(u)}return t}function xMt(e){var l;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1;for(const c of n){const u=c.match(r);if(i){u&&((l=u[1])!=null&&l.startsWith(i[0]??""))&&u[1].length>=i.length&&(i=null);continue}if(o){s.test(c)&&(o=!1);continue}if(u){i=u[1]??null;continue}if(s.test(c)){o=!0;continue}for(const d of c.matchAll(yMt)){const f=d[1];f&&t.push({content:f,index:t.length+1})}}return t}function nX(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function kMt(e,t){var d;const n=t.trim().split(/\s+/).filter(Boolean),r=(d=n[0])==null?void 0:d.toLowerCase();if(!r)return;const s=vMt(e);if(s.length===0)return null;let i=null,o=null;const l=r==="code"?n.slice(1):n;for(const f of l)/^\d+$/.test(f)?o=Number(f):f.toLowerCase()!=="code"&&(i=f.toLowerCase());const c=i?s.filter(f=>f.lang===i):s;if(c.length===0)return null;if(o!==null){const f=i?c.find(m=>m.langIndex===o):s.find(m=>m.index===o);return f?{content:f.content,label:nX(f,i)}:null}const u=c[c.length-1];return u?{content:u.content,label:nX(u,i)}:null}function rX(e,t){const n=xMt(e);if(n.length===0)return null;let r=null;for(const i of t)/^\d+$/.test(i)&&(r=Number(i));const s=r!==null?n.find(i=>i.index===r):n[n.length-1];return s?{content:s.content,label:`Inline LaTeX expression ${s.index}`}:null}function _Mt(e,t){var u;const n=t.trim().split(/\s+/).filter(Boolean),r=(u=n[0])==null?void 0:u.toLowerCase();if(r!=="latex"&&r!=="math"&&r!=="inline-latex")return;if(r==="inline-latex")return rX(e,n.slice(1));const s=n.slice(1),i=s.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return rX(e,s.filter((d,f)=>f!==i));const o=wMt(e);if(o.length===0)return null;let l=null;for(const d of s)/^\d+$/.test(d)&&(l=Number(d));const c=l!==null?o.find(d=>d.index===l):o[o.length-1];return c?{content:c.content,label:`LaTeX block ${c.index}`}:null}function SMt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="assistant"&&n.content)return n.content}return null}function CMt(e){var t;return typeof navigator>"u"||!((t=navigator.clipboard)!=null&&t.writeText)?Promise.reject(new Error("Clipboard API is not available")):navigator.clipboard.writeText(e)}async function TMt(e,t,n=CMt){const r=SMt(e);if(r===null)return{status:"info",message:ca.NO_OUTPUT};if(!r)return{status:"info",message:ca.NO_TEXT};try{const s=_Mt(r,t);if(s===null)return{status:"info",message:t.trim().split(/\s+/).some(c=>c==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?ca.INLINE_LATEX_MISSING:ca.LATEX_MISSING};if(s!==void 0)return await n(s.content),{status:"info",message:`${s.label}${ca.COPIED_SUFFIX}`};const i=kMt(r,t);if(i===null)return{status:"info",message:ca.CODE_MISSING};const o=(i==null?void 0:i.content)??r;return await n(o),{status:"info",message:i?`${i.label}${ca.COPIED_SUFFIX}`:ca.OUTPUT_COPIED}}catch(s){const i=s instanceof Error?s.message:String(s);return{status:"error",message:`${ca.CLIPBOARD_PREFIX}${i}`}}}function EMt(e){return typeof e=="object"&&e!==null}function Eme(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function kO(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function AMt(e){if(!kO(e)||!EMt(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function jMt(e){const t=new Set;for(const n of e){if(!kO(n))continue;const r=AMt(n);r&&t.add(r)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const r=Eme(n.content);return!r||!t.has(r)})}function NMt(e){return e.role!=="system"||e.variant!=="info"?!1:Eme(e.content)!==null||kO(e)}function IMt(e){const t=e.findIndex(n=>!NMt(n));return t<0?[]:e.slice(t)}function sX(e){return IMt(jMt(e))}function MMt(e){return e.blocked?{kind:"ignore"}:e.streaming?e.armed==="cancel"?{kind:"cancel"}:{kind:"arm",action:"cancel"}:e.hasInput?e.armed==="clear"?{kind:"clear"}:{kind:"arm",action:"clear"}:{kind:"ignore"}}function iX(e,t){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(e)for(const r of e.cells){const s=r.detail;r.kind==="node_version"&&(s!=null&&s.version)?n.nodeVersion=s.version:r.kind==="npm"&&(s!=null&&s.version)?n.npmVersion=String(s.version).replace(/^npm\s*/i,""):r.kind==="auth"&&(s!=null&&s.source)&&(n.authSource=s.source)}if(t)for(const r of t.cells)r.kind==="platform"?(n.platform=r.name,r.value&&(n.arch=r.value)):r.kind==="sandbox"&&r.name==="SANDBOX"?n.sandbox=r.value||"":r.kind==="proxy"&&r.present&&r.value?n.proxy=`${r.name}: ${r.value}`:r.kind==="memory"&&r.value&&(n.memoryUsage=r.value);return n}function RMt(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function oX(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function DMt(e){const t=e.indexOf("\0"),n=t>=0?e.slice(0,t):e,r=n.indexOf(":");return r>0?`${n.slice(r+1)}(${n.slice(0,r)})`:n}const LMt=12,PMt=2,OMt=8,$Mt=.35,BMt=2,zMt=.1,FMt=700,qMt=10*60*1e3,HMt=.75,UMt=280,WMt=[/^继续[吧呢]?$/,/^行[吧吗]?$/,/^好的?$/,/^再[看试说解释改跑补].*/,/^顺手.*/,/^上面.*/,/^刚才.*/,/^这个报错.*/,/^那你.*/,/^帮我修.*/,/^帮我看下.*/,/^跑(一下)?(测试|看看).*/,/^这个实现.*/,/^这个 PR.*/i,/^继续当前.*/,/^continue$/i,/^ok(?:ay)?$/i,/^retry$/i,/^fix (?:that|this|it)/i,/^run (?:the )?tests?/i],VMt=[/新的?(功能|任务|方向|话题)/,/写(一篇)?(设计文档|文档|spec|方案)/i,/产品方案/,/脑爆/,/另一个(功能|方向|任务|主题)/,/不继续当前/,/切到(一个)?新的?(任务|方向|话题)/,/start (a )?new/i,/new (feature|task|design|spec|doc|workflow)/i,/product (design|plan|spec)/i,/brainstorm/i];function GMt(e){const t=e.trim();return WMt.some(n=>n.test(t))}function KMt(e){const t=e.trim();return VMt.some(n=>n.test(t))}function YMt(e){return e.filter(n=>(n.role==="user"||n.role==="assistant")&&typeof n.content=="string"&&n.content.trim().length>0).slice(-8).map(n=>({role:n.role,text:n.content.trim().slice(0,UMt)}))}function XMt(e){const t=e.recentMessages.map((n,r)=>`${r+1}. ${n.role}: ${n.text}`).join(`
`);return["You are deciding how a user's new message should be handled in the current coding session.",'Choose "new_session" only when the message is clearly a different task or topic and continuing here would add context noise.','Choose "btw" only for a brief side question that can be answered without changing the main task or adding its answer to the main conversation context.','Choose "none" for follow-ups, implementation continuations, debugging iterations, review follow-ups, and adjacent discussion about the same repo, PR, bug, or feature.','Be conservative. When in doubt, choose "none".',`Allowed actions: btw=${e.allowBtw?"yes":"no"}, new_session=${e.allowNewSession?"yes":"no"}. Never choose an action marked no.`,'Return JSON only with keys: suggestion ("btw", "new_session", or "none") and confidence (0-1 number).',"",`Context usage ratio: ${e.contextUsageRatio.toFixed(2)}`,`Visible message count: ${e.messageCount}`,"","Recent visible messages:",t||"(none)","","Current user input:",e.currentInput].join(`
`)}function aX(e){try{const t=JSON.parse(e);return t.suggestion!=="btw"&&t.suggestion!=="new_session"&&t.suggestion!=="none"||typeof t.confidence!="number"||!Number.isFinite(t.confidence)||t.confidence<0||t.confidence>1?null:{suggestion:t.suggestion,confidence:t.confidence}}catch{return null}}function QMt(e){const t=aX(e);if(t)return t;const n=e.indexOf("{"),r=e.lastIndexOf("}");if(n===-1||r<=n)return null;const s=e.slice(n,r+1);return s===e?null:aX(s)}function JMt({enabled:e,messages:t,sessionId:n,contextUsageRatio:r,isRunning:s,dialogOpen:i,hasAttachments:o,generateContent:l}){const[c,u]=h.useState(null),d=h.useRef(null),f=h.useRef(null),m=h.useRef(0),p=h.useRef(""),g=h.useRef(null),b=h.useRef(n),w=h.useMemo(()=>YMt(t),[t]),y=h.useRef({enabled:e,recentMessages:w,sessionId:n,contextUsageRatio:r,isRunning:s,dialogOpen:i,hasAttachments:o,generateContent:l});y.current={enabled:e,recentMessages:w,sessionId:n,contextUsageRatio:r,isRunning:s,dialogOpen:i,hasAttachments:o,generateContent:l};const v=h.useCallback(()=>{var C;d.current&&(clearTimeout(d.current),d.current=null),(C=f.current)==null||C.abort(),f.current=null},[]),x=h.useCallback(()=>{g.current!==null&&(g.current=null,u(null))},[]),k=h.useCallback(()=>{x(),v()},[v,x]),S=h.useCallback(()=>{m.current=Date.now()+qMt,x(),v()},[v,x]),T=h.useCallback(C=>{v();const{enabled:j,recentMessages:E,sessionId:L,contextUsageRatio:D,isRunning:M,dialogOpen:R,hasAttachments:$,generateContent:B}=y.current;if(!j||!B||!L){x();return}const N=C.trim();if(N.length<LMt){x();return}const z=KMt(N);if(M||R){x();return}const G=$===!1&&E.length>=PMt,I=!GMt(N)&&(z?E.length>=BMt||D>=zMt:E.length>=OMt||D>=$Mt);if(!G&&!I){x();return}if(Date.now()<m.current){x();return}x(),d.current=setTimeout(()=>{const Y=new AbortController;f.current=Y;const U=XMt({recentMessages:E,currentInput:N,contextUsageRatio:D,messageCount:E.length,allowBtw:G,allowNewSession:I});(async()=>{let P="";try{for await(const te of B(U,{signal:Y.signal})){if(f.current!==Y)return;if(te.type==="delta")P+=te.text;else if(te.type==="error"){f.current===Y&&x();return}}if(f.current!==Y)return;const F=QMt(P.trim());if(F&&F.suggestion!=="none"&&(F.suggestion==="btw"&&G||F.suggestion==="new_session"&&I)&&F.confidence>=HMt){const te={suggestion:F.suggestion,classifiedInput:N,sourceSessionId:L};g.current=te,u(te);return}x()}catch{Y.signal.aborted||x()}finally{f.current===Y&&(f.current=null)}})()},FMt)},[v,x]),_=h.useCallback(C=>{p.current=C,T(C)},[T]);return h.useEffect(()=>{b.current!==n&&(b.current=n,v(),x()),T(p.current)},[v,x,r,i,e,l,o,s,w,T,n]),h.useEffect(()=>()=>{v()},[v]),{suggestion:c,updateInput:_,dismiss:k,suppress:S}}const e1=h.createContext(!1),_O=h.createContext(new Map),Ame=h.createContext(new Map);function ZMt({timeline:e,details:t,children:n}){return a.jsx(_O.Provider,{value:e,children:a.jsx(Ame.Provider,{value:t,children:n})})}const Yw=ov,C7=500,cb=320,MC=500,eRt=800,tRt=332,jme=["approvalMode","model","widthMode","voice","workspace"],nRt=[...jme,"gitBranch"],rRt=20,sRt=3e4;function iRt(e){return(e.skills??[]).filter(t=>t.status==="ok").map(t=>({name:t.name,description:t.description??"",...t.argumentHint?{argumentHint:t.argumentHint}:{}})).sort((t,n)=>t.name.localeCompare(n.name))}const oRt="ui.compactMode",aRt="ui.hideTips",lRt={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function T7(e){return e.trim().replace(/^\/+/,"").toLowerCase()}function E7(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if((n==null?void 0:n.kind)==="user")return n.id}}function cRt(e){const t=e;return t.source!=="goal"?null:j3(t.data)??j3(t.text)}function uRt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const r=cRt(n);if(r)return r.kind==="set"||r.kind==="checking"?{condition:r.condition,setAt:r.setAt??n.serverTimestamp??n.createdAt}:null}return null}const lX={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},dRt=[],Nme=1e3,hRt=["title","environment","rightPanel"],fRt=["review","sideTask"],mRt=["environment","subagents","backgroundTasks"],cX=6,uX=40,Ime="qwen-code-web-shell-chat-width",pRt=40,Mme="qwen-code-web-shell-sidebar-collapsed";function gRt(e){return e===!0?{enabled:!0,defaultCollapsed:!1,showCompactToggle:!0}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1,showCompactToggle:e.showCompactToggle??!0,branding:e.branding,primaryNav:e.primaryNav,hideProjectHeader:e.hideProjectHeader,sessionActions:e.sessionActions,footer:e.footer,lockedWorkspace:e.lockedWorkspace}:{enabled:!1,defaultCollapsed:!1,showCompactToggle:!0}}function bRt(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Mme);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function dX(e){try{window.localStorage.setItem(Mme,String(e))}catch{}}function R4(){return`${Nme}`}function yRt(){if(typeof window>"u")return R4();try{return window.localStorage.getItem(Ime)==="wide"?"wide":R4()}catch{return R4()}}function vRt(e){try{window.localStorage.setItem(Ime,e)}catch{}}function Rme(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:Nme}function wRt(e,t){const n=`${Rme(t)}px`,r=`calc(${n} + ${pRt}px)`;return{"--chat-regular-content-width":n,"--chat-regular-shell-width":r,"--chat-content-width":e==="wide"?"100%":n,"--chat-shell-width":e==="wide"?"100%":r}}function hX(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function fX(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function xRt(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function kRt(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return jf(e.get("language")??e.get("lang")??navigator.language)}function _Rt(e,t){return e instanceof Error?e.message:t}function A7(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function ub(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function SRt(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function CRt(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function Tp(e){return typeof e=="object"&&e!==null}function TRt(e){if(!Tp(e))return null;const t=e._meta;if(!Tp(t))return null;const n=t.qwenModelSwitch;if(!Tp(n))return null;const r=n.authType,s=n.modelId,i=n.baseUrl,o=n.apiKey;return typeof r!="string"||typeof s!="string"||typeof i!="string"||typeof o!="string"?null:{authType:r,modelId:s,baseUrl:i,apiKey:o,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function ERt(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function ARt(e){return e.toolKind==="edit"}function jRt(e){const t=e.trim().replace(/[\r\n]+/g," ");return t?t==="--"?{type:"manual",displayName:""}:t.startsWith("-- ")?{type:"manual",displayName:t.slice(3).trim()}:t.toLowerCase()==="--auto"?{type:"auto"}:t.startsWith("--")?{type:"delegate"}:{type:"manual",displayName:t}:{type:"auto"}}function NRt(e){var n;const t=e.toolName.toLowerCase();return t==="monitor"?!0:((n=e.args)==null?void 0:n.is_background)!==!0?!1:t==="shell"||t==="bash"||t==="run_shell_command"||t==="exec"}function IRt(e){const t=[],n=r=>{for(const s of r)(NRt(s)||bd(s))&&t.push(`${s.callId}:${s.status}`),s.subTools&&n(s.subTools)};for(const r of e)r.role==="tool_group"&&n(r.tools);return t.join("|")}function mX(e,t){return e.status!=="running"&&t.status==="running"?e:t}function pX(e,t){return e.status!=="running"&&t.status==="running"?e:t}function MRt(e,t,n,r){if(e.parentSessionId!==t)return{parentSessionId:t,items:n,loaded:!0};const s=new Set(n.map(i=>i.sessionId));return{parentSessionId:t,loaded:!0,items:[...n,...e.items.filter(i=>!s.has(i.sessionId)&&r.has(i.sessionId))]}}function RRt(e){if(e.status==="pending"||e.status==="in_progress")return"running";if(e.status==="failed")return"failed";const t=Tp(e.rawOutput)?e.rawOutput:void 0;return(t==null?void 0:t.status)==="cancelled"?"cancelled":(t==null?void 0:t.status)==="failed"?"failed":"completed"}function DRt(e){const t=e.status==="running"||e.status==="paused"?"in_progress":e.status==="failed"?"failed":"completed";return{callId:e.id,toolName:"agent",title:`Agent: ${e.label}`,status:t,args:{description:e.description,...e.prompt?{prompt:e.prompt}:{},...e.subagentType?{subagent_type:e.subagentType}:{},run_in_background:e.isBackgrounded},rawOutput:{type:"task_execution",subagentName:e.subagentType,status:e.status},startTime:e.startTime,...e.endTime!==void 0?{endTime:e.endTime}:{}}}function gX(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||typeof((n=e.args)==null?void 0:n.subagent_type)=="string"?!0:Tp(e.rawOutput)&&e.rawOutput.type==="task_execution"}function bX(e){var s;const t=Tp(e.rawOutput)?e.rawOutput:void 0,n=typeof(t==null?void 0:t.subagentName)=="string"?t.subagentName:void 0,r=typeof((s=e.args)==null?void 0:s.subagent_type)=="string"?e.args.subagent_type:void 0;return n?`${n}-${e.callId}`:r?`${r}-${e.callId}`:void 0}function LRt(e,t){const n=t.filter(m=>m.kind==="agent"),r=new Map;for(const m of e){if(m.role!=="system"||!Tp(m.data))continue;const p=m.data.taskId,g=m.data.toolUseId;typeof p=="string"&&typeof g=="string"&&r.set(g,p)}const s=new Set,i=new Set(r.values()),o=m=>{for(const p of m){if(gX(p)&&!s.has(p.callId)){s.add(p.callId);const g=bX(p);g&&i.add(g)}p.subTools&&o(p.subTools)}};for(const m of e)m.role==="tool_group"&&o(m.tools);const l=m=>m.toolUseId!=null&&s.has(m.toolUseId)||i.has(m.id),c=[],u=new Set,d=new Set,f=m=>{var p,g,b,w;for(const y of m){if(gX(y)&&!d.has(y.callId)){d.add(y.callId);const v=Tp(y.rawOutput)?y.rawOutput:void 0,x=typeof(v==null?void 0:v.subagentColor)=="string"?v.subagentColor:void 0,k=typeof((p=y.args)==null?void 0:p.description)=="string"?y.args.description:void 0,S=typeof((g=y.args)==null?void 0:g.prompt)=="string"?y.args.prompt:void 0,T=typeof((b=y.args)==null?void 0:b.subagent_type)=="string"?y.args.subagent_type:void 0,_=typeof(v==null?void 0:v.subagentName)=="string"?v.subagentName:void 0,C=r.get(y.callId),j=bX(y),E=N=>S&&N.prompt===S||k&&N.description===k&&T&&N.subagentType===T?!0:!!k&&N.description===k,L=n.find(N=>N.toolUseId===y.callId||N.id===C||N.id===j||!u.has(N.id)&&!l(N)&&E(N)),D=(w=y.title)==null?void 0:w.replace(/^Agent:\s*/i,"").trim(),R=(D&&D.toLowerCase()!=="agent"?D:void 0)??k??S??_??T??"",$=k??S??_??T??"",B=y.startTime??0;c.push(L?{...L,label:R,description:$||L.description,...T?{subagentType:T}:{},...x?{color:x}:{}}:{kind:"agent",id:C??j??y.callId,label:R,description:$,status:RRt(y),startTime:B,...y.endTime!==void 0?{endTime:y.endTime}:{},runtimeMs:Math.max(0,(y.endTime??y.startTime??B)-B),...T?{subagentType:T}:{},...x?{color:x}:{},isBackgrounded:bd(y),toolUseId:y.callId}),L&&u.add(L.id)}y.subTools&&f(y.subTools)}};for(const m of e)m.role==="tool_group"&&f(m.tools);for(const m of n)u.has(m.id)||m.toolUseId&&d.has(m.toolUseId)||c.some(g=>g.toolUseId!=null&&g.toolUseId===m.toolUseId||g.description!==""&&g.description===m.description)||c.push(m);return c}function PRt(e,t){const n=r=>{for(const s of r){if(s.callId===t)return s;const i=s.subTools?n(s.subTools):void 0;if(i)return i}};for(const r of e){if(r.role!=="tool_group")continue;const s=n(r.tools);if(s)return s}}function ORt(e){const t={id:e.id,label:e.label,description:e.description,runtimeMs:e.runtimeMs,startTime:e.startTime,endTime:e.endTime,error:e.error};switch(e.kind){case"agent":return{...t,kind:"agent",status:e.status,subagentType:e.subagentType,isBackgrounded:e.isBackgrounded,prompt:e.prompt};case"shell":return{...t,kind:"shell",status:e.status,command:e.command,cwd:e.cwd,pid:e.pid,exitCode:e.exitCode};case"monitor":return{...t,kind:"monitor",status:e.status,command:e.command,pid:e.pid,exitCode:e.exitCode};default:return e}}function $Rt(e,t){return e===ca.NO_OUTPUT?t("copy.noOutput"):e===ca.NO_TEXT?t("copy.noText"):e===ca.CODE_MISSING?t("copy.codeMissing"):e===ca.LATEX_MISSING?t("copy.latexMissing"):e===ca.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===ca.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(ca.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(ca.CLIPBOARD_PREFIX.length)}`:e.endsWith(ca.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-ca.COPIED_SUFFIX.length)}):e}function yX(e,t){return e===t?!0:!e||!t?!1:e.v===t.v&&e.workspaceCwd===t.workspaceCwd&&e.branch===t.branch&&e.detached===t.detached&&e.staged===t.staged&&e.unstaged===t.unstaged&&e.untracked===t.untracked&&e.conflicted===t.conflicted&&e.hasUpstream===t.hasUpstream&&e.ahead===t.ahead&&e.behind===t.behind&&e.stashCount===t.stashCount&&e.operation===t.operation}function RC(e,t,n){const r=e.find(s=>s.key===n);if(r)return t==="user"?r.values.user:r.values.workspace}function BRt({onSessionIdChange:e,onSessionCreated:t,theme:n,onThemeChange:r,language:s,onLanguageChange:i,className:o,style:l,shadowDom:c,onConnectionChange:u,onStreamingStateChange:d,onError:f,onBugReport:m,hiddenSlashCommands:p,slashCommandCategoryOrder:g,onSlashCommand:b,builtinAtProviders:w,atProviders:y,composerTagIcons:v,renderToolHeaderExtra:x,renderWelcomeHeader:k,renderWelcomeFooter:S,mobileWelcomeFooterMiddle:T=!1,parseUserMessageContent:_,renderUserMessageContent:C,renderComposerTag:j,renderComposerTagTooltip:E,onComposerTagClick:L,renderAssistantTurnFooter:D,renderComposerToolbarStart:M,renderComposerToolbarEnd:R,renderComposerToolbarRight:$,renderComposerHeader:B,renderComposerFooter:N,renderChatHeader:z,renderFooter:G,bottomStatusItems:I,chatMaxWidth:Y,sidebar:U,header:P,rightPanel:F,environmentPanel:te,splitSessionIds:W,onSplitSessionIdsChange:K,renderPaneHeaderActions:ce,onRightPanelOpen:ie,messageTurnOutputs:Z,shellRef:ee,composerToolbarActions:oe,composerPlaceholders:we,compactThinking:pe=!1,collapseCompletedTurns:he=!0,markdownTableMode:X="basic",virtualScrollThreshold:ye,markdown:Ce,loadingPhrases:ae,onTranscriptChange:me,onToast:We,composerRef:Oe,onComposerReady:Mt,composerInput:$t,composerInputVersion:St,onSessionChange:ue,onSubmitBefore:Ee,restartSseOnPrompt:tt,historyPageSize:ut,initialSelectedWorkspaceCwd:Ct,lockedWorkspaceCwd:Ze,lockedWorkspaceCapability:Et}={}){var Z$,eB,tB,nB,rB,sB,iB,oB,aB,lB,cB,uB,dB,hB,fB,mB,pB,gB,bB,yB,vB,wB,xB,kB,_B;const[Nt,gt]=h.useState(yRt),[Je,Ae]=h.useState(()=>s===void 0?kRt():jf(s)),de=h.useMemo(()=>iD(Je),[Je]),nt=h.useMemo(()=>uAt(c),[c]),ve=h.useMemo(()=>gRt(U),[U]),Ke=(P==null?void 0:P.items)??hRt,le=Ke.length>0&&!!(P||z),Le=Ke.includes("title"),dt=Ke.includes("environment"),Fe=Ke.includes("rightPanel"),Ge=(F==null?void 0:F.items)??fRt,un=(te==null?void 0:te.items)??mRt,Wn=le&&dt&&(!z||!!P),Me=Wn&&un.includes("environment"),yt=Wn&&un.includes("backgroundTasks"),[cn,Re]=h.useState(()=>bRt(ve.defaultCollapsed)),[et,bt]=h.useState(null),[rn,qn]=h.useState(!1),[ft,He]=h.useState(!1),Ye=h.useCallback(()=>{qn(!1),He(!1)},[]),Yt=m7(),Cn=m7("(min-width: 1001px)"),Tn=m7("(min-width: 1200px)");h.useEffect(()=>{ve.enabled||Ye()},[Ye,ve.enabled]),h.useEffect(()=>{const A=window.matchMedia("(max-width: 760px)"),q=V=>{V.matches||Ye()};return A.addEventListener("change",q),()=>A.removeEventListener("change",q)},[Ye]),h.useEffect(()=>{if(!rn)return;const A=ne=>{if(ne.key!=="Escape"||T1.current)return;const be=ne.target;Qg(be)&&!(be!=null&&be.closest("[data-sidebar-shell]"))||(ne.stopPropagation(),ne.preventDefault(),Ye())},q=document.body.style.overflow;document.body.style.overflow="hidden";const V=ne=>{const be=ne.target;be!=null&&be.closest("[data-sidebar-shell]")&&!be.closest(`.${Ot.mobileBackdrop}`)||ne.preventDefault()};return document.addEventListener("touchmove",V,{passive:!1}),window.addEventListener("keydown",A,!0),()=>{document.body.style.overflow=q,document.removeEventListener("touchmove",V),window.removeEventListener("keydown",A,!0)}},[rn,Ye]);const zr=h.useCallback(A=>{Re(A),dX(A)},[]);h.useEffect(()=>{if(!ve.enabled)return;const A=q=>{if(!dMt(q))return;const V=q.target;if(Qg(V)&&!(V!=null&&V.closest("[data-web-shell-composer-editor]")))return;if(q.preventDefault(),ft||window.matchMedia("(max-width: 760px)").matches){rn?(qn(!1),He(!1)):qn(!0);return}const ne=!cn;Re(ne),dX(ne)};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[ve.enabled,rn,ft,cn]);const Ns=h.useMemo(()=>({composerTagIcons:v,renderToolHeaderExtra:x,renderWelcomeHeader:k,renderWelcomeFooter:S,parseUserMessageContent:_,renderUserMessageContent:C,renderComposerTag:j,renderComposerTagTooltip:E,onComposerTagClick:L,renderAssistantTurnFooter:D,renderComposerToolbarStart:M,renderComposerToolbarEnd:R,renderComposerToolbarRight:$,renderComposerHeader:B,renderComposerFooter:N,renderFooter:G,compactThinking:pe,collapseCompletedTurns:he,markdownTableMode:X,markdown:Ce,loadingPhrases:ae}),[v,x,k,S,_,C,j,E,L,D,M,R,$,B,N,G,pe,he,X,Ce,ae]),kr=G,si=B,Fr=N,At=av(),Xn=ufe(),_e=qa(),Vt=K9(),Dt=yo(),Kn=Dt.refreshCapabilities,Vn=h.useMemo(()=>{var q;const A=((q=Dt.capabilities)==null?void 0:q.workspaces)??[];return Et&&!A.some(V=>V.cwd===Et.cwd)?[...A,Et]:A},[Et,(Z$=Dt.capabilities)==null?void 0:Z$.workspaces]),ds=h.useRef(void 0),hs=Ze?void 0:Vn.map(A=>({id:A.id,cwd:A.cwd,label:X6(A),primary:A.primary,trusted:A.trusted})),vs=ds.current;((vs==null?void 0:vs.length)!==(hs==null?void 0:hs.length)||vs!=null&&vs.some((A,q)=>{const V=hs==null?void 0:hs[q];return!V||A.id!==V.id||A.cwd!==V.cwd||A.label!==V.label||A.primary!==V.primary||A.trusted!==V.trusted}))&&(ds.current=hs);const Mr=ds.current,ji=h.useRef(Vn);ji.current=Vn;const os=h.useMemo(()=>Ze?Vn.filter(A=>A.cwd===Ze):Vn,[Ze,Vn]),zt=nm(),Ni=h.useCallback(async A=>{_e.sessionId&&await zt.reloadSession(A)},[_e.sessionId,zt]),Ur=((eB=_e.capabilities)==null?void 0:eB.features.includes(See))===!0,vo=((tB=_e.capabilities)==null?void 0:tB.features.includes(Cee))===!0,{notices:wo,dismissNotice:Ps}=xwe(),Gt=ga(),_r=((rB=(nB=Dt.capabilities)==null?void 0:nB.features)==null?void 0:rB.includes("dynamic_workspace_registration"))===!0,Er=((iB=(sB=Dt.capabilities)==null?void 0:sB.features)==null?void 0:iB.includes("persistent_workspace_registration"))===!0,Do=((aB=(oB=Dt.capabilities)==null?void 0:oB.features)==null?void 0:aB.includes("scratch_workspace_registration"))===!0,fs=((cB=(lB=Dt.capabilities)==null?void 0:lB.features)==null?void 0:cB.includes("workspace_display_name"))===!0,di=((dB=(uB=Dt.capabilities)==null?void 0:uB.features)==null?void 0:dB.includes("workspace_github_prs"))===!0,[ws,xe]=h.useState(!1),[$e,it]=h.useState(!1),Ft=h.useRef(null),On=h.useRef(null),Yn=h.useRef(0),Is=h.useRef("clear"),Wr=h.useRef(void 0),[cr,Gs]=h.useState("clear"),Qr=h.useCallback(A=>{Is.current=A,Gs(A)},[]),[vr,xr]=h.useState(Ct),xs=h.useRef(vr);xs.current=vr;const[nn,ks]=h.useState(void 0);h.useEffect(()=>{if(!Dt.capabilities||!vr)return;const A=Vn.find(q=>q.cwd===vr);A!=null&&A.trusted||(Yn.current+=1,xs.current=void 0,xr(void 0))},[vr,Dt.capabilities,Vn]);const Jr=h.useRef(void 0),[fn,Ks]=h.useState(void 0),[ur,je]=h.useState(void 0),[lt,Xt]=h.useState(void 0),Nn=h.useRef(void 0);h.useEffect(()=>{const A=_e.sessionId,q=Nn.current;if(Nn.current=A,!A){Ks(void 0),je(void 0),Xt(void 0);return}q!==A&&(Ks(void 0),je(void 0),Xt(void 0)),!(_e.status!=="connected"||_e.loadingTranscript||_e.catchingUp)&&Dt.client.sessionStatus(A).then(V=>(Nn.current===A&&(Ks(V.worktree),je(V.branch),Xt(V.displayName)),Dt.client.listWorkspaceSessions(V.workspaceCwd,{pageSize:200}).then(ne=>{if(Nn.current!==A)return;const be=ne.find(Ie=>Ie.sessionId===A);Xt((be==null?void 0:be.displayName)??V.displayName)}).catch(()=>{}))).catch(()=>{Nn.current===A&&(Ks(void 0),je(void 0),Xt(void 0))})},[_e.catchingUp,_e.loadingTranscript,_e.sessionId,_e.status,Dt.client]);const Lt=h.useMemo(()=>{var A;return _e.sessionId?_e.workspaceCwd:Ze??vr??((A=Vn.find(q=>q.primary))==null?void 0:A.cwd)},[_e.sessionId,_e.workspaceCwd,Ze,vr,Vn]);h.useEffect(()=>{if(!Lt){Jr.current=void 0,ks(void 0);return}const A=(fn==null?void 0:fn.path)??Lt;Jr.current!==A&&(Jr.current=A,ks(void 0));let q=!1;const V=()=>{const Ie=Dt.client.workspaceByCwd(Lt);Ie.workspaceGit({cwd:fn==null?void 0:fn.path}).then(at=>{q||ks(Rt=>yX(Rt,at)?Rt:at)}).catch(()=>{q||ks(void 0)}),fn||Ie.workspaceGit({wait:!0}).then(at=>{q||ks(Rt=>yX(Rt,at)?Rt:at)}).catch(at=>{console.warn("[web-shell] git status fresh path failed:",at)})};V();const ne=()=>V();window.addEventListener("focus",ne);const be=window.setInterval(()=>{document.visibilityState==="visible"&&V()},3e4);return()=>{q=!0,window.removeEventListener("focus",ne),window.clearInterval(be)}},[Lt,_e.gitBranch,Dt.client,fn]),h.useEffect(()=>{const A=_e.gitStatus;!A||fn||A.workspaceCwd===Lt&&ks(A)},[_e.gitStatus,Lt,fn]);const Be=h.useRef(We);Be.current=We;const yn=h.useRef(0),[mr,dr]=h.useState([]),as=h.useCallback(A=>{dr(q=>q.filter(V=>V.id!==A))},[]),Ht=h.useCallback((A,q)=>{if(Be.current){Be.current(A,q);return}const V={id:`web-shell-toast-${Date.now()}-${++yn.current}`,tone:A,message:q};dr(ne=>[...ne.filter(Ie=>Ie.tone!==A||Ie.message!==q),V].slice(-4))},[]),hr=dO(de,Xn),hi=h.useRef(hr);hi.current=hr;const[Zr,Os]=h.useState(null),Vi=h.useRef(Zr),[Ms,Lo]=h.useState(null),Ys=h.useCallback(A=>{Vi.current=A,Os(A)},[]),[ya,Ss]=h.useState(null),[Li,pr]=h.useState(null),xo=h.useRef(1),Qo=h.useRef(1),ko=h.useRef(null),_o=h.useRef(null),_c=h.useRef(null),[Ha,Cs]=h.useState(null),lo=h.useRef(_e.sessionId),Jo=h.useRef(void 0),Sc=h.useRef(void 0),fl=h.useRef(void 0),ct=h.useRef(_e.sessionId),tr=h.useMemo(()=>{const A=[ya].filter(V=>V!==null);if(A.length===0)return sX(hr);const q=[...hr];for(const V of A.sort((ne,be)=>ne.anchorIndex-be.anchorIndex)){const ne=V.anchorAfterId?q.findIndex(Ie=>Ie.id===V.anchorAfterId):-1,be=ne>=0?ne+1:Math.min(V.anchorIndex,q.length);q.splice(be,0,V.message)}return sX(q)},[hr,ya]);h.useEffect(()=>{const A=Vi.current;if(!A)return;const q=tr.findIndex(V=>V.id===A.messageId);(A.sessionId!==_e.sessionId||q<0||tr.slice(q+1).some(V=>V.role==="user"))&&Ys(null)},[_e.sessionId,tr,Zr,Ys]);const{artifacts:re,loading:ge,error:ze}=hO(),[ot,mn]=h.useState([]),[Bt,zn]=h.useState(()=>new Map),[Zn,Mn]=h.useState([]),vn=h.useRef(Zn);vn.current=Zn,h.useEffect(()=>{if(ot.length===0||re.length===0)return;const A=new Set(re.map(V=>V.id)),q=new Set(Zn.filter(V=>V.kind==="artifact"&&V.workspaceActions).map(V=>V.kind==="artifact"?V.artifactId:""));mn(V=>{const ne=V.filter(be=>!A.has(be.id)||q.has(be.id));return ne.length===V.length?V:ne})},[re,ot.length,Zn]);const En=h.useMemo(()=>Array.from(Bt.values()).flatMap(A=>[...A.artifacts]),[Bt]),fi=h.useMemo(()=>{if(ot.length===0&&En.length===0)return re;const A=[...re];for(const q of[...ot,...En])A.findIndex(ne=>ne.id===q.id)<0&&A.push(q);return A},[re,ot,En]),Vr=h.useCallback((A,q,V)=>{zn(be=>{const Ie=be.get(A);if((Ie==null?void 0:Ie.workspaceActions)===V&&Ie.artifacts.length===q.length&&Ie.artifacts.every((Jt,vt)=>{const _t=q[vt];return(_t==null?void 0:_t.id)===Jt.id&&_t.updatedAt===Jt.updatedAt&&_t.sizeBytes===Jt.sizeBytes}))return be;const Rt=new Map(be);return q.length===0?Rt.delete(A):Rt.set(A,{artifacts:[...q],workspaceActions:V}),Rt});const ne=new Set(q.map(be=>be.id));Mn(be=>{let Ie=!1;const at=be.map(Rt=>{if(Rt.kind!=="artifact"||!ne.has(Rt.artifactId))return Rt;const Jt={id:Rt.id,kind:"artifact",title:Rt.title,artifactId:Rt.artifactId,workspaceActions:Rt.workspaceActions??V};return Rt.previewContent!==void 0&&(Ie=!0),Rt.workspaceActions||(Ie=!0),Jt});return Ie?at:be})},[]),Po=h.useMemo(()=>fO(tr,re,_e.workspaceCwd||""),[tr,re,_e.workspaceCwd]),Gi=h.useMemo(()=>mO(tr,Po,_e.workspaceCwd||""),[tr,Po,_e.workspaceCwd]),va=h.useMemo(()=>{let A=[];for(const q of Gi.values())q.length>0&&(A=q);return A},[Gi]),qr=h.useMemo(()=>Ife(tr),[tr]),$s=h.useMemo(()=>new Set(Z??khe),[Z]),[ei,mi]=h.useState(!1),[Ua,ii]=h.useState(!1),wa=h.useRef(!1);h.useLayoutEffect(()=>{wa.current=!1,ii(!1)},[_e.sessionId]);const Zo=h.useRef(ei);Zo.current=ei;const[kt,Qt]=h.useState(null),ir=h.useRef(kt);ir.current=kt;const[wn,er]=h.useState([]),[Rr,gr]=h.useState(null),[Xs,Pi]=h.useState(C7),Wa=h.useRef(null),jd=h.useRef(null),Cc=h.useRef(new Map),w1=h.useRef(_e.sessionId);jd.current={open:ei,tabs:Zn,activeTabId:kt,reviewChanges:wn,selectedReviewPath:Rr,extraArtifacts:ot,width:Xs},h.useEffect(()=>{const A=w1.current;if(A){const ne=jd.current;if(ne&&(Cc.current.set(A,ne),Cc.current.size>rRt)){const be=Cc.current.keys().next().value;be&&Cc.current.delete(be)}}const q=_e.sessionId;w1.current=q;const V=q?Cc.current.get(q):void 0;if(!V){mi(!1),Mn([]),Qt(null),er([]),gr(null),mn([]),zn(new Map),Pi(C7);return}mi(V.open),Mn(V.tabs),Qt(V.activeTabId),er(V.reviewChanges),gr(V.selectedReviewPath),mn(V.extraArtifacts),zn(new Map),Pi(V.width)},[_e.sessionId]);const ec=!!(_e.sessionId&&_e.workspaceCwd)&&((hB=_e.capabilities)==null?void 0:hB.features.includes(U_e))===!0,[Ph,Oh]=h.useState({items:[],loaded:!1}),w0=h.useRef(new Set),Iv=Ph.parentSessionId===_e.sessionId?Ph.items:[],x1=Iv.length===0&&(Ph.parentSessionId!==_e.sessionId||!Ph.loaded),x0=h.useRef(0),$h=h.useCallback(A=>{const q=_e.sessionId;if(!q||!ec)return!1;const V={id:`side-task:draft:${Date.now()}:${++x0.current}`,kind:"side_task",title:de("sideTask.title"),parentSessionId:q,workspaceCwd:_e.workspaceCwd,nameFromFirstPrompt:!0,...A!=null&&A.trim()?{initialPrompt:A.trim()}:{}};return Mn(ne=>[...ne,V]),Qt(V.id),mi(!0),!0},[_e.sessionId,_e.workspaceCwd,ec,de]),Mv=h.useCallback(()=>{$h()||Ht("error",de("sideTask.createFailed"))},[$h,Ht,de]),Rv=h.useCallback(async(A,q,V)=>{const ne=_e.sessionId===q?_e.clientId:void 0,be=await Dt.client.createSideTaskSession(q,{name:V},ne);return await Dt.client.detachSession(be.sessionId,be.clientId).catch(()=>{}),{sessionId:be.sessionId,displayName:be.displayName}},[_e.clientId,_e.sessionId,Dt.client]),Q_=h.useCallback((A,q)=>{let V=vn.current.find(be=>be.id===A);if(Mn(be=>be.map(Ie=>Ie.id===A&&Ie.kind==="side_task"?{...Ie,sessionId:q}:Ie)),!V)for(const be of Cc.current.values()){const Ie=be.tabs.find(at=>at.id===A);if(Ie){V=Ie,be.tabs=be.tabs.map(at=>at.id===A&&at.kind==="side_task"?{...at,sessionId:q}:at);break}}const ne=(V==null?void 0:V.kind)==="side_task"?V:void 0;ne&&(w0.current.add(q),Oh(be=>be.parentSessionId!==ne.parentSessionId||be.items.some(Ie=>Ie.sessionId===q)?be:{...be,items:[...be.items,{sessionId:q,title:ne.title,workspaceCwd:ne.workspaceCwd,updatedAt:new Date().toISOString()}]}))},[]),Bh=h.useCallback((A,q,V=!1)=>{const ne=vn.current.find(Ie=>Ie.id===A&&Ie.kind==="side_task"),be=(ne==null?void 0:ne.kind)==="side_task"?ne.sessionId:void 0;Mn(Ie=>Ie.map(at=>at.id!==A||at.kind!=="side_task"||!V&&at.title===q?at:{...at,title:q,...V?{nameFromFirstPrompt:!1,initialPrompt:void 0}:{}})),be&&Oh(Ie=>({...Ie,items:Ie.items.map(at=>at.sessionId===be?{...at,title:q}:at)}))},[]),zh=h.useCallback(A=>{const q=_e.sessionId;if(!q)return;const V={id:`side-task:${A.sessionId}`,kind:"side_task",title:A.title,sessionId:A.sessionId,parentSessionId:q,workspaceCwd:A.workspaceCwd??_e.workspaceCwd};Mn(be=>be.some(Ie=>Ie.kind==="side_task"&&Ie.sessionId===A.sessionId)?be:[...be,V]);const ne=vn.current.find(be=>be.kind==="side_task"&&be.sessionId===A.sessionId);Qt((ne==null?void 0:ne.id)??V.id),mi(!0)},[_e.sessionId,_e.workspaceCwd]);h.useEffect(()=>{const A=_e.sessionId,q=_e.workspaceCwd;if(!ec||!A||!q){Oh({items:[],loaded:!1});return}if(!ei)return;Oh(ne=>ne.parentSessionId===A?{...ne,loaded:!1}:{parentSessionId:A,items:[],loaded:!1});let V=!1;return Dt.client.listWorkspaceSessions(q,{pageSize:nh,archiveState:"active",sourceType:W_e,sourceId:A}).then(ne=>{if(V)return;const be=ne.map(Ie=>{var at;return{sessionId:Ie.sessionId,title:((at=Ie.displayName)==null?void 0:at.trim())||`${de("sideTask.title")} ${Ie.sessionId.slice(0,8)}`,workspaceCwd:Ie.workspaceCwd||q,updatedAt:Ie.updatedAt||Ie.createdAt}});for(const Ie of be)w0.current.delete(Ie.sessionId);Oh(Ie=>MRt(Ie,A,be,w0.current))}).catch(()=>{V||Oh(ne=>ne.parentSessionId===A?{...ne,loaded:!0}:ne)}),()=>{V=!0}},[_e.sessionId,_e.workspaceCwd,ei,ec,de,Dt.client]);const k1=h.useCallback(()=>{var q;const A=(q=_o.current)==null?void 0:q.getBoundingClientRect().width;return A?Math.max(cb,Xs+A-MC):Math.max(cb,window.innerWidth-MC)},[Xs]),xa=h.useCallback(()=>{var V;const A=((V=_o.current)==null?void 0:V.getBoundingClientRect().width)??window.innerWidth,q=Math.max(cb,A-MC);return Math.min(q,Math.max(C7,Math.round(A*.56)))},[]),n8=h.useCallback((A,q)=>{if(!A)return;const V=fi.find(be=>be.id===A),ne={id:`artifact:${A}`,kind:"artifact",artifactId:A,title:(V==null?void 0:V.title)??"Artifact",...q!==void 0?{previewContent:q}:{}};Mn(be=>be.some(Ie=>Ie.id===ne.id)?be.map(Ie=>Ie.id===ne.id?{...Ie,...ne}:Ie):[...be,ne]),Qt(ne.id),Pi(be=>Zo.current?be:xa()),mi(!0)},[fi,xa]),k0=h.useCallback((A,q,V,ne,be="review")=>{const Ie={id:be,kind:"review",title:de("turnOutputs.review"),changes:A,...q?{selectedPath:q}:{},...V?{workspaceActions:V}:{},...ne?{workspaceCwd:ne}:{}};Mn(at=>at.some(Rt=>Rt.id===Ie.id)?at.map(Rt=>Rt.id===Ie.id?Ie:Rt):[Ie,...at]),Qt(Ie.id),er(A),gr(q??null),Pi(at=>Zo.current?at:xa()),mi(!0)},[xa,de]),_1=h.useCallback(()=>{va.length!==0&&k0(va)},[va,k0]),S1=h.useCallback((A,q,V)=>{const ne={id:V?`scheduled-task:${V}:${A.toolCallId}`:`scheduled-task:${A.toolCallId}`,kind:"scheduled_task",title:de("scheduledTasks.title"),task:A,...q?{workspaceActions:q}:{}};Mn(be=>be.some(Ie=>Ie.id===ne.id)?be.map(Ie=>Ie.id===ne.id?ne:Ie):[...be,ne]),Qt(ne.id),Pi(be=>Zo.current?be:xa()),mi(!0)},[xa,de]),_0=h.useCallback((A,q,V)=>{const ne={id:q?`monitor:${q}:${A.id}`:`monitor:${A.id}`,kind:"monitor",title:A.description,task:A,...q?{sessionId:q}:{},...V?{sessionActions:V}:{}};Mn(be=>be.some(Ie=>Ie.id===ne.id)?be.map(Ie=>{if(Ie.id!==ne.id||Ie.kind!=="monitor")return Ie;const at=mX(Ie.task,A);return{...ne,title:at.description,task:at}}):[...be,ne]),Qt(ne.id),Pi(be=>Zo.current?be:xa()),mi(!0)},[xa]),C1=h.useCallback((A,q,V)=>{const ne={id:q?`shell:${q}:${A.id}`:`shell:${A.id}`,kind:"shell",title:A.command,task:A,...q?{sessionId:q}:{},...V?{sessionActions:V}:{}};Mn(be=>be.some(Ie=>Ie.id===ne.id)?be.map(Ie=>{if(Ie.id!==ne.id||Ie.kind!=="shell")return Ie;const at=pX(Ie.task,A);return{...ne,title:at.command,task:at}}):[...be,ne]),Qt(ne.id),Pi(be=>Zo.current?be:xa()),mi(!0)},[xa]),hm=h.useCallback((A,q,V)=>{var at;const ne=A.rawOutput&&typeof A.rawOutput=="object"?A.rawOutput:void 0,be=(typeof((at=A.args)==null?void 0:at.subagent_type)=="string"?A.args.subagent_type:void 0)??(typeof(ne==null?void 0:ne.subagentName)=="string"?ne.subagentName:void 0),Ie={id:`subagent:${q}:${A.callId}`,kind:"subagent",title:A.title||be||de("agent.label"),sessionId:q,rootToolCallId:A.callId,rootTool:A,...V?{workspaceCwd:V}:{}};Mn(Rt=>Rt.some(Jt=>Jt.id===Ie.id)?Rt.map(Jt=>Jt.id===Ie.id?Ie:Jt):[...Rt,Ie]),Qt(Ie.id),Pi(Rt=>Zo.current?Rt:xa()),mi(!0)},[xa,de]),Dv=h.useCallback(A=>{_e.sessionId&&hm(A,_e.sessionId,_e.workspaceCwd)},[_e.sessionId,_e.workspaceCwd,hm]),Lv=h.useCallback(A=>{if(!_e.sessionId)return;Zo.current||(wa.current=!0);const q=A.toolUseId?PRt(hr,A.toolUseId):void 0;hm(q??DRt(A),_e.sessionId,_e.workspaceCwd)},[_e.sessionId,_e.workspaceCwd,hr,hm]),S0=h.useCallback(A=>{if(ie){ie(A);return}if(A.kind==="review"){k0(A.changes,A.selectedPath,A.workspaceActions,A.workspaceCwd,A.sourceSessionId?`review:${A.sourceSessionId}:${A.turnId}`:void 0);return}if(A.kind==="scheduled_task"){S1(A.task,A.workspaceActions,A.sourceSessionId);return}if(A.kind==="subagent"){hm(A.tool,A.sessionId,A.workspaceCwd);return}(!A.workspaceActions||A.sourceSessionId)&&mn(V=>{const ne=V.findIndex(Ie=>Ie.id===A.artifact.id);if(ne<0)return[...V,A.artifact];const be=[...V];return be[ne]=A.artifact,be});const q={id:A.sourceSessionId?`${A.sourceSessionId}:${A.id}`:A.id,kind:"artifact",title:A.title,artifactId:A.artifactId,...A.workspaceActions?{workspaceActions:A.workspaceActions}:{},...A.previewContent!==void 0?{previewContent:A.previewContent}:{}};Mn(V=>V.some(ne=>ne.id===q.id)?V.map(ne=>ne.id===q.id?{...ne,...q}:ne):[...V,q]),Qt(q.id),Pi(V=>Zo.current?V:xa()),mi(!0)},[xa,ie,k0,S1,hm]),J_=h.useCallback((A,q,V)=>{const ne=_he(A),be={id:`file:${V??""}:${A.path}`,kind:"file",title:V6(A.path,V),workspacePath:A.path,workspaceActions:q,...ne!==void 0?{previewContent:ne}:{}};Mn(Ie=>Ie.some(at=>at.id===be.id)?Ie.map(at=>at.id===be.id?be:at):[...Ie,be]),Qt(be.id)},[]),C0=h.useCallback(()=>{mi(!1),Oh(A=>A.items.length===0?{...A,loaded:!1}:A)},[]);h.useLayoutEffect(()=>{if(!ei)return;const A=()=>{Pi(ne=>{var at;const be=((at=_o.current)==null?void 0:at.getBoundingClientRect().width)??window.innerWidth-ne,Ie=Math.max(cb,ne+be-MC);return Math.min(ne,Ie)})};A(),window.addEventListener("resize",A);const q=_o.current,V=new ResizeObserver(A);return q&&V.observe(q),()=>{window.removeEventListener("resize",A),V.disconnect()}},[ei]);const Yu=h.useCallback(A=>{Mn(q=>{const V=q.filter(ne=>ne.id!==A);if(V.length===0)return mi(!1),Qt(null),er([]),gr(null),mn([]),zn(new Map),V;if(ir.current===A){const ne=q.findIndex(Ie=>Ie.id===A),be=V[Math.min(ne,V.length-1)]??V[0];Qt(be.id)}return V})},[]),r8=h.useCallback(A=>{A.preventDefault();const q=A.currentTarget;q.setPointerCapture(A.pointerId);const V=A.clientX,ne=Xs,be=k1(),Ie=document.body.style.cursor,at=document.body.style.userSelect;let Rt=ne,Jt=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const vt=()=>{Jt=null,Pi(Rt)},_t=Bs=>{Rt=Math.min(be,Math.max(cb,ne-(Bs.clientX-V))),Jt===null&&(Jt=window.requestAnimationFrame(vt))};let Rn=()=>{};const or=Bs=>{Wa.current=null,Jt!==null&&(window.cancelAnimationFrame(Jt),Jt=null),Bs&&Pi(Rt),q.hasPointerCapture(A.pointerId)&&q.releasePointerCapture(A.pointerId),document.body.style.cursor=Ie,document.body.style.userSelect=at,window.removeEventListener("pointermove",_t),window.removeEventListener("pointerup",Rn),window.removeEventListener("pointercancel",Rn)};Rn=()=>or(!0),Wa.current=()=>or(!1),window.addEventListener("pointermove",_t),window.addEventListener("pointerup",Rn),window.addEventListener("pointercancel",Rn)},[Xs,k1]);h.useEffect(()=>()=>{var A;return(A=Wa.current)==null?void 0:A.call(Wa)},[]);const s8=h.useMemo(()=>UN(Xn),[Xn]),Va=gMt(s8),T0=!(_e.catchingUp&&et!==null),E0=kR(Va)&&T0?Va:null,fm=Va&&!kR(Va)&&T0?Va:null,T1=h.useRef(Va);T1.current=T0?Va:null;const ka=fm!==null||E0!==null,Pv=h.useRef(ka);Pv.current=ka||T0&&UN(Xn)!==null;const Ov=h.useMemo(()=>Mnt(hr),[hr]),$v=h.useRef(null),Z_=h.useMemo(()=>{const A=Dnt(hr),q=$v.current;if(q&&q.signature===A)return q.timeline;const V=Rnt(hr);return $v.current={signature:A,timeline:V},V},[hr]),Bv=h.useRef(null),eS=h.useMemo(()=>{const A=Lnt(hr),q=Bv.current;if(q&&q.signature===A)return q.details;const V=Fnt(hr);return Bv.current={signature:A,details:V},V},[hr]),zv=bMt(Ov.todos,A=>`${A.id}:${A.status}:${A.content}`),tS=Ov.allCompleted,[nS,rS]=h.useState("hidden"),E1=_e.catchingUp||zv.length===0||tS?"hidden":"active";E1!==nS&&rS(E1);const A0=E1!=="hidden",Fv=I??dRt,j0=A0||Fv.length>0,mm=h.useRef(null),qv=h.useRef(null),[au,N0]=h.useState(null),Q=h.useRef(new Set),De=h.useRef(null),[Ve,Qe]=h.useState(0),[Tt,$n]=h.useState(0);h.useLayoutEffect(()=>{if(!j0){Qe(0),$n(0);return}const A=De.current;if(!A){Qe(uX),$n(0);return}const q=()=>{const ne=mm.current,be=A.getBoundingClientRect(),Ie=ne==null?void 0:ne.getBoundingClientRect(),at=Math.ceil(be.height),Rt=Ie?Math.max(0,Ie.top-be.top):at+cX;$n(at),Qe(Math.max(uX,Math.ceil(Rt)))};if(q(),typeof ResizeObserver>"u")return;const V=new ResizeObserver(q);return V.observe(A),mm.current&&V.observe(mm.current),()=>V.disconnect()},[j0]);const Hn=h.useMemo(()=>({"--web-shell-bottom-panel-inset":`${Ve}px`,"--web-shell-bottom-panel-height":`${Tt}px`,"--web-shell-bottom-panel-gap":`${cX}px`}),[Tt,Ve]),Dr=h.useMemo(()=>IRt(hr),[hr]),[wr,Ga]=h.useState(0),ml=mMt(_e.sessionId,Dr,_e.status==="connected",wr),Oi=h.useMemo(()=>LRt(hr,ml),[hr,ml]),lu=h.useMemo(()=>ml.filter(A=>A.kind!=="agent"),[ml]),Fh=h.useRef(_e.sessionId);Fh.current=_e.sessionId;const pl=h.useCallback(async A=>{const q=Fh.current;if(!q)return!1;try{const V=await zt.getTasks();if(Fh.current!==q||V.sessionId!==q)return!1;const ne=Nhe(V.tasks,A);return ne?(Ga(be=>be+1),_0(ne),!0):!1}catch{return!1}},[_0,zt]);h.useEffect(()=>{const A=new Map(lu.filter(q=>q.kind==="monitor").map(q=>[q.id,q]));A.size!==0&&Mn(q=>{let V=!1;const ne=q.map(be=>{if(be.kind!=="monitor"||be.sessionId&&be.sessionId!==_e.sessionId)return be;const Ie=A.get(be.task.id);if(!Ie||Ie===be.task)return be;const at=mX(be.task,Ie);return at===be.task?be:(V=!0,{...be,title:at.description,task:at})});return V?ne:q})},[lu,_e.sessionId]),h.useEffect(()=>{const A=new Map(lu.filter(q=>q.kind==="shell").map(q=>[q.id,q]));A.size!==0&&Mn(q=>{let V=!1;const ne=q.map(be=>{if(be.kind!=="shell"||be.sessionId&&be.sessionId!==_e.sessionId)return be;const Ie=A.get(be.task.id);if(!Ie||Ie===be.task)return be;const at=pX(be.task,Ie);return at===be.task?be:(V=!0,{...be,title:at.command,task:at})});return V?ne:q})},[lu,_e.sessionId]);const cu=h.useMemo(()=>G?lu.map(ORt):[],[lu,G]),Nd=h.useRef(null),pm=h.useRef(null),ti=h.useRef(null),sS=h.useRef(null),[Hv,Uv]=h.useState(!1),Qs=h.useRef(null),ea=h.useRef(!1),uu=h.useCallback((A="smooth")=>{requestAnimationFrame(()=>{var q;(q=pm.current)==null||q.scrollToBottom(A),requestAnimationFrame(()=>{var V;(V=pm.current)==null||V.scrollToBottom(A)})})},[]),iS=h.useCallback(A=>{ti.current=A,hX(Oe,A??lX),A&&sS.current!==A&&(sS.current=A,Mt==null||Mt(A))},[Oe,Mt]);h.useEffect(()=>{hX(Oe,ti.current??lX)},[Oe]);const[I0,gm]=h.useState(null),[M0,SO]=h.useState(!1),i8=h.useRef(!1),CO=h.useRef(null);CO.current=I0;const{followupState:Ome,onAcceptFollowup:$me,onDismissFollowup:Bme,clear:TO}=uee({onAccept:A=>{var q;(q=ti.current)==null||q.insertText(A)}}),o8=h.useRef(""),[zme,Fme]=h.useState(null),[oS,Wv]=h.useState(!1),es=c5();h.useEffect(()=>{Ms&&(Ms.sessionId!==_e.sessionId||es==="idle"&&Ms.settled)&&Lo(null)},[_e.sessionId,Ms,es]);const a8=!!(Ms&&Ms.sessionId===_e.sessionId&&(!Ms.admitted||Ms.settled)),R0=h.useRef(es),Xu=h.useRef([]),D0=h.useRef(0),aS=h.useRef(!1),Vv=h.useRef(!1),l8=h.useRef(Date.now()),EO=h.useRef(es);EO.current==="idle"&&es!=="idle"&&(l8.current=Date.now()),EO.current=es;const AO=h.useMemo(()=>{if(es!=="idle"){for(let A=tr.length-1;A>=0;A--){const q=tr[A];if((q==null?void 0:q.role)==="user")return q.timestamp??l8.current}return l8.current}},[tr,es]),A1=h.useRef(""),lS=h.useRef(void 0),Gv=h.useRef(null),Kv=h.useRef(null),[c8,cS]=h.useState(!1),u8=h.useRef(c8);u8.current=c8;const qh=_e.status==="connected",_a=Nh(),[Yv,qme]=h.useState([]),[d8,Hme]=h.useState(!1),jO=h.useRef(0),uS=h.useCallback(async A=>{const q=++jO.current;try{const V=A&&Dt.client?await Dt.client.workspaceByCwd(A).workspaceSkills():await Gt.loadSkillsStatus();if(q!==jO.current)return;qme(iRt(V)),Hme(!0)}catch{return}},[Dt.client,Gt]);h.useEffect(()=>{qh&&uS(_e.workspaceCwd)},[qh,_e.workspaceCwd,uS]);const[Ki,Qu]=h.useState(null),NO=h.useRef(Ki),[Tc,Xv]=h.useState("workspace"),[bm,dS]=h.useState(!1),IO=h.useRef(bm),[Ume,Wme]=h.useState([]),[j1,N1]=h.useState(!1),[MO,h8]=h.useState(!1),[RO,f8]=h.useState(!1),[DO,m8]=h.useState(!1),[LO,p8]=h.useState(!1),[PO,g8]=h.useState(!1),[OO,b8]=h.useState(!1),[$O,BO]=h.useState(!1),[ym,vm]=h.useState(void 0),[Or,So]=h.useState("chat"),zO=h.useRef(Or),FO=!Cn||Or==="split",[Hh,y8]=h.useState([]),v8=h.useRef(Hh);v8.current=Hh;const[hS,w8]=h.useState(null),[Gn,Uh]=h.useState(null),x8=h.useRef(Gn),Co=h.useCallback(()=>Uh(null),[]),qO=h.useCallback(A=>{Co(),window.setTimeout(()=>{var q,V;(q=ti.current)==null||q.setText(`/${A} `),(V=ti.current)==null||V.focus()},0)},[Co]),gl=h.useCallback(A=>{So("chat"),Uh(A)},[]),Vme=h.useCallback(async()=>{const A=await Gt.loadMcpStatus();w8({status:A,toolsByServer:{},resourcesByServer:{},showDescriptions:!1,showSchema:!1,showTips:!1})},[Gt]),k8=h.useCallback(()=>{Uh(null),So("scheduledTasks")},[]),I1=h.useCallback(()=>{Uh(null),So("goals")},[]),HO=h.useCallback(()=>{ve.enabled&&(Uh(null),So("chat"),He(!0),qn(!0))},[ve.enabled]),L0=h.useCallback(A=>{Uh(null),y8(q=>{const V=Array.from(new Set((A??[]).filter(Boolean))).slice(0,Cp);return V.length>0?V:q.length>0?q:_e.sessionId?[_e.sessionId]:[]}),So("split")},[_e.sessionId]),_8=h.useMemo(()=>Array.from(new Set((W??[]).filter(Boolean))).slice(0,Cp).join("\0"),[W]),bl=W!==void 0,Id=h.useRef(K);Id.current=K;const UO=h.useCallback(()=>{var q;if(!bl){L0();return}const A=Hh.length>0?Hh:_e.sessionId?[_e.sessionId]:[];(q=Id.current)==null||q.call(Id,A)},[_e.sessionId,bl,L0,Hh]);h.useEffect(()=>{if(!bl)return;const A=_8?_8.split("\0"):[];y8(q=>xRt(q,A)?q:A),A.length>0?(Uh(q=>q===null?q:null),So(q=>q==="split"?q:"split")):So(q=>q==="split"?"chat":q)},[bl,_8]);const Gme=h.useCallback(A=>{var q;bl||y8(A),(q=Id.current)==null||q.call(Id,A)},[bl]),fS=h.useCallback(()=>{var A;bl&&((A=Id.current)==null||A.call(Id,[]))},[bl]),Kme=h.useCallback(()=>{fS(),mxt(),gl("sessions")},[fS,gl]);h.useEffect(()=>{const A=dxt(window.location.search);if(A.length>0){const V=new URL(window.location.href);V.searchParams.delete("split"),window.history.replaceState(null,"",V),bl||L0(A);return}if(bl)return;const q=fxt();q.length>0&&L0(q)},[bl,L0]),h.useEffect(()=>{bl||Or==="split"&&Hh.length>0&&hxt(Hh)},[Or,Hh,bl]);const S8=h.useRef(!1),C8=h.useRef(!1);h.useEffect(()=>{if(Yt){C8.current&&(C8.current=!1,!bl&&v8.current.length>0&&So(A=>A==="chat"?"split":A));return}if(Gn==="sessions"&&Uh(null),Or==="split"&&(fS(),So("chat"),S8.current=!0,!bl)){C8.current=!0;const A=v8.current[0];A&&!lo.current&&zt.loadSession(A).catch(()=>{})}},[Yt,Gn,Or,fS,bl,zt]),h.useEffect(()=>{var A;Or!=="chat"||!S8.current||(S8.current=!1,!Gn&&!ka&&((A=ti.current)==null||A.focus()))},[Or,Gn,ka]);const WO=h.useRef(null),mS=h.useRef(null),T8=h.useRef(null),VO=h.useRef(Gn),GO=h.useRef(ka);h.useEffect(()=>{var V,ne,be,Ie,at;const A=VO.current,q=GO.current;if(VO.current=Gn,GO.current=ka,Gn){if(Gn==="extensions"||Gn==="channels"){(V=mS.current)==null||V.focus();return}if(Gn==="plugins"){(ne=T8.current)==null||ne.focus();return}(be=WO.current)==null||be.focus()}else A?ka||(Ie=ti.current)==null||Ie.focus():q&&!ka&&((at=ti.current)==null||at.focus())},[Gn,ka]),h.useEffect(()=>{ka&&(Gn&&Uh(null),Ki&&Qu(null),j1&&N1(!1),(Or==="scheduledTasks"||Or==="goals")&&So("chat"))},[ka,Gn,Ki,j1,Or]);const Yme=fm!==null&&!Gn&&Ki===null&&!j1&&Or==="chat",Xme=E0!==null&&!Gn&&Ki===null&&!j1&&Or==="chat",[KO,YO]=h.useState(!1),[Wh,E8]=h.useState(!1),XO=h.useRef(Wh),[Qme,Jme]=h.useState(0),[Zme,epe]=h.useState(0),[tpe,QO]=h.useState(0),npe=h.useCallback(()=>{let A=!1;return QO(q=>q+1),()=>{A||(A=!0,QO(q=>Math.max(0,q-1)))}},[]),JO=h.useRef((_a==null?void 0:_a.extensionsVersion)??0);h.useEffect(()=>{const A=(_a==null?void 0:_a.extensionsVersion)??0;if(A!==JO.current){JO.current=A;const q=_a==null?void 0:_a.lastExtensionChange;if((q==null?void 0:q.status)==="failed"){At.dispatch([{type:"error",text:de("extensions.action.failed",{name:q.name??"",source:q.source??"",error:q.error??de("error.unknown")})}]);return}if((q==null?void 0:q.status)==="installed"){const V=q.name??q.source??de("extensions.label");At.dispatch([{type:"status",text:q.version?de("extensions.install.installedWithVersion",{name:V,version:q.version}):de("extensions.install.installed",{name:V})}])}else if(q!=null&&q.status){const V=q.name??q.source??de("extensions.label"),ne=q.status==="updated"&&q.version?"extensions.manage.updatedWithVersion":`extensions.manage.${q.status}`;At.dispatch([{type:"status",text:de(ne,{name:V,version:q.version??""})}])}zt.refreshCommands().catch(()=>{At.dispatch([{type:"error",text:de("extensions.commands.refreshFailed")}])})}},[_a==null?void 0:_a.extensionsVersion,_a==null?void 0:_a.lastExtensionChange,zt,At,de]);const[rpe,spe]=h.useState("workspace"),[ipe,Qv]=h.useState(null),[ope,ZO]=h.useState(!1),[ape,e$]=h.useState(!1),pS=h.useRef(null),M1=h.useRef(null),[A8,R1]=h.useState(null),j8=h.useCallback(A=>{R1(null),Ga(q=>q+1),_0(A)},[_0]),t$=h.useCallback(A=>{R1(null),Ga(q=>q+1),C1(A)},[C1]),[Vh,N8]=h.useState(n??Fs.Dark),[Gh,n$]=h.useState(""),gS=h.useRef(Gh);gS.current=Gh;const D1=h.useCallback(A=>{gS.current=A,n$(A)},[]),sr=h.useRef(_e);sr.current=_e;const r$=h.useCallback(async()=>{var q;const A=sr.current;if(!(!A.sessionId||!A.workspaceCwd))try{const V=await Dt.client.listWorkspaceSessions(A.workspaceCwd,{pageSize:200});if(sr.current.sessionId!==A.sessionId||sr.current.displayName)return;const ne=(q=V.find(be=>be.sessionId===A.sessionId))==null?void 0:q.displayName;ne!=null&&ne.trim()&&Xt(ne)}catch{}},[Dt.client]),s$=h.useRef(r$);s$.current=r$;const ta=h.useCallback(()=>sr.current.sessionId?!0:(Ht("info",de("localCommand.noSession")),!1),[Ht,de]),Jv=_e.displayName??lt,[Ec,I8]=h.useState("default"),M8=h.useRef(Ec);M8.current=Ec;const Zv=h.useCallback(A=>{M8.current=A,I8(A)},[]),[R8,Kh]=h.useState(!1),ew=h.useRef(null),bS=h.useRef(null),[yS,tw]=h.useState({mode:"current"}),nw=h.useRef(yS);h.useEffect(()=>{nw.current=yS},[yS]);const i$=h.useRef(0),Md=h.useRef(null),o$=h.useRef(t);o$.current=t;const vS=h.useRef(void 0);h.useEffect(()=>{Or!=="goals"&&(vS.current=void 0)},[Or]);const wS=h.useCallback(()=>{const A=sr.current.sessionId;if(ew.current)return!A||A===bS.current?ew.current:Promise.resolve(void 0);if(A)return Promise.resolve(void 0);const q=(async()=>{var vt,_t;let ne;const be=gS.current||sr.current.currentModel,Ie=M8.current||sr.current.currentMode,at=(vt=Vn.find(Rn=>Rn.primary))==null?void 0:vt.cwd,Rt=xs.current,Jt=Rt?(_t=Vn.find(Rn=>Rn.cwd===Rt&&Rn.trusted===!0))==null?void 0:_t.cwd:void 0;return await Wkt({sessionActions:zt,modelId:be,modeId:Ie,workspaceCwd:Ze??Jt??at,worktree:nw.current.mode==="worktree"?{slug:nw.current.slug}:void 0,branch:nw.current.mode==="branch"?{name:nw.current.name}:void 0,onSessionCreated:o$.current,onSessionAllocated:Rn=>{bS.current=Rn,ne=Rn},getCurrentSessionId:()=>sr.current.sessionId}).then(Rn=>{Rn.worktree&&Ks(Rn.worktree),Rn.branch&&je(Rn.branch),tw({mode:"current"})}),xr(void 0),ne})();ew.current=q;const V=()=>{ew.current===q&&(ew.current=null,bS.current=null)};return q.then(V,V),q},[Ze,zt,Vn]),Yh=h.useRef(Ee);Yh.current=Ee;const a$=h.useRef(b);a$.current=b;const L1=h.useCallback(()=>{var A;return sr.current.sessionId?sr.current.workspaceCwd:Ze??xs.current??((A=ji.current.find(q=>q.primary))==null?void 0:A.cwd)},[Ze]),[l$,c$]=h.useState(0),rw=h.useRef(null);h.useEffect(()=>()=>{rw.current!==null&&clearTimeout(rw.current)},[]);const P1=h.useCallback(()=>{rw.current!==null&&clearTimeout(rw.current),rw.current=setTimeout(()=>{c$(A=>A+1),s$.current()},2e3)},[]),u$=h.useCallback(A=>{ue==null||ue(A),c$(q=>q+1),A.type==="turn_complete"&&P1()},[ue,P1]),na=h.useRef(u$);na.current=u$;const Ka=h.useCallback(async(A,q,V)=>{var Ta,Ya;const ne=!A.trimStart().startsWith("/"),be=A1.current,Ie=lS.current,at=Kv.current,Rt=u8.current,Jt=()=>{Kh(!1),A1.current=be,lS.current=Ie,Kv.current=at,cS(Rt)};!(V!=null&&V.retry)&&ne&&(A1.current=A,lS.current=q,Kv.current=null),cS(!1);const vt=!sr.current.sessionId;if(Yh.current){const Yi=sr.current.sessionId,Xa=L1(),Qa=Yn.current;Kh(!0);try{await Yh.current({sessionId:Yi,prompt:A})}catch(Ja){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",Ja),Jt();return}if(sr.current.sessionId!==Yi||L1()!==Xa||Yn.current!==Qa){Jt();return}vt||Kh(!1)}!Yh.current&&vt&&Kh(!0),TO();let _t;try{_t=await wS()}finally{vt&&Kh(!1)}const Rn={images:q,inputAnnotations:V==null?void 0:V.inputAnnotations,optimisticUserMessage:V==null?void 0:V.optimisticUserMessage,retry:V==null?void 0:V.retry,...V!=null&&V.onAdmitted?{onAdmitted:V.onAdmitted}:{}};V!=null&&V.commitComposerAccepted?V.commitComposerAccepted():V!=null&&V.clearComposerOnPromptStart&&((Ta=ti.current)==null||Ta.clear());const or=sr.current.sessionId??_t;or&&A.trim()&&((Ya=na.current)==null||Ya.call(na,{type:"submit",sessionId:or,prompt:A,queued:!1}),P1());const Bs=V!=null&&V.onOptimisticUserMessage?E7(At.getSnapshot().blocks):void 0,Si=zt.sendPrompt(A,Rn);if(or&&(V==null?void 0:V.optimisticUserMessage)!==!1&&(V!=null&&V.onOptimisticUserMessage)){const Yi=E7(At.getSnapshot().blocks);Yi&&Yi!==Bs&&V.onOptimisticUserMessage({sessionId:or,messageId:Yi})}return await Si},[TO,wS,L1,P1,zt,At]),lpe=h.useCallback(async(A,q)=>{try{if(!q){const ne=(fn==null?void 0:fn.path)??Lt;if(_e.sessionId&&ne===A)return _e.sessionId;const be=await Dt.client.workspaceByCwd(A).listWorkspaceSessions({pageSize:1,archiveState:"active"});if(be.length>0)return be[0].sessionId}return(await zt.createSession({workspaceCwd:A})).sessionId}catch{return}},[_e.sessionId,Lt,Dt.client,zt,fn]),cpe=h.useMemo(()=>(_e.models??[]).filter(yx).map(A=>({id:A.id,label:lp(A.label||A.id)})),[_e.models]),Sa=Lt,xS=!!(!_e.sessionId&&((fB=Vn.find(A=>A.cwd===Lt))!=null&&fB.trusted)&&(nn!=null&&nn.branch));h.useEffect(()=>{xS||tw({mode:"current"})},[xS]);const d$=h.useCallback(()=>{Sa&&vm({workspaceCwd:Sa,gitCwd:fn==null?void 0:fn.path,view:"diff"})},[Sa,fn==null?void 0:fn.path]),h$=h.useCallback(()=>{Sa&&vm({workspaceCwd:Sa,gitCwd:fn==null?void 0:fn.path,view:"commit"})},[Sa,fn==null?void 0:fn.path]),Ju=MO||RO||DO||LO||PO||OO||$O||ym!==void 0||Ki!==null||j1||A8!==null||hS!==null||KO||Wh||ws||cr!=="clear"||tpe>0||Gn!==null||Or!=="chat",Ar=h.useMemo(()=>{var A;return Rhe({capabilities:Dt.capabilities,intendedCwd:Lt,sessionId:_e.sessionId,workspaces:(A=Dt.capabilities)!=null&&A.workspaces||Et?Vn:void 0})},[Lt,_e.sessionId,Et,Dt.capabilities,Vn]),[kS,upe]=h.useState(0),[D8,dpe]=h.useState({}),f$=h.useMemo(()=>({user:kS,workspace:Ar?D8[Ar.workspaceKey]??0:0}),[Ar,kS,D8]),P0=hC(Ar,((mB=Dt.capabilities)==null?void 0:mB.features)??[]),hpe=(Ar==null?void 0:Ar.sessionId)===_e.sessionId&&(!(Ar!=null&&Ar.cwd)||Ar.cwd===_e.workspaceCwd)?_a==null?void 0:_a.settingsVersion:void 0,{descriptor:_S,reload:sw}=tlt(Dt.client,Ar,P0&&Or!=="split",JSON.stringify([kS,f$.workspace,hpe??null])),sn=h.useCallback((A,q)=>{if(A7(A)||EZ(A)||ub(A))return;const V=_Rt(A,q);console.error("[web-shell]",V,A),Ht("error",V)},[Ht]),fpe=h.useCallback(()=>{const A=Vi.current;if(!A||A.sessionId!==sr.current.sessionId){Ys(null);return}Ys(null);const q=Date.now();Lo({sessionId:A.sessionId,messageId:A.messageId,startedAt:q,admitted:!1,settled:!1});let V=!1;Ka(A.text,A.images,{optimisticUserMessage:!1,inputAnnotations:A.inputAnnotations,onAdmitted:()=>{V=!0,Lo(ne=>(ne==null?void 0:ne.sessionId)===A.sessionId&&ne.messageId===A.messageId?{...ne,admitted:!0}:ne)}}).catch(ne=>{!V&&sr.current.sessionId===A.sessionId&&E7(At.getSnapshot().blocks)===A.messageId&&Ys(A),sn(ne,"Failed to resend message")}).finally(()=>{Lo(ne=>(ne==null?void 0:ne.sessionId)===A.sessionId&&ne.messageId===A.messageId?{...ne,settled:!0}:ne)})},[sn,Ka,At,Ys]),mpe=h.useCallback(A=>Ht("success",A),[Ht]),{queuedPrompts:ppe,queuedTexts:gpe,enqueuePrompt:L8,removeQueuedPrompt:bpe,insertQueuedPrompt:ype,editQueuedPrompt:vpe,editLastQueuedPrompt:wpe,clearQueuedPrompts:xpe}=bfe({connected:qh,sessionId:_e.sessionId,clientId:_e.clientId,streamingState:es,sessionActions:zt,store:At,editorRef:ti,reportError:sn,notifySuccess:mpe,t:de}),O0=h.useCallback((A,q,V,ne,be)=>{var Rt;if(Yh.current){const Jt=sr.current.sessionId,vt=L1(),_t=Yn.current;return Yh.current({sessionId:Jt,prompt:A}).then(()=>{var or,Bs;if(sr.current.sessionId!==Jt||L1()!==vt||Yn.current!==_t)return;L8(A,q,V,be)!==!1&&(ne?ne():(or=ti.current)==null||or.clear()),Jt&&A.trim()&&((Bs=na.current)==null||Bs.call(na,{type:"submit",sessionId:Jt,prompt:A,queued:!0}))}).catch(Rn=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",Rn)}),!1}const Ie=L8(A,q,V,be),at=sr.current.sessionId;return at&&A.trim()&&((Rt=na.current)==null||Rt.call(na,{type:"submit",sessionId:at,prompt:A,queued:!0})),Ie},[L1,L8]);h.useEffect(()=>{for(const A of wo)SRt(A)?Ht(CRt(A),A.message):A.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",A),Ps(A.id)},[Ps,wo,Ht]);const P8=h.useRef(m);P8.current=m,h.useEffect(()=>{var A;lo.current=_e.sessionId,(A=ko.current)==null||A.abort(),ko.current=null,Ss(null),pr(null),R1(null),NS.current=0},[_e.sessionId]);const m$=h.useCallback(()=>{var be;if(!ta())return;const A=`local-recap-${xo.current++}`,q=hr.length,V=(be=hr.at(-1))==null?void 0:be.id,ne=_e.sessionId;Ss({anchorAfterId:V,anchorIndex:q,message:{id:A,role:"system",content:`※ ${de("recap.label")}: ${de("recap.loading")}`,variant:"info",source:"recap"}}),zt.recapSession().then(Ie=>{lo.current===ne&&Ss({anchorAfterId:V,anchorIndex:q,message:{id:A,role:"system",content:Ie.recap?`※ ${de("recap.label")}: ${Ie.recap}`:de("recap.empty"),variant:"info",source:"recap"}})},Ie=>{lo.current===ne&&(Ss(null),!A7(Ie)&&!ub(Ie)&&console.warn("[web-shell] unhandled recap failure",Ie))})},[_e.sessionId,hr,ta,zt,de]),p$=h.useCallback(A=>{var Ie;const q=A.trim();if(!q){Ht("error",de("btw.empty"));return}if(!ta())return;const V=`local-btw-${Qo.current++}`,ne=_e.sessionId;(Ie=ko.current)==null||Ie.abort();const be=new AbortController;ko.current=be,pr({id:V,role:"btw",question:q,answer:"",isPending:!0}),zt.btwSession(q,{signal:be.signal}).then(at=>{lo.current===ne&&ko.current===be&&(ko.current=null,pr({id:V,role:"btw",question:q,answer:at.answer||de("btw.emptyAnswer"),isPending:!1}))},at=>{lo.current===ne&&ko.current===be&&(ko.current=null,pr(null),!A7(at)&&!ub(at)&&console.warn("[web-shell] unhandled btw failure",at))})},[_e.sessionId,Ht,ta,zt,de]),g$=h.useCallback(()=>{var A;(A=ko.current)==null||A.abort(),ko.current=null,pr(null)},[]);h.useEffect(()=>{const A=q=>{var at;if(Ju||Va)return;const V=Li;if(!V||V.role!=="btw")return;const ne=q.key.toLowerCase(),be=q.key==="Escape"&&!q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey,Ie=q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey&&(ne==="c"||ne==="d");if(V.isPending){if(!be&&!Ie)return}else{const Rt=((at=ti.current)==null?void 0:at.hasInput())??!1;if(!(!q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey&&(q.key==="Escape"||!Rt&&(q.key==="Enter"||q.key===" "))))return}q.preventDefault(),q.stopPropagation(),g$()};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[Ju,Li,g$,Va]);const Xh=h.useCallback((A,q)=>Fkt(R0.current!=="idle",A,q,{append:V=>At.appendLocalUserMessage(V)}),[At]),Rd=h.useCallback(()=>(Ht("error",de("queue.commandBlocked")),!1),[Ht,de]),iw=h.useCallback(A=>{N8(A),r==null||r(A)},[r]),O1=h.useCallback(A=>{Ae(A),i==null||i(A)},[i]),b$=h.useCallback(()=>{g8(!0)},[]),y$=Q9({autoLoad:!0}),SS=Iwe({autoLoad:!0}),CS=SS.reload,[kpe,TS]=h.useState(!1),{settings:du,setValue:Zu,reload:Ac}=y$,_pe=h.useCallback(async()=>{const A=await Ac();return(Ar==null?void 0:Ar.route)==="workspace-qualified"&&await sw(),A},[Ar==null?void 0:Ar.route,sw,Ac]),v$=h.useMemo(()=>{const A=du.filter(V=>V.key!=="voiceModel");return Or==="split"?A:(Ar==null?void 0:Ar.route)==="legacy-primary"?du:!P0||!_S?A:du.findIndex(V=>V.key==="voiceModel")<0?[...A,_S]:du.map(V=>V.key==="voiceModel"?_S:V)},[Or,Ar==null?void 0:Ar.route,_S,P0,du]),Spe={...y$,settings:v$,reload:_pe},$1=du.find(A=>A.key===mg),B1=du.find(A=>A.key===aRt),z1=du.find(A=>A.key===bT),Cpe=(()=>{const A=RC(v$,Tc,"voiceModel");return typeof A=="string"&&A.trim()?A.trim():void 0})(),Tpe=(()=>{const A=RC(du,Tc,"visionModel");if(!(typeof A!="string"||!A.trim()))return DMt(A.trim())})(),Epe=(()=>{const A=RC(du,Tc,"fastModel");return typeof A=="string"&&A.trim()?A.trim():void 0})(),Ape=h.useMemo(()=>{const A=RC(du,Tc,"modelFallbacks");return typeof A=="string"?A.split(",").map(q=>q.trim()).filter(Boolean):[]},[du,Tc]),O8=h.useCallback((A,q)=>{if(A){if(q==="user"){upe(V=>V+1);return}dpe(V=>({...V,[A.workspaceKey]:(V[A.workspaceKey]??0)+1}))}},[]),ES=h.useCallback(async(A,q,V=Ar)=>{var ne;if(!V||!hC(V,((ne=Dt.capabilities)==null?void 0:ne.features)??[]))throw new Error("Voice model settings are unavailable for this workspace.");try{V.route==="legacy-primary"||q==="user"?await Zu(q,"voiceModel",A):await elt(Dt.client,V,q,A)}catch(be){throw O8(V,q),V.route==="legacy-primary"?await Ac().catch(()=>{}):await sw().catch(()=>{}),be}O8(V,q),V.route==="legacy-primary"?await Ac().catch(()=>{}):await sw().catch(()=>{})},[O8,Ar,sw,Ac,Zu,(pB=Dt.capabilities)==null?void 0:pB.features,Dt.client]),ow=h.useRef(Ar),w$=h.useRef(((gB=Dt.capabilities)==null?void 0:gB.features)??[]);h.useLayoutEffect(()=>{var A;NO.current=Ki,IO.current=bm,zO.current=Or,x8.current=Gn,XO.current=Wh,ow.current=Ar,w$.current=((A=Dt.capabilities)==null?void 0:A.features)??[]},[Gn,Or,Ar,Ki,Wh,bm,(bB=Dt.capabilities)==null?void 0:bB.features]);const wm=h.useRef(0),hu=h.useRef(void 0),x$=h.useRef(void 0),$8=h.useRef(Ar);h.useEffect(()=>()=>{wm.current++,hu.current=void 0},[]);const B8=h.useCallback(async(A,q)=>{var Ie;const V=ow.current;if(!V||!hC(V,((Ie=Dt.capabilities)==null?void 0:Ie.features)??[])){sn(new Error("Voice model settings are unavailable for this workspace."),de("model.setVoice"));return}const ne=++wm.current;hu.current=q,x$.current=V.ownerKey;const be=()=>{var at;return ne===wm.current&&((at=ow.current)==null?void 0:at.ownerKey)===V.ownerKey&&hC(ow.current,w$.current)&&(q==="settings"?x8.current==="settings":x8.current===null)&&zO.current==="chat"&&NO.current===null&&!IO.current&&!XO.current};try{const at=await Jat(Dt.client,V);if(!be()){ne===wm.current&&(hu.current=void 0);return}hu.current=void 0,$8.current=V,Wme(Uat(at)),Xv(A),Qu("voice")}catch(at){if(!be()){ne===wm.current&&(hu.current=void 0);return}hu.current=void 0,sn(at,de("model.setVoice"))}},[sn,de,(yB=Dt.capabilities)==null?void 0:yB.features,Dt.client]);h.useEffect(()=>{hu.current&&(x$.current!==(Ar==null?void 0:Ar.ownerKey)||!P0)&&(wm.current++,hu.current=void 0)},[Ar==null?void 0:Ar.ownerKey,P0]),h.useEffect(()=>{const A=hu.current;A&&!(A==="settings"?Gn==="settings":Gn===null)&&(wm.current++,hu.current=void 0)},[Gn]),h.useEffect(()=>{hu.current&&(Or!=="chat"||Ki!==null||bm||Wh)&&(wm.current++,hu.current=void 0)},[Or,Ki,Wh,bm]),h.useEffect(()=>{const A=$8.current;Ki==="voice"&&((A==null?void 0:A.ownerKey)!==(Ar==null?void 0:Ar.ownerKey)||!P0||Or!=="chat")&&Qu(null)},[Or,Ar==null?void 0:Ar.ownerKey,Ki,P0]);const jpe=h.useMemo(()=>{const A=new Set,q=[];for(const V of(_e.models??[]).filter(yx).filter(ne=>!ne.isRuntime)){const ne=V.baseModelId??oX(V.id);A.has(ne)||(A.add(ne),q.push({baseId:ne,label:lp(V.label||V.baseModelId||V.id)}))}return q},[_e.models]),[AS,k$]=h.useState(!1),z8=h.useRef(AS);z8.current=AS,h.useEffect(()=>{if(n){N8(n);return}const A=cD($1==null?void 0:$1.values.effective);A&&N8(A)},[n,$1==null?void 0:$1.values.effective]),h.useEffect(()=>{if(s!==void 0){Ae(jf(s));return}const A=rD(z1==null?void 0:z1.values.effective);A&&Ae(A)},[s,z1==null?void 0:z1.values.effective]);const Npe=h.useCallback((A,q="user")=>{const V=Je,be=`/language ui ${A}${q==="workspace"?" --project":" --global"}`;O1(A);const Ie=()=>Promise.all([zt.refreshCommands(),Ac()]);if(R0.current!=="idle"){O1(V),Rd();return}Ka(be,void 0).then(Ie).catch(at=>{O1(V),sn(at,"Failed to sync /language command")})},[Rd,O1,Ac,sn,Ka,Je,zt]),_$=h.useCallback(()=>{if(R0.current!=="idle"){At.dispatch([{type:"status",text:de("clear.blocked")}]);return}At.reset()},[At,de]),S$=h.useCallback(()=>{const A=z8.current,q=!z8.current;k$(q),Zu("workspace",oRt,q).catch(V=>{k$(A),sn(V,de("compact.saveFailed"))})},[sn,Zu,de]),xm=h.useCallback(A=>{if(!O3(A)){sn(new Error(`Unsupported approval mode: ${A}`),de("local.approvalMode"));return}if(!sr.current.sessionId){Zv(A);return}zt.setApprovalMode(A).then(q=>{const V=q.mode||A;I8(V);const ne=T1.current;if(!ne)return;if(A==="yolo"||A==="auto-edit"&&ARt(ne)){const Ie=ne.options.find(at=>at.kind==="allow_once");if(Ie){const at=ne.title||"";At.dispatch([{type:"status",text:de("mode.autoApproved",{tool:at})}]),zt.submitPermission(ne.id,Ie.id).catch(Rt=>{sn(Rt,"Failed to auto-approve tool call")})}}}).catch(q=>{sn(q,de("local.approvalMode"))})},[zt,sn,At,de,Zv]);h.useEffect(()=>{R0.current=es},[es]);const C$=h.useRef(_e.sessionId);h.useEffect(()=>{if(C$.current===_e.sessionId)return;C$.current=_e.sessionId;const A=Xu.current.length;Xu.current=[],_e.sessionId!==bS.current&&(D0.current++,Vv.current=!1),A>0&&Ht("warning",de("queue.shellDropped",{count:A}))},[_e.sessionId,Ht,de]);const T$=h.useRef(es);h.useEffect(()=>{const A=T$.current;if(T$.current=es,A==="idle"||es!=="idle"||Vv.current)return;const q=Xu.current;if(q.length===0)return;Xu.current=[],Vv.current=!0;const V=++D0.current,ne=sr.current.sessionId;(async()=>{try{let be=q;for(;be.length>0;){for(let Ie=0;Ie<be.length;Ie++){const at=D0.current!==V;if(at||sr.current.sessionId!==ne||sr.current.status!=="connected"){let Rt=be.length-Ie;at||(Rt+=Xu.current.length,Xu.current=[]),console.warn("[web-shell] dropping %d queued shell command(s)",Rt),Ht("warning",de("queue.shellDropped",{count:Rt}));return}try{await zt.sendShellCommand(be[Ie])}catch(Rt){sn(Rt,`Failed to execute shell command: !${be[Ie]}`)}}be=Xu.current,Xu.current=[]}}finally{D0.current===V&&(Vv.current=!1)}})()},[es,zt,sn,Ht,de]),h.useEffect(()=>{let A=null;for(let V=Xn.length-1;V>=0;V--){const ne=Xn[V];if((ne==null?void 0:ne.kind)==="user")break;if((ne==null?void 0:ne.kind)==="error"&&ne.source==="turn_error"){A=ne.id;break}if((ne==null?void 0:ne.kind)!=="debug")break}const q=qh&&A!==null&&A!==Kv.current&&A1.current.length>0;Gv.current=q?A:null,cS(q)},[Xn,qh]),h.useEffect(()=>{d==null||d(es)},[es,d]);const E$=h.useRef(es),A$=h.useRef(void 0);h.useEffect(()=>{var q;const A=E$.current;if(E$.current=es,es!=="idle"&&(A$.current=sr.current.sessionId),A!=="idle"&&es==="idle"){const V=sr.current.sessionId;if(!V||V!==A$.current)return;const ne=Gv.current!=null?new Error(`Turn error (block ${Gv.current})`):void 0;(q=na.current)==null||q.call(na,{type:"turn_complete",sessionId:V,error:ne})}},[es]),h.useEffect(()=>{u==null||u(_e.status)},[_e.status,u]),h.useEffect(()=>{me==null||me(Xn)},[Xn,me]),h.useEffect(()=>{if(_e.error){const A=new Error(_e.error);f==null||f(A)}},[_e.error,f]),h.useEffect(()=>{n$(_e.currentModel??"")},[_e.currentModel,_e.sessionId]),h.useEffect(()=>{I8(_e.currentMode??"default")},[_e.currentMode,_e.sessionId]),h.useEffect(()=>{const A=ct.current;if(_e.sessionId&&_e.sessionId!==A&&gm(null),ct.current=_e.sessionId,!_e.sessionId&&_e.missingSession){Jo.current=_e.sessionId,Sc.current=void 0,fl.current=void 0;return}const q=Lt??_e.workspaceCwd,V=Vn.find(be=>be.cwd===q);if(_e.sessionId&&!Dt.capabilities)return;const ne=V&&!V.primary?V.id:void 0;Jo.current===_e.sessionId&&Sc.current===ne&&fl.current===q||(Jo.current=_e.sessionId,Sc.current=ne,fl.current=q,e==null||e(_e.sessionId,ne,q))},[_e.missingSession,_e.sessionId,_e.workspaceCwd,e,Lt,Dt.capabilities,Vn]);const j$=h.useRef(void 0),F8=h.useRef(void 0);h.useEffect(()=>{var V;const A=_e.sessionId,q=_e.displayName;if(!(!A||!q)){if(A!==j$.current){j$.current=A,F8.current=q;return}q!==F8.current&&(F8.current=q,(V=na.current)==null||V.call(na,{type:"rename",sessionId:A,newName:q}))}},[_e.sessionId,_e.displayName]),h.useEffect(()=>{const A=uRt(Xn);gm(q=>A?(q==null?void 0:q.condition)===A.condition&&q.setAt===A.setAt?q:A:q&&null)},[Xn]),h.useEffect(()=>{const A=q=>{const V=q.detail;if(!(V!=null&&V.active)){gm(null);return}V.condition&&gm({condition:V.condition,setAt:V.setAt??Date.now()})};return window.addEventListener(oR,A),()=>window.removeEventListener(oR,A)},[]);const jS=h.useRef(null),NS=h.useRef(0);h.useEffect(()=>{NS.current=0},[_e.sessionId]),h.useEffect(()=>{function V(){if(document.hidden){jS.current===null&&(jS.current=Date.now());return}const ne=jS.current;if(jS.current=null,ne===null||Date.now()-ne<18e4||R0.current!=="idle"||!_e.sessionId)return;const be=At.getSnapshot().blocks.length;be-NS.current<4||(NS.current=be,zt.recapSession().then(Ie=>{Ie.recap&&At.dispatch([{type:"status",text:`※ ${de("recap.label")}: ${Ie.recap}`,source:"recap"}])},Ie=>{console.error("[auto-recap] failed:",Ie)}))}return document.addEventListener("visibilitychange",V),()=>document.removeEventListener("visibilitychange",V)},[_e.sessionId,zt,At,de]);const q8=h.useCallback(()=>{const A=O3(Ec)?Yw.indexOf(Ec):-1,q=Yw[(A+1)%Yw.length];xm(q)},[Ec,xm]),aw=h.useCallback((A,q)=>{ta()&&(Xh(A)||zt.getContextUsage({detail:q}).then(V=>{At.dispatch([{type:"status",text:QXe(V)}]),uu("smooth")}).catch(V=>{sn(V,"Failed to load context usage")}))},[Xh,At,ta,zt,sn,uu]),Ipe=h.useCallback(()=>{aw("/context detail",!0)},[aw]),IS=h.useCallback(A=>{ta()&&zt.branchSession(A||void 0).then(q=>{At.dispatch([{type:"status",text:de("branch.success",{name:q.displayName})}])}).catch(q=>{sn(q,de("branch.failed"))})},[sn,ta,zt,At,de]),Mpe=h.useCallback(()=>{IS()},[IS]),lw=h.useRef(0),MS=h.useCallback(A=>{const q=++lw.current;return window.setTimeout(()=>{var V;q!==lw.current||Pv.current||A!==void 0&&sr.current.sessionId!==A||(V=ti.current)==null||V.focus()},0),q},[]),tc=h.useCallback(async(A,q)=>{const V=Ze??A;Yn.current+=1,xs.current=V,xr(V),tw({mode:"current"}),Ye(),Co(),q!=null&&q.keepView||So("chat");let ne;try{const be=zt.clearSession();return ne=MS(),await Promise.all([be,uS(V)]),Ks(void 0),je(void 0),!0}catch(be){return lw.current===ne&&(lw.current+=1),sn(be,"Failed to start a new chat"),!1}},[Ye,Co,Ze,sn,uS,MS,zt]),F1=h.useCallback(async(A,q=ji.current)=>{var ne;if(On.current)return;const V=Symbol("workspace-switch");On.current=V;try{const be=(ne=q.find(at=>at.primary))==null?void 0:ne.cwd,Ie=A??be;if(A){const at=q.find(Rt=>Rt.cwd===A);if(!(at!=null&&at.trusted))return}if(sr.current.sessionId){if(sr.current.workspaceCwd===Ie)return;await tc(A);return}Yn.current+=1,xs.current=A,xr(A)}finally{On.current===V&&(On.current=null)}},[tc]),RS=h.useCallback(async A=>{try{const q=await(Kn==null?void 0:Kn()),V=(q==null?void 0:q.workspaces)??[],ne=V.find(be=>be.cwd===A);return ne!=null&&ne.trusted&&await F1(ne.primary?void 0:ne.cwd,V),q!==void 0}catch(q){return sn(q,"Failed to refresh the workspace list"),!1}},[Kn,sn,F1]),Rpe=h.useCallback(async(A,q,V)=>{if(Ft.current)throw new Error(de("sidebar.addWorkspaceBusyError"));const ne=Symbol("workspace-mutation");Ft.current=ne,it(!0);try{const be=Er===!0&&q,Ie=fs?V:void 0,at=await Gt.addWorkspace(A,{persist:be,...Ie?{displayName:Ie}:{}});if(be&&at.persisted!==!0)throw new Error(de("sidebar.addWorkspacePersistenceError"));if(!await RS(at.cwd))throw new Error(de("sidebar.addWorkspaceRefreshError"))}finally{Ft.current===ne&&(Ft.current=null,it(!1))}},[Er,RS,de,fs,Gt]),H8=h.useCallback(async()=>{Qr("refreshing");try{const A=await(Kn==null?void 0:Kn());if(!A)return;const q=A.workspaces??[],V=Wr.current;if(V){const ne=q.find(be=>be.cwd===V);ne!=null&&ne.trusted&&await F1(ne.primary?void 0:ne.cwd,q),Wr.current=void 0,Qr("clear")}else Qr("awaiting-ack")}catch(A){sn(A,"Failed to refresh the workspace list")}},[sn,Qr,F1,Kn]),N$=h.useCallback(async()=>{if(Is.current!=="clear"||Ft.current)return;const A=Symbol("workspace-mutation");Ft.current=A,it(!0);try{const q=await Gt.addScratchWorkspace();await RS(q.cwd)||(Wr.current=q.cwd,Qr("refreshing"))}catch(q){q instanceof Zc&&(q.status<500||q.status===501)?sn(q,de("sidebar.addWorkspaceError")):(Wr.current=void 0,Qr("refreshing"),await H8())}finally{Ft.current===A&&(Ft.current=null,it(!1))}},[RS,H8,sn,Qr,de,Gt]),Dpe=h.useCallback(A=>{F1(A)},[F1]),Lpe=h.useCallback(()=>{N$()},[N$]),Ppe=h.useCallback(()=>{xe(!0)},[]),Ope=h.useCallback(A=>{Fme(A)},[]),{suggestion:Ca,updateInput:I$,dismiss:cw,suppress:M$}=JMt({enabled:((vB=_e.capabilities)==null?void 0:vB.features.includes("session_generation"))===!0,messages:hr,sessionId:_e.sessionId,contextUsageRatio:(_e.contextWindow??0)>0?(_e.tokenCount??0)/(_e.contextWindow??0):0,isRunning:es!=="idle",dialogOpen:Ju||ka,hasAttachments:zme,generateContent:zt.generateSessionContent}),$pe=h.useCallback(A=>{o8.current=A,I$(A)},[I$]),DS=h.useCallback(A=>{const q=Md.current;if(!q||A!==void 0&&q.token!==A)return;const V=sr.current.sessionId;if(q.sourceSessionId!==void 0&&V!==void 0&&V!==q.sourceSessionId){Md.current=null,Wv(!1);return}q.sessionClearCompleted&&V===void 0&&(q.submitScheduled||(Md.current={...q,submitScheduled:!0},window.setTimeout(()=>{var be,Ie;const ne=Md.current;if(!(!ne||ne.token!==q.token)){if(sr.current.sessionId!==void 0){Md.current=null,Wv(!1);return}Md.current=null,(be=ti.current)==null||be.submit(),(Ie=ti.current)==null||Ie.focus(),Wv(!1)}},0)))},[]);h.useEffect(()=>{DS()},[_e.sessionId,DS]);const Bpe=h.useCallback(()=>{const A=o8.current.trim();if(!A||oS)return;if((Ca==null?void 0:Ca.suggestion)!=="new_session"||Ca.classifiedInput!==A||Ca.sourceSessionId!==sr.current.sessionId){cw();return}M$(),Wv(!0);const q=i$.current+1;i$.current=q,Md.current={token:q,sourceSessionId:sr.current.sessionId,sessionClearCompleted:!1,submitScheduled:!1},tc().then(V=>{const ne=Md.current;if(!V||(ne==null?void 0:ne.token)!==q){(ne==null?void 0:ne.token)===q&&(Md.current=null),Wv(!1);return}Md.current={...ne,sessionClearCompleted:!0},e==null||e(void 0),DS(q)})},[tc,cw,DS,oS,Ca,e,M$]),zpe=h.useCallback(()=>{var q,V,ne;const A=o8.current.trim();if(!A||(Ca==null?void 0:Ca.suggestion)!=="btw"||Ca.classifiedInput!==A||Ca.sourceSessionId!==sr.current.sessionId||((q=ti.current)==null?void 0:q.hasAttachments())!==!1){cw();return}cw(),(V=ti.current)==null||V.submit({text:`/btw ${A}`}),(ne=ti.current)==null||ne.focus()},[cw,Ca]),R$=h.useMemo(()=>({openSplitView:()=>{Ye(),UO()},openSessionOverview:()=>{Ye(),gl("sessions")},openSessionDrawer:HO,createNewSession:()=>tc(),createSideTask:$h}),[Ye,tc,$h,gl,HO,UO]);h.useEffect(()=>{fX(ee,R$)},[R$,ee]),h.useEffect(()=>()=>{fX(ee,null)},[ee]);const Fpe=h.useCallback(async()=>{if(!i8.current){i8.current=!0,SO(!0);try{await tc()&&(e==null||e(void 0))}finally{i8.current=!1,SO(!1)}}},[tc,e]),$0=h.useCallback(async(A,q)=>{lw.current+=1,bt(A),tw({mode:"current"}),Ks(void 0),je(void 0),Ye(),Co();try{await zt.loadSession(A,{workspaceCwd:q})}catch(V){throw bt(ne=>ne===A?null:ne),V}},[Ye,Co,zt]),U8=h.useCallback(A=>{So("chat"),$0(A).catch(q=>{sn(q,"Failed to open session")})},[$0,sn]);h.useEffect(()=>{const A=q=>{const V=q.detail;typeof V=="string"&&V&&U8(V)};return window.addEventListener("qwen:open-session",A),()=>window.removeEventListener("qwen:open-session",A)},[U8]),h.useEffect(()=>{et!==null&&_e.sessionId===et&&!_e.loadingTranscript&&!_e.catchingUp&&(bt(null),MS(et))},[_e.catchingUp,_e.loadingTranscript,_e.sessionId,MS,et]);const B0=h.useRef(null),W8=h.useCallback(A=>{const q=B0.current;q&&q.sessionId===A&&(clearTimeout(q.timer),B0.current=null)},[]),LS=h.useCallback(A=>new Promise((q,V)=>{let ne=!1;Ka(A,void 0,{onAdmitted:()=>{ne||(ne=!0,q())}}).then(()=>{ne||V(new Error("Run was cancelled before it started"))},Ie=>{ne||V(Ie)})}),[Ka]),PS=h.useCallback(()=>{const A=B0.current,q=sr.current;!A||q.sessionId!==A.sessionId||q.loadingTranscript||q.catchingUp||(clearTimeout(A.timer),B0.current=null,LS(A.prompt).then(()=>A.resolve(),V=>A.reject(V)))},[LS]),qpe=h.useCallback((A,q)=>{if(So("chat"),!q)return LS(A);const V=B0.current;return V&&(clearTimeout(V.timer),B0.current=null,V.reject(new Error("superseded by another run"))),new Promise((ne,be)=>{const Ie=setTimeout(()=>{W8(q),be(new Error("Timed out switching to the task session"))},sRt);B0.current={sessionId:q,prompt:A,resolve:ne,reject:be,timer:Ie},$0(q).then(()=>PS()).catch(at=>{W8(q),be(at)})})},[LS,$0,W8,PS]);h.useEffect(()=>{PS()},[_e.sessionId,_e.loadingTranscript,_e.catchingUp,PS]);const V8=h.useCallback(()=>{ta()&&zt.getTasks().then(A=>{R1({snapshot:A})}).catch(A=>{zP(A)||sn(A,"Failed to load tasks")})},[sn,ta,zt]),D$=h.useCallback(()=>{ta()&&(ii(!0),Ga(A=>A+1))},[ta]),Hpe=h.useCallback(A=>{if(A.kind==="monitor"||A.kind==="shell"){Zo.current||(wa.current=!0),A.kind==="monitor"?j8(A):t$(A);return}V8()},[j8,t$,V8]),L$=h.useCallback((A,q)=>{gm({condition:A,setAt:q}),At.dispatch([{type:"status",text:PG({kind:"set",condition:A,setAt:q})}])},[At]),P$=h.useCallback(A=>{A&&(At.dispatch([{type:"status",text:PG({kind:"cleared",condition:A.condition,durationMs:Date.now()-A.setAt})}]),gm(null))},[At]),OS=h.useCallback(A=>ta()?(At.appendLocalUserMessage(A),zt.clearGoal().catch(q=>{sn(q,"Failed to clear /goal")}),!0):!1,[sn,ta,zt,At]),Upe=h.useCallback(()=>zt.getRewindSnapshots(),[zt]),Wpe=h.useCallback(A=>zt.rewindSession(A,{rewindFiles:!1}).then(()=>{}),[zt]),Vpe=h.useCallback(A=>{if(ub(A))return;const q=A instanceof Error?A.message:String(A);Ht("error",de("rewind.failed",{reason:q}))},[Ht,de]),O$=h.useCallback((A,q,V)=>{const ne=TR(A),be=(V==null?void 0:V.sendToDaemon)??!0,Ie=()=>{const at=!!Yh.current,Rt=!sr.current.sessionId||at;return Ka(A,q,{clearComposerOnPromptStart:Rt,commitComposerAccepted:Rt?V==null?void 0:V.commitComposerAccepted:void 0}).catch(Jt=>{sn(Jt,"Failed to send /goal command")}),!Rt};return ne&&wO(ne)?be?OS(A):(At.appendLocalUserMessage(A),P$(CO.current),!0):ne?be?Ie():(At.appendLocalUserMessage(A),L$(ne,Date.now()),!0):(I1(),!0)},[P$,L$,OS,I1,sn,Ka,At,sr]),uw=h.useMemo(()=>new Set((p??[]).map(T7).filter(Boolean)),[p]),Gpe=uw.has("settings"),$$=h.useCallback((A,q,V,ne)=>{var at;if(xfe(A,a$.current,sn))return!0;if(sr.current.loadingTranscript)return Ht("warning",de("editor.sessionLoading")),!1;if(vfe({connectionStatus:sr.current.status,hasSession:!!sr.current.sessionId,restartSseOnPrompt:!!tt}))return Ht("warning",de("editor.connectionDisconnected")),!1;const be=R0.current!=="idle",Ie=(Rt,Jt,vt,_t)=>{const{trackSendFailure:Rn=!1,...or}=_t??{},Bs=!!Yh.current,Si=!sr.current.sessionId||Bs;let Ta,Ya=!1;return Ka(Rt,Jt,{...or,clearComposerOnPromptStart:Si,commitComposerAccepted:Si?V:void 0,onAdmitted:()=>{Ya=!0},...Rn?{onOptimisticUserMessage:Yi=>{Ta=Yi}}:{}}).catch(Yi=>{const Xa=Ta;Rn&&!Ya&&Xa&&Xa.sessionId===sr.current.sessionId&&At.getSnapshot().blocks.some(Qa=>Qa.kind==="user"&&Qa.id===Xa.messageId)&&Ys({...Xa,text:Rt,images:Jt,inputAnnotations:or.inputAnnotations}),sn(Yi,vt)}),!Si};if(A.startsWith("/")){const Rt=A.match(wfe);if(Rt){const Jt=Rt[1];if(uw.has(T7(Jt)))return be?O0(A,q,void 0,V,ne==null?void 0:ne.inputAnnotations):Ie(A,q,"Failed to send hidden slash command",{inputAnnotations:ne==null?void 0:ne.inputAnnotations});if(Jt==="help")return g8(!0),!0;if(Jt==="diff")return Sa?(vm({workspaceCwd:Sa,gitCwd:fn==null?void 0:fn.path,view:"diff"}),!0):(Ht("info",de("localCommand.diffNoWorkspace")),!0);if(Jt==="log")return Sa?(vm({workspaceCwd:Sa,gitCwd:fn==null?void 0:fn.path,view:"log"}),!0):(Ht("info",de("localCommand.logNoWorkspace")),!0);if(Jt==="prs")return Sa?di?(vm({workspaceCwd:Sa,view:"prs"}),!0):(Ht("info",de("localCommand.prsUnsupported")),!0):(Ht("info",de("localCommand.prsNoWorkspace")),!0);if(Jt==="tasks")return D$(),!0;if(Jt==="goal")return TR(A)?be?U6t(A)?OS(A):Rd():O$(A,q,{commitComposerAccepted:V}):(I1(),!0);if(Jt==="theme"){const vt=A.slice(Rt[0].length).trim().toLowerCase();return vt==="dark"||vt==="light"?iw(vt):vt?Ht("error",de("error.unsupportedTheme")):b8(!0),!0}if(Jt==="language"){const vt=A.slice(Rt[0].length).trim(),[_t,Rn]=vt.split(/\s+/);if(!vt)return At.dispatch([{type:"status",text:[de("language.current",{language:sD(Je)}),de("language.usage"),de("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((_t==null?void 0:_t.toLowerCase())==="ui"){if(!Rn)return At.dispatch([{type:"status",text:[de("language.set"),"",de("language.usage"),"",de("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const or=Rn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(or))return Ht("error",de("language.invalid")),!0;const Si=jf(Rn);if(O1(Si),!be){const Ta=!!Yh.current,Ya=!sr.current.sessionId||Ta;return Ka(`/language ui ${Si}`,void 0,{clearComposerOnPromptStart:Ya,commitComposerAccepted:Ya?V:void 0}).then(()=>zt.refreshCommands()).catch(Yi=>{sn(Yi,"Failed to sync /language command")}),!Ya}return!0}}if(Jt==="copy"){const vt=A.slice(Rt[0].length).trim();return TMt(hi.current,vt).then(_t=>{At.dispatch([{type:_t.status==="error"?"error":"status",text:$Rt(_t.message,de)}])}).catch(_t=>{sn(_t,de("copy.failedFallback"))}),!0}if(Jt==="delete")return f8(!0),!0;if(Jt==="release")return m8(!0),!0;if(Jt==="rewind")return ta()?(p8(!0),!0):!1;if(Jt==="branch"){if(be)return Rd();const vt=A.slice(Rt[0].length).trim();return IS(vt||void 0),!0}if(Jt==="fork"){if(be)return Rd();if(!ta())return!1;const vt=A.slice(Rt[0].length).trim();return vt?(zt.forkSession(vt).then(_t=>{if(!_t.launched){Ht("warning",de("fork.notStarted"));return}Ga(Rn=>Rn+1),Ht("success",de("fork.started",{name:_t.description}))}).catch(_t=>{const Rn=_t instanceof Error?_t.message:String(_t);sn(_t,de("fork.failed",{reason:Rn}))}),!0):(Ht("error",de("fork.empty")),!0)}if(Jt==="auth")return E8(!0),!0;if(Jt==="model"){const vt=A.slice(Rt[0].length).trim();if(vt==="--fast")return Qu("fast"),!0;if(vt.startsWith("--fast "))return be?O0(A,q,void 0,V,ne==null?void 0:ne.inputAnnotations):Ie(A,q,"Failed to send /model --fast",{inputAnnotations:ne==null?void 0:ne.inputAnnotations});if(vt==="--voice")return Xh(A,q)||B8("workspace","command"),!0;if(vt.startsWith("--voice ")){const _t=vt.replace(/^--voice\s+/,"");return ES(_t,"workspace").catch(Rn=>sn(Rn,de("model.setVoice"))),!0}if(vt==="--vision")return Qu("vision"),!0;if(vt.startsWith("--vision ")){const _t=vt.replace(/^--vision\s+/,"");return Zu("workspace","visionModel",_t).catch(Rn=>sn(Rn,de("model.setVision"))),!0}if(vt){if(!sr.current.sessionId)return D1(vt),!0;zt.setModel(vt).then(()=>{D1(vt)}).catch(_t=>{sn(_t,de("model.switch"))})}else Qu("main");return!0}if(Jt==="plan"){if(be)return Rd();const vt=A.slice(Rt[0].length).trim();return sr.current.sessionId?(vt&&Kh(!0),zt.setApprovalMode("plan").then(()=>{if(Zv("plan"),vt)return Ka(vt,q,{clearComposerOnPromptStart:!0,inputAnnotations:ne==null?void 0:ne.inputAnnotations}).catch(_t=>sn(_t,"Failed to send plan prompt"))}).catch(_t=>{sn(_t,de("mode.plan"))}).finally(()=>{vt&&Kh(!1)}),!vt):(Zv("plan"),vt?Ie(vt,q,"Failed to send plan prompt",{inputAnnotations:ne==null?void 0:ne.inputAnnotations}):!0)}if(Jt==="approval-mode"){const vt=A.slice(Rt[0].length).trim();return vt?xm(vt):N1(!0),!0}if(Jt==="mcp"){const vt=A.slice(Rt[0].length).trim().toLowerCase();return Gt.loadMcpStatus().then(_t=>{w8({status:_t,toolsByServer:{},resourcesByServer:{},showDescriptions:vt==="desc",showSchema:vt==="schema",showTips:!vt}),gl("mcp")}).catch(_t=>{sn(_t,"Failed to load MCP status")}),!0}if(Jt==="skills"){const vt=A.slice(Rt[0].length).trim();if(!vt||vt==="detail"||vt==="details")gl("skills");else{const _t=`/${vt}`;return be?O0(_t,q,void 0,V,ne==null?void 0:ne.inputAnnotations):Ie(_t,q,"Failed to send /skills command",{inputAnnotations:ne==null?void 0:ne.inputAnnotations})}return!0}if(Jt==="tools"){const vt=A.slice(Rt[0].length).trim().toLowerCase();if(vt==="desc"||vt==="descriptions")BO(!0);else{if(Xh(A,q))return!0;Gt.loadToolsStatus().then(_t=>{const Rn=(_t==null?void 0:_t.tools)??[];if(Rn.length===0)At.dispatch([{type:"status",text:de("tools.none")}]);else{const or=Rn.map(Bs=>`- ${Bs.displayName||Bs.name}`).join(`
`);At.dispatch([{type:"status",text:`${de("tools.available")}

${or}`}])}uu("smooth")}).catch(_t=>{sn(_t,"Failed to load tools")})}return!0}if(Jt==="settings")return gl("settings"),!0;if(Jt==="schedule")return k8(),!0;if(Jt==="context"){const vt=A.slice(Rt[0].length).trim().toLowerCase();if(vt===""||vt==="detail"||vt==="-d")return aw(A,vt==="detail"||vt==="-d"),!0}if(Jt==="memory"){const vt=A.slice(Rt[0].length).trim().toLowerCase();if(vt==="refresh")Jme(_t=>_t+1);else if(vt==="add"||vt.startsWith("add ")){const _t=vt.slice(3).trim();spe(_t==="user"||_t==="global"?"global":"workspace"),epe(Rn=>Rn+1)}return YO(!0),!0}if(Jt==="agents"){const vt=A.slice(Rt[0].length).trim().toLowerCase();return Qv(vt==="create"||vt==="create user"||vt==="create global"?"global":vt==="create project"||vt==="create workspace"?"workspace":null),gl("agents"),!0}if(Jt==="extensions"){const vt=A.slice(Rt[0].length).trim(),_t=(at=vt.split(/\s+/)[0])==null?void 0:at.toLowerCase();if(!_t||_t==="manage")return gl("extensions"),!0;if(_t==="install"){if(be)return Rd();const Rn=vt.slice(7).trim().split(/\s+/);let or="",Bs,Si,Ta,Ya,Yi=null;for(let Qa=0;Qa<Rn.length;Qa++){const Ja=Rn[Qa];if(Ja)if(Ja==="--auto-update")Ta=!0;else if(Ja==="--pre-release"||Ja==="--allow-pre-release")Ya=!0;else if(Ja==="--ref"||Ja==="--registry"){const z0=Rn[Qa+1];if(!z0||z0.startsWith("--")){Yi=de("extensions.install.missingOptionValue",{option:Ja});break}Ja==="--ref"?Bs=z0:Si=z0,Qa+=1}else if(Ja.startsWith("--")){Yi=de("extensions.install.unknownOption",{option:Ja});break}else if(!or)or=Ja;else{Yi=de("extensions.install.usage");break}}if(Yi)return At.appendLocalUserMessage(A),At.dispatch([{type:"error",text:Yi}]),!0;if(!or)return At.appendLocalUserMessage(A),At.dispatch([{type:"error",text:de("extensions.install.usage")}]),!0;const Xa=sr.current.clientId;return Xa?(At.appendLocalUserMessage(A),At.dispatch([{type:"status",text:de("extensions.install.started",{source:or})}]),Gt.installExtension({source:or,...Bs?{ref:Bs}:{},...Si?{registry:Si}:{},...Ta!==void 0?{autoUpdate:Ta}:{},...Ya!==void 0?{allowPreRelease:Ya}:{},consent:!0},Xa).then(()=>{}).catch(Qa=>{sn(Qa,de("extensions.install.requestFailed"))}),!0):(Ht("warning",de("extensions.install.waitForSession")),!0)}return Xh(A,q)||At.dispatch([{type:"error",text:de("extensions.install.usage")}]),!0}if(Jt==="clear"||Jt==="new"||Jt==="reset")return tc(),!0;if(Jt==="rename"){const vt=jRt(A.slice(Rt[0].length));if(vt.type==="auto"||vt.type==="delegate")return be?O0(A,q,void 0,V,ne==null?void 0:ne.inputAnnotations):Ie(A,q,"Failed to send /rename command",{inputAnnotations:ne==null?void 0:ne.inputAnnotations});const _t=vt.displayName;return _t?ta()?(zt.renameSession(_t).then(()=>{At.dispatch([{type:"status",text:de("rename.success",{name:_t})}])}).catch(Rn=>{sn(Rn,"Failed to rename session")}),!0):!1:(Ht("error",de("rename.empty")),!0)}if(Jt==="resume"){const vt=A.slice(Rt[0].length).trim();return vt?(Ye(),Co(),zt.loadSession(vt).catch(_t=>{sn(_t,"Failed to load session")})):(Ye(),h8(!0)),!0}if(Jt==="recap")return m$(),!0;if(Jt==="btw"){const vt=A.slice(Rt[0].length).trim(),_t=/^side(?:\s+|$)/i.exec(vt);if(ec&&_t){const Rn=vt.slice(_t[0].length).trim();return Rn?($h(Rn),!0):(Ht("error",de("btw.side.empty")),!0)}return p$(vt),!0}if(Jt==="stats"){const vt=A.slice(Rt[0].length).trim().toLowerCase();let _t="overview";return vt==="model"?_t="model":vt==="tools"&&(_t="tools"),ta()?(Xh(A,q)||zt.getStats().then(Rn=>{At.dispatch([{type:"status",text:BQe(Rn,_t)}]),uu("smooth")}).catch(()=>{}),!0):!1}if(Jt==="status"||Jt==="about")return Xh(A,q)||Promise.all([Gt.loadPreflight().catch(()=>null),Gt.loadProviders().catch(()=>null),Gt.loadEnv().catch(()=>null)]).then(([vt,_t,Rn])=>{var z0,SB,CB,TB,EB,AB;const or=iX(vt,Rn);let Bs=or.authSource;!Bs&&((z0=_t==null?void 0:_t.current)!=null&&z0.authType)&&(Bs=_t.current.authType);const Si=[];or.nodeVersion&&Si.push(`Node.js v${or.nodeVersion}`),or.npmVersion&&Si.push(`npm ${or.npmVersion}`);let Ta="";Bs&&(Bs.startsWith("oauth")||Bs==="qwen-oauth"?Ta="Qwen OAuth":Ta=`API Key - ${Bs}`);const Ya=`${or.platform} ${or.arch}`.trim(),Yi=gS.current,Xa=sr.current,Ja={cliVersion:((SB=Xa.capabilities)==null?void 0:SB.qwenCodeVersion)||"",runtime:Si.join(" / "),platform:Ya,auth:Ta,baseUrl:((CB=_t==null?void 0:_t.current)==null?void 0:CB.baseUrl)||"",model:Yi||Xa.currentModel||((TB=_t==null?void 0:_t.current)==null?void 0:TB.modelId)||"",fastModel:((EB=_t==null?void 0:_t.current)==null?void 0:EB.fastModelId)||Yi||Xa.currentModel||((AB=_t==null?void 0:_t.current)==null?void 0:AB.modelId)||"",sessionId:Xa.sessionId||"",sandbox:or.sandbox,proxy:or.proxy,memoryUsage:or.memoryUsage};At.dispatch([{type:"status",text:nJe(Ja)}]),uu("smooth")}),!0;if(Jt==="bug"){const vt=A.slice(Rt[0].length).trim();return Xh(A,q)||Promise.all([Gt.loadPreflight().catch(()=>null),Gt.loadEnv().catch(()=>null)]).then(([_t,Rn])=>{var Ta;const or=iX(_t,Rn),Bs=((Ta=sr.current.capabilities)==null?void 0:Ta.qwenCodeVersion)||"",Si={};if(Bs&&(Si.cliVersion=Bs),or.nodeVersion&&(Si.nodeVersion=or.nodeVersion),or.npmVersion&&(Si.npmVersion=or.npmVersion),or.platform&&(Si.platform=or.platform),or.arch&&(Si.arch=or.arch),or.sandbox&&(Si.sandbox=or.sandbox),or.memoryUsage&&(Si.memoryUsage=or.memoryUsage),P8.current)P8.current({title:vt,systemInfo:Si}),At.dispatch([{type:"status",text:de("bug.submitted")}]);else{const Ya=Object.entries(Si).filter(([,Qa])=>Qa).map(([Qa,Ja])=>`${Qa}: ${Ja}`).join(`
`),Yi=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(vt)}&info=${encodeURIComponent(`
`+Ya+`
`)}`,Xa=window.open(Yi,"_blank");Xa?(Xa.opener=null,At.dispatch([{type:"status",text:de("bug.submitted")}])):Ht("error",de("bug.popupBlocked"))}}).catch(_t=>{sn(_t,de("bug.failed"))}),!0}}return be?O0(A,q,void 0,V,ne==null?void 0:ne.inputAnnotations):Ie(A,q,"Failed to send command",{inputAnnotations:ne==null?void 0:ne.inputAnnotations})}else if(A.startsWith("!")){const Rt=A.slice(1).trim();if(!Rt)return!1;if(be)return Xu.current.push(Rt),Ht("info",de("queue.shellQueued")),!0;const Jt=!sr.current.sessionId;if(Jt){if(aS.current)return!1;aS.current=!0,Kh(!0)}let vt=!1;const _t=D0.current;return wS().finally(()=>{Jt&&(Kh(!1),aS.current=!1)}).then(Rn=>{var or,Bs;if(D0.current===_t)return Jt&&Rn&&(vt=!0,V?V():(or=ti.current)==null||or.clear(),(Bs=na.current)==null||Bs.call(na,{type:"submit",sessionId:Rn,prompt:`!${Rt}`,queued:!1}),P1()),zt.sendShellCommand(Rt)}).catch(Rn=>{sn(Rn,Jt&&!vt?"Failed to create session for shell command":"Failed to execute shell command")}),!Jt}else return be?O0(A,q,void 0,V,ne==null?void 0:ne.inputAnnotations):Ie(A,q,"Failed to send message",{inputAnnotations:ne==null?void 0:ne.inputAnnotations,trackSendFailure:!0})},[Ka,zt,At,O0,Xh,IS,Ye,Co,gl,k8,I1,tc,wS,P1,Sa,fn,di,OS,O$,iw,xm,O1,Rd,$h,ec,D$,uw,Ht,sn,m$,p$,ta,tt,uu,Je,D1,Zv,Zu,B8,ES,aw,de,Gt,Ys]),B$=h.useRef($$);B$.current=$$;const Kpe=h.useCallback((A,q,V,ne)=>{const be=B$.current(A,q,V,ne);return be!==!1&&uu("smooth"),be},[uu]),Ype=h.useCallback((A,q,V)=>{zt.submitPermission(A,q,V).catch(ne=>{sn(ne,"Failed to submit permission choice")})},[zt,sn]),Xpe=h.useCallback((A,q,V)=>zt.submitPermission(A,q,V),[zt]),G8=h.useCallback(()=>{const A=Xu.current.length;Xu.current=[],D0.current++,Vv.current=!1,aS.current=!1,A>0&&Ht("warning",de("queue.shellDropped",{count:A})),zt.cancel().catch(q=>{sn(q,"Failed to cancel request")})},[zt,sn,Ht,de]),Qpe=h.useCallback(()=>{var A;return Ju?!1:((A=Nd.current)==null?void 0:A.focusTaskPill())??!1},[Ju]),Jpe=h.useCallback(A=>{var q,V;if(A){(q=ti.current)==null||q.insertText(A);return}(V=ti.current)==null||V.focus()},[]),Zpe=h.useCallback(A=>{Uv(A)},[]),K8=h.useCallback(()=>{if(u8.current&&qh&&R0.current==="idle"&&Gv.current&&sr.current.sessionId&&A1.current){const A=Gv.current,q=sr.current.sessionId;Kv.current=A,cS(!1),Lo({sessionId:q,messageId:A,startedAt:Date.now(),admitted:!1,settled:!1}),Ka(A1.current,lS.current,{optimisticUserMessage:!1,retry:!0,onAdmitted:()=>{Lo(V=>(V==null?void 0:V.sessionId)===q&&V.messageId===A?{...V,admitted:!0}:V)}}).catch(V=>sn(V,"Failed to retry prompt")).finally(()=>{Lo(V=>(V==null?void 0:V.sessionId)===q&&V.messageId===A?{...V,settled:!0}:V)})}else At.dispatch([{type:"status",text:de("retry.none")}])},[qh,Ka,sn,At,de]);h.useEffect(()=>{const A=q=>{if(!Ju&&q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey){if(q.key==="l"){q.preventDefault(),_$();return}if(q.key==="o"){q.preventDefault(),S$();return}if(q.key==="y"){q.preventDefault(),K8();return}}};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[Ju,_$,S$,K8,At,de]);const km=h.useCallback(()=>{pS.current=null,ZO(!1),e$(!1),M1.current&&(clearTimeout(M1.current),M1.current=null)},[]),z$=h.useRef({streamingState:es,pendingApproval:Va,interactionBlocked:Ju,activePanel:Gn,closePanel:Co,handleCancel:G8,handleCycleMode:q8});z$.current={streamingState:es,pendingApproval:Va,interactionBlocked:Ju,activePanel:Gn,closePanel:Co,handleCancel:G8,handleCycleMode:q8};const e0e=es!=="idle";h.useEffect(()=>{km()},[e0e,km]),h.useEffect(()=>{const V=(be,Ie)=>{pS.current=be,be==="cancel"?e$(!0):ZO(!0),M1.current&&clearTimeout(M1.current),M1.current=setTimeout(km,Ie)},ne=be=>{var Rt,Jt;if(be.defaultPrevented||be.isComposing)return;const Ie=z$.current;if(be.key==="Escape"&&Ie.activePanel){const vt=be.target;vt!=null&&vt.closest("[data-sidebar-shell]")||(be.preventDefault(),Ie.closePanel());return}if(be.key!=="Escape"){pS.current!==null&&km(),be.key==="Tab"&&be.shiftKey&&!Ie.interactionBlocked&&(be.preventDefault(),Ie.handleCycleMode());return}const at=MMt({blocked:!!Ie.pendingApproval||Ie.interactionBlocked,streaming:Ie.streamingState!=="idle",hasInput:!!((Rt=ti.current)!=null&&Rt.hasInput()),armed:pS.current});if(at.kind!=="ignore")switch(be.preventDefault(),at.kind){case"cancel":Ie.handleCancel(),km();break;case"clear":(Jt=ti.current)==null||Jt.clear(),km();break;case"arm":V(at.action,at.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",ne),()=>{window.removeEventListener("keydown",ne),km()}},[km]);const Y8=Gkt({catchingUp:!!_e.catchingUp,pendingApproval:Va!==null,isPreparingPrompt:R8}),F$={catchingUp:!!_e.catchingUp,isPreparingPrompt:R8,isStreaming:es!=="idle"},t0e=yfe(F$),$S=we==null?void 0:we[t0e],n0e=$S!=null&&$S.trim()?$S:de(Kkt(F$)),dw=h.useCallback(A=>{if(!sr.current.sessionId){D1(A);return}TS(!0),zt.setModel(A).then(q=>{const V=TRt(q);D1((V==null?void 0:V.modelId)??A),V&&At.dispatch({type:"debug",text:ERt(V,de),source:"model_switch_summary",data:V})}).catch(q=>{sn(q,de("model.switch"))}).finally(()=>TS(!1))},[zt,At,sn,de,D1]),r0e=h.useCallback(A=>{TS(!0),Gt.deleteModel(A).then(q=>{q!=null&&q.requiresRestart&&At.dispatch([{type:"status",text:de("settings.requiresRestart")}]),CS().catch(V=>{console.warn("[web-shell] failed to reload providers after delete",V)}),Ac().catch(V=>{console.warn("[web-shell] failed to reload settings after delete",V)})}).catch(q=>{sn(q,de("settings.models.deleteFailed"))}).finally(()=>TS(!1))},[Gt,CS,Ac,sn,At,de]),q$=h.useCallback(()=>{E8(!1),CS().catch(A=>{console.warn("[web-shell] failed to reload providers after auth dialog close",A)})},[CS]),s0e=h.useCallback(A=>{dS(!1),Zu(Tc,"modelFallbacks",A.join(",")).then(q=>{q!=null&&q.requiresRestart&&At.dispatch([{type:"status",text:de("settings.requiresRestart")}]),Ac().catch(V=>{console.warn("[web-shell] failed to reload settings after fallbacks save",V)})}).catch(q=>sn(q,de("settings.models.fallbacks.saveFailed")))},[Tc,Zu,Ac,sn,At,de]),i0e=h.useCallback(A=>{if(es!=="idle"){Rd();return}Co(),Ka(`/model --fast ${A}${Tc==="user"?" --global":" --project"}`).then(()=>{Ac().catch(V=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",V)})}).catch(V=>{sn(V,"Failed to switch fast model")})},[Rd,Co,Ka,es,sn,Ac,Tc]),o0e=h.useCallback(A=>{var ne;const q=oX(A),V=$8.current;if(!V||V.ownerKey!==((ne=ow.current)==null?void 0:ne.ownerKey)){sn(new Error("The Voice workspace changed before the selection applied."),de("model.setVoice"));return}ES(q,Tc,V).catch(be=>sn(be,de("model.setVoice")))},[Tc,sn,de,ES]),a0e=h.useCallback(A=>{const q=RMt(A);Zu(Tc,"visionModel",q).catch(V=>sn(V,de("model.setVision")))},[Tc,sn,Zu,de]),l0e={main:dw,fast:i0e,voice:o0e,vision:a0e};h.useEffect(()=>{!Ki&&!bm&&!Wh&&Xv("workspace")},[Ki,bm,Wh]);const H$=h.useMemo(()=>{const A=new Set((_e.skills??[]).map(ne=>ne.toLowerCase())),q=d8?(_e.commands??[]).filter(ne=>ne.source!=="skill"&&!A.has(ne.name.toLowerCase())):_e.commands??[],V=d8?Yv.map(ne=>({name:ne.name,description:ne.description,...ne.argumentHint?{argumentHint:ne.argumentHint}:{},source:"skill",displayCategory:"skill"})):[];return Sfe(Cfe(q,V,kfe(de,{sideTaskAvailable:ec})),de).filter(ne=>!uw.has(T7(ne.name))).map(ne=>{const be=_fe(ne.name);return be?{...ne,displayCategory:"skill",description:de(be)}:ne})},[_e.commands,_e.skills,uw,Yv,d8,ec,de]),hw=h.useMemo(()=>{var A;return{version:((A=_e.capabilities)==null?void 0:A.qwenCodeVersion)||"",cwd:_e.workspaceCwd||"",currentModel:Gh,currentMode:Ec,hideTips:(B1==null?void 0:B1.values.effective)===!0}},[(wB=_e.capabilities)==null?void 0:wB.qwenCodeVersion,_e.workspaceCwd,Gh,Ec,B1==null?void 0:B1.values.effective]),c0e=h.useMemo(()=>a.jsx(a.Fragment,{children:k?k(hw):a.jsx(_pt,{...hw})}),[k,hw]),BS=h.useMemo(()=>S==null?void 0:S(hw),[S,hw]),ra=!_e.sessionId&&tr.length===0&&!A0&&!Va&&!Li,U$=ra&&T,fw=U$&&!!BS,u0e=ra&&fw,X8=ra&&U$,Q8=_e.status!=="connecting"&&!_e.sessionId&&_e.missingSession===!0&&!Gn&&Or==="chat",J8=ra?R4():Nt,W$=fn?(nn==null?void 0:nn.branch)??fn.branch:ur?(nn==null?void 0:nn.branch)??ur.name:_e.sessionId?_e.gitBranch:(nn==null?void 0:nn.branch)??void 0,mw=Ha===null||Ha>=eRt+tRt,zS=Nt!=="wide"&&mw,pw=Ua&&!ra&&!Gn&&Or==="chat",V$=h.useCallback(A=>{if(!A){wa.current=!1,ii(!1);return}ii(!0)},[]),d0e=h.useCallback(()=>{wa.current=!1,ii(!1)},[]),G$=h.useCallback(A=>{A?mi(!0):C0()},[C0]);h.useLayoutEffect(()=>{const A=_c.current;if(!A)return;const q=()=>{const be=A.getBoundingClientRect().width;be<=0||Cs(Ie=>Ie===be?Ie:be)},V=()=>{wa.current=!1,q()};q(),window.addEventListener("resize",V);const ne=new ResizeObserver(q);return ne.observe(A),()=>{window.removeEventListener("resize",V),ne.disconnect()}},[]);const K$=h.useRef(mw);h.useLayoutEffect(()=>{const A=K$.current&&!mw;K$.current=mw,A&&!wa.current&&ii(!1)},[mw]);const Y$=h.useRef(ei);h.useLayoutEffect(()=>{const A=!Y$.current&&ei;if(Y$.current=ei,!ei){wa.current=!1;return}if(!A)return;!wa.current&&!zS&&ii(!1)},[ei,zS]);const h0e=!ra&&!Gn&&Or==="chat",f0e=Rme(Y),X$=[Ot.app,Ot.appChat,ra?Ot.appChatEmpty:void 0,ve.enabled?Ot.appWithSidebar:void 0,Vh===Fs.Light?Ot.themeLight:Ot.themeDark,Vh===Fs.Dark?"dark":void 0,o].filter(Boolean).join(" "),Q$=h.useMemo(()=>({...l,...wRt(J8,Y)}),[Y,J8,l]),J$=h.useCallback(A=>{gt(A),vRt(A)},[]);return h.useLayoutEffect(()=>{const A=mm.current;if(!A)return;const q=Qs.current,V=ea.current,ne=A.getBoundingClientRect();if(V&&!ra&&q){const be=q.top-ne.top;Math.abs(be)>1&&(A.style.transition="width 320ms ease",A.style.transform=`translateY(${be}px)`,requestAnimationFrame(()=>{A.style.transition="width 320ms ease, transform 280ms ease",A.style.transform=""}),window.setTimeout(()=>{A.style.transition=""},320))}Qs.current=ne,ea.current=ra},[ra]),h.useLayoutEffect(()=>{const A=nt.portals?document.createElement("div"):null,q=(A==null?void 0:A.attachShadow({mode:"open"}))??null,V=document.createElement("div");if(V.dataset.webShellPortalRoot="",V.dataset.webShellShadcn="",A&&q){A.dataset.webShellShadowHost="portals",A.style.setProperty("all","initial","important"),A.style.setProperty("position","fixed","important"),A.style.setProperty("inset","0","important"),A.style.setProperty("width","0","important"),A.style.setProperty("height","0","important"),A.style.setProperty("z-index","var(--web-shell-portal-root-z-index, 1000)","important");const ne=bme(q,nt.styles);return q.appendChild(V),document.body.appendChild(A),N0(V),()=>{A.remove(),ne(),N0(null)}}else return document.body.appendChild(V),N0(V),()=>{V.remove(),N0(null)}},[nt.portals,nt.styles]),h.useLayoutEffect(()=>{const A=qv.current;if(!A||!au)return;const q=au.getRootNode(),V=q instanceof ShadowRoot?q.host:null;let ne=null;const be=()=>{ne=null;const Jt=getComputedStyle(A),vt=new Set;au.dataset.webShellShadcn="",au.classList.toggle("dark",Vh===Fs.Dark),au.lang=Je;for(let _t=0;_t<Jt.length;_t+=1){const Rn=Jt[_t];if(!Rn.startsWith("--"))continue;vt.add(Rn);const or=Jt.getPropertyValue(Rn);au.style.setProperty(Rn,or),V==null||V.style.setProperty(Rn,or)}for(const _t of Q.current)vt.has(_t)||(au.style.removeProperty(_t),V==null||V.style.removeProperty(_t));Q.current=vt},Ie=()=>{ne===null&&(ne=requestAnimationFrame(be))};be();const at=new MutationObserver(Ie);let Rt=A;for(;Rt;)at.observe(Rt,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),Rt=Rt.parentElement;return window.addEventListener("resize",Ie),()=>{at.disconnect(),window.removeEventListener("resize",Ie),ne!==null&&cancelAnimationFrame(ne)}},[X$,Q$,au,Je,Vh]),a.jsx(OSe,{value:Vh,children:a.jsx(bSe,{language:Je,children:a.jsx(Nee.Provider,{value:au,children:a.jsxs("div",{ref:qv,className:X$,style:Q$,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,lang:Je,children:[!We&&a.jsx(wmt,{toasts:mr,onDismiss:as}),MO&&a.jsx(zi,{title:de("resume.title"),size:"lg",onClose:()=>h8(!1),children:a.jsx(Vpt,{workspaceCwd:Ze,onSelect:A=>{Ye(),Co(),zt.loadSession(A).catch(q=>{sn(q,"Failed to load session")})},onClose:()=>h8(!1)})}),Ki&&a.jsx(zi,{title:de(lRt[Ki]),size:"lg",onClose:()=>Qu(null),children:a.jsx(f0t,{mode:Ki,models:Ki==="voice"?Ume:void 0,currentModelId:Ki==="voice"?Cpe:Ki==="vision"?Tpe:Ki==="fast"?Epe:void 0,onSelect:A=>{Ki&&l0e[Ki](A),Qu(null)}})}),j1&&a.jsx(zi,{title:de("mode.select"),size:"sm",onClose:()=>N1(!1),children:a.jsx(Wpt,{currentMode:Ec,onSelect:A=>{xm(A),N1(!1)}})}),$O&&a.jsx(zi,{title:de("tools.title"),size:"lg",onClose:()=>BO(!1),children:a.jsx(Ggt,{})}),ym&&a.jsx(iyt,{workspaceCwd:ym.workspaceCwd,gitCwd:ym.gitCwd,initialView:ym.view,sessionId:_e.sessionId,resolveSessionForWorkspace:lpe,onClose:()=>vm(void 0)},`${ym.workspaceCwd}:${ym.gitCwd??""}:${ym.view}`),A8&&a.jsx(zi,{title:de("tasks.title"),size:"lg",onClose:()=>R1(null),children:a.jsx(Yde,{message:A8,embedded:!0,manageActiveEvent:!1,onClose:()=>R1(null),onOpenMonitor:j8})}),KO&&a.jsx(zi,{title:de("memory.menu"),size:"lg",onClose:()=>YO(!1),children:a.jsx(ygt,{refreshSignal:Qme,addSignal:Zme,addScope:rpe,onMessage:(A,q="status")=>{At.dispatch([{type:q,text:A}])}})}),PO&&a.jsx(zi,{title:de("help.title"),size:"md",onClose:()=>g8(!1),children:a.jsx(vjt,{commands:H$})}),OO&&a.jsx(zi,{title:de("theme.title"),size:"sm",onClose:()=>b8(!1),children:a.jsx(wjt,{currentTheme:Vh,onSelect:iw,onClose:()=>b8(!1)})}),Wh&&a.jsx(zi,{title:de("auth.title"),size:"lg",onClose:q$,children:a.jsx(Wgt,{onMessage:(A,q="status")=>{At.dispatch([q==="error"?{type:"error",text:A}:{type:"status",text:A}])},onClose:q$})}),bm&&a.jsx(zi,{title:de("settings.models.fallbacks.title"),size:"md",onClose:()=>dS(!1),children:a.jsx(E0t,{models:jpe,current:Ape,max:3,onConfirm:s0e,onClose:()=>dS(!1)})}),RO&&a.jsx(zi,{title:de("delete.title"),size:"lg",onClose:()=>f8(!1),children:a.jsx(xjt,{workspaceCwd:Ze,onDeleted:A=>{At.dispatch([{type:"status",text:A.length===1?`${de("delete.deleted")} (${A[0].slice(0,8)})`:de("delete.deletedCount",{count:A.length})}])},onError:A=>{if(ub(A))return;const q=A instanceof Error?A.message:String(A);Ht("error",de("delete.failed",{reason:q}))},onClose:()=>f8(!1)})}),DO&&a.jsx(zi,{title:de("release.title"),size:"lg",onClose:()=>m8(!1),children:a.jsx(kjt,{workspaceCwd:Ze,onReleased:A=>{At.dispatch([{type:"status",text:`${de("release.released")} (${A.slice(0,8)})`}])},onError:A=>{if(ub(A))return;const q=A instanceof Error?A.message:String(A);Ht("error",de("release.failed",{reason:q}))},onClose:()=>m8(!1)})}),LO&&a.jsx(zi,{title:de("rewind.title"),subtitle:de("rewind.subtitle"),size:"lg",onClose:()=>p8(!1),children:a.jsx(Bjt,{blocks:Xn,loadSnapshots:Upe,rewind:Wpe,onError:Vpe,onClose:()=>p8(!1)})}),!Ze&&ws&&a.jsx(Fjt,{onClose:()=>xe(!1),onAdd:Rpe,onSuggest:A=>Gt.suggestWorkspacePaths(A),onPick:async()=>{const A=await Gt.pickWorkspaceDirectory();return A.selected?A.path:void 0},persistenceSupported:Er,displayNameEnabled:fs}),cr!=="clear"&&a.jsx(zi,{title:de("sidebar.scratchOutcomeUnknownTitle"),size:"md",dismissible:!1,onClose:()=>{},children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx("p",{children:de("sidebar.scratchOutcomeUnknown")}),a.jsx("ul",{className:"max-h-48 overflow-y-auto text-sm text-muted-foreground",children:Vn.map(A=>a.jsx("li",{children:A.cwd},A.id))}),a.jsx("div",{className:"flex justify-end",children:cr==="refreshing"?a.jsx(Zt,{type:"button",onClick:()=>void H8(),children:de("sidebar.scratchOutcomeRefresh")}):a.jsx(Zt,{type:"button",onClick:()=>Qr("clear"),children:de("sidebar.scratchOutcomeAcknowledge")})})]})}),a.jsxs("div",{className:Ot.appShell,children:[ve.enabled&&a.jsxs("div",{"data-sidebar-shell":"",...rn?{role:"dialog","aria-modal":"true"}:{},"aria-label":de("sidebar.label"),className:[Ot.mobileDrawer,rn?Ot.mobileDrawerOpen:void 0,ft?Ot.mobileDrawerForced:void 0].filter(Boolean).join(" "),children:[a.jsx("div",{className:Ot.mobileBackdrop,onClick:Ye,"aria-hidden":"true"}),a.jsx(uMt,{collapsed:(cn||Or==="split"&&!Tn)&&!rn,onCollapsedChange:zr,onOpenSettings:()=>{Ye(),gl("settings")},onOpenPlugins:()=>{Ye(),gl("plugins")},onOpenChannels:()=>{Ye(),gl("channels")},onOpenDaemonStatus:()=>{Ye(),gl("status")},onOpenScheduledTasks:()=>{Ye(),k8()},onOpenGoals:()=>{Ye(),I1()},onOpenSessions:()=>{Ye(),gl("sessions")},canOpenSessionsOverview:Yt,onOpenSplitView:()=>{Ye(),L0()},canOpenSplitView:Yt,theme:Vh,onThemeChange:A=>{iw(A),Zu("workspace",mg,Dee(A))},onNewSession:A=>tc(A),onLoadSession:(A,q)=>(So("chat"),$0(A,q)),onSelectCurrentSession:()=>{Ye(),So("chat"),Co()},onError:sn,mobileOpen:rn,sessionListReloadToken:l$,selectedWorkspaceCwd:vr,onSelectWorkspace:xr,onOpenGitDiff:A=>vm({workspaceCwd:A,gitCwd:A===Lt?fn==null?void 0:fn.path:void 0,view:"diff"}),onOpenCommit:A=>vm({workspaceCwd:A,gitCwd:A===Lt?fn==null?void 0:fn.path:void 0,view:"commit"}),onOpenAddWorkspace:_r?()=>xe(!0):void 0,workspaces:Vn,lockedWorkspaceCwd:Ze,lockedWorkspace:ve.lockedWorkspace,branding:ve.branding,primaryNav:ve.primaryNav,hideProjectHeader:ve.hideProjectHeader,sessionActions:ve.sessionActions,footer:ve.footer})]}),a.jsxs("div",{className:Ot.contextShell,children:[le&&!ra&&!Gn&&Or==="chat"&&a.jsxs("div",{className:Ot.chatHeaderRow,children:[ve.enabled&&ve.showCompactToggle&&a.jsx("button",{type:"button",className:Ot.hamburgerButton,onClick:()=>{He(!1),qn(A=>!A)},"aria-label":de("sidebar.toggleMenu"),"aria-expanded":rn,children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),z?a.jsx("div",{className:Ot.customChatHeader,children:z({sessionId:_e.sessionId,sessionName:Jv,workspaceCwd:_e.workspaceCwd,items:Ke,environmentPanelOpen:pw,rightPanelOpen:ei,onEnvironmentPanelOpenChange:V$,onRightPanelOpenChange:G$})}):a.jsx(ypt,{content:Le?Jv??de("session.new"):null,environmentOpen:pw,environmentAvailable:dt,rightPanelOpen:ei,rightPanelAvailable:Fe&&!ei,onToggleEnvironment:()=>V$(!pw),onToggleRightPanel:()=>G$(!ei)})]}),a.jsxs("div",{ref:_c,"data-testid":"context-body",className:[Ot.contextBody,pw&&zS?Ot.contextBodyWithEnvironmentPanel:void 0].filter(Boolean).join(" "),children:[a.jsxs("div",{ref:_o,"data-testid":"chat-pane-container",className:[Ot.chatPane,Or!=="chat"?Ot.chatPaneShowingPage:void 0,X8?Ot.chatPaneWithMobileComposerBottom:void 0].filter(Boolean).join(" "),children:[ra&&!Q8&&!Gn&&Or==="chat"&&a.jsx(Tpt,{}),ve.enabled&&ve.showCompactToggle&&(!le||ra)&&!Gn&&Or==="chat"&&a.jsx("button",{type:"button",className:[Ot.hamburgerButton,!le||ra?Ot.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>{He(!1),qn(A=>!A)},"aria-label":de("sidebar.toggleMenu"),"aria-expanded":rn,children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),Gn&&a.jsxs("section",{className:Ot.panelHost,role:"region","data-testid":"inline-panel","aria-label":de(Gn==="settings"?"settings.title":Gn==="status"?"daemon.title":Gn==="extensions"?"extensions.manage.title":Gn==="mcp"?"mcp.title":Gn==="skills"?"skills.title":Gn==="agents"?"agents.title":Gn==="plugins"?"plugins.title":Gn==="channels"?"channels.title":"sessionsOverview.title"),children:[Gn!=="extensions"&&Gn!=="mcp"&&Gn!=="skills"&&Gn!=="agents"&&Gn!=="plugins"&&Gn!=="channels"&&a.jsxs("div",{className:Ot.panelHeader,children:[a.jsx("button",{ref:WO,type:"button",className:Ot.panelBack,"data-testid":"panel-back",onClick:Co,"aria-label":de("common.back"),title:de("common.back"),children:a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("div",{className:Ot.panelTitle,children:de(Gn==="settings"?"settings.title":Gn==="status"?"daemon.title":"sessionsOverview.title")})]}),a.jsx("div",{className:Ot.panelBody,children:a.jsx(fAt,{enabled:nt.plugins&&cAt(Gn),language:Je,themeClassName:[Vh===Fs.Light?Ot.themeLight:Ot.themeDark,Vh===Fs.Dark?"dark":void 0].filter(Boolean).join(" "),styles:nt.styles,initialFocusRef:Gn==="plugins"?T8:Gn==="extensions"||Gn==="channels"?mS:void 0,children:Gn==="settings"?a.jsx(FAt,{settingsState:Spe,embedded:!0,onLanguageChange:Npe,onThemeChange:iw,chatWidthMode:Nt,onChatWidthModeChange:J$,modelManagement:{providers:SS.providers,currentModelId:_e.currentModel??void 0,loading:SS.loading,error:SS.error,busy:kpe,onSelectModel:dw,onDeleteModel:r0e,onAddModel:()=>E8(!0)},onSubDialog:(A,q)=>{A==="fastModel"?(Xv(q),Qu("fast")):A==="visionModel"?(Xv(q),Qu("vision")):A==="voiceModel"?B8(q,"settings"):A==="modelFallbacks"?(Xv(q),dS(!0)):A==="tools.approvalMode"&&N1(!0)}}):Gn==="status"?a.jsx(lxt,{}):Gn==="extensions"?a.jsx(hme,{onClose:Co,initialFocusRef:mS}):Gn==="mcp"&&hS?a.jsx(mme,{message:hS,onClose:()=>{w8(null),Co()}}):Gn==="skills"?a.jsx(Zhe,{onClose:Co,onUseSkill:qO}):Gn==="agents"?a.jsx(Xhe,{onClose:()=>{Qv(null),Co()},initialCreateScope:ipe}):Gn==="plugins"?a.jsx(B8t,{mcpMessage:hS,loadMcpMessage:async()=>{try{await Vme()}catch(A){throw sn(A,"Failed to load MCP status"),A}},onClose:Co,onUseSkill:qO,initialFocusRef:T8}):Gn==="channels"?a.jsx(aAt,{onClose:Co,initialFocusRef:mS}):a.jsx(ikt,{onOpenSession:U8,onOpenSplit:L0,includeOtherWorkspaces:!Ze,workspaceCwd:Ze})})},Gn)]}),Or==="scheduledTasks"&&a.jsxs("div",{className:Ot.fullPage,"data-testid":"scheduled-tasks-page",children:[a.jsxs("div",{className:Ot.fullPageHeader,children:[a.jsx("button",{type:"button",className:Ot.fullPageBack,onClick:()=>So("chat"),"aria-label":de("common.back"),title:de("common.back"),children:a.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M15 18l-6-6 6-6"})})}),a.jsx("div",{className:Ot.fullPageTitle,children:de("scheduledTasks.title")})]}),a.jsx("div",{className:Ot.fullPageBody,children:a.jsx(q6t,{onRunPrompt:qpe,workspaces:Ze?os:Vn,lockedWorkspace:Et,onCreateViaChat:()=>{tc().then(A=>{A&&(e==null||e(void 0),window.setTimeout(()=>{var q,V;(q=ti.current)==null||q.insertText(de("scheduledTasks.chatStarter"),{mode:"replace"}),(V=ti.current)==null||V.focus()},0))})},onOpenSession:A=>{So("chat"),$0(A).catch(q=>{sn(q,"Failed to open session")})},onError:sn})})]}),Or==="goals"&&a.jsxs("div",{className:Ot.fullPage,"data-testid":"goals-page",children:[a.jsxs("div",{className:Ot.fullPageHeader,children:[a.jsx("button",{type:"button",className:Ot.fullPageBack,onClick:()=>So("chat"),"aria-label":de("common.back"),title:de("common.back"),children:a.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M15 18l-6-6 6-6"})})}),a.jsx("div",{className:Ot.fullPageTitle,children:de("goals.title")})]}),a.jsx("div",{className:Ot.fullPageBody,children:a.jsx(C8t,{onCreateGoal:async A=>{const q=vS.current;if(!(q!==void 0&&sr.current.sessionId===q)){if(!await tc(void 0,{keepView:!0}))return!1;e==null||e(void 0)}try{await Ka(`/goal ${A}`,void 0,{clearComposerOnPromptStart:!0})}catch(ne){throw vS.current=sr.current.sessionId,ne}vS.current=void 0,So("chat")},onOpenSession:A=>{So("chat"),$0(A).catch(q=>{sn(q,"Failed to open session")})},onError:sn})})]}),Or==="split"&&a.jsxs("div",{className:Ot.fullPage,"data-testid":"split-view-page",children:[ka&&a.jsxs("div",{className:Ot.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[a.jsx("span",{children:de("splitView.outerApprovalPending")}),a.jsx("button",{type:"button",onClick:()=>So("chat"),children:de("splitView.goToApproval")})]}),a.jsx(ZF,{value:Ns,children:a.jsx(e1.Provider,{value:AS,children:a.jsx(VCt,{sessionIds:Hh,onPanesChange:Gme,sessionListReloadToken:l$,includeOtherWorkspaces:!Ze,workspaceCwd:Ze,onExit:Kme,onError:sn,onSlashCommand:b,onRightPanelOpen:S0,onOpenMonitor:_0,onPaneArtifactsChange:Vr,messageTurnOutputs:Z,restartSseOnPrompt:tt,historyPageSize:ut,renderPaneHeaderActions:ce,voiceUserRevision:kS,voiceWorkspaceRevisions:D8,voiceWorkspaces:(xB=Dt.capabilities)!=null&&xB.workspaces||Et?Vn:void 0})})})]}),a.jsxs("div",{className:[Ot.chatViewWrap,X8?Ot.chatViewWithMobileComposerBottom:void 0,u0e?Ot.chatViewWithWelcomeMiddle:void 0,Gn||Or!=="chat"?Ot.chatViewHidden:void 0].filter(Boolean).join(" "),"aria-hidden":Gn||Or!=="chat"?!0:void 0,children:[Q8&&a.jsxs("div",{className:Ot.missingSessionState,children:[a.jsx("div",{className:Ot.missingSessionMessage,children:de("session.missing")}),a.jsx("button",{type:"button",className:Ot.missingSessionButton,disabled:M0,onClick:Fpe,children:de("session.new")})]}),a.jsx("div",{className:Q8?Ot.chatSubtreeHidden:Ot.chatSubtree,children:a.jsxs(ZF,{value:Ns,children:[a.jsx(e1.Provider,{value:AS,children:a.jsx(ZMt,{timeline:Z_,details:eS,children:a.jsx(qre.Provider,{value:npe,children:(()=>{var Ie;const A=[Ot.content,A0||tr.length>0||Va?Ot.contentHasMessages:void 0].filter(Boolean).join(" "),q=a.jsx(JP,{ref:pm,messages:tr,pendingApproval:fm,onShowContextDetail:Ipe,loadingTranscript:_e.loadingTranscript,catchingUp:_e.catchingUp,hasOlderHistory:Vt.hasMore,loadingOlderHistory:Vt.loading,historyCapacityReached:Vt.capacityReached,historyPaginationError:Vt.paginationError,onLoadOlderHistory:Vt.loadMore,transcriptBlockCount:Xn.length,transcriptActivity:At,onReloadTranscript:Ur?Ni:void 0,isResponding:es!=="idle"&&!a8,activeTurnStartedAt:a8?void 0:(Ms==null?void 0:Ms.startedAt)??AO,workspaceCwd:_e.workspaceCwd||"",hideSessionTimeline:J8==="wide",showRetryHint:c8,onRetryClick:K8,failedPromptMessageId:Zr==null?void 0:Zr.messageId,onRetryFailedPrompt:fpe,onBranchSession:Mpe,bottomOverlayInset:Ve,welcomeHeader:ra?c0e:void 0,centerWelcomeHeader:fw||void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:Zpe,virtualScrollThreshold:ye,turnFileChanges:$s.has("file")?Gi:void 0,turnArtifacts:$s.has("artifact")?Po:void 0,turnScheduledTasks:$s.has("scheduled_task")?qr:void 0,onTurnOutputOpen:S0,onReviewChanges:k0,onOpenArtifact:n8,onOpenScheduledTask:S1,generateContent:(Ie=_e.capabilities)!=null&&Ie.features.includes("session_generation")?zt.generateSessionContent:void 0}),V=a.jsx(the,{onOpen:Dv,children:q}),ne=vo?a.jsx(rhe,{onOpen:pl,children:V}):V,be=!fw&&(Li==null?void 0:Li.role)==="btw"?a.jsx("div",{className:Ot.btwPanel,children:a.jsx(phe,{question:Li.question,answer:Li.answer,isPending:Li.isPending})}):null;return fw?a.jsxs("div",{className:Ot.mobileWelcomeGroup,children:[a.jsxs("div",{style:Hn,className:A,children:[ne,be]}),a.jsx("div",{className:Ot.mobileWelcomeFooterMiddle,children:BS})]}):a.jsxs("div",{style:Hn,className:A,children:[ne,be]})})()})})}),a.jsxs("div",{ref:mm,style:Hn,className:kr?`${Ot.footer} ${Ot.footerWithCustomFooter}`:Ot.footer,children:[Hv&&a.jsx("div",{className:j0?`${Ot.scrollToBottomLayer} ${Ot.scrollToBottomLayerWithTodos}`:Ot.scrollToBottomLayer,children:a.jsx("button",{type:"button",className:Ot.scrollToBottomButton,"aria-label":de("chat.scrollToBottom"),onClick:()=>uu("smooth"),children:a.jsx("svg",{className:Ot.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),j0&&a.jsx("div",{ref:De,className:Ot.bottomPanels,children:a.jsx(Fmt,{todos:A0?zv:[],statusItems:Fv})}),fm&&Or==="chat"&&a.jsx("div",{"data-testid":"approval-overlay",className:Ot.approvalOverlay,children:a.jsx(Efe,{request:fm,onConfirm:Ype,variant:"floating",keyboardActive:Yme})}),E0&&Or==="chat"&&a.jsx("div",{"data-testid":"approval-overlay",className:Ot.approvalOverlay,children:a.jsx(Afe,{request:E0,onConfirm:Xpe,onError:sn,variant:"floating",keyboardActive:Xme})}),a.jsxs("div",{className:Ot.composer,children:[es!=="idle"?a8?null:a.jsx(Whe,{startedAt:(Ms==null?void 0:Ms.startedAt)??AO}):Ca?a.jsxs("div",{className:Ot.composerActionTip,role:"status","data-testid":Ca.suggestion==="btw"?"btw-suggestion":"new-session-suggestion",children:[a.jsx("span",{className:Ot.composerActionTipIcon,"aria-hidden":"true",children:"✦"}),a.jsx("span",{className:Ot.composerActionTipText,children:Ca.suggestion==="btw"?de("editor.btwSuggestionTitle"):de("editor.newSessionSuggestionTitle")}),a.jsx("div",{className:Ot.composerActionTipActions,children:a.jsx("button",{type:"button",className:`${Ot.composerActionTipButton} ${Ot.composerActionTipButtonPrimary}`,"data-testid":Ca.suggestion==="btw"?"btw-suggestion-send":"new-session-suggestion-start",onMouseDown:A=>A.preventDefault(),onClick:Ca.suggestion==="btw"?zpe:Bpe,children:Ca.suggestion==="btw"?de("editor.btwSuggestionSend"):de("editor.newSessionSuggestionStart")})})]}):ope&&es==="idle"?a.jsx("div",{className:Ot.escClearStatus,role:"status",children:de("editor.escClearHint")}):null,a.jsx(Tfe,{prompts:ppe,t:de,onDelete:bpe,onInsert:ype,onEdit:vpe}),si&&a.jsx("div",{className:Ot.composerHeader,children:a.jsx(si,{disabled:Y8,isRunning:es!=="idle",currentMode:Ec,currentModel:Gh,sessionName:Jv})}),a.jsx(Uhe,{ref:iS,onSubmit:Kpe,onInputTextChange:$pe,onAttachmentsChange:Ope,onCycleMode:q8,onToggleShortcuts:b$,onCancel:G8,isRunning:es!=="idle",isPreparing:R8||oS,cancelArmed:ape,disabled:Y8||oS||Ju||ka,commands:H$,skills:Yv,slashCommandCategoryOrder:g,builtinAtProviders:w,atProviders:y,composerTagIcons:v,voiceTarget:Gn!==null||Or!=="chat"?void 0:Ar,voiceStatusRevision:f$,queuedMessages:gpe,onFocusFooter:Qpe,onPopQueuedMessages:wpe,onClearQueuedMessages:xpe,currentMode:Ec,currentModel:Gh,gitBranch:W$,gitWorktree:!!fn,gitCwd:fn==null?void 0:fn.path,gitModeIntent:xS?yS:void 0,onGitModeIntentChange:xS?tw:void 0,gitStatus:nn,onOpenGitDiff:Sa?d$:void 0,onOpenCommit:Sa?h$:void 0,chatWidthMode:Nt,showChatWidthToggle:!ra,chatWidthToggleMin:f0e,visibleToolbarActions:oe??(ra||!Me?nRt:jme),availableModels:cpe,onSelectMode:xm,onSelectModel:dw,workspaces:Mr,selectedWorkspaceCwd:_e.sessionId?(kB=Vn.find(A=>A.cwd===_e.workspaceCwd))!=null&&kB.primary?void 0:_e.workspaceCwd:vr,workspaceSelectionDisabled:!1,atWorkspaceCwd:Ze??(_e.sessionId?_e.workspaceCwd:vr??((_B=Vn.find(A=>A.primary))==null?void 0:_B.cwd)),onSelectWorkspace:Dpe,scratchWorkspaceSupported:Do,existingFolderWorkspaceSupported:_r,workspaceMutationBusy:$e,onCreateScratchWorkspace:Lpe,onOpenExistingWorkspace:Ppe,onChatWidthModeChange:J$,sessionId:_e.sessionId,sessionName:Jv,dialogOpen:Ju||ka,followupState:Ome,onAcceptFollowup:$me,onDismissFollowup:Bme,composerInput:$t,composerInputVersion:St,placeholderText:n0e}),Fr&&a.jsx(Fr,{disabled:Y8,isRunning:es!=="idle",currentMode:Ec,currentModel:Gh,sessionName:Jv})]}),kr?X8?a.jsx("div",{className:Ot.customFooter,children:a.jsx(kr,{connected:qh,mode:Ec,model:Gh,streamingState:es,contextUsageRatio:(_e.contextWindow??0)>0?(_e.tokenCount??0)/(_e.contextWindow??0):0,activeGoal:I0,tasks:cu,availableModes:Yw,availableModels:(_e.models??[]).filter(yx).map(A=>({id:A.id,label:lp(A.label||A.id),contextWindow:A.contextWindow})),skills:Yv,onSelectMode:xm,onSelectModel:dw})}):a.jsx(kr,{connected:qh,mode:Ec,model:Gh,streamingState:es,contextUsageRatio:(_e.contextWindow??0)>0?(_e.tokenCount??0)/(_e.contextWindow??0):0,activeGoal:I0,tasks:cu,availableModes:Yw,availableModels:(_e.models??[]).filter(yx).map(A=>({id:A.id,label:lp(A.label||A.id),contextWindow:A.contextWindow})),skills:Yv,onSelectMode:xm,onSelectModel:dw}):a.jsx(emt,{onSelectMode:()=>N1(A=>!A),onSelectModel:()=>Qu(A=>A?null:"main"),onShowContext:()=>aw("/context",!1),onOpenSettings:()=>gl("settings"),ref:Nd,onOpenTasks:()=>V8(),onReturnToInput:Jpe,tasks:ra||!yt?lu:[],activeGoal:I0,onOpenGoals:I1,hideSettings:Gpe,onToggleShortcuts:b$,compact:!0}),ra&&BS&&a.jsx("div",{className:[Ot.emptyWelcomeFooter,fw?Ot.desktopWelcomeFooter:void 0].filter(Boolean).join(" "),children:BS})]})]})})]})]}),h0e&&a.jsx(fpt,{floating:!zS,hidden:!pw,workspaceCwd:(fn==null?void 0:fn.path)??Lt,gitWorkspaceCwd:_e.sessionId?Sa:void 0,gitCwd:fn==null?void 0:fn.path,branch:W$,gitStatus:nn,tasks:ml,agentTasks:Oi,items:un,onOpenGitDiff:Sa?d$:void 0,onOpenGitCommit:Sa?h$:void 0,onOpenAgent:Lv,onOpenTask:Hpe,onDismiss:d0e}),ei&&FO?a.jsx(y6t,{open:!0,direction:"right",shouldScaleBackground:!1,onOpenChange:A=>{A||C0()},children:a.jsxs(x6t,{className:"data-[vaul-drawer-direction=right]:w-[min(520px,calc(100vw-16px))] data-[vaul-drawer-direction=right]:sm:max-w-[520px]",children:[a.jsx(k6t,{className:"sr-only",children:"Right panel"}),a.jsx(fY,{artifacts:fi,tabs:Zn,activeTabId:kt,reviewChanges:wn,selectedReviewPath:Rr,workspaceCwd:_e.workspaceCwd||"",loading:ge,error:ze,onSelectTab:Qt,onCloseTab:Yu,onOpenFilePreview:J_,latestReviewAvailable:va.length>0,onOpenLatestReview:_1,items:Ge,sideTaskAvailable:ec,sideTasks:Iv,sideTasksLoading:x1,onCreateSideTask:Mv,onOpenSideTask:zh,onCreateSideTaskSession:Rv,onSideTaskCreated:Q_,onSideTaskTitleChange:Bh,onNestedRightPanelOpen:S0,onNestedArtifactsChange:Vr,onSideTaskError:sn,onClose:C0,variant:"drawer"})]})}):null]})]}),ei&&!FO&&a.jsxs("div",{className:Ot.artifactPanelDock,style:{"--artifact-panel-dock-width":`${Xs+4}px`},children:[a.jsx("div",{className:Ot.artifactResizeHandle,role:"separator","aria-orientation":"vertical","aria-valuemin":cb,"aria-valuemax":k1(),"aria-valuenow":Xs,onPointerDown:r8}),a.jsx("div",{className:Ot.artifactPanelClip,children:a.jsx(fY,{artifacts:fi,tabs:Zn,activeTabId:kt,reviewChanges:wn,selectedReviewPath:Rr,panelWidth:Xs,workspaceCwd:_e.workspaceCwd||"",loading:ge,error:ze,onSelectTab:Qt,onCloseTab:Yu,onOpenFilePreview:J_,latestReviewAvailable:va.length>0,onOpenLatestReview:_1,items:Ge,sideTaskAvailable:ec,sideTasks:Iv,sideTasksLoading:x1,onCreateSideTask:Mv,onOpenSideTask:zh,onCreateSideTaskSession:Rv,onSideTaskCreated:Q_,onSideTaskTitleChange:Bh,onNestedRightPanelOpen:S0,onNestedArtifactsChange:Vr,onSideTaskError:sn,onClose:C0})})]})]})]})})})})}function j7({title:e,description:t,actionLabel:n,onAction:r,theme:s,icon:i}){return a.jsx("div",{"data-web-shell-root":!0,"data-web-shell-shadcn":!0,className:`flex min-h-48 w-full items-center justify-center p-4 ${s==="dark"?"dark":""}`,children:a.jsxs(fd,{className:"border",children:[a.jsxs(md,{children:[a.jsx(pd,{variant:"icon",children:i??a.jsx(pke,{})}),a.jsx(gd,{children:e}),a.jsx(Nv,{children:t})]}),a.jsx(Y0t,{children:a.jsx(Zt,{onClick:r,children:n})})]})})}function zRt({sessionId:e,workspaceId:t,workspaceCwd:n,lockWorkspaceCwd:r,clientId:s,restartSseOnPrompt:i,historyPageSize:o=eD,webShellProps:l}){var C,j,E,L;const c=yo(),u=ga(),[d,f]=h.useState(!1),[m,p]=h.useState(),[g,b]=h.useState(),w=h.useRef(void 0);h.useEffect(()=>f(!1),[e,r,n,t]);const y=d?void 0:e,v=d?void 0:r??n,x=v?void 0:t,k=h.useMemo(()=>{var M,R,$;const D=(R=(M=c.capabilities)==null?void 0:M.workspaces)==null?void 0:R.find(B=>B.cwd===v);if(D)return D;if(v&&v===(($=c.capabilities)==null?void 0:$.workspaceCwd))return{id:"primary",cwd:v,primary:!0,trusted:!0}},[v,(C=c.capabilities)==null?void 0:C.workspaceCwd,(j=c.capabilities)==null?void 0:j.workspaces]),S=r&&(m==null?void 0:m.requestedCwd)===r?m.workspace:void 0,T=v?k??S:(L=(E=c.capabilities)==null?void 0:E.workspaces)==null?void 0:L.find(D=>D.id===x),_=h.useMemo(()=>iD(jf(l.language)),[l.language]);return h.useEffect(()=>{var M;if(!r||!c.capabilities||k||(m==null?void 0:m.requestedCwd)===r||g===r)return;((M=w.current)==null?void 0:M.cwd)!==r&&(w.current={cwd:r,promise:u.addWorkspace(r,{persist:!0}).then(R=>{if(R.persisted!==!0)throw new Error("Workspace registration was not persisted");return R})});let D=!1;return w.current.promise.then(async R=>{var $;if(!D){p({requestedCwd:r,workspace:R}),b(void 0);try{await(($=c.refreshCapabilities)==null?void 0:$.call(c))}catch{}}}).catch(()=>{D||b(r)}),()=>{D=!0}},[k,m,g,c,c.capabilities,c.refreshCapabilities,u,r]),(v||x)&&c.status==="error"?a.jsx(j7,{title:_("workspace.loadFailed"),description:_("workspace.loadFailedDescription"),actionLabel:_("common.retry"),theme:l.theme,icon:a.jsx(XF,{}),onAction:()=>{var D;(D=c.refreshCapabilities)==null||D.call(c).catch(()=>{})}}):(v||x)&&!c.capabilities?a.jsxs("div",{"data-web-shell-root":!0,"data-web-shell-shadcn":!0,className:`flex min-h-32 w-full items-center justify-center gap-2 text-sm text-muted-foreground ${l.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[a.jsx(Hr,{}),a.jsx("span",{children:_("common.loading")})]}):r&&g===r?a.jsx(j7,{title:_("workspace.loadFailed"),description:_("workspace.loadFailedDescription"),actionLabel:_("common.retry"),theme:l.theme,icon:a.jsx(XF,{}),onAction:()=>{w.current=void 0,b(void 0)}}):r&&!T?a.jsxs("div",{"data-web-shell-root":!0,"data-web-shell-shadcn":!0,className:`flex min-h-32 w-full items-center justify-center gap-2 text-sm text-muted-foreground ${l.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[a.jsx(Hr,{}),a.jsx("span",{children:_("common.loading")})]}):(v||x)&&!T?a.jsx(j7,{title:_("workspace.notFound"),description:_("workspace.notFoundDescription"),actionLabel:_("session.new"),theme:l.theme,onAction:()=>{var D;f(!0),(D=l.onSessionIdChange)==null||D.call(l,void 0,void 0)}}):a.jsx(l5,{sessionId:y,workspaceCwd:T==null?void 0:T.cwd,clientId:s,historyPageSize:o,subagentTranscriptMode:"summary",maxBlocks:tD,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:i,children:a.jsx(BRt,{...l,historyPageSize:o,restartSseOnPrompt:i,initialSelectedWorkspaceCwd:!r&&T?T.cwd:void 0,lockedWorkspaceCwd:r?T==null?void 0:T.cwd:void 0,lockedWorkspaceCapability:r?T:void 0})},`${(T==null?void 0:T.id)??x??"primary"}:${y??"new"}`)}const FRt=gxt(),Dme="qwen-code-web-shell-language",Lme="qwen-code-web-shell-theme";function Pme(e){if(e===Fs.Dark||e===Fs.Light)return e}function qRt(){const e=new URLSearchParams(window.location.search).get("theme");return Pme(e)}function HRt(){try{return Pme(window.localStorage.getItem(Lme))}catch{return}}function URt(e){try{window.localStorage.setItem(Lme,e)}catch{}}function WRt(){return qRt()??HRt()??Fs.Dark}function VRt(){try{const e=window.localStorage.getItem(Dme);return e?jf(e):void 0}catch{return}}function GRt(e){try{window.localStorage.setItem(Dme,e)}catch{}}function KRt(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return jf(t||(VRt()??navigator.language))}function YRt(){return cxt(window.location.pathname)}function XRt(){return new URLSearchParams(window.location.search).get("workspace")||void 0}function QRt(e,t){const n=new URL(window.location.href);n.pathname=rfe(n.pathname,e),e&&t?n.searchParams.set("workspace",t):n.searchParams.delete("workspace"),n.searchParams.delete("theme"),n.searchParams.delete("language"),n.searchParams.delete("lang"),n.searchParams.delete("token"),n.searchParams.delete("daemon"),window.history.replaceState(null,"",n)}function JRt({daemonToken:e}){const[t,n]=h.useState(()=>WRt()),[r,s]=h.useState(()=>KRt()),[i]=h.useState(()=>YRt()),[o]=h.useState(()=>XRt()),l=FRt||window.location.origin;h.useEffect(()=>{const f=document.documentElement;f.classList.remove("theme-dark","theme-light","dark"),f.classList.add(`theme-${t}`),f.classList.toggle("dark",t===Fs.Dark);const m=document.querySelector('meta[name="theme-color"]');m&&m.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const c=h.useCallback(f=>{n(f),URt(f)},[]),u=h.useCallback(f=>{s(f),GRt(f)},[]),d=h.useCallback((f,m)=>{QRt(f,m)},[]);return a.jsx(Uf,{label:"web-shell-root",fallback:(f,m)=>a.jsx(Fwe,{error:f,onRetry:m,language:r}),children:a.jsx(Hve,{baseUrl:l,token:e,children:a.jsx(zRt,{sessionId:i,workspaceId:o,webShellProps:{theme:t,onThemeChange:c,language:r,onLanguageChange:u,onSessionIdChange:d,sidebar:!0,header:{items:["title","environment","rightPanel"]},rightPanel:{items:["review","sideTask"]},environmentPanel:{items:["environment","subagents","backgroundTasks"]},compactThinking:!0,markdownTableMode:"advanced"}})})})}async function ZRt(){const e=cfe()??await xxt();kxt(),hbe.createRoot(document.getElementById("root")).render(a.jsx(Dn.StrictMode,{children:a.jsx(JRt,{daemonToken:e})}))}ZRt();export{p1 as C,Un as D,en as E,jn as F,Zf as G,b0 as P,ss as R,hl as S,As as T,Ui as V,ou as W,fe as _,Tr as a,gs as b,da as c,Gp as d,Ch as e,E9t as f,THe as g,JHe as h,tk as i,i_ as j,u9t as k,Jp as l};
