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 Aue=Object.defineProperty;var jue=(e,t,n)=>t in e?Aue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>jue(e,typeof t!="symbol"?t+"":t,n);function Nue(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}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 r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var wS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function D3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nV={exports:{}},L3={};/**
 * @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 Mue=Symbol.for("react.transitional.element"),Iue=Symbol.for("react.fragment");function sV(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Mue,type:e,key:s,ref:t!==void 0?t:null,props:n}}L3.Fragment=Iue;L3.jsx=sV;L3.jsxs=sV;nV.exports=L3;var l=nV.exports,rV={exports:{}},As={};/**
 * @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 iM=Symbol.for("react.transitional.element"),Rue=Symbol.for("react.portal"),Due=Symbol.for("react.fragment"),Lue=Symbol.for("react.strict_mode"),Pue=Symbol.for("react.profiler"),Oue=Symbol.for("react.consumer"),$ue=Symbol.for("react.context"),Bue=Symbol.for("react.forward_ref"),zue=Symbol.for("react.suspense"),Fue=Symbol.for("react.memo"),iV=Symbol.for("react.lazy"),Hue=Symbol.for("react.activity"),QL=Symbol.iterator;function que(e){return e===null||typeof e!="object"?null:(e=QL&&e[QL]||e["@@iterator"],typeof e=="function"?e:null)}var oV={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},aV=Object.assign,lV={};function _b(e,t,n){this.props=e,this.context=t,this.refs=lV,this.updater=n||oV}_b.prototype.isReactComponent={};_b.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")};_b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function cV(){}cV.prototype=_b.prototype;function oM(e,t,n){this.props=e,this.context=t,this.refs=lV,this.updater=n||oV}var aM=oM.prototype=new cV;aM.constructor=oM;aV(aM,_b.prototype);aM.isPureReactComponent=!0;var JL=Array.isArray;function iE(){}var ai={H:null,A:null,T:null,S:null},uV=Object.prototype.hasOwnProperty;function lM(e,t,n){var s=n.ref;return{$$typeof:iM,type:e,key:t,ref:s!==void 0?s:null,props:n}}function Uue(e,t){return lM(e.type,t,e.props)}function cM(e){return typeof e=="object"&&e!==null&&e.$$typeof===iM}function Wue(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ZL=/\/+/g;function M5(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Wue(""+e.key):t.toString(36)}function Vue(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(iE,iE):(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 Ug(e,t,n,s,r){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 iM:case Rue:o=!0;break;case iV:return o=e._init,Ug(o(e._payload),t,n,s,r)}}if(o)return r=r(e),o=s===""?"."+M5(e,0):s,JL(r)?(n="",o!=null&&(n=o.replace(ZL,"$&/")+"/"),Ug(r,t,n,"",function(u){return u})):r!=null&&(cM(r)&&(r=Uue(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(ZL,"$&/")+"/")+o)),t.push(r)),1;o=0;var a=s===""?".":s+":";if(JL(e))for(var c=0;c<e.length;c++)s=e[c],i=a+M5(s,c),o+=Ug(s,t,n,i,r);else if(c=que(e),typeof c=="function")for(e=c.call(e),c=0;!(s=e.next()).done;)s=s.value,i=a+M5(s,c++),o+=Ug(s,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return Ug(Vue(e),t,n,s,r);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 zk(e,t,n){if(e==null)return e;var s=[],r=0;return Ug(e,s,"","",function(i){return t.call(n,i,r++)}),s}function Gue(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 eP=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)},Kue={map:zk,forEach:function(e,t,n){zk(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return zk(e,function(){t++}),t},toArray:function(e){return zk(e,function(t){return t})||[]},only:function(e){if(!cM(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};As.Activity=Hue;As.Children=Kue;As.Component=_b;As.Fragment=Due;As.Profiler=Pue;As.PureComponent=oM;As.StrictMode=Lue;As.Suspense=zue;As.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ai;As.__COMPILER_RUNTIME={__proto__:null,c:function(e){return ai.H.useMemoCache(e)}};As.cache=function(e){return function(){return e.apply(null,arguments)}};As.cacheSignal=function(){return null};As.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=aV({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!uV.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(s[i]=t[i]);var i=arguments.length-2;if(i===1)s.children=n;else if(1<i){for(var o=Array(i),a=0;a<i;a++)o[a]=arguments[a+2];s.children=o}return lM(e.type,r,s)};As.createContext=function(e){return e={$$typeof:$ue,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Oue,_context:e},e};As.createElement=function(e,t,n){var s,r={},i=null;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)uV.call(t,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(r[s]=t[s]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var a=Array(o),c=0;c<o;c++)a[c]=arguments[c+2];r.children=a}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)r[s]===void 0&&(r[s]=o[s]);return lM(e,i,r)};As.createRef=function(){return{current:null}};As.forwardRef=function(e){return{$$typeof:Bue,render:e}};As.isValidElement=cM;As.lazy=function(e){return{$$typeof:iV,_payload:{_status:-1,_result:e},_init:Gue}};As.memo=function(e,t){return{$$typeof:Fue,type:e,compare:t===void 0?null:t}};As.startTransition=function(e){var t=ai.T,n={};ai.T=n;try{var s=e(),r=ai.S;r!==null&&r(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(iE,eP)}catch(i){eP(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),ai.T=t}};As.unstable_useCacheRefresh=function(){return ai.H.useCacheRefresh()};As.use=function(e){return ai.H.use(e)};As.useActionState=function(e,t,n){return ai.H.useActionState(e,t,n)};As.useCallback=function(e,t){return ai.H.useCallback(e,t)};As.useContext=function(e){return ai.H.useContext(e)};As.useDebugValue=function(){};As.useDeferredValue=function(e,t){return ai.H.useDeferredValue(e,t)};As.useEffect=function(e,t){return ai.H.useEffect(e,t)};As.useEffectEvent=function(e){return ai.H.useEffectEvent(e)};As.useId=function(){return ai.H.useId()};As.useImperativeHandle=function(e,t,n){return ai.H.useImperativeHandle(e,t,n)};As.useInsertionEffect=function(e,t){return ai.H.useInsertionEffect(e,t)};As.useLayoutEffect=function(e,t){return ai.H.useLayoutEffect(e,t)};As.useMemo=function(e,t){return ai.H.useMemo(e,t)};As.useOptimistic=function(e,t){return ai.H.useOptimistic(e,t)};As.useReducer=function(e,t,n){return ai.H.useReducer(e,t,n)};As.useRef=function(e){return ai.H.useRef(e)};As.useState=function(e){return ai.H.useState(e)};As.useSyncExternalStore=function(e,t,n){return ai.H.useSyncExternalStore(e,t,n)};As.useTransition=function(){return ai.H.useTransition()};As.version="19.2.4";rV.exports=As;var f=rV.exports;const bn=D3(f),P3=Nue({__proto__:null,default:bn},[f]);var dV={exports:{}},O3={},hV={exports:{}},fV={};/**
 * @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($,q){var U=$.length;$.push(q);e:for(;0<U;){var H=U-1>>>1,M=$[H];if(0<r(M,q))$[H]=q,$[U]=M,U=H;else break e}}function n($){return $.length===0?null:$[0]}function s($){if($.length===0)return null;var q=$[0],U=$.pop();if(U!==q){$[0]=U;e:for(var H=0,M=$.length,ee=M>>>1;H<ee;){var V=2*(H+1)-1,R=$[V],re=V+1,Z=$[re];if(0>r(R,U))re<M&&0>r(Z,R)?($[H]=Z,$[re]=U,H=re):($[H]=R,$[V]=U,H=V);else if(re<M&&0>r(Z,U))$[H]=Z,$[re]=U,H=re;else break e}}return q}function r($,q){var U=$.sortIndex-q.sortIndex;return U!==0?U:$.id-q.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,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],d=1,h=null,m=3,p=!1,g=!1,b=!1,x=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function k($){for(var q=n(u);q!==null;){if(q.callback===null)s(u);else if(q.startTime<=$)s(u),q.sortIndex=q.expirationTime,t(c,q);else break;q=n(u)}}function T($){if(b=!1,k($),!g)if(n(c)!==null)g=!0,C||(C=!0,I());else{var q=n(u);q!==null&&A(T,q.startTime-$)}}var C=!1,_=-1,S=5,D=-1;function E(){return x?!0:!(e.unstable_now()-D<S)}function B(){if(x=!1,C){var $=e.unstable_now();D=$;var q=!0;try{e:{g=!1,b&&(b=!1,v(_),_=-1),p=!0;var U=m;try{t:{for(k($),h=n(c);h!==null&&!(h.expirationTime>$&&E());){var H=h.callback;if(typeof H=="function"){h.callback=null,m=h.priorityLevel;var M=H(h.expirationTime<=$);if($=e.unstable_now(),typeof M=="function"){h.callback=M,k($),q=!0;break t}h===n(c)&&s(c),k($)}else s(c);h=n(c)}if(h!==null)q=!0;else{var ee=n(u);ee!==null&&A(T,ee.startTime-$),q=!1}}break e}finally{h=null,m=U,p=!1}q=void 0}}finally{q?I():C=!1}}}var I;if(typeof w=="function")I=function(){w(B)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,O=L.port2;L.port1.onmessage=B,I=function(){O.postMessage(null)}}else I=function(){y(B,0)};function A($,q){_=y(function(){$(e.unstable_now())},q)}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($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function($){switch(m){case 1:case 2:case 3:var q=3;break;default:q=m}var U=m;m=q;try{return $()}finally{m=U}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function($,q){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var U=m;m=$;try{return q()}finally{m=U}},e.unstable_scheduleCallback=function($,q,U){var H=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?H+U:H):U=H,$){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=U+M,$={id:d++,callback:q,priorityLevel:$,startTime:U,expirationTime:M,sortIndex:-1},U>H?($.sortIndex=U,t(u,$),n(c)===null&&$===n(u)&&(b?(v(_),_=-1):b=!0,A(T,U-H))):($.sortIndex=M,t(c,$),g||p||(g=!0,C||(C=!0,I()))),$},e.unstable_shouldYield=E,e.unstable_wrapCallback=function($){var q=m;return function(){var U=m;m=q;try{return $.apply(this,arguments)}finally{m=U}}}})(fV);hV.exports=fV;var Yue=hV.exports,mV={exports:{}},Ga={};/**
 * @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 Xue=f;function pV(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 hf(){}var qa={d:{f:hf,r:function(){throw Error(pV(522))},D:hf,C:hf,L:hf,m:hf,X:hf,S:hf,M:hf},p:0,findDOMNode:null},Que=Symbol.for("react.portal");function Jue(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Que,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var Av=Xue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function $3(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Ga.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=qa;Ga.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(pV(299));return Jue(e,t,null,n)};Ga.flushSync=function(e){var t=Av.T,n=qa.p;try{if(Av.T=null,qa.p=2,e)return e()}finally{Av.T=t,qa.p=n,qa.d.f()}};Ga.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,qa.d.C(e,t))};Ga.prefetchDNS=function(e){typeof e=="string"&&qa.d.D(e)};Ga.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=$3(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?qa.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:r,fetchPriority:i}):n==="script"&&qa.d.X(e,{crossOrigin:s,integrity:r,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Ga.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=$3(t.as,t.crossOrigin);qa.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&&qa.d.M(e)};Ga.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=$3(n,t.crossOrigin);qa.d.L(e,n,{crossOrigin:s,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})}};Ga.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=$3(t.as,t.crossOrigin);qa.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 qa.d.m(e)};Ga.requestFormReset=function(e){qa.d.r(e)};Ga.unstable_batchedUpdates=function(e,t){return e(t)};Ga.useFormState=function(e,t,n){return Av.H.useFormState(e,t,n)};Ga.useFormStatus=function(){return Av.H.useHostTransitionStatus()};Ga.version="19.2.4";function gV(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gV)}catch(e){console.error(e)}}gV(),mV.exports=Ga;var hu=mV.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 Ao=Yue,bV=f,Zue=hu;function ct(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 yV(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hw(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 vV(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 xV(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 tP(e){if(hw(e)!==e)throw Error(ct(188))}function ede(e){var t=e.alternate;if(!t){if(t=hw(e),t===null)throw Error(ct(188));return t!==e?null:e}for(var n=e,s=t;;){var r=n.return;if(r===null)break;var i=r.alternate;if(i===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===n)return tP(r),e;if(i===s)return tP(r),t;i=i.sibling}throw Error(ct(188))}if(n.return!==s.return)n=r,s=i;else{for(var o=!1,a=r.child;a;){if(a===n){o=!0,n=r,s=i;break}if(a===s){o=!0,s=r,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,s=r;break}if(a===s){o=!0,s=i,n=r;break}a=a.sibling}if(!o)throw Error(ct(189))}}if(n.alternate!==s)throw Error(ct(190))}if(n.tag!==3)throw Error(ct(188));return n.stateNode.current===n?e:t}function wV(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=wV(e),t!==null)return t;e=e.sibling}return null}var ci=Object.assign,tde=Symbol.for("react.element"),Fk=Symbol.for("react.transitional.element"),av=Symbol.for("react.portal"),t1=Symbol.for("react.fragment"),kV=Symbol.for("react.strict_mode"),oE=Symbol.for("react.profiler"),_V=Symbol.for("react.consumer"),ch=Symbol.for("react.context"),uM=Symbol.for("react.forward_ref"),aE=Symbol.for("react.suspense"),lE=Symbol.for("react.suspense_list"),dM=Symbol.for("react.memo"),Cf=Symbol.for("react.lazy"),cE=Symbol.for("react.activity"),nde=Symbol.for("react.memo_cache_sentinel"),nP=Symbol.iterator;function jy(e){return e===null||typeof e!="object"?null:(e=nP&&e[nP]||e["@@iterator"],typeof e=="function"?e:null)}var sde=Symbol.for("react.client.reference");function uE(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===sde?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case t1:return"Fragment";case oE:return"Profiler";case kV:return"StrictMode";case aE:return"Suspense";case lE:return"SuspenseList";case cE:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case av:return"Portal";case ch:return e.displayName||"Context";case _V:return(e._context.displayName||"Context")+".Consumer";case uM:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case dM:return t=e.displayName||null,t!==null?t:uE(e.type)||"Memo";case Cf:t=e._payload,e=e._init;try{return uE(e(t))}catch{}}return null}var lv=Array.isArray,us=bV.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_r=Zue.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,e0={pending:!1,data:null,method:null,action:null},dE=[],n1=-1;function yd(e){return{current:e}}function Uo(e){0>n1||(e.current=dE[n1],dE[n1]=null,n1--)}function ni(e,t){n1++,dE[n1]=e.current,e.current=t}var ad=yd(null),dx=yd(null),Qf=yd(null),kS=yd(null);function _S(e,t){switch(ni(Qf,t),ni(dx,e),ni(ad,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?lO(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=lO(t),e=qK(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Uo(ad),ni(ad,e)}function q1(){Uo(ad),Uo(dx),Uo(Qf)}function hE(e){e.memoizedState!==null&&ni(kS,e);var t=ad.current,n=qK(t,e.type);t!==n&&(ni(dx,e),ni(ad,n))}function SS(e){dx.current===e&&(Uo(ad),Uo(dx)),kS.current===e&&(Uo(kS),kx._currentValue=e0)}var I5,sP;function Mp(e){if(I5===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);I5=t&&t[1]||"",sP=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+I5+e+sP}var R5=!1;function D5(e,t){if(!e||R5)return"";R5=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(p){var m=p}Reflect.construct(e,[],h)}else{try{h.call()}catch(p){m=p}e.call(h.prototype)}}else{try{throw Error()}catch(p){m=p}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(p){if(p&&m&&typeof p.stack=="string")return[p.stack,m.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=s.DetermineComponentFrameRoot(),o=i[0],a=i[1];if(o&&a){var c=o.split(`
`),u=a.split(`
`);for(r=s=0;s<c.length&&!c[s].includes("DetermineComponentFrameRoot");)s++;for(;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;if(s===c.length||r===u.length)for(s=c.length-1,r=u.length-1;1<=s&&0<=r&&c[s]!==u[r];)r--;for(;1<=s&&0<=r;s--,r--)if(c[s]!==u[r]){if(s!==1||r!==1)do if(s--,r--,0>r||c[s]!==u[r]){var d=`
`+c[s].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=s&&0<=r);break}}}finally{R5=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Mp(n):""}function rde(e,t){switch(e.tag){case 26:case 27:case 5:return Mp(e.type);case 16:return Mp("Lazy");case 13:return e.child!==t&&t!==null?Mp("Suspense Fallback"):Mp("Suspense");case 19:return Mp("SuspenseList");case 0:case 15:return D5(e.type,!1);case 11:return D5(e.type.render,!1);case 1:return D5(e.type,!0);case 31:return Mp("Activity");default:return""}}function rP(e){try{var t="",n=null;do t+=rde(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var fE=Object.prototype.hasOwnProperty,hM=Ao.unstable_scheduleCallback,L5=Ao.unstable_cancelCallback,ide=Ao.unstable_shouldYield,ode=Ao.unstable_requestPaint,Ql=Ao.unstable_now,ade=Ao.unstable_getCurrentPriorityLevel,SV=Ao.unstable_ImmediatePriority,CV=Ao.unstable_UserBlockingPriority,CS=Ao.unstable_NormalPriority,lde=Ao.unstable_LowPriority,TV=Ao.unstable_IdlePriority,cde=Ao.log,ude=Ao.unstable_setDisableYieldValue,fw=null,Jl=null;function Of(e){if(typeof cde=="function"&&ude(e),Jl&&typeof Jl.setStrictMode=="function")try{Jl.setStrictMode(fw,e)}catch{}}var Zl=Math.clz32?Math.clz32:fde,dde=Math.log,hde=Math.LN2;function fde(e){return e>>>=0,e===0?32:31-(dde(e)/hde|0)|0}var Hk=256,qk=262144,Uk=4194304;function Ip(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 B3(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var a=s&134217727;return a!==0?(s=a&~i,s!==0?r=Ip(s):(o&=a,o!==0?r=Ip(o):n||(n=a&~e,n!==0&&(r=Ip(n))))):(a=s&~i,a!==0?r=Ip(a):o!==0?r=Ip(o):n||(n=s&~e,n!==0&&(r=Ip(n)))),r===0?0:t!==0&&t!==r&&!(t&i)&&(i=r&-r,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:r}function mw(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mde(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 EV(){var e=Uk;return Uk<<=1,!(Uk&62914560)&&(Uk=4194304),e}function P5(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function pw(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function pde(e,t,n,s,r,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 a=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-Zl(n),h=1<<d;a[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&=~h}s!==0&&AV(e,s,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function AV(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Zl(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function jV(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Zl(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function NV(e,t){var n=t&-t;return n=n&42?1:fM(n),n&(e.suspendedLanes|t)?0:n}function fM(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 mM(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function MV(){var e=_r.p;return e!==0?e:(e=window.event,e===void 0?32:eY(e.type))}function iP(e,t){var n=_r.p;try{return _r.p=e,t()}finally{_r.p=n}}var $m=Math.random().toString(36).slice(2),na="__reactFiber$"+$m,Tl="__reactProps$"+$m,Sb="__reactContainer$"+$m,mE="__reactEvents$"+$m,gde="__reactListeners$"+$m,bde="__reactHandles$"+$m,oP="__reactResources$"+$m,gw="__reactMarker$"+$m;function pM(e){delete e[na],delete e[Tl],delete e[mE],delete e[gde],delete e[bde]}function s1(e){var t=e[na];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Sb]||n[na]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fO(e);e!==null;){if(n=e[na])return n;e=fO(e)}return t}e=n,n=e.parentNode}return null}function Cb(e){if(e=e[na]||e[Sb]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function cv(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(ct(33))}function w1(e){var t=e[oP];return t||(t=e[oP]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Fo(e){e[gw]=!0}var IV=new Set,RV={};function D0(e,t){U1(e,t),U1(e+"Capture",t)}function U1(e,t){for(RV[e]=t,e=0;e<t.length;e++)IV.add(t[e])}var yde=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]*$"),aP={},lP={};function vde(e){return fE.call(lP,e)?!0:fE.call(aP,e)?!1:yde.test(e)?lP[e]=!0:(aP[e]=!0,!1)}function A2(e,t,n){if(vde(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Wk(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 Gd(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function _c(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function DV(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xde(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var r=s.get,i=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function pE(e){if(!e._valueTracker){var t=DV(e)?"checked":"value";e._valueTracker=xde(e,t,""+e[t])}}function LV(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=DV(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function TS(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 wde=/[\n"\\]/g;function jc(e){return e.replace(wde,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function gE(e,t,n,s,r,i,o,a){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=""+_c(t)):e.value!==""+_c(t)&&(e.value=""+_c(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?bE(e,o,_c(t)):n!=null?bE(e,o,_c(n)):s!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+_c(a):e.removeAttribute("name")}function PV(e,t,n,s,r,i,o,a){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)){pE(e);return}n=n!=null?""+_c(n):"",t=t!=null?""+_c(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=a?e.checked:!!s,e.defaultChecked=!!s,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),pE(e)}function bE(e,t,n){t==="number"&&TS(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function k1(e,t,n,s){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&s&&(e[n].defaultSelected=!0)}else{for(n=""+_c(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function OV(e,t,n){if(t!=null&&(t=""+_c(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+_c(n):""}function $V(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(ct(92));if(lv(s)){if(1<s.length)throw Error(ct(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=_c(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),pE(e)}function W1(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var kde=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 cP(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||kde.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function BV(e,t,n){if(t!=null&&typeof t!="object")throw Error(ct(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var r in t)s=t[r],t.hasOwnProperty(r)&&n[r]!==s&&cP(e,r,s)}else for(var i in t)t.hasOwnProperty(i)&&cP(e,i,t[i])}function gM(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 _de=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"]]),Sde=/^[\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 j2(e){return Sde.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function uh(){}var yE=null;function bM(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var r1=null,_1=null;function uP(e){var t=Cb(e);if(t&&(e=t.stateNode)){var n=e[Tl]||null;e:switch(e=t.stateNode,t.type){case"input":if(gE(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="'+jc(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[Tl]||null;if(!r)throw Error(ct(90));gE(s,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&LV(s)}break e;case"textarea":OV(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&k1(e,!!n.multiple,t,!1)}}}var O5=!1;function zV(e,t,n){if(O5)return e(t,n);O5=!0;try{var s=e(t);return s}finally{if(O5=!1,(r1!==null||_1!==null)&&(Q3(),r1&&(t=r1,e=_1,_1=r1=null,uP(t),e)))for(t=0;t<e.length;t++)uP(e[t])}}function hx(e,t){var n=e.stateNode;if(n===null)return null;var s=n[Tl]||null;if(s===null)return null;n=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ct(231,t,typeof n));return n}var Nh=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vE=!1;if(Nh)try{var Ny={};Object.defineProperty(Ny,"passive",{get:function(){vE=!0}}),window.addEventListener("test",Ny,Ny),window.removeEventListener("test",Ny,Ny)}catch{vE=!1}var $f=null,yM=null,N2=null;function FV(){if(N2)return N2;var e,t=yM,n=t.length,s,r="value"in $f?$f.value:$f.textContent,i=r.length;for(e=0;e<n&&t[e]===r[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===r[i-s];s++);return N2=r.slice(e,1<s?1-s:void 0)}function M2(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 Vk(){return!0}function dP(){return!1}function Al(e){function t(n,s,r,i,o){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Vk:dP,this.isPropagationStopped=dP,this}return ci(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=Vk)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Vk)},persist:function(){},isPersistent:Vk}),t}var L0={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},z3=Al(L0),bw=ci({},L0,{view:0,detail:0}),Cde=Al(bw),$5,B5,My,F3=ci({},bw,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vM,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!==My&&(My&&e.type==="mousemove"?($5=e.screenX-My.screenX,B5=e.screenY-My.screenY):B5=$5=0,My=e),$5)},movementY:function(e){return"movementY"in e?e.movementY:B5}}),hP=Al(F3),Tde=ci({},F3,{dataTransfer:0}),Ede=Al(Tde),Ade=ci({},bw,{relatedTarget:0}),z5=Al(Ade),jde=ci({},L0,{animationName:0,elapsedTime:0,pseudoElement:0}),Nde=Al(jde),Mde=ci({},L0,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ide=Al(Mde),Rde=ci({},L0,{data:0}),fP=Al(Rde),Dde={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lde={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"},Pde={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ode(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Pde[e])?!!t[e]:!1}function vM(){return Ode}var $de=ci({},bw,{key:function(e){if(e.key){var t=Dde[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=M2(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Lde[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vM,charCode:function(e){return e.type==="keypress"?M2(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?M2(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Bde=Al($de),zde=ci({},F3,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mP=Al(zde),Fde=ci({},bw,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vM}),Hde=Al(Fde),qde=ci({},L0,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ude=Al(qde),Wde=ci({},F3,{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}),Vde=Al(Wde),Gde=ci({},L0,{newState:0,oldState:0}),Kde=Al(Gde),Yde=[9,13,27,32],xM=Nh&&"CompositionEvent"in window,jv=null;Nh&&"documentMode"in document&&(jv=document.documentMode);var Xde=Nh&&"TextEvent"in window&&!jv,HV=Nh&&(!xM||jv&&8<jv&&11>=jv),pP=" ",gP=!1;function qV(e,t){switch(e){case"keyup":return Yde.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function UV(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var i1=!1;function Qde(e,t){switch(e){case"compositionend":return UV(t);case"keypress":return t.which!==32?null:(gP=!0,pP);case"textInput":return e=t.data,e===pP&&gP?null:e;default:return null}}function Jde(e,t){if(i1)return e==="compositionend"||!xM&&qV(e,t)?(e=FV(),N2=yM=$f=null,i1=!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 HV&&t.locale!=="ko"?null:t.data;default:return null}}var Zde={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 bP(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Zde[e.type]:t==="textarea"}function WV(e,t,n,s){r1?_1?_1.push(s):_1=[s]:r1=s,t=US(t,"onChange"),0<t.length&&(n=new z3("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Nv=null,fx=null;function ehe(e){zK(e,0)}function H3(e){var t=cv(e);if(LV(t))return e}function yP(e,t){if(e==="change")return t}var VV=!1;if(Nh){var F5;if(Nh){var H5="oninput"in document;if(!H5){var vP=document.createElement("div");vP.setAttribute("oninput","return;"),H5=typeof vP.oninput=="function"}F5=H5}else F5=!1;VV=F5&&(!document.documentMode||9<document.documentMode)}function xP(){Nv&&(Nv.detachEvent("onpropertychange",GV),fx=Nv=null)}function GV(e){if(e.propertyName==="value"&&H3(fx)){var t=[];WV(t,fx,e,bM(e)),zV(ehe,t)}}function the(e,t,n){e==="focusin"?(xP(),Nv=t,fx=n,Nv.attachEvent("onpropertychange",GV)):e==="focusout"&&xP()}function nhe(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return H3(fx)}function she(e,t){if(e==="click")return H3(t)}function rhe(e,t){if(e==="input"||e==="change")return H3(t)}function ihe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sc=typeof Object.is=="function"?Object.is:ihe;function mx(e,t){if(sc(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!fE.call(t,r)||!sc(e[r],t[r]))return!1}return!0}function wP(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function kP(e,t){var n=wP(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=wP(n)}}function KV(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?KV(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function YV(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=TS(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=TS(e.document)}return t}function wM(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 ohe=Nh&&"documentMode"in document&&11>=document.documentMode,o1=null,xE=null,Mv=null,wE=!1;function _P(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wE||o1==null||o1!==TS(s)||(s=o1,"selectionStart"in s&&wM(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Mv&&mx(Mv,s)||(Mv=s,s=US(xE,"onSelect"),0<s.length&&(t=new z3("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=o1)))}function bp(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var a1={animationend:bp("Animation","AnimationEnd"),animationiteration:bp("Animation","AnimationIteration"),animationstart:bp("Animation","AnimationStart"),transitionrun:bp("Transition","TransitionRun"),transitionstart:bp("Transition","TransitionStart"),transitioncancel:bp("Transition","TransitionCancel"),transitionend:bp("Transition","TransitionEnd")},q5={},XV={};Nh&&(XV=document.createElement("div").style,"AnimationEvent"in window||(delete a1.animationend.animation,delete a1.animationiteration.animation,delete a1.animationstart.animation),"TransitionEvent"in window||delete a1.transitionend.transition);function P0(e){if(q5[e])return q5[e];if(!a1[e])return e;var t=a1[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in XV)return q5[e]=t[n];return e}var QV=P0("animationend"),JV=P0("animationiteration"),ZV=P0("animationstart"),ahe=P0("transitionrun"),lhe=P0("transitionstart"),che=P0("transitioncancel"),eG=P0("transitionend"),tG=new Map,kE="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(" ");kE.push("scrollEnd");function fu(e,t){tG.set(e,t),D0(t,[e])}var ES=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)},xc=[],l1=0,kM=0;function q3(){for(var e=l1,t=kM=l1=0;t<e;){var n=xc[t];xc[t++]=null;var s=xc[t];xc[t++]=null;var r=xc[t];xc[t++]=null;var i=xc[t];if(xc[t++]=null,s!==null&&r!==null){var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}i!==0&&nG(n,r,i)}}function U3(e,t,n,s){xc[l1++]=e,xc[l1++]=t,xc[l1++]=n,xc[l1++]=s,kM|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function _M(e,t,n,s){return U3(e,t,n,s),AS(e)}function O0(e,t){return U3(e,null,null,t),AS(e)}function nG(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var r=!1,i=e.return;i!==null;)i.childLanes|=n,s=i.alternate,s!==null&&(s.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(r=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,r&&t!==null&&(r=31-Zl(n),e=i.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),i):null}function AS(e){if(50<zv)throw zv=0,qE=null,Error(ct(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var c1={};function uhe(e,t,n,s){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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ul(e,t,n,s){return new uhe(e,t,n,s)}function SM(e){return e=e.prototype,!(!e||!e.isReactComponent)}function yh(e,t){var n=e.alternate;return n===null?(n=Ul(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 sG(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 I2(e,t,n,s,r,i){var o=0;if(s=e,typeof e=="function")SM(e)&&(o=1);else if(typeof e=="string")o=pfe(e,n,ad.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case cE:return e=Ul(31,n,t,r),e.elementType=cE,e.lanes=i,e;case t1:return t0(n.children,r,i,t);case kV:o=8,r|=24;break;case oE:return e=Ul(12,n,t,r|2),e.elementType=oE,e.lanes=i,e;case aE:return e=Ul(13,n,t,r),e.elementType=aE,e.lanes=i,e;case lE:return e=Ul(19,n,t,r),e.elementType=lE,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ch:o=10;break e;case _V:o=9;break e;case uM:o=11;break e;case dM:o=14;break e;case Cf:o=16,s=null;break e}o=29,n=Error(ct(130,e===null?"null":typeof e,"")),s=null}return t=Ul(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function t0(e,t,n,s){return e=Ul(7,e,s,t),e.lanes=n,e}function U5(e,t,n){return e=Ul(6,e,null,t),e.lanes=n,e}function rG(e){var t=Ul(18,null,null,0);return t.stateNode=e,t}function W5(e,t,n){return t=Ul(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var SP=new WeakMap;function Nc(e,t){if(typeof e=="object"&&e!==null){var n=SP.get(e);return n!==void 0?n:(t={value:e,source:t,stack:rP(t)},SP.set(e,t),t)}return{value:e,source:t,stack:rP(t)}}var u1=[],d1=0,jS=null,px=0,Sc=[],Cc=0,fm=null,Xu=1,Qu="";function sh(e,t){u1[d1++]=px,u1[d1++]=jS,jS=e,px=t}function iG(e,t,n){Sc[Cc++]=Xu,Sc[Cc++]=Qu,Sc[Cc++]=fm,fm=e;var s=Xu;e=Qu;var r=32-Zl(s)-1;s&=~(1<<r),n+=1;var i=32-Zl(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,Xu=1<<32-Zl(t)+r|n<<r|s,Qu=i+e}else Xu=1<<i|n<<r|s,Qu=e}function CM(e){e.return!==null&&(sh(e,1),iG(e,1,0))}function TM(e){for(;e===jS;)jS=u1[--d1],u1[d1]=null,px=u1[--d1],u1[d1]=null;for(;e===fm;)fm=Sc[--Cc],Sc[Cc]=null,Qu=Sc[--Cc],Sc[Cc]=null,Xu=Sc[--Cc],Sc[Cc]=null}function oG(e,t){Sc[Cc++]=Xu,Sc[Cc++]=Qu,Sc[Cc++]=fm,Xu=t.id,Qu=t.overflow,fm=e}var sa=null,oi=null,sr=!1,Jf=null,Mc=!1,_E=Error(ct(519));function mm(e){var t=Error(ct(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gx(Nc(t,e)),_E}function CP(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[na]=e,t[Tl]=s,n){case"dialog":Vs("cancel",t),Vs("close",t);break;case"iframe":case"object":case"embed":Vs("load",t);break;case"video":case"audio":for(n=0;n<xx.length;n++)Vs(xx[n],t);break;case"source":Vs("error",t);break;case"img":case"image":case"link":Vs("error",t),Vs("load",t);break;case"details":Vs("toggle",t);break;case"input":Vs("invalid",t),PV(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Vs("invalid",t);break;case"textarea":Vs("invalid",t),$V(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||HK(t.textContent,n)?(s.popover!=null&&(Vs("beforetoggle",t),Vs("toggle",t)),s.onScroll!=null&&Vs("scroll",t),s.onScrollEnd!=null&&Vs("scrollend",t),s.onClick!=null&&(t.onclick=uh),t=!0):t=!1,t||mm(e,!0)}function TP(e){for(sa=e.return;sa;)switch(sa.tag){case 5:case 31:case 13:Mc=!1;return;case 27:case 3:Mc=!0;return;default:sa=sa.return}}function _g(e){if(e!==sa)return!1;if(!sr)return TP(e),sr=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||KE(e.type,e.memoizedProps)),n=!n),n&&oi&&mm(e),TP(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ct(317));oi=hO(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ct(317));oi=hO(e)}else t===27?(t=oi,Bm(e.type)?(e=JE,JE=null,oi=e):oi=t):oi=sa?Oc(e.stateNode.nextSibling):null;return!0}function c0(){oi=sa=null,sr=!1}function V5(){var e=Jf;return e!==null&&(cl===null?cl=e:cl.push.apply(cl,e),Jf=null),e}function gx(e){Jf===null?Jf=[e]:Jf.push(e)}var SE=yd(null),$0=null,dh=null;function Mf(e,t,n){ni(SE,t._currentValue),t._currentValue=n}function vh(e){e._currentValue=SE.current,Uo(SE)}function CE(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function TE(e,t,n,s){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var i=r.dependencies;if(i!==null){var o=r.child;i=i.firstContext;e:for(;i!==null;){var a=i;i=r;for(var c=0;c<t.length;c++)if(a.context===t[c]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),CE(i.return,n,e),s||(o=null);break e}i=a.next}}else if(r.tag===18){if(o=r.return,o===null)throw Error(ct(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),CE(o,n,e),o=null}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===e){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}}function Tb(e,t,n,s){e=null;for(var r=t,i=!1;r!==null;){if(!i){if(r.flags&524288)i=!0;else if(r.flags&262144)break}if(r.tag===10){var o=r.alternate;if(o===null)throw Error(ct(387));if(o=o.memoizedProps,o!==null){var a=r.type;sc(r.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(r===kS.current){if(o=r.alternate,o===null)throw Error(ct(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(kx):e=[kx])}r=r.return}e!==null&&TE(t,e,n,s),t.flags|=262144}function NS(e){for(e=e.firstContext;e!==null;){if(!sc(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function u0(e){$0=e,dh=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ra(e){return aG($0,e)}function Gk(e,t){return $0===null&&u0(e),aG(e,t)}function aG(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},dh===null){if(e===null)throw Error(ct(308));dh=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else dh=dh.next=t;return n}var dhe=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},hhe=Ao.unstable_scheduleCallback,fhe=Ao.unstable_NormalPriority,oo={$$typeof:ch,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function EM(){return{controller:new dhe,data:new Map,refCount:0}}function yw(e){e.refCount--,e.refCount===0&&hhe(fhe,function(){e.controller.abort()})}var Iv=null,EE=0,V1=0,S1=null;function mhe(e,t){if(Iv===null){var n=Iv=[];EE=0,V1=JM(),S1={status:"pending",value:void 0,then:function(s){n.push(s)}}}return EE++,t.then(EP,EP),t}function EP(){if(--EE===0&&Iv!==null){S1!==null&&(S1.status="fulfilled");var e=Iv;Iv=null,V1=0,S1=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function phe(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(s.status="rejected",s.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),s}var AP=us.S;us.S=function(e,t){wK=Ql(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&mhe(e,t),AP!==null&&AP(e,t)};var n0=yd(null);function AM(){var e=n0.current;return e!==null?e:Yr.pooledCache}function R2(e,t){t===null?ni(n0,n0.current):ni(n0,t.pool)}function lG(){var e=AM();return e===null?null:{parent:oo._currentValue,pool:e}}var Eb=Error(ct(460)),jM=Error(ct(474)),W3=Error(ct(542)),MS={then:function(){}};function jP(e){return e=e.status,e==="fulfilled"||e==="rejected"}function cG(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(uh,uh),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,MP(e),e;default:if(typeof t.status=="string")t.then(uh,uh);else{if(e=Yr,e!==null&&100<e.shellSuspendCounter)throw Error(ct(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=s}},function(s){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,MP(e),e}throw s0=t,Eb}}function Rp(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(s0=n,Eb):n}}var s0=null;function NP(){if(s0===null)throw Error(ct(459));var e=s0;return s0=null,e}function MP(e){if(e===Eb||e===W3)throw Error(ct(483))}var C1=null,bx=0;function Kk(e){var t=bx;return bx+=1,C1===null&&(C1=[]),cG(C1,e,t)}function Iy(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Yk(e,t){throw t.$$typeof===tde?Error(ct(525)):(e=Object.prototype.toString.call(t),Error(ct(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function uG(e){function t(y,v){if(e){var w=y.deletions;w===null?(y.deletions=[v],y.flags|=16):w.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function s(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 r(y,v){return y=yh(y,v),y.index=0,y.sibling=null,y}function i(y,v,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<v?(y.flags|=67108866,v):w):(y.flags|=67108866,v)):(y.flags|=1048576,v)}function o(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function a(y,v,w,k){return v===null||v.tag!==6?(v=U5(w,y.mode,k),v.return=y,v):(v=r(v,w),v.return=y,v)}function c(y,v,w,k){var T=w.type;return T===t1?d(y,v,w.props.children,k,w.key):v!==null&&(v.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Cf&&Rp(T)===v.type)?(v=r(v,w.props),Iy(v,w),v.return=y,v):(v=I2(w.type,w.key,w.props,null,y.mode,k),Iy(v,w),v.return=y,v)}function u(y,v,w,k){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=W5(w,y.mode,k),v.return=y,v):(v=r(v,w.children||[]),v.return=y,v)}function d(y,v,w,k,T){return v===null||v.tag!==7?(v=t0(w,y.mode,k,T),v.return=y,v):(v=r(v,w),v.return=y,v)}function h(y,v,w){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=U5(""+v,y.mode,w),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Fk:return w=I2(v.type,v.key,v.props,null,y.mode,w),Iy(w,v),w.return=y,w;case av:return v=W5(v,y.mode,w),v.return=y,v;case Cf:return v=Rp(v),h(y,v,w)}if(lv(v)||jy(v))return v=t0(v,y.mode,w,null),v.return=y,v;if(typeof v.then=="function")return h(y,Kk(v),w);if(v.$$typeof===ch)return h(y,Gk(y,v),w);Yk(y,v)}return null}function m(y,v,w,k){var T=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return T!==null?null:a(y,v,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Fk:return w.key===T?c(y,v,w,k):null;case av:return w.key===T?u(y,v,w,k):null;case Cf:return w=Rp(w),m(y,v,w,k)}if(lv(w)||jy(w))return T!==null?null:d(y,v,w,k,null);if(typeof w.then=="function")return m(y,v,Kk(w),k);if(w.$$typeof===ch)return m(y,v,Gk(y,w),k);Yk(y,w)}return null}function p(y,v,w,k,T){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return y=y.get(w)||null,a(v,y,""+k,T);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Fk:return y=y.get(k.key===null?w:k.key)||null,c(v,y,k,T);case av:return y=y.get(k.key===null?w:k.key)||null,u(v,y,k,T);case Cf:return k=Rp(k),p(y,v,w,k,T)}if(lv(k)||jy(k))return y=y.get(w)||null,d(v,y,k,T,null);if(typeof k.then=="function")return p(y,v,w,Kk(k),T);if(k.$$typeof===ch)return p(y,v,w,Gk(v,k),T);Yk(v,k)}return null}function g(y,v,w,k){for(var T=null,C=null,_=v,S=v=0,D=null;_!==null&&S<w.length;S++){_.index>S?(D=_,_=null):D=_.sibling;var E=m(y,_,w[S],k);if(E===null){_===null&&(_=D);break}e&&_&&E.alternate===null&&t(y,_),v=i(E,v,S),C===null?T=E:C.sibling=E,C=E,_=D}if(S===w.length)return n(y,_),sr&&sh(y,S),T;if(_===null){for(;S<w.length;S++)_=h(y,w[S],k),_!==null&&(v=i(_,v,S),C===null?T=_:C.sibling=_,C=_);return sr&&sh(y,S),T}for(_=s(_);S<w.length;S++)D=p(_,y,S,w[S],k),D!==null&&(e&&D.alternate!==null&&_.delete(D.key===null?S:D.key),v=i(D,v,S),C===null?T=D:C.sibling=D,C=D);return e&&_.forEach(function(B){return t(y,B)}),sr&&sh(y,S),T}function b(y,v,w,k){if(w==null)throw Error(ct(151));for(var T=null,C=null,_=v,S=v=0,D=null,E=w.next();_!==null&&!E.done;S++,E=w.next()){_.index>S?(D=_,_=null):D=_.sibling;var B=m(y,_,E.value,k);if(B===null){_===null&&(_=D);break}e&&_&&B.alternate===null&&t(y,_),v=i(B,v,S),C===null?T=B:C.sibling=B,C=B,_=D}if(E.done)return n(y,_),sr&&sh(y,S),T;if(_===null){for(;!E.done;S++,E=w.next())E=h(y,E.value,k),E!==null&&(v=i(E,v,S),C===null?T=E:C.sibling=E,C=E);return sr&&sh(y,S),T}for(_=s(_);!E.done;S++,E=w.next())E=p(_,y,S,E.value,k),E!==null&&(e&&E.alternate!==null&&_.delete(E.key===null?S:E.key),v=i(E,v,S),C===null?T=E:C.sibling=E,C=E);return e&&_.forEach(function(I){return t(y,I)}),sr&&sh(y,S),T}function x(y,v,w,k){if(typeof w=="object"&&w!==null&&w.type===t1&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Fk:e:{for(var T=w.key;v!==null;){if(v.key===T){if(T=w.type,T===t1){if(v.tag===7){n(y,v.sibling),k=r(v,w.props.children),k.return=y,y=k;break e}}else if(v.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Cf&&Rp(T)===v.type){n(y,v.sibling),k=r(v,w.props),Iy(k,w),k.return=y,y=k;break e}n(y,v);break}else t(y,v);v=v.sibling}w.type===t1?(k=t0(w.props.children,y.mode,k,w.key),k.return=y,y=k):(k=I2(w.type,w.key,w.props,null,y.mode,k),Iy(k,w),k.return=y,y=k)}return o(y);case av:e:{for(T=w.key;v!==null;){if(v.key===T)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(y,v.sibling),k=r(v,w.children||[]),k.return=y,y=k;break e}else{n(y,v);break}else t(y,v);v=v.sibling}k=W5(w,y.mode,k),k.return=y,y=k}return o(y);case Cf:return w=Rp(w),x(y,v,w,k)}if(lv(w))return g(y,v,w,k);if(jy(w)){if(T=jy(w),typeof T!="function")throw Error(ct(150));return w=T.call(w),b(y,v,w,k)}if(typeof w.then=="function")return x(y,v,Kk(w),k);if(w.$$typeof===ch)return x(y,v,Gk(y,w),k);Yk(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,v!==null&&v.tag===6?(n(y,v.sibling),k=r(v,w),k.return=y,y=k):(n(y,v),k=U5(w,y.mode,k),k.return=y,y=k),o(y)):n(y,v)}return function(y,v,w,k){try{bx=0;var T=x(y,v,w,k);return C1=null,T}catch(_){if(_===Eb||_===W3)throw _;var C=Ul(29,_,null,y.mode);return C.lanes=k,C.return=y,C}finally{}}}var d0=uG(!0),dG=uG(!1),Tf=!1;function NM(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function AE(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 Zf(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function em(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,wr&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=AS(e),nG(e,null,n),t}return U3(e,s,t,n),AS(e)}function Rv(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,jV(e,n)}}function G5(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=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?r=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?r=i=t:i=i.next=t}else r=i=t;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var jE=!1;function Dv(){if(jE){var e=S1;if(e!==null)throw e}}function Lv(e,t,n,s){jE=!1;var r=e.updateQueue;Tf=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=r.baseState;o=0,d=u=c=null,a=i;do{var m=a.lane&-536870913,p=m!==a.lane;if(p?(Js&m)===m:(s&m)===m){m!==0&&m===V1&&(jE=!0),d!==null&&(d=d.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var g=e,b=a;m=t;var x=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){h=g.call(x,h,m);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,m=typeof g=="function"?g.call(x,h,m):g,m==null)break e;h=ci({},h,m);break e;case 2:Tf=!0}}m=a.callback,m!==null&&(e.flags|=64,p&&(e.flags|=8192),p=r.callbacks,p===null?r.callbacks=[m]:p.push(m))}else p={lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,o|=m;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);d===null&&(c=h),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=d,i===null&&(r.shared.lanes=0),gm|=o,e.lanes=o,e.memoizedState=h}}function hG(e,t){if(typeof e!="function")throw Error(ct(191,e));e.call(t)}function fG(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)hG(n[e],t)}var G1=yd(null),IS=yd(0);function IP(e,t){e=Dh,ni(IS,e),ni(G1,t),Dh=e|t.baseLanes}function NE(){ni(IS,Dh),ni(G1,G1.current)}function MM(){Dh=IS.current,Uo(G1),Uo(IS)}var rc=yd(null),Pc=null;function If(e){var t=e.alternate;ni(Xi,Xi.current&1),ni(rc,e),Pc===null&&(t===null||G1.current!==null||t.memoizedState!==null)&&(Pc=e)}function ME(e){ni(Xi,Xi.current),ni(rc,e),Pc===null&&(Pc=e)}function mG(e){e.tag===22?(ni(Xi,Xi.current),ni(rc,e),Pc===null&&(Pc=e)):Rf()}function Rf(){ni(Xi,Xi.current),ni(rc,rc.current)}function Hl(e){Uo(rc),Pc===e&&(Pc=null),Uo(Xi)}var Xi=yd(0);function RS(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||XE(n)||QE(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 Mh=0,Is=null,Br=null,ro=null,DS=!1,T1=!1,h0=!1,LS=0,yx=0,E1=null,ghe=0;function Pi(){throw Error(ct(321))}function IM(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!sc(e[n],t[n]))return!1;return!0}function RM(e,t,n,s,r,i){return Mh=i,Is=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,us.H=e===null||e.memoizedState===null?WG:UM,h0=!1,i=n(s,r),h0=!1,T1&&(i=gG(t,n,s,r)),pG(e),i}function pG(e){us.H=vx;var t=Br!==null&&Br.next!==null;if(Mh=0,ro=Br=Is=null,DS=!1,yx=0,E1=null,t)throw Error(ct(300));e===null||co||(e=e.dependencies,e!==null&&NS(e)&&(co=!0))}function gG(e,t,n,s){Is=e;var r=0;do{if(T1&&(E1=null),yx=0,T1=!1,25<=r)throw Error(ct(301));if(r+=1,ro=Br=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}us.H=VG,i=t(n,s)}while(T1);return i}function bhe(){var e=us.H,t=e.useState()[0];return t=typeof t.then=="function"?vw(t):t,e=e.useState()[0],(Br!==null?Br.memoizedState:null)!==e&&(Is.flags|=1024),t}function DM(){var e=LS!==0;return LS=0,e}function LM(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function PM(e){if(DS){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}DS=!1}Mh=0,ro=Br=Is=null,T1=!1,yx=LS=0,E1=null}function La(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ro===null?Is.memoizedState=ro=e:ro=ro.next=e,ro}function Qi(){if(Br===null){var e=Is.alternate;e=e!==null?e.memoizedState:null}else e=Br.next;var t=ro===null?Is.memoizedState:ro.next;if(t!==null)ro=t,Br=e;else{if(e===null)throw Is.alternate===null?Error(ct(467)):Error(ct(310));Br=e,e={memoizedState:Br.memoizedState,baseState:Br.baseState,baseQueue:Br.baseQueue,queue:Br.queue,next:null},ro===null?Is.memoizedState=ro=e:ro=ro.next=e}return ro}function V3(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vw(e){var t=yx;return yx+=1,E1===null&&(E1=[]),e=cG(E1,e,t),t=Is,(ro===null?t.memoizedState:ro.next)===null&&(t=t.alternate,us.H=t===null||t.memoizedState===null?WG:UM),e}function G3(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return vw(e);if(e.$$typeof===ch)return ra(e)}throw Error(ct(438,String(e)))}function OM(e){var t=null,n=Is.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Is.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=V3(),Is.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=nde;return t.index++,n}function Ih(e,t){return typeof t=="function"?t(e):t}function D2(e){var t=Qi();return $M(t,Br,e)}function $M(e,t,n){var s=e.queue;if(s===null)throw Error(ct(311));s.lastRenderedReducer=n;var r=e.baseQueue,i=s.pending;if(i!==null){if(r!==null){var o=r.next;r.next=i.next,i.next=o}t.baseQueue=r=i,s.pending=null}if(i=e.baseState,r===null)e.memoizedState=i;else{t=r.next;var a=o=null,c=null,u=t,d=!1;do{var h=u.lane&-536870913;if(h!==u.lane?(Js&h)===h:(Mh&h)===h){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}),h===V1&&(d=!0);else if((Mh&m)===m){u=u.next,m===V1&&(d=!0);continue}else h={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(a=c=h,o=i):c=c.next=h,Is.lanes|=m,gm|=m;h=u.action,h0&&n(i,h),i=u.hasEagerState?u.eagerState:n(i,h)}else m={lane:h,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(a=c=m,o=i):c=c.next=m,Is.lanes|=h,gm|=h;u=u.next}while(u!==null&&u!==t);if(c===null?o=i:c.next=a,!sc(i,e.memoizedState)&&(co=!0,d&&(n=S1,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=c,s.lastRenderedState=i}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function K5(e){var t=Qi(),n=t.queue;if(n===null)throw Error(ct(311));n.lastRenderedReducer=e;var s=n.dispatch,r=n.pending,i=t.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do i=e(i,o.action),o=o.next;while(o!==r);sc(i,t.memoizedState)||(co=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function bG(e,t,n){var s=Is,r=Qi(),i=sr;if(i){if(n===void 0)throw Error(ct(407));n=n()}else n=t();var o=!sc((Br||r).memoizedState,n);if(o&&(r.memoizedState=n,co=!0),r=r.queue,BM(xG.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||ro!==null&&ro.memoizedState.tag&1){if(s.flags|=2048,K1(9,{destroy:void 0},vG.bind(null,s,r,n,t),null),Yr===null)throw Error(ct(349));i||Mh&127||yG(s,t,n)}return n}function yG(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Is.updateQueue,t===null?(t=V3(),Is.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function vG(e,t,n,s){t.value=n,t.getSnapshot=s,wG(t)&&kG(e)}function xG(e,t,n){return n(function(){wG(t)&&kG(e)})}function wG(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!sc(e,n)}catch{return!0}}function kG(e){var t=O0(e,2);t!==null&&vl(t,e,2)}function IE(e){var t=La();if(typeof e=="function"){var n=e;if(e=n(),h0){Of(!0);try{n()}finally{Of(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ih,lastRenderedState:e},t}function _G(e,t,n,s){return e.baseState=n,$M(e,Br,typeof s=="function"?s:Ih)}function yhe(e,t,n,s,r){if(Y3(e))throw Error(ct(485));if(e=t.action,e!==null){var i={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};us.T!==null?n(!0):i.isTransition=!1,s(i),n=t.pending,n===null?(i.next=t.pending=i,SG(t,i)):(i.next=n.next,t.pending=n.next=i)}}function SG(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var i=us.T,o={};us.T=o;try{var a=n(r,s),c=us.S;c!==null&&c(o,a),RP(e,t,a)}catch(u){RE(e,t,u)}finally{i!==null&&o.types!==null&&(i.types=o.types),us.T=i}}else try{i=n(r,s),RP(e,t,i)}catch(u){RE(e,t,u)}}function RP(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){DP(e,t,s)},function(s){return RE(e,t,s)}):DP(e,t,n)}function DP(e,t,n){t.status="fulfilled",t.value=n,CG(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,SG(e,n)))}function RE(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,CG(t),t=t.next;while(t!==s)}e.action=null}function CG(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function TG(e,t){return t}function LP(e,t){if(sr){var n=Yr.formState;if(n!==null){e:{var s=Is;if(sr){if(oi){t:{for(var r=oi,i=Mc;r.nodeType!==8;){if(!i){r=null;break t}if(r=Oc(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){oi=Oc(r.nextSibling),s=r.data==="F!";break e}}mm(s)}s=!1}s&&(t=n[0])}}return n=La(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:TG,lastRenderedState:t},n.queue=s,n=HG.bind(null,Is,s),s.dispatch=n,s=IE(!1),i=qM.bind(null,Is,!1,s.queue),s=La(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=yhe.bind(null,Is,r,i,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function PP(e){var t=Qi();return EG(t,Br,e)}function EG(e,t,n){if(t=$M(e,t,TG)[0],e=D2(Ih)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=vw(t)}catch(o){throw o===Eb?W3:o}else s=t;t=Qi();var r=t.queue,i=r.dispatch;return n!==t.memoizedState&&(Is.flags|=2048,K1(9,{destroy:void 0},vhe.bind(null,r,n),null)),[s,i,e]}function vhe(e,t){e.action=t}function OP(e){var t=Qi(),n=Br;if(n!==null)return EG(t,n,e);Qi(),t=t.memoizedState,n=Qi();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function K1(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Is.updateQueue,t===null&&(t=V3(),Is.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function AG(){return Qi().memoizedState}function L2(e,t,n,s){var r=La();Is.flags|=e,r.memoizedState=K1(1|t,{destroy:void 0},n,s===void 0?null:s)}function K3(e,t,n,s){var r=Qi();s=s===void 0?null:s;var i=r.memoizedState.inst;Br!==null&&s!==null&&IM(s,Br.memoizedState.deps)?r.memoizedState=K1(t,i,n,s):(Is.flags|=e,r.memoizedState=K1(1|t,i,n,s))}function $P(e,t){L2(8390656,8,e,t)}function BM(e,t){K3(2048,8,e,t)}function xhe(e){Is.flags|=4;var t=Is.updateQueue;if(t===null)t=V3(),Is.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function jG(e){var t=Qi().memoizedState;return xhe({ref:t,nextImpl:e}),function(){if(wr&2)throw Error(ct(440));return t.impl.apply(void 0,arguments)}}function NG(e,t){return K3(4,2,e,t)}function MG(e,t){return K3(4,4,e,t)}function IG(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 RG(e,t,n){n=n!=null?n.concat([e]):null,K3(4,4,IG.bind(null,t,e),n)}function zM(){}function DG(e,t){var n=Qi();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&IM(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function LG(e,t){var n=Qi();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&IM(t,s[1]))return s[0];if(s=e(),h0){Of(!0);try{e()}finally{Of(!1)}}return n.memoizedState=[s,t],s}function FM(e,t,n){return n===void 0||Mh&1073741824&&!(Js&261930)?e.memoizedState=t:(e.memoizedState=n,e=_K(),Is.lanes|=e,gm|=e,n)}function PG(e,t,n,s){return sc(n,t)?n:G1.current!==null?(e=FM(e,n,s),sc(e,t)||(co=!0),e):!(Mh&42)||Mh&1073741824&&!(Js&261930)?(co=!0,e.memoizedState=n):(e=_K(),Is.lanes|=e,gm|=e,t)}function OG(e,t,n,s,r){var i=_r.p;_r.p=i!==0&&8>i?i:8;var o=us.T,a={};us.T=a,qM(e,!1,t,n);try{var c=r(),u=us.S;if(u!==null&&u(a,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=phe(c,s);Pv(e,t,d,ec(e))}else Pv(e,t,s,ec(e))}catch(h){Pv(e,t,{then:function(){},status:"rejected",reason:h},ec())}finally{_r.p=i,o!==null&&a.types!==null&&(o.types=a.types),us.T=o}}function whe(){}function DE(e,t,n,s){if(e.tag!==5)throw Error(ct(476));var r=$G(e).queue;OG(e,r,t,e0,n===null?whe:function(){return BG(e),n(s)})}function $G(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:e0,baseState:e0,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ih,lastRenderedState:e0},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ih,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function BG(e){var t=$G(e);t.next===null&&(t=e.alternate.memoizedState),Pv(e,t.next.queue,{},ec())}function HM(){return ra(kx)}function zG(){return Qi().memoizedState}function FG(){return Qi().memoizedState}function khe(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=ec();e=Zf(n);var s=em(t,e,n);s!==null&&(vl(s,t,n),Rv(s,t,n)),t={cache:EM()},e.payload=t;return}t=t.return}}function _he(e,t,n){var s=ec();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Y3(e)?qG(t,n):(n=_M(e,t,n,s),n!==null&&(vl(n,e,s),UG(n,t,s)))}function HG(e,t,n){var s=ec();Pv(e,t,n,s)}function Pv(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Y3(e))qG(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(r.hasEagerState=!0,r.eagerState=a,sc(a,o))return U3(e,t,r,0),Yr===null&&q3(),!1}catch{}finally{}if(n=_M(e,t,r,s),n!==null)return vl(n,e,s),UG(n,t,s),!0}return!1}function qM(e,t,n,s){if(s={lane:2,revertLane:JM(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Y3(e)){if(t)throw Error(ct(479))}else t=_M(e,n,s,2),t!==null&&vl(t,e,2)}function Y3(e){var t=e.alternate;return e===Is||t!==null&&t===Is}function qG(e,t){T1=DS=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function UG(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,jV(e,n)}}var vx={readContext:ra,use:G3,useCallback:Pi,useContext:Pi,useEffect:Pi,useImperativeHandle:Pi,useLayoutEffect:Pi,useInsertionEffect:Pi,useMemo:Pi,useReducer:Pi,useRef:Pi,useState:Pi,useDebugValue:Pi,useDeferredValue:Pi,useTransition:Pi,useSyncExternalStore:Pi,useId:Pi,useHostTransitionStatus:Pi,useFormState:Pi,useActionState:Pi,useOptimistic:Pi,useMemoCache:Pi,useCacheRefresh:Pi};vx.useEffectEvent=Pi;var WG={readContext:ra,use:G3,useCallback:function(e,t){return La().memoizedState=[e,t===void 0?null:t],e},useContext:ra,useEffect:$P,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,L2(4194308,4,IG.bind(null,t,e),n)},useLayoutEffect:function(e,t){return L2(4194308,4,e,t)},useInsertionEffect:function(e,t){L2(4,2,e,t)},useMemo:function(e,t){var n=La();t=t===void 0?null:t;var s=e();if(h0){Of(!0);try{e()}finally{Of(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=La();if(n!==void 0){var r=n(t);if(h0){Of(!0);try{n(t)}finally{Of(!1)}}}else r=t;return s.memoizedState=s.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},s.queue=e,e=e.dispatch=_he.bind(null,Is,e),[s.memoizedState,e]},useRef:function(e){var t=La();return e={current:e},t.memoizedState=e},useState:function(e){e=IE(e);var t=e.queue,n=HG.bind(null,Is,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:zM,useDeferredValue:function(e,t){var n=La();return FM(n,e,t)},useTransition:function(){var e=IE(!1);return e=OG.bind(null,Is,e.queue,!0,!1),La().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Is,r=La();if(sr){if(n===void 0)throw Error(ct(407));n=n()}else{if(n=t(),Yr===null)throw Error(ct(349));Js&127||yG(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,$P(xG.bind(null,s,i,e),[e]),s.flags|=2048,K1(9,{destroy:void 0},vG.bind(null,s,i,n,t),null),n},useId:function(){var e=La(),t=Yr.identifierPrefix;if(sr){var n=Qu,s=Xu;n=(s&~(1<<32-Zl(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=LS++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=ghe++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:HM,useFormState:LP,useActionState:LP,useOptimistic:function(e){var t=La();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=qM.bind(null,Is,!0,n),n.dispatch=t,[e,t]},useMemoCache:OM,useCacheRefresh:function(){return La().memoizedState=khe.bind(null,Is)},useEffectEvent:function(e){var t=La(),n={impl:e};return t.memoizedState=n,function(){if(wr&2)throw Error(ct(440));return n.impl.apply(void 0,arguments)}}},UM={readContext:ra,use:G3,useCallback:DG,useContext:ra,useEffect:BM,useImperativeHandle:RG,useInsertionEffect:NG,useLayoutEffect:MG,useMemo:LG,useReducer:D2,useRef:AG,useState:function(){return D2(Ih)},useDebugValue:zM,useDeferredValue:function(e,t){var n=Qi();return PG(n,Br.memoizedState,e,t)},useTransition:function(){var e=D2(Ih)[0],t=Qi().memoizedState;return[typeof e=="boolean"?e:vw(e),t]},useSyncExternalStore:bG,useId:zG,useHostTransitionStatus:HM,useFormState:PP,useActionState:PP,useOptimistic:function(e,t){var n=Qi();return _G(n,Br,e,t)},useMemoCache:OM,useCacheRefresh:FG};UM.useEffectEvent=jG;var VG={readContext:ra,use:G3,useCallback:DG,useContext:ra,useEffect:BM,useImperativeHandle:RG,useInsertionEffect:NG,useLayoutEffect:MG,useMemo:LG,useReducer:K5,useRef:AG,useState:function(){return K5(Ih)},useDebugValue:zM,useDeferredValue:function(e,t){var n=Qi();return Br===null?FM(n,e,t):PG(n,Br.memoizedState,e,t)},useTransition:function(){var e=K5(Ih)[0],t=Qi().memoizedState;return[typeof e=="boolean"?e:vw(e),t]},useSyncExternalStore:bG,useId:zG,useHostTransitionStatus:HM,useFormState:OP,useActionState:OP,useOptimistic:function(e,t){var n=Qi();return Br!==null?_G(n,Br,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:OM,useCacheRefresh:FG};VG.useEffectEvent=jG;function Y5(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:ci({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var LE={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=ec(),r=Zf(s);r.payload=t,n!=null&&(r.callback=n),t=em(e,r,s),t!==null&&(vl(t,e,s),Rv(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=ec(),r=Zf(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=em(e,r,s),t!==null&&(vl(t,e,s),Rv(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ec(),s=Zf(n);s.tag=2,t!=null&&(s.callback=t),t=em(e,s,n),t!==null&&(vl(t,e,n),Rv(t,e,n))}};function BP(e,t,n,s,r,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,o):t.prototype&&t.prototype.isPureReactComponent?!mx(n,s)||!mx(r,i):!0}function zP(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&LE.enqueueReplaceState(t,t.state,null)}function f0(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=ci({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function GG(e){ES(e)}function KG(e){console.error(e)}function YG(e){ES(e)}function PS(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function FP(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function PE(e,t,n){return n=Zf(n),n.tag=3,n.payload={element:null},n.callback=function(){PS(e,t)},n}function XG(e){return e=Zf(e),e.tag=3,e}function QG(e,t,n,s){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=s.value;e.payload=function(){return r(i)},e.callback=function(){FP(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){FP(t,n,s),typeof r!="function"&&(tm===null?tm=new Set([this]):tm.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function She(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Tb(t,n,r,!0),n=rc.current,n!==null){switch(n.tag){case 31:case 13:return Pc===null?FS():n.alternate===null&&zi===0&&(zi=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===MS?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),o6(e,s,r)),!1;case 22:return n.flags|=65536,s===MS?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),o6(e,s,r)),!1}throw Error(ct(435,n.tag))}return o6(e,s,r),FS(),!1}if(sr)return t=rc.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==_E&&(e=Error(ct(422),{cause:s}),gx(Nc(e,n)))):(s!==_E&&(t=Error(ct(423),{cause:s}),gx(Nc(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=Nc(s,n),r=PE(e.stateNode,s,r),G5(e,r),zi!==4&&(zi=2)),!1;var i=Error(ct(520),{cause:s});if(i=Nc(i,n),Bv===null?Bv=[i]:Bv.push(i),zi!==4&&(zi=2),t===null)return!0;s=Nc(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=PE(n.stateNode,s,e),G5(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"&&(tm===null||!tm.has(i))))return n.flags|=65536,r&=-r,n.lanes|=r,r=XG(r),QG(r,e,n,s),G5(n,r),!1}n=n.return}while(n!==null);return!1}var WM=Error(ct(461)),co=!1;function Xo(e,t,n,s){t.child=e===null?dG(t,null,n,s):d0(t,e.child,n,s)}function HP(e,t,n,s,r){n=n.render;var i=t.ref;if("ref"in s){var o={};for(var a in s)a!=="ref"&&(o[a]=s[a])}else o=s;return u0(t),s=RM(e,t,n,o,i,r),a=DM(),e!==null&&!co?(LM(e,t,r),Rh(e,t,r)):(sr&&a&&CM(t),t.flags|=1,Xo(e,t,s,r),t.child)}function qP(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!SM(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,JG(e,t,i,s,r)):(e=I2(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!VM(e,r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:mx,n(o,s)&&e.ref===t.ref)return Rh(e,t,r)}return t.flags|=1,e=yh(i,s),e.ref=t.ref,e.return=t,t.child=e}function JG(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(mx(i,s)&&e.ref===t.ref)if(co=!1,t.pendingProps=s=i,VM(e,r))e.flags&131072&&(co=!0);else return t.lanes=e.lanes,Rh(e,t,r)}return OE(e,t,n,s,r)}function ZG(e,t,n,s){var r=s.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(s=t.child=e.child,r=0;s!==null;)r=r|s.lanes|s.childLanes,s=s.sibling;s=r&~i}else s=0,t.child=null;return UP(e,t,i,n,s)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&R2(t,i!==null?i.cachePool:null),i!==null?IP(t,i):NE(),mG(t);else return s=t.lanes=536870912,UP(e,t,i!==null?i.baseLanes|n:n,n,s)}else i!==null?(R2(t,i.cachePool),IP(t,i),Rf(),t.memoizedState=null):(e!==null&&R2(t,null),NE(),Rf());return Xo(e,t,r,n),t.child}function uv(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function UP(e,t,n,s,r){var i=AM();return i=i===null?null:{parent:oo._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&R2(t,null),NE(),mG(t),e!==null&&Tb(e,t,s,!0),t.childLanes=r,null}function P2(e,t){return t=OS({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function WP(e,t,n){return d0(t,e.child,null,n),e=P2(t,t.pendingProps),e.flags|=2,Hl(t),t.memoizedState=null,e}function Che(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(sr){if(s.mode==="hidden")return e=P2(t,s),t.lanes=536870912,uv(null,e);if(ME(t),(e=oi)?(e=WK(e,Mc),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:fm!==null?{id:Xu,overflow:Qu}:null,retryLane:536870912,hydrationErrors:null},n=rG(e),n.return=t,t.child=n,sa=t,oi=null)):e=null,e===null)throw mm(t);return t.lanes=536870912,null}return P2(t,s)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(ME(t),r)if(t.flags&256)t.flags&=-257,t=WP(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(ct(558));else if(co||Tb(e,t,n,!1),r=(n&e.childLanes)!==0,co||r){if(s=Yr,s!==null&&(o=NV(s,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,O0(e,o),vl(s,e,o),WM;FS(),t=WP(e,t,n)}else e=i.treeContext,oi=Oc(o.nextSibling),sa=t,sr=!0,Jf=null,Mc=!1,e!==null&&oG(t,e),t=P2(t,s),t.flags|=4096;return t}return e=yh(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function O2(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(ct(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function OE(e,t,n,s,r){return u0(t),n=RM(e,t,n,s,void 0,r),s=DM(),e!==null&&!co?(LM(e,t,r),Rh(e,t,r)):(sr&&s&&CM(t),t.flags|=1,Xo(e,t,n,r),t.child)}function VP(e,t,n,s,r,i){return u0(t),t.updateQueue=null,n=gG(t,s,n,r),pG(e),s=DM(),e!==null&&!co?(LM(e,t,i),Rh(e,t,i)):(sr&&s&&CM(t),t.flags|=1,Xo(e,t,n,i),t.child)}function GP(e,t,n,s,r){if(u0(t),t.stateNode===null){var i=c1,o=n.contextType;typeof o=="object"&&o!==null&&(i=ra(o)),i=new n(s,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=LE,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=s,i.state=t.memoizedState,i.refs={},NM(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?ra(o):c1,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(Y5(t,n,o,s),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&&LE.enqueueReplaceState(i,i.state,null),Lv(t,s,i,r),Dv(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,c=f0(n,a);i.props=c;var u=i.context,d=n.contextType;o=c1,typeof d=="object"&&d!==null&&(o=ra(d));var h=n.getDerivedStateFromProps;d=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||u!==o)&&zP(t,i,s,o),Tf=!1;var m=t.memoizedState;i.state=m,Lv(t,s,i,r),Dv(),u=t.memoizedState,a||m!==u||Tf?(typeof h=="function"&&(Y5(t,n,h,s),u=t.memoizedState),(c=Tf||BP(t,n,c,s,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=s,t.memoizedState=u),i.props=s,i.state=u,i.context=o,s=c):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{i=t.stateNode,AE(e,t),o=t.memoizedProps,d=f0(n,o),i.props=d,h=t.pendingProps,m=i.context,u=n.contextType,c=c1,typeof u=="object"&&u!==null&&(c=ra(u)),a=n.getDerivedStateFromProps,(u=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==h||m!==c)&&zP(t,i,s,c),Tf=!1,m=t.memoizedState,i.state=m,Lv(t,s,i,r),Dv();var p=t.memoizedState;o!==h||m!==p||Tf||e!==null&&e.dependencies!==null&&NS(e.dependencies)?(typeof a=="function"&&(Y5(t,n,a,s),p=t.memoizedState),(d=Tf||BP(t,n,d,s,m,p,c)||e!==null&&e.dependencies!==null&&NS(e.dependencies))?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(s,p,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(s,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=s,t.memoizedState=p),i.props=s,i.state=p,i.context=c,s=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),s=!1)}return i=s,O2(e,t),s=(t.flags&128)!==0,i||s?(i=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&s?(t.child=d0(t,e.child,null,r),t.child=d0(t,null,n,r)):Xo(e,t,n,r),t.memoizedState=i.state,e=t.child):e=Rh(e,t,r),e}function KP(e,t,n,s){return c0(),t.flags|=256,Xo(e,t,n,s),t.child}var X5={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Q5(e){return{baseLanes:e,cachePool:lG()}}function J5(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Kl),e}function eK(e,t,n){var s=t.pendingProps,r=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(Xi.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(sr){if(r?If(t):Rf(),(e=oi)?(e=WK(e,Mc),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:fm!==null?{id:Xu,overflow:Qu}:null,retryLane:536870912,hydrationErrors:null},n=rG(e),n.return=t,t.child=n,sa=t,oi=null)):e=null,e===null)throw mm(t);return QE(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(Rf(),r=t.mode,a=OS({mode:"hidden",children:a},r),s=t0(s,r,n,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=Q5(n),s.childLanes=J5(e,o,n),t.memoizedState=X5,uv(null,s)):(If(t),$E(t,a))}var c=e.memoizedState;if(c!==null&&(a=c.dehydrated,a!==null)){if(i)t.flags&256?(If(t),t.flags&=-257,t=Z5(e,t,n)):t.memoizedState!==null?(Rf(),t.child=e.child,t.flags|=128,t=null):(Rf(),a=s.fallback,r=t.mode,s=OS({mode:"visible",children:s.children},r),a=t0(a,r,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,d0(t,e.child,null,n),s=t.child,s.memoizedState=Q5(n),s.childLanes=J5(e,o,n),t.memoizedState=X5,t=uv(null,s));else if(If(t),QE(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var u=o.dgst;o=u,s=Error(ct(419)),s.stack="",s.digest=o,gx({value:s,source:null,stack:null}),t=Z5(e,t,n)}else if(co||Tb(e,t,n,!1),o=(n&e.childLanes)!==0,co||o){if(o=Yr,o!==null&&(s=NV(o,n),s!==0&&s!==c.retryLane))throw c.retryLane=s,O0(e,s),vl(o,e,s),WM;XE(a)||FS(),t=Z5(e,t,n)}else XE(a)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,oi=Oc(a.nextSibling),sa=t,sr=!0,Jf=null,Mc=!1,e!==null&&oG(t,e),t=$E(t,s.children),t.flags|=4096);return t}return r?(Rf(),a=s.fallback,r=t.mode,c=e.child,u=c.sibling,s=yh(c,{mode:"hidden",children:s.children}),s.subtreeFlags=c.subtreeFlags&65011712,u!==null?a=yh(u,a):(a=t0(a,r,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,uv(null,s),s=t.child,a=e.child.memoizedState,a===null?a=Q5(n):(r=a.cachePool,r!==null?(c=oo._currentValue,r=r.parent!==c?{parent:c,pool:c}:r):r=lG(),a={baseLanes:a.baseLanes|n,cachePool:r}),s.memoizedState=a,s.childLanes=J5(e,o,n),t.memoizedState=X5,uv(e.child,s)):(If(t),n=e.child,e=n.sibling,n=yh(n,{mode:"visible",children:s.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 $E(e,t){return t=OS({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function OS(e,t){return e=Ul(22,e,null,t),e.lanes=0,e}function Z5(e,t,n){return d0(t,e.child,null,n),e=$E(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function YP(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),CE(e.return,t,n)}function e6(e,t,n,s,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=s,o.tail=n,o.tailMode=r,o.treeForkCount=i)}function tK(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;s=s.children;var o=Xi.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,ni(Xi,o),Xo(e,t,s,n),s=sr?px:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&YP(e,n,t);else if(e.tag===19)YP(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(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&RS(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),e6(t,!1,r,n,i,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&RS(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}e6(t,!0,n,null,i,s);break;case"together":e6(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Rh(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gm|=t.lanes,!(n&t.childLanes))if(e!==null){if(Tb(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(ct(153));if(t.child!==null){for(e=t.child,n=yh(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=yh(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function VM(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&NS(e)))}function The(e,t,n){switch(t.tag){case 3:_S(t,t.stateNode.containerInfo),Mf(t,oo,e.memoizedState.cache),c0();break;case 27:case 5:hE(t);break;case 4:_S(t,t.stateNode.containerInfo);break;case 10:Mf(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ME(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(If(t),t.flags|=128,null):n&t.child.childLanes?eK(e,t,n):(If(t),e=Rh(e,t,n),e!==null?e.sibling:null);If(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Tb(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return tK(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ni(Xi,Xi.current),s)break;return null;case 22:return t.lanes=0,ZG(e,t,n,t.pendingProps);case 24:Mf(t,oo,e.memoizedState.cache)}return Rh(e,t,n)}function nK(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)co=!0;else{if(!VM(e,n)&&!(t.flags&128))return co=!1,The(e,t,n);co=!!(e.flags&131072)}else co=!1,sr&&t.flags&1048576&&iG(t,px,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Rp(t.elementType),t.type=e,typeof e=="function")SM(e)?(s=f0(e,s),t.tag=1,t=GP(null,t,e,s,n)):(t.tag=0,t=OE(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===uM){t.tag=11,t=HP(null,t,e,s,n);break e}else if(r===dM){t.tag=14,t=qP(null,t,e,s,n);break e}}throw t=uE(e)||e,Error(ct(306,t,""))}}return t;case 0:return OE(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=f0(s,t.pendingProps),GP(e,t,s,r,n);case 3:e:{if(_S(t,t.stateNode.containerInfo),e===null)throw Error(ct(387));s=t.pendingProps;var i=t.memoizedState;r=i.element,AE(e,t),Lv(t,s,null,n);var o=t.memoizedState;if(s=o.cache,Mf(t,oo,s),s!==i.cache&&TE(t,[oo],n,!0),Dv(),s=o.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=KP(e,t,s,n);break e}else if(s!==r){r=Nc(Error(ct(424)),t),gx(r),t=KP(e,t,s,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(oi=Oc(e.firstChild),sa=t,sr=!0,Jf=null,Mc=!0,n=dG(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(c0(),s===r){t=Rh(e,t,n);break e}Xo(e,t,s,n)}t=t.child}return t;case 26:return O2(e,t),e===null?(n=pO(t.type,null,t.pendingProps,null))?t.memoizedState=n:sr||(n=t.type,e=t.pendingProps,s=WS(Qf.current).createElement(n),s[na]=t,s[Tl]=e,oa(s,n,e),Fo(s),t.stateNode=s):t.memoizedState=pO(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return hE(t),e===null&&sr&&(s=t.stateNode=VK(t.type,t.pendingProps,Qf.current),sa=t,Mc=!0,r=oi,Bm(t.type)?(JE=r,oi=Oc(s.firstChild)):oi=r),Xo(e,t,t.pendingProps.children,n),O2(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&sr&&((r=s=oi)&&(s=nfe(s,t.type,t.pendingProps,Mc),s!==null?(t.stateNode=s,sa=t,oi=Oc(s.firstChild),Mc=!1,r=!0):r=!1),r||mm(t)),hE(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,KE(r,i)?s=null:o!==null&&KE(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=RM(e,t,bhe,null,null,n),kx._currentValue=r),O2(e,t),Xo(e,t,s,n),t.child;case 6:return e===null&&sr&&((e=n=oi)&&(n=sfe(n,t.pendingProps,Mc),n!==null?(t.stateNode=n,sa=t,oi=null,e=!0):e=!1),e||mm(t)),null;case 13:return eK(e,t,n);case 4:return _S(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=d0(t,null,s,n):Xo(e,t,s,n),t.child;case 11:return HP(e,t,t.type,t.pendingProps,n);case 7:return Xo(e,t,t.pendingProps,n),t.child;case 8:return Xo(e,t,t.pendingProps.children,n),t.child;case 12:return Xo(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Mf(t,t.type,s.value),Xo(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,u0(t),r=ra(r),s=s(r),t.flags|=1,Xo(e,t,s,n),t.child;case 14:return qP(e,t,t.type,t.pendingProps,n);case 15:return JG(e,t,t.type,t.pendingProps,n);case 19:return tK(e,t,n);case 31:return Che(e,t,n);case 22:return ZG(e,t,n,t.pendingProps);case 24:return u0(t),s=ra(oo),e===null?(r=AM(),r===null&&(r=Yr,i=EM(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=n),r=i),t.memoizedState={parent:s,cache:r},NM(t),Mf(t,oo,r)):(e.lanes&n&&(AE(e,t),Lv(t,null,null,n),Dv()),r=e.memoizedState,i=t.memoizedState,r.parent!==s?(r={parent:s,cache:s},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Mf(t,oo,s)):(s=i.cache,Mf(t,oo,s),s!==r.cache&&TE(t,[oo],n,!0))),Xo(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(ct(156,t.tag))}function Kd(e){e.flags|=4}function t6(e,t,n,s,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(TK())e.flags|=8192;else throw s0=MS,jM}else e.flags&=-16777217}function XP(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!YK(t))if(TK())e.flags|=8192;else throw s0=MS,jM}function Xk(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?EV():536870912,e.lanes|=t,Y1|=t)}function Ry(e,t){if(!sr)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 s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function ii(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&65011712,s|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function Ehe(e,t,n){var s=t.pendingProps;switch(TM(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,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),vh(oo),q1(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(_g(t)?Kd(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,V5())),ii(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(Kd(t),i!==null?(ii(t),XP(t,i)):(ii(t),t6(t,r,null,s,n))):i?i!==e.memoizedState?(Kd(t),ii(t),XP(t,i)):(ii(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Kd(t),ii(t),t6(t,r,e,s,n)),null;case 27:if(SS(t),n=Qf.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Kd(t);else{if(!s){if(t.stateNode===null)throw Error(ct(166));return ii(t),null}e=ad.current,_g(t)?CP(t):(e=VK(r,s,n),t.stateNode=e,Kd(t))}return ii(t),null;case 5:if(SS(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Kd(t);else{if(!s){if(t.stateNode===null)throw Error(ct(166));return ii(t),null}if(i=ad.current,_g(t))CP(t);else{var o=WS(Qf.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof s.is=="string"?o.createElement("select",{is:s.is}):o.createElement("select"),s.multiple?i.multiple=!0:s.size&&(i.size=s.size);break;default:i=typeof s.is=="string"?o.createElement(r,{is:s.is}):o.createElement(r)}}i[na]=t,i[Tl]=s;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(oa(i,r,s),r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Kd(t)}}return ii(t),t6(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Kd(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(ct(166));if(e=Qf.current,_g(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=sa,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[na]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||HK(e.nodeValue,n)),e||mm(t,!0)}else e=WS(e).createTextNode(s),e[na]=t,t.stateNode=e}return ii(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=_g(t),n!==null){if(e===null){if(!s)throw Error(ct(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ct(557));e[na]=t}else c0(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ii(t),e=!1}else n=V5(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Hl(t),t):(Hl(t),null);if(t.flags&128)throw Error(ct(558))}return ii(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=_g(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(ct(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(ct(317));r[na]=t}else c0(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ii(t),r=!1}else r=V5(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Hl(t),t):(Hl(t),null)}return Hl(t),t.flags&128?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,r=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(r=s.alternate.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==r&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Xk(t,t.updateQueue),ii(t),null);case 4:return q1(),e===null&&ZM(t.stateNode.containerInfo),ii(t),null;case 10:return vh(t.type),ii(t),null;case 19:if(Uo(Xi),s=t.memoizedState,s===null)return ii(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)Ry(s,!1);else{if(zi!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=RS(e),i!==null){for(t.flags|=128,Ry(s,!1),e=i.updateQueue,t.updateQueue=e,Xk(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)sG(n,e),n=n.sibling;return ni(Xi,Xi.current&1|2),sr&&sh(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Ql()>BS&&(t.flags|=128,r=!0,Ry(s,!1),t.lanes=4194304)}else{if(!r)if(e=RS(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Xk(t,e),Ry(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!sr)return ii(t),null}else 2*Ql()-s.renderingStartTime>BS&&n!==536870912&&(t.flags|=128,r=!0,Ry(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(e=s.last,e!==null?e.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Ql(),e.sibling=null,n=Xi.current,ni(Xi,r?n&1|2:n&1),sr&&sh(t,s.treeForkCount),e):(ii(t),null);case 22:case 23:return Hl(t),MM(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(ii(t),t.subtreeFlags&6&&(t.flags|=8192)):ii(t),n=t.updateQueue,n!==null&&Xk(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&Uo(n0),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),vh(oo),ii(t),null;case 25:return null;case 30:return null}throw Error(ct(156,t.tag))}function Ahe(e,t){switch(TM(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vh(oo),q1(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return SS(t),null;case 31:if(t.memoizedState!==null){if(Hl(t),t.alternate===null)throw Error(ct(340));c0()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Hl(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ct(340));c0()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Uo(Xi),null;case 4:return q1(),null;case 10:return vh(t.type),null;case 22:case 23:return Hl(t),MM(),e!==null&&Uo(n0),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return vh(oo),null;case 25:return null;default:return null}}function sK(e,t){switch(TM(t),t.tag){case 3:vh(oo),q1();break;case 26:case 27:case 5:SS(t);break;case 4:q1();break;case 31:t.memoizedState!==null&&Hl(t);break;case 13:Hl(t);break;case 19:Uo(Xi);break;case 10:vh(t.type);break;case 22:case 23:Hl(t),MM(),e!==null&&Uo(n0);break;case 24:vh(oo)}}function xw(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var r=s.next;n=r;do{if((n.tag&e)===e){s=void 0;var i=n.create,o=n.inst;s=i(),o.destroy=s}n=n.next}while(n!==r)}}catch(a){Ir(t,t.return,a)}}function pm(e,t,n){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var i=r.next;s=i;do{if((s.tag&e)===e){var o=s.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,r=t;var c=n,u=a;try{u()}catch(d){Ir(r,c,d)}}}s=s.next}while(s!==i)}}catch(d){Ir(t,t.return,d)}}function rK(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{fG(t,n)}catch(s){Ir(e,e.return,s)}}}function iK(e,t,n){n.props=f0(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Ir(e,t,s)}}function Ov(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(r){Ir(e,t,r)}}function Ju(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){Ir(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){Ir(e,t,r)}else n.current=null}function oK(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(r){Ir(e,e.return,r)}}function n6(e,t,n){try{var s=e.stateNode;Xhe(s,e.type,n,t),s[Tl]=t}catch(r){Ir(e,e.return,r)}}function aK(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bm(e.type)||e.tag===4}function s6(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||aK(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&&Bm(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 BE(e,t,n){var s=e.tag;if(s===5||s===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=uh));else if(s!==4&&(s===27&&Bm(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(BE(e,t,n),e=e.sibling;e!==null;)BE(e,t,n),e=e.sibling}function $S(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&Bm(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($S(e,t,n),e=e.sibling;e!==null;)$S(e,t,n),e=e.sibling}function lK(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);oa(t,s,n),t[na]=e,t[Tl]=n}catch(i){Ir(e,e.return,i)}}var ih=!1,io=!1,r6=!1,QP=typeof WeakSet=="function"?WeakSet:Set,zo=null;function jhe(e,t){if(e=e.containerInfo,VE=YS,e=YV(e),wM(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,d=0,h=e,m=null;t:for(;;){for(var p;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==i||s!==0&&h.nodeType!==3||(c=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)m=h,h=p;for(;;){if(h===e)break t;if(m===n&&++u===r&&(a=o),m===i&&++d===s&&(c=o),(p=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=p}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(GE={focusedElem:e,selectionRange:n},YS=!1,zo=t;zo!==null;)if(t=zo,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,zo=e;else for(;zo!==null;){switch(t=zo,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++)r=e[n],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,r=i.memoizedProps,i=i.memoizedState,s=n.stateNode;try{var g=f0(n.type,r);e=s.getSnapshotBeforeUpdate(g,i),s.__reactInternalSnapshotBeforeUpdate=e}catch(b){Ir(n,n.return,b)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)YE(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":YE(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(ct(163))}if(e=t.sibling,e!==null){e.return=t.return,zo=e;break}zo=t.return}}function cK(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Xd(e,n),s&4&&xw(5,n);break;case 1:if(Xd(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){Ir(n,n.return,o)}else{var r=f0(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Ir(n,n.return,o)}}s&64&&rK(n),s&512&&Ov(n,n.return);break;case 3:if(Xd(e,n),s&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{fG(e,t)}catch(o){Ir(n,n.return,o)}}break;case 27:t===null&&s&4&&lK(n);case 26:case 5:Xd(e,n),t===null&&s&4&&oK(n),s&512&&Ov(n,n.return);break;case 12:Xd(e,n);break;case 31:Xd(e,n),s&4&&hK(e,n);break;case 13:Xd(e,n),s&4&&fK(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=$he.bind(null,n),rfe(e,n))));break;case 22:if(s=n.memoizedState!==null||ih,!s){t=t!==null&&t.memoizedState!==null||io,r=ih;var i=io;ih=s,(io=t)&&!i?nh(e,n,(n.subtreeFlags&8772)!==0):Xd(e,n),ih=r,io=i}break;case 30:break;default:Xd(e,n)}}function uK(e){var t=e.alternate;t!==null&&(e.alternate=null,uK(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pM(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 mi=null,ll=!1;function Yd(e,t,n){for(n=n.child;n!==null;)dK(e,t,n),n=n.sibling}function dK(e,t,n){if(Jl&&typeof Jl.onCommitFiberUnmount=="function")try{Jl.onCommitFiberUnmount(fw,n)}catch{}switch(n.tag){case 26:io||Ju(n,t),Yd(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:io||Ju(n,t);var s=mi,r=ll;Bm(n.type)&&(mi=n.stateNode,ll=!1),Yd(e,t,n),Fv(n.stateNode),mi=s,ll=r;break;case 5:io||Ju(n,t);case 6:if(s=mi,r=ll,mi=null,Yd(e,t,n),mi=s,ll=r,mi!==null)if(ll)try{(mi.nodeType===9?mi.body:mi.nodeName==="HTML"?mi.ownerDocument.body:mi).removeChild(n.stateNode)}catch(i){Ir(n,t,i)}else try{mi.removeChild(n.stateNode)}catch(i){Ir(n,t,i)}break;case 18:mi!==null&&(ll?(e=mi,uO(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Z1(e)):uO(mi,n.stateNode));break;case 4:s=mi,r=ll,mi=n.stateNode.containerInfo,ll=!0,Yd(e,t,n),mi=s,ll=r;break;case 0:case 11:case 14:case 15:pm(2,n,t),io||pm(4,n,t),Yd(e,t,n);break;case 1:io||(Ju(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&iK(n,t,s)),Yd(e,t,n);break;case 21:Yd(e,t,n);break;case 22:io=(s=io)||n.memoizedState!==null,Yd(e,t,n),io=s;break;default:Yd(e,t,n)}}function hK(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Z1(e)}catch(n){Ir(t,t.return,n)}}}function fK(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Z1(e)}catch(n){Ir(t,t.return,n)}}function Nhe(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new QP),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new QP),t;default:throw Error(ct(435,e.tag))}}function Qk(e,t){var n=Nhe(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=Bhe.bind(null,e,s);s.then(r,r)}})}function nl(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s],i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(Bm(a.type)){mi=a.stateNode,ll=!1;break e}break;case 5:mi=a.stateNode,ll=!1;break e;case 3:case 4:mi=a.stateNode.containerInfo,ll=!0;break e}a=a.return}if(mi===null)throw Error(ct(160));dK(i,o,r),mi=null,ll=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)mK(t,e),t=t.sibling}var eu=null;function mK(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:nl(t,e),sl(e),s&4&&(pm(3,e,e.return),xw(3,e),pm(5,e,e.return));break;case 1:nl(t,e),sl(e),s&512&&(io||n===null||Ju(n,n.return)),s&64&&ih&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var r=eu;if(nl(t,e),sl(e),s&512&&(io||n===null||Ju(n,n.return)),s&4){var i=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(s){case"title":i=r.getElementsByTagName("title")[0],(!i||i[gw]||i[na]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(s),r.head.insertBefore(i,r.querySelector("head > title"))),oa(i,s,n),i[na]=e,Fo(i),s=i;break e;case"link":var o=bO("link","href",r).get(s+(n.href||""));if(o){for(var a=0;a<o.length;a++)if(i=o[a],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(a,1);break t}}i=r.createElement(s),oa(i,s,n),r.head.appendChild(i);break;case"meta":if(o=bO("meta","content",r).get(s+(n.content||""))){for(a=0;a<o.length;a++)if(i=o[a],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(a,1);break t}}i=r.createElement(s),oa(i,s,n),r.head.appendChild(i);break;default:throw Error(ct(468,s))}i[na]=e,Fo(i),s=i}e.stateNode=s}else yO(r,e.type,e.stateNode);else e.stateNode=gO(r,s,e.memoizedProps);else i!==s?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,s===null?yO(r,e.type,e.stateNode):gO(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&n6(e,e.memoizedProps,n.memoizedProps)}break;case 27:nl(t,e),sl(e),s&512&&(io||n===null||Ju(n,n.return)),n!==null&&s&4&&n6(e,e.memoizedProps,n.memoizedProps);break;case 5:if(nl(t,e),sl(e),s&512&&(io||n===null||Ju(n,n.return)),e.flags&32){r=e.stateNode;try{W1(r,"")}catch(g){Ir(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,n6(e,r,n!==null?n.memoizedProps:r)),s&1024&&(r6=!0);break;case 6:if(nl(t,e),sl(e),s&4){if(e.stateNode===null)throw Error(ct(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(g){Ir(e,e.return,g)}}break;case 3:if(z2=null,r=eu,eu=VS(t.containerInfo),nl(t,e),eu=r,sl(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Z1(t.containerInfo)}catch(g){Ir(e,e.return,g)}r6&&(r6=!1,pK(e));break;case 4:s=eu,eu=VS(e.stateNode.containerInfo),nl(t,e),sl(e),eu=s;break;case 12:nl(t,e),sl(e);break;case 31:nl(t,e),sl(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Qk(e,s)));break;case 13:nl(t,e),sl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(X3=Ql()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Qk(e,s)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=ih,d=io;if(ih=u||r,io=d||c,nl(t,e),io=d,ih=u,sl(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||ih||io||Dp(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(i=c.stateNode,r)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=c.stateNode;var h=c.memoizedProps.style,m=h!=null&&h.hasOwnProperty("display")?h.display:null;a.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){Ir(c,c.return,g)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(g){Ir(c,c.return,g)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;r?dO(p,!0):dO(c.stateNode,!1)}catch(g){Ir(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}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,Qk(e,n))));break;case 19:nl(t,e),sl(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Qk(e,s)));break;case 30:break;case 21:break;default:nl(t,e),sl(e)}}function sl(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(aK(s)){n=s;break}s=s.return}if(n==null)throw Error(ct(160));switch(n.tag){case 27:var r=n.stateNode,i=s6(e);$S(e,i,r);break;case 5:var o=n.stateNode;n.flags&32&&(W1(o,""),n.flags&=-33);var a=s6(e);$S(e,a,o);break;case 3:case 4:var c=n.stateNode.containerInfo,u=s6(e);BE(e,u,c);break;default:throw Error(ct(161))}}catch(d){Ir(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pK(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;pK(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Xd(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cK(e,t.alternate,t),t=t.sibling}function Dp(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:pm(4,t,t.return),Dp(t);break;case 1:Ju(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&iK(t,t.return,n),Dp(t);break;case 27:Fv(t.stateNode);case 26:case 5:Ju(t,t.return),Dp(t);break;case 22:t.memoizedState===null&&Dp(t);break;case 30:Dp(t);break;default:Dp(t)}e=e.sibling}}function nh(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,r=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:nh(r,i,n),xw(4,i);break;case 1:if(nh(r,i,n),s=i,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(u){Ir(s,s.return,u)}if(s=i,r=s.updateQueue,r!==null){var a=s.stateNode;try{var c=r.shared.hiddenCallbacks;if(c!==null)for(r.shared.hiddenCallbacks=null,r=0;r<c.length;r++)hG(c[r],a)}catch(u){Ir(s,s.return,u)}}n&&o&64&&rK(i),Ov(i,i.return);break;case 27:lK(i);case 26:case 5:nh(r,i,n),n&&s===null&&o&4&&oK(i),Ov(i,i.return);break;case 12:nh(r,i,n);break;case 31:nh(r,i,n),n&&o&4&&hK(r,i);break;case 13:nh(r,i,n),n&&o&4&&fK(r,i);break;case 22:i.memoizedState===null&&nh(r,i,n),Ov(i,i.return);break;case 30:break;default:nh(r,i,n)}t=t.sibling}}function GM(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&&yw(n))}function KM(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&yw(e))}function Kc(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)gK(e,t,n,s),t=t.sibling}function gK(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:Kc(e,t,n,s),r&2048&&xw(9,t);break;case 1:Kc(e,t,n,s);break;case 3:Kc(e,t,n,s),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&yw(e)));break;case 12:if(r&2048){Kc(e,t,n,s),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,a=i.onPostCommit;typeof a=="function"&&a(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Ir(t,t.return,c)}}else Kc(e,t,n,s);break;case 31:Kc(e,t,n,s);break;case 13:Kc(e,t,n,s);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?Kc(e,t,n,s):$v(e,t):i._visibility&2?Kc(e,t,n,s):(i._visibility|=2,Wg(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&GM(o,t);break;case 24:Kc(e,t,n,s),r&2048&&KM(t.alternate,t);break;default:Kc(e,t,n,s)}}function Wg(e,t,n,s,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,a=n,c=s,u=o.flags;switch(o.tag){case 0:case 11:case 15:Wg(i,o,a,c,r),xw(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?Wg(i,o,a,c,r):$v(i,o):(d._visibility|=2,Wg(i,o,a,c,r)),r&&u&2048&&GM(o.alternate,o);break;case 24:Wg(i,o,a,c,r),r&&u&2048&&KM(o.alternate,o);break;default:Wg(i,o,a,c,r)}t=t.sibling}}function $v(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,r=s.flags;switch(s.tag){case 22:$v(n,s),r&2048&&GM(s.alternate,s);break;case 24:$v(n,s),r&2048&&KM(s.alternate,s);break;default:$v(n,s)}t=t.sibling}}var dv=8192;function Sg(e,t,n){if(e.subtreeFlags&dv)for(e=e.child;e!==null;)bK(e,t,n),e=e.sibling}function bK(e,t,n){switch(e.tag){case 26:Sg(e,t,n),e.flags&dv&&e.memoizedState!==null&&gfe(n,eu,e.memoizedState,e.memoizedProps);break;case 5:Sg(e,t,n);break;case 3:case 4:var s=eu;eu=VS(e.stateNode.containerInfo),Sg(e,t,n),eu=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=dv,dv=16777216,Sg(e,t,n),dv=s):Sg(e,t,n));break;default:Sg(e,t,n)}}function yK(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 Dy(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];zo=s,xK(s,e)}yK(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)vK(e),e=e.sibling}function vK(e){switch(e.tag){case 0:case 11:case 15:Dy(e),e.flags&2048&&pm(9,e,e.return);break;case 3:Dy(e);break;case 12:Dy(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$2(e)):Dy(e);break;default:Dy(e)}}function $2(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];zo=s,xK(s,e)}yK(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:pm(8,t,t.return),$2(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,$2(t));break;default:$2(t)}e=e.sibling}}function xK(e,t){for(;zo!==null;){var n=zo;switch(n.tag){case 0:case 11:case 15:pm(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:yw(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,zo=s;else e:for(n=e;zo!==null;){s=zo;var r=s.sibling,i=s.return;if(uK(s),s===n){zo=null;break e}if(r!==null){r.return=i,zo=r;break e}zo=i}}}var Mhe={getCacheForType:function(e){var t=ra(oo),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ra(oo).controller.signal}},Ihe=typeof WeakMap=="function"?WeakMap:Map,wr=0,Yr=null,Gs=null,Js=0,Mr=0,zl=null,Bf=!1,Ab=!1,YM=!1,Dh=0,zi=0,gm=0,r0=0,XM=0,Kl=0,Y1=0,Bv=null,cl=null,zE=!1,X3=0,wK=0,BS=1/0,zS=null,tm=null,Co=0,nm=null,X1=null,xh=0,FE=0,HE=null,kK=null,zv=0,qE=null;function ec(){return wr&2&&Js!==0?Js&-Js:us.T!==null?JM():MV()}function _K(){if(Kl===0)if(!(Js&536870912)||sr){var e=qk;qk<<=1,!(qk&3932160)&&(qk=262144),Kl=e}else Kl=536870912;return e=rc.current,e!==null&&(e.flags|=32),Kl}function vl(e,t,n){(e===Yr&&(Mr===2||Mr===9)||e.cancelPendingCommit!==null)&&(Q1(e,0),zf(e,Js,Kl,!1)),pw(e,n),(!(wr&2)||e!==Yr)&&(e===Yr&&(!(wr&2)&&(r0|=n),zi===4&&zf(e,Js,Kl,!1)),vd(e))}function SK(e,t,n){if(wr&6)throw Error(ct(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||mw(e,t),r=s?Lhe(e,t):i6(e,t,!0),i=s;do{if(r===0){Ab&&!s&&zf(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Rhe(n)){r=i6(e,t,!1),i=!1;continue}if(r===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 a=e;r=Bv;var c=a.current.memoizedState.isDehydrated;if(c&&(Q1(a,o).flags|=256),o=i6(a,o,!1),o!==2){if(YM&&!c){a.errorRecoveryDisabledLanes|=i,r0|=i,r=4;break e}i=cl,cl=r,i!==null&&(cl===null?cl=i:cl.push.apply(cl,i))}r=o}if(i=!1,r!==2)continue}}if(r===1){Q1(e,0),zf(e,t,0,!0);break}e:{switch(s=e,i=r,i){case 0:case 1:throw Error(ct(345));case 4:if((t&4194048)!==t)break;case 6:zf(s,t,Kl,!Bf);break e;case 2:cl=null;break;case 3:case 5:break;default:throw Error(ct(329))}if((t&62914560)===t&&(r=X3+300-Ql(),10<r)){if(zf(s,t,Kl,!Bf),B3(s,0,!0)!==0)break e;xh=t,s.timeoutHandle=UK(JP.bind(null,s,n,cl,zS,zE,t,Kl,r0,Y1,Bf,i,"Throttled",-0,0),r);break e}JP(s,n,cl,zS,zE,t,Kl,r0,Y1,Bf,i,null,-0,0)}}break}while(!0);vd(e)}function JP(e,t,n,s,r,i,o,a,c,u,d,h,m,p){if(e.timeoutHandle=-1,h=t.subtreeFlags,h&8192||(h&16785408)===16785408){h={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:uh},bK(t,i,h);var g=(i&62914560)===i?X3-Ql():(i&4194048)===i?wK-Ql():0;if(g=bfe(h,g),g!==null){xh=i,e.cancelPendingCommit=g(eO.bind(null,e,t,i,n,s,r,o,a,c,d,h,null,m,p)),zf(e,i,o,!u);return}}eO(e,t,i,n,s,r,o,a,c)}function Rhe(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 s=0;s<n.length;s++){var r=n[s],i=r.getSnapshot;r=r.value;try{if(!sc(i(),r))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 zf(e,t,n,s){t&=~XM,t&=~r0,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var i=31-Zl(r),o=1<<i;s[i]=-1,r&=~o}n!==0&&AV(e,n,t)}function Q3(){return wr&6?!0:(ww(0),!1)}function QM(){if(Gs!==null){if(Mr===0)var e=Gs.return;else e=Gs,dh=$0=null,PM(e),C1=null,bx=0,e=Gs;for(;e!==null;)sK(e.alternate,e),e=e.return;Gs=null}}function Q1(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zhe(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),xh=0,QM(),Yr=e,Gs=n=yh(e.current,null),Js=t,Mr=0,zl=null,Bf=!1,Ab=mw(e,t),YM=!1,Y1=Kl=XM=r0=gm=zi=0,cl=Bv=null,zE=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-Zl(s),i=1<<r;t|=e[r],s&=~i}return Dh=t,q3(),n}function CK(e,t){Is=null,us.H=vx,t===Eb||t===W3?(t=NP(),Mr=3):t===jM?(t=NP(),Mr=4):Mr=t===WM?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,zl=t,Gs===null&&(zi=1,PS(e,Nc(t,e.current)))}function TK(){var e=rc.current;return e===null?!0:(Js&4194048)===Js?Pc===null:(Js&62914560)===Js||Js&536870912?e===Pc:!1}function EK(){var e=us.H;return us.H=vx,e===null?vx:e}function AK(){var e=us.A;return us.A=Mhe,e}function FS(){zi=4,Bf||(Js&4194048)!==Js&&rc.current!==null||(Ab=!0),!(gm&134217727)&&!(r0&134217727)||Yr===null||zf(Yr,Js,Kl,!1)}function i6(e,t,n){var s=wr;wr|=2;var r=EK(),i=AK();(Yr!==e||Js!==t)&&(zS=null,Q1(e,t)),t=!1;var o=zi;e:do try{if(Mr!==0&&Gs!==null){var a=Gs,c=zl;switch(Mr){case 8:QM(),o=6;break e;case 3:case 2:case 9:case 6:rc.current===null&&(t=!0);var u=Mr;if(Mr=0,zl=null,h1(e,a,c,u),n&&Ab){o=0;break e}break;default:u=Mr,Mr=0,zl=null,h1(e,a,c,u)}}Dhe(),o=zi;break}catch(d){CK(e,d)}while(!0);return t&&e.shellSuspendCounter++,dh=$0=null,wr=s,us.H=r,us.A=i,Gs===null&&(Yr=null,Js=0,q3()),o}function Dhe(){for(;Gs!==null;)jK(Gs)}function Lhe(e,t){var n=wr;wr|=2;var s=EK(),r=AK();Yr!==e||Js!==t?(zS=null,BS=Ql()+500,Q1(e,t)):Ab=mw(e,t);e:do try{if(Mr!==0&&Gs!==null){t=Gs;var i=zl;t:switch(Mr){case 1:Mr=0,zl=null,h1(e,t,i,1);break;case 2:case 9:if(jP(i)){Mr=0,zl=null,ZP(t);break}t=function(){Mr!==2&&Mr!==9||Yr!==e||(Mr=7),vd(e)},i.then(t,t);break e;case 3:Mr=7;break e;case 4:Mr=5;break e;case 7:jP(i)?(Mr=0,zl=null,ZP(t)):(Mr=0,zl=null,h1(e,t,i,7));break;case 5:var o=null;switch(Gs.tag){case 26:o=Gs.memoizedState;case 5:case 27:var a=Gs;if(o?YK(o):a.stateNode.complete){Mr=0,zl=null;var c=a.sibling;if(c!==null)Gs=c;else{var u=a.return;u!==null?(Gs=u,J3(u)):Gs=null}break t}}Mr=0,zl=null,h1(e,t,i,5);break;case 6:Mr=0,zl=null,h1(e,t,i,6);break;case 8:QM(),zi=6;break e;default:throw Error(ct(462))}}Phe();break}catch(d){CK(e,d)}while(!0);return dh=$0=null,us.H=s,us.A=r,wr=n,Gs!==null?0:(Yr=null,Js=0,q3(),zi)}function Phe(){for(;Gs!==null&&!ide();)jK(Gs)}function jK(e){var t=nK(e.alternate,e,Dh);e.memoizedProps=e.pendingProps,t===null?J3(e):Gs=t}function ZP(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=VP(n,t,t.pendingProps,t.type,void 0,Js);break;case 11:t=VP(n,t,t.pendingProps,t.type.render,t.ref,Js);break;case 5:PM(t);default:sK(n,t),t=Gs=sG(t,Dh),t=nK(n,t,Dh)}e.memoizedProps=e.pendingProps,t===null?J3(e):Gs=t}function h1(e,t,n,s){dh=$0=null,PM(t),C1=null,bx=0;var r=t.return;try{if(She(e,r,t,n,Js)){zi=1,PS(e,Nc(n,e.current)),Gs=null;return}}catch(i){if(r!==null)throw Gs=r,i;zi=1,PS(e,Nc(n,e.current)),Gs=null;return}t.flags&32768?(sr||s===1?e=!0:Ab||Js&536870912?e=!1:(Bf=e=!0,(s===2||s===9||s===3||s===6)&&(s=rc.current,s!==null&&s.tag===13&&(s.flags|=16384))),NK(t,e)):J3(t)}function J3(e){var t=e;do{if(t.flags&32768){NK(t,Bf);return}e=t.return;var n=Ehe(t.alternate,t,Dh);if(n!==null){Gs=n;return}if(t=t.sibling,t!==null){Gs=t;return}Gs=t=e}while(t!==null);zi===0&&(zi=5)}function NK(e,t){do{var n=Ahe(e.alternate,e);if(n!==null){n.flags&=32767,Gs=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Gs=e;return}Gs=e=n}while(e!==null);zi=6,Gs=null}function eO(e,t,n,s,r,i,o,a,c){e.cancelPendingCommit=null;do Z3();while(Co!==0);if(wr&6)throw Error(ct(327));if(t!==null){if(t===e.current)throw Error(ct(177));if(i=t.lanes|t.childLanes,i|=kM,pde(e,n,i,o,a,c),e===Yr&&(Gs=Yr=null,Js=0),X1=t,nm=e,xh=n,FE=i,HE=r,kK=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,zhe(CS,function(){return LK(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=us.T,us.T=null,r=_r.p,_r.p=2,o=wr,wr|=4;try{jhe(e,t,n)}finally{wr=o,_r.p=r,us.T=s}}Co=1,MK(),IK(),RK()}}function MK(){if(Co===1){Co=0;var e=nm,t=X1,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=us.T,us.T=null;var s=_r.p;_r.p=2;var r=wr;wr|=4;try{mK(t,e);var i=GE,o=YV(e.containerInfo),a=i.focusedElem,c=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&KV(a.ownerDocument.documentElement,a)){if(c!==null&&wM(a)){var u=c.start,d=c.end;if(d===void 0&&(d=u),"selectionStart"in a)a.selectionStart=u,a.selectionEnd=Math.min(d,a.value.length);else{var h=a.ownerDocument||document,m=h&&h.defaultView||window;if(m.getSelection){var p=m.getSelection(),g=a.textContent.length,b=Math.min(c.start,g),x=c.end===void 0?b:Math.min(c.end,g);!p.extend&&b>x&&(o=x,x=b,b=o);var y=kP(a,b),v=kP(a,x);if(y&&v&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var w=h.createRange();w.setStart(y.node,y.offset),p.removeAllRanges(),b>x?(p.addRange(w),p.extend(v.node,v.offset)):(w.setEnd(v.node,v.offset),p.addRange(w))}}}}for(h=[],p=a;p=p.parentNode;)p.nodeType===1&&h.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<h.length;a++){var k=h[a];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}YS=!!VE,GE=VE=null}finally{wr=r,_r.p=s,us.T=n}}e.current=t,Co=2}}function IK(){if(Co===2){Co=0;var e=nm,t=X1,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=us.T,us.T=null;var s=_r.p;_r.p=2;var r=wr;wr|=4;try{cK(e,t.alternate,t)}finally{wr=r,_r.p=s,us.T=n}}Co=3}}function RK(){if(Co===4||Co===3){Co=0,ode();var e=nm,t=X1,n=xh,s=kK;t.subtreeFlags&10256||t.flags&10256?Co=5:(Co=0,X1=nm=null,DK(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(tm=null),mM(n),t=t.stateNode,Jl&&typeof Jl.onCommitFiberRoot=="function")try{Jl.onCommitFiberRoot(fw,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=us.T,r=_r.p,_r.p=2,us.T=null;try{for(var i=e.onRecoverableError,o=0;o<s.length;o++){var a=s[o];i(a.value,{componentStack:a.stack})}}finally{us.T=t,_r.p=r}}xh&3&&Z3(),vd(e),r=e.pendingLanes,n&261930&&r&42?e===qE?zv++:(zv=0,qE=e):zv=0,ww(0)}}function DK(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,yw(t)))}function Z3(){return MK(),IK(),RK(),LK()}function LK(){if(Co!==5)return!1;var e=nm,t=FE;FE=0;var n=mM(xh),s=us.T,r=_r.p;try{_r.p=32>n?32:n,us.T=null,n=HE,HE=null;var i=nm,o=xh;if(Co=0,X1=nm=null,xh=0,wr&6)throw Error(ct(331));var a=wr;if(wr|=4,vK(i.current),gK(i,i.current,o,n),wr=a,ww(0,!1),Jl&&typeof Jl.onPostCommitFiberRoot=="function")try{Jl.onPostCommitFiberRoot(fw,i)}catch{}return!0}finally{_r.p=r,us.T=s,DK(e,t)}}function tO(e,t,n){t=Nc(n,t),t=PE(e.stateNode,t,2),e=em(e,t,2),e!==null&&(pw(e,2),vd(e))}function Ir(e,t,n){if(e.tag===3)tO(e,e,n);else for(;t!==null;){if(t.tag===3){tO(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(tm===null||!tm.has(s))){e=Nc(n,e),n=XG(2),s=em(t,n,2),s!==null&&(QG(n,s,t,e),pw(s,2),vd(s));break}}t=t.return}}function o6(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Ihe;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(n)||(YM=!0,r.add(n),e=Ohe.bind(null,e,t,n),t.then(e,e))}function Ohe(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Yr===e&&(Js&n)===n&&(zi===4||zi===3&&(Js&62914560)===Js&&300>Ql()-X3?!(wr&2)&&Q1(e,0):XM|=n,Y1===Js&&(Y1=0)),vd(e)}function PK(e,t){t===0&&(t=EV()),e=O0(e,t),e!==null&&(pw(e,t),vd(e))}function $he(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),PK(e,n)}function Bhe(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(ct(314))}s!==null&&s.delete(t),PK(e,n)}function zhe(e,t){return hM(e,t)}var HS=null,Vg=null,UE=!1,qS=!1,a6=!1,Ff=0;function vd(e){e!==Vg&&e.next===null&&(Vg===null?HS=Vg=e:Vg=Vg.next=e),qS=!0,UE||(UE=!0,Hhe())}function ww(e,t){if(!a6&&qS){a6=!0;do for(var n=!1,s=HS;s!==null;){if(e!==0){var r=s.pendingLanes;if(r===0)var i=0;else{var o=s.suspendedLanes,a=s.pingedLanes;i=(1<<31-Zl(42|e)+1)-1,i&=r&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,nO(s,i))}else i=Js,i=B3(s,s===Yr?i:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(i&3)||mw(s,i)||(n=!0,nO(s,i));s=s.next}while(n);a6=!1}}function Fhe(){OK()}function OK(){qS=UE=!1;var e=0;Ff!==0&&Jhe()&&(e=Ff);for(var t=Ql(),n=null,s=HS;s!==null;){var r=s.next,i=$K(s,t);i===0?(s.next=null,n===null?HS=r:n.next=r,r===null&&(Vg=n)):(n=s,(e!==0||i&3)&&(qS=!0)),s=r}Co!==0&&Co!==5||ww(e),Ff!==0&&(Ff=0)}function $K(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Zl(i),a=1<<o,c=r[o];c===-1?(!(a&n)||a&s)&&(r[o]=mde(a,t)):c<=t&&(e.expiredLanes|=a),i&=~a}if(t=Yr,n=Js,n=B3(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Mr===2||Mr===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&L5(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||mw(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&L5(s),mM(n)){case 2:case 8:n=CV;break;case 32:n=CS;break;case 268435456:n=TV;break;default:n=CS}return s=BK.bind(null,e),n=hM(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&L5(s),e.callbackPriority=2,e.callbackNode=null,2}function BK(e,t){if(Co!==0&&Co!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Z3()&&e.callbackNode!==n)return null;var s=Js;return s=B3(e,e===Yr?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(SK(e,s,t),$K(e,Ql()),e.callbackNode!=null&&e.callbackNode===n?BK.bind(null,e):null)}function nO(e,t){if(Z3())return null;SK(e,t,!0)}function Hhe(){efe(function(){wr&6?hM(SV,Fhe):OK()})}function JM(){if(Ff===0){var e=V1;e===0&&(e=Hk,Hk<<=1,!(Hk&261888)&&(Hk=256)),Ff=e}return Ff}function sO(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:j2(""+e)}function rO(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 qhe(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var i=sO((r[Tl]||null).action),o=s.submitter;o&&(t=(t=o[Tl]||null)?sO(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new z3("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ff!==0){var c=o?rO(r,o):new FormData(r);DE(n,{pending:!0,data:c,method:r.method,action:i},null,c)}}else typeof i=="function"&&(a.preventDefault(),c=o?rO(r,o):new FormData(r),DE(n,{pending:!0,data:c,method:r.method,action:i},i,c))},currentTarget:r}]})}}for(var l6=0;l6<kE.length;l6++){var c6=kE[l6],Uhe=c6.toLowerCase(),Whe=c6[0].toUpperCase()+c6.slice(1);fu(Uhe,"on"+Whe)}fu(QV,"onAnimationEnd");fu(JV,"onAnimationIteration");fu(ZV,"onAnimationStart");fu("dblclick","onDoubleClick");fu("focusin","onFocus");fu("focusout","onBlur");fu(ahe,"onTransitionRun");fu(lhe,"onTransitionStart");fu(che,"onTransitionCancel");fu(eG,"onTransitionEnd");U1("onMouseEnter",["mouseout","mouseover"]);U1("onMouseLeave",["mouseout","mouseover"]);U1("onPointerEnter",["pointerout","pointerover"]);U1("onPointerLeave",["pointerout","pointerover"]);D0("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));D0("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));D0("onBeforeInput",["compositionend","keypress","textInput","paste"]);D0("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));D0("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));D0("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xx="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(" "),Vhe=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xx));function zK(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],r=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=u;try{i(r)}catch(d){ES(d)}r.currentTarget=null,i=c}else for(o=0;o<s.length;o++){if(a=s[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=u;try{i(r)}catch(d){ES(d)}r.currentTarget=null,i=c}}}}function Vs(e,t){var n=t[mE];n===void 0&&(n=t[mE]=new Set);var s=e+"__bubble";n.has(s)||(FK(t,e,2,!1),n.add(s))}function u6(e,t,n){var s=0;t&&(s|=4),FK(n,e,s,t)}var Jk="_reactListening"+Math.random().toString(36).slice(2);function ZM(e){if(!e[Jk]){e[Jk]=!0,IV.forEach(function(n){n!=="selectionchange"&&(Vhe.has(n)||u6(n,!1,e),u6(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Jk]||(t[Jk]=!0,u6("selectionchange",!1,t))}}function FK(e,t,n,s){switch(eY(t)){case 2:var r=xfe;break;case 8:r=wfe;break;default:r=s9}n=r.bind(null,t,n,e),r=void 0,!vE||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function d6(e,t,n,s,r){var i=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var a=s.stateNode.containerInfo;if(a===r)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===r)return;o=o.return}for(;a!==null;){if(o=s1(a),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){s=i=o;continue e}a=a.parentNode}}s=s.return}zV(function(){var u=i,d=bM(n),h=[];e:{var m=tG.get(e);if(m!==void 0){var p=z3,g=e;switch(e){case"keypress":if(M2(n)===0)break e;case"keydown":case"keyup":p=Bde;break;case"focusin":g="focus",p=z5;break;case"focusout":g="blur",p=z5;break;case"beforeblur":case"afterblur":p=z5;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=hP;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Ede;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Hde;break;case QV:case JV:case ZV:p=Nde;break;case eG:p=Ude;break;case"scroll":case"scrollend":p=Cde;break;case"wheel":p=Vde;break;case"copy":case"cut":case"paste":p=Ide;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=mP;break;case"toggle":case"beforetoggle":p=Kde}var b=(t&4)!==0,x=!b&&(e==="scroll"||e==="scrollend"),y=b?m!==null?m+"Capture":null:m;b=[];for(var v=u,w;v!==null;){var k=v;if(w=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||w===null||y===null||(k=hx(v,y),k!=null&&b.push(wx(v,k,w))),x)break;v=v.return}0<b.length&&(m=new p(m,g,null,n,d),h.push({event:m,listeners:b}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==yE&&(g=n.relatedTarget||n.fromElement)&&(s1(g)||g[Sb]))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?s1(g):null,g!==null&&(x=hw(g),b=g.tag,g!==x||b!==5&&b!==27&&b!==6)&&(g=null)):(p=null,g=u),p!==g)){if(b=hP,k="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(b=mP,k="onPointerLeave",y="onPointerEnter",v="pointer"),x=p==null?m:cv(p),w=g==null?m:cv(g),m=new b(k,v+"leave",p,n,d),m.target=x,m.relatedTarget=w,k=null,s1(d)===u&&(b=new b(y,v+"enter",g,n,d),b.target=w,b.relatedTarget=x,k=b),x=k,p&&g)t:{for(b=Ghe,y=p,v=g,w=0,k=y;k;k=b(k))w++;k=0;for(var T=v;T;T=b(T))k++;for(;0<w-k;)y=b(y),w--;for(;0<k-w;)v=b(v),k--;for(;w--;){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&&iO(h,m,p,b,!1),g!==null&&x!==null&&iO(h,x,g,b,!0)}}e:{if(m=u?cv(u):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var C=yP;else if(bP(m))if(VV)C=rhe;else{C=nhe;var _=the}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?u&&gM(u.elementType)&&(C=yP):C=she;if(C&&(C=C(e,u))){WV(h,C,n,d);break e}_&&_(e,m,u),e==="focusout"&&u&&m.type==="number"&&u.memoizedProps.value!=null&&bE(m,"number",m.value)}switch(_=u?cv(u):window,e){case"focusin":(bP(_)||_.contentEditable==="true")&&(o1=_,xE=u,Mv=null);break;case"focusout":Mv=xE=o1=null;break;case"mousedown":wE=!0;break;case"contextmenu":case"mouseup":case"dragend":wE=!1,_P(h,n,d);break;case"selectionchange":if(ohe)break;case"keydown":case"keyup":_P(h,n,d)}var S;if(xM)e:{switch(e){case"compositionstart":var D="onCompositionStart";break e;case"compositionend":D="onCompositionEnd";break e;case"compositionupdate":D="onCompositionUpdate";break e}D=void 0}else i1?qV(e,n)&&(D="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(D="onCompositionStart");D&&(HV&&n.locale!=="ko"&&(i1||D!=="onCompositionStart"?D==="onCompositionEnd"&&i1&&(S=FV()):($f=d,yM="value"in $f?$f.value:$f.textContent,i1=!0)),_=US(u,D),0<_.length&&(D=new fP(D,e,null,n,d),h.push({event:D,listeners:_}),S?D.data=S:(S=UV(n),S!==null&&(D.data=S)))),(S=Xde?Qde(e,n):Jde(e,n))&&(D=US(u,"onBeforeInput"),0<D.length&&(_=new fP("onBeforeInput","beforeinput",null,n,d),h.push({event:_,listeners:D}),_.data=S)),qhe(h,e,u,n,d)}zK(h,t)})}function wx(e,t,n){return{instance:e,listener:t,currentTarget:n}}function US(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,i=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||i===null||(r=hx(e,n),r!=null&&s.unshift(wx(e,r,i)),r=hx(e,t),r!=null&&s.push(wx(e,r,i))),e.tag===3)return s;e=e.return}return[]}function Ghe(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function iO(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var a=n,c=a.alternate,u=a.stateNode;if(a=a.tag,c!==null&&c===s)break;a!==5&&a!==26&&a!==27||u===null||(c=u,r?(u=hx(n,i),u!=null&&o.unshift(wx(n,u,c))):r||(u=hx(n,i),u!=null&&o.push(wx(n,u,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Khe=/\r\n?/g,Yhe=/\u0000|\uFFFD/g;function oO(e){return(typeof e=="string"?e:""+e).replace(Khe,`
`).replace(Yhe,"")}function HK(e,t){return t=oO(t),oO(e)===t}function Or(e,t,n,s,r,i){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||W1(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&W1(e,""+s);break;case"className":Wk(e,"class",s);break;case"tabIndex":Wk(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Wk(e,n,s);break;case"style":BV(e,s,i);break;case"data":if(t!=="object"){Wk(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=j2(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="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"&&Or(e,t,"name",r.name,r,null),Or(e,t,"formEncType",r.formEncType,r,null),Or(e,t,"formMethod",r.formMethod,r,null),Or(e,t,"formTarget",r.formTarget,r,null)):(Or(e,t,"encType",r.encType,r,null),Or(e,t,"method",r.method,r,null),Or(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=j2(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=uh);break;case"onScroll":s!=null&&Vs("scroll",e);break;case"onScrollEnd":s!=null&&Vs("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(ct(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(ct(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=j2(""+s),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":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Vs("beforetoggle",e),Vs("toggle",e),A2(e,"popover",s);break;case"xlinkActuate":Gd(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Gd(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Gd(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Gd(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Gd(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Gd(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Gd(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Gd(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Gd(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":A2(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=_de.get(n)||n,A2(e,n,s))}}function WE(e,t,n,s,r,i){switch(n){case"style":BV(e,s,i);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(ct(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(ct(60));e.innerHTML=n}}break;case"children":typeof s=="string"?W1(e,s):(typeof s=="number"||typeof s=="bigint")&&W1(e,""+s);break;case"onScroll":s!=null&&Vs("scroll",e);break;case"onScrollEnd":s!=null&&Vs("scrollend",e);break;case"onClick":s!=null&&(e.onclick=uh);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!RV.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),i=e[Tl]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,r),typeof s=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,r);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):A2(e,n,s)}}}function oa(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Vs("error",e),Vs("load",e);var s=!1,r=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":s=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(ct(137,t));default:Or(e,t,i,o,n,null)}}r&&Or(e,t,"srcSet",n.srcSet,n,null),s&&Or(e,t,"src",n.src,n,null);return;case"input":Vs("invalid",e);var a=i=o=r=null,c=null,u=null;for(s in n)if(n.hasOwnProperty(s)){var d=n[s];if(d!=null)switch(s){case"name":r=d;break;case"type":o=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":i=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(ct(137,t));break;default:Or(e,t,s,d,n,null)}}PV(e,i,a,c,u,o,r,!1);return;case"select":Vs("invalid",e),s=o=i=null;for(r in n)if(n.hasOwnProperty(r)&&(a=n[r],a!=null))switch(r){case"value":i=a;break;case"defaultValue":o=a;break;case"multiple":s=a;default:Or(e,t,r,a,n,null)}t=i,n=o,e.multiple=!!s,t!=null?k1(e,!!s,t,!1):n!=null&&k1(e,!!s,n,!0);return;case"textarea":Vs("invalid",e),i=r=s=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":s=a;break;case"defaultValue":r=a;break;case"children":i=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(ct(91));break;default:Or(e,t,o,a,n,null)}$V(e,s,r,i);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(s=n[c],s!=null))switch(c){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Or(e,t,c,s,n,null)}return;case"dialog":Vs("beforetoggle",e),Vs("toggle",e),Vs("cancel",e),Vs("close",e);break;case"iframe":case"object":Vs("load",e);break;case"video":case"audio":for(s=0;s<xx.length;s++)Vs(xx[s],e);break;case"image":Vs("error",e),Vs("load",e);break;case"details":Vs("toggle",e);break;case"embed":case"source":case"link":Vs("error",e),Vs("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)&&(s=n[u],s!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(ct(137,t));default:Or(e,t,u,s,n,null)}return;default:if(gM(t)){for(d in n)n.hasOwnProperty(d)&&(s=n[d],s!==void 0&&WE(e,t,d,s,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(s=n[a],s!=null&&Or(e,t,a,s,n,null))}function Xhe(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,i=null,o=null,a=null,c=null,u=null,d=null;for(p in n){var h=n[p];if(n.hasOwnProperty(p)&&h!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":c=h;default:s.hasOwnProperty(p)||Or(e,t,p,null,s,h)}}for(var m in s){var p=s[m];if(h=n[m],s.hasOwnProperty(m)&&(p!=null||h!=null))switch(m){case"type":i=p;break;case"name":r=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":o=p;break;case"defaultValue":a=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(ct(137,t));break;default:p!==h&&Or(e,t,m,p,s,h)}}gE(e,o,a,c,u,d,i,r);return;case"select":p=o=a=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:s.hasOwnProperty(i)||Or(e,t,i,null,s,c)}for(r in s)if(i=s[r],c=n[r],s.hasOwnProperty(r)&&(i!=null||c!=null))switch(r){case"value":m=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==c&&Or(e,t,r,i,s,c)}t=a,n=o,s=p,m!=null?k1(e,!!n,m,!1):!!s!=!!n&&(t!=null?k1(e,!!n,t,!0):k1(e,!!n,n?[]:"",!1));return;case"textarea":p=m=null;for(a in n)if(r=n[a],n.hasOwnProperty(a)&&r!=null&&!s.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:Or(e,t,a,null,s,r)}for(o in s)if(r=s[o],i=n[o],s.hasOwnProperty(o)&&(r!=null||i!=null))switch(o){case"value":m=r;break;case"defaultValue":p=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(ct(91));break;default:r!==i&&Or(e,t,o,r,s,i)}OV(e,m,p);return;case"option":for(var g in n)if(m=n[g],n.hasOwnProperty(g)&&m!=null&&!s.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:Or(e,t,g,null,s,m)}for(c in s)if(m=s[c],p=n[c],s.hasOwnProperty(c)&&m!==p&&(m!=null||p!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Or(e,t,c,m,s,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&&!s.hasOwnProperty(b)&&Or(e,t,b,null,s,m);for(u in s)if(m=s[u],p=n[u],s.hasOwnProperty(u)&&m!==p&&(m!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(ct(137,t));break;default:Or(e,t,u,m,s,p)}return;default:if(gM(t)){for(var x in n)m=n[x],n.hasOwnProperty(x)&&m!==void 0&&!s.hasOwnProperty(x)&&WE(e,t,x,void 0,s,m);for(d in s)m=s[d],p=n[d],!s.hasOwnProperty(d)||m===p||m===void 0&&p===void 0||WE(e,t,d,m,s,p);return}}for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!=null&&!s.hasOwnProperty(y)&&Or(e,t,y,null,s,m);for(h in s)m=s[h],p=n[h],!s.hasOwnProperty(h)||m===p||m==null&&p==null||Or(e,t,h,m,s,p)}function aO(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Qhe(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var r=n[s],i=r.transferSize,o=r.initiatorType,a=r.duration;if(i&&a&&aO(o)){for(o=0,a=r.responseEnd,s+=1;s<n.length;s++){var c=n[s],u=c.startTime;if(u>a)break;var d=c.transferSize,h=c.initiatorType;d&&aO(h)&&(c=c.responseEnd,o+=d*(c<a?1:(a-u)/(c-u)))}if(--s,t+=8*(i+o)/(r.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 VE=null,GE=null;function WS(e){return e.nodeType===9?e:e.ownerDocument}function lO(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 qK(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 KE(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 h6=null;function Jhe(){var e=window.event;return e&&e.type==="popstate"?e===h6?!1:(h6=e,!0):(h6=null,!1)}var UK=typeof setTimeout=="function"?setTimeout:void 0,Zhe=typeof clearTimeout=="function"?clearTimeout:void 0,cO=typeof Promise=="function"?Promise:void 0,efe=typeof queueMicrotask=="function"?queueMicrotask:typeof cO<"u"?function(e){return cO.resolve(null).then(e).catch(tfe)}:UK;function tfe(e){setTimeout(function(){throw e})}function Bm(e){return e==="head"}function uO(e,t){var n=t,s=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(r),Z1(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")Fv(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Fv(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[gw]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&Fv(e.ownerDocument.body);n=r}while(n);Z1(t)}function dO(e,t){var n=e;e=0;do{var s=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||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function YE(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":YE(n),pM(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function nfe(e,t,n,s){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[gw])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!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Oc(e.nextSibling),e===null)break}return null}function sfe(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Oc(e.nextSibling),e===null))return null;return e}function WK(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Oc(e.nextSibling),e===null))return null;return e}function XE(e){return e.data==="$?"||e.data==="$~"}function QE(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function rfe(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Oc(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 JE=null;function hO(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Oc(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function fO(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 VK(e,t,n){switch(t=WS(n),e){case"html":if(e=t.documentElement,!e)throw Error(ct(452));return e;case"head":if(e=t.head,!e)throw Error(ct(453));return e;case"body":if(e=t.body,!e)throw Error(ct(454));return e;default:throw Error(ct(451))}}function Fv(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pM(e)}var Bc=new Map,mO=new Set;function VS(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qh=_r.d;_r.d={f:ife,r:ofe,D:afe,C:lfe,L:cfe,m:ufe,X:hfe,S:dfe,M:ffe};function ife(){var e=qh.f(),t=Q3();return e||t}function ofe(e){var t=Cb(e);t!==null&&t.tag===5&&t.type==="form"?BG(t):qh.r(e)}var jb=typeof document>"u"?null:document;function GK(e,t,n){var s=jb;if(s&&typeof t=="string"&&t){var r=jc(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),mO.has(r)||(mO.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),oa(t,"link",e),Fo(t),s.head.appendChild(t)))}}function afe(e){qh.D(e),GK("dns-prefetch",e,null)}function lfe(e,t){qh.C(e,t),GK("preconnect",e,t)}function cfe(e,t,n){qh.L(e,t,n);var s=jb;if(s&&e&&t){var r='link[rel="preload"][as="'+jc(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+jc(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+jc(n.imageSizes)+'"]')):r+='[href="'+jc(e)+'"]';var i=r;switch(t){case"style":i=J1(e);break;case"script":i=Nb(e)}Bc.has(i)||(e=ci({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Bc.set(i,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(kw(i))||t==="script"&&s.querySelector(_w(i))||(t=s.createElement("link"),oa(t,"link",e),Fo(t),s.head.appendChild(t)))}}function ufe(e,t){qh.m(e,t);var n=jb;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+jc(s)+'"][href="'+jc(e)+'"]',i=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Nb(e)}if(!Bc.has(i)&&(e=ci({rel:"modulepreload",href:e},t),Bc.set(i,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(_w(i)))return}s=n.createElement("link"),oa(s,"link",e),Fo(s),n.head.appendChild(s)}}}function dfe(e,t,n){qh.S(e,t,n);var s=jb;if(s&&e){var r=w1(s).hoistableStyles,i=J1(e);t=t||"default";var o=r.get(i);if(!o){var a={loading:0,preload:null};if(o=s.querySelector(kw(i)))a.loading=5;else{e=ci({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Bc.get(i))&&e9(e,n);var c=o=s.createElement("link");Fo(c),oa(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){a.loading|=1}),c.addEventListener("error",function(){a.loading|=2}),a.loading|=4,B2(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:a},r.set(i,o)}}}function hfe(e,t){qh.X(e,t);var n=jb;if(n&&e){var s=w1(n).hoistableScripts,r=Nb(e),i=s.get(r);i||(i=n.querySelector(_w(r)),i||(e=ci({src:e,async:!0},t),(t=Bc.get(r))&&t9(e,t),i=n.createElement("script"),Fo(i),oa(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function ffe(e,t){qh.M(e,t);var n=jb;if(n&&e){var s=w1(n).hoistableScripts,r=Nb(e),i=s.get(r);i||(i=n.querySelector(_w(r)),i||(e=ci({src:e,async:!0,type:"module"},t),(t=Bc.get(r))&&t9(e,t),i=n.createElement("script"),Fo(i),oa(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function pO(e,t,n,s){var r=(r=Qf.current)?VS(r):null;if(!r)throw Error(ct(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=J1(n.href),n=w1(r).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=J1(n.href);var i=w1(r).hoistableStyles,o=i.get(e);if(o||(r=r.ownerDocument||r,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=r.querySelector(kw(e)))&&!i._p&&(o.instance=i,o.state.loading=5),Bc.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},Bc.set(e,n),i||mfe(r,e,n,o.state))),t&&s===null)throw Error(ct(528,""));return o}if(t&&s!==null)throw Error(ct(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Nb(n),n=w1(r).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(ct(444,e))}}function J1(e){return'href="'+jc(e)+'"'}function kw(e){return'link[rel="stylesheet"]['+e+"]"}function KK(e){return ci({},e,{"data-precedence":e.precedence,precedence:null})}function mfe(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),oa(t,"link",n),Fo(t),e.head.appendChild(t))}function Nb(e){return'[src="'+jc(e)+'"]'}function _w(e){return"script[async]"+e}function gO(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+jc(n.href)+'"]');if(s)return t.instance=s,Fo(s),s;var r=ci({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Fo(s),oa(s,"style",r),B2(s,n.precedence,e),t.instance=s;case"stylesheet":r=J1(n.href);var i=e.querySelector(kw(r));if(i)return t.state.loading|=4,t.instance=i,Fo(i),i;s=KK(n),(r=Bc.get(r))&&e9(s,r),i=(e.ownerDocument||e).createElement("link"),Fo(i);var o=i;return o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),oa(i,"link",s),t.state.loading|=4,B2(i,n.precedence,e),t.instance=i;case"script":return i=Nb(n.src),(r=e.querySelector(_w(i)))?(t.instance=r,Fo(r),r):(s=n,(r=Bc.get(i))&&(s=ci({},n),t9(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),Fo(r),oa(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(ct(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,B2(s,n.precedence,e));return t.instance}function B2(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=s.length?s[s.length-1]:null,i=r,o=0;o<s.length;o++){var a=s[o];if(a.dataset.precedence===t)i=a;else if(i!==r)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function e9(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function t9(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var z2=null;function bO(e,t,n){if(z2===null){var s=new Map,r=z2=new Map;r.set(n,s)}else r=z2,s=r.get(n),s||(s=new Map,r.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var i=n[r];if(!(i[gw]||i[na]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var a=s.get(o);a?a.push(i):s.set(o,[i])}}return s}function yO(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function pfe(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 YK(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function gfe(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var r=J1(s.href),i=t.querySelector(kw(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=GS.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Fo(i);return}i=t.ownerDocument||t,s=KK(s),(r=Bc.get(r))&&e9(s,r),i=i.createElement("link"),Fo(i);var o=i;o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),oa(i,"link",s),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=GS.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var f6=0;function bfe(e,t){return e.stylesheets&&e.count===0&&F2(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&F2(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&f6===0&&(f6=62500*Qhe());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&F2(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>f6?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function GS(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)F2(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var KS=null;function F2(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,KS=new Map,t.forEach(yfe,e),KS=null,GS.call(e))}function yfe(e,t){if(!(t.state.loading&4)){var n=KS.get(e);if(n)var s=n.get(null);else{n=new Map,KS.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<r.length;i++){var o=r[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),s=o)}s&&n.set(null,s)}r=t.instance,o=r.getAttribute("data-precedence"),i=n.get(o)||s,i===s&&n.set(null,r),n.set(o,r),this.count++,s=GS.bind(this),r.addEventListener("load",s),r.addEventListener("error",s),i?i.parentNode.insertBefore(r,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var kx={$$typeof:ch,Provider:null,Consumer:null,_currentValue:e0,_currentValue2:e0,_threadCount:0};function vfe(e,t,n,s,r,i,o,a,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=P5(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P5(0),this.hiddenUpdates=P5(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function XK(e,t,n,s,r,i,o,a,c,u,d,h){return e=new vfe(e,t,n,o,c,u,d,h,a),t=1,i===!0&&(t|=24),i=Ul(3,null,null,t),e.current=i,i.stateNode=e,t=EM(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:s,isDehydrated:n,cache:t},NM(i),e}function QK(e){return e?(e=c1,e):c1}function JK(e,t,n,s,r,i){r=QK(r),s.context===null?s.context=r:s.pendingContext=r,s=Zf(t),s.payload={element:n},i=i===void 0?null:i,i!==null&&(s.callback=i),n=em(e,s,t),n!==null&&(vl(n,e,t),Rv(n,e,t))}function vO(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){vO(e,t),(e=e.alternate)&&vO(e,t)}function ZK(e){if(e.tag===13||e.tag===31){var t=O0(e,67108864);t!==null&&vl(t,e,67108864),n9(e,67108864)}}function xO(e){if(e.tag===13||e.tag===31){var t=ec();t=fM(t);var n=O0(e,t);n!==null&&vl(n,e,t),n9(e,t)}}var YS=!0;function xfe(e,t,n,s){var r=us.T;us.T=null;var i=_r.p;try{_r.p=2,s9(e,t,n,s)}finally{_r.p=i,us.T=r}}function wfe(e,t,n,s){var r=us.T;us.T=null;var i=_r.p;try{_r.p=8,s9(e,t,n,s)}finally{_r.p=i,us.T=r}}function s9(e,t,n,s){if(YS){var r=ZE(s);if(r===null)d6(e,t,s,XS,n),wO(e,s);else if(_fe(r,e,t,n,s))s.stopPropagation();else if(wO(e,s),t&4&&-1<kfe.indexOf(e)){for(;r!==null;){var i=Cb(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=Ip(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var c=1<<31-Zl(o);a.entanglements[1]|=c,o&=~c}vd(i),!(wr&6)&&(BS=Ql()+500,ww(0))}}break;case 31:case 13:a=O0(i,2),a!==null&&vl(a,i,2),Q3(),n9(i,2)}if(i=ZE(s),i===null&&d6(e,t,s,XS,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else d6(e,t,s,null,n)}}function ZE(e){return e=bM(e),r9(e)}var XS=null;function r9(e){if(XS=null,e=s1(e),e!==null){var t=hw(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=vV(t),e!==null)return e;e=null}else if(n===31){if(e=xV(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 XS=e,null}function eY(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(ade()){case SV:return 2;case CV:return 8;case CS:case lde:return 32;case TV:return 268435456;default:return 32}default:return 32}}var eA=!1,sm=null,rm=null,im=null,_x=new Map,Sx=new Map,Df=[],kfe="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 wO(e,t){switch(e){case"focusin":case"focusout":sm=null;break;case"dragenter":case"dragleave":rm=null;break;case"mouseover":case"mouseout":im=null;break;case"pointerover":case"pointerout":_x.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sx.delete(t.pointerId)}}function Ly(e,t,n,s,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[r]},t!==null&&(t=Cb(t),t!==null&&ZK(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function _fe(e,t,n,s,r){switch(t){case"focusin":return sm=Ly(sm,e,t,n,s,r),!0;case"dragenter":return rm=Ly(rm,e,t,n,s,r),!0;case"mouseover":return im=Ly(im,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return _x.set(i,Ly(_x.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,Sx.set(i,Ly(Sx.get(i)||null,e,t,n,s,r)),!0}return!1}function tY(e){var t=s1(e.target);if(t!==null){var n=hw(t);if(n!==null){if(t=n.tag,t===13){if(t=vV(n),t!==null){e.blockedOn=t,iP(e.priority,function(){xO(n)});return}}else if(t===31){if(t=xV(n),t!==null){e.blockedOn=t,iP(e.priority,function(){xO(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 H2(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ZE(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);yE=s,n.target.dispatchEvent(s),yE=null}else return t=Cb(n),t!==null&&ZK(t),e.blockedOn=n,!1;t.shift()}return!0}function kO(e,t,n){H2(e)&&n.delete(t)}function Sfe(){eA=!1,sm!==null&&H2(sm)&&(sm=null),rm!==null&&H2(rm)&&(rm=null),im!==null&&H2(im)&&(im=null),_x.forEach(kO),Sx.forEach(kO)}function Zk(e,t){e.blockedOn===t&&(e.blockedOn=null,eA||(eA=!0,Ao.unstable_scheduleCallback(Ao.unstable_NormalPriority,Sfe)))}var e_=null;function _O(e){e_!==e&&(e_=e,Ao.unstable_scheduleCallback(Ao.unstable_NormalPriority,function(){e_===e&&(e_=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],r=e[t+2];if(typeof s!="function"){if(r9(s||n)===null)continue;break}var i=Cb(n);i!==null&&(e.splice(t,3),t-=3,DE(i,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function Z1(e){function t(c){return Zk(c,e)}sm!==null&&Zk(sm,e),rm!==null&&Zk(rm,e),im!==null&&Zk(im,e),_x.forEach(t),Sx.forEach(t);for(var n=0;n<Df.length;n++){var s=Df[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Df.length&&(n=Df[0],n.blockedOn===null);)tY(n),n.blockedOn===null&&Df.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var r=n[s],i=n[s+1],o=r[Tl]||null;if(typeof i=="function")o||_O(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(r=i,o=i[Tl]||null)a=o.formAction;else if(r9(r)!==null)continue}else a=o.action;typeof a=="function"?n[s+1]=a:(n.splice(s,3),s-=3),_O(n)}}}function nY(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return r=o})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),s||setTimeout(n,20)}function n(){if(!s&&!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 s=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function i9(e){this._internalRoot=e}eC.prototype.render=i9.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ct(409));var n=t.current,s=ec();JK(n,s,e,t,null,null)};eC.prototype.unmount=i9.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;JK(e.current,2,null,e,null,null),Q3(),t[Sb]=null}};function eC(e){this._internalRoot=e}eC.prototype.unstable_scheduleHydration=function(e){if(e){var t=MV();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Df.length&&t!==0&&t<Df[n].priority;n++);Df.splice(n,0,e),n===0&&tY(e)}};var SO=bV.version;if(SO!=="19.2.4")throw Error(ct(527,SO,"19.2.4"));_r.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ct(188)):(e=Object.keys(e).join(","),Error(ct(268,e)));return e=ede(t),e=e!==null?wV(e):null,e=e===null?null:e.stateNode,e};var Cfe={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:us,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var t_=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t_.isDisabled&&t_.supportsFiber)try{fw=t_.inject(Cfe),Jl=t_}catch{}}O3.createRoot=function(e,t){if(!yV(e))throw Error(ct(299));var n=!1,s="",r=GG,i=KG,o=YG;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=XK(e,1,!1,null,null,n,s,null,r,i,o,nY),e[Sb]=t.current,ZM(e),new i9(t)};O3.hydrateRoot=function(e,t,n){if(!yV(e))throw Error(ct(299));var s=!1,r="",i=GG,o=KG,a=YG,c=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=XK(e,1,!0,t,n??null,s,r,c,i,o,a,nY),t.context=QK(null),n=t.current,s=ec(),s=fM(s),r=Zf(s),r.callback=null,em(n,r,s),n=s,t.current.lanes=n,pw(t,n),vd(t),e[Sb]=t.current,ZM(e),new eC(t)};O3.version="19.2.4";function sY(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sY)}catch(e){console.error(e)}}sY(),dV.exports=O3;var tA=dV.exports;const Tfe=D3(tA);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Efe="agent";function Afe(e){return e===Efe}var jfe=3e4,Nfe=new Set(["authorized","expired","error","cancelled"]),Mfe=class{constructor(t){this.client=t}async start(t){let n=await this.client.startDeviceFlow(t),s=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:()=>s.cancelDeviceFlow(n.deviceFlowId,{clientId:t.clientId}),awaitCompletion:async(r={})=>await Ife(s,n,t.clientId,r)}}status(t,n){return this.client.getDeviceFlow(t,n)}cancel(t,n){return this.client.cancelDeviceFlow(t,n)}};async function Ife(e,t,n,s){return await Rfe(e,t,n,s)}async function CO(e,t,n,s){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:s})}catch(r){if(r instanceof ic&&r.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 r}}function TO(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function Rfe(e,t,n,s){var d;let r=s.signal,i=TO(s.timeoutMs,{allowZero:!0}),o=TO(s.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+jfe,c=Math.max(1e3,o??t.intervalMs??5e3),u=c;for(;;){if(r!=null&&r.aborted)throw nA(r);if(Date.now()>=a)return await CO(e,t,n,r);let h=await CO(e,t,n,r);if(h.intervalMs&&h.intervalMs!==u&&(u=h.intervalMs,c=h.intervalMs,(d=s.onThrottled)==null||d.call(s,h.intervalMs)),Nfe.has(h.status))return h;await Dfe(c,r)}}async function Dfe(e,t){if(t!=null&&t.aborted)throw nA(t);await new Promise((n,s)=>{let r=setTimeout(()=>{o(),n()},e),i=()=>{o(),s(nA(t))};function o(){clearTimeout(r),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function nA(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var ic=class extends Error{constructor(t,n,s){super(s);Pe(this,"status");Pe(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},EO=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},Lfe=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},AO=16*1024*1024;async function*rY(e,t){let n=e.getReader(),s=new TextDecoder,r="",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,a;try{({value:o,done:a}=await n.read())}catch(u){if(t!=null&&t.aborted)return;throw u}if(a){if(r+=s.decode(),r.length>0){let u=jO(r);for(let d of u.frames){let h=m6(d);h&&(yield h)}if(u.tail.length>0){let d=m6(u.tail);d&&(yield d)}}return}if(r+=s.decode(o,{stream:!0}),r.length>AO)throw new Lfe(`parseSseStream: unread buffer exceeded ${AO} UTF-16 code units without a frame separator — upstream likely not SSE`);let c=jO(r);if(c.frames.length>0)for(let u of c.frames){let d=m6(u);d&&(yield d)}r=c.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function jO(e){let t=[],n=0;for(;n<e.length;){let s=e.indexOf(`

`,n);if(s===-1){let i=e.indexOf(`\r
\r
`,n);if(i===-1)break;t.push(e.slice(n,i)),n=i+4;continue}let r=e.slice(n,s).indexOf(`\r
\r
`);if(r!==-1){let i=n+r;t.push(e.slice(n,i)),n=i+4}else t.push(e.slice(n,s)),n=s+2}return{frames:t,tail:e.slice(n)}}function m6(e){if(!e)return;let t=[];for(let s of e.split(/\r?\n/)){if(!s.startsWith("data:"))continue;let r=s.slice(5);t.push(r.startsWith(" ")?r.slice(1):r)}if(t.length===0)return;let n=t.join(`
`);try{let s=JSON.parse(n);if(typeof s!="object"||s===null||Array.isArray(s)||s.v!==1||typeof s.type!="string")return;let r=s.id;return r!==void 0&&(!Number.isSafeInteger(r)||r<1)?void 0:s}catch{return}}var Pfe=class{constructor(e,t,n){Pe(this,"baseUrl");Pe(this,"token");Pe(this,"_fetch");Pe(this,"activeSseRequests",new Set);Pe(this,"_disposed",!1);Pe(this,"type","rest");Pe(this,"supportsReplay",!0);Pe(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 EO;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var s,r;if(this._disposed)throw new EO;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?Ofe([t.signal,n.signal]):n.signal,a=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(a+=`?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(a,{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 ic(d.status,p,`GET /session/:id/events: ${g}`)}let h=d.headers.get("content-type")??"";if(!h.toLowerCase().includes("text/event-stream")){try{await((s=d.body)==null?void 0:s.cancel())}catch{}throw new ic(d.status,h,`GET /session/:id/events: expected content-type text/event-stream, got "${h}"`)}if(!d.body)throw new Error("No SSE body");let m=d.headers.get("x-qwen-event-epoch");m&&((r=t.onEpoch)==null||r.call(t,m)),yield*rY(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 Ofe(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,s=[],r=()=>{for(;s.length>0;){let i=s.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),r(),n.signal;let o=()=>{n.abort(i.reason),r()};i.addEventListener("abort",o,{once:!0}),s.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",r,{once:!0}),n.signal}var $fe=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.`);Pe(this,"capability");this.name="DaemonCapabilityMissingError",this.capability=t}},Bfe=["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"],Mb=["plan","default","auto-edit","auto","yolo"],n_="/workspace/memory/remember",s_="/workspace/memory/forget",r_="/workspace/memory/dream";function NO(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,s=t.modelSource,r=typeof n=="string"&&n.length>0,i=s==="fast"||s==="main",o=a=>a===void 0||typeof a=="number"&&Number.isSafeInteger(a)&&a>=0;if(t.type==="started"){if(!r||typeof t.model!="string"||!i)return}else if(t.type==="thinking"){if(!r)return}else if(t.type==="delta"){if(!r||!Number.isSafeInteger(t.seq)||t.seq<0||typeof t.text!="string"||t.text.length===0)return}else if(t.type==="done"){if(!r||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 QS=20,zfe=3e4,Ffe=65e3,Hfe=9e4,iY=35e3,MO=2147483647,qfe=5,Gg=33e4,Ufe="X-Qwen-Client-Id",ot=encodeURIComponent;function oY(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 IO(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function aY(e){if(e===void 0)return qfe;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 Wfe(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function Vfe(){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 s=n.trim();return s.length===0?void 0:s}catch{return}}var RO=class extends Error{constructor(e,t,n){super(`Pending prompts full: "${e}" (${n}/${t})`),this.name="DaemonPendingPromptLimitError",this.sessionId=e,this.limit=t,this.pendingCount=n}};function lY(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var sA=class{constructor(e){Pe(this,"baseUrl");Pe(this,"token");Pe(this,"_fetch");Pe(this,"fetchTimeoutMs");Pe(this,"promptLimit");Pe(this,"promptCounts",Object.create(null));Pe(this,"transport");Pe(this,"_authFlow");var n;this.baseUrl=Wfe(e.baseUrl),this.token=e.token??Vfe(),this._fetch=e.fetch??((n=e.transport)==null?void 0:n.restFetch)??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??zfe;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=aY(e.maxPendingPromptsPerSession),this.transport=e.transport??new Pfe(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new Mfe(this)),this._authFlow}get maxPendingPromptsPerSession(){return this.promptLimit}reservePromptSlot(e,t=this.promptLimit){if(t===1/0)return()=>{};let n=this.promptCounts,s=n[e]??0;if(s>=t)throw new RO(e,t,s);n[e]=s+1;let r;return()=>{r||(r=!0,(n[e]??0)<=1?delete n[e]:--n[e])}}async fetchWithTimeout(e,t={},n,s,r="transport"){let i=this.fetchTimeoutMs;if(s!==void 0&&Number.isFinite(s)&&s>=0&&(i=s),!i||!Number.isFinite(i)){let d=r==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(d):d}let o=new AbortController,a=setTimeout(()=>{o.abort(new DOMException("timeout","TimeoutError"))},i);typeof a=="object"&&a&&"unref"in a&&a.unref();let c=t.signal??void 0,u=c?p6([c,o.signal]):o.signal;try{let d=r==="rest"?await this._fetch(e,{...t,signal:u}):await this.transport.fetch(e,{...t,signal:u});return n?await n(d):d}finally{clearTimeout(a)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[Ufe]=t),n}async failOnError(e,t,n){let s;try{let i=await e.text();if(i.length>0)try{s=JSON.parse(i)}catch{s=i}}catch{}let r=s&&typeof s=="object"&&"error"in s?String(s.error):`HTTP ${e.status}`;if(n&&e.status===503&&s&&typeof s=="object"){let i=s;if(i.code==="prompt_queue_full")return new RO(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new ic(e.status,s,`${t}: ${r}`)}async jsonRequest(e,t,n={}){let s=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${e}`,{...n.method?{method:n.method}:{},headers:this.headers(s?{"Content-Type":"application/json"}:{},n.clientId),...s?{body:JSON.stringify(n.body)}:{},...n.signal?{signal:n.signal}:{}},async r=>{if(!r.ok)throw await this.failOnError(r,t);return await r.json()},n.timeoutMs,n.mode)}async workspaceJsonRequest(e,t,n,s={}){return await this.jsonRequest(`/workspaces/${e}${t}`,n,s)}async sessionExportRequest(e,t,n={}){let s=n.format??"html",r=n.format?`?format=${ot(n.format)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${r}`,{headers:this.headers({},n.clientId)},async i=>{var u;if(!i.ok)throw await this.failOnError(i,t);let o=await i.text(),a=i.headers.get("content-type")??"",c=((u=/filename="([^"]+)"/i.exec(i.headers.get("content-disposition")??""))==null?void 0:u[1])??`export.${s}`;return{content:o,filename:c,mimeType:a,format:s}},void 0,"rest")}async workspaceNoContentRequest(e,t,n,s={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces/${e}${t}`,{...s.method?{method:s.method}:{},headers:this.headers({},s.clientId)},async r=>{var i,o;if(r.status===204){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return}if(r.status===404&&s.okNotFoundCode){let a=await this.failOnError(r,n);if(((o=a.body)==null?void 0:o.code)===s.okNotFoundCode)return;throw a}throw await this.failOnError(r,n)},s.timeoutMs)}workspaceById(e){return new DO(this,ot(e))}workspaceByCwd(e){return new DO(this,ot(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)??iY,mode:"rest"})}async requireCapability(e){if(!(await this.capabilities()).features.includes(e))throw new $fe(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(){return await this.jsonRequest("/workspace/git","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=${ot(e)}`+(t!=null?`&oldPath=${ot(t)}`:"");return await this.jsonRequest(n,"GET /workspace/git/diff/file",{mode:"rest"})}async workspaceGitLog(e,t){let n=new URLSearchParams;e!=null&&n.set("limit",String(e)),t!=null&&n.set("skip",String(t));let s=n.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=${ot(e)}`,"GET /workspace/git/log/commit",{mode:"rest"})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${ot(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/${ot(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/${ot(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/${ot(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,s){return await this.jsonRequest(`/workspace/extensions/operations/${ot(e)}/interactions/${ot(t)}`,"POST /workspace/extensions/operations/:operationId/interactions/:interactionId",{method:"POST",body:n,clientId:s,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/${ot(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/${ot(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/${ot(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${ot(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/${ot(e)}/update`,"POST /extensions/:extensionId/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallUserExtension(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/extensions/${ot(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var s;if(n.status===204){await((s=n.body)==null?void 0:s.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/${ot(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/${ot(e)}`,"GET /extensions/operations/:operationId",t?{signal:t,mode:"rest"}:{mode:"rest"})}async waitForExtensionOperation(e,t={}){var a;let n=t.pollIntervalMs??1e3,s=t.timeoutMs??10*6e4,r=s!==Number.POSITIVE_INFINITY,i=Date.now()+s,o=()=>new Error(`Timed out waiting for extension operation ${e.operationId}. The server operation was not cancelled.`);for(;;){(a=t.signal)==null||a.throwIfAborted();let c=i-Date.now();if(c<=0||Number.isNaN(c))throw o();let u;if(!r)u=await this.extensionOperation(e.operationId,t.signal);else{let h=new AbortController,m=t.signal?p6([t.signal,h.signal]):h.signal,p,g=new Promise((b,x)=>{let y=()=>{let w=o();x(w),h.abort(w)},v=()=>{let w=i-Date.now();if(w<=0){y();return}p=setTimeout(()=>{Date.now()>=i?y():v()},Math.min(w,MO))};v()});try{u=await Promise.race([this.extensionOperation(e.operationId,m),g])}finally{p!==void 0&&clearTimeout(p),h.abort()}}if(u.status!=="queued"&&u.status!=="running")return u;let d=i-Date.now();if(d<=0)throw o();await new Promise((h,m)=>{var b,x;let p=setTimeout(()=>{var y;(y=t.signal)==null||y.removeEventListener("abort",g),h()},Math.min(n,d,MO)),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}),(x=t.signal)!=null&&x.aborted&&g()})}}async readWorkspaceFile(e,t={},n){let s=new URL(`${this.baseUrl}/file`);return s.searchParams.set("path",e),t.maxBytes!==void 0&&s.searchParams.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&s.searchParams.set("line",String(t.line)),t.limit!==void 0&&s.searchParams.set("limit",String(t.limit)),await this.fetchWithTimeout(s.toString(),{headers:this.headers({},n)},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /file");return await r.json()})}async readWorkspaceFileBytes(e,t={},n){let s=new URL(`${this.baseUrl}/file/bytes`);return s.searchParams.set("path",e),t.offset!==void 0&&s.searchParams.set("offset",String(t.offset)),t.maxBytes!==void 0&&s.searchParams.set("maxBytes",String(t.maxBytes)),await this.fetchWithTimeout(s.toString(),{headers:this.headers({},n)},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /file/bytes");return await r.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 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(n_,`POST ${n_}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${n_}/${ot(e)}`,`GET ${n_}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(s_,`POST ${s_}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${s_}/${ot(e)}`,`GET ${s_}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(r_,`POST ${r_}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${r_}/${ot(e)}`,`GET ${r_}/: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()},Gg)}async*generateContentEvents(e,t,n,s,r,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"},s==null?void 0:s.clientId),body:JSON.stringify(n),signal:s==null?void 0:s.signal});if(!o.ok)throw await this.failOnError(o,t);if(!o.body)throw new Error("Generation response body is missing");let a=!1;for await(let u of rY(o.body,s==null?void 0:s.signal)){let d=r(u);if(d&&(a=d.type==="done"||d.type==="error",yield d,i&&a))return}if(i&&!((c=s==null?void 0:s.signal)!=null&&c.aborted)&&!a)throw new Error("Stream ended without terminal event")}async*generateWorkspaceContent(e,t){yield*this.generateContentEvents("/workspace/generate","POST /workspace/generate",{prompt:e},t,NO,!0)}async getWorkspaceAgent(e,t={}){let n=t.scope?`${this.baseUrl}/workspace/agents/${ot(e)}?scope=${ot(t.scope)}`:`${this.baseUrl}/workspace/agents/${ot(e)}`;return await this.fetchWithTimeout(n,{headers:this.headers()},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /workspace/agents/:agentType");return await s.json()})}async updateWorkspaceAgent(e,t,n={},s){let r=n.scope?`${this.baseUrl}/workspace/agents/${ot(e)}?scope=${ot(n.scope)}`:`${this.baseUrl}/workspace/agents/${ot(e)}`;return await this.fetchWithTimeout(r,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),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 s=t.scope?`${this.baseUrl}/workspace/agents/${ot(e)}?scope=${ot(t.scope)}`:`${this.baseUrl}/workspace/agents/${ot(e)}`;return await this.fetchWithTimeout(s,{method:"DELETE",headers:this.headers({},n)},async r=>{var i;if(r.status===204){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return}if(r.status===404){let o=await this.failOnError(r,"DELETE /workspace/agents/:agentType"),a=o.body;if(a&&a.code==="agent_not_found")return;throw o}throw await this.failOnError(r,"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)??QS,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:QS))),r=new URLSearchParams({size:String(s)});return(t==null?void 0:t.cursor)!==void 0&&r.set("cursor",t.cursor),(t==null?void 0:t.archiveState)!==void 0&&r.set("archiveState",t.archiveState),(t==null?void 0:t.view)!==void 0&&r.set("view",t.view),(t==null?void 0:t.group)!==void 0&&r.set("group",t.group),(t==null?void 0:t.parentSessionId)!==void 0&&r.set("parentSessionId",t.parentSessionId),(t==null?void 0:t.sourceType)!==void 0&&r.set("sourceType",t.sourceType),(t==null?void 0:t.sourceId)!==void 0&&r.set("sourceId",t.sourceId),await this.jsonRequest(`/workspace/${ot(e)}/sessions?${r.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${ot(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${ot(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${ot(e)}/session-groups/${ot(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${ot(e)}/session-groups/${ot(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${ot(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/${ot(e)}/export`,"GET /session/:id/export",t)}async getSessionTranscriptPage(e,t={}){return await this.jsonRequest(`/session/${ot(e)}/transcript${oY(t)}`,"GET /session/:id/transcript",{clientId:t.clientId,mode:"rest"})}async resolveSubagentSession(e,t,n){return await this.jsonRequest(`/session/${ot(e)}/subagents/${ot(t)}`,"GET /session/:id/subagents/:toolCallId",{clientId:n,mode:"rest"})}async cancelSubagentSession(e,t,n){return await this.jsonRequest(`/session/${ot(e)}/subagents/${ot(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/${ot(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({name:t.name})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/branch");return await s.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}/fork`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({directive:t.directive})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/fork");return await s.json()})}async sessionContext(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(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/${ot(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 s=new URLSearchParams;t.detail===!0&&s.set("detail","true");let r=s.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}/context-usage${r?`?${r}`:""}`,{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/${ot(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/${ot(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/${ot(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,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}/tasks/${ot(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify({kind:n})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/tasks/:taskId/cancel");return await r.json()})}async sessionGoalClear(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(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/${ot(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,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify({cwd:n.workspaceCwd,...n.approvalMode!==void 0?{approvalMode:n.approvalMode}:{},...e==="load"&&n.historyPageSize!==void 0?{historyPageSize:n.historyPageSize}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,`POST /session/:id/${e}`);return await r.json()})}async setSessionApprovalMode(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(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 s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/approval-mode");return await s.json()})}async getRewindSnapshots(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(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/${ot(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 s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/rewind");return await s.json()},void 0,"rest")}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${ot(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/${ot(e)}/generate`,"POST /session/:id/generate",{prompt:t},n,NO,!1)}async btwSession(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${ot(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(!s.ok)throw await this.failOnError(s,"POST /session/:id/btw");return await s.json()}async enqueueMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(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 s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/mid-turn-message");return await s.json()})}async getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(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/${ot(e)}/pending-prompts/${ot(t)}`,{method:"DELETE",headers:this.headers({},n==null?void 0:n.clientId)},async s=>{if(!s.ok)throw await this.failOnError(s,"DELETE /session/:id/pending-prompts/:promptId");return await s.json()})}async shellCommand(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${ot(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(!s.ok)throw await this.failOnError(s,"POST /session/:id/shell");return await s.json()}async setWorkspaceToolEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${ot(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/tools/:name/enable");return await s.json()})}async setWorkspaceSkillEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills/${ot(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/skills/:name/enable");return await s.json()})}installWorkspaceSkill(e){return this.jsonRequest("/workspace/skills/install","Skill",{method:"POST",body:e})}deleteWorkspaceSkill(e,t){return this.jsonRequest(`/workspace/skills/${ot(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,s){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s==null?void 0:s.clientId),body:JSON.stringify({scope:e,key:t,value:n,...s!=null&&s.mcpServerMutation?{mcpServerMutation:s.mcpServerMutation}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/settings");return await r.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,s){let r=s.voiceModel?`?${new URLSearchParams({voiceModel:s.voiceModel}).toString()}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${r}`,{method:"POST",headers:this.headers({"Content-Type":s.mimeType},s.clientId),body:n},async i=>{if(!i.ok)throw await this.failOnError(i,t);return await i.json()},s.timeoutMs??Ffe,"rest")}async workspaceTrust(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/trust`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/trust");return await t.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,s){return await this.jsonRequest("/workspace/permissions","POST /workspace/permissions",{method:"POST",body:{scope:e,ruleType:t,rules:[...n]},clientId:s==null?void 0:s.clientId})}async addWorkspacePermissionRule(e,t,n,s){let r=IO(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?i:await this.setWorkspacePermissionRules(e,t,[...o,r],s)}async removeWorkspacePermissionRule(e,t,n,s){let r=IO(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?await this.setWorkspacePermissionRules(e,t,o.filter(a=>a!==r),s):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${ot(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${ot(e)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/mcp/:server/restart");return await s.json()},(t==null?void 0:t.timeoutMs)??Gg)}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)}async manageMcpServer(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${ot(e)}/${ot(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:"{}"},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/mcp/:server/:action");return await s.json()},(n==null?void 0:n.timeoutMs)??Gg)}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)??Gg)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${ot(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)??Gg)}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:Hfe})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/model");return await s.json()})}async setSessionLanguage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(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 s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/language");return await s.json()})}async prompt(e,t,n,s){n==null||n.throwIfAborted();let r=this.reservePromptSlot(e),i=!0;try{let o=await this.transport.fetch(`${this.baseUrl}/session/${ot(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(o.status===202){let a=await o.json();i=!1;try{return await this._awaitTurnComplete(e,a.promptId,a.lastEventId,n,s,a.eventEpoch)}finally{r()}}if(!o.ok)throw await this.failOnError(o,"POST /session/:id/prompt",e);return await o.json()}finally{i&&r()}}async promptNonBlocking(e,t,n,s){let r=await this.transport.fetch(`${this.baseUrl}/session/${ot(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(r.status===202)return await r.json();if(!r.ok)throw await this.failOnError(r,"POST /session/:id/prompt",e);return await r.json()}async _awaitTurnComplete(e,t,n,s,r,i){let o=new AbortController,a=s?p6([s,o.signal]):o.signal;try{let c=this.subscribeEvents(e,{lastEventId:n,...i!==void 0?{epoch:i}:{},signal:a});for await(let u of c){let d=o9(u,t);if(d!==void 0)return d}throw new Error("SSE stream ended")}catch(c){throw s!=null&&s.aborted&&c instanceof DOMException&&c.name==="AbortError"&&this.cancel(e,r).catch(()=>{}),c}finally{o.signal.aborted||o.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(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/${ot(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{var s;if(!n.ok&&n.status!==204)throw await this.failOnError(n,"POST /session/:id/cancel");try{await((s=n.body)==null?void 0:s.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/${ot(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async s=>{var r,i;if(s.status===200){try{await((r=s.body)==null?void 0:r.cancel())}catch{}return!0}if(s.status===404){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!1}throw await this.failOnError(s,"POST /permission/:requestId")})}async respondToSessionPermission(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}/permission/${ot(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(n)},async r=>{var i,o;if(r.status===200){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!0}if(r.status===404){try{await((o=r.body)==null?void 0:o.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /session/:id/permission/:requestId")})}async closeSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /session/:id")})}async detachSession(e,t){if(t)return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}/detach`,{method:"POST",headers:this.headers({},t)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.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/${ot(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/${ot(e)}`,{method:"DELETE",headers:this.headers({},t.clientId)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.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(ot(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/${ot(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${ot(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${ot(e)}/artifacts/${ot(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}/metadata`,{method:"PATCH",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async s=>{if(s.status===200){let r=await s.json();return typeof r.displayName=="string"?{displayName:r.displayName}:{}}throw await this.failOnError(s,"PATCH /session/:id/metadata")})}},DO=class{constructor(t,n){this.client=t,this.workspaceSelector=n}workspaceMcp(){return this.get("/mcp","GET /workspaces/:workspace/mcp")}notify(t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,"/notify","POST /workspaces/:workspace/notify",{method:"POST",body:t,timeoutMs:(n==null?void 0:n.timeoutMs)??iY,mode:"rest"})}initializeWorkspaceMcp(){return this.post("/mcp/initialize","POST /workspaces/:workspace/mcp/initialize",{})}reloadWorkspaceMcp(t={}){return this.post("/mcp/reload","POST /workspaces/:workspace/mcp/reload",t)}workspaceVoice(t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","GET /workspaces/:workspace/voice",{clientId:t,mode:"rest"})}setWorkspaceVoice(t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","POST /workspaces/:workspace/voice",{method:"POST",body:t,clientId:n,mode:"rest"})}transcribeWorkspaceVoice(t,n){return this.client.workspaceVoiceTranscriptionRequest(this.workspaceSelector,t,n)}workspaceGit(t){let n=t?`/git?cwd=${encodeURIComponent(t)}`:"/git";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"GET /workspaces/:workspace/git",{mode:"rest"})}workspaceGitDiff(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/git/diff","GET /workspaces/:workspace/git/diff",{mode:"rest"})}workspaceGitDiffFile(t,n){let s=`/git/diff/file?path=${ot(t)}`+(n!=null?`&oldPath=${ot(n)}`:"");return this.client.workspaceJsonRequest(this.workspaceSelector,s,"GET /workspaces/:workspace/git/diff/file",{mode:"rest"})}workspaceGitLog(t,n){let s=new URLSearchParams;t!=null&&s.set("limit",String(t)),n!=null&&s.set("skip",String(n));let r=s.toString();return this.client.workspaceJsonRequest(this.workspaceSelector,`/git/log${r?`?${r}`:""}`,"GET /workspaces/:workspace/git/log",{mode:"rest"})}workspaceGitCommitDetail(t){return this.client.workspaceJsonRequest(this.workspaceSelector,`/git/log/commit?sha=${ot(t)}`,"GET /workspaces/:workspace/git/log/commit",{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(t){let n=(t==null?void 0:t.force)===void 0?void 0:{force:t.force};return this.client.workspaceJsonRequest(this.workspaceSelector,"","DELETE /workspaces/:workspace",{method:"DELETE",...n?{body:n}:{},...(t==null?void 0:t.timeoutMs)!==void 0?{timeoutMs:t.timeoutMs}:{},mode:"rest"})}writeWorkspaceMemory(t,n){return this.post("/memory","POST /workspaces/:workspace/memory",{...t,scope:"workspace"},n)}listWorkspaceAgents(){return this.get("/agents","GET /workspaces/:workspace/agents")}createWorkspaceAgent(t,n){return this.post("/agents","POST /workspaces/:workspace/agents",{...t,scope:t.scope??"workspace"},n)}getWorkspaceAgent(t){return this.get(`/agents/${ot(t)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(t,n,s={}){let r=s.scope?`?scope=${ot(s.scope)}`:"";return this.post(`/agents/${ot(t)}${r}`,"POST /workspaces/:workspace/agents/:agentType",n,s.clientId)}async deleteWorkspaceAgent(t,n={}){let s=n.scope?`?scope=${ot(n.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${ot(t)}${s}`,"DELETE /workspaces/:workspace/agents/:agentType",{method:"DELETE",clientId:n.clientId,okNotFoundCode:"agent_not_found"})}async listWorkspaceSessionsPage(t){((t==null?void 0:t.sourceType)!==void 0||(t==null?void 0:t.sourceId)!==void 0)&&await this.client.requireCapability("session_source_metadata");let n=(t==null?void 0:t.pageSize)??QS,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:QS))),r=new URLSearchParams({size:String(s)});return(t==null?void 0:t.cursor)!==void 0&&r.set("cursor",t.cursor),(t==null?void 0:t.archiveState)!==void 0&&r.set("archiveState",t.archiveState),(t==null?void 0:t.view)!==void 0&&r.set("view",t.view),(t==null?void 0:t.group)!==void 0&&r.set("group",t.group),(t==null?void 0:t.parentSessionId)!==void 0&&r.set("parentSessionId",t.parentSessionId),(t==null?void 0:t.sourceType)!==void 0&&r.set("sourceType",t.sourceType),(t==null?void 0:t.sourceId)!==void 0&&r.set("sourceId",t.sourceId),await this.get(`/sessions?${r.toString()}`,"GET /workspaces/:workspace/sessions")}async listWorkspaceSessions(t){return(await this.listWorkspaceSessionsPage(t)).sessions}getWorkspaceSessionInfo(){return this.get("/session-info","GET /workspaces/:workspace/session-info")}getSessionTranscriptPage(t,n={}){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${ot(t)}/transcript${oY(n)}`,"GET /workspaces/:workspace/session/:id/transcript",{clientId:n.clientId,mode:"rest"})}exportSession(t,n={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${ot(t)}/export`,"GET /workspaces/:workspace/session/:id/export",n)}exportArchivedSession(t,n={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${ot(t)}/archive/export`,"GET /workspaces/:workspace/session/:id/archive/export",n)}listSessionGroups(){return this.get("/session-groups","GET /workspaces/:workspace/session-groups")}async createSessionGroup(t){return(await this.post("/session-groups","POST /workspaces/:workspace/session-groups",t)).group}async updateSessionGroup(t,n){return(await this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${ot(t)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}deleteSessionGroup(t){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${ot(t)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}updateSessionOrganization(t,n,s){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${ot(t)}/organization`,"PATCH /workspaces/:workspace/session/:id/organization",{method:"PATCH",body:n,clientId:s})}deleteSessionsData(t,n){return this.post("/sessions/delete","POST /workspaces/:workspace/sessions/delete",{sessionIds:t},n)}archiveSessionsData(t,n){return this.post("/sessions/archive","POST /workspaces/:workspace/sessions/archive",{sessionIds:t},n)}unarchiveSessionsData(t,n){return this.post("/sessions/unarchive","POST /workspaces/:workspace/sessions/unarchive",{sessionIds:t},n)}readWorkspaceFile(t,n={},s){let r=new URLSearchParams({path:t});return n.maxBytes!==void 0&&r.set("maxBytes",String(n.maxBytes)),n.line!==void 0&&r.set("line",String(n.line)),n.limit!==void 0&&r.set("limit",String(n.limit)),this.get(`/file?${r.toString()}`,"GET /workspaces/:workspace/file",s)}readWorkspaceFileBytes(t,n={},s){let r=new URLSearchParams({path:t});return n.offset!==void 0&&r.set("offset",String(n.offset)),n.maxBytes!==void 0&&r.set("maxBytes",String(n.maxBytes)),this.get(`/file/bytes?${r.toString()}`,"GET /workspaces/:workspace/file/bytes",s)}fileStat(t){let n=new URLSearchParams({path:t});return this.get(`/stat?${n.toString()}`,"GET /workspaces/:workspace/stat")}dirList(t){let n=new URLSearchParams({path:t});return this.get(`/list?${n.toString()}`,"GET /workspaces/:workspace/list")}glob(t,n={}){let s=new URLSearchParams({pattern:t});return n.maxResults!==void 0&&s.set("maxResults",String(n.maxResults)),this.client.workspaceJsonRequest(this.workspaceSelector,`/glob?${s.toString()}`,"GET /workspaces/:workspace/glob",{signal:n.signal})}writeWorkspaceFile(t,n){return this.post("/file/write","POST /workspaces/:workspace/file/write",t,n)}editWorkspaceFile(t,n){return this.post("/file/edit","POST /workspaces/:workspace/file/edit",t,n)}workspaceSettings(t){return this.get("/settings","GET /workspaces/:workspace/settings",t==null?void 0:t.clientId)}setWorkspaceSetting(t,n,s,r){return this.post("/settings","POST /workspaces/:workspace/settings",{scope:t,key:n,value:s,...r!=null&&r.mcpServerMutation?{mcpServerMutation:r.mcpServerMutation}:{}},r==null?void 0:r.clientId)}workspaceTrust(t){return this.get("/trust","GET /workspaces/:workspace/trust",t==null?void 0:t.clientId)}requestWorkspaceTrustChange(t,n){return this.post("/trust/request","POST /workspaces/:workspace/trust/request",t,n)}workspacePermissions(t){return this.get("/permissions","GET /workspaces/:workspace/permissions",t==null?void 0:t.clientId)}setWorkspacePermissionRules(t,n,s){return this.post("/permissions","POST /workspaces/:workspace/permissions",{scope:"workspace",ruleType:t,rules:[...n]},s==null?void 0:s.clientId)}setWorkspaceToolEnabled(t,n,s){return this.post(`/tools/${ot(t)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:n},s==null?void 0:s.clientId)}setWorkspaceSkillEnabled(t,n,s){return this.post(`/skills/${ot(t)}/enable`,"POST /workspaces/:workspace/skills/:name/enable",{enabled:n},s==null?void 0:s.clientId)}restartMcpServer(t,n){let s=(n==null?void 0:n.entryIndex)===void 0?"":`?entryIndex=${ot(String(n.entryIndex))}`;return this.post(`/mcp/${ot(t)}/restart${s}`,"POST /workspaces/:workspace/mcp/:server/restart",{},n==null?void 0:n.clientId,(n==null?void 0:n.timeoutMs)??Gg)}reload(t){return this.post("/reload","POST /workspaces/:workspace/reload",{},t==null?void 0:t.clientId,t==null?void 0:t.timeoutMs)}initWorkspace(t){return this.post("/init","POST /workspaces/:workspace/init",(t==null?void 0:t.force)===!0?{force:!0}:{},t==null?void 0:t.clientId)}workspaceExtensions(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions","GET /workspaces/:workspace/extensions",{mode:"rest"})}setExtensionActivation(t,n,s){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${ot(t)}/activation`,"PUT /workspaces/:workspace/extensions/:extensionId/activation",{method:"PUT",body:{state:n},clientId:s,mode:"rest"})}clearExtensionActivation(t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${ot(t)}/activation`,"DELETE /workspaces/:workspace/extensions/:extensionId/activation",{method:"DELETE",clientId:n,mode:"rest"})}refreshExtensionRuntime(t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions/refresh","POST /workspaces/:workspace/extensions/refresh",{method:"POST",body:{},clientId:t,mode:"rest"})}get(t,n,s){return this.client.workspaceJsonRequest(this.workspaceSelector,t,n,{clientId:s})}post(t,n,s,r,i){return this.client.workspaceJsonRequest(this.workspaceSelector,t,n,{method:"POST",body:s,clientId:r,timeoutMs:i})}};function p6(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,s=[],r=()=>{for(;s.length>0;){let i=s.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),r(),n.signal;let o=()=>{n.abort(i.reason),r()};i.addEventListener("abort",o,{once:!0}),s.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",r,{once:!0}),n.signal}function o9(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 ic(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function LO(e){return"promptId"in e&&"lastEventId"in e}var Py=class q2{constructor(t){Pe(this,"client");Pe(this,"session");Pe(this,"state");Pe(this,"replaySnapshot");Pe(this,"hasActivePrompt");Pe(this,"historyHasMore");Pe(this,"replayDegraded");Pe(this,"lastSeenEventId");Pe(this,"lastSeenEpoch");Pe(this,"subscriptionActive",!1);Pe(this,"reattaching");Pe(this,"promptLimit");Pe(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.replayDegraded=t.replayDegraded??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=i_(t.lastEventId),this.lastSeenEpoch=t.eventEpoch,this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:aY(t.maxPendingPromptsPerSession)}static async createOrAttach(t,n={},s){let r=await t.createOrAttachSession(n,s),i=!r.attached||n.modelServiceId||n.approvalMode?0:void 0;return new q2({client:t,session:r,hasActivePrompt:r.hasActivePrompt,lastEventId:i,eventEpoch:r.eventEpoch})}static async load(t,n,s={},r){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:c,historyHasMore:u,replayDegraded:d,lastEventId:h,eventEpoch:m,...p}=await t.loadSession(n,s,r);return new q2({client:t,session:p,hasActivePrompt:o,state:i,lastEventId:h??0,eventEpoch:m,replaySnapshot:{compactedReplay:a??[],liveJournal:c??[]},historyHasMore:u,replayDegraded:d})}static async resume(t,n,s={},r){let{state:i,hasActivePrompt:o,lastEventId:a,eventEpoch:c,...u}=await t.resumeSession(n,s,r);return new q2({client:t,session:u,hasActivePrompt:o,state:i,lastEventId:a??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=i_(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 s=this.client.reservePromptSlot(this.sessionId,this.promptLimit),r;try{if(r=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId)),!LO(r))return s(),r;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw s(),i}return new Promise((i,o)=>{let a=()=>{let u=this._pendingPrompts.get(r.promptId);u&&this._pendingPrompts.delete(r.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),u.reject(n.reason??new DOMException("Aborted","AbortError")))},c=()=>n==null?void 0:n.removeEventListener("abort",a);this._pendingPrompts.set(r.promptId,{resolve:u=>{c(),s(),i(u)},reject:u=>{c(),s(),o(u)}}),n!=null&&n.aborted?a():n==null||n.addEventListener("abort",a,{once:!0})})}async submitPrompt(t,n){n==null||n.throwIfAborted();let s=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId));if(!LO(s))throw new Error("Expected non-blocking prompt acceptance");return s}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!Gfe(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(){await this.client.cancel(this.sessionId,this.clientId)}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=i_(t.lastEventId),s=!1,r=!1,i=()=>{r||(r=!0,this.subscriptionActive=!1)},o=()=>{if(!s){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,s=!0}},a=this.iterateEvents({...t,lastEventId:n},i);return{next:async c=>(r||o(),await a.next(c)),return:async()=>{try{return await a.return(void 0)}finally{i()}},throw:async c=>{try{return await a.throw(c)}finally{i()}},[Symbol.asyncIterator](){return this}}}async*iterateEvents(t,n){try{let{resume:s=!0,...r}=t,i=r.lastEventId??(s?this.lastSeenEventId:void 0),o=r.epoch??(s?this.lastSeenEpoch:void 0),a=r.onEpoch;for await(let c of this.client.subscribeEvents(this.sessionId,{...r,lastEventId:i,...o!==void 0?{epoch:o}:{},onEpoch:u=>{this.lastSeenEpoch=u,a==null||a(u)}}))this._dispatchTurnEvent(c),yield c,c.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,i_(c.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(t){var r;if(t.type!=="turn_complete"&&t.type!=="turn_error")return;let n=(r=t.data)==null?void 0:r.promptId;if(!n)return;let s=this._pendingPrompts.get(n);if(s){this._pendingPrompts.delete(n);try{let i=o9(t,n);i!==void 0&&s.resolve(i)}catch(i){s.reject(i)}}}_rejectAllPending(t){for(let[,n]of this._pendingPrompts)n.reject(t);this._pendingPrompts.clear()}};function i_(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function Gfe(e){return e instanceof ic&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var cY="mid_turn_message_injected",a9="pending_prompt_added",l9="pending_prompt_started",c9="pending_prompt_completed",Kfe=["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",cY,a9,l9,c9,"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"];new Set(Kfe);var rA="daemon-plan";function Ft(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rt(e,t){if(!Ft(e))return;let n=e[t];return typeof n=="string"?n:void 0}function vr(e,t){if(Ft(e))for(let n of t){let s=e[n];if(typeof s=="string"&&s.trim().length>0)return s}}function bm(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 Lh(e){return bm(hh(e))}function hh(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>hh(n,t+1)):Ft(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,uY(n)?"[redacted]":hh(s,t+1)])):e}function uY(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 g6(e){if(typeof e=="string")return e;if(!Ft(e))return"";let t=e.text;return typeof t=="string"?t:""}function Yfe(e){if(typeof e=="string")return{kind:"text",text:e};if(!Ft(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=Ft(e.source)?e.source:void 0,s,r;return n&&(s=typeof n.url=="string"?n.url:void 0,r=typeof n.data=="string"?n.data:void 0),!s&&!r&&(r=typeof e.data=="string"?e.data:void 0,s=typeof e.url=="string"?e.url:void 0),!s&&!r?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:{...s?{url:s}:{},...r?{data:r}:{}}}}if(t==="audio"){let n=Ft(e.source)?e.source:void 0;if(!n)return;let s=(typeof e.mediaType=="string"?e.mediaType:void 0)??"audio/*",r=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0;return!r&&!i?void 0:{kind:"audio",mediaType:s,source:{...r?{url:r}:{},...i?{data:i}:{}}}}if(t==="resource"||t==="resource_link"){let n=typeof e.uri=="string"?e.uri:void 0;if(!n)return;let s=typeof e.mediaType=="string"?e.mediaType:void 0,r=typeof e.description=="string"?e.description:void 0;return{kind:"resource",uri:n,...s?{mediaType:s}:{},...r?{description:r}:{}}}}var Xfe=64;function JS(e,t=0){if(t>Xfe)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>JS(s,t+1)).filter(Boolean).join(`
`);if(!Ft(e))return e===void 0?"":bm(e);for(let s of["text","output","stdout","stderr","rawOutput"]){let r=e[s];if(typeof r=="string")return r}let n=e.content;if(n!==void 0){let s=JS(n,t+1);if(s)return s}return bm(e)}var Qfe=new Set(Bfe),dY=new Set(["qwen","qwen-oauth"]),Jfe=new Set(["in_flight","disabled","budget_would_exceed","authentication_required"]),PO="malformed memory_changed payload",OO=4096,$O="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 Zfe(e,t={}){let n=ame(e,t);switch(e.type){case"session_update":return cme(e,n,t);case"shell_output":{let s=JS(e.data),r=oA(e.data),i=aA(e.data);return s?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:s,...r?{stream:r}:{}}]:[]}case"permission_request":return bme(e,n);case"permission_resolved":case"permission_already_resolved":return yme(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:rt(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:rt(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let s=b6(rt(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...s?{errorKind:s}:{},text:rt(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${rt(e.data,"reason")??"closed"}`}];case"session_recording_degraded":return!rt(e.data,"sessionId")||rt(e.data,"reason")!=="write_failed"?Zs(e,n,"malformed recording state"):[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:$O}];case"session_snapshot":{if(!Ft(e.data)||!rt(e.data,"sessionId"))return Zs(e,n,"malformed recording snapshot");let s=e.data.recordingDegraded;return s!==void 0&&typeof s!="boolean"?Zs(e,n,"malformed recording snapshot"):s===!0?[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:$O}]:[]}case"client_evicted":return[{...n,type:"error",recoverable:!0,text:rt(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 s=b6(rt(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...s?{errorKind:s}:{},text:rt(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let s=rt(e.data,"code"),r=b6(rt(e.data,"errorKind")),i=rt(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...s?{code:s}:{},...r?{errorKind:r}:{},...i?{promptId:i}:{},text:rt(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return tme(e,n);case"history_truncated":return nme(e,n);case"session_rewound":return sme(e,n);case"session_branched":return rme(e,n);case"prompt_cancelled":{let s=Ume(e.data,"reason");return[{...n,type:"prompt.cancelled",...s?{reason:s}:{}}]}case"followup_suggestion":return ime(e,n);case"mid_turn_message_injected":return ome(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let s=rt(e.data,"command"),r=rt(e.data,"cwd");return s?[{...n,type:"user.shell.command",command:s,...r?{cwd:r}:{}},{...n,type:"user.text.delta",text:`$ ${s}`}]:[]}case"user_shell_result":{let s=Gr(e.data,"exitCode"),r=Ft(e.data)&&e.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${s??"unknown"}`;return[{...n,type:"status",text:r}]}case"replay_complete":{let s=Gr(e.data,"replayedCount")??0,r=Gr(e.data,"lastReplayedEventId")??Gr(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:s,...r!==void 0?{lastReplayedEventId:r}:{}}]}case"session_metadata_updated":return kme(e,n);case"approval_mode_changed":return Sme(e,n);case"git_branch_changed":return[];case"memory_changed":return Cme(e,n);case"agent_changed":return Tme(e,n);case"tool_toggled":return Eme(e,n);case"settings_changed":return Ame(e,n);case"settings_reloaded":return jme(e,n);case"trust_change_requested":return Mme(e,n);case"workspace_initialized":return Nme(e,n);case"github_setup_completed":return Ime(e,n);case"mcp_budget_warning":return Rme(e,n);case"mcp_child_refused_batch":return Dme(e,n);case"mcp_server_restarted":return Lme(e,n);case"mcp_server_restart_refused":return Pme(e,n);case"mcp_server_added":return y6(e,n,"added");case"mcp_server_removed":return y6(e,n,"removed");case"mcp_server_changed":return y6(e,n);case"extensions_changed":return Ome(e,n);case"artifact_changed":return _me(e,n);case"auth_device_flow_started":return $me(e,n);case"auth_device_flow_throttled":return Bme(e,n);case"auth_device_flow_authorized":return zme(e,n);case"auth_device_flow_failed":return Fme(e,n);case"auth_device_flow_cancelled":return qme(e,n);default:return eme(e,n)}}function eme(e,t){return[{...t,type:"debug",text:`${e.type} (unrecognized daemon event): ${Lh(e.data)}`}]}function tme(e,t){let n=rt(e.data,"reason"),s=Gr(e.data,"lastDeliveredId"),r=Gr(e.data,"earliestAvailableId");return!n||s===void 0||r===void 0?Zs(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:s,earliestAvailableId:r}]}function nme(e,t){let n=rt(e.data,"reason"),s=Gr(e.data,"truncatedEvents"),r=Gr(e.data,"retainedEvents"),i=Gr(e.data,"maxBytes");return n!=="replay_window_exceeded"||s===void 0||r===void 0||i===void 0||!Ft(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?Zs(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${r}, dropped ${s} (window ${i} bytes).`,source:"history_truncated"}]}function sme(e,t){let n=rt(e.data,"promptId"),s=Gr(e.data,"targetTurnIndex");if(!n||s===void 0)return Zs(e,t,"malformed session_rewound payload");let r=rt(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:s,...r?{sessionId:r}:{}}]}function rme(e,t){let n=rt(e.data,"sourceSessionId"),s=rt(e.data,"newSessionId"),r=rt(e.data,"displayName");return!n||!s||!r?Zs(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:s,displayName:r}]}function ime(e,t){let n=rt(e.data,"sessionId"),s=rt(e.data,"suggestion"),r=rt(e.data,"promptId");return!n||!s||!r?Zs(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:s,promptId:r}]}function ome(e,t){if(!Ft(e.data))return Zs(e,t,"malformed mid_turn_message_injected");let n=Array.isArray(e.data.messages)?e.data.messages.filter(s=>typeof s=="string"&&s.length>0):[];return n.length===0?Zs(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function ame(e,t){let n=hY(e),s=ume(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...s?{sourceRecordIds:s}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:hh(e.data)}}:{}}}function hY(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(Ft(n)){let s=n.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}if(Ft(e.data)){let s=e.data._meta,r=e.data.update,i=Ft(r)?r._meta:void 0;if(Ft(s)){let a=s.serverTimestamp;if(typeof a=="number"&&Number.isFinite(a))return a}if(Ft(i)){let a=i.serverTimestamp;if(typeof a=="number"&&Number.isFinite(a))return a}let o=[Ft(i)?i.timestamp:void 0,Ft(r)?r.timestamp:void 0,Ft(s)?s.timestamp:void 0,e.data.timestamp];for(let a of o){let c=lme(a);if(c!==void 0)return c}}}function lme(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 cme(e,t,n){let s=fY(e.data);if(!s)return[{...t,type:"debug",text:`session_update: ${Lh(e.data)}`}];let r=rt(s,"sessionUpdate");switch(r){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=zO(s),o=s.content,a=Yfe(o);if(a){if(a.kind==="image"){let u=a.source.data,d=a.mediaType||"image/*";if(d==="image/*"&&u){let h=(u.startsWith("data:")?u.split(",")[1]??"":u).slice(0,10);h.startsWith("iVBORw0KGg")?d="image/png":h.startsWith("/9j/")?d="image/jpeg":h.startsWith("R0lGOD")?d="image/gif":h.startsWith("UklGR")&&(d="image/webp")}return u?[{...t,type:"user.image.delta",data:u,mimeType:d}]:[]}return a.kind==="text"?a.text?[{...t,type:"user.text.delta",text:a.text,...i?{meta:i}:{}}]:[]:[]}let c=g6(o);return c?[{...t,type:"user.text.delta",text:c,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=g6(s.content),o=BO(s),a=zO(s),c=[];i&&c.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let u=dme(s);return u&&c.push({...t,type:"assistant.usage",usage:u,...o?{parentToolCallId:o}:{}}),c}case"agent_thought_chunk":{let i=g6(s.content);if(!i)return[];let o=BO(s);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":{let i=Ft(s._meta)?s._meta:void 0;return rt(s,"status")==="in_progress"&&rt(s,"kind")===void 0&&(i==null?void 0:i.shellProgress)!==void 0?[]:[hme(s,t)]}case"shell_output":case"tool_output":{let i=JS(s),o=oA(s)??oA(e.data),a=aA(s)??aA(e.data);return i?[{...t,type:a==="user-shell"?"user.shell.output":"shell.output",text:i,...o?{stream:o}:{}}]:[]}case"available_commands_update":{let i=(Array.isArray(s.availableCommands)?s.availableCommands:[]).filter(Ft);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[fme(s,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${r??"session_update"}: ${Lh(s)}`}]}}function BO(e){let t=Ft(e._meta)?e._meta:void 0;return t?rt(t,"parentToolCallId"):void 0}function zO(e){let t=Ft(e._meta)?e._meta:void 0;if(!t)return;let{qwenTranscript:n,...s}=t;return Object.keys(s).length>0?s:void 0}function ume(e){var i;if(!Ft(e.data))return;let t=fY(e.data),n=t&&Ft(t._meta)?t._meta:void 0,s=(i=n&&Ft(n.qwenTranscript)?n.qwenTranscript:void 0)==null?void 0:i.sourceRecordIds;if(!Array.isArray(s))return;let r=[...new Set(s.filter(o=>typeof o=="string"))];return r.length>0?r:void 0}function dme(e){let t=Ft(e._meta)?e._meta:void 0,n=t&&Ft(t.usage)?t.usage:void 0;if(!n)return;let s=Gr(n,"inputTokens"),r=Gr(n,"outputTokens");if(s===void 0&&r===void 0)return;let i=Gr(n,"cachedReadTokens");return{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}function hme(e,t){let n=Ft(e._meta)?e._meta:void 0,s=rt(e,"toolName")??rt(e,"name")??(n?rt(n,"toolName"):void 0)??(n?rt(n,"name"):void 0),r=rt(e,"kind"),i=rt(e,"title")??(rt(e,"sessionUpdate")==="tool_call"?s??r:void 0),o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,c=o!==void 0?hh(o):void 0,u=a!==void 0?hh(a):void 0,d=e.content!==void 0?hh(e.content):void 0,h=e.locations!==void 0?hh(e.locations):void 0,m=rt(e,"toolCallId"),p=rt(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}=gme(e,s),x=rt(e,"parentToolCallId")??(n?rt(n,"parentToolCallId"):void 0),y=x&&x!==m?x:void 0,v=rt(e,"subagentType")??(n?rt(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:m,...p?{status:p}:{},...i?{title:i}:{},...s?{toolName:s}:{},...r?{toolKind:r}:{},...d!==void 0?{content:d}:{},...h!==void 0?{locations:h}:{},...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:iA(Lh(c))}:u!==void 0?{details:iA(Lh(u))}:{}}}function fme(e,t){let n=Array.isArray(e.entries)?e.entries:[],s=iA(mme(n)),r=Ft(e._meta)?e._meta:void 0,i=r&&Ft(r.qwenTranscript)?r.qwenTranscript:void 0,o=rt(i,"planToolCallId")??(t.eventId!==void 0?`${rA}-${t.eventId}`:rA),a=r&&Ft(r.stats)?r.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:s}}],rawOutput:a?{entries:n,stats:a}:{entries:n}}}function mme(e){return e.flatMap(t=>{if(!Ft(t))return[];let n=rt(t,"content");return n?[`- [${pme(rt(t,"status"))}] ${n}`]:[]}).join(`
`)}function pme(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function gme(e,t){let n=rt(e,"provenance"),s=rt(e,"serverId");if(n==="builtin"||n==="mcp"||n==="subagent")return{provenance:n,...n==="mcp"&&s?{serverId:s}:{}};if(t&&t.startsWith("mcp__")){let r=t.slice(5),i=r.indexOf("__");if(i>0)return{provenance:"mcp",serverId:r.slice(0,i)}}return{}}function b6(e){if(e)return Qfe.has(e)?e:void 0}function iA(e){return e.length<=OO?e:`${e.slice(0,OO)}... [truncated]`}function bme(e,t){if(!Ft(e.data))return[{...t,type:"debug",text:`permission_request: ${Lh(e.data)}`}];let n=rt(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${Lh(e.data)}`}];let s=e.data.toolCall!==void 0?hh(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:rt(e.data,"sessionId"),title:wme(s),options:vme(e.data.options),toolCall:s}]}function yme(e,t){let n=rt(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${Lh(e.data)}`}];let s=rt(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:xme(e.data),...s?{voterClientId:s}:{}}]}function fY(e){if(!Ft(e))return;let t=e.update;return Ft(t)?t:e}function vme(e){return Array.isArray(e)?e.flatMap(t=>{if(!Ft(t))return[];let n=rt(t,"optionId");return n?[{optionId:n,label:rt(t,"label")??rt(t,"title")??rt(t,"name")??n,...rt(t,"description")?{description:rt(t,"description")}:{},raw:t}]:[]}):[]}function xme(e){if(!Ft(e))return bm(e);let t=e.outcome;if(typeof t=="string")return t;if(Ft(t)){let n=rt(t,"outcome")??"selected",s=rt(t,"optionId");return s?`${n}:${s}`:n}return vr(e,["status","reason"])??bm(e)}function wme(e){return Ft(e)?rt(e,"title")??rt(e,"name")??rt(e,"kind")??rt(e,"toolName")??"Tool permission":"Tool permission"}function oA(e){let t=rt(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function aA(e){if(!Ft(e))return;let t=rt(e,"source");if(t)return t;let n=e._meta;return Ft(n)?rt(n,"source"):void 0}function Zs(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function kme(e,t){let n=rt(e.data,"sessionId");if(!n)return Zs(e,t,"missing sessionId");let s=rt(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...s!==void 0?{displayName:s}:{}}]}function _me(e,t){let n=rt(e.data,"sessionId"),s=Ft(e.data)?e.data.change:void 0;if(!n||!Ft(s))return Zs(e,t,"malformed artifact_changed payload");let r=rt(s,"action"),i=rt(s,"artifactId");return!r||!i?Zs(e,t,"missing action or artifactId"):[{...t,type:"session.artifact.changed",sessionId:n,change:s}]}function Sme(e,t){let n=rt(e.data,"sessionId"),s=rt(e.data,"previous"),r=rt(e.data,"next");if(!n||!s||!r)return Zs(e,t,"missing sessionId / previous / next");let i=Ft(e.data)&&typeof e.data.persisted=="boolean"?e.data.persisted:!1;return[{...t,type:"session.approval_mode.changed",sessionId:n,previous:s,next:r,persisted:i}]}function Cme(e,t){var o;let n=rt(e.data,"scope");if(n==="managed"){let a=rt(e.data,"source"),c=rt(e.data,"taskId"),u=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&c&&Array.isArray(u))||u.some(d=>d!=="user"&&d!=="project")?Zs(e,t,PO):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:c,touchedScopes:u}]}let s=rt(e.data,"filePath"),r=rt(e.data,"mode"),i=Gr(Ft(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!s||r!=="append"&&r!=="replace"||i===void 0?Zs(e,t,PO):[{...t,type:"workspace.memory.changed",scope:n,filePath:s,mode:r,bytesWritten:i}]}function Tme(e,t){let n=rt(e.data,"change"),s=rt(e.data,"name"),r=rt(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!s||r!=="project"&&r!=="user"?Zs(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:s,level:r}]}function Eme(e,t){let n=rt(e.data,"toolName"),s=Ft(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||s===void 0?Zs(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:s}]}function Ame(e,t){let n=rt(e.data,"key"),s=rt(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:s??"workspace",value:Ft(e.data)?e.data.value:void 0}]:Zs(e,t,"malformed settings_changed payload")}function jme(e,t){return Ft(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:Zs(e,t,"malformed settings_reloaded payload")}function Nme(e,t){let n=rt(e.data,"path"),s=rt(e.data,"action");return!n||s!=="created"&&s!=="overwrote"&&s!=="noop"?Zs(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:s}]}function Mme(e,t){let n=rt(e.data,"workspaceCwd"),s=rt(e.data,"desiredState"),r=rt(e.data,"reason");return!n||s!=="trusted"&&s!=="untrusted"?Zs(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:s,...r!==void 0?{reason:r}:{}}]}function Ime(e,t){let n=rt(e.data,"releaseTag"),s=rt(e.data,"readmeUrl");if(!n||!s||!Ft(e.data))return Zs(e,t,"malformed github_setup_completed payload");let r=e.data.workflows,i=e.data.warnings;return[{...t,type:"workspace.github.setup.completed",releaseTag:n,readmeUrl:s,...typeof e.data.secretsUrl=="string"?{secretsUrl:e.data.secretsUrl}:{},workflows:Array.isArray(r)?r:[],gitignore:e.data.gitignore,warnings:Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}]}function Rme(e,t){if(!Ft(e.data))return Zs(e,t,"non-object payload");let n=Gr(e.data,"liveCount"),s=Gr(e.data,"reservedCount"),r=Gr(e.data,"budget"),i=Gr(e.data,"thresholdRatio"),o=rt(e.data,"mode");return n===void 0||s===void 0||r===void 0||i===void 0||o!=="warn"&&o!=="enforce"?Zs(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:s,budget:r,thresholdRatio:i,mode:o}]}function Dme(e,t){if(!Ft(e.data))return Zs(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(Ft).map(o=>{let a=rt(o,"name"),c=rt(o,"transport"),u=rt(o,"reason");return!a||!c||u!=="budget_exhausted"?null:{name:a,transport:c,reason:"budget_exhausted"}}).filter(o=>o!==null):[],s=Gr(e.data,"budget"),r=Gr(e.data,"liveCount"),i=Gr(e.data,"reservedCount");return n.length===0||s===void 0||r===void 0||i===void 0?Zs(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:s,liveCount:r,reservedCount:i}]}function Lme(e,t){let n=rt(e.data,"serverName"),s=Gr(e.data,"durationMs");return!n||s===void 0?Zs(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:s}]}function Pme(e,t){let n=rt(e.data,"serverName"),s=rt(e.data,"reason");return!n||!s||!Jfe.has(s)?Zs(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:s}]}function y6(e,t,n){let s=rt(e.data,n?"name":"serverName"),r=n??rt(e.data,"action");return!s||!r||!["added","removed","approve","enable","disable","authenticate","clear-auth"].includes(r)?Zs(e,t,`malformed ${e.type} payload`):[{...t,type:"workspace.mcp.server_changed",serverName:s,action:r}]}function Ome(e,t){let n=Gr(e.data,"refreshed"),s=Gr(e.data,"failed"),r=rt(e.data,"status"),i=rt(e.data,"source"),o=rt(e.data,"name"),a=rt(e.data,"version"),c=rt(e.data,"error");return n===void 0||s===void 0||r!==void 0&&r!=="installed"&&r!=="enabled"&&r!=="disabled"&&r!=="updated"&&r!=="uninstalled"&&r!=="failed"?Zs(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:s,...r?{status:r}:{},...i?{source:i}:{},...o?{name:o}:{},...a?{version:a}:{},...c?{error:c}:{}}]}function $me(e,t){let n=rt(e.data,"deviceFlowId"),s=rt(e.data,"providerId"),r=Gr(e.data,"expiresAt");return!n||!s||!dY.has(s)||r===void 0?Zs(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:s,expiresAt:r}]}function Bme(e,t){let n=rt(e.data,"deviceFlowId"),s=Gr(e.data,"intervalMs");return!n||s===void 0?Zs(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:s}]}function zme(e,t){let n=rt(e.data,"deviceFlowId"),s=rt(e.data,"providerId");if(!n||!s||!dY.has(s))return Zs(e,t,"malformed auth_device_flow_authorized payload");let r=Gr(e.data,"expiresAt"),i=rt(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:s,...r!==void 0?{expiresAt:r}:{},...i?{accountAlias:i}:{}}]}function Fme(e,t){let n=rt(e.data,"deviceFlowId"),s=rt(e.data,"errorKind");if(!n||!Hme(s))return Zs(e,t,"malformed auth_device_flow_failed payload");let r=rt(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:s,...r?{hint:r}:{}}]}function Hme(e){return typeof e=="string"&&e.trim().length>0}function qme(e,t){let n=rt(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:Zs(e,t,"malformed auth_device_flow_cancelled payload")}function Gr(e,t){if(!Ft(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Ume(e,t){if(!Ft(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var Wme=8;function ZS(e,t={},n=0){if(n>Wme){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(Ft(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let b=ZS(g,{title:t.title??vr(e,["title"]),toolName:t.toolName??vr(e,["toolName","name"]),toolKind:t.toolKind??vr(e,["kind"])},n+1);if(b.kind!=="generic"||!b.summary)return b}}let s=Xme(e);if(s.length>0)return{kind:"ask_user_question",questions:s};let r=Yme(e,t);if(r)return r;let i=epe(e,t);if(i)return i;let o=tpe(e,t);if(o)return o;let a=npe(e,t);if(a)return a;let c=Vme(e,t);if(c)return c;let u=Gme(e,t);if(u)return u;let d=Kme(e);if(d)return d;let h=spe(e,t);if(h)return h;let m=rpe(e);if(m)return m;if(Ft(e)){let g=vr(e,["command","cmd"]);if(g){let x=vr(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...x?{cwd:x}:{}}}let b=Jme(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 Vme(e,t={}){if(!Ft(e))return;let n=vr(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=vr(e,["oldText","old_text","old_str","oldString"]),r=vr(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),o=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!s,a=r===void 0&&o?vr(e,["content"]):void 0,c=r??a,u=vr(e,["patch","diff","unified_diff"]);if(!(!s&&!c&&!u))return{kind:"file_diff",path:n,...s?{oldText:s}:{},...c?{newText:c}:{},...u?{patch:u}:{}}}function Gme(e,t){if(!Ft(e))return;let n=vr(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=t.toolName??vr(e,["toolName","name"]),r=s!==void 0&&/read|view|cat/i.test(s),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 a=e.offset,c=e.limit;typeof a=="number"&&typeof c=="number"&&c>0&&(o=[a+1,a+c])}if(!(!r&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function Kme(e){if(!Ft(e))return;let t=vr(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=vr(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function Yme(e,t){let n=t.toolName??(Ft(e)?vr(e,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let s=n.slice(5),r=s.indexOf("__");if(r<=0)return;let i=s.slice(0,r),o=s.slice(r+2),a;if(Ft(e)){let c=e.arguments??e.args??e;if(Ft(c)){let u=Object.entries(c).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,h])=>{let m=typeof h=="string"?h:JSON.stringify(h),p=m.length>60?`${m.slice(0,60)}…`:m;return`${d}=${p}`})[0];u&&(a=u)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function Xme(e){return!Ft(e)||!Array.isArray(e.questions)?[]:e.questions.filter(Ft).map(t=>{let n=vr(t,["header","title","label"]),s=vr(t,["question","prompt","text"])??"Question",r=Array.isArray(t.options)?t.options.filter(Ft).map(Qme):[];return{...n?{header:n}:{},question:s,options:r,raw:t}})}function Qme(e){let t=vr(e,["label","title","value"])??"Option",n=vr(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function Jme(e){let t=[],n=[["Path",["path","filePath","file_path","absolutePath"]],["Cwd",["cwd","directory","workingDirectory"]],["Query",["query","pattern","search"]],["Note",["description","reason"]]];for(let[s,r]of n){let i=vr(e,r);i&&t.push({label:s,value:i})}if(t.length>0)return t;for(let[s,r]of Object.entries(e).slice(0,4))r==null||Array.isArray(r)||Ft(r)||t.push({label:s,value:uY(s)?"[redacted]":Lh(r)});return t}var FO=50,Zme=5;function epe(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!Ft(e))return;let s=vr(e,["subagent_type","agent","agentName","agent_name","subagent"]),r=vr(e,["prompt","task","description","instruction","query"]);if(!s&&!r)return;let i=vr(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:s??"subagent",task:r??"(no task description)",...i?{parentDelegationId:i}:{}}}function tpe(e,t){if(!Ft(e))return;let n=vr(e,["query","pattern","search","q"]);if(!n)return;let s=t.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(s)||typeof e.resultCount=="number"||Array.isArray(e.results)||Array.isArray(e.matches)))return;let r=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,Zme).map(a=>typeof a=="string"?a:Ft(a)?vr(a,["path","file","name","title","text"])??bm(a).slice(0,120):String(a)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...r!==void 0?{resultCount:r}:{},...i?{top:i}:{}}}function npe(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!Ft(e))return;let s=vr(e,["prompt","description","query"]);if(!s)return;let r=vr(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=vr(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:s,...r?{thumbnailUrl:r}:{},...i?{model:i}:{}}}function spe(e,t){if(!Ft(e))return;let n=vr(e,["code","snippet","source"]);if(!n)return;let s=vr(e,["language","lang","codeLanguage","syntax"]),r=t.toolName??"",i=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(r);if(!s&&!i)return;let o=vr(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...s?{language:s}:{},...o?{origin:o}:{}}}function rpe(e){if(!Ft(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let r=t.filter(o=>typeof o=="string").slice(0,30);if(r.length===0)return;let i=n.slice(0,FO).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:bm(a).slice(0,80)):[]);return{kind:"tabular",columns:r,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let s=e.data??e.records;if(Array.isArray(s)&&s.length>0&&Ft(s[0])){let r=Object.keys(s[0]).slice(0,30);if(r.length===0)return;let i=s.slice(0,FO).map(o=>{let a=o;return r.map(c=>{let u=a[c];return typeof u=="string"?u:bm(u).slice(0,80)})});return{kind:"tabular",columns:r,rows:i,...s.length>i.length?{totalRows:s.length}:{}}}}var ipe=1e3,om="__trimmed_tool_block__",tC="__trimmed_permission_block__",lA=1e5,HO=`
[truncated]
`,ope=16,Cx=new WeakMap;function ape(e={}){let t={blocks:[],blockIndexById:ao(),toolBlockByCallId:ao(),trimmedToolNotificationByCallId:ao(),permissionBlockByRequestId:ao(),activeAssistantBlockByParent:ao(),activeThoughtBlockByParent:ao(),toolProgress:ao(),awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??ipe,retainSubagentBlocks:e.retainSubagentBlocks??!0};return e.onTruncation&&Cx.set(t,e.onTruncation),t}var u9=new Set(["pending","confirming","running","in_progress"]),lpe=new Set(["completed","success","failed","error","canceled","cancelled"]),cpe=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function upe(e,t,n={}){let s=bY(e,n);f9(s);let r=m9(s,"user",t,void 0,void 0,n.meta);return n.images&&n.images.length>0&&(r.images=[...n.images]),xd(s,r),s.activeUserBlockId=r.id,yY(s)}function dpe(e,t,n={}){if(t.length===0)return e;let s=bY(e,n);for(let i of t)hpe(s,i);return yY(s)}function nC(e){let t=ao();return e.forEach((n,s)=>{t[n.id]=s}),t}function hpe(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!cpe.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),v6(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{let s=e.activeUserBlockId?e.blockIndexById[e.activeUserBlockId]:void 0,r=s!==void 0?e.blocks[s]:void 0;if((r==null?void 0:r.kind)!=="user"||!xY(r.sourceRecordIds,t.sourceRecordIds)){let i=m9(e,"user","",t.eventId,t.serverTimestamp,void 0,t.sourceRecordIds);i.images=[{data:t.data,mimeType:t.mimeType}],xd(e,i),e.activeUserBlockId=i.id}else{let i=oc(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;v6(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":f9(e,t),(t.reason==="cancelled"||t.reason==="error")&&cA(e);break;case"assistant.usage":t.parentToolCallId&&!e.retainSubagentBlocks?gpe(e,t):ppe(e,t);break;case"thought.text.delta":if(t.parentToolCallId&&!e.retainSubagentBlocks)break;v6(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":if(t.parentToolCallId&&!e.retainSubagentBlocks){ype(e,t.toolCallId);break}gY(e,t);break;case"shell.output":wpe(e,t);break;case"user.shell.output":kpe(e,t);break;case"permission.request":_pe(e,t);break;case"permission.resolved":Spe(e,t);break;case"model.changed":Hv(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Hv(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":fpe(e,t);break;case"prompt.cancelled":cA(e),t.reason!=="forward_failed"&&Cpe(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":Epe(e,t.targetTurnIndex);break;case"session.branched":Hv(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function fpe(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},cA(e),Hv(e,"error",`State resync required: ${mpe(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function mpe(e,t){let n=e+1,s=t-1;return s<n?"no events lost (resync requested without gap)":s===n?`missed 1 daemon event (id ${n})`:`missed daemon events ${n}-${s}`}function sC(e,t,n){let s=oc(e,t);((s==null?void 0:s.kind)==="assistant"||(s==null?void 0:s.kind)==="thought")&&(s.streaming=!1,s.updatedAt=e.now,(n==null?void 0:n.eventId)!==void 0&&(s.eventId=n.eventId),s.serverTimestamp===void 0&&(n==null?void 0:n.serverTimestamp)!==void 0&&(s.serverTimestamp=n.serverTimestamp))}function mY(e,t){sC(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function ppe(e,t){let n=oc(e,e.activeAssistantBlockId);if(!n||n.kind!=="assistant")return;let s=n.usage;n.usage={inputTokens:((s==null?void 0:s.inputTokens)??0)+t.usage.inputTokens,outputTokens:((s==null?void 0:s.outputTokens)??0)+t.usage.outputTokens,cachedTokens:((s==null?void 0:s.cachedTokens)??0)+(t.usage.cachedTokens??0)},n.updatedAt=e.now}function gpe(e,t){if(!t.parentToolCallId)return;let n=oc(e,e.toolBlockByCallId[t.parentToolCallId]);if((n==null?void 0:n.kind)!=="tool")return;let s=Ft(n.rawOutput)?n.rawOutput:void 0,r=Ft(s==null?void 0:s.executionSummary)?s.executionSummary:void 0,i=Zc(r==null?void 0:r.inputTokens)+t.usage.inputTokens,o=Zc(r==null?void 0:r.outputTokens)+t.usage.outputTokens,a=Zc(r==null?void 0:r.cachedTokens)+(t.usage.cachedTokens??0);n.rawOutput={...s??{type:"task_execution",status:"running"},executionSummary:{...r??{},inputTokens:i,outputTokens:o,cachedTokens:a,totalTokens:i+o}},n.updatedAt=e.now}function Zc(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function pY(e,t){sC(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function d9(e,t,n){sC(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function h9(e,t,n){sC(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function v6(e,t,n,s,r){let i=t!=="user"&&"parentToolCallId"in r?r.parentToolCallId:void 0,o=i!=null?t==="assistant"?e.activeAssistantBlockByParent:t==="thought"?e.activeThoughtBlockByParent:void 0:void 0,a=o&&i!=null?o[i]:e[n],c=oc(e,a);if(c&&c.kind===t&&bpe(c,r)){c.text=p9(e,c,s),c.updatedAt=e.now,r.eventId!==void 0&&(c.eventId=r.eventId),r.serverTimestamp!==void 0&&(c.serverTimestamp=r.serverTimestamp),"meta"in r&&r.meta&&(c.meta={...c.meta,...r.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=m9(e,t,s,r.eventId,r.serverTimestamp,"meta"in r?r.meta:void 0,r.sourceRecordIds);t!=="user"&&(u.streaming=!0),t==="thought"&&(u.collapsed=!0),i!=null&&(u.parentToolCallId=i),xd(e,u),o&&i!=null?o[i]=u.id:e[n]=u.id,i!=null?(t==="assistant"&&h9(e,i),t==="thought"&&d9(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&mY(e),t!=="thought"&&pY(e))}function bpe(e,t){var n,s;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0||!xY(e.sourceRecordIds,t.sourceRecordIds)?!1:!("meta"in t)||((s=t.meta)==null?void 0:s.qwenDiscreteMessage)!==!0}function f9(e,t){mY(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))d9(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))h9(e,n,t);pY(e,t)}function gY(e,t){let n=!e.retainSubagentBlocks&&Ft(t.rawOutput)&&t.rawOutput.type==="task_execution",s=vpe(t.rawOutput,e.retainSubagentBlocks),r=e.toolBlockByCallId[t.toolCallId];if(r===om){if(Tpe(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],gY(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Hv(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let i=oc(e,r);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=ZS(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),s!==void 0){if(n&&Ft(s)&&Ft(i.rawOutput)){let c=Ft(i.rawOutput.executionSummary)?i.rawOutput.executionSummary:void 0,u=Ft(s.executionSummary)?s.executionSummary:void 0;if(c&&u){let d=Math.max(Zc(c.inputTokens),Zc(u.inputTokens)),h=Math.max(Zc(c.outputTokens),Zc(u.outputTokens));s={...s,executionSummary:{...u,inputTokens:d,outputTokens:h,cachedTokens:Math.max(Zc(c.cachedTokens),Zc(u.cachedTokens)),totalTokens:Math.max(Zc(c.totalTokens),Zc(u.totalTokens),d+h)}}}else c&&(s={...s,executionSummary:{...c}})}i.rawOutput=s}if(i.sourceRecordIds=Npe(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!==om&&(i.parentBlockId=c)}t.subagentType&&!i.subagentType&&(i.subagentType=t.subagentType),qO(e,t.toolCallId,t.status);return}let o=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==om?e.toolBlockByCallId[t.parentToolCallId]:void 0,a={id:zm(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:ZS(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}:{},...s!==void 0?{rawOutput:s}:{},...t.toolName?{toolName:t.toolName}:{},...t.toolKind?{toolKind:t.toolKind}:{},...t.parentToolCallId?{parentToolCallId:t.parentToolCallId}:{},...t.subagentType?{subagentType:t.subagentType}:{},...o?{parentBlockId:o}:{}};xd(e,a),e.toolBlockByCallId[t.toolCallId]=a.id;for(let c of e.blocks)if(c.kind==="tool"&&c.parentToolCallId===t.toolCallId&&!c.parentBlockId){let u=oc(e,c.id);(u==null?void 0:u.kind)==="tool"&&(u.parentBlockId=a.id)}qO(e,t.toolCallId,t.status??"pending"),B0(e,t.parentToolCallId)}function ype(e,t){let n=e.toolBlockByCallId[t];!n||n===om||(rC(e),e.blocks=e.blocks.filter(s=>s.id!==n),e.blockIndexById=nC(e.blocks),delete e.toolBlockByCallId[t],delete e.toolProgress[t],e.currentToolCallId===t&&(e.currentToolCallId=void 0))}function vpe(e,t){if(t||!Ft(e)||e.type!=="task_execution")return e;let n={type:"task_execution"};for(let s of["subagentName","subagentColor","taskDescription","status","terminateReason","tokenCount","executionSummary"])e[s]!==void 0&&(n[s]=e[s]);return n}function qO(e,t,n){if(n!==void 0){if(u9.has(n)){e.currentToolCallId=t;return}if(lpe.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=xpe(e));return}}}function xpe(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"&&u9.has(n.status))return n.toolCallId}}function cA(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===om)continue;let n=oc(e,t);!n||n.kind!=="tool"||u9.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function wpe(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=oc(e,n.id);(i==null?void 0:i.kind)==="shell"&&(i.text=p9(e,i,t.text),i.updatedAt=e.now,t.eventId!==void 0&&(i.eventId=t.eventId));return}let s=zm(e,"shell"),r={id:s,kind:"shell",text:Sw(e,s,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}:{}};xd(e,r),B0(e)}function kpe(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 a=oc(e,n.id);(a==null?void 0:a.kind)==="user_shell"&&(a.text=p9(e,a,t.text),a.updatedAt=e.now,t.eventId!==void 0&&(a.eventId=t.eventId));return}let s=e.pendingUserShellCommand,r=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i=zm(e,"user-shell"),o={id:i,kind:"user_shell",text:Sw(e,i,void 0,t.text),command:(s==null?void 0:s.command)??(r==null?void 0:r.command)??"",...s!=null&&s.cwd||r!=null&&r.cwd?{cwd:(s==null?void 0:s.cwd)??(r==null?void 0:r.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,xd(e,o),B0(e)}function _pe(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===tC)return;let s=oc(e,n),r=ZS(t.toolCall,{title:t.title});if((s==null?void 0:s.kind)==="permission"){s.title=t.title,s.options=t.options.map(o=>({...o})),s.toolCall=t.toolCall,s.preview=r,s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId);return}let i={id:zm(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(o=>({...o})),preview:r,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}:{}};xd(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,B0(e)}function Spe(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===tC)return;let s=oc(e,n);if((s==null?void 0:s.kind)==="permission"){s.resolved=t.outcome,s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId);return}let r={id:zm(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}:{}};xd(e,r),e.permissionBlockByRequestId[t.requestId]=r.id,B0(e)}function Hv(e,t,n,s,r={}){let i=zm(e,t),o={id:i,kind:t,text:Sw(e,i,void 0,n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...(s==null?void 0:s.eventId)!==void 0?{eventId:s.eventId}:{},...(s==null?void 0:s.serverTimestamp)!==void 0?{serverTimestamp:s.serverTimestamp}:{},...(s==null?void 0:s.type)==="error"&&s.code?{code:s.code}:{},...(s==null?void 0:s.type)==="error"&&s.promptId?{promptId:s.promptId}:{},...(s==null?void 0:s.type)==="error"&&s.errorKind?{errorKind:s.errorKind}:{},...(s==null?void 0:s.type)==="error"&&s.source?{source:s.source}:{},...((s==null?void 0:s.type)==="status"||(s==null?void 0:s.type)==="debug")&&s.source?{source:s.source}:{},...((s==null?void 0:s.type)==="status"||(s==null?void 0:s.type)==="debug")&&s.data!==void 0?{data:s.data}:{},...(s==null?void 0:s.type)==="session.branched"?{source:"session_branched",data:{sourceSessionId:s.sourceSessionId,newSessionId:s.newSessionId,displayName:s.displayName}}:{}};xd(e,o),r.clearActiveText!==!1&&B0(e)}function Cpe(e,t){let n={id:zm(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}:{}};xd(e,n),B0(e)}function m9(e,t,n,s,r,i,o){let a=zm(e,t);return{id:a,kind:t,text:Sw(e,a,o,n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...s!==void 0?{eventId:s}:{},...r!==void 0?{serverTimestamp:r}:{},...o?{sourceRecordIds:[...o]}:{},...i?{meta:{...i}}:{}}}function bY(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:ao(e.toolBlockByCallId),activeAssistantBlockByParent:ao(e.activeAssistantBlockByParent),activeThoughtBlockByParent:ao(e.activeThoughtBlockByParent),trimmedToolNotificationByCallId:ao(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:ao(e.permissionBlockByRequestId),toolProgress:ao(Object.fromEntries(Object.entries(e.toolProgress).map(([r,i])=>[r,{...i}]))),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion},s=t.onTruncation??Cx.get(e);return s&&Cx.set(n,s),n}function yY(e){var s;if(e.blocks.length<=e.maxBlocks)return e;(s=Cx.get(e))==null||s({kind:"blocks"});let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(r=>r.id));e.blocks=t,e.blockIndexById=nC(t),e4.set(e,e.blocks);for(let[r,i]of Object.entries(e.toolBlockByCallId))n.has(i)||(e.toolBlockByCallId[r]=om);Mpe(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==om&&delete e.trimmedToolNotificationByCallId[r];for(let[r,i]of Object.entries(e.permissionBlockByRequestId))n.has(i)||(e.permissionBlockByRequestId[r]=tC);Ipe(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let i=oc(e,r.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[r,i]of Object.entries(e.activeAssistantBlockByParent))n.has(i)||delete e.activeAssistantBlockByParent[r];for(let[r,i]of Object.entries(e.activeThoughtBlockByParent))n.has(i)||delete e.activeThoughtBlockByParent[r];return e}function Tpe(e){return e.toolCallId===rA||e.toolKind==="updated_plan"}var e4=new WeakMap;function rC(e){e4.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById=ao(e.blockIndexById),e4.set(e,e.blocks))}function Epe(e,t){var r;let n=0,s=-1;for(let i=0;i<e.blocks.length;i+=1)if(((r=e.blocks[i])==null?void 0:r.kind)==="user"){if(s=i,n===t){UO(e,i);return}n+=1}s>=0&&t>=n&&UO(e,s)}function UO(e,t){rC(e),e.blocks=e.blocks.slice(0,t),e4.set(e,e.blocks),Ape(e)}function Ape(e){e.blockIndexById=nC(e.blocks),e.toolBlockByCallId=ao(),e.permissionBlockByRequestId=ao(),e.trimmedToolNotificationByCallId=ao(),e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent=ao(),e.activeThoughtBlockByParent=ao(),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 xd(e,t){rC(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function oc(e,t){if(!t)return;let n=e.blockIndexById[t];if(n===void 0)return;let s=e.blocks[n];if(!s||s.id!==t)return;let r=jpe(s);return rC(e),e.blocks[n]=r,r}function jpe(e){return e.kind==="permission"?{...e,options:e.options.map(t=>Hu(t)),toolCall:Hu(e.toolCall),preview:Hu(e.preview)}:e.kind==="tool"?{...e,preview:Hu(e.preview),content:Hu(e.content),locations:Hu(e.locations),rawInput:Hu(e.rawInput),rawOutput:Hu(e.rawOutput)}:{...e}}function zm(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function B0(e,t){t?(d9(e,t),h9(e,t)):(f9(e),e.activeUserBlockId=void 0)}function p9(e,t,n){let s="text"in t?t.text:"";return s.length>=lA?(n&&vY(e,t.id,t.sourceRecordIds),s):Sw(e,t.id,t.sourceRecordIds,s+n)}function Sw(e,t,n,s){if(s.length<=lA)return s;vY(e,t,n);let r=Math.max(0,lA-HO.length);return`${s.slice(0,r)}${HO}`}function vY(e,t,n){var s;(s=Cx.get(e))==null||s({kind:"text",blockId:t,sourceRecordIds:n})}function ao(e){return Object.assign(Object.create(null),e)}function xY(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n===t[s])}function Npe(e,t){if(!(!e&&!t))return[...new Set([...e??[],...t??[]])]}function Mpe(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,r])=>r===om).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.toolBlockByCallId[r],delete e.trimmedToolNotificationByCallId[r]}function Ipe(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,r])=>r===tC).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.permissionBlockByRequestId[r]}function Hu(e,t=0){return t>ope?e:Array.isArray(e)?e.map(n=>Hu(n,t+1)):Ft(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,Hu(s,t+1)])):e}function uA(e={}){let t=WO(e),n=new Set,s=!1,r=()=>{for(let o of n)try{o()}catch(a){Rpe(a)}},i=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,r()}))};return{getSnapshot(){return t},subscribe(o){return n.add(o),()=>{n.delete(o)}},dispatch(o){let a=Array.isArray(o)?o:[o];a.length!==0&&(t=dpe(t,a),i())},appendLocalUserMessage(o,a,c){t=upe(t,o,{images:a,meta:c}),i()},reset(o={}){t=WO({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 Rpe(e){var s;let t=globalThis.reportError;if(typeof t=="function"){t(e);return}let n=(s=globalThis.console)==null?void 0:s.error;typeof n=="function"&&n.call(globalThis.console,e)}function WO(e){let t=e.blocks?[...e.blocks]:[];return{...ape({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:nC(t),toolBlockByCallId:Cg(e.toolBlockByCallId),trimmedToolNotificationByCallId:Cg(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:Cg(e.permissionBlockByRequestId),toolProgress:Cg(e.toolProgress),activeAssistantBlockByParent:Cg(e.activeAssistantBlockByParent),activeThoughtBlockByParent:Cg(e.activeThoughtBlockByParent),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}function Cg(e){return Object.assign(Object.create(null),e)}var Dpe="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function VO(e,t){var n;if(!e)return{models:[]};const s=new Set,r=[];let i=(n=e.current)==null?void 0:n.modelId;const o=e.approvalMode;let a;for(const c of e.providers)for(const u of c.models){!i&&u.isCurrent&&(i=u.modelId),a===void 0&&(i?u.modelId===i:u.isCurrent)&&(a=u.contextLimit);const d=[c.authType,u.modelId,u.baseUrl??"",u.envKey??""].join("\0");s.has(d)||(s.add(d),r.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:r,currentModel:i,currentMode:o,contextWindow:a}}function Lpe(e){var t;const n=ea((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const s=Bi(n,"currentModelId")??Bi(n,"currentModel"),r=n.availableModels,i=[];let o;if(Array.isArray(r))for(const a of r){const c=ea(a),u=Bi(c,"modelId")??Bi(c,"id")??Bi(c,"value");if(!u)continue;const d=ea(c==null?void 0:c._meta),h=hv(d,"contextLimit")??hv(d,"contextWindow")??hv(c,"contextLimit")??hv(c,"contextWindow");o===void 0&&s!==void 0&&u===s&&(o=h),i.push({id:u,baseModelId:Bi(c,"baseModelId")??zpe(u),label:Bi(c,"name")??Bi(c,"label")??u,...h!==void 0?{contextWindow:h}:{}})}if(!(!s&&i.length===0))return{models:i,currentModel:s,contextWindow:o}}function wY(e){if(!e)return{commands:[],skills:[]};const t=e.availableCommands.map(s=>{var r;return{name:s.name,description:s.description||"",...(r=s.input)!=null&&r.hint?{argumentHint:s.input.hint}:{},...SY(s._meta),raw:s}}),n=e.availableSkills.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:kY(t,n),skills:e.availableSkills}}function GO(e){if(!e)return{commands:[],skills:[]};const t=e.skills.filter(s=>s.status==="ok");return{commands:t.map(s=>({name:s.name,description:s.description||"",...s.argumentHint?{argumentHint:s.argumentHint}:{},raw:{name:s.name,description:s.description||"",input:s.argumentHint?{hint:s.argumentHint}:null,_meta:{source:"skill"}}})),skills:t.map(s=>s.name)}}function kY(...e){const t=new Map;for(const n of e)for(const s of n){const r=t.get(s.name);r?t.set(s.name,{...r,...s,description:s.description||r.description,argumentHint:s.argumentHint??r.argumentHint,raw:s.raw}):t.set(s.name,s)}return[...t.values()]}function Ppe(e,t){var n;if(e.type==="session_update"){const s=ea((n=ea(e.data))==null?void 0:n.update),r=_Y(s);if(r&&t(i=>({...i,tokenUsage:r,tokenCount:g9(r)})),Bi(s,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=Bpe(s);t(a=>({...a,commands:i,skills:o}))}return}switch(e.type){case"git_branch_changed":{const s=ea(e.data),r=Bi(s,"workspaceCwd"),i=Bi(s,"branch");t(o=>r&&r!==o.workspaceCwd?o:{...o,gitBranch:i});break}case"session_metadata_updated":{const s=ea(e.data);Object.prototype.hasOwnProperty.call(s??{},"displayName")&&t(r=>({...r,displayName:Bi(s,"displayName")}));break}case"model_switched":{const s=Bi(ea(e.data),"modelId");s&&t(r=>({...r,currentModel:s}));break}case"approval_mode_changed":{const s=ea(e.data),r=Bi(s,"next")??Bi(s,"mode");r&&t(i=>({...i,currentMode:r}));break}}}function KO(e){const t=Bi(e,"displayName");return t!=null&&t.trim()?t:void 0}function Ope(e){var t;const n=ea((t=e==null?void 0:e.state)==null?void 0:t.modes);return Bi(n,"currentModeId")??Bi(n,"currentMode")}function g9(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((s,r)=>s+(typeof r=="number"?r:0),0);return n>0?n:void 0}function $pe(e){var t;for(let n=e.length-1;n>=0;n--)try{const s=e[n];if(s.type!=="session_update")continue;const r=ea((t=ea(s.data))==null?void 0:t.update),i=_Y(r);if(i)return i}catch{}}function _Y(e){const t=ea(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=ea(t==null?void 0:t.usage),s={...Oy(n,"inputTokens"),...Oy(n,"outputTokens"),...Oy(n,"totalTokens"),...Oy(n,"thoughtTokens"),...Oy(n,"cachedReadTokens")};return g9(s)!==void 0?s:void 0}function Oy(e,t){const n=hv(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function Bpe(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=ea(i),c=Bi(a,"name");if(!c)return[];const u=ea(a==null?void 0:a.input),d={name:c,description:Bi(a,"description")??"",input:u?{hint:Bi(u,"hint")??""}:null,_meta:ea(a==null?void 0:a._meta)??null};return[{name:c,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...SY(d._meta),raw:d}]}),s=Array.isArray(e.availableSkills)?e.availableSkills.filter(i=>typeof i=="string"):[],r=s.map(i=>({name:i,description:"",raw:{name:i,description:"",input:null,_meta:{source:"skill"}}}));return{commands:kY(n,r),skills:s}}function SY(e){const n=Bi(e??void 0,"source");return{...n?{source:n}:{}}}function ea(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Bi(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function hv(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function zpe(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 YO(e,t=[]){const n=[{type:"text",text:e}];for(const s of t){const r=s.mimeType??s.mediaType??s.media_type;r&&r!=="image/*"?n.push({type:"image",data:s.data,mimeType:r}):n.push({type:"image",data:s.data})}return n}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Fpe=3e4;function Hpe(e,t,n){const s=Number.isFinite(t)&&t>0?t:1e3,r=Number.isFinite(n)&&n>0?Math.max(s,n):s,i=s*2**Math.max(0,e-1),o=Math.min(i,r),a=.8+Math.random()*.4;return Math.min(r,Math.max(1,Math.round(o*a)))}async function dt(e,t,n=Fpe){let s;try{return await Promise.race([e,new Promise((r,i)=>{s=setTimeout(()=>{i(new Error(`${t} after ${n}ms`))},n)})])}finally{s!==void 0&&clearTimeout(s)}}function qpe(e,t){return e<=0||t.aborted?Promise.resolve():new Promise(n=>{const s=setTimeout(r,e);function r(){clearTimeout(s),t.removeEventListener("abort",r),n()}t.addEventListener("abort",r,{once:!0})})}function Vi(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function Upe(e,t,n="replay",s=80,r){Vi(t),t.current=setTimeout(()=>{t.current=void 0,e.getSnapshot().activeAssistantBlockId&&(e.dispatch({type:"assistant.done",reason:n}),r==null||r())},s)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Wpe="qwen-code-webui-client-id:session:";function x6(e,t){if(e)return e;if(typeof window>"u")return w6();try{if(t){const n=window.sessionStorage.getItem(CY(t));if(n)return n}return w6()}catch{return w6()}}function U2(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(CY(t),e)}catch{}}async function XO(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${Vpe(e.baseUrl)}/session/${encodeURIComponent(e.sessionId)}/detach`,s=await fetch(n,{method:"POST",headers:t,keepalive:!0});if(!(s.status===204||s.status===404))throw new Error(`Detach client failed (${s.status})`)}function w6(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function CY(e){return`${Wpe}${encodeURIComponent(e)}`}function Vpe(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 Gpe(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 Kpe({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:s,pendingSessionLoadRef:r,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:c,passiveAssistantDoneTimerRef:u,getCreateSessionRequest:d,createDetachedSession:h,getConnection:m,hasSessionActivePrompt:p,resetCurrentSessionActivePrompt:g,restartEventStream:b,addNotice:x,setConnection:y,setPromptStatus:v,setRestoreSessionId:w,setRestoreWorkspaceCwd:k,setRestoreMode:T,setRestoreSessionNonce:C,setAttachSessionNonce:_,setNewSessionNonce:S}){function D(){for(const[,I]of n.current)I.controller.abort();n.current.clear(),s.current.clear(),v("idle"),Vi(u),r.current&&(c.current===r.current.sessionId&&(c.current=void 0),clearTimeout(r.current.timeout),r.current.reject(new DOMException("Session cleared","AbortError")),r.current=void 0),e.reset(),w(void 0),k(void 0)}function E(I,L,O){const A=i.current+1;return i.current=A,r.current&&(clearTimeout(r.current.timeout),r.current.reject(new DOMException(`Session ${L} superseded by a newer request`,"AbortError"))),new Promise((q,U)=>{const H=setTimeout(()=>{var M;((M=r.current)==null?void 0:M.id)===A&&(r.current=void 0,U(Ar(x,`${Zpe(L)} session failed`,new Error(`Session ${L} timed out`),e0e(L))))},3e4);r.current={id:A,sessionId:I,mode:L,timeout:H,resolve:q,reject:U,...O?{signal:O}:{}}})}function B(I,L,O,A){var $;if(A!=null&&A.aborted)return Promise.reject(new DOMException("Session load cancelled","AbortError"));a.current=!1;const q=E(I,L,A),U=t.current,H=U==null?void 0:U.sessionId,M=H?n.current.get(H):void 0;($=M==null?void 0:M.reject)==null||$.call(M,new DOMException("Session switch interrupted prompt wait","AbortError")),H&&n.current.delete(H),g();const ee=L==="load"&&H===I;if(U){const V=()=>U.detach().catch(R=>{console.warn("[DaemonSessionActions] detach before session switch failed:",R)});ee?(c.current=I,q.then(V,()=>{})):V()}return ee||(t.current=void 0),ee||y(V=>({...V,status:"connecting",sessionId:I,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),v("idle"),s.current.clear(),Vi(u),ee||e.reset(),T(L),w(I),k(O??m().workspaceCwd),C(V=>V+1),q.catch(V=>{throw fv(V)||y(R=>({...R,loadingTranscript:void 0,catchingUp:void 0})),V})}return{async sendPrompt(I,L){var O,A,$,q,U;const H=Pr(x,t.current,"Prompt failed","send_prompt"),M=H.sessionId;if(n.current.has(M))throw Ar(x,"Prompt failed","A prompt is already in progress","send_prompt");Vi(u),v("waiting");const ee=new AbortController;n.current.set(M,{controller:ee});try{const V=((L==null?void 0:L.images)??[]).map(K=>({data:K.data,mimeType:K.mimeType||K.mediaType||K.media_type||"image/*"})),R=L!=null&&L.inputAnnotations&&L.inputAnnotations.length>0?L.inputAnnotations:void 0;(L==null?void 0:L.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(I,V,R?{inputAnnotations:R}:void 0);const re={prompt:YO(I,V)};R&&(re._meta={inputAnnotations:R}),L!=null&&L.retry&&(re.retry=!0);const Z=await H.submitPrompt(re,ee.signal);return((O=n.current.get(M))==null?void 0:O.controller)===ee&&b(M),(A=L==null?void 0:L.onAdmitted)==null||A.call(L),await Ype(n.current,s.current,M,ee,Z.promptId)}catch(V){if(fv(V))return(($=t.current)==null?void 0:$.sessionId)===M&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw lY(V)?V:(((q=t.current)==null?void 0:q.sessionId)===M&&e.dispatch({type:"assistant.done",reason:"error"}),Ar(x,"Prompt failed",V,"send_prompt"))}finally{const V=n.current.get(M);(V==null?void 0:V.controller)===ee&&n.current.delete(M),((U=t.current)==null?void 0:U.sessionId)===M&&!p()&&v("idle")}},async submitPrompt(I,L){var O;const A=Pr(x,t.current,"Prompt failed","send_prompt");if(L!=null&&L.sessionId&&A.sessionId!==L.sessionId)throw new Error("Session changed before prompt submission");const $=((L==null?void 0:L.images)??[]).map(M=>({data:M.data,mimeType:M.mimeType||M.mediaType||M.media_type||"image/*"})),q=L!=null&&L.inputAnnotations&&L.inputAnnotations.length>0?L.inputAnnotations:void 0;(L==null?void 0:L.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(I,$,q?{inputAnnotations:q}:void 0);const U={prompt:YO(I,$)};q&&(U._meta={inputAnnotations:q}),L!=null&&L.retry&&(U.retry=!0);const H=await A.submitPrompt(U);if((O=L==null?void 0:L.signal)!=null&&O.aborted)throw await A.removePendingPrompt(H.promptId).catch(M=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",M),x({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:M instanceof Error?M.message:String(M),recoverable:!0})}),L.signal.reason??new DOMException("Aborted","AbortError");return{promptId:H.promptId}},async cancel(){var I,L;const O=Pr(x,t.current,"Cancel failed","cancel_prompt"),A=n.current.get(O.sessionId);A==null||A.controller.abort(),Vi(u);const $=A?new AbortController:void 0;$&&n.current.set(O.sessionId,{controller:$});try{await dt(O.cancel(),"Cancel timed out")}catch(q){throw Ar(x,"Cancel failed",q,"cancel_prompt")}finally{$&&((I=n.current.get(O.sessionId))==null?void 0:I.controller)===$&&n.current.delete(O.sessionId),((L=t.current)==null?void 0:L.sessionId)===O.sessionId&&!p()&&v("idle")}},async setModel(I){const L=Pr(x,t.current,"Set model failed","switch_model");try{const O=await dt(L.setModel(I),"Set model timed out");return y(A=>({...A,currentModel:I})),O}catch(O){throw Ar(x,"Set model failed",O,"switch_model")}},async setApprovalMode(I,L){const O=Pr(x,t.current,"Set approval mode failed","set_approval_mode");try{const A=await dt(O.client.setSessionApprovalMode(O.sessionId,I,{persist:L==null?void 0:L.persist,clientId:O.clientId}),"Set approval mode timed out");return y($=>({...$,currentMode:A.mode||I})),A}catch(A){throw Ar(x,"Set approval mode failed",A,"set_approval_mode")}},async respondToPermission(I,L){const O=Pr(x,t.current,"Permission response failed","submit_permission");try{return await dt(O.respondToSessionPermission(I,L),"Permission response timed out")}catch(A){throw Ar(x,"Permission response failed",A,"submit_permission")}},async submitPermission(I,L,O){const A=Pr(x,t.current,"Permission response failed","submit_permission"),$=L!==void 0&&L.length>0?{outcome:{outcome:"selected",optionId:L},...O?{answers:O}:{}}:{outcome:{outcome:"cancelled"},...O?{answers:O}:{}};try{return await dt(A.respondToSessionPermission(I,$),"Permission response timed out")}catch(q){throw Ar(x,"Permission response failed",q,"submit_permission")}},async heartbeat(){const I=t.current;if(!(!I||!o.current))return dt(I.heartbeat(),"Heartbeat timed out")},async listSessions(I){const L=t.current;if(!L)return[];try{return await dt(L.client.listWorkspaceSessions(L.workspaceCwd,I),"List sessions timed out")}catch(O){throw Ar(x,"List sessions failed",O,"list_sessions")}},async loadSession(I,L){return B(I,"load",L==null?void 0:L.workspaceCwd)},async reloadSession(I){const L=Pr(x,t.current,"Reload session failed","load_session");return B(L.sessionId,"load",L.workspaceCwd,I)},async resumeSession(I,L){return B(I,"resume",L==null?void 0:L.workspaceCwd)},async createSession(I){try{a.current=!1;const L={...(I==null?void 0:I.approvalMode)!==void 0?{approvalMode:I.approvalMode}:{},...(I==null?void 0:I.sourceType)!==void 0?{sourceType:I.sourceType}:{},...(I==null?void 0:I.worktree)!==void 0?{worktree:I.worktree}:{},...(I==null?void 0:I.branch)!==void 0?{branch:I.branch}:{}},O=t.current,A=O&&m().sessionId===O.sessionId?O:void 0;if(A){const q=await dt(A.client.createOrAttachSession({...d(),...(I==null?void 0:I.workspaceCwd)!==void 0?{workspaceCwd:I.workspaceCwd}:{},...L}),"Create session timed out");return U2(q.clientId,q.sessionId),q}const $=await dt(h(I==null?void 0:I.workspaceCwd,L),"Create session timed out");if(a.current){try{await dt($.detach(),"Detach cleared session timed out")}catch(q){console.warn("[DaemonSessionActions] detach after interrupted create failed:",q)}throw new DOMException("Session creation interrupted","AbortError")}return U2($.clientId,$.sessionId),t.current=$,c.current=$.sessionId,y(q=>({...q,status:"connected",sessionId:$.sessionId,...$.clientId?{clientId:$.clientId}:{},workspaceCwd:$.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),$}catch(L){throw Ar(x,`Create session failed${I!=null&&I.workspaceCwd?` (workspace: ${I.workspaceCwd})`:""}`,L,"create_session")}},async attachSession(){const I=Pr(x,t.current,"Attach session failed","attach_session"),L=E(I.sessionId,"attach");return _(O=>O+1),L},async clearSession(){const I=t.current;if(a.current=!0,D(),t.current=void 0,y(L=>Gpe(L,I==null?void 0:I.sessionId)),I)try{await dt(I.detach(),"Clear session timed out")}catch(L){console.warn("[DaemonSessionActions] detach on clear failed:",L)}},async newSession(){a.current=!1,D(),y(I=>({...I,missingSession:!1,error:void 0,errorStatus:void 0})),S(I=>I+1)},async releaseSession(I){try{const L=Pr(x,t.current,"Release session failed","release_session");await dt(L.client.closeSession(I),"Release session timed out")}catch(L){throw Ar(x,"Release session failed",L,"release_session")}},async closeSession(){const I=Pr(x,t.current,"Close session failed","close_session");try{await dt(I.close(),"Close session timed out")}catch(L){throw Ar(x,"Close session failed",L,"close_session")}},async refreshCommands(){const I=Pr(x,t.current,"Refresh commands failed","refresh_commands");try{const L=await dt(I.supportedCommands(),"Refresh commands timed out"),{commands:O,skills:A}=wY(L);y($=>({...$,commands:O,skills:A,supportedCommands:L}))}catch(L){throw Ar(x,"Refresh commands failed",L,"refresh_commands")}},async getContext(){const I=Pr(x,t.current,"Load context failed","load_context");try{const L=await dt(I.context(),"Load context timed out");return y(O=>({...O,context:L,currentMode:Xpe(L)??O.currentMode,currentModel:Qpe(L)??O.currentModel})),L}catch(L){throw Ar(x,"Load context failed",L,"load_context")}},async getContextUsage(I){const L=Pr(x,t.current,"Load context usage failed","load_context_usage");try{return await dt(L.contextUsage(I),"Load context usage timed out")}catch(O){throw Ar(x,"Load context usage failed",O,"load_context_usage")}},async renameSession(I){const L=Pr(x,t.current,"Rename session failed","rename_session");try{return await dt(L.updateMetadata({displayName:I}),"Rename session timed out")}catch(O){throw Ar(x,"Rename session failed",O,"rename_session")}},async recapSession(){const I=Pr(x,t.current,"Recap session failed","recap_session");try{return await dt(I.recap(),"Recap session timed out")}catch(L){throw Ar(x,"Recap session failed",L,"recap_session")}},async*generateSessionContent(I,L){yield*Pr(x,t.current,"Generate content failed","generate_session_content").generateContent(I,L)},async getRewindSnapshots(){const I=Pr(x,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await dt(I.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(L){throw Ar(x,"Load rewind snapshots failed",L,"rewind_snapshots")}},async rewindSession(I,L){const O=Pr(x,t.current,"Rewind session failed","rewind_session");try{return await dt(O.rewind(I,L),"Rewind session timed out")}catch(A){throw Ar(x,"Rewind session failed",A,"rewind_session")}},async btwSession(I,L){var O;const A=Pr(x,t.current,"Side question failed","btw_session");try{return await dt(A.btw(I,L),"Side question timed out")}catch($){throw(O=L==null?void 0:L.signal)!=null&&O.aborted||fv($)?$:Ar(x,"Side question failed",$,"btw_session")}},async enqueueMidTurnMessage(I,L){const O=t.current;if(!O)return{accepted:!1};try{return await O.enqueueMidTurnMessage(I,L)}catch(A){return A instanceof DOMException&&A.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",A),{accepted:!1}}},async getPendingPrompts(I){const L=t.current;if(!L)return{pendingPrompts:[]};if(I!=null&&I.sessionId&&L.sessionId!==I.sessionId)throw new Error("Session changed before pending prompts refresh");return await L.getPendingPrompts()},async removePendingPrompt(I,L){const O=t.current;return O?L!=null&&L.sessionId&&O.sessionId!==L.sessionId?await O.client.removePendingPrompt(L.sessionId,I):await O.removePendingPrompt(I):{removed:!1}},async sendShellCommand(I){var L,O;const A=Pr(x,t.current,"Shell command failed","send_shell_command"),$=`${A.sessionId}:shell`;v("waiting");const q=new AbortController;n.current.set($,{controller:q});try{return await A.shellCommand(I,q.signal)}catch(U){throw Ar(x,"Shell command failed",U,"send_shell_command")}finally{((L=n.current.get($))==null?void 0:L.controller)===q&&n.current.delete($),((O=t.current)==null?void 0:O.sessionId)===A.sessionId&&!p()&&v("idle")}},async getTasks(){const I=Pr(x,t.current,"Get tasks failed","load_tasks");try{return await dt(I.tasks(),"Get tasks timed out")}catch(L){throw Ar(x,"Get tasks failed",L,"load_tasks")}},async cancelTask(I,L){const O=Pr(x,t.current,"Cancel task failed","cancel_task");try{return await dt(O.cancelTask(I,L),"Cancel task timed out")}catch(A){throw Ar(x,"Cancel task failed",A,"cancel_task")}},async clearGoal(){const I=Pr(x,t.current,"Clear goal failed","clear_goal");try{return await dt(I.clearGoal(),"Clear goal timed out")}catch(L){throw Ar(x,"Clear goal failed",L,"clear_goal")}},async getStats(){const I=Pr(x,t.current,"Load stats failed","load_stats");try{return await dt(I.stats(),"Load stats timed out")}catch(L){throw Ar(x,"Load stats failed",L,"load_stats")}},async loadArtifacts(){const I=t.current;if(!I)throw new Error("Daemon session is not connected");return dt(I.artifacts(),"Load artifacts timed out")},async respondToGlobalPermission(I,L){const O=Pr(x,t.current,"Global permission response failed","submit_permission");try{return await dt(O.client.respondToPermission(I,L),"Global permission response timed out")}catch(A){throw Ar(x,"Global permission response failed",A,"submit_permission")}},async branchSession(I){const L=Pr(x,t.current,"Branch session failed","branch_session");try{const O=await dt(L.client.branchSession(L.sessionId,{name:I},L.clientId),"Branch session timed out");return U2(O.clientId,O.sessionId),B(O.sessionId,"load").catch(A=>{fv(A)||Ar(x,"Branch session failed",A,"branch_session")}),{sessionId:O.sessionId,displayName:O.displayName}}catch(O){throw Ar(x,"Branch session failed",O,"branch_session")}},async forkSession(I){const L=Pr(x,t.current,"Fork session failed","fork_session");try{return await dt(L.fork(I),"Fork session timed out")}catch(O){throw Ar(x,"Fork session failed",O,"fork_session")}}}}function Ype(e,t,n,s,r){return new Promise((i,o)=>{const a=dA(n,r),c=t.get(a);if(c){t.delete(a),c.status==="resolved"?i(c.result):o(c.error);return}const u=e.get(n);if((u==null?void 0:u.controller)!==s){o(new DOMException("Aborted","AbortError"));return}if(u.promptId!==void 0&&u.promptId!==r){o(new Error(`Prompt accepted with unexpected id ${r}`));return}if(s.signal.aborted){e.delete(n),o(s.signal.reason??new DOMException("Aborted","AbortError"));return}const d=()=>{s.signal.removeEventListener("abort",h)},h=()=>{const m=e.get(n);(m==null?void 0:m.controller)===s&&e.delete(n),d(),o(s.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...u,promptId:r,resolve:m=>{d(),i(m)},reject:m=>{d(),o(m)}}),s.signal.addEventListener("abort",h,{once:!0})})}function dA(e,t){return JSON.stringify([e,t])}function Xpe(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 Qpe(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 Pr(e,t,n,s){if(!t)throw Ar(e,n,"Daemon session is not connected",s);return t}function Ar(e,t,n,s){if(fv(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 r=n instanceof Error?n.message:String(n);return e({severity:"error",category:"user_action",operation:s,code:`daemon.${s}.failed`,message:`${t}: ${r}`,debugMessage:r,recoverable:!0}),Jpe(n instanceof Error?n:new Error(r))}function fv(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Jpe(e){return Object.assign(e,{_alreadyDispatched:!0})}function Zpe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function e0e(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const t0e=33e4;function n0e({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:s}){return{async listSessions(r){const i=Ut(e,"List sessions failed"),o=t();return o?dt(i.listWorkspaceSessionsPage(o,r).then(a=>a.sessions),"List sessions timed out"):[]},async listSessionsPage(r){const i=Ut(e,"List sessions failed"),o=t();return o?dt(i.listWorkspaceSessionsPage(o,r),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const r=Ut(e,"List session groups failed"),i=t();return i?dt(r.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(r){const i=Ut(e,"Create session group failed"),o=k6(t);return dt(i.createSessionGroup(o,r),"Create session group timed out")},async updateSessionGroup(r,i){const o=Ut(e,"Update session group failed"),a=k6(t);return dt(o.updateSessionGroup(a,r,i),"Update session group timed out")},async deleteSessionGroup(r){const i=Ut(e,"Delete session group failed"),o=k6(t);return dt(i.deleteSessionGroup(o,r),"Delete session group timed out")},async updateSessionOrganization(r,i){const o=Ut(e,"Update session organization failed");return dt(o.updateSessionOrganization(r,i),"Update session organization timed out")},async deleteSession(r){const i=Ut(e,"Delete session failed"),o=await dt(i.deleteSessionsData([r]),"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(r){const i=Ut(e,"Delete sessions failed");return dt(i.deleteSessionsData(r),"Delete sessions timed out")},async exportSession(r,i="html"){const o=Ut(e,"Export session failed");return dt(o.exportSession(r,{format:i}),"Export session timed out")},async archiveSession(r){const i=Ut(e,"Archive session failed"),o=await dt(i.archiveSessionsData([r]),"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(r){const i=Ut(e,"Unarchive session failed"),o=await dt(i.unarchiveSessionsData([r]),"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 loadMcpStatus(){const r=Ut(e,"Load MCP status failed");return dt(r.workspaceMcp(),"Load MCP status timed out")},async initializeMcp(){const r=Ut(e,"Initialize MCP failed");return dt(r.initializeWorkspaceMcp(),"Initialize MCP timed out")},async reloadMcp(){const r=Ut(e,"Reload MCP failed");return dt(r.reloadWorkspaceMcp(),"Reload MCP timed out")},async loadMcpTools(r){const i=Ut(e,"Load MCP tools failed");try{return await dt(i.workspaceMcpTools(r),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:r,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async loadMcpResources(r){const i=Ut(e,"Load MCP resources failed");try{return await dt(i.workspaceMcpResources(r),"Load MCP resources timed out")}catch{return{v:1,workspaceCwd:"",serverName:r,initialized:!1,acpChannelLive:!1,resources:[],errors:[{kind:"mcp_resources",status:"error",error:"The connected daemon does not expose MCP resource details."}]}}},async restartMcpServer(r){const i=Ut(e,"Restart MCP server failed");return dt(i.restartMcpServer(r),"Restart MCP server timed out",5*6e4)},async manageMcpServer(r,i){const o=Ut(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return dt(o.manageMcpServer(r,i),"Manage MCP server timed out",a)},async addRuntimeMcpServer(r){const i=Ut(e,"Add MCP server failed");return dt(i.addRuntimeMcpServer(r),"Add MCP server timed out",5*6e4)},async removeRuntimeMcpServer(r){const i=Ut(e,"Remove MCP server failed");return dt(i.removeRuntimeMcpServer(r),"Remove MCP server timed out",5*6e4)},async loadDaemonStatus(r){const i=Ut(e,"Load daemon status failed");return dt(i.daemonStatus(r),"Load daemon status timed out")},async loadUsageDashboard(r){const i=Ut(e,"Load usage dashboard failed");return dt(i.usageDashboard(r),"Load usage dashboard timed out")},async loadSkillsStatus(){const r=Ut(e,"Load skills failed");return dt(r.workspaceSkills(),"Load skills timed out")},async setWorkspaceSkillEnabled(r,i){const o=Ut(e,"Set skill enabled failed");return dt(o.setWorkspaceSkillEnabled(r,i),"Set skill enabled timed out")},async installWorkspaceSkill(r){const i=Ut(e,"Install skill failed");return dt(i.installWorkspaceSkill(r),"Install skill timed out")},async deleteWorkspaceSkill(r,i){const o=Ut(e,"Delete skill failed");return dt(o.deleteWorkspaceSkill(r,i),"Delete skill timed out")},async loadExtensionsStatus(){const r=Ut(e,"Load extensions failed");return dt(r.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const r=Ut(e,"Load tools failed");return dt(r.workspaceTools(),"Load tools timed out")},async preheatAcp(r){const i=Ut(e,"Preheat ACP failed");return dt(i.workspaceAcpPreheat(r),"Preheat ACP timed out",r===void 0?void 0:r+2e3)},async setWorkspaceToolEnabled(r,i){const o=Ut(e,"Set tool enabled failed");return dt(o.setWorkspaceToolEnabled(r,i),"Set tool enabled timed out")},async loadSettingsStatus(){const r=Ut(e,"Load settings failed");return dt(r.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(r,i,o,a){const c=Ut(e,"Set setting failed");return dt(c.setWorkspaceSetting(r,i,o,a),"Set setting timed out")},async loadMemoryStatus(){const r=Ut(e,"Load memory failed");return dt(r.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(r){const i=Ut(e,"Read workspace file failed");return dt(i.readWorkspaceFile(r),"Read workspace file timed out")},async writeMemory(r){const i=Ut(e,"Write memory failed");return dt(i.writeWorkspaceMemory(r),"Write memory timed out")},async*generateContent(r,i){yield*Ut(e,"Generate content failed").generateWorkspaceContent(r,{signal:i==null?void 0:i.signal})},async listAgents(){const r=Ut(e,"List agents failed");return dt(r.listWorkspaceAgents(),"List agents timed out")},async getAgent(r,i){const o=Ut(e,"Get agent failed");return dt(o.getWorkspaceAgent(r,i?{scope:i}:{}),"Get agent timed out")},async createAgent(r){const i=Ut(e,"Create agent failed");return dt(i.createWorkspaceAgent(r),"Create agent timed out")},async generateAgent(r){const i=Ut(e,"Generate agent failed");return dt(i.generateWorkspaceAgent(r),"Generate agent timed out",t0e)},async deleteAgent(r,i){const o=Ut(e,"Delete agent failed");return dt(o.deleteWorkspaceAgent(r,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(r,i){Ut(e,"Glob workspace failed");const o=Eu(n,"/glob");o.searchParams.set("pattern",r),(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 a=await dt(fetch(Au(o,n),{headers:Tg(s)}),"Glob workspace timed out");if(!a.ok)throw new Error(await ju(a,"GET /glob"));const c=await a.json();return{matches:Array.isArray(c.matches)?c.matches.filter(u=>typeof u=="string"):[]}},async loadProviders(){const r=Ut(e,"Load providers failed");return dt(r.workspaceProviders(),"Load providers timed out")},async readFileBytes(r,i){const o=Ut(e,"Read file bytes failed");return dt(o.readWorkspaceFileBytes(r,i??{}),"Read file bytes timed out")},async writeFile(r){const i=Ut(e,"Write file failed");return dt(i.writeWorkspaceFile(r),"Write file timed out")},async editFile(r){const i=Ut(e,"Edit file failed");return dt(i.editWorkspaceFile(r),"Edit file timed out")},async stat(r){Ut(e,"Stat file failed");const i=Eu(n,"/stat");i.searchParams.set("path",r);const o=await dt(fetch(Au(i,n),{headers:Tg(s)}),"Stat file timed out");if(!o.ok)throw new Error(await ju(o,"GET /stat"));return await o.json()},async listDirectory(r){Ut(e,"List directory failed");const i=Eu(n,"/list");i.searchParams.set("path",r);const o=await dt(fetch(Au(i,n),{headers:Tg(s)}),"List directory timed out");if(!o.ok)throw new Error(await ju(o,"GET /list"));return await o.json()},async listScheduledTasks(r){Ut(e,"List scheduled tasks failed");const i=$y(r),o=Eu(n,i),a=await dt(fetch(Au(o,n),{headers:Tg(s)}),"List scheduled tasks timed out");if(!a.ok)throw new Error(await ju(a,`GET ${i}`));const c=await a.json();return Array.isArray(c.tasks)?c.tasks:[]},async createScheduledTask(r,i){Ut(e,"Create scheduled task failed");const o=$y(i),a=Eu(n,o),c=await dt(fetch(Au(a,n),{method:"POST",headers:o_(s),body:JSON.stringify(r)}),"Create scheduled task timed out");if(!c.ok)throw new Error(await ju(c,`POST ${o}`));return await c.json()},async updateScheduledTask(r,i,o){Ut(e,"Update scheduled task failed");const a=$y(o,`/${encodeURIComponent(r)}`),c=Eu(n,a),u=await dt(fetch(Au(c,n),{method:"PATCH",headers:o_(s),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!u.ok)throw new Error(await ju(u,`PATCH ${a}`));return await u.json()},async runScheduledTask(r,i){Ut(e,"Run scheduled task failed");const o=$y(i,`/${encodeURIComponent(r)}/run`),a=Eu(n,o),c=await dt(fetch(Au(a,n),{method:"POST",headers:o_(s)}),"Run scheduled task timed out");if(!c.ok)throw new Error(await ju(c,`POST ${o}`));return await c.json()},async deleteScheduledTask(r,i){Ut(e,"Delete scheduled task failed");const o=$y(i,`/${encodeURIComponent(r)}`),a=Eu(n,o),c=await dt(fetch(Au(a,n),{method:"DELETE",headers:Tg(s)}),"Delete scheduled task timed out");if(!c.ok)throw new Error(await ju(c,`DELETE ${o}`))},async listGoals(){Ut(e,"List goals failed");const r=Eu(n,"/goals"),i=await dt(fetch(Au(r,n),{headers:Tg(s)}),"List goals timed out");if(!i.ok)throw new Error(await ju(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(r){Ut(e,"Clear goal failed");const i=Eu(n,`/session/${encodeURIComponent(r)}/goal/clear`),o=await dt(fetch(Au(i,n),{method:"POST",headers:o_(s),body:"{}"}),"Clear goal timed out");if(!o.ok)throw new Error(await ju(o,`POST /session/${r}/goal/clear`));return await o.json()},async loadEnv(){const r=Ut(e,"Load env failed");return dt(r.workspaceEnv(),"Load env timed out")},async loadPreflight(){const r=Ut(e,"Load preflight failed");return dt(r.workspacePreflight(),"Load preflight timed out")},async initWorkspace(r){const i=Ut(e,"Init workspace failed");return dt(i.initWorkspace(r),"Init workspace timed out")},async updateAgent(r,i,o){const a=Ut(e,"Update agent failed");return dt(a.updateWorkspaceAgent(r,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(r,i){const o=Ut(e,"Install extension failed");return dt(o.installExtension(r,i),"Install extension timed out")},async extensionOperationStatus(r){const i=Ut(e,"Load extension operation failed");return dt(i.extensionOperationStatus(r),"Load extension operation timed out")},async activeExtensionOperations(){const r=Ut(e,"Load active extension operations failed");return dt(r.activeExtensionOperations(),"Load active extension operations timed out")},async respondToExtensionInteraction(r,i,o,a){const c=Ut(e,"Respond to extension interaction failed");return dt(c.respondToExtensionInteraction(r,i,o,a),"Respond to extension interaction timed out")},async checkExtensionUpdates(r){const i=Ut(e,"Check extension updates failed");return dt(i.checkExtensionUpdates(r),"Check extension updates timed out")},async refreshExtensions(r){const i=Ut(e,"Refresh extensions failed");return dt(i.refreshExtensions(r),"Refresh extensions timed out")},async enableExtension(r,i,o){const a=Ut(e,"Enable extension failed");return dt(a.enableExtension(r,i,o),"Enable extension timed out")},async disableExtension(r,i,o){const a=Ut(e,"Disable extension failed");return dt(a.disableExtension(r,i,o),"Disable extension timed out")},async updateExtension(r,i){const o=Ut(e,"Update extension failed");return dt(o.updateExtension(r,i),"Update extension timed out")},async uninstallExtension(r,i){const o=Ut(e,"Uninstall extension failed");return dt(o.uninstallExtension(r,i),"Uninstall extension timed out")},async startDeviceFlow(r){const i=Ut(e,"Start device flow failed");return dt(i.startDeviceFlow({providerId:r}),"Start device flow timed out")},async getDeviceFlow(r,i){const o=Ut(e,"Get device flow failed");return dt(o.getDeviceFlow(r,i),"Get device flow timed out")},async cancelDeviceFlow(r){const i=Ut(e,"Cancel device flow failed");return dt(i.cancelDeviceFlow(r),"Cancel device flow timed out")},async getAuthStatus(){const r=Ut(e,"Get auth status failed");return dt(r.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const r=Ut(e,"Get auth providers failed");return dt(r.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(r){const i=Ut(e,"Install auth provider failed");return dt(i.installAuthProvider(r),"Install auth provider timed out")},async deleteModel(r){const i=Ut(e,"Delete model failed");return dt(i.deleteModel(r),"Delete model timed out")},async addWorkspace(r,i){const o=Ut(e,"Add workspace failed");return dt(o.addWorkspace(r,i),"Add workspace timed out")},async addScratchWorkspace(){const r=Ut(e,"Add scratch workspace failed");return dt(r.addScratchWorkspace(),"Add scratch workspace timed out")},async suggestWorkspacePaths(r){const i=Ut(e,"Suggest workspace paths failed");return await dt(i.workspacePathSuggestions(r),"Suggest workspace paths timed out")},async updateWorkspace(r,i){const o=Ut(e,"Update workspace failed");return dt(o.updateWorkspace(r,i),"Update workspace timed out")},async removeWorkspace(r,i){const a=Ut(e,"Remove workspace failed").workspaceById(r).remove(i);return(i==null?void 0:i.timeoutMs)===0?a:dt(a,"Remove workspace timed out",i==null?void 0:i.timeoutMs)}}}function Ut(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function k6(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function $y(e,t=""){return e?`/workspaces/${encodeURIComponent(e)}/scheduled-tasks${t}`:`/scheduled-tasks${t}`}function Tg(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function o_(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Eu(e,t){const n=TY(e),s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,s)}function Au(e,t){return TY(t)?e.toString():`${e.pathname}${e.search}`}function TY(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 ju(e,t){try{const n=await e.json(),s=typeof n.error=="string"?n.error:typeof n.message=="string"?n.message:void 0;return s?`${t}: ${s}`:`${t}: HTTP ${e.status}`}catch{return`${t}: HTTP ${e.status}`}}const b9=f.createContext(void 0);let By;function s0e({baseUrl:e,token:t,workspaceCwd:n,autoConnect:s=!0,transport:r,children:i}){const o=f.useMemo(()=>s?new sA({baseUrl:e,token:t,transport:r}):void 0,[s,e,t,r]),a=f.useRef(o);a.current=o;const c=f.useRef(void 0),u=f.useRef(void 0),d=f.useRef(0),h=f.useRef(n),[m,p]=f.useState(void 0),[g,b]=f.useState(s?"connecting":"idle"),[x,y]=f.useState(void 0),v=f.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 C=o.capabilities().catch(_=>{throw u.current===C&&(u.current=void 0),_});u.current=C}return u.current},[o]),w=f.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));c.current!==o&&(c.current=o,d.current++);const C=++d.current,_=()=>{const D=u.current;return c.current===o&&D&&d.current!==C?D:Promise.reject(new Error("Capabilities refresh was superseded by a client change"))},S=o.capabilities().then(D=>c.current!==o||d.current!==C?_():(p(D),b("connected"),y(void 0),D),D=>{if(c.current!==o||d.current!==C)return _();throw y(D instanceof Error?D:new Error(String(D))),b("error"),D});return u.current=S,S},[o]);f.useEffect(()=>{if(!o)return;b("connecting"),y(void 0),p(void 0),By===o&&(By=void 0);let C=!1;const _=v();return _.then(S=>{!C&&c.current===o&&u.current===_&&(p(S),b("connected"))}).catch(S=>{!C&&c.current===o&&u.current===_&&(y(S instanceof Error?S:new Error(String(S))),b("error"))}),()=>{C=!0,By=o,queueMicrotask(()=>{By===o&&(By=void 0,o.dispose())})}},[o,v]),h.current=(m==null?void 0:m.workspaceCwd)??n;const k=f.useMemo(()=>n0e({getClient:()=>a.current,getWorkspaceCwd:()=>h.current,baseUrl:e,token:t}),[e,t]),T=f.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(m==null?void 0:m.workspaceCwd)??n,status:g,error:x,capabilities:m,getCapabilities:v,refreshCapabilities:w,actions:k}},[o,t,e,n,g,x,m,v,w,k]);return l.jsx(b9.Provider,{value:T,children:i})}function la(){const e=f.useContext(b9);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function Vo(){return la().actions}function EY(){return f.useContext(b9)}function r0e(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&QO(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&QO(t)||(t==null?void 0:t.kind)==="tool"&&JO(t))return"responding";for(let n=e.length-1;n>=0;n--){const s=e[n];if(s.kind==="user")break;if(s.kind==="tool"&&JO(s))return"responding"}return"idle"}function i0e(e,t){const n=r0e(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function QO(e){return e.streaming===!0}function JO(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const hA=new Set;let t4;function ZO(){return t4}function o0e(e){return hA.add(e),()=>{hA.delete(e)}}function a0e(e){t4={...e},AY()}function a_(){t4!==void 0&&(t4=void 0,AY())}function AY(){for(const e of hA)e()}function l0e(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 s=n,r=s.sessionId,i=s.suggestion,o=s.promptId;if(!(typeof r!="string"||typeof i!="string"||i.length===0||typeof o!="string"))return{sessionId:r,suggestion:i,promptId:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const fA=new Set,jY=Object.freeze([]),_6=64;let Hf=jY;function e$(){return Hf}function c0e(e){return fA.add(e),()=>{fA.delete(e)}}function u0e(e){const t=[...Hf,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>_6){const n=t.length-_6;console.debug(`[mid-turn] sidechannel buffer over ${_6}; evicting ${n} oldest batch(es)`),Hf=t.slice(n)}else Hf=t;NY()}function d0e(e){if(e.length===0||Hf.length===0)return;const t=new Set(e),n=Hf.filter(s=>!t.has(s));n.length!==Hf.length&&(Hf=n.length===0?jY:n,NY())}function NY(){for(const e of fA)e()}function h0e(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==cY)return;const n=t.data;if(!n||typeof n!="object")return;const s=n,r=s.sessionId,i=s.messages;if(typeof r!="string"||!Array.isArray(i))return;const o=i.filter(c=>typeof c=="string"&&c.length>0);if(o.length===0)return;const a=t.originatorClientId;return{sessionId:r,messages:o,...typeof a=="string"?{originatorClientId:a}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const mA=new Set,pA=new Set;let MY=0,A1=[];function f0e(){return MY}function t$(){return A1}function m0e(e){return mA.add(e),()=>{mA.delete(e)}}function p0e(e){return pA.add(e),()=>{pA.delete(e)}}function g0e(){MY++;for(const e of mA)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function IY(){for(const e of pA)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function b0e(e){if(e.length===0)return;const t=new Set(e),n=A1.filter(s=>!t.has(s));n.length!==A1.length&&(A1=n,IY())}function y0e(e){const t=RY(e);return t?(A1=[...A1,t].slice(-200),IY(),(t.type===a9||t.type===l9||t.type===c9)&&g0e(),!0):!1}function v0e(e){return RY(e)!==void 0}function RY(e){if(!e||typeof e!="object")return;const t=e,n=t.type,s=t.data;if(!s||typeof s!="object")return;const r=s;if(typeof r.sessionId=="string"&&((n===a9||n===l9||n===c9)&&typeof r.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof r.promptId=="string"))return e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const DY=[404,410],x0e=new Set(DY);function qv(e){return e!==void 0&&x0e.has(e)}function Nu(e,t){return qv(t)&&!qv(e)?t:e}const n$="session_transcript_pagination",w0e="workspace_acp_preheat",k0e="workspace_acp_status";function Ef(e,t){const n=hY(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}function _0e(e){if(e.type==="session_update")try{if(!lo(e.data))return;const t=e.data.update,n=lo(t)?t._meta:e.data._meta;return lo(n)?ou(n,"qwen.session.recordId"):void 0}catch{return}}function LY(e){return e.type==="history_truncated"&&lo(e.data)&&e.data.fullTranscriptAvailable===!0}function S0e(e,t,n){const s=e.getSnapshot(),r=uA({maxBlocks:Number.MAX_SAFE_INTEGER,nextOrdinal:s.nextOrdinal,retainSubagentBlocks:s.retainSubagentBlocks});r.dispatch(t);const i=r.getSnapshot();return i.blocks.length+s.blocks.length>n?!1:(e.reset({...s,blocks:[...i.blocks,...s.blocks],nextOrdinal:i.nextOrdinal,toolBlockByCallId:{...i.toolBlockByCallId,...s.toolBlockByCallId},permissionBlockByRequestId:{...i.permissionBlockByRequestId,...s.permissionBlockByRequestId}}),!0)}function yp(e,t){if(!(typeof e!="string"||e.length===0))return e.length<=t?e:`${e.slice(0,t)}…`}function C0e(e){var t;const n=lo(e.rawInput)?e.rawInput:void 0,s=lo(e.rawOutput)?e.rawOutput:void 0,r=(t=e.toolName)==null?void 0:t.toLowerCase();if(!(r==="agent"||r==="task"||typeof(n==null?void 0:n.subagent_type)=="string"||(s==null?void 0:s.type)==="task_execution"))return e;const o=lo(s==null?void 0:s.executionSummary)?s.executionSummary:void 0,a=yp(n==null?void 0:n.subagent_type,120),c=yp(n==null?void 0:n.prompt,240),u=yp(n==null?void 0:n.description,240),d=yp(s==null?void 0:s.subagentName,120),h=yp(s==null?void 0:s.taskDescription,240),m=yp(s==null?void 0:s.status,80),p=yp(s==null?void 0:s.terminateReason,240),g=n?{...a?{subagent_type:a}:{},...c?{prompt:c}:{},...u?{description:u}:{},...n.run_in_background===!0?{run_in_background:!0}:{}}:void 0,b=s?{...s.type==="task_execution"?{type:"task_execution"}:{},...d?{subagentName:d}:{},...h?{taskDescription:h}:{},...m?{status:m}:{},...p?{terminateReason:p}:{},...typeof s.tokenCount=="number"?{tokenCount:s.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,...g&&Object.keys(g).length>0?{rawInput:g}:{rawInput:void 0},...b&&Object.keys(b).length>0?{rawOutput:b}:{rawOutput:void 0},content:void 0,details:void 0}}function S6(e){const t=[];for(const n of e)"parentToolCallId"in n&&n.parentToolCallId&&n.type!=="assistant.usage"||t.push(n.type==="tool.update"?C0e(n):n);return t}const PY=f.createContext(void 0),OY=f.createContext(void 0),y9=f.createContext(void 0),$Y=f.createContext(void 0),BY=f.createContext(void 0),zY=f.createContext(void 0),FY=f.createContext(void 0),v9=new Set([401,403]),T0e=new Set([...v9,...DY]),E0e=2e5,A0e={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,artifactsVersion:0,initVersion:0,authVersion:0},j0e=Symbol("unhandled session");function x9(e){const{baseUrl:t,token:n,workspaceCwd:s,sessionId:r,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:c=E0e,historyPageSize:u,subagentTranscriptMode:d="full",suppressOwnUserEcho:h=!0,includeRawEvent:m=!1,autoConnect:p=!0,autoReconnect:g=!0,restartEventStreamOnPrompt:b=!1,reconnectDelayMs:x=1e3,maxReconnectDelayMs:y=1e4,heartbeatIntervalMs:v=3e4,heartbeatFailureThreshold:w=3,loadWarnings:k,children:T}=e,C=EY(),_=t??(C==null?void 0:C.baseUrl),S=n??(C==null?void 0:C.token),D=s??(C==null?void 0:C.workspaceCwd),E=f.useRef(C==null?void 0:C.client);E.current=C==null?void 0:C.client;const B=f.useRef(C==null?void 0:C.capabilities);B.current=C==null?void 0:C.capabilities;const I=f.useRef(C==null?void 0:C.getCapabilities);I.current=C==null?void 0:C.getCapabilities;const L=f.useRef(!1),A=f.useRef(r).current,$=A===void 0,q=f.useRef(D);q.current=D;const U=f.useRef(D);D&&(U.current=D);const H=f.useMemo(()=>uA({maxBlocks:c,retainSubagentBlocks:d==="full"}),[c,d]),M=f.useRef(void 0),ee=f.useRef({hasMore:!1,loading:!1,capacityReached:!1}),[V,R]=f.useState({hasMore:!1,loading:!1,capacityReached:!1}),re=f.useRef(void 0),Z=f.useRef(void 0),K=f.useRef(new Map),Y=f.useRef(new Map),ae=f.useRef(void 0),le=f.useRef(0),te=f.useRef(void 0),z=f.useRef(!1),X=f.useRef({consecutiveFailures:0}),fe=f.useRef(!1),xe=f.useRef(void 0),ie=f.useRef(new WeakSet),Ce=f.useRef({suppressOwnUserEcho:h,includeRawEvent:m}),Ke=f.useRef({reconnectDelayMs:x,maxReconnectDelayMs:y}),ut=f.useRef(k),Et=f.useRef(u),st=f.useRef(d),xt=f.useRef(void 0);(!xt.current||i)&&(xt.current=x6(i)),Ce.current={suppressOwnUserEcho:h,includeRawEvent:m},Ke.current={reconnectDelayMs:x,maxReconnectDelayMs:y},ut.current=k,Et.current=u,st.current=d;const He=o==null?void 0:o.modelServiceId,pn=o==null?void 0:o.sessionScope,Yt=f.useRef(o);Yt.current=o;const[It,me]=f.useState("idle"),[$e,yt]=f.useState(A),[Me,Le]=f.useState(void 0),[vn,ge]=f.useState("load"),[Rt,ht]=f.useState(0),[gn,Ue]=f.useState(0),[De,Re]=f.useState(0),[be,Ie]=f.useState({status:p?"connecting":"idle",...A?{sessionId:A}:{}}),ne=f.useRef(be);ne.current=be,f.useEffect(()=>{C!=null&&C.capabilities&&Ie(gt=>gt.capabilities===C.capabilities?gt:{...gt,capabilities:C.capabilities})},[C==null?void 0:C.capabilities]);const Ee=f.useRef(0),[qe,Je]=f.useState([]),Qe=f.useCallback(gt=>{const Ae={...gt,id:gt.id??`daemon-notice-${Date.now()}-${++Ee.current}`,createdAt:gt.createdAt??Date.now()};return Je(kn=>kn.some(Dn=>Dn.id===Ae.id)?kn:[...kn.slice(-49),Ae]),Ae},[]),cn=f.useCallback(gt=>{Je(Ae=>Ae.filter(kn=>kn.id!==gt))},[]),Kn=f.useCallback(()=>{Je([])},[]),_e=f.useMemo(()=>({notices:qe,dismissNotice:cn,clearNotices:Kn}),[Kn,cn,qe]),[ft,$t]=f.useState(A0e),pe=f.useRef(()=>!1),Be=f.useRef(!1);f.useEffect(()=>(Be.current=!0,()=>{Be.current=!1}),[]),f.useEffect(()=>{var gt;if(!p)return;if(!E.current&&!_){Ie({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Ae=new AbortController;let kn=!1;const Dn=vn==="load"&&$e!==void 0&&$e===((gt=M.current)==null?void 0:gt.sessionId)&&$e===xe.current;let qn=[],ir;const Qn=()=>{if(ir=void 0,qn.length===0)return;const os=qn;qn=[];try{H.dispatch(os)}catch(ts){console.error("[DaemonSessionProvider] batched transcript dispatch failed",{eventCount:os.length,error:ts})}},jr=()=>{ir!==void 0&&(clearTimeout(ir),ir=void 0)},es=os=>{if(os.length!==0){for(const ts of os)qn.push(ts);ir===void 0&&(ir=setTimeout(Qn,0))}},Gn=()=>{jr(),Qn()},Dt=os=>{Gn(),H.dispatch(os)},ps=()=>{jr(),qn=[]};return(async()=>{var os,ts,Wn,ds,Sn,ui,Ur,lr,Cs,js,Ii,Jr,ve,ze,lt;const _t=E.current??new sA({baseUrl:_,token:S});let Xt,rs,fs=$e,gs=!$e&&De>0,Ps=0,mr=!1,Ri=()=>!1,si=!1;for(;!kn&&!Ae.signal.aborted;){const cr=mr;mr=!1;let Jn=!1,Ln,Vn;const Hi=()=>{Vn==null||Vn(),Vn=void 0,re.current===Ln&&(re.current=void 0)};try{let ns=!1,Rr=!1,pr=!1,Cr=!1,Fe,xn;if(!Xt){const vt=M.current;vt&&!$e&&!fs&&!gs&&(Xt=vt,fs=vt.sessionId,Z.current=vt.sessionId,Cr=!0)}if(!Xt){Dn||Ie(xr=>({...xr,status:"connecting",error:void 0,errorStatus:Nu(void 0,xr.errorStatus)}));const vt=I.current,Ye=B.current??(vt?await vt():await _t.capabilities());if(kn||Ae.signal.aborted)return;rs=Ye;const Ht=Array.isArray(Ye.features)&&Ye.features.includes(n$);z.current=Array.isArray(Ye.features)&&Ye.features.includes("client_heartbeat");const zt=Me??q.current??Ye.workspaceCwd;U.current=zt;const qt=Array.isArray(Ye.features)?Ye.features:[],Fn=zt===Ye.workspaceCwd&&qt.includes(w0e),Bn=Fn&&qt.includes(k0e);if(($||fe.current)&&!$e&&!fs&&!gs){const[xr,Ta,hc,Ji]=await Promise.allSettled([_t.workspaceProviders(),_t.workspaceSkills(),Bn?_t.workspaceAcpStatus():Promise.resolve(void 0),zt?_t.workspaceByCwd(zt).workspaceGit():_t.workspaceGit()]);xr.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",xr.reason),Ta.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",Ta.reason),Bn&&hc.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",hc.reason);const Uc=xr.status==="fulfilled"?xr.value:void 0,Id=VO(Uc),{commands:tp,skills:Z0}=GO(Ta.status==="fulfilled"?Ta.value:void 0),Rd=Ta.status==="rejected"||fe.current&&tp.length===0;Ie(Qa=>({...Qa,status:"connected",workspaceCwd:zt,gitBranch:Ji.status==="fulfilled"?Ji.value.branch??void 0:void 0,models:Id.models,currentModel:Id.currentModel,currentMode:Id.currentMode,contextWindow:Id.contextWindow,providers:Uc,capabilities:Ye,commands:Rd?Qa.commands:tp,skills:Rd?Qa.skills:Z0})),Fn&&!(hc.status==="fulfilled"&&((os=hc.value)==null?void 0:os.channelLive)===!0)&&!L.current&&(L.current=!0,(async()=>{try{const Qa=await _t.workspaceAcpPreheat(5e3);if(kn||Ae.signal.aborted||!Qa.ready||ne.current.sessionId)return;const Ja=await _t.workspaceSkills();if(kn||Ae.signal.aborted||ne.current.sessionId)return;const{commands:eg,skills:Jh}=GO(Ja);Ie(Dd=>Dd.sessionId?Dd:{...Dd,commands:eg,skills:Jh})}catch(Qa){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",Qa)}finally{L.current=!1}})());return}const Ms=$e&&vn==="resume"?Py.resume:Py.load,Lr=$e??fs,Io=i?xt.current:x6(void 0,Lr);Jn=!!$e,Lr&&!Dn&&Ie(xr=>({...xr,sessionId:Lr,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const _i=((ts=ae.current)==null?void 0:ts.sessionId)===Lr?ae.current:void 0,ls=$e?await Ms(_t,$e,{workspaceCwd:zt,...Ht&&vn==="load"&&Et.current!==void 0?{historyPageSize:Et.current}:{}},Io):fs?await Py.load(_t,fs,{workspaceCwd:zt,...Ht&&Et.current!==void 0?{historyPageSize:Et.current}:{}},Io):await Py.createOrAttach(_t,{...He!==void 0?{modelServiceId:He}:{},...gs?{sessionScope:"thread"}:pn!==void 0?{sessionScope:pn}:{},workspaceCwd:zt},Io);if(Jn=!1,!i&&ls.clientId&&(xt.current=ls.clientId,U2(ls.clientId,ls.sessionId)),kn||Ae.signal.aborted){XO({baseUrl:_,token:S,sessionId:ls.sessionId,clientId:ls.clientId}).catch(xr=>console.warn("[DaemonSessionProvider] detach failed:",xr));return}if(Dn&&(_i==null?void 0:_i.sessionId)===ls.sessionId&&((Wn=_i.signal)!=null&&Wn.aborted||ae.current!==_i)){const xr=M.current;if(ls!==xr&&await ls.detach().catch(Ta=>{console.warn("[DaemonSessionProvider] detach cancelled reload failed:",Ta)}),ae.current===_i&&(ae.current=void 0,clearTimeout(_i.timeout),_i.reject(new DOMException("Session load cancelled","AbortError"))),xe.current===ls.sessionId&&(xe.current=void 0),Jn=!1,(xr==null?void 0:xr.sessionId)===ls.sessionId){Xt=xr,fs=xr.sessionId,Ps=0,mr=!0;continue}return}const Ss=Z.current;Ss!==ls.sessionId&&Kn(),Ss!==void 0&&ls.sessionId!==Ss?(me("idle"),Vi(te),pr=!0):Ss!==void 0&&(ls.replaySnapshot.compactedReplay.length+ls.replaySnapshot.liveJournal.length>0?(me("idle"),Vi(te),pr=!0):(H.dispatch({type:"assistant.done",reason:"reconnected"}),H.getSnapshot().awaitingResync&&H.clearAwaitingResync())),ns=Ss!==void 0&&Ss===ls.sessionId,Rr=ls.replaySnapshot.compactedReplay.length>0||ls.replaySnapshot.liveJournal.length>0;const Xs=[...ls.replaySnapshot.compactedReplay,...ls.replaySnapshot.liveJournal];Fe=$pe(Xs),xn=g9(Fe),Xt=ls,fs=Xt.sessionId,gs=!1,Z.current=Xt.sessionId,M.current=Xt}const kt=Xt,ms=ie.current.has(kt);let In=kt.hasActivePrompt===!0&&!ms;const we=()=>{ie.current.add(kt),In=!1},We=()=>In||K.current.has(kt.sessionId);Ri=We,pe.current=We,me(We()?"streaming":"idle");const St=ae.current,fn=(St==null?void 0:St.sessionId)===kt.sessionId?St:void 0,{compactedReplay:Ct,liveJournal:$n}=kt.replaySnapshot,as=[...Ct,...$n],Rs=as.map(_0e).find(vt=>vt!==void 0),ki=as.some(LY),zs=Array.isArray(rs==null?void 0:rs.features)&&rs.features.includes(n$)&&(kt.historyHasMore||ki)&&Rs!==void 0;ee.current={sessionId:kt.sessionId,...Rs!==void 0?{beforeRecordId:Rs}:{},hasMore:zs,loading:!1,capacityReached:!1},R({hasMore:zs,loading:!1,capacityReached:!1});const Yn=Rr&&as.length>0;if(pr&&!Yn&&H.reset(),Yn){const vt={...Ce.current,suppressOwnUserEcho:!1},Ye=[];for(const zt of as)try{const qt=C6(zt,kt.clientId,vt,Ie,{updateConnection:!1}),Fn=T6(zt,qt,Qe,cn,{hideHistoryTruncation:zs});if(Ye.push(...st.current==="summary"?S6(Fn):Fn),zt.type==="turn_complete"){const Bn=((ds=zt.data)==null?void 0:ds.stopReason)??"end_turn";Ye.push(Ef(zt,Bn))}else zt.type==="turn_error"&&Ye.push(Ef(zt,"error"))}catch(qt){const Fn=qt instanceof Error?qt.message:String(qt);Qe({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Fn,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",qt)}let Ht=!1;if(pr||H.getSnapshot().blocks.length===0){const zt=uA({maxBlocks:Number.MAX_SAFE_INTEGER,retainSubagentBlocks:st.current==="full"});zt.dispatch(Ye);const qt=zt.getSnapshot();Ht=qt.blocks.length>c,H.reset({...qt,maxBlocks:Math.max(c,qt.blocks.length)})}else Ye.length>0&&H.dispatch(Ye);Ye.length>0&&i$(Ye,$t),Ht&&zs&&(ee.current.hasMore=!1,ee.current.capacityReached=!0,R({hasMore:!1,loading:!1,capacityReached:!0}));for(const zt of as)s$(K.current,Y.current,kt.sessionId,zt,H,me,te,{requireBoundPromptId:!0});Ie(zt=>({...zt,catchingUp:void 0}))}Ie(vt=>({...vt,status:"connected",sessionId:kt.sessionId,...kt.clientId?{clientId:kt.clientId}:{},workspaceCwd:kt.workspaceCwd,displayName:KO(kt.state)??(vt.sessionId===kt.sessionId?vt.displayName:void 0),tokenUsage:Fe!==void 0?Fe:vt.sessionId===kt.sessionId?vt.tokenUsage:void 0,tokenCount:xn!==void 0?xn:vt.sessionId===kt.sessionId?vt.tokenCount??0:0,loadingTranscript:void 0,catchingUp:Yn?vt.catchingUp:ns||kt.lastEventId!=null||void 0})),fn&&(ae.current=void 0,clearTimeout(fn.timeout),xe.current===kt.sessionId&&(xe.current=void 0),fn.resolve());const or=cr||Cr&&ne.current.commands!==void 0&&ne.current.skills!==void 0&&ne.current.supportedCommands!==void 0&&ne.current.context!==void 0,ur=cr?Promise.resolve({branch:ne.current.gitBranch}):kt.workspaceCwd?_t.workspaceByCwd(kt.workspaceCwd).workspaceGit():_t.workspaceGit(),[Dr,ri,ua,Ya]=await Promise.allSettled([or?Promise.resolve(void 0):_t.workspaceProviders(),or?Promise.resolve(void 0):kt.supportedCommands(),or?Promise.resolve(void 0):kt.context(),ur]),go=(Dr==null?void 0:Dr.status)==="fulfilled"?Dr.value:void 0,Xa=(ri==null?void 0:ri.status)==="fulfilled"?ri.value:void 0,di=(ua==null?void 0:ua.status)==="fulfilled"?ua.value:void 0,se=(Ya==null?void 0:Ya.status)==="fulfilled"?Ya.value.branch??void 0:void 0,de=[(Dr==null?void 0:Dr.status)==="rejected"?(Sn=ut.current)==null?void 0:Sn.models:void 0,(ri==null?void 0:ri.status)==="rejected"?(ui=ut.current)==null?void 0:ui.commands:void 0,(ua==null?void 0:ua.status)==="rejected"?(Ur=ut.current)==null?void 0:Ur.context:void 0].filter(vt=>!!vt),Ve=VO(go),et=Lpe(di),Cn=et&&et.models.length>0?et.models:Ve.models,Lt=(et==null?void 0:et.currentModel)??Ve.currentModel,Rn=Lt===Ve.currentModel?Ve.contextWindow:(lr=Ve.models.find(vt=>vt.id===Lt))==null?void 0:lr.contextWindow,Pn=(et==null?void 0:et.contextWindow)??((Cs=Cn.find(vt=>vt.id===Lt))==null?void 0:Cs.contextWindow)??Rn,{commands:bs,skills:Fs}=wY(Xa),Ts=Ope(di)??Ve.currentMode;Ie(vt=>vt.sessionId!==kt.sessionId?vt:{...vt,status:"connected",sessionId:kt.sessionId,...kt.clientId?{clientId:kt.clientId}:{},workspaceCwd:kt.workspaceCwd,commands:Xa!==void 0?bs:vt.commands,skills:Xa!==void 0?Fs:vt.skills,models:Cn.length>0?Cn:vt.models,currentModel:Lt??vt.currentModel,currentMode:Ts??vt.currentMode,displayName:KO(kt.state)??vt.displayName,contextWindow:Pn??vt.contextWindow,providers:go??vt.providers,supportedCommands:Xa??vt.supportedCommands,context:di??vt.context,gitBranch:Ya.status==="fulfilled"?se:vt.gitBranch,capabilities:rs??vt.capabilities,loadingTranscript:void 0,catchingUp:Yn?vt.catchingUp:ns||kt.lastEventId!=null||void 0}),de.length>0&&H.dispatch(de.map(vt=>({type:"status",text:vt})));let gr=!1,Ns=!1;const qi=()=>{const vt=K.current.get(kt.sessionId);vt==null||vt.controller.abort(),K.current.delete(kt.sessionId),In&&we(),Vi(te),me("idle"),ps(),H.reset(),kt.setLastEventId(0),fs=kt.sessionId,Ns=!0,Xt=void 0,M.current=void 0,pe.current=()=>!1,Ie(Ye=>({...Ye,status:"connecting",error:void 0,errorStatus:Nu(void 0,Ye.errorStatus)}))},ys=new AbortController;Ln={sessionId:kt.sessionId,controller:ys,restartRequested:!1},re.current=Ln;const Go=()=>ys.abort(Ae.signal.reason);Ae.signal.addEventListener("abort",Go,{once:!0}),Vn=()=>Ae.signal.removeEventListener("abort",Go);for await(const vt of kt.events({signal:ys.signal,maxQueued:a})){if(((js=M.current)==null?void 0:js.sessionId)!==kt.sessionId)break;gr||(gr=!0,Ps=0);try{const Ye=l0e(vt);if(Ye){a0e(Ye);continue}const Ht=h0e(vt);Ht&&u0e(Ht),v0e(vt)&&(y0e(vt),vt.type==="pending_prompt_started"&&(Vi(te),me("waiting")));const zt=C6(vt,kt.clientId,Ce.current,Ie),qt=T6(vt,zt,Qe,cn),Fn=st.current==="summary"?S6(qt):qt;if(vt.type==="state_resync_required"&&(typeof vt.data=="object"&&vt.data!==null?vt.data.reason:void 0)==="epoch_reset"){qi();break}if(i$(qt,$t),qt.length>0){const ls=E6(qt);me(Ss=>Ss==="waiting"||Ss==="idle"&&ls?"streaming":Ss)}(vt.type==="turn_complete"||vt.type==="turn_error")&&Gn();const Bn=s$(K.current,Y.current,kt.sessionId,vt,H,me,te);let Ms=!1;if(!Bn&&In&&(vt.type==="turn_complete"||vt.type==="turn_error")){we(),Ms=!0,Vi(te);const ls=vt.type==="turn_complete"?((Ii=vt.data)==null?void 0:Ii.stopReason)??"end_turn":"error";Dt(Ef(vt,ls)),We()||me("idle")}!We()&&qt.some(ls=>ls.type==="debug")&&Gn();const Io=!We()&&H.getSnapshot().activeAssistantBlockId!=null?Fn.filter(ls=>ls.type!=="debug"):Fn;es(Io);for(const ls of qt)if(ls.type==="prompt.cancelled"&&(In||ls.originatorClientId!==kt.clientId)){Dt(Ef(vt,"cancelled"));const Ss=In;we(),Ms=!0,Vi(te),Ss||K.current.delete(kt.sessionId),We()||me("idle")}else ls.type==="session.replay_complete"&&(Gn(),Ie(Ss=>({...Ss,catchingUp:void 0})),H.getSnapshot().awaitingResync&&H.clearAwaitingResync(),We()||(Vi(te),Dt({type:"assistant.done",reason:"replay_complete"}),me("idle")));const _i=!Bn&&!Ms&&!We();if(_i&&(qt.some(Ss=>Ss.type==="user.text.delta")?me("waiting"):E6(qt)&&me(Ss=>Ss==="idle"?"streaming":Ss)),_i&&vt.type==="turn_complete"){Vi(te);const ls=((Jr=vt.data)==null?void 0:Jr.stopReason)??"end_turn";Dt(Ef(vt,ls)),me("idle")}else _i&&vt.type==="turn_error"?(Vi(te),Dt(Ef(vt,"error")),me("idle")):_i&&E6(qt)&&Upe(H,te,"passive_observer",3e3,()=>me("idle"));if(vt.type==="state_resync_required"&&(typeof vt.data=="object"&&vt.data!==null?vt.data.reason:void 0)!=="epoch_reset"){We()||(me("idle"),Vi(te)),ps(),H.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",kt.sessionId),Ns=!0,Xt=void 0,M.current=void 0,pe.current=()=>!1,Ie(Ss=>({...Ss,status:"connecting",error:void 0,errorStatus:Nu(void 0,Ss.errorStatus)}));break}if(vt.type==="session_closed"&&((ve=vt.data)==null?void 0:ve.reason)==="client_close"){si=!0;const ls=kt.sessionId,Ss=K.current.get(ls);Ss==null||Ss.controller.abort(),K.current.delete(ls),Xt=void 0,M.current=void 0;break}}catch(Ye){const Ht=Ye instanceof Error?Ye.message:String(Ye);Qe({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:Ht,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",Ye)}}Gn();const Tr=Ln.restartRequested;if(Hi(),Tr){Ps=0,mr=!0;continue}if(si){Dt({type:"assistant.done",reason:"cancelled"}),me("idle"),Vi(te),Ie(vt=>({...vt,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(fe.current){Xt=void 0,M.current=void 0,pe.current=()=>!1;return}!kn&&!Ae.signal.aborted&&!Ns&&(((ze=M.current)==null?void 0:ze.sessionId)===kt.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),We()||(Vi(te),me("idle"),Dt({type:"assistant.done",reason:"stream_ended"}))),Ie(vt=>({...vt,status:vt.status==="error"?"error":"disconnected",error:vt.status==="error"?vt.error:void 0,errorStatus:Nu(void 0,vt.errorStatus)})))}catch(ns){const Rr=(Ln==null?void 0:Ln.restartRequested)===!0;if(Hi(),Rr&&!kn&&!Ae.signal.aborted){Gn(),Ps=0,mr=!0;continue}if(kn||Ae.signal.aborted)return;Gn();const pr=ns instanceof Error?ns.message:String(ns),Cr=n4(ns),Fe=Xt==null?void 0:Xt.sessionId,xn=F0e(ns),kt=z0e(ns);if(Fe&&(xn||kt)){const In=K.current.get(Fe);In==null||In.controller.abort(),K.current.delete(Fe)}(xn||kt||!Ri())&&(Vi(te),me("idle"));const ms=ae.current;if(ms&&(ms.sessionId===$e||ms.sessionId===fs)&&(xe.current===ms.sessionId&&(xe.current=void 0),ae.current=void 0,clearTimeout(ms.timeout),ms.reject(ns)),xn||kt){if(Xt=void 0,M.current=void 0,xn){Ie(we=>({...we,status:"error",sessionId:void 0,error:pr,errorStatus:Nu(Cr,we.errorStatus),missingSession:!1,capabilities:rs??we.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const In=Jn&&qv(Cr);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",Fe,Cr,pr),Ie(we=>({...we,status:"disconnected",sessionId:void 0,error:pr,errorStatus:Nu(Cr,we.errorStatus),missingSession:In||we.missingSession===!0,capabilities:rs??we.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else if(Dn&&Xt===void 0&&(ms==null?void 0:ms.sessionId)===$e&&((lt=M.current)==null?void 0:lt.sessionId)===$e){Xt=M.current,fs=Xt.sessionId,Ps=0,mr=!0;continue}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",Xt==null?void 0:Xt.sessionId);if(!g){Xt=void 0,M.current=void 0,Ie(In=>({...In,status:"error",error:pr,errorStatus:Nu(Cr,In.errorStatus),missingSession:!1}));return}Ie(In=>({...In,status:"disconnected",error:pr,errorStatus:Nu(Cr,In.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!g){M.current=void 0,Ie(ns=>({...ns,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}Ps+=1;const Di=Ke.current,Mo=Hpe(Ps,Di.reconnectDelayMs,Di.maxReconnectDelayMs);Ie(ns=>({...ns,status:"disconnected",error:`Reconnecting in ${Mo}ms`})),await qpe(Mo,Ae.signal)}})(),()=>{const os=M.current;kn=!0,Ae.abort(),Gn(),pe.current=()=>!1,me("idle"),Vi(te);const ts=(os==null?void 0:os.sessionId)===xe.current,Wn=!Be.current;ae.current&&(!ts||Wn)&&(clearTimeout(ae.current.timeout),ae.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),ae.current=void 0),(!ts||Wn)&&(os!=null&&os.clientId)&&XO({baseUrl:_,token:S,sessionId:os.sessionId,clientId:os.clientId}).catch(ds=>console.warn("[DaemonSessionProvider] detach failed:",ds)),(!ts||Wn)&&(M.current=void 0)}},[p,g,_,S,s,He,pn,a,c,H,$e,Me,vn,Rt,gn,De,i,$,Kn,Qe,cn]),f.useEffect(()=>{if(!z.current||be.status!=="connected"||v<=0||w<=0||!be.sessionId)return;X.current.sessionId!==be.sessionId&&(X.current={sessionId:be.sessionId,consecutiveFailures:0});const gt=X.current;let Ae=!1;const kn=setInterval(()=>{const Dn=M.current;Dn&&Dn.heartbeat().then(()=>{Ae||(gt.consecutiveFailures>=w&&Ie(qn=>qn.sessionId===Dn.sessionId?{...qn,status:"connected",error:void 0,errorStatus:void 0}:qn),gt.consecutiveFailures=0,gt.lastHttpError=void 0)}).catch(qn=>{var ir,Qn,jr,es,Gn;if(Ae)return;gt.consecutiveFailures+=1;const Dt=qn instanceof Error?qn.message:"Session heartbeat failed",ps=n4(qn);if(ps!==void 0){const ds=(ir=gt.lastHttpError)==null?void 0:ir.status;gt.lastHttpError={status:Nu(ps,ds)??ps,message:qv(ds)?((Qn=gt.lastHttpError)==null?void 0:Qn.message)??Dt:Dt}}if(gt.consecutiveFailures<w)return;const is=(jr=gt.lastHttpError)==null?void 0:jr.status,os=((es=gt.lastHttpError)==null?void 0:es.message)??Dt,ts=is!==void 0&&v9.has(is),Wn=qv(is);if(ts||Wn){const ds=Dn.sessionId;console.warn(Wn?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",ds,is);const Sn=K.current.get(ds);Sn==null||Sn.controller.abort(),K.current.delete(ds),Vi(te),me("idle"),((Gn=M.current)==null?void 0:Gn.sessionId)===ds&&(Wn&&(fe.current=!0),M.current=void 0)}Ie(ds=>ds.sessionId===Dn.sessionId?{...ds,status:ts?"error":"disconnected",error:os,errorStatus:Nu(is,ds.errorStatus),missingSession:Wn,...ts||Wn?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:ds)})},v);return()=>{Ae=!0,clearInterval(kn)}},[be.sessionId,be.status,w,v]);const ue=f.useMemo(()=>Kpe({store:H,sessionRef:M,activePromptsRef:K,settledPromptsRef:Y,pendingSessionLoadRef:ae,pendingSessionLoadIdRef:le,heartbeatSupportedRef:z,manualSessionClearRef:fe,skipNextCleanupDetachSessionIdRef:xe,passiveAssistantDoneTimerRef:te,hasSessionActivePrompt:()=>pe.current(),resetCurrentSessionActivePrompt:()=>{pe.current=()=>!1},restartEventStream:gt=>{if(!b)return;const Ae=re.current;(Ae==null?void 0:Ae.sessionId)===gt&&(Ae.restartRequested=!0,Ae.controller.abort())},getCreateSessionRequest:()=>{var gt;return{...Yt.current,sessionScope:"thread",workspaceCwd:U.current??((gt=M.current)==null?void 0:gt.workspaceCwd)}},createDetachedSession:(gt,Ae)=>{var kn;const Dn=E.current??new sA({baseUrl:_,token:S}),qn={...Yt.current,sessionScope:"thread",workspaceCwd:gt??U.current??((kn=M.current)==null?void 0:kn.workspaceCwd),...(Ae==null?void 0:Ae.approvalMode)!==void 0?{approvalMode:Ae.approvalMode}:{},...(Ae==null?void 0:Ae.sourceType)!==void 0?{sourceType:Ae.sourceType}:{},...(Ae==null?void 0:Ae.worktree)!==void 0?{worktree:Ae.worktree}:{},...(Ae==null?void 0:Ae.branch)!==void 0?{branch:Ae.branch}:{}},ir=i?xt.current:x6(void 0);return Py.createOrAttach(Dn,qn,ir)},getConnection:()=>ne.current,addNotice:Qe,setConnection:Ie,setPromptStatus:me,setRestoreSessionId:yt,setRestoreWorkspaceCwd:Le,setRestoreMode:ge,setRestoreSessionNonce:ht,setAttachSessionNonce:Ue,setNewSessionNonce:Re}),[Qe,i,_,S,b,H]),Wt=f.useCallback(async()=>{const gt=ee.current,Ae=M.current;if(!gt.hasMore||gt.loading||!Ae||Ae.sessionId!==gt.sessionId)return;gt.loading=!0,R({hasMore:!0,loading:!0,capacityReached:!1});let kn=!1;try{const Dn=await Ae.client.getSessionTranscriptPage(Ae.sessionId,{...gt.cursor!==void 0?{cursor:gt.cursor}:gt.beforeRecordId!==void 0?{beforeRecordId:gt.beforeRecordId}:{},limit:Et.current??100,clientId:Ae.clientId});if(M.current!==Ae||ee.current!==gt)return;if(Dn.partial||Dn.replayError)throw kn=!0,new Error(Dn.replayError??"Earlier session history was only partially read");const qn={...Ce.current,suppressOwnUserEcho:!1},ir=[];for(const jr of Dn.events)try{const es=T6(jr,C6(jr,Ae.clientId,qn,Ie,{updateConnection:!1}),Qe,cn);ir.push(...st.current==="summary"?S6(es):es)}catch(es){const Gn=es instanceof Error?es.message:String(es);Qe({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed history event",debugMessage:Gn,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed history event:",es)}if(ir.length>0&&!S0e(H,ir,c)){gt.hasMore=!1,gt.loading=!1,gt.capacityReached=!0,R({hasMore:!1,loading:!1,capacityReached:!0});return}const Qn=H.getSnapshot().blocks.length<c;gt.capacityReached=Dn.hasMore&&!Qn,gt.cursor=Dn.nextCursor,gt.beforeRecordId=void 0,gt.hasMore=Dn.hasMore&&Qn,gt.loading=!1,R({hasMore:gt.hasMore,loading:!1,capacityReached:gt.capacityReached})}catch(Dn){if(M.current!==Ae||ee.current!==gt)return;const qn=!kn&&(!(Dn instanceof ic)||Dn.status>=500||Dn.status===408||Dn.status===429);throw gt.hasMore=qn,gt.loading=!1,gt.capacityReached=!1,R({hasMore:qn,loading:!1,capacityReached:!1}),Qe({severity:"warning",category:"user_action",operation:"load_session",code:"daemon.transcript_history.failed",message:"Failed to load earlier session history",debugMessage:Dn instanceof Error?Dn.message:String(Dn),recoverable:qn}),Dn}},[Qe,cn,c,H]),Bt=f.useMemo(()=>{var gt;const Ae=be.sessionId===ee.current.sessionId&&((gt=M.current)==null?void 0:gt.sessionId)===ee.current.sessionId;return{hasMore:Ae&&V.hasMore,loading:Ae&&V.loading,capacityReached:Ae&&V.capacityReached,loadMore:Wt}},[be.sessionId,Wt,V]),hn=f.useRef(j0e);return f.useEffect(()=>{if(hn.current===r)return;hn.current=r;const gt=ne.current.sessionId;if(r===gt)return;const Ae=r?ue.loadSession(r):gt?ue.clearSession():void 0;Ae&&Ae.catch(kn=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",kn)})},[ue,r]),l.jsx(PY.Provider,{value:H,children:l.jsx(OY.Provider,{value:be,children:l.jsx(BY.Provider,{value:It,children:l.jsx(zY.Provider,{value:_e,children:l.jsx(FY.Provider,{value:ft,children:l.jsx(y9.Provider,{value:ue,children:l.jsx($Y.Provider,{value:Bt,children:T})})})})})})})}function s$(e,t,n,s,r,i,o,a={}){var c;if(s.type!=="turn_complete"&&s.type!=="turn_error")return!1;const u=(c=s.data)==null?void 0:c.promptId;if(!u)return!1;const d=e.get(n);if(!d||a.requireBoundPromptId&&d.promptId===void 0||d.promptId!==void 0&&d.promptId!==u)return!1;Vi(o);try{const h=o9(s,u);if(!h)return!1;r.dispatch(Ef(s,h.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(h)):(e.delete(n),t.set(dA(n,u),{status:"resolved",result:h}))}catch(h){r.dispatch(Ef(s,"error")),i("idle"),d.reject?(e.delete(n),d.reject(h)):(e.delete(n),t.set(dA(n,u),{status:"rejected",error:h}))}return!0}function N0e(e){return e.type==="turn_complete"}function C6(e,t,n,s,r={}){M0e(e),r.updateConnection!==!1&&Ppe(e,s);const i=Zfe(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=O0e(e);return N0e(e)?o?[o]:[]:o?[...i,o]:i}function M0e(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",I0e(e))}function I0e(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!lo(e.data))return t.payload="non-object",t;const n=R0e(e.data.env),s=Uv(e.data.changedKeys),r=Uv(e.data.sessionsRefreshed),i=Uv(e.data.sessionsSkipped),o=e.data.childReloaded,a=ou(e.data,"childError");return n&&(t.env=n),s&&(t.changedKeys=s),typeof o=="boolean"&&(t.childReloaded=o),r&&(t.sessionsRefreshed=r),i&&(t.sessionsSkipped=i),a&&(t.childError=a),t}function R0e(e){if(lo(e))return{updatedKeys:Uv(e.updatedKeys)??[],removedKeys:Uv(e.removedKeys)??[]}}function Uv(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function T6(e,t,n,s,r={}){if(r.hideHistoryTruncation&&LY(e))return[];if(e.type==="session_snapshot"&&lo(e.data)&&e.data.recordingDegraded===!1){const o=ou(e.data,"sessionId");o&&s(`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 a=n(D0e(e,o));(a.category==="protocol"||a.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",a)}return i}function D0e(e,t){const n={message:t.text,debugMessage:t.text,recoverable:t.recoverable};switch(e.type){case"session_recording_degraded":case"session_snapshot":{const s=lo(e.data)?ou(e.data,"sessionId"):void 0;return{...n,...s?{id:`daemon.session_recording_degraded:${s}`}:{},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 iC(){const e=f.useContext(PY);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function HY(){const e=f.useContext($Y);if(!e)throw new Error("useDaemonTranscriptHistory must be used within DaemonSessionProvider");return e}function Cw(){const e=iC(),t=f.useCallback(()=>e.getSnapshot().blocks,[e]);return f.useSyncExternalStore(e.subscribe,t,t)}function oC(){const e=Cw(),t=qY();return f.useMemo(()=>i0e(e,t),[e,t])}function Ib(){const e=f.useContext(y9);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function L0e(){return f.useContext(y9)}function wd(){return f.useContext(FY)}function qY(){const e=f.useContext(BY);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function xa(){const e=f.useContext(OY);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function P0e(){const e=f.useContext(zY);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function E6(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function O0e(e){if(e.type!=="session_update")return null;const t=lo(e.data)?e.data:void 0,n=lo(t==null?void 0:t.update)?t.update:lo(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const s=n._meta;if(!lo(s))return null;const r=$0e(s.goalStatus);if(r)return r$(e,r);const i=B0e(s.goalTerminal);if(i)return r$(e,i);const o=s.stopHookLoop;if(!lo(o))return null;const a=o.goal;return!lo(a)||!ou(a,"condition"),null}function r$(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function $0e(e){if(!lo(e))return null;const t=ou(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=ou(e,"condition");if(!n)return null;const s=Wv(e,"iterations"),r=Wv(e,"durationMs"),i=Wv(e,"setAt"),o=ou(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i!==void 0?{setAt:i}:{},...o?{lastReason:o}:{}}}function B0e(e){if(!lo(e))return null;const t=ou(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=ou(e,"condition");if(!n)return null;const s=Wv(e,"iterations"),r=Wv(e,"durationMs"),i=ou(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i?{lastReason:i}:{}}}function ou(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Wv(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function i$(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,c=0,u,d=0,h=0;for(const m of e)switch(m.type){case"workspace.memory.changed":n+=1;break;case"workspace.agent.changed":s+=1;break;case"workspace.tool.toggled":r+=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":a+=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":h+=1;break}n+s+r+i+o+a+c+d+h!==0&&t(m=>({memoryVersion:m.memoryVersion+n,agentsVersion:m.agentsVersion+s,toolsVersion:m.toolsVersion+r,settingsVersion:m.settingsVersion+i,mcpVersion:m.mcpVersion+o,extensionsVersion:m.extensionsVersion+a,artifactsVersion:m.artifactsVersion+c,...u?{lastExtensionChange:u}:{},initVersion:m.initVersion+d,authVersion:m.authVersion+h}))}function z0e(e){const t=n4(e);return t!==void 0&&T0e.has(t)}function F0e(e){const t=n4(e);return t!==void 0&&v9.has(t)}function n4(e){if(e instanceof ic||lo(e)&&typeof e.status=="number")return e.status}function lo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function kd(e,t){const{autoLoad:n=!1,enabled:s=!0}=t,[r,i]=f.useState({data:void 0,loading:!1,error:void 0}),o=f.useRef(0),a=f.useCallback(async()=>{if(!s)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(h=>({...h,loading:!1,error:d}));return}},[s,e]);return f.useEffect(()=>{!n||!s||a()},[n,s,a]),{...r,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Rb(e,t,n){const s=f.useRef(!1);f.useEffect(()=>{if(!(e===void 0||!n)){if(!s.current){s.current=!0;return}t()}},[n,t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function UY(e={}){var t;const n=Vo(),s=f.useCallback(()=>n.listAgents(),[n]),r=kd(s,e),i=wd();return Rb(i==null?void 0:i.agentsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,agents:((t=r.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 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function w9(e={}){const t=Vo(),n=f.useCallback(()=>t.loadMcpStatus(),[t]),s=kd(n,e),r=wd();return Rb(r==null?void 0:r.mcpVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.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 H0e(e={}){var t;const n=Vo(),s=f.useCallback(()=>n.loadMemoryStatus(),[n]),r=kd(s,e),i=wd();return Rb(i==null?void 0:i.memoryVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,files:((t=r.data)==null?void 0:t.files)??[],readFile:n.readWorkspaceFile,writeMemory:n.writeMemory}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function W2(e={}){const{pageSize:t,cursor:n,archiveState:s,view:r,group:i,sourceType:o,...a}=e,c=la(),u=L0e(),d=f.useCallback(()=>{const C={...t!==void 0?{pageSize:t}:{},...n!==void 0?{cursor:n}:{},...s!==void 0?{archiveState:s}:{},...r!==void 0?{view:r}:{},...i!==void 0?{group:i}:{},...o!==void 0?{sourceType:o}:{}};return c.actions.listSessionsPage(C)},[s,n,i,t,o,r,c.actions]),h=!!c.workspaceCwd,m=kd(d,{...a,enabled:(a.enabled??!0)&&h}),p=m.reload,g=f.useCallback(async()=>{const C=await p();return C==null?void 0:C.sessions},[p]),b=m.data,x=(b==null?void 0:b.sessions)??[],y=f.useCallback(async C=>{const _=await c.actions.deleteSession(C);return _&&g(),_},[c.actions,g]),v=f.useCallback(async C=>{const _=await c.actions.deleteSessions(C);return(_.removed.length>0||_.notFound.length>0)&&g(),_},[c.actions,g]),w=f.useCallback((C,_="html")=>c.actions.exportSession(C,_),[c.actions]),k=f.useCallback(async C=>{const _=await c.actions.archiveSession(C);return _&&g(),_},[c.actions,g]),T=f.useCallback(async C=>{const _=await c.actions.unarchiveSession(C);return _&&g(),_},[c.actions,g]);return{...m,data:b!==void 0?x:void 0,reload:g,sessions:x,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:w,archiveSession:k,unarchiveSession:T}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function q0e(e={}){var t;const n=Vo(),s=f.useCallback(()=>n.loadSkillsStatus(),[n]),r=kd(s,e);return{...r,status:r.data,skills:((t=r.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 gA(e={}){const{detail:t="summary",...n}=e,s=Vo(),r=f.useCallback(()=>s.loadDaemonStatus(t),[s,t]),i=kd(r,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function U0e(e={}){const{range:t,heatmapDays:n,...s}=e,r=Vo(),i=f.useCallback(()=>r.loadUsageDashboard({range:t,heatmapDays:n}),[r,t,n]),o=kd(i,s);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function WY(e={}){var t;const n=Vo(),s=f.useCallback(()=>n.loadToolsStatus(),[n]),r=kd(s,e),i=wd();return Rb(i==null?void 0:i.toolsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,tools:((t=r.data)==null?void 0:t.tools)??[],preheat:n.preheatAcp,setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function k9(e={}){var t;const n=Vo(),s=f.useCallback(()=>n.loadSettingsStatus(),[n]),r=kd(s,e),i=wd();return Rb(i==null?void 0:i.settingsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,settings:((t=r.data)==null?void 0:t.settings)??[],setValue:n.setWorkspaceSetting}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function W0e(e={}){var t,n;const s=Vo(),r=f.useCallback(()=>s.loadProviders(),[s]),i=kd(r,e),o=wd();return Rb(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 V0e=300,G0e=100,Kg=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function A6(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function K0e(e){const{enabled:t=!0,onStateChange:n,getOnAccept:s,getOnOutcome:r}=e;let i=Kg,o=null,a=!1,c=null;function u(x){i=x,n(x)}function d(){o&&(clearTimeout(o),o=null),c&&(clearTimeout(c),c=null)}return{setSuggestion:x=>{if(o&&(clearTimeout(o),o=null),!x){u(Kg);return}t&&(o=setTimeout(()=>{u({suggestion:x,isVisible:!0,shownAt:Date.now()})},V0e))},accept:(x,y)=>{var v;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const w=i.suggestion,{shownAt:k}=i;if(!w){a=!1;return}try{(v=r())==null||v({outcome:"accepted",accept_method:x,time_ms:k>0?Date.now()-k:0,suggestion_length:w.length})}catch(T){console.error("[followup] onOutcome callback threw:",T)}u(Kg),queueMicrotask(()=>{var T;try{y!=null&&y.skipOnAccept||(T=s())==null||T(w)}catch(C){console.error("[followup] onAccept callback threw:",C)}finally{c&&clearTimeout(c),c=setTimeout(()=>{a=!1},G0e)}})},dismiss:()=>{var x;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(x=r())==null||x({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(Kg)}},clear:()=>{d(),a=!1,u(Kg)},cleanup:()=>{d(),a=!1}}}function VY(e={}){const{enabled:t=!0,onAccept:n,onOutcome:s}=e,r=iC(),i=xa().sessionId,[o,a]=f.useState(Kg),c=f.useRef(n);c.current=n;const u=f.useRef(s);u.current=s;const d=f.useSyncExternalStore(r.subscribe,()=>r.getSnapshot().lastFollowupSuggestion,()=>r.getSnapshot().lastFollowupSuggestion),h=f.useSyncExternalStore(o0e,ZO,ZO),m=(h==null?void 0:h.sessionId)===i?h:d,p=f.useMemo(()=>K0e({enabled:t,onStateChange:a,getOnAccept:()=>c.current,getOnOutcome:()=>u.current}),[t]),{setSuggestion:g}=p;f.useEffect(()=>(t||p.clear(),()=>p.cleanup()),[p,t]);const b=f.useRef(void 0),x=f.useRef(i);f.useEffect(()=>{const k=x.current;x.current=i,k!==void 0&&i!==void 0&&k!==i&&(p.clear(),a_(),b.current=void 0)},[p,i]),f.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=f.useCallback(()=>{p.clear(),A6(r),a_(),b.current=void 0},[p,r]),v=f.useCallback((k,T)=>{p.accept(k,T),A6(r),a_(),b.current=void 0},[p,r]),w=f.useCallback(()=>{p.dismiss(),A6(r),a_(),b.current=void 0},[p,r]);return f.useMemo(()=>({followupState:o,onAcceptFollowup:v,onDismissFollowup:w,clear:y}),[o,v,w,y])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Y0e(){const e=f.useSyncExternalStore(c0e,e$,e$),t=f.useCallback(n=>d0e(n),[]);return{batches:e,consume:t}}const o$=[];function X0e(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,s)=>!Object.is(n,t[s]))}class Ph extends f.Component{constructor(){super(...arguments);Pe(this,"state",{error:null,resetKeys:this.props.resetKeys??o$});Pe(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){const r=n.resetKeys??o$;return X0e(s.resetKeys,r)?{error:null,resetKeys:r}:null}componentDidCatch(n,s){console.error(`[web-shell] ${this.props.label??"render"} failed:`,n,s.componentStack)}render(){const{error:n}=this.state;if(n===null)return this.props.children;const{fallback:s}=this.props;return typeof s=="function"?s(n,this.reset):s}}const a$={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:"重试"}},Q0e={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},J0e={margin:0,fontSize:"1rem",fontWeight:600},Z0e={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},ege={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 tge({error:e,onRetry:t,language:n="en"}){const s=a$[n]??a$.en;return l.jsxs("div",{role:"alert",style:Q0e,"data-web-shell-error":!0,children:[l.jsx("p",{style:J0e,children:s.title}),l.jsx("p",{style:Z0e,children:s.body}),!1,l.jsx("button",{type:"button",style:ege,onClick:t,children:s.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 GY=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.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 nge=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 sge=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.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 l$=e=>{const t=sge(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 j6={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 rge=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},ige=f.createContext({}),oge=()=>f.useContext(ige),age=f.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},c)=>{const{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:h=!1,color:m="currentColor",className:p=""}=oge()??{},g=s??h?Number(n??d)*24/Number(t??u):n??d;return f.createElement("svg",{ref:c,...j6,width:t??u??j6.width,height:t??u??j6.height,stroke:e??m,strokeWidth:g,className:GY("lucide",p,r),...!i&&!rge(a)&&{"aria-hidden":"true"},...a},[...o.map(([b,x])=>f.createElement(b,x)),...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 Mn=(e,t)=>{const n=f.forwardRef(({className:s,...r},i)=>f.createElement(age,{ref:i,iconNode:t,className:GY(`lucide-${nge(l$(e))}`,`lucide-${e}`,s),...r}));return n.displayName=l$(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 lge=[["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"}]],cge=Mn("activity",lge);/**
 * @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 uge=[["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"}]],dge=Mn("archive-restore",uge);/**
 * @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 hge=[["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"}]],l_=Mn("archive",hge);/**
 * @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 fge=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],aC=Mn("arrow-left",fge);/**
 * @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 mge=[["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"}]],pge=Mn("blocks",mge);/**
 * @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 gge=[["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"}]],Vv=Mn("bot",gge);/**
 * @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 bge=[["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"}]],yge=Mn("box",bge);/**
 * @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 vge=[["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"}]],xge=Mn("calendar-clock",vge);/**
 * @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 wge=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],lC=Mn("check",wge);/**
 * @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 kge=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],wc=Mn("chevron-down",kge);/**
 * @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 _ge=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cC=Mn("chevron-right",_ge);/**
 * @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 Sge=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Cge=Mn("chevron-up",Sge);/**
 * @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 Tge=[["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"}]],nu=Mn("circle-alert",Tge);/**
 * @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 Ege=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Age=Mn("circle-check",Ege);/**
 * @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 jge=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],KY=Mn("circle-dot",jge);/**
 * @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 Nge=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Mge=Mn("columns-2",Nge);/**
 * @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 Ige=[["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"}]],Rge=Mn("command",Ige);/**
 * @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 Dge=[["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"}]],Lge=Mn("copy",Dge);/**
 * @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 Pge=[["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"}]],bA=Mn("database",Pge);/**
 * @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 Oge=[["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"}]],N6=Mn("download",Oge);/**
 * @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 $ge=[["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"}]],qf=Mn("ellipsis-vertical",$ge);/**
 * @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 Bge=[["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"}]],zge=Mn("file-text",Bge);/**
 * @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 Fge=[["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"}]],Hge=Mn("flask-conical",Fge);/**
 * @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 qge=[["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"}]],s4=Mn("folder-closed",qge);/**
 * @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 Uge=[["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"}]],Wge=Mn("folder-input",Uge);/**
 * @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 Vge=[["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"}]],Gge=Mn("folder-open",Vge);/**
 * @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 Kge=[["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"}]],Yge=Mn("folder-plus",Kge);/**
 * @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 Xge=[["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"}]],Qge=Mn("folder-x",Xge);/**
 * @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 Jge=[["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"}]],yA=Mn("git-branch",Jge);/**
 * @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 Zge=[["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"}]],r4=Mn("git-fork",Zge);/**
 * @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 e1e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],vA=Mn("info",e1e);/**
 * @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 t1e=[["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"}]],n1e=Mn("layers",t1e);/**
 * @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 s1e=[["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"}]],r1e=Mn("layout-grid",s1e);/**
 * @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 i1e=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],o1e=Mn("loader-circle",i1e);/**
 * @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 a1e=[["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"}]],l1e=Mn("lock",a1e);/**
 * @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 c1e=[["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"}]],YY=Mn("maximize-2",c1e);/**
 * @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 u1e=[["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"}]],XY=Mn("minimize-2",u1e);/**
 * @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 d1e=[["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"}]],h1e=Mn("moon",d1e);/**
 * @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 f1e=[["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"}]],c$=Mn("package",f1e);/**
 * @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 m1e=[["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"}]],p1e=Mn("palette",m1e);/**
 * @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 g1e=[["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"}]],b1e=Mn("panel-left-close",g1e);/**
 * @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 y1e=[["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"}]],v1e=Mn("panel-left-open",y1e);/**
 * @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 x1e=[["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"}]],i4=Mn("pencil",x1e);/**
 * @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 w1e=[["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"}]],u$=Mn("pin",w1e);/**
 * @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 k1e=[["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"}]],_1e=Mn("play",k1e);/**
 * @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 S1e=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],eb=Mn("plus",S1e);/**
 * @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 C1e=[["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"}]],uC=Mn("refresh-cw",C1e);/**
 * @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 T1e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],lu=Mn("search",T1e);/**
 * @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 E1e=[["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"}]],j1=Mn("server",E1e);/**
 * @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 A1e=[["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"}]],QY=Mn("settings-2",A1e);/**
 * @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 j1e=[["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"}]],N1e=Mn("settings",j1e);/**
 * @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 M1e=[["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"}]],I1e=Mn("shield",M1e);/**
 * @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 R1e=[["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"}]],D1e=Mn("sliders-horizontal",R1e);/**
 * @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 L1e=[["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"}]],N1=Mn("sparkles",L1e);/**
 * @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 P1e=[["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"}]],d$=Mn("square-pen",P1e);/**
 * @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 O1e=[["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"}]],$1e=Mn("sun",O1e);/**
 * @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 B1e=[["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"}]],z1e=Mn("target",B1e);/**
 * @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 F1e=[["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"}]],Wp=Mn("trash-2",F1e);/**
 * @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 H1e=[["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"}]],q1e=Mn("triangle-alert",H1e);/**
 * @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 U1e=[["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"}]],W1e=Mn("upload",U1e);/**
 * @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 V1e=[["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"}]],h$=Mn("wifi-off",V1e);/**
 * @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 G1e=[["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"}]],xA=Mn("wrench",G1e);/**
 * @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 K1e=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Tw=Mn("x",K1e);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const oh=1e3,_9="session_organization",JY="session_transcript_pagination",o4="default",ZY=100,Y1e=500,eX=5e4;function wA(e){for(const t of e){if(!X1e(t))continue;const n=t;if(n.resolved)continue;const s=f1(n.toolCall),r=typeof(s==null?void 0:s.toolCallId)=="string"?s.toolCallId:typeof(s==null?void 0:s.id)=="string"?s.id:void 0,i=typeof(s==null?void 0:s.kind)=="string"?s.kind:void 0,o=f1(s==null?void 0:s._meta),a=typeof(o==null?void 0:o.toolName)=="string"?o.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:r,title:n.title,toolKind:i,toolName:a,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(c=>({id:c.optionId,label:c.label,kind:J1e(c.raw)})),rawInput:Q1e(n.toolCall)}}return null}function X1e(e){return e.kind==="permission"}function Q1e(e){const t=f1(e);return t?f1(t.rawInput)??f1(t.input)??f1(t.args)??t:void 0}function f1(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function J1e(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 Z1e(e,t,n){const s=new Array(e);return new Proxy(s,{get(r,i,o){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const c=+i;if(Number.isInteger(c)&&c>=0&&c<e){let u=r[c];if(!u){const d=t[c*2];u=r[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(r,i,o)}})}function Eg(e,t,n){let s=n.initialDeps??[],r,i=!0;function o(){const a=e();return(a.length!==s.length||a.some((u,d)=>s[d]!==u))&&(s=a,r=t(...a),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(r),i=!1),r}return o.updateDeps=a=>{s=a},o}function f$(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const ebe=(e,t)=>Math.abs(e-t)<1.01,tbe=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let zy;const M6=()=>{if(zy!==void 0)return zy;if(typeof navigator>"u")return zy=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return zy=!0;const e=navigator.maxTouchPoints;return zy=navigator.platform==="MacIntel"&&e!==void 0&&e>0},m$=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},nbe=e=>e,sbe=e=>{const t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=new Array(s);for(let i=0;i<s;i++)r[i]=t+i;return r},rbe=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=o=>{const{width:a,height:c}=o;t({width:Math.round(a),height:Math.round(c)})};if(r(m$(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const a=()=>{const c=o[0];if(c!=null&&c.borderBoxSize){const u=c.borderBoxSize[0];if(u){r({width:u.inlineSize,height:u.blockSize});return}}r(m$(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},a4={passive:!0},ibe=typeof window>"u"?!0:"onscrollend"in window,obe=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const i=e.options.useScrollendEvent&&ibe;let o=0;const a=i?null:tbe(r,()=>t(o,!1),e.options.isScrollingResetDelay),c=h=>()=>{o=n(s),a==null||a(),t(o,h)},u=c(!0),d=c(!1);return s.addEventListener("scroll",u,a4),i&&s.addEventListener("scrollend",d,a4),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",d)}},abe=(e,t)=>obe(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),lbe=(e,t,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(e),r=n.options.getItemKey(s);return n.itemSizeCache.get(r)??n.options.estimateSize(s)}if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const s=n.indexFromElement(e),r=n.options.getItemKey(s),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},cbe=(e,{adjustments:t=0,behavior:n},s)=>{var r,i;(i=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||i.call(r,{[s.options.horizontal?"left":"top"]:e+t,behavior:n})},ube=cbe;class dbe{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,s,r;return((r=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:r.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(i=>{const o=()=>{const a=i.target,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,d]of this.elementsCache)if(d===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var i;return(i=s())==null?void 0:i.observe(r,{box:"border-box"})},unobserve:r=>{var i;return(i=s())==null?void 0:i.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{var s,r;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:nbe,rangeExtractor:sbe,onChange:()=>{},measureElement:lbe,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 a=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?((s=g[0])==null?void 0:s.key)??o.getItemKey(0):null,x=m>0?((r=g[m-1])==null?void 0:r.key)??o.getItemKey(m-1):null;if(p!==m||m>0&&p>0&&(i.getItemKey(0)!==b||i.getItemKey(p-1)!==x)){u=!0;const w=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;w&&(a=[w.key,this.getScrollOffset()-w.start]);const k=i.followOnAppend===!0?"auto":i.followOnAppend||null;k&&p>m&&this.isAtEnd(o.scrollEndThreshold)&&(m===0||i.getItemKey(p-1)!==x)&&(c=k)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,h=0;if(a&&this.scrollOffset!==null){const[m,p]=a,g=this.getMeasurements(),{count:b,getItemKey:x}=this.options;let y=0;for(;y<b&&x(y)!==m;)y++;if(y<b){const v=g[y];if(v){const w=v.start+p;w!==this.scrollOffset&&(h=w-this.scrollOffset,this.scrollOffset=w,d=!0)}}}(d||c)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,c,h])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Eg(()=>(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 s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,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)},a=()=>{this._iosTouching=!1,!(!M6()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,a4),i.addEventListener("touchend",a,a4),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",a),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 r=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,r&&this.scrollElement&&this.options.enabled){const[i,o,a,c]=r;i!==null&&!a&&(M6()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?c!==0&&(this._iosDeferredAdjustment+=c):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const r=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=r,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,s)=>{const r=new Map,i=new Map;for(let o=s-1;o>=0;o--){const a=n[o];if(r.has(a.lane))continue;const c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.end<c.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=Eg(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,r,i,o,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Eg(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,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 h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const g=this.options.gap,b=n*2;let x=this._flatMeasurements;if(!x||x.length<b){const w=new Float64Array(b);x&&h>0&&w.set(x.subarray(0,h*2)),x=w,this._flatMeasurements=x}let y;if(h===0)y=s+r;else{const w=h-1;y=x[w*2]+x[w*2+1]+g}for(let w=h;w<n;w++){const k=i(w),T=d.get(k),C=typeof T=="number"?T:this.options.estimateSize(w);x[w*2]=y,x[w*2+1]=C,y+=C+g}const v=Z1e(n,x,i);return this.measurementsCache=v,v}const m=this.measurementsCache.slice(0,h),p=new Array(a).fill(void 0);for(let g=0;g<h;g++){const b=m[g];b&&(p[b.lane]=g)}for(let g=h;g<n;g++){const b=i(g),x=this.laneAssignments.get(g);let y,v;const w=c==="estimate"||d.has(b);if(x!==void 0&&this.options.lanes>1){y=x;const _=p[y],S=_!==void 0?m[_]:void 0;v=S?S.end+this.options.gap:s+r}else{const _=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);v=_?_.end+this.options.gap:s+r,y=_?_.lane:g%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(g,y)}const k=d.get(b),T=typeof k=="number"?k:this.options.estimateSize(g),C=v+T;m[g]={index:g,start:v,size:T,end:C,key:b,lane:y},p[y]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Eg(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?hbe({measurements:n,outerSize:s,scrollOffset:r,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Eg(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(r!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,r-i),a=Math.min(this.options.count-1,r+i);return n>=o&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const s=this.indexFromElement(n),r=this.options.getItemKey(s),i=this.elementsCache.get(r);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(r,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var r,i;if(n<0||n>=this.options.count)return;let o,a,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),a=u[n*2],o=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;c=m.key,a=m.start,o=m.size}const d=this.itemSizeCache.get(c)??o,h=s-d;if(h!==0){const m=this.options.anchorTo==="end"&&((r=this.scrollState)==null?void 0:r.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:a,size:o,end:a+o,lane:0},h,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,s),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-p):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=Eg(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],c=s[a];r.push(c)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const r=this._flatMeasurements,i=this.options.lanes===1&&r!=null,o=tX(0,s.length-1,i?a=>r[a*2]:a=>f$(s[a]).start,n);return f$(s[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,s,r=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=n>=o+i?"end":"start"),s==="center"?n+=(r-i)/2:s==="end"&&(n-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(s==="auto")if(o.end>=i+r-this.options.scrollPaddingEnd)s="end";else if(o.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,o.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:r="auto"}={})=>{const i=this.getOffsetForAlignment(n,s),o=this.now();this.scrollState={index:null,align:s,behavior:r,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:r="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,s);if(!i)return;const[o,a]=i,c=this.now();this.scrollState={index:n,align:a,behavior:r,startedAt:c,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const r=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),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 s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,o=this._flatMeasurements;o!=null?r=o[i*2]+o[i*2+1]:r=((n=s[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&i.some(a=>a===null);){const a=s[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}r=Math.max(...i.filter(a=>a!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const r of s)r&&this.itemSizeCache.has(r.key)&&n.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:r,adjustments:s},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&&(M6()&&(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 s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=s?s[0]:this.scrollState.lastTargetOffset,i=1,o=r!==this.scrollState.lastTargetOffset;if(!o&&ebe(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==r&&this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,c=Math.abs(r-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>a;this.scrollState.lastTargetOffset=r,u||(this.scrollState.behavior="auto"),this._scrollToOffset(r,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const tX=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,i=n(r);if(i<s)e=r+1;else if(i>s)t=r-1;else return r}return e>0?e-1:0};function hbe({measurements:e,outerSize:t,scrollOffset:n,lanes:s,flat:r}){const i=e.length-1,o=r?d=>r[d*2]:d=>e[d].start,a=r?d=>r[d*2]+r[d*2+1]:d=>e[d].end;if(e.length<=s)return{startIndex:0,endIndex:i};let c=tX(0,i,o,n),u=c;if(s===1)for(;u<i&&a(u)<n+t;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<i&&d.some(m=>m<n+t);){const m=e[u];d[m.lane]=m.end,u++}const h=Array(s).fill(n+t);for(;c>=0&&h.some(m=>m>=n);){const m=e[c];h[m.lane]=m.start,c--}c=Math.max(0,c-c%s),u=Math.min(i,u+(s-1-u%s))}return{startIndex:c,endIndex:u}}const I6=typeof document<"u"?f.useLayoutEffect:f.useEffect;function fbe({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...s}){const r=f.useReducer(u=>u+1,0)[1],i=f.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 h=u.getTotalSize();if(d.container&&h!==d.lastSize){d.lastSize=h;const y=u.options.horizontal?"width":"height";d.container.style[y]=`${h}px`}const m=!!u.options.horizontal,p=d.mode==="transform",g=m?"left":"top",b=u.options.scrollMargin,x=u.getVirtualItems();for(const y of x){const v=y.start-b,w=u.elementsCache.get(y.key);w&&d.lastPositions.get(w)!==v&&(d.lastPositions.set(w,v),p?w.style.transform=m?`translate3d(${v}px, 0, 0)`:`translate3d(0, ${v}px, 0)`:w.style[g]=`${v}px`)}},a={...s,onChange:(u,d)=>{var h;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?hu.flushSync(r):r()),(h=s.onChange)==null||h.call(s,u,d)}},[c]=f.useState(()=>{const u=new dbe(a);return Object.assign(u,{containerRef:d=>{const h=i.current;if(h.container=d,h.lastSize=null,d&&h.enabled){const m=u.getTotalSize();h.lastSize=m;const p=u.options.horizontal?"width":"height";d.style[p]=`${m}px`}}})});return c.setOptions(a),I6(()=>c._didMount(),[]),I6(()=>c._willUpdate()),I6(()=>{o(c)}),c}function mbe(e){return fbe({observeElementRect:rbe,observeElementOffset:abe,scrollToFn:ube,...e})}function nX(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function pbe(e){var t;return((t=nX(e))==null?void 0:t.type)==="task_execution"}function Db(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||pbe(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function Oh(e){if(!Db(e))return!1;const t=nX(e.rawOutput),n=e.toolName.toLowerCase(),s=e.args,r=n==="agent"&&e.parentToolCallId===void 0,i=r&&(s==null?void 0:s.run_in_background)===void 0&&(s==null?void 0:s.working_dir)===void 0&&(s==null?void 0:s.name)===void 0&&(typeof(s==null?void 0:s.subagent_type)!="string"||s.subagent_type.toLowerCase()!=="fork"),o=(s==null?void 0:s.run_in_background)===!0&&(n!=="agent"||r);return(t==null?void 0:t.status)==="background"||o||i}const sX=f.createContext({}),p$=sX.Provider;function mu(){return f.useContext(sX)}const gbe=["en","zh-CN"],S9={"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`,"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)??""}`,"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.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.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.defaultTitle":"Chart Loading","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.runtimeUnavailable":"Chart runtime is unavailable.","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.copyVisible":"Quick copy","markdownTable.freezeFirstColumn":"Freeze first column","markdownTable.unfreezeFirstColumn":"Unfreeze first column","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.","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","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.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.project":"Project","sidebar.pinnedSessions":"Pinned","sidebar.workspaceSelectLabel":"Workspace","sidebar.details":"Details","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.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.editing":"Editing...","queue.removing":"Updating...","queue.submittingDisabled":"Submitting queued message...","queue.commandBlocked":"Slash commands can't be queued while a turn is running.","queue.shellBlocked":"Shell commands can't be queued while a turn is running.","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.","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.","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.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.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","userMessage.showMore":"Show more","userMessage.showLess":"Collapse","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.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.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","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:"},bbe={...S9,"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`,"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)??""}`,"workspace.paneLabel":e=>`工作区：${(e==null?void 0:e.name)??""}`,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.grep":"搜索内容","toolName.grep_search":"搜索内容","toolName.glob":"Glob","toolName.run_shell_command":"运行命令","toolName.todo_write":"任务清单","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.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.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.defaultTitle":"图表加载中","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.runtimeUnavailable":"图表运行时不可用。","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.copyVisible":"快捷复制","markdownTable.freezeFirstColumn":"冻结首列","markdownTable.unfreezeFirstColumn":"取消冻结首列","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":"已达到历史显示上限，更早消息仍保存在会话中。","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":"在新会话发送","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.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.project":"项目","sidebar.pinnedSessions":"置顶","sidebar.workspaceSelectLabel":"工作区","sidebar.details":"详情","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.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.editing":"编辑中...","queue.removing":"处理中...","queue.submittingDisabled":"排队消息正在提交中...","queue.commandBlocked":"当前回合运行时，Slash 命令不能进入排队。","queue.shellBlocked":"当前回合运行时，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":"没有可重试的失败请求。","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":"当前还没有可用于查看历史的工作区。","local.agents":"管理智能体","local.bug":"提交错误报告","local.compress":"将上下文压缩为摘要","local.compressFast":"无需 AI 的快速上下文压缩","local.config":"通过点分路径键获取或设置配置项","local.diff":"显示工作区相对 HEAD 的改动统计","local.log":"显示工作区的提交历史","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.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":"回到底部","userMessage.showMore":"显示更多","userMessage.showLess":"收起","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.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.paneError":"此会话窗格出错","splitView.paneConnectionError":"连接已断开","splitView.outerApprovalPending":"主会话正在等待审批。","splitView.goToApproval":"前往处理","splitView.empty":"分屏中还没有会话，添加一个开始。","splitView.composerPlaceholder":"给这个会话发消息…","settings.title":"设置","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":"提示："},ybe={en:S9,"zh-CN":bbe},vbe={en:"English [en]","zh-CN":"中文 [zh-CN]"},rX=f.createContext({language:"en",t:e=>e});function wh(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function C9(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return wh(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 T9(e){return vbe[e]}function E9(e){const t=ybe[e];return(n,s)=>{const r=t[n]??S9[n]??n;return typeof r=="function"?r(s):r}}function xbe({language:e,children:t}){const n=f.useMemo(()=>({language:e,t:E9(e)}),[e]);return l.jsx(rX.Provider,{value:n,children:t})}function at(){return f.useContext(rX)}const iX=f.createContext(null);function Hc(){return f.useContext(iX)}const wbe="_row_19m4s_1",kbe="_tip_19m4s_13",_be="_chatRow_19m4s_35",Sbe="_chatTip_19m4s_43",Cbe="_chatActions_19m4s_56",Tbe="_copyButton_19m4s_71",ff={row:wbe,tip:kbe,chatRow:_be,chatTip:Sbe,chatActions:Cbe,copyButton:Tbe};function kA({timestamp:e,children:t,chatMode:n=!1,copyText:s,copyTitle:r="Copy"}){const[i,o]=f.useState(!1),a=f.useCallback(()=>{var u;s&&((u=navigator.clipboard)==null||u.writeText(s).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[s]);if(e===void 0&&!s)return l.jsx(l.Fragment,{children:t});const c=s?l.jsx("button",{type:"button",className:ff.copyButton,title:r,"aria-label":r,onClick:a,children:i?l.jsx(Abe,{}):l.jsx(Ebe,{})}):null;return e===void 0?l.jsxs("div",{className:n?ff.chatRow:ff.row,children:[t,c]}):l.jsxs("div",{className:n?ff.chatRow:ff.row,children:[t,n?l.jsxs("span",{className:ff.chatActions,children:[l.jsx("span",{className:ff.chatTip,"aria-hidden":"true",children:tb(e)}),c]}):l.jsx("span",{className:ff.tip,"aria-hidden":"true",children:tb(e)})]})}function Ebe(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function Abe(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function tb(e,t=new Date){const n=new Date(e),s=o=>String(o).padStart(2,"0"),r=`${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${r}`}const jbe="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",Nbe="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",Mbe="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",Ibe="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 Rbe(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 Dbe(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="text"?typeof t.text=="string":t.type!=="tag"?!1:Rbe(t.tag)}function A9(e,t,n,s={}){if(!t)return null;try{const r=t(e);return!Array.isArray(r)||r.length===0||!r.every(Dbe)||s.requireSourcePreservation&&r.map(i=>i.type==="text"?i.text:dC(i.tag)).join("")!==e?null:r}catch(r){return console.warn(n,r),null}}const j9={extension:jbe,file:Nbe,mcp:Mbe,skill:Ibe},Lbe=new Set(Object.values(j9));function _A(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function dC(e){var t,n,s;return((t=e.serialized)==null?void 0:t.trim())||((n=e.value)==null?void 0:n.trim())||((s=e.label)==null?void 0:s.trim())||e.id}function z0(e,t){if(e)return _A(t,e)??_A(j9,e)}function N9(e){return e!==void 0&&Lbe.has(e)}function Pbe(e,t){const n=[];let s=0;for(const r of t){const i=dC(r);if(!i)continue;const o=e.indexOf(i,s);if(o<0)continue;const a=o+i.length;n.push({type:"reference",start:o,end:a,text:i,reference:{id:r.id,...r.kind?{kind:r.kind}:{},...r.label?{label:r.label}:{},...r.value?{value:r.value}:{},...r.serialized?{serialized:r.serialized}:{},...r.removable!==void 0?{removable:r.removable}:{}}}),s=a}return n}function oX(e,t){if(!t||t.length===0)return[{type:"text",text:e}];const n=[];let s=0;for(const r of t){if(r.type!=="reference")continue;const{start:i,end:o,text:a}=r,c=r.reference;!c||typeof c.id!="string"||i<s||o<=i||o>e.length||e.slice(i,o)!==a||(s<i&&n.push({type:"text",text:e.slice(s,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??a,...c.removable!==void 0?{removable:c.removable}:{}}}),s=o)}return s<e.length&&n.push({type:"text",text:e.slice(s)}),n.length>0?n:[{type:"text",text:e}]}function Obe(e,t){var i,o;const n=((i=e.label)==null?void 0:i.trim())??"",s=((o=e.value)==null?void 0:o.trim())??"";return{tagLabel:(e.kind?_A(j9,e.kind):void 0)?"":n,tagValue:s,fallback:e.id,iconUrl:z0(e.kind,t)}}const $be="modulepreload",Bbe=function(e){return"/"+e},g$={},oe=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=Bbe(c),c in g$)return;g$[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":$be,u||(h.as="script"),h.crossOrigin="",h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),u)return new Promise((m,p)=>{h.addEventListener("load",m),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},zr={Dark:"dark",Light:"light"},aX=[zr.Dark,zr.Light],lX=f.createContext(zr.Dark),zbe=lX.Provider;function Lb(){return f.useContext(lX)}const Vp="ui.theme",l4="general.language";function M9(e,t){return e===zr.Light||e==="Qwen Light"?zr.Light:e===zr.Dark||e==="Qwen Dark"?zr.Dark:t}function cX(e){return e===zr.Light?"Qwen Light":"Qwen Dark"}const uX=f.createContext("interactive");uX.Provider;function I9(){return f.useContext(uX)}function b$(e){const t=[],n=String(e||"");let s=n.indexOf(","),r=0,i=!1;for(;!i;){s===-1&&(s=n.length,i=!0);const o=n.slice(r,s).trim();(o||!i)&&t.push(o),r=s+1,s=n.indexOf(",",r)}return t}function dX(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Fbe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hbe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qbe={};function y$(e,t){return(qbe.jsx?Hbe:Fbe).test(e)}const Ube=/[ \t\n\f\r]/g;function hC(e){return typeof e=="object"?e.type==="text"?v$(e.value):!1:v$(e)}function v$(e){return e.replace(Ube,"")===""}class Ew{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Ew.prototype.normal={};Ew.prototype.property={};Ew.prototype.space=void 0;function hX(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new Ew(n,s,t)}function Tx(e){return e.toLowerCase()}class jl{constructor(t,n){this.attribute=n,this.property=t}}jl.prototype.attribute="";jl.prototype.booleanish=!1;jl.prototype.boolean=!1;jl.prototype.commaOrSpaceSeparated=!1;jl.prototype.commaSeparated=!1;jl.prototype.defined=!1;jl.prototype.mustUseProperty=!1;jl.prototype.number=!1;jl.prototype.overloadedBoolean=!1;jl.prototype.property="";jl.prototype.spaceSeparated=!1;jl.prototype.space=void 0;let Wbe=0;const ws=F0(),no=F0(),SA=F0(),jt=F0(),Wr=F0(),i0=F0(),$l=F0();function F0(){return 2**++Wbe}const CA=Object.freeze(Object.defineProperty({__proto__:null,boolean:ws,booleanish:no,commaOrSpaceSeparated:$l,commaSeparated:i0,number:jt,overloadedBoolean:SA,spaceSeparated:Wr},Symbol.toStringTag,{value:"Module"})),R6=Object.keys(CA);class R9 extends jl{constructor(t,n,s,r){let i=-1;if(super(t,n),x$(this,"space",r),typeof s=="number")for(;++i<R6.length;){const o=R6[i];x$(this,R6[i],(s&CA[o])===CA[o])}}}R9.prototype.defined=!0;function x$(e,t,n){n&&(e[t]=n)}function Pb(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new R9(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Tx(s)]=s,n[Tx(i.attribute)]=s}return new Ew(t,n,e.space)}const fX=Pb({properties:{ariaActiveDescendant:null,ariaAtomic:no,ariaAutoComplete:null,ariaBusy:no,ariaChecked:no,ariaColCount:jt,ariaColIndex:jt,ariaColSpan:jt,ariaControls:Wr,ariaCurrent:null,ariaDescribedBy:Wr,ariaDetails:null,ariaDisabled:no,ariaDropEffect:Wr,ariaErrorMessage:null,ariaExpanded:no,ariaFlowTo:Wr,ariaGrabbed:no,ariaHasPopup:null,ariaHidden:no,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Wr,ariaLevel:jt,ariaLive:null,ariaModal:no,ariaMultiLine:no,ariaMultiSelectable:no,ariaOrientation:null,ariaOwns:Wr,ariaPlaceholder:null,ariaPosInSet:jt,ariaPressed:no,ariaReadOnly:no,ariaRelevant:null,ariaRequired:no,ariaRoleDescription:Wr,ariaRowCount:jt,ariaRowIndex:jt,ariaRowSpan:jt,ariaSelected:no,ariaSetSize:jt,ariaSort:null,ariaValueMax:jt,ariaValueMin:jt,ariaValueNow:jt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mX(e,t){return t in e?e[t]:t}function pX(e,t){return mX(e,t.toLowerCase())}const Vbe=Pb({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:i0,acceptCharset:Wr,accessKey:Wr,action:null,allow:null,allowFullScreen:ws,allowPaymentRequest:ws,allowUserMedia:ws,alpha:ws,alt:null,as:null,async:ws,autoCapitalize:null,autoComplete:Wr,autoFocus:ws,autoPlay:ws,blocking:Wr,capture:null,charSet:null,checked:ws,cite:null,className:Wr,closedBy:null,colorSpace:null,cols:jt,colSpan:jt,command:null,commandFor:null,content:null,contentEditable:no,controls:ws,controlsList:Wr,coords:jt|i0,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ws,defer:ws,dir:null,dirName:null,disabled:ws,download:SA,draggable:no,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ws,formTarget:null,headers:Wr,height:jt,hidden:SA,high:jt,href:null,hrefLang:null,htmlFor:Wr,httpEquiv:Wr,id:null,imageSizes:null,imageSrcSet:null,inert:ws,inputMode:null,integrity:null,is:null,isMap:ws,itemId:null,itemProp:Wr,itemRef:Wr,itemScope:ws,itemType:Wr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ws,low:jt,manifest:null,max:null,maxLength:jt,media:null,method:null,min:null,minLength:jt,multiple:ws,muted:ws,name:null,nonce:null,noModule:ws,noValidate:ws,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:ws,optimum:jt,pattern:null,ping:Wr,placeholder:null,playsInline:ws,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ws,referrerPolicy:null,rel:Wr,required:ws,reversed:ws,rows:jt,rowSpan:jt,sandbox:Wr,scope:null,scoped:ws,seamless:ws,selected:ws,shadowRootClonable:ws,shadowRootCustomElementRegistry:ws,shadowRootDelegatesFocus:ws,shadowRootMode:null,shadowRootSerializable:ws,shape:null,size:jt,sizes:null,slot:null,span:jt,spellCheck:no,src:null,srcDoc:null,srcLang:null,srcSet:null,start:jt,step:null,style:null,tabIndex:jt,target:null,title:null,translate:null,type:null,typeMustMatch:ws,useMap:null,value:no,width:jt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Wr,axis:null,background:null,bgColor:null,border:jt,borderColor:null,bottomMargin:jt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ws,declare:ws,event:null,face:null,frame:null,frameBorder:null,hSpace:jt,leftMargin:jt,link:null,longDesc:null,lowSrc:null,marginHeight:jt,marginWidth:jt,noResize:ws,noHref:ws,noShade:ws,noWrap:ws,object:null,profile:null,prompt:null,rev:null,rightMargin:jt,rules:null,scheme:null,scrolling:no,standby:null,summary:null,text:null,topMargin:jt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:jt,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ws,disablePictureInPicture:ws,disableRemotePlayback:ws,exportParts:i0,part:Wr,prefix:null,property:null,results:jt,security:null,unselectable:null},space:"html",transform:pX}),Gbe=Pb({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:$l,accentHeight:jt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:jt,amplitude:jt,arabicForm:null,ascent:jt,attributeName:null,attributeType:null,azimuth:jt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:jt,by:null,calcMode:null,capHeight:jt,className:Wr,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:jt,diffuseConstant:jt,direction:null,display:null,dur:null,divisor:jt,dominantBaseline:null,download:ws,dx:null,dy:null,edgeMode:null,editable:null,elevation:jt,enableBackground:null,end:null,event:null,exponent:jt,externalResourcesRequired:null,fill:null,fillOpacity:jt,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:i0,g2:i0,glyphName:i0,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:jt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:jt,horizOriginX:jt,horizOriginY:jt,id:null,ideographic:jt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:jt,k:jt,k1:jt,k2:jt,k3:jt,k4:jt,kernelMatrix:$l,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:jt,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:jt,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:jt,overlineThickness:jt,paintOrder:null,panose1:null,path:null,pathLength:jt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Wr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:jt,pointsAtY:jt,pointsAtZ:jt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$l,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$l,rev:$l,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$l,requiredFeatures:$l,requiredFonts:$l,requiredFormats:$l,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:jt,specularExponent:jt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:jt,strikethroughThickness:jt,string:null,stroke:null,strokeDashArray:$l,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:jt,strokeOpacity:jt,strokeWidth:null,style:null,surfaceScale:jt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$l,tabIndex:jt,tableValues:null,target:null,targetX:jt,targetY:jt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$l,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:jt,underlineThickness:jt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:jt,values:null,vAlphabetic:jt,vMathematical:jt,vectorEffect:null,vHanging:jt,vIdeographic:jt,version:null,vertAdvY:jt,vertOriginX:jt,vertOriginY:jt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:jt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mX}),gX=Pb({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()}}),bX=Pb({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:pX}),yX=Pb({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Kbe={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"},Ybe=/[A-Z]/g,w$=/-[a-z]/g,Xbe=/^data[-\w.:]+$/i;function D9(e,t){const n=Tx(t);let s=t,r=jl;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Xbe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(w$,Jbe);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!w$.test(i)){let o=i.replace(Ybe,Qbe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=R9}return new r(s,t)}function Qbe(e){return"-"+e.toLowerCase()}function Jbe(e){return e.charAt(1).toUpperCase()}const L9=hX([fX,Vbe,gX,bX,yX],"html"),Ob=hX([fX,Gbe,gX,bX,yX],"svg");function k$(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function vX(e){return e.join(" ").trim()}var P9={},_$=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Zbe=/\n/g,eye=/^\s*/,tye=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,nye=/^:\s*/,sye=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,rye=/^[;\s]*/,iye=/^\s+|\s+$/g,oye=`
`,S$="/",C$="*",Bp="",aye="comment",lye="declaration";function cye(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function r(g){var b=g.match(Zbe);b&&(n+=b.length);var x=g.lastIndexOf(oye);s=~x?g.length-x:s+g.length}function i(){var g={line:n,column:s};return function(b){return b.position=new o(g),u(),b}}function o(g){this.start=g,this.end={line:n,column:s},this.source=t.source}o.prototype.content=e;function a(g){var b=new Error(t.source+":"+n+":"+s+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=s,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var x=b[0];return r(x),e=e.slice(x.length),b}}function u(){c(eye)}function d(g){var b;for(g=g||[];b=h();)b!==!1&&g.push(b);return g}function h(){var g=i();if(!(S$!=e.charAt(0)||C$!=e.charAt(1))){for(var b=2;Bp!=e.charAt(b)&&(C$!=e.charAt(b)||S$!=e.charAt(b+1));)++b;if(b+=2,Bp===e.charAt(b-1))return a("End of comment missing");var x=e.slice(2,b-2);return s+=2,r(x),e=e.slice(b),s+=2,g({type:aye,comment:x})}}function m(){var g=i(),b=c(tye);if(b){if(h(),!c(nye))return a("property missing ':'");var x=c(sye),y=g({type:lye,property:T$(b[0].replace(_$,Bp)),value:x?T$(x[0].replace(_$,Bp)):Bp});return c(rye),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 T$(e){return e?e.replace(iye,Bp):Bp}var uye=cye,dye=wS&&wS.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(P9,"__esModule",{value:!0});P9.default=fye;const hye=dye(uye);function fye(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,hye.default)(e),r=typeof t=="function";return s.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;r?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var fC={};Object.defineProperty(fC,"__esModule",{value:!0});fC.camelCase=void 0;var mye=/^--[a-zA-Z0-9_-]+$/,pye=/-([a-z])/g,gye=/^[^-]+$/,bye=/^-(webkit|moz|ms|o|khtml)-/,yye=/^-(ms)-/,vye=function(e){return!e||gye.test(e)||mye.test(e)},xye=function(e,t){return t.toUpperCase()},E$=function(e,t){return"".concat(t,"-")},wye=function(e,t){return t===void 0&&(t={}),vye(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(yye,E$):e=e.replace(bye,E$),e.replace(pye,xye))};fC.camelCase=wye;var kye=wS&&wS.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},_ye=kye(P9),Sye=fC;function TA(e,t){var n={};return!e||typeof e!="string"||(0,_ye.default)(e,function(s,r){s&&r&&(n[(0,Sye.camelCase)(s,t)]=r)}),n}TA.default=TA;var Cye=TA;const Tye=D3(Cye),xX=wX("end"),O9=wX("start");function wX(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function Eye(e){const t=O9(e),n=xX(e);if(t&&n)return{start:t,end:n}}function Gv(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?A$(e.position):"start"in e||"end"in e?A$(e):"line"in e||"column"in e?EA(e):""}function EA(e){return j$(e&&e.line)+":"+j$(e&&e.column)}function A$(e){return EA(e&&e.start)+"-"+EA(e&&e.end)}function j$(e){return e&&typeof e=="number"?e:1}class wa extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let r="",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"?r=t:!i.cause&&t&&(o=!0,r=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const a=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=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=Gv(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}}wa.prototype.file="";wa.prototype.name="";wa.prototype.reason="";wa.prototype.message="";wa.prototype.stack="";wa.prototype.column=void 0;wa.prototype.line=void 0;wa.prototype.ancestors=void 0;wa.prototype.cause=void 0;wa.prototype.fatal=void 0;wa.prototype.place=void 0;wa.prototype.ruleId=void 0;wa.prototype.source=void 0;const $9={}.hasOwnProperty,Aye=new Map,jye=/[A-Z]/g,Nye=new Set(["table","tbody","thead","tfoot","tr"]),Mye=new Set(["td","th"]),kX="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Iye(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=zye(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");s=Bye(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,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"?Ob:L9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=_X(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function _X(e,t,n){if(t.type==="element")return Rye(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Dye(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Pye(e,t,n);if(t.type==="mdxjsEsm")return Lye(e,t);if(t.type==="root")return Oye(e,t,n);if(t.type==="text")return $ye(e,t)}function Rye(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=Ob,e.schema=r),e.ancestors.push(t);const i=CX(e,t.tagName,!1),o=Fye(e,t);let a=z9(e,t);return Nye.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!hC(c):!0})),SX(e,o,i,t),B9(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Dye(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Ex(e,t.position)}function Lye(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ex(e,t.position)}function Pye(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=Ob,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:CX(e,t.name,!0),o=Hye(e,t),a=z9(e,t);return SX(e,o,i,t),B9(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Oye(e,t,n){const s={};return B9(s,z9(e,t)),e.create(t,e.Fragment,s,n)}function $ye(e,t){return t.value}function SX(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function B9(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Bye(e,t,n){return s;function s(r,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function zye(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),c=O9(s);return t(r,i,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Fye(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&$9.call(t.properties,r)){const i=qye(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Mye.has(t.tagName)?s=a:n[o]=a}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function Hye(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ex(e,t.position);else{const r=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const a=s.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else Ex(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function z9(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:Aye;for(;++s<t.children.length;){const i=t.children[s];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=r.get(c)||0;o=c+"-"+u,r.set(c,u+1)}}const a=_X(e,i,o);a!==void 0&&n.push(a)}return n}function qye(e,t,n){const s=D9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?dX(n):vX(n)),s.property==="style"){let r=typeof n=="object"?n:Uye(e,String(n));return e.stylePropertyNameCase==="css"&&(r=Wye(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?Kbe[s.property]||s.property:s.attribute,n]}}function Uye(e,t){try{return Tye(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new wa("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=kX+"#cannot-parse-style-attribute",r}}function CX(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let i=-1,o;for(;++i<r.length;){const a=y$(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}s=o}else s=y$(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return $9.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ex(e)}function Ex(e,t){const n=new wa("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=kX+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Wye(e){const t={};let n;for(n in e)$9.call(e,n)&&(t[Vye(n)]=e[n]);return t}function Vye(e){let t=e.replace(jye,Gye);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Gye(e){return"-"+e.toLowerCase()}const D6={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"]},Kye={};function F9(e,t){const n=Kye,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return TX(e,s,r)}function TX(e,t,n){if(Yye(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 N$(e.children,t,n)}return Array.isArray(e)?N$(e,t,n):""}function N$(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=TX(e[r],t,n);return s.join("")}function Yye(e){return!!(e&&typeof e=="object")}const M$=document.createElement("i");function H9(e){const t="&"+e+";";M$.innerHTML=t;const n=M$.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function tc(e,t,n,s){const r=e.length;let i=0,o;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Tc(e,t){return e.length>0?(tc(e,e.length,0,t),e):t}const I$={}.hasOwnProperty;function EX(e){const t={};let n=-1;for(;++n<e.length;)Xye(t,e[n]);return t}function Xye(e,t){let n;for(n in t){const r=(I$.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){I$.call(r,o)||(r[o]=[]);const a=i[o];Qye(r[o],Array.isArray(a)?a:a?[a]:[])}}}function Qye(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);tc(e,0,0,s)}function AX(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 au(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fa=Fm(/[A-Za-z]/),ba=Fm(/[\dA-Za-z]/),Jye=Fm(/[#-'*+\--9=?A-Z^-~]/);function c4(e){return e!==null&&(e<32||e===127)}const AA=Fm(/\d/),Zye=Fm(/[\dA-Fa-f]/),eve=Fm(/[!-/:-@[-`{-~]/);function zn(e){return e!==null&&e<-2}function Xr(e){return e!==null&&(e<0||e===32)}function Ys(e){return e===-2||e===-1||e===32}const mC=Fm(new RegExp("\\p{P}|\\p{S}","u")),m0=Fm(/\s/);function Fm(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function $b(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&ba(e.charCodeAt(n+1))&&ba(e.charCodeAt(n+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),r=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,n),encodeURIComponent(o)),s=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(s)}function Us(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Ys(c)?(e.enter(n),a(c)):t(c)}function a(c){return Ys(c)&&i++<r?(e.consume(c),a):(e.exit(n),t(c))}}const tve={tokenize:nve};function nve(e){const t=e.attempt(this.parser.constructs.contentInitial,s,r);let n;return t;function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Us(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return zn(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const sve={tokenize:rve},R$={tokenize:ive};function rve(e){const t=this,n=[];let s=0,r,i,o;return a;function a(w){if(s<n.length){const k=n[s];return t.containerState=k[1],e.attempt(k[0].continuation,c,u)(w)}return u(w)}function c(w){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&v();const k=t.events.length;let T=k,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}y(s);let _=k;for(;_<t.events.length;)t.events[_][1].end={...C},_++;return tc(t.events,T+1,0,t.events.slice(k)),t.events.length=_,u(w)}return a(w)}function u(w){if(s===n.length){if(!r)return m(w);if(r.currentConstruct&&r.currentConstruct.concrete)return g(w);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(R$,d,h)(w)}function d(w){return r&&v(),y(s),m(w)}function h(w){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,g(w)}function m(w){return t.containerState={},e.attempt(R$,p,g)(w)}function p(w){return s++,n.push([t.currentConstruct,t.containerState]),m(w)}function g(w){if(w===null){r&&v(),y(0),e.consume(w);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),b(w)}function b(w){if(w===null){x(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return zn(w)?(e.consume(w),x(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(w),b)}function x(w,k){const T=t.sliceStream(w);if(k&&T.push(null),w.previous=i,i&&(i.next=w),i=w,r.defineSkip(w.start),r.write(T),t.parser.lazy[w.start.line]){let C=r.events.length;for(;C--;)if(r.events[C][1].start.offset<o&&(!r.events[C][1].end||r.events[C][1].end.offset>o))return;const _=t.events.length;let S=_,D,E;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(D){E=t.events[S][1].end;break}D=!0}for(y(s),C=_;C<t.events.length;)t.events[C][1].end={...E},C++;tc(t.events,S+1,0,t.events.slice(_)),t.events.length=C}}function y(w){let k=n.length;for(;k-- >w;){const T=n[k];t.containerState=T[1],T[0].exit.call(t,e)}n.length=w}function v(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function ive(e,t,n){return Us(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nb(e){if(e===null||Xr(e)||m0(e))return 1;if(mC(e))return 2}function pC(e,t,n){const s=[];let r=-1;for(;++r<e.length;){const i=e[r].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const jA={name:"attention",resolveAll:ove,tokenize:ave};function ove(e,t){let n=-1,s,r,i,o,a,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[s][1].end},m={...e[n][1].start};D$(h,-c),D$(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=Tc(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=Tc(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Tc(u,pC(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=Tc(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Tc(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,tc(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function ave(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=nb(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===i)return e.consume(c),a;const u=e.exit("attentionSequence"),d=nb(c),h=!d||d===2&&r||n.includes(c),m=!r||r===2&&d||n.includes(s);return u._open=!!(i===42?h:h&&(r||!m)),u._close=!!(i===42?m:m&&(d||!h)),t(c)}}function D$(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lve={name:"autolink",tokenize:cve};function cve(e,t,n){let s=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Fa(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||ba(p)?(s=1,a(p)):u(p)}function a(p){return p===58?(e.consume(p),s=0,c):(p===43||p===45||p===46||ba(p))&&s++<32?(e.consume(p),a):(s=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||c4(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):Jye(p)?(e.consume(p),u):n(p)}function d(p){return ba(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),s=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||ba(p))&&s++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const Aw={partial:!0,tokenize:uve};function uve(e,t,n){return s;function s(i){return Ys(i)?Us(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||zn(i)?t(i):n(i)}}const jX={continuation:{tokenize:hve},exit:fve,name:"blockQuote",tokenize:dve};function dve(e,t,n){const s=this;return r;function r(o){if(o===62){const a=s.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Ys(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function hve(e,t,n){const s=this;return r;function r(o){return Ys(o)?Us(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(jX,t,n)(o)}}function fve(e){e.exit("blockQuote")}const NX={name:"characterEscape",tokenize:mve};function mve(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),r}function r(i){return eve(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const MX={name:"characterReference",tokenize:pve};function pve(e,t,n){const s=this;let r=0,i,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=ba,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Zye,d):(e.enter("characterReferenceValue"),i=7,o=AA,d(h))}function d(h){if(h===59&&r){const m=e.exit("characterReferenceValue");return o===ba&&!H9(s.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&r++<i?(e.consume(h),d):n(h)}}const L$={partial:!0,tokenize:bve},P$={concrete:!0,name:"codeFenced",tokenize:gve};function gve(e,t,n){const s=this,r={partial:!0,tokenize:T};let i=0,o=0,a;return c;function c(C){return u(C)}function u(C){const _=s.events[s.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===a?(o++,e.consume(C),d):o<3?n(C):(e.exit("codeFencedFenceSequence"),Ys(C)?Us(e,h,"whitespace")(C):h(C))}function h(C){return C===null||zn(C)?(e.exit("codeFencedFence"),s.interrupt?t(C):e.check(L$,b,k)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||zn(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):Ys(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Us(e,p,"whitespace")(C)):C===96&&C===a?n(C):(e.consume(C),m)}function p(C){return C===null||zn(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||zn(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===a?n(C):(e.consume(C),g)}function b(C){return e.attempt(r,k,x)(C)}function x(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),y}function y(C){return i>0&&Ys(C)?Us(e,v,"linePrefix",i+1)(C):v(C)}function v(C){return C===null||zn(C)?e.check(L$,b,k)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||zn(C)?(e.exit("codeFlowValue"),v(C)):(e.consume(C),w)}function k(C){return e.exit("codeFenced"),t(C)}function T(C,_,S){let D=0;return E;function E(A){return C.enter("lineEnding"),C.consume(A),C.exit("lineEnding"),B}function B(A){return C.enter("codeFencedFence"),Ys(A)?Us(C,I,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):I(A)}function I(A){return A===a?(C.enter("codeFencedFenceSequence"),L(A)):S(A)}function L(A){return A===a?(D++,C.consume(A),L):D>=o?(C.exit("codeFencedFenceSequence"),Ys(A)?Us(C,O,"whitespace")(A):O(A)):S(A)}function O(A){return A===null||zn(A)?(C.exit("codeFencedFence"),_(A)):S(A)}}}function bve(e,t,n){const s=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}const L6={name:"codeIndented",tokenize:vve},yve={partial:!0,tokenize:xve};function vve(e,t,n){const s=this;return r;function r(u){return e.enter("codeIndented"),Us(e,i,"linePrefix",5)(u)}function i(u){const d=s.events[s.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):zn(u)?e.attempt(yve,o,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||zn(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function xve(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):zn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):Us(e,i,"linePrefix",5)(o)}function i(o){const a=s.events[s.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):zn(o)?r(o):n(o)}}const wve={name:"codeText",previous:_ve,resolve:kve,tokenize:Sve};function kve(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="codeTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function _ve(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Sve(e,t,n){let s=0,r,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),s++,a):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(i=e.enter("codeTextSequence"),r=0,d(h)):zn(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||zn(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class Cve{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 s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const r=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return s&&Fy(this.left,s),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),Fy(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fy(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);Fy(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fy(this.left,n.reverse())}}}function Fy(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 IX(e){const t={};let n=-1,s,r,i,o,a,c,u;const d=new Cve(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(s=d.get(n),n&&s[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=s[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(s[0]==="enter")s[1].contentType&&(Object.assign(t,Tve(d,n)),n=t[n],u=!0);else if(s[1]._container){for(i=n,r=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(d.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(s[1].end={...d.get(r)[1].start},a=d.slice(r,n),a.unshift(s),d.splice(r,n-r+1,a))}}return tc(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Tve(e,t){const n=e.get(t)[1],s=e.get(t)[2];let r=t-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],u={};let d,h,m=-1,p=n,g=0,b=0;const x=[b];for(;p;){for(;e.get(++r)[1]!==p;);i.push(r),p._tokenizer||(d=s.sliceStream(p),p.next||d.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(b=m+1,x.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):x.pop(),m=x.length;m--;){const y=a.slice(x[m],x[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 Eve={resolve:jve,tokenize:Nve},Ave={partial:!0,tokenize:Mve};function jve(e){return IX(e),e}function Nve(e,t){let n;return s;function s(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(a)}function r(a){return a===null?i(a):zn(a)?e.check(Ave,o,i)(a):(e.consume(a),r)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function Mve(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Us(e,i,"linePrefix")}function i(o){if(o===null||zn(o))return n(o);const a=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function RX(e,t,n,s,r,i,o,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(y),e.exit(i),m):y===null||y===32||y===41||c4(y)?n(y):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(y))}function m(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(a),m(y)):y===null||y===60||zn(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||Xr(y))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(y)):d<u&&y===40?(e.consume(y),d++,b):y===41?(e.consume(y),d--,b):y===null||y===32||y===40||c4(y)?n(y):(e.consume(y),y===92?x:b)}function x(y){return y===40||y===41||y===92?(e.consume(y),b):b(y)}}function DX(e,t,n,s,r,i){const o=this;let a=0,c;return u;function u(p){return e.enter(s),e.enter(r),e.consume(p),e.exit(r),e.enter(i),d}function d(p){return a>999||p===null||p===91||p===93&&!c||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(r),e.consume(p),e.exit(r),e.exit(s),t):zn(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||zn(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Ys(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}}function LX(e,t,n,s,r,i){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(s),e.enter(r),e.consume(m),e.exit(r),o=m===40?41:m,c):n(m)}function c(m){return m===o?(e.enter(r),e.consume(m),e.exit(r),e.exit(s),t):(e.enter(i),u(m))}function u(m){return m===o?(e.exit(i),c(o)):m===null?n(m):zn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Us(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||zn(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:d)}function h(m){return m===o||m===92?(e.consume(m),d):d(m)}}function Kv(e,t){let n;return s;function s(r){return zn(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):Ys(r)?Us(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const Ive={name:"definition",tokenize:Dve},Rve={partial:!0,tokenize:Lve};function Dve(e,t,n){const s=this;let r;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return DX.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return r=au(s.sliceSerialize(s.events[s.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 Xr(p)?Kv(e,u)(p):u(p)}function u(p){return RX(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Rve,h,h)(p)}function h(p){return Ys(p)?Us(e,m,"whitespace")(p):m(p)}function m(p){return p===null||zn(p)?(e.exit("definition"),s.parser.defined.push(r),t(p)):n(p)}}function Lve(e,t,n){return s;function s(a){return Xr(a)?Kv(e,r)(a):n(a)}function r(a){return LX(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Ys(a)?Us(e,o,"whitespace")(a):o(a)}function o(a){return a===null||zn(a)?t(a):n(a)}}const Pve={name:"hardBreakEscape",tokenize:Ove};function Ove(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return zn(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const $ve={name:"headingAtx",resolve:Bve,tokenize:zve};function Bve(e,t){let n=e.length-2,s=3,r,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(r={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},tc(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function zve(e,t,n){let s=0;return r;function r(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&s++<6?(e.consume(d),o):d===null||Xr(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||zn(d)?(e.exit("atxHeading"),t(d)):Ys(d)?Us(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||Xr(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const Fve=["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"],O$=["pre","script","style","textarea"],Hve={concrete:!0,name:"htmlFlow",resolveTo:Wve,tokenize:Vve},qve={partial:!0,tokenize:Kve},Uve={partial:!0,tokenize:Gve};function Wve(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 Vve(e,t,n){const s=this;let r,i,o,a,c;return u;function u(R){return d(R)}function d(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),m):R===47?(e.consume(R),i=!0,b):R===63?(e.consume(R),r=3,s.interrupt?t:M):Fa(R)?(e.consume(R),o=String.fromCharCode(R),x):n(R)}function m(R){return R===45?(e.consume(R),r=2,p):R===91?(e.consume(R),r=5,a=0,g):Fa(R)?(e.consume(R),r=4,s.interrupt?t:M):n(R)}function p(R){return R===45?(e.consume(R),s.interrupt?t:M):n(R)}function g(R){const re="CDATA[";return R===re.charCodeAt(a++)?(e.consume(R),a===re.length?s.interrupt?t:I:g):n(R)}function b(R){return Fa(R)?(e.consume(R),o=String.fromCharCode(R),x):n(R)}function x(R){if(R===null||R===47||R===62||Xr(R)){const re=R===47,Z=o.toLowerCase();return!re&&!i&&O$.includes(Z)?(r=1,s.interrupt?t(R):I(R)):Fve.includes(o.toLowerCase())?(r=6,re?(e.consume(R),y):s.interrupt?t(R):I(R)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(R):i?v(R):w(R))}return R===45||ba(R)?(e.consume(R),o+=String.fromCharCode(R),x):n(R)}function y(R){return R===62?(e.consume(R),s.interrupt?t:I):n(R)}function v(R){return Ys(R)?(e.consume(R),v):E(R)}function w(R){return R===47?(e.consume(R),E):R===58||R===95||Fa(R)?(e.consume(R),k):Ys(R)?(e.consume(R),w):E(R)}function k(R){return R===45||R===46||R===58||R===95||ba(R)?(e.consume(R),k):T(R)}function T(R){return R===61?(e.consume(R),C):Ys(R)?(e.consume(R),T):w(R)}function C(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),c=R,_):Ys(R)?(e.consume(R),C):S(R)}function _(R){return R===c?(e.consume(R),c=null,D):R===null||zn(R)?n(R):(e.consume(R),_)}function S(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Xr(R)?T(R):(e.consume(R),S)}function D(R){return R===47||R===62||Ys(R)?w(R):n(R)}function E(R){return R===62?(e.consume(R),B):n(R)}function B(R){return R===null||zn(R)?I(R):Ys(R)?(e.consume(R),B):n(R)}function I(R){return R===45&&r===2?(e.consume(R),$):R===60&&r===1?(e.consume(R),q):R===62&&r===4?(e.consume(R),ee):R===63&&r===3?(e.consume(R),M):R===93&&r===5?(e.consume(R),H):zn(R)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(qve,V,L)(R)):R===null||zn(R)?(e.exit("htmlFlowData"),L(R)):(e.consume(R),I)}function L(R){return e.check(Uve,O,V)(R)}function O(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),A}function A(R){return R===null||zn(R)?L(R):(e.enter("htmlFlowData"),I(R))}function $(R){return R===45?(e.consume(R),M):I(R)}function q(R){return R===47?(e.consume(R),o="",U):I(R)}function U(R){if(R===62){const re=o.toLowerCase();return O$.includes(re)?(e.consume(R),ee):I(R)}return Fa(R)&&o.length<8?(e.consume(R),o+=String.fromCharCode(R),U):I(R)}function H(R){return R===93?(e.consume(R),M):I(R)}function M(R){return R===62?(e.consume(R),ee):R===45&&r===2?(e.consume(R),M):I(R)}function ee(R){return R===null||zn(R)?(e.exit("htmlFlowData"),V(R)):(e.consume(R),ee)}function V(R){return e.exit("htmlFlow"),t(R)}}function Gve(e,t,n){const s=this;return r;function r(o){return zn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function Kve(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Aw,t,n)}}const Yve={name:"htmlText",tokenize:Xve};function Xve(e,t,n){const s=this;let r,i,o;return a;function a(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),c}function c(M){return M===33?(e.consume(M),u):M===47?(e.consume(M),T):M===63?(e.consume(M),w):Fa(M)?(e.consume(M),S):n(M)}function u(M){return M===45?(e.consume(M),d):M===91?(e.consume(M),i=0,g):Fa(M)?(e.consume(M),v):n(M)}function d(M){return M===45?(e.consume(M),p):n(M)}function h(M){return M===null?n(M):M===45?(e.consume(M),m):zn(M)?(o=h,q(M)):(e.consume(M),h)}function m(M){return M===45?(e.consume(M),p):h(M)}function p(M){return M===62?$(M):M===45?m(M):h(M)}function g(M){const ee="CDATA[";return M===ee.charCodeAt(i++)?(e.consume(M),i===ee.length?b:g):n(M)}function b(M){return M===null?n(M):M===93?(e.consume(M),x):zn(M)?(o=b,q(M)):(e.consume(M),b)}function x(M){return M===93?(e.consume(M),y):b(M)}function y(M){return M===62?$(M):M===93?(e.consume(M),y):b(M)}function v(M){return M===null||M===62?$(M):zn(M)?(o=v,q(M)):(e.consume(M),v)}function w(M){return M===null?n(M):M===63?(e.consume(M),k):zn(M)?(o=w,q(M)):(e.consume(M),w)}function k(M){return M===62?$(M):w(M)}function T(M){return Fa(M)?(e.consume(M),C):n(M)}function C(M){return M===45||ba(M)?(e.consume(M),C):_(M)}function _(M){return zn(M)?(o=_,q(M)):Ys(M)?(e.consume(M),_):$(M)}function S(M){return M===45||ba(M)?(e.consume(M),S):M===47||M===62||Xr(M)?D(M):n(M)}function D(M){return M===47?(e.consume(M),$):M===58||M===95||Fa(M)?(e.consume(M),E):zn(M)?(o=D,q(M)):Ys(M)?(e.consume(M),D):$(M)}function E(M){return M===45||M===46||M===58||M===95||ba(M)?(e.consume(M),E):B(M)}function B(M){return M===61?(e.consume(M),I):zn(M)?(o=B,q(M)):Ys(M)?(e.consume(M),B):D(M)}function I(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),r=M,L):zn(M)?(o=I,q(M)):Ys(M)?(e.consume(M),I):(e.consume(M),O)}function L(M){return M===r?(e.consume(M),r=void 0,A):M===null?n(M):zn(M)?(o=L,q(M)):(e.consume(M),L)}function O(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Xr(M)?D(M):(e.consume(M),O)}function A(M){return M===47||M===62||Xr(M)?D(M):n(M)}function $(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function q(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),U}function U(M){return Ys(M)?Us(e,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):H(M)}function H(M){return e.enter("htmlTextData"),o(M)}}const q9={name:"labelEnd",resolveAll:exe,resolveTo:txe,tokenize:nxe},Qve={tokenize:sxe},Jve={tokenize:rxe},Zve={tokenize:ixe};function exe(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const r=s.type==="labelImage"?4:2;s.type="data",t+=r}}return e.length!==n.length&&tc(e,0,e.length,n),e}function txe(e,t){let n=e.length,s=0,r,i,o,a;for(;n--;)if(r=e[n][1],i){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[n][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(i=n,r.type!=="labelLink")){s=2;break}}else r.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+s+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=Tc(a,e.slice(i+1,i+s+3)),a=Tc(a,[["enter",d,t]]),a=Tc(a,pC(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=Tc(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=Tc(a,e.slice(o+1)),a=Tc(a,[["exit",c,t]]),tc(e,i,e.length,a),e}function nxe(e,t,n){const s=this;let r=s.events.length,i,o;for(;r--;)if((s.events[r][1].type==="labelImage"||s.events[r][1].type==="labelLink")&&!s.events[r][1]._balanced){i=s.events[r][1];break}return a;function a(m){return i?i._inactive?h(m):(o=s.parser.defined.includes(au(s.sliceSerialize({start:i.end,end:s.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(Qve,d,o?d:h)(m):m===91?e.attempt(Jve,d,o?u:h)(m):o?d(m):h(m)}function u(m){return e.attempt(Zve,d,h)(m)}function d(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function sxe(e,t,n){return s;function s(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),r}function r(h){return Xr(h)?Kv(e,i)(h):i(h)}function i(h){return h===41?d(h):RX(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Xr(h)?Kv(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?LX(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Xr(h)?Kv(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function rxe(e,t,n){const s=this;return r;function r(a){return DX.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(au(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function ixe(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),r}function r(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const oxe={name:"labelStartImage",resolveAll:q9.resolveAll,tokenize:axe};function axe(e,t,n){const s=this;return r;function r(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(a):t(a)}}const lxe={name:"labelStartLink",resolveAll:q9.resolveAll,tokenize:cxe};function cxe(e,t,n){const s=this;return r;function r(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 s.parser.constructs?n(o):t(o)}}const P6={name:"lineEnding",tokenize:uxe};function uxe(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Us(e,t,"linePrefix")}}const V2={name:"thematicBreak",tokenize:dxe};function dxe(e,t,n){let s=0,r;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return r=u,a(u)}function a(u){return u===r?(e.enter("thematicBreakSequence"),c(u)):s>=3&&(u===null||zn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),Ys(u)?Us(e,a,"whitespace")(u):a(u))}}const ol={continuation:{tokenize:pxe},exit:bxe,name:"list",tokenize:mxe},hxe={partial:!0,tokenize:yxe},fxe={partial:!0,tokenize:gxe};function mxe(e,t,n){const s=this,r=s.events[s.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return a;function a(p){const g=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:AA(p)){if(s.containerState.type||(s.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(V2,n,u)(p):u(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return AA(p)&&++o<10?(e.consume(p),c):(!s.interrupt||o<2)&&(s.containerState.marker?p===s.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"),s.containerState.marker=s.containerState.marker||p,e.check(Aw,s.interrupt?n:d,e.attempt(hxe,m,h))}function d(p){return s.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return Ys(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function pxe(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Aw,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Us(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!Ys(a)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(a)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(fxe,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,Us(e,e.attempt(ol,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function gxe(e,t,n){const s=this;return Us(e,r,"listItemIndent",s.containerState.size+1);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):n(i)}}function bxe(e){e.exit(this.containerState.type)}function yxe(e,t,n){const s=this;return Us(e,r,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(i){const o=s.events[s.events.length-1];return!Ys(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const $$={name:"setextUnderline",resolveTo:vxe,tokenize:xxe};function vxe(e,t){let n=e.length,s,r,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(r=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[s][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function xxe(e,t,n){const s=this;let r;return i;function i(u){let d=s.events.length,h;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){h=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||h)?(e.enter("setextHeadingLine"),r=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===r?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Ys(u)?Us(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||zn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const wxe={tokenize:kxe};function kxe(e){const t=this,n=e.attempt(Aw,s,e.attempt(this.parser.constructs.flowInitial,r,Us(e,e.attempt(this.parser.constructs.flow,r,e.attempt(Eve,r)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const _xe={resolveAll:OX()},Sxe=PX("string"),Cxe=PX("text");function PX(e){return{resolveAll:OX(e==="text"?Txe:void 0),tokenize:t};function t(n){const s=this,r=this.parser.constructs[e],i=n.attempt(r,o,a);return o;function o(d){return u(d)?i(d):a(d)}function a(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 h=r[d];let m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(s,s.previous))return!0}return!1}}}function OX(e){return t;function t(n,s){let r=-1,i;for(;++r<=n.length;)i===void 0?n[r]&&n[r][1].type==="data"&&(i=r,r++):(!n[r]||n[r][1].type!=="data")&&(r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(n,s):n}}function Txe(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 s=e[n-1][1],r=t.sliceStream(s);let i=r.length,o=-1,a=0,c;for(;i--;){const u=r[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)c=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-a,offset:s.end.offset-a},end:{...s.end}};s.end={...u.start},s.start.offset===s.end.offset?Object.assign(s,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Exe={42:ol,43:ol,45:ol,48:ol,49:ol,50:ol,51:ol,52:ol,53:ol,54:ol,55:ol,56:ol,57:ol,62:jX},Axe={91:Ive},jxe={[-2]:L6,[-1]:L6,32:L6},Nxe={35:$ve,42:V2,45:[$$,V2],60:Hve,61:$$,95:V2,96:P$,126:P$},Mxe={38:MX,92:NX},Ixe={[-5]:P6,[-4]:P6,[-3]:P6,33:oxe,38:MX,42:jA,60:[lve,Yve],91:lxe,92:[Pve,NX],93:q9,95:jA,96:wve},Rxe={null:[jA,_xe]},Dxe={null:[42,95]},Lxe={null:[]},Pxe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Dxe,contentInitial:Axe,disable:Lxe,document:Exe,flow:Nxe,flowInitial:jxe,insideSpan:Rxe,string:Mxe,text:Ixe},Symbol.toStringTag,{value:"Module"}));function Oxe(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},i=[];let o=[],a=[];const c={attempt:_(T),check:_(C),consume:v,enter:w,exit:k,interrupt:_(C,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:m,sliceStream:p,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function h(B){return o=Tc(o,B),x(),o[o.length-1]!==null?[]:(S(t,0),u.events=pC(i,u.events,u),u.events)}function m(B,I){return Bxe(p(B),I)}function p(B){return $xe(o,B)}function g(){const{_bufferIndex:B,_index:I,line:L,column:O,offset:A}=s;return{_bufferIndex:B,_index:I,line:L,column:O,offset:A}}function b(B){r[B.line]=B.column,E()}function x(){let B;for(;s._index<o.length;){const I=o[s._index];if(typeof I=="string")for(B=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===B&&s._bufferIndex<I.length;)y(I.charCodeAt(s._bufferIndex));else y(I)}}function y(B){d=d(B)}function v(B){zn(B)?(s.line++,s.column=1,s.offset+=B===-3?2:1,E()):B!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),u.previous=B}function w(B,I){const L=I||{};return L.type=B,L.start=g(),u.events.push(["enter",L,u]),a.push(L),L}function k(B){const I=a.pop();return I.end=g(),u.events.push(["exit",I,u]),I}function T(B,I){S(B,I.from)}function C(B,I){I.restore()}function _(B,I){return L;function L(O,A,$){let q,U,H,M;return Array.isArray(O)?V(O):"tokenize"in O?V([O]):ee(O);function ee(K){return Y;function Y(ae){const le=ae!==null&&K[ae],te=ae!==null&&K.null,z=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(te)?te:te?[te]:[]];return V(z)(ae)}}function V(K){return q=K,U=0,K.length===0?$:R(K[U])}function R(K){return Y;function Y(ae){return M=D(),H=K,K.partial||(u.currentConstruct=K),K.name&&u.parser.constructs.disable.null.includes(K.name)?Z():K.tokenize.call(I?Object.assign(Object.create(u),I):u,c,re,Z)(ae)}}function re(K){return B(H,M),A}function Z(K){return M.restore(),++U<q.length?R(q[U]):$}}}function S(B,I){B.resolveAll&&!i.includes(B)&&i.push(B),B.resolve&&tc(u.events,I,u.events.length-I,B.resolve(u.events.slice(I),u)),B.resolveTo&&(u.events=B.resolveTo(u.events,u))}function D(){const B=g(),I=u.previous,L=u.currentConstruct,O=u.events.length,A=Array.from(a);return{from:O,restore:$};function $(){s=B,u.previous=I,u.currentConstruct=L,u.events.length=O,a=A,E()}}function E(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function $xe(e,t){const n=t.start._index,s=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex;let o;if(n===r)o=[e[n].slice(s,i)];else{if(o=e.slice(n,r),s>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(s):o.shift()}i>0&&o.push(e[r].slice(0,i))}return o}function Bxe(e,t){let n=-1;const s=[];let r;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&&r)continue;o=" ";break}default:o=String.fromCharCode(i)}r=i===-2,s.push(o)}return s.join("")}function zxe(e){const s={constructs:EX([Pxe,...(e||{}).extensions||[]]),content:r(tve),defined:[],document:r(sve),flow:r(wxe),lazy:{},string:r(Sxe),text:r(Cxe)};return s;function r(i){return o;function o(a){return Oxe(s,i,a)}}}function Fxe(e){for(;!IX(e););return e}const B$=/[\0\t\n\r]/g;function Hxe(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const c=[];let u,d,h,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(B$.lastIndex=h,u=B$.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(h);break}if(p===10&&h===m&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),h<m&&(c.push(i.slice(h,m)),e+=m-h),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:s=!0,e=1}h=m+1}return a&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const qxe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Uxe(e){return e.replace(qxe,Wxe)}function Wxe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return AX(n.slice(i?2:1),i?16:10)}return H9(n)||e}const $X={}.hasOwnProperty;function Vxe(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Gxe(n)(Fxe(zxe(n).document().write(Hxe()(e,t,!0))))}function Gxe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Et),autolinkProtocol:D,autolinkEmail:D,atxHeading:i(ie),blockQuote:i(te),characterEscape:D,characterReference:D,codeFenced:i(z),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(z,o),codeText:i(X,o),codeTextData:D,data:D,codeFlowValue:D,definition:i(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(xe),hardBreakEscape:i(Ce),hardBreakTrailing:i(Ce),htmlFlow:i(Ke,o),htmlFlowData:D,htmlText:i(Ke,o),htmlTextData:D,image:i(ut),label:o,link:i(Et),listItem:i(xt),listItemValue:m,listOrdered:i(st,h),listUnordered:i(st),paragraph:i(He),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ie),strong:i(pn),thematicBreak:i(It)},exit:{atxHeading:c(),atxHeadingSequence:T,autolink:c(),autolinkEmail:le,autolinkProtocol:ae,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:K,characterReference:Y,codeFenced:c(x),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:E,codeIndented:c(y),codeText:c(A),codeTextData:E,data:E,definition:c(),definitionDestinationString:k,definitionLabelString:v,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(I),hardBreakTrailing:c(I),htmlFlow:c(L),htmlFlowData:E,htmlText:c(O),htmlTextData:E,image:c(q),label:H,labelText:U,lineEnding:B,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:re,resourceDestinationString:M,resourceTitleString:ee,resource:V,setextHeading:c(S),setextHeadingLineSequence:_,setextHeadingText:C,strong:c(),thematicBreak:c()}};BX(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(me){let $e={type:"root",children:[]};const yt={stack:[$e],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},Me=[];let Le=-1;for(;++Le<me.length;)if(me[Le][1].type==="listOrdered"||me[Le][1].type==="listUnordered")if(me[Le][0]==="enter")Me.push(Le);else{const vn=Me.pop();Le=r(me,vn,Le)}for(Le=-1;++Le<me.length;){const vn=t[me[Le][0]];$X.call(vn,me[Le][1].type)&&vn[me[Le][1].type].call(Object.assign({sliceSerialize:me[Le][2].sliceSerialize},yt),me[Le][1])}if(yt.tokenStack.length>0){const vn=yt.tokenStack[yt.tokenStack.length-1];(vn[1]||z$).call(yt,void 0,vn[0])}for($e.position={start:mf(me.length>0?me[0][1].start:{line:1,column:1,offset:0}),end:mf(me.length>0?me[me.length-2][1].end:{line:1,column:1,offset:0})},Le=-1;++Le<t.transforms.length;)$e=t.transforms[Le]($e)||$e;return $e}function r(me,$e,yt){let Me=$e-1,Le=-1,vn=!1,ge,Rt,ht,gn;for(;++Me<=yt;){const Ue=me[Me];switch(Ue[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ue[0]==="enter"?Le++:Le--,gn=void 0;break}case"lineEndingBlank":{Ue[0]==="enter"&&(ge&&!gn&&!Le&&!ht&&(ht=Me),gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gn=void 0}if(!Le&&Ue[0]==="enter"&&Ue[1].type==="listItemPrefix"||Le===-1&&Ue[0]==="exit"&&(Ue[1].type==="listUnordered"||Ue[1].type==="listOrdered")){if(ge){let De=Me;for(Rt=void 0;De--;){const Re=me[De];if(Re[1].type==="lineEnding"||Re[1].type==="lineEndingBlank"){if(Re[0]==="exit")continue;Rt&&(me[Rt][1].type="lineEndingBlank",vn=!0),Re[1].type="lineEnding",Rt=De}else if(!(Re[1].type==="linePrefix"||Re[1].type==="blockQuotePrefix"||Re[1].type==="blockQuotePrefixWhitespace"||Re[1].type==="blockQuoteMarker"||Re[1].type==="listItemIndent"))break}ht&&(!Rt||ht<Rt)&&(ge._spread=!0),ge.end=Object.assign({},Rt?me[Rt][1].start:Ue[1].end),me.splice(Rt||Me,0,["exit",ge,Ue[2]]),Me++,yt++}if(Ue[1].type==="listItemPrefix"){const De={type:"listItem",_spread:!1,start:Object.assign({},Ue[1].start),end:void 0};ge=De,me.splice(Me,0,["enter",De,Ue[2]]),Me++,yt++,ht=void 0,gn=!0}}}return me[$e][1]._spread=vn,yt}function i(me,$e){return yt;function yt(Me){a.call(this,me(Me),Me),$e&&$e.call(this,Me)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(me,$e,yt){this.stack[this.stack.length-1].children.push(me),this.stack.push(me),this.tokenStack.push([$e,yt||void 0]),me.position={start:mf($e.start),end:void 0}}function c(me){return $e;function $e(yt){me&&me.call(this,yt),u.call(this,yt)}}function u(me,$e){const yt=this.stack.pop(),Me=this.tokenStack.pop();if(Me)Me[0].type!==me.type&&($e?$e.call(this,me,Me[0]):(Me[1]||z$).call(this,me,Me[0]));else throw new Error("Cannot close `"+me.type+"` ("+Gv({start:me.start,end:me.end})+"): it’s not open");yt.position.end=mf(me.end)}function d(){return F9(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(me){if(this.data.expectingFirstListItemValue){const $e=this.stack[this.stack.length-2];$e.start=Number.parseInt(this.sliceSerialize(me),10),this.data.expectingFirstListItemValue=void 0}}function p(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.lang=me}function g(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.meta=me}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.value=me.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.value=me.replace(/(\r?\n|\r)$/g,"")}function v(me){const $e=this.resume(),yt=this.stack[this.stack.length-1];yt.label=$e,yt.identifier=au(this.sliceSerialize(me)).toLowerCase()}function w(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.title=me}function k(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.url=me}function T(me){const $e=this.stack[this.stack.length-1];if(!$e.depth){const yt=this.sliceSerialize(me).length;$e.depth=yt}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function _(me){const $e=this.stack[this.stack.length-1];$e.depth=this.sliceSerialize(me).codePointAt(0)===61?1:2}function S(){this.data.setextHeadingSlurpLineEnding=void 0}function D(me){const yt=this.stack[this.stack.length-1].children;let Me=yt[yt.length-1];(!Me||Me.type!=="text")&&(Me=Yt(),Me.position={start:mf(me.start),end:void 0},yt.push(Me)),this.stack.push(Me)}function E(me){const $e=this.stack.pop();$e.value+=this.sliceSerialize(me),$e.position.end=mf(me.end)}function B(me){const $e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const yt=$e.children[$e.children.length-1];yt.position.end=mf(me.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes($e.type)&&(D.call(this,me),E.call(this,me))}function I(){this.data.atHardBreak=!0}function L(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.value=me}function O(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.value=me}function A(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.value=me}function $(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const $e=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=$e,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function q(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const $e=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=$e,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function U(me){const $e=this.sliceSerialize(me),yt=this.stack[this.stack.length-2];yt.label=Uxe($e),yt.identifier=au($e).toLowerCase()}function H(){const me=this.stack[this.stack.length-1],$e=this.resume(),yt=this.stack[this.stack.length-1];if(this.data.inReference=!0,yt.type==="link"){const Me=me.children;yt.children=Me}else yt.alt=$e}function M(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.url=me}function ee(){const me=this.resume(),$e=this.stack[this.stack.length-1];$e.title=me}function V(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function re(me){const $e=this.resume(),yt=this.stack[this.stack.length-1];yt.label=$e,yt.identifier=au(this.sliceSerialize(me)).toLowerCase(),this.data.referenceType="full"}function Z(me){this.data.characterReferenceType=me.type}function K(me){const $e=this.sliceSerialize(me),yt=this.data.characterReferenceType;let Me;yt?(Me=AX($e,yt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Me=H9($e);const Le=this.stack[this.stack.length-1];Le.value+=Me}function Y(me){const $e=this.stack.pop();$e.position.end=mf(me.end)}function ae(me){E.call(this,me);const $e=this.stack[this.stack.length-1];$e.url=this.sliceSerialize(me)}function le(me){E.call(this,me);const $e=this.stack[this.stack.length-1];$e.url="mailto:"+this.sliceSerialize(me)}function te(){return{type:"blockquote",children:[]}}function z(){return{type:"code",lang:null,meta:null,value:""}}function X(){return{type:"inlineCode",value:""}}function fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xe(){return{type:"emphasis",children:[]}}function ie(){return{type:"heading",depth:0,children:[]}}function Ce(){return{type:"break"}}function Ke(){return{type:"html",value:""}}function ut(){return{type:"image",title:null,url:"",alt:null}}function Et(){return{type:"link",title:null,url:"",children:[]}}function st(me){return{type:"list",ordered:me.type==="listOrdered",start:null,spread:me._spread,children:[]}}function xt(me){return{type:"listItem",spread:me._spread,checked:null,children:[]}}function He(){return{type:"paragraph",children:[]}}function pn(){return{type:"strong",children:[]}}function Yt(){return{type:"text",value:""}}function It(){return{type:"thematicBreak"}}}function mf(e){return{line:e.line,column:e.column,offset:e.offset}}function BX(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?BX(e,s):Kxe(e,s)}}function Kxe(e,t){let n;for(n in t)if($X.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function z$(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Gv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Gv({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Gv({start:t.start,end:t.end})+") is still open")}function Yxe(e){const t=this;t.parser=n;function n(s){return Vxe(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Xxe(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 Qxe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function Jxe(e,t){const n=t.value?t.value+`
`:"",s={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(s.className=["language-"+r[0]]);let i={type:"element",tagName:"code",properties:s,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 Zxe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ewe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function twe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=$b(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,a=e.footnoteCounts.get(s);a===void 0?(a=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(s,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),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 nwe(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 swe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function zX(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const r=e.all(t),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=s:r.push({type:"text",value:s}),r}function rwe(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return zX(e,t);const r={src:$b(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function iwe(e,t){const n={src:$b(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 s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function owe(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function awe(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return zX(e,t);const r={href:$b(s.url||"")};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function lwe(e,t){const n={href:$b(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function cwe(e,t,n){const s=e.all(t),r=n?uwe(n):FX(t),i={},o=[];if(typeof t.checked=="boolean"){const d=s[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},s.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<s.length;){const d=s[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!r?o.push(...d.children):o.push(d)}const c=s[s.length-1];c&&(r||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 uwe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=FX(n[s])}return t}function FX(e){const t=e.spread;return t??e.children.length>1}function dwe(e,t){const n={},s=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<s.length;){const o=s[r];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(s,!0)};return e.patch(t,i),e.applyData(t,i)}function hwe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fwe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function mwe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pwe(e,t){const n=e.all(t),s=n.shift(),r=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),r.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=O9(t.children[1]),c=xX(t.children[t.children.length-1]);a&&c&&(o.position={start:a,end:c}),r.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function gwe(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],m={},p=o?o[c]:void 0;p&&(m.align=p);let g={type:"element",tagName:i,properties:m,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,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 bwe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const F$=9,H$=32;function ywe(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(q$(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(q$(t.slice(r),r>0,!1)),i.join("")}function q$(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===F$||i===H$;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===F$||i===H$;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function vwe(e,t){const n={type:"text",value:ywe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function xwe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wwe={blockquote:Xxe,break:Qxe,code:Jxe,delete:Zxe,emphasis:ewe,footnoteReference:twe,heading:nwe,html:swe,imageReference:rwe,image:iwe,inlineCode:owe,linkReference:awe,link:lwe,listItem:cwe,list:dwe,paragraph:hwe,root:fwe,strong:mwe,table:pwe,tableCell:bwe,tableRow:gwe,text:vwe,thematicBreak:xwe,toml:c_,yaml:c_,definition:c_,footnoteDefinition:c_};function c_(){}const HX=-1,gC=0,Yv=1,u4=2,U9=3,W9=4,V9=5,G9=6,qX=7,UX=8,U$=typeof self=="object"?self:globalThis,kwe=(e,t)=>{const n=(r,i)=>(e.set(i,r),r),s=r=>{if(e.has(r))return e.get(r);const[i,o]=t[r];switch(i){case gC:case HX:return n(o,r);case Yv:{const a=n([],r);for(const c of o)a.push(s(c));return a}case u4:{const a=n({},r);for(const[c,u]of o)a[s(c)]=s(u);return a}case U9:return n(new Date(o),r);case W9:{const{source:a,flags:c}=o;return n(new RegExp(a,c),r)}case V9:{const a=n(new Map,r);for(const[c,u]of o)a.set(s(c),s(u));return a}case G9:{const a=n(new Set,r);for(const c of o)a.add(s(c));return a}case qX:{const{name:a,message:c}=o;return n(new U$[a](c),r)}case UX:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new U$[i](o),r)};return s},W$=e=>kwe(new Map,e)(0),Ag="",{toString:_we}={},{keys:Swe}=Object,Hy=e=>{const t=typeof e;if(t!=="object"||!e)return[gC,t];const n=_we.call(e).slice(8,-1);switch(n){case"Array":return[Yv,Ag];case"Object":return[u4,Ag];case"Date":return[U9,Ag];case"RegExp":return[W9,Ag];case"Map":return[V9,Ag];case"Set":return[G9,Ag];case"DataView":return[Yv,n]}return n.includes("Array")?[Yv,n]:n.includes("Error")?[qX,n]:[u4,n]},u_=([e,t])=>e===gC&&(t==="function"||t==="symbol"),Cwe=(e,t,n,s)=>{const r=(o,a)=>{const c=s.push(o)-1;return n.set(a,c),c},i=o=>{if(n.has(o))return n.get(o);let[a,c]=Hy(o);switch(a){case gC:{let d=o;switch(c){case"bigint":a=UX,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([HX],o)}return r([a,d],o)}case Yv:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),r([c,[...m]],o)}const d=[],h=r([a,d],o);for(const m of o)d.push(i(m));return h}case u4:{if(c)switch(c){case"BigInt":return r([c,o.toString()],o);case"Boolean":case"Number":case"String":return r([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=r([a,d],o);for(const m of Swe(o))(e||!u_(Hy(o[m])))&&d.push([i(m),i(o[m])]);return h}case U9:return r([a,o.toISOString()],o);case W9:{const{source:d,flags:h}=o;return r([a,{source:d,flags:h}],o)}case V9:{const d=[],h=r([a,d],o);for(const[m,p]of o)(e||!(u_(Hy(m))||u_(Hy(p))))&&d.push([i(m),i(p)]);return h}case G9:{const d=[],h=r([a,d],o);for(const m of o)(e||!u_(Hy(m)))&&d.push(i(m));return h}}const{message:u}=o;return r([a,{name:c,message:u}],o)};return i},V$=(e,{json:t,lossy:n}={})=>{const s=[];return Cwe(!(t||n),!!t,new Map,s)(e),s},d4=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?W$(V$(e,t)):structuredClone(e):(e,t)=>W$(V$(e,t));function Twe(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 Ewe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Awe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Twe,s=e.options.footnoteBackLabel||Ewe,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),m=$b(h.toLowerCase());let p=0;const g=[],b=e.footnoteCounts.get(h);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 s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.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),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...d4(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
`}]}}const jw=function(e){if(e==null)return Iwe;if(typeof e=="function")return bC(e);if(typeof e=="object")return Array.isArray(e)?jwe(e):Nwe(e);if(typeof e=="string")return Mwe(e);throw new Error("Expected function, string, or object as test")};function jwe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=jw(e[n]);return bC(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function Nwe(e){const t=e;return bC(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Mwe(e){return bC(t);function t(n){return n&&n.type===e}}function bC(e){return t;function t(n,s,r){return!!(Rwe(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function Iwe(){return!0}function Rwe(e){return e!==null&&typeof e=="object"&&"type"in e}const WX=[],Dwe=!0,NA=!1,VX="skip";function K9(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=jw(r),o=s?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=WX,g,b,x;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=Lwe(n(c,d)),p[0]===NA))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==VX)for(b=(s?y.children.length:-1)+o,x=d.concat(y);b>-1&&b<y.children.length;){const v=y.children[b];if(g=a(v,b,x)(),g[0]===NA)return g;b=typeof g[1]=="number"?g[1]:b+o}}return p}}}function Lwe(e){return Array.isArray(e)?e:typeof e=="number"?[Dwe,e]:e==null?WX:[e]}function Y9(e,t,n,s){let r,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,r=n):(i=t,o=n,r=s),K9(e,i,a,r);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const MA={}.hasOwnProperty,Pwe={};function Owe(e,t){const n=t||Pwe,s=new Map,r=new Map,i=new Map,o={...wwe,...n.handlers},a={all:u,applyData:Bwe,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:$we,wrap:Fwe};return Y9(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?s:r,m=String(d.identifier).toUpperCase();h.has(m)||h.set(m,d)}}),a;function c(d,h){const m=d.type,p=a.handlers[m];if(MA.call(a.handlers,m)&&p)return p(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in d){const{children:b,...x}=d,y=d4(x);return y.children=a.all(d),y}return d4(d)}return(a.options.unknownHandler||zwe)(a,d,h)}function u(d){const h=[];if("children"in d){const m=d.children;let p=-1;for(;++p<m.length;){const g=a.one(m[p],d);if(g){if(p&&m[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=G$(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=G$(b.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function $we(e,t){e.position&&(t.position=Eye(e))}function Bwe(e,t){let n=t;if(e&&e.data){const s=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,d4(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function zwe(e,t){const n=t.data||{},s="value"in t&&!(MA.call(n,"hProperties")||MA.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Fwe(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
`});++s<e.length;)s&&n.push({type:"text",value:`
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function G$(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function K$(e,t){const n=Owe(e,t),s=n.one(e,void 0),r=Awe(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
`},r),i}function Hwe(e,t){return e&&"run"in e?async function(n,s){const r=K$(n,{file:s,...t});await e.run(r,s)}:function(n,s){return K$(n,{file:s,...e||t})}}function Y$(e){if(e)throw e}var G2=Object.prototype.hasOwnProperty,GX=Object.prototype.toString,X$=Object.defineProperty,Q$=Object.getOwnPropertyDescriptor,J$=function(t){return typeof Array.isArray=="function"?Array.isArray(t):GX.call(t)==="[object Array]"},Z$=function(t){if(!t||GX.call(t)!=="[object Object]")return!1;var n=G2.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&G2.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||G2.call(t,r)},eB=function(t,n){X$&&n.name==="__proto__"?X$(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},tB=function(t,n){if(n==="__proto__")if(G2.call(t,n)){if(Q$)return Q$(t,n).value}else return;return t[n]},qwe=function e(){var t,n,s,r,i,o,a=arguments[0],c=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},c=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)s=tB(a,n),r=tB(t,n),a!==r&&(d&&r&&(Z$(r)||(i=J$(r)))?(i?(i=!1,o=s&&J$(s)?s:[]):o=s&&Z$(s)?s:{},eB(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&eB(a,{name:n,newValue:r}));return a};const O6=D3(qwe);function IA(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 Uwe(){const e=[],t={run:n,use:s};return t;function n(...r){let i=-1;const o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...r);function a(c,...u){const d=e[++i];let h=-1;if(c){o(c);return}for(;++h<r.length;)(u[h]===null||u[h]===void 0)&&(u[h]=r[h]);r=u,d?Wwe(d,a)(...u):o(null,...u)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function Wwe(e,t){let n;return s;function s(...o){const a=e.length>o.length;let c;a&&o.push(r);try{c=e.apply(this,o)}catch(u){const d=u;if(a&&n)throw d;return r(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(i,r):c instanceof Error?r(c):i(c))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const qu={basename:Vwe,dirname:Gwe,extname:Kwe,join:Ywe,sep:"/"};function Vwe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Nw(e);let n=0,s=-1,r=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else s<0&&(i=!0,s=r+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let o=-1,a=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else o<0&&(i=!0,o=r+1),a>-1&&(e.codePointAt(r)===t.codePointAt(a--)?a<0&&(s=r):(a=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function Gwe(e){if(Nw(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Kwe(e){Nw(e);let t=e.length,n=-1,s=0,r=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?r<0?r=t:i!==1&&(i=1):r>-1&&(i=-1)}return r<0||n<0||i===0||i===1&&r===n-1&&r===s+1?"":e.slice(r,n)}function Ywe(...e){let t=-1,n;for(;++t<e.length;)Nw(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Xwe(n)}function Xwe(e){Nw(e);const t=e.codePointAt(0)===47;let n=Qwe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Qwe(e,t){let n="",s=0,r=-1,i=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||i===1))if(r!==o-1&&i===2){if(n.length<2||s!==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="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),r=o,i=0;continue}}else if(n.length>0){n="",s=0,r=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),s=o-r-1;r=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function Nw(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Jwe={cwd:Zwe};function Zwe(){return"/"}function RA(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function eke(e){if(typeof e=="string")e=new URL(e);else if(!RA(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 tke(e)}function tke(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const $6=["history","path","basename","stem","extname","dirname"];class KX{constructor(t){let n;t?RA(t)?n={path:t}:typeof t=="string"||nke(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Jwe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<$6.length;){const i=$6[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let r;for(r in n)$6.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?qu.basename(this.path):void 0}set basename(t){z6(t,"basename"),B6(t,"basename"),this.path=qu.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?qu.dirname(this.path):void 0}set dirname(t){nB(this.basename,"dirname"),this.path=qu.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?qu.extname(this.path):void 0}set extname(t){if(B6(t,"extname"),nB(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=qu.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){RA(t)&&(t=eke(t)),z6(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?qu.basename(this.path,this.extname):void 0}set stem(t){z6(t,"stem"),B6(t,"stem"),this.path=qu.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const r=this.message(t,n,s);throw r.fatal=!0,r}info(t,n,s){const r=this.message(t,n,s);return r.fatal=void 0,r}message(t,n,s){const r=new wa(t,n,s);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function B6(e,t){if(e&&e.includes(qu.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+qu.sep+"`")}function z6(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function nB(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function nke(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ske=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},rke={}.hasOwnProperty;class X9 extends ske{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=Uwe()}copy(){const t=new X9;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(O6(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(q6("data",this.frozen),this.namespace[t]=n,this):rke.call(this.namespace,t)&&this.namespace[t]||void 0:t?(q6("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,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const r=n.call(t,...s);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=d_(t),s=this.parser||this.Parser;return F6("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),F6("process",this.parser||this.Parser),H6("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=d_(t),c=s.parse(a);s.run(c,a,function(d,h,m){if(d||!h||!m)return u(d);const p=h,g=s.stringify(p,m);ake(g)?m.value=g:m.result=g,u(d,m)});function u(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),F6("processSync",this.parser||this.Parser),H6("processSync",this.compiler||this.Compiler),this.process(t,r),rB("processSync","process",n),s;function r(i,o){n=!0,Y$(i),s=o}}run(t,n,s){sB(t),this.freeze();const r=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,a){const c=d_(n);r.run(t,c,u);function u(d,h,m){const p=h||t;d?a(d):o?o(p):s(void 0,p,m)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),rB("runSync","run",s),r;function i(o,a){Y$(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=d_(n),r=this.compiler||this.Compiler;return H6("stringify",r),sB(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(q6("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(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,...h]=u;c(d,h)}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");a(u.plugins),u.settings&&(r.settings=O6(!0,r.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,m=-1;for(;++h<s.length;)if(s[h][0]===u){m=h;break}if(m===-1)s.push([u,...d]);else if(d.length>0){let[p,...g]=d;const b=s[m][1];IA(b)&&IA(p)&&(p=O6(!0,b,p)),s[m]=[u,p,...g]}}}}const ike=new X9().freeze();function F6(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function H6(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function q6(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 sB(e){if(!IA(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function rB(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function d_(e){return oke(e)?e:new KX(e)}function oke(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ake(e){return typeof e=="string"||lke(e)}function lke(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const cke="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",iB=[],oB={allowDangerousHtml:!0},uke=/^(https?|ircs?|mailto|xmpp)$/i,dke=[{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 hke(e){const t=fke(e),n=mke(e);return pke(t.runSync(t.parse(n),n),e)}function fke(e){const t=e.rehypePlugins||iB,n=e.remarkPlugins||iB,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...oB}:oB;return ike().use(Yxe).use(n).use(Hwe,s).use(t)}function mke(e){const t=e.children||"",n=new KX;return typeof t=="string"&&(n.value=t),n}function pke(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||YX;for(const d of dke)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+cke+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Y9(e,u),Iye(e,{Fragment:l.Fragment,components:r,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,h,m){if(d.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in D6)if(Object.hasOwn(D6,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=D6[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&&s&&typeof h=="number"&&(p=!s(d,h,m)),p&&m&&typeof h=="number")return a&&d.children?m.children.splice(h,1,...d.children):m.children.splice(h,1),h}}}function YX(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||s!==-1&&t>s||uke.test(e.slice(0,t))?e:""}function h4(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,r=n.indexOf(t);for(;r!==-1;)s++,r=n.indexOf(t,r+t.length);return s}function gke(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function bke(e,t,n){const r=jw((n||{}).ignore||[]),i=yke(t);let o=-1;for(;++o<i.length;)K9(e,"text",a);function a(u,d){let h=-1,m;for(;++h<d.length;){const p=d[h],g=m?m.children:void 0;if(r(p,g?g.indexOf(p):void 0,m))return;m=p}if(m)return c(u,d)}function c(u,d){const h=d[d.length-1],m=i[o][0],p=i[o][1];let g=0;const x=h.children.indexOf(u);let y=!1,v=[];m.lastIndex=0;let w=m.exec(u.value);for(;w;){const k=w.index,T={index:w.index,input:w.input,stack:[...d,u]};let C=p(...w,T);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?m.lastIndex=k+1:(g!==k&&v.push({type:"text",value:u.value.slice(g,k)}),Array.isArray(C)?v.push(...C):C&&v.push(C),g=k+w[0].length,y=!0),!m.global)break;w=m.exec(u.value)}return y?(g<u.value.length&&v.push({type:"text",value:u.value.slice(g)}),h.children.splice(x,1,...v)):v=[u],x+v.length}}function yke(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 s=-1;for(;++s<n.length;){const r=n[s];t.push([vke(r[0]),xke(r[1])])}return t}function vke(e){return typeof e=="string"?new RegExp(gke(e),"g"):e}function xke(e){return typeof e=="function"?e:function(){return e}}const U6="phrasing",W6=["autolink","link","image","label"];function wke(){return{transforms:[Ake],enter:{literalAutolink:_ke,literalAutolinkEmail:V6,literalAutolinkHttp:V6,literalAutolinkWww:V6},exit:{literalAutolink:Eke,literalAutolinkEmail:Tke,literalAutolinkHttp:Ske,literalAutolinkWww:Cke}}}function kke(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:U6,notInConstruct:W6},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:U6,notInConstruct:W6},{character:":",before:"[ps]",after:"\\/",inConstruct:U6,notInConstruct:W6}]}}function _ke(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function V6(e){this.config.enter.autolinkProtocol.call(this,e)}function Ske(e){this.config.exit.autolinkProtocol.call(this,e)}function Cke(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 Tke(e){this.config.exit.autolinkEmail.call(this,e)}function Eke(e){this.exit(e)}function Ake(e){bke(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jke],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Nke]],{ignore:["link","linkReference"]})}function jke(e,t,n,s,r){let i="";if(!XX(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Mke(n)))return!1;const o=Ike(n+s);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function Nke(e,t,n,s){return!XX(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Mke(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 Ike(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const r=h4(e,"(");let i=h4(e,")");for(;s!==-1&&r>i;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),i++;return[e,n]}function XX(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||m0(n)||mC(n))&&(!t||n!==47)}QX.peek=Fke;function Rke(){this.buffer()}function Dke(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Lke(){this.buffer()}function Pke(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Oke(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=au(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $ke(e){this.exit(e)}function Bke(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=au(this.sliceSerialize(e)).toLowerCase(),n.label=t}function zke(e){this.exit(e)}function Fke(){return"["}function QX(e,t,n,s){const r=n.createTracker(s);let i=r.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=r.move("]"),i}function Hke(){return{enter:{gfmFootnoteCallString:Rke,gfmFootnoteCall:Dke,gfmFootnoteDefinitionLabelString:Lke,gfmFootnoteDefinition:Pke},exit:{gfmFootnoteCallString:Oke,gfmFootnoteCall:$ke,gfmFootnoteDefinitionLabelString:Bke,gfmFootnoteDefinition:zke}}}function qke(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:QX},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const a=i.createTracker(o);let c=a.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=a.move(i.safe(i.associationId(s),{before:c,after:"]"})),d(),c+=a.move("]:"),s.children&&s.children.length>0&&(a.shift(4),c+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(s,a.current()),t?JX:Uke))),u(),c}}function Uke(e,t,n){return t===0?e:JX(e,t,n)}function JX(e,t,n){return(n?"":"    ")+e}const Wke=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ZX.peek=Xke;function Vke(){return{canContainEols:["delete"],enter:{strikethrough:Kke},exit:{strikethrough:Yke}}}function Gke(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Wke}],handlers:{delete:ZX}}}function Kke(e){this.enter({type:"delete",children:[]},e)}function Yke(e){this.exit(e)}function ZX(e,t,n,s){const r=n.createTracker(s),i=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),i(),o}function Xke(){return"~"}function Qke(e){return e.length}function Jke(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||Qke,i=[],o=[],a=[],c=[];let u=0,d=-1;for(;++d<e.length;){const b=[],x=[];let y=-1;for(e[d].length>u&&(u=e[d].length);++y<e[d].length;){const v=Zke(e[d][y]);if(n.alignDelimiters!==!1){const w=r(v);x[y]=w,(c[y]===void 0||w>c[y])&&(c[y]=w)}b.push(v)}o[d]=b,a[d]=x}let h=-1;if(typeof s=="object"&&"length"in s)for(;++h<u;)i[h]=aB(s[h]);else{const b=aB(s);for(;++h<u;)i[h]=b}h=-1;const m=[],p=[];for(;++h<u;){const b=i[h];let x="",y="";b===99?(x=":",y=":"):b===108?x=":":b===114&&(y=":");let v=n.alignDelimiters===!1?1:Math.max(1,c[h]-x.length-y.length);const w=x+"-".repeat(v)+y;n.alignDelimiters!==!1&&(v=x.length+v+y.length,v>c[h]&&(c[h]=v),p[h]=v),m[h]=w}o.splice(1,0,m),a.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const b=o[d],x=a[d];h=-1;const y=[];for(;++h<u;){const v=b[h]||"";let w="",k="";if(n.alignDelimiters!==!1){const T=c[h]-(x[h]||0),C=i[h];C===114?w=" ".repeat(T):C===99?T%2?(w=" ".repeat(T/2+.5),k=" ".repeat(T/2-.5)):(w=" ".repeat(T/2),k=w):k=" ".repeat(T)}n.delimiterStart!==!1&&!h&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||h)&&y.push(" "),n.alignDelimiters!==!1&&y.push(w),y.push(v),n.alignDelimiters!==!1&&y.push(k),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&y.push("|")}g.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return g.join(`
`)}function Zke(e){return e==null?"":String(e)}function aB(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 lB={}.hasOwnProperty;function e_e(e,t){const n=t||{};function s(r,...i){let o=s.invalid;const a=s.handlers;if(r&&lB.call(r,e)){const c=String(r[e]);o=lB.call(a,c)?a[c]:s.unknown}if(o)return o.call(this,r,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}function t_e(e,t,n,s){const r=n.enter("blockquote"),i=n.createTracker(s);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),n_e);return r(),o}function n_e(e,t,n){return">"+(n?"":" ")+e}function s_e(e,t){return cB(e,t.inConstruct,!0)&&!cB(e,t.notInConstruct,!1)}function cB(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function uB(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&s_e(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function eQ(e,t){const n=String(e);let s=n.indexOf(t),r=s,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===r?++i>o&&(o=i):i=1,r=s+t.length,s=n.indexOf(t,r);return o}function r_e(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 i_e(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 o_e(e,t,n,s){const r=i_e(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(r_e(e,n)){const h=n.enter("codeIndented"),m=n.indentLines(i,a_e);return h(),m}const a=n.createTracker(s),c=r.repeat(Math.max(eQ(i,r)+1,3)),u=n.enter("codeFenced");let d=a.move(c);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
`,encode:["`"],...a.current()})),h()}return d+=a.move(`
`),i&&(d+=a.move(i+`
`)),d+=a.move(c),u(),d}function a_e(e,t,n){return(n?"":"    ")+e}function Q9(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 l_e(e,t,n,s){const r=Q9(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
`,...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),o(),u}function c_e(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 Ax(e){return"&#x"+e.toString(16).toUpperCase()+";"}function f4(e,t,n){const s=nb(e),r=nb(t);return s===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}tQ.peek=u_e;function tQ(e,t,n,s){const r=c_e(n),i=n.enter("emphasis"),o=n.createTracker(s),a=o.move(r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=f4(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=Ax(u)+c.slice(1));const h=c.charCodeAt(c.length-1),m=f4(s.after.charCodeAt(0),h,r);m.inside&&(c=c.slice(0,-1)+Ax(h));const p=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+c+p}function u_e(e,t,n){return n.options.emphasis||"*"}function d_e(e,t){let n=!1;return Y9(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,NA}),!!((!e.depth||e.depth<3)&&F9(e)&&(t.options.setext||n))}function h_e(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(d_e(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return h(),d(),m+`
`+(r===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
`))+1))}const o="#".repeat(r),a=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(u)&&(u=Ax(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),a(),u}nQ.peek=f_e;function nQ(e){return e.value||""}function f_e(){return"<"}sQ.peek=m_e;function sQ(e,t,n,s){const r=Q9(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),u+=c.move(")"),o(),u}function m_e(){return"!"}rQ.peek=p_e;function rQ(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("![");const u=n.safe(e.alt,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function p_e(){return"!"}iQ.peek=g_e;function iQ(e,t,n){let s=e.value||"",r="`",i=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(s);)r+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let c;if(o.atBreak)for(;c=a.exec(s);){let u=c.index;s.charCodeAt(u)===10&&s.charCodeAt(u-1)===13&&u--,s=s.slice(0,u)+" "+s.slice(c.index+1)}}return r+s+r}function g_e(){return"`"}function oQ(e,t){const n=F9(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))}aQ.peek=b_e;function aQ(e,t,n,s){const r=Q9(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,c;if(oQ(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),n.stack=d,h}a=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(" "+r),u+=o.move(n.safe(e.title,{before:u,after:r,...o.current()})),u+=o.move(r),c()),u+=o.move(")"),a(),u}function b_e(e,t,n){return oQ(e,n)?"<":"["}lQ.peek=y_e;function lQ(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function y_e(){return"["}function J9(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 v_e(e){const t=J9(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 x_e(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 cQ(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 w_e(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?x_e(n):J9(n);const a=e.ordered?o==="."?")":".":v_e(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),cQ(n)===o&&d){let h=-1;for(;++h<e.children.length;){const m=e.children[h];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),u}function k_e(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 __e(e,t,n,s){const r=k_e(n);let i=n.bulletCurrent||J9(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;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(s);a.move(i+" ".repeat(o-i.length)),a.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return c(),u;function d(h,m,p){return m?(p?"":" ".repeat(o))+h:(p?i:i+" ".repeat(o-i.length))+h}}function S_e(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const C_e=jw(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function T_e(e,t,n,s){return(e.children.some(function(o){return C_e(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function E_e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}uQ.peek=A_e;function uQ(e,t,n,s){const r=E_e(n),i=n.enter("strong"),o=n.createTracker(s),a=o.move(r+r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=f4(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=Ax(u)+c.slice(1));const h=c.charCodeAt(c.length-1),m=f4(s.after.charCodeAt(0),h,r);m.inside&&(c=c.slice(0,-1)+Ax(h));const p=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+c+p}function A_e(e,t,n){return n.options.strong||"*"}function j_e(e,t,n,s){return n.safe(e.value,s)}function N_e(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 M_e(e,t,n){const s=(cQ(n)+(n.options.ruleSpaces?" ":"")).repeat(N_e(n));return n.options.ruleSpaces?s.slice(0,-1):s}const dQ={blockquote:t_e,break:uB,code:o_e,definition:l_e,emphasis:tQ,hardBreak:uB,heading:h_e,html:nQ,image:sQ,imageReference:rQ,inlineCode:iQ,link:aQ,linkReference:lQ,list:w_e,listItem:__e,paragraph:S_e,root:T_e,strong:uQ,text:j_e,thematicBreak:M_e};function I_e(){return{enter:{table:R_e,tableData:dB,tableHeader:dB,tableRow:L_e},exit:{codeText:P_e,table:D_e,tableData:G6,tableHeader:G6,tableRow:G6}}}function R_e(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 D_e(e){this.exit(e),this.data.inTable=void 0}function L_e(e){this.enter({type:"tableRow",children:[]},e)}function G6(e){this.exit(e)}function dB(e){this.enter({type:"tableCell",children:[]},e)}function P_e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,O_e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function O_e(e,t){return t==="|"?t:e}function $_e(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,r=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:a}};function o(p,g,b,x){return u(d(p,b,x),p.align)}function a(p,g,b,x){const y=h(p,b,x),v=u([y]);return v.slice(0,v.indexOf(`
`))}function c(p,g,b,x){const y=b.enter("tableCell"),v=b.enter("phrasing"),w=b.containerPhrasing(p,{...x,before:i,after:i});return v(),y(),w}function u(p,g){return Jke(p,{align:g,alignDelimiters:s,padding:n,stringLength:r})}function d(p,g,b){const x=p.children;let y=-1;const v=[],w=g.enter("table");for(;++y<x.length;)v[y]=h(x[y],g,b);return w(),v}function h(p,g,b){const x=p.children;let y=-1;const v=[],w=g.enter("tableRow");for(;++y<x.length;)v[y]=c(x[y],p,g,b);return w(),v}function m(p,g,b){let x=dQ.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function B_e(){return{exit:{taskListCheckValueChecked:hB,taskListCheckValueUnchecked:hB,paragraph:F_e}}}function z_e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H_e}}}function hB(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function F_e(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 s=n.children[0];if(s&&s.type==="text"){const r=t.children;let i=-1,o;for(;++i<r.length;){const a=r[i];if(a.type==="paragraph"){o=a;break}}o===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function H_e(e,t,n,s){const r=e.children[0],i=typeof e.checked=="boolean"&&r&&r.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(s);i&&a.move(o);let c=dQ.listItem(e,t,n,{...s,...a.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function q_e(){return[wke(),Hke(),Vke(),I_e(),B_e()]}function U_e(e){return{extensions:[kke(),qke(e),Gke(),$_e(e),z_e()]}}const W_e={tokenize:Q_e,partial:!0},hQ={tokenize:J_e,partial:!0},fQ={tokenize:Z_e,partial:!0},mQ={tokenize:e2e,partial:!0},V_e={tokenize:t2e,partial:!0},pQ={name:"wwwAutolink",tokenize:Y_e,previous:bQ},gQ={name:"protocolAutolink",tokenize:X_e,previous:yQ},Uh={name:"emailAutolink",tokenize:K_e,previous:vQ},_d={};function G_e(){return{text:_d}}let vp=48;for(;vp<123;)_d[vp]=Uh,vp++,vp===58?vp=65:vp===91&&(vp=97);_d[43]=Uh;_d[45]=Uh;_d[46]=Uh;_d[95]=Uh;_d[72]=[Uh,gQ];_d[104]=[Uh,gQ];_d[87]=[Uh,pQ];_d[119]=[Uh,pQ];function K_e(e,t,n){const s=this;let r,i;return o;function o(h){return!DA(h)||!vQ.call(s,s.previous)||Z9(s.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return DA(h)?(e.consume(h),a):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(V_e,d,u)(h):h===45||h===95||ba(h)?(i=!0,e.consume(h),c):d(h)}function u(h){return e.consume(h),r=!0,c}function d(h){return i&&r&&Fa(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function Y_e(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!bQ.call(s,s.previous)||Z9(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(W_e,e.attempt(hQ,e.attempt(fQ,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function X_e(e,t,n){const s=this;let r="",i=!1;return o;function o(h){return(h===72||h===104)&&yQ.call(s,s.previous)&&!Z9(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(Fa(h)&&r.length<5)return r+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const m=r.toLowerCase();if(m==="http"||m==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?u:(i=!0,c)):n(h)}function u(h){return h===null||c4(h)||Xr(h)||m0(h)||mC(h)?n(h):e.attempt(hQ,e.attempt(fQ,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function Q_e(e,t,n){let s=0;return r;function r(o){return(o===87||o===119)&&s<3?(s++,e.consume(o),r):o===46&&s===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function J_e(e,t,n){let s,r,i;return o;function o(u){return u===46||u===95?e.check(mQ,c,a)(u):u===null||Xr(u)||m0(u)||u!==45&&mC(u)?c(u):(i=!0,e.consume(u),o)}function a(u){return u===95?s=!0:(r=s,s=void 0),e.consume(u),o}function c(u){return r||s||!i?n(u):t(u)}}function Z_e(e,t){let n=0,s=0;return r;function r(o){return o===40?(n++,e.consume(o),r):o===41&&s<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(mQ,t,i)(o):o===null||Xr(o)||m0(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function e2e(e,t,n){return s;function s(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),s):a===38?(e.consume(a),i):a===93?(e.consume(a),r):a===60||a===null||Xr(a)||m0(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||Xr(a)||m0(a)?t(a):s(a)}function i(a){return Fa(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):Fa(a)?(e.consume(a),o):n(a)}}function t2e(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return ba(i)?n(i):t(i)}}function bQ(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Xr(e)}function yQ(e){return!Fa(e)}function vQ(e){return!(e===47||DA(e))}function DA(e){return e===43||e===45||e===46||e===95||ba(e)}function Z9(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const n2e={tokenize:u2e,partial:!0};function s2e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:a2e,continuation:{tokenize:l2e},exit:c2e}},text:{91:{name:"gfmFootnoteCall",tokenize:o2e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:r2e,resolveTo:i2e}}}}function r2e(e,t,n){const s=this;let r=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;r--;){const c=s.events[r][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 a;function a(c){if(!o||!o._balanced)return n(c);const u=au(s.sliceSerialize({start:o.end,end:s.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 i2e(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 s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},r.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)},a=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",r,t],["exit",r,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...a),e}function o2e(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(i>999||h===93&&!o||h===null||h===91||Xr(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return r.includes(au(s.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Xr(h)||(o=!0),i++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,u):u(h)}}function a2e(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,a;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&&!a||g===null||g===91||Xr(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=au(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Xr(g)||(a=!0),o++,e.consume(g),g===92?h:d}function h(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"),r.includes(i)||r.push(i),Us(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function l2e(e,t,n){return e.check(Aw,t,e.attempt(n2e,t,n))}function c2e(e){e.exit("gfmFootnoteDefinition")}function u2e(e,t,n){const s=this;return Us(e,r,"gfmFootnoteDefinitionIndent",5);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function d2e(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function r(o,a){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)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},m=[["enter",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",h,a]],p=a.parser.constructs.insideSpan.null;p&&tc(m,m.length,0,pC(p,o.slice(u+1,c),a)),tc(m,m.length,0,[["exit",h,a],["enter",o[c][1],a],["exit",o[c][1],a],["exit",d,a]]),tc(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,a,c){const u=this.previous,d=this.events;let h=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=nb(u);if(g===126)return h>1?c(g):(o.consume(g),h++,p);if(h<2&&!n)return c(g);const x=o.exit("strikethroughSequenceTemporary"),y=nb(g);return x._open=!y||y===2&&!!b,x._close=!b||b===2&&!!y,a(g)}}}class h2e{constructor(){this.map=[]}add(t,n,s){f2e(this,t,n,s)}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 s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let r=s.pop();for(;r;){for(const i of r)t.push(i);r=s.pop()}this.map.length=0}}function f2e(e,t,n,s){let r=0;if(!(n===0&&s.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=n,e.map[r][2].push(...s);return}r+=1}e.map.push([t,n,s])}}function m2e(e,t){let n=!1;const s=[];for(;t<e.length;){const r=e[t];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=s.length-1;s[i]=s[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function p2e(){return{flow:{null:{name:"table",tokenize:g2e,resolveAll:b2e}}}}function g2e(e,t,n){const s=this;let r=0,i=0,o;return a;function a(E){let B=s.events.length-1;for(;B>-1;){const O=s.events[B][1].type;if(O==="lineEnding"||O==="linePrefix")B--;else break}const I=B>-1?s.events[B][1].type:null,L=I==="tableHead"||I==="tableRow"?C:c;return L===C&&s.parser.lazy[s.now().line]?n(E):L(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):zn(E)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):n(E):Ys(E)?Us(e,d,"whitespace")(E):(i+=1,o&&(o=!1,r+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(E)))}function h(E){return E===null||E===124||Xr(E)?(e.exit("data"),d(E)):(e.consume(E),E===92?m:h)}function m(E){return E===92||E===124?(e.consume(E),h):h(E)}function p(E){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(E):(e.enter("tableDelimiterRow"),o=!1,Ys(E)?Us(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):g(E))}function g(E){return E===45||E===58?x(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),b):T(E)}function b(E){return Ys(E)?Us(e,x,"whitespace")(E):x(E)}function x(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||zn(E)?k(E):T(E)}function y(E){return E===45?(e.enter("tableDelimiterFiller"),v(E)):T(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"),w):(e.exit("tableDelimiterFiller"),w(E))}function w(E){return Ys(E)?Us(e,k,"whitespace")(E):k(E)}function k(E){return E===124?g(E):E===null||zn(E)?!o||r!==i?T(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):T(E)}function T(E){return n(E)}function C(E){return e.enter("tableRow"),_(E)}function _(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),_):E===null||zn(E)?(e.exit("tableRow"),t(E)):Ys(E)?Us(e,_,"whitespace")(E):(e.enter("data"),S(E))}function S(E){return E===null||E===124||Xr(E)?(e.exit("data"),_(E)):(e.consume(E),E===92?D:S)}function D(E){return E===92||E===124?(e.consume(E),S):S(E)}}function b2e(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,c=0,u,d,h;const m=new h2e;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,c!==0&&(fB(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"?(s=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",d,t]])),r=g.type==="tableDelimiterRow"?2:d?3:1):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=h_(m,t,i,r,void 0,h),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],h=h_(m,t,i,r,void 0,h)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(a=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],h=h_(m,t,i,r,n,h)):o[1]!==0&&(h=h_(m,t,o,r,n,h)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&fB(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=m2e(t.events,n))}return e}function h_(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Yg(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=Yg(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=Yg(t.events,n[2]),d=Yg(t.events,n[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),s!==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",h,t]])}return r!==void 0&&(i.end=Object.assign({},Yg(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function fB(e,t,n,s,r){const i=[],o=Yg(t.events,n);r&&(r.end=Object.assign({},o),i.push(["exit",r,t])),s.end=Object.assign({},o),i.push(["exit",s,t]),e.add(n+1,0,i)}function Yg(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const y2e={name:"tasklistCheck",tokenize:x2e};function v2e(){return{text:{91:y2e}}}function x2e(e,t,n){const s=this;return r;function r(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Xr(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"),a):n(c)}function a(c){return zn(c)?t(c):Ys(c)?e.check({tokenize:w2e},t,n)(c):n(c)}}function w2e(e,t,n){return Us(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function k2e(e){return EX([G_e(),s2e(),d2e(e),p2e(),v2e()])}const _2e={};function mB(e){const t=this,n=e||_2e,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(k2e(n)),i.push(q_e()),o.push(U_e(n))}function S2e(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:r,mathFlowFence:s,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};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 s(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function r(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 h=d.data.hChildren[0];h.type,h.tagName,h.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 a(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function C2e(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),s.peek=r,{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:s}};function n(i,o,a,c){const u=i.value||"",d=a.createTracker(c),h="$".repeat(Math.max(eQ(u,"$")+1,2)),m=a.enter("mathFlow");let p=d.move(h);if(i.meta){const g=a.enter("mathFlowMeta");p+=d.move(a.safe(i.meta,{after:`
`,before:p,encode:["$"],...d.current()})),g()}return p+=d.move(`
`),u&&(p+=d.move(u+`
`)),p+=d.move(h),m(),p}function s(i,o,a){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 h=-1;for(;++h<a.unsafe.length;){const m=a.unsafe[h];if(!m.atBreak)continue;const p=a.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 r(){return"$"}}const T2e={tokenize:E2e,concrete:!0,name:"mathFlow"},pB={tokenize:A2e,partial:!0};function E2e(e,t,n){const s=this,r=s.events[s.events.length-1],i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0;let o=0;return a;function a(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"),Us(e,u,"whitespace")(v))}function u(v){return v===null||zn(v)?h(v):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||zn(v)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),h(v)):v===36?n(v):(e.consume(v),d)}function h(v){return e.exit("mathFlowFence"),s.interrupt?t(v):e.attempt(pB,m,x)(v)}function m(v){return e.attempt({tokenize:y,partial:!0},x,p)(v)}function p(v){return(i?Us(e,g,"linePrefix",i+1):g)(v)}function g(v){return v===null?x(v):zn(v)?e.attempt(pB,m,x)(v):(e.enter("mathFlowValue"),b(v))}function b(v){return v===null||zn(v)?(e.exit("mathFlowValue"),g(v)):(e.consume(v),b)}function x(v){return e.exit("mathFlow"),t(v)}function y(v,w,k){let T=0;return Us(v,C,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function C(D){return v.enter("mathFlowFence"),v.enter("mathFlowFenceSequence"),_(D)}function _(D){return D===36?(T++,v.consume(D),_):T<o?k(D):(v.exit("mathFlowFenceSequence"),Us(v,S,"whitespace")(D))}function S(D){return D===null||zn(D)?(v.exit("mathFlowFence"),w(D)):k(D)}}}function A2e(e,t,n){const s=this;return r;function r(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function j2e(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:s,resolve:N2e,previous:M2e,name:"mathText"};function s(r,i,o){let a=0,c,u;return d;function d(b){return r.enter("mathText"),r.enter("mathTextSequence"),h(b)}function h(b){return b===36?(r.consume(b),a++,h):a<2&&!n?o(b):(r.exit("mathTextSequence"),m(b))}function m(b){return b===null?o(b):b===36?(u=r.enter("mathTextSequence"),c=0,g(b)):b===32?(r.enter("space"),r.consume(b),r.exit("space"),m):zn(b)?(r.enter("lineEnding"),r.consume(b),r.exit("lineEnding"),m):(r.enter("mathTextData"),p(b))}function p(b){return b===null||b===32||b===36||zn(b)?(r.exit("mathTextData"),m(b)):(r.consume(b),p)}function g(b){return b===36?(r.consume(b),c++,g):c===a?(r.exit("mathTextSequence"),r.exit("mathText"),i(b)):(u.type="mathTextData",p(b))}}}function N2e(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[n][1].type="mathTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="mathTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function M2e(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function I2e(e){return{flow:{36:T2e},text:{36:j2e(e)}}}class Tt extends Error{constructor(t,n){var s="KaTeX parse error: "+t,r,i,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;r=o.start,i=o.end,r===a.length?s+=" at end of input: ":s+=" at position "+(r+1)+": ";var c=a.slice(r,i).replace(/[^]/g,"$&̲"),u;r>15?u="…"+a.slice(r-15,r):u=a.slice(0,r);var d;i+15<a.length?d=a.slice(i,i+15)+"…":d=a.slice(i),s+=u+c+d}super(s),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,Tt.prototype),this.position=r,r!=null&&i!=null&&(this.length=i-r),this.rawMessage=t}}var R2e=/([A-Z])/g,D2e=e=>e.replace(R2e,"-$1").toLowerCase(),L2e={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},P2e=/[&><"']/g,ya=e=>String(e).replace(P2e,t=>L2e[t]),K2=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?K2(e.body[0]):e:e.type==="font"?K2(e.body):e,O2e=new Set(["mathord","textord","atom"]),Wh=e=>O2e.has(K2(e).type),$2e=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"},m4={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 B2e(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 z2e(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return B2e(t)}function F2e(e,t,n,s){var r=n[t];e[t]=r!==void 0?s.processor?s.processor(r):r:z2e(s)}class eI{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(m4)){var s=m4[n];s&&F2e(this,n,t,s)}}reportNonstrict(t,n,s){var r=this.strict;if(typeof r=="function"&&(r=r(t,n,s)),!(!r||r==="ignore")){if(r===!0||r==="error")throw new Tt("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),s);r==="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 '"+r+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,s){var r=this.strict;if(typeof r=="function")try{r=r(t,n,s)}catch{r="error"}return!r||r==="ignore"?!1:r===!0||r==="error"?!0:r==="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 '"+r+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=$2e(t.url);if(n==null)return!1;t.protocol=n}var s=typeof this.trust=="function"?this.trust(t):this.trust;return!!s}}let pf=class{constructor(t,n,s){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=s}sup(){return Wu[H2e[this.id]]}sub(){return Wu[q2e[this.id]]}fracNum(){return Wu[U2e[this.id]]}fracDen(){return Wu[W2e[this.id]]}cramp(){return Wu[V2e[this.id]]}text(){return Wu[G2e[this.id]]}isTight(){return this.size>=2}};var tI=0,p4=1,M1=2,kh=3,jx=4,Ic=5,sb=6,Ua=7,Wu=[new pf(tI,0,!1),new pf(p4,0,!0),new pf(M1,1,!1),new pf(kh,1,!0),new pf(jx,2,!1),new pf(Ic,2,!0),new pf(sb,3,!1),new pf(Ua,3,!0)],H2e=[jx,Ic,jx,Ic,sb,Ua,sb,Ua],q2e=[Ic,Ic,Ic,Ic,Ua,Ua,Ua,Ua],U2e=[M1,kh,jx,Ic,sb,Ua,sb,Ua],W2e=[kh,kh,Ic,Ic,Ua,Ua,Ua,Ua],V2e=[p4,p4,kh,kh,Ic,Ic,Ua,Ua],G2e=[tI,p4,M1,kh,M1,kh,M1,kh],ks={DISPLAY:Wu[tI],TEXT:Wu[M1],SCRIPT:Wu[jx],SCRIPTSCRIPT:Wu[sb]},LA=[{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 K2e(e){for(var t=0;t<LA.length;t++)for(var n=LA[t],s=0;s<n.blocks.length;s++){var r=n.blocks[s];if(e>=r[0]&&e<=r[1])return n.name}return null}var Y2=[];LA.forEach(e=>e.blocks.forEach(t=>Y2.push(...t)));function xQ(e){for(var t=0;t<Y2.length;t+=2)if(e>=Y2[t]&&e<=Y2[t+1])return!0;return!1}var xo=e=>e+" "+e,jg=80,Y2e=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"},X2e=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"},Q2e=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"},J2e=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"},Z2e=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"},eSe=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},tSe=function(t,n,s){var r=s-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+`
H742v`+r+`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"},nSe=function(t,n,s){n=1e3*n;var r="";switch(t){case"sqrtMain":r=Y2e(n,jg);break;case"sqrtSize1":r=X2e(n,jg);break;case"sqrtSize2":r=Q2e(n,jg);break;case"sqrtSize3":r=J2e(n,jg);break;case"sqrtSize4":r=Z2e(n,jg);break;case"sqrtTall":r=tSe(n,jg,s)}return r},sSe=function(t,n){switch(t){case"⎜":return xo("M291 0 H417 V"+n+" H291z");case"∣":return xo("M145 0 H188 V"+n+" H145z");case"∥":return xo("M145 0 H188 V"+n+" H145z")+xo("M367 0 H410 V"+n+" H367z");case"⎟":return xo("M457 0 H583 V"+n+" H457z");case"⎢":return xo("M319 0 H403 V"+n+" H319z");case"⎥":return xo("M263 0 H347 V"+n+" H263z");case"⎪":return xo("M384 0 H504 V"+n+" H384z");case"⏐":return xo("M312 0 H355 V"+n+" H312z");case"‖":return xo("M257 0 H300 V"+n+" H257z")+xo("M478 0 H521 V"+n+" H478z");default:return""}},gB={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:xo("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:xo("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:xo("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:xo("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:xo("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:xo("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:xo("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:xo("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`},rSe=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 iSe(e){return"toText"in e}let Bb=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(iSe(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}};var PA={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},oSe={ex:!0,em:!0,mu:!0},wQ=function(t){return typeof t!="string"&&(t=t.unit),t in PA||t in oSe||t==="ex"},Mi=function(t,n){var s;if(t.unit in PA)s=PA[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")s=n.fontMetrics().cssEmPerMu;else{var r;if(n.style.isTight()?r=n.havingStyle(n.style.text()):r=n,t.unit==="ex")s=r.fontMetrics().xHeight;else if(t.unit==="em")s=r.fontMetrics().quad;else throw new Tt("Invalid unit: '"+t.unit+"'");r!==n&&(s*=r.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*s,n.maxSize)},Ot=function(t){return+t.toFixed(4)+"em"},ym=function(t){return t.filter(n=>n).join(" ")},nI=function(t){var n="";for(var s of Object.keys(t)){var r=t[s];r!==void 0&&(n+=D2e(s)+":"+r+";")}return n},kQ=function(t,n,s){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=s||{},n){n.style.isTight()&&this.classes.push("mtight");var r=n.getColor();r&&(this.style.color=r)}},_Q=function(t){var n=document.createElement(t);n.className=ym(this.classes),Object.assign(n.style,this.style);for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);for(var r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n},aSe=/[\s"'>/=\x00-\x1f]/,SQ=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+ya(ym(this.classes))+'"');var s=nI(this.style);s&&(n+=' style="'+ya(s)+'"');for(var r of Object.keys(this.attributes)){if(aSe.test(r))throw new Tt("Invalid attribute name '"+r+"'");n+=" "+r+'="'+ya(this.attributes[r])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class zb{constructor(t,n,s,r){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,kQ.call(this,t,s,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return _Q.call(this,"span")}toMarkup(){return SQ.call(this,"span")}}let yC=class{constructor(t,n,s,r){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,kQ.call(this,n,r),this.children=s||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return _Q.call(this,"a")}toMarkup(){return SQ.call(this,"a")}};class lSe{constructor(t,n,s){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=s}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="'+ya(this.src)+'"'+(' alt="'+ya(this.alt)+'"'),n=nI(this.style);return n&&(t+=' style="'+ya(n)+'"'),t+="'/>",t}}var cSe={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class ac{constructor(t,n,s,r,i,o,a,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=s||0,this.italic=r||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=c||{},this.maxFontSize=0;var u=K2e(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=cSe[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=Ot(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=ym(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+=ya(ym(this.classes)),n+='"');var s="";this.italic>0&&(s+="margin-right:"+Ot(this.italic)+";"),s+=nI(this.style),s&&(t=!0,n+=' style="'+ya(s)+'"');var r=ya(this.text);return t?(n+=">",n+=r,n+="</span>",n):r}}class $h{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 s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);for(var r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))t+=" "+n+'="'+ya(this.attributes[n])+'"';t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</svg>",t}}class vm{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",gB[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+ya(this.alternate)+'"/>':'<path d="'+ya(gB[this.pathName])+'"/>'}}class OA{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 s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);return n}toMarkup(){var t="<line";for(var n of Object.keys(this.attributes))t+=" "+n+'="'+ya(this.attributes[n])+'"';return t+="/>",t}}function uSe(e){if(e instanceof ac)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function dSe(e){if(e instanceof zb)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var hSe=e=>e instanceof zb||e instanceof yC||e instanceof Bb,Zu={"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]}},f_={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]},bB={Å:"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 CQ(e,t){Zu[e]=t}function sI(e,t,n){if(!Zu[t])throw new Error("Font metrics not found for font: "+t+".");var s=e.charCodeAt(0),r=Zu[t][s];if(!r&&e[0]in bB&&(s=bB[e[0]].charCodeAt(0),r=Zu[t][s]),!r&&n==="text"&&xQ(s)&&(r=Zu[t][77]),r)return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}var K6={};function fSe(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!K6[t]){var n=K6[t]={cssEmPerMu:f_.quad[t]/18};for(var s in f_)f_.hasOwnProperty(s)&&(n[s]=f_[s][t])}return K6[t]}var vi={math:{},text:{}};function N(e,t,n,s,r,i){vi[e][r]={font:t,group:n,replace:s},i&&s&&(vi[e][s]=vi[e][r])}var P="math",bt="text",G="main",he="ams",wi="accent-token",yn="bin",Ka="close",Fb="inner",Xn="mathord",po="op-token",cc="open",Mw="punct",ye="rel",Vh="spacing",Se="textord";N(P,G,ye,"≡","\\equiv",!0);N(P,G,ye,"≺","\\prec",!0);N(P,G,ye,"≻","\\succ",!0);N(P,G,ye,"∼","\\sim",!0);N(P,G,ye,"⊥","\\perp");N(P,G,ye,"⪯","\\preceq",!0);N(P,G,ye,"⪰","\\succeq",!0);N(P,G,ye,"≃","\\simeq",!0);N(P,G,ye,"∣","\\mid",!0);N(P,G,ye,"≪","\\ll",!0);N(P,G,ye,"≫","\\gg",!0);N(P,G,ye,"≍","\\asymp",!0);N(P,G,ye,"∥","\\parallel");N(P,G,ye,"⋈","\\bowtie",!0);N(P,G,ye,"⌣","\\smile",!0);N(P,G,ye,"⊑","\\sqsubseteq",!0);N(P,G,ye,"⊒","\\sqsupseteq",!0);N(P,G,ye,"≐","\\doteq",!0);N(P,G,ye,"⌢","\\frown",!0);N(P,G,ye,"∋","\\ni",!0);N(P,G,ye,"∝","\\propto",!0);N(P,G,ye,"⊢","\\vdash",!0);N(P,G,ye,"⊣","\\dashv",!0);N(P,G,ye,"∋","\\owns");N(P,G,Mw,".","\\ldotp");N(P,G,Mw,"⋅","\\cdotp");N(P,G,Mw,"⋅","·");N(bt,G,Se,"⋅","·");N(P,G,Se,"#","\\#");N(bt,G,Se,"#","\\#");N(P,G,Se,"&","\\&");N(bt,G,Se,"&","\\&");N(P,G,Se,"ℵ","\\aleph",!0);N(P,G,Se,"∀","\\forall",!0);N(P,G,Se,"ℏ","\\hbar",!0);N(P,G,Se,"∃","\\exists",!0);N(P,G,Se,"∇","\\nabla",!0);N(P,G,Se,"♭","\\flat",!0);N(P,G,Se,"ℓ","\\ell",!0);N(P,G,Se,"♮","\\natural",!0);N(P,G,Se,"♣","\\clubsuit",!0);N(P,G,Se,"℘","\\wp",!0);N(P,G,Se,"♯","\\sharp",!0);N(P,G,Se,"♢","\\diamondsuit",!0);N(P,G,Se,"ℜ","\\Re",!0);N(P,G,Se,"♡","\\heartsuit",!0);N(P,G,Se,"ℑ","\\Im",!0);N(P,G,Se,"♠","\\spadesuit",!0);N(P,G,Se,"§","\\S",!0);N(bt,G,Se,"§","\\S");N(P,G,Se,"¶","\\P",!0);N(bt,G,Se,"¶","\\P");N(P,G,Se,"†","\\dag");N(bt,G,Se,"†","\\dag");N(bt,G,Se,"†","\\textdagger");N(P,G,Se,"‡","\\ddag");N(bt,G,Se,"‡","\\ddag");N(bt,G,Se,"‡","\\textdaggerdbl");N(P,G,Ka,"⎱","\\rmoustache",!0);N(P,G,cc,"⎰","\\lmoustache",!0);N(P,G,Ka,"⟯","\\rgroup",!0);N(P,G,cc,"⟮","\\lgroup",!0);N(P,G,yn,"∓","\\mp",!0);N(P,G,yn,"⊖","\\ominus",!0);N(P,G,yn,"⊎","\\uplus",!0);N(P,G,yn,"⊓","\\sqcap",!0);N(P,G,yn,"∗","\\ast");N(P,G,yn,"⊔","\\sqcup",!0);N(P,G,yn,"◯","\\bigcirc",!0);N(P,G,yn,"∙","\\bullet",!0);N(P,G,yn,"‡","\\ddagger");N(P,G,yn,"≀","\\wr",!0);N(P,G,yn,"⨿","\\amalg");N(P,G,yn,"&","\\And");N(P,G,ye,"⟵","\\longleftarrow",!0);N(P,G,ye,"⇐","\\Leftarrow",!0);N(P,G,ye,"⟸","\\Longleftarrow",!0);N(P,G,ye,"⟶","\\longrightarrow",!0);N(P,G,ye,"⇒","\\Rightarrow",!0);N(P,G,ye,"⟹","\\Longrightarrow",!0);N(P,G,ye,"↔","\\leftrightarrow",!0);N(P,G,ye,"⟷","\\longleftrightarrow",!0);N(P,G,ye,"⇔","\\Leftrightarrow",!0);N(P,G,ye,"⟺","\\Longleftrightarrow",!0);N(P,G,ye,"↦","\\mapsto",!0);N(P,G,ye,"⟼","\\longmapsto",!0);N(P,G,ye,"↗","\\nearrow",!0);N(P,G,ye,"↩","\\hookleftarrow",!0);N(P,G,ye,"↪","\\hookrightarrow",!0);N(P,G,ye,"↘","\\searrow",!0);N(P,G,ye,"↼","\\leftharpoonup",!0);N(P,G,ye,"⇀","\\rightharpoonup",!0);N(P,G,ye,"↙","\\swarrow",!0);N(P,G,ye,"↽","\\leftharpoondown",!0);N(P,G,ye,"⇁","\\rightharpoondown",!0);N(P,G,ye,"↖","\\nwarrow",!0);N(P,G,ye,"⇌","\\rightleftharpoons",!0);N(P,he,ye,"≮","\\nless",!0);N(P,he,ye,"","\\@nleqslant");N(P,he,ye,"","\\@nleqq");N(P,he,ye,"⪇","\\lneq",!0);N(P,he,ye,"≨","\\lneqq",!0);N(P,he,ye,"","\\@lvertneqq");N(P,he,ye,"⋦","\\lnsim",!0);N(P,he,ye,"⪉","\\lnapprox",!0);N(P,he,ye,"⊀","\\nprec",!0);N(P,he,ye,"⋠","\\npreceq",!0);N(P,he,ye,"⋨","\\precnsim",!0);N(P,he,ye,"⪹","\\precnapprox",!0);N(P,he,ye,"≁","\\nsim",!0);N(P,he,ye,"","\\@nshortmid");N(P,he,ye,"∤","\\nmid",!0);N(P,he,ye,"⊬","\\nvdash",!0);N(P,he,ye,"⊭","\\nvDash",!0);N(P,he,ye,"⋪","\\ntriangleleft");N(P,he,ye,"⋬","\\ntrianglelefteq",!0);N(P,he,ye,"⊊","\\subsetneq",!0);N(P,he,ye,"","\\@varsubsetneq");N(P,he,ye,"⫋","\\subsetneqq",!0);N(P,he,ye,"","\\@varsubsetneqq");N(P,he,ye,"≯","\\ngtr",!0);N(P,he,ye,"","\\@ngeqslant");N(P,he,ye,"","\\@ngeqq");N(P,he,ye,"⪈","\\gneq",!0);N(P,he,ye,"≩","\\gneqq",!0);N(P,he,ye,"","\\@gvertneqq");N(P,he,ye,"⋧","\\gnsim",!0);N(P,he,ye,"⪊","\\gnapprox",!0);N(P,he,ye,"⊁","\\nsucc",!0);N(P,he,ye,"⋡","\\nsucceq",!0);N(P,he,ye,"⋩","\\succnsim",!0);N(P,he,ye,"⪺","\\succnapprox",!0);N(P,he,ye,"≆","\\ncong",!0);N(P,he,ye,"","\\@nshortparallel");N(P,he,ye,"∦","\\nparallel",!0);N(P,he,ye,"⊯","\\nVDash",!0);N(P,he,ye,"⋫","\\ntriangleright");N(P,he,ye,"⋭","\\ntrianglerighteq",!0);N(P,he,ye,"","\\@nsupseteqq");N(P,he,ye,"⊋","\\supsetneq",!0);N(P,he,ye,"","\\@varsupsetneq");N(P,he,ye,"⫌","\\supsetneqq",!0);N(P,he,ye,"","\\@varsupsetneqq");N(P,he,ye,"⊮","\\nVdash",!0);N(P,he,ye,"⪵","\\precneqq",!0);N(P,he,ye,"⪶","\\succneqq",!0);N(P,he,ye,"","\\@nsubseteqq");N(P,he,yn,"⊴","\\unlhd");N(P,he,yn,"⊵","\\unrhd");N(P,he,ye,"↚","\\nleftarrow",!0);N(P,he,ye,"↛","\\nrightarrow",!0);N(P,he,ye,"⇍","\\nLeftarrow",!0);N(P,he,ye,"⇏","\\nRightarrow",!0);N(P,he,ye,"↮","\\nleftrightarrow",!0);N(P,he,ye,"⇎","\\nLeftrightarrow",!0);N(P,he,ye,"△","\\vartriangle");N(P,he,Se,"ℏ","\\hslash");N(P,he,Se,"▽","\\triangledown");N(P,he,Se,"◊","\\lozenge");N(P,he,Se,"Ⓢ","\\circledS");N(P,he,Se,"®","\\circledR");N(bt,he,Se,"®","\\circledR");N(P,he,Se,"∡","\\measuredangle",!0);N(P,he,Se,"∄","\\nexists");N(P,he,Se,"℧","\\mho");N(P,he,Se,"Ⅎ","\\Finv",!0);N(P,he,Se,"⅁","\\Game",!0);N(P,he,Se,"‵","\\backprime");N(P,he,Se,"▲","\\blacktriangle");N(P,he,Se,"▼","\\blacktriangledown");N(P,he,Se,"■","\\blacksquare");N(P,he,Se,"⧫","\\blacklozenge");N(P,he,Se,"★","\\bigstar");N(P,he,Se,"∢","\\sphericalangle",!0);N(P,he,Se,"∁","\\complement",!0);N(P,he,Se,"ð","\\eth",!0);N(bt,G,Se,"ð","ð");N(P,he,Se,"╱","\\diagup");N(P,he,Se,"╲","\\diagdown");N(P,he,Se,"□","\\square");N(P,he,Se,"□","\\Box");N(P,he,Se,"◊","\\Diamond");N(P,he,Se,"¥","\\yen",!0);N(bt,he,Se,"¥","\\yen",!0);N(P,he,Se,"✓","\\checkmark",!0);N(bt,he,Se,"✓","\\checkmark");N(P,he,Se,"ℶ","\\beth",!0);N(P,he,Se,"ℸ","\\daleth",!0);N(P,he,Se,"ℷ","\\gimel",!0);N(P,he,Se,"ϝ","\\digamma",!0);N(P,he,Se,"ϰ","\\varkappa");N(P,he,cc,"┌","\\@ulcorner",!0);N(P,he,Ka,"┐","\\@urcorner",!0);N(P,he,cc,"└","\\@llcorner",!0);N(P,he,Ka,"┘","\\@lrcorner",!0);N(P,he,ye,"≦","\\leqq",!0);N(P,he,ye,"⩽","\\leqslant",!0);N(P,he,ye,"⪕","\\eqslantless",!0);N(P,he,ye,"≲","\\lesssim",!0);N(P,he,ye,"⪅","\\lessapprox",!0);N(P,he,ye,"≊","\\approxeq",!0);N(P,he,yn,"⋖","\\lessdot");N(P,he,ye,"⋘","\\lll",!0);N(P,he,ye,"≶","\\lessgtr",!0);N(P,he,ye,"⋚","\\lesseqgtr",!0);N(P,he,ye,"⪋","\\lesseqqgtr",!0);N(P,he,ye,"≑","\\doteqdot");N(P,he,ye,"≓","\\risingdotseq",!0);N(P,he,ye,"≒","\\fallingdotseq",!0);N(P,he,ye,"∽","\\backsim",!0);N(P,he,ye,"⋍","\\backsimeq",!0);N(P,he,ye,"⫅","\\subseteqq",!0);N(P,he,ye,"⋐","\\Subset",!0);N(P,he,ye,"⊏","\\sqsubset",!0);N(P,he,ye,"≼","\\preccurlyeq",!0);N(P,he,ye,"⋞","\\curlyeqprec",!0);N(P,he,ye,"≾","\\precsim",!0);N(P,he,ye,"⪷","\\precapprox",!0);N(P,he,ye,"⊲","\\vartriangleleft");N(P,he,ye,"⊴","\\trianglelefteq");N(P,he,ye,"⊨","\\vDash",!0);N(P,he,ye,"⊪","\\Vvdash",!0);N(P,he,ye,"⌣","\\smallsmile");N(P,he,ye,"⌢","\\smallfrown");N(P,he,ye,"≏","\\bumpeq",!0);N(P,he,ye,"≎","\\Bumpeq",!0);N(P,he,ye,"≧","\\geqq",!0);N(P,he,ye,"⩾","\\geqslant",!0);N(P,he,ye,"⪖","\\eqslantgtr",!0);N(P,he,ye,"≳","\\gtrsim",!0);N(P,he,ye,"⪆","\\gtrapprox",!0);N(P,he,yn,"⋗","\\gtrdot");N(P,he,ye,"⋙","\\ggg",!0);N(P,he,ye,"≷","\\gtrless",!0);N(P,he,ye,"⋛","\\gtreqless",!0);N(P,he,ye,"⪌","\\gtreqqless",!0);N(P,he,ye,"≖","\\eqcirc",!0);N(P,he,ye,"≗","\\circeq",!0);N(P,he,ye,"≜","\\triangleq",!0);N(P,he,ye,"∼","\\thicksim");N(P,he,ye,"≈","\\thickapprox");N(P,he,ye,"⫆","\\supseteqq",!0);N(P,he,ye,"⋑","\\Supset",!0);N(P,he,ye,"⊐","\\sqsupset",!0);N(P,he,ye,"≽","\\succcurlyeq",!0);N(P,he,ye,"⋟","\\curlyeqsucc",!0);N(P,he,ye,"≿","\\succsim",!0);N(P,he,ye,"⪸","\\succapprox",!0);N(P,he,ye,"⊳","\\vartriangleright");N(P,he,ye,"⊵","\\trianglerighteq");N(P,he,ye,"⊩","\\Vdash",!0);N(P,he,ye,"∣","\\shortmid");N(P,he,ye,"∥","\\shortparallel");N(P,he,ye,"≬","\\between",!0);N(P,he,ye,"⋔","\\pitchfork",!0);N(P,he,ye,"∝","\\varpropto");N(P,he,ye,"◀","\\blacktriangleleft");N(P,he,ye,"∴","\\therefore",!0);N(P,he,ye,"∍","\\backepsilon");N(P,he,ye,"▶","\\blacktriangleright");N(P,he,ye,"∵","\\because",!0);N(P,he,ye,"⋘","\\llless");N(P,he,ye,"⋙","\\gggtr");N(P,he,yn,"⊲","\\lhd");N(P,he,yn,"⊳","\\rhd");N(P,he,ye,"≂","\\eqsim",!0);N(P,G,ye,"⋈","\\Join");N(P,he,ye,"≑","\\Doteq",!0);N(P,he,yn,"∔","\\dotplus",!0);N(P,he,yn,"∖","\\smallsetminus");N(P,he,yn,"⋒","\\Cap",!0);N(P,he,yn,"⋓","\\Cup",!0);N(P,he,yn,"⩞","\\doublebarwedge",!0);N(P,he,yn,"⊟","\\boxminus",!0);N(P,he,yn,"⊞","\\boxplus",!0);N(P,he,yn,"⋇","\\divideontimes",!0);N(P,he,yn,"⋉","\\ltimes",!0);N(P,he,yn,"⋊","\\rtimes",!0);N(P,he,yn,"⋋","\\leftthreetimes",!0);N(P,he,yn,"⋌","\\rightthreetimes",!0);N(P,he,yn,"⋏","\\curlywedge",!0);N(P,he,yn,"⋎","\\curlyvee",!0);N(P,he,yn,"⊝","\\circleddash",!0);N(P,he,yn,"⊛","\\circledast",!0);N(P,he,yn,"⋅","\\centerdot");N(P,he,yn,"⊺","\\intercal",!0);N(P,he,yn,"⋒","\\doublecap");N(P,he,yn,"⋓","\\doublecup");N(P,he,yn,"⊠","\\boxtimes",!0);N(P,he,ye,"⇢","\\dashrightarrow",!0);N(P,he,ye,"⇠","\\dashleftarrow",!0);N(P,he,ye,"⇇","\\leftleftarrows",!0);N(P,he,ye,"⇆","\\leftrightarrows",!0);N(P,he,ye,"⇚","\\Lleftarrow",!0);N(P,he,ye,"↞","\\twoheadleftarrow",!0);N(P,he,ye,"↢","\\leftarrowtail",!0);N(P,he,ye,"↫","\\looparrowleft",!0);N(P,he,ye,"⇋","\\leftrightharpoons",!0);N(P,he,ye,"↶","\\curvearrowleft",!0);N(P,he,ye,"↺","\\circlearrowleft",!0);N(P,he,ye,"↰","\\Lsh",!0);N(P,he,ye,"⇈","\\upuparrows",!0);N(P,he,ye,"↿","\\upharpoonleft",!0);N(P,he,ye,"⇃","\\downharpoonleft",!0);N(P,G,ye,"⊶","\\origof",!0);N(P,G,ye,"⊷","\\imageof",!0);N(P,he,ye,"⊸","\\multimap",!0);N(P,he,ye,"↭","\\leftrightsquigarrow",!0);N(P,he,ye,"⇉","\\rightrightarrows",!0);N(P,he,ye,"⇄","\\rightleftarrows",!0);N(P,he,ye,"↠","\\twoheadrightarrow",!0);N(P,he,ye,"↣","\\rightarrowtail",!0);N(P,he,ye,"↬","\\looparrowright",!0);N(P,he,ye,"↷","\\curvearrowright",!0);N(P,he,ye,"↻","\\circlearrowright",!0);N(P,he,ye,"↱","\\Rsh",!0);N(P,he,ye,"⇊","\\downdownarrows",!0);N(P,he,ye,"↾","\\upharpoonright",!0);N(P,he,ye,"⇂","\\downharpoonright",!0);N(P,he,ye,"⇝","\\rightsquigarrow",!0);N(P,he,ye,"⇝","\\leadsto");N(P,he,ye,"⇛","\\Rrightarrow",!0);N(P,he,ye,"↾","\\restriction");N(P,G,Se,"‘","`");N(P,G,Se,"$","\\$");N(bt,G,Se,"$","\\$");N(bt,G,Se,"$","\\textdollar");N(P,G,Se,"%","\\%");N(bt,G,Se,"%","\\%");N(P,G,Se,"_","\\_");N(bt,G,Se,"_","\\_");N(bt,G,Se,"_","\\textunderscore");N(P,G,Se,"∠","\\angle",!0);N(P,G,Se,"∞","\\infty",!0);N(P,G,Se,"′","\\prime");N(P,G,Se,"△","\\triangle");N(P,G,Se,"Γ","\\Gamma",!0);N(P,G,Se,"Δ","\\Delta",!0);N(P,G,Se,"Θ","\\Theta",!0);N(P,G,Se,"Λ","\\Lambda",!0);N(P,G,Se,"Ξ","\\Xi",!0);N(P,G,Se,"Π","\\Pi",!0);N(P,G,Se,"Σ","\\Sigma",!0);N(P,G,Se,"Υ","\\Upsilon",!0);N(P,G,Se,"Φ","\\Phi",!0);N(P,G,Se,"Ψ","\\Psi",!0);N(P,G,Se,"Ω","\\Omega",!0);N(P,G,Se,"A","Α");N(P,G,Se,"B","Β");N(P,G,Se,"E","Ε");N(P,G,Se,"Z","Ζ");N(P,G,Se,"H","Η");N(P,G,Se,"I","Ι");N(P,G,Se,"K","Κ");N(P,G,Se,"M","Μ");N(P,G,Se,"N","Ν");N(P,G,Se,"O","Ο");N(P,G,Se,"P","Ρ");N(P,G,Se,"T","Τ");N(P,G,Se,"X","Χ");N(P,G,Se,"¬","\\neg",!0);N(P,G,Se,"¬","\\lnot");N(P,G,Se,"⊤","\\top");N(P,G,Se,"⊥","\\bot");N(P,G,Se,"∅","\\emptyset");N(P,he,Se,"∅","\\varnothing");N(P,G,Xn,"α","\\alpha",!0);N(P,G,Xn,"β","\\beta",!0);N(P,G,Xn,"γ","\\gamma",!0);N(P,G,Xn,"δ","\\delta",!0);N(P,G,Xn,"ϵ","\\epsilon",!0);N(P,G,Xn,"ζ","\\zeta",!0);N(P,G,Xn,"η","\\eta",!0);N(P,G,Xn,"θ","\\theta",!0);N(P,G,Xn,"ι","\\iota",!0);N(P,G,Xn,"κ","\\kappa",!0);N(P,G,Xn,"λ","\\lambda",!0);N(P,G,Xn,"μ","\\mu",!0);N(P,G,Xn,"ν","\\nu",!0);N(P,G,Xn,"ξ","\\xi",!0);N(P,G,Xn,"ο","\\omicron",!0);N(P,G,Xn,"π","\\pi",!0);N(P,G,Xn,"ρ","\\rho",!0);N(P,G,Xn,"σ","\\sigma",!0);N(P,G,Xn,"τ","\\tau",!0);N(P,G,Xn,"υ","\\upsilon",!0);N(P,G,Xn,"ϕ","\\phi",!0);N(P,G,Xn,"χ","\\chi",!0);N(P,G,Xn,"ψ","\\psi",!0);N(P,G,Xn,"ω","\\omega",!0);N(P,G,Xn,"ε","\\varepsilon",!0);N(P,G,Xn,"ϑ","\\vartheta",!0);N(P,G,Xn,"ϖ","\\varpi",!0);N(P,G,Xn,"ϱ","\\varrho",!0);N(P,G,Xn,"ς","\\varsigma",!0);N(P,G,Xn,"φ","\\varphi",!0);N(P,G,yn,"∗","*",!0);N(P,G,yn,"+","+");N(P,G,yn,"−","-",!0);N(P,G,yn,"⋅","\\cdot",!0);N(P,G,yn,"∘","\\circ",!0);N(P,G,yn,"÷","\\div",!0);N(P,G,yn,"±","\\pm",!0);N(P,G,yn,"×","\\times",!0);N(P,G,yn,"∩","\\cap",!0);N(P,G,yn,"∪","\\cup",!0);N(P,G,yn,"∖","\\setminus",!0);N(P,G,yn,"∧","\\land");N(P,G,yn,"∨","\\lor");N(P,G,yn,"∧","\\wedge",!0);N(P,G,yn,"∨","\\vee",!0);N(P,G,Se,"√","\\surd");N(P,G,cc,"⟨","\\langle",!0);N(P,G,cc,"∣","\\lvert");N(P,G,cc,"∥","\\lVert");N(P,G,Ka,"?","?");N(P,G,Ka,"!","!");N(P,G,Ka,"⟩","\\rangle",!0);N(P,G,Ka,"∣","\\rvert");N(P,G,Ka,"∥","\\rVert");N(P,G,ye,"=","=");N(P,G,ye,":",":");N(P,G,ye,"≈","\\approx",!0);N(P,G,ye,"≅","\\cong",!0);N(P,G,ye,"≥","\\ge");N(P,G,ye,"≥","\\geq",!0);N(P,G,ye,"←","\\gets");N(P,G,ye,">","\\gt",!0);N(P,G,ye,"∈","\\in",!0);N(P,G,ye,"","\\@not");N(P,G,ye,"⊂","\\subset",!0);N(P,G,ye,"⊃","\\supset",!0);N(P,G,ye,"⊆","\\subseteq",!0);N(P,G,ye,"⊇","\\supseteq",!0);N(P,he,ye,"⊈","\\nsubseteq",!0);N(P,he,ye,"⊉","\\nsupseteq",!0);N(P,G,ye,"⊨","\\models");N(P,G,ye,"←","\\leftarrow",!0);N(P,G,ye,"≤","\\le");N(P,G,ye,"≤","\\leq",!0);N(P,G,ye,"<","\\lt",!0);N(P,G,ye,"→","\\rightarrow",!0);N(P,G,ye,"→","\\to");N(P,he,ye,"≱","\\ngeq",!0);N(P,he,ye,"≰","\\nleq",!0);N(P,G,Vh," ","\\ ");N(P,G,Vh," ","\\space");N(P,G,Vh," ","\\nobreakspace");N(bt,G,Vh," ","\\ ");N(bt,G,Vh," "," ");N(bt,G,Vh," ","\\space");N(bt,G,Vh," ","\\nobreakspace");N(P,G,Vh,"","\\nobreak");N(P,G,Vh,"","\\allowbreak");N(P,G,Mw,",",",");N(P,G,Mw,";",";");N(P,he,yn,"⊼","\\barwedge",!0);N(P,he,yn,"⊻","\\veebar",!0);N(P,G,yn,"⊙","\\odot",!0);N(P,G,yn,"⊕","\\oplus",!0);N(P,G,yn,"⊗","\\otimes",!0);N(P,G,Se,"∂","\\partial",!0);N(P,G,yn,"⊘","\\oslash",!0);N(P,he,yn,"⊚","\\circledcirc",!0);N(P,he,yn,"⊡","\\boxdot",!0);N(P,G,yn,"△","\\bigtriangleup");N(P,G,yn,"▽","\\bigtriangledown");N(P,G,yn,"†","\\dagger");N(P,G,yn,"⋄","\\diamond");N(P,G,yn,"⋆","\\star");N(P,G,yn,"◃","\\triangleleft");N(P,G,yn,"▹","\\triangleright");N(P,G,cc,"{","\\{");N(bt,G,Se,"{","\\{");N(bt,G,Se,"{","\\textbraceleft");N(P,G,Ka,"}","\\}");N(bt,G,Se,"}","\\}");N(bt,G,Se,"}","\\textbraceright");N(P,G,cc,"{","\\lbrace");N(P,G,Ka,"}","\\rbrace");N(P,G,cc,"[","\\lbrack",!0);N(bt,G,Se,"[","\\lbrack",!0);N(P,G,Ka,"]","\\rbrack",!0);N(bt,G,Se,"]","\\rbrack",!0);N(P,G,cc,"(","\\lparen",!0);N(P,G,Ka,")","\\rparen",!0);N(bt,G,Se,"<","\\textless",!0);N(bt,G,Se,">","\\textgreater",!0);N(P,G,cc,"⌊","\\lfloor",!0);N(P,G,Ka,"⌋","\\rfloor",!0);N(P,G,cc,"⌈","\\lceil",!0);N(P,G,Ka,"⌉","\\rceil",!0);N(P,G,Se,"\\","\\backslash");N(P,G,Se,"∣","|");N(P,G,Se,"∣","\\vert");N(bt,G,Se,"|","\\textbar",!0);N(P,G,Se,"∥","\\|");N(P,G,Se,"∥","\\Vert");N(bt,G,Se,"∥","\\textbardbl");N(bt,G,Se,"~","\\textasciitilde");N(bt,G,Se,"\\","\\textbackslash");N(bt,G,Se,"^","\\textasciicircum");N(P,G,ye,"↑","\\uparrow",!0);N(P,G,ye,"⇑","\\Uparrow",!0);N(P,G,ye,"↓","\\downarrow",!0);N(P,G,ye,"⇓","\\Downarrow",!0);N(P,G,ye,"↕","\\updownarrow",!0);N(P,G,ye,"⇕","\\Updownarrow",!0);N(P,G,po,"∐","\\coprod");N(P,G,po,"⋁","\\bigvee");N(P,G,po,"⋀","\\bigwedge");N(P,G,po,"⨄","\\biguplus");N(P,G,po,"⋂","\\bigcap");N(P,G,po,"⋃","\\bigcup");N(P,G,po,"∫","\\int");N(P,G,po,"∫","\\intop");N(P,G,po,"∬","\\iint");N(P,G,po,"∭","\\iiint");N(P,G,po,"∏","\\prod");N(P,G,po,"∑","\\sum");N(P,G,po,"⨂","\\bigotimes");N(P,G,po,"⨁","\\bigoplus");N(P,G,po,"⨀","\\bigodot");N(P,G,po,"∮","\\oint");N(P,G,po,"∯","\\oiint");N(P,G,po,"∰","\\oiiint");N(P,G,po,"⨆","\\bigsqcup");N(P,G,po,"∫","\\smallint");N(bt,G,Fb,"…","\\textellipsis");N(P,G,Fb,"…","\\mathellipsis");N(bt,G,Fb,"…","\\ldots",!0);N(P,G,Fb,"…","\\ldots",!0);N(P,G,Fb,"⋯","\\@cdots",!0);N(P,G,Fb,"⋱","\\ddots",!0);N(P,G,Se,"⋮","\\varvdots");N(bt,G,Se,"⋮","\\varvdots");N(P,G,wi,"ˊ","\\acute");N(P,G,wi,"ˋ","\\grave");N(P,G,wi,"¨","\\ddot");N(P,G,wi,"~","\\tilde");N(P,G,wi,"ˉ","\\bar");N(P,G,wi,"˘","\\breve");N(P,G,wi,"ˇ","\\check");N(P,G,wi,"^","\\hat");N(P,G,wi,"⃗","\\vec");N(P,G,wi,"˙","\\dot");N(P,G,wi,"˚","\\mathring");N(P,G,Xn,"","\\@imath");N(P,G,Xn,"","\\@jmath");N(P,G,Se,"ı","ı");N(P,G,Se,"ȷ","ȷ");N(bt,G,Se,"ı","\\i",!0);N(bt,G,Se,"ȷ","\\j",!0);N(bt,G,Se,"ß","\\ss",!0);N(bt,G,Se,"æ","\\ae",!0);N(bt,G,Se,"œ","\\oe",!0);N(bt,G,Se,"ø","\\o",!0);N(bt,G,Se,"Æ","\\AE",!0);N(bt,G,Se,"Œ","\\OE",!0);N(bt,G,Se,"Ø","\\O",!0);N(bt,G,wi,"ˊ","\\'");N(bt,G,wi,"ˋ","\\`");N(bt,G,wi,"ˆ","\\^");N(bt,G,wi,"˜","\\~");N(bt,G,wi,"ˉ","\\=");N(bt,G,wi,"˘","\\u");N(bt,G,wi,"˙","\\.");N(bt,G,wi,"¸","\\c");N(bt,G,wi,"˚","\\r");N(bt,G,wi,"ˇ","\\v");N(bt,G,wi,"¨",'\\"');N(bt,G,wi,"˝","\\H");N(bt,G,wi,"◯","\\textcircled");var TQ={"--":!0,"---":!0,"``":!0,"''":!0};N(bt,G,Se,"–","--",!0);N(bt,G,Se,"–","\\textendash");N(bt,G,Se,"—","---",!0);N(bt,G,Se,"—","\\textemdash");N(bt,G,Se,"‘","`",!0);N(bt,G,Se,"‘","\\textquoteleft");N(bt,G,Se,"’","'",!0);N(bt,G,Se,"’","\\textquoteright");N(bt,G,Se,"“","``",!0);N(bt,G,Se,"“","\\textquotedblleft");N(bt,G,Se,"”","''",!0);N(bt,G,Se,"”","\\textquotedblright");N(P,G,Se,"°","\\degree",!0);N(bt,G,Se,"°","\\degree");N(bt,G,Se,"°","\\textdegree",!0);N(P,G,Se,"£","\\pounds");N(P,G,Se,"£","\\mathsterling",!0);N(bt,G,Se,"£","\\pounds");N(bt,G,Se,"£","\\textsterling",!0);N(P,he,Se,"✠","\\maltese");N(bt,he,Se,"✠","\\maltese");var yB='0123456789/@."';for(var Y6=0;Y6<yB.length;Y6++){var vB=yB.charAt(Y6);N(P,G,Se,vB,vB)}var xB='0123456789!@*()-=+";:?/.,';for(var X6=0;X6<xB.length;X6++){var wB=xB.charAt(X6);N(bt,G,Se,wB,wB)}var g4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var Q6=0;Q6<g4.length;Q6++){var m_=g4.charAt(Q6);N(P,G,Xn,m_,m_),N(bt,G,Se,m_,m_)}N(P,he,Se,"C","ℂ");N(bt,he,Se,"C","ℂ");N(P,he,Se,"H","ℍ");N(bt,he,Se,"H","ℍ");N(P,he,Se,"N","ℕ");N(bt,he,Se,"N","ℕ");N(P,he,Se,"P","ℙ");N(bt,he,Se,"P","ℙ");N(P,he,Se,"Q","ℚ");N(bt,he,Se,"Q","ℚ");N(P,he,Se,"R","ℝ");N(bt,he,Se,"R","ℝ");N(P,he,Se,"Z","ℤ");N(bt,he,Se,"Z","ℤ");N(P,G,Xn,"h","ℎ");N(bt,G,Xn,"h","ℎ");var cs;for(var Ma=0;Ma<g4.length;Ma++){var Li=g4.charAt(Ma);cs=String.fromCharCode(55349,56320+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56372+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56424+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56580+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56684+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56736+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56788+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56840+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56944+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),Ma<26&&(cs=String.fromCharCode(55349,56632+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs),cs=String.fromCharCode(55349,56476+Ma),N(P,G,Xn,Li,cs),N(bt,G,Se,Li,cs))}cs="𝕜";N(P,G,Xn,"k",cs);N(bt,G,Se,"k",cs);for(var xp=0;xp<10;xp++){var gf=xp.toString();cs=String.fromCharCode(55349,57294+xp),N(P,G,Xn,gf,cs),N(bt,G,Se,gf,cs),cs=String.fromCharCode(55349,57314+xp),N(P,G,Xn,gf,cs),N(bt,G,Se,gf,cs),cs=String.fromCharCode(55349,57324+xp),N(P,G,Xn,gf,cs),N(bt,G,Se,gf,cs),cs=String.fromCharCode(55349,57334+xp),N(P,G,Xn,gf,cs),N(bt,G,Se,gf,cs)}var $A="ÐÞþ";for(var J6=0;J6<$A.length;J6++){var p_=$A.charAt(J6);N(P,G,Xn,p_,p_),N(bt,G,Se,p_,p_)}var BA={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},kB={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},_B={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},mSe={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},zp={mathClass:"",textClass:"",font:""},SB={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},CB={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},TB={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},zA={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},FA={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},EB={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},HA={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},AB=[BA,BA,kB,kB,_B,_B,mSe,zp,zp,zp,SB,SB,CB,CB,TB,TB,zA,zA,FA,FA,EB,EB,zp,zp,HA,HA],pSe=[BA,zp,zA,FA,HA],gSe=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),s=(t-55296)*1024+(n-56320)+65536;if(119808<=s&&s<120484){var r=Math.floor((s-119808)/26);return AB[r]}else if(120782<=s&&s<=120831){var i=Math.floor((s-120782)/10);return pSe[i]}else{if(s===120485||s===120486)return AB[0];if(120486<s&&s<120782)return zp;throw new Tt("Unsupported character: "+e)}},vC=function(t,n,s){if(vi[s][t]){var r=vi[s][t].replace;r&&(t=r)}return{value:t,metrics:sI(t,n,s)}},Pa=function(t,n,s,r,i){var o=vC(t,n,s),a=o.metrics;t=o.value;var c;if(a){var u=a.italic;(s==="text"||r&&r.font==="mathit")&&(u=0),c=new ac(t,a.height,a.depth,u,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+s+"'")),c=new ac(t,0,0,0,0,0,i);if(r){c.maxFontSize=r.sizeMultiplier,r.style.isTight()&&c.classes.push("mtight");var d=r.getColor();d&&(c.style.color=d)}return c},rI=function(t,n,s,r){return r===void 0&&(r=[]),s.font==="boldsymbol"&&vC(t,"Main-Bold",n).metrics?Pa(t,"Main-Bold",n,s,r.concat(["mathbf"])):t==="\\"||vi[n][t].font==="main"?Pa(t,"Main-Regular",n,s,r):Pa(t,"AMS-Regular",n,s,r.concat(["amsrm"]))},bSe=function(t,n,s){return s!=="textord"&&vC(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},xC=function(t,n,s){var r=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:c,fontWeight:u,fontShape:d}=n,h=r==="math"||r==="text"&&!!a,m=h?a:c,p="",g="";if(i.charCodeAt(0)===55349){var b=gSe(i);p=b.font,g=b[r+"Class"]}if(p)return Pa(i,p,r,n,o.concat(g));if(m){var x,y;if(m==="boldsymbol"){var v=bSe(i,r,s);x=v.fontName,y=[v.fontClass]}else h?(x=qA[a].fontName,y=[a]):(x=g_(c,u,d),y=[c,u,d]);if(vC(i,x,r).metrics)return Pa(i,x,r,n,o.concat(y));if(TQ.hasOwnProperty(i)&&x.slice(0,10)==="Typewriter"){for(var w=[],k=0;k<i.length;k++)w.push(Pa(i[k],x,r,n,o.concat(y)));return Gh(w)}}if(s==="mathord")return Pa(i,"Math-Italic",r,n,o.concat(["mathnormal"]));if(s==="textord"){var T=vi[r][i]&&vi[r][i].font;if(T==="ams"){var C=g_("amsrm",u,d);return Pa(i,C,r,n,o.concat("amsrm",u,d))}else if(T==="main"||!T){var _=g_("textrm",u,d);return Pa(i,_,r,n,o.concat(u,d))}else{var S=g_(T,u,d);return Pa(i,S,r,n,o.concat(S,u,d))}}else throw new Error("unexpected type: "+s+" in makeOrd")},ySe=(e,t)=>{if(ym(e.classes)!==ym(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 s of Object.keys(e.style))if(e.style[s]!==t.style[s])return!1;for(var r of Object.keys(t.style))if(e.style[r]!==t.style[r])return!1;return!0},EQ=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],s=e[t+1];n instanceof ac&&s instanceof ac&&ySe(n,s)&&(n.text+=s.text,n.height=Math.max(n.height,s.height),n.depth=Math.max(n.depth,s.depth),n.italic=s.italic,e.splice(t+1,1),t--)}return e},iI=function(t){for(var n=0,s=0,r=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>n&&(n=o.height),o.depth>s&&(s=o.depth),o.maxFontSize>r&&(r=o.maxFontSize)}t.height=n,t.depth=s,t.maxFontSize=r},wt=function(t,n,s,r){var i=new zb(t,n,s,r);return iI(i),i},xm=(e,t,n,s)=>new zb(e,t,n,s),rb=function(t,n,s){var r=wt([t],[],n);return r.height=Math.max(s||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),r.style.borderBottomWidth=Ot(r.height),r.maxFontSize=1,r},vSe=function(t,n,s,r){var i=new yC(t,n,s,r);return iI(i),i},Gh=function(t){var n=new Bb(t);return iI(n),n},ib=function(t,n){return t instanceof Bb?wt([],[t],n):t},xSe=function(t){if(t.positionType==="individualShift"){for(var n=t.children,s=[n[0]],r=-n[0].shift-n[0].elem.depth,i=r,o=1;o<n.length;o++){var a=-n[o].shift-i-n[o].elem.depth,c=a-(n[o-1].elem.height+n[o-1].elem.depth);i=i+a,s.push({type:"kern",size:c}),s.push(n[o])}return{children:s,depth:r}}var u;if(t.positionType==="top"){for(var d=t.positionData,h=0;h<t.children.length;h++){var m=t.children[h];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}},kr=function(t,n){for(var{children:s,depth:r}=xSe(t),i=0,o=0;o<s.length;o++){var a=s[o];if(a.type==="elem"){var c=a.elem;i=Math.max(i,c.maxFontSize,c.height)}}i+=2;var u=wt(["pstrut"],[]);u.style.height=Ot(i);for(var d=[],h=r,m=r,p=r,g=0;g<s.length;g++){var b=s[g];if(b.type==="kern")p+=b.size;else{var x=b.elem,y=b.wrapperClasses||[],v=b.wrapperStyle||{},w=wt(y,[u,x],void 0,v);w.style.top=Ot(-i-p-x.depth),b.marginLeft&&(w.style.marginLeft=b.marginLeft),b.marginRight&&(w.style.marginRight=b.marginRight),d.push(w),p+=x.height+x.depth}h=Math.min(h,p),m=Math.max(m,p)}var k=wt(["vlist"],d);k.style.height=Ot(m);var T;if(h<0){var C=wt([],[]),_=wt(["vlist"],[C]);_.style.height=Ot(-h);var S=wt(["vlist-s"],[new ac("​")]);T=[wt(["vlist-r"],[k,S]),wt(["vlist-r"],[_])]}else T=[wt(["vlist-r"],[k])];var D=wt(["vlist-t"],T);return T.length===2&&D.classes.push("vlist-t2"),D.height=m,D.depth=-h,D},AQ=(e,t)=>{var n=wt(["mspace"],[],t),s=Mi(e,t);return n.style.marginRight=Ot(s),n},g_=(e,t,n)=>{var s,r;switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}return t==="textbf"&&n==="textit"?r="BoldItalic":t==="textbf"?r="Bold":n==="textit"?r="Italic":r="Regular",s+"-"+r},qA={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"}},jQ={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},NQ=function(t,n){var[s,r,i]=jQ[t],o=new vm(s),a=new $h([o],{width:Ot(r),height:Ot(i),style:"width:"+Ot(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=xm(["overlay"],[a],n);return c.height=i,c.style.height=Ot(i),c.style.width=Ot(r),c},Ti={number:3,unit:"mu"},wp={number:4,unit:"mu"},Qd={number:5,unit:"mu"},wSe={mord:{mop:Ti,mbin:wp,mrel:Qd,minner:Ti},mop:{mord:Ti,mop:Ti,mrel:Qd,minner:Ti},mbin:{mord:wp,mop:wp,mopen:wp,minner:wp},mrel:{mord:Qd,mop:Qd,mopen:Qd,minner:Qd},mopen:{},mclose:{mop:Ti,mbin:wp,mrel:Qd,minner:Ti},mpunct:{mord:Ti,mop:Ti,mrel:Qd,mopen:Ti,mclose:Ti,mpunct:Ti,minner:Ti},minner:{mord:Ti,mop:Ti,mbin:wp,mrel:Qd,mopen:Ti,mpunct:Ti,minner:Ti}},kSe={mord:{mop:Ti},mop:{mord:Ti,mop:Ti},mbin:{},mrel:{},mopen:{},mclose:{mop:Ti},mpunct:{},minner:{mop:Ti}},MQ={},b4={},y4={};function ln(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:s.numArgs,argTypes:s.argTypes,allowedInArgument:!!s.allowedInArgument,allowedInText:!!s.allowedInText,allowedInMath:s.allowedInMath===void 0?!0:s.allowedInMath,numOptionalArgs:s.numOptionalArgs||0,infix:!!s.infix,primitive:!!s.primitive,handler:r},c=0;c<n.length;++c)MQ[n[c]]=a;t&&(i&&(b4[t]=i),o&&(y4[t]=o))}function H0(e){var{type:t,htmlBuilder:n,mathmlBuilder:s}=e;ln({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:s})}var v4=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},uo=function(t){return t.type==="ordgroup"?t.body:[t]},_Se=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),SSe=new Set(["rightmost","mrel","mclose","mpunct"]),CSe={display:ks.DISPLAY,text:ks.TEXT,script:ks.SCRIPT,scriptscript:ks.SCRIPTSCRIPT},TSe={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},jo=function(t,n,s,r){r===void 0&&(r=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=Sr(t[o],n);if(a instanceof Bb){var c=a.children;i.push(...c)}else i.push(a)}if(EQ(i),!s)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(CSe[d.style]))}var h=wt([r[0]||"leftmost"],[],n),m=wt([r[1]||"rightmost"],[],n),p=s==="root";return UA(i,(g,b)=>{var x=b.classes[0],y=g.classes[0];x==="mbin"&&SSe.has(y)?b.classes[0]="mord":y==="mbin"&&_Se.has(x)&&(g.classes[0]="mord")},{node:h},m,p),UA(i,(g,b)=>{var x,y,v=VA(b),w=VA(g),k=v&&w?g.hasClass("mtight")?(x=kSe[v])==null?void 0:x[w]:(y=wSe[v])==null?void 0:y[w]:null;if(k)return AQ(k,u)},{node:h},m,p),i},UA=function(t,n,s,r,i){r&&t.push(r);for(var o=0;o<t.length;o++){var a=t[o],c=IQ(a);if(c){UA(c.children,n,s,null,i);continue}var u=!a.hasClass("mspace");if(u){var d=n(a,s.node);d&&(s.insertAfter?s.insertAfter(d):(t.unshift(d),o++))}u?s.node=a:i&&a.hasClass("newline")&&(s.node=wt(["leftmost"])),s.insertAfter=(h=>m=>{t.splice(h+1,0,m),o++})(o)}r&&t.pop()},IQ=function(t){return t instanceof Bb||t instanceof yC||t instanceof zb&&t.hasClass("enclosing")?t:null},WA=function(t,n){var s=IQ(t);if(s){var r=s.children;if(r.length){if(n==="right")return WA(r[r.length-1],"right");if(n==="left")return WA(r[0],"left")}}return t},VA=function(t,n){if(!t)return null;n&&(t=WA(t,n));var s=t.classes[0];return TSe[s]||null},Nx=function(t,n){var s=["nulldelimiter"].concat(t.baseSizingClasses());return wt(n.concat(s))},Sr=function(t,n,s){if(!t)return wt();if(b4[t.type]){var r=b4[t.type](t,n);if(s&&n.size!==s.size){r=wt(n.sizingClasses(s),[r],n);var i=n.sizeMultiplier/s.sizeMultiplier;r.height*=i,r.depth*=i}return r}else throw new Tt("Got group of unknown type: '"+t.type+"'")};function b_(e,t){var n=wt(["base"],e,t),s=wt(["strut"]);return s.style.height=Ot(n.height+n.depth),n.depth&&(s.style.verticalAlign=Ot(-n.depth)),n.children.unshift(s),n}function GA(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var s=jo(e,t,"root"),r;s.length===2&&s[1].hasClass("tag")&&(r=s.pop());for(var i=[],o=[],a=0;a<s.length;a++)if(o.push(s[a]),s[a].hasClass("mbin")||s[a].hasClass("mrel")||s[a].hasClass("allowbreak")){for(var c=!1;a<s.length-1&&s[a+1].hasClass("mspace")&&!s[a+1].hasClass("newline");)a++,o.push(s[a]),s[a].hasClass("nobreak")&&(c=!0);c||(i.push(b_(o,t)),o=[])}else s[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(b_(o,t)),o=[]),i.push(s[a]));o.length>0&&i.push(b_(o,t));var u;n?(u=b_(jo(n,t,!0),t),u.classes=["tag"],i.push(u)):r&&i.push(r);var d=wt(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),u){var h=u.children[0];h.style.height=Ot(d.height+d.depth),d.depth&&(h.style.verticalAlign=Ot(-d.depth))}return d}function RQ(e){return new Bb(e)}class Nt{constructor(t,n,s){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=s||[]}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=ym(this.classes));for(var s=0;s<this.children.length;s++)if(this.children[s]instanceof ho&&this.children[s+1]instanceof ho){for(var r=this.children[s].toText()+this.children[++s].toText();this.children[s+1]instanceof ho;)r+=this.children[++s].toText();t.appendChild(new ho(r).toNode())}else t.appendChild(this.children[s].toNode());return t}toMarkup(){var t="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=" "+n+'="',t+=ya(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+ya(ym(this.classes))+'"'),t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}let ho=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return ya(this.toText())}toText(){return this.text}};class DQ{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",Ot(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ot(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var ESe=new Set(["\\imath","\\jmath"]),ASe=new Set(["mrow","mtable"]),zc=function(t,n,s){return vi[n][t]&&vi[n][t].replace&&t.charCodeAt(0)!==55349&&!(TQ.hasOwnProperty(t)&&s&&(s.fontFamily&&s.fontFamily.slice(4,6)==="tt"||s.font&&s.font.slice(4,6)==="tt"))&&(t=vi[n][t].replace),new ho(t)},oI=function(t){return t.length===1?t[0]:new Nt("mrow",t)},jSe={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"},aI=(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 s=e.mode,r=jSe[n];if(r)return typeof r=="function"?r(e):r;var i=e.text;if(ESe.has(i))return null;if(vi[s][i]){var o=vi[s][i].replace;o&&(i=o)}var a=qA[n].fontName;return sI(i,a,s)?qA[n].variant:null};function Z6(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof ho&&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 ho&&n.text===","}else return!1}var uc=function(t,n,s){if(t.length===1){var r=Qr(t[0],n);return s&&r instanceof Nt&&r.type==="mo"&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i=[],o,a=0;a<t.length;a++){var c=Qr(t[a],n);if(c instanceof Nt&&o instanceof Nt){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(Z6(c)&&o.type==="mn"){o.children.push(...c.children);continue}else if(c.type==="mn"&&Z6(o))c.children=[...o.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(o.type==="mn"||Z6(o))){var u=c.children[0];u instanceof Nt&&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 ho&&d.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var h=c.children[0];h instanceof ho&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),i.pop())}}}i.push(c),o=c}return i},wm=function(t,n,s){return oI(uc(t,n,s))},Qr=function(t,n){if(!t)return new Nt("mrow");if(y4[t.type])return y4[t.type](t,n);throw new Tt("Got group of unknown type: '"+t.type+"'")};function jB(e,t,n,s,r){var i=uc(e,n),o;i.length===1&&i[0]instanceof Nt&&ASe.has(i[0].type)?o=i[0]:o=new Nt("mrow",i);var a=new Nt("annotation",[new ho(t)]);a.setAttribute("encoding","application/x-tex");var c=new Nt("semantics",[o,a]),u=new Nt("math",[c]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),s&&u.setAttribute("display","block");var d=r?"katex":"katex-mathml";return wt([d],[u])}var NSe=[[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]],NB=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],MB=function(t,n){return n.size<2?t:NSe[t-1][n.size-1]};class rh{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||rh.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=NB[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 rh(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:MB(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:NB[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=MB(rh.BASESIZE,t);return this.size===n&&this.textSize===rh.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!==rh.BASESIZE?["sizing","reset-size"+this.size,"size"+rh.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=fSe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}rh.BASESIZE=6;var LQ=function(t){return new rh({style:t.displayMode?ks.DISPLAY:ks.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},PQ=function(t,n){if(n.displayMode){var s=["katex-display"];n.leqno&&s.push("leqno"),n.fleqn&&s.push("fleqn"),t=wt(s,[t])}return t},MSe=function(t,n,s){var r=LQ(s),i;if(s.output==="mathml")return jB(t,n,r,s.displayMode,!0);if(s.output==="html"){var o=GA(t,r);i=wt(["katex"],[o])}else{var a=jB(t,n,r,s.displayMode,!1),c=GA(t,r);i=wt(["katex"],[a,c])}return PQ(i,s)},ISe=function(t,n,s){var r=LQ(s),i=GA(t,r),o=wt(["katex"],[i]);return PQ(o,s)},RSe={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":"="},wC=function(t){var n=new Nt("mo",[new ho(RSe[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},DSe={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]},LSe=new Set(["widehat","widecheck","widetilde","utilde"]),kC=function(t,n){function s(){var a=4e5,c=t.label.slice(1);if(LSe.has(c)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,d,h,m;if(u>5)c==="widehat"||c==="widecheck"?(d=420,a=2364,m=.42,h=c+"4"):(d=312,a=2340,m=.34,h="tilde4");else{var p=[1,1,2,2,3,3][u];c==="widehat"||c==="widecheck"?(a=[0,1062,2364,2364,2364][p],d=[0,239,300,360,420][p],m=[0,.24,.3,.3,.36,.42][p],h=c+p):(a=[0,600,1033,2339,2340][p],d=[0,260,286,306,312][p],m=[0,.26,.286,.3,.306,.34][p],h="tilde"+p)}var g=new vm(h),b=new $h([g],{width:"100%",height:Ot(m),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:xm([],[b],n),minWidth:0,height:m}}else{var x=[],y=DSe[c];if(!y)throw new Error('No SVG data for "'+c+'".');var[v,w,k]=y,T=k/1e3,C=v.length,_,S;if(C===1){if(y.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+c+'".');_=["hide-tail"],S=[y[3]]}else if(C===2)_=["halfarrow-left","halfarrow-right"],S=["xMinYMin","xMaxYMin"];else if(C===3)_=["brace-left","brace-center","brace-right"],S=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+C+" children.");for(var D=0;D<C;D++){var E=new vm(v[D]),B=new $h([E],{width:"400em",height:Ot(T),viewBox:"0 0 "+a+" "+k,preserveAspectRatio:S[D]+" slice"}),I=xm([_[D]],[B],n);if(C===1)return{span:I,minWidth:w,height:T};I.style.height=Ot(T),x.push(I)}return{span:wt(["stretchy"],x,n),minWidth:w,height:T}}}var{span:r,minWidth:i,height:o}=s();return r.height=o,r.style.height=Ot(o),i>0&&(r.style.minWidth=Ot(i)),r},PSe=function(t,n,s,r,i){var o,a=t.height+t.depth+s+r;if(/fbox|color|angl/.test(n)){if(o=wt(["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 OA({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&u.push(new OA({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new $h(u,{width:"100%",height:Ot(a)});o=xm([],[d],i)}return o.height=a,o.style.height=Ot(a),o},OSe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},$Se={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function BSe(e){return e in OSe}function Ls(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 _C(e){var t=SC(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 SC(e){return e&&(e.type==="atom"||$Se.hasOwnProperty(e.type))?e:null}var OQ=e=>{if(e instanceof ac)return e;if(hSe(e)&&e.children.length===1)return OQ(e.children[0])},lI=(e,t)=>{var n,s,r;e&&e.type==="supsub"?(s=Ls(e.base,"accent"),n=s.base,e.base=n,r=dSe(Sr(e,t)),e.base=s):(s=Ls(e,"accent"),n=s.base);var i=Sr(n,t.havingCrampedStyle()),o=s.isShifty&&Wh(n),a=0;if(o){var c,u;a=(c=(u=OQ(i))==null?void 0:u.skew)!=null?c:0}var d=s.label==="\\c",h=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),m;if(s.isStretchy)m=kC(s,t),m=kr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Ot(2*a)+")",marginLeft:Ot(2*a)}:void 0}]});else{var p,g;s.label==="\\vec"?(p=NQ("vec",t),g=jQ.vec[1]):(p=xC({mode:s.mode,text:s.label},t,"textord"),p=uSe(p),p.italic=0,g=p.width,d&&(h+=p.depth)),m=wt(["accent-body"],[p]);var b=s.label==="\\textcircled";b&&(m.classes.push("accent-full"),h=i.height);var x=a;b||(x-=g/2),m.style.left=Ot(x),s.label==="\\textcircled"&&(m.style.top=".2em"),m=kr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-h},{type:"elem",elem:m}]})}var y=wt(["mord","accent"],[m],t);return r?(r.children[0]=y,r.height=Math.max(y.height,r.height),r.classes[0]="mord",r):y},$Q=(e,t)=>{var n=e.isStretchy?wC(e.label):new Nt("mo",[zc(e.label,e.mode)]),s=new Nt("mover",[Qr(e.base,t),n]);return s.setAttribute("accent","true"),s},zSe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));ln({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=v4(t[0]),s=!zSe.test(e.funcName),r=!s||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:s,isShifty:r,base:n}},htmlBuilder:lI,mathmlBuilder:$Q});ln({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],s=e.parser.mode;return s==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),s="text"),{type:"accent",mode:s,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:lI,mathmlBuilder:$Q});ln({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"accentUnder",mode:n.mode,label:s,base:r}},htmlBuilder:(e,t)=>{var n=Sr(e.base,t),s=kC(e,t),r=e.label==="\\utilde"?.12:0,i=kr({positionType:"top",positionData:n.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:r},{type:"elem",elem:n}]});return wt(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=wC(e.label),s=new Nt("munder",[Qr(e.base,t),n]);return s.setAttribute("accentunder","true"),s}});var y_=e=>{var t=new Nt("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};ln({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:s,funcName:r}=e;return{type:"xArrow",mode:s.mode,label:r,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,s=t.havingStyle(n.sup()),r=ib(Sr(e.body,s,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";r.classes.push(i+"-arrow-pad");var o;e.below&&(s=t.havingStyle(n.sub()),o=ib(Sr(e.below,s,t),t),o.classes.push(i+"-arrow-pad"));var a=kC(e,t),c=-t.fontMetrics().axisHeight+.5*a.height,u=-t.fontMetrics().axisHeight-.5*a.height-.111;(r.depth>.25||e.label==="\\xleftequilibrium")&&(u-=r.depth);var d;if(o){var h=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=kr({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:a,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:h}]})}else d=kr({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:a,shift:c,wrapperClasses:["svg-align"]}]});return wt(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=wC(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var s;if(e.body){var r=y_(Qr(e.body,t));if(e.below){var i=y_(Qr(e.below,t));s=new Nt("munderover",[n,i,r])}else s=new Nt("mover",[n,r])}else if(e.below){var o=y_(Qr(e.below,t));s=new Nt("munder",[n,o])}else s=y_(),s=new Nt("mover",[n,s]);return s}});function BQ(e,t){var n=jo(e.body,t,!0);return wt([e.mclass],n,t)}function zQ(e,t){var n,s=uc(e.body,t);return e.mclass==="minner"?n=new Nt("mpadded",s):e.mclass==="mord"?e.isCharacterBox?(n=s[0],n.type="mi"):n=new Nt("mi",s):(e.isCharacterBox?(n=s[0],n.type="mo"):n=new Nt("mo",s),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}ln({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+s.slice(5),body:uo(r),isCharacterBox:Wh(r)}},htmlBuilder:BQ,mathmlBuilder:zQ});var CC=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"};ln({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:CC(t[0]),body:uo(t[1]),isCharacterBox:Wh(t[1])}}});ln({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:s}=e,r=t[1],i=t[0],o;s!=="\\stackrel"?o=CC(r):o="mrel";var a={type:"op",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:s!=="\\stackrel",body:uo(r)},c={type:"supsub",mode:i.mode,base:a,sup:s==="\\underset"?null:i,sub:s==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[c],isCharacterBox:Wh(c)}},htmlBuilder:BQ,mathmlBuilder:zQ});ln({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:CC(t[0]),body:uo(t[0])}},htmlBuilder(e,t){var n=jo(e.body,t,!0),s=wt([e.mclass],n,t);return s.style.textShadow="0.02em 0.01em 0.04px",s},mathmlBuilder(e,t){var n=uc(e.body,t),s=new Nt("mstyle",n);return s.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),s}});var FSe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},IB=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),RB=e=>e.type==="textord"&&e.text==="@",HSe=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function qSe(e,t,n){var s=FSe[e];switch(s){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(s,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var r=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:s,mode:"math",family:"rel"},o=n.callFunction("\\Big",[i],[]),a=n.callFunction("\\\\cdright",[t[1]],[]),c={type:"ordgroup",mode:"math",body:[r,o,a]};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 USe(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 Tt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var s=[],r=[s],i=0;i<t.length;i++){for(var o=t[i],a=IB(),c=0;c<o.length;c++)if(!RB(o[c]))a.body.push(o[c]);else{s.push(a),c+=1;var u=_C(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 h=0;h<2;h++){for(var m=!0,p=c+1;p<o.length;p++){if(HSe(o[p],u)){m=!1,c=p;break}if(RB(o[p]))throw new Tt("Missing a "+u+" character to complete a CD arrow.",o[p]);d[h].body.push(o[p])}if(m)throw new Tt("Missing a "+u+" character to complete a CD arrow.",o[c])}else throw new Tt('Expected one of "<>AV=|." after @',o[c]);var g=qSe(u,d,e),b={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};s.push(b),a=IB()}i%2===0?s.push(a):s.shift(),s=[],r.push(s)}e.gullet.endGroup(),e.gullet.endGroup();var x=new Array(r[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:r,arraystretch:1,addJot:!0,rowGaps:[null],cols:x,colSeparationType:"CD",hLinesBeforeRow:new Array(r.length+1).fill([])}}ln({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e;return{type:"cdlabel",mode:n.mode,side:s.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),s=ib(Sr(e.label,n,t),t);return s.classes.push("cd-label-"+e.side),s.style.bottom=Ot(.8-s.depth),s.height=0,s.depth=0,s},mathmlBuilder(e,t){var n=new Nt("mrow",[Qr(e.label,t)]);return n=new Nt("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Nt("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});ln({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=ib(Sr(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Nt("mrow",[Qr(e.fragment,t)])}});ln({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,s=Ls(t[0],"ordgroup"),r=s.body,i="",o=0;o<r.length;o++){var a=Ls(r[o],"textord");i+=a.text}var c=parseInt(i),u;if(isNaN(c))throw new Tt("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new Tt("\\@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 FQ=(e,t)=>{var n=jo(e.body,t.withColor(e.color),!1);return Gh(n)},HQ=(e,t)=>{var n=uc(e.body,t.withColor(e.color)),s=new Nt("mstyle",n);return s.setAttribute("mathcolor",e.color),s};ln({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,s=Ls(t[0],"color-token").color,r=t[1];return{type:"color",mode:n.mode,color:s,body:uo(r)}},htmlBuilder:FQ,mathmlBuilder:HQ});ln({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:s}=e,r=Ls(t[0],"color-token").color;n.gullet.macros.set("\\current@color",r);var i=n.parseExpression(!0,s);return{type:"color",mode:n.mode,color:r,body:i}},htmlBuilder:FQ,mathmlBuilder:HQ});ln({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:s}=e,r=s.gullet.future().text==="["?s.parseSizeGroup(!0):null,i=!s.settings.displayMode||!s.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:s.mode,newLine:i,size:r&&Ls(r,"size").value}},htmlBuilder(e,t){var n=wt(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Ot(Mi(e.size,t)))),n},mathmlBuilder(e,t){var n=new Nt("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Ot(Mi(e.size,t)))),n}});var KA={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},qQ=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Tt("Expected a control sequence",e);return t},WSe=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},UQ=(e,t,n,s)=>{var r=e.gullet.macros.get(n.text);r==null&&(n.noexpand=!0,r={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,r,s)};ln({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var s=t.fetch();if(KA[s.text])return(n==="\\global"||n==="\\\\globallong")&&(s.text=KA[s.text]),Ls(t.parseFunction(),"internal");throw new Tt("Invalid token after macro prefix",s)}});ln({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=t.gullet.popToken(),r=s.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new Tt("Expected a control sequence",s);for(var i=0,o,a=[[]];t.gullet.future().text!=="{";)if(s=t.gullet.popToken(),s.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),a[i].push("{");break}if(s=t.gullet.popToken(),!/^[1-9]$/.test(s.text))throw new Tt('Invalid argument number "'+s.text+'"');if(parseInt(s.text)!==i+1)throw new Tt('Argument number "'+s.text+'" out of order');i++,a.push([])}else{if(s.text==="EOF")throw new Tt("Expected a macro definition");a[i].push(s.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(r,{tokens:c,numArgs:i,delimiters:a},n===KA[n]),{type:"internal",mode:t.mode}}});ln({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=qQ(t.gullet.popToken());t.gullet.consumeSpaces();var r=WSe(t);return UQ(t,s,r,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});ln({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=qQ(t.gullet.popToken()),r=t.gullet.popToken(),i=t.gullet.popToken();return UQ(t,s,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(r),{type:"internal",mode:t.mode}}});var mv=function(t,n,s){var r=vi.math[t]&&vi.math[t].replace,i=sI(r||t,n,s);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},cI=function(t,n,s,r){var i=s.havingBaseStyle(n),o=wt(r.concat(i.sizingClasses(s)),[t],s),a=i.sizeMultiplier/s.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},WQ=function(t,n,s){var r=n.havingBaseStyle(s),i=(1-n.sizeMultiplier/r.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Ot(i),t.height-=i,t.depth+=i},VSe=function(t,n,s,r,i,o){var a=Pa(t,"Main-Regular",i,r),c=cI(a,n,r,o);return WQ(c,r,n),c},GSe=function(t,n,s,r){return Pa(t,"Size"+n+"-Regular",s,r)},VQ=function(t,n,s,r,i,o){var a=GSe(t,n,i,r),c=cI(wt(["delimsizing","size"+n],[a],r),ks.TEXT,r,o);return s&&WQ(c,r,ks.TEXT),c},e8=function(t,n,s){var r;n==="Size1-Regular"?r="delim-size1":r="delim-size4";var i=wt(["delimsizinginner",r],[wt([],[Pa(t,n,s)])]);return{type:"elem",elem:i}},t8=function(t,n,s){var r=Zu["Size4-Regular"][t.charCodeAt(0)]?Zu["Size4-Regular"][t.charCodeAt(0)][4]:Zu["Size1-Regular"][t.charCodeAt(0)][4],i=new vm("inner",sSe(t,Math.round(1e3*n))),o=new $h([i],{width:Ot(r),height:Ot(n),style:"width:"+Ot(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=xm([],[o],s);return a.height=n,a.style.height=Ot(n),a.style.width=Ot(r),{type:"elem",elem:a}},YA=.008,v_={type:"kern",size:-1*YA},KSe=new Set(["|","\\lvert","\\rvert","\\vert"]),YSe=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),GQ=function(t,n,s,r,i,o){var a,c,u,d,h="",m=0;a=u=d=t,c=null;var p="Size1-Regular";t==="\\uparrow"?u=d="⏐":t==="\\Uparrow"?u=d="‖":t==="\\downarrow"?a=u="⏐":t==="\\Downarrow"?a=u="‖":t==="\\updownarrow"?(a="\\uparrow",u="⏐",d="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",u="‖",d="\\Downarrow"):KSe.has(t)?(u="∣",h="vert",m=333):YSe.has(t)?(u="∥",h="doublevert",m=556):t==="["||t==="\\lbrack"?(a="⎡",u="⎢",d="⎣",p="Size4-Regular",h="lbrack",m=667):t==="]"||t==="\\rbrack"?(a="⎤",u="⎥",d="⎦",p="Size4-Regular",h="rbrack",m=667):t==="\\lfloor"||t==="⌊"?(u=a="⎢",d="⎣",p="Size4-Regular",h="lfloor",m=667):t==="\\lceil"||t==="⌈"?(a="⎡",u=d="⎢",p="Size4-Regular",h="lceil",m=667):t==="\\rfloor"||t==="⌋"?(u=a="⎥",d="⎦",p="Size4-Regular",h="rfloor",m=667):t==="\\rceil"||t==="⌉"?(a="⎤",u=d="⎥",p="Size4-Regular",h="rceil",m=667):t==="("||t==="\\lparen"?(a="⎛",u="⎜",d="⎝",p="Size4-Regular",h="lparen",m=875):t===")"||t==="\\rparen"?(a="⎞",u="⎟",d="⎠",p="Size4-Regular",h="rparen",m=875):t==="\\{"||t==="\\lbrace"?(a="⎧",c="⎨",d="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",c="⎬",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",d="⎩",u="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",d="⎭",u="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",d="⎩",u="⎪",p="Size4-Regular");var g=mv(a,p,i),b=g.height+g.depth,x=mv(u,p,i),y=x.height+x.depth,v=mv(d,p,i),w=v.height+v.depth,k=0,T=1;if(c!==null){var C=mv(c,p,i);k=C.height+C.depth,T=2}var _=b+w+k,S=Math.max(0,Math.ceil((n-_)/(T*y))),D=_+S*T*y,E=r.fontMetrics().axisHeight;s&&(E*=r.sizeMultiplier);var B=D/2-E,I=[];if(h.length>0){var L=D-b-w,O=Math.round(D*1e3),A=rSe(h,Math.round(L*1e3)),$=new vm(h,A),q=Ot(m/1e3),U=Ot(O/1e3),H=new $h([$],{width:q,height:U,viewBox:"0 0 "+m+" "+O}),M=xm([],[H],r);M.height=O/1e3,M.style.width=q,M.style.height=U,I.push({type:"elem",elem:M})}else{if(I.push(e8(d,p,i)),I.push(v_),c===null){var ee=D-b-w+2*YA;I.push(t8(u,ee,r))}else{var V=(D-b-w-k)/2+2*YA;I.push(t8(u,V,r)),I.push(v_),I.push(e8(c,p,i)),I.push(v_),I.push(t8(u,V,r))}I.push(v_),I.push(e8(a,p,i))}var R=r.havingBaseStyle(ks.TEXT),re=kr({positionType:"bottom",positionData:B,children:I});return cI(wt(["delimsizing","mult"],[re],R),ks.TEXT,r,o)},n8=80,s8=.08,r8=function(t,n,s,r,i){var o=nSe(t,r,s),a=new vm(t,o),c=new $h([a],{width:"400em",height:Ot(n),viewBox:"0 0 400000 "+s,preserveAspectRatio:"xMinYMin slice"});return xm(["hide-tail"],[c],i)},XSe=function(t,n){var s=n.havingBaseSizing(),r=JQ("\\surd",t*s.sizeMultiplier,QQ,s),i=s.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,c,u,d,h;return r.type==="small"?(d=1e3+1e3*o+n8,t<1?i=1:t<1.4&&(i=.7),c=(1+o+s8)/i,u=(1+o)/i,a=r8("sqrtMain",c,d,o,n),a.style.minWidth="0.853em",h=.833/i):r.type==="large"?(d=(1e3+n8)*Xv[r.size],u=(Xv[r.size]+o)/i,c=(Xv[r.size]+o+s8)/i,a=r8("sqrtSize"+r.size,c,d,o,n),a.style.minWidth="1.02em",h=1/i):(c=t+o+s8,u=t+o,d=Math.floor(1e3*t+o)+n8,a=r8("sqrtTall",c,d,o,n),a.style.minWidth="0.742em",h=1.056),a.height=u,a.style.height=Ot(c),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},KQ=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),QSe=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),YQ=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Xv=[0,1.2,1.8,2.4,3],XQ=function(t,n,s,r,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),KQ.has(t)||YQ.has(t))return VQ(t,n,!1,s,r,i);if(QSe.has(t))return GQ(t,Xv[n],!1,s,r,i);throw new Tt("Illegal delimiter: '"+t+"'")},JSe=[{type:"small",style:ks.SCRIPTSCRIPT},{type:"small",style:ks.SCRIPT},{type:"small",style:ks.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],ZSe=[{type:"small",style:ks.SCRIPTSCRIPT},{type:"small",style:ks.SCRIPT},{type:"small",style:ks.TEXT},{type:"stack"}],QQ=[{type:"small",style:ks.SCRIPTSCRIPT},{type:"small",style:ks.SCRIPT},{type:"small",style:ks.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],e4e=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.")},JQ=function(t,n,s,r){for(var i=Math.min(2,3-r.style.size),o=i;o<s.length;o++){var a=s[o];if(a.type==="stack")break;var c=mv(t,e4e(a),"math"),u=c.height+c.depth;if(a.type==="small"){var d=r.havingBaseStyle(a.style);u*=d.sizeMultiplier}if(u>n)return a}return s[s.length-1]},XA=function(t,n,s,r,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;YQ.has(t)?a=JSe:KQ.has(t)?a=QQ:a=ZSe;var c=JQ(t,n,a,r);return c.type==="small"?VSe(t,c.style,s,r,i,o):c.type==="large"?VQ(t,c.size,s,r,i,o):GQ(t,n,s,r,i,o)},i8=function(t,n,s,r,i,o){var a=r.fontMetrics().axisHeight*r.sizeMultiplier,c=901,u=5/r.fontMetrics().ptPerEm,d=Math.max(n-a,s+a),h=Math.max(d/500*c,2*d-u);return XA(t,h,!0,r,i,o)},DB={"\\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}},t4e=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 LB(e){return"isMiddle"in e}function TC(e,t){var n=SC(e);if(n&&t4e.has(n.text))return n;throw n?new Tt("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Tt("Invalid delimiter type '"+e.type+"'",e)}ln({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=TC(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:DB[e.funcName].size,mclass:DB[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?wt([e.mclass]):XQ(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(zc(e.delim,e.mode));var n=new Nt("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var s=Ot(Xv[e.size]);return n.setAttribute("minsize",s),n.setAttribute("maxsize",s),n}});function PB(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ln({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 Tt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:TC(t[0],e).text,color:n}}});ln({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=TC(t[0],e),s=e.parser;++s.leftrightDepth;var r=s.parseExpression(!1);--s.leftrightDepth,s.expect("\\right",!1);var i=Ls(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:r,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{PB(e);for(var n=jo(e.body,t,!0,["mopen","mclose"]),s=0,r=0,i=!1,o=0;o<n.length;o++){var a=n[o];LB(a)?i=!0:(s=Math.max(n[o].height,s),r=Math.max(n[o].depth,r))}s*=t.sizeMultiplier,r*=t.sizeMultiplier;var c;if(e.left==="."?c=Nx(t,["mopen"]):c=i8(e.left,s,r,t,e.mode,["mopen"]),n.unshift(c),i)for(var u=1;u<n.length;u++){var d=n[u];if(LB(d)){var h=d.isMiddle;n[u]=i8(h.delim,s,r,h.options,e.mode,[])}}var m;if(e.right===".")m=Nx(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;m=i8(e.right,s,r,p,e.mode,["mclose"])}return n.push(m),wt(["minner"],n,t)},mathmlBuilder:(e,t)=>{PB(e);var n=uc(e.body,t);if(e.left!=="."){var s=new Nt("mo",[zc(e.left,e.mode)]);s.setAttribute("fence","true"),n.unshift(s)}if(e.right!=="."){var r=new Nt("mo",[zc(e.right,e.mode)]);r.setAttribute("fence","true"),e.rightColor&&r.setAttribute("mathcolor",e.rightColor),n.push(r)}return oI(n)}});ln({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=TC(t[0],e);if(!e.parser.leftrightDepth)throw new Tt("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=Nx(t,[]):(n=XQ(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?zc("|","text"):zc(e.delim,e.mode),s=new Nt("mo",[n]);return s.setAttribute("fence","true"),s.setAttribute("lspace","0.05em"),s.setAttribute("rspace","0.05em"),s}});var EC=(e,t)=>{var n=ib(Sr(e.body,t),t),s=e.label.slice(1),r=t.sizeMultiplier,i,o,a=Wh(e.body);if(s==="sout")i=wt(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/r,o=-.5*t.fontMetrics().xHeight;else if(s==="phase"){var c=Mi({number:.6,unit:"pt"},t),u=Mi({number:.35,unit:"ex"},t),d=t.havingBaseSizing();r=r/d.sizeMultiplier;var h=n.height+n.depth+c+u;n.style.paddingLeft=Ot(h/2+c);var m=Math.floor(1e3*h*r),p=eSe(m),g=new $h([new vm("phase",p)],{width:"400em",height:Ot(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});i=xm(["hide-tail"],[g],t),i.style.height=Ot(h),o=n.depth+c+u}else{/cancel/.test(s)?a||n.classes.push("cancel-pad"):s==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var b,x,y=0;/box/.test(s)?(y=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),b=t.fontMetrics().fboxsep+(s==="colorbox"?0:y),x=b):s==="angl"?(y=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),b=4*y,x=Math.max(0,.25-n.depth)):(b=a?.2:0,x=b),i=PSe(n,s,b,x,t),/fbox|boxed|fcolorbox/.test(s)?(i.style.borderStyle="solid",i.style.borderWidth=Ot(y)):s==="angl"&&y!==.049&&(i.style.borderTopWidth=Ot(y),i.style.borderRightWidth=Ot(y)),o=n.depth+x,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var v;if(e.backgroundColor)v=kr({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var w=/cancel|phase/.test(s)?["svg-align"]:[];v=kr({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:w}]})}return/cancel/.test(s)&&(v.height=n.height,v.depth=n.depth),/cancel/.test(s)&&!a?wt(["mord","cancel-lap"],[v],t):wt(["mord"],[v],t)},AC=(e,t)=>{var n,s=new Nt(e.label.includes("colorbox")?"mpadded":"menclose",[Qr(e.body,t)]);switch(e.label){case"\\cancel":s.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":s.setAttribute("notation","downdiagonalstrike");break;case"\\phase":s.setAttribute("notation","phasorangle");break;case"\\sout":s.setAttribute("notation","horizontalstrike");break;case"\\fbox":s.setAttribute("notation","box");break;case"\\angl":s.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,s.setAttribute("width","+"+2*n+"pt"),s.setAttribute("height","+"+2*n+"pt"),s.setAttribute("lspace",n+"pt"),s.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var r=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);s.setAttribute("style","border: "+Ot(r)+" solid "+e.borderColor)}break;case"\\xcancel":s.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&s.setAttribute("mathbackground",e.backgroundColor),s};ln({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=Ls(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:s.mode,label:r,backgroundColor:i,body:o}},htmlBuilder:EC,mathmlBuilder:AC});ln({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=Ls(t[0],"color-token").color,o=Ls(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:s.mode,label:r,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:EC,mathmlBuilder:AC});ln({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]}}});ln({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"enclose",mode:n.mode,label:s,body:r}},htmlBuilder:EC,mathmlBuilder:AC});ln({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var r=t[0];return{type:"enclose",mode:n.mode,label:s,body:r}},htmlBuilder:EC,mathmlBuilder:AC});ln({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 ZQ={};function Sd(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:s.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:r},c=0;c<n.length;++c)ZQ[n[c]]=a;i&&(b4[t]=i),o&&(y4[t]=o)}var eJ={};function Q(e,t){eJ[e]=t}class dl{constructor(t,n,s){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=n,this.end=s}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new dl(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class nc{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 nc(n,dl.range(this,t))}}function OB(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 jC=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Tt("{"+e.envName+"} can be used only in display mode.")},n4e=new Set(["gather","gather*"]);function uI(e){if(!e.includes("ed"))return!e.includes("*")}function Hm(e,t,n){var{hskipBeforeAndAfter:s,addJot:r,cols:i,arraystretch:o,colSeparationType:a,autoTag:c,singleRow:u,emptySingleRow:d,maxNumCols:h,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 Tt("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],b=[g],x=[],y=[],v=c!=null?[]:void 0;function w(){c&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){v&&(e.gullet.macros.get("\\df@tag")?(v.push(e.subparse([new nc("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):v.push(!!c&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(w(),y.push(OB(e));;){var T=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var C={type:"ordgroup",mode:e.mode,body:T};n&&(C={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[C]}),g.push(C);var _=e.fetch().text;if(_==="&"){if(h&&g.length===h){if(u||a)throw new Tt("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&&C.type==="styling"&&C.body.length===1&&C.body[0].type==="ordgroup"&&C.body[0].body.length===0&&(b.length>1||!d)&&b.pop(),y.length<b.length+1&&y.push([]);break}else if(_==="\\\\"){e.consume();var S=void 0;e.gullet.future().text!==" "&&(S=e.parseSizeGroup(!0)),x.push(S?S.value:null),k(),y.push(OB(e)),g=[],b.push(g),w()}else throw new Tt("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:r,arraystretch:o,body:b,cols:i,rowGaps:x,hskipBeforeAndAfter:s,hLinesBeforeRow:y,colSeparationType:a,tags:v,leqno:m}}function dI(e){return e.slice(0,1)==="d"?"display":"text"}var Cd=function(t,n){var s,r,i=t.body.length,o=t.hLinesBeforeRow,a=0,c=new Array(i),u=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,m=5*h;if(t.colSeparationType&&t.colSeparationType==="small"){var p=n.havingStyle(ks.SCRIPT).sizeMultiplier;m=.2778*(p/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?Mi({number:3,unit:"ex"},n):12*h,b=3*h,x=t.arraystretch*g,y=.7*x,v=.3*x,w=0;function k(yt){for(var Me=0;Me<yt.length;++Me)Me>0&&(w+=.25),u.push({pos:w,isDashed:yt[Me]})}for(k(o[0]),s=0;s<t.body.length;++s){var T=t.body[s],C=y,_=v;a<T.length&&(a=T.length);var S={cells:new Array(T.length),height:0,depth:0,pos:0};for(r=0;r<T.length;++r){var D=Sr(T[r],n);_<D.depth&&(_=D.depth),C<D.height&&(C=D.height),S.cells[r]=D}var E=t.rowGaps[s],B=0;E&&(B=Mi(E,n),B>0&&(B+=v,_<B&&(_=B),B=0)),t.addJot&&s<t.body.length-1&&(_+=b),S.height=C,S.depth=_,w+=C,S.pos=w,w+=_+B,c[s]=S,k(o[s+1])}var I=w/2+n.fontMetrics().axisHeight,L=t.cols||[],O=[],A,$,q=[];if(t.tags&&t.tags.some(yt=>yt))for(s=0;s<i;++s){var U=c[s],H=U.pos-I,M=t.tags[s],ee=void 0;M===!0?ee=wt(["eqn-num"],[],n):M===!1?ee=wt([],[],n):ee=wt([],jo(M,n,!0),n),ee.depth=U.depth,ee.height=U.height,q.push({type:"elem",elem:ee,shift:H})}for(r=0,$=0;r<a||$<L.length;++r,++$){for(var V,R=L[$],re=!0;((Z=R)==null?void 0:Z.type)==="separator";){var Z;if(re||(A=wt(["arraycolsep"],[]),A.style.width=Ot(n.fontMetrics().doubleRuleSep),O.push(A)),R.separator==="|"||R.separator===":"){var K=R.separator==="|"?"solid":"dashed",Y=wt(["vertical-separator"],[],n);Y.style.height=Ot(w),Y.style.borderRightWidth=Ot(d),Y.style.borderRightStyle=K,Y.style.margin="0 "+Ot(-d/2);var ae=w-I;ae&&(Y.style.verticalAlign=Ot(-ae)),O.push(Y)}else throw new Tt("Invalid separator type: "+R.separator);$++,R=L[$],re=!1}if(!(r>=a)){var le=void 0;if(r>0||t.hskipBeforeAndAfter){var te,z;le=(te=(z=R)==null?void 0:z.pregap)!=null?te:m,le!==0&&(A=wt(["arraycolsep"],[]),A.style.width=Ot(le),O.push(A))}var X=[];for(s=0;s<i;++s){var fe=c[s],xe=fe.cells[r];if(xe){var ie=fe.pos-I;xe.depth=fe.depth,xe.height=fe.height,X.push({type:"elem",elem:xe,shift:ie})}}var Ce=kr({positionType:"individualShift",children:X}),Ke=wt(["col-align-"+(((V=R)==null?void 0:V.align)||"c")],[Ce]);if(O.push(Ke),r<a-1||t.hskipBeforeAndAfter){var ut,Et;le=(ut=(Et=R)==null?void 0:Et.postgap)!=null?ut:m,le!==0&&(A=wt(["arraycolsep"],[]),A.style.width=Ot(le),O.push(A))}}}var st=wt(["mtable"],O);if(u.length>0){for(var xt=rb("hline",n,d),He=rb("hdashline",n,d),pn=[{type:"elem",elem:st,shift:0}];u.length>0;){var Yt=u.pop(),It=Yt.pos-I;Yt.isDashed?pn.push({type:"elem",elem:He,shift:It}):pn.push({type:"elem",elem:xt,shift:It})}st=kr({positionType:"individualShift",children:pn})}if(q.length===0)return wt(["mord"],[st],n);var me=kr({positionType:"individualShift",children:q}),$e=wt(["tag"],[me],n);return Gh([st,$e])},s4e={c:"center ",l:"left ",r:"right "},Td=function(t,n){for(var s=[],r=new Nt("mtd",[],["mtr-glue"]),i=new Nt("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var a=t.body[o],c=[],u=0;u<a.length;u++)c.push(new Nt("mtd",[Qr(a[u],n)]));t.tags&&t.tags[o]&&(c.unshift(r),c.push(r),t.leqno?c.unshift(i):c.push(i)),s.push(new Nt("mtr",c))}var d=new Nt("mtable",s),h=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",Ot(h));var m="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,b="",x=!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 w=y;w<v;w++){var k=g[w];k.type==="align"?(p+=s4e[k.align],x&&(b+="none "),x=!0):k.type==="separator"&&x&&(b+=k.separator==="|"?"solid ":"dashed ",x=!1)}d.setAttribute("columnalign",p.trim()),/[sd]/.test(b)&&d.setAttribute("columnlines",b.trim())}if(t.colSeparationType==="align"){for(var T=t.cols||[],C="",_=1;_<T.length;_++)C+=_%2?"0em ":"1em ";d.setAttribute("columnspacing",C.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 S="",D=t.hLinesBeforeRow;m+=D[0].length>0?"left ":"",m+=D[D.length-1].length>0?"right ":"";for(var E=1;E<D.length-1;E++)S+=D[E].length===0?"none ":D[E][0]?"dashed ":"solid ";return/[sd]/.test(S)&&d.setAttribute("rowlines",S.trim()),m!==""&&(d=new Nt("menclose",[d]),d.setAttribute("notation",m.trim())),t.arraystretch&&t.arraystretch<1&&(d=new Nt("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},tJ=function(t,n){t.envName.includes("ed")||jC(t);var s=[],r=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=Hm(t.parser,{cols:s,addJot:!0,autoTag:i?void 0:uI(t.envName),emptySingleRow:!0,colSeparationType:r,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),a=0,c=0,u={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",h=0;h<n[0].body.length;h++){var m=Ls(n[0].body[h],"textord");d+=m.text}a=Number(d),c=a*2}var p=!c;o.body.forEach(function(y){for(var v=1;v<y.length;v+=2){var w=Ls(y[v],"styling"),k=Ls(w.body[0],"ordgroup");k.body.unshift(u)}if(p)c<y.length&&(c=y.length);else{var T=y.length/2;if(a<T)throw new Tt("Too many math in a row: "+("expected "+a+", but got "+T),y[0])}});for(var g=0;g<c;++g){var b="r",x=0;g%2===1?b="l":g>0&&p&&(x=1),s[g]={type:"align",align:b,pregap:x,postgap:0}}return o.colSeparationType=p?"align":"alignat",o};Sd({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=SC(t[0]),s=n?[t[0]]:Ls(t[0],"ordgroup").body,r=s.map(function(o){var a=_C(o),c=a.text;if("lcr".includes(c))return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new Tt("Unknown column alignment: "+c,o)}),i={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return Hm(e.parser,i,dI(e.envName))},htmlBuilder:Cd,mathmlBuilder:Td});Sd({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",s={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var r=e.parser;if(r.consumeSpaces(),r.fetch().text==="["){if(r.consume(),r.consumeSpaces(),n=r.fetch().text,!"lcr".includes(n))throw new Tt("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[{type:"align",align:n}]}}var i=Hm(e.parser,s,dI(e.envName)),o=Math.max(0,...i.body.map(a=>a.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:Cd,mathmlBuilder:Td});Sd({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=Hm(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Cd,mathmlBuilder:Td});Sd({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=SC(t[0]),s=n?[t[0]]:Ls(t[0],"ordgroup").body,r=s.map(function(a){var c=_C(a),u=c.text;if("lc".includes(u))return{type:"align",align:u};throw new Tt("Unknown column alignment: "+u,a)});if(r.length>1)throw new Tt("{subarray} can contain only one column");var i={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},o=Hm(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new Tt("{subarray} can contain only one column");return o},htmlBuilder:Cd,mathmlBuilder:Td});Sd({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=Hm(e.parser,t,dI(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Cd,mathmlBuilder:Td});Sd({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:tJ,htmlBuilder:Cd,mathmlBuilder:Td});Sd({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){n4e.has(e.envName)&&jC(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:uI(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Hm(e.parser,t,"display")},htmlBuilder:Cd,mathmlBuilder:Td});Sd({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:tJ,htmlBuilder:Cd,mathmlBuilder:Td});Sd({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){jC(e);var t={autoTag:uI(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Hm(e.parser,t,"display")},htmlBuilder:Cd,mathmlBuilder:Td});Sd({type:"array",names:["CD"],props:{numArgs:0},handler(e){return jC(e),USe(e.parser)},htmlBuilder:Cd,mathmlBuilder:Td});Q("\\nonumber","\\gdef\\@eqnsw{0}");Q("\\notag","\\nonumber");ln({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Tt(e.funcName+" valid only within array environment")}});var $B=ZQ;ln({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];if(r.type!=="ordgroup")throw new Tt("Invalid environment name",r);for(var i="",o=0;o<r.body.length;++o)i+=Ls(r.body[o],"textord").text;if(s==="\\begin"){if(!$B.hasOwnProperty(i))throw new Tt("No such environment: "+i,r);var a=$B[i],{args:c,optArgs:u}=n.parseArguments("\\begin{"+i+"}",a),d={mode:n.mode,envName:i,parser:n},h=a.handler(d,c,u);n.expect("\\end",!1);var m=n.nextToken,p=Ls(n.parseFunction(),"environment");if(p.name!==i)throw new Tt("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",m);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:r}}});var nJ=(e,t)=>{var n=e.font,s=t.withFont(n);return Sr(e.body,s)},sJ=(e,t)=>{var n=e.font,s=t.withFont(n);return Qr(e.body,s)},BB={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};ln({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:s}=e,r=v4(t[0]),i=s;return i in BB&&(i=BB[i]),{type:"font",mode:n.mode,font:i.slice(1),body:r}},htmlBuilder:nJ,mathmlBuilder:sJ});ln({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"mclass",mode:n.mode,mclass:CC(s),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:s}],isCharacterBox:Wh(s)}}});ln({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s,breakOnTokenText:r}=e,{mode:i}=n,o=n.parseExpression(!0,r);return{type:"font",mode:i,font:"math"+s.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:nJ,mathmlBuilder:sJ});var r4e=(e,t)=>{var n=t.style,s=n.fracNum(),r=n.fracDen(),i;i=t.havingStyle(s);var o=Sr(e.numer,i,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,c=3.5/t.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<c?c:o.depth}i=t.havingStyle(r);var u=Sr(e.denom,i,t),d,h,m;e.hasBarLine?(e.barSize?(h=Mi(e.barSize,t),d=rb("frac-line",t,h)):d=rb("frac-line",t),h=d.height,m=d.height):(d=null,h=0,m=t.fontMetrics().defaultRuleThickness);var p,g,b;n.size===ks.DISPLAY.size?(p=t.fontMetrics().num1,h>0?g=3*m:g=7*m,b=t.fontMetrics().denom1):(h>0?(p=t.fontMetrics().num2,g=m):(p=t.fontMetrics().num3,g=3*m),b=t.fontMetrics().denom2);var x;if(d){var v=t.fontMetrics().axisHeight;p-o.depth-(v+.5*h)<g&&(p+=g-(p-o.depth-(v+.5*h))),v-.5*h-(u.height-b)<g&&(b+=g-(v-.5*h-(u.height-b)));var w=-(v-.5*h);x=kr({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:d,shift:w},{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)),x=kr({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:o,shift:-p}]})}i=t.havingStyle(n),x.height*=i.sizeMultiplier/t.sizeMultiplier,x.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===ks.DISPLAY.size?k=t.fontMetrics().delim1:n.size===ks.SCRIPTSCRIPT.size?k=t.havingStyle(ks.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var T,C;return e.leftDelim==null?T=Nx(t,["mopen"]):T=XA(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?C=wt([]):e.rightDelim==null?C=Nx(t,["mclose"]):C=XA(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),wt(["mord"].concat(i.sizingClasses(t)),[T,wt(["mfrac"],[x]),C],t)},i4e=(e,t)=>{var n=new Nt("mfrac",[Qr(e.numer,t),Qr(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var s=Mi(e.barSize,t);n.setAttribute("linethickness",Ot(s))}if(e.leftDelim!=null||e.rightDelim!=null){var r=[];if(e.leftDelim!=null){var i=new Nt("mo",[new ho(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),r.push(i)}if(r.push(n),e.rightDelim!=null){var o=new Nt("mo",[new ho(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),r.push(o)}return oI(r)}return n},rJ=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};ln({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:s}=e,r=t[0],i=t[1],o,a=null,c=null;switch(s){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",c=")";break;case"\\\\bracefrac":o=!1,a="\\{",c="\\}";break;case"\\\\brackfrac":o=!1,a="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}var u=s==="\\cfrac",d=null;return u||s.startsWith("\\d")?d="display":s.startsWith("\\t")&&(d="text"),rJ({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:u,hasBarLine:o,leftDelim:a,rightDelim:c,barSize:null},d)},htmlBuilder:r4e,mathmlBuilder:i4e});ln({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:s}=e,r;switch(n){case"\\over":r="\\frac";break;case"\\choose":r="\\binom";break;case"\\atop":r="\\\\atopfrac";break;case"\\brace":r="\\\\bracefrac";break;case"\\brack":r="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:r,token:s}}});var zB=["display","text","script","scriptscript"],FB=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};ln({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,s=t[4],r=t[5],i=v4(t[0]),o=i.type==="atom"&&i.family==="open"?FB(i.text):null,a=v4(t[1]),c=a.type==="atom"&&a.family==="close"?FB(a.text):null,u=Ls(t[2],"size"),d,h=null;u.isBlank?d=!0:(h=u.value,d=h.number>0);var m=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=Ls(p.body[0],"textord");m=zB[Number(g.text)]}}else p=Ls(p,"textord"),m=zB[Number(p.text)];return rJ({type:"genfrac",mode:n.mode,numer:s,denom:r,continued:!1,hasBarLine:d,barSize:h,leftDelim:o,rightDelim:c},m)}});ln({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:s,token:r}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Ls(t[0],"size").value,token:r}}});ln({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=Ls(t[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=t[2],a=i.number>0;return{type:"genfrac",mode:n.mode,numer:r,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});var iJ=(e,t)=>{var n=t.style,s,r;e.type==="supsub"?(s=e.sup?Sr(e.sup,t.havingStyle(n.sup()),t):Sr(e.sub,t.havingStyle(n.sub()),t),r=Ls(e.base,"horizBrace")):r=Ls(e,"horizBrace");var i=Sr(r.base,t.havingBaseStyle(ks.DISPLAY)),o=kC(r,t),a;if(r.isOver?a=kr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=kr({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),s){var c=wt(["minner",r.isOver?"mover":"munder"],[a],t);r.isOver?a=kr({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:s}]}):a=kr({positionType:"bottom",positionData:c.depth+.2+s.height+s.depth,children:[{type:"elem",elem:s},{type:"kern",size:.2},{type:"elem",elem:c}]})}return wt(["minner",r.isOver?"mover":"munder"],[a],t)},o4e=(e,t)=>{var n=wC(e.label);return new Nt(e.isOver?"mover":"munder",[Qr(e.base,t),n])};ln({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e;return{type:"horizBrace",mode:n.mode,label:s,isOver:s.includes("\\over"),base:t[0]}},htmlBuilder:iJ,mathmlBuilder:o4e});ln({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[1],r=Ls(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:r})?{type:"href",mode:n.mode,href:r,body:uo(s)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=jo(e.body,t,!1);return vSe(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=wm(e.body,t);return n instanceof Nt||(n=new Nt("mrow",[n])),n.setAttribute("href",e.href),n}});ln({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=Ls(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:s}))return n.formatUnsupportedCmd("\\url");for(var r=[],i=0;i<s.length;i++){var o=s[i];o==="~"&&(o="\\textasciitilde"),r.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:r};return{type:"href",mode:n.mode,href:s,body:uo(a)}}});ln({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:uo(t[0])}},htmlBuilder(e,t){var n=jo(e.body,t.withFont(""),!1);return Gh(n)},mathmlBuilder(e,t){return new Nt("mrow",uc(e.body,t.withFont("")))}});ln({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s,token:r}=e,i=Ls(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,c={};switch(s){case"\\htmlClass":c.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,a={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var u=i.split(","),d=0;d<u.length;d++){var h=u[d],m=h.indexOf("=");if(m<0)throw new Tt("\\htmlData key/value '"+h+"' missing equals sign");var p=h.slice(0,m),g=h.slice(m+1);c["data-"+p.trim()]=g}a={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:c,body:uo(o)}:n.formatUnsupportedCmd(s)},htmlBuilder:(e,t)=>{var n=jo(e.body,t,!1),s=["enclosing"];e.attributes.class&&s.push(...e.attributes.class.trim().split(/\s+/));var r=wt(s,n,t);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&r.setAttribute(i,e.attributes[i]);return r},mathmlBuilder:(e,t)=>wm(e.body,t)});ln({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:uo(t[0]),mathml:uo(t[1])}},htmlBuilder:(e,t)=>{var n=jo(e.html,t,!1);return Gh(n)},mathmlBuilder:(e,t)=>wm(e.mathml,t)});var o8=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 Tt("Invalid size: '"+t+"' in \\includegraphics");var s={number:+(n[1]+n[2]),unit:n[3]};if(!wQ(s))throw new Tt("Invalid unit: '"+s.unit+"' in \\includegraphics.");return s};ln({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:s}=e,r={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var c=Ls(n[0],"raw").string,u=c.split(","),d=0;d<u.length;d++){var h=u[d].split("=");if(h.length===2){var m=h[1].trim();switch(h[0].trim()){case"alt":a=m;break;case"width":r=o8(m);break;case"height":i=o8(m);break;case"totalheight":o=o8(m);break;default:throw new Tt("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var p=Ls(t[0],"url").url;return a===""&&(a=p,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),s.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:s.mode,alt:a,width:r,height:i,totalheight:o,src:p}:s.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=Mi(e.height,t),s=0;e.totalheight.number>0&&(s=Mi(e.totalheight,t)-n);var r=0;e.width.number>0&&(r=Mi(e.width,t));var i={height:Ot(n+s)};r>0&&(i.width=Ot(r)),s>0&&(i.verticalAlign=Ot(-s));var o=new lSe(e.src,e.alt,i);return o.height=n,o.depth=s,o},mathmlBuilder:(e,t)=>{var n=new Nt("mglyph",[]);n.setAttribute("alt",e.alt);var s=Mi(e.height,t),r=0;if(e.totalheight.number>0&&(r=Mi(e.totalheight,t)-s,n.setAttribute("valign",Ot(-r))),n.setAttribute("height",Ot(s+r)),e.width.number>0){var i=Mi(e.width,t);n.setAttribute("width",Ot(i))}return n.setAttribute("src",e.src),n}});ln({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e,r=Ls(t[0],"size");if(n.settings.strict){var i=s[1]==="m",o=r.value.unit==="mu";i?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" supports only mu units, "+("not "+r.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:r.value}},htmlBuilder(e,t){return AQ(e.dimension,t)},mathmlBuilder(e,t){var n=Mi(e.dimension,t);return new DQ(n)}});ln({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"lap",mode:n.mode,alignment:s.slice(5),body:r}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=wt([],[Sr(e.body,t)]),n=wt(["inner"],[n],t)):n=wt(["inner"],[Sr(e.body,t)]);var s=wt(["fix"],[]),r=wt([e.alignment],[n,s],t),i=wt(["strut"]);return i.style.height=Ot(r.height+r.depth),r.depth&&(i.style.verticalAlign=Ot(-r.depth)),r.children.unshift(i),r=wt(["thinbox"],[r],t),wt(["mord","vbox"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Nt("mpadded",[Qr(e.body,t)]);if(e.alignment!=="rlap"){var s=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",s+"width")}return n.setAttribute("width","0px"),n}});ln({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:s}=e,r=s.mode;s.switchMode("math");var i=n==="\\("?"\\)":"$",o=s.parseExpression(!1,i);return s.expect(i),s.switchMode(r),{type:"styling",mode:s.mode,style:"text",resetFont:!0,body:o}}});ln({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Tt("Mismatched "+e.funcName)}});var HB=(e,t)=>{switch(t.style.size){case ks.DISPLAY.size:return e.display;case ks.TEXT.size:return e.text;case ks.SCRIPT.size:return e.script;case ks.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};ln({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:uo(t[0]),text:uo(t[1]),script:uo(t[2]),scriptscript:uo(t[3])}},htmlBuilder:(e,t)=>{var n=HB(e,t),s=jo(n,t,!1);return Gh(s)},mathmlBuilder:(e,t)=>{var n=HB(e,t);return wm(n,t)}});var oJ=(e,t,n,s,r,i,o)=>{e=wt([],[e]);var a=n&&Wh(n),c,u;if(t){var d=Sr(t,s.havingStyle(r.sup()),s);u={elem:d,kern:Math.max(s.fontMetrics().bigOpSpacing1,s.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=Sr(n,s.havingStyle(r.sub()),s);c={elem:h,kern:Math.max(s.fontMetrics().bigOpSpacing2,s.fontMetrics().bigOpSpacing4-h.height)}}var m;if(u&&c){var p=s.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+e.depth+o;m=kr({positionType:"bottom",positionData:p,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ot(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Ot(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else if(c){var g=e.height-o;m=kr({positionType:"top",positionData:g,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ot(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e}]})}else if(u){var b=e.depth+o;m=kr({positionType:"bottom",positionData:b,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Ot(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else return e;var x=[m];if(c&&i!==0&&!a){var y=wt(["mspace"],[],s);y.style.marginRight=Ot(i),x.unshift(y)}return wt(["mop","op-limits"],x,s)},aJ=new Set(["\\smallint"]),Hb=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=Ls(e.base,"op"),r=!0):i=Ls(e,"op");var o=t.style,a=!1;o.size===ks.DISPLAY.size&&i.symbol&&!aJ.has(i.name)&&(a=!0);var c,u;if(i.symbol){var d=a?"Size2-Regular":"Size1-Regular",h="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(h=i.name.slice(1),i.name=h==="oiint"?"\\iint":"\\iiint"),c=Pa(i.name,d,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),u=c.italic,h.length>0){var m=NQ(h+"Size"+(a?"2":"1"),t);c=kr({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:m,shift:a?.08:0}]}),i.name="\\"+h,c.classes.unshift("mop"),c.italic=u}}else if(i.body){var p=jo(i.body,t,!0);p.length===1&&p[0]instanceof ac?(c=p[0],c.classes[0]="mop"):c=wt(["mop"],p,t)}else{for(var g=[],b=1;b<i.name.length;b++)g.push(rI(i.name[b],i.mode,t));c=wt(["mop"],g,t)}var x=0,y=0;if((c instanceof ac||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var v;x=(c.height-c.depth)/2-t.fontMetrics().axisHeight,y=(v=c.italic)!=null?v:0}return r?oJ(c,n,s,t,o,y,x):(x&&(c.style.position="relative",c.style.top=Ot(x)),c)},Iw=(e,t)=>{var n;if(e.symbol)n=new Nt("mo",[zc(e.name,e.mode)]),aJ.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Nt("mo",uc(e.body,t));else{n=new Nt("mi",[new ho(e.name.slice(1))]);var s=new Nt("mo",[zc("⁡","text")]);e.parentIsSupSub?n=new Nt("mrow",[n,s]):n=RQ([n,s])}return n},a4e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};ln({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:s}=e,r=s;return r.length===1&&(r=a4e[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Hb,mathmlBuilder:Iw});ln({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:uo(s)}},htmlBuilder:Hb,mathmlBuilder:Iw});var l4e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};ln({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:Hb,mathmlBuilder:Iw});ln({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:Hb,mathmlBuilder:Iw});ln({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,s=n;return s.length===1&&(s=l4e[s]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Hb,mathmlBuilder:Iw});var lJ=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=Ls(e.base,"operatorname"),r=!0):i=Ls(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(h=>{var m="text"in h?h.text:void 0;return typeof m=="string"?{type:"textord",mode:h.mode,text:m}:h}),c=jo(a,t.withFont("mathrm"),!0),u=0;u<c.length;u++){var d=c[u];d instanceof ac&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=wt(["mop"],c,t)}else o=wt(["mop"],[],t);return r?oJ(o,n,s,t,t.style,0,0):o},c4e=(e,t)=>{for(var n=uc(e.body,t.withFont("mathrm")),s=!0,r=0;r<n.length;r++){var i=n[r];if(!(i instanceof DQ))if(i instanceof Nt)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 ho?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):s=!1;break}default:s=!1}else s=!1}if(s){var a=n.map(d=>d.toText()).join("");n=[new ho(a)]}var c=new Nt("mi",n);c.setAttribute("mathvariant","normal");var u=new Nt("mo",[zc("⁡","text")]);return e.parentIsSupSub?new Nt("mrow",[c,u]):RQ([c,u])};ln({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"operatorname",mode:n.mode,body:uo(r),alwaysHandleSupSub:s==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:lJ,mathmlBuilder:c4e});Q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");H0({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?Gh(jo(e.body,t,!1)):wt(["mord"],jo(e.body,t,!0),t)},mathmlBuilder(e,t){return wm(e.body,t,!0)}});ln({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,s=t[0];return{type:"overline",mode:n.mode,body:s}},htmlBuilder(e,t){var n=Sr(e.body,t.havingCrampedStyle()),s=rb("overline-line",t),r=t.fontMetrics().defaultRuleThickness,i=kr({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*r},{type:"elem",elem:s},{type:"kern",size:r}]});return wt(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Nt("mo",[new ho("‾")]);n.setAttribute("stretchy","true");var s=new Nt("mover",[Qr(e.body,t),n]);return s.setAttribute("accent","true"),s}});ln({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"phantom",mode:n.mode,body:uo(s)}},htmlBuilder:(e,t)=>{var n=jo(e.body,t.withPhantom(),!1);return Gh(n)},mathmlBuilder:(e,t)=>{var n=uc(e.body,t);return new Nt("mphantom",n)}});Q("\\hphantom","\\smash{\\phantom{#1}}");ln({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"vphantom",mode:n.mode,body:s}},htmlBuilder:(e,t)=>{var n=wt(["inner"],[Sr(e.body,t.withPhantom())]),s=wt(["fix"],[]);return wt(["mord","rlap"],[n,s],t)},mathmlBuilder:(e,t)=>{var n=uc(uo(e.body),t),s=new Nt("mphantom",n),r=new Nt("mpadded",[s]);return r.setAttribute("width","0px"),r}});ln({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,s=Ls(t[0],"size").value,r=t[1];return{type:"raisebox",mode:n.mode,dy:s,body:r}},htmlBuilder(e,t){var n=Sr(e.body,t),s=Mi(e.dy,t);return kr({positionType:"shift",positionData:-s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Nt("mpadded",[Qr(e.body,t)]),s=e.dy.number+e.dy.unit;return n.setAttribute("voffset",s),n}});ln({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});ln({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:s}=e,r=n[0],i=Ls(t[0],"size"),o=Ls(t[1],"size");return{type:"rule",mode:s.mode,shift:r&&Ls(r,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=wt(["mord","rule"],[],t),s=Mi(e.width,t),r=Mi(e.height,t),i=e.shift?Mi(e.shift,t):0;return n.style.borderRightWidth=Ot(s),n.style.borderTopWidth=Ot(r),n.style.bottom=Ot(i),n.width=s,n.height=r+i,n.depth=-i,n.maxFontSize=r*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=Mi(e.width,t),s=Mi(e.height,t),r=e.shift?Mi(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Nt("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Ot(n)),o.setAttribute("height",Ot(s));var a=new Nt("mpadded",[o]);return r>=0?a.setAttribute("height",Ot(r)):(a.setAttribute("height",Ot(r)),a.setAttribute("depth",Ot(-r))),a.setAttribute("voffset",Ot(r)),a}});function cJ(e,t,n){for(var s=jo(e,t,!1),r=t.sizeMultiplier/n.sizeMultiplier,i=0;i<s.length;i++){var o=s[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(s[i].classes,t.sizingClasses(n)):s[i].classes[o+1]==="reset-size"+t.size&&(s[i].classes[o+1]="reset-size"+n.size),s[i].height*=r,s[i].depth*=r}return Gh(s)}var qB=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],u4e=(e,t)=>{var n=t.havingSize(e.size);return cJ(e.body,n,t)};ln({type:"sizing",names:qB,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:s,parser:r}=e,i=r.parseExpression(!1,n);return{type:"sizing",mode:r.mode,size:qB.indexOf(s)+1,body:i}},htmlBuilder:u4e,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),s=uc(e.body,n),r=new Nt("mstyle",s);return r.setAttribute("mathsize",Ot(n.sizeMultiplier)),r}});ln({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:s}=e,r=!1,i=!1,o=n[0]&&Ls(n[0],"ordgroup");if(o)for(var a,c=0;c<o.body.length;++c){var u=o.body[c];if(a=_C(u).text,a==="t")r=!0;else if(a==="b")i=!0;else{r=!1,i=!1;break}}else r=!0,i=!0;var d=t[0];return{type:"smash",mode:s.mode,body:d,smashHeight:r,smashDepth:i}},htmlBuilder:(e,t)=>{var n=wt([],[Sr(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 wt(["mord","smash"],[n],t);if(n.children)for(var s=0;s<n.children.length;s++)e.smashHeight&&(n.children[s].height=0),e.smashDepth&&(n.children[s].depth=0);var r=kr({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return wt(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Nt("mpadded",[Qr(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});ln({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:s}=e,r=n[0],i=t[0];return{type:"sqrt",mode:s.mode,body:i,index:r}},htmlBuilder(e,t){var n=Sr(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=ib(n,t);var s=t.fontMetrics(),r=s.defaultRuleThickness,i=r;t.style.id<ks.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,a=n.height+n.depth+o+r,{span:c,ruleWidth:u,advanceWidth:d}=XSe(a,t),h=c.height-u;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var m=c.height-n.height-o-u;n.style.paddingLeft=Ot(d);var p=kr({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(ks.SCRIPTSCRIPT),b=Sr(e.index,g,t),x=.6*(p.height-p.depth),y=kr({positionType:"shift",positionData:-x,children:[{type:"elem",elem:b}]}),v=wt(["root"],[y]);return wt(["mord","sqrt"],[v,p],t)}else return wt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:n,index:s}=e;return s?new Nt("mroot",[Qr(n,t),Qr(s,t)]):new Nt("msqrt",[Qr(n,t)])}});var QA={display:ks.DISPLAY,text:ks.TEXT,script:ks.SCRIPT,scriptscript:ks.SCRIPTSCRIPT};function d4e(e){return e in QA}ln({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:s,parser:r}=e,i=r.parseExpression(!0,n),o=s.slice(1,s.length-5);if(!d4e(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:r.mode,style:o,body:i}},htmlBuilder(e,t){var n=QA[e.style],s=t.havingStyle(n);return e.resetFont&&(s=s.withFont("")),cJ(e.body,s,t)},mathmlBuilder(e,t){var n=QA[e.style],s=t.havingStyle(n);e.resetFont&&(s=s.withFont(""));var r=uc(e.body,s),i=new Nt("mstyle",r),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});var h4e=function(t,n){var s=t.base;if(s)if(s.type==="op"){var r=s.limits&&(n.style.size===ks.DISPLAY.size||s.alwaysHandleSupSub);return r?Hb:null}else if(s.type==="operatorname"){var i=s.alwaysHandleSupSub&&(n.style.size===ks.DISPLAY.size||s.limits);return i?lJ:null}else{if(s.type==="accent")return Wh(s.base)?lI:null;if(s.type==="horizBrace"){var o=!t.sub;return o===s.isOver?iJ:null}else return null}else return null};H0({type:"supsub",htmlBuilder(e,t){var n=h4e(e,t);if(n)return n(e,t);var{base:s,sup:r,sub:i}=e,o=Sr(s,t),a,c,u=t.fontMetrics(),d=0,h=0,m=s&&Wh(s);if(r){var p=t.havingStyle(t.style.sup());a=Sr(r,p,t),m||(d=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());c=Sr(i,g,t),m||(h=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var b;t.style===ks.DISPLAY?b=u.sup1:t.style.cramped?b=u.sup3:b=u.sup2;var x=t.sizeMultiplier,y=Ot(.5/u.ptPerEm/x),v=null;if(c){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof ac||w){var k;v=Ot(-((k=o.italic)!=null?k:0))}}var T;if(a&&c){d=Math.max(d,b,a.depth+.25*u.xHeight),h=Math.max(h,u.sub2);var C=u.defaultRuleThickness,_=4*C;if(d-a.depth-(c.height-h)<_){h=_-(d-a.depth)+c.height;var S=.8*u.xHeight-(d-a.depth);S>0&&(d+=S,h-=S)}var D=[{type:"elem",elem:c,shift:h,marginRight:y,marginLeft:v},{type:"elem",elem:a,shift:-d,marginRight:y}];T=kr({positionType:"individualShift",children:D})}else if(c){h=Math.max(h,u.sub1,c.height-.8*u.xHeight);var E=[{type:"elem",elem:c,marginLeft:v,marginRight:y}];T=kr({positionType:"shift",positionData:h,children:E})}else if(a)d=Math.max(d,b,a.depth+.25*u.xHeight),T=kr({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:y}]});else throw new Error("supsub must have either sup or sub.");var B=VA(o,"right")||"mord";return wt([B],[o,wt(["msupsub"],[T])],t)},mathmlBuilder(e,t){var n=!1,s,r;e.base&&e.base.type==="horizBrace"&&(r=!!e.sup,r===e.base.isOver&&(n=!0,s=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[Qr(e.base,t)];e.sub&&i.push(Qr(e.sub,t)),e.sup&&i.push(Qr(e.sup,t));var o;if(n)o=s?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===ks.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===ks.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var c=e.base;c&&c.type==="op"&&c.limits&&(t.style===ks.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||t.style===ks.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===ks.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===ks.DISPLAY)?o="mover":o="msup"}return new Nt(o,i)}});H0({type:"atom",htmlBuilder(e,t){return rI(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Nt("mo",[zc(e.text,e.mode)]);if(e.family==="bin"){var s=aI(e,t);s==="bold-italic"&&n.setAttribute("mathvariant",s)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var uJ={mi:"italic",mn:"normal",mtext:"normal"};H0({type:"mathord",htmlBuilder(e,t){return xC(e,t,"mathord")},mathmlBuilder(e,t){var n=new Nt("mi",[zc(e.text,e.mode,t)]),s=aI(e,t)||"italic";return s!==uJ[n.type]&&n.setAttribute("mathvariant",s),n}});H0({type:"textord",htmlBuilder(e,t){return xC(e,t,"textord")},mathmlBuilder(e,t){var n=zc(e.text,e.mode,t),s=aI(e,t)||"normal",r;return e.mode==="text"?r=new Nt("mtext",[n]):/[0-9]/.test(e.text)?r=new Nt("mn",[n]):e.text==="\\prime"?r=new Nt("mo",[n]):r=new Nt("mi",[n]),s!==uJ[r.type]&&r.setAttribute("mathvariant",s),r}});var a8={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},l8={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};H0({type:"spacing",htmlBuilder(e,t){if(l8.hasOwnProperty(e.text)){var n=l8[e.text].className||"";if(e.mode==="text"){var s=xC(e,t,"textord");return s.classes.push(n),s}else return wt(["mspace",n],[rI(e.text,e.mode,t)],t)}else{if(a8.hasOwnProperty(e.text))return wt(["mspace",a8[e.text]],[],t);throw new Tt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(l8.hasOwnProperty(e.text))n=new Nt("mtext",[new ho(" ")]);else{if(a8.hasOwnProperty(e.text))return new Nt("mspace");throw new Tt('Unknown type of space "'+e.text+'"')}return n}});var UB=()=>{var e=new Nt("mtd",[]);return e.setAttribute("width","50%"),e};H0({type:"tag",mathmlBuilder(e,t){var n=new Nt("mtable",[new Nt("mtr",[UB(),new Nt("mtd",[wm(e.body,t)]),UB(),new Nt("mtd",[wm(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var WB={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},VB={"\\textbf":"textbf","\\textmd":"textmd"},f4e={"\\textit":"textit","\\textup":"textup"},GB=(e,t)=>{var n=e.font;if(n){if(WB[n])return t.withTextFontFamily(WB[n]);if(VB[n])return t.withTextFontWeight(VB[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(f4e[n])};ln({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:s}=e,r=t[0];return{type:"text",mode:n.mode,body:uo(r),font:s}},htmlBuilder(e,t){var n=GB(e,t),s=jo(e.body,n,!0);return wt(["mord","text"],s,n)},mathmlBuilder(e,t){var n=GB(e,t);return wm(e.body,n)}});ln({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=Sr(e.body,t),s=rb("underline-line",t),r=t.fontMetrics().defaultRuleThickness,i=kr({positionType:"top",positionData:n.height,children:[{type:"kern",size:r},{type:"elem",elem:s},{type:"kern",size:3*r},{type:"elem",elem:n}]});return wt(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Nt("mo",[new ho("‾")]);n.setAttribute("stretchy","true");var s=new Nt("munder",[Qr(e.body,t),n]);return s.setAttribute("accentunder","true"),s}});ln({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=Sr(e.body,t),s=t.fontMetrics().axisHeight,r=.5*(n.height-s-(n.depth+s));return kr({positionType:"shift",positionData:r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Nt("mpadded",[Qr(e.body,t)],["vcenter"]);return new Nt("mrow",[n])}});ln({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Tt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=KB(e),s=[],r=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push(Pa(o,"Typewriter-Regular",e.mode,r,["mord","texttt"]))}return wt(["mord","text"].concat(r.sizingClasses(t)),EQ(s),r)},mathmlBuilder(e,t){var n=new ho(KB(e)),s=new Nt("mtext",[n]);return s.setAttribute("mathvariant","monospace"),s}});var KB=e=>e.body.replace(/ /g,e.star?"␣":" "),Uf=MQ,dJ=`[ \r
	]`,m4e="\\\\[a-zA-Z@]+",p4e="\\\\[^\uD800-\uDFFF]",g4e="("+m4e+")"+dJ+"*",b4e=`\\\\(
|[ \r	]+
?)[ \r	]*`,JA="[̀-ͯ]",y4e=new RegExp(JA+"+$"),v4e="("+dJ+"+)|"+(b4e+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(JA+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(JA+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+g4e)+("|"+p4e+")");class YB{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(v4e,"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 nc("EOF",new dl(this,n,n));var s=this.tokenRegex.exec(t);if(s===null||s.index!==n)throw new Tt("Unexpected character: '"+t[n]+"'",new nc(t[n],new dl(this,n,n+1)));var r=s[6]||s[3]||(s[2]?"\\ ":" ");if(this.catcodes[r]===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 nc(r,new dl(this,n,this.tokenRegex.lastIndex))}}class x4e{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 Tt("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,s){if(s===void 0&&(s=!1),s){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][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 w4e=eJ;Q("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});Q("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});Q("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});Q("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});Q("\\@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}});Q("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Q("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var XB={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};Q("\\char",function(e){var t=e.popToken(),n,s=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]==="\\")s=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new Tt("\\char` missing argument");s=t.text.charCodeAt(0)}else n=10;if(n){if(s=XB[t.text],s==null||s>=n)throw new Tt("Invalid base-"+n+" digit "+t.text);for(var r;(r=XB[e.future().text])!=null&&r<n;)s*=n,s+=r,e.popToken()}return"\\@char{"+s+"}"});var hI=(e,t,n,s)=>{var r=e.consumeArg().tokens;if(r.length!==1)throw new Tt("\\newcommand's first argument must be a macro name");var i=r[0].text,o=e.isDefined(i);if(o&&!t)throw new Tt("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new Tt("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(r=e.consumeArg().tokens,r.length===1&&r[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 Tt("Invalid number of arguments: "+c);a=parseInt(c),r=e.consumeArg().tokens}return o&&s||e.macros.set(i,{tokens:r,numArgs:a}),""};Q("\\newcommand",e=>hI(e,!1,!0,!1));Q("\\renewcommand",e=>hI(e,!0,!1,!1));Q("\\providecommand",e=>hI(e,!0,!0,!0));Q("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});Q("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});Q("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Uf[n],vi.math[n],vi.text[n]),""});Q("\\bgroup","{");Q("\\egroup","}");Q("~","\\nobreakspace");Q("\\lq","`");Q("\\rq","'");Q("\\aa","\\r a");Q("\\AA","\\r A");Q("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Q("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Q("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Q("ℬ","\\mathscr{B}");Q("ℰ","\\mathscr{E}");Q("ℱ","\\mathscr{F}");Q("ℋ","\\mathscr{H}");Q("ℐ","\\mathscr{I}");Q("ℒ","\\mathscr{L}");Q("ℳ","\\mathscr{M}");Q("ℛ","\\mathscr{R}");Q("ℭ","\\mathfrak{C}");Q("ℌ","\\mathfrak{H}");Q("ℨ","\\mathfrak{Z}");Q("\\Bbbk","\\Bbb{k}");Q("\\llap","\\mathllap{\\textrm{#1}}");Q("\\rlap","\\mathrlap{\\textrm{#1}}");Q("\\clap","\\mathclap{\\textrm{#1}}");Q("\\mathstrut","\\vphantom{(}");Q("\\underbar","\\underline{\\text{#1}}");Q("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Q("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Q("\\ne","\\neq");Q("≠","\\neq");Q("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Q("∉","\\notin");Q("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Q("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Q("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Q("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Q("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Q("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Q("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Q("⟂","\\perp");Q("‼","\\mathclose{!\\mkern-0.8mu!}");Q("∌","\\notni");Q("⌜","\\ulcorner");Q("⌝","\\urcorner");Q("⌞","\\llcorner");Q("⌟","\\lrcorner");Q("©","\\copyright");Q("®","\\textregistered");Q("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Q("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Q("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Q("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Q("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Q("⋮","\\vdots");Q("\\varGamma","\\mathit{\\Gamma}");Q("\\varDelta","\\mathit{\\Delta}");Q("\\varTheta","\\mathit{\\Theta}");Q("\\varLambda","\\mathit{\\Lambda}");Q("\\varXi","\\mathit{\\Xi}");Q("\\varPi","\\mathit{\\Pi}");Q("\\varSigma","\\mathit{\\Sigma}");Q("\\varUpsilon","\\mathit{\\Upsilon}");Q("\\varPhi","\\mathit{\\Phi}");Q("\\varPsi","\\mathit{\\Psi}");Q("\\varOmega","\\mathit{\\Omega}");Q("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Q("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Q("\\boxed","\\fbox{$\\displaystyle{#1}$}");Q("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Q("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Q("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Q("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Q("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var QB={",":"\\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"},k4e=new Set(["bin","rel"]);Q("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in QB?t=QB[n]:(n.slice(0,4)==="\\not"||n in vi.math&&k4e.has(vi.math[n].group))&&(t="\\dotsb"),t});var fI={")":!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};Q("\\dotso",function(e){var t=e.future().text;return t in fI?"\\ldots\\,":"\\ldots"});Q("\\dotsc",function(e){var t=e.future().text;return t in fI&&t!==","?"\\ldots\\,":"\\ldots"});Q("\\cdots",function(e){var t=e.future().text;return t in fI?"\\@cdots\\,":"\\@cdots"});Q("\\dotsb","\\cdots");Q("\\dotsm","\\cdots");Q("\\dotsi","\\!\\cdots");Q("\\dotsx","\\ldots\\,");Q("\\DOTSI","\\relax");Q("\\DOTSB","\\relax");Q("\\DOTSX","\\relax");Q("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Q("\\,","\\tmspace+{3mu}{.1667em}");Q("\\thinspace","\\,");Q("\\>","\\mskip{4mu}");Q("\\:","\\tmspace+{4mu}{.2222em}");Q("\\medspace","\\:");Q("\\;","\\tmspace+{5mu}{.2777em}");Q("\\thickspace","\\;");Q("\\!","\\tmspace-{3mu}{.1667em}");Q("\\negthinspace","\\!");Q("\\negmedspace","\\tmspace-{4mu}{.2222em}");Q("\\negthickspace","\\tmspace-{5mu}{.277em}");Q("\\enspace","\\kern.5em ");Q("\\enskip","\\hskip.5em\\relax");Q("\\quad","\\hskip1em\\relax");Q("\\qquad","\\hskip2em\\relax");Q("\\tag","\\@ifstar\\tag@literal\\tag@paren");Q("\\tag@paren","\\tag@literal{({#1})}");Q("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Tt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Q("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Q("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Q("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Q("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Q("\\newline","\\\\\\relax");Q("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var hJ=Ot(Zu["Main-Regular"][84][1]-.7*Zu["Main-Regular"][65][1]);Q("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+hJ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Q("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+hJ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Q("\\hspace","\\@ifstar\\@hspacer\\@hspace");Q("\\@hspace","\\hskip #1\\relax");Q("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Q("\\ordinarycolon",":");Q("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Q("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Q("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Q("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Q("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Q("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Q("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Q("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Q("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Q("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Q("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Q("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Q("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Q("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Q("∷","\\dblcolon");Q("∹","\\eqcolon");Q("≔","\\coloneqq");Q("≕","\\eqqcolon");Q("⩴","\\Coloneqq");Q("\\ratio","\\vcentcolon");Q("\\coloncolon","\\dblcolon");Q("\\colonequals","\\coloneqq");Q("\\coloncolonequals","\\Coloneqq");Q("\\equalscolon","\\eqqcolon");Q("\\equalscoloncolon","\\Eqqcolon");Q("\\colonminus","\\coloneq");Q("\\coloncolonminus","\\Coloneq");Q("\\minuscolon","\\eqcolon");Q("\\minuscoloncolon","\\Eqcolon");Q("\\coloncolonapprox","\\Colonapprox");Q("\\coloncolonsim","\\Colonsim");Q("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Q("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Q("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Q("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Q("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Q("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Q("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Q("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Q("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Q("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Q("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Q("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Q("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Q("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Q("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Q("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Q("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Q("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Q("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Q("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Q("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Q("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Q("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Q("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Q("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Q("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Q("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Q("\\imath","\\html@mathml{\\@imath}{ı}");Q("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Q("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Q("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Q("⟦","\\llbracket");Q("⟧","\\rrbracket");Q("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Q("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Q("⦃","\\lBrace");Q("⦄","\\rBrace");Q("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Q("⦵","\\minuso");Q("\\darr","\\downarrow");Q("\\dArr","\\Downarrow");Q("\\Darr","\\Downarrow");Q("\\lang","\\langle");Q("\\rang","\\rangle");Q("\\uarr","\\uparrow");Q("\\uArr","\\Uparrow");Q("\\Uarr","\\Uparrow");Q("\\N","\\mathbb{N}");Q("\\R","\\mathbb{R}");Q("\\Z","\\mathbb{Z}");Q("\\alef","\\aleph");Q("\\alefsym","\\aleph");Q("\\Alpha","\\mathrm{A}");Q("\\Beta","\\mathrm{B}");Q("\\bull","\\bullet");Q("\\Chi","\\mathrm{X}");Q("\\clubs","\\clubsuit");Q("\\cnums","\\mathbb{C}");Q("\\Complex","\\mathbb{C}");Q("\\Dagger","\\ddagger");Q("\\diamonds","\\diamondsuit");Q("\\empty","\\emptyset");Q("\\Epsilon","\\mathrm{E}");Q("\\Eta","\\mathrm{H}");Q("\\exist","\\exists");Q("\\harr","\\leftrightarrow");Q("\\hArr","\\Leftrightarrow");Q("\\Harr","\\Leftrightarrow");Q("\\hearts","\\heartsuit");Q("\\image","\\Im");Q("\\infin","\\infty");Q("\\Iota","\\mathrm{I}");Q("\\isin","\\in");Q("\\Kappa","\\mathrm{K}");Q("\\larr","\\leftarrow");Q("\\lArr","\\Leftarrow");Q("\\Larr","\\Leftarrow");Q("\\lrarr","\\leftrightarrow");Q("\\lrArr","\\Leftrightarrow");Q("\\Lrarr","\\Leftrightarrow");Q("\\Mu","\\mathrm{M}");Q("\\natnums","\\mathbb{N}");Q("\\Nu","\\mathrm{N}");Q("\\Omicron","\\mathrm{O}");Q("\\plusmn","\\pm");Q("\\rarr","\\rightarrow");Q("\\rArr","\\Rightarrow");Q("\\Rarr","\\Rightarrow");Q("\\real","\\Re");Q("\\reals","\\mathbb{R}");Q("\\Reals","\\mathbb{R}");Q("\\Rho","\\mathrm{P}");Q("\\sdot","\\cdot");Q("\\sect","\\S");Q("\\spades","\\spadesuit");Q("\\sub","\\subset");Q("\\sube","\\subseteq");Q("\\supe","\\supseteq");Q("\\Tau","\\mathrm{T}");Q("\\thetasym","\\vartheta");Q("\\weierp","\\wp");Q("\\Zeta","\\mathrm{Z}");Q("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Q("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Q("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Q("\\bra","\\mathinner{\\langle{#1}|}");Q("\\ket","\\mathinner{|{#1}\\rangle}");Q("\\braket","\\mathinner{\\langle{#1}\\rangle}");Q("\\Bra","\\left\\langle#1\\right|");Q("\\Ket","\\left|#1\\right\\rangle");var fJ=e=>t=>{var n=t.consumeArg().tokens,s=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var c=h=>m=>{e&&(m.macros.set("|",o),r.length&&m.macros.set("\\|",a));var p=h;if(!h&&r.length){var g=m.future();g.text==="|"&&(m.popToken(),p=!0)}return{tokens:p?r:s,numArgs:0}};t.macros.set("|",c(!1)),r.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}};Q("\\bra@ket",fJ(!1));Q("\\bra@set",fJ(!0));Q("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Q("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Q("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Q("\\angln","{\\angl n}");Q("\\blue","\\textcolor{##6495ed}{#1}");Q("\\orange","\\textcolor{##ffa500}{#1}");Q("\\pink","\\textcolor{##ff00af}{#1}");Q("\\red","\\textcolor{##df0030}{#1}");Q("\\green","\\textcolor{##28ae7b}{#1}");Q("\\gray","\\textcolor{gray}{#1}");Q("\\purple","\\textcolor{##9d38bd}{#1}");Q("\\blueA","\\textcolor{##ccfaff}{#1}");Q("\\blueB","\\textcolor{##80f6ff}{#1}");Q("\\blueC","\\textcolor{##63d9ea}{#1}");Q("\\blueD","\\textcolor{##11accd}{#1}");Q("\\blueE","\\textcolor{##0c7f99}{#1}");Q("\\tealA","\\textcolor{##94fff5}{#1}");Q("\\tealB","\\textcolor{##26edd5}{#1}");Q("\\tealC","\\textcolor{##01d1c1}{#1}");Q("\\tealD","\\textcolor{##01a995}{#1}");Q("\\tealE","\\textcolor{##208170}{#1}");Q("\\greenA","\\textcolor{##b6ffb0}{#1}");Q("\\greenB","\\textcolor{##8af281}{#1}");Q("\\greenC","\\textcolor{##74cf70}{#1}");Q("\\greenD","\\textcolor{##1fab54}{#1}");Q("\\greenE","\\textcolor{##0d923f}{#1}");Q("\\goldA","\\textcolor{##ffd0a9}{#1}");Q("\\goldB","\\textcolor{##ffbb71}{#1}");Q("\\goldC","\\textcolor{##ff9c39}{#1}");Q("\\goldD","\\textcolor{##e07d10}{#1}");Q("\\goldE","\\textcolor{##a75a05}{#1}");Q("\\redA","\\textcolor{##fca9a9}{#1}");Q("\\redB","\\textcolor{##ff8482}{#1}");Q("\\redC","\\textcolor{##f9685d}{#1}");Q("\\redD","\\textcolor{##e84d39}{#1}");Q("\\redE","\\textcolor{##bc2612}{#1}");Q("\\maroonA","\\textcolor{##ffbde0}{#1}");Q("\\maroonB","\\textcolor{##ff92c6}{#1}");Q("\\maroonC","\\textcolor{##ed5fa6}{#1}");Q("\\maroonD","\\textcolor{##ca337c}{#1}");Q("\\maroonE","\\textcolor{##9e034e}{#1}");Q("\\purpleA","\\textcolor{##ddd7ff}{#1}");Q("\\purpleB","\\textcolor{##c6b9fc}{#1}");Q("\\purpleC","\\textcolor{##aa87ff}{#1}");Q("\\purpleD","\\textcolor{##7854ab}{#1}");Q("\\purpleE","\\textcolor{##543b78}{#1}");Q("\\mintA","\\textcolor{##f5f9e8}{#1}");Q("\\mintB","\\textcolor{##edf2df}{#1}");Q("\\mintC","\\textcolor{##e0e5cc}{#1}");Q("\\grayA","\\textcolor{##f6f7f7}{#1}");Q("\\grayB","\\textcolor{##f0f1f2}{#1}");Q("\\grayC","\\textcolor{##e3e5e6}{#1}");Q("\\grayD","\\textcolor{##d6d8da}{#1}");Q("\\grayE","\\textcolor{##babec2}{#1}");Q("\\grayF","\\textcolor{##888d93}{#1}");Q("\\grayG","\\textcolor{##626569}{#1}");Q("\\grayH","\\textcolor{##3b3e40}{#1}");Q("\\grayI","\\textcolor{##21242c}{#1}");Q("\\kaBlue","\\textcolor{##314453}{#1}");Q("\\kaGreen","\\textcolor{##71B307}{#1}");var mJ={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class _4e{constructor(t,n,s){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 x4e(w4e,n.macros),this.mode=s,this.stack=[]}feed(t){this.lexer=new YB(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,s,r;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:r,end:s}=this.consumeArg(["]"])}else({tokens:r,start:n,end:s}=this.consumeArg());return this.pushToken(new nc("EOF",s.loc)),this.pushTokens(r),new nc("",dl.range(n,s))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],s=t&&t.length>0;s||this.consumeSpaces();var r=this.future(),i,o=0,a=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new Tt("Extra }",i)}else if(i.text==="EOF")throw new Tt("Unexpected end of input in a macro argument, expected '"+(t&&s?t[a]:"}")+"'",i);if(t&&s)if((o===0||o===1&&t[a]==="{")&&i.text===t[a]){if(++a,a===t.length){n.splice(-a,a);break}}else a=0}while(o!==0||s);return r.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:r,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new Tt("The length of delimiters doesn't match the number of args!");for(var s=n[0],r=0;r<s.length;r++){var i=this.popToken();if(s[r]!==i.text)throw new Tt("Use of the macro doesn't match its definition",i)}}for(var o=[],a=0;a<t;a++)o.push(this.consumeArg(n&&n[a+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new Tt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),s=n.text,r=n.noexpand?null:this._getExpansion(s);if(r==null||t&&r.unexpandable){if(t&&r==null&&s[0]==="\\"&&!this.isDefined(s))throw new Tt("Undefined control sequence: "+s);return this.pushToken(n),!1}this.countExpansion(1);var i=r.tokens,o=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var c=i[a];if(c.text==="#"){if(a===0)throw new Tt("Incomplete placeholder at end of macro body",c);if(c=i[--a],c.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(c.text))i.splice(a,2,...o[+c.text-1]);else throw new Tt("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 nc(t)]):void 0}expandTokens(t){var n=[],s=this.stack.length;for(this.pushTokens(t);this.stack.length>s;)if(this.expandOnce(!0)===!1){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),n.push(r)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(s=>s.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var s=this.lexer.catcodes[t];if(s!=null&&s!==13)return}var r=typeof n=="function"?n(this):n;if(typeof r=="string"){var i=0;if(r.includes("#"))for(var o=r.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new YB(r,this.settings),c=[],u=a.lex();u.text!=="EOF";)c.push(u),u=a.lex();c.reverse();var d={tokens:c,numArgs:i};return d}return r}isDefined(t){return this.macros.has(t)||Uf.hasOwnProperty(t)||vi.math.hasOwnProperty(t)||vi.text.hasOwnProperty(t)||mJ.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Uf.hasOwnProperty(t)&&!Uf[t].primitive}}var JB=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,x_=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),c8={"́":{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"}},ZB={á:"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 pJ=class gJ{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 _4e(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 Tt("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 nc("}")),this.gullet.pushTokens(t);var s=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,s}parseExpression(t,n){for(var s=[];;){this.mode==="math"&&this.consumeSpaces();var r=this.fetch();if(gJ.endOfExpression.has(r.text)||n&&r.text===n||t&&Uf[r.text]&&Uf[r.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;s.push(i)}return this.mode==="text"&&this.formLigatures(s),this.handleInfixNodes(s)}handleInfixNodes(t){for(var n=-1,s,r=0;r<t.length;r++){var i=t[r];if(i.type==="infix"){if(n!==-1)throw new Tt("only one infix operator per group",i.token);n=r,s=i.replaceWith}}if(n!==-1&&s){var o,a,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"?a=u[0]:a={type:"ordgroup",mode:this.mode,body:u};var d;return s==="\\\\abovefrac"?d=this.callFunction(s,[o,t[n],a],[]):d=this.callFunction(s,[o,a],[]),[d]}else return t}handleSupSubscript(t){var n=this.fetch(),s=n.text;this.consume(),this.consumeSpaces();var r;do{var i;r=this.parseGroup(t)}while(((i=r)==null?void 0:i.type)==="internal");if(!r)throw new Tt("Expected group after '"+s+"'",n);return r}formatUnsupportedCmd(t){for(var n=[],s=0;s<t.length;s++)n.push({type:"textord",mode:"text",text:t[s]});var r={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]};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 s,r;;){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 Tt("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(s)throw new Tt("Double superscript",i);s=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(r)throw new Tt("Double subscript",i);r=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(s)throw new Tt("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},c=[a];for(this.consume();this.fetch().text==="'";)c.push(a),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),s={type:"ordgroup",mode:this.mode,body:c}}else if(x_[i.text]){var u=JB.test(i.text),d=[];for(d.push(new nc(x_[i.text])),this.consume();;){var h=this.fetch().text;if(!x_[h]||JB.test(h)!==u)break;d.unshift(new nc(x_[h])),this.consume()}var m=this.subparse(d);u?r={type:"ordgroup",mode:"math",body:m}:s={type:"ordgroup",mode:"math",body:m}}else break}return s||r?{type:"supsub",mode:this.mode,base:n,sup:s,sub:r}:n}parseFunction(t,n){var s=this.fetch(),r=s.text,i=Uf[r];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new Tt("Got function '"+r+"' with no arguments"+(n?" as "+n:""),s);if(this.mode==="text"&&!i.allowedInText)throw new Tt("Can't use function '"+r+"' in text mode",s);if(this.mode==="math"&&i.allowedInMath===!1)throw new Tt("Can't use function '"+r+"' in math mode",s);var{args:o,optArgs:a}=this.parseArguments(r,i);return this.callFunction(r,o,a,s,t)}callFunction(t,n,s,r,i){var o={funcName:t,parser:this,token:r,breakOnTokenText:i},a=Uf[t];if(a&&a.handler)return a.handler(o,n,s);throw new Tt("No function handler for "+t)}parseArguments(t,n){var s=n.numArgs+n.numOptionalArgs;if(s===0)return{args:[],optArgs:[]};for(var r=[],i=[],o=0;o<s;o++){var a=n.argTypes&&n.argTypes[o],c=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&a==null||n.type==="sqrt"&&o===1&&i[0]==null)&&(a="primitive");var u=this.parseGroupOfType("argument to '"+t+"'",a,c);if(c)i.push(u);else if(u!=null)r.push(u);else throw new Tt("Null argument, please report this as a bug")}return{args:r,optArgs:i}}parseGroupOfType(t,n,s){switch(n){case"color":return this.parseColorGroup(s);case"size":return this.parseSizeGroup(s);case"url":return this.parseUrlGroup(s);case"math":case"text":return this.parseArgumentGroup(s,n);case"hbox":{var r=this.parseArgumentGroup(s,"text");return r!=null?{type:"styling",mode:r.mode,body:[r],style:"text",resetFont:!0}:null}case"raw":{var i=this.parseStringGroup("raw",s);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(s)throw new Tt("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new Tt("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(s);default:throw new Tt("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,n){var s=this.gullet.scanArgument(n);if(s==null)return null;for(var r="",i;(i=this.fetch()).text!=="EOF";)r+=i.text,this.consume();return this.consume(),s.text=r,s}parseRegexGroup(t,n){for(var s=this.fetch(),r=s,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)r=o,i+=r.text,this.consume();if(i==="")throw new Tt("Invalid "+n+": '"+s.text+"'",s);return s.range(r,i)}parseColorGroup(t){var n=this.parseStringGroup("color",t);if(n==null)return null;var s=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!s)throw new Tt("Invalid color: '"+n.text+"'",n);var r=s[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(t){var n,s=!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",s=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!r)throw new Tt("Invalid size: '"+n.text+"'",n);var i={number:+(r[1]+r[2]),unit:r[3]};if(!wQ(i))throw new Tt("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:s}}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 s=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:s}}parseArgumentGroup(t,n){var s=this.gullet.scanArgument(t);if(s==null)return null;var r=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:s.loc,body:i};return n&&this.switchMode(r),o}parseGroup(t,n){var s=this.fetch(),r=s.text,i;if(r==="{"||r==="\\begingroup"){this.consume();var o=r==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),c=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:dl.range(s,c),body:a,semisimple:r==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&r[0]==="\\"&&!mJ.hasOwnProperty(r)){if(this.settings.throwOnError)throw new Tt("Undefined control sequence: "+r,s);i=this.formatUnsupportedCmd(r),this.consume()}return i}formLigatures(t){for(var n=t.length-1,s=0;s<n;++s){var r=t[s];if(r.type==="textord"){var i=r.text,o=t[s+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=t[s+2];s+1<n&&a&&a.type==="textord"&&a.text==="-"?(t.splice(s,3,{type:"textord",mode:"text",loc:dl.range(r,a),text:"---"}),n-=2):(t.splice(s,2,{type:"textord",mode:"text",loc:dl.range(r,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(s,2,{type:"textord",mode:"text",loc:dl.range(r,o),text:i+i}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var s=n.slice(5),r=s.charAt(0)==="*";if(r&&(s=s.slice(1)),s.length<2||s.charAt(0)!==s.slice(-1))throw new Tt(`\\verb assertion failed --
                    please report what input caused this bug`);return s=s.slice(1,-1),{type:"verb",mode:"text",body:s,star:r}}ZB.hasOwnProperty(n[0])&&!vi[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=ZB[n[0]]+n.slice(1));var i=y4e.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(vi[this.mode][n]){this.settings.strict&&this.mode==="math"&&$A.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=vi[this.mode][n].group,c=dl.range(t),u;BSe(a)?u={type:"atom",mode:this.mode,family:a,loc:c,text:n}:u={type:a,mode:this.mode,loc:c,text:n},o=u}else if(n.charCodeAt(0)>=128)this.settings.strict&&(xQ(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:dl.range(t),text:n};else return null;if(this.consume(),i)for(var d=0;d<i[0].length;d++){var h=i[0][d];if(!c8[h])throw new Tt("Unknown accent ' "+h+"'",t);var m=c8[h][this.mode]||c8[h].text;if(!m)throw new Tt("Accent "+h+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:dl.range(t),label:m,isStretchy:!1,isShifty:!0,base:o}}return o}};pJ.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var mI=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var s=new pJ(t,n);delete s.gullet.macros.current["\\df@tag"];var r=s.parse();if(delete s.gullet.macros.current["\\current@color"],delete s.gullet.macros.current["\\color"],s.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new Tt("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:s.subparse([new nc("\\df@tag")])}]}return r},pI=function(t,n,s){n.textContent="";var r=NC(t,s).toNode();n.appendChild(r)};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."),pI=function(){throw new Tt("KaTeX doesn't work in quirks mode.")});var bJ=function(t,n){var s=NC(t,n).toMarkup();return s},yJ=function(t,n){var s=new eI(n);return mI(t,s)},vJ=function(t,n,s){if(s.throwOnError||!(t instanceof Tt))throw t;var r=wt(["katex-error"],[new ac(n)]);return r.setAttribute("title",t.toString()),r.setAttribute("style","color:"+s.errorColor),r},NC=function(t,n){var s=new eI(n);try{var r=mI(t,s);return MSe(r,t,s)}catch(i){return vJ(i,t,s)}},xJ=function(t,n){var s=new eI(n);try{var r=mI(t,s);return ISe(r,t,s)}catch(i){return vJ(i,t,s)}},wJ="0.16.47",kJ={Span:zb,Anchor:yC,SymbolNode:ac,SvgNode:$h,PathNode:vm,LineNode:OA},ZA={version:wJ,render:pI,renderToString:bJ,ParseError:Tt,SETTINGS_SCHEMA:m4,__parse:yJ,__renderToDomTree:NC,__renderToHTMLTree:xJ,__setFontMetrics:CQ,__defineSymbol:N,__defineFunction:ln,__defineMacro:Q,__domTree:kJ};const I4t=Object.freeze(Object.defineProperty({__proto__:null,ParseError:Tt,SETTINGS_SCHEMA:m4,__defineFunction:ln,__defineMacro:Q,__defineSymbol:N,__domTree:kJ,__parse:yJ,__renderToDomTree:NC,__renderToHTMLTree:xJ,__setFontMetrics:CQ,default:ZA,get render(){return pI},renderToString:bJ,version:wJ},Symbol.toStringTag,{value:"Module"})),S4e={};function ez(e){const t=this,n=e||S4e,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(I2e(n)),i.push(S2e()),o.push(C2e(n))}const tz=/[#.]/g;function C4e(e,t){const n=e||"",s={};let r=0,i,o;for(;r<n.length;){tz.lastIndex=r;const a=tz.exec(n),c=n.slice(r,a?a.index:n.length);c&&(i?i==="#"?s.id=c:Array.isArray(s.className)?s.className.push(c):s.className=[c]:o=c,r+=c.length),a&&(i=a[0],r++)}return{type:"element",tagName:o||t||"div",properties:s,children:[]}}function _J(e,t,n){const s=n?j4e(n):void 0;function r(i,o,...a){let c;if(i==null){c={type:"root",children:[]};const u=o;a.unshift(u)}else{c=C4e(i,t);const u=c.tagName.toLowerCase(),d=s?s.get(u):void 0;if(c.tagName=d||u,T4e(o))a.unshift(o);else for(const[h,m]of Object.entries(o))E4e(e,c.properties,h,m)}for(const u of a)ej(c.children,u);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return r}function T4e(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 s of n){const r=t[s];if(r&&typeof r=="object"){if(!Array.isArray(r))return!0;const i=r;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function E4e(e,t,n,s){const r=D9(e,n);let i;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;i=s}else typeof s=="boolean"?i=s:typeof s=="string"?r.spaceSeparated?i=k$(s):r.commaSeparated?i=b$(s):r.commaOrSpaceSeparated?i=k$(b$(s).join(" ")):i=nz(r,r.property,s):Array.isArray(s)?i=[...s]:i=r.property==="style"?A4e(s):String(s);if(Array.isArray(i)){const o=[];for(const a of i)o.push(nz(r,r.property,a));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function ej(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)ej(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?ej(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function nz(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Tx(n)===Tx(t)))return!0}return n}function A4e(e){const t=[];for(const[n,s]of Object.entries(e))t.push([n,s].join(": "));return t.join("; ")}function j4e(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const N4e=["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"],M4e=_J(L9,"div"),I4e=_J(Ob,"g",N4e),u8={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function R4e(e,t){return SJ(e,{})||{type:"root",children:[]}}function SJ(e,t){const n=D4e(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function D4e(e,t){switch(e.nodeType){case 1:return $4e(e,t);case 3:return P4e(e);case 8:return O4e(e);case 9:return sz(e,t);case 10:return L4e();case 11:return sz(e,t);default:return}}function sz(e,t){return{type:"root",children:CJ(e,t)}}function L4e(){return{type:"doctype"}}function P4e(e){return{type:"text",value:e.nodeValue||""}}function O4e(e){return{type:"comment",value:e.nodeValue||""}}function $4e(e,t){const n=e.namespaceURI,s=n===u8.svg?I4e:M4e,r=n===u8.html?e.tagName.toLowerCase():e.tagName,i=n===u8.html&&r==="template"?e.content:e,o=e.getAttributeNames(),a={};let c=-1;for(;++c<o.length;)a[o[c]]=e.getAttribute(o[c])||"";return s(r,a,CJ(i,t))}function CJ(e,t){const n=e.childNodes,s=[];let r=-1;for(;++r<n.length;){const i=SJ(n[r],t);i!==void 0&&s.push(i)}return s}new DOMParser;function B4e(e,t){const n=z4e(e);return R4e(n)}function z4e(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const rz=function(e,t,n){const s=jw(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(s(e.children[t],t,e))return e.children[t]},q0=function(e){if(e==null)return q4e;if(typeof e=="string")return H4e(e);if(typeof e=="object")return F4e(e);if(typeof e=="function")return gI(e);throw new Error("Expected function, string, or array as `test`")};function F4e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=q0(e[n]);return gI(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function H4e(e){return gI(t);function t(n){return n.tagName===e}}function gI(e){return t;function t(n,s,r){return!!(U4e(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function q4e(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function U4e(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const iz=/\n/g,oz=/[\t ]+/g,tj=q0("br"),az=q0(J4e),W4e=q0("p"),lz=q0("tr"),V4e=q0(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Q4e,Z4e]),TJ=q0(["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 G4e(e,t){const n=t||{},s="children"in e?e.children:[],r=TJ(e),i=jJ(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...AJ(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<s.length;)o.push(...EJ(s[a],e,{whitespace:i,breakBefore:a?void 0:r,breakAfter:a<s.length-1?tj(s[a+1]):r}));const c=[];let u;for(a=-1;++a<o.length;){const d=o[a];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 EJ(e,t,n){return e.type==="element"?K4e(e,t,n):e.type==="text"?n.whitespace==="normal"?AJ(e,n):Y4e(e):[]}function K4e(e,t,n){const s=jJ(e,n),r=e.children||[];let i=-1,o=[];if(V4e(e))return o;let a,c;for(tj(e)||lz(e)&&rz(t,e,lz)?c=`
`:W4e(e)?(a=2,c=2):TJ(e)&&(a=1,c=1);++i<r.length;)o=o.concat(EJ(r[i],e,{whitespace:s,breakBefore:i?void 0:a,breakAfter:i<r.length-1?tj(r[i+1]):c}));return az(e)&&rz(t,e,az)&&o.push("	"),a&&o.unshift(a),c&&o.push(c),o}function AJ(e,t){const n=String(e.value),s=[],r=[];let i=0;for(;i<=n.length;){iz.lastIndex=i;const c=iz.exec(n),u=c&&"index"in c?c.index:n.length;s.push(X4e(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,a;for(;++o<s.length;)s[o].charCodeAt(s[o].length-1)===8203||o<s.length-1&&s[o+1].charCodeAt(0)===8203?(r.push(s[o]),a=void 0):s[o]?(typeof a=="number"&&r.push(a),r.push(s[o]),a=0):(o===0||o===s.length-1)&&r.push(0);return r}function Y4e(e){return[String(e.value)]}function X4e(e,t,n){const s=[];let r=0,i;for(;r<e.length;){oz.lastIndex=r;const o=oz.exec(e);i=o?o.index:e.length,!r&&!i&&o&&!t&&s.push(""),r!==i&&s.push(e.slice(r,i)),r=o?i+o[0].length:i}return r!==i&&!n&&s.push(""),s.join(" ")}function jJ(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 Q4e(e){return!!(e.properties||{}).hidden}function J4e(e){return e.tagName==="td"||e.tagName==="th"}function Z4e(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const e3e={},t3e=[];function cz(e){const t=e||e3e;return function(n,s){K9(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:t3e,a=o.includes("language-math"),c=o.includes("math-display"),u=o.includes("math-inline");let d=c;if(!a&&!c&&!u)return;let h=i[i.length-1],m=r;if(r.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(m=h,h=i[i.length-2],d=!0),!h)return;const p=G4e(m,{whitespace:"pre"});let g;try{g=ZA.renderToString(p,{...t,displayMode:d,throwOnError:!0})}catch(x){const y=x,v=y.name.toLowerCase();s.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:y,place:r.position,ruleId:v,source:"rehype-katex"});try{g=ZA.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(x)},children:[{type:"text",value:p}]}]}}typeof g=="string"&&(g=B4e(g).children);const b=h.children.indexOf(m);return h.children.splice(b,1,...g),VX})}}const NJ=[{id:"abap",name:"ABAP",import:()=>oe(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>oe(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>oe(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>oe(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>oe(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>oe(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>oe(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>oe(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>oe(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>oe(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>oe(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>oe(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>oe(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>oe(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>oe(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>oe(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>oe(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>oe(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>oe(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>oe(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>oe(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>oe(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>oe(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>oe(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>oe(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>oe(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>oe(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>oe(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>oe(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>oe(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>oe(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>oe(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>oe(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>oe(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>oe(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>oe(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>oe(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>oe(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>oe(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>oe(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>oe(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>oe(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>oe(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>oe(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>oe(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>oe(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>oe(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>oe(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>oe(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>oe(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>oe(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>oe(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>oe(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>oe(()=>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:()=>oe(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>oe(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>oe(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>oe(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>oe(()=>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:()=>oe(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>oe(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>oe(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>oe(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>oe(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>oe(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>oe(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>oe(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>oe(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>oe(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>oe(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>oe(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>oe(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>oe(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>oe(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>oe(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>oe(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>oe(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>oe(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>oe(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>oe(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>oe(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>oe(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>oe(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>oe(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>oe(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>oe(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>oe(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>oe(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>oe(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>oe(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>oe(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>oe(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>oe(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>oe(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>oe(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>oe(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>oe(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>oe(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>oe(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>oe(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>oe(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>oe(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>oe(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>oe(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>oe(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>oe(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>oe(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>oe(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>oe(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>oe(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>oe(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>oe(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>oe(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>oe(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>oe(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>oe(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>oe(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>oe(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>oe(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>oe(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>oe(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>oe(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>oe(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>oe(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>oe(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>oe(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>oe(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>oe(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>oe(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>oe(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>oe(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>oe(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>oe(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>oe(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>oe(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>oe(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>oe(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>oe(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>oe(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>oe(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>oe(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>oe(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>oe(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>oe(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>oe(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>oe(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>oe(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>oe(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>oe(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>oe(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>oe(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>oe(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>oe(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>oe(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>oe(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>oe(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>oe(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>oe(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>oe(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>oe(()=>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:()=>oe(()=>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:()=>oe(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>oe(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>oe(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>oe(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>oe(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>oe(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>oe(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>oe(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>oe(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>oe(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>oe(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>oe(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>oe(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>oe(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>oe(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>oe(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>oe(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>oe(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>oe(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>oe(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>oe(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>oe(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>oe(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>oe(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>oe(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>oe(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>oe(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>oe(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>oe(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>oe(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>oe(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>oe(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>oe(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>oe(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>oe(()=>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:()=>oe(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>oe(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>oe(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>oe(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>oe(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>oe(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>oe(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>oe(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>oe(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>oe(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>oe(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>oe(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>oe(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>oe(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>oe(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>oe(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>oe(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>oe(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>oe(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>oe(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>oe(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>oe(()=>import("./zig-BVz_zdnA.js"),[])}],n3e=Object.fromEntries(NJ.map(e=>[e.id,e.import])),s3e=Object.fromEntries(NJ.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),r3e={...n3e,...s3e},i3e=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>oe(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>oe(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>oe(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>oe(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>oe(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>oe(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>oe(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>oe(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>oe(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>oe(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>oe(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>oe(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>oe(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>oe(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>oe(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>oe(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>oe(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>oe(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>oe(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>oe(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>oe(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>oe(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>oe(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>oe(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>oe(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>oe(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>oe(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>oe(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>oe(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>oe(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>oe(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>oe(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>oe(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>oe(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>oe(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>oe(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>oe(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>oe(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>oe(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>oe(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>oe(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>oe(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>oe(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>oe(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>oe(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>oe(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>oe(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>oe(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>oe(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>oe(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>oe(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>oe(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>oe(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>oe(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],o3e=Object.fromEntries(i3e.map(e=>[e.id,e.import]));let _h=class extends Error{constructor(t){super(t),this.name="ShikiError"}},bI=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function a3e(){return 2147483648}function l3e(){return typeof performance<"u"?performance.now():Date.now()}const c3e=(e,t)=>e+(t-e%t)%t;async function u3e(e){let t,n;const s={};function r(p){n=p,s.HEAPU8=new Uint8Array(p),s.HEAPU32=new Uint32Array(p)}function i(p,g,b){s.HEAPU8.copyWithin(p,g,g+b)}function o(p){try{return t.grow(p-n.byteLength+65535>>>16),r(t.buffer),1}catch{}}function a(p){const g=s.HEAPU8.length;p=p>>>0;const b=a3e();if(p>b)return!1;for(let x=1;x<=4;x*=2){let y=g*(1+.2/x);y=Math.min(y,p+100663296);const v=Math.min(b,c3e(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 x=g+b;let y=g;for(;p[y]&&!(y>=x);)++y;if(y-g>16&&p.buffer&&c)return c.decode(p.subarray(g,y));let v="";for(;g<y;){let w=p[g++];if(!(w&128)){v+=String.fromCharCode(w);continue}const k=p[g++]&63;if((w&224)===192){v+=String.fromCharCode((w&31)<<6|k);continue}const T=p[g++]&63;if((w&240)===224?w=(w&15)<<12|k<<6|T:w=(w&7)<<18|k<<12|T<<6|p[g++]&63,w<65536)v+=String.fromCharCode(w);else{const C=w-65536;v+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return v}function d(p,g){return p?u(s.HEAPU8,p,g):""}const h={emscripten_get_now:l3e,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function m(){const g=await e({env:h,wasi_snapshot_preview1:h});t=g.memory,r(t.buffer),Object.assign(s,g),s.UTF8ToString=d}return await m(),s}var d3e=Object.defineProperty,h3e=(e,t,n)=>t in e?d3e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ko=(e,t,n)=>(h3e(e,typeof t!="symbol"?t+"":t,n),n);let Bo=null;function f3e(e){throw new bI(e.UTF8ToString(e.getLastOnigError()))}class MC{constructor(t){ko(this,"utf16Length"),ko(this,"utf8Length"),ko(this,"utf16Value"),ko(this,"utf8Value"),ko(this,"utf16OffsetToUtf8"),ko(this,"utf8OffsetToUtf16");const n=t.length,s=MC._utf8ByteLength(t),r=s!==n,i=r?new Uint32Array(n+1):null;r&&(i[n]=s);const o=r?new Uint32Array(s+1):null;r&&(o[s]=n);const a=new Uint8Array(s);let c=0;for(let u=0;u<n;u++){const d=t.charCodeAt(u);let h=d,m=!1;if(d>=55296&&d<=56319&&u+1<n){const p=t.charCodeAt(u+1);p>=56320&&p<=57343&&(h=(d-55296<<10)+65536|p-56320,m=!0)}r&&(i[u]=c,m&&(i[u+1]=c),h<=127?o[c+0]=u:h<=2047?(o[c+0]=u,o[c+1]=u):h<=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)),h<=127?a[c++]=h:h<=2047?(a[c++]=192|(h&1984)>>>6,a[c++]=128|(h&63)>>>0):h<=65535?(a[c++]=224|(h&61440)>>>12,a[c++]=128|(h&4032)>>>6,a[c++]=128|(h&63)>>>0):(a[c++]=240|(h&1835008)>>>18,a[c++]=128|(h&258048)>>>12,a[c++]=128|(h&4032)>>>6,a[c++]=128|(h&63)>>>0),m&&u++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let s=0,r=t.length;s<r;s++){const i=t.charCodeAt(s);let o=i,a=!1;if(i>=55296&&i<=56319&&s+1<r){const c=t.charCodeAt(s+1);c>=56320&&c<=57343&&(o=(i-55296<<10)+65536|c-56320,a=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,a&&s++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const $u=class{constructor(e){if(ko(this,"id",++$u.LAST_ID),ko(this,"_onigBinding"),ko(this,"content"),ko(this,"utf16Length"),ko(this,"utf8Length"),ko(this,"utf16OffsetToUtf8"),ko(this,"utf8OffsetToUtf16"),ko(this,"ptr"),!Bo)throw new bI("Must invoke loadWasm first.");this._onigBinding=Bo,this.content=e;const t=new MC(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!$u._sharedPtrInUse?($u._sharedPtr||($u._sharedPtr=Bo.omalloc(1e4)),$u._sharedPtrInUse=!0,Bo.HEAPU8.set(t.utf8Value,$u._sharedPtr),this.ptr=$u._sharedPtr):this.ptr=t.createString(Bo)}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===$u._sharedPtr?$u._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let Rw=$u;ko(Rw,"LAST_ID",0);ko(Rw,"_sharedPtr",0);ko(Rw,"_sharedPtrInUse",!1);class m3e{constructor(t){if(ko(this,"_onigBinding"),ko(this,"_ptr"),!Bo)throw new bI("Must invoke loadWasm first.");const n=[],s=[];for(let a=0,c=t.length;a<c;a++){const u=new MC(t[a]);n[a]=u.createString(Bo),s[a]=u.utf8Length}const r=Bo.omalloc(4*t.length);Bo.HEAPU32.set(n,r/4);const i=Bo.omalloc(4*t.length);Bo.HEAPU32.set(s,i/4);const o=Bo.createOnigScanner(r,i,t.length);for(let a=0,c=t.length;a<c;a++)Bo.ofree(n[a]);Bo.ofree(i),Bo.ofree(r),o===0&&f3e(Bo),this._onigBinding=Bo,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let r=0;if(typeof s=="number"&&(r=s),typeof t=="string"){t=new Rw(t);const i=this._findNextMatchSync(t,n,!1,r);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,r)}_findNextMatchSync(t,n,s,r){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),r);if(o===0)return null;const a=i.HEAPU32;let c=o/4;const u=a[c++],d=a[c++],h=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(a[c++]),g=t.convertUtf8OffsetToUtf16(a[c++]);h[m]={start:p,end:g,length:g-p}}return{index:u,captureIndices:h}}}function p3e(e){return typeof e.instantiator=="function"}function g3e(e){return typeof e.default=="function"}function b3e(e){return typeof e.data<"u"}function y3e(e){return typeof Response<"u"&&e instanceof Response}function v3e(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 w_;function x3e(e){if(w_)return w_;async function t(){Bo=await u3e(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),p3e(s)?s=await s.instantiator(n):g3e(s)?s=await s.default(n):(b3e(s)&&(s=s.data),y3e(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await w3e(s)(n):s=await k3e(s)(n):v3e(s)?s=await d8(s)(n):s instanceof WebAssembly.Module?s=await d8(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await d8(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return w_=t(),w_}function d8(e){return t=>WebAssembly.instantiate(e,t)}function w3e(e){return t=>WebAssembly.instantiateStreaming(e,t)}function k3e(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let _3e;function S3e(){return _3e}async function MJ(e){return e&&await x3e(e),{createScanner(t){return new m3e(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Rw(t)}}}function C3e(e){return yI(e)}function yI(e){return Array.isArray(e)?T3e(e):e instanceof RegExp?e:typeof e=="object"?E3e(e):e}function T3e(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=yI(e[n]);return t}function E3e(e){let t={};for(let n in e)t[n]=yI(e[n]);return t}function IJ(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function RJ(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?RJ(e.substring(0,e.length-1)):e.substr(~t+1)}var h8=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,k_=class{static hasCaptures(e){return e===null?!1:(h8.lastIndex=0,h8.test(e))}static replaceCaptures(e,t,n){return e.replace(h8,(s,r,i,o)=>{let a=n[parseInt(r||i,10)];if(a){let c=t.substring(a.start,a.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 s})}};function DJ(e,t){return e<t?-1:e>t?1:0}function LJ(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let r=0;r<n;r++){let i=DJ(e[r],t[r]);if(i!==0)return i}return 0}return n-s}function uz(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 PJ(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var OJ=class{constructor(e){Pe(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}},x4=class{constructor(e,t,n){Pe(this,"_cachedMatchRoot",new OJ(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(N3e(e),t)}static createFromParsedTheme(e,t){return I3e(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,s=this._cachedMatchRoot.get(t).find(r=>A3e(e.parent,r.parentScopes));return s?new $J(s.fontStyle,s.foreground,s.background):null}},f8=class X2{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new X2(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new X2(n,t[s]);return n}push(t){return new X2(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 s=this;for(;s&&s!==t;)n.push(s.scopeName),s=s.parent;return s===t?n.reverse():void 0}};function A3e(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let s=t[n],r=!1;if(s===">"){if(n===t.length-1)return!1;s=t[++n],r=!0}for(;e&&!j3e(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function j3e(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var $J=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function N3e(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let m=0,p=h.length;m<p;m++)switch(h[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"&&uz(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&uz(o.settings.background)&&(d=o.settings.background);for(let h=0,m=a.length;h<m;h++){let g=a[h].trim().split(" "),b=g[g.length-1],x=null;g.length>1&&(x=g.slice(0,g.length-1),x.reverse()),n[s++]=new M3e(b,x,r,c,u,d)}}return n}var M3e=class{constructor(e,t,n,s,r,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},fh=(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))(fh||{});function I3e(e,t){e.sort((c,u)=>{let d=DJ(c.scope,u.scope);return d!==0||(d=LJ(c.parentScopes,u.parentScopes),d!==0)?d:c.index-u.index});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(s=c.foreground),c.background!==null&&(r=c.background)}let i=new R3e(t),o=new $J(n,i.getId(s),i.getId(r)),a=new L3e(new nj(0,null,-1,0,0),[]);for(let c=0,u=e.length;c<u;c++){let d=e[c];a.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new x4(i,o,a)}var R3e=class{constructor(e){Pe(this,"_isFrozen");Pe(this,"_lastColorId");Pe(this,"_id2color");Pe(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)}},D3e=Object.freeze([]),nj=class BJ{constructor(t,n,s,r,i){Pe(this,"scopeDepth");Pe(this,"parentScopes");Pe(this,"fontStyle");Pe(this,"foreground");Pe(this,"background");this.scopeDepth=t,this.parentScopes=n||D3e,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new BJ(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let s=0,r=t.length;s<r;s++)n[s]=t[s].clone();return n}acceptOverwrite(t,n,s,r){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},L3e=class sj{constructor(t,n=[],s={}){Pe(this,"_rulesWithParentScopes");this._mainRule=t,this._children=s,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let s=0,r=0;for(;t.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=t.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-t.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let s=t.indexOf("."),r,i;if(s===-1?(r=t,i=""):(r=t.substring(0,s),i=t.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(sj._cmpBySpecificity),n}insert(t,n,s,r,i,o){if(n===""){this._doInsertHere(t,s,r,i,o);return}let a=n.indexOf("."),c,u;a===-1?(c=n,u=""):(c=n.substring(0,a),u=n.substring(a+1));let d;this._children.hasOwnProperty(c)?d=this._children[c]:(d=new sj(this._mainRule.clone(),nj.cloneArr(this._rulesWithParentScopes)),this._children[c]=d),d.insert(t+1,u,s,r,i,o)}_doInsertHere(t,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(t,s,r,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let c=this._rulesWithParentScopes[o];if(LJ(c.parentScopes,n)===0){c.acceptOverwrite(t,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new nj(t,n,s,r,i))}},ob=class vc{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=vc.getLanguageId(t),s=vc.getTokenType(t),r=vc.getFontStyle(t),i=vc.getForeground(t),o=vc.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:r,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,s,r,i,o,a){let c=vc.getLanguageId(t),u=vc.getTokenType(t),d=vc.containsBalancedBrackets(t)?1:0,h=vc.getFontStyle(t),m=vc.getForeground(t),p=vc.getBackground(t);return n!==0&&(c=n),s!==8&&(u=s),r!==null&&(d=r?1:0),i!==-1&&(h=i),o!==0&&(m=o),a!==0&&(p=a),(c<<0|u<<8|d<<10|h<<11|m<<15|p<<24)>>>0}};function w4(e,t){const n=[],s=P3e(e);let r=s.next();for(;r!==null;){let c=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let u=o();if(n.push({matcher:u,priority:c}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const c=i();return u=>!!c&&!c(u)}if(r==="("){r=s.next();const c=a();return r===")"&&(r=s.next()),c}if(dz(r)){const c=[];do c.push(r),r=s.next();while(dz(r));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(h=>h(d))}function a(){const c=[];let u=o();for(;u&&(c.push(u),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");u=o()}return d=>c.some(h=>h(d))}}function dz(e){return!!e&&!!e.match(/[\w\.:]+/)}function P3e(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}function zJ(e){typeof e.dispose=="function"&&e.dispose()}var Mx=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},O3e=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},$3e=class{constructor(){Pe(this,"_references",[]);Pe(this,"_seenReferenceKeys",new Set);Pe(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))}},B3e=class{constructor(e,t){Pe(this,"seenFullScopeRequests",new Set);Pe(this,"seenPartialScopeRequests",new Set);Pe(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Mx(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new $3e;for(const n of e)z3e(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Mx){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 z3e(e,t,n,s){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof Mx?Q2({baseGrammar:i,selfGrammar:r},s):rj(e.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(e.scopeName);if(o)for(const a of o)s.add(new Mx(a))}function rj(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];k4([s],t,n)}}function Q2(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&k4(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&k4(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function k4(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?IJ({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&k4(s.patterns,{...t,repository:r},n);const i=s.include;if(!i)continue;const o=FJ(i);switch(o.kind){case 0:Q2({...t,selfGrammar:t.baseGrammar},n);break;case 1:Q2(t,n);break;case 2:rj(o.ruleName,{...t,repository:r},n);break;case 3:case 4:const a=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const c={baseGrammar:t.baseGrammar,selfGrammar:a,repository:r};o.kind===4?rj(o.ruleName,c,n):Q2(c,n)}else o.kind===4?n.add(new O3e(o.scopeName,o.ruleName)):n.add(new Mx(o.scopeName));break}}}var F3e=class{constructor(){Pe(this,"kind",0)}},H3e=class{constructor(){Pe(this,"kind",1)}},q3e=class{constructor(e){Pe(this,"kind",2);this.ruleName=e}},U3e=class{constructor(e){Pe(this,"kind",3);this.scopeName=e}},W3e=class{constructor(e,t){Pe(this,"kind",4);this.scopeName=e,this.ruleName=t}};function FJ(e){if(e==="$base")return new F3e;if(e==="$self")return new H3e;const t=e.indexOf("#");if(t===-1)return new U3e(e);if(t===0)return new q3e(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new W3e(n,s)}}var V3e=/\\(\d+)/,hz=/\\(\d+)/g,G3e=-1,HJ=-2;var Dw=class{constructor(t,n,s,r){Pe(this,"$location");Pe(this,"id");Pe(this,"_nameIsCapturing");Pe(this,"_name");Pe(this,"_contentNameIsCapturing");Pe(this,"_contentName");this.$location=t,this.id=n,this._name=s||null,this._nameIsCapturing=k_.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=k_.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${RJ(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:k_.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:k_.replaceCaptures(this._contentName,t,n)}},K3e=class extends Dw{constructor(t,n,s,r,i){super(t,n,s,r);Pe(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,s,r){throw new Error("Not supported!")}},Y3e=class extends Dw{constructor(t,n,s,r,i){super(t,n,s,null);Pe(this,"_match");Pe(this,"captures");Pe(this,"_cachedCompiledPatterns");this._match=new Ix(r,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,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Rx,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},fz=class extends Dw{constructor(t,n,s,r,i){super(t,n,s,r);Pe(this,"hasMissingPatterns");Pe(this,"patterns");Pe(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 s of this.patterns)t.getRule(s).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Rx,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ij=class extends Dw{constructor(t,n,s,r,i,o,a,c,u,d){super(t,n,s,r);Pe(this,"_begin");Pe(this,"beginCaptures");Pe(this,"_end");Pe(this,"endHasBackReferences");Pe(this,"endCaptures");Pe(this,"applyEndPatternLast");Pe(this,"hasMissingPatterns");Pe(this,"patterns");Pe(this,"_cachedCompiledPatterns");this._begin=new Ix(i,this.id),this.beginCaptures=o,this._end=new Ix(a||"",-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,s,r){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,r)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Rx;for(const s of this.patterns)t.getRule(s).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}},_4=class extends Dw{constructor(t,n,s,r,i,o,a,c,u){super(t,n,s,r);Pe(this,"_begin");Pe(this,"beginCaptures");Pe(this,"whileCaptures");Pe(this,"_while");Pe(this,"whileHasBackReferences");Pe(this,"hasMissingPatterns");Pe(this,"patterns");Pe(this,"_cachedCompiledPatterns");Pe(this,"_cachedCompiledWhilePatterns");this._begin=new Ix(i,this.id),this.beginCaptures=o,this.whileCaptures=c,this._while=new Ix(a,HJ),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,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Rx;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,s,r){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,r)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Rx,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},qJ=class ma{static createCaptureRule(t,n,s,r,i){return t.registerRule(o=>new K3e(n,o,s,r,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new Y3e(t.$vscodeTextmateLocation,t.id,t.name,t.match,ma._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=IJ({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new fz(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,ma._compilePatterns(i,n,s))}return t.while?new _4(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ma._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,ma._compileCaptures(t.whileCaptures||t.captures,n,s),ma._compilePatterns(t.patterns,n,s)):new ij(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ma._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,ma._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,ma._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let r=[];if(t){let i=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)r[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let c=0;t[o].patterns&&(c=ma.getCompiledRuleId(t[o],n,s)),r[a]=ma.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}return r}static _compilePatterns(t,n,s){let r=[];if(t)for(let i=0,o=t.length;i<o;i++){const a=t[i];let c=-1;if(a.include){const u=FJ(a.include);switch(u.kind){case 0:case 1:c=ma.getCompiledRuleId(s[a.include],n,s);break;case 2:let d=s[u.ruleName];d&&(c=ma.getCompiledRuleId(d,n,s));break;case 3:case 4:const h=u.scopeName,m=u.kind===4?u.ruleName:null,p=n.getExternalGrammar(h,s);if(p)if(m){let g=p.repository[m];g&&(c=ma.getCompiledRuleId(g,n,p.repository))}else c=ma.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=ma.getCompiledRuleId(a,n,s);if(c!==-1){const u=n.getRule(c);let d=!1;if((u instanceof fz||u instanceof ij||u instanceof _4)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},Ix=class UJ{constructor(t,n){Pe(this,"source");Pe(this,"ruleId");Pe(this,"hasAnchor");Pe(this,"hasBackReferences");Pe(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let r=0,i=[],o=!1;for(let a=0;a<s;a++)if(t.charAt(a)==="\\"&&a+1<s){const u=t.charAt(a+1);u==="z"?(i.push(t.substring(r,a)),i.push("$(?!\\n)(?<!\\n)"),r=a+2):(u==="A"||u==="G")&&(o=!0),a++}this.hasAnchor=o,r===0?this.source=t:(i.push(t.substring(r,s)),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=V3e.test(this.source):this.hasBackReferences=!1}clone(){return new UJ(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 s=n.map(r=>t.substring(r.start,r.end));return hz.lastIndex=0,this.source.replace(hz,(r,i)=>PJ(s[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=[],s=[],r=[],i,o,a,c;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),t[i]=a,n[i]=a,s[i]=a,r[i]=a,a==="\\"&&i+1<o&&(c=this.source.charAt(i+1),c==="A"?(t[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):c==="G"?(t[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(t[i+1]=c,n[i+1]=c,s[i+1]=c,r[i+1]=c),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.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}},Rx=class{constructor(){Pe(this,"_items");Pe(this,"_hasAnchors");Pe(this,"_cached");Pe(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 mz(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 s=this._items.map(r=>r.resolveAnchors(t,n));return new mz(e,s,this._items.map(r=>r.ruleId))}},mz=class{constructor(e,t,n){Pe(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 s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},m8=class{constructor(e,t){this.languageId=e,this.tokenType=t}},lh,X3e=(lh=class{constructor(t,n){Pe(this,"_defaultAttributes");Pe(this,"_embeddedLanguagesMatcher");Pe(this,"_getBasicScopeAttributes",new OJ(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new m8(n,s)}));this._defaultAttributes=new m8(t,8),this._embeddedLanguagesMatcher=new Q3e(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?lh._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(lh.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!")}},Pe(lh,"_NULL_SCOPE_METADATA",new m8(0,0)),Pe(lh,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),lh),Q3e=class{constructor(e){Pe(this,"values");Pe(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>PJ(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])}},pz=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function WJ(e,t,n,s,r,i,o,a){const c=t.content.length;let u=!1,d=-1;if(o){const p=J3e(e,t,n,s,r,i);r=p.stack,s=p.linePos,n=p.isFirstLine,d=p.anchorPosition}const h=Date.now();for(;!u;){if(a!==0&&Date.now()-h>a)return new pz(r,!0);m()}return new pz(r,!1);function m(){const p=Z3e(e,t,n,s,r,d);if(!p){i.produce(r,c),u=!0;return}const g=p.captureIndices,b=p.matchedRuleId,x=g&&g.length>0?g[0].end>s:!1;if(b===G3e){const y=r.getRule(e);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),pv(e,t,n,r,i,y.endCaptures,g),i.produce(r,g[0].end);const v=r;if(r=r.parent,d=v.getAnchorPos(),!x&&v.getEnterPos()===s){r=v,i.produce(r,c),u=!0;return}}else{const y=e.getRule(b);i.produce(r,g[0].start);const v=r,w=y.getName(t.content,g),k=r.contentNameScopesList.pushAttributed(w,e);if(r=r.push(b,s,d,g[0].end===c,null,k,k),y instanceof ij){const T=y;pv(e,t,n,r,i,T.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const C=T.getContentName(t.content,g),_=k.pushAttributed(C,e);if(r=r.withContentNameScopesList(_),T.endHasBackReferences&&(r=r.withEndRule(T.getEndWithResolvedBackReferences(t.content,g))),!x&&v.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(y instanceof _4){const T=y;pv(e,t,n,r,i,T.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const C=T.getContentName(t.content,g),_=k.pushAttributed(C,e);if(r=r.withContentNameScopesList(_),T.whileHasBackReferences&&(r=r.withEndRule(T.getWhileWithResolvedBackReferences(t.content,g))),!x&&v.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(pv(e,t,n,r,i,y.captures,g),i.produce(r,g[0].end),r=r.pop(),!x){r=r.safePop(),i.produce(r,c),u=!0;return}}g[0].end>s&&(s=g[0].end,n=!1)}}function J3e(e,t,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const a=[];for(let c=r;c;c=c.pop()){const u=c.getRule(e);u instanceof _4&&a.push({rule:u,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:u,findOptions:d}=nCe(c.rule,e,c.stack.endRule,n,s===o),h=u.findNextMatchSync(t,s,d);if(h){if(h.ruleId!==HJ){r=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(c.stack,h.captureIndices[0].start),pv(e,t,n,c.stack,i,c.rule.whileCaptures,h.captureIndices),i.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=c.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function Z3e(e,t,n,s,r,i){const o=eCe(e,t,n,s,r,i),a=e.getInjections();if(a.length===0)return o;const c=tCe(a,e,t,n,s,r,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 eCe(e,t,n,s,r,i){const o=r.getRule(e),{ruleScanner:a,findOptions:c}=VJ(o,e,r.endRule,n,s===i),u=a.findNextMatchSync(t,s,c);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function tCe(e,t,n,s,r,i,o){let a=Number.MAX_VALUE,c=null,u,d=0;const h=i.contentNameScopesList.getScopeNames();for(let m=0,p=e.length;m<p;m++){const g=e[m];if(!g.matcher(h))continue;const b=t.getRule(g.ruleId),{ruleScanner:x,findOptions:y}=VJ(b,t,null,s,r===o),v=x.findNextMatchSync(n,r,y);if(!v)continue;const w=v.captureIndices[0].start;if(!(w>=a)&&(a=w,c=v.captureIndices,u=v.ruleId,d=g.priority,a===r))break}return c?{priorityMatch:d===-1,captureIndices:c,matchedRuleId:u}:null}function VJ(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function nCe(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function pv(e,t,n,s,r,i,o){if(i.length===0)return;const a=t.content,c=Math.min(i.length,o.length),u=[],d=o[0].end;for(let h=0;h<c;h++){const m=i[h];if(m===null)continue;const p=o[h];if(p.length===0)continue;if(p.start>d)break;for(;u.length>0&&u[u.length-1].endPos<=p.start;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?r.produceFromScopes(u[u.length-1].scopes,p.start):r.produce(s,p.start),m.retokenizeCapturedWithRuleId){const b=m.getName(a,o),x=s.contentNameScopesList.pushAttributed(b,e),y=m.getContentName(a,o),v=x.pushAttributed(y,e),w=s.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,x,v),k=e.createOnigString(a.substring(0,p.end));WJ(e,k,n&&p.start===0,p.start,w,r,!1,0),zJ(k);continue}const g=m.getName(a,o);if(g!==null){const x=(u.length>0?u[u.length-1].scopes:s.contentNameScopesList).pushAttributed(g,e);u.push(new sCe(x,p.end))}}for(;u.length>0;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var sCe=class{constructor(e,t){Pe(this,"scopes");Pe(this,"endPos");this.scopes=e,this.endPos=t}};function rCe(e,t,n,s,r,i,o,a){return new oCe(e,t,n,s,r,i,o,a)}function gz(e,t,n,s,r){const i=w4(t,S4),o=qJ.getCompiledRuleId(n,s,r.repository);for(const a of i)e.push({debugSelector:t,matcher:a.matcher,ruleId:o,grammar:r,priority:a.priority})}function S4(e,t){if(t.length<e.length)return!1;let n=0;return e.every(s=>{for(let r=n;r<t.length;r++)if(iCe(t[r],s))return n=r+1,!0;return!1})}function iCe(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 oCe=class{constructor(e,t,n,s,r,i,o,a){Pe(this,"_rootId");Pe(this,"_lastRuleId");Pe(this,"_ruleId2desc");Pe(this,"_includedGrammars");Pe(this,"_grammarRepository");Pe(this,"_grammar");Pe(this,"_injections");Pe(this,"_basicScopeAttributesProvider");Pe(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new X3e(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=bz(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const c of Object.keys(r)){const u=w4(c,S4);for(const d of u)this._tokenTypeMatchers.push({matcher:d.matcher,type:r[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:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},t=[],n=this._rootScopeName,s=e.lookup(n);if(s){const r=s.injections;if(r)for(let o in r)gz(t,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const c=a.injectionSelector;c&&gz(t,c,a,this,a)}})}return t.sort((r,i)=>r.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]=bz(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){this._rootId===-1&&(this._rootId=qJ.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!t||t===oj.NULL){r=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),h=ob.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=Qv.createRootAndLookUpScopeName(m,h,this):p=Qv.createRoot("unknown",h),t=new oj(null,this._rootId,-1,-1,!1,null,p,p)}else r=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new lCe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=WJ(this,i,r,0,t,a,!0,s);return zJ(i),{lineLength:o,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function bz(e,t){return e=C3e(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 Qv=class Bu{constructor(t,n,s){this.parent=t,this.scopePath=n,this.tokenAttributes=s}static fromExtension(t,n){let s=t,r=(t==null?void 0:t.scopePath)??null;for(const i of n)r=f8.push(r,i.scopeNames),s=new Bu(s,r,i.encodedTokenAttributes);return s}static createRoot(t,n){return new Bu(null,new f8(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),i=new f8(null,t),o=s.themeProvider.themeMatch(i),a=Bu.mergeAttributes(n,r,o);return new Bu(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Bu.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,s){let r=-1,i=0,o=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,o=s.backgroundId),ob.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Bu._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const i of s)r=Bu._pushAttributed(r,i,n);return r}static _pushAttributed(t,n,s){const r=s.getMetadataForScope(n),i=t.scopePath.push(n),o=s.themeProvider.themeMatch(i),a=Bu.mergeAttributes(t.tokenAttributes,r,o);return new Bu(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var r;const n=[];let s=this;for(;s&&s!==t;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(((r=s.parent)==null?void 0:r.scopePath)??null)}),s=s.parent;return s===t?n.reverse():void 0}},Ac,oj=(Ac=class{constructor(t,n,s,r,i,o,a,c){Pe(this,"_stackElementBrand");Pe(this,"_enterPos");Pe(this,"_anchorPos");Pe(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}equals(t){return t===null?!1:Ac._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Qv.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(){Ac._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,i,o,a){return new Ac(this,t,n,s,r,i,o,a)}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 s,r;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(s=this.nameScopesList)==null?void 0:s.toString()}, ${(r=this.contentNameScopesList)==null?void 0:r.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 Ac(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,s;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:((s=this.contentNameScopesList)==null?void 0:s.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const s=Qv.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new Ac(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,Qv.fromExtension(s,n.contentNameScopesList))}},Pe(Ac,"NULL",new Ac(null,0,0,0,!1,null,null,null)),Ac),aCe=class{constructor(e,t){Pe(this,"balancedBracketScopes");Pe(this,"unbalancedBracketScopes");Pe(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):w4(n,S4).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>w4(n,S4).map(s=>s.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}},lCe=class{constructor(e,t,n,s){Pe(this,"_emitBinaryTokens");Pe(this,"_lineText");Pe(this,"_tokens");Pe(this,"_binaryTokens");Pe(this,"_lastTokenEndIndex");Pe(this,"_tokenTypeOverrides");this.balancedBracketSelectors=s,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 s;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((s=this.balancedBracketSelectors)!=null&&s.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 a of this._tokenTypeOverrides)a.matcher(o)&&(r=ob.set(r,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=ob.set(r,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),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 s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},cCe=class{constructor(e,t){Pe(this,"_grammars",new Map);Pe(this,"_rawGrammars",new Map);Pe(this,"_injectionGrammars",new Map);Pe(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,s,r){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,rCe(e,i,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},uCe=class{constructor(t){Pe(this,"_options");Pe(this,"_syncRegistry");Pe(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new cCe(x4.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(x4.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new aCe(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,r,i){const o=new B3e(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,s,r,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 s=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,r=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,r)}_grammarForScopeName(t,n=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,s,r,i)}},aj=oj.NULL;const dCe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],hCe=/["&'<>`]/g,fCe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,mCe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,pCe=/[|\\{}()[\]^$+*?.]/g,yz=new WeakMap;function gCe(e,t){if(e=e.replace(t.subset?bCe(t.subset):hCe,s),t.subset||t.escapeOnly)return e;return e.replace(fCe,n).replace(mCe,s);function n(r,i,o){return t.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function s(r,i,o){return t.format(r.charCodeAt(0),o.charCodeAt(i+1),t)}}function bCe(e){let t=yz.get(e);return t||(t=yCe(e),yz.set(e,t)),t}function yCe(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(pCe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const vCe=/[\dA-Fa-f]/;function xCe(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!vCe.test(String.fromCharCode(t))?s:s+";"}const wCe=/\d/;function kCe(e,t,n){const s="&#"+String(e);return n&&t&&!wCe.test(String.fromCharCode(t))?s:s+";"}const _Ce=["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"],p8={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:"€"},SCe=["cent","copy","divide","gt","lt","not","para","times"],GJ={}.hasOwnProperty,lj={};let __;for(__ in p8)GJ.call(p8,__)&&(lj[p8[__]]=__);const CCe=/[^\dA-Za-z]/;function TCe(e,t,n,s){const r=String.fromCharCode(e);if(GJ.call(lj,r)){const i=lj[r],o="&"+i;return n&&_Ce.includes(i)&&!SCe.includes(i)&&(!s||t&&t!==61&&CCe.test(String.fromCharCode(t)))?o:o+";"}return""}function ECe(e,t,n){let s=xCe(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=TCe(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=kCe(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function I1(e,t){return gCe(e,Object.assign({format:ECe},t))}const ACe=/^>|^->|<!--|-->|--!>|<!-$/g,jCe=[">"],NCe=["<",">"];function MCe(e,t,n,s){return s.settings.bogusComments?"<?"+I1(e.value,Object.assign({},s.settings.characterReferences,{subset:jCe}))+">":"<!--"+e.value.replace(ACe,r)+"-->";function r(i){return I1(i,Object.assign({},s.settings.characterReferences,{subset:NCe}))}}function ICe(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const No=YJ(1),KJ=YJ(-1),RCe=[];function YJ(e){return t;function t(n,s,r){const i=n?n.children:RCe;let o=(s||0)+e,a=i[o];if(!r)for(;a&&hC(a);)o+=e,a=i[o];return a}}const DCe={}.hasOwnProperty;function XJ(e){return t;function t(n,s,r){return DCe.call(e,n.tagName)&&e[n.tagName](n,s,r)}}const vI=XJ({body:PCe,caption:g8,colgroup:g8,dd:zCe,dt:BCe,head:g8,html:LCe,li:$Ce,optgroup:FCe,option:HCe,p:OCe,rp:vz,rt:vz,tbody:UCe,td:xz,tfoot:WCe,th:xz,thead:qCe,tr:VCe});function g8(e,t,n){const s=No(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&hC(s.value.charAt(0)))}function LCe(e,t,n){const s=No(n,t);return!s||s.type!=="comment"}function PCe(e,t,n){const s=No(n,t);return!s||s.type!=="comment"}function OCe(e,t,n){const s=No(n,t);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.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 $Ce(e,t,n){const s=No(n,t);return!s||s.type==="element"&&s.tagName==="li"}function BCe(e,t,n){const s=No(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function zCe(e,t,n){const s=No(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function vz(e,t,n){const s=No(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function FCe(e,t,n){const s=No(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function HCe(e,t,n){const s=No(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function qCe(e,t,n){const s=No(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function UCe(e,t,n){const s=No(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function WCe(e,t,n){return!No(n,t)}function VCe(e,t,n){const s=No(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function xz(e,t,n){const s=No(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const GCe=XJ({body:XCe,colgroup:QCe,head:YCe,html:KCe,tbody:JCe});function KCe(e){const t=No(e,-1);return!t||t.type!=="comment"}function YCe(e){const t=new Set;for(const s of e.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(t.has(s.tagName))return!1;t.add(s.tagName)}const n=e.children[0];return!n||n.type==="element"}function XCe(e){const t=No(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&hC(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function QCe(e,t,n){const s=KJ(n,t),r=No(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&vI(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function JCe(e,t,n){const s=KJ(n,t),r=No(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&vI(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const S_={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 ZCe(e,t,n,s){const r=s.schema,i=r.space==="svg"?!1:s.settings.omitOptionalTags;let o=r.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const a=[];let c;r.space==="html"&&e.tagName==="svg"&&(s.schema=Ob);const u=eTe(s,e.properties),d=s.all(r.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=r,d&&(o=!1),(u||!i||!GCe(e,t,n))&&(a.push("<",e.tagName,u?" "+u:""),o&&(r.space==="svg"||s.settings.closeSelfClosing)&&(c=u.charAt(u.length-1),(!s.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(d),!o&&(!i||!vI(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function eTe(e,t){const n=[];let s=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const i=tTe(e,r,t[r]);i&&n.push(i)}}for(;++s<n.length;){const i=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&i!=='"'&&i!=="'"&&(n[s]+=" ")}return n.join("")}function tTe(e,t,n){const s=D9(e.schema,t),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,a;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const c=I1(s.attribute,Object.assign({},e.settings.characterReferences,{subset:S_.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?dX:vX)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(a=I1(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:S_.unquoted[r][i]}))),a!==n&&(e.settings.quoteSmart&&h4(n,o)>h4(n,e.alternative)&&(o=e.alternative),a=o+I1(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?S_.single:S_.double)[r][i],attribute:!0}))+o),c+(a&&"="+a))}const nTe=["<","&"];function QJ(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:I1(e.value,Object.assign({},s.settings.characterReferences,{subset:nTe}))}function sTe(e,t,n,s){return s.settings.allowDangerousHtml?e.value:QJ(e,t,n,s)}function rTe(e,t,n,s){return s.all(e)}const iTe=e_e("type",{invalid:oTe,unknown:aTe,handlers:{comment:MCe,doctype:ICe,element:ZCe,raw:sTe,root:rTe,text:QJ}});function oTe(e){throw new Error("Expected node, not `"+e+"`")}function aTe(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const lTe={},cTe={},uTe=[];function dTe(e,t){const n=lTe,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:hTe,all:fTe,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||dCe,characterReferences:n.characterReferences||cTe,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Ob:L9,quote:s,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function hTe(e,t,n){return iTe(e,t,n,this)}function fTe(e){const t=[],n=e&&e.children||uTe;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function mTe(e){return Array.isArray(e)?e:[e]}function IC(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let s=0;const r=[];for(let o=0;o<n.length;o+=2){const a=t?n[o]+(n[o+1]||""):n[o];r.push([a,s]),s+=n[o].length,s+=((i=n[o+1])==null?void 0:i.length)||0}return r}function xI(e){return!e||["plaintext","txt","text","plain"].includes(e)}function JJ(e){return e==="ansi"||xI(e)}function wI(e){return e==="none"}function ZJ(e){return wI(e)}function eZ(e,t){var s;if(!t)return e;e.properties||(e.properties={}),(s=e.properties).class||(s.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 r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function pTe(e,t){let n=0;const s=[];for(const r of t)r>n&&s.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function gTe(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((s,r)=>s-r);return n.length?e.map(s=>s.flatMap(r=>{const i=n.filter(o=>r.offset<o&&o<r.offset+r.content.length).map(o=>o-r.offset).sort((o,a)=>o-a);return i.length?pTe(r,i):r})):e}async function tZ(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function C4(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},s=typeof e=="string"?e:e.name;for(const[r,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[r]=i:r===s&&Object.assign(n,i);return n}function Gp(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function nZ(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&fh.Italic&&(t["font-style"]="italic"),e.fontStyle&fh.Bold&&(t["font-weight"]="bold"),e.fontStyle&fh.Underline&&(t["text-decoration"]="underline")),t}function bTe(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function yTe(e){const t=IC(e,!0).map(([r])=>r);function n(r){if(r===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=r,o=0;for(const a of t){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function s(r,i){let o=0;for(let a=0;a<r;a++)o+=t[a].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:s}}class $a extends Error{constructor(t){super(t),this.name="ShikiError"}}const sZ=new WeakMap;function RC(e,t){sZ.set(e,t)}function Dx(e){return sZ.get(e)}class qb{constructor(...t){Pe(this,"_stacks",{});Pe(this,"lang");if(t.length===2){const[n,s]=t;this.lang=s,this._stacks=n}else{const[n,s,r]=t;this.lang=s,this._stacks={[r]: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 qb(Object.fromEntries(mTe(n).map(s=>[s,aj])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return wz(this._stacks[this.theme])}getScopes(t=this.theme){return wz(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function wz(e){const t=[],n=new Set;function s(r){var o;if(n.has(r))return;n.add(r);const i=(o=r==null?void 0:r.nameScopesList)==null?void 0:o.scopeName;i&&t.push(i),r.parent&&s(r.parent)}return s(e),t}function vTe(e,t){if(!(e instanceof qb))throw new $a("Invalid grammar state");return e.getInternalStack(t)}function xTe(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let s=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new $a(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...r.indexToPos(o),offset:o}}else{const a=r.lines[o.line];if(a===void 0)throw new $a(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);if(o.character<0||o.character>a.length)throw new $a(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:r.posToIndex(o.line,o.character)}}};const r=yTe(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));wTe(i),e.set(n.meta,{decorations:i,converter:r,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 r=t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return gTe(n,r)},code(n){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const s=t(this),r=Array.from(n.children).filter(h=>h.type==="element"&&h.tagName==="span");if(r.length!==s.converter.lines.length)throw new $a(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function i(h,m,p,g){const b=r[h];let x="",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++)x+=rZ(b.children[k]),y===-1&&x.length===m&&(y=k+1),v===-1&&x.length===p&&(v=k+1);if(y===-1)throw new $a(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(v===-1)throw new $a(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const w=b.children.slice(y,v);if(!g.alwaysWrap&&w.length===b.children.length)a(b,g,"line");else if(!g.alwaysWrap&&w.length===1&&w[0].type==="element")a(w[0],g,"token");else{const k={type:"element",tagName:"span",properties:{},children:w};a(k,g,"wrapper"),b.children.splice(y,w.length,k)}}function o(h,m){r[h]=a(r[h],m,"line")}function a(h,m,p){var x;const g=m.properties||{},b=m.transform||(y=>y);return h.tagName=m.tagName||"span",h.properties={...h.properties,...g,class:h.properties.class},(x=m.properties)!=null&&x.class&&eZ(h,m.properties.class),h=b(h,p)||h,h}const c=[],u=s.decorations.sort((h,m)=>m.start.offset-h.start.offset);for(const h of u){const{start:m,end:p}=h;if(m.line===p.line)i(m.line,m.character,p.character,h);else if(m.line<p.line){i(m.line,m.character,Number.POSITIVE_INFINITY,h);for(let g=m.line+1;g<p.line;g++)c.unshift(()=>o(g,h));i(p.line,0,p.character,h)}}c.forEach(h=>h())}}}function wTe(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new $a(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const r=e[s],i=n.start.offset<r.start.offset&&r.start.offset<n.end.offset,o=n.start.offset<r.end.offset&&r.end.offset<n.end.offset,a=r.start.offset<n.start.offset&&n.start.offset<r.end.offset,c=r.start.offset<n.end.offset&&n.end.offset<r.end.offset;if(i||o||a||c){if(o&&o||a&&c)continue;throw new $a(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function rZ(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(rZ).join(""):""}const kTe=[xTe()];function T4(e){return[...e.transformers||[],...kTe]}var Kp=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],b8={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function _Te(e,t){const n=e.indexOf("\x1B[",t);if(n!==-1){const s=e.indexOf("m",n);return{sequence:e.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:e.length}}function kz(e,t){let n=1;const s=e[t+n++];let r;if(s==="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))&&(r={type:"rgb",rgb:i})}else if(s==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(r={type:"table",index:Number(i)})}return[n,r]}function STe(e){const t=[];for(let n=0;n<e.length;n++){const s=e[n],r=Number.parseInt(s);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)b8[r]&&t.push({type:"setDecoration",value:b8[r]});else if(r<=29){const i=b8[r-20];i&&t.push({type:"resetDecoration",value:i})}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Kp[r-30]}});else if(r===38){const[i,o]=kz(e,n);o&&t.push({type:"setForegroundColor",value:o}),n+=i}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Kp[r-40]}});else if(r===48){const[i,o]=kz(e,n);o&&t.push({type:"setBackgroundColor",value:o}),n+=i}else r===49?t.push({type:"resetBackgroundColor"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Kp[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Kp[r-100+8]}})}return t}function CTe(){let e=null,t=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=_Te(s,i),a=o.sequence?s.substring(i,o.startPosition):s.substring(i);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const c=STe(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<s.length);return r}}}var TTe={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 ETe(e=TTe){function t(a){return e[a]}function n(a){return`#${a.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(){if(s)return s;s=[];for(let u=0;u<Kp.length;u++)s.push(t(Kp[u]));let a=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let d=0;d<6;d++)for(let h=0;h<6;h++)s.push(n([a[u],a[d],a[h]]));let c=8;for(let u=0;u<24;u++,c+=10)s.push(n([c,c,c]));return s}function i(a){return r()[a]}function o(a){switch(a.type){case"named":return t(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}function ATe(e,t,n){const s=C4(e,n),r=IC(t),i=ETe(Object.fromEntries(Kp.map(a=>{var c;return[a,(c=e.colors)==null?void 0:c[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=CTe();return r.map(a=>o.parse(a[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=Gp(u,s),d=Gp(d,s),c.decorations.has("dim")&&(u=jTe(u));let h=fh.None;return c.decorations.has("bold")&&(h|=fh.Bold),c.decorations.has("italic")&&(h|=fh.Italic),c.decorations.has("underline")&&(h|=fh.Underline),{content:c.value,offset:a[1],color:u,bgColor:d,fontStyle:h}}))}function jTe(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t)if(t[3]){const s=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${s}`}else return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(s=>`${s}${s}`).join("")}80`;const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function kI(e,t,n={}){const{lang:s="text",theme:r=e.getLoadedThemes()[0]}=n;if(xI(s)||wI(r))return IC(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(s==="ansi")return ATe(i,t,n);const a=e.getLanguage(s);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new _h(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new _h(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return MTe(t,a,i,o,n)}function NTe(...e){if(e.length===2)return Dx(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(xI(r)||wI(i))throw new _h("Plain language does not have grammar state");if(r==="ansi")throw new _h("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),c=t.getLanguage(r);return new qb(E4(n,c,o,a,s).stateStack,c.name,o.name)}function MTe(e,t,n,s,r){const i=E4(e,t,n,s,r),o=new qb(E4(e,t,n,s,r).stateStack,t.name,n.name);return RC(i.tokens,o),i.tokens}function E4(e,t,n,s,r){const i=C4(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=r,c=IC(e);let u=r.grammarState?vTe(r.grammarState,n.name)??aj:r.grammarContextCode!=null?E4(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:aj,d=[];const h=[];for(let m=0,p=c.length;m<p;m++){const[g,b]=c[m];if(g===""){d=[],h.push([]);continue}if(o>0&&g.length>=o){d=[],h.push([{content:g,offset:b,color:"",fontStyle:0}]);continue}let x,y,v;r.includeExplanation&&(x=t.tokenizeLine(g,u),y=x.tokens,v=0);const w=t.tokenizeLine2(g,u,a),k=w.tokens.length/2;for(let T=0;T<k;T++){const C=w.tokens[2*T],_=T+1<k?w.tokens[2*T+2]:g.length;if(C===_)continue;const S=w.tokens[2*T+1],D=Gp(s[ob.getForeground(S)],i),E=ob.getFontStyle(S),B={content:g.substring(C,_),offset:b+C,color:D,fontStyle:E};if(r.includeExplanation){const I=[];if(r.includeExplanation!=="scopeName")for(const O of n.settings){let A;switch(typeof O.scope){case"string":A=O.scope.split(/,/).map($=>$.trim());break;case"object":A=O.scope;break;default:continue}I.push({settings:O,selectors:A.map($=>$.split(/ /))})}B.explanation=[];let L=0;for(;C+L<_;){const O=y[v],A=g.substring(O.startIndex,O.endIndex);L+=A.length,B.explanation.push({content:A,scopes:r.includeExplanation==="scopeName"?ITe(O.scopes):RTe(I,O.scopes)}),v+=1}}d.push(B)}h.push(d),d=[],u=w.ruleStack}return{tokens:h,stateStack:u}}function ITe(e){return e.map(t=>({scopeName:t}))}function RTe(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const i=t[s];n[s]={scopeName:i,themeMatches:LTe(e,i,t.slice(0,s))}}return n}function _z(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function DTe(e,t,n){if(!_z(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)_z(e[s],n[r])&&(s-=1),r-=1;return s===-1}function LTe(e,t,n){const s=[];for(const{selectors:r,settings:i}of e)for(const o of r)if(DTe(o,t,n)){s.push(i);break}return s}function iZ(e,t,n){const s=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),r=s.map(c=>{const u=kI(e,t,{...n,theme:c.theme}),d=Dx(u),h=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:u,state:d,theme:h}}),i=PTe(...r.map(c=>c.tokens)),o=i[0].map((c,u)=>c.map((d,h)=>{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:x,offset:y,...v}=p[u][h];m.variants[s[g].color]=v}),m})),a=r[0].state?new qb(Object.fromEntries(r.map(c=>{var u;return[c.theme,(u=c.state)==null?void 0:u.getInternalStack(c.theme)]})),r[0].state.lang):void 0;return a&&RC(o,a),o}function PTe(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(c=>c[s]),i=t.map(()=>[]);t.forEach((c,u)=>c.push(i[u]));const o=r.map(()=>0),a=r.map(c=>c[0]);for(;a.every(c=>c);){const c=Math.min(...a.map(u=>u.content.length));for(let u=0;u<n;u++){const d=a[u];d.content.length===c?(i[u].push(d),o[u]+=1,a[u]=r[u][o[u]]):(i[u].push({...d,content:d.content.slice(0,c)}),a[u]={...d,content:d.content.slice(c),offset:d.offset+c})}}}return t}function A4(e,t,n){let s,r,i,o,a,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:d="--shiki-"}=n,h=Object.entries(n.themes).filter(x=>x[1]).map(x=>({color:x[0],theme:x[1]})).sort((x,y)=>x.color===u?-1:y.color===u?1:0);if(h.length===0)throw new _h("`themes` option must not be empty");const m=iZ(e,t,n);if(c=Dx(m),u&&!h.find(x=>x.color===u))throw new _h(`\`themes\` option must contain the defaultColor key \`${u}\``);const p=h.map(x=>e.getTheme(x.theme)),g=h.map(x=>x.color);i=m.map(x=>x.map(y=>OTe(y,g,d,u))),c&&RC(i,c);const b=h.map(x=>C4(x.theme,n));r=h.map((x,y)=>(y===0&&u?"":`${d+x.color}:`)+(Gp(p[y].fg,b[y])||"inherit")).join(";"),s=h.map((x,y)=>(y===0&&u?"":`${d+x.color}-bg:`)+(Gp(p[y].bg,b[y])||"inherit")).join(";"),o=`shiki-themes ${p.map(x=>x.name).join(" ")}`,a=u?void 0:[r,s].join(";")}else if("theme"in n){const u=C4(n.theme,n);i=kI(e,t,n);const d=e.getTheme(n.theme);s=Gp(d.bg,u),r=Gp(d.fg,u),o=d.name,c=Dx(i)}else throw new _h("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:c}}function OTe(e,t,n,s){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(c=>nZ(e.variants[c])),o=new Set(i.flatMap(c=>Object.keys(c))),a={};return i.forEach((c,u)=>{for(const d of o){const h=c[d]||"inherit";if(u===0&&s)a[d]=h;else{const m=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[u]+(d==="color"?"":m);a[p]=h}}}),r.htmlStyle=a,r}function j4(e,t,n,s={meta:{},options:n,codeToHast:(r,i)=>j4(e,r,i),codeToTokens:(r,i)=>A4(e,r,i)}){var p,g;let r=t;for(const b of T4(n))r=((p=b.preprocess)==null?void 0:p.call(s,r,n))||r;let{tokens:i,fg:o,bg:a,themeName:c,rootStyle:u,grammarState:d}=A4(e,r,n);const{mergeWhitespaces:h=!0}=n;h===!0?i=BTe(i):h==="never"&&(i=zTe(i));const m={...s,get source(){return r}};for(const b of T4(n))i=((g=b.tokens)==null?void 0:g.call(m,i))||i;return $Te(i,{...n,fg:o,bg:a,themeName:c,rootStyle:u},m,d)}function $Te(e,t,n,s=Dx(e)){var g,b,x;const r=T4(t),i=[],o={type:"root",children:[]},{structure:a="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 h=[],m={...n,structure:a,addClassToHast:eZ,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 h}};if(e.forEach((y,v)=>{var T,C;v&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let w={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const _ of y){let S={type:"element",tagName:"span",properties:{..._.htmlAttrs},children:[{type:"text",value:_.content}]};_.htmlStyle;const D=bTe(_.htmlStyle||nZ(_));D&&(S.properties.style=D);for(const E of r)S=((T=E==null?void 0:E.span)==null?void 0:T.call(m,S,v+1,k,w,_))||S;a==="inline"?o.children.push(S):a==="classic"&&w.children.push(S),k+=_.content.length}if(a==="classic"){for(const _ of r)w=((C=_==null?void 0:_.line)==null?void 0:C.call(m,w,v+1))||w;h.push(w),i.push(w)}}),a==="classic"){for(const y of r)d=((g=y==null?void 0:y.code)==null?void 0:g.call(m,d))||d;u.children.push(d);for(const y of r)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 r)p=((x=y==null?void 0:y.root)==null?void 0:x.call(m,p))||p;return s&&RC(p,s),p}function BTe(e){return e.map(t=>{const n=[];let s="",r=0;return t.forEach((i,o)=>{const c=!(i.fontStyle&&i.fontStyle&fh.Underline);c&&i.content.match(/^\s+$/)&&t[o+1]?(r||(r=i.offset),s+=i.content):s?(c?n.push({...i,offset:r,content:s+i.content}):n.push({content:s,offset:r},i),r=0,s=""):n.push(i)}),n})}function zTe(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const s=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return n;const[,r,i,o]=s;if(!r&&!o)return n;const a=[{...n,offset:n.offset+r.length,content:i}];return r&&a.unshift({content:r,offset:n.offset}),o&&a.push({content:o,offset:n.offset+r.length+i.length}),a}))}function FTe(e,t,n){var i;const s={meta:{},options:n,codeToHast:(o,a)=>j4(e,o,a),codeToTokens:(o,a)=>A4(e,o,a)};let r=dTe(j4(e,t,n,s));for(const o of T4(n))r=((i=o.postprocess)==null?void 0:i.call(s,r,n))||r;return r}const Sz={light:"#333333",dark:"#bbbbbb"},Cz={light:"#fffffe",dark:"#1e1e1e"},Tz="__shiki_resolved";function _I(e){var a,c,u,d,h;if(e!=null&&e[Tz])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:s}=t;if(!n||!s){const m=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(a=m==null?void 0:m.settings)!=null&&a.foreground&&(s=m.settings.foreground),(c=m==null?void 0:m.settings)!=null&&c.background&&(n=m.settings.background),!s&&((u=t==null?void 0:t.colors)!=null&&u["editor.foreground"])&&(s=t.colors["editor.foreground"]),!n&&((d=t==null?void 0:t.colors)!=null&&d["editor.background"])&&(n=t.colors["editor.background"]),s||(s=t.type==="light"?Sz.light:Sz.dark),n||(n=t.type==="light"?Cz.light:Cz.dark),t.fg=s,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 r=0;const i=new Map;function o(m){var g;if(i.has(m))return i.get(m);r+=1;const p=`#${r.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 x,y;const p=((x=m.settings)==null?void 0:x.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"))&&!((h=t.colors[m])!=null&&h.startsWith("#"))){const p=o(t.colors[m]);t.colorReplacements[p]=t.colors[m],t.colors[m]=p}return Object.defineProperty(t,Tz,{enumerable:!1,writable:!1,value:!0}),t}async function oZ(e){return Array.from(new Set((await Promise.all(e.filter(t=>!JJ(t)).map(async t=>await tZ(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function aZ(e){return(await Promise.all(e.map(async n=>ZJ(n)?null:_I(await tZ(n))))).filter(n=>!!n)}class HTe extends uCe{constructor(n,s,r,i={}){super(n);Pe(this,"_resolvedThemes",new Map);Pe(this,"_resolvedGrammars",new Map);Pe(this,"_langMap",new Map);Pe(this,"_langGraph",new Map);Pe(this,"_textmateThemeCache",new WeakMap);Pe(this,"_loadedThemesCache",null);Pe(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=s,this._langs=r,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 s=_I(n);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let s=this._textmateThemeCache.get(n);s||(s=x4.createFromRawTheme(n),this._textmateThemeCache.set(n,s)),this._syncRegistry.setTheme(s)}getGrammar(n){if(this._alias[n]){const s=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],s.has(n))throw new $a(`Circular alias \`${Array.from(s).join(" -> ")} -> ${n}\``);s.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,c,u;if(this.getGrammar(n.name))return;const s=new Set([...this._langMap.values()].filter(d=>{var h;return(h=d.embeddedLangsLazy)==null?void 0:h.includes(n.name)}));this._resolver.addLanguage(n);const r={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,r);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,s.size)for(const d of s)this._resolvedGrammars.delete(d.name),this._loadedLanguagesCache=null,(a=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||a.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 s=Array.from(this._langGraph.entries()),r=s.filter(([i,o])=>!o);if(r.length){const i=s.filter(([o,a])=>{var c;return a&&((c=a.embeddedLangs)==null?void 0:c.some(u=>r.map(([d])=>d).includes(u)))}).filter(o=>!r.includes(o));throw new $a(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${i.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[i,o]of s)this._resolver.addLanguage(o);for(const[i,o]of s)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 s of n.embeddedLangs)this._langGraph.set(s,this._langMap.get(s))}}class qTe{constructor(t,n){Pe(this,"_langs",new Map);Pe(this,"_scopeToLang",new Map);Pe(this,"_injections",new Map);Pe(this,"_onigLib");this._onigLib={createOnigScanner:s=>t.createScanner(s),createOnigString:s=>t.createString(s)},n.forEach(s=>this.addLanguage(s))}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 s=[];for(let r=1;r<=n.length;r++){const i=n.slice(0,r).join(".");s=[...s,...this._injections.get(i)||[]]}return s}}let qy=0;function UTe(e){qy+=1,e.warnings!==!1&&qy>=10&&qy%10===0&&console.warn(`[Shiki] ${qy} 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 $a("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(_I),r=new qTe(e.engine,n),i=new HTe(r,s,n,e.langAlias);let o;function a(v){x();const w=i.getGrammar(typeof v=="string"?v:v.name);if(!w)throw new $a(`Language \`${v}\` not found, you may need to load it first`);return w}function c(v){if(v==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};x();const w=i.getTheme(v);if(!w)throw new $a(`Theme \`${v}\` not found, you may need to load it first`);return w}function u(v){x();const w=c(v);o!==v&&(i.setTheme(w),o=v);const k=i.getColorMap();return{theme:w,colorMap:k}}function d(){return x(),i.getLoadedThemes()}function h(){return x(),i.getLoadedLanguages()}function m(...v){x(),i.loadLanguages(v.flat(1))}async function p(...v){return m(await oZ(v))}function g(...v){x();for(const w of v.flat(1))i.loadTheme(w)}async function b(...v){return x(),g(await aZ(v))}function x(){if(t)throw new $a("Shiki instance has been disposed")}function y(){t||(t=!0,i.dispose(),qy-=1)}return{setTheme:u,getTheme:c,getLanguage:a,getLoadedThemes:d,getLoadedLanguages:h,loadLanguage:p,loadLanguageSync:m,loadTheme:b,loadThemeSync:g,dispose:y,[Symbol.dispose]:y}}async function WTe(e={}){e.loadWasm;const[t,n,s]=await Promise.all([aZ(e.themes||[]),oZ(e.langs||[]),e.engine||MJ(e.loadWasm||S3e())]);return UTe({...e,themes:t,langs:n,engine:s})}async function VTe(e={}){const t=await WTe(e);return{getLastGrammarState:(...n)=>NTe(t,...n),codeToTokensBase:(n,s)=>kI(t,n,s),codeToTokensWithThemes:(n,s)=>iZ(t,n,s),codeToTokens:(n,s)=>A4(t,n,s),codeToHast:(n,s)=>j4(t,n,s),codeToHtml:(n,s)=>FTe(t,n,s),...t,getInternalContext:()=>t}}function GTe(e,t,n){let s,r,i;{const a=e;s=a.langs,r=a.themes,i=a.engine}async function o(a){function c(p){if(typeof p=="string"){if(JJ(p))return[];const g=s[p];if(!g)throw new _h(`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(ZJ(p))return"none";if(typeof p=="string"){const g=r[p];if(!g)throw new _h(`Theme \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}const d=(a.themes??[]).map(p=>u(p)),h=(a.langs??[]).map(p=>c(p)),m=await VTe({engine:a.engine??i(),...a,themes:d,langs:h});return{...m,loadLanguage(...p){return m.loadLanguage(...p.map(c))},loadTheme(...p){return m.loadTheme(...p.map(u))}}}return o}const KTe=GTe({langs:r3e,themes:o3e,engine:()=>MJ(oe(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const YTe=["github-light-default","github-dark-default"];let C_=null,cj=null;const uj=new Set,y8=new Map,Ez=new Set,XTe=128,gv=new Map;function lZ(e,t,n){return`${t}\0${n}\0${e}`}function QTe(e,t){if(gv.size>=XTe){const n=gv.keys().next().value;n!==void 0&&gv.delete(n)}gv.set(e,t)}function JTe(e,t,n){return gv.get(lZ(e,t,n))??null}function ZTe(){return C_||(C_=KTe({langs:[],themes:YTe}).then(e=>(cj=e,e)).catch(e=>{throw C_=null,e})),C_}async function cZ(e){const t=await ZTe();if(uj.has(e))return t;if(Ez.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=y8.get(e);return n||(n=t.loadLanguage(e).then(()=>{uj.add(e)}).catch(s=>{throw Ez.add(e),s}).finally(()=>{y8.delete(e)}),y8.set(e,n)),await n,t}const e5e=1e5,t5e=2e4;function dj(e){if(e.length>e5e)return!0;let t=0;const n=e.length;for(let s=0;s<=n;s++)if(s===n||e.charCodeAt(s)===10){if(s-t>t5e)return!0;t=s+1}return!1}function Az(e,t,n,s=!0){if(cj&&uj.has(t))try{const r=cj.codeToHtml(e,{lang:t,theme:n});return s&&QTe(lZ(e,t,n),r),r}catch(r){return console.warn("[web-shell] sync highlight failed for lang=%s",t,r),null}return null}const n5e=()=>{},s5e=()=>n5e,uZ=f.createContext(s5e);function r5e(){return f.useContext(uZ)}function dZ(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=dZ(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function hZ(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=dZ(e))&&(s&&(s+=" "),s+=t);return s}const jz=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Nz=hZ,U0=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return Nz(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:i}=t,o=Object.keys(r).map(u=>{const d=n==null?void 0:n[u],h=i==null?void 0:i[u];if(d===null)return null;const m=jz(d)||jz(h);return r[u][m]}),a=n&&Object.entries(n).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:h,className:m,...p}=d;return Object.entries(p).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...i,...a}[b]):{...i,...a}[b]===x})?[...u,h,m]:u},[]);return Nz(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};function Mz(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function i5e(...e){return t=>{let n=!1;const s=e.map(r=>{const i=Mz(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():Mz(e[r],null)}}}}function Es(...e){return f.useCallback(i5e(...e),e)}function km(e){const t=f.forwardRef((n,s)=>{let{children:r,...i}=n,o=null,a=!1;const c=[];Iz(r)&&typeof T_=="function"&&(r=T_(r._payload)),f.Children.forEach(r,m=>{var p;if(u5e(m)){a=!0;const g=m;let b="child"in g.props?g.props.child:g.props.children;Iz(b)&&typeof T_=="function"&&(b=T_(b._payload)),o=a5e(g,b),c.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else c.push(m)}),o?o=f.cloneElement(o,void 0,c):!a&&f.Children.count(r)===1&&f.isValidElement(r)&&(o=r);const u=o?c5e(o):void 0,d=Es(s,u);if(!o){if(r||r===0)throw new Error(a?m5e(e):f5e(e));return r}const h=l5e(i,o.props??{});return o.type!==f.Fragment&&(h.ref=s?d:u),f.cloneElement(o,h)});return t.displayName=`${e}.Slot`,t}var SI=km("Slot"),fZ=Symbol.for("radix.slottable");function o5e(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=fZ,t}var a5e=(e,t)=>{if("child"in e.props){const n=e.props.child;return f.isValidElement(n)?f.cloneElement(n,void 0,e.props.children(n.props.children)):null}return f.isValidElement(t)?t:null};function l5e(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const c=i(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function c5e(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function u5e(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fZ}var d5e=Symbol.for("react.lazy");function Iz(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===d5e&&"_payload"in e&&h5e(e._payload)}function h5e(e){return typeof e=="object"&&e!==null&&"then"in e}var f5e=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,m5e=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,T_=P3[" use ".trim().toString()],p5e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Un=p5e.reduce((e,t)=>{const n=km(`Primitive.${t}`),s=f.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function mZ(e,t){e&&hu.flushSync(()=>e.dispatchEvent(t))}var pZ=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"}),g5e="VisuallyHidden",gZ=f.forwardRef((e,t)=>l.jsx(Un.span,{...e,ref:t,style:{...pZ,...e.style}}));gZ.displayName=g5e;var b5e=gZ;function ka(e,t=[]){let n=[];function s(i,o){const a=f.createContext(o);a.displayName=i+"Context";const c=n.length;n=[...n,o];const u=h=>{var y;const{scope:m,children:p,...g}=h,b=((y=m==null?void 0:m[e])==null?void 0:y[c])||a,x=f.useMemo(()=>g,Object.values(g));return l.jsx(b.Provider,{value:x,children:p})};u.displayName=i+"Provider";function d(h,m,p={}){var y;const{optional:g=!1}=p,b=((y=m==null?void 0:m[e])==null?void 0:y[c])||a,x=f.useContext(b);if(x)return x;if(o!==void 0)return o;if(!g)throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const r=()=>{const i=n.map(o=>f.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return r.scopeName=e,[s,y5e(r,...t)]}function y5e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const o=s.reduce((a,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...a,...h}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function CI(e){const t=e+"CollectionProvider",[n,s]=ka(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:x,children:y}=b,v=f.useRef(null),w=f.useRef(new Map).current;return l.jsx(r,{scope:x,itemMap:w,collectionRef:v,children:y})};o.displayName=t;const a=e+"CollectionSlot",c=km(a),u=f.forwardRef((b,x)=>{const{scope:y,children:v}=b,w=i(a,y),k=Es(x,w.collectionRef);return l.jsx(c,{ref:k,children:v})});u.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",m=km(d),p=f.forwardRef((b,x)=>{const{scope:y,children:v,...w}=b,k=f.useRef(null),T=Es(x,k),C=i(d,y);return f.useEffect(()=>(C.itemMap.set(k,{ref:k,...w}),()=>void C.itemMap.delete(k))),l.jsx(m,{[h]:"",ref:T,children:v})});p.displayName=d;function g(b){const x=i(e+"CollectionConsumer",b);return f.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((C,_)=>w.indexOf(C.ref.current)-w.indexOf(_.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,s]}function en(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r||!r.defaultPrevented)return t==null?void 0:t(r)}}var Wo=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},v5e=P3[" useInsertionEffect ".trim().toString()]||Wo;function Va({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=x5e({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:r;{const d=f.useRef(e!==void 0);f.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${a?"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=a},[a,s])}const u=f.useCallback(d=>{var h;if(a){const m=w5e(d)?d(e):d;m!==e&&((h=o.current)==null||h.call(o,m))}else i(d)},[a,e,i,o]);return[c,u]}function x5e({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),r=f.useRef(n),i=f.useRef(t);return v5e(()=>{i.current=t},[t]),f.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function w5e(e){return typeof e=="function"}function k5e(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var _a=e=>{const{present:t,children:n}=e,s=_5e(t),r=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),i=S5e(s.ref,C5e(r));return typeof n=="function"||s.isPresent?f.cloneElement(r,{ref:i}):null};_a.displayName="Presence";function _5e(e){const[t,n]=f.useState(),s=f.useRef(null),r=f.useRef(e),i=f.useRef("none"),o=f.useRef(void 0),a=e?"mounted":"unmounted",[c,u]=k5e(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{c==="mounted"?(i.current=o.current??Uy(s.current),o.current=void 0):i.current="none"},[c]),Wo(()=>{const d=s.current,h=r.current;if(h!==e){const p=i.current,g=Uy(d);e?(o.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,u]),Wo(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,m=g=>{const x=Uy(s.current).includes(CSS.escape(g.animationName));if(g.target===t&&x&&(u("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=g=>{g.target===t&&(i.current=Uy(s.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{h.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:f.useCallback(d=>{if(d){const h=getComputedStyle(d);s.current=h,o.current=Uy(h)}else s.current=null;n(d)},[])}}function Rz(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function S5e(...e){const t=f.useRef(e);return t.current=e,f.useCallback(n=>{const s=t.current;let r=!1;const i=s.map(o=>{const a=Rz(o,n);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():Rz(s[o],null)}}},[])}function Uy(e){return(e==null?void 0:e.animationName)||"none"}function C5e(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var T5e=P3[" useId ".trim().toString()]||(()=>{}),E5e=0;function xl(e){const[t,n]=f.useState(T5e());return Wo(()=>{n(s=>s??String(E5e++))},[e]),e||(t?`radix-${t}`:"")}var A5e=f.createContext(void 0);function Ub(e){const t=f.useContext(A5e);return e||t||"ltr"}function lc(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}var j5e="DismissableLayer",hj="dismissableLayer.update",N5e="dismissableLayer.pointerDownOutside",M5e="dismissableLayer.focusOutside",Dz,TI=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Wb=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...u}=e,d=f.useContext(TI),[h,m]=f.useState(null),p=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=f.useState({}),b=Es(t,m),x=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=y?x.indexOf(y):-1,w=h?x.indexOf(h):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,T=w>=v,C=f.useRef(!1),_=P5e(B=>{i==null||i(B),a==null||a(B),B.defaultPrevented||c==null||c()},{ownerDocument:p,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(B=>{if(!(B instanceof Node))return!1;const I=[...d.branches].some(L=>L.contains(B));return T&&!I},[d.branches,T])}),S=O5e(B=>{if(s&&C.current)return;const I=B.target;[...d.branches].some(O=>O.contains(I))||(o==null||o(B),a==null||a(B),B.defaultPrevented||c==null||c())},p),D=h?w===x.length-1:!1,E=lc(B=>{B.key==="Escape"&&(r==null||r(B),!B.defaultPrevented&&c&&(B.preventDefault(),c()))});return f.useEffect(()=>{if(D)return p.addEventListener("keydown",E,{capture:!0}),()=>p.removeEventListener("keydown",E,{capture:!0})},[p,D,E]),f.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Dz=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),Lz(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Dz))}},[h,p,n,d]),f.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),Lz())},[h,d]),f.useEffect(()=>{const B=()=>g({});return document.addEventListener(hj,B),()=>document.removeEventListener(hj,B)},[]),l.jsx(Un.div,{...u,ref:b,style:{pointerEvents:k?T?"auto":"none":void 0,...e.style},onFocusCapture:en(e.onFocusCapture,S.onFocusCapture),onBlurCapture:en(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:en(e.onPointerDownCapture,_.onPointerDownCapture)})});Wb.displayName=j5e;var I5e="DismissableLayerBranch",R5e=f.forwardRef((e,t)=>{const n=f.useContext(TI),s=f.useRef(null),r=Es(t,s);return f.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(Un.div,{...e,ref:r})});R5e.displayName=I5e;function D5e(){const e=f.useContext(TI),[t,n]=f.useState(null);return f.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var L5e=()=>!0;function P5e(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=L5e}=t,a=lc(e),c=f.useRef(!1),u=f.useRef(!1),d=f.useRef(new Map),h=f.useRef(()=>{});return f.useEffect(()=>{function m(){u.current=!1,r.current=!1,d.current.clear()}function p(){return Array.from(d.current.values()).some(Boolean)}function g(w){if(!u.current)return;const k=w.target;k instanceof Node&&[...i].some(C=>C.contains(k))||d.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{u.current&&h.current()},0)}function b(w){u.current&&d.current.set(w.type,!1)}const x=w=>{if(w.target&&!c.current){let k=function(){n.removeEventListener("click",h.current);const C=p();m(),C||bZ(N5e,a,T,{discrete:!0})};if(!o(w.target)){n.removeEventListener("click",h.current),m(),c.current=!1;return}const T={originalEvent:w};u.current=!0,r.current=s&&w.button===0,d.current.clear(),!s||w.button!==0?k():(n.removeEventListener("click",h.current),h.current=k,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),m();c.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of y)n.addEventListener(w,g,!0),n.addEventListener(w,b);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",x),n.removeEventListener("click",h.current);for(const w of y)n.removeEventListener(w,g,!0),n.removeEventListener(w,b)}},[n,a,s,r,i,o]),{onPointerDownCapture:()=>c.current=!0}}function O5e(e,t=globalThis==null?void 0:globalThis.document){const n=lc(e),s=f.useRef(!1);return f.useEffect(()=>{const r=i=>{i.target&&!s.current&&bZ(M5e,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Lz(){const e=new CustomEvent(hj);document.dispatchEvent(e)}function bZ(e,t,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?mZ(r,i):r.dispatchEvent(i)}var v8="focusScope.autoFocusOnMount",x8="focusScope.autoFocusOnUnmount",Pz={bubbles:!1,cancelable:!0},$5e="FocusScope",Lw=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,c]=f.useState(null),u=lc(r),d=lc(i),h=f.useRef(null),m=Es(t,c),p=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let b=function(w){if(p.paused||!a)return;const k=w.target;a.contains(k)?h.current=k:wf(h.current,{select:!0})},x=function(w){if(p.paused||!a)return;const k=w.relatedTarget;k!==null&&(a.contains(k)||wf(h.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const T of w)T.removedNodes.length>0&&wf(a)};document.addEventListener("focusin",b),document.addEventListener("focusout",x);const v=new MutationObserver(y);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",x),v.disconnect()}}},[s,a,p.paused]),f.useEffect(()=>{if(a){$z.add(p);const b=document.activeElement;if(!a.contains(b)){const y=new CustomEvent(v8,Pz);a.addEventListener(v8,u),a.dispatchEvent(y),y.defaultPrevented||(B5e(U5e(yZ(a)),{select:!0}),document.activeElement===b&&wf(a))}return()=>{a.removeEventListener(v8,u),setTimeout(()=>{const y=new CustomEvent(x8,Pz);a.addEventListener(x8,d),a.dispatchEvent(y),y.defaultPrevented||wf(b??document.body,{select:!0}),a.removeEventListener(x8,d),$z.remove(p)},0)}}},[a,u,d,p]);const g=f.useCallback(b=>{if(!n&&!s||p.paused)return;const x=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(x&&y){const v=b.currentTarget,[w,k]=z5e(v);w&&k?!b.shiftKey&&y===k?(b.preventDefault(),n&&wf(w,{select:!0})):b.shiftKey&&y===w&&(b.preventDefault(),n&&wf(k,{select:!0})):y===v&&b.preventDefault()}},[n,s,p.paused]);return l.jsx(Un.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});Lw.displayName=$5e;function B5e(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(wf(s,{select:t}),document.activeElement!==n)return}function z5e(e){const t=yZ(e),n=Oz(t,e),s=Oz(t.reverse(),e);return[n,s]}function yZ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Oz(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):F5e(s,{upTo:t})))return s}function F5e(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 H5e(e){return e instanceof HTMLInputElement&&"select"in e}function wf(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&H5e(e)&&t&&e.select()}}var $z=q5e();function q5e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Bz(e,t),e.unshift(t)},remove(t){var n;e=Bz(e,t),(n=e[0])==null||n.resume()}}}function Bz(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function U5e(e){return e.filter(t=>t.tagName!=="A")}var W5e="Portal",Vb=f.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=f.useState(!1);Wo(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?hu.createPortal(l.jsx(Un.div,{...s,ref:t}),o):null});Vb.displayName=W5e;var E_=0,Mu=null;function DC(){f.useEffect(()=>{Mu||(Mu={start:zz(),end:zz()});const{start:e,end:t}=Mu;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),E_++,()=>{E_===1&&(Mu==null||Mu.start.remove(),Mu==null||Mu.end.remove(),Mu=null),E_=Math.max(0,E_-1)}},[])}function zz(){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 Vu=function(){return Vu=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Vu.apply(this,arguments)};function vZ(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function V5e(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,i;s<r;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var J2="right-scroll-bar-position",Z2="width-before-scroll-bar",G5e="with-scroll-bars-hidden",K5e="--removed-body-scroll-bar-size";function w8(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Y5e(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var X5e=typeof window<"u"?f.useLayoutEffect:f.useEffect,Fz=new WeakMap;function Q5e(e,t){var n=Y5e(null,function(s){return e.forEach(function(r){return w8(r,s)})});return X5e(function(){var s=Fz.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||w8(a,null)}),i.forEach(function(a){r.has(a)||w8(a,o)})}Fz.set(n,e)},[e]),n}function J5e(e){return e}function Z5e(e,t){t===void 0&&(t=J5e);var n=[],s=!1,r={read:function(){if(s)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,s);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var a=n;n=[],a.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 r}function e6e(e){e===void 0&&(e={});var t=Z5e(null);return t.options=Vu({async:!0,ssr:!1},e),t}var xZ=function(e){var t=e.sideCar,n=vZ(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return f.createElement(s,Vu({},n))};xZ.isSideCarExport=!0;function t6e(e,t){return e.useMedium(t),xZ}var wZ=e6e(),k8=function(){},LC=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:k8,onWheelCapture:k8,onTouchMoveCapture:k8}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,b=e.inert,x=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,w=e.gapMode,k=vZ(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=m,C=Q5e([n,t]),_=Vu(Vu({},k),r);return f.createElement(f.Fragment,null,d&&f.createElement(T,{sideCar:wZ,removeScrollBar:u,shards:h,noRelative:p,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:w}),o?f.cloneElement(f.Children.only(a),Vu(Vu({},_),{ref:C})):f.createElement(v,Vu({},_,{className:c,ref:C}),a))});LC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};LC.classNames={fullWidth:Z2,zeroRight:J2};var n6e=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function s6e(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=n6e();return t&&e.setAttribute("nonce",t),e}function r6e(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function i6e(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var o6e=function(){var e=0,t=null;return{add:function(n){e==0&&(t=s6e())&&(r6e(t,n),i6e(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},a6e=function(){var e=o6e();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},kZ=function(){var e=a6e(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},l6e={left:0,top:0,right:0,gap:0},_8=function(e){return parseInt(e||"",10)||0},c6e=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[_8(n),_8(s),_8(r)]},u6e=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return l6e;var t=c6e(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},d6e=kZ(),R1="data-scroll-locked",h6e=function(e,t,n,s){var r=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(G5e,` {
   overflow: hidden `).concat(s,`;
   padding-right: `).concat(a,"px ").concat(s,`;
  }
  body[`).concat(R1,`] {
    overflow: hidden `).concat(s,`;
    overscroll-behavior: contain;
    `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
    padding-left: `.concat(r,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(s,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(J2,` {
    right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(Z2,` {
    margin-right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(J2," .").concat(J2,` {
    right: 0 `).concat(s,`;
  }
  
  .`).concat(Z2," .").concat(Z2,` {
    margin-right: 0 `).concat(s,`;
  }
  
  body[`).concat(R1,`] {
    `).concat(K5e,": ").concat(a,`px;
  }
`)},Hz=function(){var e=parseInt(document.body.getAttribute(R1)||"0",10);return isFinite(e)?e:0},f6e=function(){f.useEffect(function(){return document.body.setAttribute(R1,(Hz()+1).toString()),function(){var e=Hz()-1;e<=0?document.body.removeAttribute(R1):document.body.setAttribute(R1,e.toString())}},[])},m6e=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;f6e();var i=f.useMemo(function(){return u6e(r)},[r]);return f.createElement(d6e,{styles:h6e(i,!t,r,n?"":"!important")})},fj=!1;if(typeof window<"u")try{var A_=Object.defineProperty({},"passive",{get:function(){return fj=!0,!0}});window.addEventListener("test",A_,A_),window.removeEventListener("test",A_,A_)}catch{fj=!1}var Ng=fj?{passive:!1}:!1,p6e=function(e){return e.tagName==="TEXTAREA"},_Z=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!p6e(e)&&n[t]==="visible")},g6e=function(e){return _Z(e,"overflowY")},b6e=function(e){return _Z(e,"overflowX")},qz=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=SZ(e,s);if(r){var i=CZ(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},y6e=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},v6e=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},SZ=function(e,t){return e==="v"?g6e(t):b6e(t)},CZ=function(e,t){return e==="v"?y6e(t):v6e(t)},x6e=function(e,t){return e==="h"&&t==="rtl"?-1:1},w6e=function(e,t,n,s,r){var i=x6e(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,c=t.contains(a),u=!1,d=o>0,h=0,m=0;do{if(!a)break;var p=CZ(e,a),g=p[0],b=p[1],x=p[2],y=b-x-i*g;(g||y)&&SZ(e,a)&&(h+=y,m+=g);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(m)<1)&&(u=!0),u},j_=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Uz=function(e){return[e.deltaX,e.deltaY]},Wz=function(e){return e&&"current"in e?e.current:e},k6e=function(e,t){return e[0]===t[0]&&e[1]===t[1]},_6e=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},S6e=0,Mg=[];function C6e(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),r=f.useState(S6e++)[0],i=f.useState(kZ)[0],o=f.useRef(e);f.useEffect(function(){o.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var b=V5e([e.lockRef.current],(e.shards||[]).map(Wz),!0).filter(Boolean);return b.forEach(function(x){return x.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),b.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(b,x){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var y=j_(b),v=n.current,w="deltaX"in b?b.deltaX:v[0]-y[0],k="deltaY"in b?b.deltaY:v[1]-y[1],T,C=b.target,_=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in b&&_==="h"&&C.type==="range")return!1;var S=window.getSelection(),D=S&&S.anchorNode,E=D?D===C||D.contains(C):!1;if(E)return!1;var B=qz(_,C);if(!B)return!0;if(B?T=_:(T=_==="v"?"h":"v",B=qz(_,C)),!B)return!1;if(!s.current&&"changedTouches"in b&&(w||k)&&(s.current=T),!T)return!0;var I=s.current||T;return w6e(I,x,b,I==="h"?w:k)},[]),c=f.useCallback(function(b){var x=b;if(!(!Mg.length||Mg[Mg.length-1]!==i)){var y="deltaY"in x?Uz(x):j_(x),v=t.current.filter(function(T){return T.name===x.type&&(T.target===x.target||x.target===T.shadowParent)&&k6e(T.delta,y)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var w=(o.current.shards||[]).map(Wz).filter(Boolean).filter(function(T){return T.contains(x.target)}),k=w.length>0?a(x,w[0]):!o.current.noIsolation;k&&x.cancelable&&x.preventDefault()}}},[]),u=f.useCallback(function(b,x,y,v){var w={name:b,delta:x,target:y,should:v,shadowParent:T6e(y)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(k){return k!==w})},1)},[]),d=f.useCallback(function(b){n.current=j_(b),s.current=void 0},[]),h=f.useCallback(function(b){u(b.type,Uz(b),b.target,a(b,e.lockRef.current))},[]),m=f.useCallback(function(b){u(b.type,j_(b),b.target,a(b,e.lockRef.current))},[]);f.useEffect(function(){return Mg.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Ng),document.addEventListener("touchmove",c,Ng),document.addEventListener("touchstart",d,Ng),function(){Mg=Mg.filter(function(b){return b!==i}),document.removeEventListener("wheel",c,Ng),document.removeEventListener("touchmove",c,Ng),document.removeEventListener("touchstart",d,Ng)}},[]);var p=e.removeScrollBar,g=e.inert;return f.createElement(f.Fragment,null,g?f.createElement(i,{styles:_6e(r)}):null,p?f.createElement(m6e,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function T6e(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const E6e=t6e(wZ,C6e);var Pw=f.forwardRef(function(e,t){return f.createElement(LC,Vu({},e,{ref:t,sideCar:E6e}))});Pw.classNames=LC.classNames;var A6e=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ig=new WeakMap,N_=new WeakMap,M_={},S8=0,TZ=function(e){return e&&(e.host||TZ(e.parentNode))},j6e=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=TZ(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},N6e=function(e,t,n,s){var r=j6e(t,Array.isArray(e)?e:[e]);M_[n]||(M_[n]=new WeakMap);var i=M_[n],o=[],a=new Set,c=new Set(r),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};r.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(a.has(m))d(m);else try{var p=m.getAttribute(s),g=p!==null&&p!=="false",b=(Ig.get(m)||0)+1,x=(i.get(m)||0)+1;Ig.set(m,b),i.set(m,x),o.push(m),b===1&&g&&N_.set(m,!0),x===1&&m.setAttribute(n,"true"),g||m.setAttribute(s,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),a.clear(),S8++,function(){o.forEach(function(h){var m=Ig.get(h)-1,p=i.get(h)-1;Ig.set(h,m),i.set(h,p),m||(N_.has(h)||h.removeAttribute(s),N_.delete(h)),p||h.removeAttribute(n)}),S8--,S8||(Ig=new WeakMap,Ig=new WeakMap,N_=new WeakMap,M_={})}},PC=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=A6e(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),N6e(s,r,n,"aria-hidden")):function(){return null}},OC="Dialog",[EZ,AZ]=ka(OC),[M6e,pu]=EZ(OC),$C=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,a=f.useRef(null),c=f.useRef(null),[u,d]=Va({prop:s,defaultProp:r??!1,onChange:i,caller:OC});return l.jsx(M6e,{scope:t,triggerRef:a,contentRef:c,contentId:xl(),titleId:xl(),descriptionId:xl(),open:u,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};$C.displayName=OC;var jZ="DialogTrigger",NZ=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=pu(jZ,n),i=Es(t,r.triggerRef);return l.jsx(Un.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":jI(r.open),...s,ref:i,onClick:en(e.onClick,r.onOpenToggle)})});NZ.displayName=jZ;var EI="DialogPortal",[I6e,MZ]=EZ(EI,{forceMount:void 0}),BC=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,i=pu(EI,t);return l.jsx(I6e,{scope:t,forceMount:n,children:f.Children.map(s,o=>l.jsx(_a,{present:n||i.open,children:l.jsx(Vb,{asChild:!0,container:r,children:o})}))})};BC.displayName=EI;var N4="DialogOverlay",zC=f.forwardRef((e,t)=>{const n=MZ(N4,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=pu(N4,e.__scopeDialog);return i.modal?l.jsx(_a,{present:s||i.open,children:l.jsx(D6e,{...r,ref:t})}):null});zC.displayName=N4;var R6e=km("DialogOverlay.RemoveScroll"),D6e=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=pu(N4,n),i=D5e(),o=Es(t,i);return l.jsx(Pw,{as:R6e,allowPinchZoom:!0,shards:[r.contentRef],children:l.jsx(Un.div,{"data-state":jI(r.open),...s,ref:o,style:{pointerEvents:"auto",...s.style}})})}),ab="DialogContent",FC=f.forwardRef((e,t)=>{const n=MZ(ab,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=pu(ab,e.__scopeDialog);return l.jsx(_a,{present:s||i.open,children:i.modal?l.jsx(L6e,{...r,ref:t}):l.jsx(P6e,{...r,ref:t})})});FC.displayName=ab;var L6e=f.forwardRef((e,t)=>{const n=pu(ab,e.__scopeDialog),s=f.useRef(null),r=Es(t,n.contentRef,s);return f.useEffect(()=>{const i=s.current;if(i)return PC(i)},[]),l.jsx(IZ,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:en(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:en(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:en(e.onFocusOutside,i=>i.preventDefault())})}),P6e=f.forwardRef((e,t)=>{const n=pu(ab,e.__scopeDialog),s=f.useRef(!1),r=f.useRef(!1);return l.jsx(IZ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),IZ=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...o}=e,a=pu(ab,n);return DC(),l.jsx(l.Fragment,{children:l.jsx(Lw,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(Wb,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":jI(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),RZ="DialogTitle",HC=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=pu(RZ,n);return l.jsx(Un.h2,{id:r.titleId,...s,ref:t})});HC.displayName=RZ;var DZ="DialogDescription",AI=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=pu(DZ,n);return l.jsx(Un.p,{id:r.descriptionId,...s,ref:t})});AI.displayName=DZ;var LZ="DialogClose",Gb=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=pu(LZ,n);return l.jsx(Un.button,{type:"button",...s,ref:t,onClick:en(e.onClick,()=>r.onOpenChange(!1))})});Gb.displayName=LZ;function jI(e){return e?"open":"closed"}var PZ="AlertDialog",[O6e,O4t]=ka(PZ,[AZ]),Kh=AZ(),OZ=e=>{const{__scopeAlertDialog:t,...n}=e,s=Kh(t);return l.jsx($C,{...s,...n,modal:!0})};OZ.displayName=PZ;var $6e="AlertDialogTrigger",B6e=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Kh(n);return l.jsx(NZ,{...r,...s,ref:t})});B6e.displayName=$6e;var z6e="AlertDialogPortal",$Z=e=>{const{__scopeAlertDialog:t,...n}=e,s=Kh(t);return l.jsx(BC,{...s,...n})};$Z.displayName=z6e;var F6e="AlertDialogOverlay",BZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Kh(n);return l.jsx(zC,{...r,...s,ref:t})});BZ.displayName=F6e;var zZ="AlertDialogContent",[H6e,q6e]=O6e(zZ),FZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...r}=e,i=Kh(n),o=f.useRef(null),a=Es(t,o),c=f.useRef(null);return l.jsx(H6e,{scope:n,cancelRef:c,children:l.jsx(FC,{role:"alertdialog",...i,...r,ref:a,onOpenAutoFocus:en(r.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:s})})});FZ.displayName=zZ;var U6e="AlertDialogTitle",HZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Kh(n);return l.jsx(HC,{...r,...s,ref:t})});HZ.displayName=U6e;var W6e="AlertDialogDescription",qZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Kh(n);return l.jsx(AI,{...r,...s,ref:t})});qZ.displayName=W6e;var V6e="AlertDialogAction",UZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Kh(n);return l.jsx(Gb,{...r,...s,ref:t})});UZ.displayName=V6e;var WZ="AlertDialogCancel",VZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:r}=q6e(WZ,n),i=Kh(n),o=Es(t,r);return l.jsx(Gb,{...i,...s,ref:o})});VZ.displayName=WZ;var G6e=OZ,K6e=$Z,Y6e=BZ,X6e=FZ,Q6e=UZ,J6e=VZ,Z6e=HZ,e8e=qZ;function qC(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function UC(e){const[t,n]=f.useState(void 0);return Wo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let o,a;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var WC="Checkbox",[t8e,$4t]=ka(WC),[n8e,NI]=t8e(WC);function s8e(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=e,[m,p]=Va({prop:n,defaultProp:r??!1,onChange:c,caller:WC}),[g,b]=f.useState(null),[x,y]=f.useState(null),v=f.useRef(!1),w=g?!!o||!!g.closest("form"):!0,k={checked:m,disabled:i,setChecked:p,control:g,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:am(r)?!1:r,isFormControl:w,bubbleInput:x,setBubbleInput:y};return l.jsx(n8e,{scope:t,...k,children:r8e(h)?h(k):s})}var GZ="CheckboxTrigger",KZ=f.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},r)=>{const{control:i,value:o,disabled:a,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=NI(GZ,e),b=Es(r,d),x=f.useRef(c);return f.useEffect(()=>{const y=i==null?void 0:i.form;if(y){const v=()=>h(x.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[i,h]),l.jsx(Un.button,{type:"button",role:"checkbox","aria-checked":am(c)?"mixed":c,"aria-required":u,"data-state":eee(c),"data-disabled":a?"":void 0,disabled:a,value:o,...s,ref:b,onKeyDown:en(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:en(n,y=>{h(v=>am(v)?!0:!v),g&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});KZ.displayName=GZ;var YZ=f.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:c,onCheckedChange:u,form:d,...h}=e;return l.jsx(s8e,{__scopeCheckbox:n,checked:r,defaultChecked:i,disabled:a,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(KZ,{...h,ref:t,__scopeCheckbox:n}),m&&l.jsx(ZZ,{__scopeCheckbox:n})]})})});YZ.displayName=WC;var XZ="CheckboxIndicator",QZ=f.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...r}=e,i=NI(XZ,n);return l.jsx(_a,{present:s||am(i.checked)||i.checked===!0,children:l.jsx(Un.span,{"data-state":eee(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});QZ.displayName=XZ;var JZ="CheckboxBubbleInput",ZZ=f.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:p}=NI(JZ,e),g=Es(n,p),b=qC(i),x=UC(s);f.useEffect(()=>{const v=m;if(!v)return;const w=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(w,"checked").set,C=!r.current;if(b!==i&&T){const _=new Event("click",{bubbles:C});v.indeterminate=am(i),T.call(v,am(i)?!1:i),v.dispatchEvent(_)}},[m,b,i,r]);const y=f.useRef(am(i)?!1:i);return l.jsx(Un.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:a,disabled:c,name:u,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});ZZ.displayName=JZ;function r8e(e){return typeof e=="function"}function am(e){return e==="indeterminate"}function eee(e){return am(e)?"indeterminate":e?"checked":"unchecked"}const i8e=["top","right","bottom","left"],_m=Math.min,Sh=Math.max,M4=Math.round,I_=Math.floor,Ch=e=>({x:e,y:e}),o8e={left:"right",right:"left",bottom:"top",top:"bottom"};function tee(e,t,n){return Sh(e,_m(t,n))}function Bh(e,t){return typeof e=="function"?e(t):e}function Sm(e){return e.split("-")[0]}function Kb(e){return e.split("-")[1]}function MI(e){return e==="x"?"y":"x"}function II(e){return e==="y"?"height":"width"}function ed(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function RI(e){return MI(ed(e))}function a8e(e,t,n){n===void 0&&(n=!1);const s=Kb(e),r=RI(e),i=II(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=I4(o)),[o,I4(o)]}function l8e(e){const t=I4(e);return[mj(e),t,mj(t)]}function mj(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Vz=["left","right"],Gz=["right","left"],c8e=["top","bottom"],u8e=["bottom","top"];function d8e(e,t,n){switch(e){case"top":case"bottom":return n?t?Gz:Vz:t?Vz:Gz;case"left":case"right":return t?c8e:u8e;default:return[]}}function h8e(e,t,n,s){const r=Kb(e);let i=d8e(Sm(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(mj)))),i}function I4(e){const t=Sm(e);return o8e[t]+e.slice(t.length)}function f8e(e){var t,n,s,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(s=e.bottom)!=null?s:0,left:(r=e.left)!=null?r:0}}function nee(e){return typeof e!="number"?f8e(e):{top:e,right:e,bottom:e,left:e}}function R4(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function Kz(e,t,n){let{reference:s,floating:r}=e;const i=ed(t),o=RI(t),a=II(o),c=Sm(t),u=i==="y",d=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,m=s[a]/2-r[a]/2;let p;switch(c){case"top":p={x:d,y:s.y-r.height};break;case"bottom":p={x:d,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:h};break;case"left":p={x:s.x-r.width,y:h};break;default:p={x:s.x,y:s.y}}const g=Kb(t);return g&&(p[o]+=m*(g==="end"?1:-1)*(n&&u?-1:1)),p}async function m8e(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:p=0}=Bh(t,e),g=nee(p),x=a[m?h==="floating"?"reference":"floating":h],y=R4(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),v=h==="floating"?{x:s,y:r,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),k=await(i.isElement==null?void 0:i.isElement(w))&&await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1},T=R4(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:c}):v);return{top:(y.top-T.top+g.top)/k.y,bottom:(T.bottom-y.bottom+g.bottom)/k.y,left:(y.left-T.left+g.left)/k.x,right:(T.right-y.right+g.right)/k.x}}const p8e=50,g8e=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:m8e},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:h}=Kz(u,s,c),m=s,p=0;const g={};for(let b=0;b<i.length;b++){const x=i[b];if(!x)continue;const{name:y,fn:v}=x,{x:w,y:k,data:T,reset:C}=await v({x:d,y:h,initialPlacement:s,placement:m,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,h=k??h,g[y]={...g[y],...T},C&&p<p8e&&(p++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(u=C.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:d,y:h}=Kz(u,m,c)),b=-1)}return{x:d,y:h,placement:m,strategy:r,middlewareData:g}},b8e=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Bh(e,t)||{};if(u==null)return{};const h=nee(d),m={x:n,y:s},p=RI(r),g=II(p),b=await o.getDimensions(u),x=p==="y",y=x?"top":"left",v=x?"bottom":"right",w=x?"clientHeight":"clientWidth",k=i.reference[g]+i.reference[p]-m[p]-i.floating[g],T=m[p]-i.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let _=C?C[w]:0;(!_||!await(o.isElement==null?void 0:o.isElement(C)))&&(_=a.floating[w]||i.floating[g]);const S=k/2-T/2,D=_/2-b[g]/2-1,E=_m(h[y],D),B=_m(h[v],D),I=_-b[g]-B,L=_/2-b[g]/2+S,O=tee(E,L,I),A=!c.arrow&&Kb(r)!=null&&L!==O&&i.reference[g]/2-(L<E?E:B)-b[g]/2<0,$=A?L<E?L-E:L-I:0;return{[p]:m[p]+$,data:{[p]:O,centerOffset:L-O-$,...A&&{alignmentOffset:$}},reset:A}}}),y8e=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...x}=Bh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Sm(r),v=ed(a),w=Sm(a)===a,k=await(c.isRTL==null?void 0:c.isRTL(u.floating)),T=m||(w||!b?[I4(a)]:l8e(a)),C=g!=="none";!m&&C&&T.push(...h8e(a,b,g,k));const _=[a,...T],S=await c.detectOverflow(t,x),D=[];let E=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&D.push(S[y]),h){const O=a8e(r,o,k);D.push(S[O[0]],S[O[1]])}if(E=[...E,{placement:r,overflows:D}],!D.every(O=>O<=0)){var B,I;const O=(((B=i.flip)==null?void 0:B.index)||0)+1,A=_[O];if(A&&(!(h==="alignment"?v!==ed(A):!1)||E.every(U=>ed(U.placement)===v?U.overflows[0]>0:!0)))return{data:{index:O,overflows:E},reset:{placement:A}};let $=(I=E.filter(q=>q.overflows[0]<=0).sort((q,U)=>q.overflows[1]-U.overflows[1])[0])==null?void 0:I.placement;if(!$)switch(p){case"bestFit":{var L;const q=(L=E.filter(U=>{if(C){const H=ed(U.placement);return H===v||H==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(H=>H>0).reduce((H,M)=>H+M,0)]).sort((U,H)=>U[1]-H[1])[0])==null?void 0:L[0];q&&($=q);break}case"initialPlacement":$=a;break}if(r!==$)return{reset:{placement:$}}}return{}}}};function Yz(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Xz(e){return i8e.some(t=>e[t]>=0)}const v8e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...i}=Bh(e,t);switch(r){case"referenceHidden":{const o=await s.detectOverflow(t,{...i,elementContext:"reference"}),a=Yz(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Xz(a)}}}case"escaped":{const o=await s.detectOverflow(t,{...i,altBoundary:!0}),a=Yz(o,n.floating);return{data:{escapedOffsets:a,escaped:Xz(a)}}}default:return{}}}}},see=new Set(["left","top"]);async function x8e(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=Sm(n),a=Kb(n),c=ed(n)==="y",u=see.has(o)?-1:1,d=i&&c?-1:1,h=Bh(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const w8e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:i,placement:o,middlewareData:a}=t,c=await x8e(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:o}}}}},k8e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:c={fn:v=>{let{x:w,y:k}=v;return{x:w,y:k}}},...u}=Bh(e,t),d={x:n,y:s},h=await i.detectOverflow(t,u),m=ed(r),p=MI(m);let g=d[p],b=d[m];const x=(v,w)=>tee(w+h[v==="y"?"top":"left"],w,w-h[v==="y"?"bottom":"right"]);o&&(g=x(p,g)),a&&(b=x(m,b));const y=c.fn({...t,[p]:g,[m]:b});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[p]:o,[m]:a}}}}}},_8e=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:i,placement:o,rects:a,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=Bh(e,t),m={x:r,y:i},p=ed(o),g=MI(p);let b=m[g],x=m[p];const y=Bh(u,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(d){const T=g==="y"?"height":"width",C=a.reference[g]-a.floating[T]+v.mainAxis,_=a.reference[g]+a.reference[T]-v.mainAxis;b<C?b=C:b>_&&(b=_)}if(h){var w,k;const T=g==="y"?"width":"height",C=see.has(Sm(o)),_=a.reference[p]-a.floating[T]+(C&&((w=c.offset)==null?void 0:w[p])||0)+(C?0:v.crossAxis),S=a.reference[p]+a.reference[T]+(C?0:((k=c.offset)==null?void 0:k[p])||0)-(C?v.crossAxis:0);x<_?x=_:x>S&&(x=S)}return{[g]:b,[p]:x}}}},S8e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:s,platform:r,elements:i}=t,{apply:o=()=>{},...a}=Bh(e,t),c=await r.detectOverflow(t,a),u=Sm(n),d=Kb(n),h=ed(n)==="y",{width:m,height:p}=s.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(r.isRTL==null?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const x=p-c.top-c.bottom,y=m-c.left-c.right,v=_m(p-c[g],x),w=_m(m-c[b],y),k=t.middlewareData.shift,T=!k;let C=v,_=w;k!=null&&k.enabled.x&&(_=y),k!=null&&k.enabled.y&&(C=x),T&&!d&&(h?_=m-2*Sh(c.left,c.right):C=p-2*Sh(c.top,c.bottom)),await o({...t,availableWidth:_,availableHeight:C});const S=await r.getDimensions(i.floating);return m!==S.width||p!==S.height?{reset:{rects:!0}}:{}}}};function VC(){return typeof window<"u"}function Yb(e){return ree(e)?(e.nodeName||"").toLowerCase():"#document"}function wl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yh(e){var t;return(t=(ree(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ree(e){return VC()?e instanceof Node||e instanceof wl(e).Node:!1}function md(e){return VC()?e instanceof Element||e instanceof wl(e).Element:!1}function qm(e){return VC()?e instanceof HTMLElement||e instanceof wl(e).HTMLElement:!1}function Qz(e){return!VC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wl(e).ShadowRoot}function GC(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=pd(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function C8e(e){return/^(table|td|th)$/.test(Yb(e))}function KC(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const T8e=/transform|translate|scale|rotate|perspective|filter/,E8e=/paint|layout|strict|content/,kp=e=>!!e&&e!=="none";let C8;function DI(e){const t=md(e)?pd(e):e;return kp(t.transform)||kp(t.translate)||kp(t.scale)||kp(t.rotate)||kp(t.perspective)||!LI()&&(kp(t.backdropFilter)||kp(t.filter))||T8e.test(t.willChange||"")||E8e.test(t.contain||"")}function A8e(e){let t=p0(e);for(;qm(t)&&!Lx(t);){if(DI(t))return t;if(KC(t))return null;t=p0(t)}return null}function LI(){return C8==null&&(C8=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),C8}function Lx(e){return/^(html|body|#document)$/.test(Yb(e))}function pd(e){return wl(e).getComputedStyle(e)}function YC(e){return md(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function p0(e){if(Yb(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qz(e)&&e.host||Yh(e);return Qz(t)?t.host:t}function iee(e){const t=p0(e);return Lx(t)?(e.ownerDocument||e).body:qm(t)&&GC(t)?t:iee(t)}function Px(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=iee(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),o=wl(r);if(i){const a=pj(o);return t.concat(o,o.visualViewport||[],GC(r)?r:[],a&&n?Px(a):[])}else return t.concat(r,Px(r,[],n))}function pj(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oee(e){const t=pd(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=qm(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,a=M4(n)!==i||M4(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function PI(e){return md(e)?e:e.contextElement}function D1(e){const t=PI(e);if(!qm(t))return Ch(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=oee(t);let o=(i?M4(n.width):n.width)/s,a=(i?M4(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const j8e=Ch(0);function aee(e){const t=wl(e);return!LI()||!t.visualViewport?j8e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function N8e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===wl(e)}function g0(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=PI(e);let o=Ch(1);t&&(s?md(s)&&(o=D1(s)):o=D1(e));const a=N8e(i,n,s)?aee(i):Ch(0);let c=(r.left+a.x)/o.x,u=(r.top+a.y)/o.y,d=r.width/o.x,h=r.height/o.y;if(i&&s){const m=wl(i),p=md(s)?wl(s):s;let g=m,b=pj(g);for(;b&&p!==g;){const x=D1(b),y=b.getBoundingClientRect(),v=pd(b),w=y.left+(b.clientLeft+parseFloat(v.paddingLeft))*x.x,k=y.top+(b.clientTop+parseFloat(v.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,h*=x.y,c+=w,u+=k,g=wl(b),b=pj(g)}}return R4({width:d,height:h,x:c,y:u})}function XC(e,t){const n=YC(e).scrollLeft;return t?t.left+n:g0(Yh(e)).left+n}function lee(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-XC(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function M8e(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=Yh(s),a=t?KC(t.floating):!1;if(s===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Ch(1);const d=Ch(0),h=qm(s);if((h||!i)&&((Yb(s)!=="body"||GC(o))&&(c=YC(s)),h)){const p=g0(s);u=D1(s),d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}const m=o&&!h&&!i?lee(o,c):Ch(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 I8e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function R8e(e){const t=YC(e),n=e.ownerDocument.body,s=Sh(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Sh(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+XC(e);const o=-t.scrollTop;return pd(n).direction==="rtl"&&(i+=Sh(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:o}}const D8e=25;function L8e(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=wl(e),i=Yh(e),o=r.visualViewport;let a=i.clientWidth,c=i.clientHeight,u=0,d=0;if(o){const m=!LI()||t==="fixed";s?m||(u=-o.offsetLeft,d=-o.offsetTop):(a=o.width,c=o.height,m&&(u=o.offsetLeft,d=o.offsetTop))}if(XC(i)<=0){const m=i.ownerDocument,p=m.body,g=getComputedStyle(p),b=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(i.clientWidth-p.clientWidth-b),y=getComputedStyle(i).scrollbarGutter==="stable both-edges"?x/2:x;y<=D8e&&(a-=y)}return{width:a,height:c,x:u,y:d}}function P8e(e,t){const n=g0(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=D1(e),o=e.clientWidth*i.x,a=e.clientHeight*i.y,c=r*i.x,u=s*i.y;return{width:o,height:a,x:c,y:u}}function Jz(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=L8e(e,n,t);else if(t==="document")s=R8e(Yh(e));else if(md(t))s=P8e(t,n);else{const r=aee(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return R4(s)}function O8e(e,t){const n=t.get(e);if(n)return n;let s=Px(e,[],!1).filter(a=>md(a)&&Yb(a)!=="body"),r=null;const i=pd(e).position==="fixed";let o=i?p0(e):e;for(;md(o)&&!Lx(o);){const a=pd(o),c=DI(o),u=r?r.position:i?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&a.position==="static")?s=s.filter(h=>h!==o):r=a,o=p0(o)}return t.set(e,s),s}function $8e(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?KC(t)?[]:O8e(t,this._c):[].concat(n),s],a=Jz(t,o[0],r);let c=a.top,u=a.right,d=a.bottom,h=a.left;for(let m=1;m<o.length;m++){const p=Jz(t,o[m],r);c=Sh(p.top,c),u=_m(p.right,u),d=_m(p.bottom,d),h=Sh(p.left,h)}return{width:u-h,height:d-c,x:h,y:c}}function B8e(e){const{width:t,height:n}=oee(e);return{width:t,height:n}}function z8e(e,t,n){const s=qm(t),r=Yh(t),i=n==="fixed",o=g0(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Ch(0);if((s||!i)&&((Yb(t)!=="body"||GC(r))&&(a=YC(t)),s)){const m=g0(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}!s&&r&&(c.x=XC(r));const u=r&&!s&&!i?lee(r,a):Ch(0),d=o.left+a.scrollLeft-c.x-u.x,h=o.top+a.scrollTop-c.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function T8(e){return pd(e).position==="static"}function Zz(e,t){if(!qm(e)||pd(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Yh(e)===n&&(n=n.ownerDocument.body),n}function cee(e,t){const n=wl(e);if(KC(e))return n;if(!qm(e)){let r=p0(e);for(;r&&!Lx(r);){if(md(r)&&!T8(r))return r;r=p0(r)}return n}let s=Zz(e,t);for(;s&&C8e(s)&&T8(s);)s=Zz(s,t);return s&&Lx(s)&&T8(s)&&!DI(s)?n:s||A8e(e)||n}const F8e=async function(e){const t=this.getOffsetParent||cee,n=this.getDimensions,s=await n(e.floating);return{reference:z8e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function H8e(e){return pd(e).direction==="rtl"}const q8e={convertOffsetParentRelativeRectToViewportRelativeRect:M8e,getDocumentElement:Yh,getClippingRect:$8e,getOffsetParent:cee,getElementRects:F8e,getClientRects:I8e,getDimensions:B8e,getScale:D1,isElement:md,isRTL:H8e};function uee(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function U8e(e,t,n){let s=null,r;const i=Yh(e);function o(){var d;clearTimeout(r),(d=s)==null||d.disconnect(),s=null}function a(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),o();const m=e.getBoundingClientRect(),{left:p,top:g,width:b,height:x}=m;if(d||t(),!b||!x)return;const y=I_(g),v=I_(i.clientWidth-(p+b)),w=I_(i.clientHeight-(g+x)),k=I_(p),C={rootMargin:-y+"px "+-v+"px "+-w+"px "+-k+"px",threshold:Sh(0,_m(1,h))||1};let _=!0;function S(D){const E=D[0].intersectionRatio;if(!uee(m,e.getBoundingClientRect()))return a();if(E!==h){if(!_)return a();E?a(!1,E):r=setTimeout(()=>{a(!1,1e-7)},1e3)}_=!1}try{s=new IntersectionObserver(S,{...C,root:i.ownerDocument})}catch{s=new IntersectionObserver(S,C)}s.observe(e)}const c=wl(e),u=()=>a(n);return c.addEventListener("resize",u),a(!0),()=>{c.removeEventListener("resize",u),o()}}function W8e(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=PI(e),d=r||i?[...u?Px(u):[],...t?Px(t):[]]:[];d.forEach(y=>{r&&y.addEventListener("scroll",n),i&&y.addEventListener("resize",n)});const h=u&&a?U8e(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 w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),t&&p.observe(t));let g,b=c?g0(e):null;c&&x();function x(){const y=g0(e);b&&!uee(b,y)&&n(),b=y,g=requestAnimationFrame(x)}return n(),()=>{var y;d.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),h==null||h(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const V8e=w8e,G8e=k8e,K8e=y8e,Y8e=S8e,X8e=v8e,eF=b8e,Q8e=_8e,J8e=(e,t,n)=>{const s=new Map,r=n??{},i={...q8e,...r.platform,_c:s};return g8e(e,t,{...r,platform:i})};var Z8e=typeof document<"u",e7e=function(){},eS=Z8e?f.useLayoutEffect:e7e;function D4(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,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!D4(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!D4(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function dee(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tF(e,t){const n=dee(e);return Math.round(t*n)/n}function E8(e){const t=f.useRef(e);return eS(()=>{t.current=e}),t}function t7e(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,h]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=f.useState(s);D4(m,s)||p(s);const[g,b]=f.useState(null),[x,y]=f.useState(null),v=f.useCallback(U=>{U!==C.current&&(C.current=U,b(U))},[]),w=f.useCallback(U=>{U!==_.current&&(_.current=U,y(U))},[]),k=i||g,T=o||x,C=f.useRef(null),_=f.useRef(null),S=f.useRef(d),D=c!=null,E=E8(c),B=E8(r),I=E8(u),L=f.useCallback(()=>{if(!C.current||!_.current)return;const U={placement:t,strategy:n,middleware:m};B.current&&(U.platform=B.current),J8e(C.current,_.current,U).then(H=>{const M={...H,isPositioned:I.current!==!1};O.current&&!D4(S.current,M)&&(S.current=M,hu.flushSync(()=>{h(M)}))})},[m,t,n,B,I]);eS(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,h(U=>({...U,isPositioned:!1})))},[u]);const O=f.useRef(!1);eS(()=>(O.current=!0,()=>{O.current=!1}),[]),eS(()=>{if(k&&(C.current=k),T&&(_.current=T),k&&T){if(E.current)return E.current(k,T,L);L()}},[k,T,L,E,D]);const A=f.useMemo(()=>({reference:C,floating:_,setReference:v,setFloating:w}),[v,w]),$=f.useMemo(()=>({reference:k,floating:T}),[k,T]),q=f.useMemo(()=>{const U={position:n,left:0,top:0};if(!$.floating)return U;const H=tF($.floating,d.x),M=tF($.floating,d.y);return a?{...U,transform:"translate("+H+"px, "+M+"px)",...dee($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:M}},[n,a,$.floating,d.x,d.y]);return f.useMemo(()=>({...d,update:L,refs:A,elements:$,floatingStyles:q}),[d,L,A,$,q])}const n7e=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:r}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?eF({element:s.current,padding:r}).fn(n):{}:s?eF({element:s,padding:r}).fn(n):{}}}},s7e=(e,t)=>{const n=V8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},r7e=(e,t)=>{const n=G8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},i7e=(e,t)=>({fn:Q8e(e).fn,options:[e,t]}),o7e=(e,t)=>{const n=K8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},a7e=(e,t)=>{const n=Y8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},l7e=(e,t)=>{const n=X8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},c7e=(e,t)=>{const n=n7e(e);return{name:n.name,fn:n.fn,options:[e,t]}};var u7e="Arrow",hee=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...i}=e;return l.jsx(Un.svg,{...i,ref:t,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});hee.displayName=u7e;var d7e=hee,OI="Popper",[fee,Um]=ka(OI),[h7e,mee]=fee(OI),pee=e=>{const{__scopePopper:t,children:n}=e,[s,r]=f.useState(null),[i,o]=f.useState(void 0);return l.jsx(h7e,{scope:t,anchor:s,onAnchorChange:r,placementState:i,setPlacementState:o,children:n})};pee.displayName=OI;var gee="PopperAnchor",bee=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,i=mee(gee,n),o=f.useRef(null),a=i.onAnchorChange,c=f.useCallback(g=>{o.current=g,g&&a(g)},[a]),u=Es(t,c),d=f.useRef(null);f.useEffect(()=>{if(!s)return;const g=d.current;d.current=s.current,g!==d.current&&a(d.current)});const h=i.placementState&&BI(i.placementState),m=h==null?void 0:h[0],p=h==null?void 0:h[1];return s?null:l.jsx(Un.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...r,ref:u})});bee.displayName=gee;var $I="PopperContent",[f7e,m7e]=fee($I),yee=f.forwardRef((e,t)=>{var ae,le,te,z,X,fe;const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...b}=e,x=mee($I,n),[y,v]=f.useState(null),w=Es(t,v),[k,T]=f.useState(null),C=UC(k),_=(C==null?void 0:C.width)??0,S=(C==null?void 0:C.height)??0,D=s+(i!=="center"?"-"+i:""),E=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},B=Array.isArray(u)?u:[u],I=B.length>0,L={padding:E,boundary:B.filter(g7e),altBoundary:I},{refs:O,floatingStyles:A,placement:$,isPositioned:q,middlewareData:U}=t7e({strategy:"fixed",placement:D,whileElementsMounted:(...xe)=>W8e(...xe,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[s7e({mainAxis:r+S,alignmentAxis:o}),c&&r7e({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?i7e():void 0,...L}),c&&o7e({...L}),a7e({...L,apply:({elements:xe,rects:ie,availableWidth:Ce,availableHeight:Ke})=>{const{width:ut,height:Et}=ie.reference,st=xe.floating.style;st.setProperty("--radix-popper-available-width",`${Ce}px`),st.setProperty("--radix-popper-available-height",`${Ke}px`),st.setProperty("--radix-popper-anchor-width",`${ut}px`),st.setProperty("--radix-popper-anchor-height",`${Et}px`)}}),k&&c7e({element:k,padding:a}),b7e({arrowWidth:_,arrowHeight:S}),m&&l7e({strategy:"referenceHidden",...L,boundary:I?L.boundary:void 0})]}),H=x.setPlacementState;Wo(()=>(H($),()=>{H(void 0)}),[$,H]);const[M,ee]=BI($),V=lc(g);Wo(()=>{q&&(V==null||V())},[q,V]);const R=(ae=U.arrow)==null?void 0:ae.x,re=(le=U.arrow)==null?void 0:le.y,Z=((te=U.arrow)==null?void 0:te.centerOffset)!==0,[K,Y]=f.useState();return Wo(()=>{y&&Y(window.getComputedStyle(y).zIndex)},[y]),l.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...A,transform:q?A.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[(z=U.transformOrigin)==null?void 0:z.x,(X=U.transformOrigin)==null?void 0:X.y].join(" "),...((fe=U.hide)==null?void 0:fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(f7e,{scope:n,placedSide:M,placedAlign:ee,onArrowChange:T,arrowX:R,arrowY:re,shouldHideArrow:Z,children:l.jsx(Un.div,{"data-side":M,"data-align":ee,...b,ref:w,style:{...b.style,animation:q?void 0:"none"}})})})});yee.displayName=$I;var vee="PopperArrow",p7e={top:"bottom",right:"left",bottom:"top",left:"right"},xee=f.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,i=m7e(vee,s),o=p7e[i.placedSide];return l.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:l.jsx(d7e,{...r,ref:n,style:{...r.style,display:"block"}})})});xee.displayName=vee;function g7e(e){return e!==null}var b7e=e=>({name:"transformOrigin",options:e,fn(t){var x,y,v;const{placement:n,rects:s,middlewareData:r}=t,o=((x=r.arrow)==null?void 0:x.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=BI(n),h={start:"0%",center:"50%",end:"100%"}[d],m=(((y=r.arrow)==null?void 0:y.x)??0)+a/2,p=(((v=r.arrow)==null?void 0:v.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=o?h:`${m}px`,b=`${-c}px`):u==="top"?(g=o?h:`${m}px`,b=`${s.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=o?h:`${p}px`):u==="left"&&(g=`${s.floating.width+c}px`,b=o?h:`${p}px`),{data:{x:g,y:b}}}});function BI(e){const[t,n="center"]=e.split("-");return[t,n]}var Ow=pee,$w=bee,QC=yee,JC=xee,A8=!1;function y7e(){const[e,t]=f.useState(A8);return f.useEffect(()=>{A8||(A8=!0,t(!0))},[]),e}var wee=P3[" useSyncExternalStore ".trim().toString()];function v7e(){return()=>{}}function x7e(){return wee(v7e,()=>!0,()=>!1)}var w7e=typeof wee=="function"?x7e:y7e,j8="rovingFocusGroup.onEntryFocus",k7e={bubbles:!1,cancelable:!0},Bw="RovingFocusGroup",[gj,kee,_7e]=CI(Bw),[S7e,Wm]=ka(Bw,[_7e]),[C7e,T7e]=S7e(Bw),_ee=f.forwardRef((e,t)=>l.jsx(gj.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(gj.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(E7e,{...e,ref:t})})}));_ee.displayName=Bw;var E7e=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:r=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,m=f.useRef(null),p=Es(t,m),g=Ub(i),[b,x]=Va({prop:o,defaultProp:a??null,onChange:c,caller:Bw}),[y,v]=f.useState(!1),w=lc(u),k=kee(n),T=f.useRef(!1),[C,_]=f.useState(0);return f.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(j8,w),()=>S.removeEventListener(j8,w)},[w]),l.jsx(C7e,{scope:n,orientation:s,dir:g,loop:r,currentTabStopId:b,onItemFocus:f.useCallback(S=>x(S),[x]),onItemShiftTab:f.useCallback(()=>v(!0),[]),onFocusableItemAdd:f.useCallback(()=>_(S=>S+1),[]),onFocusableItemRemove:f.useCallback(()=>_(S=>S-1),[]),children:l.jsx(Un.div,{tabIndex:y||C===0?-1:0,"data-orientation":s,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:en(e.onMouseDown,()=>{T.current=!0}),onFocus:en(e.onFocus,S=>{const D=!T.current;if(S.target===S.currentTarget&&D&&!y){const E=new CustomEvent(j8,k7e);if(S.currentTarget.dispatchEvent(E),!E.defaultPrevented){const B=k().filter($=>$.focusable),I=B.find($=>$.active),L=B.find($=>$.id===b),A=[I,L,...B].filter(Boolean).map($=>$.ref.current);Tee(A,d)}}T.current=!1}),onBlur:en(e.onBlur,()=>v(!1))})})}),See="RovingFocusGroupItem",Cee=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:r=!1,tabStopId:i,children:o,...a}=e,c=xl(),u=i||c,d=T7e(See,n),h=d.currentTabStopId===u,m=kee(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:b}=d,x=w7e();return Wo(()=>{if(!(!x||!s))return p(),()=>g()},[x,s,p,g]),f.useEffect(()=>{if(!(x||!s))return p(),()=>g()},[x,s,p,g]),l.jsx(gj.ItemSlot,{scope:n,id:u,focusable:s,active:r,children:l.jsx(Un.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:en(e.onMouseDown,y=>{s?d.onItemFocus(u):y.preventDefault()}),onFocus:en(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:en(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=N7e(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(T=>T.focusable).map(T=>T.ref.current);if(v==="last")k.reverse();else if(v==="prev"||v==="next"){v==="prev"&&k.reverse();const T=k.indexOf(y.currentTarget);k=d.loop?M7e(k,T+1):k.slice(T+1)}setTimeout(()=>Tee(k))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:b!=null}):o})})});Cee.displayName=See;var A7e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function j7e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function N7e(e,t,n){const s=j7e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return A7e[s]}function Tee(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function M7e(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var ZC=_ee,eT=Cee,bj=["Enter"," "],I7e=["ArrowDown","PageUp","Home"],Eee=["ArrowUp","PageDown","End"],R7e=[...I7e,...Eee],D7e={ltr:[...bj,"ArrowRight"],rtl:[...bj,"ArrowLeft"]},L7e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zw="Menu",[Ox,P7e,O7e]=CI(zw),[W0,Aee]=ka(zw,[O7e,Um,Wm]),Fw=Um(),jee=Wm(),[Nee,Vm]=W0(zw),[$7e,Hw]=W0(zw),Mee=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:r,onOpenChange:i,modal:o=!0}=e,a=Fw(t),[c,u]=f.useState(null),d=f.useRef(!1),h=lc(i),m=Ub(r);return f.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})}},[]),f.useEffect(()=>{if(!n)return;const p=()=>h(!1);return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[n,h]),l.jsx(Ow,{...a,children:l.jsx(Nee,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:u,children:l.jsx($7e,{scope:t,onClose:f.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:m,modal:o,children:s})})})};Mee.displayName=zw;var B7e="MenuAnchor",zI=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=Fw(n);return l.jsx($w,{...r,...s,ref:t})});zI.displayName=B7e;var FI="MenuPortal",[z7e,Iee]=W0(FI,{forceMount:void 0}),Ree=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:r}=e,i=Vm(FI,t);return l.jsx(z7e,{scope:t,forceMount:n,children:l.jsx(_a,{present:n||i.open,children:l.jsx(Vb,{asChild:!0,container:r,children:s})})})};Ree.displayName=FI;var $c="MenuContent",[F7e,HI]=W0($c),Dee=f.forwardRef((e,t)=>{const n=Iee($c,e.__scopeMenu),{forceMount:s=n.forceMount,...r}=e,i=Vm($c,e.__scopeMenu),o=Hw($c,e.__scopeMenu);return l.jsx(Ox.Provider,{scope:e.__scopeMenu,children:l.jsx(_a,{present:s||i.open,children:l.jsx(Ox.Slot,{scope:e.__scopeMenu,children:o.modal?l.jsx(H7e,{...r,ref:t}):l.jsx(q7e,{...r,ref:t})})})})}),H7e=f.forwardRef((e,t)=>{const n=Vm($c,e.__scopeMenu),s=f.useRef(null),r=Es(t,s);return f.useEffect(()=>{const i=s.current;if(i)return PC(i)},[]),l.jsx(qI,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:en(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),q7e=f.forwardRef((e,t)=>{const n=Vm($c,e.__scopeMenu);return l.jsx(qI,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),U7e=km("MenuContent.ScrollLock"),qI=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:p,disableOutsideScroll:g,...b}=e,x=Vm($c,n),y=Hw($c,n),v=Fw(n),w=jee(n),k=P7e(n),[T,C]=f.useState(null),_=f.useRef(null),S=Es(t,_,x.onContentChange),D=f.useRef(0),E=f.useRef(""),B=f.useRef(0),I=f.useRef(null),L=f.useRef("right"),O=f.useRef(0),A=g?Pw:f.Fragment,$=g?{as:U7e,allowPinchZoom:!0}:void 0,q=H=>{var Y,ae;const M=E.current+H,ee=k().filter(le=>!le.disabled),V=document.activeElement,R=(Y=ee.find(le=>le.ref.current===V))==null?void 0:Y.textValue,re=ee.map(le=>le.textValue),Z=nEe(re,M,R),K=(ae=ee.find(le=>le.textValue===Z))==null?void 0:ae.ref.current;(function le(te){E.current=te,window.clearTimeout(D.current),te!==""&&(D.current=window.setTimeout(()=>le(""),1e3))})(M),K&&setTimeout(()=>K.focus())};f.useEffect(()=>()=>window.clearTimeout(D.current),[]),DC();const U=f.useCallback(H=>{var ee,V;return L.current===((ee=I.current)==null?void 0:ee.side)&&rEe(H,(V=I.current)==null?void 0:V.area)},[]);return l.jsx(F7e,{scope:n,searchRef:E,onItemEnter:f.useCallback(H=>{U(H)&&H.preventDefault()},[U]),onItemLeave:f.useCallback(H=>{var M;U(H)||((M=_.current)==null||M.focus(),C(null))},[U]),onTriggerLeave:f.useCallback(H=>{U(H)&&H.preventDefault()},[U]),pointerGraceTimerRef:B,onPointerGraceIntentChange:f.useCallback(H=>{I.current=H},[]),children:l.jsx(A,{...$,children:l.jsx(Lw,{asChild:!0,trapped:r,onMountAutoFocus:en(i,H=>{var M;H.preventDefault(),(M=_.current)==null||M.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:l.jsx(Wb,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:p,children:l.jsx(ZC,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:s,currentTabStopId:T,onCurrentTabStopIdChange:C,onEntryFocus:en(c,H=>{y.isUsingKeyboardRef.current||H.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(QC,{role:"menu","aria-orientation":"vertical","data-state":Qee(x.open),"data-radix-menu-content":"",dir:y.dir,...v,...b,ref:S,style:{outline:"none",...b.style},onKeyDown:en(b.onKeyDown,H=>{const ee=H.target.closest("[data-radix-menu-content]")===H.currentTarget,V=H.ctrlKey||H.altKey||H.metaKey,R=H.key.length===1;ee&&(H.key==="Tab"&&H.preventDefault(),!V&&R&&q(H.key));const re=_.current;if(H.target!==re||!R7e.includes(H.key))return;H.preventDefault();const K=k().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);Eee.includes(H.key)&&K.reverse(),eEe(K)}),onBlur:en(e.onBlur,H=>{H.currentTarget.contains(H.target)||(window.clearTimeout(D.current),E.current="")}),onPointerMove:en(e.onPointerMove,$x(H=>{const M=H.target,ee=O.current!==H.clientX;if(H.currentTarget.contains(M)&&ee){const V=H.clientX>O.current?"right":"left";L.current=V,O.current=H.clientX}}))})})})})})})});Dee.displayName=$c;var W7e="MenuGroup",UI=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Un.div,{role:"group",...s,ref:t})});UI.displayName=W7e;var V7e="MenuLabel",Lee=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Un.div,{...s,ref:t})});Lee.displayName=V7e;var L4="MenuItem",nF="menu.itemSelect",tT=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...r}=e,i=f.useRef(null),o=Hw(L4,e.__scopeMenu),a=HI(L4,e.__scopeMenu),c=Es(t,i),u=f.useRef(!1),d=()=>{const h=i.current;if(!n&&h){const m=new CustomEvent(nF,{bubbles:!0,cancelable:!0});h.addEventListener(nF,p=>s==null?void 0:s(p),{once:!0}),mZ(h,m),m.defaultPrevented?u.current=!1:o.onClose()}};return l.jsx(Pee,{...r,ref:c,disabled:n,onClick:en(e.onClick,d),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),u.current=!0},onPointerUp:en(e.onPointerUp,h=>{var m;u.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:en(e.onKeyDown,h=>{n||h.target!==h.currentTarget||a.searchRef.current!==""&&h.key===" "||bj.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});tT.displayName=L4;var Pee=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:r,...i}=e,o=HI(L4,n),a=jee(n),c=f.useRef(null),u=Es(t,c),[d,h]=f.useState(!1),[m,p]=f.useState("");return f.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),l.jsx(Ox.ItemSlot,{scope:n,disabled:s,textValue:r??m,children:l.jsx(eT,{asChild:!0,...a,focusable:!s,children:l.jsx(Un.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...i,ref:u,onPointerMove:en(e.onPointerMove,$x(g=>{s?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:en(e.onPointerLeave,$x(g=>o.onItemLeave(g))),onFocus:en(e.onFocus,()=>h(!0)),onBlur:en(e.onBlur,()=>h(!1))})})})}),G7e="MenuCheckboxItem",Oee=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...r}=e;return l.jsx(Hee,{scope:e.__scopeMenu,checked:n,children:l.jsx(tT,{role:"menuitemcheckbox","aria-checked":P4(n)?"mixed":n,...r,ref:t,"data-state":GI(n),onSelect:en(r.onSelect,()=>s==null?void 0:s(P4(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Oee.displayName=G7e;var $ee="MenuRadioGroup",[K7e,Y7e]=W0($ee,{value:void 0,onValueChange:()=>{}}),Bee=f.forwardRef((e,t)=>{const{value:n,onValueChange:s,...r}=e,i=lc(s);return l.jsx(K7e,{scope:e.__scopeMenu,value:n,onValueChange:i,children:l.jsx(UI,{...r,ref:t})})});Bee.displayName=$ee;var zee="MenuRadioItem",Fee=f.forwardRef((e,t)=>{const{value:n,...s}=e,r=Y7e(zee,e.__scopeMenu),i=n===r.value;return l.jsx(Hee,{scope:e.__scopeMenu,checked:i,children:l.jsx(tT,{role:"menuitemradio","aria-checked":i,...s,ref:t,"data-state":GI(i),onSelect:en(s.onSelect,()=>{var o;return(o=r.onValueChange)==null?void 0:o.call(r,n)},{checkForDefaultPrevented:!1})})})});Fee.displayName=zee;var WI="MenuItemIndicator",[Hee,X7e]=W0(WI,{checked:!1}),qee=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...r}=e,i=X7e(WI,n);return l.jsx(_a,{present:s||P4(i.checked)||i.checked===!0,children:l.jsx(Un.span,{...r,ref:t,"data-state":GI(i.checked)})})});qee.displayName=WI;var Q7e="MenuSeparator",Uee=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Un.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});Uee.displayName=Q7e;var J7e="MenuArrow",Wee=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=Fw(n);return l.jsx(JC,{...r,...s,ref:t})});Wee.displayName=J7e;var VI="MenuSub",[Z7e,Vee]=W0(VI),Gee=e=>{const{__scopeMenu:t,children:n,open:s=!1,onOpenChange:r}=e,i=Vm(VI,t),o=Fw(t),[a,c]=f.useState(null),[u,d]=f.useState(null),h=lc(r);return f.useEffect(()=>(i.open===!1&&h(!1),()=>h(!1)),[i.open,h]),l.jsx(Ow,{...o,children:l.jsx(Nee,{scope:t,open:s,onOpenChange:h,content:u,onContentChange:d,children:l.jsx(Z7e,{scope:t,contentId:xl(),triggerId:xl(),trigger:a,onTriggerChange:c,children:n})})})};Gee.displayName=VI;var bv="MenuSubTrigger",Kee=f.forwardRef((e,t)=>{const n=Vm(bv,e.__scopeMenu),s=Hw(bv,e.__scopeMenu),r=Vee(bv,e.__scopeMenu),i=HI(bv,e.__scopeMenu),o=f.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=f.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);f.useEffect(()=>d,[d]),f.useEffect(()=>{const m=a.current;return()=>{window.clearTimeout(m),c(null)}},[a,c]);const h=Es(t,r.onTriggerChange);return l.jsx(zI,{asChild:!0,...u,children:l.jsx(Pee,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?r.contentId:void 0,"data-state":Qee(n.open),...e,ref:h,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:en(e.onPointerMove,$x(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:en(e.onPointerLeave,$x(m=>{var g,b;d();const p=(g=n.content)==null?void 0:g.getBoundingClientRect();if(p){const x=(b=n.content)==null?void 0:b.dataset.side,y=x==="right",v=y?-5:5,w=p[y?"left":"right"],k=p[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+v,y:m.clientY},{x:w,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x:w,y:p.bottom}],side:x}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:en(e.onKeyDown,m=>{var g;e.disabled||m.target!==m.currentTarget||i.searchRef.current!==""&&m.key===" "||D7e[s.dir].includes(m.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),m.preventDefault())})})})});Kee.displayName=bv;var Yee="MenuSubContent",Xee=f.forwardRef((e,t)=>{const n=Iee($c,e.__scopeMenu),{forceMount:s=n.forceMount,align:r="start",...i}=e,o=Vm($c,e.__scopeMenu),a=Hw($c,e.__scopeMenu),c=Vee(Yee,e.__scopeMenu),u=f.useRef(null),d=Es(t,u);return l.jsx(Ox.Provider,{scope:e.__scopeMenu,children:l.jsx(_a,{present:s||o.open,children:l.jsx(Ox.Slot,{scope:e.__scopeMenu,children:l.jsx(qI,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:d,align:r,side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var m;a.isUsingKeyboardRef.current&&((m=u.current)==null||m.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:en(e.onFocusOutside,h=>{h.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:en(e.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:en(e.onKeyDown,h=>{var g;const m=h.currentTarget.contains(h.target),p=L7e[a.dir].includes(h.key);m&&p&&(o.onOpenChange(!1),(g=c.trigger)==null||g.focus(),h.preventDefault())})})})})})});Xee.displayName=Yee;function Qee(e){return e?"open":"closed"}function P4(e){return e==="indeterminate"}function GI(e){return P4(e)?"indeterminate":e?"checked":"unchecked"}function eEe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function tEe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function nEe(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=tEe(e,Math.max(i,0));r.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function sEe(e,t){const{x:n,y:s}=e;let r=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],c=t[o],u=a.x,d=a.y,h=c.x,m=c.y;d>s!=m>s&&n<(h-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function rEe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return sEe(n,t)}function $x(e){return t=>t.pointerType==="mouse"?e(t):void 0}var iEe=Mee,oEe=zI,aEe=Ree,lEe=Dee,cEe=UI,uEe=Lee,dEe=tT,hEe=Oee,fEe=Bee,mEe=Fee,pEe=qee,gEe=Uee,bEe=Wee,yEe=Gee,vEe=Kee,xEe=Xee,nT="DropdownMenu",[wEe,B4t]=ka(nT,[Aee]),Sa=Aee(),[kEe,Jee]=wEe(nT),Zee=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:r,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,c=Sa(t),u=f.useRef(null),[d,h]=Va({prop:r,defaultProp:i??!1,onChange:o,caller:nT});return l.jsx(kEe,{scope:t,triggerId:xl(),triggerRef:u,contentId:xl(),open:d,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(m=>!m),[h]),modal:a,children:l.jsx(iEe,{...c,open:d,onOpenChange:h,dir:s,modal:a,children:n})})};Zee.displayName=nT;var ete="DropdownMenuTrigger",tte=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...r}=e,i=Jee(ete,n),o=Sa(n),a=Es(t,i.triggerRef);return l.jsx(oEe,{asChild:!0,...o,children:l.jsx(Un.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":s?"":void 0,disabled:s,...r,ref:a,onPointerDown:en(e.onPointerDown,c=>{!s&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:en(e.onKeyDown,c=>{s||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});tte.displayName=ete;var _Ee="DropdownMenuPortal",nte=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Sa(t);return l.jsx(aEe,{...s,...n})};nte.displayName=_Ee;var ste="DropdownMenuContent",rte=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Jee(ste,n),i=Sa(n),o=f.useRef(!1);return l.jsx(lEe,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...s,ref:t,onCloseAutoFocus:en(e.onCloseAutoFocus,a=>{var c;o.current||(c=r.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:en(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!r.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)"}})});rte.displayName=ste;var SEe="DropdownMenuGroup",ite=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(cEe,{...r,...s,ref:t})});ite.displayName=SEe;var CEe="DropdownMenuLabel",TEe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(uEe,{...r,...s,ref:t})});TEe.displayName=CEe;var EEe="DropdownMenuItem",ote=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(dEe,{...r,...s,ref:t})});ote.displayName=EEe;var AEe="DropdownMenuCheckboxItem",jEe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(hEe,{...r,...s,ref:t})});jEe.displayName=AEe;var NEe="DropdownMenuRadioGroup",ate=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(fEe,{...r,...s,ref:t})});ate.displayName=NEe;var MEe="DropdownMenuRadioItem",lte=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(mEe,{...r,...s,ref:t})});lte.displayName=MEe;var IEe="DropdownMenuItemIndicator",cte=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(pEe,{...r,...s,ref:t})});cte.displayName=IEe;var REe="DropdownMenuSeparator",ute=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(gEe,{...r,...s,ref:t})});ute.displayName=REe;var DEe="DropdownMenuArrow",LEe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(bEe,{...r,...s,ref:t})});LEe.displayName=DEe;var PEe=e=>{const{__scopeDropdownMenu:t,children:n,open:s,onOpenChange:r,defaultOpen:i}=e,o=Sa(t),[a,c]=Va({prop:s,defaultProp:i??!1,onChange:r,caller:"DropdownMenuSub"});return l.jsx(yEe,{...o,open:a,onOpenChange:c,children:n})},OEe="DropdownMenuSubTrigger",dte=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(vEe,{...r,...s,ref:t})});dte.displayName=OEe;var $Ee="DropdownMenuSubContent",hte=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Sa(n);return l.jsx(xEe,{...r,...s,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)"}})});hte.displayName=$Ee;var BEe=Zee,zEe=tte,FEe=nte,HEe=rte,qEe=ite,UEe=ote,WEe=ate,VEe=lte,GEe=cte,KEe=ute,YEe=PEe,XEe=dte,QEe=hte,JEe="Label",fte=f.forwardRef((e,t)=>l.jsx(Un.label,{...e,ref:t,onMouseDown:n=>{var r;n.target.closest("button, input, select, textarea")||((r=e.onMouseDown)==null||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));fte.displayName=JEe;var ZEe=fte;function sF(e,[t,n]){return Math.min(n,Math.max(t,e))}var sT="Popover",[mte,z4t]=ka(sT,[Um]),qw=Um(),[eAe,Gm]=mte(sT),pte=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!1}=e,a=qw(t),c=f.useRef(null),[u,d]=f.useState(!1),[h,m]=Va({prop:s,defaultProp:r??!1,onChange:i,caller:sT});return l.jsx(Ow,{...a,children:l.jsx(eAe,{scope:t,contentId:xl(),triggerRef:c,open:h,onOpenChange:m,onOpenToggle:f.useCallback(()=>m(p=>!p),[m]),hasCustomAnchor:u,onCustomAnchorAdd:f.useCallback(()=>d(!0),[]),onCustomAnchorRemove:f.useCallback(()=>d(!1),[]),modal:o,children:n})})};pte.displayName=sT;var gte="PopoverAnchor",bte=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Gm(gte,n),i=qw(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=r;return f.useEffect(()=>(o(),()=>a()),[o,a]),l.jsx($w,{...i,...s,ref:t})});bte.displayName=gte;var yte="PopoverTrigger",vte=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Gm(yte,n),i=qw(n),o=Es(t,r.triggerRef),a=l.jsx(Un.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":Ste(r.open),...s,ref:o,onClick:en(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?a:l.jsx($w,{asChild:!0,...i,children:a})});vte.displayName=yte;var KI="PopoverPortal",[tAe,nAe]=mte(KI,{forceMount:void 0}),xte=e=>{const{__scopePopover:t,forceMount:n,children:s,container:r}=e,i=Gm(KI,t);return l.jsx(tAe,{scope:t,forceMount:n,children:l.jsx(_a,{present:n||i.open,children:l.jsx(Vb,{asChild:!0,container:r,children:s})})})};xte.displayName=KI;var lb="PopoverContent",wte=f.forwardRef((e,t)=>{const n=nAe(lb,e.__scopePopover),{forceMount:s=n.forceMount,...r}=e,i=Gm(lb,e.__scopePopover);return l.jsx(_a,{present:s||i.open,children:i.modal?l.jsx(rAe,{...r,ref:t}):l.jsx(iAe,{...r,ref:t})})});wte.displayName=lb;var sAe=km("PopoverContent.RemoveScroll"),rAe=f.forwardRef((e,t)=>{const n=Gm(lb,e.__scopePopover),s=f.useRef(null),r=Es(t,s),i=f.useRef(!1);return f.useEffect(()=>{const o=s.current;if(o)return PC(o)},[]),l.jsx(Pw,{as:sAe,allowPinchZoom:!0,children:l.jsx(kte,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:en(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:en(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:en(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),iAe=f.forwardRef((e,t)=>{const n=Gm(lb,e.__scopePopover),s=f.useRef(!1),r=f.useRef(!1);return l.jsx(kte,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),kte=f.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...h}=e,m=Gm(lb,n),p=qw(n);return DC(),l.jsx(Lw,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(Wb,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:l.jsx(QC,{"data-state":Ste(m.open),role:"dialog",id:m.contentId,...p,...h,ref:t,style:{...h.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)"}})})})}),_te="PopoverClose",oAe=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Gm(_te,n);return l.jsx(Un.button,{type:"button",...s,ref:t,onClick:en(e.onClick,()=>r.onOpenChange(!1))})});oAe.displayName=_te;var aAe="PopoverArrow",lAe=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=qw(n);return l.jsx(JC,{...r,...s,ref:t})});lAe.displayName=aAe;function Ste(e){return e?"open":"closed"}var cAe=pte,uAe=bte,dAe=vte,hAe=xte,fAe=wte,YI="Radio",[mAe,Cte]=ka(YI),[pAe,rT]=mAe(YI);function Tte(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:r,form:i,name:o,onCheck:a,required:c,value:u="on",internal_do_not_use_render:d}=e,[h,m]=f.useState(null),[p,g]=f.useState(null),b=f.useRef(!1),x=h?!!i||!!h.closest("form"):!0,y={checked:n,disabled:r,required:c,name:o,form:i,value:u,control:h,setControl:m,hasConsumerStoppedPropagationRef:b,isFormControl:x,bubbleInput:p,setBubbleInput:g,onCheck:()=>a==null?void 0:a()};return l.jsx(pAe,{scope:t,...y,children:bAe(d)?d(y):s})}var Ete="RadioTrigger",XI=f.forwardRef(({__scopeRadio:e,onClick:t,...n},s)=>{const{checked:r,disabled:i,value:o,setControl:a,onCheck:c,hasConsumerStoppedPropagationRef:u,isFormControl:d,bubbleInput:h}=rT(Ete,e),m=Es(s,a);return l.jsx(Un.button,{type:"button",role:"radio","aria-checked":r,"data-state":Mte(r),"data-disabled":i?"":void 0,disabled:i,value:o,...n,ref:m,onClick:en(t,p=>{r||c(),h&&d&&(u.current=p.isPropagationStopped(),u.current||p.stopPropagation())})})});XI.displayName=Ete;var gAe=f.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:r,required:i,disabled:o,value:a,onCheck:c,form:u,...d}=e;return l.jsx(Tte,{__scopeRadio:n,checked:r,disabled:o,required:i,onCheck:c,name:s,form:u,value:a,internal_do_not_use_render:({isFormControl:h})=>l.jsxs(l.Fragment,{children:[l.jsx(XI,{...d,ref:t,__scopeRadio:n}),h&&l.jsx(QI,{__scopeRadio:n})]})})});gAe.displayName=YI;var Ate="RadioIndicator",jte=f.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...r}=e,i=rT(Ate,n);return l.jsx(_a,{present:s||i.checked,children:l.jsx(Un.span,{"data-state":Mte(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})})});jte.displayName=Ate;var Nte="RadioBubbleInput",QI=f.forwardRef(({__scopeRadio:e,...t},n)=>{const{control:s,checked:r,required:i,disabled:o,name:a,value:c,form:u,bubbleInput:d,setBubbleInput:h,hasConsumerStoppedPropagationRef:m}=rT(Nte,e),p=Es(n,h),g=qC(r),b=UC(s);f.useEffect(()=>{const y=d;if(!y)return;const v=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(v,"checked").set,T=!m.current;if(g!==r&&k){const C=new Event("click",{bubbles:T});k.call(y,r),y.dispatchEvent(C)}},[d,g,r,m]);const x=f.useRef(r);return l.jsx(Un.input,{type:"radio","aria-hidden":!0,defaultChecked:x.current,required:i,disabled:o,name:a,value:c,form:u,...t,tabIndex:-1,ref:p,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});QI.displayName=Nte;function bAe(e){return typeof e=="function"}function Mte(e){return e?"checked":"unchecked"}var yAe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],iT="RadioGroup",[vAe,F4t]=ka(iT,[Wm,Cte]),Ite=Wm(),oT=Cte(),[xAe,wAe]=vAe(iT),Rte=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,form:r,defaultValue:i,value:o,required:a=!1,disabled:c=!1,orientation:u,dir:d,loop:h=!0,onValueChange:m,...p}=e,g=Ite(n),b=Ub(d),[x,y]=Va({prop:o,defaultProp:i??null,onChange:m,caller:iT}),[v,w]=f.useState(null),k=Es(t,w),T=f.useRef(x);return f.useEffect(()=>{const C=r?v==null?void 0:v.ownerDocument.getElementById(r):v==null?void 0:v.closest("form");if(C instanceof HTMLFormElement){const _=()=>y(T.current);return C.addEventListener("reset",_),()=>C.removeEventListener("reset",_)}},[v,r,y]),l.jsx(xAe,{scope:n,name:s,form:r,required:a,disabled:c,value:x,onValueChange:y,children:l.jsx(ZC,{asChild:!0,...g,orientation:u,dir:b,loop:h,children:l.jsx(Un.div,{role:"radiogroup","aria-required":a,"aria-orientation":u,"data-disabled":c?"":void 0,dir:b,...p,ref:k})})})});Rte.displayName=iT;var kAe="RadioGroupItem",_Ae="RadioGroupItemProvider",Dte="RadioGroupItemTrigger",SAe="RadioGroupItemBubbleInput";function CAe(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:r,internal_do_not_use_render:i}=e,o=wAe(_Ae,t),a=oT(t),c=o.disabled||s;return l.jsx(Tte,{...a,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:r})}var Lte=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=Ite(n),i=oT(n),{checked:o,disabled:a}=rT(Dte,i.__scopeRadio),c=f.useRef(null),u=Es(t,c),d=f.useRef(!1);return f.useEffect(()=>{const h=p=>{yAe.includes(p.key)&&(d.current=!0)},m=()=>d.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),l.jsx(eT,{asChild:!0,...r,focusable:!a,active:o,children:l.jsx(XI,{...i,...s,ref:u,onKeyDown:en(s.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:en(s.onFocus,()=>{var h;d.current&&((h=c.current)==null||h.click())})})})});Lte.displayName=Dte;var Pte=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,value:s,disabled:r,...i}=e;return l.jsx(CAe,{__scopeRadioGroup:n,value:s,disabled:r,internal_do_not_use_render:({isFormControl:o})=>l.jsxs(l.Fragment,{children:[l.jsx(Lte,{...i,ref:t,__scopeRadioGroup:n}),o&&l.jsx(Ote,{__scopeRadioGroup:n})]})})});Pte.displayName=kAe;var Ote=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=oT(n);return l.jsx(QI,{...r,...s,ref:t})});Ote.displayName=SAe;var TAe="RadioGroupIndicator",$te=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=oT(n);return l.jsx(jte,{...r,...s,ref:t})});$te.displayName=TAe;var EAe=[" ","Enter","ArrowUp","ArrowDown"],AAe=[" ","Enter"],b0="Select",[aT,lT,jAe]=CI(b0),[V0,H4t]=ka(b0,[jAe,Um]),cT=Um(),[NAe,Km]=V0(b0),[MAe,IAe]=V0(b0),RAe="SelectProvider";function Bte(e){const{__scopeSelect:t,children:n,open:s,defaultOpen:r,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:p,form:g,internal_do_not_use_render:b}=e,x=cT(t),[y,v]=f.useState(null),[w,k]=f.useState(null),[T,C]=f.useState(!1),_=Ub(u),[S,D]=Va({prop:s,defaultProp:r??!1,onChange:i,caller:b0}),[E,B]=Va({prop:o,defaultProp:a,onChange:c,caller:b0}),I=f.useRef(null),L=f.useRef(E);f.useEffect(()=>{const V=g?y==null?void 0:y.ownerDocument.getElementById(g):y==null?void 0:y.form;if(V instanceof HTMLFormElement){const R=()=>B(L.current);return V.addEventListener("reset",R),()=>V.removeEventListener("reset",R)}},[g,y,B]);const O=y?!!g||!!y.closest("form"):!0,[A,$]=f.useState(new Set),q=xl(),U=Array.from(A).map(V=>V.props.value).join(";"),H=f.useCallback(V=>{$(R=>new Set(R).add(V))},[]),M=f.useCallback(V=>{$(R=>{const re=new Set(R);return re.delete(V),re})},[]),ee={required:p,trigger:y,onTriggerChange:v,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:C,contentId:q,value:E,onValueChange:B,open:S,onOpenChange:D,dir:_,triggerPointerDownPosRef:I,disabled:m,name:d,autoComplete:h,form:g,nativeOptions:A,nativeSelectKey:U,isFormControl:O};return l.jsx(Ow,{...x,children:l.jsx(NAe,{scope:t,...ee,children:l.jsx(aT.Provider,{scope:t,children:l.jsx(MAe,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:M,children:YAe(b)?b(ee):n})})})})}Bte.displayName=RAe;var zte=e=>{const{__scopeSelect:t,children:n,...s}=e;return l.jsx(Bte,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:r})=>l.jsxs(l.Fragment,{children:[n,r?l.jsx(fne,{__scopeSelect:t}):null]})})};zte.displayName=b0;var Fte="SelectTrigger",Hte=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...r}=e,i=cT(n),o=Km(Fte,n),a=o.disabled||s,c=Es(t,o.onTriggerChange),u=lT(n),d=f.useRef("touch"),[h,m,p]=mne(b=>{const x=u().filter(w=>!w.disabled),y=x.find(w=>w.value===o.value),v=pne(x,b,y);v!==void 0&&o.onValueChange(v.value)}),g=b=>{a||(o.onOpenChange(!0),p()),b&&(o.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return l.jsx($w,{asChild:!0,...i,children:l.jsx(Un.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:a,"data-disabled":a?"":void 0,"data-placeholder":uT(o.value)?"":void 0,...r,ref:c,onClick:en(r.onClick,b=>{b.currentTarget.focus(),d.current!=="mouse"&&g(b)}),onPointerDown:en(r.onPointerDown,b=>{d.current=b.pointerType;const x=b.target;x.hasPointerCapture(b.pointerId)&&x.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(g(b),b.preventDefault())}),onKeyDown:en(r.onKeyDown,b=>{const x=h.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(x&&b.key===" ")&&EAe.includes(b.key)&&(g(),b.preventDefault())})})})});Hte.displayName=Fte;var qte="SelectValue",Ute=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:o="",...a}=e,c=Km(qte,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,h=Es(t,c.onValueNodeChange);Wo(()=>{u(d)},[u,d]);const m=uT(c.value);return l.jsx(Un.span,{...a,asChild:m?!1:a.asChild,ref:h,style:{pointerEvents:"none"},children:l.jsx(f.Fragment,{children:m?o:i},m?"placeholder":"value")})});Ute.displayName=qte;var DAe="SelectIcon",Wte=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...r}=e;return l.jsx(Un.span,{"aria-hidden":!0,...r,ref:t,children:s||"▼"})});Wte.displayName=DAe;var Vte="SelectPortal",[LAe,PAe]=V0(Vte,{forceMount:void 0}),Gte=e=>{const{__scopeSelect:t,forceMount:n,...s}=e;return l.jsx(LAe,{scope:e.__scopeSelect,forceMount:n,children:l.jsx(Vb,{asChild:!0,...s})})};Gte.displayName=Vte;var Cm="SelectContent",Kte=f.forwardRef((e,t)=>{const n=PAe(Cm,e.__scopeSelect),{forceMount:s=n.forceMount,...r}=e,i=Km(Cm,e.__scopeSelect),[o,a]=f.useState();return Wo(()=>{a(new DocumentFragment)},[]),l.jsx(_a,{present:s||i.open,children:({present:c})=>c?l.jsx(Qte,{...r,ref:t}):l.jsx(Yte,{...r,fragment:o})})});Kte.displayName=Cm;var Yte=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,fragment:r}=e;return r?hu.createPortal(l.jsx(Xte,{scope:n,children:l.jsx(aT.Slot,{scope:n,children:l.jsx("div",{ref:t,children:s})})}),r):null});Yte.displayName="SelectContentFragment";var Jc=10,[Xte,Ym]=V0(Cm),OAe="SelectContentImpl",$Ae=km("SelectContent.RemoveScroll"),Qte=f.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:x,...y}=e,v=Km(Cm,n),[w,k]=f.useState(null),[T,C]=f.useState(null),_=Es(t,k),[S,D]=f.useState(null),[E,B]=f.useState(null),I=lT(n),[L,O]=f.useState(!1),A=f.useRef(!1);f.useEffect(()=>{if(w)return PC(w)},[w]),DC();const $=f.useCallback(Y=>{const[ae,...le]=I().map(X=>X.ref.current),[te]=le.slice(-1),z=document.activeElement;for(const X of Y)if(X===z||(X==null||X.scrollIntoView({block:"nearest"}),X===ae&&T&&(T.scrollTop=0),X===te&&T&&(T.scrollTop=T.scrollHeight),X==null||X.focus(),document.activeElement!==z))return},[I,T]),q=f.useCallback(()=>$([S,w]),[$,S,w]);f.useEffect(()=>{L&&q()},[L,q]);const{onOpenChange:U,triggerPointerDownPosRef:H}=v;f.useEffect(()=>{if(w){let Y={x:0,y:0};const ae=te=>{var z,X;Y={x:Math.abs(Math.round(te.pageX)-(((z=H.current)==null?void 0:z.x)??0)),y:Math.abs(Math.round(te.pageY)-(((X=H.current)==null?void 0:X.y)??0))}},le=te=>{Y.x<=10&&Y.y<=10?te.preventDefault():te.composedPath().includes(w)||U(!1),document.removeEventListener("pointermove",ae),H.current=null};return H.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",le,{capture:!0})}}},[w,U,H]),f.useEffect(()=>{const Y=()=>U(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[U]);const[M,ee]=mne(Y=>{const ae=I().filter(z=>!z.disabled),le=ae.find(z=>z.ref.current===document.activeElement),te=pne(ae,Y,le);te&&setTimeout(()=>{var z;return(z=te.ref.current)==null?void 0:z.focus()})}),V=f.useCallback((Y,ae,le)=>{const te=!A.current&&!le;(v.value!==void 0&&v.value===ae||te)&&(D(Y),te&&(A.current=!0))},[v.value]),R=f.useCallback(()=>w==null?void 0:w.focus(),[w]),re=f.useCallback((Y,ae,le)=>{const te=!A.current&&!le;(v.value!==void 0&&v.value===ae||te)&&B(Y)},[v.value]),Z=s==="popper"?yj:Jte,K=Z===yj?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:x}:{};return l.jsx(Xte,{scope:n,content:w,viewport:T,onViewportChange:C,itemRefCallback:V,selectedItem:S,onItemLeave:R,itemTextRefCallback:re,focusSelectedItem:q,selectedItemText:E,position:s,isPositioned:L,searchRef:M,children:l.jsx(Pw,{as:$Ae,allowPinchZoom:!0,children:l.jsx(Lw,{asChild:!0,trapped:v.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:en(r,Y=>{var ae;(ae=v.trigger)==null||ae.focus({preventScroll:!0}),Y.preventDefault()}),children:l.jsx(Wb,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(Z,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:Y=>Y.preventDefault(),...y,...K,onPlaced:()=>O(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:en(y.onKeyDown,Y=>{const ae=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!ae&&Y.key.length===1&&ee(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let te=I().filter(z=>!z.disabled).map(z=>z.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const z=Y.target,X=te.indexOf(z);te=te.slice(X+1)}setTimeout(()=>$(te)),Y.preventDefault()}})})})})})})});Qte.displayName=OAe;var BAe="SelectItemAlignedPosition",Jte=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...r}=e,i=Km(Cm,n),o=Ym(Cm,n),[a,c]=f.useState(null),[u,d]=f.useState(null),h=Es(t,d),m=lT(n),p=f.useRef(!1),g=f.useRef(!0),{viewport:b,selectedItem:x,selectedItemText:y,focusSelectedItem:v}=o,w=f.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&u&&b&&x&&y){const _=i.trigger.getBoundingClientRect(),S=u.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),E=y.getBoundingClientRect();if(i.dir!=="rtl"){const z=E.left-S.left,X=D.left-z,fe=_.left-X,xe=_.width+fe,ie=Math.max(xe,S.width),Ce=window.innerWidth-Jc,Ke=sF(X,[Jc,Math.max(Jc,Ce-ie)]);a.style.minWidth=xe+"px",a.style.left=Ke+"px"}else{const z=S.right-E.right,X=window.innerWidth-D.right-z,fe=window.innerWidth-_.right-X,xe=_.width+fe,ie=Math.max(xe,S.width),Ce=window.innerWidth-Jc,Ke=sF(X,[Jc,Math.max(Jc,Ce-ie)]);a.style.minWidth=xe+"px",a.style.right=Ke+"px"}const B=m(),I=window.innerHeight-Jc*2,L=b.scrollHeight,O=window.getComputedStyle(u),A=parseInt(O.borderTopWidth,10),$=parseInt(O.paddingTop,10),q=parseInt(O.borderBottomWidth,10),U=parseInt(O.paddingBottom,10),H=A+$+L+U+q,M=Math.min(x.offsetHeight*5,H),ee=window.getComputedStyle(b),V=parseInt(ee.paddingTop,10),R=parseInt(ee.paddingBottom,10),re=_.top+_.height/2-Jc,Z=I-re,K=x.offsetHeight/2,Y=x.offsetTop+K,ae=A+$+Y,le=H-ae;if(ae<=re){const z=B.length>0&&x===B[B.length-1].ref.current;a.style.bottom="0px";const X=u.clientHeight-b.offsetTop-b.offsetHeight,fe=Math.max(Z,K+(z?R:0)+X+q),xe=ae+fe;a.style.height=xe+"px"}else{const z=B.length>0&&x===B[0].ref.current;a.style.top="0px";const fe=Math.max(re,A+b.offsetTop+(z?V:0)+K)+le;a.style.height=fe+"px",b.scrollTop=ae-re+b.offsetTop}a.style.margin=`${Jc}px 0`,a.style.minHeight=M+"px",a.style.maxHeight=I+"px",s==null||s(),requestAnimationFrame(()=>p.current=!0)}},[m,i.trigger,i.valueNode,a,u,b,x,y,i.dir,s]);Wo(()=>w(),[w]);const[k,T]=f.useState();Wo(()=>{u&&T(window.getComputedStyle(u).zIndex)},[u]);const C=f.useCallback(_=>{_&&g.current===!0&&(w(),v==null||v(),g.current=!1)},[w,v]);return l.jsx(FAe,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:C,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:l.jsx(Un.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Jte.displayName=BAe;var zAe="SelectPopperPosition",yj=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=Jc,...i}=e,o=cT(n);return l.jsx(QC,{...o,...i,ref:t,align:s,collisionPadding:r,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)"}})});yj.displayName=zAe;var[FAe,JI]=V0(Cm,{}),vj="SelectViewport",Zte=f.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...r}=e,i=Ym(vj,n),o=JI(vj,n),a=Es(t,i.onViewportChange),c=f.useRef(0);return l.jsxs(l.Fragment,{children:[l.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:s}),l.jsx(aT.Slot,{scope:n,children:l.jsx(Un.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:en(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Jc*2,b=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),y=Math.max(b,x);if(y<g){const v=y+p,w=Math.min(g,v),k=v-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Zte.displayName=vj;var ene="SelectGroup",[HAe,qAe]=V0(ene),tne=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=xl();return l.jsx(HAe,{scope:n,id:r,children:l.jsx(Un.div,{role:"group","aria-labelledby":r,...s,ref:t})})});tne.displayName=ene;var nne="SelectLabel",UAe=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=qAe(nne,n);return l.jsx(Un.div,{id:r.id,...s,ref:t})});UAe.displayName=nne;var O4="SelectItem",[WAe,sne]=V0(O4),rne=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...o}=e,a=Km(O4,n),c=Ym(O4,n),u=a.value===s,[d,h]=f.useState(i??""),[m,p]=f.useState(!1),g=lc(w=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,w,s,r)}),b=Es(t,g),x=xl(),y=f.useRef("touch"),v=()=>{r||(a.onValueChange(s),a.onOpenChange(!1))};return l.jsx(WAe,{scope:n,value:s,disabled:r,textId:x,isSelected:u,onItemTextChange:f.useCallback(w=>{h(k=>k||((w==null?void 0:w.textContent)??"").trim())},[]),children:l.jsx(aT.ItemSlot,{scope:n,value:s,disabled:r,textValue:d,children:l.jsx(Un.div,{role:"option","aria-labelledby":x,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:b,onFocus:en(o.onFocus,()=>p(!0)),onBlur:en(o.onBlur,()=>p(!1)),onClick:en(o.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:en(o.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:en(o.onPointerDown,w=>{y.current=w.pointerType}),onPointerMove:en(o.onPointerMove,w=>{var k;y.current=w.pointerType,r?(k=c.onItemLeave)==null||k.call(c):y.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:en(o.onPointerLeave,w=>{var k;w.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:en(o.onKeyDown,w=>{var T;r||w.target!==w.currentTarget||((T=c.searchRef)==null?void 0:T.current)!==""&&w.key===" "||(AAe.includes(w.key)&&v(),w.key===" "&&w.preventDefault())})})})})});rne.displayName=O4;var yv="SelectItemText",ine=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,...i}=e,o=Km(yv,n),a=Ym(yv,n),c=sne(yv,n),u=IAe(yv,n),[d,h]=f.useState(null),m=lc(v=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,v,c.value,c.disabled)}),p=Es(t,h,c.onItemTextChange,m),g=d==null?void 0:d.textContent,b=f.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:x,onNativeOptionRemove:y}=u;return Wo(()=>(x(b),()=>y(b)),[x,y,b]),l.jsxs(l.Fragment,{children:[l.jsx(Un.span,{id:c.textId,...i,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!uT(o.value)?hu.createPortal(i.children,o.valueNode):null]})});ine.displayName=yv;var one="SelectItemIndicator",ane=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return sne(one,n).isSelected?l.jsx(Un.span,{"aria-hidden":!0,...s,ref:t}):null});ane.displayName=one;var xj="SelectScrollUpButton",lne=f.forwardRef((e,t)=>{const n=Ym(xj,e.__scopeSelect),s=JI(xj,e.__scopeSelect),[r,i]=f.useState(!1),o=Es(t,s.onScrollButtonChange);return Wo(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?l.jsx(une,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});lne.displayName=xj;var wj="SelectScrollDownButton",cne=f.forwardRef((e,t)=>{const n=Ym(wj,e.__scopeSelect),s=JI(wj,e.__scopeSelect),[r,i]=f.useState(!1),o=Es(t,s.onScrollButtonChange);return Wo(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?l.jsx(une,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});cne.displayName=wj;var une=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=e,i=Ym("SelectScrollButton",n),o=f.useRef(null),a=lT(n),c=f.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return f.useEffect(()=>()=>c(),[c]),Wo(()=>{var d;const u=a().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Un.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:en(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:en(r.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:en(r.onPointerLeave,()=>{c()})})}),VAe="SelectSeparator",GAe=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return l.jsx(Un.div,{"aria-hidden":!0,...s,ref:t})});GAe.displayName=VAe;var dne="SelectArrow",KAe=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=cT(n);return Ym(dne,n).position==="popper"?l.jsx(JC,{...r,...s,ref:t}):null});KAe.displayName=dne;var hne="SelectBubbleInput",fne=f.forwardRef(({__scopeSelect:e,...t},n)=>{const s=Km(hne,e),{value:r,onValueChange:i,required:o,disabled:a,name:c,autoComplete:u,form:d}=s,{nativeOptions:h,nativeSelectKey:m}=s,p=f.useRef(null),g=Es(n,p),b=r??"",x=qC(b),y=Array.from(h).some(v=>(v.props.value??"")==="");return f.useEffect(()=>{const v=p.current;if(!v)return;const w=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(w,"value").set;if(x!==b&&T){const C=new Event("change",{bubbles:!0});T.call(v,b),v.dispatchEvent(C)}},[x,b]),l.jsxs(Un.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:u,disabled:a,form:d,onChange:v=>i(v.target.value),...t,style:{...pZ,...t.style},ref:g,defaultValue:b,children:[uT(r)&&!y?l.jsx("option",{value:""}):null,Array.from(h)]},m)});fne.displayName=hne;function YAe(e){return typeof e=="function"}function uT(e){return e===""||e===void 0}function mne(e){const t=lc(e),n=f.useRef(""),s=f.useRef(0),r=f.useCallback(o=>{const a=n.current+o;t(a),function c(u){n.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),i=f.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function pne(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=XAe(e,Math.max(i,0));r.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function XAe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var QAe="Separator",rF="horizontal",JAe=["horizontal","vertical"],gne=f.forwardRef((e,t)=>{const{decorative:n,orientation:s=rF,...r}=e,i=ZAe(s)?s:rF,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(Un.div,{"data-orientation":i,...a,...r,ref:t})});gne.displayName=QAe;function ZAe(e){return JAe.includes(e)}var eje=gne,dT="Switch",[tje,q4t]=ka(dT),[nje,ZI]=tje(dT);function sje(e){const{__scopeSwitch:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=e,[m,p]=Va({prop:n,defaultProp:r??!1,onChange:c,caller:dT}),[g,b]=f.useState(null),[x,y]=f.useState(null),v=f.useRef(!1),w=g?!!o||!!g.closest("form"):!0,k={checked:m,setChecked:p,disabled:i,control:g,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:r,isFormControl:w,bubbleInput:x,setBubbleInput:y};return l.jsx(nje,{scope:t,...k,children:rje(h)?h(k):s})}var bne="SwitchTrigger",yne=f.forwardRef(({__scopeSwitch:e,onClick:t,...n},s)=>{const{control:r,form:i,value:o,disabled:a,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=ZI(bne,e),b=Es(s,d),x=f.useRef(c);return f.useEffect(()=>{const y=i?r==null?void 0:r.ownerDocument.getElementById(i):r==null?void 0:r.form;if(y instanceof HTMLFormElement){const v=()=>h(x.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[r,i,h]),l.jsx(Un.button,{type:"button",role:"switch","aria-checked":c,"aria-required":u,"data-state":Sne(c),"data-disabled":a?"":void 0,disabled:a,value:o,...n,ref:b,onClick:en(t,y=>{h(v=>!v),g&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});yne.displayName=bne;var vne=f.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:c,onCheckedChange:u,form:d,...h}=e;return l.jsx(sje,{__scopeSwitch:n,checked:r,defaultChecked:i,disabled:a,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(yne,{...h,ref:t,__scopeSwitch:n}),m&&l.jsx(_ne,{__scopeSwitch:n})]})})});vne.displayName=dT;var xne="SwitchThumb",wne=f.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,r=ZI(xne,n);return l.jsx(Un.span,{"data-state":Sne(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});wne.displayName=xne;var kne="SwitchBubbleInput",_ne=f.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:p}=ZI(kne,e),g=Es(n,p),b=qC(i),x=UC(s);f.useEffect(()=>{const v=m;if(!v)return;const w=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(w,"checked").set,C=!r.current;if(b!==i&&T){const _=new Event("click",{bubbles:C});T.call(v,i),v.dispatchEvent(_)}},[m,b,i,r]);const y=f.useRef(i);return l.jsx(Un.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:a,disabled:c,name:u,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_ne.displayName=kne;function rje(e){return typeof e=="function"}function Sne(e){return e?"checked":"unchecked"}var hT="Tabs",[ije,U4t]=ka(hT,[Wm]),Cne=Wm(),[oje,eR]=ije(hT),Tne=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:r,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Ub(a),[h,m]=Va({prop:s,onChange:r,defaultProp:i??"",caller:hT});return l.jsx(oje,{scope:n,baseId:xl(),value:h,onValueChange:m,orientation:o,dir:d,activationMode:c,children:l.jsx(Un.div,{dir:d,"data-orientation":o,...u,ref:t})})});Tne.displayName=hT;var Ene="TabsList",Ane=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...r}=e,i=eR(Ene,n),o=Cne(n);return l.jsx(ZC,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:l.jsx(Un.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});Ane.displayName=Ene;var jne="TabsTrigger",Nne=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:r=!1,...i}=e,o=eR(jne,n),a=Cne(n),c=Rne(o.baseId,s),u=Dne(o.baseId,s),d=s===o.value;return l.jsx(eT,{asChild:!0,...a,focusable:!r,active:d,children:l.jsx(Un.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...i,ref:t,onMouseDown:en(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?o.onValueChange(s):h.preventDefault()}),onKeyDown:en(e.onKeyDown,h=>{r||h.target!==h.currentTarget||[" ","Enter"].includes(h.key)&&o.onValueChange(s)}),onFocus:en(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!r&&h&&o.onValueChange(s)})})})});Nne.displayName=jne;var Mne="TabsContent",Ine=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:r,children:i,...o}=e,a=eR(Mne,n),c=Rne(a.baseId,s),u=Dne(a.baseId,s),d=s===a.value,h=f.useRef(d);return f.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(_a,{present:r||d,children:({present:m})=>l.jsx(Un.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&i})})});Ine.displayName=Mne;function Rne(e,t){return`${e}-trigger-${t}`}function Dne(e,t){return`${e}-content-${t}`}var aje=Tne,lje=Ane,cje=Nne,uje=Ine,Lne="Toggle",Pne=f.forwardRef((e,t)=>{const{pressed:n,defaultPressed:s,onPressedChange:r,...i}=e,[o,a]=Va({prop:n,onChange:r,defaultProp:s??!1,caller:Lne});return l.jsx(Un.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:en(e.onClick,()=>{e.disabled||a(!o)})})});Pne.displayName=Lne;var Xm="ToggleGroup",[One,W4t]=ka(Xm,[Wm]),$ne=Wm(),tR=f.forwardRef((e,t)=>{const{type:n,...s}=e;if(n==="single"){const r=s;return l.jsx(dje,{role:"radiogroup",...r,ref:t})}if(n==="multiple"){const r=s;return l.jsx(hje,{role:"toolbar",...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Xm}\``)});tR.displayName=Xm;var[Bne,zne]=One(Xm),dje=f.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,a]=Va({prop:n,defaultProp:s??"",onChange:r,caller:Xm});return l.jsx(Bne,{scope:e.__scopeToggleGroup,type:"single",value:f.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:f.useCallback(()=>a(""),[a]),children:l.jsx(Fne,{...i,ref:t})})}),hje=f.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,a]=Va({prop:n,defaultProp:s??[],onChange:r,caller:Xm}),c=f.useCallback(d=>a((h=[])=>[...h,d]),[a]),u=f.useCallback(d=>a((h=[])=>h.filter(m=>m!==d)),[a]);return l.jsx(Bne,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:l.jsx(Fne,{...i,ref:t})})});tR.displayName=Xm;var[fje,mje]=One(Xm),Fne=f.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:s=!1,rovingFocus:r=!0,orientation:i,dir:o,loop:a=!0,...c}=e,u=$ne(n),d=Ub(o),h={dir:d,...c};return l.jsx(fje,{scope:n,rovingFocus:r,disabled:s,children:r?l.jsx(ZC,{asChild:!0,...u,orientation:i,dir:d,loop:a,children:l.jsx(Un.div,{...h,ref:t})}):l.jsx(Un.div,{...h,ref:t})})}),$4="ToggleGroupItem",Hne=f.forwardRef((e,t)=>{const n=zne($4,e.__scopeToggleGroup),s=mje($4,e.__scopeToggleGroup),r=$ne(e.__scopeToggleGroup),i=n.value.includes(e.value),o=s.disabled||e.disabled,a={...e,pressed:i,disabled:o},c=f.useRef(null);return s.rovingFocus?l.jsx(eT,{asChild:!0,...r,focusable:!o,active:i,ref:c,children:l.jsx(iF,{...a,ref:t})}):l.jsx(iF,{...a,ref:t})});Hne.displayName=$4;var iF=f.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:s,...r}=e,i=zne($4,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=i.type==="single"?o:void 0;return l.jsx(Pne,{...a,...r,ref:t,onPressedChange:c=>{c?i.onItemActivate(s):i.onItemDeactivate(s)}})}),[fT,V4t]=ka("Tooltip",[Um]),mT=Um(),qne="TooltipProvider",pje=700,kj="tooltip.open",[gje,nR]=fT(qne),Une=e=>{const{__scopeTooltip:t,delayDuration:n=pje,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:i}=e,o=f.useRef(!0),a=f.useRef(!1),c=f.useRef(0);return f.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(gje,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:f.useCallback(()=>{s<=0||(window.clearTimeout(c.current),o.current=!1)},[s]),onClose:f.useCallback(()=>{s<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s))},[s]),isPointerInTransitRef:a,onPointerInTransitChange:f.useCallback(u=>{a.current=u},[]),disableHoverableContent:r,children:i})};Une.displayName=qne;var Bx="Tooltip",[bje,Uw]=fT(Bx),Wne=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=e,c=nR(Bx,e.__scopeTooltip),u=mT(t),[d,h]=f.useState(null),m=xl(),p=f.useRef(0),g=o??c.disableHoverableContent,b=a??c.delayDuration,x=f.useRef(!1),[y,v]=Va({prop:s,defaultProp:r??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(kj))):c.onClose(),i==null||i(_)},caller:Bx}),w=f.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),k=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,v(!0)},[v]),T=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),C=f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,v(!0),p.current=0},b)},[b,v]);return f.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),l.jsx(Ow,{...u,children:l.jsx(bje,{scope:t,contentId:m,open:y,stateAttribute:w,trigger:d,onTriggerChange:h,onTriggerEnter:f.useCallback(()=>{c.isOpenDelayedRef.current?C():k()},[c.isOpenDelayedRef,C,k]),onTriggerLeave:f.useCallback(()=>{g?T():(window.clearTimeout(p.current),p.current=0)},[T,g]),onOpen:k,onClose:T,disableHoverableContent:g,children:n})})};Wne.displayName=Bx;var _j="TooltipTrigger",Vne=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=Uw(_j,n),i=nR(_j,n),o=mT(n),a=f.useRef(null),c=Es(t,a,r.onTriggerChange),u=f.useRef(!1),d=f.useRef(!1),h=f.useCallback(()=>u.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx($w,{asChild:!0,...o,children:l.jsx(Un.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:c,onPointerMove:en(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:en(e.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:en(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:en(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:en(e.onBlur,r.onClose),onClick:en(e.onClick,r.onClose)})})});Vne.displayName=_j;var sR="TooltipPortal",[yje,vje]=fT(sR,{forceMount:void 0}),Gne=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,i=Uw(sR,t);return l.jsx(yje,{scope:t,forceMount:n,children:l.jsx(_a,{present:n||i.open,children:l.jsx(Vb,{asChild:!0,container:r,children:s})})})};Gne.displayName=sR;var cb="TooltipContent",Kne=f.forwardRef((e,t)=>{const n=vje(cb,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...i}=e,o=Uw(cb,e.__scopeTooltip);return l.jsx(_a,{present:s||o.open,children:o.disableHoverableContent?l.jsx(Yne,{side:r,...i,ref:t}):l.jsx(xje,{side:r,...i,ref:t})})}),xje=f.forwardRef((e,t)=>{const n=Uw(cb,e.__scopeTooltip),s=nR(cb,e.__scopeTooltip),r=f.useRef(null),i=Es(t,r),[o,a]=f.useState(null),{trigger:c,onClose:u}=n,d=r.current,{onPointerInTransitChange:h}=s,m=f.useCallback(()=>{a(null),h(!1)},[h]),p=f.useCallback((g,b)=>{const x=g.currentTarget,y={x:g.clientX,y:g.clientY},v=Cje(y,x.getBoundingClientRect()),w=Tje(y,v),k=Eje(b.getBoundingClientRect()),T=jje([...w,...k]);a(T),h(!0)},[h]);return f.useEffect(()=>()=>m(),[m]),f.useEffect(()=>{if(c&&d){const g=x=>p(x,d),b=x=>p(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",b)}}},[c,d,p,m]),f.useEffect(()=>{if(o){const g=b=>{const x=b.target,y={x:b.clientX,y:b.clientY},v=(c==null?void 0:c.contains(x))||(d==null?void 0:d.contains(x)),w=!Aje(y,o);v?m():w&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,m]),l.jsx(Yne,{...e,ref:i})}),[wje,kje]=fT(Bx,{isInside:!1}),_je=o5e("TooltipContent"),Yne=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=e,c=Uw(cb,n),u=mT(n),{onClose:d}=c;return f.useEffect(()=>(document.addEventListener(kj,d),()=>document.removeEventListener(kj,d)),[d]),f.useEffect(()=>{if(c.trigger){const h=m=>{m.target instanceof Node&&m.target.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),l.jsx(Wb,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(QC,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.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:[l.jsx(_je,{children:s}),l.jsx(wje,{scope:n,isInside:!0,children:l.jsx(b5e,{id:c.contentId,role:"tooltip",children:r||s})})]})})});Kne.displayName=cb;var Xne="TooltipArrow",Sje=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=mT(n);return kje(Xne,n).isInside?null:l.jsx(JC,{...r,...s,ref:t})});Sje.displayName=Xne;function Cje(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,s,r,i)){case i:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function Tje(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function Eje(e){const{top:t,right:n,bottom:s,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:s},{x:r,y:s}]}function Aje(e,t){const{x:n,y:s}=e;let r=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],c=t[o],u=a.x,d=a.y,h=c.x,m=c.y;d>s!=m>s&&n<(h-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function jje(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),Nje(t)}function Nje(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(r.y-o.y)>=(i.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const r=e[s];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(r.y-o.y)>=(i.y-o.y)*(r.x-o.x))n.pop();else break}n.push(r)}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 Qne=Une,Jne=Wne,Zne=Vne,ese=Gne,tse=Kne;const Mje=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},Ije=(e,t)=>({classGroupId:e,validator:t}),nse=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),B4="-",oF=[],Rje="arbitrary..",Dje=e=>{const t=Pje(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return Lje(o);const a=o.split(B4),c=a[0]===""&&a.length>1?1:0;return sse(a,c,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const c=s[o],u=n[o];return c?u?Mje(u,c):c:u||oF}return n[o]||oF}}},sse=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],i=n.nextPart.get(r);if(i){const u=sse(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const a=t===0?e.join(B4):e.slice(t).join(B4),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(a))return d.classGroupId}},Lje=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?Rje+s:void 0})(),Pje=e=>{const{theme:t,classGroups:n}=e;return Oje(n,t)},Oje=(e,t)=>{const n=nse();for(const s in e){const r=e[s];rR(r,n,s,t)}return n},rR=(e,t,n,s)=>{const r=e.length;for(let i=0;i<r;i++){const o=e[i];$je(o,t,n,s)}},$je=(e,t,n,s)=>{if(typeof e=="string"){Bje(e,t,n);return}if(typeof e=="function"){zje(e,t,n,s);return}Fje(e,t,n,s)},Bje=(e,t,n)=>{const s=e===""?t:rse(t,e);s.classGroupId=n},zje=(e,t,n,s)=>{if(Hje(e)){rR(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(Ije(n,e))},Fje=(e,t,n,s)=>{const r=Object.entries(e),i=r.length;for(let o=0;o<i;o++){const[a,c]=r[o];rR(c,rse(t,a),n,s)}},rse=(e,t)=>{let n=e;const s=t.split(B4),r=s.length;for(let i=0;i<r;i++){const o=s[i];let a=n.nextPart.get(o);a||(a=nse(),n.nextPart.set(o,a)),n=a}return n},Hje=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,qje=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const r=(i,o)=>{n[i]=o,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=s[i])!==void 0)return r(i,o),o},set(i,o){i in n?n[i]=o:r(i,o)}}},Sj="!",aF=":",Uje=[],lF=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),Wje=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const i=[];let o=0,a=0,c=0,u;const d=r.length;for(let b=0;b<d;b++){const x=r[b];if(o===0&&a===0){if(x===aF){i.push(r.slice(c,b)),c=b+1;continue}if(x==="/"){u=b;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const h=i.length===0?r:r.slice(c);let m=h,p=!1;h.endsWith(Sj)?(m=h.slice(0,-1),p=!0):h.startsWith(Sj)&&(m=h.slice(1),p=!0);const g=u&&u>c?u-c:void 0;return lF(i,p,m,g)};if(t){const r=t+aF,i=s;s=o=>o.startsWith(r)?i(o.slice(r.length)):lF(Uje,!1,o,void 0,!0)}if(n){const r=s;s=i=>n({className:i,parseClassName:r})}return s},Vje=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let r=[];for(let i=0;i<n.length;i++){const o=n[i],a=o[0]==="[",c=t.has(o);a||c?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(o)):r.push(o)}return r.length>0&&(r.sort(),s.push(...r)),s}},Gje=e=>({cache:qje(e.cacheSize),parseClassName:Wje(e),sortModifiers:Vje(e),postfixLookupClassGroupIds:Kje(e),...Dje(e)}),Kje=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let s=0;s<n.length;s++)t[n[s]]=!0;return t},Yje=/\s+/,Xje=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:i,postfixLookupClassGroupIds:o}=t,a=[],c=e.trim().split(Yje);let u="";for(let d=c.length-1;d>=0;d-=1){const h=c[d],{isExternal:m,modifiers:p,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:x}=n(h);if(m){u=h+(u.length>0?" "+u:u);continue}let y=!!x,v;if(y){const _=b.substring(0,x);v=s(_);const S=v&&o[v]?s(b):void 0;S&&S!==v&&(v=S,y=!1)}else v=s(b);if(!v){if(!y){u=h+(u.length>0?" "+u:u);continue}if(v=s(b),!v){u=h+(u.length>0?" "+u:u);continue}y=!1}const w=p.length===0?"":p.length===1?p[0]:i(p).join(":"),k=g?w+Sj:w,T=k+v;if(a.indexOf(T)>-1)continue;a.push(T);const C=r(v,y);for(let _=0;_<C.length;++_){const S=C[_];a.push(k+S)}u=h+(u.length>0?" "+u:u)}return u},Qje=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=ise(n))&&(r&&(r+=" "),r+=s);return r},ise=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=ise(e[s]))&&(n&&(n+=" "),n+=t);return n},Jje=(e,...t)=>{let n,s,r,i;const o=c=>{const u=t.reduce((d,h)=>h(d),e());return n=Gje(u),s=n.cache.get,r=n.cache.set,i=a,a(c)},a=c=>{const u=s(c);if(u)return u;const d=Xje(c,n);return r(c,d),d};return i=o,(...c)=>i(Qje(...c))},Zje=[],bo=e=>{const t=n=>n[e]||Zje;return t.isThemeGetter=!0,t},ose=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ase=/^\((?:(\w[\w-]*):)?(.+)\)$/i,eNe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,tNe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nNe=/\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$/,sNe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rNe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,iNe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bf=e=>eNe.test(e),$s=e=>!!e&&!Number.isNaN(Number(e)),Iu=e=>!!e&&Number.isInteger(Number(e)),N8=e=>e.endsWith("%")&&$s(e.slice(0,-1)),Jd=e=>tNe.test(e),lse=()=>!0,oNe=e=>nNe.test(e)&&!sNe.test(e),iR=()=>!1,aNe=e=>rNe.test(e),lNe=e=>iNe.test(e),cNe=e=>!wn(e)&&!_n(e),uNe=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)),dNe=e=>Qm(e,dse,iR),wn=e=>ose.test(e),_p=e=>Qm(e,hse,oNe),cF=e=>Qm(e,vNe,$s),hNe=e=>Qm(e,mse,lse),fNe=e=>Qm(e,fse,iR),uF=e=>Qm(e,cse,iR),mNe=e=>Qm(e,use,lNe),R_=e=>Qm(e,pse,aNe),_n=e=>ase.test(e),Wy=e=>G0(e,hse),pNe=e=>G0(e,fse),dF=e=>G0(e,cse),gNe=e=>G0(e,dse),bNe=e=>G0(e,use),D_=e=>G0(e,pse,!0),yNe=e=>G0(e,mse,!0),Qm=(e,t,n)=>{const s=ose.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},G0=(e,t,n=!1)=>{const s=ase.exec(e);return s?s[1]?t(s[1]):n:!1},cse=e=>e==="position"||e==="percentage",use=e=>e==="image"||e==="url",dse=e=>e==="length"||e==="size"||e==="bg-size",hse=e=>e==="length",vNe=e=>e==="number",fse=e=>e==="family-name",mse=e=>e==="number"||e==="weight",pse=e=>e==="shadow",xNe=()=>{const e=bo("color"),t=bo("font"),n=bo("text"),s=bo("font-weight"),r=bo("tracking"),i=bo("leading"),o=bo("breakpoint"),a=bo("container"),c=bo("spacing"),u=bo("radius"),d=bo("shadow"),h=bo("inset-shadow"),m=bo("text-shadow"),p=bo("drop-shadow"),g=bo("blur"),b=bo("perspective"),x=bo("aspect"),y=bo("ease"),v=bo("animate"),w=()=>["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"],T=()=>[...k(),_n,wn],C=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],S=()=>[_n,wn,c],D=()=>[bf,"full","auto",...S()],E=()=>[Iu,"none","subgrid",_n,wn],B=()=>["auto",{span:["full",Iu,_n,wn]},Iu,_n,wn],I=()=>[Iu,"auto",_n,wn],L=()=>["auto","min","max","fr",_n,wn],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],A=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...S()],q=()=>[bf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],U=()=>[bf,"screen","full","dvw","lvw","svw","min","max","fit",...S()],H=()=>[bf,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],M=()=>[e,_n,wn],ee=()=>[...k(),dF,uF,{position:[_n,wn]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",gNe,dNe,{size:[_n,wn]}],re=()=>[N8,Wy,_p],Z=()=>["","none","full",u,_n,wn],K=()=>["",$s,Wy,_p],Y=()=>["solid","dashed","dotted","double"],ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[$s,N8,dF,uF],te=()=>["","none",g,_n,wn],z=()=>["none",$s,_n,wn],X=()=>["none",$s,_n,wn],fe=()=>[$s,_n,wn],xe=()=>[bf,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jd],breakpoint:[Jd],color:[lse],container:[Jd],"drop-shadow":[Jd],ease:["in","out","in-out"],font:[cNe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jd],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jd],shadow:[Jd],spacing:["px",$s],text:[Jd],"text-shadow":[Jd],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",bf,wn,_n,x]}],container:["container"],"container-type":[{"@container":["","normal","size",_n,wn]}],"container-named":[uNe],columns:[{columns:[$s,wn,_n,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:T()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Iu,"auto",_n,wn]}],basis:[{basis:[bf,"full","auto",a,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$s,bf,"auto","initial","none",wn]}],grow:[{grow:["",$s,_n,wn]}],shrink:[{shrink:["",$s,_n,wn]}],order:[{order:[Iu,"first","last","none",_n,wn]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...A(),"normal"]}],"justify-self":[{"justify-self":["auto",...A()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...A(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...A(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...A(),"baseline"]}],"place-self":[{"place-self":["auto",...A()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...H()]}],"min-block-size":[{"min-block":["auto",...H()]}],"max-block-size":[{"max-block":["none",...H()]}],w:[{w:[a,"screen",...q()]}],"min-w":[{"min-w":[a,"screen","none",...q()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",n,Wy,_p]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,yNe,hNe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",N8,wn]}],"font-family":[{font:[pNe,fNe,t]}],"font-features":[{"font-features":[wn]}],"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:[r,_n,wn]}],"line-clamp":[{"line-clamp":[$s,"none",_n,cF]}],leading:[{leading:[i,...S()]}],"list-image":[{"list-image":["none",_n,wn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_n,wn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[$s,"from-font","auto",_n,_p]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[$s,"auto",_n,wn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[Iu,_n,wn]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_n,wn]}],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",_n,wn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Iu,_n,wn],radial:["",_n,wn],conic:[Iu,_n,wn]},bNe,mNe]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-bs":[{"border-bs":K()}],"border-w-be":[{"border-be":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$s,_n,wn]}],"outline-w":[{outline:["",$s,Wy,_p]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,D_,R_]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",h,D_,R_]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[$s,_p]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",m,D_,R_]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[$s,_n,wn]}],"mix-blend":[{"mix-blend":[...ae(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ae()}],"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":[$s]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[_n,wn]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[$s]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_n,wn]}],filter:[{filter:["","none",_n,wn]}],blur:[{blur:te()}],brightness:[{brightness:[$s,_n,wn]}],contrast:[{contrast:[$s,_n,wn]}],"drop-shadow":[{"drop-shadow":["","none",p,D_,R_]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",$s,_n,wn]}],"hue-rotate":[{"hue-rotate":[$s,_n,wn]}],invert:[{invert:["",$s,_n,wn]}],saturate:[{saturate:[$s,_n,wn]}],sepia:[{sepia:["",$s,_n,wn]}],"backdrop-filter":[{"backdrop-filter":["","none",_n,wn]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[$s,_n,wn]}],"backdrop-contrast":[{"backdrop-contrast":[$s,_n,wn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$s,_n,wn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$s,_n,wn]}],"backdrop-invert":[{"backdrop-invert":["",$s,_n,wn]}],"backdrop-opacity":[{"backdrop-opacity":[$s,_n,wn]}],"backdrop-saturate":[{"backdrop-saturate":[$s,_n,wn]}],"backdrop-sepia":[{"backdrop-sepia":["",$s,_n,wn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_n,wn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$s,"initial",_n,wn]}],ease:[{ease:["linear","initial",y,_n,wn]}],delay:[{delay:[$s,_n,wn]}],animate:[{animate:["none",v,_n,wn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,_n,wn]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:z()}],"rotate-x":[{"rotate-x":z()}],"rotate-y":[{"rotate-y":z()}],"rotate-z":[{"rotate-z":z()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[_n,wn,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],zoom:[{zoom:[Iu,_n,wn]}],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",_n,wn]}],"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":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"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",_n,wn]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[$s,Wy,_p,cF]}],stroke:[{stroke:["none",...M()]}],"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"]}},wNe=Jje(xNe);function Qt(...e){return wNe(hZ(e))}const kNe=U0("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"}}),An=f.forwardRef(function({className:t,variant:n="default",size:s="default",asChild:r=!1,...i},o){const a=r?SI:"button";return l.jsx(a,{ref:o,"data-slot":"button","data-variant":n,"data-size":s,className:Qt(kNe({variant:n,size:s,className:t})),...i})}),z4=f.forwardRef(function({className:t,...n},s){return l.jsx(YZ,{ref:s,"data-slot":"checkbox",className:Qt("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:l.jsx(QZ,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:l.jsx(lC,{})})})});function y0({...e}){return l.jsx($C,{"data-slot":"dialog",...e})}function _Ne({container:e,...t}){const n=Hc();return l.jsx(BC,{"data-slot":"dialog-portal",container:e??n??void 0,...t})}function Cj({...e}){return l.jsx(Gb,{"data-slot":"dialog-close",...e})}const SNe=f.forwardRef(function({className:t,...n},s){return l.jsx(zC,{ref:s,"data-slot":"dialog-overlay",className:Qt("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})}),v0=f.forwardRef(function({className:t,children:n,showCloseButton:s=!0,overlayProps:r,...i},o){return l.jsxs(_Ne,{children:[l.jsx(SNe,{...r}),l.jsxs(FC,{ref:o,"data-slot":"dialog-content",className:Qt("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,s&&l.jsx(Gb,{"data-slot":"dialog-close",asChild:!0,children:l.jsxs(An,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[l.jsx(Tw,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})});function x0({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:Qt("flex flex-col gap-2",e),...t})}function w0({className:e,showCloseButton:t=!1,children:n,...s}){return l.jsxs("div",{"data-slot":"dialog-footer",className:Qt("-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),...s,children:[n,t&&l.jsx(Gb,{asChild:!0,children:l.jsx(An,{variant:"outline",children:"Close"})})]})}function k0({className:e,...t}){return l.jsx(HC,{"data-slot":"dialog-title",className:Qt("text-base leading-none font-medium",e),...t})}function ub({className:e,...t}){return l.jsx(AI,{"data-slot":"dialog-description",className:Qt("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const qr=f.forwardRef(function({className:t,type:n,...s},r){return l.jsx("input",{ref:r,type:n,"data-slot":"input",className:Qt("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),...s})});function Tj({className:e,...t}){return l.jsx(ZEe,{"data-slot":"label",className:Qt("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 db({...e}){return l.jsx(cAe,{"data-slot":"popover",...e})}const zx=f.forwardRef(function(t,n){return l.jsx(dAe,{ref:n,"data-slot":"popover-trigger",...t})}),hb=f.forwardRef(function({className:t,align:n="center",sideOffset:s=4,...r},i){const o=Hc();return l.jsx(hAe,{container:o??void 0,children:l.jsx(fAe,{ref:i,"data-slot":"popover-content",align:n,sideOffset:s,className:Qt("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),...r})})}),hF=f.forwardRef(function(t,n){return l.jsx(uAe,{ref:n,"data-slot":"popover-anchor",...t})});function CNe({className:e,...t}){return l.jsx("div",{"data-slot":"popover-header",className:Qt("flex flex-col gap-0.5 text-sm",e),...t})}function TNe({className:e,...t}){return l.jsx("div",{"data-slot":"popover-title",className:Qt("font-medium",e),...t})}function kl({...e}){return l.jsx(zte,{"data-slot":"select",...e})}function gse({className:e,...t}){return l.jsx(tne,{"data-slot":"select-group",className:Qt("scroll-my-1 p-1",e),...t})}function _l({...e}){return l.jsx(Ute,{"data-slot":"select-value",...e})}const Sl=f.forwardRef(function({className:t,size:n="default",children:s,...r},i){return l.jsxs(Hte,{ref:i,"data-slot":"select-trigger","data-size":n,className:Qt("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),...r,children:[s,l.jsx(Wte,{asChild:!0,children:l.jsx(wc,{className:"pointer-events-none size-4 text-muted-foreground"})})]})});function Cl({className:e,children:t,position:n="item-aligned",align:s="center",...r}){const i=Hc();return l.jsx(Gte,{container:i??void 0,children:l.jsxs(Kte,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:Qt("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:s,...r,children:[l.jsx(ENe,{}),l.jsx(Zte,{"data-position":n,className:Qt("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}),l.jsx(ANe,{})]})})}function bi({className:e,children:t,...n}){return l.jsxs(rne,{"data-slot":"select-item",className:Qt("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:[l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:l.jsx(ane,{children:l.jsx(lC,{className:"pointer-events-none"})})}),l.jsx(ine,{children:t})]})}function ENe({className:e,...t}){return l.jsx(lne,{"data-slot":"select-scroll-up-button",className:Qt("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Cge,{})})}function ANe({className:e,...t}){return l.jsx(cne,{"data-slot":"select-scroll-down-button",className:Qt("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(wc,{})})}const jNe="_tableShell_ysf4j_1",NNe="_densityCompact_ysf4j_11",MNe="_densityStandard_ysf4j_21",INe="_densityComfortable_ysf4j_29",RNe="_toolbar_ysf4j_37",DNe="_summary_ysf4j_48",LNe="_hint_ysf4j_53",PNe="_selection_ysf4j_57",ONe="_selectionStats_ysf4j_62",$Ne="_selectionMetric_ysf4j_70",BNe="_selectionMetricValue_ysf4j_74",zNe="_copyButton_ysf4j_80",FNe="_copyCheck_ysf4j_90",HNe="_scroller_ysf4j_98",qNe="_table_ysf4j_1",UNe="_headerCell_ysf4j_120",WNe="_cell_ysf4j_121",VNe="_frozenHeaderCell_ysf4j_144",GNe="_headerControls_ysf4j_149",KNe="_headerButton_ysf4j_155",YNe="_filterTrigger_ysf4j_172",XNe="_headerText_ysf4j_176",QNe="_sortIcon_ysf4j_183",JNe="_activeHeaderCell_ysf4j_199",ZNe="_reorderHandle_ysf4j_203",eMe="_reorderHandleVisible_ysf4j_226",tMe="_resizeHandle_ysf4j_246",nMe="_filterTriggerActive_ysf4j_265",sMe="_columnContextMenu_ysf4j_270",rMe="_columnContextMenuAction_ysf4j_283",iMe="_cellContent_ysf4j_315",oMe="_detailValueContent_ysf4j_316",aMe="_cellText_ysf4j_322",lMe="_detailValueText_ysf4j_323",cMe="_cellContentCollapsed_ysf4j_329",uMe="_detailValueCollapsed_ysf4j_330",dMe="_dragging_ysf4j_337",hMe="_evenRow_ysf4j_341",fMe="_selectedCell_ysf4j_349",mMe="_actionHeaderCell_ysf4j_356",pMe="_actionCell_ysf4j_357",gMe="_stickyActionHeaderCell_ysf4j_365",bMe="_stickyActionCell_ysf4j_366",yMe="_frozenCell_ysf4j_382",vMe="_hasFrozenColumn_ysf4j_388",xMe="_rowDetailButton_ysf4j_435",wMe="_detailRow_ysf4j_450",kMe="_detailCell_ysf4j_454",_Me="_detailPanel_ysf4j_461",SMe="_detailTitle_ysf4j_467",CMe="_detailItem_ysf4j_472",TMe="_detailLabel_ysf4j_479",EMe="_detailValue_ysf4j_316",AMe="_emptyValue_ysf4j_494",jMe="_emptyState_ysf4j_499",sn={tableShell:jNe,densityCompact:NNe,densityStandard:MNe,densityComfortable:INe,toolbar:RNe,summary:DNe,hint:LNe,selection:PNe,selectionStats:ONe,selectionMetric:$Ne,selectionMetricValue:BNe,copyButton:zNe,copyCheck:FNe,scroller:HNe,table:qNe,headerCell:UNe,cell:WNe,frozenHeaderCell:VNe,headerControls:GNe,headerButton:KNe,filterTrigger:YNe,headerText:XNe,sortIcon:QNe,activeHeaderCell:JNe,reorderHandle:ZNe,reorderHandleVisible:eMe,resizeHandle:tMe,filterTriggerActive:nMe,columnContextMenu:sMe,columnContextMenuAction:rMe,cellContent:iMe,detailValueContent:oMe,cellText:aMe,detailValueText:lMe,cellContentCollapsed:cMe,detailValueCollapsed:uMe,dragging:dMe,evenRow:hMe,selectedCell:fMe,actionHeaderCell:mMe,actionCell:pMe,stickyActionHeaderCell:gMe,stickyActionCell:bMe,frozenCell:yMe,hasFrozenColumn:vMe,rowDetailButton:xMe,detailRow:wMe,detailCell:kMe,detailPanel:_Me,detailTitle:SMe,detailItem:CMe,detailLabel:TMe,detailValue:EMe,emptyValue:AMe,emptyState:jMe},NMe={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"},MMe={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"},IMe=500,RMe=50,lm=160,bse=80,yse=640,fF=16,vse="application/x-qwen-web-shell-table-column",DMe=60,LMe=3,M8=["standard","compact","comfortable"],PMe={width:lm,minWidth:lm,maxWidth:lm},OMe={width:"auto"};function mF(e){return Math.min(yse,Math.max(bse,e))}function I8(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function $Me(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function Yp(e,t){return f.isValidElement(e)&&e.type===t}function BMe(e){return e.replace(/\s+/g," ").trim()}function R8(e){return e.length>DMe||e.split(/\r\n|\r|\n/).length>LMe}function zMe(e){const t=M8.indexOf(e);return M8[(t+1)%M8.length]??"standard"}function FMe(e){switch(e){case"compact":return sn.densityCompact;case"comfortable":return sn.densityComfortable;case"standard":default:return sn.densityStandard}}function Ej(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Ej).join(""):f.isValidElement(e)?e.type==="img"?e.props.alt??"":Ej(e.props.children):""}function HMe(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function xse(e,t){const n=f.Children.toArray(e.props.children).filter(s=>Yp(s,"td")||Yp(s,"th"));return{key:t,cells:n.map((s,r)=>{var o;const i=Ej(s.props.children);return{key:`${t}-${r}`,content:s.props.children,text:BMe(i),rawText:i,isHeader:s.type==="th",textAlign:(o=s.props.style)==null?void 0:o.textAlign}})}}function D8(e,t){return f.Children.toArray(e.props.children).filter(n=>Yp(n,"tr")).map((n,s)=>xse(n,`${t}-${s}`))}function qMe(e,t){return{...e,cells:Array.from({length:t},(n,s)=>e.cells[s]??HMe(e.key,s))}}function UMe(e,t){const n=f.Children.toArray(e),s=[],r=[],i=[];if(n.forEach((d,h)=>{Yp(d,"thead")?s.push(...D8(d,`head-${h}`)):Yp(d,"tbody")?r.push(...D8(d,`body-${h}`)):Yp(d,"tfoot")?r.push(...D8(d,`foot-${h}`)):Yp(d,"tr")&&i.push(xse(d,`row-${h}`))}),i.length>0){const[d,...h]=i;d!=null&&d.cells.some(m=>m.isHeader)?(s.push(d),r.push(...h)):r.push(...i)}const o=[...s,...r],a=Math.max(0,...o.map(d=>d.cells.length)),c=s[0];return{headers:Array.from({length:a},(d,h)=>{const m=c==null?void 0:c.cells[h];if(m)return m;const p=t(h);return{key:`header-${h}`,content:p,text:p,rawText:p,isHeader:!0}}),rows:r.map(d=>qMe(d,a)),columnCount:a}}function Th(e){const t=e.trim(),n=t.endsWith("%"),r=(n?t.slice(0,-1):t).replace(/[$€£¥₹,\s]/g,"");if(!/^-?(\d+(\.\d+)?|\.\d+)$/.test(r))return null;const i=Number(r);return Number.isFinite(i)?n?i/100:i:null}function wse(e,t){const n=Th(e),s=Th(t);return n!==null&&s!==null&&n!==s?n-s:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function F4(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function oR(e,t){if(!e)return[];const n=t.indexOf(e.anchorCol),s=t.indexOf(e.focusCol);if(n===-1||s===-1)return[];const r=Math.min(n,s),i=Math.max(n,s);return t.slice(r,i+1)}function H4(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function Aj(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function L8(e){return e.rawText||e.text}function pF(e,t,n){if((e[t]??lm)===n)return e;if(n===lm){const r={...e};return delete r[t],r}return{...e,[t]:n}}function gF(e,t,n){if(!e)return"";const{minRow:s,maxRow:r}=F4(e),i=oR(e,n);if(i.length===0)return"";const o=[];for(let a=s;a<=r;a++){const c=t[a];c&&o.push(i.map(u=>H4(Aj(c.cells[u]))).join("	"))}return o.join(`
`)}function WMe(e,t,n){return n.length===0?"":[n.map(r=>H4(Aj(e[r]))).join("	"),...t.map(r=>n.map(i=>H4(Aj(r.cells[i]))).join("	"))].join(`
`)}function VMe(e,t,n){if(!e)return null;const{minRow:s,maxRow:r}=F4(e),i=oR(e,n);if(i.length===0)return null;let o=0,a=0,c=0,u=0,d=1/0,h=-1/0,m=!0,p=!0,g;for(let x=s;x<=r;x++){const y=t[x];y&&i.forEach(v=>{const w=y.cells[v];if(!w)return;o+=1;const k=w.text.trim();if(!k)return;a+=1;const T=Th(k);if(T===null)return;c+=1,u+=T,d=Math.min(d,T),h=Math.max(h,T),m=m&&k.endsWith("%");const C=k.match(/[$€£¥₹]/g),_=(C==null?void 0:C.length)===1?C[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:a,numericCount:c,sum:u,average:c>0?u/c:0,min:c>0?d:0,max:c>0?h:0,format:b,currencySymbol:g}}function L_(e,t,n){const s=Object.is(e,-0)?0:e,r=n==="en"?"en-US":n;if(t.format==="percent")return new Intl.NumberFormat(r,{style:"percent",maximumFractionDigits:6}).format(s);const i=new Intl.NumberFormat(r,{maximumFractionDigits:6}).format(Math.abs(s));return t.format==="currency"&&t.currencySymbol?`${s<0?"-":""}${t.currencySymbol}${i}`:s<0?`-${i}`:i}function bF(e,t,n){if(t===n)return e;const s=e.indexOf(t),r=e.indexOf(n);if(s===-1||r===-1)return e;const i=[...e],[o]=i.splice(s,1);return o===void 0?e:(i.splice(r,0,o),i)}function GMe(e,t,n,s){if(s.size===0)return bF(e,t,n);const r=e.filter(a=>!s.has(a)),i=bF(r,t,n);if(i===r)return e;let o=0;return e.map(a=>{if(s.has(a))return a;const c=i[o];return o+=1,c??a})}function yF(e){return Array.from({length:e},(t,n)=>n)}function vF(e){return Array.from(e.types).includes(vse)}function Jv(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 KMe(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=e.toLowerCase(),s=t.value.trim().toLowerCase();switch(t.operator){case"equals":return n===s;case"notEquals":return n!==s;case"startsWith":return n.startsWith(s);case"endsWith":return n.endsWith(s);case"contains":default:return n.includes(s)}}function YMe(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Th(e),s=Th(t.value);if(n===null||s===null)return!1;switch(t.operator){case"gt":return n>s;case"gte":return n>=s;case"lt":return n<s;case"lte":return n<=s;case"between":{const r=Th(t.valueTo??"");if(r===null)return!1;const i=Math.min(s,r),o=Math.max(s,r);return n>=i&&n<=o}default:return!0}}function XMe(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:KMe(e,t.textFilter)&&YMe(e,t.numberFilter)}function xF(e,t,n){const s=Object.entries(t).map(([r,i])=>[Number(r),i]).filter(([r,i])=>r!==n&&Jv(i));return s.length===0?e:e.filter(r=>s.every(([i,o])=>{var a;return XMe(((a=r.cells[i])==null?void 0:a.text)??"",o)}))}function QMe(e,t){return t?e.map((n,s)=>({row:n,index:s})).sort((n,s)=>{var o,a;const r=wse(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((a=s.row.cells[t.columnIndex])==null?void 0:a.text)??""),i=t.direction==="asc"?r:-r;return i===0?n.index-s.index:i}).map(({row:n})=>n):e}function JMe(e,t,n){const s=new Map;return e.forEach(r=>{var o;const i=((o=r.cells[t])==null?void 0:o.text)??"";s.set(i,(s.get(i)??0)+1)}),Array.from(s.entries()).map(([r,i])=>({value:r,label:r||n,count:i})).sort((r,i)=>wse(r.value,i.value))}function ZMe(e,t){let n=0,s=0;return e.forEach(r=>{var o;const i=((o=r.cells[t])==null?void 0:o.text)??"";i&&(n+=1,Th(i)!==null&&(s+=1))}),n>0&&s/n>=.7}function e9e(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function t9e(e,t){var s,r,i;const n={};if(e.selectedValues!==void 0&&!e9e(e.selectedValues,t)&&(n.selectedValues=e.selectedValues),(s=e.textFilter)!=null&&s.value.trim()&&(n.textFilter={operator:e.textFilter.operator,value:e.textFilter.value.trim()}),(r=e.numberFilter)!=null&&r.value.trim()){const o=e.numberFilter.value.trim(),a=(i=e.numberFilter.valueTo)==null?void 0:i.trim();Th(o)!==null&&(e.numberFilter.operator!=="between"||Th(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return Jv(n)?n:void 0}function n9e({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:s}=at();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx(An,{variant:"ghost",size:"sm",className:`w-full justify-start text-xs ${(t==null?void 0:t.direction)==="asc"?"bg-muted text-primary":""}`,type:"button",onClick:()=>n(e,"asc"),children:s("markdownTable.sort.asc")}),l.jsx(An,{variant:"ghost",size:"sm",className:`w-full justify-start text-xs ${(t==null?void 0:t.direction)==="desc"?"bg-muted text-primary":""}`,type:"button",onClick:()=>n(e,"desc"),children:s("markdownTable.sort.desc")}),l.jsx(An,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",type:"button",onClick:()=>n(e,null),children:s("markdownTable.sort.clear")})]})}function s9e({onHideColumn:e}){const{t}=at();return l.jsx("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:l.jsx(An,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function r9e({columnIndex:e,columnName:t,search:n,searchInputRef:s,filteredOptions:r,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:c,onFilteredSelectionChange:u,onToggleValue:d}){const{t:h}=at();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx(qr,{ref:s,className:"h-7 text-xs",value:n,onChange:m=>c(m.currentTarget.value),placeholder:h("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":h("markdownTable.filter.searchAria",{column:t})}),l.jsxs(Tj,{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:[l.jsx(z4,{id:`markdown-table-filter-all-${e}`,name:`markdown-table-filter-all-${e}`,"data-name":`markdown-table-filter-all-${e}`,checked:a,onCheckedChange:m=>u(m===!0)}),l.jsx("span",{children:h("markdownTable.filter.selectVisible")}),l.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:r.length})]}),l.jsxs("div",{className:"max-h-[170px] overflow-auto rounded-md border bg-muted/50",children:[i.map((m,p)=>l.jsxs(Tj,{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:[l.jsx(z4,{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)}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label}),l.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:m.count})]},m.value)),r.length>i.length&&l.jsx("div",{className:"p-2 text-center text-muted-foreground",children:h("markdownTable.filter.optionLimit",{count:i.length})}),r.length===0&&l.jsx("div",{className:"p-2 text-center text-muted-foreground",children:h("markdownTable.filter.noOptions")})]})]})}function i9e({overlayId:e,columnIndex:t,columnName:n,isNumeric:s,textOperator:r,textValue:i,numberOperator:o,numberValue:a,numberValueTo:c,onTextOperatorChange:u,onTextValueChange:d,onNumberOperatorChange:h,onNumberValueChange:m,onNumberValueToChange:p}){const{t:g}=at();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx("div",{className:"font-semibold text-muted-foreground",children:g("markdownTable.filter.custom")}),s?l.jsxs(l.Fragment,{children:[l.jsxs(kl,{value:o,name:`markdown-table-number-operator-${t}`,onValueChange:b=>h(b),children:[l.jsx(Sl,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-number-operator-${t}`,"aria-label":g("markdownTable.filter.numberAria",{column:n}),children:l.jsx(_l,{})}),l.jsx(Cl,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(MMe).map(([b,x])=>l.jsx(bi,{value:b,"data-value":b,className:"text-xs",children:g(x)},b))})]}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(qr,{className:"h-7 text-xs",value:a,onChange:b=>m(b.currentTarget.value),placeholder:g("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${t}`}),o==="between"&&l.jsx(qr,{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}`})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs(kl,{value:r,name:`markdown-table-text-operator-${t}`,onValueChange:b=>u(b),children:[l.jsx(Sl,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-text-operator-${t}`,"aria-label":g("markdownTable.filter.textAria",{column:n}),children:l.jsx(_l,{})}),l.jsx(Cl,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(NMe).map(([b,x])=>l.jsx(bi,{value:b,"data-value":b,className:"text-xs",children:g(x)},b))})]}),l.jsx(qr,{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 o9e({onClear:e,onClose:t,onApply:n}){const{t:s}=at();return l.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2",children:[l.jsx(An,{variant:"outline",size:"sm",type:"button",onClick:e,children:s("markdownTable.filter.reset")}),l.jsx("span",{className:"flex-1"}),l.jsx(An,{variant:"outline",size:"sm",type:"button",onClick:t,children:s("markdownTable.filter.cancel")}),l.jsx(An,{size:"sm",type:"button",onClick:n,children:s("markdownTable.filter.confirm")})]})}function a9e({id:e,columnName:t,columnIndex:n,filter:s,isNumeric:r,options:i,sort:o,canHideColumn:a,onApply:c,onClose:u,onHideColumn:d,onSort:h}){var M,ee,V,R,re;const m=f.useMemo(()=>i.map(Z=>Z.value),[i]),[p,g]=f.useState(""),[b,x]=f.useState(()=>new Set((s==null?void 0:s.selectedValues)??m)),[y,v]=f.useState(((M=s==null?void 0:s.textFilter)==null?void 0:M.operator)??"contains"),[w,k]=f.useState(((ee=s==null?void 0:s.textFilter)==null?void 0:ee.value)??""),[T,C]=f.useState(((V=s==null?void 0:s.numberFilter)==null?void 0:V.operator)??"gt"),[_,S]=f.useState(((R=s==null?void 0:s.numberFilter)==null?void 0:R.value)??""),[D,E]=f.useState(((re=s==null?void 0:s.numberFilter)==null?void 0:re.valueTo)??""),B=f.useRef(null);f.useEffect(()=>{var Z;(Z=B.current)==null||Z.focus()},[]);const I=f.useMemo(()=>{const Z=p.trim().toLowerCase();return Z?i.filter(K=>K.label.toLowerCase().includes(Z)):i},[i,p]),L=I.slice(0,500),O=I.length>0&&I.every(Z=>b.has(Z.value)),A=Z=>{x(K=>{const Y=new Set(K);return I.forEach(ae=>{Z?Y.add(ae.value):Y.delete(ae.value)}),Y})},$=Z=>{x(K=>{const Y=new Set(K);return Y.has(Z)?Y.delete(Z):Y.add(Z),Y})},q=()=>{c(n,t9e({selectedValues:Array.from(b),textFilter:{operator:y,value:w},numberFilter:{operator:T,value:_,valueTo:D}},m))},U=()=>{c(n,void 0)},H=(o==null?void 0:o.columnIndex)===n?o:null;return l.jsxs(hb,{id:e,"data-markdown-table-filter-owner":e,align:"end",sideOffset:2,collisionPadding:6,onCloseAutoFocus:Z=>{document.activeElement&&document.activeElement!==document.body&&Z.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:[l.jsx(CNe,{className:"border-b px-2.5 py-2",children:l.jsx(TNe,{id:`${e}-title`,className:"truncate text-xs font-bold",children:t})}),l.jsx(n9e,{columnIndex:n,sortedThisColumn:H,onSort:h}),a&&l.jsx(s9e,{onHideColumn:()=>d(n)}),l.jsx(r9e,{columnIndex:n,columnName:t,search:p,searchInputRef:B,filteredOptions:I,visibleOptions:L,selectedValues:b,allFilteredSelected:O,onSearchChange:g,onFilteredSelectionChange:A,onToggleValue:$}),l.jsx(i9e,{overlayId:e,columnIndex:n,columnName:t,isNumeric:r,textOperator:y,textValue:w,numberOperator:T,numberValue:_,numberValueTo:D,onTextOperatorChange:v,onTextValueChange:k,onNumberOperatorChange:C,onNumberValueChange:S,onNumberValueToChange:E}),l.jsx(o9e,{onClear:U,onClose:u,onApply:q})]})}function l9e({children:e,fallback:t,toolbarExtra:n}){const{t:s}=at(),r=f.useMemo(()=>UMe(e,i=>s("markdownTable.column",{index:i+1})),[e,s]);return r.columnCount===0?l.jsx(l.Fragment,{children:t??l.jsx("table",{children:e})}):r.rows.length>IMe||r.columnCount>RMe?l.jsx(l.Fragment,{children:t??l.jsx("table",{children:e})}):l.jsx(c9e,{table:r,toolbarExtra:n})}function c9e({table:e,toolbarExtra:t}){const{language:n,t:s}=at(),r=r5e(),i=f.useId(),[o,a]=f.useState(null),[c,u]=f.useState({}),[d,h]=f.useState(null),[m,p]=f.useState(null),[g,b]=f.useState(null),[x,y]=f.useState(()=>new Set),[v,w]=f.useState({}),[k,T]=f.useState(()=>yF(e.columnCount)),[C,_]=f.useState(null),[S,D]=f.useState(!1),[E,B]=f.useState(null),[I,L]=f.useState(null),[O,A]=f.useState(null),[$,q]=f.useState(!1),[U,H]=f.useState("standard"),[M,ee]=f.useState(!1),[V,R]=f.useState(!1),[re,Z]=f.useState(!1),[K,Y]=f.useState(!1),ae=f.useRef(!1),le=f.useRef(null),te=f.useRef(null),z=f.useRef(null),X=f.useRef(0),fe=f.useRef(0),xe=f.useRef(0),ie=f.useRef(!0),Ce=f.useRef(null),Ke=f.useRef(null),ut=f.useRef(null),Et=f.useRef(null),st=f.useRef(null),xt=f.useRef(null),He=f.useRef(0),pn=f.useRef(0),Yt=f.useRef(null),It=f.useRef(null),me=f.useMemo(()=>`${e.columnCount}\0${e.headers.map(ve=>ve.text).join("\0")}`,[e.columnCount,e.headers]),$e=f.useRef(me),yt=f.useCallback(()=>{p(null)},[]),Me=f.useCallback(()=>{X.current+=1,le.current&&(clearTimeout(le.current),le.current=null),R(!1)},[]),Le=f.useCallback(()=>{fe.current+=1,te.current&&(clearTimeout(te.current),te.current=null),Z(!1)},[]),vn=f.useCallback(()=>{xe.current+=1,z.current&&(clearTimeout(z.current),z.current=null),Y(!1)},[]),ge=f.useCallback(()=>{He.current&&(cancelAnimationFrame(He.current),He.current=0);const ve=xt.current;xt.current=null,ve&&h(ze=>ze&&{...ze,focusRow:ve.rowIndex,focusCol:ve.columnIndex})},[]),Rt=f.useCallback(()=>{ge(),ae.current=!1,ee(!1)},[ge]);f.useEffect(()=>{const ve=()=>{document.hidden&&Rt()};return window.addEventListener("mouseup",Rt),window.addEventListener("blur",Rt),document.addEventListener("visibilitychange",ve),()=>{window.removeEventListener("mouseup",Rt),window.removeEventListener("blur",Rt),document.removeEventListener("visibilitychange",ve),He.current&&cancelAnimationFrame(He.current)}},[Rt]),f.useEffect(()=>{$e.current!==me&&($e.current=me,a(null),u({}),h(null),p(null),b(null),y(new Set),w({}),T(yF(e.columnCount)),_(null),D(!1),B(null),L(null),A(null),q(!1),H("standard"),Me(),Le(),vn(),ae.current=!1,It.current=null,ee(!1))},[Le,vn,Me,e.columnCount,me]),f.useEffect(()=>{Le()},[Le,d]),f.useEffect(()=>(ie.current=!0,()=>{ie.current=!1,le.current&&(clearTimeout(le.current),le.current=null),te.current&&(clearTimeout(te.current),te.current=null),z.current&&(clearTimeout(z.current),z.current=null)}),[]),f.useEffect(()=>{if(!m)return;const ve=`${i}-filter-${m.columnIndex}`,ze=_t=>{if(_t.target instanceof Element){const Xt=_t.target.closest("[data-markdown-table-filter-owner]");if((Xt==null?void 0:Xt.getAttribute("data-markdown-table-filter-owner"))===ve)return}p(null)},lt=()=>p(null);return document.addEventListener("scroll",ze,!0),window.addEventListener("resize",lt),()=>{document.removeEventListener("scroll",ze,!0),window.removeEventListener("resize",lt)}},[m,i]),f.useEffect(()=>{if(!g)return;const ve=_t=>{var rs;const Xt=_t.target;(rs=ut.current)!=null&&rs.contains(Xt)||b(null)},ze=_t=>{_t.key==="Escape"&&(_t.preventDefault(),b(null))},lt=()=>b(null);return document.addEventListener("mousedown",ve),document.addEventListener("keydown",ze),document.addEventListener("scroll",lt,!0),window.addEventListener("resize",lt),()=>{document.removeEventListener("mousedown",ve),document.removeEventListener("keydown",ze),document.removeEventListener("scroll",lt,!0),window.removeEventListener("resize",lt)}},[g]),f.useEffect(()=>{const ve=lt=>{var Xt,rs;const _t=lt.target;_t instanceof Node&&!((Xt=Ce.current)!=null&&Xt.contains(_t))&&!((rs=ut.current)!=null&&rs.contains(_t))&&_(null)},ze=lt=>{lt.defaultPrevented||m||O||g||lt.key==="Escape"&&_(null)};return document.addEventListener("mousedown",ve),document.addEventListener("keydown",ze),()=>{document.removeEventListener("mousedown",ve),document.removeEventListener("keydown",ze)}},[O,g,m]);const ht=f.useMemo(()=>xF(e.rows,c),[c,e.rows]),gn=f.useMemo(()=>QMe(ht,o),[ht,o]);f.useEffect(()=>{h(ve=>ve&&(F4(ve).maxRow<gn.length?ve:null))},[gn.length]);const Ue=f.useMemo(()=>{if(!m)return[];const ve=m.columnIndex;return JMe(xF(e.rows,c,ve),ve,s("markdownTable.blank"))},[c,m,s,e.rows]),De=f.useMemo(()=>e.headers.map((ve,ze)=>ZMe(e.rows,ze)),[e.headers,e.rows]),Re=f.useMemo(()=>k.filter(ve=>ve>=0&&ve<e.columnCount).filter(ve=>!x.has(ve)),[k,x,e.columnCount]),be=S?Re[0]:void 0,Ie=f.useMemo(()=>{if(!O)return null;const ve=gn.find(ze=>ze.key===O.rowKey);return(ve==null?void 0:ve.cells[O.columnIndex])??null},[O,gn]),ne=Ie==null?void 0:Ie.text;f.useEffect(()=>{Me()},[Me,Re,gn]),f.useEffect(()=>{if(!E)return;const ve=()=>{const Xt=Yt.current;Yt.current=null,pn.current&&(cancelAnimationFrame(pn.current),pn.current=0),Xt!==null&&w(rs=>pF(rs,E.columnIndex,Xt))},ze=Xt=>{Yt.current=mF(E.startWidth+Xt.clientX-E.startX),!pn.current&&(pn.current=requestAnimationFrame(ve))},lt=()=>{ve(),B(null)},_t=()=>{document.hidden&&lt()};return window.addEventListener("mousemove",ze),window.addEventListener("mouseup",lt),window.addEventListener("blur",lt),document.addEventListener("visibilitychange",_t),()=>{window.removeEventListener("mousemove",ze),window.removeEventListener("mouseup",lt),window.removeEventListener("blur",lt),document.removeEventListener("visibilitychange",_t),pn.current&&(cancelAnimationFrame(pn.current),pn.current=0),Yt.current=null}},[E]),f.useEffect(()=>{I&&!gn.some(ve=>ve.key===I)&&L(null),O&&!gn.some(ve=>ve.key===O.rowKey&&ve.cells[O.columnIndex])&&A(null)},[O,I,gn]),f.useEffect(()=>{if(O)return r()},[O,r]),f.useEffect(()=>{O&&vn()},[O,ne,vn]),f.useEffect(()=>{if(O)return()=>{const ve=st.current;st.current=null,ve!=null&&ve.isConnected&&ve.focus()}},[O]);const Ee=(ve,ze)=>{h(null),u(lt=>{const _t={...lt};return ze&&Jv(ze)?_t[ve]=ze:delete _t[ve],_t}),yt()},qe=(ve,ze)=>{h(null),_(ve),a(ze?{columnIndex:ve,direction:ze}:null)},Je=ve=>{h(null),_(ve),a(ze=>(ze==null?void 0:ze.columnIndex)!==ve?{columnIndex:ve,direction:"asc"}:ze.direction==="asc"?{columnIndex:ve,direction:"desc"}:null)},Qe=(ve,ze)=>{if(!ze){p(lt=>(lt==null?void 0:lt.columnIndex)===ve?null:lt);return}h(null),_(ve),b(null),p({columnIndex:ve})},cn=ve=>{Re.length<=1||(h(null),_(ze=>ze===ve?null:ze),yt(),u(ze=>{const lt={...ze};return delete lt[ve],lt}),a(ze=>(ze==null?void 0:ze.columnIndex)===ve?null:ze),y(ze=>{const lt=new Set(ze);return lt.add(ve),lt}))},Kn=()=>{h(null),y(new Set)},_e=()=>{D(ve=>!ve),b(null)},ft=(ve,ze)=>{if(ze!==Re[0])return;ve.preventDefault(),h(null),_(ze),p(null),b({left:Math.max(6,Math.min(ve.clientX,window.innerWidth-220-6)),top:Math.max(6,Math.min(ve.clientY,window.innerHeight-72-6))})},$t=()=>{H(ve=>zMe(ve))},pe=ve=>{h(null),A(null),vn(),L(ze=>ze===ve?null:ve)},Be=(ve,ze)=>{st.current=document.activeElement instanceof HTMLElement?document.activeElement:null,h(null),p(null),L(null),vn(),A({rowKey:ve,columnIndex:ze})},ue=()=>{A(null),vn()},Wt=()=>{if(ne==null||!navigator.clipboard)return;const ve=xe.current;navigator.clipboard.writeText(H4(ne)).then(()=>{ie.current&&xe.current===ve&&(z.current&&clearTimeout(z.current),Y(!0),z.current=setTimeout(()=>Y(!1),2e3))}).catch(ze=>console.warn("[web-shell] clipboard write failed:",ze))},Bt=f.useMemo(()=>d?F4(d):null,[d]),hn=f.useMemo(()=>new Set(oR(d,Re)),[d,Re]),gt=(ve,ze)=>{if(!Bt)return!1;const{minRow:lt,maxRow:_t}=Bt;return ve>=lt&&ve<=_t&&hn.has(ze)},Ae=(ve,ze)=>{const lt=v[ve];if(lt===void 0){const _t=U==="compact"?OMe:PMe;return ze?{..._t,...ze}:_t}return{width:lt,minWidth:lt,maxWidth:lt,...ze}},kn=(ve,ze)=>{ve.preventDefault(),ve.stopPropagation();const lt=ve.currentTarget.closest("th"),_t=lt==null?void 0:lt.getBoundingClientRect().width;B({columnIndex:ze,startX:ve.clientX,startWidth:v[ze]??(_t?Math.round(_t):lm)})},Dn=(ve,ze)=>{if(ve.ctrlKey||ve.metaKey||ve.altKey||ve.shiftKey)return;let lt=0;if(ve.key==="ArrowRight"?lt=fF:ve.key==="ArrowLeft"&&(lt=-fF),lt===0)return;ve.preventDefault(),ve.stopPropagation();const _t=ve.currentTarget.closest("th"),Xt=_t==null?void 0:_t.getBoundingClientRect().width;w(rs=>{const fs=rs[ze]??(Xt?Math.round(Xt):lm),gs=mF(fs+lt);return pF(rs,ze,gs)})},qn=(ve,ze)=>{ve.stopPropagation(),_(ze),It.current=ze,ve.dataTransfer.effectAllowed="move",ve.dataTransfer.setData(vse,String(ze))},ir=()=>{It.current=null},Qn=ve=>{It.current===null||!vF(ve.dataTransfer)||(ve.preventDefault(),ve.dataTransfer.dropEffect="move")},jr=(ve,ze)=>{const lt=It.current;ir(),!(lt===null||!vF(ve.dataTransfer))&&(ve.preventDefault(),ve.stopPropagation(),h(null),_(lt),T(_t=>GMe(_t,lt,ze,x)))},es=(ve,ze)=>{m!==null&&p(null),_(null),ae.current=!0,h({anchorRow:ve,anchorCol:ze,focusRow:ve,focusCol:ze})},Gn=(ve,ze,lt)=>{var _t;ve.button!==0||I8(ve.target)||(ve.preventDefault(),(_t=Ke.current)==null||_t.focus({preventScroll:!0}),es(ze,lt))},Dt=(ve,ze)=>{ae.current&&(ee(!0),xt.current={rowIndex:ve,columnIndex:ze},!He.current&&(He.current=requestAnimationFrame(()=>{He.current=0;const lt=xt.current;xt.current=null,lt&&h(_t=>_t&&{..._t,focusRow:lt.rowIndex,focusCol:lt.columnIndex})})))},ps=ve=>{var rs;const ze=document.elementFromPoint(ve.clientX,ve.clientY),lt=ze==null?void 0:ze.closest("[data-row-index][data-column-index]");if(!lt||!((rs=Ce.current)!=null&&rs.contains(lt)))return null;const _t=Number(lt.dataset.rowIndex),Xt=Number(lt.dataset.columnIndex);return!Number.isInteger(_t)||!Number.isInteger(Xt)?null:{rowIndex:_t,columnIndex:Xt}},is=(ve,ze,lt)=>{ve.touches.length!==1||I8(ve.target)||es(ze,lt)},os=ve=>{if(!ae.current||ve.touches.length!==1)return;const ze=ve.touches[0];if(!ze)return;const lt=ps(ze);lt&&(ve.preventDefault(),Dt(lt.rowIndex,lt.columnIndex))},ts=()=>{const ve=gF(d,gn,Re);if(!ve||!navigator.clipboard)return;const ze=fe.current;navigator.clipboard.writeText(ve).then(()=>{ie.current&&fe.current===ze&&(te.current&&clearTimeout(te.current),Z(!0),te.current=setTimeout(()=>Z(!1),2e3))}).catch(lt=>console.warn("[web-shell] clipboard write failed:",lt))},Wn=()=>{const ve=WMe(e.headers,gn,Re);if(!ve||!navigator.clipboard)return;const ze=X.current;navigator.clipboard.writeText(ve).then(()=>{ie.current&&X.current===ze&&(le.current&&clearTimeout(le.current),R(!0),le.current=setTimeout(()=>R(!1),2e3))}).catch(lt=>console.warn("[web-shell] clipboard write failed:",lt))},ds=ve=>{if($Me())return;const ze=gF(d,gn,Re);ze&&(ve.preventDefault(),ve.clipboardData.setData("text/plain",ze))},Sn=f.useMemo(()=>VMe(d,gn,Re),[Re,d,gn]),ui=(Sn==null?void 0:Sn.selectedCount)??0,Ur=Object.values(c).filter(Jv).length,lr=s(`markdownTable.density.${U}`),Cs=f.useMemo(()=>gn.some(ve=>Re.some(ze=>{const lt=ve.cells[ze];return lt?R8(L8(lt)):!1})),[Re,gn]),js=gn.length===e.rows.length?s("markdownTable.rows",{count:e.rows.length}):s("markdownTable.rowsFiltered",{visible:gn.length,total:e.rows.length}),Ii=(ve,ze)=>{const lt=L8(ve),_t=R8(lt);return l.jsx("div",{className:`${sn.cellContent} ${_t&&!ze?sn.cellContentCollapsed:""}`,title:_t&&!ze?lt:void 0,children:l.jsx("div",{className:sn.cellText,children:ve.content})})},Jr=(ve,ze)=>{const lt=ve.text.length===0,_t=L8(ve),Xt=R8(_t);return l.jsx("div",{className:`${sn.detailValueContent} ${Xt&&!ze?sn.detailValueCollapsed:""} ${lt?sn.emptyValue:""}`,title:Xt&&!ze?_t:void 0,children:l.jsx("div",{className:sn.detailValueText,children:lt?s("markdownTable.emptyValue"):ve.content})})};return l.jsxs("div",{ref:Ce,className:`${sn.tableShell} ${FMe(U)} ${S?sn.hasFrozenColumn:""} ${M?sn.dragging:""}`,children:[l.jsxs("div",{className:sn.toolbar,children:[l.jsx("span",{className:sn.summary,children:js}),l.jsx("span",{className:sn.hint,children:s("markdownTable.hint")}),l.jsx("button",{className:sn.copyButton,type:"button",onClick:Wn,children:V?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:sn.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyVisible")}),x.size>0&&l.jsx("button",{className:sn.copyButton,type:"button",onClick:Kn,children:s("markdownTable.showHiddenColumns",{count:x.size})}),l.jsx("button",{className:sn.copyButton,type:"button",onClick:$t,children:s("markdownTable.density",{density:lr})}),Cs&&l.jsx("button",{className:sn.copyButton,type:"button",onClick:()=>q(ve=>!ve),children:s($?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),Ur>0&&l.jsx("span",{className:sn.selection,children:s("markdownTable.filtersActive",{count:Ur})}),ui>0&&l.jsxs(l.Fragment,{children:[Sn&&l.jsxs("div",{className:sn.selectionStats,children:[l.jsxs("span",{className:sn.selectionMetric,children:[s("markdownTable.selection.selected")," ",l.jsx("strong",{className:sn.selectionMetricValue,children:Sn.selectedCount})]}),l.jsxs("span",{className:sn.selectionMetric,children:[s("markdownTable.selection.nonEmpty")," ",l.jsx("strong",{className:sn.selectionMetricValue,children:Sn.nonEmptyCount})]}),l.jsxs("span",{className:sn.selectionMetric,children:[s("markdownTable.selection.numeric")," ",l.jsx("strong",{className:sn.selectionMetricValue,children:Sn.numericCount})]}),Sn.numericCount>0&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:sn.selectionMetric,children:[s("markdownTable.selection.sum")," ",l.jsx("strong",{className:sn.selectionMetricValue,children:L_(Sn.sum,Sn,n)})]}),l.jsxs("span",{className:sn.selectionMetric,children:[s("markdownTable.selection.average")," ",l.jsx("strong",{className:sn.selectionMetricValue,children:L_(Sn.average,Sn,n)})]}),l.jsxs("span",{className:sn.selectionMetric,children:[s("markdownTable.selection.min")," ",l.jsx("strong",{className:sn.selectionMetricValue,children:L_(Sn.min,Sn,n)})]}),l.jsxs("span",{className:sn.selectionMetric,children:[s("markdownTable.selection.max")," ",l.jsx("strong",{className:sn.selectionMetricValue,children:L_(Sn.max,Sn,n)})]})]})]}),l.jsx("button",{className:sn.copyButton,type:"button",onClick:ts,children:re?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:sn.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyTsv")})]}),t]}),l.jsxs("div",{ref:Ke,className:sn.scroller,tabIndex:0,onCopy:ds,children:[l.jsxs("table",{className:sn.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:`${sn.headerCell} ${sn.actionHeaderCell} ${S?sn.stickyActionHeaderCell:""}`,children:s("markdownTable.actions")}),Re.map(ve=>{const ze=e.headers[ve];if(!ze)return null;const lt=(o==null?void 0:o.columnIndex)===ve,_t=Jv(c[ve]),Xt=(m==null?void 0:m.columnIndex)===ve,rs=lt?o.direction==="asc"?"↑":"↓":"↕",fs=ze.text||s("markdownTable.column",{index:ve+1}),gs=lt?s(o.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:fs}):s("markdownTable.sortByColumn",{column:fs}),Ps=lt?o.direction==="asc"?"ascending":"descending":"none",mr=`${i}-filter-${ve}`,Ri=ze.textAlign?{textAlign:ze.textAlign}:void 0,si=be===ve,cr=C===ve;return l.jsxs("th",{className:`${sn.headerCell} ${si?sn.frozenHeaderCell:""} ${cr?sn.activeHeaderCell:""}`,"aria-sort":Ps,onContextMenu:Jn=>ft(Jn,ve),onDragOver:Qn,onDrop:Jn=>jr(Jn,ve),style:Ae(ve,Ri),title:fs,children:[l.jsxs("div",{className:sn.headerControls,children:[l.jsxs("button",{className:sn.headerButton,type:"button",onClick:()=>Je(ve),"aria-label":gs,style:Ri,children:[l.jsx("span",{className:sn.headerText,style:Ri,children:ze.content}),l.jsx("span",{className:sn.sortIcon,"aria-hidden":"true",children:rs})]}),l.jsx("button",{className:`${sn.reorderHandle} ${cr?sn.reorderHandleVisible:""}`,type:"button",draggable:!0,tabIndex:cr?0:-1,onDragStart:Jn=>qn(Jn,ve),onDragEnd:ir,"aria-label":s("markdownTable.moveColumn",{column:fs}),children:"⋮⋮"}),l.jsxs(db,{open:Xt,onOpenChange:Jn=>Qe(ve,Jn),children:[l.jsx(zx,{asChild:!0,children:l.jsx("button",{className:`${sn.filterTrigger} ${_t?sn.filterTriggerActive:""}`,type:"button","aria-label":s("markdownTable.filterColumn",{column:fs}),"aria-controls":Xt?mr:void 0,children:"▾"})}),Xt&&l.jsx(a9e,{id:mr,columnName:fs,columnIndex:ve,filter:c[ve],isNumeric:De[ve]??!1,options:Ue,sort:o,canHideColumn:Re.length>1,onApply:Ee,onClose:yt,onHideColumn:cn,onSort:qe},ve)]})]}),l.jsx("button",{className:sn.resizeHandle,type:"button",onMouseDown:Jn=>kn(Jn,ve),onKeyDown:Jn=>Dn(Jn,ve),role:"separator","aria-label":s("markdownTable.resizeColumn",{column:fs}),"aria-orientation":"vertical","aria-valuemin":bse,"aria-valuemax":yse,"aria-valuenow":v[ve]??lm})]},ze.key)})]})}),l.jsx("tbody",{children:gn.map((ve,ze)=>{const lt=I===ve.key,_t=`${i}-detail-${ve.key}`;return l.jsxs(f.Fragment,{children:[l.jsxs("tr",{className:ze%2===1?sn.evenRow:void 0,children:[l.jsx("td",{className:`${sn.cell} ${sn.actionCell} ${S?sn.stickyActionCell:""}`,children:l.jsx("button",{className:sn.rowDetailButton,type:"button",onClick:()=>pe(ve.key),"aria-expanded":lt,"aria-controls":_t,"aria-label":s(lt?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:ze+1}),children:s("markdownTable.rowDetails")})}),Re.map(Xt=>{const rs=ve.cells[Xt];if(!rs)return null;const fs=rs.textAlign?{textAlign:rs.textAlign}:void 0,gs=be===Xt;return l.jsx("td",{className:`${sn.cell} ${gt(ze,Xt)?sn.selectedCell:""} ${gs?sn.frozenCell:""}`,style:Ae(Xt,fs),"data-row-index":ze,"data-column-index":Xt,onMouseDown:Ps=>Gn(Ps,ze,Xt),onMouseEnter:()=>Dt(ze,Xt),onTouchStart:Ps=>is(Ps,ze,Xt),onTouchMove:os,onTouchEnd:Rt,onTouchCancel:Rt,onDoubleClick:Ps=>{I8(Ps.target)||Be(ve.key,Xt)},children:Ii(rs,$)},rs.key)})]}),lt&&l.jsx("tr",{id:_t,className:sn.detailRow,children:l.jsx("td",{className:sn.detailCell,colSpan:Re.length+1,children:l.jsxs("div",{className:sn.detailPanel,children:[l.jsx("div",{className:sn.detailTitle,children:s("markdownTable.detailsHeader")}),Re.map(Xt=>{const rs=e.headers[Xt],fs=ve.cells[Xt];return!rs||!fs?null:l.jsxs("div",{className:sn.detailItem,children:[l.jsx("div",{className:sn.detailLabel,title:rs.text,children:rs.content}),l.jsx("div",{className:sn.detailValue,children:Jr(fs,$)})]},`${ve.key}-detail-${Xt}`)})]})})})]},ve.key)})})]}),gn.length===0&&l.jsx("div",{className:sn.emptyState,children:e.rows.length===0?s("markdownTable.empty"):s("markdownTable.emptyFiltered")})]}),g&&Re.length>0&&l.jsx("div",{ref:ut,className:sn.columnContextMenu,style:{left:g.left,top:g.top},role:"menu",children:l.jsx("button",{className:sn.columnContextMenuAction,type:"button",role:"menuitem",onClick:_e,children:s(S?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),l.jsx(y0,{open:O!==null&&Ie!==null,onOpenChange:ve=>{ve||ue()},children:Ie&&l.jsxs(v0,{ref:Et,className:"sm:max-w-lg",showCloseButton:!1,overlayProps:{onMouseDown:ue},onOpenAutoFocus:ve=>{var ze;ve.preventDefault(),(ze=Et.current)==null||ze.focus()},tabIndex:-1,children:[l.jsx(Cj,{asChild:!0,children:l.jsxs(An,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm","aria-label":s("markdownTable.close"),children:[l.jsx(Tw,{}),l.jsx("span",{className:"sr-only",children:s("markdownTable.close")})]})}),l.jsx(x0,{children:l.jsx(k0,{children:s("markdownTable.cellDialogTitle")})}),l.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:Ie.content}),l.jsxs(w0,{children:[l.jsx(An,{variant:"outline",onClick:Wt,children:s(K?"code.copied":"markdownTable.copyCell")}),l.jsx(Cj,{asChild:!0,children:l.jsx(An,{children:s("markdownTable.close")})})]})]})})]})}const u9e="_content_1n6wo_1",d9e="_inlineCode_1n6wo_127",h9e="_link_1n6wo_139",f9e="_tableWrapper_1n6wo_149",m9e="_table_1n6wo_149",p9e="_image_1n6wo_179",g9e="_codeBlock_1n6wo_187",b9e="_codeBlockHeader_1n6wo_196",y9e="_codeBlockLang_1n6wo_205",v9e="_codeBlockCopy_1n6wo_213",x9e="_codeBlockContent_1n6wo_236",w9e="_codeBlockPlain_1n6wo_256",k9e="_mermaidBlock_1n6wo_274",_9e="_mermaidInline_1n6wo_286",S9e="_mermaidLoading_1n6wo_305",C9e="_mermaidActions_1n6wo_312",T9e="_mermaidZoomWrapper_1n6wo_317",E9e="_mermaidDragging_1n6wo_325",qs={content:u9e,inlineCode:d9e,link:h9e,tableWrapper:f9e,table:m9e,image:p9e,codeBlock:g9e,codeBlockHeader:b9e,codeBlockLang:y9e,codeBlockCopy:v9e,codeBlockContent:x9e,codeBlockPlain:w9e,mermaidBlock:k9e,mermaidInline:_9e,mermaidLoading:S9e,mermaidActions:C9e,mermaidZoomWrapper:T9e,mermaidDragging:E9e},A9e=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"]),wF={"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 aR(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(wF,t)?wF[t]:t,s=A9e.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const kse=/^(https?:|mailto:)/i,j9e=/^data:image\/(png|jpeg|gif|webp);base64,/i;function _se(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:kse.test(t):!1}function Xb(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||j9e.test(t)?!0:kse.test(t):!1}let kF,N9e=0;function M9e({code:e}){const{t}=at(),n=Lb(),[s,r]=f.useState(null),[i,o]=f.useState(null),[a,c]=f.useState("diagram"),[u,d]=f.useState(!1),[h,m]=f.useState(1),[p,g]=f.useState({x:0,y:0}),[b,x]=f.useState(!1),y=f.useRef(null),v=n==="light"?"default":"dark",w=.5,k=3,T=.25,C=()=>{m(B=>Math.min(k,Math.round((B+T)*100)/100))},_=()=>{m(B=>Math.max(w,Math.round((B-T)*100)/100))},S=f.useCallback(()=>{y.current=null,x(!1),m(1),g({x:0,y:0})},[]),D=f.useCallback(B=>{B.preventDefault(),x(!0),y.current={startX:B.clientX,startY:B.clientY,origX:p.x,origY:p.y}},[p]);f.useEffect(()=>{if(!b)return;const B=L=>{if(!y.current)return;const O=L.clientX-y.current.startX,A=L.clientY-y.current.startY,$=1500;g({x:y.current.origX+O,y:Math.max(-$,Math.min($,y.current.origY+A))})},I=()=>{y.current=null,x(!1)};return window.addEventListener("mousemove",B),window.addEventListener("mouseup",I),window.addEventListener("blur",I),()=>{window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",I),window.removeEventListener("blur",I)}},[b]),f.useEffect(()=>{m(1),g({x:0,y:0})},[e]),f.useEffect(()=>{let B=!1;r(null),o(null);const I=setTimeout(()=>{oe(()=>import("./mermaid.core-5RJs-31j.js").then(L=>L.bm),[]).then(async L=>{if(B)return;const O=L.default;kF!==v&&(O.initialize({startOnLoad:!1,theme:v,securityLevel:"strict",suppressErrorRendering:!0,flowchart:{wrappingWidth:300,useMaxWidth:!1}}),kF=v);try{const A=`mermaid-${++N9e}`,{svg:$}=await O.render(A,e.trim());B||r($)}catch(A){B||o(A instanceof Error?A.message:"Mermaid render failed")}})},150);return()=>{B=!0,clearTimeout(I)}},[e,v]);const E=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?l.jsxs("div",{className:qs.codeBlock,children:[l.jsx("div",{className:qs.codeBlockHeader,children:l.jsx("span",{className:qs.codeBlockLang,children:t("mermaid.errorLabel")})}),l.jsx("pre",{className:`${qs.codeBlockContent} ${qs.codeBlockPlain}`,children:l.jsx("code",{children:e})})]}):l.jsxs("div",{className:qs.codeBlock,children:[l.jsxs("div",{className:qs.codeBlockHeader,children:[l.jsx("span",{className:qs.codeBlockLang,children:t("mermaid.label")}),l.jsxs("span",{className:qs.mermaidActions,children:[a==="diagram"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:qs.codeBlockCopy,onClick:_,title:t("mermaid.zoomOut"),disabled:h<=w,children:t("mermaid.zoomOut")}),l.jsx("button",{className:qs.codeBlockCopy,onClick:S,title:t("mermaid.zoomReset"),disabled:h===1&&p.x===0&&p.y===0,children:t("mermaid.zoomReset")}),l.jsx("button",{className:qs.codeBlockCopy,onClick:C,title:t("mermaid.zoomIn"),disabled:h>=k,children:t("mermaid.zoomIn")})]}),l.jsx("button",{className:qs.codeBlockCopy,onClick:()=>c(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),l.jsx("button",{className:qs.codeBlockCopy,onClick:E,children:t(u?"code.copied":"code.copy")})]})]}),a==="code"?l.jsx("pre",{className:`${qs.codeBlockContent} ${qs.codeBlockPlain}`,children:l.jsx("code",{children:e})}):s?l.jsx("div",{className:`${qs.mermaidZoomWrapper} ${b?qs.mermaidDragging:""}`,onMouseDown:D,onDoubleClick:S,children:l.jsx("div",{className:`${qs.mermaidBlock} ${qs.mermaidInline}`,style:{transform:`translate(${p.x}px, ${p.y}px) scale(${h})`,transformOrigin:"top center"},dangerouslySetInnerHTML:{__html:s}})}):l.jsx("div",{className:`${qs.mermaidBlock} ${qs.mermaidLoading} ${qs.mermaidInline}`,children:l.jsx("span",{children:t("mermaid.rendering")})})]})}function I9e({className:e,children:t,isStreaming:n}){const{t:s}=at(),r=Lb(),[i,o]=f.useState(null),[a,c]=f.useState(!1),{label:u,lang:d,resolvedLang:h}=aR(Sse(e)),m=String(t).replace(/\n$/,""),p=r==="light"?"github-light-default":"github-dark-default";f.useEffect(()=>{if(n||d==="mermaid"||h==="text"||dj(m)){o(null);return}const b=JTe(m,h,p);if(b!==null){o(b);return}const x=Az(m,h,p,!0);if(x!==null){o(x);return}o(null);let y=!1;return cZ(h).then(()=>{if(y)return;const v=Az(m,h,p,!0);v!==null&&o(v)}).catch(v=>{y||(console.warn("[web-shell] highlight failed for lang=%s",h,v),o(null))}),()=>{y=!0}},[m,d,h,p,n]);const g=()=>{navigator.clipboard.writeText(m).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)},()=>{})};return d==="mermaid"&&!n?l.jsx(M9e,{code:m}):l.jsxs("div",{className:qs.codeBlock,children:[l.jsxs("div",{className:qs.codeBlockHeader,children:[l.jsx("span",{className:qs.codeBlockLang,children:u}),l.jsx("button",{className:qs.codeBlockCopy,onClick:g,children:s(a?"code.copied":"code.copy")})]}),!n&&i!==null?l.jsx("div",{className:qs.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):l.jsx("pre",{className:`${qs.codeBlockContent} ${qs.codeBlockPlain}`,children:l.jsx("code",{children:m})})]})}function Sse(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 s=n[1]??"",r=t[s.length];return!r||r==="{"||r===":"?s:""}function R9e({children:e}){return l.jsx("code",{className:qs.inlineCode,children:e})}function _F({children:e}){return l.jsx("div",{className:qs.tableWrapper,children:l.jsx("table",{className:qs.table,children:e})})}const Cse=f.createContext(!1),Tse=f.createContext(void 0);function D9e({className:e,children:t}){const n=f.useContext(Cse);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?l.jsx(L9e,{className:e,isStreaming:n,children:t}):l.jsx(R9e,{children:t})}function L9e({className:e,children:t,isStreaming:n}){var m;const s=f.useContext(Tse),r=Lb(),{markdown:i}=mu(),o=String(t),a=o.replace(/\n$/,""),c=l.jsx(I9e,{className:e,isStreaming:n,children:o}),u=Sse(e),{resolvedLang:d}=aR(u);if(!!s&&!!e&&!!u)try{const p=(m=i==null?void 0:i.renderCodeBlock)==null?void 0:m.call(i,{language:u,resolvedLanguage:d,className:e,code:a,isStreaming:!!n,source:s,theme:r});if(p!=null&&typeof p!="boolean")return l.jsx(Ph,{fallback:c,label:`custom code block component render (lang=${u})`,resetKeys:[u,s,r,n?"streaming":"settled",a],children:p})}catch(p){console.error("[web-shell] custom code block renderer call failed (lang=%s):",u,p)}return c}function P9e({children:e}){return l.jsx(l.Fragment,{children:e})}const jj=/^qwen-session:\/\//i;function O9e(e){return jj.test(e.trim())?e:YX(e)}function $9e({href:e,children:t}){const n=I9();if(e&&jj.test(e.trim())){if(n==="readonly")return l.jsx("span",{className:qs.link,children:t});const r=e.trim().replace(jj,"");return l.jsx("a",{href:"#",role:"button",className:qs.link,onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:r}))},children:t})}const s=_se(e)?e:void 0;return l.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:qs.link,children:t})}function B9e({src:e,alt:t}){const n=Xb(e)?e:void 0;return l.jsx("img",{src:n,alt:t||"",className:qs.image})}function Ese(e="basic",t=""){return{code:D9e,pre:P9e,a:$9e,img:B9e,table({children:n}){if(e==="advanced"){const s=l.jsx(_F,{children:n});return l.jsx(Ph,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:l.jsx(l9e,{fallback:s,children:n})})}return l.jsx(_F,{children:n})}}}const z9e=Ese(),Tm=f.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=mu(),a=n?i:void 0,c=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,u=s?"basic":r??o??"basic",d=f.useMemo(()=>u==="advanced"?Ese("advanced",c):z9e,[u,c]),h=a==null?void 0:a.components,m=f.useMemo(()=>h?{...d,...h,...u==="advanced"?{table:d.table}:{}}:d,[d,u,h]);if(!t)return null;const p=a!=null&&a.remarkPlugins?[mB,ez,...a.remarkPlugins]:[mB,ez],g=a!=null&&a.rehypePlugins?[cz,...a.rehypePlugins]:[cz];return l.jsx("div",{className:n!=="thinking"?qs.content:void 0,"data-markdown-source":n,children:l.jsx(Cse.Provider,{value:!!s,children:l.jsx(Tse.Provider,{value:n,children:l.jsx(hke,{remarkPlugins:p,rehypePlugins:g,components:m,urlTransform:O9e,children:c})})})})});let Nj=[],Ase=[];(()=>{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?Ase:Nj).push(n=n+e[t])})();function F9e(e){if(e<768)return!1;for(let t=0,n=Nj.length;;){let s=t+n>>1;if(e<Nj[s])n=s;else if(e>=Ase[s])t=s+1;else return!0;if(t==n)return!1}}function SF(e){return e>=127462&&e<=127487}const CF=8205;function H9e(e,t,n=!0,s=!0){return(n?jse:q9e)(e,t,s)}function jse(e,t,n){if(t==e.length)return t;t&&Nse(e.charCodeAt(t))&&Mse(e.charCodeAt(t-1))&&t--;let s=P8(e,t);for(t+=TF(s);t<e.length;){let r=P8(e,t);if(s==CF||r==CF||n&&F9e(r))t+=TF(r),s=r;else if(SF(r)){let i=0,o=t-2;for(;o>=0&&SF(P8(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function q9e(e,t,n){for(;t>0;){let s=jse(e,t-2,n);if(s<t)return s;t--}return 0}function P8(e,t){let n=e.charCodeAt(t);if(!Mse(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return Nse(s)?(n-55296<<10)+(s-56320)+65536:n}function Nse(e){return e>=56320&&e<57344}function Mse(e){return e>=55296&&e<56320}function TF(e){return e<65536?1:2}class fr{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,s){[t,n]=fb(this,t,n);let r=[];return this.decompose(0,t,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(n,this.length,r,1),Gu.from(r,this.length-(n-t)+s.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=fb(this,t,n);let s=[];return this.decompose(t,n,s,0),Gu.from(s,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),s=this.length-this.scanIdentical(t,-1),r=new Zv(this),i=new Zv(t);for(let o=n,a=n;;){if(r.next(o),i.next(o),o=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=s)return!0}}iter(t=1){return new Zv(this,t)}iterRange(t,n=this.length){return new Ise(this,t,n)}iterLines(t,n){let s;if(t==null)s=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(t).from;s=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new Rse(s)}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]?fr.empty:t.length<=32?new Ki(t):Gu.from(Ki.split(t,[]))}}class Ki extends fr{constructor(t,n=U9e(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,s,r){for(let i=0;;i++){let o=this.text[i],a=r+o.length;if((n?s:a)>=t)return new W9e(r,a,s,o);r=a+1,s++}}decompose(t,n,s,r){let i=t<=0&&n>=this.length?this:new Ki(EF(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=s.pop(),a=tS(i.text,o.text.slice(),0,i.length);if(a.length<=32)s.push(new Ki(a,o.length+i.length));else{let c=a.length>>1;s.push(new Ki(a.slice(0,c)),new Ki(a.slice(c)))}}else s.push(i)}replace(t,n,s){if(!(s instanceof Ki))return super.replace(t,n,s);[t,n]=fb(this,t,n);let r=tS(this.text,tS(s.text,EF(this.text,0,t)),n),i=this.length+s.length-(n-t);return r.length<=32?new Ki(r,i):Gu.from(Ki.split(r,[]),i)}sliceString(t,n=this.length,s=`
`){[t,n]=fb(this,t,n);let r="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],c=i+a.length;i>t&&o&&(r+=s),t<c&&n>i&&(r+=a.slice(Math.max(0,t-i),n-i)),i=c+1}return r}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let s=[],r=-1;for(let i of t)s.push(i),r+=i.length+1,s.length==32&&(n.push(new Ki(s,r)),s=[],r=-1);return r>-1&&n.push(new Ki(s,r)),n}}class Gu extends fr{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let s of t)this.lines+=s.lines}lineInner(t,n,s,r){for(let i=0;;i++){let o=this.children[i],a=r+o.length,c=s+o.lines-1;if((n?c:a)>=t)return o.lineInner(t,n,s,r);r=a+1,s=c+1}}decompose(t,n,s,r){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],c=o+a.length;if(t<=c&&n>=o){let u=r&((o<=t?1:0)|(c>=n?2:0));o>=t&&c<=n&&!u?s.push(a):a.decompose(t-o,n-o,s,u)}o=c+1}}replace(t,n,s){if([t,n]=fb(this,t,n),s.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.length;if(t>=i&&n<=a){let c=o.replace(t-i,n-i,s),u=this.lines-o.lines+c.lines;if(c.lines<u>>4&&c.lines>u>>6){let d=this.children.slice();return d[r]=c,new Gu(d,this.length-(n-t)+s.length)}return super.replace(i,a,c)}i=a+1}return super.replace(t,n,s)}sliceString(t,n=this.length,s=`
`){[t,n]=fb(this,t,n);let r="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],c=o+a.length;o>t&&i&&(r+=s),t<c&&n>o&&(r+=a.sliceString(t-o,n-o,s)),o=c+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof Gu))return 0;let s=0,[r,i,o,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=n,i+=n){if(r==o||i==a)return s;let c=this.children[r],u=t.children[i];if(c!=u)return s+c.scanIdentical(u,n);s+=c.length+1}}static from(t,n=t.reduce((s,r)=>s+r.length+1,-1)){let s=0;for(let p of t)s+=p.lines;if(s<32){let p=[];for(let g of t)g.flatten(p);return new Ki(p,n)}let r=Math.max(32,s>>5),i=r<<1,o=r>>1,a=[],c=0,u=-1,d=[];function h(p){let g;if(p.lines>i&&p instanceof Gu)for(let b of p.children)h(b);else p.lines>o&&(c>o||!c)?(m(),a.push(p)):p instanceof Ki&&c&&(g=d[d.length-1])instanceof Ki&&p.lines+g.lines<=32?(c+=p.lines,u+=p.length+1,d[d.length-1]=new Ki(g.text.concat(p.text),g.length+1+p.length)):(c+p.lines>r&&m(),c+=p.lines,u+=p.length+1,d.push(p))}function m(){c!=0&&(a.push(d.length==1?d[0]:Gu.from(d,u)),u=-1,c=d.length=0)}for(let p of t)h(p);return m(),a.length==1?a[0]:new Gu(a,n)}}fr.empty=new Ki([""],0);function U9e(e){let t=-1;for(let n of e)t+=n.length+1;return t}function tS(e,t,n=0,s=1e9){for(let r=0,i=0,o=!0;i<e.length&&r<=s;i++){let a=e[i],c=r+a.length;c>=n&&(c>s&&(a=a.slice(0,s-r)),r<n&&(a=a.slice(n-r)),o?(t[t.length-1]+=a,o=!1):t.push(a)),r=c+1}return t}function EF(e,t,n){return tS(e,[""],t,n)}class Zv{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 Ki?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let s=this.nodes.length-1,r=this.nodes[s],i=this.offsets[s],o=i>>1,a=r instanceof Ki?r.text.length:r.children.length;if(o==(n>0?a:0)){if(s==0)return this.done=!0,this.value="",this;n>0&&this.offsets[s-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[s]+=n,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(r instanceof Ki){let c=r.text[o+(n<0?-1:0)];if(this.offsets[s]+=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=r.children[o+(n<0?-1:0)];t>c.length?(t-=c.length,this.offsets[s]+=n):(n<0&&this.offsets[s]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Ki?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 Ise{constructor(t,n,s){this.value="",this.done=!1,this.cursor=new Zv(t,n>s?-1:1),this.pos=n>s?t.length:0,this.from=Math.min(n,s),this.to=Math.max(n,s)}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 s=n<0?this.pos-this.from:this.to-this.pos;t>s&&(t=s),s-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*n,this.value=r.length<=s?r:n<0?r.slice(r.length-s):r.slice(0,s),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 Rse{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:s,value:r}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):s?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(fr.prototype[Symbol.iterator]=function(){return this.iter()},Zv.prototype[Symbol.iterator]=Ise.prototype[Symbol.iterator]=Rse.prototype[Symbol.iterator]=function(){return this});class W9e{constructor(t,n,s,r){this.from=t,this.to=n,this.number=s,this.text=r}get length(){return this.to-this.from}}function fb(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function qo(e,t,n=!0,s=!0){return H9e(e,t,n,s)}function V9e(e){return e>=56320&&e<57344}function G9e(e){return e>=55296&&e<56320}function hl(e,t){let n=e.charCodeAt(t);if(!G9e(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return V9e(s)?(n-55296<<10)+(s-56320)+65536:n}function lR(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Ku(e){return e<65536?1:2}const Mj=/\r\n?|\n/;var Ha=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Ha||(Ha={}));class ld{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 s=this.sections[n+1];t+=s<0?this.sections[n]:s}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,s=0,r=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(s,r,i),r+=i):r+=o,s+=i}}iterChangedRanges(t,n=!1){Ij(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let s=this.sections[n++],r=this.sections[n++];r<0?t.push(s,r):t.push(r,s)}return new ld(t)}composeDesc(t){return this.empty?t:t.empty?this:Dse(this,t)}mapDesc(t,n=!1){return t.empty?this:Rj(this,t,n)}mapPos(t,n=-1,s=Ha.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],c=this.sections[o++],u=r+a;if(c<0){if(u>t)return i+(t-r);i+=a}else{if(s!=Ha.Simple&&u>=t&&(s==Ha.TrackDel&&r<t&&u>t||s==Ha.TrackBefore&&r<t||s==Ha.TrackAfter&&u>t))return null;if(u>t||u==t&&n<0&&!a)return t==r||n<0?i:i+c;i+=c}r=u}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return i}touchesRange(t,n=t){for(let s=0,r=0;s<this.sections.length&&r<=n;){let i=this.sections[s++],o=this.sections[s++],a=r+i;if(o>=0&&r<=n&&a>=t)return r<t&&a>n?"cover":!0;r=a}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let s=this.sections[n++],r=this.sections[n++];t+=(t?" ":"")+s+(r>=0?":"+r:"")}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 ld(t)}static create(t){return new ld(t)}}class _o extends ld{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 Ij(this,(n,s,r,i,o)=>t=t.replace(r,r+(s-n),o),!1),t}mapDesc(t,n=!1){return Rj(this,t,n,!0)}invert(t){let n=this.sections.slice(),s=[];for(let r=0,i=0;r<n.length;r+=2){let o=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=o;let c=r>>1;for(;s.length<c;)s.push(fr.empty);s.push(o?t.slice(i,i+o):fr.empty)}i+=o}return new _o(n,s)}compose(t){return this.empty?t:t.empty?this:Dse(this,t,!0)}map(t,n=!1){return t.empty?this:Rj(this,t,n,!0)}iterChanges(t,n=!1){Ij(this,t,n)}get desc(){return ld.create(this.sections)}filter(t){let n=[],s=[],r=[],i=new Fx(this);e:for(let o=0,a=0;;){let c=o==t.length?1e9:t[o++];for(;a<c||a==c&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,c-a);ga(r,d,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;ga(n,d,h),h>0&&Wf(s,n,i.text),i.forward(d),a+=d}let u=t[o++];for(;a<u;){if(i.done)break e;let d=Math.min(i.len,u-a);ga(n,d,-1),ga(r,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),a+=d}}return{changes:new _o(n,s),filtered:ld.create(r)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let s=this.sections[n],r=this.sections[n+1];r<0?t.push(s):r==0?t.push([s]):t.push([s].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,s){let r=[],i=[],o=0,a=null;function c(d=!1){if(!d&&!r.length)return;o<n&&ga(r,n-o,-1);let h=new _o(r,i);a=a?a.compose(h.map(a)):h,r=[],i=[],o=0}function u(d){if(Array.isArray(d))for(let h of d)u(h);else if(d instanceof _o){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);c(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:m=h,insert:p}=d;if(h>m||h<0||m>n)throw new RangeError(`Invalid change range ${h} to ${m} (in doc of length ${n})`);let g=p?typeof p=="string"?fr.of(p.split(s||Mj)):p:fr.empty,b=g.length;if(h==m&&b==0)return;h<o&&c(),h>o&&ga(r,h-o,-1),ga(r,m-h,b),Wf(i,r,g),o=m}}return u(t),c(!a),a}static empty(t){return new _o(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],s=[];for(let r=0;r<t.length;r++){let i=t[r];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;s.length<r;)s.push(fr.empty);s[r]=fr.of(i.slice(1)),n.push(i[0],s[r].length)}}}return new _o(n,s)}static createSet(t,n){return new _o(t,n)}}function ga(e,t,n,s=!1){if(t==0&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&t==0&&e[r]==0?e[r+1]+=n:s?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Wf(e,t,n){if(n.length==0)return;let s=t.length-2>>1;if(s<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<s;)e.push(fr.empty);e.push(n)}}function Ij(e,t,n){let s=e.inserted;for(let r=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],c=e.sections[o++];if(c<0)r+=a,i+=a;else{let u=r,d=i,h=fr.empty;for(;u+=a,d+=c,c&&s&&(h=h.append(s[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],c=e.sections[o++];t(r,u,i,d,h),r=u,i=d}}}function Rj(e,t,n,s=!1){let r=[],i=s?[]:null,o=new Fx(e),a=new Fx(t);for(let c=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let u=Math.min(o.len,a.len);ga(r,u,-1),o.forward(u),a.forward(u)}else if(a.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let u=a.len;for(ga(r,a.ins,-1);u;){let d=Math.min(o.len,u);o.ins>=0&&c<o.i&&o.len<=d&&(ga(r,0,o.ins),i&&Wf(i,r,o.text),c=o.i),o.forward(d),u-=d}a.next()}else if(o.ins>=0){let u=0,d=o.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);u+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;ga(r,u,c<o.i?o.ins:0),i&&c<o.i&&Wf(i,r,o.text),c=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return i?_o.createSet(r,i):ld.create(r);throw new Error("Mismatched change set lengths")}}}function Dse(e,t,n=!1){let s=[],r=n?[]:null,i=new Fx(e),o=new Fx(t);for(let a=!1;;){if(i.done&&o.done)return r?_o.createSet(s,r):ld.create(s);if(i.ins==0)ga(s,i.len,0,a),i.next();else if(o.len==0&&!o.done)ga(s,0,o.ins,a),r&&Wf(r,s,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=s.length;if(i.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;ga(s,c,d,a),r&&d&&Wf(r,s,o.text)}else o.ins==-1?(ga(s,i.off?0:i.len,c,a),r&&Wf(r,s,i.textBit(c))):(ga(s,i.off?0:i.len,o.off?0:o.ins,a),r&&!o.off&&Wf(r,s,o.text));a=(i.ins>c||o.ins>=0&&o.len>c)&&(a||s.length>u),i.forward2(c),o.forward(c)}}}}class Fx{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?fr.empty:t[n]}textBit(t){let{inserted:n}=this.set,s=this.i-2>>1;return s>=n.length&&!t?fr.empty:n[s].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 Xp{constructor(t,n,s){this.from=t,this.to=n,this.flags=s}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 s,r;return this.empty?s=r=t.mapPos(this.from,n):(s=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),s==this.from&&r==this.to?this:new Xp(s,r,this.flags)}extend(t,n=t,s=0){if(t<=this.anchor&&n>=this.anchor)return nt.range(t,n,void 0,void 0,s);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return nt.range(this.anchor,r,void 0,void 0,s)}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 nt.range(t.anchor,t.head)}static create(t,n,s){return new Xp(t,n,s)}}class nt{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:nt.create(this.ranges.map(s=>s.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let s=0;s<this.ranges.length;s++)if(!this.ranges[s].eq(t.ranges[s],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new nt([this.main],0)}addRange(t,n=!0){return nt.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let s=this.ranges.slice();return s[n]=t,nt.create(s,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 nt(t.ranges.map(n=>Xp.fromJSON(n)),t.main)}static single(t,n=t){return new nt([nt.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 s=0,r=0;r<t.length;r++){let i=t[r];if(i.empty?i.from<=s:i.from<s)return nt.normalized(t.slice(),n);s=i.to}return new nt(t,n)}static cursor(t,n=0,s,r){return Xp.create(t,t,(n==0?0:n<0?8:16)|(s==null?7:Math.min(6,s))|(r??16777215)<<6)}static range(t,n,s,r,i){let o=(s??16777215)<<6|(r==null?7:Math.min(6,r));return!i&&t!=n&&(i=n<t?1:-1),n<t?Xp.create(n,t,48|o):Xp.create(t,n,(i?i<0?8:16:0)|o)}static normalized(t,n=0){let s=t[n];t.sort((r,i)=>r.from-i.from),n=t.indexOf(s);for(let r=1;r<t.length;r++){let i=t[r],o=t[r-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,c=Math.max(i.to,o.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?nt.range(c,a):nt.range(a,c))}}return new nt(t,n)}}function Lse(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let cR=0;class dn{constructor(t,n,s,r,i){this.combine=t,this.compareInput=n,this.compare=s,this.isStatic=r,this.id=cR++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new dn(t.combine||(n=>n),t.compareInput||((n,s)=>n===s),t.compare||(t.combine?(n,s)=>n===s:uR),!!t.static,t.enables)}of(t){return new nS([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new nS(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new nS(t,this,2,n)}from(t,n){return n||(n=s=>s),this.compute([t],s=>n(s.field(t)))}}function uR(e,t){return e==t||e.length==t.length&&e.every((n,s)=>n===t[s])}class nS{constructor(t,n,s,r){this.dependencies=t,this.facet=n,this.type=s,this.value=r,this.id=cR++}dynamicSlot(t){var n;let s=this.value,r=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,c=!1,u=!1,d=[];for(let h of this.dependencies)h=="doc"?c=!0:h=="selection"?u=!0:((n=t[h.id])!==null&&n!==void 0?n:1)&1||d.push(t[h.id]);return{create(h){return h.values[o]=s(h),1},update(h,m){if(c&&m.docChanged||u&&(m.docChanged||m.selection)||Dj(h,d)){let p=s(h);if(a?!AF(p,h.values[o],r):!r(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,m)=>{let p,g=m.config.address[i];if(g!=null){let b=U4(m,g);if(this.dependencies.every(x=>x instanceof dn?m.facet(x)===h.facet(x):x instanceof ca?m.field(x,!1)==h.field(x,!1):!0)||(a?AF(p=s(h),b,r):r(p=s(h),b)))return h.values[o]=b,0}else p=s(h);return h.values[o]=p,1}}}}function AF(e,t,n){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!n(e[s],t[s]))return!1;return!0}function Dj(e,t){let n=!1;for(let s of t)ex(e,s)&1&&(n=!0);return n}function K9e(e,t,n){let s=n.map(c=>e[c.id]),r=n.map(c=>c.type),i=s.filter(c=>!(c&1)),o=e[t.id]>>1;function a(c){let u=[];for(let d=0;d<s.length;d++){let h=U4(c,s[d]);if(r[d]==2)for(let m of h)u.push(m);else u.push(h)}return t.combine(u)}return{create(c){for(let u of s)ex(c,u);return c.values[o]=a(c),1},update(c,u){if(!Dj(c,i))return 0;let d=a(c);return t.compare(d,c.values[o])?0:(c.values[o]=d,1)},reconfigure(c,u){let d=Dj(c,s),h=u.config.facets[t.id],m=u.facet(t);if(h&&!d&&uR(n,h))return c.values[o]=m,0;let p=a(c);return t.compare(p,m)?(c.values[o]=m,0):(c.values[o]=p,1)}}}const P_=dn.define({static:!0});class ca{constructor(t,n,s,r,i){this.id=t,this.createF=n,this.updateF=s,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new ca(cR++,t.create,t.update,t.compare||((s,r)=>s===r),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(P_).find(s=>s.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:s=>(s.values[n]=this.create(s),1),update:(s,r)=>{let i=s.values[n],o=this.updateF(i,r);return this.compareF(i,o)?0:(s.values[n]=o,1)},reconfigure:(s,r)=>{let i=s.facet(P_),o=r.facet(P_),a;return(a=i.find(c=>c.field==this))&&a!=o.find(c=>c.field==this)?(s.values[n]=a.create(s),1):r.config.address[this.id]!=null?(s.values[n]=r.field(this),0):(s.values[n]=this.create(s),1)}}}init(t){return[this,P_.of({field:this,create:t})]}get extension(){return this}}const Fp={lowest:4,low:3,default:2,high:1,highest:0};function Vy(e){return t=>new Pse(t,e)}const Jm={highest:Vy(Fp.highest),high:Vy(Fp.high),default:Vy(Fp.default),low:Vy(Fp.low),lowest:Vy(Fp.lowest)};class Pse{constructor(t,n){this.inner=t,this.prec=n}}class K0{of(t){return new Lj(this,t)}reconfigure(t){return K0.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Lj{constructor(t,n){this.compartment=t,this.inner=n}}class q4{constructor(t,n,s,r,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=s,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<s.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,s){let r=[],i=Object.create(null),o=new Map;for(let m of Y9e(t,n,o))m instanceof ca?r.push(m):(i[m.facet.id]||(i[m.facet.id]=[])).push(m);let a=Object.create(null),c=[],u=[];for(let m of r)a[m.id]=u.length<<1,u.push(p=>m.slot(p));let d=s==null?void 0:s.config.facets;for(let m in i){let p=i[m],g=p[0].facet,b=d&&d[m]||[];if(p.every(x=>x.type==0))if(a[g.id]=c.length<<1|1,uR(b,p))c.push(s.facet(g));else{let x=g.combine(p.map(y=>y.value));c.push(s&&g.compare(x,s.facet(g))?s.facet(g):x)}else{for(let x of p)x.type==0?(a[x.id]=c.length<<1|1,c.push(x.value)):(a[x.id]=u.length<<1,u.push(y=>x.dynamicSlot(y)));a[g.id]=u.length<<1,u.push(x=>K9e(x,g,p))}}let h=u.map(m=>m(a));return new q4(t,o,h,a,c,i)}}function Y9e(e,t,n){let s=[[],[],[],[],[]],r=new Map;function i(o,a){let c=r.get(o);if(c!=null){if(c<=a)return;let u=s[c].indexOf(o);u>-1&&s[c].splice(u,1),o instanceof Lj&&n.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let u of o)i(u,a);else if(o instanceof Lj){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,a)}else if(o instanceof Pse)i(o.inner,o.prec);else if(o instanceof ca)s[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof nS)s[a].push(o),o.facet.extensions&&i(o.facet.extensions,Fp.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,a)}}return i(e,Fp.default),s.reduce((o,a)=>o.concat(a))}function ex(e,t){if(t&1)return 2;let n=t>>1,s=e.status[n];if(s==4)throw new Error("Cyclic dependency between fields and/or facets");if(s&2)return s;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function U4(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const Ose=dn.define(),Pj=dn.define({combine:e=>e.some(t=>t),static:!0}),$se=dn.define({combine:e=>e.length?e[0]:void 0,static:!0}),Bse=dn.define(),zse=dn.define(),Fse=dn.define(),Hse=dn.define({combine:e=>e.length?e[0]:!1});class Xh{constructor(t,n){this.type=t,this.value=n}static define(){return new X9e}}class X9e{of(t){return new Xh(this,t)}}class Q9e{constructor(t){this.map=t}of(t){return new _s(this,t)}}class _s{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 _s(this.type,n)}is(t){return this.type==t}static define(t={}){return new Q9e(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let s=[];for(let r of t){let i=r.map(n);i&&s.push(i)}return s}}_s.reconfigure=_s.define();_s.appendConfig=_s.define();class To{constructor(t,n,s,r,i,o){this.startState=t,this.changes=n,this.selection=s,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,s&&Lse(s,n.newLength),i.some(a=>a.type==To.time)||(this.annotations=i.concat(To.time.of(Date.now())))}static create(t,n,s,r,i,o){return new To(t,n,s,r,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(To.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}To.time=Xh.define();To.userEvent=Xh.define();To.addToHistory=Xh.define();To.remote=Xh.define();function J9e(e,t){let n=[];for(let s=0,r=0;;){let i,o;if(s<e.length&&(r==t.length||t[r]>=e[s]))i=e[s++],o=e[s++];else if(r<t.length)i=t[r++],o=t[r++];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 qse(e,t,n){var s;let r,i,o;return n?(r=t.changes,i=_o.empty(t.changes.length),o=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(i):(s=e.selection)===null||s===void 0?void 0:s.map(r),effects:_s.mapEffects(e.effects,r).concat(_s.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Oj(e,t,n){let s=t.selection,r=L1(t.annotations);return t.userEvent&&(r=r.concat(To.userEvent.of(t.userEvent))),{changes:t.changes instanceof _o?t.changes:_o.of(t.changes||[],n,e.facet($se)),selection:s&&(s instanceof nt?s:nt.single(s.anchor,s.head)),effects:L1(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function Use(e,t,n){let s=Oj(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;s=qse(s,Oj(e,t[i],o?s.changes.newLength:e.doc.length),o)}let r=To.create(e,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return eIe(n?Z9e(r):r)}function Z9e(e){let t=e.startState,n=!0;for(let r of t.facet(Bse)){let i=r(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:J9e(n,i))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=_o.empty(t.doc.length);else{let o=e.changes.filter(n);r=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=To.create(t,r,e.selection&&e.selection.map(i),_s.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let s=t.facet(zse);for(let r=s.length-1;r>=0;r--){let i=s[r](e);i instanceof To?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof To?e=i[0]:e=Use(t,L1(i),!1)}return e}function eIe(e){let t=e.startState,n=t.facet(Fse),s=e;for(let r=n.length-1;r>=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(s=qse(s,Oj(t,i,e.changes.newLength),!0))}return s==e?e:To.create(t,e.changes,e.selection,s.effects,s.annotations,s.scrollIntoView)}const tIe=[];function L1(e){return e==null?tIe:Array.isArray(e)?e:[e]}var yi=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(yi||(yi={}));const nIe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let $j;try{$j=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function sIe(e){if($j)return $j.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||nIe.test(n)))return!0}return!1}function rIe(e){return t=>{if(!/\S/.test(t))return yi.Space;if(sIe(t))return yi.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return yi.Word;return yi.Other}}class nr{constructor(t,n,s,r,i,o){this.config=t,this.doc=n,this.selection=s,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)ex(this,a<<1);this.computeSlot=null}field(t,n=!0){let s=this.config.address[t.id];if(s==null){if(n)throw new RangeError("Field is not present in this state");return}return ex(this,s),U4(this,s)}update(...t){return Use(this,t,!0)}applyTransaction(t){let n=this.config,{base:s,compartments:r}=n;for(let a of t.effects)a.is(K0.reconfigure)?(n&&(r=new Map,n.compartments.forEach((c,u)=>r.set(u,c)),n=null),r.set(a.value.compartment,a.value.extension)):a.is(_s.reconfigure)?(n=null,s=a.value):a.is(_s.appendConfig)&&(n=null,s=L1(s).concat(a.value));let i;n?i=t.startState.values.slice():(n=q4.resolve(s,r,this),i=new nr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=t.startState.facet(Pj)?t.newSelection:t.newSelection.asSingle();new nr(n,t.newDoc,o,i,(a,c)=>c.update(a,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:nt.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,s=t(n.ranges[0]),r=this.changes(s.changes),i=[s.range],o=L1(s.effects);for(let a=1;a<n.ranges.length;a++){let c=t(n.ranges[a]),u=this.changes(c.changes),d=u.map(r);for(let m=0;m<a;m++)i[m]=i[m].map(d);let h=r.mapDesc(u,!0);i.push(c.range.map(h)),r=r.compose(d),o=_s.mapEffects(o,d).concat(_s.mapEffects(L1(c.effects),h))}return{changes:r,selection:nt.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof _o?t:_o.of(t,this.doc.length,this.facet(nr.lineSeparator))}toText(t){return fr.of(t.split(this.facet(nr.lineSeparator)||Mj))}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:(ex(this,n),U4(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let s in t){let r=t[s];r instanceof ca&&this.config.address[r.id]!=null&&(n[s]=r.spec.toJSON(this.field(t[s]),this))}return n}static fromJSON(t,n={},s){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(s){for(let i in s)if(Object.prototype.hasOwnProperty.call(t,i)){let o=s[i],a=t[i];r.push(o.init(c=>o.spec.fromJSON(a,c)))}}return nr.create({doc:t.doc,selection:nt.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=q4.resolve(t.extensions||[],new Map),s=t.doc instanceof fr?t.doc:fr.of((t.doc||"").split(n.staticFacet(nr.lineSeparator)||Mj)),r=t.selection?t.selection instanceof nt?t.selection:nt.single(t.selection.anchor,t.selection.head):nt.single(0);return Lse(r,s.length),n.staticFacet(Pj)||(r=r.asSingle()),new nr(n,s,r,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(nr.tabSize)}get lineBreak(){return this.facet(nr.lineSeparator)||`
`}get readOnly(){return this.facet(Hse)}phrase(t,...n){for(let s of this.facet(nr.phrases))if(Object.prototype.hasOwnProperty.call(s,t)){t=s[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(s,r)=>{if(r=="$")return"$";let i=+(r||1);return!i||i>n.length?s:n[i-1]})),t}languageDataAt(t,n,s=-1){let r=[];for(let i of this.facet(Ose))for(let o of i(this,n,s))Object.prototype.hasOwnProperty.call(o,t)&&r.push(o[t]);return r}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return rIe(n.length?n[0]:"")}wordAt(t){let{text:n,from:s,length:r}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-s,a=t-s;for(;o>0;){let c=qo(n,o,!1);if(i(n.slice(c,o))!=yi.Word)break;o=c}for(;a<r;){let c=qo(n,a);if(i(n.slice(a,c))!=yi.Word)break;a=c}return o==a?null:nt.range(o+s,a+s)}}nr.allowMultipleSelections=Pj;nr.tabSize=dn.define({combine:e=>e.length?e[0]:4});nr.lineSeparator=$se;nr.readOnly=Hse;nr.phrases=dn.define({compare(e,t){let n=Object.keys(e),s=Object.keys(t);return n.length==s.length&&n.every(r=>e[r]==t[r])}});nr.languageData=Ose;nr.changeFilter=Bse;nr.transactionFilter=zse;nr.transactionExtender=Fse;K0.reconfigure=_s.define();function Ed(e,t,n={}){let s={};for(let r of e)for(let i of Object.keys(r)){let o=r[i],a=s[i];if(a===void 0)s[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))s[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let r in t)s[r]===void 0&&(s[r]=t[r]);return s}class Em{eq(t){return this==t}range(t,n=t){return Bj.create(t,n,this)}}Em.prototype.startSide=Em.prototype.endSide=0;Em.prototype.point=!1;Em.prototype.mapMode=Ha.TrackDel;function dR(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let Bj=class Wse{constructor(t,n,s){this.from=t,this.to=n,this.value=s}static create(t,n,s){return new Wse(t,n,s)}};function zj(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class hR{constructor(t,n,s,r){this.from=t,this.to=n,this.value=s,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,n,s,r=0){let i=s?this.to:this.from;for(let o=r,a=i.length;;){if(o==a)return o;let c=o+a>>1,u=i[c]-t||(s?this.value[c].endSide:this.value[c].startSide)-n;if(c==o)return u>=0?o:a;u>=0?a=c:o=c+1}}between(t,n,s,r){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(s,1e9,!1,i);i<o;i++)if(r(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let s=[],r=[],i=[],o=-1,a=-1;for(let c=0;c<this.value.length;c++){let u=this.value[c],d=this.from[c]+t,h=this.to[c]+t,m,p;if(d==h){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(h,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&&(a=Math.max(a,p-m)),s.push(u),r.push(m-o),i.push(p-o))}return{mapped:s.length?new hR(r,i,s,a):null,pos:o}}}class Ks{constructor(t,n,s,r){this.chunkPos=t,this.chunk=n,this.nextLayer=s,this.maxPoint=r}static create(t,n,s,r){return new Ks(t,n,s,r)}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:s=!1,filterFrom:r=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(s&&(n=n.slice().sort(zj)),this.isEmpty)return n.length?Ks.of(n):this;let a=new Vse(this,null,-1).goto(0),c=0,u=[],d=new gd;for(;a.value||c<n.length;)if(c<n.length&&(a.from-n[c].from||a.startSide-n[c].value.startSide)>=0){let h=n[c++];d.addInner(h.from,h.to,h.value)||u.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(a.chunkIndex)<n[c].from)&&(!o||r>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||r>a.to||i<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||u.push(Bj.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!u.length?Ks.empty:this.nextLayer.update({add:u,filter:o,filterFrom:r,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],s=[],r=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],c=this.chunk[o],u=t.touchesRange(a,a+c.length);if(u===!1)r=Math.max(r,c.maxPoint),n.push(c),s.push(t.mapPos(a));else if(u===!0){let{mapped:d,pos:h}=c.map(a,t);d&&(r=Math.max(r,d.maxPoint),n.push(d),s.push(h))}}let i=this.nextLayer.map(t);return n.length==0?i:new Ks(s,n,i||Ks.empty,r)}between(t,n,s){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,s)===!1)return}this.nextLayer.between(t,n,s)}}iter(t=0){return Hx.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return Hx.from(t).goto(n)}static compare(t,n,s,r,i=-1){let o=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),a=n.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),c=jF(o,a,s),u=new Gy(o,c,i),d=new Gy(a,c,i);s.iterGaps((h,m,p)=>NF(u,h,d,m,p,r)),s.empty&&s.length==0&&NF(u,0,d,0,0,r)}static eq(t,n,s=0,r){r==null&&(r=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 a=jF(i,o),c=new Gy(i,a,0).goto(s),u=new Gy(o,a,0).goto(s);for(;;){if(c.to!=u.to||!Fj(c.active,u.active)||c.point&&(!u.point||!dR(c.point,u.point)))return!1;if(c.to>r)return!0;c.next(),u.next()}}static spans(t,n,s,r,i=-1){let o=new Gy(t,null,i).goto(n),a=n,c=o.openStart;for(;;){let u=Math.min(o.to,s);if(o.point){let d=o.activeForPoint(o.to),h=o.pointFrom<n?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,c);r.point(a,u,o.point,d,h,o.pointRank),c=Math.min(o.openEnd(u),d.length)}else u>a&&(r.span(a,u,o.active,c),c=o.openEnd(u));if(o.to>s)return c+(o.point&&o.to>s?1:0);a=o.to,o.next()}}static of(t,n=!1){let s=new gd;for(let r of t instanceof Bj?[t]:n?iIe(t):t)s.add(r.from,r.to,r.value);return s.finish()}static join(t){if(!t.length)return Ks.empty;let n=t[t.length-1];for(let s=t.length-2;s>=0;s--)for(let r=t[s];r!=Ks.empty;r=r.nextLayer)n=new Ks(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}Ks.empty=new Ks([],[],null,-1);function iIe(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let s=e[n];if(zj(t,s)>0)return e.slice().sort(zj);t=s}return e}Ks.empty.nextLayer=Ks.empty;class gd{finishChunk(t){this.chunks.push(new hR(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,s){this.addInner(t,n,s)||(this.nextLayer||(this.nextLayer=new gd)).add(t,n,s)}addInner(t,n,s){let r=t-this.lastTo||s.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||s.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<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=s,this.lastFrom=t,this.lastTo=n,this.value.push(s),s.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 s=n.value.length-1;return this.last=n.value[s],this.lastFrom=n.from[s]+t,this.lastTo=n.to[s]+t,!0}finish(){return this.finishInner(Ks.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=Ks.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function jF(e,t,n){let s=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&s.set(i.chunk[o],i.chunkPos[o]);let r=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let a=s.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+i.chunk[o].length))&&r.add(i.chunk[o])}return r}class Vse{constructor(t,n,s,r=0){this.layer=t,this.skip=n,this.minPoint=s,this.rank=r}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,s){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<t||r.maxPoint<this.minPoint))break;this.chunkIndex++,s=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],n,!0);(!s||this.rangeIndex<r)&&this.setRangeIndex(r)}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],s=t+n.from[this.rangeIndex];if(this.from=s,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 Hx{constructor(t){this.heap=t}static from(t,n=null,s=-1){let r=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=s&&r.push(new Vse(o,n,s,i));return r.length==1?r[0]:new Hx(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let s of this.heap)s.goto(t,n);for(let s=this.heap.length>>1;s>=0;s--)O8(this.heap,s);return this.next(),this}forward(t,n){for(let s of this.heap)s.forward(t,n);for(let s=this.heap.length>>1;s>=0;s--)O8(this.heap,s);(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(),O8(this.heap,0)}}}function O8(e,t){for(let n=e[t];;){let s=(t<<1)+1;if(s>=e.length)break;let r=e[s];if(s+1<e.length&&r.compare(e[s+1])>=0&&(r=e[s+1],s++),n.compare(r)<0)break;e[s]=n,e[t]=r,t=s}}class Gy{constructor(t,n,s){this.minPoint=s,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=Hx.from(t,n,s)}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){O_(this.active,t),O_(this.activeTo,t),O_(this.activeRank,t),this.minActive=MF(this.active,this.activeTo)}addActive(t){let n=0,{value:s,to:r,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||r-this.activeTo[n])>0;)n++;$_(this.active,n,s),$_(this.activeTo,n,r),$_(this.activeRank,n,i),t&&$_(t,n,this.cursor.from),this.minActive=MF(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let s=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>t){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),s&&O_(s,r)}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(s),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(s){this.openStart=0;for(let r=s.length-1;r>=0&&s[r]<t;r--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let n=[];for(let s=this.active.length-1;s>=0&&!(this.activeRank[s]<this.pointRank);s--)(this.activeTo[s]>t||this.activeTo[s]==t&&this.active[s].endSide>=this.point.endSide)&&n.push(this.active[s]);return n.reverse()}openEnd(t){let n=0;for(let s=this.activeTo.length-1;s>=0&&this.activeTo[s]>t;s--)n++;return n}}function NF(e,t,n,s,r,i){e.goto(t),n.goto(s);let o=s+r,a=s,c=s-t,u=!!i.boundChange;for(let d=!1;;){let h=e.to+c-n.to,m=h||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&&dR(e.point,n.point)&&Fj(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,g,e.point,n.point),d=!1):(d&&i.boundChange(a),g>a&&!Fj(e.active,n.active)&&i.compareRange(a,g,e.active,n.active),u&&g<o&&(h||e.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;a=p,m<=0&&e.next(),m>=0&&n.next()}}function Fj(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!dR(e[n],t[n]))return!1;return!0}function O_(e,t){for(let n=t,s=e.length-1;n<s;n++)e[n]=e[n+1];e.pop()}function $_(e,t,n){for(let s=e.length-1;s>=t;s--)e[s+1]=e[s];e[t]=n}function MF(e,t){let n=-1,s=1e9;for(let r=0;r<t.length;r++)(t[r]-s||e[r].endSide-e[n].endSide)<0&&(n=r,s=t[r]);return n}function Qb(e,t,n=e.length){let s=0;for(let r=0;r<n&&r<e.length;)e.charCodeAt(r)==9?(s+=t-s%t,r++):(s++,r=qo(e,r));return s}function Hj(e,t,n,s){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=qo(e,r)}return s===!0?-1:e.length}const qj="ͼ",IF=typeof Symbol>"u"?"__"+qj:Symbol.for(qj),Uj=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),RF=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Am{constructor(t,n){this.rules=[];let{finish:s}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,c,u){let d=[],h=/^@(\w+)\b/.exec(o[0]),m=h&&h[1]=="keyframes";if(h&&a==null)return c.push(o[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))i(p.split(/,\s*/).map(b=>o.map(x=>b.replace(/&/,x))).reduce((b,x)=>b.concat(x)),g,c);else if(g&&typeof g=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");i(r(p),g,d,m)}else g!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||m)&&c.push((s&&!h&&!u?o.map(s):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in t)i(r(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=RF[IF]||1;return RF[IF]=t+1,qj+t.toString(36)}static mount(t,n,s){let r=t[Uj],i=s&&s.nonce;r?i&&r.setNonce(i):r=new oIe(t,i),r.mount(Array.isArray(n)?n:[n],t)}}let DF=new Map;class oIe{constructor(t,n){let s=t.ownerDocument||t,r=s.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let i=DF.get(s);if(i)return t[Uj]=i;this.sheet=new r.CSSStyleSheet,DF.set(s,this)}else this.styleTag=s.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[Uj]=this}mount(t,n){let s=this.sheet,r=0,i=0;for(let o=0;o<t.length;o++){let a=t[o],c=this.modules.indexOf(a);if(c<i&&c>-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,a),s)for(let u=0;u<a.rules.length;u++)s.insertRule(a.rules[u],r++)}else{for(;i<c;)r+=this.modules[i++].rules.length;r+=a.rules.length,i++}}if(s)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 a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var jm={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:"'"},qx={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aIe=typeof navigator<"u"&&/Mac/.test(navigator.platform),lIe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ta=0;ta<10;ta++)jm[48+ta]=jm[96+ta]=String(ta);for(var ta=1;ta<=24;ta++)jm[ta+111]="F"+ta;for(var ta=65;ta<=90;ta++)jm[ta]=String.fromCharCode(ta+32),qx[ta]=String.fromCharCode(ta);for(var $8 in jm)qx.hasOwnProperty($8)||(qx[$8]=jm[$8]);function cIe(e){var t=aIe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||lIe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?qx:jm)[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 $r(){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 s in n)if(Object.prototype.hasOwnProperty.call(n,s)){var r=n[s];typeof r=="string"?e.setAttribute(s,r):r!=null&&(e[s]=r)}t++}for(;t<arguments.length;t++)Gse(e,arguments[t]);return e}function Gse(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++)Gse(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}let Oa=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Wj=typeof document<"u"?document:{documentElement:{style:{}}};const Vj=/Edge\/(\d+)/.exec(Oa.userAgent),Kse=/MSIE \d/.test(Oa.userAgent),Gj=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Oa.userAgent),pT=!!(Kse||Gj||Vj),LF=!pT&&/gecko\/(\d+)/i.test(Oa.userAgent),B8=!pT&&/Chrome\/(\d+)/.exec(Oa.userAgent),PF="webkitFontSmoothing"in Wj.documentElement.style,Kj=!pT&&/Apple Computer/.test(Oa.vendor),OF=Kj&&(/Mobile\/\w+/.test(Oa.userAgent)||Oa.maxTouchPoints>2);var un={mac:OF||/Mac/.test(Oa.platform),windows:/Win/.test(Oa.platform),linux:/Linux|X11/.test(Oa.platform),ie:pT,ie_version:Kse?Wj.documentMode||6:Gj?+Gj[1]:Vj?+Vj[1]:0,gecko:LF,gecko_version:LF?+(/Firefox\/(\d+)/.exec(Oa.userAgent)||[0,0])[1]:0,chrome:!!B8,chrome_version:B8?+B8[1]:0,ios:OF,android:/Android\b/.test(Oa.userAgent),webkit:PF,webkit_version:PF?+(/\bAppleWebKit\/(\d+)/.exec(Oa.userAgent)||[0,0])[1]:0,safari:Kj,safari_version:Kj?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Oa.userAgent)||[0,0])[1]:0,tabSize:Wj.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function fR(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 W4=Object.create(null);function mR(e,t,n){if(e==t)return!0;e||(e=W4),t||(t=W4);let s=Object.keys(e),r=Object.keys(t);if(s.length-0!=r.length-0)return!1;for(let i of s)if(i!=n&&(r.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function uIe(e,t){for(let n=e.attributes.length-1;n>=0;n--){let s=e.attributes[n].name;t[s]==null&&e.removeAttribute(s)}for(let n in t){let s=t[n];n=="style"?e.style.cssText=s:e.getAttribute(n)!=s&&e.setAttribute(n,s)}}function $F(e,t,n){let s=!1;if(t)for(let r in t)n&&r in n||(s=!0,r=="style"?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(s=!0,r=="style"?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return s}function dIe(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let s=e.attributes[n];t[s.name]=s.value}return t}class dc{eq(t){return!1}updateDOM(t,n,s){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,s){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var aa=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(aa||(aa={}));class Nn extends Em{constructor(t,n,s,r){super(),this.startSide=t,this.endSide=n,this.widget=s,this.spec=r}get heightRelevant(){return!1}static mark(t){return new Ww(t)}static widget(t){let n=Math.max(-1e4,Math.min(1e4,t.side||0)),s=!!t.block;return n+=s&&!t.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new _0(t,n,n,s,t.widget||null,!1)}static replace(t){let n=!!t.block,s,r;if(t.isBlockGap)s=-5e8,r=4e8;else{let{start:i,end:o}=Yse(t,n);s=(i?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new _0(t,s,r,n,t.widget||null,!0)}static line(t){return new Vw(t)}static set(t,n=!1){return Ks.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Nn.none=Ks.empty;class Ww extends Nn{constructor(t){let{start:n,end:s}=Yse(t);super(n?-1:5e8,s?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?fR(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||W4}eq(t){return this==t||t instanceof Ww&&this.tagName==t.tagName&&mR(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)}}Ww.prototype.point=!1;class Vw extends Nn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Vw&&this.spec.class==t.spec.class&&mR(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)}}Vw.prototype.mapMode=Ha.TrackBefore;Vw.prototype.point=!0;class _0 extends Nn{constructor(t,n,s,r,i,o){super(n,s,i,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?Ha.TrackBefore:Ha.TrackAfter:Ha.TrackDel}get type(){return this.startSide!=this.endSide?aa.WidgetRange:this.startSide<=0?aa.WidgetBefore:aa.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof _0&&hIe(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)}}_0.prototype.point=!0;function Yse(e,t=!1){let{inclusiveStart:n,inclusiveEnd:s}=e;return n==null&&(n=e.inclusive),s==null&&(s=e.inclusive),{start:n??t,end:s??t}}function hIe(e,t){return e==t||!!(e&&t&&e.compare(t))}function P1(e,t,n,s=0){let r=n.length-1;r>=0&&n[r]+s>=e?n[r]=Math.max(n[r],t):n.push(e,t)}class Ux extends Em{constructor(t,n,s){super(),this.tagName=t,this.attributes=n,this.rank=s}eq(t){return t==this||t instanceof Ux&&this.tagName==t.tagName&&mR(this.attributes,t.attributes)}static create(t){return new Ux(t.tagName,t.attributes||W4,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return Ks.of(t,n)}}Ux.prototype.startSide=Ux.prototype.endSide=-1;function Wx(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function Yj(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function tx(e,t){if(!t.anchorNode)return!1;try{return Yj(e,t.anchorNode)}catch{return!1}}function nx(e){return e.nodeType==3?Gx(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function sx(e,t,n,s){return n?BF(e,t,n,s,-1)||BF(e,t,n,s,1):!1}function Nm(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function V4(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function BF(e,t,n,s,r){for(;;){if(e==n&&t==s)return!0;if(t==(r<0?0:zh(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Nm(e)+(r<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?zh(e):0}else return!1}}function zh(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Vx(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function fIe(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 Xse(e,t){let n=t.width/e.offsetWidth,s=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(s>.995&&s<1.005||!isFinite(s)||Math.abs(t.height-e.offsetHeight)<1)&&(s=1),{scaleX:n,scaleY:s}}function mIe(e,t,n,s,r,i,o,a){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,h=!1;d&&!h;)if(d.nodeType==1){let m,p=d==c.body,g=1,b=1;if(p)m=fIe(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(h=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let v=d.getBoundingClientRect();({scaleX:g,scaleY:b}=Xse(d,v)),m={left:v.left,right:v.left+d.clientWidth*g,top:v.top,bottom:v.top+d.clientHeight*b}}let x=0,y=0;if(r=="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,w=m.bottom-m.top;y=(r=="center"&&v<=w?t.top+v/2-w/2:r=="start"||r=="center"&&n<0?t.top-o:t.bottom-w+o)-m.top}if(s=="nearest"?t.left<m.left+i?(x=t.left-(m.left+i),n>0&&t.right>m.right+x&&(x=t.right-m.right+i)):t.right>m.right-i&&(x=t.right-m.right+i,n<0&&t.left<m.left+x&&(x=t.left-(m.left+i))):x=(s=="center"?t.left+(t.right-t.left)/2-(m.right-m.left)/2:s=="start"==a?t.left-i:t.right-(m.right-m.left)+i)-m.left,x||y)if(p)u.scrollBy(x,y);else{let v=0,w=0;if(y){let k=d.scrollTop;d.scrollTop+=y/b,w=(d.scrollTop-k)*b}if(x){let k=d.scrollLeft;d.scrollLeft+=x/g,v=(d.scrollLeft-k)*g}t={left:t.left-v,top:t.top-w,right:t.right-v,bottom:t.bottom-w},v&&Math.abs(v-x)<1&&(s="nearest"),w&&Math.abs(w-y)<1&&(r="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 Qse(e,t=!0){let n=e.ownerDocument,s=null,r=null;for(let i=e.parentNode;i&&!(i==n.body||(!t||s)&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),t&&!s&&i.scrollWidth>i.clientWidth&&(s=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:s,y:r}}class pIe{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:s}=t;this.set(n,Math.min(t.anchorOffset,n?zh(n):0),s,Math.min(t.focusOffset,s?zh(s):0))}set(t,n,s,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=s,this.focusOffset=r}}let Lp=null;un.safari&&un.safari_version>=26&&(Lp=!1);function Jse(e){if(e.setActive)return e.setActive();if(Lp)return e.focus(Lp);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Lp==null?{get preventScroll(){return Lp={preventScroll:!0},!0}}:void 0),!Lp){Lp=!1;for(let n=0;n<t.length;){let s=t[n++],r=t[n++],i=t[n++];s.scrollTop!=r&&(s.scrollTop=r),s.scrollLeft!=i&&(s.scrollLeft=i)}}}let zF;function Gx(e,t,n=t){let s=zF||(zF=document.createRange());return s.setEnd(e,n),s.setStart(e,t),s}function O1(e,t,n,s){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};s&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=s);let i=new KeyboardEvent("keydown",r);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function gIe(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function bIe(e,t){let n=t.focusNode,s=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=s)return!1;for(s=Math.min(s,zh(n));;)if(s){if(n.nodeType!=1)return!1;let r=n.childNodes[s-1];r.contentEditable=="false"?s--:(n=r,s=zh(n))}else{if(n==e)return!0;s=Nm(n),n=n.parentNode}}function Zse(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 ere(e,t){for(let n=e,s=t;;){if(n.nodeType==3&&s>0)return{node:n,offset:s};if(n.nodeType==1&&s>0){if(n.contentEditable=="false")return null;n=n.childNodes[s-1],s=zh(n)}else if(n.parentNode&&!V4(n))s=Nm(n),n=n.parentNode;else return null}}function tre(e,t){for(let n=e,s=t;;){if(n.nodeType==3&&s<n.nodeValue.length)return{node:n,offset:s};if(n.nodeType==1&&s<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[s],s=0}else if(n.parentNode&&!V4(n))s=Nm(n)+1,n=n.parentNode;else return null}}class ru{constructor(t,n,s=!0){this.node=t,this.offset=n,this.precise=s}static before(t,n){return new ru(t.parentNode,Nm(t),n)}static after(t,n){return new ru(t.parentNode,Nm(t)+1,n)}}var Kr=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Kr||(Kr={}));const S0=Kr.LTR,pR=Kr.RTL;function nre(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const yIe=nre("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),vIe=nre("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Xj=Object.create(null),Ru=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Xj[t]=n,Xj[n]=-t}function sre(e){return e<=247?yIe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?vIe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const xIe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class td{get dir(){return this.level%2?pR:S0}constructor(t,n,s){this.from=t,this.to=n,this.level=s}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,s,r){let i=-1;for(let o=0;o<t.length;o++){let a=t[o];if(a.from<=n&&a.to>=n){if(a.level==s)return o;(i<0||(r!=0?r<0?a.from<n:a.to>n:t[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function rre(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.from!=r.from||s.to!=r.to||s.direction!=r.direction||!rre(s.inner,r.inner))return!1}return!0}const Vr=[];function wIe(e,t,n,s,r){for(let i=0;i<=s.length;i++){let o=i?s[i-1].to:t,a=i<s.length?s[i].from:n,c=i?256:r;for(let u=o,d=c,h=c;u<a;u++){let m=sre(e.charCodeAt(u));m==512?m=d:m==8&&h==4&&(m=16),Vr[u]=m==4?2:m,m&7&&(h=m),d=m}for(let u=o,d=c,h=c;u<a;u++){let m=Vr[u];if(m==128)u<a-1&&d==Vr[u+1]&&d&24?m=Vr[u]=d:Vr[u]=256;else if(m==64){let p=u+1;for(;p<a&&Vr[p]==64;)p++;let g=u&&d==8||p<n&&Vr[p]==8?h==1?1:8:256;for(let b=u;b<p;b++)Vr[b]=g;u=p-1}else m==8&&h==1&&(Vr[u]=1);d=m,m&7&&(h=m)}}}function kIe(e,t,n,s,r){let i=r==1?2:1;for(let o=0,a=0,c=0;o<=s.length;o++){let u=o?s[o-1].to:t,d=o<s.length?s[o].from:n;for(let h=u,m,p,g;h<d;h++)if(p=Xj[m=e.charCodeAt(h)])if(p<0){for(let b=a-3;b>=0;b-=3)if(Ru[b+1]==-p){let x=Ru[b+2],y=x&2?r:x&4?x&1?i:r:0;y&&(Vr[h]=Vr[Ru[b]]=y),a=b;break}}else{if(Ru.length==189)break;Ru[a++]=h,Ru[a++]=m,Ru[a++]=c}else if((g=Vr[h])==2||g==1){let b=g==r;c=b?0:1;for(let x=a-3;x>=0;x-=3){let y=Ru[x+2];if(y&2)break;if(b)Ru[x+2]|=2;else{if(y&4)break;Ru[x+2]|=4}}}}}function _Ie(e,t,n,s){for(let r=0,i=s;r<=n.length;r++){let o=r?n[r-1].to:e,a=r<n.length?n[r].from:t;for(let c=o;c<a;){let u=Vr[c];if(u==256){let d=c+1;for(;;)if(d==a){if(r==n.length)break;d=n[r++].to,a=r<n.length?n[r].from:t}else if(Vr[d]==256)d++;else break;let h=i==1,m=(d<t?Vr[d]:s)==1,p=h==m?h?1:2:s;for(let g=d,b=r,x=b?n[b-1].to:e;g>c;)g==x&&(g=n[--b].from,x=b?n[b-1].to:e),Vr[--g]=p;c=d}else i=u,c++}}}function Qj(e,t,n,s,r,i,o){let a=s%2?2:1;if(s%2==r%2)for(let c=t,u=0;c<n;){let d=!0,h=!1;if(u==i.length||c<i[u].from){let b=Vr[c];b!=a&&(d=!1,h=b==16)}let m=!d&&a==1?[]:null,p=d?s:s+1,g=c;e:for(;;)if(u<i.length&&g==i[u].from){if(h)break e;let b=i[u];if(!d)for(let x=b.to,y=u+1;;){if(x==n)break e;if(y<i.length&&i[y].from==x)x=i[y++].to;else{if(Vr[x]==a)break e;break}}if(u++,m)m.push(b);else{b.from>c&&o.push(new td(c,b.from,p));let x=b.direction==S0!=!(p%2);Jj(e,x?s+1:s,r,b.inner,b.from,b.to,o),c=b.to}g=b.to}else{if(g==n||(d?Vr[g]!=a:Vr[g]==a))break;g++}m?Qj(e,c,g,s+1,r,m,o):c<g&&o.push(new td(c,g,p)),c=g}else for(let c=n,u=i.length;c>t;){let d=!0,h=!1;if(!u||c>i[u-1].to){let b=Vr[c-1];b!=a&&(d=!1,h=b==16)}let m=!d&&a==1?[]:null,p=d?s:s+1,g=c;e:for(;;)if(u&&g==i[u-1].to){if(h)break e;let b=i[--u];if(!d)for(let x=b.from,y=u;;){if(x==t)break e;if(y&&i[y-1].to==x)x=i[--y].from;else{if(Vr[x-1]==a)break e;break}}if(m)m.push(b);else{b.to<c&&o.push(new td(b.to,c,p));let x=b.direction==S0!=!(p%2);Jj(e,x?s+1:s,r,b.inner,b.from,b.to,o),c=b.from}g=b.from}else{if(g==t||(d?Vr[g-1]!=a:Vr[g-1]==a))break;g--}m?Qj(e,g,c,s+1,r,m,o):g<c&&o.push(new td(g,c,p)),c=g}}function Jj(e,t,n,s,r,i,o){let a=t%2?2:1;wIe(e,r,i,s,a),kIe(e,r,i,s,a),_Ie(r,i,s,a),Qj(e,r,i,t,n,s,o)}function SIe(e,t,n){if(!e)return[new td(0,0,t==pR?1:0)];if(t==S0&&!n.length&&!xIe.test(e))return ire(e.length);if(n.length)for(;e.length>Vr.length;)Vr[Vr.length]=256;let s=[],r=t==S0?0:1;return Jj(e,r,r,n,0,e.length,s),s}function ire(e){return[new td(0,e,0)]}let ore="";function CIe(e,t,n,s,r){var i;let o=s.head-e.from,a=td.find(t,o,(i=s.bidiLevel)!==null&&i!==void 0?i:-1,s.assoc),c=t[a],u=c.side(r,n);if(o==u){let m=a+=r?1:-1;if(m<0||m>=t.length)return null;c=t[a=m],o=c.side(!r,n),u=c.side(r,n)}let d=qo(e.text,o,c.forward(r,n));(d<c.from||d>c.to)&&(d=u),ore=e.text.slice(Math.min(o,d),Math.max(o,d));let h=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return h&&d==u&&h.level+(r?0:1)<c.level?nt.cursor(h.side(!r,n)+e.from,h.forward(r,n)?1:-1,h.level):nt.cursor(d+e.from,c.forward(r,n)?-1:1,c.level)}function TIe(e,t,n){for(let s=t;s<n;s++){let r=sre(e.charCodeAt(s));if(r==1)return S0;if(r==2||r==4)return pR}return S0}const are=dn.define(),lre=dn.define(),cre=dn.define(),ure=dn.define(),Zj=dn.define(),dre=dn.define(),hre=dn.define(),gR=dn.define(),bR=dn.define(),fre=dn.define({combine:e=>e.some(t=>t)}),mre=dn.define({combine:e=>e.some(t=>t)}),pre=dn.define();class $1{constructor(t,n,s,r,i,o=!1){this.range=t,this.y=n,this.x=s,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new $1(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 $1(nt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const B_=_s.define({map:(e,t)=>e.map(t)}),gre=_s.define();function gl(e,t,n){let s=e.facet(ure);s.length?s[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const ah=dn.define({combine:e=>e.length?e[0]:!0});let EIe=0;const m1=dn.define({combine(e){return e.filter((t,n)=>{for(let s=0;s<n;s++)if(e[s].plugin==t.plugin)return!1;return!0})}});class xi{constructor(t,n,s,r,i){this.id=t,this.create=n,this.domEventHandlers=s,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(m1.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(m1.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:s,eventObservers:r,provide:i,decorations:o}=n||{};return new xi(EIe++,t,s,r,a=>{let c=[];return o&&c.push(gT.of(u=>{let d=u.plugin(a);return d?o(d):Nn.none})),i&&c.push(i(a)),c})}static fromClass(t,n){return xi.define((s,r)=>new t(s,r),n)}}class z8{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(s){if(gl(n.state,s,"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){gl(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(s){gl(t.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const bre=dn.define(),yR=dn.define(),gT=dn.define(),yre=dn.define(),vR=dn.define(),Gw=dn.define(),vre=dn.define();function FF(e,t){let n=e.state.facet(vre);if(!n.length)return n;let s=n.map(i=>i instanceof Function?i(e):i),r=[];return Ks.spans(s,t.from,t.to,{point(){},span(i,o,a,c){let u=i-t.from,d=o-t.from,h=r;for(let m=a.length-1;m>=0;m--,c--){let p=a[m].spec.bidiIsolate,g;if(p==null&&(p=TIe(t.text,u,d)),c>0&&h.length&&(g=h[h.length-1]).to==u&&g.direction==p)g.to=d,h=g.inner;else{let b={from:u,to:d,direction:p,inner:[]};h.push(b),h=b.inner}}}}),r}const xre=dn.define();function xR(e){let t=0,n=0,s=0,r=0;for(let i of e.state.facet(xre)){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&&(s=Math.max(s,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:s,bottom:r}}const vv=dn.define();class Rc{constructor(t,n,s,r){this.fromA=t,this.toA=n,this.fromB=s,this.toB=r}join(t){return new Rc(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,s=this;for(;n>0;n--){let r=t[n-1];if(!(r.fromA>s.toA)){if(r.toA<s.fromA)break;s=s.join(r),t.splice(n-1,1)}}return t.splice(n,0,s),t}static extendWithRanges(t,n){if(n.length==0)return t;let s=[];for(let r=0,i=0,o=0;;){let a=r<t.length?t[r].fromB:1e9,c=i<n.length?n[i]:1e9,u=Math.min(a,c);if(u==1e9)break;let d=u+o,h=u,m=d;for(;;)if(i<n.length&&n[i]<=h){let p=n[i+1];i+=2,h=Math.max(h,p);for(let g=r;g<t.length&&t[g].fromB<=h;g++)o=t[g].toA-t[g].toB;m=Math.max(m,p+o)}else if(r<t.length&&t[r].fromB<=h){let p=t[r++];h=Math.max(h,p.toB),m=Math.max(m,p.toA),o=p.toA-p.toB}else break;s.push(new Rc(d,m,u,h))}return s}}class G4{constructor(t,n,s){this.view=t,this.state=n,this.transactions=s,this.flags=0,this.startState=t.state,this.changes=_o.empty(this.startState.doc.length);for(let i of s)this.changes=this.changes.compose(i.changes);let r=[];this.changes.iterChangedRanges((i,o,a,c)=>r.push(new Rc(i,o,a,c))),this.changedRanges=r}static create(t,n,s){return new G4(t,n,s)}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 AIe=[];class Fi{constructor(t,n,s=0){this.dom=t,this.length=n,this.flags=s,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return AIe}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&&uIe(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 s=n;for(let r of this.children){if(r==t)return s;s+=r.length+r.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 s=Nm(this.dom),r=this.length?t>0:n>0;return new ru(this.parent.dom,s+(r?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 yT)return t;return null}static get(t){return t.cmTile}}class bT extends Fi{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,s=null,r,i=(t==null?void 0:t.node)==n?t:null,o=0;for(let a of this.children){if(a.sync(t),o+=a.length+a.breakAfter,r=s?s.nextSibling:n.firstChild,i&&r!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;r&&r!=a.dom;)r=HF(r);else n.insertBefore(a.dom,r);s=a.dom}for(r=s?s.nextSibling:n.firstChild,i&&r&&(i.written=!0);r;)r=HF(r);this.length=o}}function HF(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class yT extends bT{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=Fi.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],s=this,r=0,i=0;;)if(r==s.children.length){if(!n.length)return;s=s.parent,s.breakAfter&&i++,r=n.pop()}else{let o=s.children[r++];if(o instanceof Eh)n.push(r),s=o,r=0;else{let a=i+o.length,c=t(o,i);if(c!==void 0)return c;i=a+o.breakAfter}}}resolveBlock(t,n){let s,r=-1,i,o=-1;if(this.blockTiles((a,c)=>{let u=c+a.length;if(t>=c&&t<=u){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(s=void 0)}(c<t||t==u&&(n<-1?a.length:a.covers(1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,r=t-c),(u>t||t==c&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-c)}}),!s&&!i)throw new Error("No tile at position "+t);return s&&n<0||!i?{tile:s,offset:r}:{tile:i,offset:o}}}class Eh extends bT{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 s=new Eh(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class mb extends bT{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,s){let r=new mb(n||document.createElement("div"),t);return(!n||!s)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(t,n,s){let r=null,i=-1,o=null,a=-1;function c(d,h){for(let m=0,p=0;m<d.children.length&&p<=h;m++){let g=d.children[m],b=p+g.length;b>=h&&(g.isComposite()?c(g,h-p):(!o||o.isHidden&&(n>0||s&&NIe(o,g)))&&(b>h||g.flags&32)?(o=g,a=h-p):(p<h||g.flags&16&&!g.isHidden)&&(r=g,i=h-p)),p=b}}c(this,t);let u=(n<0?r:o)||r||o;return u?{tile:u,offset:u==r?i:a}:null}coordsIn(t,n){let s=this.resolveInline(t,n,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),n):jIe(this)}domIn(t,n){let s=this.resolveInline(t,n);if(s){let{tile:r,offset:i}=s;if(this.dom.contains(r.dom))return r.isText()?new ru(r.dom,Math.min(r.dom.nodeValue.length,i)):r.domPosFor(i,r.flags&16?1:r.flags&32?-1:n);let o=s.tile.parent,a=!1;for(let c of o.children){if(a)return new ru(c.dom,0);c==s.tile&&(a=!0)}}return new ru(this.dom,0)}}function jIe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=nx(t);return n[n.length-1]||null}function NIe(e,t){let n=e.coordsIn(0,1),s=t.coordsIn(0,1);return n&&s&&s.top<n.bottom}class fl extends bT{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let s=new fl(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class Qp extends Fi{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 s=this.dom.nodeValue.length;t>s&&(t=s);let r=t,i=t,o=0;t==0&&n<0||t==s&&n>=0?un.chrome||un.gecko||(t?(r--,o=1):i<s&&(i++,o=-1)):n<0?r--:i<s&&i++;let a=Gx(this.dom,r,i).getClientRects();if(!a.length)return null;let c=a[(o?o<0:n>=0)?0:a.length-1];return un.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(a,u=>u.width)||c),o?Vx(c,o<0):c||null}static of(t,n){let s=new Qp(n||document.createTextNode(t),t);return n||(s.flags|=2),s}}class C0 extends Fi{constructor(t,n,s,r){super(t,n,r),this.widget=s}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,s){let r=this.widget.coordsAt(this.dom,t,n);if(r)return r;if(s)return Vx(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let a=this.flags&16?!0:this.flags&32?!1:t>0;for(let c=a?i.length-1:0;o=i[c],!(t>0?c==0:c==i.length-1||o.top<o.bottom);c+=a?-1:1);return Vx(o,!a)}}get overrideDOMText(){if(!this.length)return fr.empty;let{root:t}=this;if(!t)return fr.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,s,r,i){return i||(i=t.toDOM(n),t.editable||(i.contentEditable="false")),new C0(i,s,t,r)}}class K4 extends Fi{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 fr.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class MIe{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,s){let{tile:r,index:i,beforeBreak:o,parents:a}=this;for(;t||n>0;)if(r.isComposite())if(o){if(!t)break;s&&s.break(),t--,o=!1}else if(i==r.children.length){if(!t&&!a.length)break;s&&s.leave(r),o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++}else{let c=r.children[i],u=c.breakAfter;(n>0?c.length<=t:c.length<t)&&(!s||s.skip(c,0,c.length)!==!1||!c.isComposite)?(o=!!u,i++,t-=c.length):(a.push({tile:r,index:i}),r=c,i=0,s&&c.isComposite()&&s.enter(c))}else if(i==r.length)o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++;else if(t){let c=Math.min(t,r.length-i);s&&s.skip(r,i,i+c),t-=c,i+=c}else break;return this.tile=r,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class IIe{constructor(t,n,s,r){this.from=t,this.to=n,this.wrapper=s,this.rank=r}}class RIe{constructor(t,n,s){this.cache=t,this.root=n,this.blockWrappers=s,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,s,r){var i;this.flushBuffer();let o=this.ensureMarks(n,s),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+t.length<512){this.cache.reused.set(a,2);let c=o.children[o.children.length-1]=new Qp(a.dom,a.text+t);c.parent=o}else o.append(r||Qp.of(t,(i=this.cache.find(Qp))===null||i===void 0?void 0:i.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,n){let s=this.curLine;s.dom!=n.line.dom&&(s.setDOM(this.cache.reused.has(n.line)?F8(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let r=s;for(let a=n.marks.length-1;a>=0;a--){let c=n.marks[a],u=r.lastChild;if(u instanceof fl&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(F8(c.dom)),r=u;else{if(this.cache.reused.get(c)){let h=Fi.get(c.dom);h&&h.setDOM(F8(c.dom))}let d=fl.of(c.mark,c.dom);r.append(d),r=d}this.cache.reused.set(c,2)}let i=Fi.get(t.text);i&&this.cache.reused.set(i,2);let o=new Qp(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,r.append(o)}addInlineWidget(t,n,s){let r=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);r||this.flushBuffer();let i=this.ensureMarks(n,s);!r&&!(t.flags&16)&&i.append(this.getBuffer(1)),i.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,s){this.flushBuffer(),this.ensureMarks(n,s).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 s;t||(t=wre);let r=mb.start(t,n||((s=this.cache.find(mb))===null||s===void 0?void 0:s.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=r)}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 s;let r=this.curLine;for(let i=t.length-1;i>=0;i--){let o=t[i],a;if(n>0&&(a=r.lastChild)&&a instanceof fl&&a.mark.eq(o))r=a,n--;else{let c=fl.of(o,(s=this.cache.find(fl,u=>u.mark.eq(o)))===null||s===void 0?void 0:s.dom);r.append(c),r=c,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!qF(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(un.ios&&qF(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(H8,0,32)||new C0(H8.toDOM(),0,H8,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,s=new IIe(t.from,t.to,t.value,n),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-s.rank||this.wrappers[r-1].to-s.to)<0;)r--;this.wrappers.splice(r,0,s)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let s of this.wrappers){let r=n.lastChild;if(s.from<this.pos&&r instanceof Eh&&r.wrapper.eq(s.wrapper))n=r;else{let i=Eh.of(s.wrapper,(t=this.cache.find(Eh,o=>o.wrapper.eq(s.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),s=this.cache.find(K4,void 0,1);return s&&(s.flags=n),s||new K4(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class DIe{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:r,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=r;let a=this.textOff=Math.min(t,r.length);return i?null:r.slice(0,a)}let n=Math.min(this.text.length,this.textOff+t),s=this.text.slice(this.textOff,n);return this.textOff=n,s}}const Y4=[C0,mb,Qp,fl,K4,Eh,yT];for(let e=0;e<Y4.length;e++)Y4[e].bucket=e;class LIe{constructor(t){this.view=t,this.buckets=Y4.map(()=>[]),this.index=Y4.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,s=this.buckets[n];s.length<6?s.push(t):s[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,s=2){let r=t.bucket,i=this.buckets[r],o=this.index[r];for(let a=i.length-1;a>=0;a--){let c=(a+o)%i.length,u=i[c];if((!n||n(u))&&!this.reused.has(u))return i.splice(c,1),c<o&&this.index[r]--,this.reused.set(u,s),u}return null}findWidget(t,n,s){let r=this.buckets[0];if(r.length)for(let i=0,o=0;;i++){if(i==r.length){if(o)return null;o=1,i=0}let a=r[i];if(!this.reused.has(a)&&(o==0?a.widget.compare(t):a.widget.constructor==t.constructor&&t.updateDOM(a.dom,this.view,a.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,a.widget==t&&a.length==n&&(a.flags&497)==s?(this.reused.set(a,1),a):(this.reused.set(a,2),new C0(a.dom,n,t,a.flags&-498|s))}}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 PIe{constructor(t,n,s,r,i){this.view=t,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new LIe(t),this.text=new DIe(t.state.doc),this.builder=new RIe(this.cache,new yT(t,t.contentDOM),Ks.iter(s)),this.cache.reused.set(n,2),this.old=new MIe(n),this.reuseWalker={skip:(o,a,c)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,n){let s=n&&this.getCompositionContext(n.text);for(let r=0,i=0,o=0;;){let a=o<t.length?t[o++]:null,c=a?a.fromA:this.old.root.length;if(c>r){let u=c-r;this.preserve(u,!o,!a),r=c,i+=u}if(!a)break;n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.forward(a.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,s),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,a.toA),this.emit(n.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(i,a.toB)),i=a.toB,r=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,s){let r=BIe(this.old),i=this.openMarks;this.old.advance(t,s?1:-1,{skip:(o,a,c)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(c-a);else{let u=c>0||a<o.length?C0.of(o.widget,this.view,c-a,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,r,i),i=r.length)}else if(o.isText())this.builder.ensureLine(null),!a&&c==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,r,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,c),r,i)),i=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof K4)this.cache.add(o);else if(o instanceof fl)this.builder.ensureLine(null),this.builder.addMark(o,r,i),this.cache.reused.set(o,1),i=r.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 fl&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=i=0):o instanceof fl&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let s=null,r=this.builder,i=0,o=Ks.spans(this.decorations,t,n,{point:(a,c,u,d,h,m)=>{if(u instanceof _0){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(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=d.length,h>d.length)r.continueWidget(c-a);else{let p=u.widget||(u.block?pb.block:pb.inline),g=OIe(u),b=this.cache.findWidget(p,c-a,g)||C0.of(p,this.view,c-a,g);u.block?(u.startSide>0&&r.addLineStartIfNotCovered(s),r.addBlockWidget(b)):(r.ensureLine(s),r.addInlineWidget(b,d,h))}s=null}else s=$Ie(s,u);c>a&&this.text.skip(c-a)},span:(a,c,u,d)=>{for(let h=a;h<c;){let m=this.text.next(Math.min(512,c-h));m==null?(r.addLineStartIfNotCovered(s),r.addBreak(),h++):(r.ensureLine(s),r.addText(m,u,h==a?d:u.length),h+=m.length),s=null}}});r.addLineStartIfNotCovered(s),this.openWidget=o>i,this.openMarks=o}forward(t,n,s=1){n-t<=10?this.old.advance(n-t,s,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,s,this.reuseWalker))}getCompositionContext(t){let n=[],s=null;for(let r=t.parentNode;;r=r.parentNode){let i=Fi.get(r);if(r==this.view.contentDOM)break;i instanceof fl?n.push(i):i!=null&&i.isLine()?s=i:i instanceof Eh||(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM?s=new mb(r,wre):s||n.push(fl.of(new Ww({tagName:r.nodeName.toLowerCase(),attributes:dIe(r)}),r)))}return{line:s,marks:n}}}function qF(e,t){let n=s=>{for(let r of s.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function OIe(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 wre={class:"cm-line"};function $Ie(e,t){let n=t.spec.attributes,s=t.spec.class;return!n&&!s||(e||(e={class:"cm-line"}),n&&fR(n,e),s&&(e.class+=" "+s)),e}function BIe(e){let t=[];for(let n=e.parents.length;n>1;n--){let s=n==e.parents.length?e.tile:e.parents[n].tile;s instanceof fl&&t.push(s.mark)}return t}function F8(e){let t=Fi.get(e);return t&&t.setDOM(e.cloneNode()),e}class pb extends dc{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}}pb.inline=new pb("span");pb.block=new pb("div");const H8=new class extends dc{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class UF{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Nn.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 yT(t,t.contentDOM),this.updateInner([new Rc(0,0,0,t.state.doc.length)],null)}update(t){var n;let s=t.changedRanges;this.minWidth>0&&s.length&&(s.every(({fromA:d,toA:h})=>h<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 r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?r=this.domChanged.newSel.head:!KIe(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let i=r>-1?FIe(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:h}=this.hasComposition;s=new Rc(d,h,t.changes.mapPos(d,-1),t.changes.mapPos(h,1)).addToSet(s.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(un.ie||un.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let c=UIe(o,this.decorations,t.changes);c.length&&(s=Rc.extendWithRanges(s,c));let u=VIe(a,this.blockWrappers,t.changes);return u.length&&(s=Rc.extendWithRanges(s,u)),i&&!s.some(d=>d.fromA<=i.range.fromA&&d.toA>=i.range.toA)&&(s=i.range.addToSet(s.slice())),this.tile.flags&2&&s.length==0?!1:(this.updateInner(s,i),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:s}=this.view;s.ignore(()=>{if(n||t.length){let o=this.tile,a=new PIe(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Fi.get(n.text)&&a.cache.reused.set(Fi.get(n.text),2),this.tile=a.run(t,n),eN(o,a.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=un.chrome||un.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||s.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];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 q8&&r.push(i.dom);s.updateGaps(r)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let n of t.transactions)for(let s of n.effects)s.is(gre)&&(this.editContextFormatting=s.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:s}=this.tile,r=this.view.root.activeElement,i=r==s,o=!i&&!(this.view.state.facet(ah)||s.tabIndex>-1)&&tx(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(i||n||o))return;let a=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)),un.gecko&&c.empty&&!this.hasComposition&&zIe(u)){let m=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(m,u.node.childNodes[u.offset]||null)),u=d=new ru(m,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!sx(u.node,u.offset,h.anchorNode,h.anchorOffset)||!sx(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,c))&&(this.view.observer.ignore(()=>{un.android&&un.chrome&&s.contains(h.focusNode)&&GIe(h.focusNode,s)&&(s.blur(),s.focus({preventScroll:!0}));let m=Wx(this.view.root);if(m)if(c.empty){if(un.gecko){let p=HIe(u.node,u.offset);if(p&&p!=3){let g=(p==1?ere:tre)(u.node,u.offset);g&&(u=new ru(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==s&&(s.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new ru(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new ru(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&sx(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,s=Wx(t.root),{anchorNode:r,anchorOffset:i}=t.observer.selectionRange;if(!s||!n.empty||!n.assoc||!s.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+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);s.collapse(d.node,d.offset),s.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let h=t.observer.selectionRange;t.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=n.from&&s.collapse(r,i)}posFromDOM(t,n){let s=this.tile.nearest(t);if(!s)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let r=s.posAtStart;if(s.isComposite()){let i;if(t==s.dom)i=s.dom.childNodes[n];else{let o=zh(t)==0?0:n==0?-1:1;for(;;){let a=t.parentNode;if(a==s.dom)break;o==0&&a.firstChild!=a.lastChild&&(t==a.firstChild?o=-1:o=1),t=a}o<0?i=t:i=t.nextSibling}if(i==s.dom.firstChild)return r;for(;i&&!Fi.get(i);)i=i.nextSibling;if(!i)return r+s.length;for(let o=0,a=r;;o++){let c=s.children[o];if(c.dom==i)return a;a+=c.length+c.breakAfter}}else return s.isText()?t==s.dom?r+n:r+(n?s.length:0):r}domAtPos(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.domPosFor(t,n):s.domIn(r,n)}inlineDOMNearPos(t,n){let s,r=-1,i=!1,o,a=-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 h=d+u.length;if(d<=t&&(s=u,r=t-d,i=h<t),h>=t&&!o&&(o=u,a=t-d,c=d>t),d>t&&o)return!0}}),!s&&!o?this.domAtPos(t,n):(i&&o?s=null:c&&s&&(o=null),s&&n<0||!o?s.domIn(r,n):o.domIn(a,n))}coordsAt(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.widget instanceof q8?null:s.coordsInWidget(r,n,!0):s.coordsIn(r,n)}lineAt(t,n){let{tile:s}=this.tile.resolveBlock(t,n);return s.isLine()?s:null}coordsForChar(t){let{tile:n,offset:s}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function r(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let c=r(a,o);if(c)return c}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=qo(i.text,o);if(a==o)return null;let c=Gx(i.dom,o,a).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 r(n,s)}measureVisibleLineHeights(t){let n=[],{from:s,to:r}=t,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,c=this.view.textDirection==Kr.LTR,u=0,d=(h,m,p)=>{for(let g=0;g<h.children.length&&!(m>r);g++){let b=h.children[g],x=m+b.length,y=b.dom.getBoundingClientRect(),{height:v}=y;if(p&&!g&&(u+=y.top-p.top),b instanceof Eh)x>s&&d(b,m,y);else if(m>=s&&(u>0&&n.push(-u),n.push(v+u),u=0,o)){let w=b.dom.lastChild,k=w?nx(w):[];if(k.length){let T=k[k.length-1],C=c?T.right-y.left:y.right-T.left;C>a&&(a=C,this.minWidth=i,this.minWidthFrom=m,this.minWidthTo=x)}}p&&g==h.children.length-1&&(u+=p.bottom-y.bottom),m=x+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"?Kr.RTL:Kr.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,c;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=nx(u.dom);if(d.length!=1)return;a+=d[0].width,c=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:c}}});if(t)return t;let n=document.createElement("div"),s,r,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=nx(n.firstChild)[0];s=n.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,i=o&&o.height?o.height:s,n.remove()}),{lineHeight:s,charWidth:r,textHeight:i}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let s=0,r=0;;r++){let i=r==n.viewports.length?null:n.viewports[r],o=i?i.from-1:this.view.state.doc.length;if(o>s){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(s).top)/this.view.scaleY;t.push(Nn.replace({widget:new q8(a),block:!0,inclusive:!0,isBlockGap:!0}).range(s,o))}if(!i)break;s=i.to+1}return Nn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(gT).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),s=!1,r=this.view.state.facet(vR).map((i,o)=>{let a=typeof i=="function";return a&&(s=!0),a?i(this.view):i});for(r.length&&(this.dynamicDecorationMap[t++]=s,n.push(Ks.join(r))),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(yre).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(pre))try{if(d(this.view,t.range,t))return!0}catch(h){gl(this.view.state,h,"scroll handler")}let{range:s}=t,r=this.coordsAt(s.head,(n=s.assoc)!==null&&n!==void 0?n:s.empty?0:s.head>s.anchor?-1:1),i;if(!r)return;!s.empty&&(i=this.coordsAt(s.anchor,s.anchor>s.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let o=xR(this.view),a={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:c,offsetHeight:u}=this.view.scrollDOM;if(mIe(this.view.scrollDOM,a,s.head<s.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==Kr.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(s.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=s=>s.isWidget()||s.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){eN(this.tile)}}function eN(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let s of e.children)eN(s,t)}}function zIe(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 kre(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let s=ere(n.focusNode,n.focusOffset),r=tre(n.focusNode,n.focusOffset),i=s||r;if(r&&s&&r.node!=s.node){let a=Fi.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)i=r;else if(e.docView.lastCompositionAfterCursor){let c=Fi.get(s.node);!c||c.isText()&&c.text!=s.node.nodeValue||(i=r)}}if(e.docView.lastCompositionAfterCursor=i!=s,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function FIe(e,t,n){let s=kre(e,n);if(!s)return null;let{node:r,from:i,to:o}=s,a=r.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(s.from,s.to)!=a)return null;let c=t.invertedDesc;return{range:new Rc(c.mapPos(i),c.mapPos(o),i,o),text:r}}function HIe(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 qIe=class{constructor(){this.changes=[]}compareRange(t,n){P1(t,n,this.changes)}comparePoint(t,n){P1(t,n,this.changes)}boundChange(t){P1(t,t,this.changes)}};function UIe(e,t,n){let s=new qIe;return Ks.compare(e,t,n,s),s.changes}class WIe{constructor(){this.changes=[]}compareRange(t,n){P1(t,n,this.changes)}comparePoint(){}boundChange(t){P1(t,t,this.changes)}}function VIe(e,t,n){let s=new WIe;return Ks.compare(e,t,n,s),s.changes}function GIe(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 KIe(e,t){let n=!1;return t&&e.iterChangedRanges((s,r)=>{s<t.to&&r>t.from&&(n=!0)}),n}class q8 extends dc{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 YIe(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(r.length==0)return nt.cursor(t);i==0?n=1:i==r.length&&(n=-1);let o=i,a=i;n<0?o=qo(r.text,i,!1):a=qo(r.text,i);let c=s(r.text.slice(o,a));for(;o>0;){let u=qo(r.text,o,!1);if(s(r.text.slice(u,o))!=c)break;o=u}for(;a<r.length;){let u=qo(r.text,a);if(s(r.text.slice(a,u))!=c)break;a=u}return nt.range(o+r.from,a+r.from)}function XIe(e,t,n,s,r){let i=Math.round((s-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let a=e.viewState.heightOracle.textHeight,c=Math.floor((r-n.top-(e.defaultLineHeight-a)*.5)/a);i+=c*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Hj(o,i,e.state.tabSize)}function tN(e,t,n){let s=e.lineBlockAt(t);if(Array.isArray(s.type)){let r;for(let i of s.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!r||i.type==aa.Text&&(r.type!=i.type||(n<0?i.from<t:i.to>t)))&&(r=i)}}return r||s}return s}function QIe(e,t,n,s){let r=tN(e,t.head,t.assoc||-1),i=!s||r.type!=aa.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),a=e.textDirectionAt(r.from),c=e.posAtCoords({x:n==(a==Kr.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(c!=null)return nt.cursor(c,n?-1:1)}return nt.cursor(n?r.to:r.from,n?-1:1)}function WF(e,t,n,s){let r=e.state.doc.lineAt(t.head),i=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let a=t,c=null;;){let u=CIe(r,i,o,a,n),d=ore;if(!u){if(r.number==(n?e.state.doc.lines:1))return a;d=`
`,r=e.state.doc.line(r.number+(n?1:-1)),i=e.bidiSpans(r),u=e.visualLineSide(r,!n)}if(c){if(!c(d))return a}else{if(!s)return u;c=s(d)}a=u}}function JIe(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return i=>{let o=s(i);return r==yi.Space&&(r=o),r==o}}function ZIe(e,t,n,s){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return nt.cursor(r,t.assoc);let o=t.goalColumn,a,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)o==null&&(o=u.left-c.left),a=i<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(r);o==null&&(o=Math.min(c.right-c.left,e.defaultCharacterWidth*(r-g.from))),a=(i<0?g.top:g.bottom)+d}let h=c.left+o,m=e.viewState.heightOracle.textHeight>>1,p=s??m;for(let g=0;;g+=m){let b=a+(p+g)*i,x=nN(e,{x:h,y:b},!1,i);if(n?b>c.bottom:b<c.top)return nt.cursor(x.pos,x.assoc);let y=e.coordsAtPos(x.pos,x.assoc),v=y?(y.top+y.bottom)/2:0;if(!y||(n?v>a:v<a))return nt.cursor(x.pos,x.assoc,void 0,o)}}function rx(e,t,n){for(;;){let s=0;for(let r of e)r.between(t-1,t+1,(i,o,a)=>{if(t>i&&t<o){let c=s||n||(t-i<o-t?-1:1);t=c<0?i:o,s=c}});if(!s)return t}}function _re(e,t){let n=null;for(let s=0;s<t.ranges.length;s++){let r=t.ranges[s],i=null;if(r.empty){let o=rx(e,r.from,0);o!=r.from&&(i=nt.cursor(o,-1))}else{let o=rx(e,r.from,-1),a=rx(e,r.to,1);(o!=r.from||a!=r.to)&&(i=nt.range(r.from==r.anchor?o:a,r.from==r.head?o:a))}i&&(n||(n=t.ranges.slice()),n[s]=i)}return n?nt.create(n,t.mainIndex):t}function U8(e,t,n){let s=rx(e.state.facet(Gw).map(r=>r(e)),n.from,t.head>n.from?-1:1);return s==n.from?n:nt.cursor(s,s<n.from?1:-1)}class Yu{constructor(t,n){this.pos=t,this.assoc=n}}function nN(e,t,n,s){let r=e.contentDOM.getBoundingClientRect(),i=r.top+e.viewState.paddingTop,{x:o,y:a}=t,c=a-i,u;for(;;){if(c<0)return new Yu(0,1);if(c>e.viewState.docHeight)return new Yu(e.state.doc.length,-1);if(u=e.elementAtHeight(c),s==null)break;if(u.type==aa.Text){if(s<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let m=e.docView.coordsAt(s<0?u.from:u.to,s>0?-1:1);if(m&&(s<0?m.top<=c+i:m.bottom>=c+i))break}let h=e.viewState.heightOracle.textHeight/2;c=s>0?u.bottom+h:u.top-h}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==aa.Text){let h=XIe(e,r,u,o,a);return new Yu(h,h==u.from?1:-1)}}if(u.type!=aa.Text)return c<(u.top+u.bottom)/2?new Yu(u.from,1):new Yu(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 eRe(e,o,a,e.textDirectionAt(u.from)).scanTile(d,u.from)}class eRe{constructor(t,n,s,r){this.view=t,this.x=n,this.y=s,this.baseDir=r,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:s,spans:r}=this.bidiSpansAt(t);return r[td.find(r,t-s.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[td.find(r,t-s.from,-1,n)].dir}bidiIn(t,n){let{spans:s,line:r}=this.bidiSpansAt(t);return s.length>1||s.length&&(s[0].level!=this.baseDir||s[0].to+r.from<n)}scan(t,n,s=!1){let r=0,i=t.length-1,o=new Set,a=this.bidiIn(t[0],t[i]),c,u,d=-1,h=1e9,m;e:for(;r<i;){let g=i-r,b=r+i>>1;t:if(o.has(b)){let y=r+Math.floor(Math.random()*g);for(let v=0;v<g;v++){if(!o.has(y)){b=y;break t}y++,y==i&&(y=r)}break e}o.add(b);let x=n(b);if(x)for(let y=0;y<x.length;y++){let v=x[y],w=0;if(!(v.width==0&&x.length>1)){if(v.bottom<this.y)(!c||c.bottom<v.bottom)&&(c=v),w=1;else if(v.top>this.y)(!u||u.top>v.top)&&(u=v),w=-1;else{let k=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,T=Math.abs(k);T<h&&(d=b,h=T,m=v),k&&(w=k<0==(this.baseDir==Kr.LTR)?-1:1)}w==-1&&(!a||this.baseDirAt(t[b],1))?i=b:w==1&&(!a||this.baseDirAt(t[b+1],-1))&&(r=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(h&&!s){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=(a?this.dirAt(t[d],1):this.baseDir)==Kr.LTR;return{i:d,after:this.x>(m.left+m.right)/2==p}}scanText(t,n){let s=[];for(let i=0;i<t.length;i=qo(t.text,i))s.push(n+i);s.push(n+t.length);let r=this.scan(s,i=>{let o=s[i]-n,a=s[i+1]-n;return Gx(t.dom,o,a).getClientRects()});return r.after?new Yu(s[r.i+1],-1):new Yu(s[r.i],1)}scanTile(t,n){if(!t.length)return new Yu(n,1);if(t.children.length==1){let a=t.children[0];if(a.isText())return this.scanText(a,n);if(a.isComposite())return this.scanTile(a,n)}let s=[n];for(let a=0,c=n;a<t.children.length;a++)s.push(c+=t.children[a].length);let r=this.scan(s,a=>{let c=t.children[a];return c.flags&48?null:(c.dom.nodeType==1?c.dom:Gx(c.dom,0,c.length)).getClientRects()}),i=t.children[r.i],o=s[r.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):r.after?new Yu(s[r.i+1],-1):new Yu(o,1)}}const Xg="";class tRe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(nr.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Xg}readRange(t,n){if(!t)return this;let s=t.parentNode;for(let r=t;;){this.findPointBefore(s,r);let i=this.text.length;this.readNode(r);let o=Fi.get(r),a=r.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&s!=this.view.contentDOM&&this.lineBreak();break}let c=Fi.get(a);(o&&c?o.breakAfter:(o?o.breakAfter:V4(r))||V4(a)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!sRe(a,n)&&this.lineBreak(),r=a}return this.findPointBefore(s,n),this}readTextNode(t){let n=t.nodeValue;for(let s of this.points)s.node==t&&(s.pos=this.text.length+Math.min(s.offset,n.length));for(let s=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,s),o=this.lineSeparator.length):(a=r.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(s,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);s=i+o}}readNode(t){let n=Fi.get(t),s=n&&n.overrideDOMText;if(s!=null){this.findPointInside(t,s.length);for(let r=s.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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 s of this.points)s.node==t&&t.childNodes[s.offset]==n&&(s.pos=this.text.length)}findPointInside(t,n){for(let s of this.points)(t.nodeType==3?s.node==t:t.contains(s.node))&&(s.pos=this.text.length+(nRe(t,s.node,s.offset)?n:0))}}function nRe(e,t,n){for(;;){if(!t||n<zh(t))return!1;if(t==e)return!0;n=Nm(t)+1,t=t.parentNode}}function sRe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let s=Fi.get(e);if(!(s!=null&&s.isWidget()))return!1;s&&(n||(n=[])).push(s)}if(n)for(let s of n){let r=s.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class VF{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class rRe{constructor(t,n,s,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=t.docView,a=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=Sre(t.docView.tile,n,s,0))){let c=i||o?[]:oRe(t),u=new tRe(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=aRe(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!Yj(t.contentDOM,c.focusNode)?a.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!Yj(t.contentDOM,c.anchorNode)?a.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),h=t.viewport;if((un.ios||un.chrome)&&a.main.empty&&u!=d&&(h.from>0||h.to<t.state.doc.length)){let m=Math.min(u,d),p=Math.max(u,d),g=h.from-m,b=h.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&&a.ranges.length>1)this.newSel=a.replaceRange(nt.range(d,u));else if(t.lineWrapping&&d==u&&!(a.main.empty&&a.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=nt.create([nt.cursor(u,p)])}else this.newSel=nt.single(d,u)}}}function Sre(e,t,n,s){if(e.isComposite()){let r=-1,i=-1,o=-1,a=-1;for(let c=0,u=s,d=s;c<e.children.length;c++){let h=e.children[c],m=u+h.length;if(u<t&&m>n)return Sre(h,t,n,u);if(m>=t&&r==-1&&(r=c,i=u),u>n&&h.dom.parentNode==e.dom){o=c,a=d;break}d=m,u=m+h.breakAfter}return{from:i,to:a<0?s+e.length:a,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:s,to:s+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Cre(e,t){let n,{newSel:s}=t,{state:r}=e,i=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:a,to:c}=t.bounds,u=i.from,d=null;(o===8||un.android&&t.text.length<c-a)&&(u=i.to,d="end");let h=r.doc.sliceString(a,c,Xg),m,p;!i.empty&&i.from>=a&&i.to<=c&&(t.typeOver||h!=t.text)&&h.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&h.slice(i.to-a)==t.text.slice(m=t.text.length-(h.length-(i.to-a)))?n={from:i.from,to:i.to,insert:fr.of(t.text.slice(i.from-a,m).split(Xg))}:(p=Tre(h,t.text,u-a,d))&&(un.chrome&&o==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==Xg+Xg&&p.toB--,n={from:a+p.from,to:a+p.toA,insert:fr.of(t.text.slice(p.from,p.toB).split(Xg))})}else s&&(!e.hasFocus&&r.facet(ah)||X4(s,i))&&(s=null);if(!n&&!s)return!1;if((un.mac||un.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(s&&n.insert.length==2&&(s=nt.single(s.main.anchor-1,s.main.head-1)),n={from:n.from,to:n.to,insert:fr.of([n.insert.toString().replace("."," ")])}):r.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:r.toText(e.inputState.insertingText)}:un.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(s&&(s=nt.single(s.main.anchor-1,s.main.head-1)),n={from:i.from,to:i.to,insert:fr.of([" "])}),n)return wR(e,n,s,o);if(s&&!X4(s,i)){let a=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(a=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(s=_re(r.facet(Gw).map(u=>u(e)),s))),e.dispatch({selection:s,scrollIntoView:a,userEvent:c}),!0}else return!1}function wR(e,t,n,s=-1){if(un.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(un.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&O1(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||s==8&&t.insert.length<t.to-t.from&&t.to>r.head)&&O1(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&O1(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=iRe(e,t,n));return e.state.facet(dre).some(c=>c(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function iRe(e,t,n){let s,r=e.state,i=r.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=rx(r.facet(Gw).map(h=>h(e)),u,c);t.from==d&&(o=d)}if(o>-1)s={changes:t,selection:nt.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?r.sliceDoc(i.from,t.from):"",u=i.to>t.to?r.sliceDoc(t.to,i.to):"";s=r.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=r.changes(t),u=n&&n.main.to<=c.newLength?n.main:void 0;if(r.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),h,m=n&&kre(e,n.main.head);if(m){let g=t.insert.length-(t.to-t.from);h={from:m.from,to:m.to-g}}else h=e.state.doc.lineAt(i.head);let p=i.to-t.to;s=r.changeByRange(g=>{if(g.from==i.from&&g.to==i.to)return{changes:c,range:u||g.map(c)};let b=g.to-p,x=b-d.length;if(e.state.sliceDoc(x,b)!=d||b>=h.from&&x<=h.to)return{range:g};let y=r.changes({from:x,to:b,insert:t.insert}),v=g.to-i.to;return{changes:y,range:u?nt.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):g.map(y)}})}else s={changes:c,selection:u&&r.selection.replaceRange(u)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),r.update(s,{userEvent:a,scrollIntoView:!0})}function Tre(e,t,n,s){let r=Math.min(e.length,t.length),i=0;for(;i<r&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==r&&e.length==t.length)return null;let o=e.length,a=t.length;for(;o>0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if(s=="end"){let c=Math.max(0,i-Math.min(o,a));n-=o+c-i}if(o<i&&e.length<t.length){let c=n<=i&&n>=o?i-n:0;i-=c,a=i+(a-o),o=i}else if(a<i){let c=n<=i&&n>=a?i-n:0;i-=c,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function oRe(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new VF(n,s)),(r!=n||i!=s)&&t.push(new VF(r,i))),t}function aRe(e,t){if(e.length==0)return null;let n=e[0].pos,s=e.length==2?e[1].pos:n;return n>-1&&s>-1?nt.single(n+t,s+t):null}function X4(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class lRe{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,un.safari&&t.contentDOM.addEventListener("input",()=>null),un.gecko&&_Re(t.contentDOM.ownerDocument)}handleEvent(t){!gRe(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 s=this.handlers[t];if(s){for(let r of s.observers)r(this.view,n);for(let r of s.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=cRe(t),s=this.handlers,r=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=s[i];a&&o!=!a.handlers.length&&(r.removeEventListener(i,this.handleEvent),a=null),a||r.addEventListener(i,this.handleEvent,{passive:o})}for(let i in s)i!="scroll"&&!n[i]&&r.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&&Are.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),un.android&&un.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return un.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=Ere.find(s=>s.keyCode==t.keyCode))&&!t.ctrlKey||uRe.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,O1(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:un.safari&&!un.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 GF(e,t){return(n,s)=>{try{return t.call(e,s,n)}catch(r){gl(n.state,r)}}}function cRe(e){let t=Object.create(null);function n(s){return t[s]||(t[s]={observers:[],handlers:[]})}for(let s of e){let r=s.spec,i=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(i)for(let a in i){let c=i[a];c&&n(a).handlers.push(GF(s.value,c))}if(o)for(let a in o){let c=o[a];c&&n(a).observers.push(GF(s.value,c))}}for(let s in cu)n(s).handlers.push(cu[s]);for(let s in El)n(s).observers.push(El[s]);return t}const Ere=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],uRe="dthko",Are=[16,17,18,20,91,92,224,225],z_=6;function F_(e){return Math.max(0,e)*.7+8}function dRe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class hRe{constructor(t,n,s,r){this.view=t,this.startEvent=n,this.style=s,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Qse(t.contentDOM),this.atoms=t.state.facet(Gw).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(nr.allowMultipleSelections)&&fRe(t,n),this.dragging=pRe(t,n)&&Mre(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&&dRe(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,s=0,r=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let c=xR(this.view);t.clientX-c.left<=r+z_?n=-F_(r-t.clientX):t.clientX+c.right>=o-z_&&(n=F_(t.clientX-o)),t.clientY-c.top<=i+z_?s=-F_(i-t.clientY):t.clientY+c.bottom>=a-z_&&(s=F_(t.clientY-a)),this.setScrollSpeed(n,s)}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,s=_re(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!s.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:s,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 fRe(e,t){let n=e.state.facet(are);return n.length?n[0](t):un.mac?t.metaKey:t.ctrlKey}function mRe(e,t){let n=e.state.facet(lre);return n.length?n[0](t):un.mac?!t.altKey:!t.ctrlKey}function pRe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let s=Wx(e.root);if(!s||s.rangeCount==0)return!0;let r=s.getRangeAt(0).getClientRects();for(let i=0;i<r.length;i++){let o=r[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function gRe(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,s;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(s=Fi.get(n))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(t))return!1;return!0}const cu=Object.create(null),El=Object.create(null),jre=un.ie&&un.ie_version<15||un.ios&&un.webkit_version<604;function bRe(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(),Nre(e,n.value)},50)}function vT(e,t,n){for(let s of e.facet(t))n=s(n,e);return n}function Nre(e,t){t=vT(e.state,gR,t);let{state:n}=e,s,r=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(sN!=null&&n.selection.ranges.every(c=>c.empty)&&sN==i.toString()){let c=-1;s=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let h=n.toText((o?i.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:h},range:nt.cursor(u.from+h.length)}})}else o?s=n.changeByRange(c=>{let u=i.line(r++);return{changes:{from:c.from,to:c.to,insert:u.text},range:nt.cursor(c.from+u.length)}}):s=n.replaceSelection(i);e.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}El.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};El.wheel=El.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};cu.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);El.touchstart=(e,t)=>{let n=e.inputState,s=t.targetTouches[0];n.lastTouchTime=Date.now(),s&&(n.lastTouchX=s.clientX,n.lastTouchY=s.clientY),n.setSelectionOrigin("select.pointer")};El.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};cu.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let s of e.state.facet(cre))if(n=s(e,t),n)break;if(!n&&t.button==0&&(n=vRe(e,t)),n){let s=!e.hasFocus;e.inputState.startMouseSelection(new hRe(e,t,n,s)),s&&e.observer.ignore(()=>{Jse(e.contentDOM);let i=e.root.activeElement;i&&!i.contains(e.contentDOM)&&i.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function KF(e,t,n,s){if(s==1)return nt.cursor(t,n);if(s==2)return YIe(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:i.from,a=r?r.posAtEnd:i.to;return a<e.state.doc.length&&a==i.to&&a++,nt.range(o,a)}}const yRe=un.ie&&un.ie_version<=11;let YF=null,XF=0,QF=0;function Mre(e){if(!yRe)return e.detail;let t=YF,n=QF;return YF=e,QF=Date.now(),XF=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(XF+1)%3:1}function vRe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),s=Mre(t),r=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),r=r.map(i.changes))},get(i,o,a){let c=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),u,d=KF(e,c.pos,c.assoc,s);if(n.pos!=c.pos&&!o){let h=KF(e,n.pos,n.assoc,s),m=Math.min(h.from,d.from),p=Math.max(h.to,d.to);d=m<d.from?nt.range(m,p,d.assoc):nt.range(p,m,d.assoc)}return o?r.replaceRange(r.main.extend(d.from,d.to,d.assoc)):a&&s==1&&r.ranges.length>1&&(u=xRe(r,c.pos))?u:a?r.addRange(d):nt.create([d])}}}function xRe(e,t){for(let n=0;n<e.ranges.length;n++){let{from:s,to:r}=e.ranges[n];if(s<=t&&r>=t)return nt.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}cu.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let i=r.posAtStart,o=i+r.length;(i>=n.to||o<=n.from)&&(n=nt.range(i,o))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",vT(e.state,bR,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};cu.dragend=e=>(e.inputState.draggedContent=null,!1);function JF(e,t,n,s){if(n=vT(e.state,gR,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=s&&i&&mRe(e,t)?{from:i.from,to:i.to}:null,a={from:r,insert:n},c=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(r,-1),head:c.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}cu.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let s=Array(n.length),r=0,i=()=>{++r==n.length&&JF(e,t,s.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(s[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let s=t.dataTransfer.getData("Text");if(s)return JF(e,t,s,!0),!0}return!1};cu.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=jre?null:t.clipboardData;return n?(Nre(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(bRe(e),!1)};function wRe(e,t){let n=e.dom.parentNode;if(!n)return;let s=n.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=t,s.focus(),s.selectionEnd=t.length,s.selectionStart=0,setTimeout(()=>{s.remove(),e.focus()},50)}function kRe(e){let t=[],n=[],s=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>r&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),r=o.number}s=!0}return{text:vT(e,bR,t.join(e.lineBreak)),ranges:n,linewise:s}}let sN=null;cu.copy=cu.cut=(e,t)=>{if(!tx(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:s,linewise:r}=kRe(e.state);if(!n&&!r)return!1;sN=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let i=jre?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(wRe(e,n),!1)};const Ire=Xh.define();function Rre(e,t){let n=[];for(let s of e.facet(hre)){let r=s(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:Ire.of(!0)}):null}function Dre(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Rre(e.state,t);n?e.dispatch(n):e.update([])}},10)}El.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),Dre(e)};El.blur=e=>{e.observer.clearSelectionRange(),Dre(e)};El.compositionstart=El.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};El.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,un.chrome&&un.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};El.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};cu.beforeinput=(e,t)=>{var n,s;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 a=o[0],c=e.posAtDOM(a.startContainer,a.startOffset),u=e.posAtDOM(a.endContainer,a.endOffset);return wR(e,{from:c,to:u,insert:e.state.toText(i)},null),!0}}let r;if(un.chrome&&un.android&&(r=Ere.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((s=window.visualViewport)===null||s===void 0?void 0:s.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 un.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),un.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>El.compositionend(e,t),20),!1};const ZF=new Set;function _Re(e){ZF.has(e)||(ZF.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const eH=["pre-wrap","normal","pre-line","break-spaces"];let gb=!1;function tH(){gb=!1}class SRe{constructor(t){this.lineWrapping=t,this.doc=fr.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let s=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(s+=Math.max(0,Math.ceil((n-t-s*this.lineLength*.5)/this.lineLength))),this.lineHeight*s}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 eH.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let s=0;s<t.length;s++){let r=t[s];r<0?s++:this.heightSamples[Math.floor(r*10)]||(n=!0,this.heightSamples[Math.floor(r*10)]=!0)}return n}refresh(t,n,s,r,i,o){let a=eH.indexOf(t)>-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=s,this.textHeight=r,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 CRe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class su{constructor(t,n,s,r,i){this.from=t,this.length=n,this.top=s,this.height=r,this._content=i}get type(){return typeof this._content=="number"?aa.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 _0?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 su(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var ti=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(ti||(ti={}));const sS=.001;class Wa{constructor(t,n,s=2){this.length=t,this.height=n,this.flags=s}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)>sS&&(gb=!0),this.height=t)}replace(t,n,s){return Wa.of(s)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,s,r){let i=this,o=s.doc;for(let a=r.length-1;a>=0;a--){let{fromA:c,toA:u,fromB:d,toB:h}=r[a],m=i.lineAt(c,ti.ByPosNoHeight,s.setDoc(n),0,0),p=m.to>=u?m:i.lineAt(u,ti.ByPosNoHeight,s,0,0);for(h+=p.to-u,u=p.to;a>0&&m.from<=r[a-1].toA;)c=r[a-1].fromA,d=r[a-1].fromB,a--,c<m.from&&(m=i.lineAt(c,ti.ByPosNoHeight,s,0,0));d+=m.from-c,c=m.from;let g=kR.build(s.setDoc(o),t,d,h);i=Q4(i,i.replace(c,u,g))}return i.updateHeight(s,0)}static empty(){return new Fl(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,s=t.length,r=0,i=0;for(;;)if(n==s)if(r>i*2){let a=t[n-1];a.break?t.splice(--n,1,a.left,null,a.right):t.splice(--n,1,a.left,a.right),s+=1+a.break,r-=a.size}else if(i>r*2){let a=t[s];a.break?t.splice(s,1,a.left,null,a.right):t.splice(s,1,a.left,a.right),s+=2+a.break,i-=a.size}else break;else if(r<i){let a=t[n++];a&&(r+=a.size)}else{let a=t[--s];a&&(i+=a.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,s++),new ERe(Wa.of(t.slice(0,n)),o,Wa.of(t.slice(s)))}}function Q4(e,t){return e==t?e:(e.constructor!=t.constructor&&(gb=!0),t)}Wa.prototype.size=1;const TRe=Nn.replace({});class Lre extends Wa{constructor(t,n,s){super(t,n),this.deco=s,this.spaceAbove=0}mainBlock(t,n){return new su(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,n,s,r){return this.spaceAbove&&t<s+this.spaceAbove?new su(r,0,s,this.spaceAbove,TRe):this.mainBlock(s,r)}lineAt(t,n,s,r,i){let o=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,s,r,i).join(o):o}forEachLine(t,n,s,r,i,o){t<=i+this.length&&n>=i&&o(this.lineAt(0,ti.ByPos,s,r,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,s=!1,r){return r&&r.from<=n&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Fl extends Lre{constructor(t,n,s){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=s}mainBlock(t,n){return new su(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,s){let r=s[0];return s.length==1&&(r instanceof Fl||r instanceof Qo&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Qo?r=new Fl(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Wa.of(s)}updateHeight(t,n=0,s=!1,r){return r&&r.from<=n&&r.more?this.setMeasuredHeight(r):(s||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 Qo extends Wa{constructor(t){super(t,0)}heightMetrics(t,n){let s=t.doc.lineAt(n).number,r=t.doc.lineAt(n+this.length).number,i=r-s+1,o,a=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*i);o=c/i,this.length>i+1&&(a=(this.height-c)/(this.length-i-1))}else o=this.height/i;return{firstLine:s,lastLine:r,perLine:o,perChar:a}}blockAt(t,n,s,r){let{firstLine:i,lastLine:o,perLine:a,perChar:c}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-s)/this.height))*this.length)),d=n.doc.lineAt(u),h=a+d.length*c,m=Math.max(s,t-h/2);return new su(d.from,d.length,m,h,0)}else{let u=Math.max(0,Math.min(o-i,Math.floor((t-s)/a))),{from:d,length:h}=n.doc.line(i+u);return new su(d,h,s+a*u,a,0)}}lineAt(t,n,s,r,i){if(n==ti.ByHeight)return this.blockAt(t,s,r,i);if(n==ti.ByPosNoHeight){let{from:p,to:g}=s.doc.lineAt(t);return new su(p,g-p,0,0,0)}let{firstLine:o,perLine:a,perChar:c}=this.heightMetrics(s,i),u=s.doc.lineAt(t),d=a+u.length*c,h=u.number-o,m=r+a*h+c*(u.from-i-h);return new su(u.from,u.length,Math.max(r,Math.min(m,r+this.height-d)),d,0)}forEachLine(t,n,s,r,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:c,perChar:u}=this.heightMetrics(s,i);for(let d=t,h=r;d<=n;){let m=s.doc.lineAt(d);if(d==t){let g=m.number-a;h+=c*g+u*(t-i-g)}let p=c+u*m.length;o(new su(m.from,m.length,h,p,0)),h+=p,d=m.to+1}}replace(t,n,s){let r=this.length-n;if(r>0){let i=s[s.length-1];i instanceof Qo?s[s.length-1]=new Qo(i.length+r):s.push(null,new Qo(r-1))}if(t>0){let i=s[0];i instanceof Qo?s[0]=new Qo(t+i.length):s.unshift(new Qo(t-1),null)}return Wa.of(s)}decomposeLeft(t,n){n.push(new Qo(t-1),null)}decomposeRight(t,n){n.push(null,new Qo(this.length-t-1))}updateHeight(t,n=0,s=!1,r){let i=n+this.length;if(r&&r.from<=n+this.length&&r.more){let o=[],a=Math.max(n,r.from),c=-1;for(r.from>n&&o.push(new Qo(r.from-n-1).updateHeight(t,n));a<=i&&r.more;){let d=t.doc.lineAt(a).length;o.length&&o.push(null);let h=r.heights[r.index++],m=0;h<0&&(m=-h,h=r.heights[r.index++]),c==-1?c=h:Math.abs(h-c)>=sS&&(c=-2);let p=new Fl(d,h,m);p.outdated=!1,o.push(p),a+=d+1}a<=i&&o.push(null,new Qo(i-a).updateHeight(t,a));let u=Wa.of(o);return(c<0||Math.abs(u.height-this.height)>=sS||Math.abs(c-this.heightMetrics(t,n).perLine)>=sS)&&(gb=!0),Q4(this,u)}else(s||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class ERe extends Wa{constructor(t,n,s){super(t.length+n+s.length,t.height+s.height,n|(t.outdated||s.outdated?2:0)),this.left=t,this.right=s,this.size=t.size+s.size}get break(){return this.flags&1}blockAt(t,n,s,r){let i=s+this.left.height;return t<i?this.left.blockAt(t,n,s,r):this.right.blockAt(t,n,i,r+this.left.length+this.break)}lineAt(t,n,s,r,i){let o=r+this.left.height,a=i+this.left.length+this.break,c=n==ti.ByHeight?t<o:t<a,u=c?this.left.lineAt(t,n,s,r,i):this.right.lineAt(t,n,s,o,a);if(this.break||(c?u.to<a:u.from>a))return u;let d=n==ti.ByPosNoHeight?ti.ByPosNoHeight:ti.ByPos;return c?u.join(this.right.lineAt(a,d,s,o,a)):this.left.lineAt(a,d,s,r,i).join(u)}forEachLine(t,n,s,r,i,o){let a=r+this.left.height,c=i+this.left.length+this.break;if(this.break)t<c&&this.left.forEachLine(t,n,s,r,i,o),n>=c&&this.right.forEachLine(t,n,s,a,c,o);else{let u=this.lineAt(c,ti.ByPos,s,r,i);t<u.from&&this.left.forEachLine(t,u.from-1,s,r,i,o),u.to>=t&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,s,a,c,o)}}replace(t,n,s){let r=this.left.length+this.break;if(n<r)return this.balanced(this.left.replace(t,n,s),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-r,n-r,s));let i=[];t>0&&this.decomposeLeft(t,i);let o=i.length;for(let a of s)i.push(a);if(t>0&&nH(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),nH(i,a)}return Wa.of(i)}decomposeLeft(t,n){let s=this.left.length;if(t<=s)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(s++,t>=s&&n.push(null)),t>s&&this.right.decomposeLeft(t-s,n)}decomposeRight(t,n){let s=this.left.length,r=s+this.break;if(t>=r)return this.right.decomposeRight(t-r,n);t<s&&this.left.decomposeRight(t,n),this.break&&t<r&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?Wa.of(this.break?[t,null,n]:[t,n]):(this.left=Q4(this.left,t),this.right=Q4(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,s=!1,r){let{left:i,right:o}=this,a=n+i.length+this.break,c=null;return r&&r.from<=n+i.length&&r.more?c=i=i.updateHeight(t,n,s,r):i.updateHeight(t,n,s),r&&r.from<=a+o.length&&r.more?c=o=o.updateHeight(t,a,s,r):o.updateHeight(t,a,s),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 nH(e,t){let n,s;e[t]==null&&(n=e[t-1])instanceof Qo&&(s=e[t+1])instanceof Qo&&e.splice(t-1,3,new Qo(n.length+1+s.length))}const ARe=5;class kR{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 s=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Fl?r.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new Fl(s-this.pos,-1,0)),this.writtenTo=s,n>s&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,s){if(t<n||s.heightRelevant){let r=s.widget?s.widget.estimatedHeight:0,i=s.widget?s.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=n-t;s.block?this.addBlock(new Lre(o,r,s)):(o||i||r>=ARe)&&this.addLineDeco(r,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 Fl(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let s=new Qo(n-t);return this.oracle.doc.lineAt(t).to==n&&(s.flags|=4),s}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Fl)return t;let n=new Fl(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,s){let r=this.ensureLine();r.length+=s,r.collapsed+=s,r.widgetHeight=Math.max(r.widgetHeight,t),r.breaks+=n,this.writtenTo=this.pos=this.pos+s}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Fl)&&!this.isCovered?this.nodes.push(new Fl(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let s=t;for(let r of this.nodes)r instanceof Fl&&r.updateHeight(this.oracle,s),s+=r?r.length:1;return this.nodes}static build(t,n,s,r){let i=new kR(s,t);return Ks.spans(n,s,r,i,0),i.finish(s)}}function jRe(e,t,n){let s=new NRe;return Ks.compare(e,t,n,s,0),s.changes}class NRe{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,s,r){(t<n||s&&s.heightRelevant||r&&r.heightRelevant)&&P1(t,n,this.changes,5)}}function MRe(e,t){let n=e.getBoundingClientRect(),s=e.ownerDocument,r=s.defaultView||window,i=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),c=Math.min(r.innerHeight,n.bottom);for(let u=e.parentNode;u&&u!=s.body;)if(u.nodeType==1){let d=u,h=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&h.overflow!="visible"){let m=d.getBoundingClientRect();i=Math.max(i,m.left),o=Math.min(o,m.right),a=Math.max(a,m.top),c=Math.min(u==e.parentNode?r.innerHeight:c,m.bottom)}u=h.position=="absolute"||h.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:a-(n.top+t),bottom:Math.max(a,c)-(n.top+t)}}function IRe(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 RRe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class W8{constructor(t,n,s,r){this.from=t,this.to=n,this.size=s,this.displaySize=r}static same(t,n){if(t.length!=n.length)return!1;for(let s=0;s<t.length;s++){let r=t[s],i=n[s];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(t,n){return Nn.replace({widget:new DRe(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class DRe extends dc{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 sH{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=rH,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Kr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let s=n.facet(yR).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new SRe(s),this.stateDeco=iH(n),this.heightMap=Wa.empty().applyChanges(this.stateDeco,fr.empty,this.heightOracle.setDoc(n.doc),[new Rc(0,0,0,n.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Nn.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let s=0;s<=1;s++){let r=s?n.head:n.anchor;if(!t.some(({from:i,to:o})=>r>=i&&r<=o)){let{from:i,to:o}=this.lineBlockAt(r);t.push(new H_(i,o))}}return this.viewports=t.sort((s,r)=>s.from-r.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?rH:new _R(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(xv(t,this.scaler))})}update(t,n=null){this.state=t.state;let s=this.stateDeco;this.stateDeco=iH(this.state);let r=t.changedRanges,i=Rc.extendWithRanges(r,jRe(s,this.stateDeco,t?t.changes:_o.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);tH(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||gb)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.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(mre)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,s=window.getComputedStyle(n),r=this.heightOracle,i=s.whiteSpace;this.defaultTextDirection=s.direction=="rtl"?Kr.RTL:Kr.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),c=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,d=0;if(a.width&&a.height){let{scaleX:T,scaleY:C}=Xse(n,a);(T>.005&&Math.abs(this.scaleX-T)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=T,this.scaleY=C,u|=16,o=c=!0)}let h=(parseInt(s.paddingTop)||0)*this.scaleY,m=(parseInt(s.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=m)&&(this.paddingTop=h,this.paddingBottom=m,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let p=Qse(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=Zse(this.scrollParent||t.win);let b=(this.printing?RRe:MRe)(n,this.paddingTop),x=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&&!IRe(t.dom))return 0;let w=a.width;if((this.contentDOMWidth!=w||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let T=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(T)&&(o=!0),o||r.lineWrapping&&Math.abs(w-this.contentDOMWidth)>r.charWidth){let{lineHeight:C,charWidth:_,textHeight:S}=t.docView.measureTextSize();o=C>0&&r.refresh(i,C,_,S,Math.max(5,w/_),T),o&&(t.docView.minWidth=0,u|=16)}x>0&&y>0?d=Math.max(x,y):x<0&&y<0&&(d=Math.min(x,y)),tH();for(let C of this.viewports){let _=C.from==this.viewport.from?T:t.docView.measureVisibleLineHeights(C);this.heightMap=(o?Wa.empty().applyChanges(this.stateDeco,fr.empty,this.heightOracle,[new Rc(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new CRe(C.from,_))}gb&&(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 s=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,c=new H_(r.lineAt(o-s*1e3,ti.ByHeight,i,0,0).from,r.lineAt(a+(1-s)*1e3,ti.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),h=r.lineAt(u,ti.ByPos,i,0,0),m;n.y=="center"?m=(h.top+h.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u<c.from?m=h.top:m=h.bottom-d,c=new H_(r.lineAt(m-1e3/2,ti.ByHeight,i,0,0).from,r.lineAt(m+d+1e3/2,ti.ByHeight,i,0,0).to)}}return c}mapViewport(t,n){let s=n.mapPos(t.from,-1),r=n.mapPos(t.to,1);return new H_(this.heightMap.lineAt(s,ti.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,ti.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:n},s=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(t,ti.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,ti.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(t==0||r<=o-Math.max(10,Math.min(-s,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(s,250)))&&r>o-2*1e3&&i<a+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let s=[];for(let r of t)n.touchesRange(r.from,r.to)||s.push(new W8(n.mapPos(r.from),n.mapPos(r.to),r.size,r.displaySize));return s}ensureLineGaps(t,n){let s=this.heightOracle.lineWrapping,r=s?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=Kr.LTR&&!s)return[];let a=[],c=(d,h,m,p)=>{if(h-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<h){c(d,y-10,m,p),c(y+10,h,m,p);return}let x=PRe(t,y=>y.from>=m.from&&y.to<=m.to&&Math.abs(y.from-d)<i&&Math.abs(y.to-h)<i&&!b.some(v=>y.from<v&&y.to>v));if(!x){if(h<m.to&&n&&s&&n.visibleRanges.some(w=>w.from<=h&&w.to>=h)){let w=n.moveToLineBoundary(nt.cursor(h),!1,!0).head;w>d&&(h=w)}let y=this.gapSize(m,d,h,p),v=s||y<2e6?y:2e6;x=new W8(d,h,y,v)}a.push(x)},u=d=>{if(d.length<o||d.type!=aa.Text)return;let h=LRe(d.from,d.to,this.stateDeco);if(h.total<o)return;let m=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(s){let b=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,y;if(m!=null){let v=U_(h,m),w=((this.visibleBottom-this.visibleTop)/2+b)/d.height;x=v-w,y=v+w}else x=(this.visibleTop-d.top-b)/d.height,y=(this.visibleBottom-d.top+b)/d.height;p=q_(h,x),g=q_(h,y)}else{let b=h.total*this.heightOracle.charWidth,x=r*this.heightOracle.charWidth,y=0;if(b>2e6)for(let C of t)C.from>=d.from&&C.from<d.to&&C.size!=C.displaySize&&C.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=C.size-C.displaySize);let v=this.pixelViewport.left+y,w=this.pixelViewport.right+y,k,T;if(m!=null){let C=U_(h,m),_=((w-v)/2+x)/b;k=C-_,T=C+_}else k=(v-x)/b,T=(w+x)/b;p=q_(h,k),g=q_(h,T)}p>d.from&&c(d.from,p,d,h),g<d.to&&c(g,d.to,d,h)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(u):u(d);return a}gapSize(t,n,s,r){let i=U_(r,s)-U_(r,n);return this.heightOracle.lineWrapping?t.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(t){W8.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Nn.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 s=[];Ks.spans(n,this.viewport.from,this.viewport.to,{span(i,o){s.push({from:i,to:o})},point(){}},20);let r=0;if(s.length!=this.visibleRanges.length)r=12;else for(let i=0;i<s.length&&!(r&8);i++){let o=this.visibleRanges[i],a=s[i];(o.from!=a.from||o.to!=a.to)&&(r|=4,t&&t.mapPos(o.from,-1)==a.from&&t.mapPos(o.to,1)==a.to||(r|=8))}return this.visibleRanges=s,r}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||xv(this.heightMap.lineAt(t,ti.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)||xv(this.heightMap.lineAt(this.scaler.fromDOM(t),ti.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 xv(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 H_{constructor(t,n){this.from=t,this.to=n}}function LRe(e,t,n){let s=[],r=e,i=0;return Ks.spans(n,e,t,{span(){},point(o,a){o>r&&(s.push({from:r,to:o}),i+=o-r),r=a}},20),r<t&&(s.push({from:r,to:t}),i+=t-r),{total:i,ranges:s}}function q_({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let s=Math.floor(e*n);for(let r=0;;r++){let{from:i,to:o}=t[r],a=o-i;if(s<=a)return i+s;s-=a}}function U_(e,t){let n=0;for(let{from:s,to:r}of e.ranges){if(t<=r){n+=t-s;break}n+=r-s}return n/e.total}function PRe(e,t){for(let n of e)if(t(n))return n}const rH={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function iH(e){let t=e.facet(gT).filter(s=>typeof s!="function"),n=e.facet(vR).filter(s=>typeof s!="function");return n.length&&t.push(Ks.join(n)),t}class _R{constructor(t,n,s){let r=0,i=0,o=0;this.viewports=s.map(({from:a,to:c})=>{let u=n.lineAt(a,ti.ByPos,t,0,0).top,d=n.lineAt(c,ti.ByPos,t,0,0).bottom;return r+=d-u,{from:a,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(t){for(let n=0,s=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return r+(t-s)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);s=i.bottom,r=i.domBottom}}fromDOM(t){for(let n=0,s=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return s+(t-r)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);s=i.bottom,r=i.domBottom}}eq(t){return t instanceof _R?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,s)=>n.from==t.viewports[s].from&&n.to==t.viewports[s].to):!1}}function xv(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),s=t.toDOM(e.bottom);return new su(e.from,e.length,n,s-n,Array.isArray(e._content)?e._content.map(r=>xv(r,t)):e._content)}const W_=dn.define({combine:e=>e.join(" ")}),rN=dn.define({combine:e=>e.indexOf(!0)>-1}),iN=Am.newName(),Pre=Am.newName(),Ore=Am.newName(),$re={"&light":"."+Pre,"&dark":"."+Ore};function oN(e,t,n){return new Am(t,{finish(s){return/&/.test(s)?s.replace(/&\w*/,r=>{if(r=="&")return e;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+s}})}const ORe=oN("."+iN,{"&":{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"}},$re),$Re={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},V8=un.ie&&un.ie_version<=11;class BRe{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new pIe,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 s of n)this.queue.push(s);(un.ie&&un.ie_version<=11||un.ios&&t.composing)&&n.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&un.android&&t.constructor.EDIT_CONTEXT!==!1&&!(un.chrome&&un.chrome_version<126)&&(this.editContext=new FRe(t),t.state.facet(ah)&&(t.contentDOM.editContext=this.editContext.editContext)),V8&&(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,s)=>n!=t[s]))){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:s}=this,r=this.selectionRange;if(s.state.facet(ah)?s.root.activeElement!=this.dom:!tx(this.dom,r))return;let i=r.anchorNode&&s.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(un.ie&&un.ie_version<=11||un.android&&un.chrome)&&!s.state.selection.main.empty&&r.focusNode&&sx(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Wx(t.root);if(!n)return!1;let s=un.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&zRe(this.view,n)||n;if(!s||this.selectionRange.eq(s))return!1;let r=tx(this.dom,s);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&bIe(this.dom,s)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(s),r&&(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 s=this.dom;s;)if(s.nodeType==1)!n&&t<this.scrollTargets.length&&this.scrollTargets[t]==s?t++:n||(n=this.scrollTargets.slice(0,t)),n&&n.push(s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;if(t<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,t)),n){for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);for(let s of this.scrollTargets=n)s.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,$Re),V8&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),V8&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,n){var s;if(!this.delayedAndroidKey){let r=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&O1(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((s=this.delayedAndroidKey)===null||s===void 0)&&s.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,s=-1,r=!1;for(let i of t){let o=this.readMutation(i);o&&(o.typeOver&&(r=!0),n==-1?{from:n,to:s}=o:(n=Math.min(o.from,n),s=Math.max(o.to,s)))}return{from:n,to:s,typeOver:r}}readChange(){let{from:t,to:n,typeOver:s}=this.processRecords(),r=this.selectionChanged&&tx(this.dom,this.selectionRange);if(t<0&&!r)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new rRe(this.view,t,n,s);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 s=this.view.state,r=Cre(this.view,n);return this.view.state==s&&(n.domChanged||n.newSel&&!X4(this.view.state.selection,n.newSel.main))&&this.view.update([]),r}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 s=oH(n,t.previousSibling||t.target.previousSibling,-1),r=oH(n,t.nextSibling||t.target.nextSibling,1);return{from:s?n.posAfter(s):n.posAtStart,to:r?n.posBefore(r):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(ah)!=t.state.facet(ah)&&(t.view.contentDOM.editContext=t.state.facet(ah)?this.editContext.editContext:null))}destroy(){var t,n,s;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(s=this.resizeScroll)===null||s===void 0||s.disconnect();for(let r of this.scrollTargets)r.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 oH(e,t,n){for(;t;){let s=Fi.get(t);if(s&&s.parent==e)return s;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function aH(e,t){let n=t.startContainer,s=t.startOffset,r=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return sx(o.node,o.offset,r,i)&&([n,s,r,i]=[r,i,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}}function zRe(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return aH(e,r)}let n=null;function s(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",s,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",s,!0),n?aH(e,n):null}class FRe{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=s=>{let r=t.state.selection.main,{anchor:i,head:o}=r,a=this.toEditorPos(s.updateRangeStart),c=this.toEditorPos(s.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:s.updateRangeStart,editorBase:a,drifted:!1});let u=c-a>s.text.length;a==this.from&&i<this.from?a=i:c==this.to&&i>this.to&&(c=i);let d=Tre(t.state.sliceDoc(a,c),s.text,(u?r.from:r.to)-a,u?"end":null);if(!d){let m=nt.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));X4(m,r)||t.dispatch({selection:m,userEvent:"select"});return}let h={from:d.from+a,to:d.toA+a,insert:fr.of(s.text.slice(d.from,d.toB).split(`
`))};if((un.mac||un.android)&&h.from==o-1&&/^\. ?$/.test(s.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:c,insert:fr.of([s.text.replace("."," ")])}),this.pendingContextChange=h,!t.state.readOnly){let m=this.to-this.from+(h.to-h.from+h.insert.length);wR(t,h,nt.single(this.toEditorPos(s.selectionStart,m),this.toEditorPos(s.selectionEnd,m)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),h.from<h.to&&!h.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,s.updateRangeStart-1),Math.min(n.text.length,s.updateRangeStart+1)))&&this.handlers.compositionend(s)},this.handlers.characterboundsupdate=s=>{let r=[],i=null;for(let o=this.toEditorPos(s.rangeStart),a=this.toEditorPos(s.rangeEnd);o<a;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,r.push(i)}n.updateCharacterBounds(s.rangeStart,r)},this.handlers.textformatupdate=s=>{let r=[];for(let i of s.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){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(a)?1:2}px`;r.push(Nn.mark({attributes:{style:d}}).range(c,u))}}}t.dispatch({effects:gre.of(Nn.set(r))})},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:s}=this.composing;this.composing=null,s&&this.reset(t.state)}};for(let s in this.handlers)n.addEventListener(s,this.handlers[s]);this.measureReq={read:s=>{this.editContext.updateControlBounds(s.contentDOM.getBoundingClientRect());let r=Wx(s.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,s=!1,r=this.pendingContextChange;return t.changes.iterChanges((i,o,a,c,u)=>{if(s)return;let d=u.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(u)){r=this.pendingContextChange=null,n+=d,this.to+=d;return}else r=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){s=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),u.toString()),this.to+=d}n+=d}),r&&!s&&this.revertPending(t.state),!s}update(t){let n=this.pendingContextChange,s=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(s.from,s.to)&&t.transactions.some(r=>!r.isUserEvent("input.type")&&r.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,s=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=s||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(s,r)}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 s=this.composing;return s&&s.drifted?s.editorBase+(t-s.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 Pt{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:s}=t;this.dispatchTransactions=t.dispatchTransactions||s&&(r=>r.forEach(i=>s(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||gIe(t.parent)||document,this.viewState=new sH(this,t.state||nr.create(t)),t.scrollTo&&t.scrollTo.is(B_)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(m1).map(r=>new z8(r));for(let r of this.plugins)r.update(this);this.observer=new BRe(this),this.inputState=new lRe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new UF(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 To?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,s=!1,r,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,a=0,c=null;t.some(m=>m.annotation(Ire))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Rre(i,o),c||(a=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(nr.phrases)!=this.state.facet(nr.phrases))return this.setState(i);r=G4.create(this,i,t),r.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let m of t){if(h&&(h=h.map(m.changes)),m.scrollIntoView){let{main:p}=m.state.selection,{x:g,y:b}=this.state.facet(Pt.cursorScrollMargin);h=new $1(p.empty?p:nt.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",b,g)}for(let p of m.effects)p.is(B_)&&(h=p.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=J4.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(vv)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(m=>m.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(W_)!=r.state.facet(W_)&&(this.viewState.mustMeasureContent=!0),(n||s||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let m of this.state.facet(Zj))try{m(r)}catch(p){gl(this.state,p,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!Cre(this,d)&&u.force&&O1(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 s of this.plugins)s.destroy(this);this.viewState=new sH(this,t),this.plugins=t.facet(m1).map(s=>new z8(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new UF(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(m1),s=t.state.facet(m1);if(n!=s){let r=[];for(let i of s){let o=n.indexOf(i);if(o<0)r.push(new z8(i));else{let a=this.plugins[o];a.mustUpdate=t,r.push(a)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);n!=s&&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(s){gl(this.state,s,"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,s=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(Zse(s||this.win))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(r);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(a>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 gl(this.state,g),lH}}),h=G4.create(this,this.state,[]),m=!1;h.flags|=c,n?n.flags|=c:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),m=this.docView.update(h),m&&this.docViewUpdate());for(let p=0;p<u.length;p++)if(d[p]!=lH)try{let g=u[p];g.write&&g.write(d[p],this)}catch(g){gl(this.state,g)}if(m&&this.docView.updateSelection(!0),!h.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)&&(s==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+g,s?s.scrollTop+=g:this.win.scrollBy(0,g),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(Zj))a(n)}get themeClasses(){return iN+" "+(this.state.facet(rN)?Ore:Pre)+" "+this.state.facet(W_)}updateAttrs(){let t=cH(this,bre,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ah)?"true":"false",class:"cm-content",style:`${un.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),cH(this,yR,n);let s=this.observer.ignore(()=>{let r=$F(this.contentDOM,this.contentAttrs,n),i=$F(this.dom,this.editorAttrs,t);return r||i});return this.editorAttrs=t,this.contentAttrs=n,s}showAnnouncements(t){let n=!0;for(let s of t)for(let r of s.effects)if(r.is(Pt.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(vv);let t=this.state.facet(Pt.cspNonce);Am.mount(this.root,this.styleModules.concat(ORe).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(s=>s.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,s){return U8(this,t,WF(this,t,n,s))}moveByGroup(t,n){return U8(this,t,WF(this,t,n,s=>JIe(this,t.head,s)))}visualLineSide(t,n){let s=this.bidiSpans(t),r=this.textDirectionAt(t.from),i=s[n?s.length-1:0];return nt.cursor(i.side(n,r)+t.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,s=!0){return QIe(this,t,n,s)}moveVertically(t,n,s){return U8(this,t,ZIe(this,t,n,s))}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 s=nN(this,t,n);return s&&s.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),nN(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let s=this.docView.coordsAt(t,n);if(!s||s.left==s.right)return s;let r=this.state.doc.lineAt(t),i=this.bidiSpans(r),o=i[td.find(i,t-r.from,-1,n)];return Vx(s,o.dir==Kr.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(fre)||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>HRe)return ire(t.length);let n=this.textDirectionAt(t.from),s;for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||rre(i.isolates,s=FF(this,t))))return i.order;s||(s=FF(this,t));let r=SIe(t.text,n,s);return this.bidiCache.push(new J4(t.from,t.to,n,s,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||un.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Jse(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 s,r,i,o;return B_.of(new $1(typeof t=="number"?nt.cursor(t):t,(s=n.y)!==null&&s!==void 0?s:"nearest",(r=n.x)!==null&&r!==void 0?r:"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,s=this.viewState.scrollAnchorAt(t);return B_.of(new $1(nt.cursor(s.from),"start","start",s.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 xi.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return xi.define(()=>({}),{eventObservers:t})}static theme(t,n){let s=Am.newName(),r=[W_.of(s),vv.of(oN(`.${s}`,t))];return n&&n.dark&&r.push(rN.of(!0)),r}static baseTheme(t){return Jm.lowest(vv.of(oN("."+iN,t,$re)))}static findFromDOM(t){var n;let s=t.querySelector(".cm-content"),r=s&&Fi.get(s)||Fi.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Pt.styleModule=vv;Pt.inputHandler=dre;Pt.clipboardInputFilter=gR;Pt.clipboardOutputFilter=bR;Pt.scrollHandler=pre;Pt.focusChangeEffect=hre;Pt.perLineTextDirection=fre;Pt.exceptionSink=ure;Pt.updateListener=Zj;Pt.editable=ah;Pt.mouseSelectionStyle=cre;Pt.dragMovesSelection=lre;Pt.clickAddsSelectionRange=are;Pt.decorations=gT;Pt.blockWrappers=yre;Pt.outerDecorations=vR;Pt.atomicRanges=Gw;Pt.bidiIsolatedRanges=vre;Pt.cursorScrollMargin=dn.define({combine:e=>{let t=5,n=5;for(let s of e)typeof s=="number"?t=n=s:{x:t,y:n}=s;return{x:t,y:n}}});Pt.scrollMargins=xre;Pt.darkTheme=rN;Pt.cspNonce=dn.define({combine:e=>e.length?e[0]:""});Pt.contentAttributes=yR;Pt.editorAttributes=bre;Pt.lineWrapping=Pt.contentAttributes.of({class:"cm-lineWrapping"});Pt.announce=_s.define();const HRe=4096,lH={};class J4{constructor(t,n,s,r,i,o){this.from=t,this.to=n,this.dir=s,this.isolates=r,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let s=[],r=t.length?t[t.length-1].dir:Kr.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==r&&!n.touchesRange(o.from,o.to)&&s.push(new J4(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return s}}function cH(e,t,n){for(let s=e.state.facet(t),r=s.length-1;r>=0;r--){let i=s[r],o=typeof i=="function"?i(e):i;o&&fR(o,n)}return n}const qRe=un.mac?"mac":un.windows?"win":un.linux?"linux":"key";function URe(e,t){const n=e.split(/-(?!$)/);let s=n[n.length-1];s=="Space"&&(s=" ");let r,i,o,a;for(let c=0;c<n.length-1;++c){const u=n[c];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!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"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),a&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function V_(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 WRe=Jm.default(Pt.domEventHandlers({keydown(e,t){return zre(Bre(t.state),e,t,"editor")}})),bb=dn.define({enables:WRe}),uH=new WeakMap;function Bre(e){let t=e.facet(bb),n=uH.get(t);return n||uH.set(t,n=KRe(t.reduce((s,r)=>s.concat(r),[]))),n}function VRe(e,t,n){return zre(Bre(e.state),t,e,n)}let Lf=null;const GRe=4e3;function KRe(e,t=qRe){let n=Object.create(null),s=Object.create(null),r=(o,a)=>{let c=s[o];if(c==null)s[o]=a;else if(c!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,c,u,d)=>{var h,m;let p=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(y=>URe(y,t));for(let y=1;y<g.length;y++){let v=g.slice(0,y).join(" ");r(v,!0),p[v]||(p[v]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=Lf={view:w,prefix:v,scope:o};return setTimeout(()=>{Lf==k&&(Lf=null)},GRe),!0}]})}let b=g.join(" ");r(b,!1);let x=p[b]||(p[b]={preventDefault:!1,stopPropagation:!1,run:((m=(h=p._any)===null||h===void 0?void 0:h.run)===null||m===void 0?void 0:m.slice())||[]});c&&x.run.push(c),u&&(x.preventDefault=!0),d&&(x.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of a){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let m in d)d[m].run.push(p=>h(p,aN))}let c=o[t]||o.key;if(c)for(let u of a)i(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return n}let aN=null;function zre(e,t,n,s){aN=t;let r=cIe(t),i=hl(r,0),o=Ku(i)==r.length&&r!=" ",a="",c=!1,u=!1,d=!1;Lf&&Lf.view==n&&Lf.scope==s&&(a=Lf.prefix+" ",Are.indexOf(t.keyCode)<0&&(u=!0,Lf=null));let h=new Set,m=x=>{if(x){for(let y of x.run)if(!h.has(y)&&(h.add(y),y(n)))return x.stopPropagation&&(d=!0),!0;x.preventDefault&&(x.stopPropagation&&(d=!0),u=!0)}return!1},p=e[s],g,b;return p&&(m(p[a+V_(r,t,!o)])?c=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(un.windows&&t.ctrlKey&&t.altKey)&&!(un.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=jm[t.keyCode])&&g!=r?(m(p[a+V_(g,t,!0)])||t.shiftKey&&(b=qx[t.keyCode])!=r&&b!=g&&m(p[a+V_(b,t,!1)]))&&(c=!0):o&&t.shiftKey&&m(p[a+V_(r,t,!0)])&&(c=!0),!c&&m(p._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),aN=null,c}class o0{constructor(t,n,s,r,i){this.className=t,this.left=n,this.top=s,this.width=r,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,s){if(s.empty){let r=t.coordsAtPos(s.head,s.assoc||1);if(!r)return[];let i=Fre(t);return[new o0(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return YRe(t,n,s)}}function Fre(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Kr.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function dH(e,t,n,s){let r=e.coordsAtPos(t,n*2);if(!r)return s;let i=e.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,a=e.posAtCoords({x:i.left+1,y:o}),c=e.posAtCoords({x:i.right-1,y:o});return a==null||c==null?s:{from:Math.max(s.from,Math.min(a,c)),to:Math.min(s.to,Math.max(a,c))}}function YRe(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let s=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),i=e.textDirection==Kr.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),c=Fre(e),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),h=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),m=a.right-(d?parseInt(d.paddingRight):0),p=tN(e,s,1),g=tN(e,r,-1),b=p.type==aa.Text?p:null,x=g.type==aa.Text?g:null;if(b&&(e.lineWrapping||p.widgetLineBreaks)&&(b=dH(e,s,1,b)),x&&(e.lineWrapping||g.widgetLineBreaks)&&(x=dH(e,r,-1,x)),b&&x&&b.from==x.from&&b.to==x.to)return v(w(n.from,n.to,b));{let T=b?w(n.from,null,b):k(p,!1),C=x?w(null,n.to,x):k(g,!0),_=[];return(b||p).to<(x||g).from-(b&&x?1:0)||p.widgetLineBreaks>1&&T.bottom+e.defaultLineHeight/2<C.top?_.push(y(h,T.bottom,m,C.top)):T.bottom<C.top&&e.elementAtHeight((T.bottom+C.top)/2).type==aa.Text&&(T.bottom=C.top=(T.bottom+C.top)/2),v(T).concat(_).concat(v(C))}function y(T,C,_,S){return new o0(t,T-c.left,C-c.top,Math.max(0,_-T),S-C)}function v({top:T,bottom:C,horizontal:_}){let S=[];for(let D=0;D<_.length;D+=2)S.push(y(_[D],T,_[D+1],C));return S}function w(T,C,_){let S=1e9,D=-1e9,E=[];function B(O,A,$,q,U){let H=e.coordsAtPos(O,O==_.to?-2:2),M=e.coordsAtPos($,$==_.from?2:-2);!H||!M||(S=Math.min(H.top,M.top,S),D=Math.max(H.bottom,M.bottom,D),U==Kr.LTR?E.push(i&&A?h:H.left,i&&q?m:M.right):E.push(!i&&q?h:M.left,!i&&A?m:H.right))}let I=T??_.from,L=C??_.to;for(let O of e.visibleRanges)if(O.to>I&&O.from<L)for(let A=Math.max(O.from,I),$=Math.min(O.to,L);;){let q=e.state.doc.lineAt(A);for(let U of e.bidiSpans(q)){let H=U.from+q.from,M=U.to+q.from;if(H>=$)break;M>A&&B(Math.max(H,A),T==null&&H<=I,Math.min(M,$),C==null&&M>=L,U.dir)}if(A=q.to+1,A>=$)break}return E.length==0&&B(I,T==null,L,C==null,e.textDirection),{top:S,bottom:D,horizontal:E}}function k(T,C){let _=a.top+(C?T.top:T.bottom);return{top:_,bottom:_,horizontal:[]}}}function XRe(e,t){return e.constructor==t.constructor&&e.eq(t)}class QRe{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(rS)!=t.state.facet(rS)&&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,s=t.facet(rS);for(;n<s.length&&s[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,s)=>!XRe(n,this.drawn[s]))){let n=this.dom.firstChild,s=0;for(let r of t)r.update&&n&&r.constructor&&this.drawn[s].constructor&&r.update(n,this.drawn[s])?(n=n.nextSibling,s++):this.dom.insertBefore(r.draw(),n);for(;n;){let r=n.nextSibling;n.remove(),n=r}this.drawn=t,un.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const rS=dn.define();function Hre(e){return[xi.define(t=>new QRe(t,e)),rS.of(e)]}const yb=dn.define({combine(e){return Ed(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function qre(e={}){return[yb.of(e),JRe,ZRe,eDe,mre.of(!0)]}function Ure(e){return e.startState.facet(yb)!=e.state.facet(yb)}const JRe=Hre({above:!0,markers(e){let{state:t}=e,n=t.facet(yb),s=[];for(let r of t.selection.ranges){let i=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(i&&un.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:nt.cursor(r.head,r.assoc);for(let c of o0.forRange(e,o,a))s.push(c)}}return s},update(e,t){e.transactions.some(s=>s.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=Ure(e);return n&&hH(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){hH(t.state,e)},class:"cm-cursorLayer"});function hH(e,t){t.style.animationDuration=e.facet(yb).cursorBlinkRate+"ms"}const ZRe=Hre({above:!1,markers(e){let t=[],{main:n,ranges:s}=e.state.selection;for(let r of s)if(!r.empty)for(let i of o0.forRange(e,"cm-selectionBackground",r))t.push(i);if(un.ios&&!n.empty&&e.state.facet(yb).iosSelectionHandles){for(let r of o0.forRange(e,"cm-selectionHandle cm-selectionHandle-start",nt.cursor(n.from,1)))t.push(r);for(let r of o0.forRange(e,"cm-selectionHandle cm-selectionHandle-end",nt.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Ure(e)},class:"cm-selectionLayer"}),eDe=Jm.highest(Pt.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"}}}})),Wre=_s.define({map(e,t){return e==null?null:t.mapPos(e)}}),wv=ca.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,s)=>s.is(Wre)?s.value:n,e)}}),tDe=xi.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(wv);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(wv)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(wv),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let s=e.scrollDOM.getBoundingClientRect();return{left:n.left-s.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-s.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(wv)!=e&&this.view.dispatch({effects:Wre.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 nDe(){return[wv,tDe]}function fH(e,t,n,s,r){t.lastIndex=0;for(let i=e.iterRange(n,s),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=t.exec(i.value);)r(o+a.index,a)}function sDe(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 s=[];for(let{from:r,to:i}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),i=Math.min(e.state.doc.lineAt(i).to,i+t),s.length&&s[s.length-1].to>=r?s[s.length-1].to=i:s.push({from:r,to:i});return s}class rDe{constructor(t){const{regexp:n,decoration:s,decorate:r,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,r)this.addMatch=(a,c,u,d)=>r(d,u,u+a[0].length,a,c);else if(typeof s=="function")this.addMatch=(a,c,u,d)=>{let h=s(a,c,u);h&&d(u,u+a[0].length,h)};else if(s)this.addMatch=(a,c,u,d)=>d(u,u+a[0].length,s);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(t){let n=new gd,s=n.add.bind(n);for(let{from:r,to:i}of sDe(t,this.maxLength))fH(t.state.doc,this.regexp,r,i,(o,a)=>this.addMatch(a,t,o,s));return n.finish()}updateDeco(t,n){let s=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((i,o,a,c)=>{c>=t.view.viewport.from&&a<=t.view.viewport.to&&(s=Math.min(a,s),r=Math.max(c,r))}),t.viewportMoved||r-s>1e3?this.createDeco(t.view):r>-1?this.updateRange(t.view,n.map(t.changes),s,r):n}updateRange(t,n,s,r){for(let i of t.visibleRanges){let o=Math.max(i.from,s),a=Math.min(i.to,r);if(a>=o){let c=t.state.doc.lineAt(o),u=c.to<a?t.state.doc.lineAt(a):c,d=Math.max(i.from,c.from),h=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(;a<u.to;a++)if(this.boundary.test(u.text[a-u.from])){h=a;break}}let m=[],p,g=(b,x,y)=>m.push(y.range(b,x));if(c==u)for(this.regexp.lastIndex=d-c.from;(p=this.regexp.exec(c.text))&&p.index<h-c.from;)this.addMatch(p,t,p.index+c.from,g);else fH(t.state.doc,this.regexp,d,h,(b,x)=>this.addMatch(x,t,b,g));n=n.update({filterFrom:d,filterTo:h,filter:(b,x)=>b<d||x>h,add:m})}}return n}}const lN=/x/.unicode!=null?"gu":"g",iDe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,lN),oDe={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 G8=null;function aDe(){var e;if(G8==null&&typeof document<"u"&&document.body){let t=document.body.style;G8=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return G8||!1}const iS=dn.define({combine(e){let t=Ed(e,{render:null,specialChars:iDe,addSpecialChars:null});return(t.replaceTabs=!aDe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,lN)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,lN)),t}});function Vre(e={}){return[iS.of(e),lDe()]}let mH=null;function lDe(){return mH||(mH=xi.fromClass(class{constructor(e){this.view=e,this.decorations=Nn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(iS)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new rDe({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,i=hl(t[0],0);if(i==9){let o=r.lineAt(s),a=n.state.tabSize,c=Qb(o.text,a,s-o.from);return Nn.replace({widget:new hDe((a-c%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Nn.replace({widget:new dDe(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(iS);e.startState.facet(iS)!=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 cDe="•";function uDe(e){return e>=32?cDe:e==10?"␤":String.fromCharCode(9216+e)}class dDe extends dc{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=uDe(this.code),s=t.state.phrase("Control character")+" "+(oDe[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,s,n);if(r)return r;let i=document.createElement("span");return i.textContent=n,i.title=s,i.setAttribute("aria-label",s),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class hDe extends dc{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 fDe(){return pDe}const mDe=Nn.line({class:"cm-activeLine"}),pDe=xi.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 s of e.state.selection.ranges){let r=e.lineBlockAt(s.head);r.from>t&&(n.push(mDe.range(r.from)),t=r.from)}return Nn.set(n)}},{decorations:e=>e.decorations});class gDe extends dc{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?nx(t.firstChild):[];if(!n.length)return null;let s=window.getComputedStyle(t.parentNode),r=Vx(n[0],s.direction!="rtl"),i=parseInt(s.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}function pH(e){let t=xi.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Nn.set([Nn.widget({widget:new gDe(e),side:1}).range(0)]):Nn.none}get decorations(){return this.view.state.doc.length?Nn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Pt.contentAttributes.of({"aria-placeholder":e})]:t}const cN=2e3;function bDe(e,t,n){let s=Math.min(t.line,n.line),r=Math.max(t.line,n.line),i=[];if(t.off>cN||n.off>cN||t.col<0||n.col<0){let o=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let c=s;c<=r;c++){let u=e.doc.line(c);u.length<=a&&i.push(nt.range(u.from+o,u.to+a))}}else{let o=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let c=s;c<=r;c++){let u=e.doc.line(c),d=Hj(u.text,o,e.tabSize,!0);if(d<0)i.push(nt.cursor(u.to));else{let h=Hj(u.text,a,e.tabSize);i.push(nt.range(u.from+d,u.from+h))}}}return i}function yDe(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function gH(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),s=e.state.doc.lineAt(n),r=n-s.from,i=r>cN?-1:r==s.length?yDe(e,t.clientX):Qb(s.text,e.state.tabSize,n-s.from);return{line:s.number,col:i,off:r}}function vDe(e,t){let n=gH(e,t),s=e.state.selection;return n?{update(r){if(r.docChanged){let i=r.changes.mapPos(r.startState.doc.line(n.line).from),o=r.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},s=s.map(r.changes)}},get(r,i,o){let a=gH(e,r);if(!a)return s;let c=bDe(e.state,n,a);return c.length?o?nt.create(c.concat(s.ranges)):nt.create(c):s}}:null}function xDe(e){let t=n=>n.altKey&&n.button==0;return Pt.mouseSelectionStyle.of((n,s)=>t(s)?vDe(n,s):null)}const wDe={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},kDe={style:"cursor: crosshair"};function _De(e={}){let[t,n]=wDe[e.key||"Alt"],s=xi.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==t||n(r))},keyup(r){(r.keyCode==t||!n(r))&&this.set(!1)},mousemove(r){this.set(n(r))}}});return[s,Pt.contentAttributes.of(r=>{var i;return!((i=r.plugin(s))===null||i===void 0)&&i.isDown?kDe:null})]}const G_="-10000px";class Gre{constructor(t,n,s,r){this.facet=n,this.createTooltipView=s,this.removeTooltipView=r,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=s(o,i))}update(t,n){var s;let r=t.state.facet(this.facet),i=r.filter(c=>c);if(r===this.input){for(let c of this.tooltipViews)c.update&&c.update(t);return!1}let o=[],a=n?[]:null;for(let c=0;c<i.length;c++){let u=i[c],d=-1;if(u){for(let h=0;h<this.tooltips.length;h++){let m=this.tooltips[h];m&&m.create==u.create&&(d=h)}if(d<0)o[c]=this.createTooltipView(u,c?o[c-1]:null),a&&(a[c]=!!u.above);else{let h=o[c]=this.tooltipViews[d];a&&(a[c]=n[d]),h.update&&h.update(t)}}}for(let c of this.tooltipViews)o.indexOf(c)<0&&(this.removeTooltipView(c),(s=c.destroy)===null||s===void 0||s.call(c));return n&&(a.forEach((c,u)=>n[u]=c),n.length=a.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function SDe(e={}){return oS.of(e)}function CDe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const oS=dn.define({combine:e=>{var t,n,s;return{position:un.ios?"absolute":((t=e.find(r=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((s=e.find(r=>r.tooltipSpace))===null||s===void 0?void 0:s.tooltipSpace)||CDe}}}),bH=new WeakMap,SR=xi.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(oS);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 Gre(e,CR,(n,s)=>this.createTooltip(n,s),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,s=e.state.facet(oS);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.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),s=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=G_,n.dom.style.left="0px",this.container.insertBefore(n.dom,s),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 s of this.manager.tooltipViews)s.dom.remove(),(e=s.destroy)===null||e===void 0||e.call(s);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(un.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 s=this.view.scrollDOM.getBoundingClientRect(),r=xR(this.view);return{visible:{left:s.left+r.left,top:s.top+r.top,right:s.right-r.right,bottom:s.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(oS).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:s,scaleX:r,scaleY:i}=e,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let c=this.manager.tooltips[a],u=this.manager.tooltipViews[a],{dom:d}=u,h=e.pos[a],m=e.size[a];if(!h||c.clip!==!1&&(h.bottom<=Math.max(n.top,s.top)||h.top>=Math.min(n.bottom,s.bottom)||h.right<Math.max(n.left,s.left)-.1||h.left>Math.min(n.right,s.right)+.1)){d.style.top=G_;continue}let p=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,b=m.right-m.left,x=(t=bH.get(u))!==null&&t!==void 0?t:m.bottom-m.top,y=u.offset||EDe,v=this.view.textDirection==Kr.LTR,w=m.width>s.right-s.left?v?s.left:s.right-m.width:v?Math.max(s.left,Math.min(h.left-(p?14:0)+y.x,s.right-b)):Math.min(Math.max(s.left,h.left-b+(p?14:0)-y.x),s.right-b),k=this.above[a];!c.strictSide&&(k?h.top-x-g-y.y<s.top:h.bottom+x+g+y.y>s.bottom)&&k==s.bottom-h.bottom>h.top-s.top&&(k=this.above[a]=!k);let T=(k?h.top-s.top:s.bottom-h.bottom)-g;if(T<x&&u.resize!==!1){if(T<this.view.defaultLineHeight){d.style.top=G_;continue}bH.set(u,x),d.style.height=(x=T)/i+"px"}else d.style.height&&(d.style.height="");let C=k?h.top-x-g-y.y:h.bottom+g+y.y,_=w+b;if(u.overlap!==!0)for(let S of o)S.left<_&&S.right>w&&S.top<C+x&&S.bottom>C&&(C=k?S.top-x-2-g:S.bottom+g+2);if(this.position=="absolute"?(d.style.top=(C-e.parent.top)/i+"px",yH(d,(w-e.parent.left)/r)):(d.style.top=C/i+"px",yH(d,w/r)),p){let S=h.left+(v?y.x:-y.x)-(w+14-7);p.style.left=S/r+"px"}u.overlap!==!0&&o.push({left:w,top:C,right:_,bottom:C+x}),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=G_}},{eventObservers:{scroll(){this.maybeMeasure()}}});function yH(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const TDe=Pt.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"}}}),EDe={x:0,y:0},CR=dn.define({enables:[SR,TDe]}),Z4=dn.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class xT{static create(t){return new xT(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Gre(t,Z4,(n,s)=>this.createHostedView(n,s),n=>n.dom.remove())}createHostedView(t,n){let s=t.create(this.view);return s.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(s.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&s.mount&&s.mount(this.view),s}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 s of this.manager.tooltipViews){let r=s[t];if(r!==void 0){if(n===void 0)n=r;else if(n!==r)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 ADe=CR.compute([Z4],e=>{let t=e.facet(Z4);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var s;return(s=n.end)!==null&&s!==void 0?s:n.pos})),create:xT.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),Kre=dn.define();class jDe{constructor(t,n,s,r,i,o){this.view=t,this.source=n,this.field=s,this.locked=r,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,s=t.docView.tile.nearest(n.target);if(!s)return;let r,i=1;if(s.isWidget())r=s.posAtStart;else{if(r=t.posAtCoords(n),r==null)return;let o=t.coordsAtPos(r);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-t.defaultCharacterWidth||n.x>o.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(r)).find(u=>u.from<=r&&u.to>=r),c=a&&a.dir==Kr.RTL?-1:1;i=n.x<o.left?-c:c}this.activateHover(t,r,i)}activateHover(t,n,s,r){let i=this.source(t,n,s),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let c=Array.isArray(a)?a:[a];r&&this.locked.set(c,r),t.dispatch({effects:this.setHover.of(c)})}};if(i&&"then"in i){let a=this.pending={pos:n};i.then(c=>{this.pending==a&&(this.pending=null,o(c))},c=>gl(t.state,c,"hover tooltip"))}else o(i)}get tooltip(){let t=this.view.plugin(SR),n=t?t.manager.tooltips.findIndex(s=>s.create==xT.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,s;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:r,tooltip:i}=this;if(r.length&&!this.locked.has(r)&&i&&!NDe(i.dom,t)||this.pending){let{pos:o}=r[0]||this.pending,a=(s=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&s!==void 0?s:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!MDe(this.view,o,a,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:s}=this;s&&s.dom.contains(t.relatedTarget)?this.watchTooltipLeave(s.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=s=>{t.removeEventListener("mouseleave",n);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(s.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 K_=4;function NDe(e,t){let{left:n,right:s,top:r,bottom:i}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();r=Math.min(a.top,r),i=Math.max(a.bottom,i)}return t.clientX>=n-K_&&t.clientX<=s+K_&&t.clientY>=r-K_&&t.clientY<=i+K_}function MDe(e,t,n,s,r,i){let o=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>s||o.right<s||o.top>r||Math.min(o.bottom,a)<r)return!1;let c=e.posAtCoords({x:s,y:r},!1);return c>=t&&c<=n}function IDe(e,t={}){let n=_s.define(),s=new WeakMap,r=ca.define({create(){return[]},update(o,a){let c=s.get(o);if(o.length&&(t.hideOnChange&&(a.docChanged||a.selection)?o=[]:c&&c(a)?o=[]:t.hideOn&&(o=o.filter(u=>!t.hideOn(a,u)))),a.docChanged&&o.length){let u=[];for(let d of o){let h=a.changes.mapPos(d.pos,-1,Ha.TrackDel);if(h!=null){let m=Object.assign(Object.create(null),d);m.pos=h,m.end!=null&&(m.end=a.changes.mapPos(m.end)),u.push(m)}}o=u}for(let u of a.effects)u.is(n)&&(o=u.value,c=void 0),(u.is(DDe)&&!u.value||u.value==r)&&(o=[]);return o.length&&c&&s.set(o,c),o},provide:o=>Z4.from(o)});const i=xi.define(o=>new jDe(o,e,r,s,n,t.hoverTime||300));return{active:r,extension:[r,i,Kre.of(i),ADe]}}function RDe(e,t,n,s={}){var r;let i=e.state.facet(Kre).map(o=>e.plugin(o)).filter(o=>!!o);if(s.tooltip&&s.tooltip.active){let o=i.find(a=>a.field==s.tooltip.active);o&&(i=[o])}for(let o of i)o.activateHover(e,t,n,(r=s.until)!==null&&r!==void 0?r:()=>!1)}function Yre(e,t){let n=e.plugin(SR);if(!n)return null;let s=n.manager.tooltips.indexOf(t);return s<0?null:n.manager.tooltipViews[s]}const DDe=_s.define(),vH=dn.define({combine(e){let t,n;for(let s of e)t=t||s.topContainer,n=n||s.bottomContainer;return{topContainer:t,bottomContainer:n}}});function TR(e,t){let n=e.plugin(Xre),s=n?n.specs.indexOf(t):-1;return s>-1?n.panels[s]:null}const Xre=xi.fromClass(class{constructor(e){this.input=e.state.facet(Kx),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(vH);this.top=new Y_(e,!0,t.topContainer),this.bottom=new Y_(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(vH);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Y_(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Y_(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Kx);if(n!=this.input){let s=n.filter(c=>c),r=[],i=[],o=[],a=[];for(let c of s){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),a.push(d)):(d=this.panels[u],d.update&&d.update(e)),r.push(d),(d.top?i:o).push(d)}this.specs=s,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let c of a)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let s of this.panels)s.update&&s.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Pt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Y_{constructor(t,n,s){this.view=t,this.top=n,this.container=s,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=xH(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=xH(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 xH(e){let t=e.nextSibling;return e.remove(),t}const Kx=dn.define({enables:Xre});function LDe(e,t){let n,s=new Promise(o=>n=o),r=o=>PDe(o,t,n);e.state.field(K8,!1)?e.dispatch({effects:Qre.of(r)}):e.dispatch({effects:_s.appendConfig.of(K8.init(()=>[r]))});let i=Jre.of(r);return{close:i,result:s.then(o=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(K8).indexOf(r)>-1&&e.dispatch({effects:i})}),o))}}const K8=ca.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(Qre)?e=[n.value].concat(e):n.is(Jre)&&(e=e.filter(s=>s!=n.value));return e},provide:e=>Kx.computeN([e],t=>t.field(e))}),Qre=_s.define(),Jre=_s.define();function PDe(e,t,n){let s=t.content?t.content(e,()=>o(null)):null;if(!s){if(s=$r("form"),t.input){let a=$r("input",t.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),s.appendChild($r("label",(t.label||"")+": ",a))}else s.appendChild(document.createTextNode(t.label||""));s.appendChild(document.createTextNode(" ")),s.appendChild($r("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let r=s.nodeName=="FORM"?[s]:s.querySelectorAll("form");for(let a=0;a<r.length;a++){let c=r[a];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=$r("div",s,$r("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(a){i.contains(i.ownerDocument.activeElement)&&e.focus(),n(a)}return{dom:i,top:t.top,mount:()=>{if(t.focus){let a;typeof t.focus=="string"?a=s.querySelector(t.focus):a=s.querySelector("input")||s.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class Fh extends Em{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Fh.prototype.elementClass="";Fh.prototype.toDOM=void 0;Fh.prototype.mapMode=Ha.TrackBefore;Fh.prototype.startSide=Fh.prototype.endSide=-1;Fh.prototype.point=!0;const aS=dn.define(),ODe=dn.define(),$De={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ks.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ix=dn.define();function BDe(e){return[Zre(),ix.of({...$De,...e})]}const wH=dn.define({combine:e=>e.some(t=>t)});function Zre(e){return[zDe]}const zDe=xi.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(ix).map(t=>new _H(e,t)),this.fixed=!e.state.facet(wH);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,s=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(s<(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(wH)!=!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=Ks.iter(this.view.state.facet(aS),this.view.viewport.from),s=[],r=this.gutters.map(i=>new FDe(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==aa.Text&&o){uN(n,s,a.from);for(let c of r)c.line(this.view,a,s);o=!1}else if(a.widget)for(let c of r)c.widget(this.view,a)}else if(i.type==aa.Text){uN(n,s,i.from);for(let o of r)o.line(this.view,i,s)}else if(i.widget)for(let o of r)o.widget(this.view,i);for(let i of r)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(ix),n=e.state.facet(ix),s=e.docChanged||e.heightChanged||e.viewportChanged||!Ks.eq(e.startState.facet(aS),e.state.facet(aS),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let r of this.gutters)r.update(e)&&(s=!0);else{s=!0;let r=[];for(let i of n){let o=t.indexOf(i);o<0?r.push(new _H(this.view,i)):(this.gutters[o].update(e),r.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),r.indexOf(i)<0&&i.destroy();for(let i of r)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=r}return s}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>Pt.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let s=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Kr.LTR?{left:s,right:r}:{right:s,left:r}})});function kH(e){return Array.isArray(e)?e:[e]}function uN(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class FDe{constructor(t,n,s){this.gutter=t,this.height=s,this.i=0,this.cursor=Ks.iter(t.markers,n.from)}addElement(t,n,s){let{gutter:r}=this,i=(n.top-this.height)/t.scaleY,o=n.height/t.scaleY;if(this.i==r.elements.length){let a=new eie(t,o,i,s);r.elements.push(a),r.dom.appendChild(a.dom)}else r.elements[this.i].update(t,o,i,s);this.height=n.bottom,this.i++}line(t,n,s){let r=[];uN(this.cursor,r,n.from),s.length&&(r=r.concat(s));let i=this.gutter.config.lineMarker(t,n,r);i&&r.unshift(i);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(t,n,r)}widget(t,n){let s=this.gutter.config.widgetMarker(t,n.widget,n),r=s?[s]:null;for(let i of t.state.facet(ODe)){let o=i(t,n.widget,n);o&&(r||(r=[])).push(o)}r&&this.addElement(t,n,r)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class _H{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 s in n.domEventHandlers)this.dom.addEventListener(s,r=>{let i=r.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=r.clientY;let a=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[s](t,a,r)&&r.preventDefault()});this.markers=kH(n.markers(t)),n.initialSpacer&&(this.spacer=new eie(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=kH(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],t);r!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[r])}let s=t.view.viewport;return!Ks.eq(this.markers,n,s.from,s.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class eie{constructor(t,n,s,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,s,r)}update(t,n,s,r){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=s&&(this.dom.style.marginTop=(this.above=s)?s+"px":""),HDe(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,n){let s="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let a=o,c=i<n.length?n[i++]:null,u=!1;if(c){let d=c.elementClass;d&&(s+=" "+d);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(c)){a=h,u=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(r);let h=r.nextSibling;r.remove(),r=h}}if(!c)break;c.toDOM&&(u?r=r.nextSibling:this.dom.insertBefore(c.toDOM(t),r)),u&&o++}this.dom.className=s,this.markers=n}destroy(){this.setMarkers(null,[])}}function HDe(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 qDe=dn.define(),UDe=dn.define(),p1=dn.define({combine(e){return Ed(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,n){let s=Object.assign({},t);for(let r in n){let i=s[r],o=n[r];s[r]=i?(a,c,u)=>i(a,c,u)||o(a,c,u):o}return s}})}});class Y8 extends Fh{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function X8(e,t){return e.state.facet(p1).formatNumber(t,e.state)}const WDe=ix.compute([p1],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(qDe)},lineMarker(t,n,s){return s.some(r=>r.toDOM)?null:new Y8(X8(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,s)=>{for(let r of t.state.facet(UDe)){let i=r(t,n,s);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet(p1)!=t.state.facet(p1),initialSpacer(t){return new Y8(X8(t,SH(t.state.doc.lines)))},updateSpacer(t,n){let s=X8(n.view,SH(n.view.state.doc.lines));return s==t.number?t:new Y8(s)},domEventHandlers:e.facet(p1).domEventHandlers,side:"before"}));function VDe(e={}){return[p1.of(e),Zre(),WDe]}function SH(e){let t=9;for(;t<e;)t=t*10+9;return t}const GDe=new class extends Fh{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},KDe=aS.compute(["selection"],e=>{let t=[],n=-1;for(let s of e.selection.ranges){let r=e.doc.lineAt(s.head).from;r>n&&(n=r,t.push(GDe.range(r)))}return Ks.of(t)});function YDe(){return KDe}const XDe=1024;let QDe=0;class Q8{constructor(t,n){this.from=t,this.to=n}}class rr{constructor(t={}){this.id=QDe++,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=Fc.match(t)),n=>{let s=t(n);return s===void 0?null:[this,s]}}}rr.closedBy=new rr({deserialize:e=>e.split(" ")});rr.openedBy=new rr({deserialize:e=>e.split(" ")});rr.group=new rr({deserialize:e=>e.split(" ")});rr.isolate=new rr({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});rr.contextHash=new rr({perNode:!0});rr.lookAhead=new rr({perNode:!0});rr.mounted=new rr({perNode:!0});class ox{constructor(t,n,s,r=!1){this.tree=t,this.overlay=n,this.parser=s,this.bracketed=r}static get(t){return t&&t.props&&t.props[rr.mounted.id]}}const JDe=Object.create(null);class Fc{constructor(t,n,s,r=0){this.name=t,this.props=n,this.id=s,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):JDe,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new Fc(t.name||"",n,t.id,s);if(t.props){for(let i of t.props)if(Array.isArray(i)||(i=i(r)),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 r}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(rr.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let s in t)for(let r of s.split(" "))n[r]=t[s];return s=>{for(let r=s.prop(rr.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?s.name:r[i]];if(o)return o}}}}Fc.none=new Fc("",Object.create(null),0,8);const X_=new WeakMap,CH=new WeakMap;var Yi;(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"})(Yi||(Yi={}));class ia{constructor(t,n,s,r,i){if(this.type=t,this.children=n,this.positions=s,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=ox.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let s of this.children){let r=s.toString();r&&(n&&(n+=","),n+=r)}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 hN(this.topNode,t)}cursorAt(t,n=0,s=0){let r=X_.get(this)||this.topNode,i=new hN(r);return i.moveTo(t,n),X_.set(this,i._tree),i}get topNode(){return new Im(this,0,0,null)}resolve(t,n=0){let s=Yx(X_.get(this)||this.topNode,t,n,!1);return X_.set(this,s),s}resolveInner(t,n=0){let s=Yx(CH.get(this)||this.topNode,t,n,!0);return CH.set(this,s),s}resolveStack(t,n=0){return tLe(this,t,n)}iterate(t){let{enter:n,leave:s,from:r=0,to:i=this.length}=t,o=t.mode||0,a=(o&Yi.IncludeAnonymous)>0;for(let c=this.cursor(o|Yi.IncludeAnonymous);;){let u=!1;if(c.from<=i&&c.to>=r&&(!a&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&s&&(a||!c.type.isAnonymous)&&s(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:jR(Fc.none,this.children,this.positions,0,this.children.length,0,this.length,(n,s,r)=>new ia(this.type,n,s,r,this.propValues),t.makeTree||((n,s,r)=>new ia(Fc.none,n,s,r)))}static build(t){return nLe(t)}}ia.empty=new ia(Fc.none,[],[],0);class ER{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 ER(this.buffer,this.index)}}class Mm{constructor(t,n,s){this.buffer=t,this.length=n,this.set=s}get type(){return Fc.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],s=this.buffer[t+3],r=this.set.types[n],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),t+=4,s==t)return i;let o=[];for(;t<s;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,s,r,i){let{buffer:o}=this,a=-1;for(let c=t;c!=n&&!(tie(i,r,o[c+1],o[c+2])&&(a=c,s>0));c=o[c+3]);return a}slice(t,n,s){let r=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,c=0;a<n;){i[c++]=r[a++],i[c++]=r[a++]-s;let u=i[c++]=r[a++]-s;i[c++]=r[a++]-t,o=Math.max(o,u)}return new Mm(i,o,this.set)}}function tie(e,t,n,s){switch(e){case-2:return n<t;case-1:return s>=t&&n<t;case 0:return n<t&&s>t;case 1:return n<=t&&s>t;case 2:return s>t;case 4:return!0}}function Yx(e,t,n,s){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!s&&e instanceof Im&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=s?0:Yi.IgnoreOverlays;if(s)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof Im&&o.index<0&&((r=a.enter(t,n,i))===null||r===void 0?void 0:r.from)!=o.from&&(e=a);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class nie{cursor(t=0){return new hN(this,t)}getChild(t,n=null,s=null){let r=TH(this,t,n,s);return r.length?r[0]:null}getChildren(t,n=null,s=null){return TH(this,t,n,s)}resolve(t,n=0){return Yx(this,t,n,!1)}resolveInner(t,n=0){return Yx(this,t,n,!0)}matchContext(t){return dN(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),s=this;for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(s=n,n=r.prevSibling):n=r}return s}get node(){return this}get next(){return this.parent}}let Im=class lS extends nie{constructor(t,n,s,r){super(),this._tree=t,this.from=n,this.index=s,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,s,r,i=0){for(let o=this;;){for(let{children:a,positions:c}=o._tree,u=n>0?a.length:-1;t!=u;t+=n){let d=a[t],h=c[t]+o.from,m;if(!(!(i&Yi.EnterBracketed&&d instanceof ia&&(m=ox.get(d))&&!m.overlay&&m.bracketed&&s>=h&&s<=h+d.length)&&!tie(r,s,h,h+d.length))){if(d instanceof Mm){if(i&Yi.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,s-h,r);if(p>-1)return new Vf(new ZDe(o,d,t,h),null,p)}else if(i&Yi.IncludeAnonymous||!d.type.isAnonymous||AR(d)){let p;if(!(i&Yi.IgnoreMounts)&&(p=ox.get(d))&&!p.overlay)return new lS(p.tree,h,t,o);let g=new lS(d,h,t,o);return i&Yi.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,s,r,i)}}}if(i&Yi.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,s=0){let r;if(!(s&Yi.IgnoreOverlays)&&(r=ox.get(this._tree))&&r.overlay){let i=t-this.from,o=s&Yi.EnterBracketed&&r.bracketed;for(let{from:a,to:c}of r.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?c>=i:c>i))return new lS(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,s)}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 TH(e,t,n,s){let r=e.cursor(),i=[];if(!r.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=r.type.is(n),!r.nextSibling())return i}for(;;){if(s!=null&&r.type.is(s))return i;if(r.type.is(t)&&i.push(r.node),!r.nextSibling())return s==null?i:[]}}function dN(e,t,n=t.length-1){for(let s=e;n>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(t[n]&&t[n]!=s.name)return!1;n--}}return!0}class ZDe{constructor(t,n,s,r){this.parent=t,this.buffer=n,this.index=s,this.start=r}}class Vf extends nie{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,s){super(),this.context=t,this._parent=n,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,n,s){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,s);return i<0?null:new Vf(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,s=0){if(s&Yi.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new Vf(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 Vf(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 Vf(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:s}=this.context,r=this.index+4,i=s.buffer[this.index+3];if(i>r){let o=s.buffer[this.index+1];t.push(s.slice(r,i,o)),n.push(0)}return new ia(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function sie(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 s=n instanceof Im&&n.index<0?null:n.parent,r=e.slice();return s?r[t]=s:r.splice(t,1),new eLe(r,n)}class eLe{constructor(t,n){this.heads=t,this.node=n}get next(){return sie(this.heads)}}function tLe(e,t,n){let s=e.resolveInner(t,n),r=null;for(let i=s instanceof Im?s:s.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(r||(r=[s])).push(o.resolve(t,n)),i=o}else{let o=ox.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new Im(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[s])).push(Yx(a,t,n,!1))}}return r?sie(r):s}class hN{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&~Yi.EnterBracketed,t instanceof Im)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let s=t._parent;s;s=s._parent)this.stack.unshift(s.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:s,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[t]],this.from=s+r.buffer[t+1],this.to=s+r.buffer[t+2],!0}yield(t){return t?t instanceof Im?(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,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,s,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.buffer.start,s);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,s=this.mode){return this.buffer?s&Yi.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Yi.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Yi.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,s=this.stack.length-1;if(t<0){let r=s<0?0:this.stack[s]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(s<0?n.buffer.length:n.buffer[this.stack[s]+3]))return this.yieldBuf(r)}return s<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,s,{buffer:r}=this;if(r){if(t>0){if(this.index<r.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(r.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:s}=r)}else({index:n,_parent:s}=this._tree);for(;s;{index:n,_parent:s}=s)if(n>-1)for(let i=n+t,o=t<0?-1:s._tree.children.length;i!=o;i+=t){let a=s._tree.children[i];if(this.mode&Yi.IncludeAnonymous||a instanceof Mm||!a.type.isAnonymous||AR(a))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,s=0;if(t&&t.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;n=o,s=i+1;break e}r=this.stack[--i]}for(let r=s;r<this.stack.length;r++)n=new Vf(this.buffer,n,this.stack[r]);return this.bufferNode=new Vf(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let s=0;;){let r=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){s++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&n&&n(this),r=this.type.isAnonymous,!s)return;if(this.nextSibling())break;this.parent(),s--,r=!0}}}matchContext(t){if(!this.buffer)return dN(this.node.parent,t);let{buffer:n}=this.buffer,{types:s}=n.set;for(let r=t.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return dN(this._tree,t,r);let o=s[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}}function AR(e){return e.children.some(t=>t instanceof Mm||!t.type.isAnonymous||AR(t))}function nLe(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=XDe,reused:i=[],minRepeatType:o=s.types.length}=e,a=Array.isArray(n)?new ER(n,n.length):n,c=s.types,u=0,d=0;function h(T,C,_,S,D,E){let{id:B,start:I,end:L,size:O}=a,A=d,$=u;if(O<0)if(a.next(),O==-1){let ee=i[B];_.push(ee),S.push(I-T);return}else if(O==-3){u=B;return}else if(O==-4){d=B;return}else throw new RangeError(`Unrecognized record size: ${O}`);let q=c[B],U,H,M=I-T;if(L-I<=r&&(H=x(a.pos-C,D))){let ee=new Uint16Array(H.size-H.skip),V=a.pos-H.size,R=ee.length;for(;a.pos>V;)R=y(H.start,ee,R);U=new Mm(ee,L-H.start,s),M=H.start-T}else{let ee=a.pos-O;a.next();let V=[],R=[],re=B>=o?B:-1,Z=0,K=L;for(;a.pos>ee;)re>=0&&a.id==re&&a.size>=0?(a.end<=K-r&&(g(V,R,I,Z,a.end,K,re,A,$),Z=V.length,K=a.end),a.next()):E>2500?m(I,ee,V,R):h(I,ee,V,R,re,E+1);if(re>=0&&Z>0&&Z<V.length&&g(V,R,I,Z,I,K,re,A,$),V.reverse(),R.reverse(),re>-1&&Z>0){let Y=p(q,$);U=jR(q,V,R,0,V.length,0,L-I,Y,Y)}else U=b(q,V,R,L-I,A-L,$)}_.push(U),S.push(M)}function m(T,C,_,S){let D=[],E=0,B=-1;for(;a.pos>C;){let{id:I,start:L,end:O,size:A}=a;if(A>4)a.next();else{if(B>-1&&L<B)break;B<0&&(B=O-r),D.push(I,L,O),E++,a.next()}}if(E){let I=new Uint16Array(E*4),L=D[D.length-2];for(let O=D.length-3,A=0;O>=0;O-=3)I[A++]=D[O],I[A++]=D[O+1]-L,I[A++]=D[O+2]-L,I[A++]=A;_.push(new Mm(I,D[2]-L,s)),S.push(L-T)}}function p(T,C){return(_,S,D)=>{let E=0,B=_.length-1,I,L;if(B>=0&&(I=_[B])instanceof ia){if(!B&&I.type==T&&I.length==D)return I;(L=I.prop(rr.lookAhead))&&(E=S[B]+I.length+L)}return b(T,_,S,D,E,C)}}function g(T,C,_,S,D,E,B,I,L){let O=[],A=[];for(;T.length>S;)O.push(T.pop()),A.push(C.pop()+_-D);T.push(b(s.types[B],O,A,E-D,I-E,L)),C.push(D-_)}function b(T,C,_,S,D,E,B){if(E){let I=[rr.contextHash,E];B=B?[I].concat(B):[I]}if(D>25){let I=[rr.lookAhead,D];B=B?[I].concat(B):[I]}return new ia(T,C,_,S,B)}function x(T,C){let _=a.fork(),S=0,D=0,E=0,B=_.end-r,I={size:0,start:0,skip:0};e:for(let L=_.pos-T;_.pos>L;){let O=_.size;if(_.id==C&&O>=0){I.size=S,I.start=D,I.skip=E,E+=4,S+=4,_.next();continue}let A=_.pos-O;if(O<0||A<L||_.start<B)break;let $=_.id>=o?4:0,q=_.start;for(_.next();_.pos>A;){if(_.size<0)if(_.size==-3||_.size==-4)$+=4;else break e;else _.id>=o&&($+=4);_.next()}D=q,S+=O,E+=$}return(C<0||S==T)&&(I.size=S,I.start=D,I.skip=E),I.size>4?I:void 0}function y(T,C,_){let{id:S,start:D,end:E,size:B}=a;if(a.next(),B>=0&&S<o){let I=_;if(B>4){let L=a.pos-(B-4);for(;a.pos>L;)_=y(T,C,_)}C[--_]=I,C[--_]=E-T,C[--_]=D-T,C[--_]=S}else B==-3?u=S:B==-4&&(d=S);return _}let v=[],w=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,v,w,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:v.length?w[0]+v[0].length:0;return new ia(c[e.topID],v.reverse(),w.reverse(),k)}const EH=new WeakMap;function cS(e,t){if(!e.isAnonymous||t instanceof Mm||t.type!=e)return 1;let n=EH.get(t);if(n==null){n=1;for(let s of t.children){if(s.type!=e||!(s instanceof ia)){n=1;break}n+=cS(e,s)}EH.set(t,n)}return n}function jR(e,t,n,s,r,i,o,a,c){let u=0;for(let g=s;g<r;g++)u+=cS(e,t[g]);let d=Math.ceil(u*1.5/8),h=[],m=[];function p(g,b,x,y,v){for(let w=x;w<y;){let k=w,T=b[w],C=cS(e,g[w]);for(w++;w<y;w++){let _=cS(e,g[w]);if(C+_>=d)break;C+=_}if(w==k+1){if(C>d){let _=g[k];p(_.children,_.positions,0,_.children.length,b[k]+v);continue}h.push(g[k])}else{let _=b[w-1]+g[w-1].length-T;h.push(jR(e,g,b,k,w,T,_,null,c))}m.push(T+v-i)}}return p(t,n,s,r,0),(a||c)(h,m,o)}class a0{constructor(t,n,s,r,i=!1,o=!1){this.from=t,this.to=n,this.tree=s,this.offset=r,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=[],s=!1){let r=[new a0(0,t.length,t,0,!1,s)];for(let i of n)i.to>t.length&&r.push(i);return r}static applyChanges(t,n,s=128){if(!n.length)return t;let r=[],i=1,o=t.length?t[0]:null;for(let a=0,c=0,u=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-c>=s)for(;o&&o.from<h;){let m=o;if(c>=m.from||h<=m.to||u){let p=Math.max(m.from,c)-u,g=Math.min(m.to,h)-u;m=p>=g?null:new a0(p,g,m.tree,m.offset+u,a>0,!!d)}if(m&&r.push(m),o.to>h)break;o=i<t.length?t[i++]:null}if(!d)break;c=d.toA,u=d.toA-d.toB}return r}}class sLe{startParse(t,n,s){return typeof t=="string"&&(t=new rLe(t)),s=s?s.length?s.map(r=>new Q8(r.from,r.to)):[new Q8(0,0)]:[new Q8(0,t.length)],this.createParse(t,n||[],s)}parse(t,n,s){let r=this.startParse(t,n,s);for(;;){let i=r.advance();if(i)return i}}}class rLe{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 rr({perNode:!0});let iLe=0;class Ec{constructor(t,n,s,r){this.name=t,this.set=n,this.base=s,this.modified=r,this.id=iLe++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let s=typeof t=="string"?t:"?";if(t instanceof Ec&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new Ec(s,[],null,[]);if(r.set.push(r),n)for(let i of n.set)r.set.push(i);return r}static defineModifier(t){let n=new e3(t);return s=>s.modified.indexOf(n)>-1?s:e3.get(s.base||s,s.modified.concat(n).sort((r,i)=>r.id-i.id))}}let oLe=0;class e3{constructor(t){this.name=t,this.instances=[],this.id=oLe++}static get(t,n){if(!n.length)return t;let s=n[0].instances.find(a=>a.base==t&&aLe(n,a.modified));if(s)return s;let r=[],i=new Ec(t.name,r,t,n);for(let a of n)a.instances.push(i);let o=lLe(n);for(let a of t.set)if(!a.modified.length)for(let c of o)r.push(e3.get(a,c));return i}}function aLe(e,t){return e.length==t.length&&e.every((n,s)=>n==t[s])}function lLe(e){let t=[[]];for(let n=0;n<e.length;n++)for(let s=0,r=t.length;s<r;s++)t.push(t[s].concat(e[n]));return t.sort((n,s)=>s.length-n.length)}function cLe(e){let t=Object.create(null);for(let n in e){let s=e[n];Array.isArray(s)||(s=[s]);for(let r of n.split(" "))if(r){let i=[],o=2,a=r;for(let h=0;;){if(a=="..."&&h>0&&h+3==r.length){o=1;break}let m=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!m)throw new RangeError("Invalid path: "+r);if(i.push(m[0]=="*"?"":m[0][0]=='"'?JSON.parse(m[0]):m[0]),h+=m[0].length,h==r.length)break;let p=r[h++];if(h==r.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+r);a=r.slice(h)}let c=i.length-1,u=i[c];if(!u)throw new RangeError("Invalid path: "+r);let d=new Xx(s,o,c>0?i.slice(0,c):null);t[u]=d.sort(t[u])}}return rie.add(t)}const rie=new rr({combine(e,t){let n,s,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let i=new Xx(r.tags,r.mode,r.context);n?n.next=i:s=i,n=i}return s}});class Xx{constructor(t,n,s,r){this.tags=t,this.mode=n,this.context=s,this.next=r}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}}Xx.empty=new Xx([],2,null);function iie(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:s,all:r=null}=t||{};return{style:i=>{let o=r;for(let a of i)for(let c of a.set){let u=n[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:s}}function uLe(e,t){let n=null;for(let s of e){let r=s.style(t);r&&(n=n?n+" "+r:r)}return n}function dLe(e,t,n,s=0,r=e.length){let i=new hLe(s,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),s,r,"",i.highlighters),i.flush(r)}class hLe{constructor(t,n,s){this.at=t,this.highlighters=n,this.span=s,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,s,r,i){let{type:o,from:a,to:c}=t;if(a>=s||c<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=r,d=fLe(t)||Xx.empty,h=uLe(i,d.tags);if(h&&(u&&(u+=" "),u+=h,d.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(n,a),u),d.opaque)return;let m=t.tree&&t.tree.prop(rr.mounted);if(m&&m.overlay){let p=t.node.enter(m.overlay[0].from+a,1),g=this.highlighters.filter(x=>!x.scope||x.scope(m.tree.type)),b=t.firstChild();for(let x=0,y=a;;x++){let v=x<m.overlay.length?m.overlay[x]:null,w=v?v.from+a:c,k=Math.max(n,y),T=Math.min(s,w);if(k<T&&b)for(;t.from<T&&(this.highlightRange(t,k,T,r,i),this.startSpan(Math.min(T,t.to),u),!(t.to>=w||!t.nextSibling())););if(!v||w>s)break;y=v.to+a,y>n&&(this.highlightRange(p.cursor(),Math.max(n,v.from+a),Math.min(s,y),"",g),this.startSpan(Math.min(s,y),u))}b&&t.parent()}else if(t.firstChild()){m&&(r="");do if(!(t.to<=n)){if(t.from>=s)break;this.highlightRange(t,n,s,r,i),this.startSpan(Math.min(s,t.to),u)}while(t.nextSibling());t.parent()}}}function fLe(e){let t=e.type.prop(rie);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Zt=Ec.define,Q_=Zt(),Af=Zt(),AH=Zt(Af),jH=Zt(Af),jf=Zt(),J_=Zt(jf),J8=Zt(jf),zu=Zt(),Sp=Zt(zu),Du=Zt(),Lu=Zt(),fN=Zt(),Ky=Zt(fN),Z_=Zt(),rn={comment:Q_,lineComment:Zt(Q_),blockComment:Zt(Q_),docComment:Zt(Q_),name:Af,variableName:Zt(Af),typeName:AH,tagName:Zt(AH),propertyName:jH,attributeName:Zt(jH),className:Zt(Af),labelName:Zt(Af),namespace:Zt(Af),macroName:Zt(Af),literal:jf,string:J_,docString:Zt(J_),character:Zt(J_),attributeValue:Zt(J_),number:J8,integer:Zt(J8),float:Zt(J8),bool:Zt(jf),regexp:Zt(jf),escape:Zt(jf),color:Zt(jf),url:Zt(jf),keyword:Du,self:Zt(Du),null:Zt(Du),atom:Zt(Du),unit:Zt(Du),modifier:Zt(Du),operatorKeyword:Zt(Du),controlKeyword:Zt(Du),definitionKeyword:Zt(Du),moduleKeyword:Zt(Du),operator:Lu,derefOperator:Zt(Lu),arithmeticOperator:Zt(Lu),logicOperator:Zt(Lu),bitwiseOperator:Zt(Lu),compareOperator:Zt(Lu),updateOperator:Zt(Lu),definitionOperator:Zt(Lu),typeOperator:Zt(Lu),controlOperator:Zt(Lu),punctuation:fN,separator:Zt(fN),bracket:Ky,angleBracket:Zt(Ky),squareBracket:Zt(Ky),paren:Zt(Ky),brace:Zt(Ky),content:zu,heading:Sp,heading1:Zt(Sp),heading2:Zt(Sp),heading3:Zt(Sp),heading4:Zt(Sp),heading5:Zt(Sp),heading6:Zt(Sp),contentSeparator:Zt(zu),list:Zt(zu),quote:Zt(zu),emphasis:Zt(zu),strong:Zt(zu),link:Zt(zu),monospace:Zt(zu),strikethrough:Zt(zu),inserted:Zt(),deleted:Zt(),changed:Zt(),invalid:Zt(),meta:Z_,documentMeta:Zt(Z_),annotation:Zt(Z_),processingInstruction:Zt(Z_),definition:Ec.defineModifier("definition"),constant:Ec.defineModifier("constant"),function:Ec.defineModifier("function"),standard:Ec.defineModifier("standard"),local:Ec.defineModifier("local"),special:Ec.defineModifier("special")};for(let e in rn){let t=rn[e];t instanceof Ec&&(t.name=e)}iie([{tag:rn.link,class:"tok-link"},{tag:rn.heading,class:"tok-heading"},{tag:rn.emphasis,class:"tok-emphasis"},{tag:rn.strong,class:"tok-strong"},{tag:rn.keyword,class:"tok-keyword"},{tag:rn.atom,class:"tok-atom"},{tag:rn.bool,class:"tok-bool"},{tag:rn.url,class:"tok-url"},{tag:rn.labelName,class:"tok-labelName"},{tag:rn.inserted,class:"tok-inserted"},{tag:rn.deleted,class:"tok-deleted"},{tag:rn.literal,class:"tok-literal"},{tag:rn.string,class:"tok-string"},{tag:rn.number,class:"tok-number"},{tag:[rn.regexp,rn.escape,rn.special(rn.string)],class:"tok-string2"},{tag:rn.variableName,class:"tok-variableName"},{tag:rn.local(rn.variableName),class:"tok-variableName tok-local"},{tag:rn.definition(rn.variableName),class:"tok-variableName tok-definition"},{tag:rn.special(rn.variableName),class:"tok-variableName2"},{tag:rn.definition(rn.propertyName),class:"tok-propertyName tok-definition"},{tag:rn.typeName,class:"tok-typeName"},{tag:rn.namespace,class:"tok-namespace"},{tag:rn.className,class:"tok-className"},{tag:rn.macroName,class:"tok-macroName"},{tag:rn.propertyName,class:"tok-propertyName"},{tag:rn.operator,class:"tok-operator"},{tag:rn.comment,class:"tok-comment"},{tag:rn.meta,class:"tok-meta"},{tag:rn.invalid,class:"tok-invalid"},{tag:rn.punctuation,class:"tok-punctuation"}]);var Z8;const kv=new rr,mLe=new rr;class nd{constructor(t,n,s=[],r=""){this.data=t,this.name=r,nr.prototype.hasOwnProperty("tree")||Object.defineProperty(nr.prototype,"tree",{get(){return va(this)}}),this.parser=n,this.extension=[Rm.of(this),nr.languageData.of((i,o,a)=>{let c=NH(i,o,a),u=c.type.prop(kv);if(!u)return[];let d=i.facet(u),h=c.type.prop(mLe);if(h){let m=c.resolve(o-c.from,a);for(let p of h)if(p.test(m,i)){let g=i.facet(p.facet);return p.type=="replace"?g:g.concat(d)}}return d})].concat(s)}isActiveAt(t,n,s=-1){return NH(t,n,s).type.prop(kv)==this.data}findRegions(t){let n=t.facet(Rm);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let s=[],r=(i,o)=>{if(i.prop(kv)==this.data){s.push({from:o,to:o+i.length});return}let a=i.prop(rr.mounted);if(a){if(a.tree.prop(kv)==this.data){if(a.overlay)for(let c of a.overlay)s.push({from:c.from+o,to:c.to+o});else s.push({from:o,to:o+i.length});return}else if(a.overlay){let c=s.length;if(r(a.tree,a.overlay[0].from+o),s.length>c)return}}for(let c=0;c<i.children.length;c++){let u=i.children[c];u instanceof ia&&r(u,i.positions[c]+o)}};return r(va(t),0),s}get allowsNesting(){return!0}}nd.setState=_s.define();function NH(e,t,n){let s=e.facet(Rm),r=va(e).topNode;if(!s||s.allowsNesting)for(let i=r;i;i=i.enter(t,n,Yi.ExcludeBuffers|Yi.EnterBracketed))i.type.isTop&&(r=i);return r}function va(e){let t=e.field(nd.state,!1);return t?t.tree:ia.empty}class pLe{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 s=this.cursorPos-this.string.length;return t<s||n>=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-s,n-s)}}let Yy=null;class t3{constructor(t,n,s=[],r,i,o,a,c){this.parser=t,this.state=n,this.fragments=s,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,s){return new t3(t,n,[],ia.empty,0,s,[],null)}startParse(){return this.parser.startParse(new pLe(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ia.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var s;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}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 r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(a0.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(s=this.parse.stoppedAt)!==null&&s!==void 0?s:this.state.doc.length,this.tree=r,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(a0.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Yy;Yy=this;try{return t()}finally{Yy=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=MH(t,n.from,n.to);return t}changes(t,n){let{fragments:s,tree:r,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let c=[];if(t.iterChangedRanges((u,d,h,m)=>c.push({fromA:u,toA:d,fromB:h,toB:m})),s=a0.applyChanges(s,c),r=ia.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),h=t.mapPos(u.to,-1);d<h&&a.push({from:d,to:h})}}}return new t3(this.parser,n,s,r,i,o,a,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 s=0;s<this.skipped.length;s++){let{from:r,to:i}=this.skipped[s];r<t.to&&i>t.from&&(this.fragments=MH(this.fragments,r,i),this.skipped.splice(s--,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 sLe{createParse(n,s,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let c=Yy;if(c){for(let u of r)c.tempSkipped.push(u);t&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,t]):t)}return this.parsedPos=o,new ia(Fc.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 Yy}}function MH(e,t,n){return a0.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class vb{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),s=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,s)||n.takeTree(),new vb(n)}static init(t){let n=Math.min(3e3,t.doc.length),s=t3.create(t.facet(Rm).parser,t,{from:0,to:n});return s.work(20,n)||s.takeTree(),new vb(s)}}nd.state=ca.define({create:vb.init,update(e,t){for(let n of t.effects)if(n.is(nd.setState))return n.value;return t.startState.facet(Rm)!=t.state.facet(Rm)?vb.init(t.state):e.apply(t)}});let oie=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(oie=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const e7=typeof navigator<"u"&&(!((Z8=navigator.scheduling)===null||Z8===void 0)&&Z8.isInputPending)?()=>navigator.scheduling.isInputPending():null,gLe=xi.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(nd.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(nd.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=oie(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:s,viewport:{to:r}}=this.view,i=s.field(nd.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!e7?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<r&&s.doc.length>r+1e3,c=i.context.work(()=>e7&&e7()||Date.now()>o,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:nd.setState.of(new vb(i.context))})),this.chunkBudget>0&&!(c&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>gl(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()}}}),Rm=dn.define({combine(e){return e.length?e[0]:null},enables:e=>[nd.state,gLe,Pt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),bLe=dn.define(),NR=dn.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 n3(e){let t=e.facet(NR);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Qx(e,t){let n="",s=e.tabSize,r=e.facet(NR)[0];if(r=="	"){for(;t>=s;)n+="	",t-=s;r=" "}for(let i=0;i<t;i++)n+=r;return n}function MR(e,t){e instanceof nr&&(e=new wT(e));for(let s of e.state.facet(bLe)){let r=s(e,t);if(r!==void 0)return r}let n=va(e.state);return n.length>=t?vLe(e,n,t):null}class wT{constructor(t,n={}){this.state=t,this.options=n,this.unit=n3(t)}lineAt(t,n=1){let s=this.state.doc.lineAt(t),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=s.from&&r<=s.to?i&&r==t?{text:"",from:t}:(n<0?r<t:r<=t)?{text:s.text.slice(r-s.from),from:r}:{text:s.text.slice(0,r-s.from),from:s.from}:s}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:s,from:r}=this.lineAt(t,n);return s.slice(t-r,Math.min(s.length,t+100-r))}column(t,n=1){let{text:s,from:r}=this.lineAt(t,n),i=this.countColumn(s,t-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(s,s.search(/\S|$/))),i}countColumn(t,n=t.length){return Qb(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:s,from:r}=this.lineAt(t,n),i=this.options.overrideIndentation;if(i){let o=i(r);if(o>-1)return o}return this.countColumn(s,s.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const yLe=new rr;function vLe(e,t,n){let s=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=s.node){let i=[];for(let o=r;o&&!(o.from<s.node.from||o.to>s.node.to||o.from==s.node.from&&o.type==s.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)s={node:i[o],next:s}}return aie(s,e,n)}function aie(e,t,n){for(let s=e;s;s=s.next){let r=wLe(s.node);if(r)return r(IR.create(t,n,s))}return 0}function xLe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function wLe(e){let t=e.type.prop(yLe);if(t)return t;let n=e.firstChild,s;if(n&&(s=n.type.prop(rr.closedBy))){let r=e.lastChild,i=r&&s.indexOf(r.name)>-1;return o=>CLe(o,!0,1,void 0,i&&!xLe(o)?r.from:void 0)}return e.parent==null?kLe:null}function kLe(){return 0}class IR extends wT{constructor(t,n,s){super(t.state,t.options),this.base=t,this.pos=n,this.context=s}get node(){return this.context.node}static create(t,n,s){return new IR(t,n,s)}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 s=t.resolve(n.from);for(;s.parent&&s.parent.from==s.from;)s=s.parent;if(_Le(s,t))break;n=this.state.doc.lineAt(s.from)}return this.lineIndent(n.from)}continue(){return aie(this.context.next,this.base,this.pos)}}function _Le(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function SLe(e){let t=e.node,n=t.childAfter(t.from),s=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=r==null||r<=i.from?i.to:Math.min(i.to,r);for(let a=n.to;;){let c=t.childAfter(a);if(!c||c==s)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}}a=c.to}}function CLe(e,t,n,s,r){let i=e.textAfter,o=i.match(/^\s*/)[0].length,a=s&&i.slice(o,o+s.length)==s||r==e.pos+o,c=SLe(e);return c?a?e.column(c.from):e.column(c.to):e.baseIndent+(a?0:e.unit*n)}const TLe=200;function ELe(){return nr.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:s}=e.newSelection.main,r=n.lineAt(s);if(s>r.from+TLe)return e;let i=n.sliceString(r.from,s);if(!t.some(u=>u.test(i)))return e;let{state:o}=e,a=-1,c=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==a)continue;a=d.from;let h=MR(o,d.from);if(h==null)continue;let m=/^\s*/.exec(d.text)[0],p=Qx(o,h);m!=p&&c.push({from:d.from,to:d.from+m.length,insert:p})}return c.length?[e,{changes:c,sequential:!0}]:e})}const ALe=dn.define(),jLe=new rr;function NLe(e,t,n){let s=va(e);if(s.length<n)return null;let r=s.resolveStack(n,1),i=null;for(let o=r;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(i&&a.from<t)break;let c=a.type.prop(jLe);if(c&&(a.to<s.length-50||s.length==e.doc.length||!MLe(a))){let u=c(a,e);u&&u.from<=n&&u.from>=t&&u.to>n&&(i=u)}}return i}function MLe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function s3(e,t,n){for(let s of e.facet(ALe)){let r=s(e,t,n);if(r)return r}return NLe(e,t,n)}function lie(e,t){let n=t.mapPos(e.from,1),s=t.mapPos(e.to,-1);return n>=s?void 0:{from:n,to:s}}const kT=_s.define({map:lie}),Kw=_s.define({map:lie});function cie(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(s=>s.from<=n&&s.to>=n)||t.push(e.lineBlockAt(n));return t}const T0=ca.define({create(){return Nn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((n,s)=>e=IH(e,n,s)),e=e.map(t.changes);for(let n of t.effects)if(n.is(kT)&&!ILe(e,n.value.from,n.value.to)){let{preparePlaceholder:s}=t.state.facet(hie),r=s?Nn.replace({widget:new BLe(s(t.state,n.value))}):RH;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(Kw)&&(e=e.update({filter:(s,r)=>n.value.from!=s||n.value.to!=r,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=IH(e,t.selection.main.head)),e},provide:e=>Pt.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(s,r)=>{n.push(s,r)}),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 s=e[n++],r=e[n++];if(typeof s!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");t.push(RH.range(s,r))}return Nn.set(t,!0)}});function IH(e,t,n=t){let s=!1;return e.between(t,n,(r,i)=>{r<n&&i>t&&(s=!0)}),s?e.update({filterFrom:t,filterTo:n,filter:(r,i)=>r>=n||i<=t}):e}function r3(e,t,n){var s;let r=null;return(s=e.field(T0,!1))===null||s===void 0||s.between(t,n,(i,o)=>{(!r||r.from>i)&&(r={from:i,to:o})}),r}function ILe(e,t,n){let s=!1;return e.between(t,t,(r,i)=>{r==t&&i==n&&(s=!0)}),s}function uie(e,t){return e.field(T0,!1)?t:t.concat(_s.appendConfig.of(fie()))}const RLe=e=>{for(let t of cie(e)){let n=s3(e.state,t.from,t.to);if(n)return e.dispatch({effects:uie(e.state,[kT.of(n),die(e,n)])}),!0}return!1},DLe=e=>{if(!e.state.field(T0,!1))return!1;let t=[];for(let n of cie(e)){let s=r3(e.state,n.from,n.to);s&&t.push(Kw.of(s),die(e,s,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function die(e,t,n=!0){let s=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return Pt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${s} ${e.state.phrase("to")} ${r}.`)}const LLe=e=>{let{state:t}=e,n=[];for(let s=0;s<t.doc.length;){let r=e.lineBlockAt(s),i=s3(t,r.from,r.to);i&&n.push(kT.of(i)),s=(i?e.lineBlockAt(i.to):r).to+1}return n.length&&e.dispatch({effects:uie(e.state,n)}),!!n.length},PLe=e=>{let t=e.state.field(T0,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(s,r)=>{n.push(Kw.of({from:s,to:r}))}),e.dispatch({effects:n}),!0},OLe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:RLe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:DLe},{key:"Ctrl-Alt-[",run:LLe},{key:"Ctrl-Alt-]",run:PLe}],$Le={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},hie=dn.define({combine(e){return Ed(e,$Le)}});function fie(e){return[T0,HLe]}function mie(e,t){let{state:n}=e,s=n.facet(hie),r=o=>{let a=e.lineBlockAt(e.posAtDOM(o.target)),c=r3(e.state,a.from,a.to);c&&e.dispatch({effects:Kw.of(c)}),o.preventDefault()};if(s.placeholderDOM)return s.placeholderDOM(e,r,t);let i=document.createElement("span");return i.textContent=s.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=r,i}const RH=Nn.replace({widget:new class extends dc{toDOM(e){return mie(e,null)}}});class BLe extends dc{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return mie(t,this.value)}}const zLe={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class t7 extends Fh{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 FLe(e={}){let t={...zLe,...e},n=new t7(t,!0),s=new t7(t,!1),r=xi.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Rm)!=o.state.facet(Rm)||o.startState.field(T0,!1)!=o.state.field(T0,!1)||va(o.startState)!=va(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new gd;for(let c of o.viewportLineBlocks){let u=r3(o.state,c.from,c.to)?s:s3(o.state,c.from,c.to)?n:null;u&&a.add(c.from,c.from,u)}return a.finish()}}),{domEventHandlers:i}=t;return[r,BDe({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(r))===null||a===void 0?void 0:a.markers)||Ks.empty},initialSpacer(){return new t7(t,!1)},domEventHandlers:{...i,click:(o,a,c)=>{if(i.click&&i.click(o,a,c))return!0;let u=r3(o.state,a.from,a.to);if(u)return o.dispatch({effects:Kw.of(u)}),!0;let d=s3(o.state,a.from,a.to);return d?(o.dispatch({effects:kT.of(d)}),!0):!1}}}),fie()]}const HLe=Pt.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 _T{constructor(t,n){this.specs=t;let s;function r(a){let c=Am.newName();return(s||(s=Object.create(null)))["."+c]=a,c}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof nd?a=>a.prop(kv)==o.data:o?a=>a==o:void 0,this.style=iie(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=s?new Am(s):null,this.themeType=n.themeType}static define(t,n){return new _T(t,n||{})}}const mN=dn.define(),pie=dn.define({combine(e){return e.length?[e[0]]:null}});function uS(e){let t=e.facet(mN);return t.length?t:e.facet(pie)}function gie(e,t){let n=[ULe],s;return e instanceof _T&&(e.module&&n.push(Pt.styleModule.of(e.module)),s=e.themeType),t!=null&&t.fallback?n.push(pie.of(e)):s?n.push(mN.computeN([Pt.darkTheme],r=>r.facet(Pt.darkTheme)==(s=="dark")?[e]:[])):n.push(mN.of(e)),n}function Y4t(e,t,n){let s=uS(e),r=null;if(s){for(let i of s)if(!i.scope||n){let o=i.style(t);o&&(r=r?r+" "+o:o)}}return r}class qLe{constructor(t){this.markCache=Object.create(null),this.tree=va(t.state),this.decorations=this.buildDeco(t,uS(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=va(t.state),s=uS(t.state),r=s!=uS(t.startState),{viewport:i}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!r&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(t.view,s),this.decoratedTo=i.to)}buildDeco(t,n){if(!n||!this.tree.length)return Nn.none;let s=new gd;for(let{from:r,to:i}of t.visibleRanges)dLe(this.tree,n,(o,a,c)=>{s.add(o,a,this.markCache[c]||(this.markCache[c]=Nn.mark({class:c})))},r,i);return s.finish()}}const ULe=Jm.high(xi.fromClass(qLe,{decorations:e=>e.decorations})),bie=_T.define([{tag:rn.meta,color:"#404740"},{tag:rn.link,textDecoration:"underline"},{tag:rn.heading,textDecoration:"underline",fontWeight:"bold"},{tag:rn.emphasis,fontStyle:"italic"},{tag:rn.strong,fontWeight:"bold"},{tag:rn.strikethrough,textDecoration:"line-through"},{tag:rn.keyword,color:"#708"},{tag:[rn.atom,rn.bool,rn.url,rn.contentSeparator,rn.labelName],color:"#219"},{tag:[rn.literal,rn.inserted],color:"#164"},{tag:[rn.string,rn.deleted],color:"#a11"},{tag:[rn.regexp,rn.escape,rn.special(rn.string)],color:"#e40"},{tag:rn.definition(rn.variableName),color:"#00f"},{tag:rn.local(rn.variableName),color:"#30a"},{tag:[rn.typeName,rn.namespace],color:"#085"},{tag:rn.className,color:"#167"},{tag:[rn.special(rn.variableName),rn.macroName],color:"#256"},{tag:rn.definition(rn.propertyName),color:"#00c"},{tag:rn.comment,color:"#940"},{tag:rn.invalid,color:"#f00"}]),WLe=Pt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),yie=1e4,vie="()[]{}",xie=dn.define({combine(e){return Ed(e,{afterCursor:!0,brackets:vie,maxScanDistance:yie,renderMatch:KLe})}}),VLe=Nn.mark({class:"cm-matchingBracket"}),GLe=Nn.mark({class:"cm-nonmatchingBracket"});function KLe(e){let t=[],n=e.matched?VLe:GLe;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 DH(e){let t=[],n=e.facet(xie);for(let s of e.selection.ranges){if(!s.empty)continue;let r=sd(e,s.head,-1,n)||s.head>0&&sd(e,s.head-1,1,n)||n.afterCursor&&(sd(e,s.head,1,n)||s.head<e.doc.length&&sd(e,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return Nn.set(t,!0)}const YLe=xi.fromClass(class{constructor(e){this.paused=!1,this.decorations=DH(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=DH(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),XLe=[YLe,WLe];function QLe(e={}){return[xie.of(e),XLe]}const JLe=new rr;function pN(e,t,n){let s=e.prop(t<0?rr.openedBy:rr.closedBy);if(s)return s;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function gN(e){let t=e.type.prop(JLe);return t?t(e.node):e}function sd(e,t,n,s={}){let r=s.maxScanDistance||yie,i=s.brackets||vie,o=va(e),a=o.resolveInner(t,n);for(let c=a;c;c=c.parent){let u=pN(c.type,n,i);if(u&&c.from<c.to){let d=gN(c);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return ZLe(e,t,n,c,d,u,i)}}return ePe(e,t,n,o,a.type,r,i)}function ZLe(e,t,n,s,r,i,o){let a=s.parent,c={from:r.from,to:r.to},u=0,d=a==null?void 0:a.cursor();if(d&&(n<0?d.childBefore(s.from):d.childAfter(s.to)))do if(n<0?d.to<=s.from:d.from>=s.to){if(u==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let h=gN(d);return{start:c,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(pN(d.type,n,o))u++;else if(pN(d.type,-n,o)){if(u==0){let h=gN(d);return{start:c,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}u--}}while(n<0?d.prevSibling():d.nextSibling());return{start:c,matched:!1}}function ePe(e,t,n,s,r,i,o){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(a);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),h=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,x=n>0?p.length:-1;b!=x;b+=n){let y=o.indexOf(p[b]);if(!(y<0||s.resolveInner(g+b,1).type!=r))if(y%2==0==n>0)h++;else{if(h==1)return{start:u,end:{from:g+b,to:g+b+1},matched:y>>1==c>>1};h--}}n>0&&(m+=p.length)}return d.done?{start:u,matched:!1}:null}const tPe=Object.create(null),LH=[Fc.none],PH=[],OH=Object.create(null),nPe=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"]])nPe[e]=sPe(tPe,t);function n7(e,t){PH.indexOf(e)>-1||(PH.push(e),console.warn(t))}function sPe(e,t){let n=[];for(let a of t.split(" ")){let c=[];for(let u of a.split(".")){let d=e[u]||rn[u];d?typeof d=="function"?c.length?c=c.map(d):n7(u,`Modifier ${u} used at start of tag`):c.length?n7(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:n7(u,`Unknown highlighting tag ${u}`)}for(let u of c)n.push(u)}if(!n.length)return 0;let s=t.replace(/ /g,"_"),r=s+" "+n.map(a=>a.id),i=OH[r];if(i)return i.id;let o=OH[r]=Fc.define({id:LH.length,name:s,props:[cLe({[s]:n})]});return LH.push(o),o.id}Kr.RTL,Kr.LTR;const rPe=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),s=DR(e.state,n.from);return s.line?iPe(e):s.block?aPe(e):!1};function RR(e,t){return({state:n,dispatch:s})=>{if(n.readOnly)return!1;let r=e(t,n);return r?(s(n.update(r)),!0):!1}}const iPe=RR(uPe,0),oPe=RR(wie,0),aPe=RR((e,t)=>wie(e,t,cPe(t)),0);function DR(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Xy=50;function lPe(e,{open:t,close:n},s,r){let i=e.sliceDoc(s-Xy,s),o=e.sliceDoc(r,r+Xy),a=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(o)[0].length,u=i.length-a;if(i.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:s-a,margin:a&&1},close:{pos:r+c,margin:c&&1}};let d,h;r-s<=2*Xy?d=h=e.sliceDoc(s,r):(d=e.sliceDoc(s,s+Xy),h=e.sliceDoc(r-Xy,r));let m=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(h)[0].length,g=h.length-p-n.length;return d.slice(m,m+t.length)==t&&h.slice(g,g+n.length)==n?{open:{pos:s+m+t.length,margin:/\s/.test(d.charAt(m+t.length))?1:0},close:{pos:r-p-n.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function cPe(e){let t=[];for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),r=n.to<=s.to?s:e.doc.lineAt(n.to);r.from>s.from&&r.from==n.to&&(r=n.to==s.to+1?s:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>s.from?t[i].to=r.to:t.push({from:s.from+/^\s*/.exec(s.text)[0].length,to:r.to})}return t}function wie(e,t,n=t.selection.ranges){let s=n.map(i=>DR(t,i.from).block);if(!s.every(i=>i))return null;let r=n.map((i,o)=>lPe(t,s[o],i.from,i.to));if(e!=2&&!r.every(i=>i))return{changes:t.changes(n.map((i,o)=>r[o]?[]:[{from:i.from,insert:s[o].open+" "},{from:i.to,insert:" "+s[o].close}]))};if(e!=1&&r.some(i=>i)){let i=[];for(let o=0,a;o<r.length;o++)if(a=r[o]){let c=s[o],{open:u,close:d}=a;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 uPe(e,t,n=t.selection.ranges){let s=[],r=-1;e:for(let{from:i,to:o}of n){let a=s.length,c=1e9,u;for(let d=i;d<=o;){let h=t.doc.lineAt(d);if(u==null&&(u=DR(t,h.from).line,!u))continue e;if(h.from>r&&(i==o||o>h.from)){r=h.from;let m=/^\s*/.exec(h.text)[0].length,p=m==h.length,g=h.text.slice(m,m+u.length)==u?m:-1;m<h.text.length&&m<c&&(c=m),s.push({line:h,comment:g,token:u,indent:m,empty:p,single:!1})}d=h.to+1}if(c<1e9)for(let d=a;d<s.length;d++)s[d].indent<s[d].line.text.length&&(s[d].indent=c);s.length==a+1&&(s[a].single=!0)}if(e!=2&&s.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:c,indent:u,empty:d,single:h}of s)(h||!d)&&i.push({from:a.from+u,insert:c+" "});let o=t.changes(i);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&s.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:c}of s)if(a>=0){let u=o.from+a,d=u+c.length;o.text[d-o.from]==" "&&d++,i.push({from:u,to:d})}return{changes:i}}return null}const bN=Xh.define(),dPe=Xh.define(),hPe=dn.define(),kie=dn.define({combine(e){return Ed(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(s,r)=>t(s,r)||n(s,r)})}}),_ie=ca.define({create(){return rd.empty},update(e,t){let n=t.state.facet(kie),s=t.annotation(bN);if(s){let c=bl.fromTransaction(t,s.selection),u=s.side,d=u==0?e.undone:e.done;return c?d=i3(d,d.length,n.minDepth,c):d=Tie(d,t.startState.selection),new rd(u==0?s.rest:d,u==0?d:s.rest)}let r=t.annotation(dPe);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(To.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=bl.fromTransaction(t),o=t.annotation(To.time),a=t.annotation(To.userEvent);return i?e=e.addChanges(i,o,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,a,n.newGroupDelay)),(r=="full"||r=="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 rd(e.done.map(bl.fromJSON),e.undone.map(bl.fromJSON))}});function LR(e={}){return[_ie,kie.of(e),Pt.domEventHandlers({beforeinput(t,n){let s=t.inputType=="historyUndo"?Sie:t.inputType=="historyRedo"?yN:null;return s?(t.preventDefault(),s(n)):!1}})]}function ST(e,t){return function({state:n,dispatch:s}){if(!t&&n.readOnly)return!1;let r=n.field(_ie,!1);if(!r)return!1;let i=r.pop(e,n,t);return i?(s(i),!0):!1}}const Sie=ST(0,!1),yN=ST(1,!1),fPe=ST(0,!0),mPe=ST(1,!0);class bl{constructor(t,n,s,r,i){this.changes=t,this.effects=n,this.mapped=s,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new bl(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,s;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:(s=this.startSelection)===null||s===void 0?void 0:s.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new bl(t.changes&&_o.fromJSON(t.changes),[],t.mapped&&ld.fromJSON(t.mapped),t.startSelection&&nt.fromJSON(t.startSelection),t.selectionsAfter.map(nt.fromJSON))}static fromTransaction(t,n){let s=Dc;for(let r of t.startState.facet(hPe)){let i=r(t);i.length&&(s=s.concat(i))}return!s.length&&t.changes.empty?null:new bl(t.changes.invert(t.startState.doc),s,void 0,n||t.startState.selection,Dc)}static selection(t){return new bl(void 0,Dc,void 0,void 0,t)}}function i3(e,t,n,s){let r=t+1>n+20?t-n-1:0,i=e.slice(r,t);return i.push(s),i}function pPe(e,t){let n=[],s=!1;return e.iterChangedRanges((r,i)=>n.push(r,i)),t.iterChangedRanges((r,i,o,a)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];a>=u&&o<=d&&(s=!0)}}),s}function gPe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,s)=>n.empty!=t.ranges[s].empty).length===0}function Cie(e,t){return e.length?t.length?e.concat(t):e:t}const Dc=[],bPe=200;function Tie(e,t){if(e.length){let n=e[e.length-1],s=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-bPe));return s.length&&s[s.length-1].eq(t)?e:(s.push(t),i3(e,e.length-1,1e9,n.setSelAfter(s)))}else return[bl.selection([t])]}function yPe(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 s7(e,t){if(!e.length)return e;let n=e.length,s=Dc;for(;n;){let r=vPe(e[n-1],t,s);if(r.changes&&!r.changes.empty||r.effects.length){let i=e.slice(0,n);return i[n-1]=r,i}else t=r.mapped,n--,s=r.selectionsAfter}return s.length?[bl.selection(s)]:Dc}function vPe(e,t,n){let s=Cie(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):Dc,n);if(!e.changes)return bl.selection(s);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new bl(r,_s.mapEffects(e.effects,t),o,e.startSelection.map(i),s)}const xPe=/^(input\.type|delete)($|\.)/;class rd{constructor(t,n,s=0,r=void 0){this.done=t,this.undone=n,this.prevTime=s,this.prevUserEvent=r}isolate(){return this.prevTime?new rd(this.done,this.undone):this}addChanges(t,n,s,r,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!s||xPe.test(s))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,pPe(a.changes,t.changes))||s=="input.type.compose")?o=i3(o,o.length-1,r.minDepth,new bl(t.changes.compose(a.changes),Cie(_s.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,Dc)):o=i3(o,o.length,r.minDepth,t),new rd(o,Dc,n,s)}addSelection(t,n,s,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Dc;return i.length>0&&n-this.prevTime<r&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&gPe(i[i.length-1],t)?this:new rd(Tie(this.done,t),this.undone,n,s)}addMapping(t){return new rd(s7(this.done,t),s7(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,s){let r=t==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(s&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:bN.of({side:t,rest:yPe(r),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=r.length==1?Dc:r.slice(0,r.length-1);return i.mapped&&(a=s7(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:bN.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}rd.empty=new rd(Dc,Dc);const PR=[{key:"Mod-z",run:Sie,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:yN,preventDefault:!0},{linux:"Ctrl-Shift-z",run:yN,preventDefault:!0},{key:"Mod-u",run:fPe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:mPe,preventDefault:!0}];function Jb(e,t){return nt.create(e.ranges.map(t),e.mainIndex)}function gu(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function bu({state:e,dispatch:t},n){let s=Jb(e.selection,n);return s.eq(e.selection,!0)?!1:(t(gu(e,s)),!0)}function CT(e,t){return nt.cursor(t?e.to:e.from)}function Eie(e,t){return bu(e,n=>n.empty?e.moveByChar(n,t):CT(n,t))}function Ca(e){return e.textDirectionAt(e.state.selection.main.head)==Kr.LTR}const Aie=e=>Eie(e,!Ca(e)),jie=e=>Eie(e,Ca(e));function Nie(e,t){return bu(e,n=>n.empty?e.moveByGroup(n,t):CT(n,t))}const wPe=e=>Nie(e,!Ca(e)),kPe=e=>Nie(e,Ca(e));function _Pe(e,t,n){if(t.type.prop(n))return!0;let s=t.to-t.from;return s&&(s>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function TT(e,t,n){let s=va(e).resolveInner(t.head),r=n?rr.closedBy:rr.openedBy;for(let c=t.head;;){let u=n?s.childAfter(c):s.childBefore(c);if(!u)break;_Pe(e,u,r)?s=u:c=n?u.to:u.from}let i=s.type.prop(r),o,a;return i&&(o=n?sd(e,s.from,1):sd(e,s.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?s.to:s.from,nt.cursor(a,n?-1:1)}const SPe=e=>bu(e,t=>TT(e.state,t,!Ca(e))),CPe=e=>bu(e,t=>TT(e.state,t,Ca(e)));function Mie(e,t){return bu(e,n=>{if(!n.empty)return CT(n,t);let s=e.moveVertically(n,t);return s.head!=n.head?s:e.moveToLineBoundary(n,t)})}const Iie=e=>Mie(e,!1),Rie=e=>Mie(e,!0);function Die(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,s=0,r;if(t){for(let i of e.state.facet(Pt.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(s=Math.max(o==null?void 0:o.bottom,s))}r=e.scrollDOM.clientHeight-n-s}else r=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:s,selfScroll:t,height:Math.max(e.defaultLineHeight,r-5)}}function Lie(e,t){let n=Die(e),{state:s}=e,r=Jb(s.selection,o=>o.empty?e.moveVertically(o,t,n.height):CT(o,t));if(r.eq(s.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(s.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),c=a.top+n.marginTop,u=a.bottom-n.marginBottom;o&&o.top>c&&o.bottom<u&&(i=Pt.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-c}))}return e.dispatch(gu(s,r),{effects:i}),!0}const $H=e=>Lie(e,!1),vN=e=>Lie(e,!0);function Zm(e,t,n){let s=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?s.to:s.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==s.from&&s.length){let i=/^\s*/.exec(e.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;i&&t.head!=s.from+i&&(r=nt.cursor(s.from+i))}return r}const TPe=e=>bu(e,t=>Zm(e,t,!0)),EPe=e=>bu(e,t=>Zm(e,t,!1)),APe=e=>bu(e,t=>Zm(e,t,!Ca(e))),jPe=e=>bu(e,t=>Zm(e,t,Ca(e))),NPe=e=>bu(e,t=>nt.cursor(e.lineBlockAt(t.head).from,1)),MPe=e=>bu(e,t=>nt.cursor(e.lineBlockAt(t.head).to,-1));function IPe(e,t,n){let s=!1,r=Jb(e.selection,i=>{let o=sd(e,i.head,-1)||sd(e,i.head,1)||i.head>0&&sd(e,i.head-1,1)||i.head<e.doc.length&&sd(e,i.head+1,-1);if(!o||!o.end)return i;s=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return nt.cursor(a)});return s?(t(gu(e,r)),!0):!1}const RPe=({state:e,dispatch:t})=>IPe(e,t);function qc(e,t){let n=Jb(e.state.selection,s=>{let r=t(s);return nt.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(gu(e.state,n)),!0)}function Pie(e,t){return qc(e,n=>e.moveByChar(n,t))}const Oie=e=>Pie(e,!Ca(e)),$ie=e=>Pie(e,Ca(e));function Bie(e,t){return qc(e,n=>e.moveByGroup(n,t))}const DPe=e=>Bie(e,!Ca(e)),LPe=e=>Bie(e,Ca(e)),PPe=e=>qc(e,t=>TT(e.state,t,!Ca(e))),OPe=e=>qc(e,t=>TT(e.state,t,Ca(e)));function zie(e,t){return qc(e,n=>e.moveVertically(n,t))}const Fie=e=>zie(e,!1),Hie=e=>zie(e,!0);function qie(e,t){return qc(e,n=>e.moveVertically(n,t,Die(e).height))}const BH=e=>qie(e,!1),zH=e=>qie(e,!0),$Pe=e=>qc(e,t=>Zm(e,t,!0)),BPe=e=>qc(e,t=>Zm(e,t,!1)),zPe=e=>qc(e,t=>Zm(e,t,!Ca(e))),FPe=e=>qc(e,t=>Zm(e,t,Ca(e))),HPe=e=>qc(e,t=>nt.cursor(e.lineBlockAt(t.head).from)),qPe=e=>qc(e,t=>nt.cursor(e.lineBlockAt(t.head).to)),FH=({state:e,dispatch:t})=>(t(gu(e,{anchor:0})),!0),HH=({state:e,dispatch:t})=>(t(gu(e,{anchor:e.doc.length})),!0),qH=({state:e,dispatch:t})=>(t(gu(e,{anchor:e.selection.main.anchor,head:0})),!0),UH=({state:e,dispatch:t})=>(t(gu(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),UPe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),WPe=({state:e,dispatch:t})=>{let n=ET(e).map(({from:s,to:r})=>nt.range(s,Math.min(r+1,e.doc.length)));return t(e.update({selection:nt.create(n),userEvent:"select"})),!0},VPe=({state:e,dispatch:t})=>{let n=Jb(e.selection,s=>{let r=va(e),i=r.resolveStack(s.from,1);if(s.empty){let o=r.resolveStack(s.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:a}=o;if((a.from<s.from&&a.to>=s.to||a.to>s.to&&a.from<=s.from)&&o.next)return nt.range(a.to,a.from)}return s});return n.eq(e.selection)?!1:(t(gu(e,n)),!0)};function Uie(e,t){let{state:n}=e,s=n.selection,r=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 a=i;;){let c=e.moveVertically(a,t);if(c.head<o.from||c.head>o.to){r.some(u=>u.head==c.head)||r.push(c);break}else{if(c.head==a.head)break;a=c}}}return r.length==s.ranges.length?!1:(e.dispatch(gu(n,nt.create(r,r.length-1))),!0)}const GPe=e=>Uie(e,!1),KPe=e=>Uie(e,!0),YPe=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=nt.create([n.main]):n.main.empty||(s=nt.create([nt.cursor(n.main.head)])),s?(t(gu(e,s)),!0):!1};function Yw(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:s}=e,r=s.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let c=t(i);c<o?(n="delete.backward",c=e2(e,c,!1)):c>o&&(n="delete.forward",c=e2(e,c,!0)),o=Math.min(o,c),a=Math.max(a,c)}else o=e2(e,o,!1),a=e2(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:nt.cursor(o,o<i.head?-1:1)}});return r.changes.empty?!1:(e.dispatch(s.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Pt.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function e2(e,t,n){if(e instanceof Pt)for(let s of e.state.facet(Pt.atomicRanges).map(r=>r(e)))s.between(t,t,(r,i)=>{r<t&&i>t&&(t=n?i:r)});return t}const Wie=(e,t,n)=>Yw(e,s=>{let r=s.from,{state:i}=e,o=i.doc.lineAt(r),a,c;if(n&&!t&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,r-o.from))){if(a[a.length-1]=="	")return r-1;let u=Qb(a,i.tabSize),d=u%n3(i)||n3(i);for(let h=0;h<d&&a[a.length-1-h]==" ";h++)r--;c=r}else c=qo(o.text,r-o.from,t,t)+o.from,c==r&&o.number!=(t?i.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,r-o.from))&&(c=qo(o.text,c-o.from,!1,!1)+o.from);return c}),xN=e=>Wie(e,!1,!0),Vie=e=>Wie(e,!0,!1),Gie=(e,t)=>Yw(e,n=>{let s=n.head,{state:r}=e,i=r.doc.lineAt(s),o=r.charCategorizer(s);for(let a=null;;){if(s==(t?i.to:i.from)){s==n.head&&i.number!=(t?r.doc.lines:1)&&(s+=t?1:-1);break}let c=qo(i.text,s-i.from,t)+i.from,u=i.text.slice(Math.min(s,c)-i.from,Math.max(s,c)-i.from),d=o(u);if(a!=null&&d!=a)break;(u!=" "||s!=n.head)&&(a=d),s=c}return s}),Kie=e=>Gie(e,!1),XPe=e=>Gie(e,!0),QPe=e=>Yw(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),JPe=e=>Yw(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),ZPe=e=>Yw(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),eOe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:fr.of(["",""])},range:nt.cursor(s.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},tOe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>{if(!s.empty||s.from==0||s.from==e.doc.length)return{range:s};let r=s.from,i=e.doc.lineAt(r),o=r==i.from?r-1:qo(i.text,r-i.from,!1)+i.from,a=r==i.to?r+1:qo(i.text,r-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:e.doc.slice(r,a).append(e.doc.slice(o,r))},range:nt.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ET(e){let t=[],n=-1;for(let s of e.selection.ranges){let r=e.doc.lineAt(s.from),i=e.doc.lineAt(s.to);if(!s.empty&&s.to==i.from&&(i=e.doc.lineAt(s.to-1)),n>=r.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(s)}else t.push({from:r.from,to:i.to,ranges:[s]});n=i.number+1}return t}function Yie(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let i of ET(e)){if(n?i.to==e.doc.length:i.from==0)continue;let o=e.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){s.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let c of i.ranges)r.push(nt.range(Math.min(e.doc.length,c.anchor+a),Math.min(e.doc.length,c.head+a)))}else{s.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let c of i.ranges)r.push(nt.range(c.anchor-a,c.head-a))}}return s.length?(t(e.update({changes:s,scrollIntoView:!0,selection:nt.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const nOe=({state:e,dispatch:t})=>Yie(e,t,!1),sOe=({state:e,dispatch:t})=>Yie(e,t,!0);function Xie(e,t,n){if(e.readOnly)return!1;let s=[];for(let i of ET(e))n?s.push({from:i.from,insert:e.doc.slice(i.from,i.to)+e.lineBreak}):s.push({from:i.to,insert:e.lineBreak+e.doc.slice(i.from,i.to)});let r=e.changes(s);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const rOe=({state:e,dispatch:t})=>Xie(e,t,!1),iOe=({state:e,dispatch:t})=>Xie(e,t,!0),oOe=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(ET(t).map(({from:r,to:i})=>(r>0?r--:i<t.doc.length&&i++,{from:r,to:i}))),s=Jb(t.selection,r=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(r.head),a=e.coordsAtPos(r.head,r.assoc||1);a&&(i=o.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(r,!0,i)}).map(n);return e.dispatch({changes:n,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0};function aOe(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=va(e).resolveInner(t),s=n.childBefore(t),r=n.childAfter(t),i;return s&&r&&s.to<=t&&r.from>=t&&(i=s.type.prop(rr.closedBy))&&i.indexOf(r.name)>-1&&e.doc.lineAt(s.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}const WH=Qie(!1),lOe=Qie(!0);function Qie(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=t.changeByRange(r=>{let{from:i,to:o}=r,a=t.doc.lineAt(i),c=!e&&i==o&&aOe(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let u=new wT(t,{simulateBreak:i,simulateDoubleBreak:!!c}),d=MR(u,i);for(d==null&&(d=Qb(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;c?{from:i,to:o}=c:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",Qx(t,d)];return c&&h.push(Qx(t,u.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:fr.of(h)},range:nt.cursor(i+1+h[1].length)}});return n(t.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function OR(e,t){let n=-1;return e.changeByRange(s=>{let r=[];for(let o=s.from;o<=s.to;){let a=e.doc.lineAt(o);a.number>n&&(s.empty||s.to>a.from)&&(t(a,r,s),n=a.number),o=a.to+1}let i=e.changes(r);return{changes:r,range:nt.range(i.mapPos(s.anchor,1),i.mapPos(s.head,1))}})}const cOe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),s=new wT(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=OR(e,(i,o,a)=>{let c=MR(s,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let u=/^\s*/.exec(i.text)[0],d=Qx(e,c);(u!=d||a.from<i.from+u.length)&&(n[i.from]=c,o.push({from:i.from,to:i.from+u.length,insert:d}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0},uOe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(OR(e,(n,s)=>{s.push({from:n.from,insert:e.facet(NR)})}),{userEvent:"input.indent"})),!0),dOe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(OR(e,(n,s)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=Qb(r,e.tabSize),o=0,a=Qx(e,Math.max(0,i-n3(e)));for(;o<r.length&&o<a.length&&r.charCodeAt(o)==a.charCodeAt(o);)o++;s.push({from:n.from+o,to:n.from+r.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),hOe=e=>(e.setTabFocusMode(),!0),fOe=[{key:"Ctrl-b",run:Aie,shift:Oie,preventDefault:!0},{key:"Ctrl-f",run:jie,shift:$ie},{key:"Ctrl-p",run:Iie,shift:Fie},{key:"Ctrl-n",run:Rie,shift:Hie},{key:"Ctrl-a",run:NPe,shift:HPe},{key:"Ctrl-e",run:MPe,shift:qPe},{key:"Ctrl-d",run:Vie},{key:"Ctrl-h",run:xN},{key:"Ctrl-k",run:QPe},{key:"Ctrl-Alt-h",run:Kie},{key:"Ctrl-o",run:eOe},{key:"Ctrl-t",run:tOe},{key:"Ctrl-v",run:vN}],mOe=[{key:"ArrowLeft",run:Aie,shift:Oie,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:wPe,shift:DPe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:APe,shift:zPe,preventDefault:!0},{key:"ArrowRight",run:jie,shift:$ie,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:kPe,shift:LPe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:jPe,shift:FPe,preventDefault:!0},{key:"ArrowUp",run:Iie,shift:Fie,preventDefault:!0},{mac:"Cmd-ArrowUp",run:FH,shift:qH},{mac:"Ctrl-ArrowUp",run:$H,shift:BH},{key:"ArrowDown",run:Rie,shift:Hie,preventDefault:!0},{mac:"Cmd-ArrowDown",run:HH,shift:UH},{mac:"Ctrl-ArrowDown",run:vN,shift:zH},{key:"PageUp",run:$H,shift:BH},{key:"PageDown",run:vN,shift:zH},{key:"Home",run:EPe,shift:BPe,preventDefault:!0},{key:"Mod-Home",run:FH,shift:qH},{key:"End",run:TPe,shift:$Pe,preventDefault:!0},{key:"Mod-End",run:HH,shift:UH},{key:"Enter",run:WH,shift:WH},{key:"Mod-a",run:UPe},{key:"Backspace",run:xN,shift:xN,preventDefault:!0},{key:"Delete",run:Vie,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kie,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:XPe,preventDefault:!0},{mac:"Mod-Backspace",run:JPe,preventDefault:!0},{mac:"Mod-Delete",run:ZPe,preventDefault:!0}].concat(fOe.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),$R=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:SPe,shift:PPe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:CPe,shift:OPe},{key:"Alt-ArrowUp",run:nOe},{key:"Shift-Alt-ArrowUp",run:rOe},{key:"Alt-ArrowDown",run:sOe},{key:"Shift-Alt-ArrowDown",run:iOe},{key:"Mod-Alt-ArrowUp",run:GPe},{key:"Mod-Alt-ArrowDown",run:KPe},{key:"Escape",run:YPe},{key:"Mod-Enter",run:lOe},{key:"Alt-l",mac:"Ctrl-l",run:WPe},{key:"Mod-i",run:VPe,preventDefault:!0},{key:"Mod-[",run:dOe},{key:"Mod-]",run:uOe},{key:"Mod-Alt-\\",run:cOe},{key:"Shift-Mod-k",run:oOe},{key:"Shift-Mod-\\",run:RPe},{key:"Mod-/",run:rPe},{key:"Alt-A",run:oPe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:hOe}].concat(mOe);class Jie{constructor(t,n,s,r){this.state=t,this.pos=n,this.explicit=s,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=va(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),s=Math.max(n.from,this.pos-250),r=n.text.slice(s-n.from,this.pos-n.from),i=r.search(Zie(t,!1));return i<0?null:{from:s+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,s){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),s&&s.onDocChange&&(this.abortOnDocChange=!0))}}function VH(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 pOe(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let i=1;i<r.length;i++)n[r[i]]=!0}let s=VH(t)+VH(n)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function gOe(e){let t=e.map(r=>typeof r=="string"?{label:r}:r),[n,s]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:pOe(t);return r=>{let i=r.matchBefore(s);return i||r.explicit?{from:i?i.from:r.pos,options:t,validFor:n}:null}}class GH{constructor(t,n,s,r){this.completion=t,this.source=n,this.match=s,this.score=r}}function l0(e){return e.selection.main.from}function Zie(e,t){var n;let{source:s}=e,r=t&&s[0]!="^",i=s[s.length-1]!="$";return!r&&!i?e:new RegExp(`${r?"^":""}(?:${s})${i?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const eoe=Xh.define();function bOe(e,t,n,s){let{main:r}=e.selection,i=n-r.from,o=s-r.from;return{...e.changeByRange(a=>{if(a!=r&&n!=s&&e.sliceDoc(a.from+i,a.from+o)!=e.sliceDoc(n,s))return{range:a};let c=e.toText(t);return{changes:{from:a.from+i,to:s==r.from?a.to:a.from+o,insert:c},range:nt.cursor(a.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const KH=new WeakMap;function yOe(e){if(!Array.isArray(e))return e;let t=KH.get(e);return t||KH.set(e,t=gOe(e)),t}const o3=_s.define(),Jx=_s.define();class vOe{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 s=hl(t,n),r=Ku(s);this.chars.push(s);let i=t.slice(n,n+r),o=i.toUpperCase();this.folded.push(hl(o==i?i.toLowerCase():o,0)),n+=r}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:s,any:r,precise:i,byWord:o}=this;if(n.length==1){let v=hl(t,0),w=Ku(v),k=w==t.length?0:-100;if(v!=n[0])if(v==s[0])k+=-200;else return null;return this.ret(k,[0,w])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,u=0;if(a<0){for(let v=0,w=Math.min(t.length,200);v<w&&u<c;){let k=hl(t,v);(k==n[u]||k==s[u])&&(r[u++]=v),v+=Ku(k)}if(u<c)return null}let d=0,h=0,m=!1,p=0,g=-1,b=-1,x=/[a-z]/.test(t),y=!0;for(let v=0,w=Math.min(t.length,200),k=0;v<w&&h<c;){let T=hl(t,v);a<0&&(d<c&&T==n[d]&&(i[d++]=v),p<c&&(T==n[p]||T==s[p]?(p==0&&(g=v),b=v+1,p++):p=0));let C,_=T<255?T>=48&&T<=57||T>=97&&T<=122?2:T>=65&&T<=90?1:0:(C=lR(T))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!v||_==1&&x||k==0&&_!=0)&&(n[h]==T||s[h]==T&&(m=!0)?o[h++]=v:o.length&&(y=!1)),k=_,v+=Ku(T)}return h==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]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):p==c?this.ret(-900-t.length,[g,b]):h==c?this.result(-100+(m?-200:0)+-700+(y?0:-1100),o,t):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,t)}result(t,n,s){let r=[],i=0;for(let o of n){let a=o+(this.astral?Ku(hl(s,o)):1);i&&r[i-1]==o?r[i-1]=a:(r[i++]=o,r[i++]=a)}return this.ret(t-s.length,r)}}class xOe{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),s=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return s==null?null:(this.matched=[0,n.length],this.score=s+(t.length==this.pattern.length?0:-100),this)}}const Ho=dn.define({combine(e){return Ed(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:wOe,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)=>s=>YH(t(s),n(s)),optionClass:(t,n)=>s=>YH(t(s),n(s)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function YH(e,t){return e?t?e+" "+t:e:t}function wOe(e,t,n,s,r,i){let o=e.textDirection==Kr.RTL,a=o,c=!1,u="top",d,h,m=t.left-r.left,p=r.right-t.right,g=s.right-s.left,b=s.bottom-s.top;if(a&&m<Math.min(g,p)?a=!1:!a&&p<Math.min(g,m)&&(a=!0),g<=(a?m:p))d=Math.max(r.top,Math.min(n.top,r.bottom-b))-t.top,h=Math.min(400,a?m:p);else{c=!0,h=Math.min(400,(o?t.right:r.right-t.left)-30);let v=r.bottom-t.bottom;v>=b||v>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let x=(t.bottom-t.top)/i.offsetHeight,y=(t.right-t.left)/i.offsetWidth;return{style:`${u}: ${d/x}px; max-width: ${h/y}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":a?"left":"right")}}const BR=_s.define();function kOe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let s=document.createElement("div");return s.classList.add("cm-completionIcon"),n.type&&s.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),s.setAttribute("aria-hidden","true"),s},position:20}),t.push({render(n,s,r,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,c=0;for(let u=0;u<i.length;){let d=i[u++],h=i[u++];d>c&&o.appendChild(document.createTextNode(a.slice(c,d)));let m=o.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(a.slice(d,h))),m.className="cm-completionMatchedText",c=h}return c<a.length&&o.appendChild(document.createTextNode(a.slice(c))),o},position:50},{render(n){if(!n.detail)return null;let s=document.createElement("span");return s.className="cm-completionDetail",s.textContent=n.detail,s},position:80}),t.sort((n,s)=>n.position-s.position).map(n=>n.render)}function r7(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let s=Math.ceil((e-t)/n);return{from:e-s*n,to:e-(s-1)*n}}class _Oe{constructor(t,n,s){this.view=t,this.stateField=n,this.applyCompletion=s,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let r=t.state.field(n),{options:i,selected:o}=r.open,a=t.state.facet(Ho);this.optionContent=kOe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=r7(i.length,o,a.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,h;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(h=/-(\d+)$/.exec(d.id))&&+h[1]<u.length){this.applyCompletion(t,u[+h[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:BR.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Ho).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:Jx.of(null)})}),this.showOptions(i,r.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 s=t.state.field(this.stateField),r=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),s!=r){let{options:i,selected:o,disabled:a}=s.open;(!r.open||r.open.options!=i)&&(this.range=r7(i.length,o,t.state.facet(Ho).maxRenderedOptions),this.showOptions(i,s.id)),this.updateSel(),a!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let s of this.currentClass.split(" "))s&&this.dom.classList.remove(s);for(let s of n.split(" "))s&&this.dom.classList.add(s);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=r7(n.options.length,n.selected,this.view.state.facet(Ho).maxRenderedOptions),this.showOptions(n.options,t.id));let s=this.updateSelectedOption(n.selected);if(s){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,r)}).catch(a=>gl(this.view.state,a,"completion info")):(this.addInfoPane(o,r),s.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let s=this.info=document.createElement("div");if(s.className="cm-tooltip cm-completionInfo",s.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)s.appendChild(t),this.infoDestroy=null;else{let{dom:r,destroy:i}=t;s.appendChild(r),this.infoDestroy=i||null}this.dom.appendChild(s),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let s=this.list.firstChild,r=this.range.from;s;s=s.nextSibling,r++)s.nodeName!="LI"||!s.id?r--:r==t?s.hasAttribute("aria-selected")||(s.setAttribute("aria-selected","true"),n=s):s.hasAttribute("aria-selected")&&(s.removeAttribute("aria-selected"),s.removeAttribute("aria-describedby"));return n&&COe(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),s=this.info.getBoundingClientRect(),r=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 r.top>Math.min(i.bottom,n.bottom)-10||r.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(Ho).positionInfo(this.view,n,r,s,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,s){const r=document.createElement("ul");r.id=n,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let i=null;for(let o=s.from;o<s.to;o++){let{completion:a,match:c}=t[o],{section:u}=a;if(u){let m=typeof u=="string"?u:u.name;if(m!=i&&(o>s.from||s.from==0))if(i=m,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let p=r.appendChild(document.createElement("completion-section"));p.textContent=m}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let h=this.optionClass(a);h&&(d.className=h);for(let m of this.optionContent){let p=m(a,this.view.state,this.view,c);p&&d.appendChild(p)}}return s.from&&r.classList.add("cm-completionListIncompleteTop"),s.to<t.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function SOe(e,t){return n=>new _Oe(n,e,t)}function COe(e,t){let n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=n.height/e.offsetHeight;s.top<n.top?e.scrollTop-=(n.top-s.top)/r:s.bottom>n.bottom&&(e.scrollTop+=(s.bottom-n.bottom)/r)}function XH(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function TOe(e,t){let n=[],s=null,r=null,i=d=>{n.push(d);let{section:h}=d.completion;if(h){s||(s=[]);let m=typeof h=="string"?h:h.name;s.some(p=>p.name==m)||s.push(typeof h=="string"?{name:m}:h)}},o=t.facet(Ho);for(let d of e)if(d.hasResult()){let h=d.result.getMatch;if(d.result.filter===!1)for(let m of d.result.options)i(new GH(m,d.source,h?h(m):[],1e9-n.length));else{let m=t.sliceDoc(d.from,d.to),p,g=o.filterStrict?new xOe(m):new vOe(m);for(let b of d.result.options)if(p=g.match(b.label)){let x=b.displayLabel?h?h(b,p.matched):[]:p.matched,y=p.score+(b.boost||0);if(i(new GH(b,d.source,x,y)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;r||(r=Object.create(null)),r[v]=Math.max(y,r[v]||-1e9)}}}}if(s){let d=Object.create(null),h=0,m=(p,g)=>(p.rank==="dynamic"&&g.rank==="dynamic"?r[g.name]-r[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 s.sort(m))h-=1e5,d[p.name]=h;for(let p of n){let{section:g}=p.completion;g&&(p.score+=d[typeof g=="string"?g:g.name])}}let a=[],c=null,u=o.compareCompletions;for(let d of n.sort((h,m)=>m.score-h.score||u(h.completion,m.completion))){let h=d.completion;!c||c.label!=h.label||c.detail!=h.detail||c.type!=null&&h.type!=null&&c.type!=h.type||c.apply!=h.apply||c.boost!=h.boost?a.push(d):XH(d.completion)>XH(c)&&(a[a.length-1]=d),c=d.completion}return a}class g1{constructor(t,n,s,r,i,o){this.options=t,this.attrs=n,this.tooltip=s,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new g1(this.options,QH(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,s,r,i,o){if(r&&!o&&t.some(u=>u.isPending))return r.setDisabled();let a=TOe(t,n);if(!a.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(Ho).selectOnOpen?0:-1;if(r&&r.selected!=c&&r.selected!=-1){let u=r.options[r.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==u){c=d;break}}return new g1(a,QH(s,c),{pos:t.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:IOe,above:i.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new g1(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new g1(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class a3{constructor(t,n,s){this.active=t,this.id=n,this.open=s}static start(){return new a3(NOe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,s=n.facet(Ho),i=(s.override||n.languageDataAt("autocomplete",l0(n)).map(yOe)).map(c=>(this.active.find(d=>d.source==c)||new Lc(c,this.active.some(d=>d.state!=0)?1:0)).update(t,s));i.length==this.active.length&&i.every((c,u)=>c==this.active[u])&&(i=this.active);let o=this.open,a=t.effects.some(c=>c.is(zR));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!EOe(i,this.active)||a?o=g1.build(i,n,this.id,o,s,a):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 Lc(c.source,0):c));for(let c of t.effects)c.is(BR)&&(o=o&&o.setSelected(c.value,this.id));return i==this.active&&o==this.open?this:new a3(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?AOe:jOe}}function EOe(e,t){if(e==t)return!0;for(let n=0,s=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;s<t.length&&!t[s].hasResult();)s++;let r=n==e.length,i=s==t.length;if(r||i)return r==i;if(e[n++].result!=t[s++].result)return!1}}const AOe={"aria-autocomplete":"list"},jOe={};function QH(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const NOe=[];function toe(e,t){if(e.isUserEvent("input.complete")){let s=e.annotation(eoe);if(s&&t.activateOnCompletion(s))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 Lc{constructor(t,n,s=!1){this.source=t,this.state=n,this.explicit=s}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let s=toe(t,n),r=this;(s&8||s&16&&this.touches(t))&&(r=new Lc(r.source,0)),s&4&&r.state==0&&(r=new Lc(this.source,1)),r=r.updateFor(t,s);for(let i of t.effects)if(i.is(o3))r=new Lc(r.source,1,i.value);else if(i.is(Jx))r=new Lc(r.source,0);else if(i.is(zR))for(let o of i.value)o.source==r.source&&(r=o);return r}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(l0(t.state))}}class B1 extends Lc{constructor(t,n,s,r,i,o){super(t,3,n),this.limit=s,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(t,n){var s;if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),a=l0(t.state);if(a>o||!r||n&2&&(l0(t.startState)==this.from||a<this.limit))return new Lc(this.source,n&4?1:0);let c=t.changes.mapPos(this.limit);return MOe(r.validFor,t.state,i,o)?new B1(this.source,this.explicit,c,r,i,o):r.update&&(r=r.update(r,i,o,new Jie(t.state,a,!1)))?new B1(this.source,this.explicit,c,r,r.from,(s=r.to)!==null&&s!==void 0?s:l0(t.state)):new Lc(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 B1(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new Lc(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function MOe(e,t,n,s){if(!e)return!1;let r=t.sliceDoc(n,s);return typeof e=="function"?e(r,n,s,t):Zie(e,!0).test(r)}const zR=_s.define({map(e,t){return e.map(n=>n.map(t))}}),Ba=ca.define({create(){return a3.start()},update(e,t){return e.update(t)},provide:e=>[CR.from(e,t=>t.tooltip),Pt.contentAttributes.from(e,t=>t.attrs)]});function FR(e,t){const n=t.completion.apply||t.completion.label;let s=e.state.field(Ba).active.find(r=>r.source==t.source);return s instanceof B1?(typeof n=="string"?e.dispatch({...bOe(e.state,n,s.from,s.to),annotations:eoe.of(t.completion)}):n(e,t.completion,s.from,s.to),!0):!1}const IOe=SOe(Ba,FR);function Gf(e,t="option"){return n=>{let s=n.state.field(Ba,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<n.state.facet(Ho).interactionDelay)return!1;let r=1,i;t=="page"&&(i=Yre(n,s.open.tooltip))&&(r=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=s.open.options,a=s.open.selected>-1?s.open.selected+r*(e?1:-1):e?0:o-1;return a<0?a=t=="page"?0:o-1:a>=o&&(a=t=="page"?o-1:0),n.dispatch({effects:BR.of(a)}),!0}}const noe=e=>{let t=e.state.field(Ba,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Ho).interactionDelay?!1:FR(e,t.open.options[t.open.selected])},dS=e=>e.state.field(Ba,!1)?(e.dispatch({effects:o3.of(!0)}),!0):!1,hS=e=>{let t=e.state.field(Ba,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:Jx.of(null)}),!0)};class ROe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const DOe=50,LOe=1e3,POe=xi.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(Ba).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Ba),n=e.state.facet(Ho);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Ba)==t)return;let s=e.transactions.some(i=>{let o=toe(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(s||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>DOe&&Date.now()-o.time>LOe){for(let a of o.context.abortListeners)try{a()}catch(c){gl(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(o3)))&&(this.pendingStart=!0);let r=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(),r):-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(Ba);for(let n of t.active)n.isPending&&!this.running.some(s=>s.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ho).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=l0(t),s=new Jie(t,n,e.explicit,this.view),r=new ROe(e,s);this.running.push(r),Promise.resolve(e.source(s)).then(i=>{r.context.aborted||(r.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Jx.of(null)}),gl(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(Ho).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Ho),s=this.view.state.field(Ba);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let a=l0(i.updates.length?i.updates[0].startState:this.view.state),c=Math.min(a,i.done.from+(i.active.explicit?0:1)),u=new B1(i.active.source,i.active.explicit,c,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let d of i.updates)u=u.update(d,n);if(u.hasResult()){t.push(u);continue}}let o=s.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new Lc(i.active.source,0);for(let c of i.updates)a=a.update(c,n);a.isPending||t.push(a)}else this.startQuery(o)}(t.length||s.open&&s.open.disabled)&&this.view.dispatch({effects:zR.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Ba,!1);if(t&&t.tooltip&&this.view.state.facet(Ho).closeOnBlur){let n=t.open&&Yre(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Jx.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:o3.of(!1)}),20),this.composing=0}}}),OOe=typeof navigator=="object"&&/Win/.test(navigator.platform),$Oe=Jm.highest(Pt.domEventHandlers({keydown(e,t){let n=t.state.field(Ba,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(OOe&&e.altKey)||e.metaKey)return!1;let s=n.open.options[n.open.selected],r=n.active.find(o=>o.source==s.source),i=s.completion.commitCharacters||r.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&FR(t,s),!1}})),BOe=Pt.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"}}}),Zx={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Jp=_s.define({map(e,t){let n=t.mapPos(e,-1,Ha.TrackAfter);return n??void 0}}),HR=new class extends Em{};HR.startSide=1;HR.endSide=-1;const soe=ca.define({create(){return Ks.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:s=>s>=n.from&&s<=n.to})}for(let n of t.effects)n.is(Jp)&&(e=e.update({add:[HR.range(n.value,n.value+1)]}));return e}});function zOe(){return[HOe,soe]}const i7="()[]{}<>«»»«［］｛｝";function roe(e){for(let t=0;t<i7.length;t+=2)if(i7.charCodeAt(t)==e)return i7.charAt(t+1);return lR(e<128?e:e+1)}function ioe(e,t){return e.languageDataAt("closeBrackets",t)[0]||Zx}const FOe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),HOe=Pt.inputHandler.of((e,t,n,s)=>{if((FOe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(s.length>2||s.length==2&&Ku(hl(s,0))==1||t!=r.from||n!=r.to)return!1;let i=WOe(e.state,s);return i?(e.dispatch(i),!0):!1}),qOe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let s=ioe(e,e.selection.main.head).brackets||Zx.brackets,r=null,i=e.changeByRange(o=>{if(o.empty){let a=VOe(e.doc,o.head);for(let c of s)if(c==a&&AT(e.doc,o.head)==roe(hl(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:nt.cursor(o.head-c.length)}}return{range:r=o}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},UOe=[{key:"Backspace",run:qOe}];function WOe(e,t){let n=ioe(e,e.selection.main.head),s=n.brackets||Zx.brackets;for(let r of s){let i=roe(hl(r,0));if(t==r)return i==r?YOe(e,r,s.indexOf(r+r+r)>-1,n):GOe(e,r,i,n.before||Zx.before);if(t==i&&ooe(e,e.selection.main.from))return KOe(e,r,i)}return null}function ooe(e,t){let n=!1;return e.field(soe).between(0,e.doc.length,s=>{s==t&&(n=!0)}),n}function AT(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Ku(hl(n,0)))}function VOe(e,t){let n=e.sliceString(t-2,t);return Ku(hl(n,0))==n.length?n:n.slice(1)}function GOe(e,t,n,s){let r=null,i=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:Jp.of(o.to+t.length),range:nt.range(o.anchor+t.length,o.head+t.length)};let a=AT(e.doc,o.head);return!a||/\s/.test(a)||s.indexOf(a)>-1?{changes:{insert:t+n,from:o.head},effects:Jp.of(o.head+t.length),range:nt.cursor(o.head+t.length)}:{range:r=o}});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function KOe(e,t,n){let s=null,r=e.changeByRange(i=>i.empty&&AT(e.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:nt.cursor(i.head+n.length)}:s={range:i});return s?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function YOe(e,t,n,s){let r=s.stringPrefixes||Zx.stringPrefixes,i=null,o=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:Jp.of(a.to+t.length),range:nt.range(a.anchor+t.length,a.head+t.length)};let c=a.head,u=AT(e.doc,c),d;if(u==t){if(JH(e,c))return{changes:{insert:t+t,from:c},effects:Jp.of(c+t.length),range:nt.cursor(c+t.length)};if(ooe(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:nt.cursor(c+m.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=ZH(e,c-2*t.length,r))>-1&&JH(e,d))return{changes:{insert:t+t+t+t,from:c},effects:Jp.of(c+t.length),range:nt.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=yi.Word&&ZH(e,c,r)>-1&&!XOe(e,c,t,r))return{changes:{insert:t+t,from:c},effects:Jp.of(c+t.length),range:nt.cursor(c+t.length)}}return{range:i=a}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function JH(e,t){let n=va(e).resolveInner(t+1);return n.parent&&n.from==t}function XOe(e,t,n,s){let r=va(e).resolveInner(t,-1),i=s.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+i)),c=a.indexOf(n);if(!c||c>-1&&s.indexOf(a.slice(0,c))>-1){let d=r.firstChild;for(;d&&d.from==r.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=r.to==t&&r.parent;if(!u)break;r=u}return!1}function ZH(e,t,n){let s=e.charCategorizer(t);if(s(e.sliceDoc(t-1,t))!=yi.Word)return t;for(let r of n){let i=t-r.length;if(e.sliceDoc(i,t)==r&&s(e.sliceDoc(i-1,i))!=yi.Word)return i}return-1}function aoe(e={}){return[$Oe,Ba,Ho.of(e),POe,QOe,BOe]}const loe=[{key:"Ctrl-Space",run:dS},{mac:"Alt-`",run:dS},{mac:"Alt-i",run:dS},{key:"Escape",run:hS},{key:"ArrowDown",run:Gf(!0)},{key:"ArrowUp",run:Gf(!1)},{key:"PageDown",run:Gf(!0,"page")},{key:"PageUp",run:Gf(!1,"page")},{key:"Enter",run:noe}],QOe=Jm.highest(bb.computeN([Ho],e=>e.facet(Ho).defaultKeymap?[loe]:[]));function Rl(e){let t=e.field(Ba,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const eq=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class xb{constructor(t,n,s=0,r=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(s,r),this.bufferStart=s,this.normalize=i?a=>i(eq(a)):eq,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 hl(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=lR(t),s=this.bufferStart+this.bufferPos;this.bufferPos+=Ku(t);let r=this.normalize(n);if(r.length)for(let i=0,o=s,a=!0;;i++){let c=r.charCodeAt(i),u=this.match(c,o,a,this.bufferPos+this.bufferStart,i==r.length-1);if(u)return this.value=u,this;if(i==r.length-1)break;a&&i<n.length&&n.charCodeAt(i)==c?o++:a=!1}}}match(t,n,s,r,i){let o=null;for(let a=0;a<this.matches.length;){let c=this.matches[a],u=!1;this.query.charCodeAt(c.index)==t&&(c.index==this.query.length-1?o={from:c.from,to:r,precise:i&&c.precise}:(c.index++,u=!0)),u?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:n,to:r,precise:s&&i}:this.matches.push({from:n,index:1,precise:s})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(xb.prototype[Symbol.iterator]=function(){return this});const coe={from:-1,to:-1,match:/.*/.exec(""),precise:!0},qR="gm"+(/x/.unicode==null?"":"u");class uoe{constructor(t,n,s,r=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=coe,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new doe(t,n,s,r,i);this.re=new RegExp(n,qR+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.iter=t.iter();let o=t.lineAt(r);this.curLineStart=o.from,this.matchPos=l3(t,r),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 s=this.curLineStart+n.index,r=s+n[0].length;if(this.matchPos=l3(this.text,r+(s==r?1:0)),s==this.curLineStart+this.curLine.length&&this.nextLine(),(s<r||s>this.value.to)&&(!this.test||this.test(s,r,n)))return this.value={from:s,to:r,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 o7=new WeakMap;class z1{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,s){let r=o7.get(t);if(!r||r.from>=s||r.to<=n){let a=new z1(n,t.sliceString(n,s));return o7.set(t,a),a}if(r.from==n&&r.to==s)return r;let{text:i,from:o}=r;return o>n&&(i=t.sliceString(n,o)+i,o=n),r.to<s&&(i+=t.sliceString(r.to,s)),o7.set(t,new z1(o,i)),new z1(n,i.slice(n-o,s-o))}}class doe{constructor(t,n,s,r,i){this.text=t,this.to=i,this.done=!1,this.value=coe,this.matchPos=l3(t,r),this.re=new RegExp(n,qR+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.flat=z1.get(t,r,this.chunkEnd(r+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 s=this.flat.from+n.index,r=s+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(s,r,n)))return this.value={from:s,to:r,precise:!0,match:n},this.matchPos=l3(this.text,r+(s==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=z1.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(uoe.prototype[Symbol.iterator]=doe.prototype[Symbol.iterator]=function(){return this});function JOe(e){try{return new RegExp(e,qR),!0}catch{return!1}}function l3(e,t){if(t>=e.length)return t;let n=e.lineAt(t),s;for(;t<n.to&&(s=n.text.charCodeAt(t-n.from))>=56320&&s<57344;)t++;return t}const ZOe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:s,result:r}=LDe(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return r.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){e.dispatch({effects:s});return}let a=t.doc.lineAt(t.selection.main.head),[,c,u,d,h]=o,m=d?+d.slice(1):0,p=u?+u:a.number;if(u&&h){let x=p/100;c&&(x=x*(c=="-"?-1:1)+a.number/t.doc.lines),p=Math.round(t.doc.lines*x)}else u&&c&&(p=p*(c=="-"?-1:1)+a.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),b=nt.cursor(g.from+Math.max(0,Math.min(m,g.length)));e.dispatch({effects:[s,Pt.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},e$e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},t$e=dn.define({combine(e){return Ed(e,e$e,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function n$e(e){return[a$e,o$e]}const s$e=Nn.mark({class:"cm-selectionMatch"}),r$e=Nn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function tq(e,t,n,s){return(n==0||e(t.sliceDoc(n-1,n))!=yi.Word)&&(s==t.doc.length||e(t.sliceDoc(s,s+1))!=yi.Word)}function i$e(e,t,n,s){return e(t.sliceDoc(n,n+1))==yi.Word&&e(t.sliceDoc(s-1,s))==yi.Word}const o$e=xi.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(t$e),{state:n}=e,s=n.selection;if(s.ranges.length>1)return Nn.none;let r=s.main,i,o=null;if(r.empty){if(!t.highlightWordAroundCursor)return Nn.none;let c=n.wordAt(r.head);if(!c)return Nn.none;o=n.charCategorizer(r.head),i=n.sliceDoc(c.from,c.to)}else{let c=r.to-r.from;if(c<t.minSelectionLength||c>200)return Nn.none;if(t.wholeWords){if(i=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(tq(o,n,r.from,r.to)&&i$e(o,n,r.from,r.to)))return Nn.none}else if(i=n.sliceDoc(r.from,r.to),!i)return Nn.none}let a=[];for(let c of e.visibleRanges){let u=new xb(n.doc,i,c.from,c.to);for(;!u.next().done;){let{from:d,to:h}=u.value;if((!o||tq(o,n,d,h))&&(r.empty&&d<=r.from&&h>=r.to?a.push(r$e.range(d,h)):(d>=r.to||h<=r.from)&&a.push(s$e.range(d,h)),a.length>t.maxMatches))return Nn.none}}return Nn.set(a)}},{decorations:e=>e.decorations}),a$e=Pt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),l$e=({state:e,dispatch:t})=>{let{selection:n}=e,s=nt.create(n.ranges.map(r=>e.wordAt(r.head)||nt.cursor(r.head)),n.mainIndex);return s.eq(n)?!1:(t(e.update({selection:s})),!0)};function c$e(e,t){let{main:n,ranges:s}=e.selection,r=e.wordAt(n.head),i=r&&r.from==n.from&&r.to==n.to;for(let o=!1,a=new xb(e.doc,t,s[s.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new xb(e.doc,t,0,Math.max(0,s[s.length-1].from-1)),o=!0}else{if(o&&s.some(c=>c.from==a.value.from))continue;if(i){let c=e.wordAt(a.value.from);if(!c||c.from!=a.value.from||c.to!=a.value.to)continue}return a.value}}const u$e=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(i=>i.from===i.to))return l$e({state:e,dispatch:t});let s=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=s))return!1;let r=c$e(e,s);return r?(t(e.update({selection:e.selection.addRange(nt.range(r.from,r.to),!1),effects:Pt.scrollIntoView(r.to)})),!0):!1},Zb=dn.define({combine(e){return Ed(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new S$e(t),scrollToMatch:t=>Pt.scrollIntoView(t)})}});class hoe{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||JOe(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,s)=>s=="n"?`
`:s=="r"?"\r":s=="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 g$e(this):new f$e(this)}getCursor(t,n=0,s){let r=t.doc?t:nr.create({doc:t});return s==null&&(s=r.doc.length),this.regexp?Jg(this,r,n,s):Qg(this,r,n,s)}}class foe{constructor(t){this.spec=t}}function d$e(e,t,n){return(s,r,i,o)=>{if(n&&!n(s,r,i,o))return!1;let a=s>=o&&r<=o+i.length?i.slice(s-o,r-o):t.doc.sliceString(s,r);return e(a,t,s,r)}}function Qg(e,t,n,s){let r;return e.wholeWord&&(r=h$e(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=d$e(e.test,t,r)),new xb(t.doc,e.unquoted,n,s,e.caseSensitive?void 0:i=>i.toLowerCase(),r)}function h$e(e,t){return(n,s,r,i)=>((i>n||i+r.length<s)&&(i=Math.max(0,n-2),r=e.sliceString(i,Math.min(e.length,s+2))),(t(c3(r,n-i))!=yi.Word||t(u3(r,n-i))!=yi.Word)&&(t(u3(r,s-i))!=yi.Word||t(c3(r,s-i))!=yi.Word))}class f$e extends foe{constructor(t){super(t)}nextMatch(t,n,s){let r=Qg(this.spec,t,s,t.doc.length).nextOverlapping();if(r.done){let i=Math.min(t.doc.length,n+this.spec.unquoted.length);r=Qg(this.spec,t,0,i).nextOverlapping()}return r.done||r.value.from==n&&r.value.to==s?null:r.value}prevMatchInRange(t,n,s){for(let r=s;;){let i=Math.max(n,r-1e4-this.spec.unquoted.length),o=Qg(this.spec,t,i,r),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==n)return null;r-=1e4}}prevMatch(t,n,s){let r=this.prevMatchInRange(t,0,n);return r||(r=this.prevMatchInRange(t,Math.max(0,s-this.spec.unquoted.length),t.doc.length)),r&&(r.from!=n||r.to!=s)?r:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let s=Qg(this.spec,t,0,t.doc.length),r=[];for(;!s.next().done;){if(r.length>=n)return null;r.push(s.value)}return r}highlight(t,n,s,r){let i=Qg(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(s+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function m$e(e,t,n){return(s,r,i)=>(!n||n(s,r,i))&&e(i[0],t,s,r)}function Jg(e,t,n,s){let r;return e.wholeWord&&(r=p$e(t.charCategorizer(t.selection.main.head))),e.test&&(r=m$e(e.test,t,r)),new uoe(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,s)}function c3(e,t){return e.slice(qo(e,t,!1),t)}function u3(e,t){return e.slice(t,qo(e,t))}function p$e(e){return(t,n,s)=>!s[0].length||(e(c3(s.input,s.index))!=yi.Word||e(u3(s.input,s.index))!=yi.Word)&&(e(u3(s.input,s.index+s[0].length))!=yi.Word||e(c3(s.input,s.index+s[0].length))!=yi.Word)}class g$e extends foe{nextMatch(t,n,s){let r=Jg(this.spec,t,s,t.doc.length).next();return r.done&&(r=Jg(this.spec,t,0,n).next()),r.done?null:r.value}prevMatchInRange(t,n,s){for(let r=1;;r++){let i=Math.max(n,s-r*1e4),o=Jg(this.spec,t,i,s),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==n||a.from>i+10))return a;if(i==n)return null}}prevMatch(t,n,s){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,s,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,s)=>{if(s=="&")return t.match[0];if(s=="$")return"$";for(let r=s.length;r>0;r--){let i=+s.slice(0,r);if(i>0&&i<t.match.length)return t.match[i]+s.slice(r)}return n})}matchAll(t,n){let s=Jg(this.spec,t,0,t.doc.length),r=[];for(;!s.next().done;){if(r.length>=n)return null;r.push(s.value)}return r}highlight(t,n,s,r){let i=Jg(this.spec,t,Math.max(0,n-250),Math.min(s+250,t.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const ew=_s.define(),UR=_s.define(),cm=ca.define({create(e){return new a7(wN(e).create(),null)},update(e,t){for(let n of t.effects)n.is(ew)?e=new a7(n.value.create(),e.panel):n.is(UR)&&(e=new a7(e.query,n.value?WR:null));return e},provide:e=>Kx.from(e,t=>t.panel)});class a7{constructor(t,n){this.query=t,this.panel=n}}const b$e=Nn.mark({class:"cm-searchMatch"}),y$e=Nn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),v$e=xi.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(cm))}update(e){let t=e.state.field(cm);(t!=e.startState.field(cm)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Nn.none;let{view:n}=this,s=new gd;for(let r=0,i=n.visibleRanges,o=i.length;r<o;r++){let{from:a,to:c}=i[r];for(;r<o-1&&c>i[r+1].from-2*250;)c=i[++r].to;e.highlight(n.state,a,c,(u,d)=>{let h=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);s.add(u,d,h?y$e:b$e)})}return s.finish()}},{decorations:e=>e.decorations});function Xw(e){return t=>{let n=t.state.field(cm,!1);return n&&n.query.spec.valid?e(t,n):goe(t)}}const d3=Xw((e,{query:t})=>{let{to:n}=e.state.selection.main,s=t.nextMatch(e.state,n,n);if(!s)return!1;let r=nt.single(s.from,s.to),i=e.state.facet(Zb);return e.dispatch({selection:r,effects:[VR(e,s),i.scrollToMatch(r.main,e)],userEvent:"select.search"}),poe(e),!0}),h3=Xw((e,{query:t})=>{let{state:n}=e,{from:s}=n.selection.main,r=t.prevMatch(n,s,s);if(!r)return!1;let i=nt.single(r.from,r.to),o=e.state.facet(Zb);return e.dispatch({selection:i,effects:[VR(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),poe(e),!0}),x$e=Xw((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:nt.create(n.map(s=>nt.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),w$e=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:s,to:r}=n.main,i=[],o=0;for(let a=new xb(e.doc,e.sliceDoc(s,r));!a.next().done;){if(i.length>1e3)return!1;a.value.from==s&&(o=i.length),i.push(nt.range(a.value.from,a.value.to))}return t(e.update({selection:nt.create(i,o),userEvent:"select.search.matches"})),!0},nq=Xw((e,{query:t})=>{let{state:n}=e,{from:s,to:r}=n.selection.main;if(n.readOnly)return!1;let i=t.nextMatch(n,s,s);if(!i)return!1;let o=i,a=[],c,u,d=[];o.precise?o.from==s&&o.to==r&&(u=n.toText(t.getReplacement(o)),a.push({from:o.from,to:o.to,insert:u}),d.push(Pt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(s).number)+"."))):o=t.nextMatch(n,o.from,o.to);let h=e.state.changes(a);return o&&(c=nt.single(o.from,o.to).map(h),d.push(VR(e,o)),d.push(n.facet(Zb).scrollToMatch(c.main,e))),e.dispatch({changes:h,selection:c,effects:d,userEvent:"input.replace"}),!0}),k$e=Xw((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:i,to:o,precise:a}=r;a&&n.push({from:i,to:o,insert:t.getReplacement(r)})}if(!n.length)return!1;let s=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Pt.announce.of(s),userEvent:"input.replace.all"}),!0});function WR(e){return e.state.facet(Zb).createPanel(e)}function wN(e,t){var n,s,r,i,o;let a=e.selection.main,c=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!c)return t;let u=e.facet(Zb);return new hoe({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(s=t==null?void 0:t.caseSensitive)!==null&&s!==void 0?s:u.caseSensitive,literal:(r=t==null?void 0:t.literal)!==null&&r!==void 0?r: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 moe(e){let t=TR(e,WR);return t&&t.dom.querySelector("[main-field]")}function poe(e){let t=moe(e);t&&t==e.root.activeElement&&t.select()}const goe=e=>{let t=e.state.field(cm,!1);if(t&&t.panel){let n=moe(e);if(n&&n!=e.root.activeElement){let s=wN(e.state,t.query.spec);s.valid&&e.dispatch({effects:ew.of(s)}),n.focus(),n.select()}}else e.dispatch({effects:[UR.of(!0),t?ew.of(wN(e.state,t.query.spec)):_s.appendConfig.of(T$e)]});return!0},boe=e=>{let t=e.state.field(cm,!1);if(!t||!t.panel)return!1;let n=TR(e,WR);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:UR.of(!1)}),!0},_$e=[{key:"Mod-f",run:goe,scope:"editor search-panel"},{key:"F3",run:d3,shift:h3,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:d3,shift:h3,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:boe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:w$e},{key:"Mod-Alt-g",run:ZOe},{key:"Mod-d",run:u$e,preventDefault:!0}];class S$e{constructor(t){this.view=t;let n=this.query=t.state.field(cm).query.spec;this.commit=this.commit.bind(this),this.searchField=$r("input",{value:n.search,placeholder:Dl(t,"Find"),"aria-label":Dl(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=$r("input",{value:n.replace,placeholder:Dl(t,"Replace"),"aria-label":Dl(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=$r("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=$r("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=$r("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function s(r,i,o){return $r("button",{class:"cm-button",name:r,onclick:i,type:"button"},o)}this.dom=$r("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,s("next",()=>d3(t),[Dl(t,"next")]),s("prev",()=>h3(t),[Dl(t,"previous")]),s("select",()=>x$e(t),[Dl(t,"all")]),$r("label",null,[this.caseField,Dl(t,"match case")]),$r("label",null,[this.reField,Dl(t,"regexp")]),$r("label",null,[this.wordField,Dl(t,"by word")]),...t.state.readOnly?[]:[$r("br"),this.replaceField,s("replace",()=>nq(t),[Dl(t,"replace")]),s("replaceAll",()=>k$e(t),[Dl(t,"replace all")])],$r("button",{name:"close",onclick:()=>boe(t),"aria-label":Dl(t,"close"),type:"button"},["×"])])}commit(){let t=new hoe({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:ew.of(t)}))}keydown(t){VRe(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?h3:d3)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),nq(this.view))}update(t){for(let n of t.transactions)for(let s of n.effects)s.is(ew)&&!s.value.eq(this.query)&&this.setQuery(s.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(Zb).top}}function Dl(e,t){return e.state.phrase(t)}const t2=30,n2=/[\s\.,:;?!]/;function VR(e,{from:t,to:n}){let s=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,i=Math.max(s.from,t-t2),o=Math.min(r,n+t2),a=e.state.sliceDoc(i,o);if(i!=s.from){for(let c=0;c<t2;c++)if(!n2.test(a[c+1])&&n2.test(a[c])){a=a.slice(c);break}}if(o!=r){for(let c=a.length-1;c>a.length-t2;c--)if(!n2.test(a[c-1])&&n2.test(a[c])){a=a.slice(0,c);break}}return Pt.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${s.number}.`)}const C$e=Pt.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"}}),T$e=[cm,Jm.low(v$e),C$e];class sq{constructor(t,n,s){this.from=t,this.to=n,this.diagnostic=s}}class Hp{constructor(t,n,s){this.diagnostics=t,this.panel=n,this.selected=s}static init(t,n,s){let r=s.facet(tw).markerFilter;r&&(t=r(t,s));let i=t.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new gd,a=[],c=0,u=s.doc.iter(),d=0,h=s.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!a.length)break;let b,x;if(a.length)b=c,x=a.reduce((w,k)=>Math.min(w,k.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>h)break;x=g.to,a.push(g),p++}for(;p<i.length;){let w=i[p];if(w.from==b&&(w.to>w.from||w.to==b))a.push(w),p++,x=Math.min(w.to,x);else{x=Math.min(w.from,x);break}}x=Math.min(x,h);let y=!1;if(a.some(w=>w.from==b&&(w.to==x||x==h))&&(y=b==x,!y&&x-b<10)){let w=b-(d+u.value.length);w>0&&(u.next(w),d=b);for(let k=b;;){if(k>=x){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=B$e(a);if(y)o.add(b,b,Nn.widget({widget:new L$e(v),diagnostics:a.slice()}));else{let w=a.reduce((k,T)=>T.markClass?k+" "+T.markClass:k,"");o.add(b,x,Nn.mark({class:"cm-lintRange cm-lintRange-"+v+w,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>x)}))}if(c=x,c==h)break;for(let w=0;w<a.length;w++)a[w].to<=c&&a.splice(w--,1)}let m=o.finish();return new Hp(m,n,Dm(m))}}function Dm(e,t=null,n=0){let s=null;return e.between(n,1e9,(r,i,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(!s)s=new sq(r,i,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(s.diagnostic)<0)return!1;s=new sq(s.from,i,s.diagnostic)}}),s}function E$e(e,t){let n=t.pos,s=t.end||n,r=e.state.facet(tw).hideOn(e,n,s);if(r!=null)return r;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(yoe))||e.changes.touchesRange(i.from,Math.max(i.to,s)))}function A$e(e,t){return e.field(Yl,!1)?t:t.concat(_s.appendConfig.of(z$e))}const yoe=_s.define(),GR=_s.define(),voe=_s.define(),Yl=ca.define({create(){return new Hp(Nn.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),s=null,r=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);s=Dm(n,e.selected.diagnostic,i)||Dm(n,null,i)}!n.size&&r&&t.state.facet(tw).autoPanel&&(r=null),e=new Hp(n,r,s)}for(let n of t.effects)if(n.is(yoe)){let s=t.state.facet(tw).autoPanel?n.value.length?nw.open:null:e.panel;e=Hp.init(n.value,s,t.state)}else n.is(GR)?e=new Hp(e.diagnostics,n.value?nw.open:null,e.selected):n.is(voe)&&(e=new Hp(e.diagnostics,e.panel,n.value));return e},provide:e=>[Kx.from(e,t=>t.panel),Pt.decorations.from(e,t=>t.diagnostics)]}),j$e=Nn.mark({class:"cm-lintRange cm-lintRange-active"});function N$e(e,t,n){let{diagnostics:s}=e.state.field(Yl),r,i=-1,o=-1;s.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 r=d.diagnostics,i=c,o=u,!1});let a=e.state.facet(tw).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:i,end:o,above:!0,create(){return{dom:M$e(e,r)}}}:null}function M$e(e,t){return $r("ul",{class:"cm-tooltip-lint"},t.map(n=>woe(e,n,!1)))}const I$e=e=>{let t=e.state.field(Yl,!1);(!t||!t.panel)&&e.dispatch({effects:A$e(e.state,[GR.of(!0)])});let n=TR(e,nw.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},rq=e=>{let t=e.state.field(Yl,!1);return!t||!t.panel?!1:(e.dispatch({effects:GR.of(!1)}),!0)},R$e=e=>{let t=e.state.field(Yl,!1);if(!t)return!1;let n=e.state.selection.main,s=Dm(t.diagnostics,null,n.to+1);return!s&&(s=Dm(t.diagnostics,null,0),!s||s.from==n.from&&s.to==n.to)?!1:(e.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0}),RDe(e,s.from,1,{tooltip:koe,until:r=>r.docChanged||r.newSelection.main.head<s.from||r.newSelection.main.head>s.to}),!0)},D$e=[{key:"Mod-Shift-m",run:I$e,preventDefault:!0},{key:"F8",run:R$e}],tw=dn.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Ed(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:iq,tooltipFilter:iq,needsRefresh:(t,n)=>t?n?s=>t(s)||n(s):t:n,hideOn:(t,n)=>t?n?(s,r,i)=>t(s,r,i)||n(s,r,i):t:n,autoPanel:(t,n)=>t||n})}}});function iq(e,t){return e?t?(n,s)=>t(e(n,s),s):e:t}function xoe(e){let t=[];if(e)e:for(let{name:n}of e){for(let s=0;s<n.length;s++){let r=n[s];if(/[a-zA-Z]/.test(r)&&!t.some(i=>i.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function woe(e,t,n){var s;let r=n?xoe(t.actions):[];return $r("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},$r("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(s=t.actions)===null||s===void 0?void 0:s.map((i,o)=>{let a=!1,c=p=>{if(p.preventDefault(),a)return;a=!0;let g=Dm(e.state.field(Yl).diagnostics,t);g&&i.apply(e,g.from,g.to)},{name:u}=i,d=r[o]?u.indexOf(r[o]):-1,h=d<0?u:[u.slice(0,d),$r("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return $r("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},h)}),t.source&&$r("div",{class:"cm-diagnosticSource"},t.source))}class L$e extends dc{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return $r("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class oq{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=woe(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class nw{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)rq(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=xoe(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==r.keyCode){let c=Dm(this.view.state.field(Yl).diagnostics,i);c&&i.actions[a].apply(t,c.from,c.to)}}else return;r.preventDefault()}},s=r=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(r.target)&&this.moveSelection(i)};this.list=$r("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:s}),this.dom=$r("div",{class:"cm-panel-lint"},this.list,$r("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>rq(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Yl).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(Yl),s=0,r=!1,i=null,o=new Set;for(t.between(0,this.view.state.doc.length,(a,c,{spec:u})=>{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let h=-1,m;for(let p=s;p<this.items.length;p++)if(this.items[p].diagnostic==d){h=p;break}h<0?(m=new oq(this.view,d),this.items.splice(s,0,m),r=!0):(m=this.items[h],h>s&&(this.items.splice(s,h-s),r=!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"),s++}});s<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new oq(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!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:a,panel:c})=>{let u=c.height/this.list.offsetHeight;a.top<c.top?this.list.scrollTop-=(c.top-a.top)/u:a.bottom>c.bottom&&(this.list.scrollTop+=(a.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let t=this.list.firstChild;function n(){let s=t;t=s.nextSibling,s.remove()}for(let s of this.items)if(s.dom.parentNode==this.list){for(;t!=s.dom;)n();t=s.dom.nextSibling}else this.list.insertBefore(s.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Yl),s=Dm(n.diagnostics,this.items[t].diagnostic);s&&this.view.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:voe.of(s)})}static open(t){return new nw(t)}}function P$e(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 s2(e){return P$e(`<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 O$e=Pt.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:s2("#f11")},".cm-lintRange-warning":{backgroundImage:s2("orange")},".cm-lintRange-info":{backgroundImage:s2("#999")},".cm-lintRange-hint":{backgroundImage:s2("#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 $$e(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function B$e(e){let t="hint",n=1;for(let s of e){let r=$$e(s.severity);r>n&&(n=r,t=s.severity)}return t}const koe=IDe(N$e,{hideOn:E$e}),z$e=[Yl,Pt.decorations.compute([Yl],e=>{let{selected:t,panel:n}=e.field(Yl);return!t||!n||t.from==t.to?Nn.none:Nn.set([j$e.range(t.from,t.to)])}),koe,O$e],_oe=[VDe(),YDe(),Vre(),LR(),FLe(),qre(),nDe(),nr.allowMultipleSelections.of(!0),ELe(),gie(bie,{fallback:!0}),QLe(),zOe(),aoe(),xDe(),_De(),fDe(),n$e(),bb.of([...UOe,...$R,..._$e,...PR,...OLe,...loe,...D$e])],F$e=[Vre(),LR(),qre(),gie(bie,{fallback:!0}),bb.of([...$R,...PR])];/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const H$e="(hover: none) and (pointer: coarse)";function _v(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(H$e).matches}function q$e(){if(typeof window<"u"){const e=new URLSearchParams(window.location.search).get("composer");if(e==="textarea")return!0;if(e==="codemirror")return!1}return _v()}function U$e(){const[e]=f.useState(q$e);return e}/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const KR={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 r=(n+t).normalize().codePointAt(0);r>126&&(KR[r]=n)}}const l7={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(l7)){const t=e.toUpperCase();for(let n=l7[e][0];n<=l7[e][1];++n)KR[n]=n%2===0?t:e}function Qw(e){if(e<192||e>8580)return e;const t=KR[e];return t!==void 0?t.codePointAt(0):e}function Nf(e,t){return e>t?e:t}const Soe=e=>e.split("").map(t=>t.codePointAt(0)),W$e=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)W$e.add(e);const wb="".codePointAt(0),sw="A".codePointAt(0),rw="Z".codePointAt(0),Coe="a".codePointAt(0),Toe="z".codePointAt(0),V$e="0".codePointAt(0),G$e="9".codePointAt(0);function b1(e,t,n){return n?e:t-e-1}const iw=16,kN=-3,f3=-1,E0=iw/2,K$e=iw/2,Y$e=E0+f3,Eoe=4,Aoe=2;function _N(e){return e?new Set:null}function Qy(e,t,n){if(t!==null&&t.i16.length>e+n){const s=t.i16.subarray(e,e+n);return[e+n,s]}return[e,new Int16Array(n)]}function aq(e,t,n){if(t!==null&&t.i32.length>e+n){const s=t.i32.subarray(e,e+n);return[e+n,s]}return[e,new Int32Array(n)]}function joe(e){return e>=Coe&&e<=Toe?1:e>=sw&&e<=rw?2:e>=V$e&&e<=G$e?4:0}function Noe(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 m3(e){return e<=wb?joe(e):Noe(e)}function YR(e,t){return e===0&&t!==0?E0:e===1&&t===2||e!==4&&t===4?Y$e:t===0?K$e:0}function X$e(e,t){return t===0?E0:YR(m3(e[t-1]),m3(e[t]))}function Q$e(e,t,n,s){let r=e.slice(s),i=r.indexOf(n);if(i===0)return s;if(!t&&n>=Coe&&n<=Toe){i>0&&(r=r.slice(0,i));const o=r.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:s+i}function lq(e){for(const t of e)if(t>=128)return!1;return!0}function XR(e,t,n){if(!lq(e))return 0;if(!lq(t))return-1;let s=0,r=0;for(let i=0;i<t.length;i++){if(r=Q$e(e,n,t[i],r),r<0)return-1;i===0&&r>0&&(s=r-1),r++}return s}const J$e=(e,t,n,s,r,i,o)=>{const a=r.length;if(a===0)return[{start:0,end:0,score:0},_N(i)];const c=s.length;if(o!==null&&c*a>o.i16.length)return Ioe(e,t,n,s,r,i);const u=XR(s,r,e);if(u<0)return[{start:-1,end:-1,score:0},null];let d=0,h=0,m=null,p=null,g=null,b=null;[d,m]=Qy(d,o,c),[d,p]=Qy(d,o,c),[d,g]=Qy(d,o,c),[h,b]=aq(h,o,a);const[,x]=aq(h,o,c);for(let V=0;V<x.length;V++)x[V]=s[V];let y=0,v=0,w=0,k=0;const T=r[0];let C=r[0],_=0,S=0,D=!1,E=x.subarray(u),B=m.subarray(u).subarray(0,E.length),I=p.subarray(u).subarray(0,E.length),L=g.subarray(u).subarray(0,E.length);for(let[V,R]of E.entries()){let re=null;R<=wb?(re=joe(R),!e&&re===2&&(R+=32)):(re=Noe(R),!e&&re===2&&(R=String.fromCodePoint(R).toLowerCase().codePointAt(0)),t&&(R=Qw(R))),E[V]=R;const Z=YR(S,re);if(L[V]=Z,S=re,R===C&&(w<a&&(b[w]=u+V,w++,C=r[Math.min(w,a-1)]),k=u+V),R===T){const K=iw+Z*Aoe;if(B[V]=K,I[V]=1,a===1&&(n&&K>y||!n&&K>=y)&&(y=K,v=u+V,n&&Z===E0))break;D=!1}else D?B[V]=Nf(_+f3,0):B[V]=Nf(_+kN,0),I[V]=0,D=!0;_=B[V]}if(w!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const V={start:v,end:v+1,score:y};if(!i)return[V,null];const R=new Set;return R.add(v),[V,R]}const O=b[0],A=k-O+1;let $=null;[d,$]=Qy(d,o,A*a);{const V=m.subarray(O,k+1);for(const[R,re]of V.entries())$[R]=re}let[,q]=Qy(d,o,A*a);{const V=p.subarray(O,k+1);for(const[R,re]of V.entries())q[R]=re}const U=b.subarray(1),H=r.slice(1).slice(0,U.length);for(const[V,R]of U.entries()){let re=!1;const Z=H[V],K=V+1,Y=K*A,ae=x.subarray(R,k+1),le=g.subarray(R).subarray(0,ae.length),te=q.subarray(Y+R-O).subarray(0,ae.length),z=q.subarray(Y+R-O-1-A).subarray(0,ae.length),X=$.subarray(Y+R-O).subarray(0,ae.length),fe=$.subarray(Y+R-O-1-A).subarray(0,ae.length),xe=$.subarray(Y+R-O-1).subarray(0,ae.length);xe[0]=0;for(const[ie,Ce]of ae.entries()){const Ke=ie+R;let ut=0,Et=0,st=0;if(re?Et=xe[ie]+f3:Et=xe[ie]+kN,Z===Ce){ut=fe[ie]+iw;let He=le[ie];st=z[ie]+1,He===E0?st=1:st>1&&(He=Nf(He,Nf(Eoe,g[Ke-st+1]))),ut+He<Et?(ut+=le[ie],st=0):ut+=He}te[ie]=st,re=ut<Et;const xt=Nf(Nf(ut,Et),0);K===a-1&&(n&&xt>y||!n&&xt>=y)&&(y=xt,v=Ke),X[ie]=xt}}const M=_N(i);let ee=O;if(i&&M!==null){let V=a-1;ee=v;let R=!0;for(;;){const re=V*A,Z=ee-O,K=$[re+Z];let Y=0,ae=0;if(V>0&&ee>=b[V]&&(Y=$[re-A+Z-1]),ee>b[V]&&(ae=$[re+Z-1]),K>Y&&(K>ae||K===ae&&R)){if(M.add(ee),V===0)break;V--}R=q[re+Z]>1||re+A+Z+1<q.length&&q[re+A+Z+1]>0,ee--}}return[{start:ee,end:v+1,score:y},M]};function Moe(e,t,n,s,r,i,o){let a=0,c=0,u=!1,d=0,h=0;const m=_N(o);let p=0;r>0&&(p=m3(n[r-1]));for(let g=r;g<i;g++){let b=n[g];const x=m3(b);if(e||(b>=sw&&b<=rw?b+=32:b>wb&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=Qw(b)),b===s[a]){o&&m!==null&&m.add(g),c+=iw;let y=YR(p,x);d===0?h=y:(y===E0&&(h=y),y=Nf(Nf(y,h),Eoe)),a===0?c+=y*Aoe:c+=y,u=!1,d++,a++}else u?c+=f3:c+=kN,u=!0,d=0,h=0;p=x}return[c,m]}const Ioe=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];if(XR(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,c=-1,u=-1;const d=s.length,h=r.length;for(let m=0;m<d;m++){let p=s[b1(m,d,n)];e||(p>=sw&&p<=rw?p+=32:p>wb&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=Qw(p));const g=r[b1(a,h,n)];if(p===g&&(c<0&&(c=m),a++,a===h)){u=m+1;break}}if(c>=0&&u>=0){a--;for(let g=u-1;g>=c;g--){const b=b1(g,d,n);let x=s[b];e||(x>=sw&&x<=rw?x+=32:x>wb&&(x=String.fromCodePoint(x).toLowerCase().codePointAt(0)));const y=b1(a,h,n),v=r[y];if(x===v&&(a--,a<0)){c=g;break}}if(!n){const g=c;c=d-u,u=d-g}const[m,p]=Moe(e,t,s,r,c,u,i);return[{start:c,end:u,score:m},p]}return[{start:-1,end:-1,score:0},null]},Z$e=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];const a=s.length,c=r.length;if(a<c)return[{start:-1,end:-1,score:0},null];if(XR(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let u=0,d=-1,h=0,m=-1;for(let p=0;p<a;p++){const g=b1(p,a,n);let b=s[g];e||(b>=sw&&b<=rw?b+=32:b>wb&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=Qw(b));const x=b1(u,c,n);if(r[x]===b){if(x===0&&(h=X$e(s,g)),u++,u===c){if(h>m&&(d=p,m=h),h===E0)break;p-=u-1,u=0,h=0}}else p-=u,u=0,h=0}if(d>=0){let p=0,g=0;n?(p=d-c+1,g=d+1):(p=a-(d+1),g=a-(d-c+1));const[b]=Moe(e,t,s,r,p,g,!1);return[{start:p,end:g,score:b},null]}return[{start:-1,end:-1,score:0},null]},eBe=100*1024,tBe=2048;function nBe(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const sBe=nBe(eBe,tBe),rBe=(e,t,n)=>{let s=!1;switch(t){case"smart-case":e.toLowerCase()!==e&&(s=!0);break;case"case-sensitive":s=!0;break;case"case-insensitive":e=e.toLowerCase(),s=!1;break}let r=Soe(e);return n&&(r=r.map(Qw)),{queryRunes:r,caseSensitive:s}};function iBe(e,t){const n=Object.keys(e).map(r=>parseInt(r,10)).sort((r,i)=>i-r);let s=[];for(const r of n)if(s=s.concat(e[r]),s.length>=t)break;return s}function oBe(e,t,n){return s=>{const r=this.runesList[s];if(t.length>r.length)return;let[i,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,r,t,!0,sBe);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 a=this.opts.sort?i.score:0;e[a]===void 0&&(e[a]=[]),e[a].push({item:this.items[s],...i,positions:o??new Set})}}function aBe(e){const{queryRunes:t,caseSensitive:n}=rBe(e,this.opts.casing,this.opts.normalize),s={},r=oBe.bind(this)(s,t,n);for(let i=0,o=this.runesList.length;i<o;++i)r(i);return iBe(s,this.opts.limit)}const Roe={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class lBe{constructor(t,...n){switch(this.opts={...Roe,...n[0]},this.items=t,this.runesList=t.map(s=>Soe(this.opts.selector(s).normalize())),this.algoFn=Z$e,this.opts.fuzzy){case"v2":this.algoFn=J$e;break;case"v1":this.algoFn=Ioe;break}}}const cBe={...Roe,match:aBe};class uBe extends lBe{constructor(t,...n){super(t,...n),this.opts={...cBe,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(dBe);t=t.normalize();let n=this.opts.match.bind(this)(t);return hBe(n,this.opts)}}const dBe=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function hBe(e,t){if(t.sort){const{selector:n}=t;e.sort((s,r)=>{if(s.score===r.score)for(const i of t.tiebreakers){const o=i(s,r,n);if(o!==0)return o}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}class fBe{constructor(t,...n){this.finder=new uBe(t,...n),this.find=this.finder.find.bind(this.finder)}}const ow=["custom","skill","system"];function SN(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function mBe(e,t,n=ow){return cq(SN(e),n)-cq(SN(t),n)}function cq(e,t=ow){const n=t.indexOf(e);return n>=0?n:t.length+ow.indexOf(e)}const QR=String.raw`([^\s/]+)`,jT={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:"安装扩展"}]},NT={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"}]},MT={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 文件列表"}]},IT={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 pBe(e,t,n,s,r){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(a=>({name:a.name,description:a.description}));let o=(s==="zh-CN"?jT:NT)[e];if(o||(o=(s==="zh-CN"?MT:IT)[e]),!o&&t.length===0&&(r!=null&&r.length)&&(o=r.map(a=>({name:a,description:""}))),!o)return null;for(const a of t){const c=o.find(u=>u.name===a);if(!(c!=null&&c.children))return null;o=c.children}return o}function gBe(e,t,n){const s=e.toLowerCase(),r=t.toLowerCase(),i=s.startsWith(n),o=r.startsWith(n);return i!==o?i?-1:1:e.localeCompare(t)}function bBe(e,t,n,s){const r=mBe(e,t,s);return r!==0?r:0}const yBe={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function vBe(e,t){if(!e||e.includes(" ")||/^[/@!?]/.test(e))return null;const n=e.toLowerCase(),s=t.find(r=>r.name.toLowerCase().startsWith(n));return s?`/${s.name} `:null}function xBe(e,t,n){var u;const s=e.match(new RegExp(`^/${QR}\\s+$`));if(!s)return null;const r=s[1],i=t.find(d=>d.name===r),o=n==="zh-CN"?jT:NT;if((u=i==null?void 0:i.subcommands)!=null&&u.length||o[r]||r==="skills")return null;const c=(n==="zh-CN"?MT:IT)[r];return!c||c.length===0?null:`/${r} ${c[0].name} `}function wBe(e,t,n){var d,h;const s=e.match(new RegExp(`^/${QR}(\\s*)$`));if(!s)return null;const r=s[1],i=t.find(m=>m.name===r);if(!i)return null;const o=(d=i.argumentHint)==null?void 0:d.trim();if(o)return o;const a=n==="zh-CN"?jT:NT;if((h=i.subcommands)!=null&&h.length||a[r]||r==="skills")return null;const u=(n==="zh-CN"?MT:IT)[r];return!u||u.length===0?null:`[${u.map(m=>m.name).join("|")}]`}function kBe(e,t){const n=Math.max(0,Math.min(t,e.length)),s=e.lastIndexOf(`
`,Math.max(0,n-1))+1,r=e.indexOf(`
`,n),i=r===-1?e.length:r;return{lineStart:s,lineEnd:i,lineText:e.slice(s,i),textBefore:e.slice(s,n),cursor:n}}const uq=new WeakMap;function _Be(e){let t=uq.get(e);if(!t){const n=[],s=new Map;for(const r of e)s.has(r.name)||(n.push(r.name),s.set(r.name,r));t={fzf:new fBe(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:s},uq.set(e,t)}return t}function SBe(e,t){try{const{fzf:n,byName:s}=_Be(e),r=[];for(const i of n.find(t)){const o=s.get(i.item);o&&r.push(o)}return r}catch(n){console.warn("[web-shell] slash fuzzy search failed, falling back to substring match:",n);const s=t.toLowerCase();return e.filter(r=>r.name.toLowerCase().includes(s))}}function CBe(e,t,n,s=[],r="en",i=a=>a,o=ow){var v,w;const{lineStart:a,lineEnd:c,lineText:u,textBefore:d,cursor:h}=kBe(e,t),m=d.match(new RegExp(`^/${QR}\\s+(.*)$`));if(m){const[,k,T]=m,C=n.find(M=>M.name===k),_=r==="zh-CN"?jT:NT,S=r==="zh-CN"?MT:IT,D=!!_[k]||k==="skills",E=!!S[k];if(!((v=C==null?void 0:C.subcommands)!=null&&v.length)&&!D&&!E)return null;const B=T.split(/\s+/),I=B.pop()||"",L=B;if(!((w=C==null?void 0:C.subcommands)!=null&&w.length)&&!D&&E&&!I)return null;const O=pBe(k,L,s,r,C==null?void 0:C.subcommands);if(!O)return null;const A=I.toLowerCase(),$=`/${k} ${L.length>0?L.join(" ")+" ":""}`,q=O.filter(M=>!I||M.name.toLowerCase().includes(A)).sort((M,ee)=>I?gBe(M.name,ee.name,A):0),U=k==="skills"&&L.length===0,H=q.map(M=>{const ee=`${$}${M.name}`;return{id:ee,label:M.name,detail:M.description||void 0,apply:`${ee} `,...U?{type:"skill"}:{}}});return H.length===0?null:{kind:"subcommand",from:a,to:h,query:I,items:H}}const p=u.match(/^\/([^\s/]*)$/);if(!p)return null;const g=p[1],b=g.length===0,y=(b?[...n].sort((k,T)=>bBe(k,T,"",o)):SBe(n,g)).map(k=>{const T=`/${k.name} `,C=SN(k),_=C==="custom"||C==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:T,category:C,...b?{section:i(yBe[C])}:{},..._&&k.description?{type:"command-info"}:{}}});return y.length===0?null:{kind:"command",from:a,to:c,query:g,items:y}}const TBe="qwen-web-shell-history",Doe=100;function EBe(e){try{const t=localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n.filter(s=>typeof s=="string"):[]}catch{return[]}}function ABe(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-Doe)))}catch{}}function dq(e=TBe){const t=f.useRef(e);t.current=e;const n=f.useRef(EBe(e)),s=f.useRef(-1),r=f.useRef(""),i=f.useRef(-1),[o,a]=f.useState(()=>({canUp:n.current.length>0,canDown:!1})),c=f.useCallback(()=>{const v=n.current,w=s.current;a({canUp:v.length>0&&(w===-1||w>0),canDown:w!==-1})},[]),u=f.useCallback(v=>{const w=n.current;w[w.length-1]!==v&&(w.push(v),w.length>Doe&&w.shift(),ABe(t.current,w),s.current=-1,c())},[c]),d=f.useCallback(v=>{const w=n.current;if(w.length===0)return null;if(s.current===-1)r.current=v,s.current=w.length-1;else if(s.current>0)s.current--;else return null;return c(),w[s.current]},[c]),h=f.useCallback(()=>{const v=n.current;return s.current===-1?null:s.current<v.length-1?(s.current++,c(),v[s.current]):(s.current=-1,c(),r.current)},[c]),m=f.useCallback(()=>s.current!==-1,[]),p=f.useCallback(()=>{s.current=-1,i.current=-1,c()},[c]),g=f.useCallback(v=>{const w=n.current;if(w.length===0||!v)return null;const k=i.current===-1?w.length-1:i.current-1;if(k<0)return i.current=-1,null;const T=v.toLowerCase();for(let C=k;C>=0;C--)if(w[C].toLowerCase().includes(T))return i.current=C,w[C];return i.current=-1,null},[]),b=f.useCallback(v=>{const w=v.trim().toLowerCase();return n.current.slice().reverse().filter(k=>!w||k.toLowerCase().includes(w))},[]),x=f.useCallback(v=>{const w=n.current;if(!v)return w.length>0?w[w.length-1]:null;for(let k=w.length-1;k>=0;k--)if(v(w[k]))return w[k];return null},[]),y=f.useCallback(()=>{i.current=-1},[]);return{push:u,navigateUp:d,navigateDown:h,isNavigating:m,reset:p,searchReverse:g,getReverseMatches:b,getLastEntry:x,resetSearch:y,nav:o}}function r2(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function CN(e,t,n){let s=e.get(t);return s||(s=n().catch(r=>{throw e.delete(t),r}),e.set(t,s)),s}const jBe=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,NBe=[],hq=150,A0=50,Loe=A0+1,Yo="files",ey="extensions",Jo="mcp-resources",Poe=[Yo,ey,Jo],MBe="\x1B",Ooe=new RegExp(`${MBe}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),$oe=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,aw="[invalid]",IBe=/[^\p{L}\p{N}_./-]/gu;function fS(e){return Poe.includes(e)}function RBe(e,t){var s;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)||(s=n.exclude)!=null&&s.includes(e))}function DBe(e){const t=new Set(Poe),n=[];for(const s of e){if(t.has(s.id)){console.error(`[@mention] duplicate provider id="${s.id}" ignored`);continue}t.add(s.id),n.push(s)}return n}function fq(e){return(e.textValue===void 0?void 0:Hr(e.textValue))??(typeof e.label=="string"?Hr(e.label)??void 0:void 0)??Hh(e.id)??aw}function Boe(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function Ah(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 LBe(e){return Array.from(e,t=>/[a-z]/i.test(t)?`[${t.toLowerCase()}${t.toUpperCase()}]`:/[\\*?[{\]}()!@+|]/.test(t)?`\\${t}`:t).join("")}function TN(e){const t=RT(e).replace(/^\.\//,"");return t?`**/*${LBe(t)}*`:"**/*"}function p3(e,...t){const n=e.toLowerCase();return t.some(s=>s==null?void 0:s.toLowerCase().includes(n))}function mq(e){const t=Ah(e),n=bd(t);return t==="."?"@./ ":`@${j0(n)}/ `}function PBe(e,t){return`${e}:${t}`}function j0(e){return e.replace(IBe,"\\$&")}function RT(e){return e.replace(/\\(.)/g,"$1")}function zoe(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function OBe(e,t){return`@${j0(PBe(bd(e),bd(t)))} `}function $Be(e,t,n){const s=RT(e);return t===Jo&&n&&s.startsWith(`${n}:`)?{providerId:Jo,serverName:n,itemQuery:s.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:ey,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:Jo,itemQuery:e.slice(4)}:null}function BBe(e,t,n){if(e===ey&&t.startsWith("ext:")||e===Jo&&t.startsWith("mcp:"))return t.slice(4);const s=RT(t);return e===Jo&&n&&s.startsWith(`${n}:`)?s.slice(n.length+1):!fS(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function zBe(e,t,n,s){if(n!=null&&n.aborted)return!1;const r=s??(e==null?void 0:e.loadMcpStatus);if(!r)return!1;try{const i=await r();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 FBe(e){const t=Ah(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function Foe(e,t){const n=RT(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),s=n.lastIndexOf("/");if(s<0)return{dirPath:Ah(t),entryQuery:n};const r=n.slice(0,s),i=Ah(t),o=i==="."?r:Boe(i,r);return{dirPath:Ah(o),entryQuery:n.slice(s+1)}}function HBe(e){if(!e)return null;const t=e.state.selection.main;if(!t.empty)return null;const n=e.state.doc.lineAt(t.head),r=n.text.slice(0,t.head-n.from).match(jBe);if(!r)return null;const i=t.head-r[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:r[1]??""}}function Hr(e){const t=e.replace(Ooe,"").replace($oe,"").split("").filter(zoe).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function bd(e){const t=e.replace(Ooe,"").replace($oe,"").split("").filter(zoe).join("");return t.length>0?t:aw}function Hh(e){return e===void 0?aw:Hr(e)??aw}function qBe(e){if(e!==void 0)return bd(e).trim()}function UBe(e){if(!e)return;const t=e.kind===void 0?void 0:Hr(e.kind);return{id:Hr(e.id)??aw,label:e.label===void 0?void 0:Hr(e.label),value:e.value===void 0?void 0:Hr(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:qBe(e.serialized)}}function WBe(e,t){const n={...e,label:Hr(e.label)??Hh(e.id),description:e.description===void 0?void 0:Hr(e.description),subtitle:e.subtitle===void 0?void 0:Hr(e.subtitle),detail:e.detail===void 0?void 0:Hr(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:Hr(e.iconTooltip),insertText:e.insertText===void 0?void 0:bd(e.insertText),composerTag:UBe(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const s={...n};return delete s.targetPath,delete s.serverName,{...s,kind:"insert"}}function VBe(e,t,n){var r;const s=n.trim();return s?t.composerTag?{...t.composerTag,serialized:((r=t.composerTag.serialized)==null?void 0:r.trim())||s}:e===ey?{id:`extension:${s}`,kind:"extension",value:t.label,serialized:s}:e===Jo?{id:`mcp:${s}`,kind:"mcp",value:t.label,serialized:s}:e===Yo?{id:`file:${s}`,kind:"file",value:t.description??t.label,serialized:s}:null:null}function GBe(e,t,n,s,r){return{id:Yo,label:s,description:r,order:1,async search({query:i,signal:o}){const a=e(),c=Ah(t()),u=a==null?void 0:a.listDirectory;if(u&&(!i||!(a!=null&&a.globWorkspace)))try{const{dirPath:h,entryQuery:m}=Foe(i,c),p=m.toLowerCase(),g=await CN(n().directories,h,()=>u(h,{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)),x={id:`current:${h}`,label:mq(h).trim(),description:Hr(h),insertText:mq(h),kind:"insert"};return[...m?[]:[x],...b.map(y=>{const v=Boe(h,y.name),w=Hh(y.name),k=Hr(v),T=bd(v);return y.kind==="directory"?{id:`dir:${v}`,label:`${w}/`,description:k,kind:"directory",targetPath:v}:{id:`file:${v}`,label:w,description:k,insertText:`@${j0(T)} `,kind:"insert"}})].slice(0,m?A0:Loe)}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}const d=a==null?void 0:a.globWorkspace;if(!d)return console.warn("[@mention] file provider unavailable: workspace actions are not configured"),[];try{const h=TN(i),m=await CN(n().globResults,h,()=>d(h,{maxResults:A0,signal:o}));return o.aborted?[]:m.matches.filter(p=>p!==".").map(p=>({id:p,label:Hh(p),insertText:`@${j0(bd(p))} `,kind:"insert"}))}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}}}}function KBe(e,t,n,s){return{id:ey,label:n,description:s,order:2,async search({query:r,signal:i}){var a;const o=(a=e())==null?void 0:a.loadExtensionsStatus;if(!o)return[];try{const c=t();c.extensionsStatus??(c.extensionsStatus=o().catch(h=>{throw c.extensionsStatus=void 0,h}));const u=await c.extensionsStatus;if(i.aborted)return[];const d=r.toLowerCase();return u.extensions.filter(h=>h.isActive).map(h=>{const m=Hh(h.name),g=`@ext:${j0(bd(h.name))}`,b=Hr(h.displayName??""),x=Hr(h.description??"");return{id:h.name,label:m,description:b&&b!==m?b:x,detail:b&&x?`${b} - ${x}`:b??x,composerTag:{id:`extension:${g}`,kind:"extension",value:b||m,serialized:g},insertText:`${g} `}}).filter(h=>p3(d,h.label,h.description)).sort((h,m)=>{const p=h.label.toLowerCase(),g=m.label.toLowerCase(),b=p.startsWith(d)?0:1,x=g.startsWith(d)?0:1;return b!==x?b-x:p.localeCompare(g)}).slice(0,A0)}catch(c){return i.aborted||console.warn("Failed to load @ extension suggestions",c),[]}}}}function YBe(e,t,n,s,r){return{id:Jo,label:n,description:s,order:3,async search({query:i,signal:o}){var c;const a=(c=e())==null?void 0:c.loadMcpStatus;if(!a)return[];try{const u=t();u.mcpStatus??(u.mcpStatus=a().catch(m=>{throw u.mcpStatus=void 0,m}));const d=await u.mcpStatus;if(o.aborted)return[];const h=i.toLowerCase();return d.servers.filter(m=>!m.disabled).map(m=>{const p=bd(m.name),g=m.resourceCount===void 0?void 0:r(m.resourceCount);return m.resourceCount===0?{id:`mcp-server-ref:${m.name}`,label:Hh(m.name),description:Hr(m.description??""),detail:Hr(m.description??""),insertText:`@mcp:${j0(p)} `,kind:"insert"}:{id:`mcp-server:${m.name}`,label:Hh(m.name),description:g===void 0?Hr(m.description??""):g,detail:Hr(m.description??""),kind:"mcp-server",serverName:m.name}}).filter(m=>p3(h,m.label,m.description)).sort((m,p)=>m.label.localeCompare(p.label)).slice(0,A0)}catch(u){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",u),[]}}}}function XBe(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function QBe({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:s,workspaceKey:r,builtinProviders:i,providers:o=NBe,createInlineTagEffect:a}){const{t:c}=at(),[u,d]=f.useState(null),h=f.useRef(null),m=f.useRef(0),p=f.useRef(null),g=f.useRef(null),b=f.useRef("."),x=f.useRef(r2()),y=f.useRef(null),v=f.useRef(null),w=f.useRef(!1),k=f.useMemo(()=>[...[GBe(()=>s.current,()=>b.current,()=>x.current,c("at.category.files"),c("at.category.files.description")),KBe(()=>s.current,()=>x.current,c("at.category.extensions"),c("at.category.extensions.description")),YBe(()=>s.current,()=>x.current,c("at.category.mcpResources"),c("at.category.mcpResources.description"),Y=>c("mcp.resourceCount",{count:Y}))].filter(Y=>RBe(Y.id,i)),...DBe(o)].sort((Y,ae)=>(Y.order??0)-(ae.order??0)),[i,o,c,s]),T=f.useRef(k);T.current=k;const C=f.useMemo(()=>k.map(K=>({id:K.id,provider:K,textValue:fq(K),label:typeof K.label=="string"?fq(K):K.label,description:K.description===void 0?void 0:Hr(K.description),tabs:K.tabs,renderItem:K.renderItem})),[k]),_=f.useRef(C);_.current=C;const S=f.useCallback(K=>{const Y=typeof K=="function"?K(h.current):K;h.current=Y,d(Y)},[]);f.useEffect(()=>{var K;(K=p.current)==null||K.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null),b.current=".",x.current=r2(),h.current=null,d(null)},[r]);const D=f.useCallback(()=>{var K;(K=p.current)==null||K.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null)},[]),E=f.useCallback((K={})=>{D(),x.current=r2();const Y=K.preserveProviderSelection||w.current;w.current=!1,Y||(y.current=null,v.current=null),S(null)},[D,S]),B=f.useCallback(()=>{const K=h.current;return K?K.level==="items"?(D(),S({...K,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},[D,E,S]);f.useEffect(()=>()=>{var K;g.current&&clearTimeout(g.current),(K=p.current)==null||K.abort(),p.current=null,b.current=".",x.current=r2()},[]);const I=f.useCallback((K,Y,ae)=>{const le=h.current;return(le==null?void 0:le.level)!=="items"||le.selectedProviderId!==K||le.selectedTabId!==ae.selectedTabId||le.itemMode!==ae.itemMode||le.mcpServerName!==ae.mcpServerName||le.fileDirectory!==ae.fileDirectory?[]:le.query!==Y&&!fS(K)?[]:K===Yo&&Y===""&&b.current==="."?[]:le.items},[]),L=f.useCallback((K,Y)=>{const ae=s.current,le=x.current;if(K===Yo){if(Y&&(ae!=null&&ae.globWorkspace))return le.globResults.has(TN(Y));if(ae!=null&&ae.listDirectory){const{dirPath:z}=Foe(Y,Ah(b.current));return le.directories.has(z)}const te=TN(Y);return!!(ae!=null&&ae.globWorkspace)&&le.globResults.has(te)}return K===ey?le.extensionsStatus!==void 0:K===Jo?le.mcpStatus!==void 0:!1},[s]),O=f.useCallback((K,Y,ae,le={})=>{var xe;const te=T.current.find(ie=>ie.id===K);if(!te){console.warn(`[@mention] provider="${K}" not found (may have been removed)`),S(null);return}(xe=p.current)==null||xe.abort();const z=new AbortController;p.current=z;const X=m.current+1;m.current=X;const fe=I(K,Y,ae);le.loadingAlreadySet||S({...ae,items:fe,loading:!0}),Promise.resolve().then(()=>te.search({query:Y,signal:z.signal,tabId:ae.selectedTabId})).then(ie=>{z.signal.aborted||m.current!==X||S(Ce=>{if(!Ce||Ce.level!=="items")return Ce;const Ke=K===Yo&&Y.length===0?Loe:A0;return{...Ce,items:ie.slice(0,Ke).map(ut=>WBe(ut,{customProvider:!fS(K)})),selectedIndex:0,loading:!1}})}).catch(ie=>{z.signal.aborted||m.current!==X||(console.warn(`[@mention] provider="${K}" query=<redacted> failed`,ie),S(Ce=>!Ce||Ce.level!=="items"?Ce:{...Ce,items:[],selectedIndex:0,loading:!1}))})},[I,S]),A=f.useCallback((K,Y,ae)=>{var te;g.current&&clearTimeout(g.current),(te=p.current)==null||te.abort(),p.current=null;const le=I(K,Y,ae);if(S({...ae,items:le,loading:!0}),L(K,Y)){O(K,Y,ae,{loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,O(K,Y,ae,{loadingAlreadySet:!0})},hq)},[I,L,O,S]),$=f.useCallback((K,Y,ae,le={})=>{var Ke,ut;const te=s.current,z=te==null?void 0:te.loadMcpResources;if(!z){console.warn(`[@mention] loadMcpResources not available for server="${K}"`),S({...ae,items:[],loading:!1});return}(Ke=p.current)==null||Ke.abort();const X=new AbortController;p.current=X;const fe=m.current+1;m.current=fe;const xe=((ut=h.current)==null?void 0:ut.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===K?h.current.items:[];le.loadingAlreadySet||S({...ae,items:xe,loading:!0});const ie=te==null?void 0:te.loadMcpStatus;(le.validateServer?zBe(te,K,X.signal,ie?()=>{const Et=x.current;return Et.mcpStatus??(Et.mcpStatus=ie().catch(st=>{throw Et.mcpStatus=void 0,st})),Et.mcpStatus}:void 0):Promise.resolve(!0)).then(Et=>X.signal.aborted?{resources:[]}:Et?CN(x.current.mcpResources,K,()=>z(K,{signal:X.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:K}),{resources:[]})).then(Et=>{if(X.signal.aborted||m.current!==fe)return;const st=Et.resources.map(xt=>{const He=Hr(xt.title??"")??Hr(xt.name??"")??Hh(xt.uri);return{id:`mcp-resource:${K}:${xt.uri}`,label:He,description:Hr(xt.description??"")??Hr(xt.mimeType??""),detail:Hh(xt.uri),insertText:OBe(K,xt.uri),kind:"insert"}}).filter(xt=>p3(Y,xt.label,xt.description,xt.detail)).sort((xt,He)=>xt.label.localeCompare(He.label)).slice(0,A0);S(xt=>!xt||xt.level!=="items"?xt:{...xt,items:st,selectedIndex:0,loading:!1})}).catch(Et=>{X.signal.aborted||m.current!==fe||(console.warn("Failed to load @ MCP resources",Et),S(st=>!st||st.level!=="items"?st:{...st,items:[],selectedIndex:0,loading:!1}))})},[S,s]),q=f.useCallback((K,Y,ae,le={})=>{var z,X;g.current&&clearTimeout(g.current),(z=p.current)==null||z.abort(),p.current=null;const te=((X=h.current)==null?void 0:X.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===K&&ae.itemMode==="mcpResources"?h.current.items:[];if(S({...ae,items:te,loading:!0}),x.current.mcpResources.has(K)){$(K,Y,ae,{...le,loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,$(K,Y,ae,{...le,loadingAlreadySet:!0})},hq)},[$,S]),U=f.useCallback(K=>{if(t.current||n.current)return E(),!1;const Y=HBe(K);if(!Y)return E(),!1;const ae=h.current;if((ae==null?void 0:ae.level)==="items"&&ae.from===Y.from&&(ae.to===Y.to||ae.inputMode==="search"&&Y.to>=ae.to||ae.inputMode==="context"&&Y.to>=ae.to)&&ae.selectedProviderId!==void 0&&_.current.some(z=>z.id===ae.selectedProviderId)){if(!ae.selectedProviderId)return!0;const z=ae.selectedProviderId,X=ae.inputMode==="context"?BBe(z,Y.query,ae.mcpServerName):ae.query;if(X!==ae.query){const fe={...ae,from:Y.from,to:Y.to,query:X,selectedIndex:0,providers:_.current};return z===Jo&&ae.itemMode==="mcpResources"&&ae.mcpServerName?(q(ae.mcpServerName,X,fe,{validateServer:ae.validateMcpServer}),!0):(A(z,X,fe),!0)}return S({...ae,from:Y.from,to:Y.to,query:X,providers:_.current}),!0}const te=_.current.filter(z=>p3(Y.query,z.textValue,z.description));if(te.length===0&&Y.query){const z=$Be(Y.query,y.current,v.current);if(z&&_.current.some(fe=>fe.id===z.providerId))return z.providerId===Jo&&z.serverName?(v.current=z.serverName,q(z.serverName,z.itemQuery,{from:Y.from,to:Y.to,query:z.itemQuery,level:"items",selectedProviderId:Jo,selectedIndex:0,providers:_.current,itemMode:"mcpResources",mcpServerName:z.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:z.validateServer},{validateServer:z.validateServer}),!0):(A(z.providerId,z.itemQuery,{from:Y.from,to:Y.to,query:z.itemQuery,level:"items",selectedProviderId:z.providerId,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:z.providerId===Yo?b.current:void 0,inputMode:"context"}),!0);const X=_.current.find(fe=>!fS(fe.id)&&Y.query.startsWith(`${fe.id}:`));if(X){const fe=Y.query.slice(X.id.length+1);return A(X.id,fe,{from:Y.from,to:Y.to,query:fe,level:"items",selectedProviderId:X.id,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(_.current.some(fe=>fe.id===Yo))return b.current=".",A(Yo,Y.query,{from:Y.from,to:Y.to,query:Y.query,level:"items",selectedProviderId:Yo,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:b.current,inputMode:"context"}),!0}return S({from:Y.from,to:Y.to,query:Y.query,level:"categories",selectedIndex:0,providers:te,items:[],loading:!1,inputMode:void 0}),!0},[E,t,A,q,S,n]),H=f.useCallback(K=>{const Y=h.current;if(!Y)return!1;const ae=Y.level==="categories"?Y.providers.length:Y.items.length;if(ae<=0)return!0;const le=XBe(Y.selectedIndex,ae,K);return le===null||S({...Y,selectedIndex:le}),!0},[S]),M=f.useCallback(K=>{const Y=h.current;if(!Y)return!1;const ae=Y.level==="categories"?Y.providers.length:Y.items.length;return K<0||K>=ae?!1:(S({...Y,selectedIndex:K}),!0)},[S]),ee=f.useCallback(K=>{var te,z;const Y=h.current;if(!Y||Y.level!=="categories")return!1;const ae=Y.providers[K??Y.selectedIndex];if(!ae)return!1;y.current=ae.id,ae.id===Yo&&(b.current=".");const le=(z=(te=ae.tabs)==null?void 0:te.find(X=>!X.disabled))==null?void 0:z.id;return A(ae.id,Y.query,{...Y,level:"items",selectedProviderId:ae.id,selectedIndex:0,tabs:ae.tabs,selectedTabId:le,itemMode:ae.id===Jo?"mcpServers":"default",mcpServerName:void 0,fileDirectory:ae.id===Yo?b.current:void 0,inputMode:"search"}),!0},[A]),V=f.useCallback(K=>{const Y=h.current;if(!Y||Y.level!=="items"||!Y.selectedProviderId)return!1;const ae={...Y,query:K,selectedIndex:0,inputMode:"search"};return Y.selectedProviderId===Jo&&Y.itemMode==="mcpResources"&&Y.mcpServerName?(q(Y.mcpServerName,K,ae,{validateServer:Y.validateMcpServer}),!0):(A(Y.selectedProviderId,K,ae),!0)},[A,q]),R=f.useCallback(K=>{var le;const Y=h.current;if(!Y||Y.level!=="items"||!Y.selectedProviderId||!((le=Y.tabs)!=null&&le.some(te=>te.id===K&&!te.disabled)))return!1;if(Y.selectedTabId===K)return!0;const ae={...Y,selectedTabId:K,selectedIndex:0,inputMode:"search"};return A(Y.selectedProviderId,Y.query,ae),!0},[A]),re=f.useCallback(()=>{const K=h.current;if(!K||K.level!=="items")return!1;if(K.selectedProviderId===Jo&&K.itemMode==="mcpResources")return A(Jo,"",{...K,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(K.selectedProviderId===Yo){const Y=Ah(K.fileDirectory??b.current);if(Y!==".")return b.current=FBe(Y),A(Yo,"",{...K,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),"items"}return S({...K,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}),D(),"categories"},[D,A,S]),Z=f.useCallback(K=>{const Y=h.current;if(!Y)return!1;if(Y.level==="categories")return ee(K);const ae=e.current;if(!ae)return!1;if(Y.loading)return!0;const le=Y.items[K??Y.selectedIndex];if(!le)return!1;if(Y.selectedProviderId&&(y.current=Y.selectedProviderId),Y.selectedProviderId===Yo&&le.kind==="directory"&&le.targetPath)return b.current=Ah(le.targetPath),A(Yo,"",{...Y,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),!0;if(Y.selectedProviderId===Jo&&le.kind==="mcp-server"&&le.serverName)return v.current=le.serverName,q(le.serverName,"",{...Y,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:le.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const te=le.insertText??`@${j0(bd(le.label))} `,z=le.composerTag&&!/\s$/.test(te)?`${te} `:te,X=ae.state.doc.length;if(Y.from<0||Y.to<Y.from||Y.to>X)return console.warn("[@mention] stale insertion range",{from:Y.from,to:Y.to,docLength:X}),E(),!0;if(!ae.state.doc.sliceString(Y.from,Y.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:Y.from,to:Y.to}),E(),!0;w.current=!0;const xe=VBe(Y.selectedProviderId,le,z),ie=z.trimEnd(),Ce=xe&&a?[a({from:Y.from,to:Y.from+ie.length,tag:xe})]:void 0;return ae.dispatch({changes:{from:Y.from,to:Y.to,insert:z},...Ce?{effects:Ce}:{},selection:{anchor:Y.from+z.length},scrollIntoView:!0}),ae.focus(),E({preserveProviderSelection:!0}),!0},[E,ee,a,A,q,e]);return{state:u,close:E,closeIfOpen:B,refreshForView:U,moveSelection:H,select:M,accept:Z,enterCategory:ee,selectTab:R,backToCategories:re,updateSearch:V}}const JBe=Nn.mark({class:"cm-input-slash"}),ZBe=Nn.mark({class:"cm-input-at"}),eze=Nn.mark({class:"cm-input-code"});class tze extends dc{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 pq(e,t,n){const s=new gd,r=e.state.doc,i=[];for(let o=1;o<=r.lines;o++){const a=r.line(o),c=a.text,u=a.from;if(c.startsWith("/")){const g=c.indexOf(" "),b=g===-1?c.length:g;i.push({from:u,to:u+b,deco:JBe})}const d=wBe(c,t(),n());if(d){const g=c.endsWith(" ")?"":" ";i.push({from:u+c.length,to:u+c.length,deco:Nn.widget({widget:new tze(`${g}${d}`),side:1})})}const h=/@[^\s]+/g;let m;for(;(m=h.exec(c))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:ZBe});const p=/`[^`]+`/g;for(;(m=p.exec(c))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:eze})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:c}of i)s.add(o,a,c);return s.finish()}function nze(e=()=>[],t=()=>"en"){return xi.fromClass(class{constructor(n){Pe(this,"decorations");this.decorations=pq(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=pq(n.view,e,t))}},{decorations:n=>n.decorations})}const sze=Pt.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 N0(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function DT(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 Kf(e,t){return{[e]:DT(t)}}const rze=1e3,ize=10,gq="web-shell-tooltip-styles",oze=`
[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 bq(e){if(e.getElementById(gq))return;const n=(e instanceof Document?e:e.ownerDocument).createElement("style");n.id=gq,n.textContent=oze,e instanceof Document?e.head.appendChild(n):e.appendChild(n)}function yq(e){const t=e.getRootNode();return t instanceof ShadowRoot?t:e.ownerDocument}function aze(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function lze(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function JR(e){return lze(e)}function cze(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function uze(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function dze(e,t,n){if(!t.detail||!JR(t))return;const s=e.closest("[data-web-shell-tooltip-portal]");if(!s)return;let r=s.querySelector(".cm-completionInfo-hover");r||(r=document.createElement("div"),r.className="cm-tooltip cm-completionInfo cm-completionInfo-hover cm-completionInfo-right-narrow",s.appendChild(r)),r.textContent=`${cze(t)}

${t.detail}`;const i=r.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete r.dataset.hideTimerId);const o=r.getBoundingClientRect(),a=18,c=12,u=12,d=window.innerWidth,h=window.innerHeight,m=n.clientX+a,p=m+o.width+u>d?Math.max(u,n.clientX-o.width-a):m,g=Math.min(Math.max(u,n.clientY+c),Math.max(u,h-o.height-u));r.style.position="fixed",r.style.left=`${p}px`,r.style.top=`${g}px`,r.style.right="auto",r.style.bottom="auto"}function hze(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 fze(e){if(!e.detail||!JR(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",s=>{dze(t,e,s)}),n.addEventListener("mouseleave",()=>{const s=t.closest("[data-web-shell-tooltip-portal]");s&&hze(s)}))}),t}function mze(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function pze(e){return[...e].length>rze||e.split(`
`).length>ize}function gze(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bze(e,t,n){const r=`[Pasted Content ${[...n].length} chars]`,i=t===1?r:`${r} #${t}`;return e.set(i,n),{placeholderText:i,nextPasteId:t+1}}function yze(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function vze(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((r,i)=>i.length-r.length),s=new RegExp(n.map(gze).join("|"),"g");return t.replace(s,r=>e.get(r)??r)}function ax(e){return dC(e)}function xze(e){return e.map(ax).join(`
`)}function LT(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function PT(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function ZR(e){return PT(e)||LT(e)||e.id}function wze(e,t){const n=xze(t);return n?e?`${n}

${e}`:n:e}function kze(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 s=0;const r=[];for(const i of n)i.start<s||(r.push(e.slice(s,i.start)),r.push(ax(i.tag)),s=i.end);return r.push(e.slice(s)),r.join("")}function OT(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const Zg=_s.define({map:e=>e}),eD=_s.define(),Qc=_s.define();let _ze=0;class Sze extends dc{constructor(n){super();Pe(this,"contentRoot",null);Pe(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 s=document.createElement("span"),r=OT(this.tag);s.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&&(s.setAttribute("role","button"),s.tabIndex=0,s.style.cursor="pointer",s.addEventListener("pointerdown",b=>{b.preventDefault(),b.stopPropagation()}),s.addEventListener("mousedown",b=>{b.preventDefault(),b.stopPropagation()}),s.addEventListener("click",b=>{var x,y;b.stopPropagation(),(y=(x=this.tag).onClick)==null||y.call(x,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()})}),s.addEventListener("keydown",b=>{var x,y;b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),(y=(x=this.tag).onClick)==null||y.call(x,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()}))}));const i=LT(this.tag),o=PT(this.tag),a=this.tag.kind?"":i,c=this.tag.iconUrl??z0(this.tag.kind),u=c&&(N9(c)||Xb(c))?c:void 0;let d;try{d=(p=(m=this.tag).renderContent)==null?void 0:p.call(m,{tag:r,placement:"composer",readonly:!1})}catch(b){console.warn("[WebShell] inline tag renderContent failed",b)}let h=!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=tA.createRoot(b),this.contentRoot.render(d),s.appendChild(b),h=!0}catch(x){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",x)}}if(!h&&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",DT(u)),s.appendChild(b)}return h||this.appendDefaultContent(s,a,o),this.tag.tooltip!==void 0&&this.tag.tooltip!==null&&this.appendTooltip(s,this.tag.tooltip),this.tag.removable!==!1&&this.appendRemoveButton(s,n),s}appendDefaultContent(n,s,r){if(s){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=s,n.appendChild(i)}if(r){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=r,n.appendChild(i)}else if(!s){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,s){var a;const r=document.createElement("span");r.setAttribute("role","tooltip"),r.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=tA.createRoot(r),this.tooltipRoot.render(s),n.appendChild(r),r.id=`composer-tag-tooltip-${++_ze}`,n.setAttribute("aria-describedby",r.id)}catch(c){(a=this.tooltipRoot)==null||a.unmount(),this.tooltipRoot=null,this.tag.tooltipText&&(n.title=this.tag.tooltipText),console.warn("[WebShell] inline tag tooltip render failed",c);return}const i=()=>{r.style.display="block"},o=()=>{r.style.display="none"};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("focusin",i),n.addEventListener("focusout",o)}appendRemoveButton(n,s){const r=document.createElement("button");r.type="button",r.setAttribute("aria-label",`Remove ${ZR(this.tag)}`),r.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;",r.textContent="×",r.addEventListener("mousedown",i=>i.preventDefault()),r.addEventListener("keydown",i=>{if(i.key==="Enter"||i.key===" "){i.stopPropagation();return}i.key!=="Backspace"&&i.key!=="Delete"||(i.preventDefault(),i.stopPropagation(),r.click())}),r.addEventListener("click",i=>{i.stopPropagation();const o=[];s.state.field(Pf).between(0,s.state.doc.length,(a,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:a,to:c,insert:""})}),o.length!==0&&(s.dispatch({changes:o,effects:eD.of({predicate:a=>a.id===this.tag.id}),scrollIntoView:!0}),s.focus())}),r.addEventListener("mouseenter",()=>{r.style.color="var(--error-color)"}),r.addEventListener("mouseleave",()=>{r.style.color="var(--muted-foreground)"}),n.appendChild(r)}destroy(){var n,s;(n=this.contentRoot)==null||n.unmount(),(s=this.tooltipRoot)==null||s.unmount(),this.contentRoot=null,this.tooltipRoot=null}ignoreEvent(){return!1}}function Cze(e){const t={widget:new Sze(e.tag),inclusive:!1,tag:e.tag};return Nn.replace(t).range(e.from,e.to)}const Pf=ca.define({create(){return Nn.none},update(e,t){let n=e.map(t.changes);for(const s of t.effects)s.is(Zg)?n=n.update({add:[Cze(s.value)]}):s.is(eD)?n=n.update({filter:(r,i,o)=>{const a=o.spec.tag;return a&&s.value.predicate?!s.value.predicate(a):!0}}):s.is(Qc)&&(n=Nn.none);return n},provide:e=>[Pt.decorations.from(e),Pt.atomicRanges.of(t=>t.state.field(e))]});function vq(e){const t=[],n=e.state.field(Pf,!1);return n==null||n.between(0,e.state.doc.length,(s,r,i)=>{const o=i.spec.tag;o&&t.push(OT(o))}),t}function Tze(e){const t=[];return e.state.field(Pf).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push({start:n,end:s,tag:OT(i)})}),t}const xq=new K0,wq=new K0,kq=new K0;function Pp(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function Eze(e,t){const n=Pp(e,t);if(!n||e.length===0)return null;const s=n.slice(e.length);return s.length>0?s:null}class Aze extends dc{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 _q(e){return xi.fromClass(class{constructor(t){Pe(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return Nn.none;const n=t.state.selection.main,s=t.state.doc.toString(),r=Eze(s,e);return!r||!n.empty||n.head!==s.length?Nn.none:Nn.set([Nn.widget({widget:new Aze(r),side:1}).range(s.length)])}},{decorations:t=>t.decorations})}function Sq(e,t){const n=e.state.doc;if(n.lines<=1)return"history";const s=e.state.selection.main;if(!s.empty)return"editor";const r=s.head,i=n.lineAt(r);return t==="up"?i.number>1?"editor":r>i.from?(e.dispatch({selection:{anchor:i.from},scrollIntoView:!0}),"handled"):"history":i.number<n.lines?"editor":r<i.to?(e.dispatch({selection:{anchor:i.to},scrollIntoView:!0}),"handled"):"history"}function Cq(e,t){let n=!1;for(const s of e)if(s.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(s.type)){n=!0;const r=s.getAsFile();if(!r)continue;const i=s.type,o=new FileReader;o.onload=()=>{const a=o.result.split(",")[1];t({data:a,media_type:i})},o.readAsDataURL(r)}return n}function jze(e){const{onSubmit:t,onInputTextChange:n,onCycleMode:s,onToggleShortcuts:r,disabled:i=!1,placeholderText:o="Type a message...",commands:a,skills:c=[],slashCommandCategoryOrder:u,queuedMessages:d=[],onPopQueuedMessages:h,currentMode:m="default",onFocusFooter:p,dialogOpen:g=!1,followupState:b,onAcceptFollowup:x,onDismissFollowup:y,sessionName:v,composerInput:w,composerInputVersion:k,builtinAtProviders:T,atProviders:C,atWorkspaceCwd:_,composerTagIcons:S,parseUserMessageContent:D,renderComposerTag:E,renderComposerTagTooltip:B,onComposerTagClick:I,editorTheme:L}=e,O=EY(),{language:A,t:$}=at(),q=Hc(),U=f.useRef(null),H=f.useRef(null),M=U$e(),ee=f.useRef(null),[V,R]=f.useState(""),re=f.useRef(""),Z=f.useRef(null),K=f.useRef(t);K.current=t;const Y=f.useRef(n);Y.current=n;const ae=f.useCallback(se=>{var de;re.current=se,R(se),(de=Y.current)==null||de.call(Y,se)},[]),le=f.useRef(s);le.current=s;const te=f.useRef(r);te.current=r;const z=f.useRef(i);z.current=i;const X=f.useRef(a);X.current=a;const fe=f.useRef(c);fe.current=c;const xe=f.useRef(u);xe.current=u;const ie=f.useRef($);ie.current=$;const Ce=f.useRef(d);Ce.current=d;const Ke=f.useRef(h);Ke.current=h;const ut=f.useRef(b);ut.current=b;const Et=f.useRef(x);Et.current=x;const st=f.useRef(y);st.current=y;const xt=f.useRef(p);xt.current=p;const He=f.useRef(A);He.current=A;const pn=f.useRef(void 0);if(O&&_){const se=O.client.workspaceByCwd(_);pn.current={...O.actions,async globWorkspace(de,Ve){var Lt,Rn;(Lt=Ve==null?void 0:Ve.signal)==null||Lt.throwIfAborted();const et=await se.glob(de,{maxResults:Ve==null?void 0:Ve.maxResults,signal:Ve==null?void 0:Ve.signal});return(Rn=Ve==null?void 0:Ve.signal)==null||Rn.throwIfAborted(),{matches:Array.isArray(et.matches)?et.matches.filter(Pn=>typeof Pn=="string"):[]}},async listDirectory(de,Ve){var Cn,Lt;if((Cn=Ve==null?void 0:Ve.signal)!=null&&Cn.aborted)return{kind:"list",path:de,entries:[],truncated:!1};const et=await se.dirList(de);return(Lt=Ve==null?void 0:Ve.signal)!=null&&Lt.aborted?{kind:"list",path:de,entries:[],truncated:!1}:et}}}else pn.current=O==null?void 0:O.actions;const Yt=f.useRef(S);Yt.current=S;const It=f.useRef(D);It.current=D;const me=f.useRef(E);me.current=E;const $e=f.useRef(B);$e.current=B;const yt=f.useRef(I);yt.current=I;const Me=f.useCallback(se=>{var Lt;const de=se.icon??z0(se.kind,Yt.current),Ve={tag:se,placement:"composer",readonly:!1};let et;try{et=(Lt=$e.current)==null?void 0:Lt.call($e,Ve)}catch(Rn){console.warn("[WebShell] inline tag tooltip render failed",Rn)}const Cn=typeof et=="string"||typeof et=="number"?String(et):void 0;return{...se,...de?{iconUrl:de}:{},...me.current?{renderContent:me.current}:{},...et!=null?{tooltip:et}:{},...Cn?{tooltipText:Cn}:{},...yt.current?{onClick:yt.current}:{}}},[]),[Le,vn]=f.useState(!1),ge=f.useRef(Le);ge.current=Le;const Rt=QBe({viewRef:H,disabledRef:z,shellModeRef:ge,workspaceActionsRef:pn,workspaceKey:_,builtinProviders:T,providers:C,createInlineTagEffect:se=>Zg.of({...se,tag:Me(se.tag)})}),ht=Rt.close,gn=Rt.refreshForView;f.useEffect(()=>{const se=H.current;if(!se)return;const de=[Qc.of()];se.state.field(Pf).between(0,se.state.doc.length,(Ve,et,Cn)=>{const Lt=Cn.spec.tag;Lt&&de.push(Zg.of({from:Ve,to:et,tag:Me(OT(Lt))}))}),de.length!==1&&se.dispatch({effects:de})},[S,I,E,B,Me]);const Ue=f.useCallback(()=>{var se,de,Ve;(se=ut.current)!=null&&se.isVisible&&((de=st.current)==null||de.call(st)),vn(et=>!et),(Ve=H.current)==null||Ve.focus()},[]),[De,Re]=f.useState(!1),[be,Ie]=f.useState(""),[ne,Ee]=f.useState([]),[qe,Je]=f.useState(0),Qe=f.useRef(null),cn=f.useRef(null),Kn=f.useRef(""),[_e,ft]=f.useState([]),$t=f.useRef([]),pe=f.useRef(new Map),Be=f.useRef(1),[ue,Wt]=f.useState([]),Bt=f.useRef([]);Bt.current=ue;const hn=f.useRef(null),gt=f.useCallback(()=>{hn.current===null&&(hn.current=[...Bt.current])},[]),Ae=f.useCallback(()=>{const se=hn.current;if(se===null)return;hn.current=null;const de=[...se];Bt.current=de,Wt(de)},[]),kn=f.useCallback(()=>{hn.current=null},[]),Dn=f.useCallback(()=>{Bt.current=[],Wt([])},[]),qn=f.useCallback((se,de)=>{Dn(),se.dispatch({changes:{from:0,to:se.state.doc.length,insert:de},effects:Qc.of(),selection:{anchor:de.length}})},[Dn]),ir=f.useCallback((se,de)=>{const Ve=A9(de,It.current,"[WebShell] failed to parse composer history content",{requireSourcePreservation:!0}),et=(Ve==null?void 0:Ve.some(Rn=>Rn.type==="tag"))??!1;if(!Ve||!et){qn(se,de);return}const Cn=[Qc.of()];let Lt="";for(const Rn of Ve){if(Rn.type==="text"){Lt+=Rn.text;continue}const Pn=dC(Rn.tag),bs=Lt.length;Lt+=Pn,Cn.push(Zg.of({from:bs,to:Lt.length,tag:Me(Rn.tag)}))}Dn(),se.dispatch({changes:{from:0,to:se.state.doc.length,insert:Lt},effects:Cn,selection:{anchor:Lt.length}})},[Dn,Me,qn]),Qn=f.useCallback((se,de)=>{if(ge.current){qn(se,de);return}ir(se,de)},[ir,qn]),jr=f.useCallback(se=>{const de=H.current;if(!de){M&&ae(se);return}Qn(de,se)},[M,Qn,ae]),es=f.useRef(w);es.current=w;const Gn=f.useRef(()=>!0),Dt=f.useRef(null),[ps,is]=f.useState(null),os=f.useRef(null),ts=f.useRef(!1),Wn=f.useCallback(se=>{os.current=se,is(se)},[]),ds=f.useCallback(()=>{const se=Dt.current,de=H.current;if(!se||!de)return;const Ve=de.state.doc,et=se.from+se.text.length;Ve.length===et&&Ve.sliceString(se.from,et)===se.text&&de.dispatch({changes:{from:se.from,to:et,insert:""}}),Dt.current=null},[]),Sn=f.useCallback(()=>{ds(),ht()},[ds,ht]),ui=Rt.closeIfOpen,Ur=f.useCallback(()=>{const se=ui();return se?(se==="closed"&&ds(),!0):!1},[ds,ui]),lr=f.useCallback((se,de)=>{var Rn;if(!se||z.current||ge.current){Wn(null);return}if(ts.current){Wn(null);return}const Ve=se.state.selection.main;if(!Ve.empty){Wn(null);return}const et=CBe(se.state.doc.toString(),Ve.head,X.current,fe.current,He.current,Pn=>ie.current(Pn),xe.current??ow);if(!et){Wn(null);return}Sn();const Cn=de??((Rn=os.current)==null?void 0:Rn.selectedIndex)??0,Lt=Math.max(0,Math.min(Cn,et.items.length-1));Wn({...et,selectedIndex:Lt})},[Sn,Wn]),Cs=f.useCallback(()=>{Wn(null)},[Wn]),js=f.useCallback(se=>{const de=os.current;return!de||se<0||se>=de.items.length?!1:(de.selectedIndex===se||Wn({...de,selectedIndex:se}),!0)},[Wn]),Ii=f.useCallback(se=>{const de=os.current;if(!de)return!1;const Ve=aze(de.selectedIndex,de.items.length,se);return Ve===null?!1:(Wn({...de,selectedIndex:Ve}),!0)},[Wn]),Jr=f.useCallback(se=>{const de=H.current,Ve=os.current;if(!de||!Ve)return!1;const et=Ve.items[se??Ve.selectedIndex];return et?(de.dispatch({changes:{from:Ve.from,to:Ve.to,insert:et.apply},selection:{anchor:Ve.from+et.apply.length},scrollIntoView:!0}),de.focus(),!0):!1},[]),[ve,ze]=f.useState(!1);f.useEffect(()=>{const se=H.current,de=se?se.state.doc.toString():V,Ve=Pp(de,b!=null&&b.isVisible?b.suggestion:null);ze(de.trim().length>0||!!Ve||ue.length>0||_e.length>0)},[ue,_e,V,b==null?void 0:b.isVisible,b==null?void 0:b.suggestion]);const lt=dq(),_t=dq("qwen-web-shell-command-history"),{push:Xt,navigateUp:rs,navigateDown:fs,isNavigating:gs,reset:Ps,getReverseMatches:mr,getLastEntry:Ri,resetSearch:si}=lt,cr=f.useRef({push:Xt,navigateUp:rs,navigateDown:fs,isNavigating:gs,reset:Ps,getReverseMatches:mr,getLastEntry:Ri,resetSearch:si});cr.current={push:Xt,navigateUp:rs,navigateDown:fs,isNavigating:gs,reset:Ps,getReverseMatches:mr,getLastEntry:Ri,resetSearch:si};const Jn=f.useRef(_t);Jn.current=_t,$t.current=_e;const Ln=f.useCallback(se=>{const de=ge.current,et=(de?Jn.current:cr.current).getReverseMatches(se);return de?et:et.filter(Cn=>!Cn.trimStart().startsWith("/"))},[]),Vn=f.useCallback(()=>{if(z.current)return;const se=H.current;if(!se&&!M)return;Cs(),Sn();const de=se?se.state.doc.toString():re.current;Kn.current=de,Re(!0),Ie("");const Ve=ge.current?Jn.current:cr.current;Ee(Ln("")),Je(0),Ve.resetSearch(),setTimeout(()=>{var et;return(et=Qe.current)==null?void 0:et.focus()},0)},[Sn,Cs,Ln,M]),Hi=f.useRef(Vn);Hi.current=Vn;const Di=f.useCallback(()=>{if(z.current)return;const se=H.current;if(!se)return;if(Rl(se.state)==="active"){Gf(!1)(se),se.focus();return}if(se.state.doc.lines>1){se.focus();return}const de=ge.current?Jn.current:cr.current,Ve=se.state.doc.toString(),et=de.navigateUp(Ve);et!==null&&(ge.current||gt(),Qn(se,et)),se.focus()},[gt,Qn]),Mo=f.useCallback(()=>{if(z.current)return;const se=H.current;if(!se)return;if(Rl(se.state)==="active"){Gf(!0)(se),se.focus();return}if(se.state.doc.lines>1){se.focus();return}const de=ge.current?Jn.current:cr.current,Ve=de.navigateDown();if(Ve!==null){const et=!ge.current&&!de.isNavigating();Qn(se,Ve),et&&Ae()}se.focus()},[Qn,Ae]),ns=f.useCallback(se=>{ae(se.target.value)},[ae]);f.useEffect(()=>{if(!M)return;const se=ee.current;if(se&&(se.style.height="auto",se.scrollHeight>0)){const de=parseFloat(getComputedStyle(se).maxHeight),Ve=Number.isFinite(de)&&de>0?Math.min(se.scrollHeight,de):se.scrollHeight;se.style.height=`${Ve}px`}},[M,V]);const Rr=f.useCallback(se=>{var et;const de=(et=se.clipboardData)==null?void 0:et.items;if(!de)return;Cq(de,Cn=>ft(Lt=>[...Lt,Cn]))&&se.preventDefault()},[]),pr=(se,de,Ve,et=!1)=>{const Cn=Ve===void 0&&se?Tze(se):[],Lt=se?se.state.doc.toString():re.current,Rn=ut.current,Pn=de===void 0&&!et&&Cn.length===0&&(Rn!=null&&Rn.isVisible)?Pp(Lt,Rn.suggestion):null,bs=de??Pn??Lt,Fs=bs.length-bs.trimStart().length,Ts=bs.trim(),gr=de===void 0&&Pn===null?Cn.map(Bn=>({...Bn,start:Bn.start-Fs,end:Bn.end-Fs})).filter(Bn=>Bn.end>0).map(Bn=>({...Bn,start:Math.max(0,Bn.start)})):[],Ns=Ve??Bt.current;if(!Ts&&Ns.length===0&&Cn.length===0)return!0;const qi=Ve===void 0?kze(Ts,gr):Ts,ys=vze(pe.current,qi),Go=wze(ys,Ns),Tr=$t.current,vt=ge.current,Ye=vt?`!${Go}`:Go,Ht=Pbe(Ye,[...Ns,...gr.map(Bn=>Bn.tag)]);let zt=!1;const qt=()=>{var Bn,Ms;zt||(zt=!0,Wn(null),Pn&&((Bn=Et.current)==null||Bn.call(Et,"enter",{skipOnAccept:!0})),(Ms=st.current)==null||Ms.call(st),pe.current.clear(),Be.current=1,vt?(Jn.current.push(ys),Jn.current.reset()):(cr.current.push(ys),cr.current.reset()),ts.current=!1,kn(),Wt([]),ft([]),se?se.dispatch({changes:{from:0,to:se.state.doc.length,insert:""},effects:Qc.of()}):ae(""))};return K.current(Ye,Tr.length>0?[...Tr]:void 0,qt,Ht.length>0?{inputAnnotations:Ht}:void 0)===!1||qt(),!0};Gn.current=pr,f.useEffect(()=>{var Tr,vt;if(!U.current)return;const se=q??document.body;bq(yq(se));const de=document.createElement("div");Z.current=de,de.setAttribute("data-web-shell-tooltip-portal",""),de.style.position="fixed",de.style.inset="0",de.style.zIndex="var(--web-shell-tooltip-z-index)",de.style.pointerEvents="none";const Ve=/\b\S*theme(?:Dark|Light)\S*/gi,et=()=>{var zt,qt;let Ye=U.current,Ht=null;if(U.current){const Fn=getComputedStyle(U.current);for(let Bn=0;Bn<Fn.length;Bn+=1){const Ms=Fn[Bn];Ms.startsWith("--")&&de.style.setProperty(Ms,Fn.getPropertyValue(Ms))}Fn.getPropertyValue("--web-shell-tooltip-z-index").trim()||de.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;Ye;){const Fn=(qt=(zt=Ye.className)==null?void 0:zt.match)==null?void 0:qt.call(zt,Ve);if(Fn){Ht=Fn[0];break}Ye=Ye.parentElement}Ht&&(de.className=Ht)};et(),se.appendChild(de);const Cn=new MutationObserver(et);let Lt=U.current;for(;Lt&&(Cn.observe(Lt,{attributes:!0,attributeFilter:["class","style"]}),!((vt=(Tr=Lt.className)==null?void 0:Tr.match)!=null&&vt.call(Tr,Ve)));)Lt=Lt.parentElement;const Rn=(Ye,Ht,zt,qt=!1)=>Gn.current(Ye,Ht,zt,qt),Pn=Ye=>(Ye.dispatch(Ye.state.replaceSelection(`
`)),!0),bs=(Ye,Ht)=>{var Bn;const zt=ut.current,qt=zt==null?void 0:zt.suggestion,Fn=Pp(Ye.state.doc.toString(),qt);return!(zt!=null&&zt.isVisible)||!Fn?!1:(Ye.dispatch({changes:{from:0,to:Ye.state.doc.length,insert:Fn},selection:{anchor:Fn.length},scrollIntoView:!0}),Ye.focus(),(Bn=Et.current)==null||Bn.call(Et,Ht,{skipOnAccept:!0}),!0)},Fs=bb.of([{key:"Backspace",run:Ye=>{var Fn;const Ht=Ye.state.selection.main;if(!Ht.empty||Ht.from!==0)return!1;let zt=!1;if(Ye.state.field(Pf).between(0,1,Bn=>{Bn===0&&(zt=!0)}),zt)return!1;let qt=-1;for(let Bn=Bt.current.length-1;Bn>=0;Bn-=1)if(((Fn=Bt.current[Bn])==null?void 0:Fn.removable)!==!1){qt=Bn;break}return qt<0?!1:(Wt(Bn=>Bn.filter((Ms,Lr)=>Lr!==qt)),!0)}},{key:"Delete",run:Ye=>{const Ht=Ye.state.selection.main;if(!Ht.empty||Ht.from!==0)return!1;let zt=!1;if(Ye.state.field(Pf).between(0,1,Fn=>{Fn===0&&(zt=!0)}),zt)return!1;const qt=Bt.current.findIndex(Fn=>Fn.removable!==!1);return qt<0?!1:(Wt(Fn=>Fn.filter((Bn,Ms)=>Ms!==qt)),!0)}},{key:"Enter",run:Ye=>{var Fn;if(Rt.accept())return!0;if(os.current)return Jr();if(Rl(Ye.state)==="active")return!1;const Ht=ut.current,qt=vq(Ye).length>0?null:Pp(Ye.state.doc.toString(),Ht==null?void 0:Ht.suggestion);return Ht!=null&&Ht.isVisible&&qt?((Fn=Et.current)==null||Fn.call(Et,"enter",{skipOnAccept:!0}),Rn(Ye,qt)):Rn(Ye)}},{key:"Shift-Enter",run:Pn},{key:"Ctrl-j",run:Pn},{key:"Mod-Enter",run:Pn},{key:"Alt-Enter",run:Pn},{key:"Escape",run:()=>Ur()?!0:os.current?(Cs(),!0):ge.current?(vn(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:Ye=>{var Ms;const Ht=ge.current?Jn.current:cr.current;if(ts.current)hS(Ye),Cs(),Sn();else{if(Rt.moveSelection("up")||Ii("up"))return!0;if(Rl(Ye.state)==="active")return Gf(!1)(Ye)}const qt=Sq(Ye,"up");if(qt==="handled")return!0;if(qt==="editor")return!1;if(ge.current){const Lr=Ye.state.doc.toString(),Io=Ht.navigateUp(Lr);return Io===null||(ts.current=!0,Qn(Ye,Io)),!0}if(Ce.current.length>0&&(Ms=Ke.current)!=null&&Ms.call(Ke))return!0;const Fn=Ye.state.doc.toString(),Bn=Ht.navigateUp(Fn);return Bn===null?!1:(gt(),ts.current=!0,Qn(Ye,Bn),!0)}},{key:"ArrowDown",run:Ye=>{var Ms;const Ht=ge.current?Jn.current:cr.current;if(ts.current)hS(Ye),Cs(),Sn();else{if(Rt.moveSelection("down")||Ii("down"))return!0;if(Rl(Ye.state)==="active")return Gf(!0)(Ye)}const qt=Sq(Ye,"down");if(qt==="handled")return!0;if(qt==="editor")return!1;if(ge.current){const Lr=Ht.navigateDown();return Lr===null||(ts.current=Ht.isNavigating(),Qn(Ye,Lr)),!0}const Fn=Ht.navigateDown();if(Fn===null)return((Ms=xt.current)==null?void 0:Ms.call(xt))??!1;const Bn=!Ht.isNavigating();return ts.current=!Bn,Qn(Ye,Fn),Bn&&Ae(),!0}},{key:"Ctrl-r",run:()=>(Hi.current(),!0)},{key:"Tab",run:Ye=>{if(Rt.accept()||bs(Ye,"tab"))return!0;if(os.current)return Jr();if(Rl(Ye.state)==="active")return noe(Ye);const Ht=Ye.state.doc.toString(),zt=xBe(Ht,X.current,He.current);if(zt)return Ye.dispatch({changes:{from:0,to:Ye.state.doc.length,insert:zt},selection:{anchor:zt.length}}),!0;const qt=vBe(Ht,X.current);return qt&&Ye.dispatch({changes:{from:0,to:Ye.state.doc.length,insert:qt},selection:{anchor:qt.length}}),!0}},{key:"ArrowRight",run:Ye=>!!(Rl(Ye.state)!=="active"&&bs(Ye,"right"))},{key:"Shift-Tab",run:()=>{var Ye;return(Ye=le.current)==null||Ye.call(le),!0}}]),Ts=Pt.updateListener.of(Ye=>{if(Ye.docChanged&&pe.current.size>0){const zt=yze(pe.current,Ye.state.doc.toString());zt!==null&&(Be.current=zt)}Ye.transactions.some(zt=>zt.isUserEvent("input")||zt.isUserEvent("delete"))&&(ts.current=!1),(Ye.docChanged||Ye.selectionSet)&&(lr(Ye.view),ts.current?Sn():gn(Ye.view)&&Cs())});let gr=!1;const Ns=Pt.updateListener.of(Ye=>{const Ht=Dt.current,zt=Rl(Ye.state)==="active";if(Ht){const qt=Ye.state.doc;if(!(qt.length===Ht.from+Ht.text.length&&qt.sliceString(Ht.from)===Ht.text))Dt.current=null;else if(gr&&!zt){Dt.current=null;const{view:Bn}=Ye,{from:Ms}=Ht;window.setTimeout(()=>{if(H.current!==Bn)return;const Lr=Bn.state.doc;Lr.length===Ms+Ht.text.length&&Lr.sliceString(Ms)===Ht.text&&Bn.dispatch({changes:{from:Ms,to:Ms+Ht.text.length,insert:""}})},0)}}gr=zt,zt||uze(de)}),qi=nr.create({doc:"",extensions:[Jm.highest(Fs),F$e,LR(),bb.of([...$R,...PR]),aoe({override:[],activateOnTyping:!0,icons:!1,optionClass:Ye=>{const Ht=[];return Ye.type==="file"&&Ht.push("cm-file-completion"),JR(Ye)&&Ht.push("cm-command-info-completion"),Ht.join(" ")},addToOptions:[{render:fze,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(Ye,Ht,zt,qt,Fn)=>{const Bn=qt.bottom-qt.top,Ms=Fn.bottom-Ht.bottom,Lr=Ms>=Bn||Ms>Ht.top,Io=Lr?"top":"bottom",_i=Lr?zt.bottom-Ht.top:Ht.bottom-zt.top;return{style:`${Io}: ${_i}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:Ye=>typeof Ye.apply=="string"&&Ye.apply.endsWith(" ")}),SDe({parent:de}),wq.of(pH("")),kq.of(_q(null)),Pt.lineWrapping,xq.of(Pt.editable.of(!0)),nze(()=>X.current,()=>He.current),sze,Pf,Ts,Ns,Pt.updateListener.of(Ye=>{var Ht;if(Ye.docChanged){const zt=Ye.state.doc.toString();(Ht=Y.current)==null||Ht.call(Y,zt);const qt=ut.current,Fn=Pp(zt,qt!=null&&qt.isVisible?qt.suggestion:null);ze(zt.trim().length>0||!!Fn||Bt.current.length>0||$t.current.length>0)}}),Pt.inputHandler.of((Ye,Ht,zt,qt)=>{var Fn;return qt==="!"&&Ye.state.doc.toString()===""&&Rl(Ye.state)!=="active"?(Ue(),!0):qt==="?"&&Ye.state.doc.toString()===""&&Rl(Ye.state)!=="active"?((Fn=te.current)==null||Fn.call(te),!0):!1}),Pt.domEventHandlers({blur(Ye){return Cs(),Ye.relatedTarget instanceof Element&&Ye.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const Ht=H.current;Ht!=null&&Ht.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||Sn()},0),!1},paste(Ye){var Lr,Io,_i,ls;const Ht=(Lr=Ye.clipboardData)==null?void 0:Lr.items;if(!Ht)return!1;if(Cq(Ht,Ss=>ft(Xs=>[...Xs,Ss])))return Ye.preventDefault(),!0;const qt=mze(((Io=Ye.clipboardData)==null?void 0:Io.getData("text/plain"))??"");if(!qt||!pze(qt))return!1;Ye.preventDefault(),ys.state.doc.toString()===""&&((_i=ut.current)!=null&&_i.isVisible)&&((ls=st.current)==null||ls.call(st));const{placeholderText:Fn,nextPasteId:Bn}=bze(pe.current,Be.current,qt);Be.current=Bn;const Ms=ys.state.selection.main;return ys.dispatch({changes:{from:Ms.from,to:Ms.to,insert:Fn},selection:{anchor:Ms.from+Fn.length},scrollIntoView:!0}),!0}}),Pt.theme(L)]}),ys=new Pt({state:qi,parent:U.current});H.current=ys,_v()||ys.focus();const Go=ys.state.doc.toString().trim();return ze(Go.length>0||Bt.current.length>0||$t.current.length>0),()=>{ys.dispatch({effects:Qc.of()}),ys.destroy(),H.current=null,Cn.disconnect(),de.remove(),Z.current=null}},[]),f.useEffect(()=>{const se=Z.current;if(!se)return;const de=q??document.body;bq(yq(de)),de.appendChild(se)},[q]),f.useEffect(()=>{const se=H.current;se&&(se.dispatch({effects:xq.reconfigure(Pt.editable.of(!i))}),!i&&!_v()&&se.focus())},[i]);const Cr=!i&&(b!=null&&b.isVisible)&&b.suggestion?b.suggestion:null,Fe=Cr??(Le?$("editor.shellPlaceholder"):o);f.useEffect(()=>{const se=H.current;se&&se.dispatch({effects:[wq.reconfigure(pH(Fe)),kq.reconfigure(_q(Cr))]})},[Fe,Cr]),f.useEffect(()=>{const se=H.current;!se||Rl(se.state)!=="active"||(hS(se),window.setTimeout(()=>{H.current===se&&dS(se)},0))},[A]);const xn=[a.map(se=>{var de;return[se.name,se.description??"",se.source??"",se.displayCategory??"",se.argumentHint??"",((de=se.subcommands)==null?void 0:de.join(","))??""].join("\0")}).join(""),c.map(se=>[se.name,se.description].join("\0")).join(""),(u==null?void 0:u.join("|"))??""].join("");f.useEffect(()=>{os.current&&lr(H.current)},[xn,A,lr]),f.useEffect(()=>{const se=H.current;se&&(g?(Cs(),Sn(),se.contentDOM.blur()):_v()||se.focus())},[Sn,g,Cs]),f.useEffect(()=>{const se=de=>{var Fs,Ts,gr;if(z.current||De||g||de.defaultPrevented)return;const Ve=de.target,et=(Fs=U.current)==null?void 0:Fs.contains(Ve),Cn=document.activeElement===document.body;if(!et&&!Cn)return;const Lt=H.current,Rn=ut.current,Pn=Pp((Lt==null?void 0:Lt.state.doc.toString())??"",Rn==null?void 0:Rn.suggestion);if(Lt&&!Lt.hasFocus&&(Rn!=null&&Rn.isVisible)&&Pn&&!N0(de.target)){if(de.key==="Tab"&&!de.shiftKey&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&Rl(Lt.state)!=="active"){de.preventDefault(),Lt.dispatch({changes:{from:0,to:Lt.state.doc.length,insert:Pn},selection:{anchor:Pn.length},scrollIntoView:!0}),Lt.focus(),(Ts=Et.current)==null||Ts.call(Et,"tab",{skipOnAccept:!0});return}if(de.key==="ArrowRight"&&!de.shiftKey&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&Rl(Lt.state)!=="active"){de.preventDefault(),Lt.dispatch({changes:{from:0,to:Lt.state.doc.length,insert:Pn},selection:{anchor:Pn.length},scrollIntoView:!0}),Lt.focus(),(gr=Et.current)==null||gr.call(Et,"right",{skipOnAccept:!0});return}}if(de.metaKey||de.ctrlKey||de.altKey||de.key.length!==1||N0(de.target)||!Lt||Lt.hasFocus)return;if(de.preventDefault(),de.key==="!"&&Lt.state.doc.toString()===""){Ue();return}const bs=Lt.state.selection.main;Lt.dispatch({changes:{from:bs.from,to:bs.to,insert:de.key},selection:{anchor:bs.from+de.key.length},scrollIntoView:!0}),Lt.focus(),de.key==="/"?window.setTimeout(()=>{lr(H.current)},0):de.key==="@"&&window.setTimeout(()=>{const Ns=H.current;Ns&&Ns.hasFocus&&(Cs(),gn(Ns))},0)};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[gn,Cs,De,g,lr,Ue]);const kt=f.useCallback(()=>{var se,de;if(M){(se=ee.current)==null||se.focus();return}(de=H.current)==null||de.focus()},[M]),ms=f.useCallback((se,de)=>{var Fs;if(M){if(se)if((de==null?void 0:de.mode)==="replace")ae(se);else{const Ts=ee.current,gr=re.current,Ns=Ts?Ts.selectionStart:gr.length,qi=Ts?Ts.selectionEnd:gr.length,ys=Ns+se.length;ae(gr.slice(0,Ns)+se+gr.slice(qi));const Go=()=>{var Tr;(Tr=ee.current)==null||Tr.setSelectionRange(ys,ys)};typeof requestAnimationFrame=="function"?requestAnimationFrame(Go):window.setTimeout(Go,0)}(Fs=ee.current)==null||Fs.focus();return}const Ve=H.current;if(!Ve||!se){Ve==null||Ve.focus();return}if((de==null?void 0:de.mode)==="replace"){Ve.dispatch({changes:{from:0,to:Ve.state.doc.length,insert:se},effects:Qc.of(),selection:{anchor:se.length},scrollIntoView:!0}),Ve.focus();return}const et=Ve.state.selection.main;let Cn=se,Lt=!1,Rn=null;const Pn=se==="@";let bs=se==="/";if(se==="/")Ve.state.doc.lineAt(et.head).text.startsWith("/")?Lt=!0:Ve.state.doc.length>0&&(Lt=!0,bs=!1);else if(se==="@"){const Ts=et.from>0?Ve.state.doc.sliceString(et.from-1,et.from):"";Ve.state.doc.sliceString(et.from,et.from+1)==="@"?(Lt=!0,Rn=et.from+1):Ts==="@"?Lt=!0:Ts&&!/\s/.test(Ts)&&(Cn=" @")}Lt?Rn!==null&&Ve.dispatch({selection:{anchor:Rn},scrollIntoView:!0}):(Ve.dispatch({changes:{from:et.from,to:et.to,insert:Cn},selection:{anchor:et.from+Cn.length},scrollIntoView:!0}),Pn&&(Dt.current={text:Cn,from:et.from})),Ve.focus(),bs?window.setTimeout(()=>{lr(H.current)},0):Pn&&window.setTimeout(()=>{const Ts=H.current;Ts&&Ts.hasFocus&&(Cs(),gn(Ts))},0)},[Cs,M,gn,lr,ae]),In=f.useCallback(()=>{var se;return M?re.current:((se=H.current)==null?void 0:se.state.doc.toString())??""},[M]),we=f.useCallback(se=>{if(M){ae(se);return}const de=H.current;de&&(de.dispatch({changes:{from:0,to:de.state.doc.length,insert:se},effects:Qc.of(),selection:{anchor:se.length},scrollIntoView:!0}),de.focus())},[M,ae]),We=f.useCallback(se=>{const de=H.current;if(!de)return;const Ve=[];de.state.field(Pf).between(0,de.state.doc.length,(et,Cn,Lt)=>{const Rn=Lt.spec.tag;Rn&&(!se||se(Rn))&&Ve.push({from:et,to:Cn,insert:""})}),Ve.length!==0&&de.dispatch({changes:Ve,effects:eD.of({predicate:se}),scrollIntoView:!0})},[]),St=f.useCallback(se=>{const de=(se==null?void 0:se.text)??!0,Ve=(se==null?void 0:se.tags)??!0,et=H.current;de&&et&&et.state.doc.length>0&&et.dispatch({changes:{from:0,to:et.state.doc.length,insert:""},effects:Qc.of()}),de&&M&&ae(""),de&&(ft([]),pe.current.clear(),Be.current=1),Ve&&(Wt([]),de||We())},[M,We,ae]),fn=f.useCallback(()=>{St({text:!0,tags:!1})},[St]),Ct=f.useCallback((se,de)=>{if(se.length!==0){if((de==null?void 0:de.placement)==="inline"&&!M){const Ve=H.current;if(!Ve)return;const et=Ve.state.selection.main;let Cn=et.from;const Lt=[],Rn=se.map(bs=>{const Fs=ax(bs);return Lt.push({from:Cn,to:Cn+Fs.length,tag:bs}),Cn+=Fs.length+1,Fs}).join(" "),Pn=Rn?`${Rn} `:"";Ve.dispatch({changes:{from:et.from,to:et.to,insert:Pn},effects:Lt.length>0?Lt.map(bs=>Zg.of({...bs,tag:Me(bs.tag)})):void 0,selection:{anchor:et.from+Pn.length},scrollIntoView:!0}),Ve.focus();return}Wt(Ve=>{const et=[...Ve];for(const Cn of se){const Lt=et.findIndex(Rn=>Rn.id===Cn.id);Lt>=0?et[Lt]=Cn:et.push(Cn)}return et})}},[M,Me]),$n=f.useCallback(se=>{Wt(de=>{const Ve=de.filter(et=>et.id!==se||et.removable===!1);return Ve.length===de.length?de:Ve}),We(de=>de.id===se&&de.removable!==!1)},[We]),as=f.useCallback(()=>{var de;return(M?re.current:((de=H.current)==null?void 0:de.state.doc.toString())??"").trim().length>0||Bt.current.length>0||$t.current.length>0},[M]),Rs=f.useCallback(se=>{const de=H.current;if(!de&&!M)return;const Ve=de?vq(de):[];if((se==null?void 0:se.tagPlacement)==="inline"){Gn.current(de,se.text??"",se.tags??Ve);return}if((se==null?void 0:se.text)!==void 0&&se.tags===void 0&&Ve.length>0){Gn.current(de,se.text,Ve);return}Gn.current(de,se==null?void 0:se.text,se?se.tags??[]:void 0)},[M]),ki=f.useCallback(()=>{const se=cr.current.getLastEntry(Ve=>!Ve.startsWith("/")&&!Ve.startsWith("!"));!se||K.current(se)===!1||ft([])},[]),zs=f.useCallback(se=>{if(M){ae(se);return}const de=H.current;de&&de.dispatch({changes:{from:0,to:de.state.doc.length,insert:se},selection:{anchor:se.length},scrollIntoView:!0})},[M,ae]);f.useEffect(()=>{const se=es.current;if(!se)return;const de=H.current;if(!de&&!M)return;const Ve=se.tagPlacement??"top";if(se.tags!==void 0&&Ve==="top"&&Wt([...se.tags]),!de){se.tags!==void 0&&Ve==="inline"&&Wt([...se.tags]),se.text!==void 0&&ae(se.text);let Cn=null;return se.submit&&(Cn=window.setTimeout(()=>{Rs(se)},0)),()=>{Cn!==null&&window.clearTimeout(Cn)}}if(se.text!==void 0||Ve==="inline"){const Cn=Ve==="inline"?[...se.tags??[]]:[],Lt=Cn.map(ax).join(" "),Rn=Ve==="inline"?Lt&&se.text?`${Lt} ${se.text}`:Lt||(se.text??""):se.text??"",Pn=[Qc.of()];if(Cn.length>0){let bs=0;for(const Fs of Cn){const Ts=ax(Fs);Pn.push(Zg.of({from:bs,to:bs+Ts.length,tag:Me(Fs)})),bs+=Ts.length+1}}de.dispatch({changes:{from:0,to:de.state.doc.length,insert:Rn},effects:Pn,selection:{anchor:Rn.length},scrollIntoView:!0})}else de.dispatch({effects:Qc.of()});(se.text!==void 0||se.submit)&&!_v()&&de.focus();let et=null;return se.submit&&(et=window.setTimeout(()=>{H.current&&Rs(se)},0)),()=>{et!==null&&window.clearTimeout(et)}},[k,M,Me,ae,Rs]);const Yn=f.useCallback((se,de=!0)=>{var et;se&&zs(Kn.current),Re(!1),Ie(""),Ee([]),Je(0),(ge.current?Jn.current:cr.current).resetSearch(),de&&((et=H.current)==null||et.focus())},[zs]);f.useEffect(()=>{if(!De)return;const se=de=>{if(de instanceof MouseEvent&&de.button!==0||de.defaultPrevented)return;const Ve=cn.current,et=de.target;Ve&&et instanceof Node&&!Ve.contains(et)&&Yn(!0,!1)};return window.addEventListener("mousedown",se),window.addEventListener("touchstart",se),()=>{window.removeEventListener("mousedown",se),window.removeEventListener("touchstart",se)}},[De,Yn]);const or=f.useCallback(se=>{var Lt;const de=H.current;if(!de&&!M)return;if(Yn(!1),!ge.current){jr(se),Gn.current(de,void 0,void 0,!0);return}const Ve=se.trim();if(!Ve)return;const et=$t.current;if(K.current(`!${Ve}`,et.length>0?[...et]:void 0)===!1){jr(se);return}(Lt=st.current)==null||Lt.call(st),Jn.current.push(Ve),Jn.current.reset(),ft([]),zs("")},[Yn,M,zs,jr]),ur=se=>{if(!se.nativeEvent.isComposing)if(se.key==="Escape")se.preventDefault(),Yn(!0);else if(se.key==="Tab"){se.preventDefault();const de=ne[qe];de&&jr(de),Yn(!1)}else if(se.key==="Enter"){se.preventDefault();const de=ne[qe];de?or(de):Yn(!1)}else se.key==="r"&&se.ctrlKey&&(se.preventDefault(),ne.length>0&&Je(de=>(de+1)%ne.length))},Dr=se=>{const de=ge.current?Jn.current:cr.current;Ee(Ln(se)),Je(0),de.resetSearch()},ri=se=>{const de=se.target.value;Ie(de),!se.nativeEvent.isComposing&&Dr(de)},ua=se=>{const de=se.currentTarget.value;Ie(de),Dr(de)},Ya=f.useCallback(se=>{ft(de=>de.filter((Ve,et)=>et!==se))},[]),go=!Le&&!De&&!(b!=null&&b.isVisible)&&!i&&!g,Xa=f.useCallback(se=>{ft(de=>[...de,...se])},[]),di=f.useMemo(()=>({clearText:fn,clear:St,focus:kt,getText:In,hasInput:as,setText:we,addTags:Ct,removeTag:$n,insertText:ms,retryLast:ki,restoreImages:Xa,submit:Rs}),[Ct,St,fn,kt,In,as,ms,$n,Xa,ki,we,Rs]);return{containerRef:U,viewRef:H,mobileComposer:M?{textareaRef:ee,value:V,onChange:ns,onPaste:Rr,placeholder:Fe}:null,focus:kt,submitText:f.useCallback(()=>{const se=H.current;!se&&!M||Gn.current(se)},[M]),clearText:fn,getText:In,hasInput:as,hasContent:ve,handle:di,pastedImages:_e,removeImage:Ya,composerTags:ue,removeTopTag:$n,addTags:Ct,removeInlineTags:We,insertText:ms,setText:we,submit:Rs,clear:St,retryLast:ki,replaceEditorText:zs,shellMode:Le,setShellMode:vn,toggleShellMode:Ue,currentMode:m,sessionName:v,searchState:{searchMode:De,searchQuery:be,searchMatches:ne,searchActiveIndex:qe,searchInputRef:Qe,searchUiRef:cn,openHistorySearch:Vn,closeSearch:Yn,submitSearchMatch:or,restoreSearchMatch:jr,handleSearchKeyDown:ur,handleSearchInput:ri,handleSearchCompositionEnd:ua},navigatePrevHistory:Di,navigateNextHistory:Mo,showShortcutHints:go,followupState:b,disabled:i,onAcceptFollowup:x,onDismissFollowup:y,slashMenu:ps,closeSlashMenu:Cs,selectSlashCompletion:js,acceptSlashCompletion:Jr,atMenu:Rt.state,closeAtMenu:Sn,selectAtCompletion:Rt.select,acceptAtCompletion:Rt.accept,enterAtCategory:Rt.enterCategory,backAtCategories:Rt.backToCategories,updateAtSearch:Rt.updateSearch,selectAtTab:Rt.selectTab}}const Nze="_flash_96ig5_1",Lm={flash:Nze},Mze="_chatMessageRow_17pz3_41",Ize="_chatBubble_17pz3_48",Rze="_chatContent_17pz3_61",Dze="_messageTag_17pz3_66",Lze="_messageTagTooltip_17pz3_83",Pze="_messageTagClickable_17pz3_117",Oze="_messageTagIcon_17pz3_127",$ze="_messageTagLabel_17pz3_138",Bze="_messageTagValue_17pz3_139",zze="_chatContentCollapsed_17pz3_162",Fze="_toggleButton_17pz3_167",Hze="_toggleIcon_17pz3_188",qze="_toggleIconExpanded_17pz3_195",Uze="_chatImages_17pz3_199",Wze="_chatImageThumb_17pz3_206",pa={chatMessageRow:Mze,chatBubble:Ize,chatContent:Rze,messageTag:Dze,messageTagTooltip:Lze,messageTagClickable:Pze,messageTagIcon:Oze,messageTagLabel:$ze,messageTagValue:Bze,chatContentCollapsed:zze,toggleButton:Fze,toggleIcon:Hze,toggleIconExpanded:qze,chatImages:Uze,chatImageThumb:Wze};function Vze({composerTagIcons:e,content:t,inputAnnotations:n,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i}){const o=f.useMemo(()=>oX(t,n),[t,n]);return l.jsx(l.Fragment,{children:o.map((a,c)=>a.type==="text"?l.jsx(f.Fragment,{children:a.text},c):l.jsx(tD,{composerTagIcons:e,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i,tag:a.tag,title:a.tag.serialized,preserveCustomKindLabel:!0},`${a.tag.id}:${c}`))})}const Gze=f.memo(function({content:t,images:n,inputAnnotations:s,isLocateFlashing:r=!1}){const{t:i}=at(),{parseUserMessageContent:o,renderUserMessageContent:a,composerTagIcons:c,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:h}=mu(),m=f.useRef(null),[p,g]=f.useState(!1),[b,x]=f.useState(!1),y=f.useMemo(()=>{const w=a==null?void 0:a({content:t,images:n,inputAnnotations:s});if(w!=null)return w;if(s&&s.length>0)return l.jsx(Vze,{composerTagIcons:c,content:t,inputAnnotations:s,onComposerTagClick:h,renderComposerTag:u,renderComposerTagTooltip:d});const k=A9(t,o,"[WebShell] failed to parse user message content");return k?k.map((T,C)=>T.type==="text"?T.text:l.jsx(tD,{tag:T.tag,composerTagIcons:c,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:h},`${T.tag.id}-${C}`)):t},[t,n,s,h,o,c,u,d,a]),v=f.useCallback(()=>{const w=m.current;w&&x(w.scrollHeight>400)},[]);return f.useLayoutEffect(()=>{g(!1),v()},[t,n==null?void 0:n.length,v]),f.useEffect(()=>{const w=m.current;if(!w||typeof ResizeObserver>"u")return;const k=new ResizeObserver(v);return k.observe(w),()=>k.disconnect()},[v]),l.jsx("div",{className:pa.chatMessageRow,children:l.jsxs("div",{className:`${pa.chatBubble}${r?` ${Lm.flash}`:""}`,children:[l.jsxs("div",{ref:m,className:`${pa.chatContent} ${b&&!p?pa.chatContentCollapsed:""}`,children:[n&&n.length>0&&l.jsx("div",{className:pa.chatImages,children:n.map((w,k)=>{const T=w.data.startsWith("data:")?w.data:`data:${w.mimeType};base64,${w.data}`;return Xb(T)?l.jsx("img",{src:T,alt:i("user.uploadedImage",{index:k+1}),className:pa.chatImageThumb,onLoad:v},k):null})}),y]}),b&&l.jsxs("button",{type:"button",className:pa.toggleButton,onClick:()=>g(w=>!w),children:[l.jsx("span",{children:i(p?"userMessage.showLess":"userMessage.showMore")}),l.jsx("svg",{className:`${pa.toggleIcon} ${p?pa.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})});function Kze(e){return ZR(e)}function tD({tag:e,composerTagIcons:t,renderComposerTag:n,renderComposerTagTooltip:s,onComposerTagClick:r,title:i,preserveCustomKindLabel:o=!1}){const a={tag:e,placement:"user-message",readonly:!0};let c,u;try{c=n==null?void 0:n(a)}catch(v){console.warn("[WebShell] user message tag render failed",v)}try{u=s==null?void 0:s(a)}catch(v){console.warn("[WebShell] user message tag tooltip render failed",v)}const d=!!r,h=o?Obe(e,t):null,m=LT(e),p=(h==null?void 0:h.tagValue)??PT(e),g=(h==null?void 0:h.tagLabel)??(e.kind?"":m),b=(h==null?void 0:h.fallback)??e.id,x=e.icon??(h==null?void 0:h.iconUrl)??z0(e.kind,t),y=x&&(N9(x)||Xb(x))?x:void 0;return l.jsxs("span",{className:`${pa.messageTag}${d?` ${pa.messageTagClickable}`:""}`,role:d?"button":void 0,tabIndex:d?0:void 0,title:i??Kze(e),onClick:v=>{d&&(v.stopPropagation(),r==null||r({...a,anchorRect:v.currentTarget.getBoundingClientRect()}))},onKeyDown:v=>{d&&(v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),r==null||r({...a,anchorRect:v.currentTarget.getBoundingClientRect()})))},children:[c??l.jsxs(l.Fragment,{children:[y&&l.jsx("span",{className:pa.messageTagIcon,style:Kf("--user-message-tag-icon-url",y),"aria-hidden":"true"}),g&&l.jsx("span",{className:pa.messageTagLabel,children:g}),p?l.jsx("span",{className:pa.messageTagValue,children:p}):g?null:l.jsx("span",{className:pa.messageTagLabel,children:b})]}),u!=null&&l.jsx("span",{className:pa.messageTagTooltip,role:"tooltip",children:u})]})}const Yze="_message_nn1j4_1",Xze="_customFooter_nn1j4_7",Qze="_messageFooter_nn1j4_11",Jze="_copyButton_nn1j4_27",Zze="_footerTime_nn1j4_53",eFe="_thinking_nn1j4_65",tFe="_thinkingBody_nn1j4_77",nFe="_thinkingHeader_nn1j4_108",sFe="_thinkingSummary_nn1j4_120",rFe="_translateButton_nn1j4_136",iFe="_thinkingHeaderExpanded_nn1j4_147",oFe="_translationPopover_nn1j4_154",aFe="_translationTitle_nn1j4_159",lFe="_translationContent_nn1j4_164",cFe="_translationPending_nn1j4_171",uFe="_translationError_nn1j4_175",dFe="_translationFooter_nn1j4_179",hFe="_translationUsage_nn1j4_189",fFe="_translationActions_nn1j4_196",mFe="_thinkingSummaryTextActive_nn1j4_211",pFe="_thinkingSummaryIcon_nn1j4_218",gFe="_thinkingSummaryText_nn1j4_211",bFe="_thinkingChevronRight_nn1j4_275",yFe="_thinkingChevronDown_nn1j4_276",vFe="_thinkingExpandedWrap_nn1j4_339",xFe="_thinkingExpandedClip_nn1j4_343",wFe="_thinkingExpandedInner_nn1j4_350",kFe="_content_nn1j4_398",_Fe="_contentBody_nn1j4_403",hr={message:Yze,customFooter:Xze,messageFooter:Qze,copyButton:Jze,footerTime:Zze,thinking:eFe,thinkingBody:tFe,thinkingHeader:nFe,thinkingSummary:sFe,translateButton:rFe,thinkingHeaderExpanded:iFe,translationPopover:oFe,translationTitle:aFe,translationContent:lFe,translationPending:cFe,translationError:uFe,translationFooter:dFe,translationUsage:hFe,translationActions:fFe,thinkingSummaryTextActive:mFe,thinkingSummaryIcon:pFe,thinkingSummaryText:gFe,thinkingChevronRight:bFe,thinkingChevronDown:yFe,thinkingExpandedWrap:vFe,thinkingExpandedClip:xFe,thinkingExpandedInner:wFe,content:kFe,contentBody:_Fe},SFe=80;function CFe(e,t){const[n,s]=f.useState(e),r=f.useRef(e),i=f.useRef(void 0);return r.current=e,f.useEffect(()=>{if(!t){i.current!==void 0&&(clearTimeout(i.current),i.current=void 0),n!==e&&s(e);return}i.current!==void 0||n===e||(i.current=setTimeout(()=>{i.current=void 0,s(r.current)},SFe))},[e,t,n]),f.useEffect(()=>()=>{i.current!==void 0&&clearTimeout(i.current)},[]),t&&e.startsWith(n)?n:e}const TFe=f.memo(function({content:t,isStreaming:n,timestamp:s,onBranchSession:r,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:a=!1,customFooterInfo:c}){const{t:u}=at(),{renderAssistantTurnFooter:d}=mu(),h=CFe(t,n),[m,p]=f.useState(!1),g=!!t&&!n&&i,b=f.useMemo(()=>c?d==null?void 0:d(c):void 0,[c,d]),x=f.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 l.jsxs("div",{className:hr.message,children:[t&&l.jsx("div",{className:`${hr.content}${a?` ${Lm.flash}`:""}`,children:l.jsx("div",{className:hr.contentBody,children:l.jsx(Tm,{content:h,source:"assistant",isStreaming:n})})}),b&&l.jsx("div",{className:hr.customFooter,children:b}),g&&l.jsxs("div",{className:hr.messageFooter,children:[l.jsx("button",{type:"button",className:hr.copyButton,title:u("assistant.copy"),"aria-label":u("assistant.copy"),onClick:x,children:m?l.jsx(AFe,{}):l.jsx(EFe,{})}),o&&r&&l.jsx("button",{type:"button",className:hr.copyButton,title:u("assistant.branch"),"aria-label":u("assistant.branch"),onClick:r,children:l.jsx(jFe,{})}),s!==void 0&&l.jsx("span",{className:hr.footerTime,"aria-hidden":"true",children:tb(s)})]})]})});function EFe(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function AFe(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function jFe(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.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"}),l.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const qp=new Map,NFe=200;function Tq(e,t){if(qp.delete(e),qp.set(e,t),qp.size<=NFe)return;const n=qp.keys().next().value;n!==void 0&&qp.delete(n)}const MFe=f.memo(function({messageId:t,content:n,isStreaming:s,timestamp:r,isLocateFlashing:i=!1,generateContent:o}){const{language:a,t:c}=at(),u=f.useContext(R0),[d,h]=f.useState(!1),m=s===!0,p=f.useRef(r??Date.now()),g=f.useRef(m),[b,x]=f.useState(()=>Date.now()),[y,v]=f.useState(null),[w,k]=f.useState(!1),[T,C]=f.useState(),[_,S]=f.useState(!1),[D,E]=f.useState(!1),[B,I]=f.useState(!1),L=f.useRef(void 0);f.useEffect(()=>{if(!n||!m)return;x(Date.now());const ee=setInterval(()=>x(Date.now()),1e3);return()=>clearInterval(ee)},[n,m]),f.useEffect(()=>{if(n){if(m){g.current=!0,v(null);return}g.current&&y===null&&v(Date.now())}},[n,y,m]);const O=m||y!==null?(m?b:y)-p.current:void 0,A=IFe({isStreaming:s,durationMs:O}),$=O!==void 0?RFe(O):"",q=f.useCallback(()=>{h(ee=>!ee)},[]);f.useEffect(()=>()=>{var ee;(ee=L.current)==null||ee.abort()},[]);const U=f.useCallback(async(ee=!1)=>{var Y;if(s||!o||_&&!ee)return;const V=`${a}:${t}:${n}`,R=qp.get(V);if(R&&!ee){Tq(V,R),C(R);return}ee&&qp.delete(V),(Y=L.current)==null||Y.abort();const re=new AbortController;L.current=re,C({text:""}),E(!1),I(!1),S(!0);let Z="",K=!1;try{const le=`Translate the following model reasoning into ${a==="zh-CN"?"Simplified Chinese":"English"}. Preserve its meaning and Markdown formatting. Output only the translation.

${n}`;for await(const te of o(le,{signal:re.signal})){if(L.current!==re)return;if(te.type==="thinking")E(!0);else if(te.type==="delta")E(!1),Z+=te.text,C({text:Z});else if(te.type==="done"){if(!Z.trim())throw new Error("Translation was empty");K=!0;const z={text:Z,inputTokens:te.inputTokens,outputTokens:te.outputTokens};Tq(V,z),C(z)}else if(te.type==="error")throw new Error(te.message)}if(!K)throw new Error("Translation stream ended early")}catch{re.signal.aborted||I(!0)}finally{L.current===re&&(L.current=void 0,E(!1),S(!1))}},[n,o,s,a,t,_]),H=f.useCallback(ee=>{k(ee),ee&&U()},[U]),M=f.useCallback(()=>{const ee=L.current;L.current=void 0,ee==null||ee.abort(),E(!1),S(!1),k(!1)},[]);return l.jsx("div",{className:`${hr.message}${i?` ${Lm.flash}`:""}`,children:n&&!u&&l.jsx("div",{className:hr.thinking,children:l.jsxs("div",{className:hr.thinkingBody,children:[l.jsxs("div",{className:`${hr.thinkingHeader}${d?` ${hr.thinkingHeaderExpanded}`:""}`,onClick:ee=>{ee.currentTarget.contains(ee.target)&&q()},children:[l.jsxs("button",{type:"button",className:hr.thinkingSummary,"aria-expanded":d,title:c(d?"thinking.collapse":"thinking.expand"),children:[l.jsx("span",{className:hr.thinkingSummaryIcon,"aria-hidden":"true",children:l.jsx(DFe,{})}),l.jsx("span",{className:m?`${hr.thinkingSummaryText} ${hr.thinkingSummaryTextActive}`:hr.thinkingSummaryText,children:c(A,$?{duration:$}:{})})]}),a==="zh-CN"&&!m&&o&&l.jsxs(db,{open:w,onOpenChange:H,children:[l.jsx(zx,{asChild:!0,children:l.jsx(An,{type:"button",variant:"secondary",size:"xs",className:hr.translateButton,title:c("thinking.translate"),onClick:ee=>ee.stopPropagation(),children:c("thinking.translate")})}),l.jsxs(hb,{align:"start",className:hr.translationPopover,children:[l.jsx("div",{className:hr.translationTitle,children:c("thinking.translation")}),B?l.jsx("div",{className:hr.translationError,children:c("thinking.translationFailed")}):T!=null&&T.text?l.jsx("div",{className:`${hr.thinkingExpandedWrap} ${hr.translationContent}`,children:l.jsx(Tm,{content:T.text,source:"thinking",isStreaming:_})}):l.jsx("div",{className:hr.translationPending,children:c(D?"thinking.translationThinking":"thinking.translating")}),l.jsxs("div",{className:hr.translationFooter,children:[l.jsx("div",{className:hr.translationUsage,children:!_&&(T==null?void 0:T.text)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:c("thinking.inputTokens",{count:T.inputTokens??"--"})}),l.jsx("span",{children:c("thinking.outputTokens",{count:T.outputTokens??"--"})})]})}),l.jsxs("div",{className:hr.translationActions,children:[l.jsx(An,{type:"button",variant:"outline",size:"xs",onClick:()=>void U(!0),children:c("thinking.retranslate")}),l.jsx(An,{type:"button",variant:"outline",size:"xs",disabled:!_&&!(T!=null&&T.text)&&!B,onClick:M,children:c(_?"thinking.cancelTranslation":"thinking.closeTranslation")})]})]})]})]}),l.jsx("span",{className:d?hr.thinkingChevronDown:hr.thinkingChevronRight,"aria-hidden":"true"})]}),d&&l.jsx("div",{className:hr.thinkingExpandedClip,children:l.jsx("div",{className:hr.thinkingExpandedInner,children:l.jsx("div",{className:hr.thinkingExpandedWrap,children:l.jsx(Tm,{content:n,source:"thinking",isStreaming:s})})})})]})})})});function IFe({isStreaming:e,durationMs:t}){return e?"thinking.running":t!==void 0&&t<1e3?"thinking.doneBriefly":"thinking.done"}function RFe(e){const t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}function DFe(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),l.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),l.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"}),l.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 LFe="_panel_8ng9u_1",PFe="_title_8ng9u_16",OFe="_metaLine_8ng9u_22",$Fe="_progress_8ng9u_32",BFe="_spacer_8ng9u_38",zFe="_row_8ng9u_42",FFe="_detailRow_8ng9u_43",HFe="_subDetailRow_8ng9u_44",qFe="_symbol_8ng9u_65",UFe="_label_8ng9u_69",WFe="_value_8ng9u_73",VFe="_detailName_8ng9u_80",GFe="_sectionTitle_8ng9u_88",KFe="_detailSection_8ng9u_94",YFe="_skillBlock_8ng9u_100",XFe="_hint_8ng9u_105",QFe="_detailCommand_8ng9u_111",JFe="_bodyLoaded_8ng9u_132",ZFe="_accent_8ng9u_137",eHe="_secondary_8ng9u_141",tHe="_warning_8ng9u_145",nHe="_error_8ng9u_149",sHe="_success_8ng9u_153",ss={panel:LFe,title:PFe,metaLine:OFe,progress:$Fe,spacer:BFe,row:zFe,detailRow:FFe,subDetailRow:HFe,symbol:qFe,label:UFe,value:WFe,detailName:VFe,sectionTitle:GFe,detailSection:KFe,skillBlock:YFe,hint:XFe,detailCommand:QFe,bodyLoaded:JFe,accent:ZFe,secondary:eHe,warning:tHe,error:nHe,success:sHe},EN="web-shell:context-usage:v1:",kf="█",Hoe="▒",qoe="░",Uoe=30;function rHe(e){return`${EN}${JSON.stringify(e)}`}function iHe(e){if(!e.startsWith(EN))return null;try{const t=JSON.parse(e.slice(EN.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function Woe(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function kb(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function oHe(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function aHe(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function lHe({usedPercentage:e,bufferPercentage:t}){const s=Math.round(Math.min(e,100)/100*56),r=Math.round(Math.min(t,Math.max(0,100-e))/100*56),i=Math.max(0,56-s-r),o=e>80?ss.error:e>60?ss.warning:ss.accent;return l.jsxs("div",{className:ss.progress,"aria-hidden":"true",children:[l.jsx("span",{className:o,children:kf.repeat(Math.max(0,s))}),l.jsx("span",{className:ss.secondary,children:qoe.repeat(Math.max(0,i))}),l.jsx("span",{className:ss.warning,children:Hoe.repeat(Math.max(0,r))})]})}function Zd({symbol:e,label:t,tokens:n,tokenLabel:s,contextWindowSize:r,symbolClassName:i=ss.secondary,isOverLimit:o}){return l.jsxs("div",{className:ss.row,children:[l.jsx("span",{className:`${ss.symbol} ${i}`,children:e}),l.jsx("span",{className:ss.label,children:t}),l.jsxs("span",{className:o?ss.error:ss.value,children:[kb(n)," ",s," (",oHe(n,r),"%)"]})]})}const c7="/context detail";function cHe({hint:e,onShowDetail:t}){const n=t?e.indexOf(c7):-1;return n<0?l.jsx("div",{className:ss.hint,children:e}):l.jsxs("div",{className:ss.hint,children:[e.slice(0,n),l.jsx("button",{type:"button",className:ss.detailCommand,onClick:t,children:c7}),e.slice(n+c7.length)]})}function uHe({name:e,tokens:t,tokenLabel:n}){return l.jsxs("div",{className:ss.detailRow,children:[l.jsxs("span",{className:ss.secondary,children:["└"," "]}),l.jsx("span",{className:ss.detailName,title:e,children:Woe(e,Uoe)}),l.jsxs("span",{className:ss.value,children:[kb(t)," ",n]})]})}function u7({title:e,items:t,getName:n,tokenLabel:s}){const r=aHe(t);return r.length===0?null:l.jsxs("section",{className:ss.detailSection,children:[l.jsx("div",{className:ss.sectionTitle,children:e}),r.map(i=>l.jsx(uHe,{name:n(i),tokens:i.tokens,tokenLabel:s},n(i)))]})}function dHe({skills:e,labels:t}){const n=[...e].sort((s,r)=>s.loaded!==r.loaded?s.loaded?-1:1:r.tokens+(r.bodyTokens??0)-(s.tokens+(s.bodyTokens??0)));return n.length===0?null:l.jsxs("section",{className:ss.detailSection,children:[l.jsx("div",{className:ss.sectionTitle,children:t.skills}),n.map(s=>l.jsxs("div",{className:ss.skillBlock,children:[l.jsxs("div",{className:ss.detailRow,children:[l.jsxs("span",{className:ss.secondary,children:["└"," "]}),l.jsxs("span",{className:ss.detailName,title:s.name,children:[Woe(s.name,Uoe),s.loaded&&l.jsxs("span",{className:ss.success,children:[" ",t.active]})]}),l.jsxs("span",{className:ss.value,children:[kb(s.tokens)," ",t.tokens]})]}),s.loaded&&s.bodyTokens!=null&&s.bodyTokens>0&&l.jsxs("div",{className:ss.subDetailRow,children:[l.jsxs("span",{className:ss.secondary,children:["  └"," "]}),l.jsx("span",{className:ss.bodyLoaded,children:t.bodyLoaded}),l.jsxs("span",{className:ss.success,children:["+",kb(s.bodyTokens)," ",t.tokens]})]})]},s.name))]})}function hHe({status:e,onShowDetail:t}){const{t:n}=at(),{usage:s}=e,{breakdown:r,contextWindowSize:i}=s,o=i>0?s.totalTokens/i*100:0,a=o>100,c=i>0?r.autocompactBuffer/i*100:0;return l.jsxs("div",{className:ss.panel,children:[l.jsx("div",{className:ss.title,children:n("contextUsage.title")}),s.isEstimated?l.jsx(l.Fragment,{children:l.jsxs("div",{className:ss.metaLine,children:[l.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),l.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",kb(i)," ",n("contextUsage.tokens")]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ss.metaLine,children:[l.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),l.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",kb(i)," ",n("contextUsage.tokens")]})]}),a&&l.jsx("div",{className:ss.error,children:n("contextUsage.overLimit")})]}),l.jsx(lHe,{usedPercentage:Math.min(o,100),bufferPercentage:c}),l.jsx("div",{className:ss.spacer}),l.jsx(Zd,{symbol:kf,label:n("contextUsage.used"),tokens:s.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?ss.error:ss.accent,isOverLimit:a}),l.jsx(Zd,{symbol:qoe,label:n("contextUsage.free"),tokens:r.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),l.jsx(Zd,{symbol:Hoe,label:n("contextUsage.autocompactBuffer"),tokens:r.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ss.warning}),l.jsx("div",{className:ss.spacer}),l.jsx("div",{className:ss.sectionTitle,children:n("contextUsage.usageByCategory")}),l.jsx(Zd,{symbol:kf,label:n("contextUsage.systemPrompt"),tokens:r.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ss.accent}),l.jsx(Zd,{symbol:kf,label:n("contextUsage.builtinTools"),tokens:r.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ss.accent}),r.mcpTools>0&&l.jsx(Zd,{symbol:kf,label:n("contextUsage.mcpTools"),tokens:r.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ss.accent}),l.jsx(Zd,{symbol:kf,label:n("contextUsage.memoryFiles"),tokens:r.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ss.accent}),l.jsx(Zd,{symbol:kf,label:n("contextUsage.skills"),tokens:r.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ss.accent}),!s.isEstimated&&l.jsx(Zd,{symbol:kf,label:n("contextUsage.messages"),tokens:r.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ss.accent}),s.showDetails?l.jsxs(l.Fragment,{children:[l.jsx(u7,{title:n("contextUsage.builtinTools"),items:s.builtinTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),l.jsx(u7,{title:n("contextUsage.mcpTools"),items:s.mcpTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),l.jsx(u7,{title:n("contextUsage.memoryFiles"),items:s.memoryFiles,getName:u=>"path"in u?u.path:u.name,tokenLabel:n("contextUsage.tokens")}),l.jsx(dHe,{skills:s.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):l.jsx(cHe,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const fHe={edit:"Edit",write_file:"WriteFile",read_file:"ReadFile",grep:"Grep",grep_search:"Grep",glob:"Glob",run_shell_command:"Shell",todo_write:"TodoList",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"},mHe=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g;function mS(e){return e.replace(mHe,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 Voe(e){if(!e.trim())return"Tool";const t=fHe[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function uu(e,t){const n=Voe(e),s=[`toolName.${e}`,`toolName.${e.toLowerCase()}`,`toolName.${n.toLowerCase()}`];for(const r of s){const i=t(r);if(i!==r)return i}return n}function yu(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function fo(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const F1=2e3;function nD(e,t){if(BT(e.toolName)){const r=$T(e.args,"skill");if(r)return fo(r,F1)}const n=bHe(e,t);if(n)return fo(n,F1);const s=Koe(e,t);return s?fo(s,F1):""}function Goe(e,t){if(!Xl(e.toolName))return nD(e,t);const n=$T(e.args,"description");if(n)return fo(n,F1);const s=Koe(e,t,{includeTimeout:!1});return s?fo(s,F1):""}function pHe(e){return Xl(e.toolName)?$T(e.args,"description"):""}function cd(e){var t;if(!e.content)return jN(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return jN(e.rawOutput)}function gHe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=Eq((jN(e.rawOutput)??"").trim());if(o)return o}const n=cd(e);if(!n)return"";const s=n.split(`
`),r=s.length;if(t==="read"||t==="read_file"||t==="readfile")return`${r} line(s)`;if(t==="glob")return`Found ${s.filter(a=>a.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${s.filter(a=>a.trim()).length} item(s)`;if(Xl(t)){if(r>3)return`${r} lines of output`;const o=s[0]||"";return fo(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=Eq(n.trim());return o||`${s.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=s[0]||"";return fo(o,80)}if(t==="websearch"||t==="web_search"){const o=s.filter(a=>a.trim()).length;return o>1?`${o} result(s)`:s[0]||""}if(yu(t))return"";const i=s[0]||"";return fo(i,80)}function bHe(e,t){if(!e.title)return null;const n=Voe(e.toolName),s=e.title.trim();if(s===e.toolName||s===n)return null;const r=[n,e.toolName];for(const i of r)if(s.startsWith(i)){const o=s.slice(i.length);if(/^(:\s*|\s+)/.test(o))return Aq(o.replace(/^:\s*|\s+/,""),t)}return Aq(s,t)}function Eq(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function Koe(e,t,n={}){const s=e.args||{},r=e.toolName.toLowerCase(),i=n.includeTimeout??!0;if(s.command){let o=String(s.command);s.directory&&r!=="shell"&&(o+=` [in ${y1(String(s.directory),t)}]`),s.is_background?o+=" [background]":i&&s.timeout&&(o+=` [timeout: ${String(s.timeout)}ms]`);const a=$T(s,"description");return a&&(o+=` (${a})`),fo(o,F1)}if(r==="grep_search"||r==="grep"||r==="search"){const o=s.pattern??s.query;if(o){let a=`'${String(o)}'`;return s.path?a+=` in path '${String(s.path)}'`:(r==="grep_search"||r==="grep")&&(a+=" in path './'"),s.glob&&(a+=` (filter: '${String(s.glob)}')`),a}}if(r==="glob"&&s.pattern){let o=`'${String(s.pattern)}'`;return s.path&&(o+=` in path '${String(s.path)}'`),o}if(s.file_path)return s.description?String(s.description):y1(String(s.file_path),t);if(s.url){const o=String(s.url),a=typeof s.prompt=="string"?s.prompt:void 0,c=a?`${o} — "${fo(a,40)}"`:o;return fo(c,80)}if(s.path)return y1(String(s.path),t);if(s.query)return fo(String(s.query),60);if(r==="list_directory"||r==="listfiles"){const o=s.path||s.directory||"";return y1(String(o),t)}return s.description?String(s.description):""}function $T(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function Xl(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function BT(e){return e.toLowerCase()==="skill"}function du(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(s=>du(s,t)))??!1}function Aq(e,t){const n=e.trim();return Yoe(AN(n))?y1(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,s=>y1(s,t))}function y1(e,t){const n=AN(e),s=t?AN(t).replace(/\/+$/,""):"";return s&&(n===s||n.startsWith(`${s}/`))?n.slice(s.length+1)||".":Yoe(n)?yHe(n):n}function AN(e){return e.replace(/\\/g,"/")}function Yoe(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function yHe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function Jw(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function sD(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 lw(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():"",s=sD(e);return n==="cancelled"||n==="canceled"||s.toLowerCase().includes("cancel")?"failed":e.status}function rD(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const vHe="general-purpose";function iD(e){var s;const t=Jw(e.rawOutput);if(t){const r=t.subagentName;if(typeof r=="string"&&r)return r}const n=(s=e.args)==null?void 0:s.subagent_type;return typeof n=="string"&&n?n:e.toolName==="task"?"task":vHe}function zT(e){var i,o;if(e.title){const a=e.title.indexOf(": ");if(a>0)return e.title.slice(a+2)}const t=(i=e.args)==null?void 0:i.description;if(typeof t=="string"&&t.trim())return t.trim();const n=Jw(e.rawOutput),s=n==null?void 0:n.taskDescription;if(typeof s=="string"&&s.trim())return s.trim();const r=(o=e.args)==null?void 0:o.prompt;return typeof r=="string"&&r.trim()?r.trim().split(`
`)[0]??"":""}function xHe(e,t){var i,o;if(e.status!=="in_progress")return"";const n=e.subTools;if(!n||n.length===0)return"";const s=n[n.length-1];if(s.status!=="in_progress"&&s.status!=="pending")return"";let r=uu(s.toolName??"",t);if(s.title){const a=s.title.indexOf(": ");r+=" "+(a>0?s.title.slice(a+2):s.title)}else(i=s.args)!=null&&i.command?r+=" "+String(s.args.command):(o=s.args)!=null&&o.file_path&&(r+=" "+String(s.args.file_path));return fo(r,50)}function jN(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 wHe="_panel_qchwm_1",kHe="_title_qchwm_17",_He="_sectionTitle_qchwm_23",SHe="_spacer_qchwm_29",CHe="_pivotRow_qchwm_35",THe="_metricCell_qchwm_41",EHe="_metricCellSection_qchwm_48",AHe="_metricCellSub_qchwm_56",jHe="_modelCell_qchwm_64",NHe="_modelCellHeader_qchwm_71",MHe="_divider_qchwm_79",IHe="_kvRow_qchwm_87",RHe="_kvSubRow_qchwm_94",DHe="_kvLabel_qchwm_102",LHe="_kvValue_qchwm_106",PHe="_tableRow_qchwm_115",OHe="_modelUsageRow_qchwm_121",$He="_tableNameCol_qchwm_129",BHe="_tableToolCol_qchwm_137",zHe="_tableNumCol_qchwm_145",FHe="_tableValueCol_qchwm_153",HHe="_success_qchwm_162",qHe="_error_qchwm_166",UHe="_secondary_qchwm_170",WHe="_warning_qchwm_174",Mt={panel:wHe,title:kHe,sectionTitle:_He,spacer:SHe,pivotRow:CHe,metricCell:THe,metricCellSection:EHe,metricCellSub:AHe,modelCell:jHe,modelCellHeader:NHe,divider:MHe,kvRow:IHe,kvSubRow:RHe,kvLabel:DHe,kvValue:LHe,tableRow:PHe,modelUsageRow:OHe,tableNameCol:$He,tableToolCol:BHe,tableNumCol:zHe,tableValueCol:FHe,success:HHe,error:qHe,secondary:UHe,warning:WHe},NN="web-shell:session-stats:v1:";function VHe(e,t="overview"){return`${NN}${JSON.stringify({_view:t,...e})}`}function GHe(e){if(!e.startsWith(NN))return null;try{const t=JSON.parse(e.slice(NN.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 um(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),s=Math.floor(t%3600/60),r=Math.floor(t%60),i=[];return n>0&&i.push(`${n}h`),s>0&&i.push(`${s}m`),r>0&&i.push(`${r}s`),i.join(" ")||"0s"}function Up({label:e,children:t}){return l.jsxs("div",{className:Mt.kvRow,children:[l.jsx("span",{className:Mt.kvLabel,children:e}),l.jsx("span",{className:Mt.kvValue,children:t})]})}function lx({label:e,children:t}){return l.jsxs("div",{className:Mt.kvSubRow,children:[l.jsxs("span",{className:Mt.secondary,children:["»"," ",e]}),l.jsx("span",{className:Mt.kvValue,children:t})]})}function Xoe(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const s=t.split("::"),r=s[0],i=s[1],o=i?`${r} (${i})`:r;return{key:t,label:o,metrics:n}})}function KHe(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function YHe(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function XHe(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Pu({metric:e,values:t,variant:n="normal"}){const s=n==="section"?Mt.metricCellSection:n==="sub"?Mt.metricCellSub:Mt.metricCell;return l.jsxs("div",{className:Mt.pivotRow,children:[l.jsx("span",{className:s,children:n==="sub"?`↳ ${e}`:e}),t.map((r,i)=>l.jsx("span",{className:Mt.modelCell,children:r},i))]})}function QHe({status:e}){const{t}=at(),{models:n,tools:s,files:r}=e,i=Object.values(n).reduce((b,x)=>b+x.api.totalLatencyMs,0),o=s.totalDurationMs,a=i+o,c=a>0?i/a*100:0,u=a>0?o/a*100:0,d=s.totalCalls>0?s.totalSuccess/s.totalCalls*100:0,h=Xoe(n),m=h.reduce((b,x)=>b+x.metrics.tokens.cached,0),p=h.reduce((b,x)=>b+x.metrics.tokens.prompt,0),g=p>0?m/p*100:0;return l.jsxs("div",{className:Mt.panel,children:[l.jsx("div",{className:Mt.title,children:t("stats.title")}),l.jsx("div",{className:Mt.sectionTitle,children:t("stats.overview")}),l.jsx(Up,{label:t("stats.duration"),children:um(e.durationMs)}),l.jsx(Up,{label:t("stats.prompts"),children:e.promptCount}),l.jsx(Up,{label:t("stats.toolCalls"),children:l.jsxs("span",{children:[s.totalCalls," ",l.jsx("span",{className:Mt.secondary,children:"("}),l.jsxs("span",{className:Mt.success,children:["✓",s.totalSuccess]})," ",l.jsxs("span",{className:Mt.error,children:["✗",s.totalFail]}),l.jsx("span",{className:Mt.secondary,children:")"})]})}),l.jsx(Up,{label:t("stats.successRate"),children:l.jsxs("span",{className:d>=90?Mt.success:d>=70?Mt.warning:Mt.error,children:[d.toFixed(1),"%"]})}),(r.totalLinesAdded>0||r.totalLinesRemoved>0)&&l.jsx(Up,{label:t("stats.codeChanges"),children:l.jsxs("span",{children:[l.jsxs("span",{className:Mt.success,children:["+",r.totalLinesAdded]})," ",l.jsxs("span",{className:Mt.error,children:["-",r.totalLinesRemoved]})]})}),l.jsx("div",{className:Mt.spacer}),l.jsx("div",{className:Mt.sectionTitle,children:t("stats.performance")}),l.jsxs(lx,{label:t("stats.apiTime"),children:[um(i)," ",l.jsxs("span",{className:Mt.secondary,children:["(",c.toFixed(1),"%)"]})]}),l.jsxs(lx,{label:t("stats.toolTime"),children:[um(o)," ",l.jsxs("span",{className:Mt.secondary,children:["(",u.toFixed(1),"%)"]})]}),h.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Mt.spacer}),l.jsx("div",{className:Mt.sectionTitle,children:t("stats.modelUsage")}),l.jsx("div",{className:Mt.spacer}),l.jsxs("div",{className:`${Mt.tableRow} ${Mt.modelUsageRow}`,children:[l.jsx("span",{className:Mt.tableNameCol,children:t("stats.modelUsage")}),l.jsx("span",{className:Mt.tableValueCol,children:t("stats.reqs")}),l.jsx("span",{className:Mt.tableValueCol,children:t("stats.inputTokens")}),l.jsx("span",{className:Mt.tableValueCol,children:t("stats.outputTokens")})]}),l.jsx("div",{className:Mt.divider}),h.map(b=>l.jsxs("div",{className:`${Mt.tableRow} ${Mt.modelUsageRow}`,children:[l.jsx("span",{className:Mt.tableNameCol,children:b.label}),l.jsx("span",{className:Mt.tableValueCol,children:b.metrics.api.totalRequests}),l.jsx("span",{className:`${Mt.tableValueCol} ${Mt.warning}`,children:b.metrics.tokens.prompt.toLocaleString()}),l.jsx("span",{className:`${Mt.tableValueCol} ${Mt.warning}`,children:b.metrics.tokens.candidates.toLocaleString()})]},b.key)),g>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Mt.spacer}),l.jsxs("div",{children:[l.jsx("span",{className:Mt.success,children:t("stats.savingsHighlight")})," ",m.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),l.jsxs("div",{className:Mt.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function JHe({status:e}){const{t}=at(),n=Xoe(e.models);if(n.length===0)return l.jsxs("div",{className:Mt.panel,children:[l.jsx("div",{className:Mt.title,children:t("stats.modelStats")}),l.jsx("div",{children:t("stats.noApiCalls")})]});const s=n.some(o=>o.metrics.tokens.cached>0),r=n.some(o=>o.metrics.tokens.thoughts>0),i=o=>n.map(a=>o(a.metrics));return l.jsxs("div",{className:Mt.panel,children:[l.jsx("div",{className:Mt.title,children:t("stats.modelStats")}),l.jsx("div",{className:Mt.spacer}),l.jsxs("div",{className:Mt.pivotRow,children:[l.jsx("span",{className:Mt.metricCellSection,children:t("stats.metric")}),n.map(o=>l.jsx("span",{className:Mt.modelCellHeader,children:o.label},o.key))]}),l.jsx("div",{className:Mt.divider}),l.jsx(Pu,{metric:t("stats.api"),values:[],variant:"section"}),l.jsx(Pu,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),l.jsx(Pu,{metric:t("stats.errors"),values:i(o=>{const a=KHe(o);return l.jsxs("span",{className:o.api.totalErrors>0?Mt.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),l.jsx(Pu,{metric:t("stats.avgLatency"),values:i(o=>um(YHe(o)))}),l.jsx("div",{className:Mt.spacer}),l.jsx(Pu,{metric:t("stats.tokens"),values:[],variant:"section"}),l.jsx(Pu,{metric:t("stats.total"),values:i(o=>l.jsx("span",{className:Mt.warning,children:o.tokens.total.toLocaleString()}))}),l.jsx(Pu,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),s&&l.jsx(Pu,{metric:t("stats.cached"),values:i(o=>l.jsxs("span",{className:Mt.success,children:[o.tokens.cached.toLocaleString()," (",XHe(o).toFixed(1),"%)"]})),variant:"sub"}),l.jsx(Pu,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),r&&l.jsx(Pu,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function ZHe(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 eqe({status:e}){const{t}=at(),n=ZHe(e.tools.byName);if(n.length===0)return l.jsxs("div",{className:Mt.panel,children:[l.jsx("div",{className:Mt.title,children:t("stats.toolStats")}),l.jsx("div",{children:t("stats.noToolCalls")})]});const s=Object.values(e.tools.byName).reduce((o,a)=>{var c,u,d;return o.accept+=((c=a.decisions)==null?void 0:c.accept)??0,o.reject+=((u=a.decisions)==null?void 0:u.reject)??0,o.modify+=((d=a.decisions)==null?void 0:d.modify)??0,o},{accept:0,reject:0,modify:0}),r=s.accept+s.reject+s.modify,i=r>0?s.accept/r*100:0;return l.jsxs("div",{className:Mt.panel,children:[l.jsx("div",{className:Mt.title,children:t("stats.toolStats")}),l.jsx("div",{className:Mt.spacer}),l.jsxs("div",{className:Mt.tableRow,children:[l.jsx("span",{className:Mt.tableToolCol,children:t("stats.toolName")}),l.jsx("span",{className:Mt.tableNumCol,children:t("stats.calls")}),l.jsx("span",{className:Mt.tableNumCol,children:t("stats.successRate")}),l.jsx("span",{className:Mt.tableNumCol,children:t("stats.avgDuration")})]}),l.jsx("div",{className:Mt.divider}),n.map(o=>{const a=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 l.jsxs("div",{className:Mt.tableRow,children:[l.jsx("span",{className:`${Mt.tableToolCol} ${Mt.metricCell}`,children:uu(o.name,t)}),l.jsx("span",{className:Mt.tableNumCol,children:o.stats.count}),l.jsxs("span",{className:`${Mt.tableNumCol} ${a>=90?Mt.success:a>=70?Mt.warning:Mt.error}`,children:[a.toFixed(1),"%"]}),l.jsx("span",{className:Mt.tableNumCol,children:um(c)})]},o.name)}),l.jsx("div",{className:Mt.spacer}),l.jsx("div",{className:Mt.sectionTitle,children:t("stats.decisionSummary")}),l.jsx(Up,{label:t("stats.totalReviewed"),children:r}),l.jsx(lx,{label:t("stats.accepted"),children:l.jsx("span",{className:Mt.success,children:s.accept})}),l.jsx(lx,{label:t("stats.rejected"),children:l.jsx("span",{className:Mt.error,children:s.reject})}),l.jsx(lx,{label:t("stats.modified"),children:l.jsx("span",{className:Mt.warning,children:s.modify})}),l.jsx("div",{className:Mt.divider}),l.jsx(Up,{label:t("stats.agreementRate"),children:l.jsx("span",{className:r>0?i>=90?Mt.success:i>=70?Mt.warning:Mt.error:void 0,children:r>0?`${i.toFixed(1)}%`:"--"})})]})}function tqe({view:e,status:t}){switch(e){case"model":return l.jsx(JHe,{status:t});case"tools":return l.jsx(eqe,{status:t});default:return l.jsx(QHe,{status:t})}}function FT(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 nqe="_panel_13hcg_1",sqe="_title_13hcg_17",rqe="_row_13hcg_23",iqe="_rowGap_13hcg_31",oqe="_label_13hcg_35",aqe="_value_13hcg_41",lqe="_accent_13hcg_46",Zp={panel:nqe,title:sqe,row:rqe,rowGap:iqe,label:oqe,value:aqe,accent:lqe},{serialize:cqe,parse:uqe}=FT("web-shell:status:v1:");function Yc({label:e,children:t,gap:n}){return l.jsxs("div",{className:`${Zp.row}${n?` ${Zp.rowGap}`:""}`,children:[l.jsx("span",{className:Zp.label,children:e}),l.jsx("span",{className:Zp.value,children:t})]})}function dqe({info:e}){const{t}=at();return l.jsxs("div",{className:Zp.panel,children:[l.jsx("div",{className:Zp.title,children:t("about.title")}),e.cliVersion&&l.jsx(Yc,{label:t("about.qwenCode"),children:l.jsx("span",{className:Zp.accent,children:e.cliVersion})}),e.runtime&&l.jsx(Yc,{label:t("about.runtime"),children:e.runtime}),e.platform&&l.jsx(Yc,{label:t("about.platform"),children:e.platform}),e.auth&&l.jsx(Yc,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&l.jsx(Yc,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&l.jsx(Yc,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&l.jsx(Yc,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&l.jsx(Yc,{label:t("about.sessionId"),children:e.sessionId}),l.jsx(Yc,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),l.jsx(Yc,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&l.jsx(Yc,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function hqe(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function Qoe(e,t,n=50){const s=f.useRef(e);f.useEffect(()=>{s.current=e},[e]),f.useEffect(()=>{const r=o=>{o.defaultPrevented||N0(o.target)&&!hqe(o.target)||s.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",r)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",r)}},t)}function Ra(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 r=n.details;if(typeof r=="string"&&r)return r}const s=t.error;if(typeof s=="string"&&s)return s}if(e instanceof Error&&e.message)return e.message}return String(e)}const fqe="_panel_1jx2a_1",mqe="_title_1jx2a_13",pqe="_header_1jx2a_18",gqe="_startup_1jx2a_24",bqe="_note_1jx2a_28",yqe="_secondary_1jx2a_29",vqe="_row_1jx2a_39",xqe="_selected_1jx2a_48",wqe="_disabled_1jx2a_52",kqe="_pointer_1jx2a_56",_qe="_nameCell_1jx2a_62",Sqe="_truncate_1jx2a_69",Cqe="_separator_1jx2a_75",Tqe="_sectionTitle_1jx2a_79",Eqe="_groupTitle_1jx2a_80",Aqe="_success_1jx2a_84",jqe="_warning_1jx2a_88",Nqe="_error_1jx2a_92",Mqe="_group_1jx2a_80",Iqe="_list_1jx2a_102",Rqe="_description_1jx2a_108",Dqe="_schema_1jx2a_113",Lqe="_shortcuts_1jx2a_131",Pqe="_detail_1jx2a_137",Oqe="_serverFields_1jx2a_143",$qe="_serverField_1jx2a_143",Bqe="_serverFieldLabel_1jx2a_156",zqe="_detailBlock_1jx2a_160",Fqe="_parameters_1jx2a_161",Hqe="_invalidBlock_1jx2a_162",qqe="_parameterRow_1jx2a_172",Uqe="_actionMessage_1jx2a_177",Wqe="_oauthPage_1jx2a_183",Vqe="_scrollHint_1jx2a_189",on={panel:fqe,title:mqe,header:pqe,startup:gqe,note:bqe,secondary:yqe,row:vqe,selected:xqe,disabled:wqe,pointer:kqe,nameCell:_qe,truncate:Sqe,separator:Cqe,sectionTitle:Tqe,groupTitle:Eqe,success:Aqe,warning:jqe,error:Nqe,group:Mqe,list:Iqe,description:Rqe,schema:Dqe,shortcuts:Lqe,detail:Pqe,serverFields:Oqe,serverField:$qe,serverFieldLabel:Bqe,detailBlock:zqe,parameters:Fqe,invalidBlock:Hqe,parameterRow:qqe,actionMessage:Uqe,oauthPage:Wqe,scrollHint:Vqe},MN="web-shell:mcp-panel-active",Cp=10,{parse:Gqe}=FT("web-shell:mcp-status:v1:");function Kqe(e){const t=Gqe(e);return!t||!t.status?null:t}function i2(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:on.error};if(e.approvalState==="pending")return{icon:"!",text:t("mcp.status.needsApproval"),className:on.warning};if(e.approvalState==="rejected")return{icon:"✗",text:t("mcp.status.rejected"),className:on.warning};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:on.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:on.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:on.error}}}function Joe(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 Yqe(e){const t=Joe(e);return t?JSON.stringify(t,null,2):""}function Xqe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function Qqe(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 Jqe(e,t){var s;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 r=((s=n.args)==null?void 0:s.join(" "))??"";return`${n.command} ${r} (stdio)`.trim()}return e.transport?`(${e.transport})`:t("mcp.status.unknown")}function d7(e,t){const n=e.annotations??{},s=[];return n.destructiveHint&&s.push(t("mcp.annotation.destructive")),n.readOnlyHint&&s.push(t("mcp.annotation.readOnly")),n.openWorldHint&&s.push(t("mcp.annotation.openWorld")),n.idempotentHint&&s.push(t("mcp.annotation.idempotent")),s.join(", ")}function jq(e,t){window.dispatchEvent(new CustomEvent(MN,{detail:{id:e,active:t}}))}function o2(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function Zqe(e,t){return e?t("mcp.required"):""}function eUe(e,t){const n=Joe(e),s=n==null?void 0:n.properties,r=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!s||typeof s!="object"){const o=Yqe(e);return o?l.jsx("pre",{className:on.schema,children:o}):null}const i=Object.entries(s);return i.length===0?null:l.jsxs("div",{className:on.parameters,children:[l.jsx("div",{className:on.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const c=a&&typeof a=="object"?a:{},u=typeof c.type=="string"?c.type:"any",d=typeof c.description=="string"?c.description:"";return l.jsx("div",{className:on.parameterRow,children:`• ${o}${Zqe(r.has(o),t)}: ${u}${d?` - ${d}`:""}`},o)})]})}function tUe({message:e}){var ee;const{t}=at(),n=w9({autoLoad:!1}),[s,r]=f.useState(e.status),[i,o]=f.useState(e.toolsByServer),[a,c]=f.useState(null),[u,d]=f.useState(!1),h=f.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[m,p]=f.useState(!0),[g,b]=f.useState("servers"),[x,y]=f.useState(0),[v,w]=f.useState(0),[k,T]=f.useState(0),C=f.useMemo(()=>s.servers??[],[s.servers]),_=C[x]??null,S=f.useMemo(()=>{var V;return _?((V=i[_.name])==null?void 0:V.tools)??[]:[]},[_,i]),D=S[k]??null,E=f.useMemo(()=>S.length<=Cp||k<Cp-1?0:Math.min(k-Cp+1,S.length-Cp),[k,S.length]),B=f.useMemo(()=>S.slice(E,E+Cp),[S,E]),I=C.filter(V=>!V.disabled&&V.mcpStatus==="connecting").length,L=f.useMemo(()=>{const V=[];for(const R of C){const re=Xqe(R,t),Z=V.find(K=>K.label===re);Z?Z.servers.push(R):V.push({label:re,servers:[R]})}return V},[C,t]),O=f.useMemo(()=>C.length===0?20:Math.min(Math.max(...C.map(V=>V.name.length))+2,35),[C]),A=f.useMemo(()=>S.length===0?30:Math.min(Math.max(...S.map(V=>V.name.length))+2,50),[S]),$=f.useMemo(()=>{if(!_)return[];const V=[],R=!!_.approvalState;return!_.disabled&&!R&&S.length>0&&V.push({id:"view-tools",label:t("mcp.action.tools")}),!_.disabled&&!R&&_.mcpStatus==="disconnected"&&V.push({id:"reconnect",label:t("mcp.action.reconnect")}),!_.disabled&&R&&V.push({id:"approve",label:t("mcp.action.approve")}),(!(_.configOrigin==="extension"||_.source==="extension"||!!_.extensionName)||_.disabled)&&V.push({id:_.disabled?"enable":"disable",label:_.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!_.disabled&&!R&&(V.push({id:"authenticate",label:_.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),_.hasOAuthTokens&&V.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),V},[_,S.length,t]),q=f.useCallback(async()=>{var R;const V=await n.reload();if(V){r(V);const re=((R=V.servers)==null?void 0:R.find(Z=>Z.name===(_==null?void 0:_.name)))??null;if(re){if(re.approvalState)return;const Z=await n.loadTools(re.name);o(K=>({...K,[re.name]:Z}))}}},[n,_==null?void 0:_.name]),U=f.useCallback(async V=>{if(!(!_||V.disabled||u)){if(V.id==="view-tools"){b("tools"),T(0),c(null);return}d(!0),V.id==="authenticate"&&b("oauth"),c(V.id==="authenticate"?o2(_.name,t):t("mcp.action.running",{action:V.label}));try{let R=null;if(V.id==="reconnect"){const re=await n.restartServer(_.name);if("restarted"in re&&!re.restarted)throw new Error(t("mcp.reconnect.skipped",{reason:re.reason}));if("entries"in re&&(re.entries.length===0||re.entries.every(Z=>!Z.restarted)))throw new Error(t("mcp.reconnect.skipped",{reason:re.entries.map(Z=>Z.reason).filter(Boolean).join(", ")||"not connected"}))}else{const re=await n.manageServer(_.name,V.id),Z=[...re.messages??[],...re.authUrl?[re.authUrl]:[]].join(`
`);Z&&(R=V.id==="authenticate"?o2(_.name,t,Z):Z)}await q(),c(R??t("mcp.action.done",{action:V.label}))}catch(R){c(V.id==="authenticate"?o2(_.name,t,Ra(R)):t("mcp.action.failed",{error:Ra(R)}))}finally{d(!1)}}},[u,n,q,_,t]);if(f.useEffect(()=>{const V=h.current;return jq(V,m),()=>jq(V,!1)},[m]),f.useEffect(()=>{const V=R=>{const re=R.detail;re!=null&&re.active&&re.id&&re.id!==h.current&&p(!1)};return window.addEventListener(MN,V),()=>window.removeEventListener(MN,V)},[]),Qoe(V=>{if(m){if(V.key==="Escape"){V.preventDefault(),V.stopPropagation(),g==="servers"?p(!1):g==="server"?(b("servers"),w(0),c(null)):g==="oauth"?(b("server"),c(null)):g==="tools"?(b("server"),T(0)):b("tools");return}if(V.key==="ArrowUp"||V.key==="ArrowDown"){V.preventDefault(),V.stopPropagation();const R=V.key==="ArrowUp"?-1:1;g==="servers"?(y(re=>Math.min(Math.max(re+R,0),C.length-1)),w(0)):g==="server"?w(re=>Math.min(Math.max(re+R,0),$.length-1)):g==="tools"&&T(re=>Math.min(Math.max(re+R,0),S.length-1));return}if(V.key==="Enter")if(V.preventDefault(),V.stopPropagation(),g==="servers"&&C.length>0)b("server"),w(0);else if(g==="server"&&$.length>0){const R=$[v];R&&U(R)}else g==="tools"&&S.length>0&&b("tool")}},[m,v,S.length,$,U,C.length,g]),!m)return null;if(C.length===0)return l.jsxs("div",{className:on.panel,"data-keyboard-scope":!0,children:[l.jsxs("div",{className:on.header,children:[l.jsx("div",{className:on.title,children:t("mcp.manageServers")}),l.jsx("div",{className:on.secondary,children:t("mcp.servers",{count:0})})]}),l.jsx("div",{className:on.secondary,children:t("mcp.empty")}),l.jsx("div",{className:on.shortcuts,children:t("mcp.shortcut.close")})]});const H=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")}):(D==null?void 0:D.name)??t("mcp.toolDetail"),M=g==="servers"?t("mcp.servers",{count:C.length}):g==="server"||g==="oauth"?"":g==="tools"?t(S.length===1?"mcp.toolCount":"mcp.toolsCount",{count:S.length}):(D==null?void 0:D.serverToolName)??(_==null?void 0:_.name)??"";return l.jsxs("div",{className:on.panel,"data-keyboard-scope":!0,children:[I>0&&l.jsxs("div",{children:[l.jsx("div",{className:on.startup,children:t("mcp.starting",{count:I})}),l.jsx("div",{className:on.note,children:t("mcp.startingNote")})]}),l.jsxs("div",{className:on.header,children:[l.jsx("div",{className:on.title,children:H}),M&&l.jsx("div",{className:on.secondary,children:M})]}),g==="servers"&&l.jsx("div",{className:on.list,children:L.map(V=>{let R=0;for(const re of L){if(re===V)break;R+=re.servers.length}return l.jsxs("div",{className:on.group,children:[l.jsx("div",{className:on.groupTitle,children:V.label}),V.servers.map((re,Z)=>{const K=R+Z,Y=K===x,ae=i2(re,t);return l.jsxs("div",{className:Y?`${on.row} ${on.selected}`:on.row,onClick:()=>{y(K),b("server"),w(0)},onMouseEnter:()=>y(K),children:[l.jsx("span",{className:on.pointer,children:Y?"❯":""}),l.jsx("span",{className:on.nameCell,style:{width:`${O}ch`},children:re.name}),l.jsx("span",{className:on.separator,children:"·"}),l.jsxs("span",{className:ae.className,children:[ae.icon," ",ae.text]})]},re.name)})]},V.label)})}),g==="server"&&_&&l.jsxs("div",{className:on.detail,children:[l.jsxs("div",{className:on.serverFields,children:[l.jsxs("div",{className:on.serverField,children:[l.jsxs("span",{className:on.serverFieldLabel,children:[t("mcp.status"),":"]}),l.jsxs("span",{className:i2(_,t).className,children:[i2(_,t).icon," ",i2(_,t).text]})]}),l.jsxs("div",{className:on.serverField,children:[l.jsxs("span",{className:on.serverFieldLabel,children:[t("mcp.source"),":"]}),l.jsx("span",{children:Qqe(_,t)})]}),l.jsxs("div",{className:on.serverField,children:[l.jsxs("span",{className:on.serverFieldLabel,children:[t("mcp.command"),":"]}),l.jsx("span",{className:on.truncate,children:Jqe(_,t)})]}),((ee=_.config)==null?void 0:ee.cwd)&&l.jsxs("div",{className:on.serverField,children:[l.jsxs("span",{className:on.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),l.jsx("span",{className:on.truncate,children:_.config.cwd})]}),!_.disabled&&l.jsxs("div",{className:on.serverField,children:[l.jsxs("span",{className:on.serverFieldLabel,children:[t("mcp.tools"),":"]}),l.jsx("span",{children:t(S.length===1?"mcp.toolCount":"mcp.toolsCount",{count:S.length})})]})]}),l.jsx("div",{className:on.list,children:$.map((V,R)=>{const re=R===v,Z=[on.row,re?on.selected:"",V.disabled?on.disabled:""].filter(Boolean).join(" ");return l.jsxs("div",{className:Z,onClick:()=>{w(R),U(V)},children:[l.jsx("span",{className:on.pointer,children:re?"❯":""}),l.jsx("span",{children:V.label})]},V.id)})}),a&&l.jsx("pre",{className:on.actionMessage,children:a})]}),g==="oauth"&&l.jsx("div",{className:on.oauthPage,children:l.jsx("pre",{className:on.actionMessage,children:a??(_?o2(_.name,t):t("mcp.status.unknown"))})}),g==="tools"&&l.jsx("div",{className:on.list,children:S.length===0?l.jsx("div",{className:on.secondary,children:t("mcp.emptyTools")}):B.map((V,R)=>{const re=E+R,Z=re===k,K=d7(V,t);return l.jsxs("div",{className:Z?`${on.row} ${on.selected}`:on.row,onClick:()=>{T(re),b("tool")},onMouseEnter:()=>T(re),children:[l.jsx("span",{className:on.pointer,children:Z?"❯":""}),l.jsx("span",{className:on.nameCell,style:{width:`${A}ch`},children:V.name}),V.isValid?K?l.jsx("span",{className:on.secondary,children:K}):null:l.jsx("span",{className:on.warning,children:t("mcp.invalidReason",{reason:V.invalidReason||t("mcp.status.unknown")})})]},V.name)})}),g==="tools"&&S.length>Cp&&l.jsxs("div",{className:on.scrollHint,children:[E>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:S.length}),E+Cp<S.length?" ↓":""]}),g==="tool"&&D&&l.jsxs("div",{className:on.detail,children:[!D.isValid&&l.jsxs("div",{className:on.invalidBlock,children:[l.jsx("div",{className:on.sectionTitle,children:t("mcp.invalidToolWarning")}),l.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",D.invalidReason||t("mcp.status.unknown")]}),l.jsx("div",{className:on.secondary,children:t("mcp.invalidToolHelp")})]}),D.description&&l.jsxs("div",{className:on.detailBlock,children:[l.jsx("div",{className:on.sectionTitle,children:t("mcp.description")}),l.jsx("div",{className:on.description,children:D.description.trim()})]}),d7(D,t)&&l.jsxs("div",{className:on.detailBlock,children:[l.jsx("span",{className:on.sectionTitle,children:t("mcp.annotations")})," ",l.jsx("span",{children:d7(D,t)})]}),eUe(D,t)]}),l.jsx("div",{className:on.shortcuts,children:t(g==="servers"?"mcp.shortcut.selectClose":g==="server"||g==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const nUe=3;function g3(e){return e.kind==="agent"&&typeof e.id=="string"}function sUe(e){const t=e.filter(g3),n=new Map;for(const u of t)n.set(u.id,u);const s=new Map,r=[];for(const u of t){const d=u.parentAgentId;if(d!=null&&d!==u.id&&n.has(d)){const h=s.get(d);h?h.push(u):s.set(d,[u])}else r.push(u)}if(s.size===0)return[...e];const i=[],o=new Set,a=u=>{if(!o.has(u.id)){o.add(u.id),i.push(u);for(const d of s.get(u.id)??[])a(d)}};for(const u of r)a(u);for(const u of t)o.has(u.id)||(o.add(u.id),i.push(u));let c=0;return e.map(u=>g3(u)?i[c++]:u)}function Zoe(e,t){const n=[],s=new Set(e.id!=null?[e.id]:[]);let r=e.parentAgentId;for(;;){if(r==null)return{chain:n,terminatedBy:"root"};if(s.has(r))return{chain:n,terminatedBy:"cycle"};const i=t(r);if(!i)return{chain:n,terminatedBy:"missing"};s.add(r),n.push(i),r=i.parentAgentId}}function rUe(e){const t=new Map;for(const s of e)g3(s)&&t.set(s.id,s);const n=new Map;for(const s of t.values()){const{chain:r,terminatedBy:i}=Zoe(s,o=>t.get(o));n.set(s.id,{visibleDepth:i==="cycle"?0:r.length,orphaned:r.length===0&&i==="missing"})}return n}function iUe(e){const t=new Map;for(const s of e)g3(s)&&t.set(s.id,s);const n=new Set;for(const s of t.values()){if(s.isBackgrounded!==!1)continue;const{chain:r,terminatedBy:i}=Zoe(s,o=>t.get(o));i==="root"&&r.every(o=>o.isBackgrounded===!1)&&n.add(s.id)}return n}function b3(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,s=Math.floor(t/60);if(s===0)return`${n}s`;const r=s%60,i=Math.floor(s/60);return i===0?`${r}m ${n}s`:`${i}h ${r}m`}const oUe="_panel_1c0ra_1",aUe="_embeddedPanel_1c0ra_12",lUe="_title_1c0ra_19",cUe="_sectionTitle_1c0ra_24",uUe="_overflowHint_1c0ra_28",dUe="_header_1c0ra_33",hUe="_secondary_1c0ra_39",fUe="_row_1c0ra_43",mUe="_selected_1c0ra_51",pUe="_pointer_1c0ra_55",gUe="_nameCell_1c0ra_61",bUe="_treeMarker_1c0ra_70",yUe="_orphanNote_1c0ra_74",vUe="_status_1c0ra_78",xUe="_chevronCell_1c0ra_84",wUe="_chevron_1c0ra_84",kUe="_chevronExpanded_1c0ra_101",_Ue="_separator_1c0ra_111",SUe="_list_1c0ra_115",CUe="_task_1c0ra_121",TUe="_taskExpanded_1c0ra_127",EUe="_success_1c0ra_132",AUe="_warning_1c0ra_136",jUe="_error_1c0ra_140",NUe="_detail_1c0ra_144",MUe="_detailTop_1c0ra_153",IUe="_detailTopMain_1c0ra_160",RUe="_inlineDetail_1c0ra_200",DUe="_taskIcon_1c0ra_222",LUe="_detailField_1c0ra_251",PUe="_detailFieldLabel_1c0ra_258",OUe="_detailContent_1c0ra_264",$Ue="_compactSummary_1c0ra_271",BUe="_actionBar_1c0ra_280",zUe="_actionHint_1c0ra_289",FUe="_actionButton_1c0ra_294",HUe="_dangerButton_1c0ra_314",qUe="_shortcuts_1c0ra_318",UUe="_confirmHint_1c0ra_324",WUe="_statusBadge_1c0ra_328",VUe="_activityCurrent_1c0ra_334",GUe="_activityPast_1c0ra_341",KUe="_promptContent_1c0ra_348",Gt={panel:oUe,embeddedPanel:aUe,title:lUe,sectionTitle:cUe,overflowHint:uUe,header:dUe,secondary:hUe,row:fUe,selected:mUe,pointer:pUe,nameCell:gUe,treeMarker:bUe,orphanNote:yUe,status:vUe,chevronCell:xUe,chevron:wUe,chevronExpanded:kUe,separator:_Ue,list:SUe,task:CUe,taskExpanded:TUe,success:EUe,warning:AUe,error:jUe,detail:NUe,detailTop:MUe,detailTopMain:IUe,inlineDetail:RUe,taskIcon:DUe,detailField:LUe,detailFieldLabel:PUe,detailContent:OUe,compactSummary:$Ue,actionBar:BUe,actionHint:zUe,actionButton:FUe,dangerButton:HUe,shortcuts:qUe,confirmHint:UUe,statusBadge:WUe,activityCurrent:VUe,activityPast:GUe,promptContent:KUe},cw="web-shell:tasks-panel-active",YUe=3e3,Nq=8,{parse:XUe}=FT("web-shell:tasks-status:v1:");function QUe(e){const t=XUe(e);return!t||!t.snapshot?null:t}function Mq(e,t){window.dispatchEvent(new CustomEvent(cw,{detail:{id:e,active:t}}))}function Iq(e){return e.status==="running"||e.status==="paused"}function JUe(e){return[...e].sort((t,n)=>{const s=Iq(t),r=Iq(n);return s!==r?s?-1:1:s?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function h7(e){return sUe(JUe(e))}function Rq(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function eae(e){switch(e){case"running":return Gt.success;case"paused":return Gt.warning;case"completed":return Gt.success;case"failed":return Gt.error;case"cancelled":return Gt.warning;default:return""}}function ZUe(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 eWe(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function tWe({expanded:e}){return l.jsx("svg",{className:`${Gt.chevron} ${e?Gt.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function nWe(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 sWe(e,t){if(e.length<=Nq)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,Nq-2),s=Math.max(0,Math.min(t-Math.floor(n/2),e.length-n)),r=Math.min(e.length,s+n);return{visible:e.slice(s,r),windowStart:s,hiddenAbove:s,hiddenBelow:e.length-r}}function rWe(e,t,n){const s=uu(e,n),r=t?t.replace(/\s*\n\s*/g," ").trim():"",i=r?`${s}(${r})`:s;return mS(i)}function tae({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:s}){const{t:r}=at(),i=Ib(),[o,a]=f.useState(()=>h7(e.snapshot.tasks)),[c,u]=f.useState(!0),[d,h]=f.useState("list"),[m,p]=f.useState(0),[g,b]=f.useState(null),[x,y]=f.useState(!1),[v,w]=f.useState(!1),[k,T]=f.useState(null),C=f.useRef(`tasks-${Math.random().toString(36).slice(2)}`),_=f.useRef(!1),S=f.useRef(null),D=o.length===0?0:Math.min(m,o.length-1),E=o[D]??null,B=f.useMemo(()=>rUe(o),[o]),I=f.useMemo(()=>iUe(o),[o]);f.useEffect(()=>{if(!c)return;const re=setInterval(()=>{_.current||(_.current=!0,i.getTasks().then(Z=>{a(h7(Z.tasks)),w(!1)}).catch(Z=>{console.warn("[web-shell] failed to refresh tasks:",Z),w(!0)}).finally(()=>{_.current=!1}))},YUe);return()=>clearInterval(re)},[c,i]),f.useEffect(()=>{o.length===0&&m!==0&&p(0),m>=o.length&&o.length>0&&p(o.length-1)},[o.length,m]),f.useEffect(()=>{if(!c||d!=="detail"){S.current=null;return}if(!E){S.current=null,h("list");return}const R=S.current;if(!R||R.taskId!==E.id){S.current={taskId:E.id,status:E.status};return}R.status==="running"&&E.status!=="running"&&(b(null),h("list"))},[c,d,E]),f.useEffect(()=>{if(!n)return;const R=C.current;return Mq(R,c),()=>Mq(R,!1)},[c,n]),f.useEffect(()=>{if(!n)return;const R=re=>{const Z=re.detail;Z!=null&&Z.active&&Z.id&&Z.id!==C.current&&u(!1)};return window.addEventListener(cw,R),()=>window.removeEventListener(cw,R)},[n]),f.useEffect(()=>{c||s==null||s()},[c,s]);const L=f.useCallback(async R=>{if(x)return;const re=R.status==="running",Z=R.kind==="agent"&&R.status==="paused";if(!re&&!Z)return;if(R.kind==="agent"&&I.has(R.id)&&g!==R.id){b(R.id);return}b(null),y(!0);try{if(!(await i.cancelTask(R.id,R.kind)).cancelled){T(r("tasks.alreadyStopped"));return}const ae=await i.getTasks();a(h7(ae.tasks)),T(null)}catch(Y){console.warn("[web-shell] failed to cancel task:",Y),T(r("tasks.cancelFailed"))}finally{y(!1)}},[i,x,I,g,r]);if(Qoe(R=>{if(c){if(R.key==="Escape"){if(R.preventDefault(),R.stopPropagation(),g){b(null);return}d==="detail"?h("list"):u(!1);return}if(R.key==="ArrowLeft"){R.preventDefault(),R.stopPropagation(),d==="detail"?(b(null),h("list")):u(!1);return}if((R.key==="ArrowUp"||R.key==="ArrowDown")&&d==="list"){if(R.preventDefault(),R.stopPropagation(),o.length===0)return;const re=R.key==="ArrowUp"?-1:1;p(Z=>Math.min(Math.max(Z+re,0),o.length-1)),b(null);return}if(R.key==="Enter"){R.preventDefault(),R.stopPropagation(),d==="list"&&E?h("detail"):d==="detail"&&u(!1);return}if(R.key===" "&&d==="detail"){R.preventDefault(),R.stopPropagation(),u(!1);return}if(R.key==="x"&&!R.ctrlKey&&!R.metaKey){R.preventDefault(),R.stopPropagation(),E&&L(E);return}}},[c,d,o.length,E,L,g]),!c)return null;const O=g!==null&&E!==null&&g===E.id,A=[];O?(A.push(r("tasks.confirmStop")),A.push(r("tasks.shortcut.cancelConfirm"))):(A.push(r("tasks.shortcut.select")),A.push(r("tasks.shortcut.view")),(E==null?void 0:E.status)==="running"?A.push(r("tasks.shortcut.stop")):(E==null?void 0:E.kind)==="agent"&&(E==null?void 0:E.status)==="paused"&&A.push(r("tasks.shortcut.abandon")),A.push(r("tasks.shortcut.listClose")));const $=[];if(O?($.push(r("tasks.confirmStop")),$.push(r("tasks.shortcut.cancelConfirm"))):($.push(r("tasks.shortcut.detailBack")),$.push(r("tasks.shortcut.detailClose")),(E==null?void 0:E.status)==="running"?$.push(r("tasks.shortcut.stop")):(E==null?void 0:E.kind)==="agent"&&(E==null?void 0:E.status)==="paused"&&$.push(r("tasks.shortcut.abandon"))),o.length===0)return l.jsxs("div",{className:t?`${Gt.panel} ${Gt.embeddedPanel}`:Gt.panel,"data-keyboard-scope":!0,children:[(v||k||!t)&&l.jsxs("div",{className:Gt.header,children:[!t&&l.jsx("div",{className:Gt.title,children:r("tasks.title")}),v&&l.jsx("div",{className:Gt.warning,children:r("tasks.refreshStale")}),k&&l.jsx("div",{className:Gt.error,children:k})]}),l.jsx("div",{children:l.jsx("div",{className:Gt.secondary,children:r("tasks.empty")})}),!t&&l.jsx("div",{className:Gt.shortcuts,children:r("tasks.shortcut.close")})]});const{visible:q,windowStart:U,hiddenAbove:H,hiddenBelow:M}=sWe(o,D),ee=t?o:q,V=t?0:U;return l.jsxs("div",{className:t?`${Gt.panel} ${Gt.embeddedPanel}`:Gt.panel,"data-keyboard-scope":!0,children:[(t||d==="list")&&(v||k||!t)&&l.jsxs("div",{className:Gt.header,children:[!t&&l.jsx("div",{className:Gt.title,children:r("tasks.title")}),v&&l.jsx("div",{className:Gt.warning,children:r("tasks.refreshStale")}),k&&l.jsx("div",{className:Gt.error,children:k})]}),(t||d==="list")&&l.jsxs("div",{className:Gt.list,children:[!t&&l.jsxs("div",{className:Gt.sectionTitle,children:[r("tasks.title")," ",l.jsxs("span",{className:Gt.secondary,children:["(",o.length,")"]})]}),!t&&H>0&&l.jsx("div",{className:Gt.overflowHint,children:r("tasks.moreAbove",{count:H})}),ee.map((R,re)=>{const Z=V+re,K=Z===D,Y=eae(R.status),ae=ZUe(R.status,r),le=t&&K&&d==="detail",te=t?le:K,z=R.kind==="agent"?B.get(R.id):void 0,X=Math.min((z==null?void 0:z.visibleDepth)??0,nUe),fe=R.kind==="agent"&&R.parentAgentId!=null,xe=z!=null&&z.orphaned?R.kind==="agent"&&R.parentName?r("tasks.row.from",{parent:R.parentName}):r("tasks.row.nested"):null;return l.jsxs("div",{className:`${Gt.task} ${le?Gt.taskExpanded:""}`,children:[l.jsxs("div",{className:te?`${Gt.row} ${Gt.selected}`:Gt.row,onClick:()=>{p(Z),h(t&&le?"list":"detail")},onMouseEnter:()=>{t||p(Z)},children:[l.jsx("span",{className:Gt.pointer,children:te?"❯":""}),t&&l.jsx("span",{className:Gt.taskIcon,"aria-hidden":"true"}),l.jsxs("span",{className:Gt.nameCell,style:X>0?{paddingLeft:`${X*16}px`}:void 0,children:[fe&&l.jsx("span",{className:Gt.treeMarker,"aria-hidden":"true",children:"↳ "}),nWe(R,I.has(R.id)),xe&&l.jsxs("span",{className:Gt.orphanNote,children:[" · ",xe]})]}),l.jsx("span",{className:`${Gt.status} ${Y}`,children:ae}),l.jsx("span",{className:Gt.chevronCell,children:l.jsx(tWe,{expanded:le})})]}),le&&l.jsx("div",{className:Gt.inlineDetail,children:l.jsx(Dq,{task:R,t:r,hideHeader:!0,busy:x,showCancelConfirm:g===R.id,onCancel:()=>void L(R),onCancelConfirmDismiss:()=>b(null)})})]},R.id)}),!t&&M>0&&l.jsx("div",{className:Gt.overflowHint,children:r("tasks.moreBelow",{count:M})})]}),!t&&d==="detail"&&E&&l.jsxs(l.Fragment,{children:[k&&l.jsx("div",{className:Gt.error,children:k}),l.jsx(Dq,{task:E,t:r,busy:x,showCancelConfirm:g===E.id,onCancel:()=>void L(E),onCancelConfirmDismiss:()=>b(null)})]}),!t&&l.jsx("div",{className:O?`${Gt.shortcuts} ${Gt.confirmHint}`:Gt.shortcuts,children:(d==="list"?A:$).join(" · ")})]})}function iWe(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 Dq({task:e,t,hideHeader:n=!1,busy:s=!1,showCancelConfirm:r=!1,onCancel:i,onCancelConfirmDismiss:o}){var w,k,T;const a=eWe(e.status),c=eae(e.status),u=e.kind==="agent"&&e.status==="paused",d=e.status==="running"||u,h=t(u?"tasks.action.abandon":"tasks.action.stop"),m=t(u?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),p=[b3(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:b3(e.runtimeMs)}],b=e.kind==="agent"?((w=e.stats)==null?void 0:w.outputTokens)??((k=e.stats)==null?void 0:k.totalTokens):void 0;b&&(p.push(t("tasks.detail.tokens",{count:Rq(b)})),g.push({label:t("tasks.detail.tokenCount"),value:Rq(b)})),e.kind==="agent"&&((T=e.stats)==null?void 0:T.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 x=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],y=d&&i?l.jsx("div",{className:Gt.actionBar,children:r?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Gt.actionHint,children:t("tasks.action.confirmHint")}),l.jsx("button",{type:"button",className:`${Gt.actionButton} ${Gt.dangerButton}`,disabled:s,onClick:i,children:m}),l.jsx("button",{type:"button",className:Gt.actionButton,onClick:o,children:t("common.cancel")})]}):l.jsx("button",{type:"button",className:`${Gt.actionButton} ${Gt.dangerButton}`,disabled:s,onClick:i,children:h})}):null,v=n?g.length>0?l.jsx("div",{className:Gt.compactSummary,children:g.map(C=>`${C.label} ${C.value}`).join(" · ")}):null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Gt.title,children:iWe(e,t)}),l.jsxs("div",{className:Gt.statusBadge,children:[a&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:c,children:[a," ",t(`tasks.${e.status}`)]}),l.jsx("span",{className:Gt.separator,children:"·"})]}),l.jsx("span",{className:Gt.secondary,children:p.join(" · ")})]})]});return l.jsxs("div",{className:Gt.detail,children:[(v||y)&&l.jsxs("div",{className:Gt.detailTop,children:[v&&l.jsx("div",{className:Gt.detailTopMain,children:v}),y]}),e.kind==="shell"&&l.jsxs(l.Fragment,{children:[l.jsx(Rg,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&l.jsx(Rg,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&l.jsx(Rg,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&l.jsx(Rg,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&l.jsx(Rg,{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&&l.jsxs("div",{className:Gt.detailField,children:[l.jsx("div",{className:Gt.detailFieldLabel,children:t("tasks.detail.progress")}),l.jsx("div",{className:Gt.detailContent,children:e.recentActivities.slice(-5).map((C,_,S)=>{const D=_===S.length-1,E=rWe(C.name,C.description,t);return l.jsxs("div",{className:D?Gt.activityCurrent:Gt.activityPast,children:[D?"> ":"  ",E]},`${C.at}-${_}`)})})]}),e.kind==="agent"&&e.prompt&&l.jsxs("div",{className:Gt.detailField,children:[l.jsx("div",{className:Gt.detailFieldLabel,children:t("tasks.detail.prompt")}),l.jsx("div",{className:Gt.promptContent,children:x.slice(0,5).map((C,_,S)=>l.jsx("div",{children:_===S.length-1&&x.length>5?`${C}…`:C||" "},_))})]}),e.kind==="agent"&&e.outputFile&&l.jsx(Rg,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&l.jsxs("div",{className:Gt.detailField,children:[l.jsx("div",{className:`${Gt.detailFieldLabel} ${Gt.error}`,children:t("tasks.detail.resumeBlocked")}),l.jsx("div",{className:Gt.error,children:e.resumeBlockedReason})]}),e.error&&l.jsxs("div",{className:Gt.detailField,children:[l.jsx("div",{className:`${Gt.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?Gt.warning:Gt.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),l.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?Gt.warning:Gt.error,children:e.error})]})]})}function Rg({label:e,value:t}){return l.jsxs("div",{className:Gt.detailField,children:[l.jsx("div",{className:Gt.detailFieldLabel,children:e}),l.jsx("div",{className:Gt.detailContent,children:t})]})}const oWe="_message_fm8gc_1",aWe="_body_fm8gc_15",lWe="_title_fm8gc_20",cWe="_muted_fm8gc_24",uWe="_accent_fm8gc_28",dWe="_success_fm8gc_32",hWe="_error_fm8gc_36",fWe="_warning_fm8gc_40",mWe="_row_fm8gc_44",pWe="_label_fm8gc_50",gWe="_value_fm8gc_55",ul={message:oWe,body:aWe,title:lWe,muted:cWe,accent:uWe,success:dWe,error:hWe,warning:fWe,row:mWe,label:pWe,value:gWe},IN="web-shell-goal-status-active",{serialize:Lq,parse:bWe}=FT(Dpe),yWe=new Set(["set","achieved","cleared","failed","aborted","checking"]);function y3(e){const t=typeof e=="string"?bWe(e):e;return vWe(t)}function vWe(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,s=t.condition;if(typeof n!="string"||!yWe.has(n)||typeof s!="string")return null;const r=f7(t.iterations),i=f7(t.durationMs),o=f7(t.setAt),a=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:s,...r!==void 0?{iterations:r}:{},...i!==void 0?{durationMs:i}:{},...o!==void 0?{setAt:o}:{},...a!==void 0?{lastReason:a}:{}}}function f7(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function xWe(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function wWe(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:ul.muted};case"set":return{title:t("goal.set"),colorClass:ul.accent};case"achieved":return{title:t("goal.achieved"),colorClass:ul.success};case"cleared":return{title:t("goal.cleared"),colorClass:ul.muted};case"failed":return{title:t("goal.failed"),colorClass:ul.error};case"aborted":return{title:t("goal.aborted"),colorClass:ul.warning}}}function kWe({status:e,activateFooter:t=!1}){var u;const{t:n}=at(),s=I9();f.useEffect(()=>{if(!t||s==="readonly")return;const d=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(IN,{detail:{active:d,condition:e.condition,setAt:e.setAt}}))},[t,s,e.condition,e.kind,e.setAt]);const r=wWe(e,n),i=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&i.push(xWe(e.iterations,n)),typeof e.durationMs=="number"&&i.push(b3(e.durationMs)));const o=i.length>0?` · ${i.join(" · ")}`:"",a=(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 l.jsx("div",{className:ul.message,children:l.jsxs("div",{className:ul.body,children:[l.jsxs("div",{className:`${ul.title} ${r.colorClass}`,children:[r.title,o&&l.jsx("span",{className:ul.muted,children:o})]}),l.jsxs("div",{className:ul.row,children:[l.jsxs("span",{className:ul.label,children:[n("goal.label"),":"]}),l.jsx("span",{className:ul.value,children:e.condition})]}),a&&l.jsxs("div",{className:ul.muted,children:[c,": ",a]})]})})}const _We="_message_u8kmd_1",SWe="_flushMessage_u8kmd_12",CWe="_noMarker_u8kmd_26",TWe="_content_u8kmd_30",EWe="_info_u8kmd_49",AWe="_recap_u8kmd_54",jWe="_modelSwitch_u8kmd_67",NWe="_error_u8kmd_71",MWe="_warning_u8kmd_77",IWe="_retryHint_u8kmd_83",RWe="_retryButton_u8kmd_90",DWe="_cancelled_u8kmd_108",rl={message:_We,flushMessage:SWe,noMarker:CWe,content:TWe,info:EWe,recap:AWe,modelSwitch:jWe,error:NWe,warning:MWe,retryHint:IWe,retryButton:RWe,cancelled:DWe},LWe=f.memo(function({content:t,variant:n,source:s,data:r,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:c}){const{t:u}=at();if(s==="prompt_cancelled")return l.jsx("div",{className:rl.cancelled,role:"status",children:l.jsx("span",{children:u("turn.stopped")})});const d=n==="info"?iHe(t):null;if(d)return l.jsx("div",{className:rl.flushMessage,children:l.jsx(hHe,{status:d,onShowDetail:i})});const h=n==="info"?GHe(t):null;if(h)return l.jsx("div",{className:rl.flushMessage,children:l.jsx(tqe,{view:h.view,status:h.status})});const m=n==="info"?uqe(t):null;if(m)return l.jsx("div",{className:rl.flushMessage,children:l.jsx(dqe,{info:m})});const p=n==="info"?Kqe(t):null;if(p)return l.jsx("div",{className:rl.flushMessage,children:l.jsx(tUe,{message:p})});const g=n==="info"?QUe(t):null;if(g)return l.jsx("div",{className:rl.flushMessage,children:l.jsx(tae,{message:g})});const b=n==="info"?y3(s==="goal"?r:t):null;if(b)return l.jsx("div",{className:rl.flushMessage,children:l.jsx(kWe,{status:b,activateFooter:o})});const x=n==="info"&&s==="model_switch_summary",y=n==="info"&&s==="recap";return l.jsx("div",{className:`${rl.message} ${rl[n]} ${x?rl.modelSwitch:""} ${y?rl.recap:""}`,children:l.jsxs("div",{className:rl.content,children:[x?l.jsx("pre",{children:t}):n==="info"?l.jsx(Tm,{content:t}):l.jsx("pre",{children:t}),a&&c&&l.jsx("div",{className:rl.retryHint,children:l.jsx("button",{type:"button",className:rl.retryButton,onClick:c,children:u("retry.hint")})})]})})}),PWe="_group_117nk_1",OWe="_chatSummaryGroup_117nk_14",$We="_line_117nk_22",BWe="_chatSummary_117nk_14",zWe="_chatSummaryTextActive_117nk_49",FWe="_chatSummaryIcon_117nk_55",HWe="_chatSummaryToolIcon_117nk_69",qWe="_chatSummaryText_117nk_49",UWe="_chatSummaryInline_117nk_85",WWe="_chatChevronRight_117nk_122",VWe="_chatChevronDown_117nk_123",GWe="_chatSummaryContentClip_117nk_184",KWe="_chatSummaryContentCollapsed_117nk_192",YWe="_chatSummaryContentInner_117nk_196",XWe="_lineMain_117nk_201",QWe="_icon_117nk_211",JWe="_iconError_117nk_216",ZWe="_lineName_117nk_221",eVe="_lineArg_117nk_225",tVe="_lineElapsed_117nk_233",nVe="_lineExpandable_117nk_239",sVe="_lineButton_117nk_246",rVe="_lineChevronRight_117nk_267",iVe="_lineChevronDown_117nk_268",oVe="_lineOutput_117nk_305",aVe="_expandedCard_117nk_314",lVe="_expandedCardHeader_117nk_324",cVe="_expandedCardTitle_117nk_333",uVe="_expandedCardDetail_117nk_340",dVe="_expandedCardBody_117nk_350",hVe="_expandedAgentCard_117nk_355",fVe="_expandedLineOutput_117nk_365",mVe="_lineDetail_117nk_369",pVe="_markdownLineDetail_117nk_375",gVe="_expandedBash_117nk_383",bVe="_expandedRead_117nk_384",yVe="_expandedOutput_117nk_388",vVe="_expandedEdit_117nk_402",xVe="_todoProgress_117nk_416",wVe="_todoBody_117nk_423",kVe="_compactGroup_117nk_431",_Ve="_compactHeader_117nk_438",SVe="_compactCount_117nk_448",CVe="_compactHint_117nk_454",Kt={group:PWe,chatSummaryGroup:OWe,line:$We,chatSummary:BWe,chatSummaryTextActive:zWe,chatSummaryIcon:FWe,chatSummaryToolIcon:HWe,chatSummaryText:qWe,chatSummaryInline:UWe,chatChevronRight:WWe,chatChevronDown:VWe,chatSummaryContentClip:GWe,chatSummaryContentCollapsed:KWe,chatSummaryContentInner:YWe,lineMain:XWe,icon:QWe,iconError:JWe,lineName:ZWe,lineArg:eVe,lineElapsed:tVe,lineExpandable:nVe,lineButton:sVe,lineChevronRight:rVe,lineChevronDown:iVe,lineOutput:oVe,expandedCard:aVe,expandedCardHeader:lVe,expandedCardTitle:cVe,expandedCardDetail:uVe,expandedCardBody:dVe,expandedAgentCard:hVe,expandedLineOutput:fVe,lineDetail:mVe,markdownLineDetail:pVe,expandedBash:gVe,expandedRead:bVe,expandedOutput:yVe,expandedEdit:vVe,todoProgress:xVe,todoBody:wVe,compactGroup:kVe,compactHeader:_Ve,compactCount:SVe,compactHint:CVe};function jh({status:e}){const{t}=at();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return l.jsx("span",{className:`${Kt.icon} ${Kt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function Zw(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 s=Math.floor(n/60),r=n%60;return`${s}m ${r}s`}function nae(e){if(!e)return"";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return`${n}m ${s}s`}function sae(e){const t=Math.max(1,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}const TVe="_panel_rcjxd_1",EVe="_header_rcjxd_11",AVe="_desc_rcjxd_23",jVe="_toggle_rcjxd_32",NVe="_meta_rcjxd_38",MVe="_body_rcjxd_44",IVe="_content_rcjxd_55",RVe="_stream_rcjxd_70",DVe="_streamCollapsed_rcjxd_80",LVe="_scrollWindow_rcjxd_88",PVe="_expandToggle_rcjxd_93",OVe="_sectionCap_rcjxd_110",$Ve="_tools_rcjxd_128",BVe="_step_rcjxd_142",zVe="_toolTimeRow_rcjxd_188",FVe="_toolTimeTip_rcjxd_192",Ei={panel:TVe,header:EVe,desc:AVe,toggle:jVe,meta:NVe,body:MVe,content:IVe,stream:RVe,streamCollapsed:DVe,scrollWindow:LVe,expandToggle:PVe,sectionCap:OVe,tools:$Ve,step:BVe,toolTimeRow:zVe,toolTimeTip:FVe};function rae(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function HVe({timestamp:e,children:t}){return e===void 0?l.jsx(l.Fragment,{children:t}):l.jsxs("div",{className:Ei.toolTimeRow,children:[t,l.jsx("span",{className:Ei.toolTimeTip,"aria-hidden":"true",children:tb(e)})]})}const qVe=f.memo(function({tool:t}){const n=t.subTools||t.subContent?l.jsx(oD,{tool:t}):l.jsx(PN,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return l.jsx(HVe,{timestamp:t.startTime,children:n})});function UVe({tc:e}){const{t}=at();return l.jsx("div",{className:Kt.line,children:l.jsxs("div",{className:Kt.lineMain,children:[l.jsx(jh,{status:e.status}),l.jsx("span",{className:Kt.lineName,children:uu(e.name,t)})]})})}function WVe(e){var t;if(e.rawOutput&&rae(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 VVe({text:e}){const{compactThinking:t}=mu(),{t:n}=at(),[s,r]=f.useState(!1),[i,o]=f.useState(!1),a=f.useRef(null),c=t&&!s;return f.useEffect(()=>{const u=a.current;!u||!c||(o(u.scrollHeight>u.clientHeight),u.scrollTop=u.scrollHeight)},[c,e]),f.useEffect(()=>{const u=a.current;if(!u||!c)return;const d=()=>o(u.scrollHeight>u.clientHeight),h=new ResizeObserver(d);return h.observe(u),()=>h.disconnect()},[c]),l.jsxs("div",{children:[l.jsx("pre",{ref:a,className:c?`${Ei.stream} ${Ei.streamCollapsed}`:Ei.stream,children:e}),t&&(i||s)&&l.jsx("button",{className:Ei.expandToggle,onClick:()=>r(u=>!u),"aria-expanded":s,"aria-label":n("subagent.toggleStream"),children:s?"▲":"▼"})]})}function GVe({content:e}){const{compactThinking:t}=mu();return l.jsx("div",{className:t?Ei.scrollWindow:void 0,children:l.jsx(Tm,{content:e,source:"assistant"})})}function Pq({pinTail:e,itemCount:t,children:n}){const s=f.useRef(null);return f.useEffect(()=>{const r=s.current;r&&(r.scrollTop=e?r.scrollHeight:0)},[e,t]),l.jsx("div",{ref:s,className:`${Ei.tools} ${Ei.scrollWindow}`,children:n})}function oD({tool:e,defaultExpanded:t,hideHeader:n,inline:s}){var T,C,_,S;const{t:r}=at(),i=e.status==="completed"||e.status==="failed",o=lw(e),[a,c]=f.useState(t??!1),u=rae(e.rawOutput)?e.rawOutput:null,d=((T=e.subTools)==null?void 0:T.length)||((C=u==null?void 0:u.toolCalls)==null?void 0:C.length)||0,h=zT(e),m=iD(e),p=Zw(e.startTime,e.endTime)||nae((_=u==null?void 0:u.executionSummary)==null?void 0:_.totalDurationMs),g=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(S=u==null?void 0:u.executionSummary)==null?void 0:S.outputTokens,b=g?rD(g):"",x=i?WVe(e):"",y=f.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),v=!!(e.subContent||x),w=!!(e.subTools&&e.subTools.length>0||y&&y.length>0),k=i&&v&&w;return l.jsxs("div",{className:s?void 0:Ei.panel,children:[!n&&l.jsxs("div",{className:Ei.header,onClick:()=>c(!a),children:[l.jsx(jh,{status:o}),l.jsxs("span",{className:Kt.lineName,children:[m,":"]}),h&&l.jsx("span",{className:Ei.desc,children:fo(h,50)}),i&&d>0&&l.jsxs("span",{className:Ei.meta,children:["· ",r("subagent.toolsCount",{count:d})]}),p&&l.jsxs("span",{className:Ei.meta,children:["· ",p]}),b&&l.jsxs("span",{className:Ei.meta,children:["· ",b]}),!i&&l.jsx("span",{className:Ei.toggle,children:a?"▼":"▶"})]}),(a||n)&&l.jsxs("div",{className:Ei.body,children:[i&&v&&l.jsxs("div",{className:Ei.content,children:[k&&l.jsx("div",{className:Ei.sectionCap,children:r("subagent.result")}),l.jsx(GVe,{content:e.subContent||x})]}),k&&l.jsx("div",{className:Ei.sectionCap,children:r("subagent.tools",{count:d})}),e.subTools&&e.subTools.length>0&&l.jsx(Pq,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(D=>l.jsx("div",{className:Ei.step,"data-status":D.status,children:l.jsx(qVe,{tool:D})},D.callId))}),y&&y.length>0&&l.jsx(Pq,{pinTail:!i,itemCount:y.length,children:y.map(D=>l.jsx("div",{className:Ei.step,"data-status":D.status,children:l.jsx(UVe,{tc:D})},D.callId))}),!i&&e.subContent&&l.jsx("div",{className:Ei.content,children:l.jsx(VVe,{text:e.subContent})})]})]})}const KVe="_view_1ycry_1",YVe="_stats_1ycry_7",XVe="_statAdd_1ycry_16",QVe="_statDel_1ycry_20",JVe="_lines_1ycry_24",ZVe="_line_1ycry_24",eGe="_lineAdd_1ycry_36",tGe="_lineDel_1ycry_40",nGe="_lineHeader_1ycry_44",sGe="_lineContext_1ycry_50",rGe="_lineNo_1ycry_54",iGe="_marker_1ycry_64",oGe="_content_1ycry_79",Ou={view:KVe,stats:YVe,statAdd:XVe,statDel:QVe,lines:JVe,line:ZVe,lineAdd:eGe,lineDel:tGe,lineHeader:nGe,lineContext:sGe,lineNo:rGe,marker:iGe,content:oGe};function aGe(e){let t=0,n=0;const s=[];let r=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const a=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);a&&(r=parseInt(a[1],10),i=parseInt(a[2],10)),s.push({type:"header",content:o})}else o.startsWith("+")&&!o.startsWith("+++ ")?(t++,s.push({type:"add",content:o.slice(1),newLine:i}),i++):o.startsWith("-")&&!o.startsWith("--- ")?(n++,s.push({type:"del",content:o.slice(1),oldLine:r}),r++):(s.push({type:"context",content:o.startsWith(" ")?o.slice(1):o,oldLine:r,newLine:i}),r++,i++);return{lines:s,additions:t,deletions:n}}const lGe=f.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:s,deletions:r}=aGe(t);return l.jsxs("div",{className:Ou.view,children:[l.jsxs("div",{className:Ou.stats,children:[s>0&&l.jsxs("span",{className:Ou.statAdd,children:["+",s]}),r>0&&l.jsxs("span",{className:Ou.statDel,children:["-",r]})]}),l.jsx("div",{className:Ou.lines,children:n.map((i,o)=>l.jsxs("div",{className:`${Ou.line} ${Ou[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[l.jsx("span",{className:Ou.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),l.jsx("span",{className:Ou.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),l.jsx("span",{className:Ou.content,children:i.content})]},o))})]})}),Oq={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"};function cGe(e){const t=[];let n,s=!1,r=!1,i=0;const o=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let a;for(;(a=o.exec(e))!==null;){a.index>i&&t.push({text:e.slice(i,a.index),color:n,bold:s,dim:r}),i=a.index+a[0].length;const c=a[1].split(";").map(Number);for(const u of c)u===0?(n=void 0,s=!1,r=!1):u===1?s=!0:u===2?r=!0:u===22?(s=!1,r=!1):u>=30&&u<=37||u>=90&&u<=97?n=Oq[u]:u===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:s,dim:r}),t}function uGe(e){return new RegExp(String.raw`\x1b\[`).test(e)}function Qh(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function m7(e){const t=e.flatMap((n,s)=>{const r=x3(n),i=a2(r,"content");return i?[{id:a2(r,"id")??`plan-${s}`,content:i,status:kGe(a2(r,"status")),priority:_Ge(a2(r,"priority"))}]:[]});return t.length>0?t:void 0}function aD(e){if(!Qh(e.toolName)&&e.kind!=="other")return;const t=Bq(e.args);if(t)return m7(t);const n=x3(e.rawOutput),s=Bq(n);if(s)return m7(s);const r=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return r?m7(r):void 0}function dGe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function v3(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const $q={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function hGe(e){let t=[],n=null,s=null,r=!1;for(const o of e){if(o.role==="user"||o.role==="user_shell"){r=!0;continue}if(o.role==="plan"){t=o.todos,n=o.id,s=null,r=!1;continue}if(o.role==="tool_group")for(const a of o.tools){const c=aD(a);c&&(t=c,n=o.id,s=a.callId,r=!1)}}if(t.length===0)return $q;const i=!dGe(t);return r?$q:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:s}}function lD(e){return JSON.stringify([e.id,e.content])}function HT(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 s=aD(n);s&&t.push({key:n.callId,todos:s,stats:gGe(n)})}return t}return[]}function fGe(e){const t=new Map,n=new Map;for(const s of e)for(const{key:r,todos:i}of HT(s)){const o=[];for(const a of i){const c=lD(a),u=n.get(c);a.status==="in_progress"&&u!=="in_progress"?o.push({kind:"started",id:a.id,content:a.content}):a.status==="completed"&&u!=="completed"&&u!==void 0&&o.push({kind:"completed",id:a.id,content:a.content}),n.set(c,a.status)}t.set(r,{events:o})}return t}function mGe(e){const t=[];for(const n of e)for(const{key:s,todos:r}of HT(n))t.push(JSON.stringify([s,r.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function pGe(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const s of n.tools)!Qh(s.toolName)&&(s.startTime!==void 0||s.endTime!==void 0)&&t.push(JSON.stringify(["span",s.callId,s.startTime,s.endTime]));for(const{key:s,todos:r,stats:i}of HT(n))t.push(JSON.stringify([s,n.timestamp,r.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function gGe(e){var o;const t=x3((o=x3(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=a=>{const c=t[a];return typeof c=="number"&&Number.isFinite(c)?c:void 0},s=n("promptTokens"),r=n("cachedTokens"),i=n("candidateTokens");if(!(s===void 0||r===void 0||i===void 0))return{promptTokens:s,cachedTokens:r,candidateTokens:i,apiTimeMs:n("apiTimeMs")??0}}function bGe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools){if(Qh(s.toolName))continue;const{startTime:r,endTime:i}=s;typeof r=="number"&&typeof i=="number"&&i>=r&&t.push({start:r,end:i})}return t.sort((n,s)=>n.start-s.start),t}function yGe(e,t,n){let s=0,r=e.length;for(;s<r;){const o=s+r>>>1;e[o].start<t?s=o+1:r=o}let i=0;for(let o=s;o<e.length&&e[o].start<=n;o++)i+=e[o].end-e[o].start;return i}function vGe(e,t){const n=(s,r)=>Math.max(0,r-s);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 xGe(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 wGe(e){var a;const t=new Map,n=new Map,s=new Map,r=new Set,i=bGe(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:h}of HT(c))for(const m of d){const p=lD(m),g=n.get(p);if(m.status==="in_progress"&&g!=="in_progress")r.has(p)&&(r.delete(p),s.delete(p),t.delete(p)),s.get(p)===void 0&&(s.set(p,h),u!==void 0&&(o(p).startTs=u));else if(m.status==="completed"&&g!=="completed"&&g!==void 0){const b=s.get(p),x=b&&h?vGe(b,h):void 0,y=(a=t.get(p))==null?void 0:a.startTs,v=y!==void 0&&u!==void 0?yGe(i,y,u):void 0,w=xGe(x,v);if(u!==void 0||w){const k=o(p);u!==void 0&&(k.endTs=u),w&&(k.resources=w)}}m.status==="completed"&&r.add(p),n.set(p,m.status)}}return t}function Bq(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function kGe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function _Ge(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function x3(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function a2(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const pS=new Set;let Jy=null,iae=Date.now();function SGe(){iae=Date.now();for(const e of pS)e()}function CGe(e){return pS.add(e),Jy||(Jy=setInterval(SGe,1e3)),()=>{pS.delete(e),pS.size===0&&Jy&&(clearInterval(Jy),Jy=null)}}function cD(e){const[t,n]=f.useState(()=>Date.now());return f.useEffect(()=>{if(e)return n(Date.now()),CGe(()=>n(iae))},[e]),t}const oae=f.createContext(void 0);function aae({onOpen:e,children:t}){return l.jsx(oae.Provider,{value:{onOpen:e},children:t})}function uD(){return f.useContext(oae)}const TGe="_list_1bo8s_1",EGe="_summary_1bo8s_2",AGe="_row_1bo8s_8",jGe="_num_1bo8s_16",NGe="_icon_1bo8s_23",MGe="_text_1bo8s_29",IGe="_inProgress_1bo8s_43",RGe="_completed_1bo8s_48",DGe="_item_1bo8s_62",LGe="_rowButton_1bo8s_69",PGe="_detailChevron_1bo8s_82",OGe="_detail_1bo8s_82",$Ge="_detailSection_1bo8s_100",BGe="_detailSectionTitle_1bo8s_106",zGe="_detailRows_1bo8s_114",FGe="_detailLabel_1bo8s_122",HGe="_detailValue_1bo8s_126",qGe="_detailDuration_1bo8s_132",UGe="_detailHint_1bo8s_136",ar={list:TGe,summary:EGe,row:AGe,num:jGe,icon:NGe,text:MGe,inProgress:IGe,completed:RGe,item:DGe,rowButton:LGe,detailChevron:PGe,detail:OGe,detailSection:$Ge,detailSectionTitle:BGe,detailRows:zGe,detailLabel:FGe,detailValue:HGe,detailDuration:qGe,detailHint:UGe};function RN(e){switch(e){case"completed":return ar.completed;case"in_progress":return ar.inProgress;case"pending":return""}}function lae({todos:e,events:t}){const{t:n}=at();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return l.jsx("div",{className:ar.summary,children:l.jsxs("div",{className:`${ar.row} ${ar.completed}`,children:[l.jsx("span",{className:ar.icon,"aria-hidden":"true",children:"✓"}),l.jsx("span",{className:ar.text,children:n("todo.allDone")})]})});const r=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return r?l.jsx("div",{className:ar.summary,children:l.jsxs("div",{className:`${ar.row} ${RN(r.status)}`,children:[l.jsx("span",{className:ar.icon,"aria-hidden":"true",children:v3(r.status)}),l.jsx("span",{className:ar.text,children:r.content})]})}):null}return l.jsx("div",{className:ar.summary,children:t.map(s=>l.jsxs("div",{className:`${ar.row} ${s.kind==="completed"?ar.completed:ar.inProgress}`,children:[l.jsx("span",{className:ar.icon,"aria-hidden":"true",children:v3(s.kind==="completed"?"completed":"in_progress")}),l.jsx("span",{className:ar.text,children:s.content})]},`${s.kind}-${s.id}`))})}function Tp({label:e,value:t,suffix:n}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ar.detailLabel,children:e}),l.jsxs("span",{className:ar.detailValue,children:[t,n]})]})}function p7({title:e,children:t}){return l.jsxs("div",{className:ar.detailSection,children:[l.jsx("div",{className:ar.detailSectionTitle,children:e}),l.jsx("div",{className:ar.detailRows,children:t})]})}function WGe({detail:e}){const{t}=at(),{startTs:n,endTs:s,resources:r}=e,i=n!==void 0||s!==void 0,o=(r==null?void 0:r.inputTokens)!==void 0,a=(r==null?void 0:r.apiTimeMs)!==void 0||(r==null?void 0:r.toolTimeMs)!==void 0;return l.jsxs("div",{className:ar.detail,children:[i&&l.jsxs(p7,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&l.jsx(Tp,{label:t("todo.detail.start"),value:tb(n)}),s!==void 0&&l.jsx(Tp,{label:t("todo.detail.end"),value:tb(s),suffix:n!==void 0?l.jsxs("span",{className:ar.detailDuration,children:[" ","(",um(s-n),")"]}):void 0})]}),o&&l.jsxs(p7,{title:t("todo.detail.sectionTokens"),children:[l.jsx(Tp,{label:t("todo.detail.input"),value:((r==null?void 0:r.inputTokens)??0).toLocaleString()}),l.jsx(Tp,{label:t("todo.detail.output"),value:((r==null?void 0:r.outputTokens)??0).toLocaleString()}),l.jsx(Tp,{label:t("todo.detail.cached"),value:((r==null?void 0:r.cachedTokens)??0).toLocaleString()})]}),a&&l.jsxs(p7,{title:t("todo.detail.sectionSpent"),children:[(r==null?void 0:r.apiTimeMs)!==void 0&&l.jsx(Tp,{label:t("todo.detail.api"),value:um(r.apiTimeMs)}),(r==null?void 0:r.toolTimeMs)!==void 0&&l.jsx(Tp,{label:t("todo.detail.tool"),value:um(r.toolTimeMs)})]}),!r&&l.jsx("div",{className:ar.detailHint,children:t("todo.detail.noResources")})]})}function VGe(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function cae({todos:e,numbered:t=!1}){const{t:n}=at(),s=f.useContext(fce),[r,i]=f.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=c=>i(u=>{const d=new Set(u);return d.has(c)?d.delete(c):d.add(c),d});return l.jsx("div",{className:ar.list,children:e.map((c,u)=>{const d=c.id||String(u),h=s.get(lD(c)),m=VGe(h),p=m&&r.has(d),g=l.jsxs(l.Fragment,{children:[t&&l.jsxs("span",{className:ar.num,style:{minWidth:o},children:[u+1,"."]}),l.jsx("span",{className:ar.icon,"aria-hidden":"true",children:v3(c.status)}),l.jsx("span",{className:ar.text,children:c.content}),m&&l.jsx("span",{className:ar.detailChevron,"aria-hidden":"true",children:p?"▾":"▸"})]});return l.jsxs("div",{className:ar.item,children:[m?l.jsx("button",{type:"button",className:`${ar.row} ${ar.rowButton} ${RN(c.status)}`,onClick:b=>{b.stopPropagation(),a(d)},"aria-expanded":p,title:n(p?"todo.detail.hide":"todo.detail.show"),children:g}):l.jsx("div",{className:`${ar.row} ${RN(c.status)}`,children:g}),p&&h&&l.jsx(WGe,{detail:h})]},d)})})}function GGe(e){const t=e.toolName.toLowerCase();if(yu(e.toolName))return!!cd(e);if(t==="write_file"||t==="writefile")return!!cKe(e)||zq(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(Xl(t)){const n=cd(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(BT(t))return!!hae(e);if(t==="edit"||t==="write"||t==="editfile")return zq(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=cd(e);return!!n&&n.split(`
`).length>3}return!1}function KGe(e){const t=e.toolName.toLowerCase();return Xl(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||BT(t)||yu(e.toolName)}function YGe(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!uae(e)}function zq(e){return YGe(e)||!!cd(e)}function XGe(e){const t=uae(e);if(t)return t;if(e.content){const n=e.content.find(s=>s.type==="diff");if(n&&n.type==="diff")return ZGe(n.oldText||"",n.newText||"")}return""}function uae(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(QGe(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function QGe(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const JGe=25e4;function ZGe(e,t){const n=e.split(`
`),s=t.split(`
`),r=n.length,i=s.length;if(r*i>JGe){const d=n.map(m=>m?`-${m}`:"-"),h=s.map(m=>m?`+${m}`:"+");return[...d,...h].join(`
`)}const o=Array.from({length:r+1},()=>Array(i+1).fill(0));for(let d=1;d<=r;d++)for(let h=1;h<=i;h++)o[d][h]=n[d-1]===s[h-1]?o[d-1][h-1]+1:Math.max(o[d-1][h],o[d][h-1]);const a=[];let c=r,u=i;for(;c>0||u>0;)c>0&&u>0&&n[c-1]===s[u-1]?(a.push(` ${n[c-1]}`),c--,u--):u>0&&(c===0||o[c][u-1]>=o[c-1][u])?(a.push(`+${s[u-1]}`),u--):(a.push(`-${n[c-1]}`),c--);return a.reverse().join(`
`)}const eKe=60,tKe=2e5,nKe=1e3,sKe={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 rKe({tool:e}){const t=f.useMemo(()=>cd(e)||"",[e]),n=f.useMemo(()=>uGe(t)?cGe(t):null,[t]);return l.jsx("div",{className:Kt.expandedBash,children:l.jsx("pre",{className:Kt.expandedOutput,children:n?n.map((s,r)=>l.jsx("span",{style:{color:s.color,fontWeight:s.bold?"bold":void 0,opacity:s.dim?.6:void 0},children:s.text},r)):t})})}function iKe({tool:e}){const t=f.useMemo(()=>cd(e)||"",[e]),n=dae(oKe(e)),s=n==="text"||t.length>tKe||aKe(t,nKe);return l.jsx("div",{className:Kt.expandedRead,children:s?l.jsx("pre",{className:Kt.expandedOutput,children:t}):l.jsx(Tm,{content:lKe(n,t)})})}function oKe(e){var n,s;const t=((n=e.args)==null?void 0:n.file_path)??((s=e.args)==null?void 0:s.path);return typeof t=="string"?t:""}function aKe(e,t){let n=1;for(let s=0;s<e.length;s++)if(e.charCodeAt(s)===10&&++n>t)return!0;return!1}function dae(e){var s,r;const t=(r=(s=e.split(/[?#]/,1)[0])==null?void 0:s.split(".").pop())==null?void 0:r.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";const n=sKe[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function lKe(e,t){var r;const n=((r=t.match(/~{3,}/g))==null?void 0:r.reduce((i,o)=>Math.max(i,o.length),0))??0,s="~".repeat(Math.max(3,n+1));return`${s}${e}
${t}
${s}`}function Fq({tool:e}){const t=f.useMemo(()=>XGe(e),[e]),n=f.useMemo(()=>cd(e)||"",[e]);return!t&&!n?null:l.jsx("div",{className:Kt.expandedEdit,children:t?l.jsx(lGe,{diff:t}):l.jsx("pre",{className:Kt.expandedOutput,children:n})})}function DN({title:e,detail:t,children:n}){return l.jsxs("div",{className:Kt.expandedCard,children:[l.jsxs("div",{className:Kt.expandedCardHeader,children:[l.jsx("span",{className:Kt.expandedCardTitle,children:e}),t&&l.jsx("span",{className:Kt.expandedCardDetail,children:t})]}),n&&l.jsx("div",{className:Kt.expandedCardBody,children:n})]})}function cKe(e){var n,s;if((n=e.args)!=null&&n.content)return e.args.content;if((s=e.args)!=null&&s.new_string)return e.args.new_string;const t=cd(e);if(t)return t;if(e.rawOutput&&typeof e.rawOutput=="object"){const r=e.rawOutput;if(typeof r.content=="string")return r.content;if(typeof r.newContent=="string")return r.newContent}return""}function uKe({tool:e,todos:t,expanded:n,title:s}){var o;const i=((o=f.useContext(ID).get(e.callId))==null?void 0:o.events)??[];return n?l.jsx(DN,{title:s,children:l.jsx("div",{className:Kt.todoBody,children:l.jsx(cae,{todos:t})})}):l.jsx("div",{className:Kt.todoBody,children:l.jsx(lae,{todos:t,events:i})})}function dKe(e,t){var p,g;const n=Jw(e.rawOutput),s=sD(e),r=lw(e),i=iD(e),o=hKe(e),a=zT(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"?nae(u.totalDurationMs):Zw(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),h=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:u&&typeof u.outputTokens=="number"&&u.outputTokens>0?u.outputTokens:0,m=h>0?rD(h):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:c,elapsed:d,tokens:m,status:r,reason:s}}function hKe(e){var r;const t=Jw(e.rawOutput),n=t==null?void 0:t.subagentName;if(typeof n=="string"&&n.trim())return n.trim();const s=(r=e.args)==null?void 0:r.subagent_type;return typeof s=="string"&&s.trim()?s.trim():""}function Hq(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(yu(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||Xl(t))}function fKe({tool:e}){const t=cd(e)||"";return l.jsx("pre",{className:Kt.expandedOutput,children:t})}function mKe({tool:e}){var n;const t=hae(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return l.jsx("pre",{className:Kt.expandedOutput,children:t})}function hae(e){var n,s;const t=(n=e.content)==null?void 0:n[0];return(t==null?void 0:t.type)!=="content"?"":typeof((s=t.content)==null?void 0:s.text)=="string"?t.content.text:""}function qT(e){const t=e.toolName.toLowerCase();return Db(e)?"agent":yu(e.toolName)?"ask":Xl(t)?"shell":hD(t)?"fetch":Qh(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 pKe({description:e,elapsed:t}){return l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:Kt.lineArg,children:e}),t&&l.jsx("span",{className:Kt.lineElapsed,children:t})]})}function cx({info:e}){const{renderToolHeaderExtra:t}=mu(),n=t==null?void 0:t(e);return n?l.jsx(l.Fragment,{children:n}):l.jsx(pKe,{description:e.description,elapsed:e.elapsed})}function gKe(e){return e.length>eKe||e.includes(`
`)}function Y0(e){return e==="in_progress"||e==="pending"||e==="running"}function dD(e){return e.find(t=>Y0(t.status))??e[e.length-1]}function bKe(e,t,n){if(pae(e)){const r=e.find(o=>Y0(o.status)&&!Oh(o)),i=r??dD(e);return yu(i.toolName)?t("toolGroup.summary.provideInformation"):!r&&Oh(i)?t("subagent.background"):t("toolGroup.running",{name:uu(i.toolName,t),count:e.length,duration:n??""})}const s=xKe(e,t);return s||t("toolGroup.summary",{count:e.length})}function yKe(e,t,n){if(Qh(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(yu(e.toolName))return Y0(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:mae(e)});const{displayName:s,description:r,hideDisplayName:i}=fae(e,t,n);return[i?"":s,r].filter(Boolean).join(" ")}function fae(e,t,n){const s=uu(e.toolName,t),r=fo(Goe(e,n),120);return{kind:qT(e),tool:e,displayName:s,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!pHe(e)}}function vKe({tool:e,runningDuration:t,workspaceCwd:n}){const{t:s}=at(),r=yu(e.toolName),i=Y0(e.status),o=!r&&i?Oh(e)?s("subagent.background"):s("toolGroup.runningPrefix").trim():"";if(Qh(e.toolName)||r)return l.jsxs(l.Fragment,{children:[o&&l.jsxs("span",{children:[o," "]}),yKe(e,s,n),t&&l.jsxs("span",{children:[" ",t]})]});const a=fae(e,s,n);return l.jsxs(l.Fragment,{children:[o&&l.jsxs("span",{children:[o," "]}),l.jsxs("span",{className:Kt.chatSummaryInline,children:[!a.hideDisplayName&&l.jsx("span",{className:Kt.lineName,children:a.displayName}),l.jsx(cx,{info:a})]}),t&&l.jsxs("span",{children:[" ",t]})]})}function xKe(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,c=0;for(const d of e){const h=d.toolName.toLowerCase();Xl(h)?s++:h==="edit"||h==="editfile"||h==="write"||h==="write_file"||h==="writefile"?n++:h==="read"||h==="read_file"||h==="readfile"?r++:h==="grep"||h==="grep_search"||h==="search"||h==="glob"||h==="web_search"||h==="websearch"?i++:Qh(h)?o++:yu(h)?a+=mae(d):c++}return[n?t("toolGroup.summary.editedFiles",{count:n}):"",s?t("toolGroup.summary.ranCommands",{count:s}):"",r?t("toolGroup.summary.readFiles",{count:r}):"",i?t("toolGroup.summary.searched",{count:i}):"",o?t("toolGroup.summary.updatedTodos",{count:o}):"",a?t("toolGroup.summary.askedQuestions",{count:a}):"",c?t("toolGroup.summary.otherTools",{count:c}):""].filter(Boolean).join(" ")}function mae(e){var n;const t=(n=e.args)==null?void 0:n.questions;return Array.isArray(t)&&t.length>0?t.length:1}function pae(e){return e.some(t=>Y0(t.status))}function wKe(){return l.jsxs("svg",{className:Kt.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:[l.jsx("path",{d:"M12 20h9"}),l.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function gae(){return l.jsxs("svg",{className:Kt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function kKe(){return l.jsxs("svg",{className:Kt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),l.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 _Ke(){return l.jsxs("svg",{className:Kt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),l.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function SKe(){return l.jsx("svg",{className:Kt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l.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 CKe(){return l.jsx("svg",{className:Kt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l.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 LN(){return l.jsx("svg",{className:Kt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:l.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 TKe({tool:e}){const t=qT(e);return t==="agent"?l.jsx(LN,{}):t==="ask"?l.jsx(CKe,{}):t==="edit"||t==="write"?l.jsx(wKe,{}):t==="fetch"?l.jsx(kKe,{}):t==="read"?l.jsx(_Ke,{}):t==="todo"?l.jsx(SKe,{}):l.jsx(gae,{})}function hD(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const EKe=lw;function AKe({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:s}=at(),r=dD(e),i=uu(r.toolName,s),o=EKe(r),a=nD(r,t),c=Y0(r.status)&&Oh(r)||Xl(r.toolName)||hD(r.toolName)?"":Zw(r.startTime,r.endTime);return l.jsxs("div",{className:`${Kt.compactGroup}${n?` ${Lm.flash}`:""}`,children:[l.jsxs("div",{className:Kt.compactHeader,children:[l.jsx(jh,{status:o}),l.jsx("span",{className:Kt.lineName,children:i}),e.length>1&&l.jsxs("span",{className:Kt.compactCount,children:["× ",e.length]}),l.jsx(cx,{info:{kind:qT(r),tool:r,displayName:i,description:a,elapsed:c,workspaceCwd:t}})]}),l.jsx("div",{className:Kt.compactHint,children:s("compact.hint")})]})}function jKe(e,t){var r,i;if(((r=e.approval)==null?void 0:r.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,s=t.tool;return n.callId===s.callId&&n.toolName===s.toolName&&n.status===s.status&&n.startTime===s.startTime&&n.endTime===s.endTime&&n.subContent===s.subContent&&n.rawOutput===s.rawOutput&&n.args===s.args&&n.content===s.content&&n.title===s.title&&NKe(n.subTools,s.subTools)}function NKe(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 s=e[n],r=t[n];if(s.callId!==r.callId||s.toolName!==r.toolName||s.status!==r.status||s.endTime!==r.endTime||s.rawOutput!==r.rawOutput||s.args!==r.args||s.subContent!==r.subContent||s.title!==r.title)return!1}return!0}const qq=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function g7(e,t){if(!e||!e.includes("qwen-session://"))return e;const n=[];let s=0,r;for(qq.lastIndex=0;(r=qq.exec(e))!==null;){r.index>s&&n.push(e.slice(s,r.index));const i=r[2];n.push(t==="readonly"?l.jsx("span",{style:{textDecoration:"underline"},children:r[1]},r.index):l.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:r[1]},r.index)),s=r.index+r[0].length}return s<e.length&&n.push(e.slice(s)),n.length===1?n[0]:l.jsx(l.Fragment,{children:n})}const PN=f.memo(function({tool:t,approval:n,workspaceCwd:s,summaryOnly:r=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:a=!1,hideCollapsedOutput:c=!1}){const{t:u}=at(),d=I9(),h=f.useContext(R0),m=uD(),[p,g]=f.useState(()=>i||!h&&Hq(t)),b=f.useRef(!1);f.useEffect(()=>{g(i||(h?!1:Hq(t))),b.current=!1},[h,i,t.callId,t.toolName]);const x=Db(t),y=n&&n.toolCallId===t.callId,v=!y&&(n==null?void 0:n.toolCallId)&&x&&du(t,n.toolCallId),w=x&&t.status==="in_progress",k=cD(w);if(f.useEffect(()=>{!i&&!x&&t.status==="completed"&&!b.current&&g(!1)},[i,x,t.status]),x){const Y=dKe(t,k),ae=Y.explicitAgentType?`${u("agent.label")} (${Y.explicitAgentType})`:u("agent.label"),le=t.status==="completed"||t.status==="failed",te=Oh(t),X=[te&&!le?u("subagent.background"):t.status==="pending"?u("subagent.pending"):u("subagent.running"),te&&!le?"":Y.elapsed].filter(Boolean).join(" · "),fe=[Y.subToolCount>0?u("subagent.toolsCount",{count:Y.subToolCount}):"",Y.elapsed,Y.tokens,Y.reason?fo(Y.reason,80):""].filter(Boolean).join(" · "),xe=i||p||!!y||!!v,ie=l.jsx(oD,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return m&&!a?l.jsx("div",{className:Kt.line,children:l.jsxs("button",{type:"button",className:`${Kt.lineMain} ${Kt.lineExpandable} ${Kt.lineButton}`,onClick:()=>m.onOpen(t),children:[l.jsx(LN,{}),l.jsx(jh,{status:le?Y.status:t.status}),l.jsx("span",{className:Kt.lineName,children:ae}),l.jsx(cx,{info:{kind:"agent",tool:t,displayName:ae,description:Y.description?fo(Y.description,60):"",elapsed:le?fe:X,workspaceCwd:s}}),l.jsx("span",{className:Kt.lineChevronRight,"aria-hidden":"true"})]})}):l.jsxs("div",{className:Kt.line,children:[!a&&l.jsxs("div",{className:`${Kt.lineMain} ${Kt.lineExpandable}`,onClick:()=>g(!p),children:[l.jsx(LN,{}),l.jsx(jh,{status:le?Y.status:t.status}),l.jsx("span",{className:Kt.lineName,children:ae}),l.jsx(cx,{info:{kind:"agent",tool:t,displayName:ae,description:Y.description?fo(Y.description,60):"",elapsed:le?fe:X,workspaceCwd:s}}),l.jsx("span",{className:p?Kt.lineChevronDown:Kt.lineChevronRight,"aria-hidden":"true"})]}),xe&&l.jsx("div",{className:Kt.lineDetail,children:a?l.jsx("div",{className:Kt.expandedAgentCard,children:ie}):ie})]})}const T=nD(t,s),C=gHe(t),S=r&&Xl(t.toolName)?Goe(t,s):T,D=uu(t.toolName,u),E=Xl(t.toolName)||hD(t.toolName)?"":Zw(t.startTime,t.endTime),B=t.toolName.toLowerCase(),I=Qh(B),L=I?aD(t):void 0,O=!!L&&L.length>0,A=L?L.filter(Y=>Y.status==="completed").length:0,$=Xl(B),q=B==="grep"||B==="grep_search"||B==="search"||B==="glob",U=B==="read"||B==="read_file"||B==="readfile",H=!I&&gKe(S),M=!i&&(o||(I?O:GGe(t)||H)),ee=KGe(t),V=p&&H,R=U,re=V&&!$&&!q&&!U,Z=T,K=!I&&p&&!ee&&(V||C);return l.jsxs("div",{className:Kt.line,children:[!a&&l.jsxs("div",{className:`${Kt.lineMain} ${M?Kt.lineExpandable:""}`,title:M?u(p?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":M?p:void 0,role:M?"button":void 0,tabIndex:M?0:void 0,onClick:M?()=>{b.current=!0,g(Y=>!Y)}:void 0,onKeyDown:M?Y=>{Y.key!=="Enter"&&Y.key!==" "||(Y.preventDefault(),b.current=!0,g(ae=>!ae))}:void 0,children:[l.jsx(jh,{status:t.status}),l.jsx("span",{className:Kt.lineName,children:D}),I&&O&&l.jsxs("span",{className:Kt.todoProgress,children:[A,"/",L.length]}),l.jsx(cx,{info:{kind:qT(t),tool:t,displayName:D,description:I||re?"":S,elapsed:I?"":E,workspaceCwd:s}}),M&&l.jsx("span",{className:p?Kt.lineChevronDown:Kt.lineChevronRight,"aria-hidden":"true"})]}),(!r||p)&&I&&O&&l.jsx(uKe,{tool:t,todos:L,expanded:p,title:D}),(!r||p)&&I&&!O&&C&&l.jsx("div",{className:Kt.lineOutput,children:g7(C,d)}),K&&l.jsx(DN,{title:D,detail:Z,children:C&&l.jsx("div",{className:`${Kt.lineOutput} ${Kt.expandedLineOutput}`,children:g7(C,d)})}),!I&&!c&&C&&!K&&(!p||!ee)&&(!r||p)&&l.jsx("div",{className:p?`${Kt.lineOutput} ${Kt.expandedLineOutput}`:Kt.lineOutput,children:g7(C,d)}),!I&&p&&ee&&l.jsx("div",{className:R?`${Kt.lineDetail} ${Kt.markdownLineDetail}`:Kt.lineDetail,children:U?l.jsx(iKe,{tool:t}):l.jsxs(DN,{title:D,detail:Z,children:[Xl(B)&&l.jsx(rKe,{tool:t}),(B==="write_file"||B==="writefile")&&l.jsx(Fq,{tool:t}),(B==="edit"||B==="write"||B==="editfile")&&l.jsx(Fq,{tool:t}),yu(t.toolName)&&l.jsx(fKe,{tool:t}),BT(B)&&l.jsx(mKe,{tool:t})]})})]})},jKe),MKe=f.memo(function({tools:t,pendingApproval:n,workspaceCwd:s,isLocateFlashing:r=!1}){const{t:i}=at(),o=f.useContext(R0),a=uD(),[c,u]=f.useState(!1),d=pae(t),h=t.some(S=>S.status==="failed"),m=t.length>0?dD(t):void 0,p=t.length===1?t[0]:void 0,g=p&&Db(p)?p:void 0,b=t.some(S=>Y0(S.status)&&!Oh(S)),x=d&&b,y=!!(g&&a),v=t[0]??m,w=f.useRef(Date.now()),k=cD(x),T=(n==null?void 0:n.toolCallId)&&t.some(S=>du(S,n.toolCallId)),C=o&&!T,_=x?sae(k-w.current):void 0;return f.useEffect(()=>{x&&(w.current=Date.now())},[x,m==null?void 0:m.callId]),C?l.jsx(AKe,{tools:t,workspaceCwd:s,isLocateFlashing:r}):T?l.jsx("div",{className:`${Kt.group}${r?` ${Lm.flash}`:""}`,children:t.map(S=>l.jsx(PN,{tool:S,approval:n,workspaceCwd:s},S.callId))}):l.jsxs("div",{className:r?Lm.flash:void 0,children:[l.jsxs("button",{type:"button",className:Kt.chatSummary,onClick:()=>{if(g&&a){a.onOpen(g);return}u(S=>!S)},"aria-expanded":y?void 0:c,title:y?void 0:i(c?"tool.collapseHint":"tool.expand"),children:[l.jsx("span",{className:Kt.chatSummaryIcon,"aria-hidden":"true",children:v?l.jsx(TKe,{tool:v}):l.jsx(gae,{})}),h&&l.jsx(jh,{status:"failed"}),l.jsx("span",{className:x?`${Kt.chatSummaryText} ${Kt.chatSummaryTextActive}`:Kt.chatSummaryText,children:p?l.jsx(vKe,{tool:p,runningDuration:_,workspaceCwd:s}):bKe(t,i,_)}),l.jsx("span",{className:c?Kt.chatChevronDown:Kt.chatChevronRight,"aria-hidden":"true"})]}),l.jsx("div",{className:c?Kt.chatSummaryContentClip:`${Kt.chatSummaryContentClip} ${Kt.chatSummaryContentCollapsed}`,children:l.jsx("div",{className:Kt.chatSummaryContentInner,children:l.jsx("div",{className:`${Kt.group} ${Kt.chatSummaryGroup}`,children:t.map(S=>l.jsx(PN,{tool:S,approval:n,workspaceCwd:s,summaryOnly:!p,forceExpanded:!!p,hideHeader:!!p},S.callId))})})})]})}),IKe="_message_kwepu_1",RKe="_header_kwepu_6",DKe="_chevron_kwepu_20",LKe="_title_kwepu_26",PKe="_progress_kwepu_35",Zy={message:IKe,header:RKe,chevron:DKe,title:LKe,progress:PKe};function OKe({id:e,todos:t}){var r;const s=((r=f.useContext(ID).get(e))==null?void 0:r.events)??[];return l.jsx(lae,{todos:t,events:s})}const $Ke=f.memo(function({id:t,todos:n,isLocateFlashing:s=!1}){const{t:r}=at(),[i,o]=f.useState(!1);if(n.length===0)return null;const a=n.length,c=n.filter(u=>u.status==="completed").length;return l.jsxs("div",{className:`${Zy.message}${s?` ${Lm.flash}`:""}`,children:[l.jsxs("button",{type:"button",className:Zy.header,onClick:()=>o(u=>!u),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[l.jsx("span",{className:Zy.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),l.jsx("span",{className:Zy.title,children:r("plan.title")}),l.jsxs("span",{className:Zy.progress,children:[c,"/",a]})]}),i?l.jsx(cae,{todos:n,numbered:!0}):l.jsx(OKe,{id:t,todos:n})]})}),BKe="_message_1abcu_1",zKe="_content_1abcu_11",FKe="_question_1abcu_17",HKe="_prefix_1abcu_24",qKe="_answer_1abcu_28",UKe="_pending_1abcu_32",WKe="_shortcuts_1abcu_36",Ep={message:BKe,content:zKe,question:FKe,prefix:HKe,answer:qKe,pending:UKe,shortcuts:WKe},bae=f.memo(function({question:t,answer:n,isPending:s}){const{t:r}=at();return l.jsxs("div",{className:Ep.message,children:[l.jsxs("div",{className:Ep.content,children:[l.jsxs("div",{className:Ep.question,children:[l.jsx("span",{className:Ep.prefix,children:"/btw "}),l.jsx("span",{children:t})]}),l.jsx("div",{className:Ep.answer,children:s?l.jsx("span",{className:Ep.pending,children:r("btw.answering")}):l.jsx(Tm,{content:n})})]}),l.jsx("div",{className:Ep.shortcuts,children:r(s?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),VKe="_message_1q4dw_1",GKe="_compact_1q4dw_16",KKe="_header_1q4dw_21",YKe="_status_1q4dw_30",XKe="_name_1q4dw_35",QKe="_command_1q4dw_42",JKe="_output_1q4dw_51",ZKe="_compactHint_1q4dw_62",eh={message:VKe,compact:GKe,header:KKe,status:YKe,name:XKe,command:QKe,output:JKe,compactHint:ZKe},eYe=f.memo(function({command:t,output:n}){const s=f.useContext(R0),{t:r}=at();return l.jsxs("div",{className:s?`${eh.message} ${eh.compact}`:eh.message,children:[l.jsxs("div",{className:eh.header,children:[l.jsx("span",{className:eh.status,children:"✓"}),l.jsx("span",{className:eh.name,children:r("shell.command")}),t&&l.jsx("span",{className:eh.command,children:t})]}),s?l.jsx("div",{className:eh.compactHint,children:r("compact.hint")}):n&&l.jsx("pre",{className:eh.output,children:n})]})}),tYe="_progress_1j3ys_1",nYe="_spinner_1j3ys_12",sYe="_bar_1j3ys_19",rYe="_stage_1j3ys_25",iYe="_icon_1j3ys_29",oYe="_done_1j3ys_35",aYe="_error_1j3ys_43",lYe="_detail_1j3ys_51",cYe="_path_1j3ys_56",$o={progress:tYe,spinner:nYe,bar:sYe,stage:rYe,icon:iYe,done:oYe,error:aYe,detail:lYe,path:cYe},Uq=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function uYe({progress:e}){const{stage:t,progress:n,detail:s,isComplete:r,error:i}=e,[o,a]=f.useState(0),c=30,u=Math.round(n/100*c),d=c-u,h="█".repeat(Math.max(0,u))+"░".repeat(Math.max(0,d));return f.useEffect(()=>{if(r||i)return;const m=setInterval(()=>{a(p=>(p+1)%Uq.length)},120);return()=>clearInterval(m)},[r,i]),i?l.jsxs("div",{className:`${$o.progress} ${$o.error}`,children:[l.jsx("span",{className:$o.icon,children:"✕"}),l.jsx("span",{className:$o.stage,children:t}),l.jsx("div",{className:$o.detail,children:i})]}):r?l.jsxs("div",{className:`${$o.progress} ${$o.done}`,children:[l.jsx("span",{className:$o.icon,children:"✓"}),l.jsx("span",{className:$o.stage,children:t})]}):l.jsxs("div",{className:$o.progress,children:[l.jsx("span",{className:$o.spinner,children:Uq[o]}),l.jsx("span",{className:$o.bar,children:h}),l.jsxs("span",{className:$o.stage,children:[t,s?` (${s})`:""]})]})}function dYe({path:e}){const{t}=at();return l.jsxs("div",{className:`${$o.progress} ${$o.done}`,children:[l.jsx("span",{className:$o.icon,children:"✓"}),l.jsx("span",{className:$o.stage,children:t("insight.ready")}),l.jsx("span",{className:$o.path,children:e})]})}const hYe=f.memo(function({message:t,pendingApproval:n,onShowContextDetail:s,workspaceCwd:r,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:c,showAssistantActions:u=!1,showAssistantBranch:d=!1,isLocateFlashing:h=!1,assistantTurnFooterInfo:m,generateContent:p}){const{t:g}=at(),b=(()=>{switch(t.role){case"user":return l.jsx(Gze,{content:t.content,images:t.images,inputAnnotations:t.inputAnnotations,isLocateFlashing:h});case"assistant":return l.jsx(TFe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:c,showFooterActions:u,showBranchAction:d,isLocateFlashing:h,customFooterInfo:m});case"thinking":return l.jsx(MFe,{messageId:t.id,content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:h,generateContent:p});case"tool_group":return l.jsx(MKe,{tools:t.tools,pendingApproval:n,workspaceCwd:r,isLocateFlashing:h});case"plan":return l.jsx($Ke,{id:t.id,todos:t.todos,isLocateFlashing:h});case"system":return l.jsx(LWe,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:s,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:a});case"user_shell":return l.jsx(eYe,{command:t.command,output:t.output});case"btw":return l.jsx(bae,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return l.jsx(uYe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return l.jsx(dYe,{path:t.path});case"insight_error":return l.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(b===null)return null;const x=l.jsx(Ph,{label:`message:${t.role}`,resetKeys:[t],fallback:l.jsx(fYe,{align:t.role==="user"?"end":"start"}),children:b}),y=l.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:x});return t.role==="assistant"?u?y:l.jsx(kA,{timestamp:t.timestamp,children:y}):t.role==="system"&&t.source==="prompt_cancelled"?y:l.jsx(kA,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:g("common.copy"),children:y})},mYe);function fYe({align:e}){const{t}=at();return l.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:l.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function mYe(e,t){var n,s;return((n=e.pendingApproval)==null?void 0:n.id)!==((s=t.pendingApproval)==null?void 0:s.id)||e.onShowContextDetail!==t.onShowContextDetail||e.workspaceCwd!==t.workspaceCwd||e.isLatest!==t.isLatest||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.onBranchSession!==t.onBranchSession||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.isLocateFlashing!==t.isLocateFlashing||e.generateContent!==t.generateContent||!pYe(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:gYe(e.message,t.message)}function pYe(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 gYe(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&&vYe(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"&&bYe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,s)=>yae(n,t.tools[s]));default:return!1}}function bYe(e,t){return e.length===t.length&&e.every((n,s)=>{const r=t[s];return r&&n.id===r.id&&n.content===r.content&&n.status===r.status&&n.priority===r.priority})}function yae(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&&yf(e.args)===yf(t.args)&&yf(e.rawOutput)===yf(t.rawOutput)&&yf(e.locations)===yf(t.locations)&&yf(e.content)===yf(t.content)&&yYe(e.subTools,t.subTools):!1}function yYe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>yae(n,t[s]))}const Wq=new WeakMap;function vYe(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n.data===t[s].data&&n.mimeType===t[s].mimeType)}function yf(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=Wq.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return Wq.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 xYe(e){const t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return null;const n=Number(t[1]),s=Number(t[2]);return n<0||n>23||s<0||s>59?null:{hh:n,mm:s}}function w3(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=xYe(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 uw(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[s,r,i,o,a]=n,c=d=>/^\d+$/.test(d),u=d=>d.padStart(2,"0");if(/^\*\/\d+$/.test(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*"){const d=Number(s.slice(2));return Number.isInteger(d)&&d>=1&&d<=30&&60%d===0?t("scheduledTasks.human.everyMinutes",{n:d}):e}if(c(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.hourly",{min:u(s)});if(c(s)&&c(r)&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.daily",{time:`${u(r)}:${u(s)}`});if(c(s)&&c(r)&&i==="*"&&o==="*"&&a==="1-5")return t("scheduledTasks.human.weekdays",{time:`${u(r)}:${u(s)}`});if(c(s)&&c(r)&&i==="*"&&o==="*"&&c(a)&&Number(a)>=0&&Number(a)<=7){const d=t("scheduledTasks.weekdayNames").split(","),h=Number(a)===7?0:Number(a),m=d[h]??a;return t("scheduledTasks.human.weekly",{day:m,time:`${u(r)}:${u(s)}`})}return e}const Uu={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function _f(e){const t=e.trim(),n={...Uu,frequency:"custom",customCron:t.length>0?t:Uu.customCron},s=t.split(/\s+/);if(s.length!==5)return n;const[r,i,o,a,c]=s,u=b=>/^\d+$/.test(b),d=b=>String(b).padStart(2,"0"),h=o==="*"&&a==="*";if(/^\*\/\d+$/.test(r)&&i==="*"&&h&&c==="*"){const b=Number(r.slice(2));return Number.isInteger(b)&&b>=1&&b<=30&&60%b===0?{...Uu,frequency:"minutes",minuteInterval:b}:n}if(!u(r))return n;const m=Number(r);if(m>59)return n;if(i==="*"&&h&&c==="*")return{...Uu,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(h&&c==="*")return{...Uu,frequency:"daily",time:g};if(h&&c==="1-5")return{...Uu,frequency:"weekdays",time:g};if(h&&u(c)){const b=Number(c);if(b>=0&&b<=7)return{...Uu,frequency:"weekly",time:g,weekday:b===7?0:b}}return n}function wYe(e,t){if(e<=0)return t("scheduledTasks.dueNow");const n=Math.floor(e/1e3),s=Math.floor(n/86400),r=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),o=n%60,a=(u,d)=>`${d}${t(`scheduledTasks.dur.${u}`)}`;let c;return s>0?c=r>0?[a("d",s),a("h",r)]:[a("d",s)]:r>0?c=i>0?[a("h",r),a("m",i)]:[a("h",r)]:i>0?c=o>0?[a("m",i),a("s",o)]:[a("m",i)]:c=[a("s",o)],c.join(" ")}function kYe(e,t){const n=e.createdAt-e.createdAt%6e4;if(e.lastFiredAt===null||e.lastFiredAt<=n)return t("scheduledTasks.never");let s;try{s=new Date(e.lastFiredAt).toLocaleString()}catch{return t("scheduledTasks.never")}return t("scheduledTasks.lastFired",{when:s})}function vae(e){switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";default:return e||"artifact"}}function xae(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function _Ye(e){return e.workspacePath??e.url??e.managedId??""}function M0(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),s=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){s.length>0&&s.at(-1)!==".."?s.pop():n||s.push(i);continue}s.push(i)}const r=s.join("/");return n?`/${r}`:r}function ON(e,t){const n=M0(e),s=M0(t);if(!s)return n;if(n===s)return n.split("/").pop()??n;const r=`${s}/`;return n.startsWith(r)?n.slice(r.length):n}function wae(e,t,n){const s=ON(e??"",n),r=ON(t??"",n);return!!s&&s===r}const Vq="default-src 'none'; base-uri 'none'; style-src 'unsafe-inline'; img-src data: blob:;";function SYe(e){if(typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${Vq}"></head><body>${CYe(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(s=>s.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=Vq,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function CYe(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 k3({additions:e,deletions:t,className:n,additionsClassName:s,deletionsClassName:r}){return e===void 0||t===void 0?null:l.jsxs("span",{className:n,children:[l.jsxs("span",{className:s,children:["+",e]}),l.jsxs("span",{className:r,children:["-",t]})]})}function kae(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 TYe="_root_aths8_1",EYe="_card_aths8_7",AYe="_summary_aths8_14",jYe="_icon_aths8_22",NYe="_iconSvg_aths8_33",MYe="_title_aths8_39",IYe="_linkButton_aths8_46",RYe="_reviewButton_aths8_47",DYe="_showMoreButton_aths8_48",LYe="_actions_aths8_79",PYe="_list_aths8_97",OYe="_fileRow_aths8_104",$Ye="_path_aths8_124",BYe="_lineStats_aths8_133",zYe="_additions_aths8_142",FYe="_deletions_aths8_146",HYe="_chevronIcon_aths8_160",qYe="_chevronIconOpen_aths8_168",UYe="_artifactInfo_aths8_172",WYe="_artifactMeta_aths8_178",Bs={root:TYe,card:EYe,summary:AYe,icon:jYe,iconSvg:NYe,title:MYe,linkButton:IYe,reviewButton:RYe,showMoreButton:DYe,actions:LYe,list:PYe,fileRow:OYe,path:$Ye,lineStats:BYe,additions:zYe,deletions:FYe,chevronIcon:HYe,chevronIconOpen:qYe,artifactInfo:UYe,artifactMeta:WYe},_ae=["file","artifact","scheduled_task"];function VYe({turnId:e,changes:t,artifacts:n,scheduledTasks:s,workspaceCwd:r,onOpenRequest:i,onReviewChanges:o,onOpenArtifact:a,onOpenScheduledTask:c}){const{t:u}=at(),[d,h]=f.useState(!1);if(t.length===0&&n.length===0&&s.length===0)return null;const m=d?t:t.slice(0,3),p=t.length-3,g=kae(t),b=v=>{if(i){i({id:"review",kind:"review",title:u("turnOutputs.review"),turnId:e,changes:t,...r?{workspaceCwd:r}:{},...v?{selectedPath:v}:{}});return}o(t,v)},x=v=>{const w=ZYe(v,t,r);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,...w!==void 0?{previewContent:w}:{}});return}a(v.id,w)},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 l.jsxs("div",{className:Bs.root,children:[t.length>0&&l.jsxs("div",{className:Bs.card,children:[l.jsxs("div",{className:Bs.summary,children:[l.jsx("span",{className:Bs.icon,"aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:Bs.iconSvg,children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),l.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),l.jsxs("div",{children:[l.jsx("div",{className:Bs.title,children:u("turnOutputs.filesEdited",{count:t.length})}),l.jsx(k3,{additions:g==null?void 0:g.additions,deletions:g==null?void 0:g.deletions,className:Bs.lineStats,additionsClassName:Bs.additions,deletionsClassName:Bs.deletions}),l.jsxs("button",{type:"button",className:Bs.linkButton,onClick:()=>b(),children:[u("turnOutputs.viewChanges")," ↗"]})]}),l.jsx("div",{className:Bs.actions,children:l.jsx("button",{type:"button",className:Bs.reviewButton,onClick:()=>b(),children:u("turnOutputs.review")})})]}),l.jsxs("div",{className:Bs.list,children:[m.map(v=>l.jsxs("button",{type:"button",className:Bs.fileRow,onClick:()=>b(v.path),title:v.path,children:[l.jsx("span",{className:Bs.path,children:UT(v.path,r)}),l.jsx(k3,{additions:v.additions,deletions:v.deletions,className:Bs.lineStats,additionsClassName:Bs.additions,deletionsClassName:Bs.deletions})]},`${v.toolCallId}:${v.path}`)),p>0&&l.jsxs("button",{type:"button",className:Bs.showMoreButton,onClick:()=>h(v=>!v),children:[l.jsx("span",{children:d?u("turnOutputs.collapseFiles"):u("turnOutputs.showMoreFiles",{count:p})}),l.jsx(QYe,{open:d})]})]})]}),n.map(v=>l.jsx(GYe,{artifact:v,onOpen:()=>x(v)},v.id)),s.map(v=>l.jsx(KYe,{task:v,scheduleLabel:uw(v.cron,u),onOpen:()=>y(v)},v.toolCallId))]})}function GYe({artifact:e,onOpen:t}){const{t:n}=at(),s=xae(e.sizeBytes);return l.jsx("div",{className:Bs.card,children:l.jsxs("div",{className:Bs.summary,children:[l.jsx("span",{className:Bs.icon,"aria-hidden":"true",children:l.jsx(YYe,{})}),l.jsxs("div",{className:Bs.artifactInfo,children:[l.jsx("div",{className:Bs.title,children:e.title}),l.jsx("div",{className:Bs.artifactMeta,children:[vae(e.kind),s].filter(Boolean).join(" · ")})]}),l.jsx("div",{className:Bs.actions,children:l.jsx("button",{type:"button",className:Bs.reviewButton,onClick:t,title:e.title,children:n("common.open")})})]})})}function KYe({task:e,scheduleLabel:t,onOpen:n}){const{t:s}=at();return l.jsx("div",{className:Bs.card,children:l.jsxs("div",{className:Bs.summary,children:[l.jsx("span",{className:Bs.icon,"aria-hidden":"true",children:l.jsx(XYe,{})}),l.jsxs("div",{className:Bs.artifactInfo,children:[l.jsx("div",{className:Bs.title,children:e.title}),l.jsx("div",{className:Bs.artifactMeta,children:[t,e.recurring?s("scheduledTasks.repeats"):s("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),l.jsx("div",{className:Bs.actions,children:l.jsx("button",{type:"button",className:Bs.reviewButton,onClick:n,title:e.title,children:s("common.open")})})]})})}function YYe(){return l.jsxs("svg",{className:Bs.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function XYe(){return l.jsxs("svg",{className:Bs.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function QYe({open:e}){return l.jsx("svg",{className:[Bs.chevronIcon,e?Bs.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}const JYe=f.memo(VYe);function ZYe(e,t,n){if(!eXe(e)||!e.workspacePath)return;const s=t.find(r=>wae(r.path,e.workspacePath,n));if(s)return Sae(s)}function Sae(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 eXe(e){var s,r;const t=((s=e.workspacePath)==null?void 0:s.toLowerCase())??"",n=((r=e.mimeType)==null?void 0:r.toLowerCase())??"";return e.kind==="html"||Cae(t)||n==="text/html"||n==="text/markdown"}function Cae(e){const t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")}function UT(e,t){return ON(e,t)}const tXe="_wrap_16iog_1",nXe="_summary_16iog_5",sXe="_summaryTextActive_16iog_27",rXe="_summaryIcon_16iog_33",iXe="_summaryStatus_16iog_47",oXe="_summaryToolIcon_16iog_54",aXe="_summaryText_16iog_27",lXe="_summaryDot_16iog_96",cXe="_chevronRight_16iog_100",uXe="_chevronDown_16iog_101",dXe="_group_16iog_161",hXe="_list_16iog_193",fXe="_row_16iog_199",mXe="_rowStats_16iog_221",pXe="_rowDesc_16iog_229",gXe="_rowTool_16iog_239",bXe="_detail_16iog_243",yXe="_track_16iog_249",vXe="_bar_16iog_257",xXe="_barRunning_16iog_265",wXe="_ruler_16iog_304",kXe="_tick_16iog_311",fi={wrap:tXe,summary:nXe,summaryTextActive:sXe,summaryIcon:rXe,summaryStatus:iXe,summaryToolIcon:oXe,summaryText:aXe,summaryDot:lXe,chevronRight:cXe,chevronDown:uXe,group:dXe,list:hXe,row:fXe,rowStats:mXe,rowDesc:pXe,rowTool:gXe,detail:bXe,track:yXe,bar:vXe,barRunning:xXe,ruler:wXe,tick:kXe};function Tae(e){const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}function _Xe(e,t){if(e.length<2)return null;const n=[];for(const h of e){if(typeof h.startTime!="number")return null;n.push(h.startTime)}const s=e.map((h,m)=>h.status==="in_progress"?Math.max(t,n[m]):Math.max(h.endTime??n[m],n[m])),r=Math.min(...n),i=Math.max(...s)-r;if(i<1e3)return null;const o=new Map;e.forEach((h,m)=>{const p=Math.max((s[m]-n[m])/i,.02),g=Math.min((n[m]-r)/i,1-p);o.set(h.callId,{leftPct:g*100,widthPct:p*100,running:h.status==="in_progress"})});const a=Math.max(i/1e3/2.2,1),c=Math.pow(10,Math.floor(Math.log10(a))),u=[5,2,1].map(h=>h*c).find(h=>h<=a)??c,d=[];for(let h=0;d.length<4;h++){const m=h*u*1e3;if(m>i*.92)break;d.push({leftPct:m/i*100,label:Tae(m)})}return{rows:o,ticks:d}}function SXe(e,t){const n=[],s=Jw(e.rawOutput),r=s==null?void 0:s.executionSummary,i=r&&typeof r.totalDurationMs=="number"?Tae(r.totalDurationMs):Zw(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const o=s&&typeof s.tokenCount=="number"&&s.tokenCount>0?s.tokenCount:r&&typeof r.outputTokens=="number"&&r.outputTokens>0?r.outputTokens:0;o>0&&n.push(rD(o));const a=sD(e);return a&&n.push(fo(a,80)),n.join(" · ")}function CXe(){return l.jsx("svg",{className:fi.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:l.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 TXe({agents:e,pendingApproval:t}){const{t:n}=at(),s=uD(),[r,i]=f.useState(!1),[o,a]=f.useState(null),[c,u]=f.useState(()=>Date.now()),d=f.useRef(Date.now()),h=e.some(w=>w.status==="in_progress");f.useEffect(()=>{h&&(d.current=Date.now(),u(Date.now()))},[h]),f.useEffect(()=>{if(!h)return;const w=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(w)},[h]);const m=h?sae(c-d.current):"",p=e.filter(w=>w.status==="completed"||w.status==="failed").length,g=e.length,b=t!=null&&t.toolCallId?e.find(w=>du(w,t.toolCallId)):void 0,x=r||!!b,y=x?_Xe(e,c):null,v=e.some(w=>lw(w)==="failed")?"failed":h?"in_progress":"completed";return l.jsxs("div",{className:fi.wrap,children:[l.jsxs("button",{type:"button",className:fi.summary,onClick:()=>i(w=>!w),"aria-expanded":x,title:n(x?"tool.collapseHint":"tool.expand"),children:[v==="failed"?l.jsx("span",{className:fi.summaryStatus,children:l.jsx(jh,{status:v})}):l.jsx("span",{className:fi.summaryIcon,"aria-hidden":"true",children:l.jsx(CXe,{})}),l.jsxs("span",{className:h?`${fi.summaryText} ${fi.summaryTextActive}`:fi.summaryText,children:[n("parallelAgents.title"),m&&l.jsxs(l.Fragment,{children:[" ",m]}),l.jsx("span",{className:fi.summaryDot,children:"·"}),n("parallelAgents.done",{done:p,total:g})]}),l.jsx("span",{className:x?fi.chevronDown:fi.chevronRight,"aria-hidden":"true"})]}),x&&l.jsxs("div",{className:fi.group,children:[l.jsx("div",{className:fi.list,children:e.map(w=>{const k=iD(w),T=zT(w),C=xHe(w,n),_=SXe(w,c),S=lw(w),D=o===w.callId,E=y==null?void 0:y.rows.get(w.callId);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:fi.row,"aria-expanded":s?void 0:D,onClick:()=>{s?s.onOpen(w):a(D?null:w.callId)},children:[l.jsx(jh,{status:S}),l.jsxs("span",{className:fi.rowDesc,children:[fo(T||k,50),C&&l.jsx("span",{className:fi.rowTool,children:` (${C})`})]}),_&&l.jsx("span",{className:fi.rowStats,children:_})]}),E&&l.jsx("div",{className:fi.track,"aria-hidden":"true",children:l.jsx("span",{className:E.running?`${fi.bar} ${fi.barRunning}`:fi.bar,style:{left:`${E.leftPct}%`,width:`${E.widthPct}%`}})}),!s&&D&&l.jsx("div",{className:fi.detail,children:l.jsx(oD,{tool:w,hideHeader:!0})})]},w.callId)})}),y&&y.ticks.length>=2&&l.jsx("div",{className:fi.ruler,"aria-hidden":"true",children:y.ticks.map(w=>l.jsx("span",{className:fi.tick,style:{left:`${w.leftPct}%`},children:w.label},w.label))})]})]})}const EXe="_collapseRow_d7f01_1",AXe="_collapseRowClickable_d7f01_14",jXe="_collapseLabel_d7f01_19",NXe="_processedLabel_d7f01_36",MXe="_processedMeta_d7f01_43",IXe="_hiddenMetrics_d7f01_47",RXe="_summaryMetrics_d7f01_51",DXe="_collapseIcon_d7f01_59",LXe="_chevronRight_d7f01_72",PXe="_chevronDown_d7f01_73",Xc={collapseRow:EXe,collapseRowClickable:AXe,collapseLabel:jXe,processedLabel:NXe,processedMeta:MXe,hiddenMetrics:IXe,summaryMetrics:RXe,collapseIcon:DXe,chevronRight:LXe,chevronDown:PXe},OXe="_list_p1edz_1",$Xe="_listWithWelcomeHeader_p1edz_12",BXe="_historyStatus_p1edz_32",zXe="_virtualSizer_p1edz_48",FXe="_virtualRow_p1edz_57",HXe="_loadingSkeleton_p1edz_67",qXe="_srOnly_p1edz_75",UXe="_loadingSkeletonUserRow_p1edz_87",WXe="_loadingSkeletonAssistantRow_p1edz_93",VXe="_loadingSkeletonUserBubble_p1edz_99",GXe="_loadingSkeletonUserBubbleCompact_p1edz_100",KXe="_loadingSkeletonAssistantBlock_p1edz_114",YXe="_loadingSkeletonLineWide_p1edz_122",XXe="_loadingSkeletonLineMedium_p1edz_123",QXe="_loadingSkeletonLineShort_p1edz_124",JXe="_loadingSkeletonLineNarrow_p1edz_125",ZXe="_turnStatusRow_p1edz_165",eQe="_turnAnswerRow_p1edz_166",tQe="_turnContentRow_p1edz_177",nQe="_sessionTimelineLayer_p1edz_181",sQe="_sessionTimelinePanel_p1edz_194",rQe="_sessionTimelineViewport_p1edz_205",iQe="_sessionTimelineList_p1edz_246",oQe="_sessionTimelineItem_p1edz_256",aQe="_sessionTimelineButton_p1edz_261",lQe="_sessionTimelineTick_p1edz_280",cQe="_sessionTimelineButtonInRange_p1edz_367",uQe="_sessionTimelineButtonCurrent_p1edz_371",dQe="_sessionTimelineDetails_p1edz_382",hQe="_sessionTimelineDetailsTitle_p1edz_416",fQe="_sessionTimelineDetailsIcon_p1edz_423",mQe="_sessionTimelineDetailsTitleText_p1edz_435",pQe="_sessionTimelineDetailsDetail_p1edz_445",Ds={list:OXe,listWithWelcomeHeader:$Xe,historyStatus:BXe,virtualSizer:zXe,virtualRow:FXe,loadingSkeleton:HXe,srOnly:qXe,loadingSkeletonUserRow:UXe,loadingSkeletonAssistantRow:WXe,loadingSkeletonUserBubble:VXe,loadingSkeletonUserBubbleCompact:GXe,loadingSkeletonAssistantBlock:KXe,loadingSkeletonLineWide:YXe,loadingSkeletonLineMedium:XXe,loadingSkeletonLineShort:QXe,loadingSkeletonLineNarrow:JXe,turnStatusRow:ZXe,turnAnswerRow:eQe,turnContentRow:tQe,sessionTimelineLayer:nQe,sessionTimelinePanel:sQe,sessionTimelineViewport:rQe,sessionTimelineList:iQe,sessionTimelineItem:oQe,sessionTimelineButton:aQe,sessionTimelineTick:lQe,sessionTimelineButtonInRange:cQe,sessionTimelineButtonCurrent:uQe,sessionTimelineDetails:dQe,sessionTimelineDetailsTitle:hQe,sessionTimelineDetailsIcon:fQe,sessionTimelineDetailsTitleText:mQe,sessionTimelineDetailsDetail:pQe},b7=()=>{},gQe=12e4,y7=180;function bQe(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 yQe(e){return e[e.length-1]}function vQe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&X0(n))return n.id}return null}function Gq(e){return e.role==="tool_group"&&e.tools.length===1&&Db(e.tools[0])}function v7(e){return e.role==="tool_group"&&e.tools.length===1&&Oh(e.tools[0])}function Kq(e){return e.role==="thinking"}function Yq(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>du(n,t.toolCallId)))}function Xq(e){return e.role==="thinking"}function xQe(e,t){const n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.role!=="tool_group"||Yq(r,t)){Xq(r)||n.push(r),s++;continue}const i=[r];let o=s,a=s+1;for(;a<e.length;){const u=e[a];if(Xq(u)){a++;continue}if(u.role==="tool_group"&&!Yq(u,t)){i.push(u),o=a,a++;continue}break}if(i.length===1){n.push(r),s++;continue}const c=i.flatMap(u=>u.role==="tool_group"?u.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:c}),s=o+1}return n}function Eae(e){const t=[];let n=0;for(;n<e.length;){if(v7(e[n])){const s=[];let r=n;for(;r<e.length;){const i=e[r];if(v7(i)){s.push(i),r++;continue}if(Kq(i)){let o=r+1;for(;o<e.length&&Kq(e[o]);)o++;if(o<e.length&&v7(e[o])){r=o;continue}}break}if(s.length>=2){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}),n=r;continue}}if(Gq(e[n])){const s=n;for(;n<e.length&&Gq(e[n]);)n++;if(n-s>=2){const r=e.slice(s,n);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})}else t.push({type:"message",key:e[s].id,message:e[s]})}else t.push({type:"message",key:e[n].id,message:e[n]}),n++}return t}function wQe(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 kQe(e,t,n,s,r){if((!n||n.size===0)&&(!s||s.size===0)&&(!r||r.size===0))return e;const i=[];let o=null;const a=(c,u)=>{if(u&&t||!c)return;const d=(n==null?void 0:n.get(c))??[],h=(s==null?void 0:s.get(c))??[],m=(r==null?void 0:r.get(c))??[];d.length===0&&h.length===0&&m.length===0||i.push({type:"turn_outputs",key:c,turnId:c,changes:d,artifacts:h,scheduledTasks:m})};for(const c of e)c.type==="message"&&X0(c.message)?(a(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 a(o,!0),i}function _Qe(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function fD(e,t,n){let s=t;for(let r=n;r>t;r--)if(OQe(e[r])){s=r;break}for(let r=n;r>s;r--)if(_Qe(e[r]))return r;return-1}function SQe(e,t){const n=[];for(let r=0;r<e.length;r++){const i=e[r];i.type==="message"&&X0(i.message)&&n.push(r)}const s=new Map;for(let r=0;r<n.length;r++){if(r===n.length-1&&t)continue;const i=n[r],o=(r+1<n.length?n[r+1]:e.length)-1,a=e[i],c=fD(e,i,o);if(c<0)continue;const u=e[c];(a==null?void 0:a.type)==="message"&&u.type==="message"&&u.message.role==="assistant"&&s.set(u.message.id,a.message.id)}return s}function Qq(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 mD(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 mD(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 CQe(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}:I0(n.content,1)?{kind:"commentary",timestamp:n.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:n.timestamp};case"tool_group":{const s=n.tools.length;return{kind:"tool",timestamp:n.timestamp,label:t?t("timeline.toolCalls",{count:s}):`${s} tool call${s===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:n.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return mD(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 I0(e,t,n={}){const r=(n.stripMarkdown===!0?TQe(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!r)return"";const i=Array.from(r);return i.length>t?`${i.slice(0,t-1).join("")}…`:r}function TQe(e){if(!e)return"";const t=[],n=r=>{const i=`\0${t.length}\0`;return t.push(r),i};let s=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,i)=>n(i)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,i)=>n(i)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");s=x7(s,"~~"),s=x7(s,"**"),s=x7(s,"__"),s=s.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(const[r,i]of t.entries())s=s.split(`\0${r}\0`).join(i);return s}function x7(e,t){let n="",s=0;for(;s<e.length;){const r=e.indexOf(t,s);if(r===-1)return n+e.slice(s);const i=r+t.length,o=e.indexOf(t,i);if(o===-1)return n+e.slice(s);const a=e.slice(i,o);n+=a.trim().length===0?e.slice(s,o+t.length):e.slice(s,r)+a,s=o+t.length}return n}function EQe(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",s=I0(n,32);return s||(t?t("timeline.userTurn"):"User turn")}function AQe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function X0(e){return e.role==="user"||e.role==="user_shell"}function jQe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return I0(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 mD(e)?I0(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 NQe(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"?"":jQe(e.message,t)}function MQe(e,t){return t?t(`timeline.kind.${e}`):aJe[e]}function IQe(e,t,n,s){if(t!==null)for(const o of e){if(o.type!=="message")continue;const{message:a}=o;if(a.id!==t||a.role!=="assistant")continue;const c=I0(a.content,180,{stripMarkdown:!0});if(c)return c}const r=[];for(let o=0;o<e.length;o+=1){const a=e[o];if(a.type==="message"&&t!==null&&a.message.id===t)continue;const c=NQe(a,s);c&&r.push(c)}const i=I0(r.join(" · "),180);return i||(n.length>0?n.map(o=>MQe(o,s)).join(" · "):s?s("timeline.noActivity"):"No activity")}function RQe(e,t){const n=[];let s=null,r=[];const i=()=>{if(!s)return;const o=Eae(r),a=fD(o,-1,o.length-1),c=a>=0?o[a]:null,u=(c==null?void 0:c.type)==="message"&&c.message.role==="assistant"&&!c.message.isStreaming&&I0(c.message.content,1,{stripMarkdown:!0}).length>0?c.message.id:null,d=[];for(const h of o){if(h.type==="message"&&u!==null&&h.message.id===u)continue;const m=CQe(h,t);m.kind!=="none"&&!d.includes(m.kind)&&d.push(m.kind)}n.push({id:s.id,label:EQe(s,t),detail:IQe(o,u,d,t),timestamp:s.timestamp,nodeKinds:d,...AQe(s)?{isScheduledTask:!0}:{}})};for(const o of e){if(X0(o)){i(),s=o,r=[];continue}s&&r.push(o)}return i(),n}function DQe(){return l.jsxs("svg",{className:Ds.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),l.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function LQe(e){var n,s,r;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(((s=e.args)==null?void 0:s.subagent_type)??""),((r=e.args)==null?void 0:r.run_in_background)===!0?"background":"",String((t==null?void 0:t.type)??""),String((t==null?void 0:t.status)??"")].join(":")}function PQe(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(LQe).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 OQe(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 Jq(e){return e==="pending"||e==="running"||e==="in_progress"}function $Qe(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(s=>Jq(s.status));return n.length===0?null:`agents:${e.key}:${n.map(s=>s.callId).join(",")}`}if(e.message.role!=="tool_group")return null;const t=e.message.tools.filter(n=>Jq(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function BQe(e){for(let t=e.length-1;t>=0;t--){const n=$Qe(e[t]);if(n)return n}return null}function zQe(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 FQe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function HQe(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 qQe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function w7(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function Zq(e){if(e.parentToolCallId||!Db(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,s=w7(n==null?void 0:n.inputTokens),r=w7(n==null?void 0:n.outputTokens);if(s===void 0&&r===void 0)return;const i=w7(n==null?void 0:n.cachedTokens);return{callId:e.callId,usage:{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}}function UQe(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>Zq(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>Zq(t)??[])}function WQe(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 Aae(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const s=e[n];if(s.type==="message"&&X0(s.message))return s.message.id}return null}function jae(e){const t=[];let n=null;for(const s of e)s.type==="message"&&X0(s.message)&&(n=s.message.id),t.push(n);return t}function eU(e,t,n,s){const r=s===void 0?Aae(e,t):s[t]??null;return r?n.get(r)??null:null}function VQe(e,t,n,s,r=jae(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const c of t){if(c<0||c>=e.length)continue;const u=eU(e,c,n,r);u!==null&&(i=Math.min(i,u),o=Math.max(o,u))}if(o<0)return null;const a=s==null?null:eU(e,s,n,r);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function GQe(e,t,n,s){if(!s)return!1;for(let r=t;r<=n;r++){const i=e[r];if(i.type==="parallel_agents"){if(i.agents.some(o=>du(o,s)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>du(o,s)))return!0}return!1}function KQe(e,{overrides:t,isResponding:n,activeTurnStartedAt:s,pendingApprovalCallId:r,includeSubagentToolUsageInMetrics:i=!0,enabled:o}){if(!o||e.length===0)return e;const a=[];for(let u=0;u<e.length;u++){const d=e[u];d.type==="message"&&X0(d.message)&&a.push(u)}if(a.length===0)return e;const c=[];for(let u=0;u<a[0];u++)c.push(e[u]);for(let u=0;u<a.length;u++){const d=a[u],h=(u+1<a.length?a[u+1]:e.length)-1,m=e[d],p=m.message.id,g=m.message.timestamp,b=u===a.length-1&&n,x=GQe(e,d,h,r),y=fD(e,d,h);let v=0,w,k,T=0,C=0,_=0,S=0,D=0,E=!1;const B=new Set;let I=!1;for(let ee=d+1;ee<=h;ee++){const V=e[ee];Qq(V,ee===y)&&v++,FQe(V)&&(I=!0),S+=WQe(V),V.type==="message"&&V.message.role==="thinking"&&D++;const re=zQe(V);re!==void 0&&(w=w===void 0?re:Math.max(w,re));const Z=HQe(V);Z!==void 0&&(k=k===void 0?Z:Math.max(k,Z));const K=qQe(V);if(K&&(T+=K.inputTokens,C+=K.outputTokens,_+=K.cachedTokens??0,E=!0),i)for(const Y of UQe(V))B.has(Y.callId)||(B.add(Y.callId),T+=Y.usage.inputTokens,C+=Y.usage.outputTokens,_+=Y.usage.cachedTokens??0,E=!0)}const L=b?s??g??Date.now():void 0,O=w??k,A=g!==void 0&&O!==void 0&&O>=g?O-g:void 0;if(x||v===0&&!(E||A!==void 0||L!==void 0)){for(let ee=d;ee<=h;ee++)c.push(e[ee]);continue}const q=b||I||y<0,H=!(v===0?!0:t.has(p)?t.get(p):q);c.push({type:"message",key:m.key,message:m.message});const M={turnId:p,collapsed:H,hiddenCount:v,...A!==void 0?{elapsedMs:A}:{},...E?{inputTokens:T,outputTokens:C}:{},..._>0?{cachedTokens:_}:{},...S>0?{toolCallCount:S}:{},...D>0?{thinkingCount:D}:{},...L!==void 0?{liveStartedAt:L}:{}};if(c.push({type:"turn_collapse",key:`tc-${p}`,turnCollapse:M}),!H){for(let ee=d+1;ee<=h;ee++){const V=e[ee];ee===y&&V.type==="message"&&V.message.role==="assistant"?c.push({...V,turnCollapse:M}):c.push(V)}continue}for(let ee=d+1;ee<=h;ee++){const V=e[ee];if(!(ee===y&&b)){if(ee===y&&V.type==="message"&&V.message.role==="assistant"){c.push({...V,turnCollapse:M});continue}Qq(V,ee===y)||c.push(V)}}}return c}function k7(e,t,n){for(let s=0;s<e.length;s++){const r=e[s];if(r.type==="message"){if(r.message.id===t||n&&r.message.role==="tool_group"&&r.message.tools.some(i=>du(i,n)))return s}else{if(r.type==="parallel_agents"&&n&&r.agents.some(i=>du(i,n)))return s;if(r.type==="turn_outputs")continue}}return-1}function tU(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(s=>du(s,n)):e.type==="parallel_agents"?!!n&&e.agents.some(s=>du(s,n)):(e.type==="turn_outputs",!1)}const _7=0,YQe=120,XQe=80,QQe=32,JQe=240,l2=30,nU=48,Nae=200,ZQe=4;function eJe(e,t=Nae){return e>t}function tJe(e){const t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t-n*60;return`${n}m ${s}s`}function S7(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function nJe(e){return e!==void 0&&e>0?tJe(e):""}function sJe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,s=n>0&&e.inputTokens>0?` (${S7(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${S7(e.inputTokens)}${s} ↓${S7(e.outputTokens)}`}function sU(e,t){const n=[],s=sJe(e,t);return s&&n.push(s),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 rJe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const iJe=f.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:s}=at(),r=t.hiddenCount>0,i=t.liveStartedAt,o=r||i!==void 0||rJe(t),a=cD(i!==void 0&&o),c=f.useRef(0),u=f.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,a-i)),d=c.current):o&&t.elapsedMs!==void 0?(c.current=0,d=t.elapsedMs):(c.current=0,d=void 0);const h=nJe(d),m=sU(t,s),p=sU(t,s),g=s(i!==void 0?"turn.processing":"turn.processed"),b=!!h&&o,x=!!m&&o,y=!!p&&o;if(!o)return null;const v=()=>{if(!r)return;const w=t.collapsed;n(t.turnId,w)};return l.jsxs("div",{className:r?`${Xc.collapseRow} ${Xc.collapseRowClickable}`:Xc.collapseRow,role:r?"button":void 0,tabIndex:r?0:void 0,"aria-expanded":r?!t.collapsed:void 0,"aria-label":r?t.collapsed?s("turn.expand"):s("turn.collapse"):void 0,title:r?t.collapsed?s("turn.expand"):s("turn.collapse"):void 0,onClick:r?v:void 0,onKeyDown:r?w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),v())}:void 0,children:[l.jsxs("span",{className:Xc.collapseLabel,children:[l.jsxs("span",{className:Xc.processedLabel,children:[g,b&&l.jsxs("span",{className:Xc.processedMeta,children:[" ",h]})]}),y&&l.jsx("span",{className:Xc.summaryMetrics,children:p}),x&&l.jsx("span",{className:Xc.hiddenMetrics,children:m})]}),r&&l.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:Xc.collapseIcon,onClick:w=>{w.stopPropagation(),v()},children:l.jsx("span",{className:t.collapsed?Xc.chevronRight:Xc.chevronDown,"aria-hidden":"true"})})]})});function oJe(e){if(e.type==="turn_collapse")return Ds.turnStatusRow;if(e.type==="turn_outputs")return Ds.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Ds.turnAnswerRow}const aJe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},lJe=["--background","--foreground","--muted-foreground","--border","--font-sans"],rU="session-timeline-detail-tooltip",cJe=f.memo(function({entries:t,currentTurnId:n,currentRange:s,hidden:r,onSelect:i}){const o=Hc(),{t:a}=at(),c=f.useRef(null),u=f.useRef(null),d=f.useRef(null),h=f.useRef(!1),m=f.useRef(!1),p=f.useRef(null),g=f.useRef(null),[b,x]=f.useState(null),y=s!==null?s.currentIndex:t.findIndex(E=>E.id===n),v=f.useCallback(()=>x(null),[]),w=f.useCallback(()=>{h.current||m.current||v()},[v]),k=f.useCallback((E,B)=>{const I=c.current;if(!I)return null;const L=getComputedStyle(I),O=B.getBoundingClientRect();return{entry:E,top:O.top+O.height/2,left:O.right+8,clamped:!1,themeVars:Object.fromEntries(lJe.map(A=>[A,L.getPropertyValue(A)]))}},[]),T=f.useCallback(E=>{const B=u.current;if(!B)return null;const I=Array.from(B.querySelectorAll('[data-testid="session-timeline-entry"]')).find(L=>L.getAttribute("data-turn-id")===E.id);return(I==null?void 0:I.querySelector("button"))??null},[]),C=f.useCallback(E=>{const B=u.current;if(!B)return!1;const I=B.getBoundingClientRect(),L=E.getBoundingClientRect();return L.bottom>=I.top&&L.top<=I.bottom},[]),_=f.useCallback(()=>{x(E=>{if(!E)return null;const B=T(E.entry);return!B||!C(B)?null:k(E.entry,B)})},[k,T,C]),S=f.useCallback((E,B)=>{x(k(E,B))},[k]),D=f.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 f.useLayoutEffect(()=>{if(r)return;const E=u.current;if(!E||y<0)return;const B=E.querySelector(`[data-timeline-index="${y}"]`);if(!B)return;const I=B.offsetTop+B.offsetHeight/2,L=E.scrollHeight-E.clientHeight,O=Math.max(0,Math.min(I-E.clientHeight/2,L));if(E.scrollTop===O)return;h.current=!0,E.scrollTop=O;const A=window.requestAnimationFrame(()=>{h.current=!1,_()}),$=window.setTimeout(()=>{h.current=!1},100);return()=>{window.cancelAnimationFrame(A),window.clearTimeout($),h.current=!1}},[y,r,_]),f.useLayoutEffect(()=>{if(!(!b||typeof window>"u"))return window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}},[_,b]),f.useLayoutEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),m.current=!1},[]),f.useLayoutEffect(()=>{if(!b||b.clamped)return;const E=c.current,B=d.current;if(!E||!B||typeof window>"u")return;const I=B.getBoundingClientRect(),L=12;let O=b.top;I.top<L?O+=L-I.top:I.bottom>window.innerHeight-L&&(O-=I.bottom-(window.innerHeight-L)),O!==b.top&&x(A=>(A==null?void 0:A.entry.id)===b.entry.id?{...A,top:O,clamped:!0}:A)},[b]),r||t.length===0?null:l.jsx("div",{className:Ds.sessionTimelineLayer,"aria-hidden":"false",children:l.jsxs("nav",{ref:c,className:Ds.sessionTimelinePanel,"aria-label":a("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:v,children:[l.jsx("div",{ref:u,className:Ds.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:w,children:l.jsx("ol",{className:Ds.sessionTimelineList,children:t.map((E,B)=>{const I=s!==null&&B>=s.startIndex&&B<=s.endIndex,L=s!==null?B===s.currentIndex:E.id===n,O=E.nodeKinds.join(","),A=[`${a("timeline.turnPrefix",{index:B+1})}: ${E.label}`,L?a("timeline.currentTurn"):null].filter(Boolean).join(". "),$=H=>S(E,H.currentTarget),q=H=>{D(),S(E,H.currentTarget)},U=(b==null?void 0:b.entry.id)===E.id;return l.jsx("li",{className:Ds.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":E.id,"data-timeline-index":B,"data-node-kinds":O,"data-in-current-range":I?"true":void 0,children:l.jsx("button",{type:"button",className:$N(Ds.sessionTimelineButton,I?Ds.sessionTimelineButtonInRange:void 0,L?Ds.sessionTimelineButtonCurrent:void 0),"aria-current":L?"step":void 0,"aria-describedby":U?rU:void 0,"aria-label":A,onClick:()=>i(E.id),onFocus:q,onBlur:v,onMouseEnter:$,onMouseLeave:v,children:l.jsx("span",{className:Ds.sessionTimelineTick})})},E.id)})})}),b&&typeof document<"u"&&hu.createPortal(l.jsxs("div",{ref:d,className:Ds.sessionTimelineDetails,id:rU,"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:[l.jsxs("span",{className:Ds.sessionTimelineDetailsTitle,children:[b.entry.isScheduledTask&&l.jsx(DQe,{}),l.jsx("span",{className:Ds.sessionTimelineDetailsTitleText,children:b.entry.label})]}),l.jsx("span",{className:Ds.sessionTimelineDetailsDetail,children:b.entry.detail})]}),o??document.body)]})})});function $N(...e){return e.filter(Boolean).join(" ")||void 0}const uJe=[];function dJe({label:e}){return l.jsxs(l.Fragment,{children:[l.jsx("div",{role:"status","aria-live":"polite",className:Ds.srOnly,children:e}),l.jsxs("div",{className:Ds.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[l.jsx("div",{className:Ds.loadingSkeletonUserRow,children:l.jsxs("div",{className:Ds.loadingSkeletonUserBubble,children:[l.jsx("span",{className:Ds.loadingSkeletonLineWide}),l.jsx("span",{className:Ds.loadingSkeletonLineShort})]})}),l.jsx("div",{className:Ds.loadingSkeletonAssistantRow,children:l.jsxs("div",{className:Ds.loadingSkeletonAssistantBlock,children:[l.jsx("span",{className:Ds.loadingSkeletonLineMedium}),l.jsx("span",{className:Ds.loadingSkeletonLineWide}),l.jsx("span",{className:Ds.loadingSkeletonLineNarrow})]})}),l.jsx("div",{className:Ds.loadingSkeletonUserRow,children:l.jsx("div",{className:Ds.loadingSkeletonUserBubbleCompact,children:l.jsx("span",{className:Ds.loadingSkeletonLineMedium})})}),l.jsx("div",{className:Ds.loadingSkeletonAssistantRow,children:l.jsxs("div",{className:Ds.loadingSkeletonAssistantBlock,children:[l.jsx("span",{className:Ds.loadingSkeletonLineWide}),l.jsx("span",{className:Ds.loadingSkeletonLineMedium})]})})]})]})}const pD=f.memo(f.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:s,loadingTranscript:r,catchingUp:i,hasOlderHistory:o=!1,loadingOlderHistory:a=!1,historyCapacityReached:c=!1,onLoadOlderHistory:u,transcriptBlockCount:d=0,transcriptActivity:h,onReloadTranscript:m,isResponding:p=!1,activeTurnStartedAt:g,welcomeHeader:b,centerWelcomeHeader:x=!1,workspaceCwd:y,tailContent:v,tailKey:w="tail",virtualScrollThreshold:k=Nae,autoScrollTailIntoView:T=!1,bottomOverlayInset:C=0,hideSessionTimeline:_=!1,hideFirstUserMessage:S=!1,firstTurnMetrics:D,includeSubagentToolUsageInMetrics:E=!0,showRetryHint:B=!1,onRetryClick:I,onBranchSession:L,onCanScrollToBottomChange:O,turnFileChanges:A,turnArtifacts:$,turnScheduledTasks:q,onReviewChanges:U,onOpenArtifact:H,onOpenScheduledTask:M,onTurnOutputOpen:ee,generateContent:V},R){var In;const{t:re}=at(),Z=f.useContext(R0),K=f.useMemo(()=>Z?xQe(t,n):t,[Z,t,n]),Y=f.useMemo(()=>kQe(Eae(K),p,A,$,q),[K,p,A,$,q]),[ae,le]=f.useState(!1),te=f.useRef(null),z=f.useMemo(()=>{var We,St;if(!ae)return uJe;const we=PQe(K);return(((We=te.current)==null?void 0:We.signature)!==we||((St=te.current)==null?void 0:St.t)!==re)&&(te.current={signature:we,t:re,entries:RQe(K,re)}),te.current.entries},[ae,K,re]),X=f.useMemo(()=>new Map(z.map((we,We)=>[we.id,We])),[z]),fe=f.useMemo(()=>vQe(K),[K]),[xe,ie]=f.useState(null),Ce=xe!==null?((In=z[xe.currentIndex])==null?void 0:In.id)??fe:fe,Ke=f.useMemo(()=>{var we;if(p)return null;for(let We=K.length-1;We>=0;We-=1){const St=K[We];if(St&&(St.role==="tool_group"||St.role==="plan"))return null;if((St==null?void 0:St.role)==="assistant"&&!St.isStreaming&&((we=St.content)!=null&&we.trim()))return St.id}return null},[p,K]),ut=f.useMemo(()=>SQe(Y,p),[Y,p]),{collapseCompletedTurns:Et}=mu(),st=Et??!0,[xt,He]=f.useState(()=>new Map),[pn,Yt]=f.useTransition(),It=f.useRef(!1),me=f.useRef(new Map),$e=f.useRef(void 0),yt=f.useRef([]),Me=f.useRef(!0),Le=f.useRef(!1),vn=f.useRef(0),ge=f.useRef(0),Rt=f.useRef(!1),ht=f.useRef(!1),gn=f.useRef(0),Ue=f.useRef(null),De=f.useRef(null),Re=f.useRef(!1),be=f.useRef(null),Ie=f.useRef(!1),ne=f.useRef(r),Ee=f.useRef(!!r),qe=f.useRef(void 0),Je=f.useRef(void 0),Qe=f.useRef(C),cn=f.useRef(null),Kn=f.useRef(i),_e=f.useRef(i),ft=f.useRef(!1),$t=f.useRef(!1),pe=f.useRef(void 0),Be=f.useRef(void 0);_e.current=i;const ue=f.useRef(null),Wt=f.useRef(!1),Bt=f.useRef(void 0),hn=f.useRef(void 0),gt=f.useRef(void 0),Ae=f.useRef(d),kn=f.useRef(p);Ae.current=d,kn.current=p;const Dn=f.useRef(null),[qn,ir]=f.useState(null),[Qn,jr]=f.useState(!1);f.useLayoutEffect(()=>{if(!qn)return;const we=ue.current;we&&(we.scrollTop=qn.scrollTop+Math.max(0,we.scrollHeight-qn.scrollHeight)),Rt.current=!1,ir(null)},[qn]),f.useEffect(()=>{o||(Wt.current=!1,Dn.current=null)},[o]);const es=f.useCallback(()=>{const we=ue.current,We=we?we.scrollHeight-we.scrollTop-we.clientHeight:0,St=!Me.current&&We>1;De.current!==St&&(De.current=St,O==null||O(St))},[O]),Gn=f.useCallback(()=>{Be.current!==void 0&&window.cancelAnimationFrame(Be.current),Be.current=window.requestAnimationFrame(es)},[es]),Dt=f.useCallback(we=>{Me.current!==we&&(Me.current=we,Gn())},[Gn]),ps=f.useMemo(()=>{var Ct;const we=KQe(Y,{overrides:xt,isResponding:p,activeTurnStartedAt:g,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,includeSubagentToolUsageInMetrics:E,enabled:st});let We=!1;const St=D?we.map($n=>We||$n.type!=="turn_collapse"?$n:(We=!0,{...$n,turnCollapse:{...$n.turnCollapse,...D.durationMs!==void 0&&D.durationMs>0?{elapsedMs:D.durationMs}:{},...D.inputTokens!==void 0?{inputTokens:D.inputTokens}:{},...D.outputTokens!==void 0?{outputTokens:D.outputTokens}:{},...D.cachedTokens!==void 0?{cachedTokens:D.cachedTokens}:{}}})):we;if(!S)return St;const fn=(Ct=K.find($n=>$n.role==="user"))==null?void 0:Ct.id;return fn?St.filter($n=>$n.type!=="message"||$n.message.id!==fn):St},[Y,xt,p,g,n==null?void 0:n.toolCallId,st,S,D,E,K]),is=f.useMemo(()=>jae(ps),[ps]),os=z.length>=ZQe;f.useLayoutEffect(()=>{if(_){le(fn=>fn&&!1);return}const we=ue.current;if(!we)return;const We=()=>{const Ct=we.getBoundingClientRect().width>=1160;le($n=>$n===Ct?$n:Ct)};if(We(),typeof ResizeObserver>"u")return;const St=new ResizeObserver(We);return St.observe(we),()=>St.disconnect()},[_]);const ts=v!=null,Wn=!!r,ds=!!b,Sn=ds?1:0,ui=Sn+ps.length,Ur=ui+(ts?1:0),lr=Sn+Y.length+(ts?1:0),Cs=eJe(lr,k),js=f.useCallback(()=>ue.current,[]),Ii=f.useCallback(()=>{const we=ue.current;if(!we)return;const St=we.scrollHeight-we.scrollTop-we.clientHeight<l2;Le.current=!St,Dt(St),Gn()},[Gn,Dt]),Jr=f.useCallback(()=>{vn.current=Date.now()+1e3},[]),ve=f.useCallback(()=>{Bt.current!==void 0&&(window.clearTimeout(Bt.current),Bt.current=void 0)},[]),ze=f.useCallback(()=>{var we;ve(),(we=hn.current)==null||we.abort(),hn.current=void 0},[ve]),lt=f.useCallback(()=>{ve();const we=gt.current;if(we){if((h==null?void 0:h.getSnapshot().lastEventId)===we.lastEventId&&Ae.current<=we.blockCount)return;gt.current=void 0}!m||hn.current!==void 0||Le.current||kn.current||Ae.current<=Y1e||(Bt.current=window.setTimeout(()=>{Bt.current=void 0;const We=ue.current;if(!We||We.scrollHeight-We.scrollTop-We.clientHeight>=l2)return;const fn=new AbortController;hn.current=fn,m(fn.signal).then(()=>{var $n;if(fn.signal.aborted)return;const Ct=h==null?void 0:h.getSnapshot();gt.current={...(Ct==null?void 0:Ct.lastEventId)!==void 0?{lastEventId:Ct.lastEventId}:{},blockCount:(($n=Ct==null?void 0:Ct.blocks)==null?void 0:$n.length)??Ae.current}}).catch(Ct=>{Ct instanceof Error&&Ct.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Ct)}).finally(()=>{hn.current===fn&&(hn.current=void 0)})},gQe))},[ve,m,h]);f.useEffect(()=>{gt.current=void 0},[h]),f.useEffect(()=>{if(!h)return ze;let we=h.getSnapshot().lastEventId;const We=h.subscribe(()=>{const St=h.getSnapshot().lastEventId;St!==we&&(we=St,lt())});return()=>{We(),ze()}},[h,lt,ze]),f.useEffect(()=>{lt()},[p,lt,d]);const _t=f.useCallback(()=>{$t.current=!0,pe.current!==void 0&&window.cancelAnimationFrame(pe.current),pe.current=window.requestAnimationFrame(()=>{$t.current=!1,pe.current=void 0,Ii()})},[Ii]);f.useEffect(()=>()=>{pe.current!==void 0&&window.cancelAnimationFrame(pe.current),Be.current!==void 0&&window.cancelAnimationFrame(Be.current),ze(),qe.current!==void 0&&window.cancelAnimationFrame(qe.current),Je.current!==void 0&&window.cancelAnimationFrame(Je.current)},[ze]);const Xt=f.useCallback((we,We)=>{var fn;const St=ue.current;(!St||St.scrollHeight>St.clientHeight+1)&&(Le.current=!0,Dt(!1)),_t(),$e.current!==void 0&&window.clearTimeout($e.current),me.current.clear(),(fn=ue.current)==null||fn.querySelectorAll("[data-message-row-key]").forEach(Ct=>{const $n=Ct.dataset.messageRowKey;$n&&me.current.set($n,Ct.getBoundingClientRect().top)}),It.current=!0,Yt(()=>{He(Ct=>{const $n=new Map(Ct);return $n.set(we,We),$n})})},[_t,Dt]);f.useLayoutEffect(()=>{var We;if(pn||!It.current)return;It.current=!1;for(const St of yt.current)St.cancel();yt.current=[];const we=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;we||(We=ue.current)==null||We.querySelectorAll("[data-message-row-key]").forEach(St=>{if(typeof St.animate!="function")return;const fn=St.dataset.messageRowKey,Ct=fn?me.current.get(fn):void 0;if(Ct===void 0){yt.current.push(St.animate([{opacity:0},{opacity:1}],{duration:y7,easing:"ease-out"}));return}const $n=Ct-St.getBoundingClientRect().top;Math.abs($n)<1||yt.current.push(St.animate([{translate:`0 ${$n}px`},{translate:"0 0"}],{duration:y7,easing:"ease-out"}))}),me.current.clear(),$e.current=window.setTimeout(()=>{$e.current=void 0,_t()},we?0:y7)},[_t,pn]),f.useEffect(()=>()=>{$e.current!==void 0&&window.clearTimeout($e.current);for(const we of yt.current)we.cancel();yt.current=[]},[]);const rs=f.useCallback(we=>{const We=we.target;We instanceof HTMLElement&&We.closest("[aria-expanded]")&&(Le.current=!0,Dt(!1),_t())},[_t,Dt]),fs=f.useCallback(we=>{if(ds&&we===_7)return"slot:header";if(ts&&we===ui)return`slot:tail:${w}`;const We=ps[we-Sn];return We?wQe(We):`slot:row:${we}`},[ds,ts,ui,w,ps,Sn]),gs=f.useCallback((we="auto")=>{const We=js();if(!We||We.scrollHeight<=We.clientHeight)return;gn.current+=1;const St=gn.current;ht.current=!0,we==="smooth"?We.scrollTo({top:We.scrollHeight,behavior:we}):We.scrollTop=We.scrollHeight,Gn(),ge.current=Math.max(0,We.scrollHeight-We.clientHeight),es();const fn=()=>{gn.current===St&&(ht.current=!1)};we==="smooth"?setTimeout(fn,350):requestAnimationFrame(fn)},[js,es,Gn]),Ps=f.useCallback((we="smooth")=>{Le.current=!1,Dt(!0),gs(we)},[gs,Dt]),mr=mbe({count:Ur,enabled:Cs,getScrollElement:js,getItemKey:fs,estimateSize:we=>{if(ds&&we===_7)return YQe;if(ts&&we===ui)return JQe;const We=ps[we-Sn];return(We==null?void 0:We.type)==="turn_collapse"?QQe:XQe},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Ri=mr.getVirtualItems(),si=mr.getTotalSize(),cr=f.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});cr.current={entryIndexById:X,headerOffset:Sn,isVisible:ae,turnIdByDisplayIndex:is,visibleItems:ps};const Jn=f.useCallback(()=>{const we=js(),We=cr.current;if(!we||!We.isVisible||We.entryIndexById.size===0){ie(Yn=>Yn===null?Yn:null);return}const St=we.getBoundingClientRect(),fn=St.top,Ct=St.bottom,$n=fn+(Ct-fn)/2,as=[];let Rs=null,ki=Number.POSITIVE_INFINITY;we.querySelectorAll("[data-index]").forEach(Yn=>{const or=Yn.dataset.index;if(or===void 0)return;const ur=Number(or);if(!Number.isFinite(ur))return;const Dr=ur-We.headerOffset;if(Dr<0||Dr>=We.visibleItems.length)return;const ri=Yn.getBoundingClientRect();if(ri.bottom<fn||ri.top>Ct)return;as.push(Dr);const ua=ri.top+(ri.bottom-ri.top)/2,Ya=Math.abs(ua-$n);Ya<ki&&(ki=Ya,Rs=Dr)});const zs=VQe(We.visibleItems,as,We.entryIndexById,Rs,We.turnIdByDisplayIndex);ie(Yn=>(Yn==null?void 0:Yn.startIndex)===(zs==null?void 0:zs.startIndex)&&(Yn==null?void 0:Yn.endIndex)===(zs==null?void 0:zs.endIndex)&&(Yn==null?void 0:Yn.currentIndex)===(zs==null?void 0:zs.currentIndex)?Yn:zs)},[js]),Ln=f.useCallback(()=>{Ue.current!==null&&cancelAnimationFrame(Ue.current),Ue.current=requestAnimationFrame(()=>{Ue.current=null,Jn()})},[Jn]);f.useEffect(()=>()=>{Ue.current!==null&&(cancelAnimationFrame(Ue.current),Ue.current=null)},[]),f.useEffect(()=>{Ln()},[Ln,Ur,si,Cs,Ri.length,ae]);const[Vn,Hi]=f.useState(null);f.useEffect(()=>{if(!Vn)return;const we=setTimeout(()=>Hi(null),1600);return()=>clearTimeout(we)},[Vn]);const Di=f.useCallback((we,We)=>{var fn,Ct;Le.current=!0,Dt(!1),gn.current+=1;const St=gn.current;ht.current=!0,Cs?mr.scrollToIndex(we,{align:"center"}):(Ct=(fn=ue.current)==null?void 0:fn.querySelector(`[data-index="${we}"]`))==null||Ct.scrollIntoView({block:"center"}),setTimeout(()=>{gn.current===St&&(ht.current=!1,Ln(),Gn())},150),Hi(null),requestAnimationFrame(()=>Hi(We))},[Cs,mr,Dt,Ln,Gn]),Mo=f.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Mo.current={visibleItems:ps,displayItems:Y,headerOffset:Sn,performScrollToRow:Di};const ns=f.useRef(null),Rr=f.useCallback((we,We)=>{const{visibleItems:St,displayItems:fn,headerOffset:Ct,performScrollToRow:$n}=Mo.current,as=k7(St,we,We);if(as>=0)return ns.current=null,$n(as+Ct,{messageId:we,callId:We}),!0;const Rs=k7(fn,we,We);if(Rs<0)return!1;const ki=Aae(fn,Rs);return ki?(ns.current={messageId:we,callId:We},He(zs=>{if(zs.get(ki)===!0)return zs;const Yn=new Map(zs);return Yn.set(ki,!0),Yn}),!0):!1},[]);f.useImperativeHandle(R,()=>({scrollToMessage:Rr,scrollToBottom:Ps}),[Rr,Ps]),f.useEffect(()=>{const we=ns.current;if(!we)return;const We=k7(ps,we.messageId,we.callId);We<0||(ns.current=null,Di(We+Sn,we))},[ps,Sn,Di]);const pr=f.useCallback(async(we=!1)=>{const We=ue.current;if(!We||!u||a||Rt.current||Wt.current&&!we)return;Wt.current=!1,Rt.current=!0,jr(!we);const St=We.scrollHeight,fn=We.scrollTop;Le.current=!0;try{await u(),ir({scrollHeight:St,scrollTop:fn})}catch{Wt.current=!0,Rt.current=!1}finally{jr(!1)}},[a,u]),Cr=f.useCallback(()=>{const we=js();if(!we)return;const We=we.scrollTop;if(o&&We<=nU&&pr(!0),ht.current){ge.current=We;return}Ln();const St=ge.current;ge.current=We;const fn=we.scrollHeight-We-we.clientHeight;if(Gn(),We<St-1){const Ct=fn<l2,$n=Date.now()<=vn.current;Ct?(Le.current=!1,Dt(!0)):$n?(ze(),Le.current=!0,Dt(!1)):Le.current||(ze(),Dt(!1));return}fn<l2?(Le.current=!1,Dt(!0),lt()):ze()},[js,o,pr,Gn,Ln,lt,ze,Dt]);f.useEffect(()=>{const we=js();if(we)return we.addEventListener("scroll",Cr,{passive:!0}),()=>we.removeEventListener("scroll",Cr)},[js,Cr]);const Fe=f.useCallback(()=>{if(!o||a||i||Wn)return;const we=js();if(!we||we.scrollHeight>we.clientHeight+1)return;const We=Dn.current;if(We!==null&&We.loader===u&&We.totalVirtualSize===si){Wt.current=!0;return}Dn.current={loader:u,totalVirtualSize:si},pr()},[i,js,o,pr,a,u,Wn,si]);f.useEffect(()=>{Fe()},[Fe,si]),f.useEffect(()=>{const we=js();if(!we)return;const We=()=>{Wt.current&&we.scrollTop<=nU&&pr(!0)},St=as=>{Jr(),as.deltaY<0&&We()},fn=()=>{Jr(),We()},Ct=as=>{const Rs=we.getBoundingClientRect(),ki=20;(as.clientX>=Rs.right-ki||as.clientY>=Rs.bottom-ki)&&Jr()},$n=as=>{(as.key==="ArrowUp"||as.key==="ArrowDown"||as.key==="PageUp"||as.key==="PageDown"||as.key==="Home"||as.key==="End"||as.key===" ")&&(Jr(),(as.key==="ArrowUp"||as.key==="PageUp"||as.key==="Home")&&We())};return we.addEventListener("wheel",St,{passive:!0}),we.addEventListener("touchstart",fn,{passive:!0}),we.addEventListener("pointerdown",Ct,{passive:!0}),we.addEventListener("keydown",$n,{passive:!0}),()=>{we.removeEventListener("wheel",St),we.removeEventListener("touchstart",fn),we.removeEventListener("pointerdown",Ct),we.removeEventListener("keydown",$n)}},[js,pr,Jr]),f.useEffect(()=>{const we=js();if(!we||typeof ResizeObserver>"u")return;const We=new ResizeObserver(()=>{Gn(),Fe()});We.observe(we);for(const fn of Array.from(we.children))We.observe(fn);const St=new MutationObserver(fn=>{for(const Ct of fn){for(const $n of Array.from(Ct.addedNodes))$n instanceof HTMLElement&&We.observe($n);for(const $n of Array.from(Ct.removedNodes))$n instanceof HTMLElement&&We.unobserve($n)}Gn()});return St.observe(we,{childList:!0}),Gn(),()=>{We.disconnect(),St.disconnect()}},[js,Fe,Gn]),f.useEffect(()=>{t.length===0&&(Le.current=!1,Dt(!0),ns.current=null,He(we=>we.size?new Map:we))},[t.length,Dt]),f.useEffect(()=>{const we=ue.current;if(!we)return;const We=new ResizeObserver(()=>{Ln(),!_e.current&&(Le.current||(Dt(!0),requestAnimationFrame(()=>{!_e.current&&!Le.current&&gs()})))});return We.observe(we),()=>We.disconnect()},[gs,Ln,Dt]),f.useLayoutEffect(()=>{const we=bQe(t);if(i||r||ne.current){be.current=we,Re.current=!0,Ie.current=!1,ne.current=r;return}if(ne.current=r,!Re.current){be.current=we,Re.current=!0,Ie.current=!1;return}const We=yQe(t);we&&(We==null?void 0:We.role)==="user"&&we!==be.current?(Le.current=!1,Dt(!0),ns.current=null,Ie.current=!0):Ie.current=!1,be.current=we},[t,i,r,Dt]),f.useLayoutEffect(()=>{Kn.current&&!i&&(Le.current=!1,Dt(!0),gs("auto")),Kn.current=i},[i,gs,Dt]),f.useLayoutEffect(()=>{if(r){Ee.current=!0;return}if(!Ee.current||i||t.length===0)return;Ee.current=!1,Le.current=!1,Dt(!0),ns.current=null,qe.current!==void 0&&window.cancelAnimationFrame(qe.current),Je.current!==void 0&&window.cancelAnimationFrame(Je.current);const we=()=>{_e.current||Le.current||(Dt(!0),gs("auto"))};qe.current=window.requestAnimationFrame(()=>{qe.current=void 0,we(),Je.current=window.requestAnimationFrame(()=>{Je.current=void 0,we()})})},[i,r,t.length,gs,Dt]),f.useLayoutEffect(()=>{const we=Qe.current!==C;Qe.current=C,we&&(i||Le.current||(Dt(!0),requestAnimationFrame(()=>{!_e.current&&!Le.current&&gs("auto")})))},[C,i,gs,Dt]);const xn=f.useMemo(()=>BQe(ps),[ps]);f.useLayoutEffect(()=>{if(!i){if(!xn){cn.current=null;return}xn!==cn.current&&(cn.current=xn,(Me.current||!Le.current)&&requestAnimationFrame(()=>{Le.current||(Dt(!0),gs())}))}},[i,xn,gs,Dt]),f.useEffect(()=>{T&&ts&&!ft.current&&(Le.current=!1,Dt(!0),requestAnimationFrame(()=>{Le.current||gs()})),ft.current=ts},[T,ts,gs,Dt]);const kt=f.useCallback(we=>{const We=(Ct,$n)=>{if(Ct.type==="parallel_agents")return l.jsx(kA,{timestamp:Ct.timestamp,children:l.jsx("div",{className:tU(Ct,Vn)?Lm.flash:void 0,children:l.jsx(TXe,{agents:Ct.agents,pendingApproval:n})})});if(Ct.type==="turn_outputs")return l.jsx(JYe,{changes:Ct.changes,turnId:Ct.turnId,artifacts:Ct.artifacts,scheduledTasks:Ct.scheduledTasks,workspaceCwd:y,onOpenRequest:ee,onReviewChanges:U??b7,onOpenArtifact:H??b7,onOpenScheduledTask:M??b7});if(Ct.type==="turn_collapse")return l.jsx(iJe,{turnCollapse:Ct.turnCollapse,onToggleCollapse:Xt});const as=Ct.message.role==="assistant"?ut.get(Ct.message.id):void 0;let Rs;return Ct.message.role==="assistant"&&as&&(Rs={turnId:as,message:{id:Ct.message.id,content:Ct.message.content,isStreaming:Ct.message.isStreaming,timestamp:Ct.message.timestamp}}),l.jsx(hYe,{message:Ct.message,pendingApproval:n,onShowContextDetail:s,workspaceCwd:y,isLatest:$n,showRetryHint:B,onRetryClick:I,onBranchSession:L,showAssistantActions:Ct.message.role==="assistant"&&ut.has(Ct.message.id),showAssistantBranch:Ct.message.role==="assistant"&&Ct.message.id===Ke,isLocateFlashing:tU(Ct,Vn),assistantTurnFooterInfo:Rs,generateContent:V})};if(ds&&we===_7)return b;if(ts&&we===ui)return v;const St=we-Sn,fn=ps[St];return fn?We(fn,St===ps.length-1):null},[ds,b,ts,v,ui,n,s,V,Sn,ps,Vn,ut,Ke,y,B,I,L,Xt,H,M,U,ee]),ms=f.useCallback(we=>we?oJe(we):void 0,[]);return f.useLayoutEffect(()=>{if(i)return;const we=Ie.current;ht.current&&!we||$t.current&&!we||(Me.current||we||!Le.current)&&(Le.current||Dt(!0),gs(we?"smooth":"auto"),Ie.current=!1)},[si,t,Ur,i,gs,Dt]),f.useLayoutEffect(()=>{Gn()},[t,Gn,Ur,si]),l.jsxs("div",{ref:ue,className:$N(Ds.list,ds&&x?Ds.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:rs,children:[Wn&&l.jsx(dJe,{label:re("editor.sessionLoading")}),a&&!Wn&&!Qn&&l.jsx("div",{className:Ds.historyStatus,role:"status",children:re("history.loadingEarlier")}),c&&!Wn&&l.jsx("div",{className:Ds.historyStatus,role:"status",children:re("history.capacityReached")}),l.jsx(cJe,{entries:z,currentTurnId:Ce,currentRange:xe,hidden:!ae||!os,onSelect:Rr}),Cs?l.jsx("div",{className:Ds.virtualSizer,style:{height:si},children:Ri.map(we=>l.jsx("div",{"data-index":we.index,ref:mr.measureElement,className:$N(Ds.virtualRow,ms(ps[we.index-Sn])),"data-message-row-key":String(fs(we.index)),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${we.start}px)`},children:kt(we.index)},we.key))}):Array.from({length:Ur},(we,We)=>{const St=fs(We),fn=ps[We-Sn];return l.jsx("div",{"data-index":We,className:ms(fn),"data-message-row-key":String(St),"data-web-shell-message-row":!0,children:kt(We)},St)})]})}));/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function hJe(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 iU(e){const t=new Set,n=[];for(const s of(e==null?void 0:e.providers)??[])for(const r of s.models??[]){const i=r.baseModelId;!i||r.isRuntime||!hJe(i)||t.has(i)||(t.add(i),n.push({id:i,...r.name?{label:r.name}:{},...s.authType?{authType:s.authType}:{},...r.baseUrl?{baseUrl:r.baseUrl}:{},...typeof r.contextLimit=="number"?{contextWindow:r.contextLimit}:{},modalities:{audio:!0}}))}return n}const fJe="_editorShell_r7nbo_1",mJe="_editorShellDropdownOpen_r7nbo_7",pJe="_container_r7nbo_11",gJe="_content_r7nbo_30",bJe="_dacAura_r7nbo_46",yJe="_dacHalo_r7nbo_47",vJe="_atPortalLayer_r7nbo_188",xJe="_slashPanel_r7nbo_216",wJe="_slashPanelBody_r7nbo_225",kJe="_slashList_r7nbo_230",_Je="_slashEntry_r7nbo_257",SJe="_slashSection_r7nbo_263",CJe="_slashSectionHeader_r7nbo_269",TJe="_slashSectionCount_r7nbo_282",EJe="_slashItem_r7nbo_290",AJe="_slashItemActive_r7nbo_316",jJe="_slashCommand_r7nbo_320",NJe="_slashDetail_r7nbo_325",MJe="_slashDetailCommand_r7nbo_335",IJe="_slashDetailText_r7nbo_345",RJe="_slashDescription_r7nbo_365",DJe="_atPanel_r7nbo_377",LJe="_atPanelHeaderWrap_r7nbo_401",PJe="_atPanelHeader_r7nbo_401",OJe="_atBackButton_r7nbo_416",$Je="_atPanelTitle_r7nbo_438",BJe="_atTabsWrap_r7nbo_447",zJe="_atTabs_r7nbo_447",FJe="_atTab_r7nbo_447",HJe="_atTabScrollButton_r7nbo_471",qJe="_atTabActive_r7nbo_503",UJe="_atSearchInput_r7nbo_514",WJe="_atList_r7nbo_533",VJe="_atItem_r7nbo_561",GJe="_atItemActive_r7nbo_583",KJe="_atItemSingleLine_r7nbo_587",YJe="_atItemMain_r7nbo_593",XJe="_atItemLeading_r7nbo_604",QJe="_atItemIcon_r7nbo_614",JJe="_atItemImageIcon_r7nbo_625",ZJe="_atItemIconSpin_r7nbo_633",eZe="_atItemLabel_r7nbo_637",tZe="_atItemSubtitle_r7nbo_638",nZe="_atItemDescription_r7nbo_665",sZe="_atItemTrailing_r7nbo_676",rZe="_atEmpty_r7nbo_683",iZe="_attachments_r7nbo_689",oZe="_tags_r7nbo_699",aZe="_tag_r7nbo_699",lZe="_tagContent_r7nbo_722",cZe="_tagTooltip_r7nbo_730",uZe="_tagLabel_r7nbo_754",dZe="_tagValue_r7nbo_755",hZe="_tagIcon_r7nbo_759",fZe="_tagRemove_r7nbo_794",mZe="_editorArea_r7nbo_814",pZe="_shellPrefix_r7nbo_842",gZe="_mobileTextarea_r7nbo_865",bZe="_toolbar_r7nbo_911",yZe="_toolbarLeading_r7nbo_921",vZe="_toolbarStart_r7nbo_922",xZe="_toolbarEnd_r7nbo_923",wZe="_toolbarLeft_r7nbo_924",kZe="_toolbarRight_r7nbo_925",_Ze="_gitBranchChip_r7nbo_949",SZe="_gitBranchChipButton_r7nbo_966",CZe="_gitBranchIcon_r7nbo_984",TZe="_gitBranchText_r7nbo_996",EZe="_gitBranchIconWrap_r7nbo_1011",AZe="_gitBranchBadgeDot_r7nbo_1019",jZe="_gitBranchIndicators_r7nbo_1038",NZe="_gitBranchDirtyDot_r7nbo_1045",MZe="_gitBranchAheadBehind_r7nbo_1053",IZe="_gitBranchStash_r7nbo_1058",RZe="_gitBranchConflicted_r7nbo_1071",DZe="_gitBranchOperation_r7nbo_1085",LZe="_gitBranchTooltip_r7nbo_1093",PZe="_gitBranchTooltipTitle_r7nbo_1099",OZe="_gitBranchTooltipRow_r7nbo_1103",$Ze="_workspaceChip_r7nbo_1109",BZe="_workspaceChipAccented_r7nbo_1128",zZe="_workspaceChipIcon_r7nbo_1132",FZe="_workspaceChipText_r7nbo_1148",HZe="_toolbarRightCustom_r7nbo_1160",qZe="_toolbarMeasurements_r7nbo_1166",UZe="_dropdownWrapper_r7nbo_1177",WZe="_dropdownWrapperCompact_r7nbo_1181",VZe="_dropdownList_r7nbo_1186",GZe="_dropdownListConstrained_r7nbo_1196",KZe="_dropdownEmpty_r7nbo_1200",YZe="_dropdownItem_r7nbo_1207",XZe="_dropdownRich_r7nbo_1224",QZe="_dropdownCheck_r7nbo_1233",JZe="_dropdownItemActive_r7nbo_1245",ZZe="_dropdownItemIcon_r7nbo_1250",eet="_dropdownItemCheck_r7nbo_1251",tet="_dropdownItemContent_r7nbo_1268",net="_dropdownItemLabel_r7nbo_1275",set="_dropdownItemDesc_r7nbo_1285",ret="_toolBtn_r7nbo_1299",iet="_modeToolBtn_r7nbo_1317",oet="_modelToolBtn_r7nbo_1318",aet="_workspaceSelectTrigger_r7nbo_1327",cet="_gitBranchChipCompact_r7nbo_1362",uet="_workspaceChipCompact_r7nbo_1363",det="_workspaceSelectTriggerCompact_r7nbo_1364",het="_toolBtnCompact_r7nbo_1365",fet="_toolBtnText_r7nbo_1385",met="_toolBtnArrow_r7nbo_1386",pet="_toolBtnIcon_r7nbo_1413",get="_widthModeBtn_r7nbo_1429",bet="_quickActionsBtn_r7nbo_1438",yet="_toolBtnModeIcon_r7nbo_1447",vet="_toolBtnModelIcon_r7nbo_1448",xet="_quickActionsPanel_r7nbo_1494",wet="_quickActionsHeader_r7nbo_1507",ket="_quickActionsLayout_r7nbo_1514",_et="_quickActionsGrid_r7nbo_1521",Cet="_quickAction_r7nbo_1438",Tet="_quickActionLabel_r7nbo_1552",Eet="_quickKeysGrid_r7nbo_1567",Aet="_quickKey_r7nbo_1567",jet="_quickKeyLabel_r7nbo_1596",Net="_sendBtn_r7nbo_1609",Met="_sendBtnRunning_r7nbo_1647",Iet="_sendIcon_r7nbo_1660",Ret="_stopIcon_r7nbo_1666",Det="_loadingIcon_r7nbo_1673",Let="_sendBtnArmed_r7nbo_1685",Pet="_escLabel_r7nbo_1753",Oet="_srOnly_r7nbo_1761",$et="_images_r7nbo_1783",Bet="_imageThumb_r7nbo_1791",zet="_imageRemove_r7nbo_1806",Fet="_searchPanel_r7nbo_1827",Het="_searchBar_r7nbo_1844",qet="_searchLabel_r7nbo_1852",Uet="_searchInput_r7nbo_1857",Wet="_searchResults_r7nbo_1871",Vet="_searchResult_r7nbo_1871",Get="_searchResultActive_r7nbo_1904",Ket="_searchResultMarker_r7nbo_1909",Yet="_searchResultText_r7nbo_1914",Xet="_searchEmpty_r7nbo_1921",ke={editorShell:fJe,editorShellDropdownOpen:mJe,container:pJe,content:gJe,dacAura:bJe,dacHalo:yJe,atPortalLayer:vJe,slashPanel:xJe,slashPanelBody:wJe,slashList:kJe,slashEntry:_Je,slashSection:SJe,slashSectionHeader:CJe,slashSectionCount:TJe,slashItem:EJe,slashItemActive:AJe,slashCommand:jJe,slashDetail:NJe,slashDetailCommand:MJe,slashDetailText:IJe,slashDescription:RJe,atPanel:DJe,atPanelHeaderWrap:LJe,atPanelHeader:PJe,atBackButton:OJe,atPanelTitle:$Je,atTabsWrap:BJe,atTabs:zJe,atTab:FJe,atTabScrollButton:HJe,atTabActive:qJe,atSearchInput:UJe,atList:WJe,atItem:VJe,atItemActive:GJe,atItemSingleLine:KJe,atItemMain:YJe,atItemLeading:XJe,atItemIcon:QJe,atItemImageIcon:JJe,atItemIconSpin:ZJe,atItemLabel:eZe,atItemSubtitle:tZe,atItemDescription:nZe,atItemTrailing:sZe,atEmpty:rZe,attachments:iZe,tags:oZe,tag:aZe,tagContent:lZe,tagTooltip:cZe,tagLabel:uZe,tagValue:dZe,tagIcon:hZe,tagRemove:fZe,editorArea:mZe,shellPrefix:pZe,mobileTextarea:gZe,toolbar:bZe,toolbarLeading:yZe,toolbarStart:vZe,toolbarEnd:xZe,toolbarLeft:wZe,toolbarRight:kZe,gitBranchChip:_Ze,gitBranchChipButton:SZe,gitBranchIcon:CZe,gitBranchText:TZe,gitBranchIconWrap:EZe,gitBranchBadgeDot:AZe,gitBranchIndicators:jZe,gitBranchDirtyDot:NZe,gitBranchAheadBehind:MZe,gitBranchStash:IZe,gitBranchConflicted:RZe,gitBranchOperation:DZe,gitBranchTooltip:LZe,gitBranchTooltipTitle:PZe,gitBranchTooltipRow:OZe,workspaceChip:$Ze,workspaceChipAccented:BZe,workspaceChipIcon:zZe,workspaceChipText:FZe,toolbarRightCustom:HZe,toolbarMeasurements:qZe,dropdownWrapper:UZe,dropdownWrapperCompact:WZe,dropdownList:VZe,dropdownListConstrained:GZe,dropdownEmpty:KZe,dropdownItem:YZe,dropdownRich:XZe,dropdownCheck:QZe,dropdownItemActive:JZe,dropdownItemIcon:ZZe,dropdownItemCheck:eet,dropdownItemContent:tet,dropdownItemLabel:net,dropdownItemDesc:set,toolBtn:ret,modeToolBtn:iet,modelToolBtn:oet,workspaceSelectTrigger:aet,gitBranchChipCompact:cet,workspaceChipCompact:uet,workspaceSelectTriggerCompact:det,toolBtnCompact:het,toolBtnText:fet,toolBtnArrow:met,toolBtnIcon:pet,widthModeBtn:get,quickActionsBtn:bet,toolBtnModeIcon:yet,toolBtnModelIcon:vet,quickActionsPanel:xet,quickActionsHeader:wet,quickActionsLayout:ket,quickActionsGrid:_et,quickAction:Cet,quickActionLabel:Tet,quickKeysGrid:Eet,quickKey:Aet,quickKeyLabel:jet,sendBtn:Net,sendBtnRunning:Met,sendIcon:Iet,stopIcon:Ret,loadingIcon:Det,sendBtnArmed:Let,escLabel:Pet,srOnly:Oet,images:$et,imageThumb:Bet,imageRemove:zet,searchPanel:Fet,searchBar:Het,searchLabel:qet,searchInput:Uet,searchResults:Wet,searchResult:Vet,searchResultActive:Get,searchResultMarker:Ket,searchResultText:Yet,searchEmpty:Xet},Qet=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function Jet({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r,onBack:i,onSearch:o,onSelectTab:a}){const c=Hc(),{t:u}=at(),d=f.useRef([]),h=f.useRef(null),m=f.useRef(null),[p,g]=f.useState(null),[b,x]=f.useState({});f.useEffect(()=>{var S;(S=d.current[e.selectedIndex])==null||S.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),f.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===h.current)return;const S=()=>{var B;return(B=h.current)==null?void 0:B.focus()},D=window.requestAnimationFrame(S),E=window.setTimeout(S,0);return()=>{window.cancelAnimationFrame(D),window.clearTimeout(E)}},[e.inputMode,e.level,e.selectedProviderId]),f.useLayoutEffect(()=>{const S=t.current;if(!S)return;const D=getComputedStyle(S);x(Object.fromEntries(Qet.map(E=>[E,D.getPropertyValue(E)])))},[t]),f.useLayoutEffect(()=>{const S=t.current;if(!S)return;let D=null;const E=()=>{var H;const L=S.getBoundingClientRect(),O=((H=n.current)==null?void 0:H.offsetWidth)??360,A=getComputedStyle(S),$=Number.parseFloat(A.getPropertyValue("--web-shell-popover-safe-top"))||48,q=Math.max(96,Math.min(300,L.top-$-8)),U={left:Math.max(12,Math.min(L.left+16,window.innerWidth-O-12)),bottom:window.innerHeight-L.top+8,width:L.width,maxHeight:q};g(M=>M&&M.left===U.left&&M.bottom===U.bottom&&M.width===U.width&&M.maxHeight===U.maxHeight?M:U)},B=()=>{D===null&&(D=window.requestAnimationFrame(()=>{D=null,E()}))};E();const I=new ResizeObserver(B);return I.observe(S),window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{D!==null&&window.cancelAnimationFrame(D),I.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[t,n]);const y=e.level==="categories"?e.providers.map(S=>({id:S.id,label:S.label,labelTitle:S.textValue,description:S.description,trailing:"›",provider:S})):e.items.map(S=>({id:S.id,label:S.label,labelTitle:S.label,subtitle:S.subtitle,description:e.selectedProviderId===Yo?void 0:S.description??S.detail,icon:S.icon,iconMode:S.iconMode,iconColor:S.iconColor,iconSpin:S.iconSpin,iconTooltip:S.iconTooltip,trailing:S.kind==="directory"||S.kind==="mcp-server"?"›":"",item:S}));if(f.useEffect(()=>{d.current.length=y.length},[y.length]),!p)return null;const v=e.providers.find(S=>S.id===e.selectedProviderId),w=e.itemMode==="mcpResources"&&e.mcpServerName?Hr(e.mcpServerName)??"[invalid]":(v==null?void 0:v.label)??"",k=e.itemMode==="mcpResources"&&e.mcpServerName?Hr(e.mcpServerName)??"[invalid]":(v==null?void 0:v.textValue)??"",T=e.level==="items"?(v==null?void 0:v.textValue)??u("at.menu"):u("at.menu"),C="at-mention-listbox",_=e.selectedIndex>=0&&e.selectedIndex<y.length?`at-mention-option-${e.selectedIndex}`:void 0;return hu.createPortal(l.jsx("div",{className:ke.atPortalLayer,style:b,children:l.jsxs("div",{ref:n,className:ke.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":T,onMouseDown:S=>{S.target instanceof HTMLInputElement||S.preventDefault()},children:[e.level==="items"&&l.jsxs("div",{className:ke.atPanelHeaderWrap,children:[l.jsxs("div",{className:ke.atPanelHeader,children:[l.jsx("button",{type:"button",className:ke.atBackButton,"aria-label":u("common.back"),onMouseDown:S=>{S.preventDefault(),S.stopPropagation()},onClick:S=>{S.preventDefault(),S.stopPropagation(),i()},children:"‹"}),l.jsx("span",{className:ke.atPanelTitle,title:k,children:w})]}),l.jsx("input",{ref:h,className:ke.atSearchInput,value:e.query,placeholder:u("common.search"),"aria-label":u("common.search"),"aria-controls":C,"aria-activedescendant":_,onMouseDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),onChange:S=>o(S.currentTarget.value),onKeyDown:S=>{if(!(S.nativeEvent.isComposing||S.nativeEvent.keyCode===229)){if(S.key==="Escape")S.preventDefault(),S.stopPropagation(),i();else if(S.key==="Enter")S.preventDefault(),S.stopPropagation(),r();else if(S.key==="Tab"&&!S.shiftKey&&!S.altKey&&!S.ctrlKey&&!S.metaKey)S.preventDefault(),S.stopPropagation(),r();else if(S.key==="ArrowUp"){if(S.preventDefault(),S.stopPropagation(),y.length===0)return;s(Math.max(0,e.selectedIndex-1))}else if(S.key==="ArrowDown"){if(S.preventDefault(),S.stopPropagation(),y.length===0)return;s(Math.min(y.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&l.jsxs("div",{className:ke.atTabsWrap,children:[l.jsx("button",{type:"button",className:ke.atTabScrollButton,"aria-label":"Previous tab",onClick:S=>{S.preventDefault(),S.stopPropagation(),oU(m.current,"previous")},children:"‹"}),l.jsx("div",{ref:m,className:ke.atTabs,role:"tablist",children:e.tabs.map(S=>{const D=S.id===e.selectedTabId,E=S.textValue??(typeof S.label=="string"?S.label:S.id);return l.jsx("button",{type:"button",role:"tab","aria-selected":D,disabled:S.disabled,className:`${ke.atTab} ${D?ke.atTabActive:""}`,title:E,onClick:B=>{B.preventDefault(),B.stopPropagation(),a(S.id)},children:S.label},S.id)})}),l.jsx("button",{type:"button",className:ke.atTabScrollButton,"aria-label":"Next tab",onClick:S=>{S.preventDefault(),S.stopPropagation(),oU(m.current,"next")},children:"›"})]})]}),l.jsx("div",{id:C,className:ke.atList,role:y.length>0?"listbox":void 0,"aria-label":y.length>0?T:void 0,children:e.loading&&y.length===0?l.jsx("div",{className:ke.atEmpty,role:"status","aria-live":"polite",children:u("common.loading")}):y.length===0?l.jsx("div",{className:ke.atEmpty,role:"status","aria-live":"polite",children:u("common.noResults")}):y.map((S,D)=>{const E=D===e.selectedIndex,B="item"in S?v==null?void 0:v.provider:S.provider.provider;let I;if("item"in S&&(B!=null&&B.renderItem))try{I=B.renderItem({item:S.item,provider:B,selected:E})}catch(O){console.warn("[WebShell] at mention item render failed",O)}const L="icon"in S&&S.icon&&Xb(S.icon)?S.icon:void 0;return l.jsxs("button",{ref:O=>{d.current[D]=O},type:"button",id:`at-mention-option-${D}`,role:"option","aria-selected":E,className:`${ke.atItem} ${E?ke.atItemActive:""} ${S.description?"":ke.atItemSingleLine}`,style:{"--at-item-main-template":Zet(ett(S.label,S.labelTitle),"subtitle"in S?S.subtitle:void 0)},onMouseEnter:()=>s(D),onMouseDown:O=>{O.preventDefault(),O.stopPropagation()},onClick:O=>{O.preventDefault(),O.stopPropagation(),r(D)},children:[I??l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:ke.atItemMain,children:[l.jsxs("span",{className:ke.atItemLeading,children:["icon"in S&&L&&(S.iconMode==="image"?l.jsx("img",{className:ke.atItemImageIcon,src:L,title:S.iconTooltip,alt:"","aria-hidden":"true"}):l.jsx("span",{className:`${ke.atItemIcon} ${S.iconSpin?ke.atItemIconSpin:""}`,style:{...Kf("--at-item-icon-url",L),color:S.iconColor},title:S.iconTooltip,"aria-hidden":"true"})),l.jsx("span",{className:ke.atItemLabel,title:S.labelTitle,children:S.label})]}),"subtitle"in S&&S.subtitle&&l.jsx("span",{className:ke.atItemSubtitle,title:S.subtitle,children:S.subtitle})]}),S.description&&l.jsx("span",{className:ke.atItemDescription,title:S.description,children:S.description})]}),S.trailing&&l.jsx("span",{className:ke.atItemTrailing,"aria-hidden":"true",children:S.trailing})]},S.id)})})]})}),c??document.body)}function oU(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function Zet(e,t){if(!t)return"minmax(0, 1fr)";const n=aU(e);return aU(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function ett(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function aU(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const ttt="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",ntt="/assets/default-aEtf0G7-.svg",Mae="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",stt="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",rtt="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",itt="_icon_i7y0u_1",ott={icon:itt},att={auto:ttt,"auto-edit":Mae,default:ntt,plan:stt,yolo:rtt};function Sv({mode:e}){const t=att[e];return t?l.jsx("span",{className:ott.icon,style:Kf("--mode-icon-url",t),"aria-hidden":"true"}):l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.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 ltt(e,t){const n=new Map;if(t==="command")for(const r of e)r.section&&n.set(r.section,(n.get(r.section)??0)+1);let s;return e.map((r,i)=>{const o=r.section,a=t==="command"&&o!==void 0&&o!==s,c=a&&i>0;return s=o??s,{showHeader:a,showDivider:c,count:a&&o?n.get(o)??0:0}})}function Yf(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const C7=16e3,ctt=4096,lU=6e4;function utt(e){const t=new URL(e),n=t.pathname.replace(/\/?$/,"/"),s=new URL("voice/stream",`${t.origin}${n}`);return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}const dtt="qwen-bearer.",htt="qwen-ws";function ftt(e){const t=new TextEncoder().encode(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);const s=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${dtt}${s}`}function mtt(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 ptt(e){const t=new Int16Array(e.length);let n=0;for(let s=0;s<e.length;s++){let r=e[s];r>1?r=1:r<-1&&(r=-1),t[s]=r<0?r*32768:r*32767,n+=r*r}return{pcm:t.buffer,level:e.length?Math.sqrt(n/e.length):0}}function gtt(e){const{baseUrl:t,token:n,onFinal:s,onError:r}=e,[i,o]=f.useState("idle"),[a,c]=f.useState(""),[u,d]=f.useState(0),[h,m]=f.useState(void 0),p=f.useRef({}),g=f.useRef(!0),b=f.useRef(0),x=f.useRef("idle"),y=f.useRef(s);y.current=s;const v=f.useRef(r);v.current=r;const w=f.useCallback(I=>{x.current=I,o(I)},[]),k=f.useCallback(()=>{const I=p.current;I.transcribeTimeout&&(clearTimeout(I.transcribeTimeout),I.transcribeTimeout=void 0)},[]),T=f.useCallback(()=>{var L;const I=p.current;I.processor&&(I.processor.onaudioprocess=null);for(const O of[I.processor,I.source,I.sink])try{O==null||O.disconnect()}catch{}(L=I.stream)==null||L.getTracks().forEach(O=>O.stop()),I.context&&I.context.state!=="closed"&&I.context.close().catch(()=>{}),I.processor=void 0,I.sink=void 0,I.source=void 0,I.stream=void 0,I.context=void 0},[]),C=f.useCallback(()=>{b.current++,T();const I=p.current;if(k(),I.ws){try{I.ws.onmessage=null,I.ws.onerror=null,I.ws.onclose=null,I.ws.close()}catch{}I.ws=void 0}},[T,k]),_=f.useCallback((I,L)=>{var O;!g.current||L!==void 0&&b.current!==L||(C(),w("error"),c(""),d(0),m(I),(O=v.current)==null||O.call(v,I))},[C,w]),S=f.useCallback((I,L)=>{L!==void 0&&b.current!==L||(C(),g.current&&(w("idle"),c(""),d(0),y.current(I)))},[C,w]),D=f.useCallback(()=>{if(x.current!=="idle"&&x.current!=="error")return;m(void 0),c(""),w("connecting");const I=++b.current,L=()=>!g.current||b.current!==I;(async()=>{var O;try{if(!((O=navigator.mediaDevices)!=null&&O.getUserMedia))throw new Error(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.");let A;try{A=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(ee){throw new Error(mtt(ee))}if(L()){A.getTracks().forEach(ee=>ee.stop());return}p.current.stream=A;const $=new AudioContext({sampleRate:C7});if($.sampleRate!==C7)throw A.getTracks().forEach(ee=>ee.stop()),$.close().catch(()=>{}),new Error(`Browser audio rate ${$.sampleRate} Hz is not the required ${C7} Hz.`);if(p.current.context=$,$.state==="suspended"&&await $.resume(),L()){A.getTracks().forEach(ee=>ee.stop()),$.close().catch(()=>{});return}const q=$.createMediaStreamSource(A),U=$.createScriptProcessor(ctt,1,1),H=$.createGain();H.gain.value=0,p.current.source=q,p.current.processor=U,p.current.sink=H;const M=new WebSocket(utt(t),n?[htt,ftt(n)]:void 0);M.binaryType="arraybuffer",p.current.ws=M,U.onaudioprocess=ee=>{const{pcm:V,level:R}=ptt(ee.inputBuffer.getChannelData(0));g.current&&d(R),M.readyState===WebSocket.OPEN&&M.send(V)},M.onopen=()=>{if(L()){U.onaudioprocess=null;for(const V of[U,q,H])try{V.disconnect()}catch{}A.getTracks().forEach(V=>V.stop()),$.state!=="closed"&&$.close().catch(()=>{});const ee=p.current;ee.ws===M&&(ee.ws=void 0),ee.processor===U&&(ee.processor=void 0),ee.source===q&&(ee.source=void 0),ee.sink===H&&(ee.sink=void 0),ee.stream===A&&(ee.stream=void 0),ee.context===$&&(ee.context=void 0);try{M.close()}catch{}return}M.send(JSON.stringify({type:"start"})),q.connect(U),U.connect(H),H.connect($.destination),k(),p.current.transcribeTimeout=setTimeout(()=>{x.current==="recording"&&_("No response from server. Check that the voice model is running.",I)},lU),g.current&&w("recording")},M.onmessage=ee=>{(x.current==="connecting"||x.current==="recording")&&k();let V;try{V=JSON.parse(String(ee.data))}catch{return}V.type==="interim"?g.current&&c(V.text??""):V.type==="final"?S(V.text??"",I):V.type==="error"&&_(V.message??V.text??"Voice transcription failed.",I)},M.onerror=()=>{},M.onclose=ee=>{if(g.current&&(x.current==="recording"||x.current==="connecting"||x.current==="transcribing")){const V=ee.code||1006,R=ee.reason||"none";_(`Voice connection closed (code=${V}, reason=${R}).`,I)}}}catch(A){_(A instanceof Error?A.message:String(A),I)}})()},[t,n,_,S,w,k]),E=f.useCallback(()=>{const I=p.current.ws;if(!I||I.readyState!==WebSocket.OPEN){C(),w("idle");return}T(),d(0),w("transcribing");const L=b.current;try{I.send(JSON.stringify({type:"stop"})),k(),p.current.transcribeTimeout=setTimeout(()=>{x.current==="transcribing"&&_("Transcription timed out.",L)},lU)}catch{_("Failed to finalize voice transcription.",L)}},[C,T,_,w,k]),B=f.useCallback(()=>{const I=p.current.ws;if(I&&I.readyState===WebSocket.OPEN)try{I.send(JSON.stringify({type:"abort"}))}catch{}C(),w("idle"),c(""),d(0)},[C,w]);return f.useEffect(()=>(g.current=!0,()=>{g.current=!1,C()}),[C]),{status:i,interimText:a,audioLevel:u,errorMessage:h,start:D,stop:E,abort:B}}const btt="_root_9hwm9_7",ytt="_iconBtn_9hwm9_14",vtt="_error_9hwm9_47",xtt="_connecting_9hwm9_51",wtt="_pill_9hwm9_56",ktt="_transcribing_9hwm9_75",_tt="_recDot_9hwm9_79",Stt="_wave_9hwm9_88",Ctt="_bar_9hwm9_95",Ttt="_time_9hwm9_103",Ett="_stop_9hwm9_111",Att="_spinner_9hwm9_118",jtt="_interim_9hwm9_128",fa={root:btt,iconBtn:ytt,error:vtt,connecting:xtt,pill:wtt,transcribing:ktt,recDot:_tt,wave:Stt,bar:Ctt,time:Ttt,stop:Ett,spinner:Att,interim:jtt},Ntt="voice_transcribe",cU=16,Mtt=()=>l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[l.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),l.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"})]}),Itt=()=>l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function Rtt(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${n}:${s}`}function Dtt({onInsert:e,disabled:t}){var q,U;const n=la(),s=(q=wd())==null?void 0:q.settingsVersion,{t:r}=at(),o=(((U=n.capabilities)==null?void 0:U.features)??[]).includes(Ntt),[a,c]=f.useState(()=>({client:n.client,settingsVersion:s,enabled:!1}));f.useEffect(()=>{let H=!0;if(c({client:n.client,settingsVersion:s,enabled:!1}),!!o)return n.client.workspaceVoice().then(M=>{H&&c({client:n.client,settingsVersion:s,enabled:M.enabled===!0})}).catch(()=>{}),()=>{H=!1}},[o,s,n.client]);const u=o&&a.client===n.client&&a.settingsVersion===s&&a.enabled,[d,h]=f.useState(void 0),{status:m,interimText:p,audioLevel:g,errorMessage:b,start:x,stop:y,abort:v}=gtt({baseUrl:n.baseUrl,token:n.token,onFinal:H=>{const M=H.trim();M?(h(void 0),e(M)):h(r("voice.noSpeech"))}}),w=m==="recording",[k,T]=f.useState(()=>new Array(cU).fill(0));f.useEffect(()=>{if(!w){T(new Array(cU).fill(0));return}T(H=>[...H.slice(1),Math.min(1,g*8)])},[g,w]);const[C,_]=f.useState(0);f.useEffect(()=>{if(!w){_(0);return}const H=performance.now(),M=setInterval(()=>_(performance.now()-H),200);return()=>clearInterval(M)},[w]);const S=f.useRef(u);if(f.useEffect(()=>{const H=S.current;S.current=u,H&&!u&&(m==="recording"||m==="connecting"||m==="transcribing")&&v()},[v,m,u]),!u)return null;const D=m==="connecting",E=m==="transcribing",B=m==="error",I=!!d&&!B,L=w||D,O=w?r("voice.stopDictation"):E?r("voice.transcribing"):D?r("voice.starting"):B?r("voice.errorRetry",{message:b??""}):r(I?"voice.noSpeechRetry":"voice.startDictation");let A;if(w)A=l.jsxs("button",{type:"button",className:fa.pill,onClick:()=>y(),"aria-label":O,title:O,children:[l.jsx("span",{className:fa.recDot,"aria-hidden":"true"}),l.jsx("span",{className:fa.wave,"aria-hidden":"true",children:k.map((H,M)=>l.jsx("span",{className:fa.bar,style:{height:`${2+Math.round(H*14)}px`}},M))}),l.jsx("span",{className:fa.time,children:Rtt(C)}),l.jsx("span",{className:fa.stop,"aria-hidden":"true",children:l.jsx(Itt,{})})]});else if(E)A=l.jsxs("span",{className:`${fa.pill} ${fa.transcribing}`,role:"status","aria-label":O,children:[l.jsx("span",{className:fa.spinner,"aria-hidden":"true"}),l.jsx("span",{className:fa.time,children:"…"})]});else{const H=[fa.iconBtn,B?fa.error:"",D?fa.connecting:""].filter(Boolean).join(" ");A=l.jsx("button",{type:"button",className:H,onClick:()=>{if(D)v();else{if(t)return;h(void 0),x()}},disabled:!!t&&!L,"aria-label":O,title:b??d??O,children:l.jsx(Mtt,{})})}const $=w&&p||B||I;return l.jsxs("span",{className:fa.root,children:[A,$&&l.jsx("span",{role:"status","aria-live":"polite",className:`${fa.interim}${B?` ${fa.error}`:""}`,children:B?b||r("voice.error"):I?d:p})]})}function Ad({delayDuration:e=0,...t}){return l.jsx(Qne,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function jd({...e}){return l.jsx(Jne,{"data-slot":"tooltip",...e})}function Nd({...e}){return l.jsx(Zne,{"data-slot":"tooltip-trigger",...e})}function Md({className:e,sideOffset:t=8,children:n,...s}){const r=Hc();return l.jsx(ese,{container:r??void 0,children:l.jsx(tse,{"data-slot":"tooltip-content",sideOffset:t,className:Qt("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),...s,children:n})})}function Ltt(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("circle",{cx:"18",cy:"6",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("circle",{cx:"6",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.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 Iae(e){const t=(e==null?void 0:e.staged)??0,n=(e==null?void 0:e.unstaged)??0,s=(e==null?void 0:e.untracked)??0,r=(e==null?void 0:e.conflicted)??0;return{detached:(e==null?void 0:e.detached)??!1,staged:t,unstaged:n,untracked:s,conflicted:r,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+s+r>0}}function Ptt(e){return e.conflicted>0?"error":e.operation||e.detached?"warning":e.dirty?"accent":null}function BN({branch:e,status:t,compact:n,worktree:s=!1}){const{t:r}=at(),i=Iae(t),o=Ptt(i);return l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:ke.gitBranchIconWrap,children:[l.jsx("span",{className:ke.gitBranchIcon,children:s?l.jsx(r4,{size:14,strokeWidth:1.5}):i.detached?l.jsx(KY,{}):l.jsx(Ltt,{})}),n&&o&&l.jsx("span",{className:ke.gitBranchBadgeDot,"data-tone":o,"aria-hidden":"true"})]}),l.jsx("span",{className:ke.gitBranchText,children:e}),!n&&l.jsxs("span",{className:ke.gitBranchIndicators,"aria-hidden":"true",children:[i.operation&&l.jsx("span",{className:ke.gitBranchOperation,children:r(`git.operation.${i.operation}`)}),i.conflicted>0&&l.jsxs("span",{className:ke.gitBranchConflicted,children:[l.jsx(q1e,{}),i.conflicted]}),i.dirty&&l.jsx("span",{className:ke.gitBranchDirtyDot}),i.ahead>0&&l.jsxs("span",{className:ke.gitBranchAheadBehind,children:["↑",i.ahead]}),i.behind>0&&l.jsxs("span",{className:ke.gitBranchAheadBehind,children:["↓",i.behind]}),i.stashCount>0&&l.jsxs("span",{className:ke.gitBranchStash,children:[l.jsx(n1e,{}),i.stashCount]})]})]})}function Rae({branch:e,status:t,compact:n=!1,onOpenDiff:s,worktree:r=!1}){const{t:i}=at(),o=Iae(t),a=[];o.operation&&a.push(i(`git.operation.${o.operation}`)),o.detached&&a.push(i("git.detached")),o.conflicted>0&&a.push(i("git.conflicted",{count:o.conflicted})),o.staged>0&&a.push(i("git.staged",{count:o.staged})),o.unstaged>0&&a.push(i("git.unstaged",{count:o.unstaged})),o.untracked>0&&a.push(i("git.untracked",{count:o.untracked})),o.ahead>0&&a.push(i("git.ahead",{count:o.ahead})),o.behind>0&&a.push(i("git.behind",{count:o.behind})),o.stashCount>0&&a.push(i("git.stash",{count:o.stashCount}));const c=a.length>0?`${i("git.currentBranch",{branch:e})} — ${a.join(", ")}`:(t==null?void 0:t.computedAt)!==void 0?`${i("git.currentBranch",{branch:e})} — ${i("git.clean")}`:i("git.currentBranch",{branch:e}),u=`${ke.gitBranchChip} ${n?ke.gitBranchChipCompact:""} ${s?ke.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":s?"true":void 0,"data-worktree":r?"true":void 0},h=l.jsx(BN,{branch:e,status:t,compact:n,worktree:r});return l.jsx(Ad,{delayDuration:300,children:l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:s?l.jsx("button",{type:"button",className:u,"aria-label":c,onClick:s,...d,children:h}):l.jsx("output",{className:u,"aria-label":c,...d,children:h})}),l.jsx(Md,{side:"top",children:l.jsxs("div",{className:ke.gitBranchTooltip,children:[l.jsx("div",{className:ke.gitBranchTooltipTitle,children:o.detached?`${i("git.detached")} (${e})`:e}),a.length>0?a.map(m=>l.jsx("div",{className:ke.gitBranchTooltipRow,children:m},m)):(t==null?void 0:t.computedAt)!==void 0?l.jsx("div",{className:ke.gitBranchTooltipRow,children:i("git.clean")}):null]})})]})})}const Ott="_wrap_11orh_1",$tt="_chip_11orh_8",Btt="_chipBranch_11orh_34",ztt="_chipWorktree_11orh_44",Ftt="_chipCompact_11orh_54",Htt="_chipIcon_11orh_57",qtt="_chipText_11orh_66",Utt="_chevron_11orh_71",Wtt="_chevronOpen_11orh_78",Vtt="_clearBtn_11orh_82",Gtt="_popover_11orh_104",Ktt="_header_11orh_110",Ytt="_option_11orh_120",Xtt="_optionSelected_11orh_140",Qtt="_optionIcon_11orh_144",Jtt="_iconCurrent_11orh_159",Ztt="_iconBranch_11orh_164",ent="_iconWorktree_11orh_169",tnt="_optionText_11orh_175",nnt="_optionName_11orh_183",snt="_optionDesc_11orh_187",rnt="_checkCurrent_11orh_193",int="_checkBranch_11orh_194",ont="_checkWorktree_11orh_195",ant="_branchBox_11orh_213",lnt="_branchRow_11orh_220",cnt="_branchLabel_11orh_225",unt="_branchInputWrap_11orh_231",dnt="_branchInput_11orh_231",hnt="_branchInputInvalid_11orh_257",fnt="_branchInputValid_11orh_261",mnt="_branchStatus_11orh_266",pnt="_branchHint_11orh_274",gnt="_branchHintError_11orh_280",bnt="_footer_11orh_285",ynt="_cmd_11orh_294",vnt="_confirmBranch_11orh_304",xnt="_confirmWorktree_11orh_305",Zn={wrap:Ott,chip:$tt,chipBranch:Btt,chipWorktree:ztt,chipCompact:Ftt,chipIcon:Htt,chipText:qtt,chevron:Utt,chevronOpen:Wtt,clearBtn:Vtt,popover:Gtt,header:Ktt,option:Ytt,optionSelected:Xtt,optionIcon:Qtt,iconCurrent:Jtt,iconBranch:Ztt,iconWorktree:ent,optionText:tnt,optionName:nnt,optionDesc:snt,checkCurrent:rnt,checkBranch:int,checkWorktree:ont,branchBox:ant,branchRow:lnt,branchLabel:cnt,branchInputWrap:unt,branchInput:dnt,branchInputInvalid:hnt,branchInputValid:fnt,branchStatus:mnt,branchHint:pnt,branchHintError:gnt,footer:bnt,cmd:ynt,confirmBranch:vnt,confirmWorktree:xnt},wnt=1e3,knt=200,uU=new TextEncoder;function _nt(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"||uU.encode(e).length>wnt||e.split("/").some(t=>uU.encode(t).length>knt)):!1}function Snt({branch:e,compact:t=!1,intent:n,onIntentChange:s}){const{t:r}=at(),[i,o]=f.useState(!1),[a,c]=f.useState(n.mode),[u,d]=f.useState(n.mode==="branch"?n.name:""),h=f.useRef(null),m=f.useMemo(()=>_nt(u),[u]),p=f.useCallback(T=>{o(T),T&&(c(n.mode),d(n.mode==="branch"?n.name:""))},[n]),g=f.useCallback(()=>{s({mode:"current"}),o(!1)},[s]),b=f.useCallback(()=>{!u||!m||(s({mode:"branch",name:u}),o(!1))},[u,m,s]),x=f.useCallback(()=>{s({mode:"worktree"}),o(!1)},[s]),y=f.useCallback(T=>{T.stopPropagation(),s({mode:"current"}),o(!1)},[s]),v=n.mode==="branch",w=n.mode==="worktree",k=v?`→ ${n.name}`:w?r("gitMode.worktree"):e;return l.jsxs("span",{className:Zn.wrap,children:[l.jsxs(db,{open:i,onOpenChange:p,children:[l.jsx(zx,{asChild:!0,children:l.jsxs("button",{type:"button",className:`${Zn.chip} ${v?Zn.chipBranch:""} ${w?Zn.chipWorktree:""} ${t?Zn.chipCompact:""}`,"data-web-shell-git-branch":!0,"data-testid":"git-mode-chip","aria-label":`${r("gitMode.title")}: ${k}`,children:[l.jsx("span",{className:Zn.chipIcon,children:w?l.jsx(r4,{size:14,strokeWidth:1.5}):l.jsx(yA,{size:15,strokeWidth:1.5})}),!t&&l.jsx("span",{className:Zn.chipText,children:k}),l.jsx("svg",{className:`${Zn.chevron} ${i?Zn.chevronOpen:""}`,viewBox:"0 0 16 16",fill:"currentColor",width:9,height:9,"aria-hidden":"true",children:l.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"})})]})}),l.jsxs(hb,{ref:h,side:"top",align:"end",sideOffset:8,className:Zn.popover,onClick:T=>T.stopPropagation(),onOpenAutoFocus:T=>T.preventDefault(),onInteractOutside:T=>{var C;(C=h.current)!=null&&C.contains(T.target)&&T.preventDefault()},children:[l.jsx("div",{className:Zn.header,children:r("gitMode.title")}),l.jsxs("button",{type:"button",role:"radio","aria-checked":a==="current",className:`${Zn.option} ${a==="current"?Zn.optionSelected:""}`,onClick:g,children:[l.jsx("span",{className:`${Zn.optionIcon} ${Zn.iconCurrent}`,children:l.jsx(KY,{size:15,strokeWidth:1.5})}),l.jsxs("span",{className:Zn.optionText,children:[l.jsx("span",{className:Zn.optionName,children:r("gitMode.current")}),l.jsx("span",{className:Zn.optionDesc,children:r("gitMode.currentDesc",{branch:e})})]}),a==="current"&&l.jsx("span",{className:Zn.checkCurrent,"aria-hidden":"true",children:"✓"})]}),l.jsxs("button",{type:"button",role:"radio","aria-checked":a==="branch",className:`${Zn.option} ${a==="branch"?Zn.optionSelected:""}`,onClick:()=>c("branch"),children:[l.jsx("span",{className:`${Zn.optionIcon} ${Zn.iconBranch}`,children:l.jsx(yA,{size:15,strokeWidth:1.5})}),l.jsxs("span",{className:Zn.optionText,children:[l.jsx("span",{className:Zn.optionName,children:r("gitMode.branch")}),l.jsx("span",{className:Zn.optionDesc,children:r("gitMode.branchDesc",{branch:e})})]}),a==="branch"&&l.jsx("span",{className:Zn.checkBranch,"aria-hidden":"true",children:"✓"})]}),a==="branch"&&l.jsxs("div",{className:Zn.branchBox,children:[l.jsxs("div",{className:Zn.branchRow,children:[l.jsx("label",{className:Zn.branchLabel,htmlFor:"git-mode-branch-input",children:r("gitMode.branchLabel")}),l.jsxs("span",{className:Zn.branchInputWrap,children:[l.jsx("input",{className:`${Zn.branchInput} ${u&&!m?Zn.branchInputInvalid:""} ${u&&m?Zn.branchInputValid:""}`,value:u,onChange:T=>d(T.target.value),onKeyDown:T=>{T.key==="Enter"&&u&&m&&b()},placeholder:r("gitMode.branchPlaceholder"),autoFocus:!0,spellCheck:!1,autoComplete:"off",id:"git-mode-branch-input","data-testid":"git-mode-branch-input"}),u&&l.jsx("span",{className:Zn.branchStatus,"aria-hidden":"true",style:{color:m?"var(--git-mode-valid)":"var(--git-mode-invalid)"},children:m?"✓":"✗"})]})]}),l.jsx("div",{className:`${Zn.branchHint} ${u&&!m?Zn.branchHintError:""}`,children:r(u&&!m?"gitMode.branchInvalidName":"gitMode.branchHint")}),u&&m&&l.jsx("div",{className:Zn.branchHint,children:r("gitMode.branchConflictWarning")})]}),l.jsxs("button",{type:"button",role:"radio","aria-checked":a==="worktree",className:`${Zn.option} ${a==="worktree"?Zn.optionSelected:""}`,onClick:()=>c("worktree"),children:[l.jsx("span",{className:`${Zn.optionIcon} ${Zn.iconWorktree}`,children:l.jsx(r4,{size:15,strokeWidth:1.5})}),l.jsxs("span",{className:Zn.optionText,children:[l.jsx("span",{className:Zn.optionName,children:r("gitMode.worktree")}),l.jsx("span",{className:Zn.optionDesc,children:r("gitMode.worktreeDesc")})]}),a==="worktree"&&l.jsx("span",{className:Zn.checkWorktree,"aria-hidden":"true",children:"✓"})]}),l.jsxs("div",{className:Zn.footer,children:[l.jsx("span",{className:Zn.cmd,children:a==="branch"?`$ git checkout -b ${u||"…"} ← ${e}`:a==="worktree"?"$ git worktree add .qwen/worktrees/<slug>":`$ git checkout ${e}`}),a==="branch"&&l.jsx("button",{type:"button",className:Zn.confirmBranch,disabled:!u||!m,onClick:b,"data-testid":"git-mode-confirm-branch",children:r("gitMode.confirmBranch")}),a==="worktree"&&l.jsx("button",{type:"button",className:Zn.confirmWorktree,onClick:x,"data-testid":"git-mode-confirm-worktree",children:r("gitMode.confirmWorktree")})]})]})]}),(v||w)&&l.jsx("button",{type:"button",className:Zn.clearBtn,onClick:y,"aria-label":r("gitMode.resetToCurrent"),title:r("gitMode.resetToCurrent"),"data-testid":"git-mode-clear",children:"✕"})]})}const Cnt="_red_179c6_21",Tnt="_orange_179c6_24",Ent="_yellow_179c6_27",Ant="_green_179c6_30",jnt="_blue_179c6_33",Nnt="_purple_179c6_36",gD={red:Cnt,orange:Tnt,yellow:Ent,green:Ant,blue:jnt,purple:Nnt};function Mnt(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.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 Int({name:e,title:t,ariaLabel:n,color:s,compact:r=!1}){const i=[ke.workspaceChip,r?ke.workspaceChipCompact:"",s?gD[s]:"",s?ke.workspaceChipAccented:""].filter(Boolean).join(" ");return l.jsx(Ad,{delayDuration:300,children:l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:l.jsxs("output",{className:i,"aria-label":n,"data-web-shell-workspace":!0,"data-web-shell-workspace-title":t,children:[l.jsx("span",{className:ke.workspaceChipIcon,children:l.jsx(Mnt,{})}),l.jsx("span",{className:ke.workspaceChipText,children:e})]})}),l.jsx(Md,{side:"top",children:t})]})})}function mh({...e}){return l.jsx(BEe,{"data-slot":"dropdown-menu",...e})}function Rnt({container:e,...t}){const n=Hc();return l.jsx(FEe,{"data-slot":"dropdown-menu-portal",container:e??n??void 0,...t})}const ph=f.forwardRef(function(t,n){return l.jsx(zEe,{ref:n,"data-slot":"dropdown-menu-trigger",...t})});function gh({className:e,align:t="start",sideOffset:n=4,...s}){return l.jsx(Rnt,{children:l.jsx(HEe,{"data-slot":"dropdown-menu-content",sideOffset:n,align:t,className:Qt("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),...s})})}function dm({...e}){return l.jsx(qEe,{"data-slot":"dropdown-menu-group",...e})}function Gi({className:e,inset:t,variant:n="default",...s}){return l.jsx(UEe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Qt("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),...s})}function Dnt({...e}){return l.jsx(WEe,{"data-slot":"dropdown-menu-radio-group",...e})}function Lnt({className:e,children:t,inset:n,...s}){return l.jsxs(VEe,{"data-slot":"dropdown-menu-radio-item","data-inset":n,className:Qt("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),...s,children:[l.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:l.jsx(GEe,{children:l.jsx(lC,{})})}),t]})}function Dae({className:e,...t}){return l.jsx(KEe,{"data-slot":"dropdown-menu-separator",className:Qt("-mx-1 my-1 h-px bg-border",e),...t})}function zN({...e}){return l.jsx(YEe,{"data-slot":"dropdown-menu-sub",...e})}const FN=f.forwardRef(function({className:t,inset:n,children:s,...r},i){return l.jsxs(XEe,{ref:i,"data-slot":"dropdown-menu-sub-trigger","data-inset":n,className:Qt("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),...r,children:[s,l.jsx(cC,{className:"ml-auto"})]})});function HN({className:e,...t}){return l.jsx(QEe,{"data-slot":"dropdown-menu-sub-content",className:Qt("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 Pnt({workspaces:e,selectedWorkspaceCwd:t,disabled:n,busy:s,scratchSupported:r,existingFolderSupported:i,className:o,onSelectWorkspace:a,onCreateScratch:c,onOpenExistingFolder:u}){const{t:d}=at(),[h,m]=f.useState(!1),[p,g]=f.useState(!1),b=f.useRef(!1),x=f.useRef(!1),y=e.find(w=>t?w.cwd===t:w.primary),v=r||i;return e.length<=1&&!v?null:l.jsx(Ad,{delayDuration:300,children:l.jsxs(mh,{open:h,onOpenChange:w=>{b.current=w,m(w),w&&(x.current=!0,g(!1))},children:[l.jsxs(jd,{open:p,onOpenChange:w=>{w&&(h||x.current)||g(w)},children:[l.jsx(Nd,{asChild:!0,children:l.jsx(ph,{asChild:!0,disabled:n||s,children:l.jsxs("button",{type:"button",className:o,"aria-label":d("sidebar.workspaceSelectLabel"),onPointerEnter:()=>{b.current||(x.current=!1)},onPointerLeave:()=>{x.current=!1,g(!1)},onBlur:()=>{b.current||(x.current=!1,g(!1))},children:[l.jsx(s4,{size:16,strokeWidth:1.2}),l.jsx("span",{"data-slot":"select-value",children:(y==null?void 0:y.label)??""})]})})}),l.jsx(Md,{side:"top",children:y==null?void 0:y.label})]}),l.jsxs(gh,{align:"start",className:"min-w-56",children:[l.jsx(Dnt,{value:y==null?void 0:y.id,onValueChange:w=>{const k=e.find(T=>T.id===w);k!=null&&k.trusted&&a(k.primary?void 0:k.cwd)},children:e.map(w=>l.jsxs(Lnt,{value:w.id,disabled:!w.trusted,title:w.cwd,children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:w.label}),!w.trusted&&l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(l1e,{}),d("sidebar.workspaceUntrusted")]})]},w.id))}),v&&l.jsxs(l.Fragment,{children:[l.jsx(Dae,{}),l.jsxs(zN,{children:[l.jsxs(FN,{disabled:s,children:[l.jsx(Yge,{}),d("sidebar.newWorkspace")]}),l.jsxs(HN,{children:[r&&l.jsx(Gi,{onSelect:c,children:d("sidebar.startFromScratch")}),i&&l.jsx(Gi,{onSelect:u,children:d("sidebar.useExistingFolder")})]})]})]})]})]})})}function Ont(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(s=>`${s.label}
${s.searchText??""}`.toLocaleLowerCase().includes(n)):[...e]}function dU({availableWidth:e,items:t}){const n=Object.fromEntries(t.map(r=>[r.id,r.ready!==!1]));let s=t.reduce((r,i)=>r+(n[i.id]?i.expansionWidth:0),0);for(const r of t){if(s<=e)break;n[r.id]&&(n[r.id]=!1,s-=r.expansionWidth)}return n}function $nt({availableWidth:e,items:t,currentVisibility:n,expansionMargin:s}){const r=dU({availableWidth:e,items:t}),i=dU({availableWidth:Math.max(0,e-s),items:t});return Object.fromEntries(t.map(o=>[o.id,n[o.id]?r[o.id]:i[o.id]]))}function Bnt({toolbarWidth:e,leadingWidth:t,rightWidth:n,currentExpansionWidth:s,gap:r}){const i=Math.max(0,t-s);return Math.max(0,e-n-i-r)}function znt({currentModelLabel:e,lastConfirmedModelLabel:t}){const n=e||t;return{modelLabel:n,modelLabelReady:!!n,nextConfirmedModelLabel:n}}const Fnt=["approvalMode","gitBranch","model","widthMode","voice","workspace"],Hnt=new Set(Fnt),qnt={"&":{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 hU(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}function Unt({tag:e,content:t,tooltip:n,onActivate:s,onRemove:r}){const i=f.useRef(null),o=Hc(),a=n!=null,c=l.jsx("span",{className:ke.tagContent,"data-web-shell-composer-tag-trigger":!0,role:s?"button":void 0,tabIndex:s||a?0:void 0,onClick:d=>{var h;s&&(d.stopPropagation(),s(((h=i.current)==null?void 0:h.getBoundingClientRect())??d.currentTarget.getBoundingClientRect()))},onKeyDown:d=>{var h;s&&(d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),s(((h=i.current)==null?void 0:h.getBoundingClientRect())??d.currentTarget.getBoundingClientRect())))},children:t}),u=l.jsxs("span",{ref:i,className:ke.tag,"data-web-shell-composer-tag":!0,children:[a?l.jsx(Zne,{asChild:!0,children:c}):c,r&&l.jsx("button",{type:"button",className:ke.tagRemove,"aria-label":`Remove ${ZR(e)}`,onMouseDown:d=>d.preventDefault(),onClick:d=>{d.stopPropagation(),r()},onKeyDown:d=>{if(d.key==="Enter"||d.key===" "){d.stopPropagation();return}d.key!=="Backspace"&&d.key!=="Delete"||(d.preventDefault(),d.stopPropagation(),r())},children:"×"})]});return a?l.jsxs(Jne,{disableHoverableContent:!1,children:[u,l.jsx(ese,{container:o??void 0,children:l.jsx(tse,{className:ke.tagTooltip,"data-web-shell-composer-tag-tooltip":!0,sideOffset:6,collisionPadding:8,avoidCollisions:!0,children:n})})]}):u}function Wnt(){return l.jsx("svg",{className:ke.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:l.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vnt(){return l.jsx("span",{className:ke.stopIcon,"aria-hidden":"true"})}function Gnt(){return l.jsx("span",{className:ke.loadingIcon,"aria-hidden":"true"})}function Knt(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>l.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function Ynt(e,t){let n,s,r,i,o=0,a=0;const c=(b,x)=>{e.style.setProperty("--dac-glow-on",b.toFixed(4)),e.style.setProperty("--dac-glow-pulse",x.toFixed(4))},u=b=>{n!==void 0&&window.cancelAnimationFrame(n);const x=o,y=b-x;if(Math.abs(y)<.001){o=b,c(b,a);return}const v=performance.now(),w=k=>{const T=Math.min((k-v)/220,1);o=x+y*(1-(1-T)**2),c(o,a),n=T<1?window.requestAnimationFrame(w):void 0};n=window.requestAnimationFrame(w)},d=()=>{s!==void 0&&window.cancelAnimationFrame(s);const b=a,x=performance.now(),y=v=>{const w=Math.min((v-x)/300,1);a=b*(1-w),c(o,a),s=w<1?window.requestAnimationFrame(y):void 0};s=window.requestAnimationFrame(y)},h=b=>{b?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},m=()=>u(1),p=()=>{u(0),h(!1),i!==void 0&&window.clearTimeout(i)},g=()=>{s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),a=1,c(o,1),r=window.setTimeout(d,100),h(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>h(!1),650)};return t.addEventListener("focus",m),t.addEventListener("blur",p),t.addEventListener("keydown",g),document.activeElement===t&&u(1),()=>{n!==void 0&&window.cancelAnimationFrame(n),s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),i!==void 0&&window.clearTimeout(i),t.removeEventListener("focus",m),t.removeEventListener("blur",p),t.removeEventListener("keydown",g),c(0,0),h(!1)}}function Xnt({mode:e}){return e==="wide"?l.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[l.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)"}),l.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)"})]}):l.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:l.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 T7(){return l.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[l.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"}),l.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 Qnt(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 Jnt=[{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 Znt(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function Lae(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 est(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]??Lae(e,t)}function fU({open:e,items:t,activeId:n,onOpenChange:s,onSelect:r,trigger:i,tooltip:o,showCheck:a=!1,searchable:c=!1,searchLabel:u,noResultsLabel:d}){const[h,m]=f.useState(""),[p,g]=f.useState(null),b=f.useRef(!1),x=f.useRef(!1),y=f.useRef(null),v=t.some(T=>T.description||T.icon),w=c?Ont(t,h):t;f.useEffect(()=>{e||m("")},[e]);const k=v||a;return l.jsxs(db,{open:e,onOpenChange:T=>{var C;T&&(b.current=!1,x.current=!1,g(((C=y.current)==null?void 0:C.closest("[data-web-shell-root]"))??null)),s(T)},children:[o?l.jsx(Ad,{delayDuration:300,children:l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:l.jsx(zx,{ref:y,asChild:!0,children:i})}),l.jsx(Md,{side:"top",children:o})]})}):l.jsx(zx,{ref:y,asChild:!0,children:i}),l.jsxs(hb,{side:"top",align:"start",collisionPadding:8,collisionBoundary:p??void 0,"data-web-shell-toolbar-popover":!0,onClick:T=>T.stopPropagation(),onPointerDownOutside:T=>{const C=T.target;C instanceof Element&&C.closest("[data-web-shell-toolbar-popover-trigger]")&&(x.current=!0)},onCloseAutoFocus:T=>{if(x.current){T.preventDefault(),x.current=!1;return}if(document.activeElement instanceof HTMLElement&&document.activeElement.closest("[data-web-shell-toolbar-popover]")){T.preventDefault();return}b.current&&(T.preventDefault(),b.current=!1)},children:[c&&l.jsx(qr,{type:"search",value:h,"aria-label":u,placeholder:u,autoComplete:"off",onChange:T=>m(T.target.value)}),l.jsxs("div",{className:`${ke.dropdownList} ${v?ke.dropdownRich:a?ke.dropdownCheck:""} ${c?ke.dropdownListConstrained:""}`,children:[w.map(T=>l.jsx("button",{type:"button",className:`${ke.dropdownItem} ${T.id===n?ke.dropdownItemActive:""}`,onClick:()=>{b.current=!0,r(T.id)},children:k?l.jsxs(l.Fragment,{children:[v&&l.jsx("span",{className:ke.dropdownItemIcon,children:T.icon}),l.jsxs("span",{className:ke.dropdownItemContent,children:[l.jsx("span",{className:ke.dropdownItemLabel,children:T.label}),T.description&&l.jsx("span",{className:ke.dropdownItemDesc,children:T.description})]}),l.jsx("span",{className:ke.dropdownItemCheck,children:T.id===n?l.jsx(Znt,{}):null})]}):T.label},T.id)),w.length===0&&d&&l.jsx("div",{className:ke.dropdownEmpty,role:"status",children:d(h)})]})]})]})}function tst({menu:e,anchorRef:t,panelRef:n,detailRef:s,onClose:r,onSelect:i,onAccept:o}){const a=f.useRef([]),c=f.useRef(null),[u,d]=f.useState(null),[h,m]=f.useState(null);f.useEffect(()=>{var g;(g=a.current[e.selectedIndex])==null||g.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),f.useEffect(()=>{m(null)},[e.items]),f.useLayoutEffect(()=>{var g;d(((g=t.current)==null?void 0:g.closest("[data-web-shell-root]"))??null)},[t]),f.useEffect(()=>{const g=b=>{b.key!=="Escape"||!b.isComposing&&b.keyCode!==229||(Object.defineProperty(b,"key",{configurable:!0,value:"Process"}),window.addEventListener("keydown",x=>{x===b&&Reflect.deleteProperty(b,"key")},{once:!0}))};return window.addEventListener("keydown",g,{capture:!0}),()=>{window.removeEventListener("keydown",g,{capture:!0})}},[]);const p=ltt(e.items,e.kind);return l.jsxs(l.Fragment,{children:[l.jsxs(db,{open:!0,onOpenChange:g=>{g||r()},children:[l.jsx(hF,{virtualRef:t}),l.jsx(hb,{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 x,y;const b=g.target;b instanceof Node&&((x=t.current)!=null&&x.contains(b)||(y=s.current)!=null&&y.contains(b))&&g.preventDefault()},onMouseDown:g=>g.preventDefault(),onMouseLeave:g=>{var x;const b=g.relatedTarget;b instanceof Node&&((x=s.current)!=null&&x.contains(b))||m(null)},children:l.jsx("div",{className:ke.slashPanel,children:l.jsx("div",{className:ke.slashPanelBody,children:l.jsx("div",{className:ke.slashList,onScroll:()=>m(null),children:e.items.map((g,b)=>{const x=p[b];return l.jsxs("div",{className:ke.slashEntry,children:[x.showHeader&&l.jsxs(l.Fragment,{children:[x.showDivider&&l.jsx("div",{className:ke.slashSection}),l.jsxs("div",{className:ke.slashSectionHeader,children:[l.jsx("span",{children:g.section}),x.count>0?l.jsx("span",{className:ke.slashSectionCount,children:x.count}):null]})]}),l.jsxs("button",{ref:y=>{a.current[b]=y},type:"button",role:"option","aria-selected":b===e.selectedIndex,"data-has-description":g.detail?"":void 0,className:`${ke.slashItem} ${b===e.selectedIndex?ke.slashItemActive:""}`,onMouseEnter:y=>{if(i(b),!g.detail){m(null);return}c.current=y.currentTarget;const v=y.currentTarget.getBoundingClientRect(),w=u==null?void 0:u.getBoundingClientRect(),k=(w==null?void 0:w.left)??0,T=(w==null?void 0:w.right)??window.innerWidth,C=(w==null?void 0:w.top)??0,_=(w==null?void 0:w.bottom)??window.innerHeight,S=Math.min(320,T-k-24),D=T-v.right>=S+8?"right":v.left-k>=S+8?"left":v.top-C>=_-v.bottom?"top":"bottom";m({label:g.label,detail:g.detail,side:D})},onMouseDown:y=>{y.preventDefault(),y.stopPropagation(),o(b)},children:[l.jsx("span",{className:ke.slashCommand,children:g.label}),g.detail&&l.jsx("span",{className:ke.slashDescription,children:g.detail})]})]},`${g.id}:${b}`)})})})})})]}),l.jsxs(db,{open:!!h,onOpenChange:g=>{g||m(null)},children:[l.jsx(hF,{virtualRef:c}),h&&l.jsx(hb,{ref:s,side:h.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 x;const b=g.relatedTarget;b instanceof Node&&((x=n.current)!=null&&x.contains(b))||m(null)},children:l.jsxs("div",{className:ke.slashDetail,children:[l.jsx("div",{className:ke.slashDetailCommand,children:h.label}),l.jsx("div",{className:ke.slashDetailText,children:h.detail})]})})]})]})}function nst({actions:e,onRun:t,onPressKey:n,showKeyHints:s=!0}){const{t:r}=at();return l.jsxs("div",{className:ke.quickActionsPanel,onMouseDown:i=>i.stopPropagation(),onClick:i=>i.stopPropagation(),children:[l.jsx("div",{className:ke.quickActionsHeader,children:r("quickActions.title")}),l.jsxs("div",{className:ke.quickActionsLayout,children:[l.jsx("div",{className:ke.quickActionsGrid,children:e.map(i=>l.jsx("button",{type:"button",className:ke.quickAction,onClick:()=>t(i),children:l.jsx("span",{className:ke.quickActionLabel,children:i.label})},i.id))}),s&&l.jsx("div",{className:ke.quickKeysGrid,children:Jnt.map(i=>l.jsx("button",{type:"button",className:ke.quickKey,title:r(i.descriptionKey),onMouseDown:o=>o.preventDefault(),onClick:()=>n(i),children:l.jsx("span",{className:ke.quickKeyLabel,children:i.label})},i.id))})]})]})}const Pae=f.memo(f.forwardRef(function(t,n){var Cr;const{onSubmit:s,onInputTextChange:r,onCycleMode:i,onToggleShortcuts:o,onCancel:a,isRunning:c=!1,isPreparing:u=!1,cancelArmed:d=!1,disabled:h=!1,placeholderText:m="Type a message...",commands:p,skills:g=[],slashCommandCategoryOrder:b,queuedMessages:x=[],onPopQueuedMessages:y,currentMode:v="default",currentModel:w="",gitBranch:k,gitWorktree:T,gitModeIntent:C,onGitModeIntentChange:_,gitStatus:S,onOpenGitDiff:D,workspaceName:E,workspaceTitle:B,workspaceColor:I,chatWidthMode:L="1000",showChatWidthToggle:O=!0,chatWidthToggleMin:A,visibleToolbarActions:$,availableModels:q=[],onSelectMode:U,onSelectModel:H,workspaces:M,selectedWorkspaceCwd:ee,workspaceSelectionDisabled:V=!1,onSelectWorkspace:R,scratchWorkspaceSupported:re=!1,existingFolderWorkspaceSupported:Z=!1,workspaceMutationBusy:K=!1,onCreateScratchWorkspace:Y,onOpenExistingWorkspace:ae,atWorkspaceCwd:le,onChatWidthModeChange:te,onFocusFooter:z,dialogOpen:X=!1,followupState:fe,onAcceptFollowup:xe,onDismissFollowup:ie,sessionName:Ce,composerInput:Ke,composerInputVersion:ut,builtinAtProviders:Et,atProviders:st,composerTagIcons:xt}=t,{renderComposerToolbarStart:He,renderComposerToolbarEnd:pn,renderComposerToolbarRight:Yt,renderComposerTag:It,renderComposerTagTooltip:me,onComposerTagClick:$e,parseUserMessageContent:yt}=mu(),Me=jze({onSubmit:s,onInputTextChange:r,onCycleMode:i,onToggleShortcuts:o,disabled:h,placeholderText:m,commands:p,skills:g,slashCommandCategoryOrder:b,queuedMessages:x,onPopQueuedMessages:y,currentMode:v,onFocusFooter:z,dialogOpen:X,followupState:fe,onAcceptFollowup:xe,onDismissFollowup:ie,sessionName:Ce,composerInput:Ke,composerInputVersion:ut,builtinAtProviders:Et,atProviders:st,atWorkspaceCwd:le,composerTagIcons:xt,parseUserMessageContent:yt,renderComposerTag:It,renderComposerTagTooltip:me,onComposerTagClick:$e,editorTheme:qnt}),{t:Le}=at();f.useImperativeHandle(n,()=>Me.handle,[Me.handle]);const[vn,ge]=f.useState(!1),[Rt,ht]=f.useState(!1),[gn,Ue]=f.useState(!1),[De,Re]=f.useState(hU),be=f.useRef(null),Ie=f.useRef(null),ne=f.useRef(null),Ee=f.useRef(null),qe=f.useRef(null),Je=f.useRef(null),Qe=f.useRef(null),cn=f.useRef(null),Kn=f.useRef(null),_e=f.useRef(null),ft=f.useRef(null),[$t,pe]=f.useState(!1),[Be,ue]=f.useState({workspaceSelect:!1,workspace:!1,gitBranch:!1,mode:!1,model:!1}),[Wt,Bt]=f.useState(""),hn=Me.slashMenu,gt=Me.closeSlashMenu,Ae=Me.atMenu,kn=Me.closeAtMenu,Dn=!!hn,qn=!!Ae,ir=Me.viewRef;f.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Fe=window.matchMedia("(hover: none), (pointer: coarse)"),xn=()=>Re(hU());return xn(),Fe.addEventListener("change",xn),()=>Fe.removeEventListener("change",xn)},[]),f.useEffect(()=>{De||Ue(!1)},[De]),f.useEffect(()=>{if(!Dn&&!qn)return;const Fe=xn=>{var In,we,We;const kt=xn.target,ms=be.current;kt instanceof Node&&ms&&!ms.contains(kt)&&!((In=Ie.current)!=null&&In.contains(kt))&&!((we=ne.current)!=null&&we.contains(kt))&&!((We=Ee.current)!=null&&We.contains(kt))&&(gt(),kn())};return window.addEventListener("mousedown",Fe),window.addEventListener("touchstart",Fe),()=>{window.removeEventListener("mousedown",Fe),window.removeEventListener("touchstart",Fe)}},[qn,Dn,kn,gt]),f.useEffect(()=>{var kt;const Fe=be.current,xn=(kt=ir.current)==null?void 0:kt.contentDOM;if(!(!Fe||!xn))return Ynt(Fe,xn)},[ir]),f.useEffect(()=>{const Fe=be.current,xn=A;if(!Fe||xn===void 0){pe(!1);return}const kt=()=>{pe(Fe.getBoundingClientRect().width>=xn-50)};kt();const ms=new ResizeObserver(kt);return ms.observe(Fe),()=>ms.disconnect()},[A]);const Qn=f.useMemo(()=>Mb.map(Fe=>({id:Fe,label:est(Fe,Le),description:Le(`mode.desc.${Fe}`),icon:l.jsx(Sv,{mode:Fe})})),[Le]),jr=f.useMemo(()=>{if(!$)return null;const Fe=$.filter(xn=>Hnt.has(xn));return new Set(Fe)},[$]),es=Fe=>jr?jr.has(Fe):!0,Gn=es("approvalMode"),Dt=es("model"),ps=f.useMemo(()=>new Set(p.map(Fe=>Fe.name.replace(/^\/+/,""))),[p]),is=f.useCallback(Fe=>ps.has(Fe),[ps]),os=f.useMemo(()=>[{id:"new",label:Le("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:Le("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:Le("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:Le("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:Le("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:Le("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:Le("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:Le("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:Le("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:Le("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:Le("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:Le("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:Le("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:Le("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:Le("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:Le("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:Me.shellMode?Le("quickActions.exitShellMode"):Le("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:Le("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Fe=>{const xn=Qnt(Fe);return!xn||is(xn)}),[Me.shellMode,is,Le]),ts=f.useMemo(()=>q.map(Fe=>({id:Fe.id,label:Yf(Fe.label||Fe.id),searchText:`${Fe.label??""}
${Fe.id}`})),[q]),Wn=f.useCallback(Fe=>{U==null||U(Fe),ge(!1),Me.focus()},[U,Me]),ds=f.useCallback(Fe=>{H==null||H(Fe),ht(!1),Me.focus()},[H,Me]),Sn=f.useCallback(Fe=>{if(Me.mobileComposer){Fe.ctrlKey&&Fe.key==="r"&&Me.searchState.openHistorySearch();return}const xn=Me.viewRef.current;xn&&(xn.focus(),xn.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Fe,bubbles:!0,cancelable:!0})))},[Me]),ui=f.useCallback(Fe=>{if(Ue(!1),ge(!1),ht(!1),Me.closeSlashMenu(),Me.closeAtMenu(),Fe.action.type==="insert"){Me.insertText(Fe.action.text,{mode:"replace"});return}if(Fe.action.type==="shell"){Me.toggleShellMode();return}if(Fe.action.type==="key"){Sn(Fe.action.item.event);return}s(Fe.action.command)},[Me,Sn,s]),Ur=f.useCallback(Fe=>{Sn(Fe.event),Fe.id==="ctrl-r"&&Ue(!1)},[Sn]),{searchMode:lr,searchQuery:Cs,searchMatches:js,searchActiveIndex:Ii,searchInputRef:Jr,searchUiRef:ve,closeSearch:ze,restoreSearchMatch:lt,handleSearchKeyDown:_t,handleSearchInput:Xt,handleSearchCompositionEnd:rs}=Me.searchState,fs=Fe=>{const xn=It==null?void 0:It({tag:Fe,placement:"composer",readonly:!1});if(xn!=null)return xn;const kt=LT(Fe),ms=PT(Fe),In=Fe.kind?"":kt,we=Fe.icon??z0(Fe.kind,xt),We=we&&(N9(we)||Xb(we))?we:void 0;return!In&&!ms?l.jsx("span",{className:ke.tagLabel,children:Fe.id}):l.jsxs(l.Fragment,{children:[We&&l.jsx("span",{className:ke.tagIcon,style:Kf("--composer-tag-icon-url",We),"aria-hidden":"true"}),In&&l.jsx("span",{className:ke.tagLabel,children:In}),ms&&l.jsx("span",{className:ke.tagValue,children:ms})]})},gs=Lae(v,Le),Ps=w?((Cr=q.find(Fe=>Fe.id===w))==null?void 0:Cr.label)??(w.startsWith("qwen-route:")?"":Yf(w)):"",{modelLabel:mr,modelLabelReady:Ri}=znt({currentModelLabel:Ps,lastConfirmedModelLabel:Wt}),si=M==null?void 0:M.find(Fe=>ee?Fe.cwd===ee:Fe.primary),cr=(si==null?void 0:si.label)??"",Jn=!!(M&&R&&(M.length>1||re||Z)),Ln=!!(E&&es("workspace")),Vn=!!(k&&es("gitBranch"));f.useLayoutEffect(()=>{Ps&&Ps!==Wt&&Bt(Ps)},[Ps,Wt]);const Hi=Be.workspaceSelect,Di=Be.workspace,Mo=Be.gitBranch,ns=Be.mode,Rr=Be.model,pr=c&&!Me.hasContent;return f.useLayoutEffect(()=>{const Fe=qe.current,xn=Je.current,kt=Qe.current,ms=ft.current;if(!Fe||!xn||!kt||!ms)return;const In=()=>{const Ct=ur=>{const Dr=ms.querySelector(`[data-toolbar-measure="${ur}:collapsed"]`),ri=ms.querySelector(`[data-toolbar-measure="${ur}:expanded"]`);return Math.max(0,Math.ceil((ri==null?void 0:ri.getBoundingClientRect().width)??0)-Math.ceil((Dr==null?void 0:Dr.getBoundingClientRect().width)??0))},$n=[...Jn?[{id:"workspaceSelect",expansionWidth:Ct("workspaceSelect")}]:[],...Ln?[{id:"workspace",expansionWidth:Ct("workspace")}]:[],...Vn?[{id:"gitBranch",expansionWidth:Ct("gitBranch")}]:[],...Gn?[{id:"mode",expansionWidth:Ct("mode")}]:[],...Dt?[{id:"model",expansionWidth:Ct("model"),ready:Ri}]:[]],as=$n.reduce((ur,Dr)=>ur+(Be[Dr.id]?Dr.expansionWidth:0),0),Rs=xn.scrollWidth,ki=Math.ceil(Number.parseFloat(getComputedStyle(Fe).columnGap)||0),zs=Bnt({toolbarWidth:Math.floor(Fe.getBoundingClientRect().width),leadingWidth:Rs,rightWidth:Math.ceil(kt.getBoundingClientRect().width),currentExpansionWidth:as,gap:ki}),Yn=$nt({availableWidth:zs,items:$n,currentVisibility:Be,expansionMargin:$n.length}),or={workspaceSelect:Yn.workspaceSelect??!1,workspace:Yn.workspace??!1,gitBranch:Yn.gitBranch??!1,mode:Yn.mode??!1,model:Yn.model??!1};ue(ur=>Object.keys(or).every(ri=>ur[ri]===or[ri])?ur:or)};In();const we=new ResizeObserver(In);we.observe(Fe),we.observe(xn),we.observe(kt);for(const Ct of ms.children)we.observe(Ct);const We=[cn.current,Kn.current,_e.current].filter(Ct=>Ct!==null),St=()=>{for(const Ct of We){we.observe(Ct);for(const $n of Ct.children)we.observe($n)}};St();const fn=new MutationObserver(()=>{St(),In()});for(const Ct of We)fn.observe(Ct,{attributes:!0,characterData:!0,childList:!0,subtree:!0});return()=>{fn.disconnect(),we.disconnect()}},[pn,Yt,He,h,k,Vn,c,mr,Ri,gs,Ce,Dt,Gn,Be,Ln,E,Jn,cr]),l.jsxs("div",{className:`${ke.editorShell} ${vn||Rt?ke.editorShellDropdownOpen:""}`,"data-composer":!0,"data-web-shell-composer":!0,children:[l.jsxs("div",{ref:be,className:ke.container,"data-web-shell-composer-surface":!0,"data-dac-glow":!0,onClick:()=>{ge(!1),ht(!1),Ue(!1),Me.focus()},children:[l.jsx("div",{className:ke.dacAura,"aria-hidden":"true"}),l.jsx("div",{className:ke.dacHalo,"aria-hidden":"true"}),lr&&l.jsxs("div",{ref:ve,className:ke.searchPanel,onMouseDown:Fe=>Fe.stopPropagation(),onClick:Fe=>Fe.stopPropagation(),children:[l.jsxs("div",{className:ke.searchBar,children:[l.jsx("span",{className:ke.searchLabel,children:Le("editor.searchLabel")}),l.jsx("input",{ref:Jr,className:ke.searchInput,value:Cs,onChange:Xt,onCompositionEnd:rs,onKeyDown:_t,placeholder:Le("editor.searchPlaceholder")})]}),js.length>0&&l.jsx("div",{className:ke.searchResults,children:js.map((Fe,xn)=>l.jsxs("button",{type:"button",className:`${ke.searchResult} ${xn===Ii?ke.searchResultActive:""}`,onMouseDown:kt=>{kt.preventDefault(),lt?lt(Fe):Me.replaceEditorText(Fe),ze(!1)},children:[l.jsx("span",{className:ke.searchResultMarker,children:xn===Ii?"›":""}),l.jsx("span",{className:ke.searchResultText,children:Fe})]},`${Fe}-${xn}`))}),js.length===0&&l.jsx("div",{className:ke.searchEmpty,children:Le("editor.noHistory")})]}),l.jsxs("div",{className:ke.content,children:[(Me.composerTags.length>0||Me.pastedImages.length>0)&&l.jsxs("div",{className:ke.attachments,"data-web-shell-composer-attachments":!0,children:[Me.composerTags.length>0&&l.jsx(Qne,{delayDuration:0,disableHoverableContent:!1,children:l.jsx("div",{className:ke.tags,children:Me.composerTags.map(Fe=>{const xn={tag:Fe,placement:"composer",readonly:!1};let kt;try{kt=me==null?void 0:me(xn)}catch(ms){console.warn("[WebShell] composer tag tooltip render failed",ms)}return l.jsx(Unt,{tag:Fe,content:fs(Fe),tooltip:kt,onActivate:$e?ms=>$e({...xn,anchorRect:ms}):void 0,onRemove:Fe.removable!==!1?()=>{var ms;Me.removeTopTag(Fe.id),(ms=Me.viewRef.current)==null||ms.focus()}:void 0},Fe.id)})})}),Me.pastedImages.length>0&&l.jsx("div",{className:ke.images,children:Me.pastedImages.map((Fe,xn)=>l.jsxs("div",{className:ke.imageThumb,children:[l.jsx("img",{src:`data:${Fe.media_type};base64,${Fe.data}`,alt:""}),l.jsx("button",{className:ke.imageRemove,onClick:kt=>{kt.stopPropagation(),Me.removeImage(xn)},children:"×"})]},xn))})]}),Me.slashMenu&&l.jsx(tst,{menu:Me.slashMenu,anchorRef:be,panelRef:Ie,detailRef:ne,onClose:Me.closeSlashMenu,onSelect:Me.selectSlashCompletion,onAccept:Me.acceptSlashCompletion}),Me.atMenu&&l.jsx(Jet,{menu:Me.atMenu,anchorRef:be,panelRef:Ee,onSelect:Me.selectAtCompletion,onAccept:Me.acceptAtCompletion,onBack:()=>{const Fe=Me.backAtCategories();return Fe==="categories"&&window.setTimeout(()=>Me.focus(),0),!!Fe},onSearch:Me.updateAtSearch,onSelectTab:Me.selectAtTab}),l.jsxs("div",{className:ke.editorArea,children:[Me.shellMode&&l.jsx("span",{className:ke.shellPrefix,"aria-hidden":"true",children:"!"}),Me.mobileComposer?l.jsx("textarea",{ref:Me.mobileComposer.textareaRef,className:ke.mobileTextarea,value:Me.mobileComposer.value,onChange:Me.mobileComposer.onChange,onPaste:Me.mobileComposer.onPaste,placeholder:Me.mobileComposer.placeholder,disabled:Me.disabled,rows:1,enterKeyHint:"enter",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"data-web-shell-composer-editor":!0}):l.jsx("div",{ref:Me.containerRef,"data-web-shell-composer-editor":!0})]}),l.jsxs("div",{ref:qe,className:ke.toolbar,children:[l.jsxs("div",{ref:Je,className:ke.toolbarLeading,children:[He&&l.jsx("div",{ref:cn,className:ke.toolbarStart,children:l.jsx(He,{disabled:h,isRunning:c,currentMode:v,currentModel:w,sessionName:Ce})}),l.jsxs("div",{className:ke.toolbarLeft,children:[Jn&&M&&R&&l.jsx(Pnt,{workspaces:M,selectedWorkspaceCwd:ee,disabled:V,busy:K,scratchSupported:re,existingFolderSupported:Z,className:`${ke.toolBtn} ${ke.workspaceSelectTrigger} ${Hi?"":ke.workspaceSelectTriggerCompact}`,onSelectWorkspace:R,onCreateScratch:Y??(()=>{}),onOpenExistingFolder:ae??(()=>{})}),Ln&&E&&l.jsx(Int,{name:E,title:B??E,color:I,compact:!Di,ariaLabel:Le("workspace.paneLabel",{name:E})}),Vn&&k&&(C&&_?l.jsx(Snt,{branch:k,compact:!Mo,intent:C,onIntentChange:_}):l.jsx(Rae,{branch:k,status:S,compact:!Mo,onOpenDiff:D,worktree:T})),Gn&&l.jsx("div",{className:`${ke.dropdownWrapper} ${ns?"":ke.dropdownWrapperCompact}`,children:l.jsx(fU,{open:vn,items:Qn,activeId:v,onOpenChange:Fe=>{ge(Fe),Fe&&ht(!1)},onSelect:Wn,tooltip:gs,trigger:l.jsxs("button",{className:`${ke.toolBtn} ${ke.modeToolBtn} ${ns?"":ke.toolBtnCompact}`,"data-web-shell-mode-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Fe=>{Fe.stopPropagation(),Me.closeSlashMenu(),Me.closeAtMenu(),Ue(!1)},"aria-label":Le("status.mode"),children:[l.jsx("span",{className:ke.toolBtnModeIcon,children:l.jsx(Sv,{mode:v})}),ns&&l.jsx("span",{className:ke.toolBtnText,children:gs}),l.jsx("span",{className:ke.toolBtnArrow,children:l.jsx(wc,{})})]})})}),Dt&&l.jsx("div",{className:`${ke.dropdownWrapper} ${Rr?"":ke.dropdownWrapperCompact}`,children:l.jsx(fU,{open:Rt,items:ts,activeId:w,onOpenChange:Fe=>{ht(Fe),Fe&&ge(!1)},onSelect:ds,tooltip:mr,showCheck:!0,searchable:!0,searchLabel:Le("common.search"),noResultsLabel:Fe=>Le("model.noMatch",{query:Fe}),trigger:l.jsxs("button",{className:`${ke.toolBtn} ${ke.modelToolBtn} ${Rr?"":ke.toolBtnCompact}`,"data-web-shell-model-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Fe=>{Fe.stopPropagation(),Me.closeSlashMenu(),Me.closeAtMenu(),Ue(!1)},"aria-label":Le("model.select"),children:[l.jsx("span",{className:ke.toolBtnModelIcon,children:l.jsx(T7,{})}),Rr&&l.jsx("span",{className:ke.toolBtnText,children:mr}),l.jsx("span",{className:ke.toolBtnArrow,children:l.jsx(wc,{})})]})})}),pn&&l.jsx("div",{ref:Kn,className:ke.toolbarEnd,children:l.jsx(pn,{disabled:h,isRunning:c,currentMode:v,currentModel:w,sessionName:Ce})})]})]}),l.jsxs("div",{ref:Qe,className:ke.toolbarRight,children:[De&&os.length>0&&l.jsx("button",{className:`${ke.toolBtn} ${ke.quickActionsBtn}`,onClick:Fe=>{Fe.stopPropagation(),Me.closeSlashMenu(),Me.closeAtMenu(),ge(!1),ht(!1),Ue(xn=>!xn)},"aria-expanded":gn,"aria-label":Le("quickActions.open"),title:Le("quickActions.open"),"data-tooltip":Le("quickActions.open"),children:l.jsx("span",{className:ke.toolBtnIcon,children:l.jsx(Knt,{})})}),Yt&&l.jsx("div",{ref:_e,className:ke.toolbarRightCustom,children:l.jsx(Yt,{disabled:h,isRunning:c,currentMode:v,currentModel:w,sessionName:Ce})}),O&&$t&&es("widthMode")&&l.jsx("button",{className:`${ke.toolBtn} ${ke.widthModeBtn}`,onClick:Fe=>{Fe.stopPropagation(),te==null||te(L==="wide"?"1000":"wide")},disabled:!te,"aria-label":Le(L==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:Le(L==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":Le(L==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:l.jsx("span",{className:ke.toolBtnIcon,children:l.jsx(Xnt,{mode:L})})}),es("voice")&&l.jsx(Dtt,{disabled:h,onInsert:Fe=>{const xn=Me.getText(),kt=xn&&!/\s$/.test(xn)?" ":"";Me.insertText(`${kt}${Fe} `),Me.focus()}}),l.jsx("button",{className:u||pr?`${ke.sendBtn} ${ke.sendBtnRunning}${d?` ${ke.sendBtnArmed}`:""}`:ke.sendBtn,disabled:u?!0:pr?!a:Me.disabled||!Me.hasContent,"data-web-shell-composer-submit":!0,onClick:Fe=>{if(Fe.stopPropagation(),!u){if(pr){a==null||a();return}Me.submitText()}},"aria-label":Le(u?"common.loading":pr?d?"stream.cancelArmed":"stream.cancel":"editor.send"),title:c&&d?Le("stream.cancelArmed"):void 0,children:u?l.jsx(Gnt,{}):pr?d?l.jsx("span",{className:ke.escLabel,"aria-hidden":"true",children:"Esc"}):l.jsx(Vnt,{}):l.jsx(Wnt,{})}),l.jsx("span",{role:"status","aria-live":"polite",className:ke.srOnly,children:c&&d?Le("stream.cancelArmed"):""})]})]}),l.jsxs("div",{ref:ft,className:ke.toolbarMeasurements,"aria-hidden":"true",children:[Jn&&si&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{"data-toolbar-measure":"workspaceSelect:collapsed",className:`${ke.toolBtn} ${ke.workspaceSelectTrigger} ${ke.workspaceSelectTriggerCompact}`,children:[l.jsx(s4,{size:16,strokeWidth:1.2}),l.jsx("span",{className:ke.toolBtnText,children:cr}),l.jsx("span",{className:ke.toolBtnArrow,children:l.jsx(wc,{})})]}),l.jsxs("span",{"data-toolbar-measure":"workspaceSelect:expanded",className:`${ke.toolBtn} ${ke.workspaceSelectTrigger}`,children:[l.jsx(s4,{size:16,strokeWidth:1.2}),l.jsx("span",{className:ke.toolBtnText,children:cr}),l.jsx("span",{className:ke.toolBtnArrow,children:l.jsx(wc,{})})]})]}),Ln&&E&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{"data-toolbar-measure":"workspace:collapsed",className:`${ke.workspaceChip} ${ke.workspaceChipCompact}`,children:[l.jsx("span",{className:ke.workspaceChipIcon}),l.jsx("span",{className:ke.workspaceChipText,children:E})]}),l.jsxs("span",{"data-toolbar-measure":"workspace:expanded",className:ke.workspaceChip,children:[l.jsx("span",{className:ke.workspaceChipIcon}),l.jsx("span",{className:ke.workspaceChipText,children:E})]})]}),Vn&&k&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-toolbar-measure":"gitBranch:collapsed",className:`${ke.gitBranchChip} ${ke.gitBranchChipCompact}`,children:l.jsx(BN,{branch:k,status:S,compact:!0,worktree:T})}),l.jsx("span",{"data-toolbar-measure":"gitBranch:expanded",className:ke.gitBranchChip,children:l.jsx(BN,{branch:k,status:S,compact:!1,worktree:T})})]}),l.jsxs("span",{"data-toolbar-measure":"mode:collapsed",className:`${ke.toolBtn} ${ke.modeToolBtn} ${ke.toolBtnCompact}`,children:[l.jsx("span",{className:ke.toolBtnModeIcon,children:l.jsx(Sv,{mode:v})}),l.jsx("span",{className:ke.toolBtnText,children:gs}),l.jsx("span",{className:ke.toolBtnArrow,children:l.jsx(wc,{})})]}),l.jsxs("span",{"data-toolbar-measure":"mode:expanded",className:`${ke.toolBtn} ${ke.modeToolBtn}`,children:[l.jsx("span",{className:ke.toolBtnModeIcon,children:l.jsx(Sv,{mode:v})}),l.jsx("span",{className:ke.toolBtnText,children:gs}),l.jsx("span",{className:ke.toolBtnArrow,children:l.jsx(wc,{})})]}),l.jsxs("span",{"data-toolbar-measure":"model:collapsed",className:`${ke.toolBtn} ${ke.modelToolBtn} ${ke.toolBtnCompact}`,children:[l.jsx("span",{className:ke.toolBtnModelIcon,children:l.jsx(T7,{})}),l.jsx("span",{className:ke.toolBtnText,children:mr}),l.jsx("span",{className:ke.toolBtnArrow,children:l.jsx(wc,{})})]}),l.jsxs("span",{"data-toolbar-measure":"model:expanded",className:`${ke.toolBtn} ${ke.modelToolBtn}`,children:[l.jsx("span",{className:ke.toolBtnModelIcon,children:l.jsx(T7,{})}),l.jsx("span",{className:ke.toolBtnText,children:mr}),l.jsx("span",{className:ke.toolBtnArrow,children:l.jsx(wc,{})})]})]})]})]}),De&&gn&&os.length>0&&l.jsx(nst,{actions:os,onRun:ui,onPressKey:Ur,showKeyHints:!Me.mobileComposer})]})}));function Oae(e){return e.kind!=="agent"}const sst="_bar_17p6f_1",rst="_left_17p6f_12",ist="_right_17p6f_13",ost="_settingsButton_17p6f_23",ast="_modeButton_17p6f_49",lst="_modeHint_17p6f_62",cst="_modeLabel_17p6f_67",ust="_modeDefault_17p6f_71",dst="_modePlan_17p6f_75",hst="_modeAutoEdit_17p6f_79",fst="_modeAuto_17p6f_79",mst="_modeYolo_17p6f_87",pst="_shortcutsButton_17p6f_96",gst="_modelButton_17p6f_114",bst="_model_17p6f_114",yst="_contextButton_17p6f_138",vst="_context_17p6f_138",xst="_goal_17p6f_161",wst="_goalButton_17p6f_167",kst="_separator_17p6f_184",_st="_taskPill_17p6f_188",Oi={bar:sst,left:rst,right:ist,settingsButton:ost,modeButton:ast,modeHint:lst,modeLabel:cst,modeDefault:ust,modePlan:dst,modeAutoEdit:hst,modeAuto:fst,modeYolo:mst,shortcutsButton:pst,modelButton:gst,model:bst,contextButton:yst,context:vst,goal:xst,goalButton:wst,separator:kst,taskPill:_st},Sst=1e3;function Cst(e,t){switch(e){case"default":return{label:t("mode.default"),className:Oi.modeDefault};case"plan":return{label:t("mode.plan"),className:Oi.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:Oi.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:Oi.modeAuto};case"yolo":return{label:t("mode.yolo"),className:Oi.modeYolo};default:return null}}function Tst(){return l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"3"}),l.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 mU(e,t,n,s){return s(e===1?t:n,{count:e})}function Est(e,t){const n=e.filter(Oae);if(n.length===0)return"";const s=n.filter(r=>r.status==="running");if(s.length>0){const r={shell:0,monitor:0};for(const o of s)o.kind==="shell"&&(r.shell+=1),o.kind==="monitor"&&(r.monitor+=1);const i=[];return r.shell>0&&i.push(mU(r.shell,"tasks.pill.shell","tasks.pill.shells",t)),r.monitor>0&&i.push(mU(r.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 Ast(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 jst=f.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:s,onOpenSettings:r,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:c,onOpenGoals:u,hideSettings:d,onToggleShortcuts:h,compact:m=!1},p){const g=xa(),b=g.status==="connected",x=g.currentModel??"",y=g.currentMode??"",v=g.tokenCount??0,w=g.contextWindow??0,{t:k}=at(),C=(w>0?v/w*100:0).toFixed(1),_=Cst(y,k),[,S]=f.useState(0),D=f.useRef(null);f.useEffect(()=>{if(!c)return;const q=setInterval(()=>S(U=>(U+1)%1e6),Sst);return()=>clearInterval(q)},[c]);const E=f.useMemo(()=>Est(a,k),[a,k]),B=!m&&(b||!!_),I=c?Ast(Date.now()-c.setAt):"",L=c?`◎ ${k("goal.statusActive")}${I?` (${I})`:""}`:"",O=!!E||!m,A=!m&&!!x||!m&&w>0&&v>0||!!L;if(f.useImperativeHandle(p,()=>({focusTaskPill(){var q;return E?((q=D.current)==null||q.focus({preventScroll:!0}),!0):!1}}),[E]),!O&&!A)return null;const $=q=>{if(q.key==="Enter"||q.key==="ArrowDown"||q.key==="n"&&q.ctrlKey){q.preventDefault(),q.stopPropagation(),i==null||i();return}if(q.key==="ArrowUp"||q.key==="Escape"||q.key==="p"&&q.ctrlKey){q.preventDefault(),q.stopPropagation(),o==null||o();return}q.key.length===1&&!q.metaKey&&!q.ctrlKey&&!q.altKey&&(q.preventDefault(),q.stopPropagation(),o==null||o(q.key))};return l.jsxs("div",{className:Oi.bar,children:[l.jsxs("div",{className:Oi.left,children:[b&&!d&&!m&&l.jsx("button",{type:"button",className:Oi.settingsButton,onClick:r,onMouseDown:q=>q.stopPropagation(),onTouchStart:q=>q.stopPropagation(),title:k("settings.title"),"aria-label":k("settings.title"),"aria-haspopup":"dialog",children:l.jsx(Tst,{})}),_&&!m&&l.jsxs("button",{type:"button",className:Oi.modeButton,onClick:t,onMouseDown:q=>q.stopPropagation(),onTouchStart:q=>q.stopPropagation(),title:k("mode.select"),"aria-haspopup":"listbox",children:[l.jsx("span",{className:`${Oi.modeLabel} ${_.className}`,children:_.label}),!m&&l.jsx("span",{className:Oi.modeHint,children:k("status.modeHint")})]}),!m&&l.jsx(l.Fragment,{children:h?l.jsx("button",{type:"button",className:Oi.shortcutsButton,onClick:h,onMouseDown:q=>q.stopPropagation(),onTouchStart:q=>q.stopPropagation(),"aria-haspopup":"dialog","aria-label":k("status.shortcuts"),children:k("status.shortcuts")}):l.jsx("span",{children:k("status.shortcuts")})}),E&&l.jsxs(l.Fragment,{children:[B&&l.jsx("span",{className:Oi.separator,children:"·"}),l.jsx("button",{ref:D,type:"button",className:Oi.taskPill,onClick:i,onKeyDown:$,disabled:!i,children:E})]})]}),l.jsxs("div",{className:Oi.right,children:[!m&&x&&l.jsx("button",{type:"button",className:Oi.modelButton,onClick:n,onMouseDown:q=>q.stopPropagation(),onTouchStart:q=>q.stopPropagation(),title:k("model.select"),"aria-haspopup":"listbox",children:l.jsx("span",{className:Oi.model,children:x})}),!m&&w>0&&v>0&&l.jsx("button",{type:"button",className:Oi.contextButton,onClick:s,title:k("contextUsage.title"),children:l.jsx("span",{className:Oi.context,children:k("status.contextUsed",{pct:C})})}),L&&(u?l.jsx("button",{type:"button",className:Oi.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:l.jsx("span",{className:Oi.goal,children:L})}):l.jsx("span",{className:Oi.goal,title:c==null?void 0:c.condition,children:L}))]})]})}),Nst=15e3,Mst=["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."],Ist=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function pU(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?Ist:Mst}function Rst(){const e=oC(),t=Cw(),n=e!=="idle",s=f.useRef(0),r=f.useRef(0),[i,o]=f.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=f.useMemo(()=>{let u=0,d=0,h=!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&&(h=!0)),b.kind==="tool"&&!b.parentToolCallId){if(b.rawInput!==void 0)try{u+=JSON.stringify(b.rawInput).length}catch{}const x=Dst(b.rawOutput);x!==void 0&&!m.has(b.toolCallId)&&(d+=x,m.add(b.toolCallId))}}return{chars:u,agentTokens:d,isReceiving:h}},[t]),c=f.useRef(a);return c.current=a,a.chars<r.current&&(s.current=a.chars),r.current=a.chars,f.useEffect(()=>{if(!n){s.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const u=setInterval(()=>{const{chars:d,agentTokens:h,isReceiving:m}=c.current;if(d<s.current){s.current=d,o({estimatedOutputTokens:h+Math.round(d/4),isReceivingContent:m});return}const p=d-s.current;if(p<=0){o(x=>{const y={estimatedOutputTokens:h+Math.round(s.current/4),isReceivingContent:m};return x.estimatedOutputTokens===y.estimatedOutputTokens&&x.isReceivingContent===y.isReceivingContent?x:y});return}let g;p<70?g=3:p<=200?g=Math.max(3,Math.round(p*.2)):g=50;const b=Math.min(s.current+g,d);s.current=b,o({estimatedOutputTokens:h+Math.round(b/4),isReceivingContent:m})},100);return()=>clearInterval(u)},[n]),i}function Dst(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 s=t.executionSummary;if(typeof s=="object"&&s!==null){const r=s.outputTokens;if(typeof r=="number"&&r>0)return r}}function Lst(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function v1(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const Pst="_status_zld2v_1",Ost="_spinner_zld2v_11",$st="_label_zld2v_15",Bst="_meta_zld2v_19",c2={status:Pst,spinner:Ost,label:$st,meta:Bst},E7=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function $ae({startedAt:e,showPhrase:t=!0}){const n=oC(),{estimatedOutputTokens:s,isReceivingContent:r}=Rst(),{language:i,t:o}=at(),{loadingPhrases:a}=mu(),c=f.useRef(a);c.current=a;const u=f.useCallback(C=>{var _;try{return((_=c.current)==null?void 0:_.call(c,C))??pU(C)}catch(S){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",S),pU(C)}},[]),[d,h]=f.useState(0),m=f.useRef(Date.now()),[p,g]=f.useState(0),[b,x]=f.useState(()=>u(i)[0]??""),y=n!=="idle";if(f.useEffect(()=>{if(!y){h(0);return}m.current=e??Date.now(),h(gU(m.current));const C=setInterval(()=>{h(gU(m.current))},1e3);return()=>clearInterval(C)},[y,e]),f.useEffect(()=>{if(!t)return;if(n==="idle"){x(u(i)[0]??"");return}const C=()=>{const S=u(i),D=Math.floor(Math.random()*S.length);x(S[D]??"")};C();const _=setInterval(C,Nst);return()=>clearInterval(_)},[i,n,u,t]),f.useEffect(()=>{if(n==="idle")return;const C=setInterval(()=>{g(_=>(_+1)%E7.length)},250);return()=>clearInterval(C)},[n]),n==="idle")return null;const v=E7[p%E7.length],w=r?"↓":"↑",k=d<60?`${d}s`:zst(d*1e3),T=s>0?` · ${w} ${o("stream.tokens",{count:Lst(s)})}`:"";return l.jsxs("div",{className:c2.status,children:[l.jsx("span",{className:c2.spinner,children:v}),t&&b&&l.jsx("span",{className:c2.label,children:b}),l.jsxs("span",{className:c2.meta,children:["(",k,T," · ",o("stream.cancel"),")"]})]})}function zst(e){if(e<=0)return"0s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=t%60,i=[];return n>0&&i.push(`${n}h`),s>0&&i.push(`${s}m`),r>0&&i.push(`${r}s`),i.length>0?i.join(" "):"0s"}function gU(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const Fst="_host_1scjy_1",Hst="_toast_1scjy_13",qst="_message_1scjy_31",Ust="_close_1scjy_39",Wst="_info_1scjy_58",Vst="_success_1scjy_62",Gst="_warning_1scjy_66",Kst="_error_1scjy_70",Cv={host:Fst,toast:Hst,message:qst,close:Ust,info:Wst,success:Vst,warning:Gst,error:Kst};function Yst({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:l.jsx("div",{className:Cv.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(s=>l.jsx(Xst,{toast:s,onDismiss:t,autoDismissMs:n},s.id))})}function Xst({toast:e,onDismiss:t,autoDismissMs:n}){const{t:s}=at();return f.useEffect(()=>{const r=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(r)},[n,t,e.id]),l.jsxs("div",{className:`${Cv.toast} ${Cv[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[l.jsx("div",{className:Cv.message,children:e.message}),l.jsx("button",{type:"button",className:Cv.close,onClick:()=>t(e.id),"aria-label":s("toast.dismiss"),title:s("toast.dismissShort"),children:"x"})]})}const Qst="_panel_n876c_1",Jst="_summary_n876c_10",Zst="_progressRing_n876c_27",ert="_stepText_n876c_41",trt="_statusSegmentWrap_n876c_48",nrt="_separator_n876c_55",srt="_statusSegment_n876c_48",rrt="_statusSegmentButton_n876c_61",irt="_fullText_n876c_83",ort="_compactText_n876c_87",art="_detail_n876c_106",lrt="_item_n876c_138",crt="_icon_n876c_148",urt="_loadingIcon_n876c_156",drt="_content_n876c_165",hrt="_completed_n876c_173",frt="_inProgress_n876c_187",mrt="_pending_n876c_192",Oo={panel:Qst,summary:Jst,progressRing:Zst,stepText:ert,statusSegmentWrap:trt,separator:nrt,statusSegment:srt,statusSegmentButton:rrt,fullText:irt,compactText:ort,detail:art,item:lrt,icon:crt,loadingIcon:urt,content:drt,completed:hrt,inProgress:frt,pending:mrt};function prt(e){switch(e){case"completed":return Oo.completed;case"in_progress":return Oo.inProgress;case"pending":return Oo.pending}}const grt=f.memo(function({todos:t,title:n,statusItems:s=[]}){const{t:r}=at();if(t.length===0&&s.length===0)return null;const i=t.length,o=i>0,a=t.findIndex(p=>p.status==="in_progress"),c=a>=0?a:t.findIndex(p=>p.status==="pending"),u=o?c>=0?c+1:i:0,d=o?u/i:0,h=s.map(p=>p.ariaLabel??p.title??(typeof p.label=="string"?p.label:void 0)).filter(Boolean).join(", ")||void 0,m=o?r("todo.stepProgress",{current:u,total:i}):h;return l.jsxs("section",{className:Oo.panel,"aria-label":n??(o?r("todo.title"):h),tabIndex:0,children:[l.jsxs("div",{className:Oo.summary,"aria-label":m,children:[o&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Oo.progressRing,style:{"--todo-progress":String(d)},"aria-hidden":"true"}),l.jsxs("span",{className:Oo.stepText,children:[l.jsx("span",{className:Oo.fullText,children:r("todo.stepProgress",{current:u,total:i})}),l.jsx("span",{className:Oo.compactText,children:r("todo.stepFraction",{current:u,total:i})})]})]}),s.map((p,g)=>l.jsxs("span",{className:Oo.statusSegmentWrap,children:[(i>0||g>0)&&l.jsx("span",{className:Oo.separator,"aria-hidden":"true",children:"·"}),p.onClick?l.jsx("button",{type:"button",className:Oo.statusSegmentButton,title:p.title,"aria-label":p.ariaLabel,onClick:p.onClick,children:p.label}):l.jsx("span",{className:Oo.statusSegment,title:p.title,children:p.label})]},p.id))]}),i>0&&l.jsx("div",{className:Oo.detail,role:"tooltip",children:t.map((p,g)=>l.jsxs("div",{className:`${Oo.item} ${prt(p.status)}`,children:[l.jsx("span",{className:Oo.icon,"aria-hidden":"true",children:p.status==="in_progress"?l.jsx("span",{className:Oo.loadingIcon}):v3(p.status)}),l.jsx("span",{className:Oo.content,title:p.content,children:p.content})]},`${p.id||g}:${p.content}`))})]})}),brt="_header_leiy3_1",yrt="_titleRow_leiy3_11",vrt="_title_leiy3_11",xrt="_subtitle_leiy3_31",u2={header:brt,titleRow:yrt,title:vrt,subtitle:xrt};function wrt(e){const{t}=at();return l.jsxs("div",{className:u2.header,children:[l.jsxs("div",{className:u2.titleRow,children:[l.jsx("span",{children:t("welcome.titlePrefix")}),l.jsx("span",{className:u2.title,children:"Qwen Code"})]}),l.jsx("div",{className:u2.subtitle,children:t("welcome.prompt")})]})}const krt="_themeDark_1tp31_1",_rt="_themeLight_1tp31_25",bU={themeDark:krt,themeLight:_rt},Srt={sm:"sm:max-w-[420px]",md:"sm:max-w-[560px]",lg:"sm:max-w-[720px]",xl:"sm:max-w-[900px]"},Crt=["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 yU(e){return e?Array.from(e.querySelectorAll(Crt)):[]}const x1=[],Bae=f.createContext(null);function qN(e){return e===null?!0:x1[x1.length-1]===e}function pi({title:e,subtitle:t,size:n="md",allowFullscreen:s=!1,dismissible:r=!0,onClose:i,children:o}){const{t:a}=at(),c=Lb(),[u,d]=f.useState(!1),h=f.useRef(null),m=f.useRef(i);m.current=i;const[p]=f.useState(()=>typeof document<"u"?document.activeElement:null),g=f.useRef(!1),b=f.useRef(!1),x=f.useRef(null);x.current===null&&(x.current={}),f.useEffect(()=>{const T=x.current;x1.push(T);const C=_=>{_.key!=="Escape"||!_.isComposing&&_.keyCode!==229||!qN(T)||(Object.defineProperty(_,"key",{configurable:!0,value:"Process"}),document.addEventListener("keydown",S=>{S===_&&Reflect.deleteProperty(_,"key")},{capture:!0,once:!0}))};return window.addEventListener("keydown",C,{capture:!0}),()=>{var B,I;window.removeEventListener("keydown",C,{capture:!0});const _=x1.indexOf(T);if(_>=0&&x1.splice(_,1),x1.length===0){(B=p==null?void 0:p.focus)==null||B.call(p);return}const S=Array.from(document.querySelectorAll("[data-keyboard-scope]")),D=S[S.length-1];(I=yU(D).find(L=>!L.hasAttribute("data-dialog-close"))??D)==null||I.focus()}},[p]);const y=T=>{g.current=T.target===T.currentTarget,b.current=!1},v=T=>{b.current=T.target===T.currentTarget},w=T=>{const C=g.current&&b.current&&T.target===T.currentTarget;g.current=!1,b.current=!1,C&&r&&i()},k=c===zr.Light?bU.themeLight:bU.themeDark;return l.jsx(y0,{open:!0,onOpenChange:T=>{!T&&r&&i()},children:l.jsx(Bae.Provider,{value:x.current,children:l.jsxs(v0,{ref:h,showCloseButton:!1,overlayProps:{onMouseDown:y,onMouseUp:v,onClick:w},className:`${k} ${c===zr.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)]":Srt[n]}`,"aria-label":e,"data-keyboard-scope":!0,"data-web-shell-dialog":!0,"data-web-shell-dialog-title":e,onPointerDownOutside:T=>T.preventDefault(),onEscapeKeyDown:T=>{T.defaultPrevented||T.isComposing||T.keyCode===229||qN(x.current)&&(T.preventDefault(),r&&m.current())},onOpenAutoFocus:T=>{var _;T.preventDefault(),(_=yU(h.current).find(S=>!S.hasAttribute("data-dialog-close"))??h.current)==null||_.focus()},onCloseAutoFocus:T=>T.preventDefault(),children:[l.jsxs(x0,{className:"flex-row items-center gap-2 border-b px-4 py-2.5 text-left",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx(k0,{children:e}),t&&l.jsx(ub,{className:"mt-0.5 text-xs",children:t})]}),s&&l.jsx(An,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>d(T=>!T),"aria-label":a(u?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":u,title:a(u?"common.exitFullscreen":"common.fullscreen"),children:u?l.jsx(XY,{}):l.jsx(YY,{})}),r&&l.jsx(Cj,{asChild:!0,children:l.jsx(An,{type:"button",variant:"ghost",size:"icon-sm","aria-label":a("common.close"),title:a("common.close"),"data-dialog-close":!0,children:l.jsx(Tw,{})})})]}),l.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 d2(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const Trt=new Set(["button","submit","reset"]),Ert=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function vU(){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 Trt.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function A7(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!Ert.has(e.type):e.isContentEditable===!0}function ep({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s,enabled:r=!0}){const i=f.useContext(Bae),o=f.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s};const[a,c]=f.useState(!1);return f.useEffect(()=>{if(!r)return;const u=()=>c(!0),d=()=>c(!1),h=m=>{if(!qN(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(d2(g+1,p));break;case"ArrowUp":m.preventDefault(),u(),o.current.onActiveIndexChange(d2(g-1,p));break;case"Home":if(A7())return;m.preventDefault(),u(),o.current.onActiveIndexChange(0);break;case"End":if(A7())return;m.preventDefault(),u(),o.current.onActiveIndexChange(p-1);break;case"Enter":{if(vU()||g<0)return;m.preventDefault(),o.current.onConfirm(d2(g,p));break}case" ":{if(vU()||A7()||g<0)return;m.preventDefault(),o.current.onConfirm(d2(g,p));break}}};return window.addEventListener("keydown",h),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",h),window.removeEventListener("mousemove",d)}},[i,r]),{keyboardMode:a}}const Art="_picker_5cmbf_4",jrt="_selected_5cmbf_98",Nrt="_disabled_5cmbf_114",Mrt={picker:Art,"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:jrt,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:Nrt,"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 an(...e){return e.filter(t=>!!t).map(t=>Mrt[t]).filter(Boolean).join(" ")}const Irt="_list_jbgdx_1",Rrt="_row_jbgdx_16",Drt="_selected_jbgdx_32",Lrt="_keyboardOnly_jbgdx_39",Prt="_modeName_jbgdx_47",Ort="_modeIcon_jbgdx_51",$rt="_modeText_jbgdx_67",Brt="_modeDesc_jbgdx_83",vf={list:Irt,row:Rrt,selected:Drt,keyboardOnly:Lrt,modeName:Prt,modeIcon:Ort,modeText:$rt,modeDesc:Brt};function zrt({currentMode:e,onSelect:t}){const{t:n}=at(),s=f.useRef(null),r=Mb.map(m=>({id:m,name:n(`mode.listLabel.${m}`),description:n(`mode.desc.${m}`)})),i=r.findIndex(m=>m.id===e),[o,a]=f.useState(i>=0?i:0),c=f.useRef(!1);f.useEffect(()=>{c.current||i<0||a(i)},[i]);const u=m=>{c.current=!0,a(m)},d=m=>{const p=r[m];p&&t(p.id)},{keyboardMode:h}=ep({itemCount:r.length,activeIndex:o,onActiveIndexChange:u,onConfirm:d});return f.useEffect(()=>{var p;const m=(p=s.current)==null?void 0:p.children[o];m==null||m.scrollIntoView({block:"nearest"})},[o]),l.jsx("div",{className:`${vf.list} ${h?vf.keyboardOnly:""}`,ref:s,role:"listbox",tabIndex:0,"aria-activedescendant":r.length>0?`mode-opt-${o}`:void 0,"aria-label":n("mode.select"),"data-web-shell-approval-mode-dialog":!0,children:r.map((m,p)=>{const g=p===o,b=m.id===e;return l.jsxs("div",{id:`mode-opt-${p}`,role:"option","aria-selected":b,className:`${vf.row} ${g?vf.selected:""} ${b?an("dialog-current"):""}`,"data-web-shell-approval-mode-option":!0,"data-mode-id":m.id,onClick:()=>d(p),onMouseMove:()=>u(p),children:[l.jsx("span",{className:vf.modeIcon,children:l.jsx(Sv,{mode:m.id})}),l.jsxs("span",{className:vf.modeText,children:[l.jsx("span",{className:vf.modeName,children:m.name}),l.jsx("span",{className:vf.modeDesc,children:m.description})]})]},m.id)})})}function WT(e){const[t,n]=f.useState(""),[s,r]=f.useState(""),i=f.useRef(!1),o=f.useRef(""),a=f.useRef(e);a.current=e;const c=f.useCallback(m=>{var p;m!==o.current&&(o.current=m,r(m),(p=a.current)==null||p.call(a,m))},[]),u=f.useCallback(m=>{const p=m.target.value;n(p),i.current||c(p)},[c]),d=f.useCallback(()=>{i.current=!0},[]),h=f.useCallback(m=>{i.current=!1;const p=m.currentTarget.value;n(p),c(p)},[c]);return{filterValue:s,inputProps:{value:t,onChange:u,onCompositionStart:d,onCompositionEnd:h}}}function _3(e,t){const n=Date.now()-new Date(e).getTime(),s=Math.floor(n/6e4);if(s<1)return t("time.justNow");if(s<60)return t("time.minutesAgo",{count:s});const r=Math.floor(s/60);if(r<24)return t("time.hoursAgo",{count:r});const i=Math.floor(r/24);return i<7?t("time.daysAgo",{count:i}):new Date(e).toLocaleDateString()}function bD({session:e,active:t,current:n,confirmed:s,disabled:r,currentLabel:i,optionId:o,ariaSelected:a,leading:c,trailing:u,resumeSelector:d,onClick:h,onActivate:m}){const{t:p}=at(),g=e.updatedAt||e.createdAt;return l.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":r||void 0,className:an("picker-item","picker-session-item",t?"selected":void 0,n?"dialog-current":void 0,s?"picker-item-confirmed":void 0,r?"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:h,onMouseMove:m,children:[l.jsxs("div",{className:an("picker-item-row"),children:[c,l.jsx("span",{className:an("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),u]}),l.jsxs("div",{className:an("picker-item-meta"),children:[l.jsx("span",{children:g&&_3(g,p)}),l.jsx("span",{className:an("picker-item-detail"),children:p("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&l.jsx("span",{className:an("picker-item-detail"),children:p("resume.activePrompt")})]})]})}function ek(e,t={}){const{autoLoad:n=!1,enabled:s=!0,pageSize:r,archiveState:i,view:o,group:a}=t,c=W2({autoLoad:n,enabled:s&&!e,pageSize:r,archiveState:i,view:o,group:a,sourceType:o4}),{reload:u,deleteSession:d,deleteSessions:h}=c,m=la(),p=f.useRef(0),[g,b]=f.useState({sessions:[],loading:!1}),x=f.useCallback(async()=>{if(!e||!s)return[];const T=++p.current;b(C=>({cwd:e,sessions:C.cwd===e?C.sessions:[],loading:!0}));try{const _=(await m.client.workspaceByCwd(e).listWorkspaceSessions({pageSize:r,archiveState:i,view:o,group:a,sourceType:o4})).map(S=>({...S,workspaceCwd:e}));return p.current===T&&b({cwd:e,sessions:_,loading:!1}),_}catch(C){const _=C instanceof Error?C:new Error(String(C));throw p.current===T&&b({cwd:e,sessions:[],loading:!1,error:_}),_}},[i,s,a,r,o,m.client,e]);f.useEffect(()=>{if(e)return p.current+=1,b({cwd:e,sessions:[],loading:n&&s}),n&&s&&x().catch(()=>{}),()=>{p.current+=1}},[n,s,x,e]);const y=f.useCallback(()=>e?x():u(),[u,x,e]),v=f.useCallback(async T=>{if(!e)return h(T);const C=await m.client.workspaceByCwd(e).deleteSessionsData(T);return await x(),C},[h,x,m.client,e]),w=f.useCallback(async T=>{if(!e)return d(T);const C=await v([T]);if(C.errors.length>0)throw new Error(C.errors[0].error);return C.removed.length>0||C.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&&s),error:k==null?void 0:k.error,reload:y,deleteSession:w,deleteSessions:v,releaseSession:c.releaseSession}}const UN="resume-session-list",xU=e=>`${UN}-opt-${e}`;function Frt({onSelect:e,onClose:t,workspaceCwd:n}){const{t:s}=at(),r=xa(),{sessions:i,loading:o,error:a}=ek(n,{autoLoad:!0}),c=r.sessionId,[u,d]=f.useState(-1),{filterValue:h,inputProps:m}=WT(()=>d(-1)),p=f.useRef(null),g=f.useRef(null),b=h?i.filter(v=>{const w=h.toLowerCase();return(v.displayName||"").toLowerCase().includes(w)||v.sessionId.toLowerCase().includes(w)}):i;f.useEffect(()=>{u>=b.length&&b.length>0&&d(b.length-1)},[b.length,u]),f.useEffect(()=>{var w;const v=(w=p.current)==null?void 0:w.children[u];v==null||v.scrollIntoView({block:"nearest"})},[u]);const x=v=>{const w=b[v];w&&(e(w.sessionId),t())},{keyboardMode:y}=ep({itemCount:b.length,activeIndex:u,onActiveIndexChange:d,onConfirm:x});return f.useEffect(()=>{var v;(v=g.current)==null||v.focus()},[]),l.jsxs("div",{className:an("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[l.jsxs("div",{className:an("picker-search"),children:[l.jsxs("span",{className:an("picker-search-label"),children:[s("resume.search"),":"," "]}),l.jsx("input",{ref:g,className:an("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":UN,"aria-activedescendant":u>=0&&u<b.length?xU(u):void 0,...m,placeholder:""})]}),l.jsx("div",{className:an("picker-sep")}),l.jsxs("div",{id:UN,role:"listbox",className:an("picker-list",y?"picker-keyboard-only":void 0),ref:p,children:[o&&l.jsx("div",{className:an("picker-empty"),children:s("common.loading")}),!o&&a&&l.jsx("div",{className:an("picker-empty"),children:a.message||s("resume.failedToLoad")}),!o&&!a&&b.length===0&&l.jsx("div",{className:an("picker-empty"),children:h?s("resume.noMatch",{query:h}):s("resume.none")}),!o&&b.map((v,w)=>l.jsx(bD,{session:v,optionId:xU(w),active:w===u,current:v.sessionId===c,currentLabel:s("resume.current"),resumeSelector:!0,onClick:()=>x(w),onActivate:()=>d(w)},v.sessionId))]})]})}const Hrt="_layout_1sigx_1",qrt="_list_1sigx_9",Urt="_row_1sigx_23",Wrt="_selected_1sigx_39",Vrt="_keyboardOnly_1sigx_46",Grt="_label_1sigx_54",Krt="_divider_1sigx_58",Yrt="_number_1sigx_65",Xrt="_provider_1sigx_71",Qrt="_badge_1sigx_86",Jrt="_detail_1sigx_92",Zrt="_detailRow_1sigx_104",eit="_detailLabel_1sigx_111",tit="_detailValue_1sigx_117",nit="_empty_1sigx_122",Da={layout:Hrt,list:qrt,row:Urt,selected:Wrt,keyboardOnly:Vrt,label:Grt,divider:Krt,number:Yrt,provider:Xrt,badge:Qrt,detail:Jrt,detailRow:Zrt,detailLabel:eit,detailValue:tit,empty:nit};function sit(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function rit(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 wU(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function iit(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function oit(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function ait(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function h2({label:e,value:t}){return l.jsxs("div",{className:Da.detailRow,children:[l.jsx("span",{className:Da.detailLabel,children:e}),l.jsx("span",{className:Da.detailValue,children:t})]})}function lit({mode:e="main",onSelect:t,models:n,currentModelId:s}){const r=xa(),i=s??r.currentModel??"",o=f.useMemo(()=>n??r.models??[],[n,r.models]),{t:a}=at(),c=f.useRef(null),u=e==="fast",d=e==="voice",h=e==="vision",m=o.findIndex(k=>k.id===i),[p,g]=f.useState(m>=0?m:0),b=f.useRef(!1);f.useEffect(()=>{b.current||o.length===0||g(m>=0?m:0)},[o.length,m]);const x=k=>{b.current=!0,g(k)};f.useEffect(()=>{p>=o.length&&o.length>0&&g(o.length-1)},[o.length,p]);const y=o[p]??o[0],v=k=>{const T=o[k];T&&t(ait(T,u))},{keyboardMode:w}=ep({itemCount:o.length,activeIndex:p,onActiveIndexChange:x,onConfirm:v});return f.useEffect(()=>{var T;const k=(T=c.current)==null?void 0:T.children[p];k==null||k.scrollIntoView({block:"nearest"})},[p]),l.jsxs("div",{className:Da.layout,children:[l.jsxs("div",{className:`${Da.list} ${w?Da.keyboardOnly:""}`,ref:c,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${p}`:void 0,"aria-label":a(u?"model.setFast":d?"model.setVoice":h?"model.setVision":"model.select"),"data-web-shell-model-dialog":!0,children:[o.length===0?l.jsx("div",{className:Da.empty,children:a("model.none")}):null,o.map((k,T)=>{const C=T===p,_=T===m,S=wU(k);return l.jsxs("div",{id:`model-opt-${T}`,role:"option","aria-selected":_,className:`${Da.row} ${C?Da.selected:""} ${_?an("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":k.id,onClick:()=>v(T),onMouseMove:()=>x(T),children:[l.jsxs("span",{className:Da.number,children:[T+1,"."]}),S?l.jsxs("span",{className:Da.provider,children:["[",S,"]"]}):null,l.jsx("span",{className:Da.label,children:iit(k)}),k.isRuntime?l.jsx("span",{className:Da.badge,children:a("common.runtime")}):null]},oit(k))})]}),y?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Da.divider}),l.jsxs("div",{className:Da.detail,children:[l.jsx(h2,{label:a("model.modality"),value:rit(y.modalities,a)}),l.jsx(h2,{label:a("model.contextWindow"),value:sit(y.contextWindow,a)}),wU(y)!=="qwen-oauth"?l.jsxs(l.Fragment,{children:[l.jsx(h2,{label:a("model.baseUrl"),value:y.baseUrl??a("model.default")}),l.jsx(h2,{label:a("model.apiKey"),value:y.envKey??a("model.notSet")})]}):null]})]}):null]})}const cit="_body_2kfet_1",uit="_hint_2kfet_8",dit="_list_2kfet_13",hit="_empty_2kfet_21",fit="_row_2kfet_27",mit="_rowSelected_2kfet_51",pit="_badge_2kfet_56",git="_label_2kfet_74",bit="_footer_2kfet_78",yit="_count_2kfet_86",vit="_actions_2kfet_91",xit="_cancel_2kfet_96",wit="_confirm_2kfet_97",Ll={body:cit,hint:uit,list:dit,empty:hit,row:fit,rowSelected:mit,badge:pit,label:git,footer:bit,count:yit,actions:vit,cancel:xit,confirm:wit};function kit({models:e,current:t,max:n,onConfirm:s,onClose:r}){const{t:i}=at(),[o,a]=f.useState(()=>{const d=new Set,h=[];for(const m of t){const p=m.trim();if(!(!p||d.has(p))&&(d.add(p),h.push(p),h.length>=n))break}return h}),c=f.useMemo(()=>{const d=new Set(e.map(m=>m.baseId)),h=o.filter(m=>!d.has(m)).map(m=>({baseId:m,label:m}));return[...e,...h]},[e,o]),u=d=>{a(h=>h.includes(d)?h.filter(m=>m!==d):h.length>=n?h:[...h,d])};return l.jsxs("div",{className:Ll.body,children:[l.jsx("div",{className:Ll.hint,children:i("settings.models.fallbacks.hint",{max:n})}),l.jsxs("div",{className:Ll.list,role:"group","aria-label":i("settings.models.fallbacks.title"),children:[c.length===0&&l.jsx("div",{className:Ll.empty,children:i("settings.models.fallbacks.empty")}),c.map(d=>{const h=o.indexOf(d.baseId),m=h>=0,p=o.length>=n&&!m;return l.jsxs("button",{type:"button","aria-pressed":m,className:`${Ll.row} ${m?Ll.rowSelected:""}`,"aria-disabled":p||void 0,title:p?i("settings.models.fallbacks.limitReached",{max:n}):void 0,onClick:()=>u(d.baseId),children:[l.jsx("span",{className:Ll.badge,children:m?h+1:""}),l.jsx("span",{className:Ll.label,children:d.label})]},d.baseId)})]}),l.jsxs("div",{className:Ll.footer,children:[l.jsxs("span",{className:Ll.count,children:[o.length,"/",n]}),l.jsxs("div",{className:Ll.actions,children:[l.jsx("button",{type:"button",className:Ll.cancel,onClick:r,children:i("settings.models.cancel")}),l.jsx("button",{type:"button",className:Ll.confirm,onClick:()=>s(o),children:i("settings.models.fallbacks.confirm")})]})]})]})}function _it(e,t,n="all"){const s=t.trim().toLowerCase();return e.filter(r=>n!=="all"&&r.level!==n?!1:s?r.name.toLowerCase().includes(s):!0)}function kU(e,t){return e?t.find(n=>n.name===e.name&&n.level===e.level)??null:null}function _U(e,t){return e.level!=="user"?!1:t.some(n=>n.level==="project"&&n.name===e.name)}function Sit(e){return(e.level==="project"||e.level==="user")&&!e.isBuiltin}function SU(e){if(e==="project")return"workspace";if(e==="user")return"global"}const Cit=U0("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 mo({className:e,variant:t="default",asChild:n=!1,...s}){const r=n?SI:"span";return l.jsx(r,{"data-slot":"badge","data-variant":t,className:Qt(Cit({variant:t}),e),...s})}function yD({className:e,orientation:t="horizontal",decorative:n=!0,...s}){return l.jsx(eje,{"data-slot":"separator",decorative:n,orientation:t,className:Qt("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...s})}function H1({className:e,...t}){return l.jsx("div",{"data-slot":"field-group",className:Qt("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 Tit=U0("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 $i({className:e,orientation:t="vertical",...n}){return l.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Qt(Tit({orientation:t}),e),...n})}function zae({className:e,...t}){return l.jsx("div",{"data-slot":"field-content",className:Qt("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...t})}function vo({className:e,...t}){return l.jsx(Tj,{"data-slot":"field-label",className:Qt("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 Eit({className:e,...t}){return l.jsx("div",{"data-slot":"field-label",className:Qt("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function tu({className:e,...t}){return l.jsx("p",{"data-slot":"field-description",className:Qt("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 Ait({className:e,children:t,errors:n,...s}){const r=f.useMemo(()=>{var o;if(t)return t;if(!(n!=null&&n.length))return null;const i=[...new Map(n.map(a=>[a==null?void 0:a.message,a])).values()];return(i==null?void 0:i.length)==1?(o=i[0])==null?void 0:o.message:l.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((a,c)=>(a==null?void 0:a.message)&&l.jsx("li",{children:a.message},c))})},[t,n]);return r?l.jsx("div",{role:"alert","data-slot":"field-error",className:Qt("text-sm font-normal text-destructive",e),...s,children:r}):null}const jit=U0("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 Wl({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:Qt(jit({variant:t}),e),...n})}function ux({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:Qt("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function Vl({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:Qt("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 Nit({className:e,...t}){return l.jsx("div",{"data-slot":"alert-action",className:Qt("absolute top-2 right-2",e),...t})}function li({className:e,...t}){return l.jsx(o1e,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:Qt("size-4 animate-spin",e),...t})}function yl({children:e,closeLabel:t,noticeKey:n,onDismiss:s,tone:r,className:i}){const o=f.useRef(s);return o.current=s,f.useEffect(()=>{if(r==="error"||r==="progress")return;const a=window.setTimeout(()=>o.current(),3e3);return()=>window.clearTimeout(a)},[n,r]),l.jsxs(Wl,{variant:r==="error"?"destructive":r==="success"?"success":"default",children:[r==="error"?l.jsx(nu,{}):r==="success"?l.jsx(Age,{}):r==="progress"?l.jsx(li,{}):l.jsx(vA,{}),l.jsx(Vl,{className:i,children:e}),r!=="progress"?l.jsx(Nit,{children:l.jsx(An,{type:"button",variant:"ghost",size:"icon-xs","aria-label":t,title:t,onClick:s,children:l.jsx(Tw,{})})}):null]})}function Q0({className:e,orientation:t="horizontal",...n}){return l.jsx(aje,{orientation:t,"data-slot":"tabs","data-orientation":t,className:Qt("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Mit=U0("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 J0({className:e,variant:t="default",...n}){return l.jsx(lje,{"data-slot":"tabs-list","data-variant":t,className:Qt(Mit({variant:t}),e),...n})}function Fr({className:e,...t}){return l.jsx(cje,{"data-slot":"tabs-trigger",className:Qt("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 gi({className:e,...t}){return l.jsx(uje,{"data-slot":"tabs-content",className:Qt("flex-1 text-sm outline-none",e),...t})}function Op({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:Qt("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 Iit(e,t){const n=new Set(Object.values(t).flatMap(s=>s.map(r=>r.name)));return e.filter(s=>s.enabled&&!s.name.startsWith("mcp__")&&!n.has(s.name))}function Rit(e){return e.filter(t=>!t.disabled&&(t.mcpStatus==="connected"||t.mcpStatus===void 0&&t.status==="ok")).map(t=>t.name)}function Dit(e,t){if(!e.trim())return;const n=JSON.parse(e);if(!Sf(n))throw new Error(`${t} must be a JSON object`);return n}function Sf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Lit(e){return(e instanceof Error?e.message:String(e)).replace(/^[A-Z]+ \/\S+:\s*/,"")}function WN(e,t,n){const s=new Set(e);return n?s.add(t):s.delete(t),s}const CU=["inherit",...Mb],Pit=1500,Oit=40;function TU({initialScope:e="global",agent:t,onCancel:n,onCreated:s}){var ft,$t;const{t:r}=at(),{createAgent:i,updateAgent:o,generateContent:a}=UY({autoLoad:!1}),c=WY({autoLoad:!1}),u=w9({autoLoad:!1}),d=k9({autoLoad:!0}),h=u.loadTools,m=u.initialize,p=u.reloadConfig,g=u.reload,b=c.preheat,x=c.reload,y=(t==null?void 0:t.level)==="user"?"global":"workspace",[v,w]=f.useState(t?y:e),[k,T]=f.useState((t==null?void 0:t.name)??""),[C,_]=f.useState((t==null?void 0:t.description)??""),[S,D]=f.useState((t==null?void 0:t.systemPrompt)??""),[E,B]=f.useState(()=>{var pe;return new Set((pe=t==null?void 0:t.tools)!=null&&pe.includes("*")?[]:(t==null?void 0:t.tools)??[])}),[I,L]=f.useState(()=>new Set((t==null?void 0:t.disallowedTools)??[])),[O,A]=f.useState((t==null?void 0:t.model)??""),[$,q]=f.useState((t==null?void 0:t.approvalMode)??"inherit"),U=$==="bubble"?[...CU,"bubble"]:CU,[H,M]=f.useState(((ft=t==null?void 0:t.maxTurns)==null?void 0:ft.toString())??""),[ee,V]=f.useState((t==null?void 0:t.color)??"inherit"),[R,re]=f.useState(()=>new Set(Object.keys((t==null?void 0:t.mcpServers)??{}))),[Z,K]=f.useState(t!=null&&t.hooks?JSON.stringify(t.hooks,null,2):""),[Y,ae]=f.useState(!1),[le,te]=f.useState(""),[z,X]=f.useState(""),[fe,xe]=f.useState(""),[ie,Ce]=f.useState({}),[Ke,ut]=f.useState(!1),[Et,st]=f.useState(null),[xt,He]=f.useState(!0),[pn,Yt]=f.useState(null),[It,me]=f.useState(!1),[$e,yt]=f.useState(()=>new Set),[Me,Le]=f.useState(null),[vn,ge]=f.useState(null),Rt=f.useRef({description:0,systemPrompt:0}),ht=f.useRef({}),gn=f.useMemo(()=>Iit(c.tools,ie),[ie,c.tools]),Ue=f.useMemo(()=>{var pe;return((pe=u.status)==null?void 0:pe.servers)??[]},[($t=u.status)==null?void 0:$t.servers]),De=f.useMemo(()=>{var ue;const pe=(ue=d.settings.find(Wt=>Wt.key==="mcpServers"))==null?void 0:ue.values,Be=v==="global"?pe==null?void 0:pe.user:pe==null?void 0:pe.effective;return Sf(Be)?Be:{}},[v,d.settings]),Re=f.useMemo(()=>Ue.filter(pe=>{var Be;return Sf(De[pe.name])||Sf((Be=t==null?void 0:t.mcpServers)==null?void 0:Be[pe.name])?!0:v==="workspace"&&Sf(pe.config)}),[t==null?void 0:t.mcpServers,De,Ue,v]),be=f.useMemo(()=>Rit(Re),[Re]),Ie=be.join("\0"),ne=!!(k.trim()&&C.trim()&&S.trim());f.useEffect(()=>()=>{for(const pe of Object.values(ht.current))pe==null||pe.abort()},[]),f.useEffect(()=>{let pe=!0;return(async()=>{var ue,Wt;He(!0),Yt(null);try{if(!(await b(5e3)).ready)throw new Error(r("agent.create.tools.preheatFailed"));if(!pe)return;const hn=await x();if(!hn)throw new Error(r("agent.create.tools.loadFailed"));if((ue=hn.errors)!=null&&ue.length)throw new Error(hn.errors.map(kn=>kn.error||kn.hint||kn.kind).join(`
`));(await m()).accepted||await p();let Ae=!1;for(let kn=0;kn<Oit;kn+=1){if(await new Promise(qn=>window.setTimeout(qn,Pit)),!pe)return;const Dn=await g();if(Dn){if((Wt=Dn.errors)!=null&&Wt.length)throw new Error(Dn.errors.map(qn=>qn.error||qn.hint||qn.kind).join(`
`));if(Dn.discoveryState==="completed"||Dn.initialized&&Dn.discoveryState==="not_started"&&Dn.servers.length===0){Ae=!0;break}}}if(!Ae)throw new Error(r("mcp.discovery.timeout"))}catch(Bt){pe&&Yt(Bt instanceof Error?Bt.message:String(Bt))}finally{pe&&He(!1)}})(),()=>{pe=!1}},[m,b,g,p,x,r]),f.useEffect(()=>{if(xt)return;if(!Ie){Ce({});return}let pe=!0;return ut(!0),st(null),Promise.all(be.map(async Be=>{var Wt;const ue=await h(Be);return{serverName:Be,tools:ue.tools.filter(Bt=>Bt.isValid),error:(Wt=ue.errors)!=null&&Wt.length?`${Be}: ${ue.errors.map(Bt=>Bt.error||Bt.hint||Bt.kind).join(", ")}`:void 0}})).then(Be=>{if(!pe)return;Ce(Object.fromEntries(Be.map(({serverName:Wt,tools:Bt})=>[Wt,Bt])));const ue=Be.flatMap(({error:Wt})=>Wt?[Wt]:[]);st(ue.length>0?ue.join(`
`):null)}).catch(Be=>{pe&&st(Be instanceof Error?Be.message:String(Be))}).finally(()=>{pe&&ut(!1)}),()=>{pe=!1}},[Ie,be,xt,h]);function Ee(pe){var Be;if(!pe){for(const ue of["description","systemPrompt"])Rt.current[ue]+=1,(Be=ht.current[ue])==null||Be.abort(),delete ht.current[ue];yt(new Set)}ae(pe)}function qe(){X(C),xe(S),ge(null),ae(!0)}function Je(pe){var Be;Rt.current[pe]+=1,(Be=ht.current[pe])==null||Be.abort(),delete ht.current[pe],yt(ue=>{const Wt=new Set(ue);return Wt.delete(pe),Wt})}async function Qe(pe){const Be=le.trim();if(!Be||ht.current[pe])return;const ue=Rt.current[pe]+1;Rt.current[pe]=ue;const Wt=new AbortController;ht.current[pe]=Wt,yt(hn=>new Set(hn).add(pe)),ge(null);const Bt=pe==="description"?X:xe;Bt("");try{const hn=pe==="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 gt="";for await(const Ae of a(`${Be}

${hn}`,{signal:Wt.signal})){if(Rt.current[pe]!==ue)return;if(Ae.type==="delta")gt+=Ae.text,Bt(gt);else if(Ae.type==="error")throw new Error(Ae.message)}if(Rt.current[pe]!==ue)return;Bt(gt.trim())}catch(hn){if(Rt.current[pe]!==ue||Wt.signal.aborted)return;ge(r("agent.create.generateFailed",{error:hn instanceof Error?hn.message:String(hn)}))}finally{Rt.current[pe]===ue&&(yt(hn=>{const gt=new Set(hn);return gt.delete(pe),gt}),ht.current[pe]===Wt&&delete ht.current[pe])}}function cn(){_(z.trim()),D(fe.trim()),Ee(!1)}function Kn(pe){var Bt,hn;const Be=(Bt=t==null?void 0:t.mcpServers)==null?void 0:Bt[pe];if(Sf(Be))return Be;const ue=De[pe];if(Sf(ue))return ue;const Wt=v==="workspace"?(hn=Ue.find(gt=>gt.name===pe))==null?void 0:hn.config:void 0;return Sf(Wt)?Wt:void 0}async function _e(){if(!ne){Le(r("agent.create.required"));return}me(!0),Le(null);try{const pe=H.trim()?Number(H.trim()):void 0;if(pe!==void 0&&(!Number.isSafeInteger(pe)||pe<=0))throw new Error(r("agent.create.maxTurnsInvalid"));const Be=[...E],ue=[...I],Wt=Dit(Z,"hooks"),Bt=Object.fromEntries([...R].flatMap(Ae=>{const kn=Kn(Ae);return kn?[[Ae,kn]]:[]})),hn={description:C.trim(),systemPrompt:S.trim(),tools:t||Be.length>0?Be:void 0,disallowedTools:t||ue.length>0?ue:void 0,mcpServers:t||Object.keys(Bt).length>0?Bt:void 0,hooks:t?Wt??{}:Wt},gt=t?await o(t.name,{...hn,model:O.trim()||null,approvalMode:$==="inherit"?null:$,maxTurns:pe??null,color:ee==="inherit"?null:ee},v):await i({name:k.trim(),scope:v,...hn,model:O.trim()||void 0,approvalMode:$==="inherit"?void 0:$,maxTurns:pe,color:ee==="inherit"?void 0:ee});s(gt.agent.name)}catch(pe){Le(Lit(pe))}finally{me(!1)}}return l.jsxs("div",{className:"flex w-full max-w-5xl flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsx("h1",{className:"text-xl font-semibold text-balance",children:r(t?"agent.edit":"agent.create")}),l.jsxs(An,{type:"button",variant:"outline",onClick:qe,children:[l.jsx(N1,{"data-icon":"inline-start"}),r("agent.create.modelGenerate")]})]}),Me?l.jsx(yl,{tone:"error",noticeKey:Me,closeLabel:r("common.close"),onDismiss:()=>Le(null),children:Me}):null,l.jsxs(Q0,{defaultValue:"overview",children:[l.jsxs(J0,{className:"max-w-full overflow-x-auto",children:[l.jsx(Fr,{value:"overview",children:r("agent.detail.overview")}),l.jsx(Fr,{value:"prompt",children:r("agent.detail.systemPrompt")}),l.jsx(Fr,{value:"tools",children:r("agent.detail.tools")}),l.jsx(Fr,{value:"mcp",children:r("agent.detail.mcp")}),l.jsx(Fr,{value:"hooks",children:r("agent.detail.hooks")})]}),l.jsx(gi,{value:"overview",className:"pt-4",children:l.jsxs(H1,{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"agent-scope",children:r("agent.create.scope")}),l.jsxs(kl,{value:v,disabled:!!t,onValueChange:pe=>w(pe),children:[l.jsx(Sl,{id:"agent-scope",className:"w-full",children:l.jsx(_l,{})}),l.jsxs(Cl,{children:[l.jsx(bi,{value:"workspace",children:r("agent.create.project.cli")}),l.jsx(bi,{value:"global",children:r("agent.create.user.cli")})]})]})]}),l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"agent-name",children:r("agent.create.name")}),l.jsx(qr,{id:"agent-name",value:k,onChange:pe=>T(pe.target.value),placeholder:r("agent.create.namePlaceholder"),disabled:!!t}),l.jsx(tu,{children:r("agent.create.nameHelp")})]}),l.jsxs($i,{className:"lg:col-span-2",children:[l.jsx(vo,{htmlFor:"agent-description",children:r("agent.create.description")}),l.jsx(Op,{id:"agent-description",value:C,onChange:pe=>_(pe.target.value),placeholder:r("agent.create.manualDescPlaceholder"),rows:3})]}),l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"agent-model",children:r("agent.create.model")}),l.jsx(qr,{id:"agent-model",value:O,onChange:pe=>A(pe.target.value),placeholder:"inherit / fast / provider:model"})]}),l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"agent-approval",children:r("agent.create.approvalMode")}),l.jsxs(kl,{value:$,onValueChange:q,children:[l.jsx(Sl,{id:"agent-approval",className:"w-full",children:l.jsx(_l,{children:jU($,r)})}),l.jsx(Cl,{children:U.map(pe=>l.jsx(bi,{value:pe,disabled:pe==="bubble",children:jU(pe,r)},pe))})]}),l.jsx(tu,{children:Bit($,r)})]}),l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"agent-max-turns",children:r("agent.create.maxTurns")}),l.jsx(qr,{id:"agent-max-turns",type:"number",min:"1",step:"1",value:H,onChange:pe=>M(pe.target.value)}),l.jsx(tu,{children:r("agent.create.maxTurnsHelp")})]}),l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"agent-color",children:r("agent.create.color")}),l.jsxs(kl,{value:ee,onValueChange:V,children:[l.jsx(Sl,{id:"agent-color",className:"w-full",children:l.jsx(_l,{})}),l.jsx(Cl,{children:["inherit","auto","red","blue","green","yellow","purple","orange","pink","cyan"].map(pe=>l.jsx(bi,{value:pe,children:pe},pe))})]})]})]})}),l.jsx(gi,{value:"prompt",className:"pt-4",children:l.jsxs($i,{children:[l.jsx(Op,{id:"agent-prompt","aria-label":r("agent.create.prompt"),value:S,onChange:pe=>D(pe.target.value),placeholder:r("agent.create.promptPlaceholder.cli"),rows:16,className:"min-h-80 max-h-[60vh] overflow-y-auto"}),l.jsx(tu,{children:r("agent.create.promptHelp")})]})}),l.jsx(gi,{value:"tools",className:"pt-4",children:l.jsxs(H1,{children:[l.jsxs($i,{children:[l.jsx(vo,{children:r("agent.create.tools")}),l.jsx(tu,{children:r("agent.create.toolsSelectHelp")}),l.jsx(AU,{idPrefix:"agent-allowed-tool",selection:E,onSelectionChange:B,builtInTools:gn,mcpServers:Re,mcpTools:ie,t:r}),xt||Ke?l.jsx(NU,{label:r("agent.create.tools.initializing")}):null,pn||Et?l.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:pn||Et}):null]}),l.jsxs($i,{children:[l.jsx(vo,{children:r("agent.create.disallowedTools")}),l.jsx(AU,{idPrefix:"agent-disallowed-tool",selection:I,onSelectionChange:L,builtInTools:gn,mcpServers:Re,mcpTools:ie,t:r})]})]})}),l.jsx(gi,{value:"mcp",className:"pt-4",children:l.jsxs($i,{children:[l.jsx(vo,{children:r("agent.create.mcpServers")}),l.jsx($it,{selection:R,onSelectionChange:re,servers:Re,t:r}),d.loading?l.jsx(NU,{label:r("common.loading")}):d.error?l.jsx(zit,{error:d.error}):null]})}),l.jsx(gi,{value:"hooks",className:"pt-4",children:l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"agent-hooks",children:"Hooks"}),l.jsx(Op,{id:"agent-hooks",value:Z,onChange:pe=>K(pe.target.value),placeholder:'{"PreToolUse":[...] }',rows:10,className:"min-h-64 max-h-[60vh] overflow-y-auto font-mono text-xs"}),l.jsx(tu,{children:r("agent.create.jsonObjectHelp")})]})})]}),l.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[l.jsx(An,{variant:"outline",onClick:n,disabled:It,children:r("common.cancel")}),l.jsxs(An,{onClick:()=>void _e(),disabled:!ne||It,children:[It?l.jsx(li,{"data-icon":"inline-start"}):null,r(t?"agent.edit.save":"agent.create.save")]})]}),l.jsx(y0,{open:Y,onOpenChange:Ee,children:l.jsxs(v0,{className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl",children:[l.jsxs(x0,{children:[l.jsx(k0,{children:r("agent.create.modelGenerate")}),l.jsx(ub,{children:r("agent.create.modelGenerate.description")})]}),vn?l.jsx(yl,{tone:"error",noticeKey:vn,closeLabel:r("common.close"),onDismiss:()=>ge(null),children:vn}):null,l.jsxs(H1,{children:[l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"agent-generation-requirements",children:r("agent.create.describeAgent")}),l.jsx(Op,{id:"agent-generation-requirements",value:le,onChange:pe=>te(pe.target.value),placeholder:r("agent.create.qwenPlaceholder"),rows:4}),l.jsx(tu,{children:r("agent.create.qwenHint")})]}),l.jsxs($i,{children:[l.jsx(EU,{htmlFor:"agent-generated-description",label:r("agent.create.generatedDescription"),active:$e.has("description"),disabled:!le.trim(),onGenerate:()=>void Qe("description"),onCancel:()=>Je("description"),t:r}),l.jsx(Op,{id:"agent-generated-description",value:z,onChange:pe=>X(pe.target.value),rows:3,readOnly:$e.has("description")})]}),l.jsxs($i,{children:[l.jsx(EU,{htmlFor:"agent-generated-prompt",label:r("agent.create.generatedSystemPrompt"),active:$e.has("systemPrompt"),disabled:!le.trim(),onGenerate:()=>void Qe("systemPrompt"),onCancel:()=>Je("systemPrompt"),t:r}),l.jsx(Op,{id:"agent-generated-prompt",value:fe,onChange:pe=>xe(pe.target.value),rows:10,readOnly:$e.has("systemPrompt"),className:"min-h-64 max-h-64 overflow-y-auto"})]})]}),l.jsxs(w0,{children:[l.jsx(An,{type:"button",variant:"outline",onClick:()=>Ee(!1),children:r("common.cancel")}),l.jsx(An,{type:"button",onClick:cn,disabled:$e.size>0||!z.trim()||!fe.trim(),children:r("agent.create.useGenerated")})]})]})})]})}function EU({htmlFor:e,label:t,active:n,disabled:s,onGenerate:r,onCancel:i,t:o}){return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(vo,{htmlFor:e,children:t}),n?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(li,{className:"size-3"}),o("agent.create.generatingPrompt")]}),l.jsx(An,{type:"button",variant:"outline",size:"sm",className:"ml-auto",onClick:i,children:o("common.cancel")})]}):l.jsxs(An,{type:"button",variant:"outline",size:"sm",className:"ml-auto",disabled:s,onClick:r,children:[l.jsx(N1,{"data-icon":"inline-start"}),o("agent.create.generate")]})]})}function AU({idPrefix:e,selection:t,onSelectionChange:n,builtInTools:s,mcpServers:r,mcpTools:i,t:o}){const[a,c]=f.useState("builtin"),[u,d]=f.useState(""),h=r.filter(g=>!g.disabled),m=a==="builtin"?s:i[u]??[],p=new Map;for(const g of s)p.set(g.name,g.displayName||g.name);for(const[g,b]of Object.entries(i))for(const x of b)p.set(x.name,`${g} / ${x.serverToolName||x.name}`);return l.jsxs("div",{className:"grid gap-3 rounded-lg border p-4",children:[l.jsxs("div",{className:`grid gap-3 ${a==="mcp"?"sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]":"sm:grid-cols-[minmax(0,1fr)]"}`,children:[l.jsxs(kl,{value:a,onValueChange:g=>{c(g),d("")},children:[l.jsx(Sl,{id:`${e}-kind`,className:"w-full","aria-label":o("agent.create.tools.type"),children:l.jsx(_l,{})}),l.jsxs(Cl,{children:[l.jsx(bi,{value:"builtin",children:o("agent.create.tools.builtin")}),l.jsx(bi,{value:"mcp",children:o("agent.create.tools.mcp")})]})]}),a==="mcp"?l.jsxs(kl,{value:u||void 0,onValueChange:d,children:[l.jsx(Sl,{id:`${e}-server`,className:"w-full","aria-label":o("agent.create.tools.selectServer"),children:l.jsx(_l,{placeholder:o("agent.create.tools.selectServer")})}),l.jsx(Cl,{children:h.map(g=>{var b;return l.jsxs(bi,{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]}),l.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:m.length>0?l.jsx(Ad,{delayDuration:300,children:l.jsx("div",{className:"divide-y",children:m.map(g=>{const b=a==="builtin"?g.displayName||g.name:g.serverToolName||g.name;return l.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-3 py-2.5 hover:bg-accent/30",children:[l.jsx(z4,{id:`${e}-${g.name}`,checked:t.has(g.name),onCheckedChange:x=>n(WN(t,g.name,x===!0))}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-sm font-medium",children:b}),g.description?l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:l.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:g.description})}),l.jsx(Md,{className:"max-w-sm whitespace-normal",children:g.description})]}):null]})]},g.name)})})}):l.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("agent.create.tools.empty")})}),t.size>0?l.jsx("div",{className:"flex flex-wrap gap-2",children:[...t].map(g=>l.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:[l.jsx("span",{className:"truncate",children:p.get(g)||g}),l.jsx("button",{type:"button",className:"rounded-sm text-muted-foreground hover:text-foreground","aria-label":o("agent.create.removeSelection",{name:g}),onClick:()=>n(WN(t,g,!1)),children:l.jsx(Tw,{className:"size-3.5"})})]},g))}):l.jsx("div",{className:"text-sm text-muted-foreground",children:o("agent.create.tools.noneSelected")})]})}function $it({selection:e,onSelectionChange:t,servers:n,t:s}){return l.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border",children:n.length>0?l.jsx("div",{className:"divide-y",children:n.map(r=>l.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-accent/30",children:[l.jsx(z4,{id:`agent-mcp-server-${r.name}`,checked:e.has(r.name),onCheckedChange:i=>t(WN(e,r.name,i===!0))}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.name}),r.mcpStatus?l.jsx(mo,{variant:"secondary",className:r.mcpStatus==="connected"?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:s(`mcp.status.${r.mcpStatus}`)}):null]},r.name))}):l.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:s("agent.create.mcpServers.empty")})})}function jU(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.${e}`:`mode.listLabel.${e}`)}function Bit(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.desc.${e}`:`mode.desc.${e}`)}function NU({label:e}){return l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(li,{}),e]})}function zit({error:e}){return l.jsx("div",{className:"text-sm text-destructive",children:e==null?void 0:e.message})}function S3({...e}){return l.jsx(G6e,{"data-slot":"alert-dialog",...e})}function Fit({container:e,...t}){const n=Hc();return l.jsx(K6e,{"data-slot":"alert-dialog-portal",container:e??n??void 0,...t})}const Hit=f.forwardRef(function({className:t,...n},s){return l.jsx(Y6e,{ref:s,"data-slot":"alert-dialog-overlay",className:Qt("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})}),C3=f.forwardRef(function({className:t,size:n="default",...s},r){return l.jsxs(Fit,{children:[l.jsx(Hit,{}),l.jsx(X6e,{ref:r,"data-slot":"alert-dialog-content","data-size":n,className:Qt("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),...s})]})});function T3({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:Qt("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 E3({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:Qt("-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 A3({className:e,...t}){return l.jsx(Z6e,{"data-slot":"alert-dialog-title",className:Qt("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 j3({className:e,...t}){return l.jsx(e8e,{"data-slot":"alert-dialog-description",className:Qt("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function vD({className:e,variant:t="default",size:n="default",...s}){return l.jsx(An,{variant:t,size:n,asChild:!0,children:l.jsx(Q6e,{"data-slot":"alert-dialog-action",className:Qt(e),...s})})}function N3({className:e,variant:t="outline",size:n="default",...s}){return l.jsx(An,{variant:t,size:n,asChild:!0,children:l.jsx(J6e,{"data-slot":"alert-dialog-cancel",className:Qt(e),...s})})}function Pm({className:e,...t}){return l.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Qt(e),...t})}function Om({className:e,...t}){return l.jsx("ol",{"data-slot":"breadcrumb-list",className:Qt("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function Ni({className:e,...t}){return l.jsx("li",{"data-slot":"breadcrumb-item",className:Qt("inline-flex items-center gap-1",e),...t})}function id({asChild:e,className:t,...n}){const s=e?SI:"a";return l.jsx(s,{"data-slot":"breadcrumb-link",className:Qt("transition-colors hover:text-foreground",t),...n})}function za({className:e,...t}){return l.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Qt("font-normal text-foreground",e),...t})}function od({children:e,className:t,...n}){return l.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:Qt("[&>svg]:size-3.5",t),...n,children:e??l.jsx(cC,{})})}function So({className:e,size:t="default",...n}){return l.jsx("div",{"data-slot":"card","data-size":t,className:Qt("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 ml({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:Qt("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 pl({className:e,...t}){return l.jsx("div",{"data-slot":"card-title",className:Qt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function iu({className:e,...t}){return l.jsx("div",{"data-slot":"card-description",className:Qt("text-sm text-muted-foreground",e),...t})}function qit({className:e,...t}){return l.jsx("div",{"data-slot":"card-action",className:Qt("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function Gl({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:Qt("px-(--card-spacing)",e),...t})}function ud({className:e,...t}){return l.jsx("div",{"data-slot":"empty",className:Qt("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 dd({className:e,...t}){return l.jsx("div",{"data-slot":"empty-header",className:Qt("flex max-w-sm flex-col items-center gap-2",e),...t})}const Uit=U0("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 hd({className:e,variant:t="default",...n}){return l.jsx("div",{"data-slot":"empty-icon","data-variant":t,className:Qt(Uit({variant:t,className:e})),...n})}function fd({className:e,...t}){return l.jsx("div",{"data-slot":"empty-title",className:Qt("text-sm font-medium tracking-tight",e),...t})}function tk({className:e,...t}){return l.jsx("div",{"data-slot":"empty-description",className:Qt("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Wit({className:e,...t}){return l.jsx("div",{"data-slot":"empty-content",className:Qt("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",e),...t})}const Vit=U0("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"}}),Fae=f.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function xD({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:i,...o}){return l.jsx(tR,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:Qt("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:l.jsx(Fae.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:i})})}function wD({className:e,children:t,variant:n="default",size:s="default",...r}){const i=f.useContext(Fae);return l.jsx(Hne,{"data-slot":"toggle-group-item","data-variant":i.variant||n,"data-size":i.size||s,"data-spacing":i.spacing,className:Qt("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",Vit({variant:i.variant||n,size:i.size||s}),e),...r,children:t})}const Git="_agentGrid_bui90_1",Kit={agentGrid:Git};function j7(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 Yit(e,t){return e?e==="inherit"||e==="bubble"?t(`agent.approval.${e}`):Mb.some(n=>n===e)?t(`mode.listLabel.${e}`):e:"—"}function Ap({label:e,value:t}){return l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function MU(e){return e?JSON.stringify(e,null,2):"—"}function Xit(e){return e.replace(/\r\n?/g,`
`).replace(new RegExp("(?<!\\n)\\n(?!\\n|[ \\t]*(?:#{1,6}\\s|[-*+]\\s|\\d+\\.\\s|```|>\\s|\\*\\*[^*\\n]+\\*\\*:))","g")," ")}function Hae({onClose:e,embedded:t,initialCreateScope:n}){var le,te;const{t:s}=at(),{agents:r,loading:i,error:o,reload:a,getAgent:c,deleteAgent:u}=UY({autoLoad:!0}),[d,h]=f.useState(""),[m,p]=f.useState("all"),[g,b]=f.useState(null),[x,y]=f.useState(null),[v,w]=f.useState(!1),[k,T]=f.useState(!1),[C,_]=f.useState(!1),[S,D]=f.useState(()=>!!n),[E,B]=f.useState(!1),[I,L]=f.useState(null),[O,A]=f.useState(null),[$,q]=f.useState(null),[U,H]=f.useState(!1),M=f.useMemo(()=>_it(r,d,m),[r,d,m]),ee=f.useMemo(()=>kU(g,r),[r,g]),V=(g==null?void 0:g.name)??null;f.useEffect(()=>{b(z=>kU(z,r))},[r]),f.useEffect(()=>{t==null||t.onDetailChange(!!(V||S||E))},[S,E,t,V]),f.useEffect(()=>{if(!g){y(null),q(null);return}let z=!0;return y(null),q(null),w(!0),c(g.name,SU(g.level)).then(X=>{z&&y(X)}).catch(X=>{z&&q(X instanceof Error?X.message:String(X))}).finally(()=>{z&&w(!1)}),()=>{z=!1}},[g,c]),f.useEffect(()=>{H(!1)},[o]),f.useEffect(()=>{n&&D(!0)},[n]);function R(){D(!1),B(!1),b(null),y(null),A(null),a()}async function re(){if(!x||!ee)return;const z=SU(ee.level);if(z){T(!0);try{await u(ee.name,z),_(!1),b(null),y(null),L(s("agent.deleted",{name:x.name})),await a()}catch(X){_(!1),A(X instanceof Error?X.message:String(X))}finally{T(!1)}}}const Z=[{value:"all",label:s("skills.filter.all")},{value:"project",label:s("agent.level.project")},{value:"user",label:s("agent.level.user")},{value:"builtin",label:s("agent.level.builtin")},{value:"extension",label:s("agent.level.extension")}],K=E?s("agent.edit"):V??(S?s("agent.create.button"):null),Y=l.jsx(Pm,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Om,{className:"text-base",children:[l.jsx(Ni,{children:l.jsx(An,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(aC,{})})}),l.jsx(Ni,{children:K?l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",onClick:R,children:s("agents.title")})}):l.jsx(za,{children:s("agents.title")})}),K?l.jsx(od,{}):null,K?l.jsx(Ni,{children:l.jsx(za,{children:K})}):null]})}),ae=t?K?l.jsx(Pm,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Om,{className:"h-8 text-sm",children:[l.jsx(Ni,{children:l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{R(),t.onDetailChange(!1)},children:s("agents.title")})})}),l.jsx(od,{}),l.jsx(Ni,{children:l.jsx(za,{children:K})})]})}):null:Y;if(S)return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,l.jsx(TU,{initialScope:n??"global",onCancel:R,onCreated:z=>{D(!1),L(s("agent.created",{name:z})),a()}})]});if(E&&x)return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,l.jsx(TU,{agent:x,onCancel:()=>B(!1),onCreated:z=>{B(!1),b(null),y(null),L(s("agent.updated",{name:z})),a()}})]});if(V&&x){const z=Sit(x),X=!x.tools||x.tools.length===0||x.tools.includes("*")?s("agent.create.tools.all"):x.tools.join(", "),fe=((le=x.disallowedTools)==null?void 0:le.join(", "))||"—";return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(Vv,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-xl font-semibold text-balance",children:x.name}),l.jsx(mo,{variant:"outline",children:j7(x.level,s)}),_U(x,r)?l.jsx(mo,{variant:"secondary",children:s("agent.overriddenBadge")}):null]})}),z?l.jsxs(mh,{children:[l.jsx(ph,{asChild:!0,children:l.jsx(An,{variant:"ghost",size:"icon",disabled:k,"aria-label":s("agent.chooseAction",{name:x.name}),children:k?l.jsx(li,{}):l.jsx(qf,{})})}),l.jsx(gh,{align:"end",onCloseAutoFocus:xe=>xe.preventDefault(),children:l.jsxs(dm,{children:[l.jsxs(Gi,{onSelect:()=>B(!0),children:[l.jsx(i4,{"data-icon":"inline-start"}),s("agent.edit")]}),l.jsxs(Gi,{variant:"destructive",disabled:k,onSelect:()=>_(!0),children:[l.jsx(Wp,{"data-icon":"inline-start"}),s("agent.delete")]})]})})]}):null]}),O?l.jsx(yl,{tone:"error",noticeKey:O,closeLabel:s("common.close"),onDismiss:()=>A(null),children:O}):null,l.jsxs(Q0,{defaultValue:"overview",children:[l.jsxs(J0,{className:"max-w-full overflow-x-auto",children:[l.jsx(Fr,{value:"overview",children:s("agent.detail.overview")}),l.jsx(Fr,{value:"prompt",children:s("agent.detail.systemPrompt")}),l.jsx(Fr,{value:"tools",children:s("agent.detail.tools")}),l.jsx(Fr,{value:"mcp",children:s("agent.detail.mcp")}),l.jsx(Fr,{value:"hooks",children:s("agent.detail.hooks")})]}),l.jsx(gi,{value:"overview",className:"pt-4",children:l.jsxs(So,{children:[l.jsxs(ml,{children:[l.jsx(pl,{className:"text-sm",children:s("agent.descriptionLabel")}),l.jsx(iu,{children:x.description||"—"})]}),l.jsxs(Gl,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(Ap,{label:s("agent.filePathLabel"),value:x.filePath||"—"}),l.jsx(Ap,{label:s("agent.modelLabel"),value:x.model||"—"}),l.jsx(Ap,{label:s("agent.level.label"),value:j7(x.level,s)}),l.jsx(Ap,{label:s("agent.create.approvalMode"),value:Yit(x.approvalMode||x.permissionMode,s)}),l.jsx(Ap,{label:s("agent.create.maxTurns"),value:((te=x.maxTurns)==null?void 0:te.toString())||"—"}),l.jsx(Ap,{label:s("agent.create.color"),value:x.color||"—"})]})]})}),l.jsx(gi,{value:"prompt",className:"pt-4",children:l.jsx(So,{children:l.jsx(Gl,{children:l.jsx("div",{className:"max-h-[60vh] w-full overflow-auto break-words whitespace-pre-line text-sm leading-6 text-muted-foreground",children:x.systemPrompt?Xit(x.systemPrompt):"—"})})})}),l.jsx(gi,{value:"tools",className:"pt-4",children:l.jsxs(So,{children:[l.jsxs(ml,{children:[l.jsx(pl,{className:"text-sm",children:s("agent.toolsLabel")}),l.jsx(iu,{children:X})]}),l.jsx(Gl,{className:"flex flex-col gap-6",children:l.jsx(Ap,{label:s("agent.create.disallowedTools"),value:fe})})]})}),l.jsx(gi,{value:"mcp",className:"pt-4",children:l.jsxs(So,{children:[l.jsx(ml,{children:l.jsx(pl,{className:"text-sm",children:s("agent.create.mcpServers")})}),l.jsx(Gl,{children:l.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:MU(x.mcpServers)})})]})}),l.jsx(gi,{value:"hooks",className:"pt-4",children:l.jsxs(So,{children:[l.jsx(ml,{children:l.jsx(pl,{className:"text-sm",children:s("agent.detail.hooks")})}),l.jsx(Gl,{children:l.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:MU(x.hooks)})})]})})]}),l.jsx(S3,{open:C,onOpenChange:xe=>{!xe&&k||_(xe)},children:l.jsxs(C3,{children:[l.jsxs(T3,{children:[l.jsx(A3,{children:s("agent.delete.title",{name:x.name})}),l.jsx(j3,{children:s("agent.delete.confirm",{name:x.name})})]}),l.jsxs(E3,{children:[l.jsx(N3,{disabled:k,children:s("common.cancel")}),l.jsxs(vD,{variant:"destructive",disabled:k,onClick:xe=>{xe.preventDefault(),re()},children:[k?l.jsx(li,{"data-icon":"inline-start"}):null,s("agent.delete.yes")]})]})]})})]})]})}return V&&v?l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(li,{className:"size-6"})})]}):V&&$?l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,l.jsx(yl,{tone:"error",noticeKey:$,closeLabel:s("common.close"),onDismiss:R,children:$})]}):l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold text-balance",children:s("agents.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("agent.count",{count:r.length})})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(An,{variant:"outline",disabled:i,onClick:()=>void a(),children:[i?l.jsx(li,{"data-icon":"inline-start"}):l.jsx(uC,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(An,{onClick:()=>D(!0),children:[l.jsx(eb,{"data-icon":"inline-start"}),s("agent.create.button")]})]})]}),o&&!U?l.jsx(yl,{tone:"error",noticeKey:o.message,closeLabel:s("common.close"),onDismiss:()=>H(!0),children:o.message}):null,I?l.jsx(yl,{tone:"success",noticeKey:I,closeLabel:s("common.close"),onDismiss:()=>L(null),children:I}):null,l.jsxs("div",{className:"relative",children:[l.jsx(lu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(qr,{name:"agent-search","aria-label":s("common.search"),autoComplete:"off",value:d,onChange:z=>h(z.target.value),placeholder:s("common.search"),className:"pl-9"})]}),l.jsx(xD,{type:"single",value:m,onValueChange:z=>{z&&p(z)},variant:"outline",size:"sm","aria-label":s("agent.level.filter"),children:Z.map(z=>l.jsx(wD,{value:z.value,children:z.label},z.value))}),M.length?l.jsx("div",{className:Kit.agentGrid,"data-column-count":Math.min(M.length,4),children:M.map(z=>l.jsx(So,{size:"sm",role:"button",tabIndex:0,"aria-label":z.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>{L(null),A(null),b({name:z.name,level:z.level})},onKeyDown:X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),L(null),A(null),b({name:z.name,level:z.level}))},children:l.jsx(ml,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(Vv,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(pl,{className:"min-w-0 flex-1 truncate",children:z.name}),l.jsxs("div",{className:"flex shrink-0 gap-1",children:[l.jsx(mo,{variant:"outline",className:"text-[10px]",children:j7(z.level,s)}),_U(z,r)?l.jsx(mo,{variant:"secondary",className:"text-[10px]",children:s("agent.overriddenBadge")}):null]})]}),l.jsx(iu,{className:"mt-1 min-w-0 text-xs",children:l.jsx(Ad,{delayDuration:300,children:l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:z.description||"—"})}),l.jsx(Md,{children:z.description||"—"})]})})})]})]})})},`${z.level}:${z.name}`))}):l.jsx(ud,{className:"border",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:d||m!=="all"?l.jsx(lu,{}):l.jsx(Vv,{})}),l.jsx(fd,{children:s(d||m!=="all"?"agent.noMatches":"agent.empty")})]})})]})]})}const Qit="_page_1np31_1",Jit="_tabs_1np31_11",Zit="_memoryCard_1np31_19",eot="_memoryCardActive_1np31_35",tot="_memoryTitle_1np31_44",not="_detailPath_1np31_48",sot="_status_1np31_49",rot="_actionButton_1np31_54",iot="_primaryButton_1np31_55",oot="_secondaryButton_1np31_56",aot="_detail_1np31_48",lot="_detailHeader_1np31_79",cot="_detailTitleWrap_1np31_87",uot="_actions_1np31_91",dot="_content_1np31_105",hot="_editor_1np31_106",fot="_editorFooter_1np31_127",Ko={page:Qit,tabs:Jit,memoryCard:Zit,memoryCardActive:eot,memoryTitle:tot,detailPath:not,status:sot,actionButton:rot,primaryButton:iot,secondaryButton:oot,detail:aot,detailHeader:lot,detailTitleWrap:cot,actions:uot,content:dot,editor:hot,editorFooter:fot};function IU(e,t){return e.find(n=>n.scope===t)}function RU(e,t){return t(e==="global"?"memory.global":"memory.project")}function mot({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:s}){var M,ee;const{t:r}=at(),{files:i,loading:o,error:a,readFile:c,reload:u,writeMemory:d}=H0e({autoLoad:!0}),h=f.useRef(null),m=f.useRef(0),[p,g]=f.useState("workspace"),[b,x]=f.useState("view"),[y,v]=f.useState(""),[w,k]=f.useState(""),[T,C]=f.useState(!1),[_,S]=f.useState(!1),[D,E]=f.useState(null),B=f.useRef(0),I=f.useMemo(()=>{const V=IU(i,"global"),R=IU(i,"workspace");return[{scope:"workspace",title:r("memory.project"),description:r("memory.project.desc"),fallbackPath:"QWEN.md",file:R},{scope:"global",title:r("memory.global"),description:r("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:V}]},[i,r]),L=I.find(V=>V.scope===p)??I[0],O=f.useCallback((V,R)=>{const re=++m.current;if(x(R),E(null),v(""),k(""),!(V!=null&&V.file)){R==="edit"&&requestAnimationFrame(()=>{var Z;return(Z=h.current)==null?void 0:Z.focus()});return}C(!0),c(V.file.path).then(Z=>{re===m.current&&(v(Z.content),k(Z.content),Z.truncated&&E(r("memory.fileTruncated")),requestAnimationFrame(()=>{var K;return(K=h.current)==null?void 0:K.focus()}))}).catch(Z=>{if(re!==m.current)return;const K=Z instanceof Error?Z.message:String(Z);E(K),V.scope!=="global"&&(s==null||s(K,"error"))}).finally(()=>{re===m.current&&C(!1)})},[s,c,r]);f.useEffect(()=>{L&&O(L,b)},[(M=L==null?void 0:L.file)==null?void 0:M.path,L==null?void 0:L.scope]),f.useEffect(()=>{a&&E(a.message)},[a]),f.useEffect(()=>{e<=0||u().then(()=>E(r("memory.refreshed"))).catch(V=>{const R=V instanceof Error?V.message:String(V);E(R),s==null||s(R,"error")})},[s,e,u,r]),f.useEffect(()=>{if(t<=0||B.current===t)return;B.current=t;const V=n==="global"?"global":"workspace";g(V);const R=I.find(re=>re.scope===V);O(R,"edit")},[n,t,I,O]);const A=V=>{g(V.scope),O(V,"view")},$=()=>{L&&O(L,"edit")},q=()=>{if(L){if(!w.trim()){E(r("memory.contentEmpty"));return}S(!0),E(null),d({scope:L.scope,mode:"replace",content:w}).then(V=>{const R=r("memory.saved",{scope:RU(L.scope,r),bytes:V.bytesWritten,path:V.filePath});v(w),x("view"),E(R),s==null||s(R,"status"),u().catch(()=>{})}).catch(V=>{const R=V instanceof Error?V.message:String(V);E(R),s==null||s(R,"error")}).finally(()=>S(!1))}},U=((ee=L==null?void 0:L.file)==null?void 0:ee.path)??(L==null?void 0:L.fallbackPath)??"",H=D??(o?r("memory.loading"):null);return l.jsxs("div",{className:Ko.page,children:[l.jsx("nav",{className:Ko.tabs,"aria-label":r("memory.menu"),children:I.map(V=>{const R=V.scope===p;return l.jsx("button",{type:"button",className:`${Ko.memoryCard} ${R?Ko.memoryCardActive:""}`,onClick:()=>A(V),children:l.jsx("span",{className:Ko.memoryTitle,children:V.title})},V.scope)})}),l.jsxs("section",{className:Ko.detail,children:[l.jsxs("header",{className:Ko.detailHeader,children:[l.jsx("div",{className:Ko.detailTitleWrap,children:l.jsx("div",{className:Ko.detailPath,children:U})}),l.jsx("div",{className:Ko.actions,children:l.jsx("button",{type:"button",className:Ko.actionButton,onClick:$,children:r("settings.action.edit")})})]}),H&&l.jsx("div",{className:Ko.status,children:H}),b==="edit"?l.jsxs(l.Fragment,{children:[l.jsx("textarea",{ref:h,className:Ko.editor,value:w,disabled:_||T,onChange:V=>k(V.target.value),placeholder:r("memory.placeholder",{scope:L?RU(L.scope,r):""})}),l.jsxs("div",{className:Ko.editorFooter,children:[l.jsx("button",{type:"button",className:Ko.secondaryButton,disabled:_,onClick:()=>{k(y),x("view")},children:r("common.cancel")}),l.jsx("button",{type:"button",className:Ko.primaryButton,disabled:_||T,onClick:q,children:r(_?"memory.saving":"memory.save")})]})]}):l.jsx("pre",{className:Ko.content,children:T?r("memory.loadingFile"):y||r("memory.noFiles")})]})]})}const pot="_panel_cxp6w_1",got="_steps_cxp6w_10",bot="_stepPill_cxp6w_18",yot="_stepPillActive_cxp6w_29",vot="_stepPillDone_cxp6w_34",xot="_stepNumber_cxp6w_38",wot="_stepLabel_cxp6w_49",kot="_body_cxp6w_55",_ot="_text_cxp6w_59",Sot="_muted_cxp6w_64",Cot="_options_cxp6w_68",Tot="_option_cxp6w_68",Eot="_optionActive_cxp6w_90",Aot="_label_cxp6w_94",jot="_optionText_cxp6w_98",Not="_description_cxp6w_112",Mot="_input_cxp6w_119",Iot="_preview_cxp6w_135",Rot="_error_cxp6w_146",Dot="_link_cxp6w_150",Lot="_terms_cxp6w_161",Pot="_actions_cxp6w_169",Oot="_actionButton_cxp6w_177",br={panel:pot,steps:got,stepPill:bot,stepPillActive:yot,stepPillDone:vot,stepNumber:xot,stepLabel:wot,body:kot,text:_ot,muted:Sot,options:Cot,option:Tot,optionActive:Eot,label:Aot,optionText:jot,description:Not,input:Mot,preview:Iot,error:Rot,link:Dot,terms:Lot,actions:Pot,actionButton:Oot};function $ot(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 ev(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function DU(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function Bot(e,t,n){var s;return e==="protocol"?n("auth.step.protocol"):e==="baseUrl"?((s=t.uiLabels)==null?void 0:s.baseUrlStepTitle)??n("auth.step.baseUrl"):n(e==="apiKey"?"auth.step.apiKey":e==="models"?"auth.step.models":"auth.step.advanced")}function zot(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 N7(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function Fot({onMessage:e,onClose:t}){const{t:n}=at(),s=Vo(),[r,i]=f.useState("groups"),[o,a]=f.useState(0),[c,u]=f.useState(0),[d,h]=f.useState("providers"),[m,p]=f.useState(0),[g,b]=f.useState(),[x,y]=f.useState("alibaba"),[v,w]=f.useState(null),[k,T]=f.useState("openai"),[C,_]=f.useState(""),[S,D]=f.useState(""),[E,B]=f.useState(""),[I,L]=f.useState(!1),[O,A]=f.useState(!1),[$,q]=f.useState(!0),[U,H]=f.useState(!0),[M,ee]=f.useState(!1),[V,R]=f.useState(!1),[re,Z]=f.useState(""),[K,Y]=f.useState(!0),[ae,le]=f.useState(!1),[te,z]=f.useState(null);f.useEffect(()=>{s.getAuthProviders().then(Ue=>{b(Ue),Y(!1)}).catch(Ue=>{z(Ue instanceof Error?Ue.message:String(Ue)),Y(!1)})},[s]);const X=f.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),fe=f.useMemo(()=>{var De;return(((De=X.find(Re=>Re.id===x))==null?void 0:De.providerIds)??[]).map(Re=>g==null?void 0:g.providers.find(be=>be.id===Re)).filter(Re=>!!Re)},[g,x,X]),xe=f.useMemo(()=>(v==null?void 0:v.steps)??[],[v==null?void 0:v.steps]),ie=xe[m],Ce=(v==null?void 0:v.showAdvancedConfig)===!0,Ke=f.useMemo(()=>O?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[O]),ut=Ke.indexOf("context"),Et=ie==="apiKey"||ie==="models"||ie==="baseUrl"&&!Array.isArray(v==null?void 0:v.baseUrl),[st,xt]=f.useState(0),He=f.useCallback((Ue,De="providers")=>{var be,Ie;w(Ue),h(De);const Re=((be=Ue.protocolOptions)==null?void 0:be[0])??Ue.protocol;T(Re),typeof Ue.baseUrl=="string"?_(Ue.baseUrl):Array.isArray(Ue.baseUrl)?_(((Ie=Ue.baseUrl[0])==null?void 0:Ie.url)??""):_(ev(Re)),D(""),B(DU(Ue)),L(!1),A(!1),q(!0),H(!0),ee(!1),R(!1),Z(""),p(0),xt(0),z(null),i(Ue.steps.length>0?"step":"review")},[]),pn=f.useCallback(()=>{if(z(null),r==="groups"){t();return}if(r==="providers"){i("groups");return}if(r==="review"){if(xe.length===0){i(d);return}i("step"),p(Math.max(0,xe.length-1));return}if(m>0){p(Ue=>Ue-1),xt(0);return}i(d)},[t,d,m,xe.length,r]),Yt=f.useCallback(()=>{if(!v||ae)return;le(!0),z(null);const Ue=Number(re);s.installAuthProvider({providerId:v.id,protocol:k,baseUrl:C,apiKey:S,modelIds:N7(E),advancedConfig:I||O||Number.isFinite(Ue)&&Ue>0?{...I?{enableThinking:!0}:{},...O?{multimodal:{...$?{image:!0}:{},...U?{video:!0}:{},...M?{audio:!0}:{},...V?{pdf:!0}:{}}}:{},...Number.isFinite(Ue)&&Ue>0?{contextWindowSize:Ue}:{}}:void 0}).then(De=>{e(De.message),t()}).catch(De=>{const Re=De instanceof Error?De.message:String(De);z(Re),e(Re,"error")}).finally(()=>le(!1))},[S,C,re,O,M,$,V,U,E,t,e,k,v,ae,I,s]),It=f.useCallback(()=>{if(v){if(ie==="baseUrl"){const Ue=C.trim()||ev(k);if(!Ue){z(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(Ue)){z(n("auth.baseUrlInvalid"));return}C.trim()||_(Ue)}if(ie==="apiKey"&&S.trim().length===0){z(n("auth.apiKeyRequired"));return}if(ie==="models"&&N7(E).length===0){z(n("auth.modelsRequired"));return}z(null),m>=xe.length-1?Ce?i("review"):Yt():(p(Ue=>Ue+1),xt(0))}},[S,C,ie,E,k,v,Yt,Ce,m,xe.length,n]),me=f.useCallback(Ue=>{switch(Ue){case"thinking":L(De=>!De);return;case"modality":A(De=>!De);return;case"image":q(De=>!De);return;case"video":H(De=>!De);return;case"audio":ee(De=>!De);return;case"pdf":R(De=>!De);return;case"context":It();return;default:return}},[It]),$e=f.useCallback(()=>{if(r==="groups"){const Ue=X[o];if(!Ue)return;if(Ue.id==="custom"){const De=Ue.providerIds.map(Re=>g==null?void 0:g.providers.find(be=>be.id===Re)).find(Re=>!!Re);De&&He(De,"groups");return}y(Ue.id),u(0),i("providers");return}if(r==="providers"){const Ue=fe[c];Ue&&He(Ue,"providers");return}if(r==="review"){Yt();return}if(!(!v||!ie)){if(ie==="protocol"){const Ue=(v.protocolOptions??[v.protocol])[st];Ue&&(T(Ue),v.baseUrl||_(ev(Ue))),It();return}if(ie==="baseUrl"&&Array.isArray(v.baseUrl)){const Ue=v.baseUrl[st];Ue&&_(Ue.url),It();return}if(ie==="advancedConfig"){me(Ke[st]);return}It()}},[ie,g,It,o,X,st,v,c,fe,Yt,He,r,me,Ke]),yt=f.useCallback(Ue=>{if(r==="groups"){const De=X[Ue];if(!De)return;if(De.id==="custom"){const Re=De.providerIds.map(be=>g==null?void 0:g.providers.find(Ie=>Ie.id===be)).find(be=>!!be);Re&&He(Re,"groups");return}y(De.id),u(0),i("providers");return}if(r==="providers"){const De=fe[Ue];De&&He(De,"providers");return}if(!v||!ie){r==="review"&&Yt();return}if(ie==="protocol"){const De=(v.protocolOptions??[v.protocol])[Ue];De&&(T(De),v.baseUrl||_(ev(De))),It();return}if(ie==="baseUrl"&&Array.isArray(v.baseUrl)){const De=v.baseUrl[Ue];De&&_(De.url),It();return}ie==="advancedConfig"&&me(Ke[Ue])},[ie,g,It,X,me,Ke,v,fe,Yt,He,r]),Me=(Ue,De,Re)=>l.jsx("div",{className:br.options,children:Ue.map((be,Ie)=>l.jsx("button",{type:"button",className:`${br.option} ${De===Ie?br.optionActive:""}`,onClick:()=>{Re(Ie),yt(Ie)},children:l.jsxs("div",{className:br.optionText,children:[l.jsx("div",{className:br.label,children:be.label}),be.description&&l.jsx("div",{className:br.description,children:be.description})]})},be.value))}),Le=()=>{if(!v||!ie)return null;if(ie==="protocol"){const Re=v.protocolOptions??[v.protocol];return Me($ot(n).filter(be=>Re.includes(be.value)),st,xt)}if(ie==="baseUrl")return Array.isArray(v.baseUrl)?Me(v.baseUrl.map(Re=>({value:Re.url,label:Re.label,description:Re.url})),st,xt):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:br.text,children:n("auth.baseUrlPrompt")}),l.jsx("input",{className:br.input,value:C,placeholder:ev(k),onChange:Re=>{_(Re.target.value),z(null)},onKeyDown:Re=>{Re.key==="Enter"&&(Re.preventDefault(),Re.stopPropagation(),It())},autoFocus:!0}),v.documentationUrl&&l.jsx("a",{className:br.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(ie==="apiKey")return l.jsxs(l.Fragment,{children:[v.documentationUrl&&l.jsxs("a",{className:br.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",v.documentationUrl]}),l.jsx("input",{className:br.input,type:"password",value:S,placeholder:v.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:Re=>{D(Re.target.value),z(null)},onKeyDown:Re=>{Re.key==="Enter"&&(Re.preventDefault(),Re.stopPropagation(),It())},autoFocus:!0})]});if(ie==="models"){const Re=DU(v);return l.jsxs(l.Fragment,{children:[Re&&l.jsx("div",{className:br.muted,children:n("auth.modelsPrompt",{modelIds:Re})}),l.jsx("input",{className:br.input,value:E,placeholder:Re||n("auth.modelsPlaceholder"),onChange:be=>{B(be.target.value),z(null)},onKeyDown:be=>{be.key==="Enter"&&(be.preventDefault(),be.stopPropagation(),It())},autoFocus:!0})]})}const Ue=Re=>Re?"◉":"○",De=[{value:"thinking",label:`${Ue(I)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${Ue(O)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return O&&De.push({value:"image",label:`${Ue($)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${Ue(U)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${Ue(M)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${Ue(V)} ${n("auth.advanced.modalityPdf")}`}),De.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${re||"auto"}`,description:n("auth.advanced.contextDesc")}),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:br.text,children:n("auth.advanced.prompt")}),Me(De,st,xt),l.jsx("input",{className:br.input,value:re,placeholder:n("common.auto"),onChange:Re=>Z(Re.target.value.replace(/[^0-9]/g,"")),onFocus:()=>xt(ut),onKeyDown:Re=>{Re.key==="Enter"&&(Re.preventDefault(),Re.stopPropagation(),It())}})]})},vn=f.useMemo(()=>{if(!v)return"";const Ue=v.envKey??`${k.toUpperCase()}_API_KEY`,De=N7(E),Re={};if(I&&(Re.extra_body={enable_thinking:!0}),O){const ne={};$&&(ne.image=!0),U&&(ne.video=!0),M&&(ne.audio=!0),V&&(ne.pdf=!0),Object.keys(ne).length>0&&(Re.modalities=ne)}const be=Number(re);Number.isFinite(be)&&be>0&&(Re.contextWindowSize=be);const Ie=Object.keys(Re).length>0;return JSON.stringify({env:{[Ue]:zot(S,n)},modelProviders:{[k]:De.map(ne=>({id:ne,name:ne,baseUrl:C.trim(),envKey:Ue,...Ie?{generationConfig:Re}:{}}))},security:{auth:{selectedType:k}},model:{name:De[0]}},null,2)},[S,C,re,O,M,$,V,U,E,k,v,n,I]),ge=f.useMemo(()=>{const Ue=[n("auth.step.group"),n("auth.step.provider")];return v&&(Ue.push(...xe.map(De=>Bot(De,v,n))),Ce&&Ue.push(n("auth.review"))),Ue},[v,Ce,xe,n]),Rt=f.useMemo(()=>r==="groups"?1:r==="providers"?2:r==="step"?Math.min(3+m,ge.length):ge.length,[m,ge.length,r]),ht=K?l.jsx("div",{className:br.muted,children:n("common.loading")}):r==="groups"?l.jsxs(l.Fragment,{children:[Me(X.map(Ue=>({value:Ue.id,label:n(Ue.label),description:n(Ue.description)})),o,a),l.jsxs("div",{className:br.terms,children:[l.jsxs("div",{children:[n("auth.termsTitle"),":"]}),l.jsx("a",{className:br.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/"})]})]}):r==="providers"?Me(fe.map(Ue=>({value:Ue.id,label:n(Ue.label),description:n(Ue.description)})),c,u):r==="step"?Le():l.jsxs(l.Fragment,{children:[l.jsx("div",{className:br.text,children:n("auth.reviewText")}),l.jsx("div",{className:br.preview,children:vn})]}),gn=()=>{if(r==="review"){Yt();return}if(Et||ie==="advancedConfig"){It();return}$e()};return l.jsxs("div",{className:br.panel,children:[l.jsx("div",{className:br.steps,children:ge.map((Ue,De)=>{const Re=De+1;return l.jsxs("div",{className:`${br.stepPill} ${Re===Rt?br.stepPillActive:""} ${Re<Rt?br.stepPillDone:""}`,children:[l.jsx("span",{className:br.stepNumber,children:Re}),l.jsx("span",{className:br.stepLabel,children:Ue})]},`${Re}:${Ue}`)})}),l.jsx("div",{className:br.body,children:ht}),te&&l.jsx("div",{className:br.error,children:te}),l.jsxs("div",{className:br.actions,children:[l.jsx("button",{type:"button",className:br.actionButton,onClick:pn,disabled:r==="groups"||K||ae,children:n("common.previous")}),l.jsx("button",{type:"button",className:br.actionButton,onClick:gn,disabled:K||ae,children:n(r==="review"?ae?"auth.saving":"auth.save":"common.next")})]})]})}function Hot(e){return e.displayName||e.name}const qae="tools-list",LU=e=>`${qae}-opt-${e}`;function qot(){const{t:e}=at(),{status:t,tools:n,loading:s,error:r}=WY({autoLoad:!0}),[i,o]=f.useState(0),[a,c]=f.useState(null),[u,d]=f.useState(()=>new Set),h=f.useRef(null);f.useEffect(()=>{var b,x;r?c(r.message):(x=(b=t==null?void 0:t.errors)==null?void 0:b[0])!=null&&x.error?c(t.errors[0].error):t&&c(null)},[t,r]);const m=f.useCallback(b=>{d(x=>x.has(b.name)?new Set:new Set([b.name]))},[]);f.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),f.useEffect(()=>{var x;const b=(x=h.current)==null?void 0:x.children[i];b==null||b.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:p}=ep({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:b=>{const x=n[b];x!=null&&x.description&&m(x)}}),g=f.useMemo(()=>{if(!t)return"";const b=n.filter(x=>x.enabled).length;return e("tools.summary",{enabled:b,total:n.length})},[t,n,e]);return l.jsxs("div",{className:an("picker","picker-in-shell"),children:[g&&l.jsx("div",{className:an("picker-search"),children:l.jsx("span",{className:an("picker-search-hint"),children:g})}),(a||s)&&l.jsx("div",{className:an("picker-search"),children:l.jsx("span",{className:an("picker-search-hint"),children:a||e("tools.loading")})}),l.jsx("div",{className:an("picker-sep")}),l.jsxs("div",{id:qae,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?LU(i):void 0,className:an("picker-list",p?"picker-keyboard-only":void 0),ref:h,children:[!s&&n.length===0&&l.jsx("div",{className:an("picker-empty"),children:e("tools.empty")}),n.map((b,x)=>{const y=u.has(b.name),v=b.description??"";return l.jsxs("div",{id:LU(x),role:"option","aria-selected":!1,"aria-expanded":v?y:void 0,className:an("picker-item","picker-session-item","tools-picker-item",x===i?"selected":void 0,y?"tools-picker-item-expanded":void 0),onClick:()=>{o(x),b.description&&m(b)},onMouseMove:()=>o(x),children:[l.jsxs("div",{className:an("picker-item-row"),children:[l.jsx("span",{className:an("tools-item-icon"),"aria-hidden":"true"}),l.jsx("span",{className:an("picker-item-title"),children:Hot(b)}),l.jsx("span",{className:an("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?l.jsx("svg",{className:an("tools-item-chevron",y?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),y&&v&&l.jsx("div",{className:an("tools-desc-expanded"),children:l.jsx("div",{className:an("tools-desc-body"),children:v})})]},b.name)})]})]})}const Uot="_content_xihrz_1",Wot="_placeholder_xihrz_7",Vot="_fileList_xihrz_13",Got="_file_xihrz_13",Kot="_fileHeader_xihrz_25",Yot="_fileStats_xihrz_43",Xot="_statAdd_xihrz_51",Qot="_statDel_xihrz_55",Jot="_fileBinary_xihrz_59",Zot="_filePath_xihrz_63",eat="_fileOldPath_xihrz_71",tat="_fileTag_xihrz_75",nat="_fileBody_xihrz_85",sat="_filePlaceholder_xihrz_89",rat="_hiddenNote_xihrz_95",iat="_diffLines_xihrz_101",oat="_diffLine_xihrz_101",aat="_diffLineAdd_xihrz_113",lat="_diffLineDel_xihrz_117",cat="_diffLineContext_xihrz_121",uat="_diffLineMeta_xihrz_125",dat="_diffOldNo_xihrz_131",hat="_diffNewNo_xihrz_132",fat="_diffMarker_xihrz_143",mat="_diffContent_xihrz_159",tr={content:Uot,placeholder:Wot,fileList:Vot,file:Got,fileHeader:Kot,fileStats:Yot,statAdd:Xot,statDel:Qot,fileBinary:Jot,filePath:Zot,fileOldPath:eat,fileTag:tat,fileBody:nat,filePlaceholder:sat,hiddenNote:rat,diffLines:iat,diffLine:oat,diffLineAdd:aat,diffLineDel:lat,diffLineContext:cat,diffLineMeta:uat,diffOldNo:dat,diffNewNo:hat,diffMarker:fat,diffContent:mat},pat={add:tr.diffLineAdd,del:tr.diffLineDel,context:tr.diffLineContext,meta:tr.diffLineMeta};function gat(e){return e===zr.Light?"github-light-default":"github-dark-default"}async function bat(e,t,n){const{resolvedLang:s}=aR(dae(t));let r=null;if(s!=="text")try{r=await cZ(s)}catch{r=null}const i=[];for(const o of e){const a=[],c=[];for(const y of o.lines){const v=y[0],w=y.slice(1);v==="+"?a.push(w):v==="-"?c.push(w):v===" "&&(a.push(w),c.push(w))}const u=a.join(`
`),d=c.join(`
`);let h=null,m=null;if(r){const y=s;if(!dj(u))try{h=r.codeToTokens(u,{lang:y,theme:n}).tokens}catch{h=null}if(!dj(d))try{m=r.codeToTokens(d,{lang:y,theme:n}).tokens}catch{m=null}}let p=0,g=0,b=o.oldStart,x=o.newStart;for(const y of o.lines){const v=y[0],w=y.slice(1);v==="+"?(i.push({type:"add",oldNo:null,newNo:x,text:w,tokens:(h==null?void 0:h[p])??null}),p++,x++):v==="-"?(i.push({type:"del",oldNo:b,newNo:null,text:w,tokens:(m==null?void 0:m[g])??null}),g++,b++):v===" "?(i.push({type:"context",oldNo:b,newNo:x,text:w,tokens:(h==null?void 0:h[p])??null}),p++,g++,b++,x++):i.push({type:"meta",oldNo:null,newNo:null,text:y,tokens:null})}}return i}function yat(e){return!e.tokens||e.tokens.length===0?e.text:e.tokens.map((t,n)=>l.jsx("span",{style:t.color?{color:t.color}:void 0,children:t.content},n))}function vat({hunks:e,path:t}){const{t:n}=at(),s=Lb(),r=gat(s),[i,o]=f.useState(null),[a,c]=f.useState(!1);return f.useEffect(()=>{let u=!1;return o(null),c(!1),bat(e,t,r).then(d=>{u||o(d)}).catch(()=>{u||c(!0)}),()=>{u=!0}},[e,t,r]),a?l.jsx("div",{className:tr.filePlaceholder,children:n("gitDiff.fileError")}):i===null?l.jsx("div",{className:tr.filePlaceholder,children:n("gitDiff.loading")}):l.jsx("div",{className:tr.diffLines,children:(i??[]).map((u,d)=>l.jsxs("div",{className:`${tr.diffLine} ${pat[u.type]}`,children:[l.jsx("span",{className:tr.diffOldNo,children:u.oldNo??""}),l.jsx("span",{className:tr.diffNewNo,children:u.newNo??""}),l.jsx("span",{className:tr.diffMarker,children:u.type==="add"?"+":u.type==="del"?"-":u.type==="meta"?"":" "}),l.jsx("code",{className:tr.diffContent,children:yat(u)})]},d))})}function xat({workspaceCwd:e,file:t}){const{t:n}=at(),{client:s}=la(),[r,i]=f.useState(!1),[o,a]=f.useState(null),[c,u]=f.useState(!1),[d,h]=f.useState(!1),[m,p]=f.useState(!1),g=f.useRef(!1);f.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);const b=()=>{const y=!r;i(y),y&&o===null&&!d&&!t.isBinary&&(h(!0),p(!1),s.workspaceByCwd(e).workspaceGitDiffFile(t.path,t.oldPath).then(v=>{g.current||(a(v.hunks),u(v.truncated===!0))}).catch(()=>{g.current||p(!0)}).finally(()=>{g.current||h(!1)}))},x=mS(t.path);return l.jsxs("div",{className:tr.file,children:[l.jsxs("button",{type:"button",className:tr.fileHeader,onClick:b,"aria-expanded":r,"aria-label":n(r?"gitDiff.collapse":"gitDiff.expand",{path:t.oldPath?`${mS(t.oldPath)} → ${x}`:x}),children:[l.jsx("span",{className:tr.fileStats,children:t.isBinary?l.jsx("span",{className:tr.fileBinary,children:n("gitDiff.binary")}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:tr.statAdd,children:["+",t.added??0]}),l.jsxs("span",{className:tr.statDel,children:["-",t.removed??0]})]})}),l.jsxs("span",{className:tr.filePath,title:x,children:[t.oldPath?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:tr.fileOldPath,children:mS(t.oldPath)})," → "]}):null,x]}),t.isUntracked&&l.jsx("span",{className:tr.fileTag,children:n("gitDiff.untracked")}),t.isDeleted&&l.jsx("span",{className:tr.fileTag,children:n("gitDiff.deleted")})]}),r&&l.jsx("div",{className:tr.fileBody,children:t.isBinary?l.jsx("div",{className:tr.filePlaceholder,children:n("gitDiff.binary")}):d?l.jsx("div",{className:tr.filePlaceholder,children:n("gitDiff.loading")}):m?l.jsx("div",{className:tr.filePlaceholder,children:n("gitDiff.fileError")}):o&&o.length>0?l.jsxs(l.Fragment,{children:[l.jsx(vat,{hunks:o,path:t.path}),c&&l.jsx("div",{className:tr.filePlaceholder,role:"note",children:n("gitDiff.truncated")})]}):l.jsx("div",{className:tr.filePlaceholder,children:n("gitDiff.noDiff")})})]})}function wat({workspaceCwd:e,onSubtitleChange:t}){const{t:n}=at(),{client:s}=la(),[r,i]=f.useState(null),[o,a]=f.useState(!0),[c,u]=f.useState(!1);f.useEffect(()=>{let m=!1;return a(!0),u(!1),s.workspaceByCwd(e).workspaceGitDiff().then(p=>{m||i(p)}).catch(()=>{m||u(!0)}).finally(()=>{m||a(!1)}),()=>{m=!0}},[s,e]);const d=r&&r.available?n("gitDiff.summary",{count:r.filesCount,added:r.linesAdded,removed:r.linesRemoved}):void 0;f.useEffect(()=>{t==null||t(d)},[t,d]);let h;return o?h=l.jsx("div",{className:tr.placeholder,children:n("gitDiff.loading")}):c?h=l.jsx("div",{className:tr.placeholder,children:n("gitDiff.error")}):!r||!r.available?h=l.jsx("div",{className:tr.placeholder,children:n("gitDiff.unavailable")}):r.files.length===0?h=l.jsx("div",{className:tr.placeholder,children:n("gitDiff.empty")}):h=l.jsxs("div",{className:tr.fileList,children:[r.files.map(m=>l.jsx(xat,{workspaceCwd:e,file:m},`${e}:${m.path}`)),r.hiddenCount>0&&l.jsx("div",{className:tr.hiddenNote,children:n("gitDiff.hidden",{count:r.hiddenCount})})]}),l.jsx("div",{className:tr.content,children:h})}const kat="_content_18nyy_1",_at="_placeholder_18nyy_7",Sat="_commitList_18nyy_13",Cat="_commitRow_18nyy_18",Tat="_commitHeader_18nyy_22",Eat="_commitToggle_18nyy_32",Aat="_commitSha_18nyy_47",jat="_copyBtn_18nyy_54",Nat="_commitSubject_18nyy_78",Mat="_commitMeta_18nyy_86",Iat="_commitRefs_18nyy_93",Rat="_refTag_18nyy_99",Dat="_refHead_18nyy_109",Lat="_mergeIcon_18nyy_114",Pat="_commitDetail_18nyy_120",Oat="_commitBody_18nyy_126",$at="_fileStats_18nyy_134",Bat="_fileStatHeader_18nyy_140",zat="_fileStatRow_18nyy_146",Fat="_statNums_18nyy_154",Hat="_statAdd_18nyy_162",qat="_statDel_18nyy_166",Uat="_fileStatPath_18nyy_170",Wat="_fileBinary_18nyy_178",Vat="_hiddenNote_18nyy_182",Gat="_detailError_18nyy_188",Kat="_loadMore_18nyy_194",Qs={content:kat,placeholder:_at,commitList:Sat,commitRow:Cat,commitHeader:Tat,commitToggle:Eat,commitSha:Aat,copyBtn:jat,commitSubject:Nat,commitMeta:Mat,commitRefs:Iat,refTag:Rat,refHead:Dat,mergeIcon:Lat,commitDetail:Pat,commitBody:Oat,fileStats:$at,fileStatHeader:Bat,fileStatRow:zat,statNums:Fat,statAdd:Hat,statDel:qat,fileStatPath:Uat,fileBinary:Wat,hiddenNote:Vat,detailError:Gat,loadMore:Kat},PU=50;function Yat(e,t,n){const s=Math.max(0,Math.floor(t-e)),r=new Intl.RelativeTimeFormat(n,{numeric:"auto"});if(s<60)return r.format(0,"second");const i=Math.floor(s/60);if(i<60)return r.format(-i,"minute");const o=Math.floor(i/60);if(o<24)return r.format(-o,"hour");const a=Math.floor(o/24);if(a<7)return r.format(-a,"day");const c=Math.floor(a/7);if(c<5)return r.format(-c,"week");const u=Math.floor(a/30);return u<12?r.format(-u,"month"):r.format(-Math.max(1,Math.floor(a/365)),"year")}function Xat(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 Qat({entry:e,workspaceCwd:t,now:n}){const{client:s}=la(),{language:r,t:i}=at(),[o,a]=f.useState(!1),[c,u]=f.useState(null),[d,h]=f.useState(!1),[m,p]=f.useState(!1),[g,b]=f.useState(!1),x=f.useRef(!1),y=()=>{navigator.clipboard.writeText(e.sha).then(()=>{b(!0),setTimeout(()=>b(!1),1500)}).catch(()=>{})};f.useEffect(()=>(x.current=!1,()=>{x.current=!0}),[]);const v=()=>{const C=!o;a(C),C&&c===null&&!d&&(h(!0),p(!1),s.workspaceByCwd(t).workspaceGitCommitDetail(e.sha).then(_=>{x.current||u(_)}).catch(()=>{x.current||p(!0)}).finally(()=>{x.current||h(!1)}))},w=Xat(e.refs??""),k=e.parents.length>1;let T;return o&&(d?T=l.jsx("div",{className:Qs.commitDetail,children:l.jsx("span",{className:Qs.fileBinary,children:i("gitLog.loading")})}):m?T=l.jsx("div",{className:Qs.commitDetail,children:l.jsx("span",{className:Qs.detailError,children:i("gitLog.detailError")})}):c&&c.available?T=l.jsxs("div",{className:Qs.commitDetail,children:[c.body&&l.jsx("pre",{className:Qs.commitBody,children:c.body}),c.files&&l.jsxs("div",{className:Qs.fileStats,children:[l.jsx("div",{className:Qs.fileStatHeader,children:i("gitLog.files",{count:c.filesCount??0,added:c.linesAdded??0,removed:c.linesRemoved??0})}),c.files.map(C=>l.jsxs("div",{className:Qs.fileStatRow,children:[C.isBinary?l.jsx("span",{className:Qs.fileBinary,children:"~"}):l.jsxs("span",{className:Qs.statNums,children:[l.jsxs("span",{className:Qs.statAdd,children:["+",C.added]}),l.jsxs("span",{className:Qs.statDel,children:["−",C.removed]})]}),l.jsx("span",{className:Qs.fileStatPath,children:C.path})]},C.path)),(c.hiddenCount??0)>0&&l.jsx("div",{className:Qs.hiddenNote,children:i("gitLog.hidden",{count:c.hiddenCount??0})})]})]}):c&&!c.available&&(T=l.jsx("div",{className:Qs.commitDetail,children:l.jsx("span",{className:Qs.detailError,children:i("gitLog.detailError")})}))),l.jsxs("div",{className:Qs.commitRow,children:[l.jsxs("div",{className:Qs.commitHeader,children:[l.jsxs("button",{type:"button",className:Qs.commitToggle,onClick:v,"aria-expanded":o,children:[k&&l.jsx("span",{className:Qs.mergeIcon,children:"⎇"}),l.jsx("span",{className:Qs.commitSha,title:e.sha,children:e.shortSha}),l.jsx("span",{className:Qs.commitSubject,children:e.subject}),w.length>0&&l.jsx("span",{className:Qs.commitRefs,children:w.map(C=>l.jsx("span",{className:`${Qs.refTag}${C.isHead?` ${Qs.refHead}`:""}`,children:C.label},C.label))}),l.jsxs("span",{className:Qs.commitMeta,children:[e.authorName," · ",Yat(e.authorDate,n,r)]})]}),l.jsx("button",{type:"button",className:Qs.copyBtn,onClick:y,"aria-label":i("gitLog.copySha",{sha:e.shortSha}),children:g?l.jsx(lC,{size:12}):l.jsx(Lge,{size:12})})]}),T]})}function Jat({workspaceCwd:e,onSubtitleChange:t}){const{client:n}=la(),{t:s}=at(),[r,i]=f.useState(null),[o,a]=f.useState(!0),[c,u]=f.useState(!1),[d,h]=f.useState(!1),[m,p]=f.useState(!1),[g,b]=f.useState(Date.now()/1e3),x=f.useRef(0);f.useEffect(()=>{const k=setInterval(()=>b(Date.now()/1e3),6e4);return()=>clearInterval(k)},[]),f.useEffect(()=>{let k=!1;return a(!0),u(!1),p(!1),x.current=0,n.workspaceByCwd(e).workspaceGitLog(PU,0).then(T=>{k||(x.current=T.entries.length,i(T))}).catch(()=>{k||u(!0)}).finally(()=>{k||a(!1)}),()=>{k=!0}},[n,e]);const y=f.useCallback(()=>{!r||d||(h(!0),n.workspaceByCwd(e).workspaceGitLog(PU,x.current).then(k=>{x.current+=k.entries.length,i(T=>{if(!T)return k;const C=new Set(T.entries.map(_=>_.sha));return{...T,entries:[...T.entries,...k.entries.filter(_=>!C.has(_.sha))],hasMore:k.hasMore}})}).catch(()=>{p(!0)}).finally(()=>{h(!1)}))},[n,e,r,d]),v=r!=null&&r.available?s("gitLog.subtitle",{count:r.entries.length}):void 0;f.useEffect(()=>{t==null||t(v)},[t,v]);let w;return o?w=l.jsx("div",{className:Qs.placeholder,children:s("gitLog.loading")}):c?w=l.jsx("div",{className:Qs.placeholder,children:s("gitLog.error")}):!r||!r.available?w=l.jsx("div",{className:Qs.placeholder,children:s("gitLog.unavailable")}):r.entries.length===0?w=l.jsx("div",{className:Qs.placeholder,children:s("gitLog.empty")}):w=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Qs.commitList,children:r.entries.map(k=>l.jsx(Qat,{entry:k,workspaceCwd:e,now:g},k.sha))}),m&&l.jsx("div",{className:Qs.placeholder,children:s("gitLog.error")}),r.hasMore&&l.jsx("button",{type:"button",className:Qs.loadMore,onClick:()=>{p(!1),y()},disabled:d,children:s(d?"gitLog.loadingMore":"gitLog.loadMore")})]}),l.jsx("div",{className:Qs.content,children:w})}const Zat="_content_96a7w_1",elt="_tabBar_96a7w_7",tlt="_tab_96a7w_7",nlt="_tabActive_96a7w_27",slt="_tabPanel_96a7w_36",jp={content:Zat,tabBar:elt,tab:tlt,tabActive:nlt,tabPanel:slt};function rlt({workspaceCwd:e,initialView:t,onClose:n}){const{t:s}=at(),[r,i]=f.useState(t),[o,a]=f.useState(),c=f.useCallback(m=>{a(void 0),i(m)},[]),u=m=>{var p;c(m),(p=document.getElementById(`git-dialog-tab-${m}`))==null||p.focus()},d=m=>{if(m.key==="ArrowLeft"||m.key==="ArrowRight"){m.preventDefault(),u(r==="diff"?"log":"diff");return}if(m.key==="Home"){m.preventDefault(),u("diff");return}m.key==="End"&&(m.preventDefault(),u("log"))},h=s(r==="diff"?"gitDiff.title":"gitLog.title");return l.jsx(pi,{title:h,subtitle:o,size:"xl",allowFullscreen:!0,onClose:n,children:l.jsxs("div",{className:jp.content,children:[l.jsxs("div",{className:jp.tabBar,role:"tablist",children:[l.jsx("button",{id:"git-dialog-tab-diff",type:"button",role:"tab","aria-selected":r==="diff","aria-controls":"git-dialog-panel",tabIndex:r==="diff"?0:-1,className:`${jp.tab}${r==="diff"?` ${jp.tabActive}`:""}`,onClick:()=>c("diff"),onKeyDown:d,children:s("gitDiff.title")}),l.jsx("button",{id:"git-dialog-tab-log",type:"button",role:"tab","aria-selected":r==="log","aria-controls":"git-dialog-panel",tabIndex:r==="log"?0:-1,className:`${jp.tab}${r==="log"?` ${jp.tabActive}`:""}`,onClick:()=>c("log"),onKeyDown:d,children:s("gitLog.title")})]}),l.jsx("div",{id:"git-dialog-panel",className:jp.tabPanel,role:"tabpanel","aria-labelledby":`git-dialog-tab-${r}`,children:r==="diff"?l.jsx(wat,{workspaceCwd:e,onSubtitleChange:a}):l.jsx(Jat,{workspaceCwd:e,onSubtitleChange:a})})]})})}function ilt(e,t,n="all",s="all"){const r=t.trim().toLowerCase();return e.filter(i=>n!=="all"&&i.level!==n||s==="disabled"&&i.status!=="disabled"||s==="enabled"&&i.status==="disabled"?!1:r?i.name.toLowerCase().includes(r):!0)}function olt(e,t){return e&&t.some(n=>n.name===e)?e:null}const alt=6*1024*1024;function llt(e,t){const n=e&&typeof e=="object"?e.body:void 0,s=n&&typeof n=="object"?n.code:void 0;return s==="invalid_skill_source"?t("skills.install.error.invalidSource"):s==="invalid_skill_scope"?t("skills.install.error.invalidScope"):s==="invalid_skill_name"?t("skills.install.error.invalidName"):s==="skill_manifest_missing"?t("skills.install.error.manifestMissing"):s==="invalid_skill_package"||s==="invalid_skill_manifest"||s==="skill_name_mismatch"||s==="unsafe_skill_path"?t("skills.install.error.invalidPackage"):s==="skill_package_too_large"?t("skills.install.error.zipTooLarge"):s==="invalid_skill_folder"?t("skills.install.error.invalidFolder"):s==="github_api_failed"||s==="github_skill_download_failed"?t("skills.install.error.githubFailed"):s==="skill_not_found"?t("skills.install.error.notFound"):s==="token_required"?t("skills.install.error.authentication"):s==="untrusted_workspace"?t("skills.install.error.untrusted"):Ra(e)||t("skills.install.failed")}async function clt(e){const t=new Uint8Array(await e.arrayBuffer());let n="";for(let s=0;s<t.length;s+=32768)n+=String.fromCharCode(...t.subarray(s,s+32768));return btoa(n)}function ult({open:e,onOpenChange:t,onInstall:n}){const{t:s}=at(),[r,i]=f.useState(""),[o,a]=f.useState("workspace"),[c,u]=f.useState("github"),[d,h]=f.useState(""),[m,p]=f.useState(""),[g,b]=f.useState(null),[x,y]=f.useState(!1),[v,w]=f.useState(null);function k(){i(""),a("workspace"),u("github"),h(""),p(""),b(null),w(null)}async function T(){y(!0),w(null);try{if(!r.trim())throw new Error(s("skills.install.error.nameRequired"));let C;if(c==="github"){if(!d.trim())throw new Error(s("skills.install.error.githubRequired"));C={type:"github",url:d.trim()}}else if(c==="folder"){if(!m.trim())throw new Error(s("skills.install.error.folderRequired"));C={type:"folder",path:m.trim()}}else{if(!g)throw new Error(s("skills.install.selectZip"));if(g.size>alt)throw new Error(s("skills.install.error.zipTooLarge"));C={type:"zip",contentBase64:await clt(g)}}await n({name:r.trim(),scope:o,source:C}),t(!1),k()}catch(C){w(llt(C,s))}finally{y(!1)}}return l.jsx(y0,{open:e,onOpenChange:C=>{x||(t(C),C||k())},children:l.jsxs(v0,{className:"sm:max-w-lg",showCloseButton:!1,onPointerDownOutside:C=>C.preventDefault(),children:[l.jsxs(x0,{children:[l.jsx(k0,{children:s("skills.install.title")}),l.jsx(ub,{children:s("skills.install.description")})]}),l.jsxs("div",{className:"grid gap-4",children:[v?l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(Vl,{children:v})]}):null,l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.name"),l.jsx(qr,{value:r,onChange:C=>i(C.target.value),placeholder:"my-skill",disabled:x})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.scope"),l.jsxs(kl,{value:o,onValueChange:C=>a(C),disabled:x,children:[l.jsx(Sl,{className:"w-full",children:l.jsx(_l,{})}),l.jsxs(Cl,{children:[l.jsx(bi,{value:"workspace",children:s("skills.install.scope.workspace")}),l.jsx(bi,{value:"global",children:s("skills.install.scope.global")})]})]})]}),l.jsxs(Q0,{value:c,onValueChange:C=>u(C),children:[l.jsxs(J0,{className:"grid w-full grid-cols-3",children:[l.jsx(Fr,{value:"github",disabled:x,children:"GitHub"}),l.jsx(Fr,{value:"folder",disabled:x,children:s("skills.install.folder")}),l.jsx(Fr,{value:"zip",disabled:x,children:"ZIP"})]}),l.jsx(gi,{value:"github",className:"pt-3",children:l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.githubUrl"),l.jsx(qr,{type:"url",value:d,onChange:C=>h(C.target.value),placeholder:"https://github.com/owner/repo/blob/main/skill/SKILL.md",disabled:x})]})}),l.jsx(gi,{value:"folder",className:"pt-3",children:l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.folderPath"),l.jsx(qr,{value:m,onChange:C=>p(C.target.value),placeholder:"/absolute/path/to/my-skill",disabled:x})]})}),l.jsx(gi,{value:"zip",className:"pt-3",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(qr,{type:"file",accept:".zip,application/zip",onChange:C=>{var S;const _=((S=C.target.files)==null?void 0:S[0])??null;b(_),_&&i(D=>D||_.name.replace(/\.zip$/i,""))},disabled:x}),g?l.jsx("div",{className:"text-xs text-muted-foreground",children:s("skills.install.zipSelected",{name:g.name})}):null]})})]})]}),l.jsxs(w0,{children:[l.jsx(An,{variant:"outline",onClick:()=>{t(!1),k()},disabled:x,children:s("common.cancel")}),l.jsxs(An,{onClick:()=>void T(),disabled:x,children:[x?l.jsx(li,{"data-icon":"inline-start"}):l.jsx(W1e,{"data-icon":"inline-start"}),s("skills.install.action")]})]})]})})}const dlt="_skillGrid_1hucr_1",hlt={skillGrid:dlt};function OU(e,t){return t(`skills.level.${e.level}`)}function $U(e,t){return t(e.status==="disabled"?"skills.status.disabled":"skills.status.enabled")}function BU(e){return e.status==="disabled"?"":"bg-[var(--success-bg)] text-[var(--success-color)]"}function flt(e,t){const n=e&&typeof e=="object"?e.body:void 0,s=n&&typeof n=="object"?n.code:void 0;return s==="skill_inactive_extension"?t("skills.error.inactiveExtension"):s==="skill_not_toggleable"?t("skills.notToggleable"):e instanceof Error?e.message:t("skills.toggleFailed")}function Dg({label:e,value:t}){return l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function zU({compact:e=!1}){const{t}=at();return l.jsx(Ad,{delayDuration:300,children:l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:l.jsx(mo,{variant:"secondary",className:e?"text-[10px]":void 0,children:t("skills.manualReference")})}),l.jsx(Md,{children:t("skills.manualReferenceHint")})]})})}function Uae({onClose:e,onUseSkill:t,embedded:n}){var z,X,fe,xe;const{t:s}=at(),r=la(),{status:i,skills:o,loading:a,error:c,reload:u,setEnabled:d,install:h,remove:m}=q0e({autoLoad:!0}),p=((z=r.capabilities)==null?void 0:z.features.includes("workspace_skill_toggle"))===!0,g=((X=r.capabilities)==null?void 0:X.features.includes("workspace_skill_manage"))===!0,[b,x]=f.useState(""),[y,v]=f.useState("all"),[w,k]=f.useState("enabled"),[T,C]=f.useState({}),[_,S]=f.useState(null),[D,E]=f.useState(null),[B,I]=f.useState(!1),[L,O]=f.useState(!1),[A,$]=f.useState(null),[q,U]=f.useState(null),H=f.useMemo(()=>o.map(ie=>({...ie,status:T[ie.name]??ie.status})),[o,T]),M=f.useMemo(()=>H.find(ie=>ie.name===_),[H,_]),ee=f.useMemo(()=>ilt(H,b,y,w),[H,y,b,w]),V=H.filter(ie=>ie.status==="disabled").length,R=(c==null?void 0:c.message)??((xe=(fe=i==null?void 0:i.errors)==null?void 0:fe[0])==null?void 0:xe.error),re=[{value:"all",label:s("skills.filter.all")},{value:"user",label:s("skills.filter.user")},{value:"project",label:s("skills.filter.project")},{value:"extension",label:s("skills.filter.extension")},{value:"bundled",label:s("skills.filter.bundled")}];f.useEffect(()=>{S(ie=>olt(ie,H))},[H]),f.useEffect(()=>{C(ie=>{const Ce={...ie};let Ke=!1;for(const ut of o)Ce[ut.name]===ut.status&&(delete Ce[ut.name],Ke=!0);return Ke?Ce:ie})},[o]),f.useEffect(()=>{n==null||n.onDetailChange(!!M)},[n,M]);async function Z(ie){const Ce=ie.status==="disabled";E(ie.name),U(null);try{await d(ie.name,Ce),C(Ke=>({...Ke,[ie.name]:Ce?"ok":"disabled"})),await u(),U({skillName:ie.name,text:s(Ce?"skills.enabled":"skills.disabled"),error:!1})}catch(Ke){U({skillName:ie.name,text:flt(Ke,s),error:!0})}finally{E(null)}}async function K(ie){$(null),await h(ie),$(s("skills.install.succeeded",{name:ie.name.trim()})),await u().catch(()=>{})}async function Y(){if(!M)return;const ie=M.level==="project"?"workspace":"global";E(M.name);try{await m(M.name,ie),O(!1),S(null),$(s("skills.delete.succeeded",{name:M.name})),await u().catch(()=>{})}catch(Ce){O(!1),U({skillName:M.name,text:Ce instanceof Error?Ce.message:s("skills.delete.failed"),error:!0})}finally{E(null)}}function ae(){S(null),u()}const le=l.jsx(Pm,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Om,{className:"text-base",children:[l.jsx(Ni,{children:l.jsx(An,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(aC,{})})}),l.jsx(Ni,{children:M?l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",onClick:ae,children:s("skills.title")})}):l.jsx(za,{children:s("skills.title")})}),M?l.jsx(od,{}):null,M?l.jsx(Ni,{children:l.jsx(za,{children:M.name})}):null]})}),te=n?M?l.jsx(Pm,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Om,{className:"h-8 text-sm",children:[l.jsx(Ni,{children:l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{ae(),n.onDetailChange(!1)},children:s("skills.title")})})}),l.jsx(od,{}),l.jsx(Ni,{children:l.jsx(za,{children:M.name})})]})}):null:le;if(M){const ie=`/${M.name}${M.argumentHint?` ${M.argumentHint}`:""}`;return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[te,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(N1,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-xl font-semibold text-balance",children:M.name}),l.jsx(mo,{variant:"outline",children:OU(M,s)}),l.jsx(mo,{variant:"secondary",className:BU(M),children:$U(M,s)}),M.modelInvocable?null:l.jsx(zU,{})]})}),l.jsxs(An,{disabled:M.status==="disabled",onClick:()=>t(M.name),children:[l.jsx(_1e,{"data-icon":"inline-start"}),s("skills.run")]}),l.jsxs(mh,{children:[l.jsx(ph,{asChild:!0,children:l.jsx(An,{variant:"ghost",size:"icon",disabled:D!==null,"aria-label":s("skills.actions"),"data-testid":"skill-actions",children:D===M.name?l.jsx(li,{}):l.jsx(qf,{})})}),l.jsx(gh,{align:"end",onCloseAutoFocus:Ce=>Ce.preventDefault(),children:l.jsxs(dm,{children:[l.jsx(Gi,{disabled:D!==null||!p||M.userInvocable===!1,title:p?M.userInvocable===!1?s("skills.notToggleable"):void 0:s("skills.toggleUnsupported"),onSelect:()=>void Z(M),children:s(M.status==="disabled"?"skills.enable":"skills.disable")}),g&&(M.level==="project"||M.level==="user")?l.jsx(Gi,{variant:"destructive",disabled:D!==null,onSelect:()=>O(!0),children:s("skills.delete.action")}):null]})})]})]}),(q==null?void 0:q.skillName)===M.name?l.jsx(yl,{tone:q.error?"error":"success",noticeKey:q.text,closeLabel:s("common.close"),onDismiss:()=>U(null),children:q.text}):null,R||M.error?l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(Vl,{children:M.error||R})]}):null,l.jsxs(So,{children:[l.jsxs(ml,{children:[l.jsx(pl,{className:"text-sm",children:s("skills.details")}),l.jsx(iu,{children:M.description||s("skills.noDescription")})]}),l.jsxs(Gl,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(Dg,{label:s("skills.invocation"),value:ie}),l.jsx(Dg,{label:s("skills.level"),value:OU(M,s)}),l.jsx(Dg,{label:s("skills.modelAccess"),value:M.modelInvocable?s("skills.modelAccess.enabled"):s("skills.modelAccess.disabled")}),l.jsx(Dg,{label:s("skills.model"),value:M.model||"-"}),l.jsx(Dg,{label:s("skills.extension"),value:M.extensionName||"-"}),M.hint?l.jsx("div",{className:"sm:col-span-2",children:l.jsx(Dg,{label:s("skills.hint"),value:M.hint})}):null]})]}),l.jsx(S3,{open:L,onOpenChange:Ce=>{!Ce&&D!==null||O(Ce)},children:l.jsxs(C3,{children:[l.jsxs(T3,{children:[l.jsx(A3,{children:s("skills.delete.title")}),l.jsx(j3,{children:s("skills.delete.description",{name:M.name})})]}),l.jsxs(E3,{children:[l.jsx(N3,{disabled:D!==null,children:s("common.cancel")}),l.jsxs(vD,{variant:"destructive",disabled:D!==null,onClick:Ce=>{Ce.preventDefault(),Y()},children:[D?l.jsx(li,{"data-icon":"inline-start"}):null,s("skills.delete.action")]})]})]})})]})]})}return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[te,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold text-balance",children:s("skills.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("skills.count",{count:o.length,enabled:o.length-V,disabled:V})})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(An,{variant:"outline",disabled:a,onClick:()=>void u(),children:[a?l.jsx(li,{"data-icon":"inline-start"}):l.jsx(uC,{"data-icon":"inline-start"}),s("common.refresh")]}),g?l.jsxs(An,{onClick:()=>I(!0),children:[l.jsx(eb,{"data-icon":"inline-start"}),s("skills.install.action")]}):null]})]}),R?l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(Vl,{children:R})]}):null,A?l.jsx(yl,{tone:"success",noticeKey:A,closeLabel:s("common.close"),onDismiss:()=>$(null),children:A}):null,l.jsxs("div",{className:"relative",children:[l.jsx(lu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(qr,{name:"skill-search","aria-label":s("skills.search"),autoComplete:"off",value:b,onChange:ie=>x(ie.target.value),placeholder:s("skills.search"),className:"pl-9"})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsx(xD,{type:"single",value:y,onValueChange:ie=>{ie&&v(ie)},variant:"outline",size:"sm","aria-label":s("skills.filter.label"),children:re.map(ie=>l.jsx(wD,{value:ie.value,children:ie.label},ie.value))}),l.jsxs(kl,{value:w,onValueChange:ie=>k(ie),children:[l.jsx(Sl,{className:"w-32","aria-label":s("skills.filter.status.label"),children:l.jsx(_l,{})}),l.jsxs(Cl,{children:[l.jsx(bi,{value:"all",children:s("skills.filter.status.all")}),l.jsx(bi,{value:"enabled",children:s("skills.filter.status.enabled")}),l.jsx(bi,{value:"disabled",children:s("skills.filter.status.disabled")})]})]})]}),ee.length?l.jsx("div",{className:hlt.skillGrid,"data-column-count":Math.min(ee.length,4),children:ee.map(ie=>l.jsx(So,{size:"sm",role:"button",tabIndex:0,"aria-label":ie.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>S(ie.name),onKeyDown:Ce=>{(Ce.key==="Enter"||Ce.key===" ")&&(Ce.preventDefault(),S(ie.name))},children:l.jsx(ml,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(N1,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(pl,{className:"min-w-0 flex-1 truncate",children:ie.name}),l.jsxs("div",{className:"flex shrink-0 gap-1",children:[l.jsx(mo,{variant:"secondary",className:`${BU(ie)} text-[10px]`,children:$U(ie,s)}),ie.modelInvocable?null:l.jsx(zU,{compact:!0})]})]}),l.jsx(iu,{className:"mt-1 min-w-0 text-xs",children:l.jsx(Ad,{delayDuration:300,children:l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:ie.description||s("skills.noDescription")})}),l.jsx(Md,{children:ie.description||s("skills.noDescription")})]})})})]})]})})},ie.name))}):l.jsx(ud,{className:"border",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:b||y!=="all"||w!=="all"?l.jsx(lu,{}):l.jsx(N1,{})}),l.jsx(fd,{children:s(b||y!=="all"||w!=="all"?"skills.noMatches":"skills.empty")})]})})]}),l.jsx(ult,{open:B,onOpenChange:I,onInstall:K})]})}const mlt="_chart_1xbk4_1",plt="_plot_1xbk4_8",glt="_svg_1xbk4_13",blt="_cursor_1xbk4_30",ylt="_tooltip_1xbk4_40",vlt="_tooltipBelow_1xbk4_62",xlt="_tooltipTime_1xbk4_67",wlt="_tooltipRow_1xbk4_73",klt="_tooltipLabel_1xbk4_79",_lt="_tooltipValue_1xbk4_83",Slt="_axis_1xbk4_91",Clt="_legend_1xbk4_96",Tlt="_legendItem_1xbk4_105",Elt="_swatch_1xbk4_112",Alt="_legendLabel_1xbk4_118",jlt="_legendValue_1xbk4_123",Nlt="_peak_1xbk4_131",Do={chart:mlt,plot:plt,svg:glt,cursor:blt,tooltip:ylt,tooltipBelow:vlt,tooltipTime:xlt,tooltipRow:wlt,tooltipLabel:klt,tooltipValue:_lt,axis:Slt,legend:Clt,legendItem:Tlt,swatch:Elt,legendLabel:Alt,legendValue:jlt,peak:Nlt},VN=320,Tv=64,al=3,f2=VN-al*2,m2=Tv-al*2;function FU(e,t){return Number.isFinite(e)?e:t}const Mlt=84;function Ilt(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 Rlt(e){return new Date(e).toLocaleTimeString()}function Wae({series:e,timestamps:t,format:n=a=>String(Math.round(a)),formatTime:s=Rlt,zeroBased:r=!0,ariaLabel:i,peakLabel:o="peak"}){const a=f.useRef(null),[c,u]=f.useState(null),[d,h]=f.useState(!1),m=f.useRef(void 0),{paths:p,maxV:g,maxLen:b,min:x,span:y}=f.useMemo(()=>{const E=e.reduce((q,U)=>Math.max(q,U.values.length),0);let B=0,I=r?0:Number.POSITIVE_INFINITY;for(const q of e)for(const U of q.values)Number.isFinite(U)&&(U>B&&(B=U),U<I&&(I=U));Number.isFinite(I)||(I=0);const L=B-I||1,O=q=>E<=1?al+f2/2:al+q/(E-1)*f2,A=q=>al+m2-(FU(q,I)-I)/L*m2;return{paths:e.map(q=>{const U=q.values.map((ee,V)=>`${V===0?"M":"L"}${O(V).toFixed(1)},${A(ee).toFixed(1)}`).join(" "),H=q.values.length-1,M=H>=0?{cx:O(H),cy:A(q.values[H]),color:q.color}:void 0;return{key:q.label,d:U,color:q.color,dot:M}}),maxV:B,maxLen:E,min:I,span:L}},[e,r]),v=b>0,w=E=>b<=1?al+f2/2:al+E/(b-1)*f2,k=E=>al+m2-(FU(E,x)-x)/y*m2,T=E=>{const B=a.current;if(!B||b===0)return;const I=B.getBoundingClientRect();if(I.width===0)return;const L=(E.clientX-I.left)/I.width,O=Math.max(0,Math.min(b-1,Math.round(L*(b-1))));u(O),m.current===void 0&&(m.current=Ilt(B));const A=m.current,$=A?A.getBoundingClientRect().top:0;h(I.top-$<Mlt)},C=()=>u(null),_=c!=null&&c>=0&&c<b?c:null,S=_!=null?w(_):0,D=_!=null&&b>1?_/(b-1)*100:50;return l.jsxs("div",{className:Do.chart,children:[l.jsxs("div",{className:Do.plot,children:[l.jsxs("svg",{ref:a,viewBox:`0 0 ${VN} ${Tv}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:Do.svg,onPointerMove:T,onPointerLeave:C,children:[l.jsx("line",{x1:al,y1:Tv-al,x2:VN-al,y2:Tv-al,className:Do.axis,vectorEffect:"non-scaling-stroke"}),p.map(E=>l.jsx("path",{d:E.d,fill:"none",stroke:E.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},E.key)),_!=null&&l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:S,y1:al,x2:S,y2:Tv-al,className:Do.cursor,vectorEffect:"non-scaling-stroke"}),e.map(E=>_<E.values.length?l.jsx("circle",{cx:S,cy:k(E.values[_]),r:2.5,fill:E.color,vectorEffect:"non-scaling-stroke"},`${E.label}-hover`):null)]}),_==null&&p.map(E=>E.dot?l.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&&l.jsxs("div",{className:`${Do.tooltip} ${d?Do.tooltipBelow:""}`,style:{left:`${D}%`},role:"tooltip",children:[t&&t[_]!=null&&l.jsx("div",{className:Do.tooltipTime,children:s(t[_])}),e.map(E=>_<E.values.length?l.jsxs("div",{className:Do.tooltipRow,children:[l.jsx("svg",{className:Do.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:l.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:E.color})}),l.jsx("span",{className:Do.tooltipLabel,children:E.label}),l.jsx("span",{className:Do.tooltipValue,children:n(E.values[_])})]},E.label):null)]})]}),l.jsxs("div",{className:Do.legend,children:[e.map(E=>{const B=E.values.length?E.values[E.values.length-1]:void 0;return l.jsxs("span",{className:Do.legendItem,children:[l.jsx("svg",{className:Do.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:l.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:E.color})}),l.jsx("span",{className:Do.legendLabel,children:E.label}),B!==void 0&&l.jsx("span",{className:Do.legendValue,children:n(B)})]},E.label)}),v&&l.jsx("span",{className:Do.peak,children:`${o} ${n(g)}`})]})]})}const Dlt="_wrap_1icv6_1",Llt="_tooltip_1icv6_11",Plt="_legend_1icv6_27",Olt="_legendLabel_1icv6_35",$lt="_scroll_1icv6_39",Blt="_grid_1icv6_44",zlt="_month_1icv6_51",Flt="_weekday_1icv6_59",Hlt="_cell_1icv6_69",qlt="_legendCell_1icv6_75",Ult="_lvl0_1icv6_82",Wlt="_lvl1_1icv6_85",Vlt="_lvl2_1icv6_88",Glt="_lvl3_1icv6_91",Klt="_lvl4_1icv6_94",Ylt="_today_1icv6_98",Ia={wrap:Dlt,tooltip:Llt,legend:Plt,legendLabel:Olt,scroll:$lt,grid:Blt,month:zlt,weekday:Flt,cell:Hlt,legendCell:qlt,lvl0:Ult,lvl1:Wlt,lvl2:Vlt,lvl3:Glt,lvl4:Klt,today:Ylt},M7=864e5,Xlt=4;function I7(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function HU(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${s}`}function Qlt(e){const t=e.filter(s=>s>0).sort((s,r)=>s-r);if(t.length===0)return[0,0,0];const n=s=>t[Math.min(t.length-1,Math.floor(s*(t.length-1)))];return[n(.25),n(.5),n(.75)]}function Jlt(e,[t,n,s]){return e<=0?0:e<=t?1:e<=n?2:e<=s?3:Xlt}function Zlt(e,t,n){const s=Math.max(1,Math.floor(t)),r=I7(Date.now()),i=I7(r.getTime()-(s-1)*M7),o=(i.getDay()+6)%7,a=I7(i.getTime()-o*M7),c=Math.round((r.getTime()-a.getTime())/M7)+1,u=[],d=[],h=HU(r),m=new Date(a.getTime());for(let w=0;w<c;w++){const k=HU(m),T=e[k],C=(T==null?void 0:T.tokens)??0;d.push(C),u.push({dateKey:k,tokens:C,cacheReadRate:(T==null?void 0:T.cacheReadRate)??0,isToday:k===h,weekday:w%7,week:Math.floor(w/7)}),m.setDate(m.getDate()+1)}const p=Qlt(d),g=u.map(w=>({...w,level:Jlt(w.tokens,p)})),b=Math.ceil(c/7),x=[];let y=-1;const v=new Date(a.getTime());for(let w=0;w<b;w++){const k=v.getMonth();k!==y&&(x.push({week:w,text:v.toLocaleDateString(n,{month:"short"})}),y=k),v.setDate(v.getDate()+7)}return{cells:g,months:x,weeks:b}}function ect({heatmap:e,days:t}){const{t:n,language:s}=at(),r=f.useMemo(()=>Zlt(e,t,s),[e,t,s]),i=f.useRef(null),[o,a]=f.useState(null),c={0:n("daemon.usage.dowMon"),2:n("daemon.usage.dowWed"),4:n("daemon.usage.dowFri")},u=d=>{const h=d.target.closest("[data-date]"),m=i.current;if(!h||!m)return;const p=h.dataset.date??"",g=Number(h.dataset.tokens??"0"),b=Number(h.dataset.cache??"0"),x=h.getBoundingClientRect(),y=m.getBoundingClientRect();a({left:x.left-y.left+x.width/2,top:x.top-y.top,text:n("daemon.usage.cellTokens",{date:p,tokens:v1(g),cache:Math.round(b*100)})})};return l.jsxs("div",{className:Ia.wrap,ref:i,children:[l.jsxs("div",{className:Ia.legend,children:[l.jsx("span",{className:Ia.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>l.jsx("span",{className:`${Ia.cell} ${Ia.legendCell} ${Ia[`lvl${d}`]}`},d)),l.jsx("span",{className:Ia.legendLabel,children:n("daemon.usage.high")})]}),l.jsx("div",{className:Ia.scroll,onMouseOver:u,onMouseLeave:()=>a(null),children:l.jsxs("div",{className:Ia.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${r.weeks}, var(--hm-cell))`},children:[r.months.map(d=>l.jsx("div",{className:Ia.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>l.jsx("div",{className:Ia.weekday,style:{gridColumn:1,gridRow:d+2},children:c[d]},`wd-${d}`)),r.cells.map(d=>l.jsx("div",{className:`${Ia.cell} ${Ia[`lvl${d.level}`]} ${d.isToday?Ia.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&&l.jsx("div",{className:Ia.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const tct="_usage_1kfmt_1",nct="_toolbar_1kfmt_9",sct="_segmented_1kfmt_14",rct="_segment_1kfmt_14",ict="_segmentActive_1kfmt_41",oct="_hero_1kfmt_48",act="_heroMain_1kfmt_59",lct="_heroLabel_1kfmt_63",cct="_heroNumber_1kfmt_71",uct="_heroSub_1kfmt_82",dct="_refresh_1kfmt_87",hct="_stats_1kfmt_109",fct="_stat_1kfmt_109",mct="_statValue_1kfmt_121",pct="_statLabel_1kfmt_130",gct="_section_1kfmt_139",bct="_sectionTitle_1kfmt_145",yct="_sectionSub_1kfmt_154",vct="_breakdown_1kfmt_161",xct="_metric_1kfmt_167",wct="_metricHead_1kfmt_173",kct="_tick_1kfmt_179",_ct="_tick_input_1kfmt_186",Sct="_tick_output_1kfmt_190",Cct="_tick_cache_1kfmt_198",Tct="_metricLabel_1kfmt_202",Ect="_metricValue_1kfmt_209",Act="_metricHint_1kfmt_219",jct="_state_1kfmt_225",Nct="_modelList_1kfmt_233",Mct="_modelRow_1kfmt_239",Ict="_modelHead_1kfmt_245",Rct="_modelRank_1kfmt_251",Dct="_modelMeta_1kfmt_262",Lct="_modelName_1kfmt_267",Pct="_modelSub_1kfmt_277",Oct="_modelShare_1kfmt_282",$ct="_modelTrack_1kfmt_289",Bct="_modelFill_1kfmt_296",zct="_modelFillCache_1kfmt_303",Fct="_skillTable_1kfmt_310",Hct="_right_1kfmt_334",qct="_bars_1kfmt_339",Uct="_barsBody_1kfmt_345",Wct="_barCol_1kfmt_352",Vct="_bar_1kfmt_339",Gct="_barsCaption_1kfmt_371",En={usage:tct,toolbar:nct,segmented:sct,segment:rct,segmentActive:ict,hero:oct,heroMain:act,heroLabel:lct,heroNumber:cct,heroSub:uct,refresh:dct,stats:hct,stat:fct,statValue:mct,statLabel:pct,section:gct,sectionTitle:bct,sectionSub:yct,breakdown:vct,metric:xct,metricHead:wct,tick:kct,tick_input:_ct,tick_output:Sct,tick_cache:Cct,metricLabel:Tct,metricValue:Ect,metricHint:Act,state:jct,modelList:Nct,modelRow:Mct,modelHead:Ict,modelRank:Rct,modelMeta:Dct,modelName:Lct,modelSub:Pct,modelShare:Oct,modelTrack:$ct,modelFill:Bct,modelFillCache:zct,skillTable:Fct,right:Hct,bars:qct,barsBody:Uct,barCol:Wct,bar:Vct,barsCaption:Gct},Vae=12,Kct=Math.round(Vae*30.44),Yct=["today","week","month"],Xct={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},Qct={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},Jct={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},qU=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function Zct(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 eut(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function p2({label:e,value:t}){return l.jsxs("div",{className:En.stat,children:[l.jsx("div",{className:En.statValue,children:t.toLocaleString()}),l.jsx("div",{className:En.statLabel,children:e})]})}function D7({accent:e,value:t,label:n,hint:s}){return l.jsxs("div",{className:En.metric,children:[l.jsxs("div",{className:En.metricHead,children:[l.jsx("span",{className:`${En.tick} ${En[`tick_${e}`]}`}),l.jsx("span",{className:En.metricLabel,children:n})]}),l.jsx("div",{className:En.metricValue,children:t}),l.jsx("div",{className:En.metricHint,children:s})]})}function tut({rank:e,model:t,color:n}){const{t:s}=at(),r=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return l.jsxs("div",{className:En.modelRow,children:[l.jsxs("div",{className:En.modelHead,children:[l.jsx("span",{className:En.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),l.jsxs("div",{className:En.modelMeta,children:[l.jsx("div",{className:En.modelName,children:t.model}),l.jsx("div",{className:En.modelSub,children:s("daemon.usage.modelMeta",{tokens:v1(t.totalTokens),cache:Math.round(i)})})]}),l.jsxs("span",{className:En.modelShare,style:{color:n},children:[Math.round(r),"%"]})]}),l.jsx("div",{className:En.modelTrack,children:l.jsx("div",{className:En.modelFill,style:{width:`${r}%`,background:n},children:l.jsx("div",{className:En.modelFillCache,style:{width:`${i}%`}})})})]})}function nut({points:e,format:t,locale:n}){const s=Math.max(1,...e.map(r=>r.value));return l.jsxs("div",{className:En.bars,children:[l.jsx("div",{className:En.barsBody,children:e.map((r,i)=>l.jsx("div",{className:En.barCol,title:`${R7(r.label,n)} · ${t(r.value)}`,children:l.jsx("div",{className:En.bar,style:{height:`${r.value/s*100}%`}})},`${r.label}-${i}`))}),e.length>1&&l.jsxs("div",{className:En.barsCaption,children:[l.jsx("span",{children:R7(e[0].label,n)}),l.jsx("span",{children:R7(e[e.length-1].label,n)})]})]})}function sut(){const{t:e,language:t}=at(),[n,s]=f.useState("today"),{dashboard:r,loading:i,error:o,reload:a}=U0e({range:n,heatmapDays:Kct,autoLoad:!0}),c=l.jsx("div",{className:En.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:Yct.map(v=>l.jsx("button",{type:"button",className:`${En.segment} ${v===n?En.segmentActive:""}`,"aria-pressed":v===n,onClick:()=>s(v),children:e(Xct[v])},v))});if(!r)return l.jsxs("div",{className:En.usage,children:[l.jsx("div",{className:En.toolbar,children:c}),i?l.jsx("div",{className:En.state,children:e("daemon.usage.loading")}):o?l.jsxs("div",{className:En.state,children:[e("daemon.usage.failed"),": ",o.message]}):l.jsx("div",{className:En.state,children:e("daemon.usage.empty")})]});const{summary:u,models:d,skills:h,daily:m,heatmap:p,heatmapDays:g}=r,b=u.linesAdded+u.linesRemoved,x=u.totalTokens>0||Object.keys(p).length>0,y=e(Jct[r.range]);return l.jsxs("div",{className:En.usage,"aria-busy":i,children:[l.jsx("div",{className:En.toolbar,children:c}),l.jsxs("header",{className:En.hero,children:[l.jsxs("div",{className:En.heroMain,children:[l.jsx("div",{className:En.heroLabel,children:e(Qct[r.range])}),l.jsx("div",{className:En.heroNumber,children:v1(u.totalTokens)}),l.jsx("div",{className:En.heroSub,children:e("daemon.usage.tokensConsumed")})]}),l.jsx("button",{type:"button",className:En.refresh,onClick:()=>void a(),disabled:i,children:e("daemon.refresh")})]}),l.jsxs("div",{className:En.stats,children:[l.jsx(p2,{label:e("daemon.usage.sessions"),value:u.sessions}),l.jsx(p2,{label:e("daemon.usage.requests"),value:u.requests}),l.jsx(p2,{label:e("daemon.usage.tools"),value:u.toolCalls}),l.jsx(p2,{label:e("daemon.usage.changes"),value:b})]}),l.jsxs("section",{className:En.section,children:[l.jsx("h4",{className:En.sectionTitle,children:e("daemon.usage.breakdownTitle")}),l.jsxs("div",{className:En.breakdown,children:[l.jsx(D7,{accent:"input",value:v1(u.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),l.jsx(D7,{accent:"output",value:v1(u.outputTokens+u.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),l.jsx(D7,{accent:"cache",value:`${Math.round(u.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),l.jsxs("section",{className:En.section,children:[l.jsx("h4",{className:En.sectionTitle,children:e("daemon.usage.heatmapTitle")}),l.jsx("div",{className:En.sectionSub,children:e("daemon.usage.heatmapSub",{months:Vae})}),x?l.jsx(ect,{heatmap:p,days:g}):l.jsx("div",{className:En.state,children:e("daemon.usage.empty")})]}),d.length>0&&l.jsxs("section",{className:En.section,children:[l.jsxs("h4",{className:En.sectionTitle,children:[y," ",e("daemon.usage.modelShareTitle")]}),l.jsx("div",{className:En.sectionSub,children:e("daemon.usage.modelShareSub")}),l.jsx("div",{className:En.modelList,children:d.map((v,w)=>l.jsx(tut,{rank:w+1,model:v,color:qU[w%qU.length]},v.model))})]}),h.length>0&&l.jsxs("section",{className:En.section,children:[l.jsxs("h4",{className:En.sectionTitle,children:[y," ",e("daemon.usage.skillTitle")]}),l.jsx("div",{className:En.sectionSub,children:e("daemon.usage.skillSub")}),l.jsxs("table",{className:En.skillTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:e("daemon.usage.skillName")}),l.jsx("th",{className:En.right,children:e("daemon.usage.skillCount")})]})}),l.jsx("tbody",{children:h.map(v=>l.jsxs("tr",{children:[l.jsx("td",{children:v.name}),l.jsx("td",{className:En.right,children:v.count.toLocaleString()})]},v.name))})]})]}),m.length>1&&l.jsxs("section",{className:En.section,children:[l.jsxs("h4",{className:En.sectionTitle,children:[y," ",e("daemon.usage.dailyTokensTitle")]}),l.jsx("div",{className:En.sectionSub,children:e("daemon.usage.dailyTokensSub")}),l.jsx(Wae,{series:[{label:e("daemon.usage.tokensConsumed"),values:m.map(v=>v.tokens),color:"var(--agent-blue-400)"}],timestamps:m.map(v=>Zct(v.date)),format:v1,formatTime:v=>eut(v,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),m.length>1&&l.jsxs("section",{className:En.section,children:[l.jsxs("h4",{className:En.sectionTitle,children:[y," ",e("daemon.usage.dailySessionsTitle")]}),l.jsx("div",{className:En.sectionSub,children:e("daemon.usage.dailySessionsSub")}),l.jsx(nut,{points:m.map(v=>({label:v.date,value:v.sessions})),format:v=>v.toLocaleString(),locale:t})]})]})}const rut="_dialog_lw868_4",iut="_toolbar_lw868_12",out="_toolbarActions_lw868_19",aut="_updatedAt_lw868_26",lut="_refreshError_lw868_31",cut="_refreshButton_lw868_36",uut="_badge_lw868_51",dut="_levelOk_lw868_61",hut="_levelWarning_lw868_66",fut="_levelError_lw868_71",mut="_levelUnavailable_lw868_76",put="_tabs_lw868_81",gut="_tab_lw868_81",but="_tabActive_lw868_106",yut="_grid_lw868_114",vut="_chartsGrid_lw868_113",xut="_card_lw868_128",wut="_cardTitle_lw868_135",kut="_cardHeader_lw868_147",_ut="_infoHint_lw868_162",Sut="_infoHintButton_lw868_168",Cut="_infoHintTip_lw868_197",Tut="_row_lw868_231",Eut="_rowLabel_lw868_240",Aut="_rowValue_lw868_244",jut="_pathRow_lw868_253",Nut="_pathValue_lw868_247",Mut="_empty_lw868_274",Iut="_issueRow_lw868_279",Rut="_issueMessage_lw868_286",Dut="_featureChips_lw868_290",Lut="_featureChip_lw868_290",Put="_summaryChip_lw868_311",Out="_sessionRow_lw868_320",$ut="_sessionName_lw868_329",But="_sessionMeta_lw868_335",zut="_activePrompt_lw868_344",Fut="_workspaceRow_lw868_348",Hut="_workspaceRowHead_lw868_357",qut="_workspaceName_lw868_363",Uut="_workspaceDuration_lw868_367",Wut="_workspaceError_lw868_374",Vut="_workspaceSummary_lw868_381",Gut="_workspaceCell_lw868_388",Kut="_workspaceCellLabel_lw868_397",Yut="_workspaceCellMessage_lw868_402",mn={dialog:rut,toolbar:iut,toolbarActions:out,updatedAt:aut,refreshError:lut,refreshButton:cut,badge:uut,levelOk:dut,levelWarning:hut,levelError:fut,levelUnavailable:mut,tabs:put,tab:gut,tabActive:but,grid:yut,chartsGrid:vut,card:xut,cardTitle:wut,cardHeader:kut,infoHint:_ut,infoHintButton:Sut,infoHintTip:Cut,row:Tut,rowLabel:Eut,rowValue:Aut,pathRow:jut,pathValue:Nut,empty:Mut,issueRow:Iut,issueMessage:Rut,featureChips:Dut,featureChip:Lut,summaryChip:Put,sessionRow:Out,sessionName:$ut,sessionMeta:But,activePrompt:zut,workspaceRow:Fut,workspaceRowHead:Hut,workspaceName:qut,workspaceDuration:Uut,workspaceError:Wut,workspaceSummary:Vut,workspaceCell:Gut,workspaceCellLabel:Kut,workspaceCellMessage:Yut},Xut=5e3,Lg=[{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 Gae(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),s=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}d ${s}h ${r}m`:s>0?`${s}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function Xf(e){return e=Math.max(0,e),e>=6e4?Gae(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function M3(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 tv(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function Qut(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function Jut(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function UU(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Zut=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function edt(e){if(!UU(e))return[];const t=[];for(const n of Zut){const s=e[n];if(Array.isArray(s))for(const r of s){if(!UU(r))continue;const i=r.status;if(i!=="warning"&&i!=="error")continue;const o=String(r.kind??r.name??r.serverName??n),a=typeof r.error=="string"?r.error:typeof r.hint=="string"?r.hint:void 0;t.push({label:o,status:i,message:a})}}return t}function GN(e){switch(e){case"ok":return mn.levelOk;case"warning":return mn.levelWarning;case"error":return mn.levelError;default:return mn.levelUnavailable}}function yr({label:e,value:t}){return l.jsxs("div",{className:mn.row,children:[l.jsx("span",{className:mn.rowLabel,children:e}),l.jsx("span",{className:mn.rowValue,children:t})]})}function tdt({text:e}){return l.jsxs("span",{className:mn.infoHint,children:[l.jsx("button",{type:"button",className:mn.infoHintButton,"aria-label":e,children:l.jsx("span",{"aria-hidden":"true",children:"ⓘ"})}),l.jsx("span",{"aria-hidden":"true",className:mn.infoHintTip,children:e})]})}function kc({title:e,help:t,children:n}){return l.jsxs("section",{className:mn.card,children:[t?l.jsxs("div",{className:mn.cardHeader,children:[l.jsx("h3",{className:mn.cardTitle,children:e}),l.jsx(tdt,{text:t})]}):l.jsx("h3",{className:mn.cardTitle,children:e}),n]})}function ndt({name:e,section:t}){const{t:n}=at(),s=Object.entries(t.summary??{}),r=edt(t.data);return l.jsxs("div",{className:mn.workspaceRow,children:[l.jsxs("div",{className:mn.workspaceRowHead,children:[l.jsx("span",{className:`${mn.badge} ${GN(t.status)}`,children:n(`daemon.level.${t.status}`)}),l.jsx("span",{className:mn.workspaceName,children:e}),l.jsx("span",{className:mn.workspaceDuration,children:Xf(t.durationMs)})]}),t.error&&l.jsx("div",{className:mn.workspaceError,children:t.error.message}),r.map((i,o)=>l.jsxs("div",{className:mn.workspaceCell,children:[l.jsx("span",{className:`${mn.badge} ${GN(i.status)}`,children:n(`daemon.level.${i.status}`)}),l.jsx("span",{className:mn.workspaceCellLabel,children:i.label}),i.message&&l.jsx("span",{className:mn.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),s.length>0&&l.jsx("div",{className:mn.workspaceSummary,children:s.map(([i,o])=>l.jsxs("span",{className:mn.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function sdt({report:e}){const{t}=at(),n=e.full;if(!n)return null;const s=Object.entries(n.workspace).sort(([r],[i])=>r.localeCompare(i));return l.jsxs(l.Fragment,{children:[l.jsx(kc,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?l.jsx("div",{className:mn.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(r=>l.jsxs("div",{className:mn.sessionRow,children:[l.jsx("div",{className:mn.sessionName,children:r.displayName||r.sessionId}),l.jsxs("div",{className:mn.sessionMeta,children:[l.jsx("span",{children:t("common.clients",{count:r.clientCount})}),l.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:r.pendingPromptCount})}),l.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:r.pendingPermissionCount})}),r.hasActivePrompt&&l.jsx("span",{className:mn.activePrompt,children:t("daemon.full.session.prompting")})]})]},r.sessionId))}),l.jsx(kc,{title:t("daemon.full.workspace.title"),children:s.length===0?l.jsx("div",{className:mn.empty,children:t("daemon.full.workspace.empty")}):s.map(([r,i])=>l.jsx(ndt,{name:r,section:i},r))}),l.jsxs(kc,{title:t("daemon.full.auth.title"),children:[l.jsx(yr,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),l.jsx(yr,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),l.jsx(yr,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function rdt({series:e}){const{t}=at();if(e.length===0)return l.jsx(kc,{title:t("daemon.charts.title"),children:l.jsx("div",{className:mn.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),s=e.map(i=>i.t),r=(i,o,a,c)=>l.jsx(kc,{title:t(i),help:t(c),children:l.jsx(Wae,{series:a,timestamps:s,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return l.jsxs("div",{className:`${mn.grid} ${mn.chartsGrid}`,children:[r("daemon.charts.concurrency",tv,[{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"),r("daemon.charts.requests",tv,[{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"),r("daemon.charts.apiLatency",Xf,[{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"),r("daemon.charts.llmLatency",Xf,[{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"),r("daemon.charts.apiHealth",tv,[{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"),r("daemon.charts.promptLatency",Xf,[{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"),r("daemon.charts.eventLoop",Xf,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}],"daemon.charts.eventLoop.help"),r("daemon.charts.cpu",Qut,[{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"),r("daemon.charts.memory",M3,[{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"),r("daemon.charts.pipe",M3,[{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"),r("daemon.charts.connections",tv,[{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"),r("daemon.charts.tokens",tv,[{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 idt(){var S;const{t:e}=at(),[t,n]=f.useState("overview"),s=f.useRef([]),r=(D,E)=>{var I;let B;if(D.key==="ArrowRight"||D.key==="ArrowDown")B=(E+1)%Lg.length;else if(D.key==="ArrowLeft"||D.key==="ArrowUp")B=(E-1+Lg.length)%Lg.length;else if(D.key==="Home")B=0;else if(D.key==="End")B=Lg.length-1;else return;D.preventDefault(),n(Lg[B].id),(I=s.current[B])==null||I.focus()},i=gA({autoLoad:!0,detail:"summary"}),o=gA({autoLoad:!0,detail:"full"}),a=i.reload,c=o.reload,u=f.useRef(!1);f.useEffect(()=>{const D=window.setInterval(()=>{document.hidden||u.current||(u.current=!0,a().finally(()=>{u.current=!1}))},Xut);return()=>window.clearInterval(D)},[a]);const d=f.useCallback(()=>{a(),c()},[a,c]),h=i.report??o.report,m=o.report,p=i.loading||o.loading,g=i.error??o.error;if(!h)return l.jsx("div",{className:mn.dialog,children:l.jsx("div",{className:mn.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const b=m??h,{daemon:x,runtime:y,security:v,limits:w,capabilities:k}=h,T=y.transport.acp,C=Object.values(y.rateLimit.rejectedSinceStart).reduce((D,E)=>D+E,0),_=D=>D===null?e("daemon.limits.unlimited"):D;return l.jsxs("div",{className:mn.dialog,children:[l.jsxs("div",{className:mn.toolbar,children:[l.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${b.status}`)}`,className:`${mn.badge} ${GN(b.status)}`,children:e(`daemon.level.${b.status}`)}),l.jsx("span",{className:mn.updatedAt,children:e("daemon.updatedAt",{time:new Date(h.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&l.jsx("span",{className:mn.refreshError,children:e("daemon.loadFailed")}),l.jsx("div",{className:mn.toolbarActions,children:l.jsx("button",{type:"button",className:mn.refreshButton,onClick:d,disabled:p,children:e("daemon.refresh")})})]}),b.issues.length>0&&l.jsx(kc,{title:e("daemon.issues.title"),children:b.issues.map((D,E)=>l.jsxs("div",{className:mn.issueRow,children:[l.jsx("span",{className:`${mn.badge} ${D.severity==="error"?mn.levelError:mn.levelWarning}`,children:D.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),l.jsx("span",{className:mn.issueMessage,children:D.message})]},`${D.code}-${E}`))}),l.jsx("div",{className:mn.tabs,role:"tablist","aria-label":e("daemon.title"),children:Lg.map((D,E)=>l.jsx("button",{ref:B=>{s.current[E]=B},type:"button",role:"tab",id:`daemon-tab-${D.id}`,"aria-selected":D.id===t,"aria-controls":`daemon-tabpanel-${D.id}`,tabIndex:D.id===t?0:-1,className:`${mn.tab} ${D.id===t?mn.tabActive:""}`,onClick:()=>n(D.id),onKeyDown:B=>r(B,E),children:e(D.labelKey)},D.id))}),t==="overview"&&l.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:mn.grid,children:[l.jsxs(kc,{title:e("daemon.overview.title"),children:[x.qwenCodeVersion&&l.jsx(yr,{label:e("daemon.overview.version"),value:x.qwenCodeVersion}),l.jsx(yr,{label:e("daemon.overview.pid"),value:x.pid}),l.jsx(yr,{label:e("daemon.overview.mode"),value:x.mode}),l.jsx(yr,{label:e("daemon.overview.uptime"),value:Gae(x.uptimeMs)}),l.jsxs("div",{className:mn.pathRow,children:[l.jsx("span",{className:mn.rowLabel,children:e("daemon.overview.workspace")}),l.jsx("span",{className:mn.pathValue,title:x.workspaceCwd,children:l.jsx("bdi",{children:x.workspaceCwd})})]})]}),l.jsxs(kc,{title:e("daemon.runtime.title"),children:[y.error?l.jsxs("div",{className:mn.workspaceError,children:[e("daemon.runtime.startFailed"),": ",y.error]}):y.loading?l.jsx("div",{className:mn.empty,children:e("daemon.runtime.startingUp")}):null,l.jsx(yr,{label:e("daemon.runtime.activeSessions"),value:y.sessions.active}),y.activity&&l.jsxs(l.Fragment,{children:[l.jsx(yr,{label:e("daemon.runtime.activePrompts"),value:y.activity.activePrompts}),l.jsx(yr,{label:e("daemon.runtime.idle"),value:y.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):Xf(y.activity.idleSinceMs)})]}),l.jsx(yr,{label:e("daemon.runtime.pendingPermissions"),value:y.permissions.pending}),l.jsx(yr,{label:e("daemon.runtime.permissionPolicy"),value:y.permissions.policy}),l.jsx(yr,{label:e("daemon.runtime.channel"),value:y.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),y.channelWorker.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(yr,{label:e("daemon.runtime.channelWorker"),value:Jut(y.channelWorker)}),y.channelWorker.error&&l.jsx("div",{className:mn.workspaceError,children:y.channelWorker.error}),(y.channelWorker.restartCount??0)>0&&l.jsx(yr,{label:e("daemon.runtime.channelWorkerRestarts"),value:y.channelWorker.restartCount})]}),l.jsx(yr,{label:e("daemon.runtime.memory"),value:`${M3(y.process.rss)} / ${M3(y.process.heapUsed)}`})]}),l.jsxs(kc,{title:e("daemon.transport.title"),children:[l.jsx(yr,{label:e("daemon.transport.restSse"),value:y.transport.restSseActive}),T.enabled?l.jsxs(l.Fragment,{children:[l.jsx(yr,{label:e("daemon.transport.acpConnections"),value:T.connections}),l.jsx(yr,{label:e("daemon.transport.acpStreams"),value:`${T.sessionStreams} / ${T.sseStreams} / ${T.wsStreams}`}),l.jsx(yr,{label:e("daemon.transport.pendingRequests"),value:T.pendingClientRequests})]}):l.jsx("div",{className:mn.empty,children:e("daemon.transport.acpDisabled")}),l.jsx(yr,{label:e("daemon.transport.rateLimitRejected"),value:y.rateLimit.enabled?C:e("common.disabled")})]}),l.jsxs(kc,{title:e("daemon.security.title"),children:[l.jsx(yr,{label:e("daemon.security.token"),value:v.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),l.jsx(yr,{label:e("daemon.security.requireAuth"),value:v.requireAuth?e("common.enabled"):e("common.disabled")}),l.jsx(yr,{label:e("daemon.security.loopback"),value:v.loopbackBind?e("common.enabled"):e("common.disabled")}),l.jsx(yr,{label:e("daemon.security.allowOrigin"),value:v.allowOriginMode}),l.jsx(yr,{label:e("daemon.security.shell"),value:v.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),l.jsxs(kc,{title:e("daemon.limits.title"),children:[l.jsx(yr,{label:e("daemon.limits.maxSessions"),value:_(w.maxSessions)}),l.jsx(yr,{label:e("daemon.limits.maxPendingPrompts"),value:_(w.maxPendingPromptsPerSession)}),l.jsx(yr,{label:e("daemon.limits.maxConnections"),value:_(w.listenerMaxConnections)}),l.jsx(yr,{label:e("daemon.limits.eventRing"),value:w.eventRingSize}),l.jsx(yr,{label:e("daemon.limits.promptDeadline"),value:w.promptDeadlineMs===null?e("daemon.limits.unlimited"):Xf(w.promptDeadlineMs)}),l.jsx(yr,{label:e("daemon.limits.sessionIdle"),value:Xf(w.sessionIdleTimeoutMs)})]}),l.jsx(kc,{title:k.features.length?e("daemon.capabilities.titleCount",{count:k.features.length}):e("daemon.capabilities.title"),children:k.features.length===0?l.jsx("span",{className:mn.empty,children:e("daemon.none")}):l.jsx("div",{className:mn.featureChips,children:[...k.features].sort().map(D=>l.jsx("span",{className:mn.featureChip,children:D},D))})})]}),t==="usage"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:l.jsx(Ph,{label:"daemon-usage",fallback:l.jsx("div",{className:mn.empty,children:e("daemon.usage.failed")}),children:l.jsx(sut,{})})}),t==="metrics"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:l.jsx(rdt,{series:((S=h.runtime.metrics)==null?void 0:S.series)??[]})}),t==="diagnostics"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:l.jsx(Ph,{label:"daemon-status-detail",fallback:l.jsx("div",{className:mn.empty,children:e("daemon.details.failed")}),children:m!=null&&m.full?l.jsx(sdt,{report:m}):o.loading?l.jsx("div",{className:mn.empty,children:e("daemon.details.loading")}):o.error?l.jsxs("div",{className:mn.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):l.jsx("div",{className:mn.empty,children:e("daemon.details.failed")})})})]})}function odt(){const{t:e}=at();return l.jsx(Ph,{label:"daemon-status",fallback:t=>l.jsx("div",{className:mn.dialog,children:l.jsxs("div",{className:mn.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:l.jsx(idt,{})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Kae="split",hm=6;function adt(e,t,n){const s=new URL(t);return s.pathname="/",s.searchParams.set(Kae,e.join(",")),n&&(s.hash=new URLSearchParams({token:n}).toString()),s.toString()}function ldt(e){const t=new URLSearchParams(e).get(Kae);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}const kD="qwen-webshell-split-sessions";function cdt(e){const t=Array.from(new Set(e.filter(Boolean))).slice(0,hm);try{sessionStorage.setItem(kD,JSON.stringify(t))}catch{}}function udt(){try{const e=sessionStorage.getItem(kD);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,hm):[]}catch{return[]}}function ddt(){try{sessionStorage.removeItem(kD)}catch{}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Yae(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function VT(e){var t;return((t=e.displayName)==null?void 0:t.trim())||Yae(e.cwd)}function GT(e,t){const n=t==null?void 0:t.find(s=>s.cwd===e);return n?VT(n):Yae(e)}function _D(e){var t;return(((t=e==null?void 0:e.workspaces)==null?void 0:t.length)??0)>1}function hdt(e,t){return!!e&&!!t&&e!==t}function Xae(e,t){if(t.length===0)return e;const n=new Map;for(const s of e)n.set(s.sessionId,s);for(const s of t)n.has(s.sessionId)||n.set(s.sessionId,s);return[...n.values()]}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const g2=[];function Qae(e=!0){var c;const t=la(),n=t.client,s=e?(((c=t.capabilities)==null?void 0:c.workspaces)??[]).filter(u=>!u.primary&&u.trusted).map(u=>u.cwd).join(`
`):"",[r,i]=f.useState(g2),o=f.useCallback(async()=>{const u=s?s.split(`
`):[];if(u.length===0)return g2;const d=await Promise.allSettled(u.map(m=>n.listWorkspaceSessions(m,{pageSize:oh,archiveState:"active",sourceType:o4}))),h=[];return d.forEach((m,p)=>{m.status==="fulfilled"?h.push(...m.value):console.warn(`[useOtherWorkspaceSessions] failed to list sessions for ${u[p]}:`,m.reason)}),h.length===0?g2:h},[n,s]),a=f.useCallback(async()=>{s&&i(await o())},[s,o]);return f.useEffect(()=>{if(!s){i(d=>d.length===0?d:g2);return}let u=!1;return o().then(d=>{u||i(d)}),()=>{u=!0}},[s,o]),{sessions:r,reload:a}}function fdt(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?xdt(e):""}let $p;const mdt="qwen-daemon-auth",pdt=2500,Jae="qwen-daemon-token";function gdt(){try{return window.sessionStorage.getItem(Jae)||void 0}catch{return}}function bdt(e){try{window.sessionStorage.setItem(Jae,e)}catch{}}function Zae(){if($p)return $p;if(typeof window>"u")return;const t=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||"";return t?(bdt(t),$p=t,$p):($p=gdt(),$p)}function ydt(e=pdt){return typeof window>"u"||window.parent===window?Promise.resolve(void 0):new Promise(t=>{let n=!1;const s=o=>{n||(n=!0,window.removeEventListener("message",r),clearTimeout(i),$p=o,t(o))},r=o=>{if(o.source!==window.parent||!o.origin.startsWith("chrome-extension://")&&!o.origin.startsWith("moz-extension://"))return;const a=o.data;if((a==null?void 0:a.type)!==mdt)return;const c=typeof a.token=="string"?a.token:"";s(c.trim()||void 0)},i=setTimeout(()=>s(void 0),e);window.addEventListener("message",r)})}function vdt(){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 s=n.toString();e.hash=s?`#${s}`:"",t=!0}}t&&window.history.replaceState(null,"",e)}function xdt(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 r=window.location.port||(window.location.protocol==="https:"?"443":"80");return(t.port||(t.protocol==="https:"?"443":"80"))!==r?"":t.origin}catch{return""}}const wdt="_panel_1s6rs_1",kdt="_toolbar_1s6rs_9",_dt="_count_1s6rs_16",Sdt="_selectAll_1s6rs_21",Cdt="_actionButton_1s6rs_30",Tdt="_refreshButton_1s6rs_50",Edt="_notice_1s6rs_61",Adt="_grid_1s6rs_71",jdt="_card_1s6rs_80",Ndt="_cardCurrent_1s6rs_91",Mdt="_cardTop_1s6rs_96",Idt="_cardCheckbox_1s6rs_103",Rdt="_colorDot_1s6rs_108",Ddt="_cardLabel_1s6rs_115",Ldt="_currentBadge_1s6rs_135",Pdt="_cardMeta_1s6rs_145",Odt="_metaItem_1s6rs_153",$dt="_statusBadge_1s6rs_162",Bdt="_statusApproval_1s6rs_172",zdt="_statusRunning_1s6rs_181",Fdt="_statusIdle_1s6rs_190",Hdt="_workspaceBadge_1s6rs_202",qdt="_workspaceBadgeOther_1s6rs_218",Udt="_empty_1s6rs_223",Wdt="_colorRed_1s6rs_231",Vdt="_colorOrange_1s6rs_234",Gdt="_colorYellow_1s6rs_237",Kdt="_colorGreen_1s6rs_240",Ydt="_colorBlue_1s6rs_243",Xdt="_colorPurple_1s6rs_246",Hs={panel:wdt,toolbar:kdt,count:_dt,selectAll:Sdt,actionButton:Cdt,refreshButton:Tdt,notice:Edt,grid:Adt,card:jdt,cardCurrent:Ndt,cardTop:Mdt,cardCheckbox:Idt,colorDot:Rdt,cardLabel:Ddt,currentBadge:Ldt,cardMeta:Pdt,metaItem:Odt,statusBadge:$dt,statusApproval:Bdt,statusRunning:zdt,statusIdle:Fdt,workspaceBadge:Hdt,workspaceBadgeOther:qdt,empty:Udt,colorRed:Wdt,colorOrange:Vdt,colorYellow:Gdt,colorGreen:Kdt,colorBlue:Ydt,colorPurple:Xdt},Qdt=3e3,Jdt=1e4,WU={needsApproval:0,running:1,idle:2};function Zdt(e,t,n,s){const r=new Map(t.map(o=>[o.sessionId,o])),i=e.map(o=>{var d,h;const a=r.get(o.sessionId),c=o.hasActivePrompt??(a==null?void 0:a.hasActivePrompt)??!1,u=((a==null?void 0:a.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??(a==null?void 0:a.clientCount)??0,model:(h=a==null?void 0:a.currentModelId)!=null&&h.startsWith("qwen-route:")?void 0:a!=null&&a.currentModelId?Yf(a.currentModelId):void 0,updatedAt:o.updatedAt||o.createdAt,color:o.color,isCurrent:o.sessionId===n,workspaceCwd:o.workspaceCwd,isNonPrimary:hdt(o.workspaceCwd,s)}});return i.sort((o,a)=>{const c=WU[o.status]-WU[a.status];return c!==0?c:(a.updatedAt??"").localeCompare(o.updatedAt??"")}),i}function b2(...e){return e.filter(Boolean).join(" ")}function eht(e){switch(e){case"red":return Hs.colorRed;case"orange":return Hs.colorOrange;case"yellow":return Hs.colorYellow;case"green":return Hs.colorGreen;case"blue":return Hs.colorBlue;case"purple":return Hs.colorPurple;default:return}}function VU(e){switch(e){case"needsApproval":return Hs.statusApproval;case"running":return Hs.statusRunning;default:return Hs.statusIdle}}function tht({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s}){var M,ee,V;const{t:r}=at(),i=xa(),o=i.sessionId,a=((ee=(M=i.capabilities)==null?void 0:M.features)==null?void 0:ee.includes(_9))??!1,{sessions:c,loading:u,error:d,reload:h}=ek(s,{autoLoad:!0,pageSize:oh,archiveState:"active",...a?{view:"organized",group:"all"}:{}}),{sessions:m,reload:p}=Qae(n&&!s),g=f.useMemo(()=>Xae(c,m),[c,m]),b=!s&&n&&_D(i.capabilities),x=gA({autoLoad:!0,detail:"full"}),y=x.reload,v=x.report,[w,k]=f.useState(()=>new Set),[T,C]=f.useState(!1),_=f.useRef(!1);f.useEffect(()=>{const R=window.setInterval(()=>{document.hidden||_.current||(_.current=!0,Promise.all([h(),p()]).finally(()=>{_.current=!1}))},Qdt);return()=>window.clearInterval(R)},[h,p]);const S=f.useRef(!1);f.useEffect(()=>{const R=window.setInterval(()=>{document.hidden||S.current||(S.current=!0,y().finally(()=>{S.current=!1}))},Jdt);return()=>window.clearInterval(R)},[y]);const D=(V=i.capabilities)==null?void 0:V.workspaceCwd,E=f.useMemo(()=>{var R;return Zdt(g,((R=v==null?void 0:v.full)==null?void 0:R.sessions)??[],o,D)},[g,v,o,D]),B=f.useCallback(R=>{k(re=>{const Z=new Set(re);return Z.has(R)?Z.delete(R):Z.add(R),Z})},[]),I=E.map(R=>R.sessionId).filter(R=>w.has(R)),L=I.length,O=E.length>0&&L===E.length,A=I.slice(0,hm),$=L>hm,q=f.useCallback(()=>{k(R=>{const re=E.map(K=>K.sessionId);return re.length>0&&re.every(K=>R.has(K))?new Set:new Set(re)})},[E]);f.useEffect(()=>{k(R=>{if(R.size===0)return R;const re=new Set(E.map(Y=>Y.sessionId));let Z=!1;const K=new Set;for(const Y of R)re.has(Y)?K.add(Y):Z=!0;return Z?K:R})},[E]);const U=f.useCallback(()=>{if(A.length===0)return;const R=adt(A,window.location.href,Zae()),re=window.open(R,"_blank");re&&(re.opener=null,re.focus()),C(!re)},[A]),H=f.useCallback(()=>{h(),p(),y()},[h,p,y]);return E.length===0?l.jsx("div",{className:Hs.panel,children:l.jsx("div",{className:Hs.empty,children:u?r("sessionsOverview.loading"):d?`${r("sessionsOverview.loadFailed")}: ${d.message}`:r("sessionsOverview.empty")})}):l.jsxs("div",{className:Hs.panel,children:[l.jsxs("div",{className:Hs.toolbar,children:[l.jsx("span",{className:Hs.count,children:r("sessionsOverview.count",{count:E.length})}),l.jsxs("label",{className:Hs.selectAll,children:[l.jsx("input",{type:"checkbox",checked:O,onChange:q}),r("sessionsOverview.selectAll")]}),l.jsx("button",{type:"button",className:Hs.actionButton,disabled:L===0,onClick:U,title:r("sessionsOverview.openInTabHint"),children:r("sessionsOverview.openInTab")}),t&&l.jsx("button",{type:"button",className:Hs.actionButton,disabled:L===0,onClick:()=>t(A),title:r("sessionsOverview.openInSplitHint"),children:r("sessionsOverview.openInSplit")}),l.jsx("button",{type:"button",className:Hs.refreshButton,onClick:H,children:r("sessionsOverview.refresh")})]}),$&&l.jsx("div",{className:Hs.notice,role:"status",children:r("sessionsOverview.splitCap",{max:hm})}),T&&l.jsx("div",{className:Hs.notice,role:"alert",children:r("sessionsOverview.popupBlocked")}),d&&l.jsxs("div",{className:Hs.notice,role:"alert",children:[r("sessionsOverview.loadFailed"),": ",d.message]}),l.jsx("ul",{className:Hs.grid,children:E.map(R=>{var re;return l.jsxs("li",{className:b2(Hs.card,VU(R.status),R.isCurrent&&Hs.cardCurrent),children:[l.jsxs("div",{className:Hs.cardTop,children:[l.jsx("input",{type:"checkbox",className:Hs.cardCheckbox,checked:w.has(R.sessionId),onChange:()=>B(R.sessionId),"aria-label":r("sessionsOverview.selectSession",{name:R.label})}),R.color&&l.jsx("span",{className:b2(Hs.colorDot,eht(R.color)),"aria-hidden":"true"}),l.jsx("button",{type:"button",className:Hs.cardLabel,onClick:()=>e(R.sessionId),title:R.label,children:R.label}),R.isCurrent&&l.jsx("span",{className:Hs.currentBadge,children:r("sessionsOverview.current")})]}),l.jsxs("div",{className:Hs.cardMeta,children:[l.jsx("span",{className:b2(Hs.statusBadge,VU(R.status)),children:r(`sessionsOverview.status.${R.status}`)}),b&&l.jsx("span",{className:b2(Hs.workspaceBadge,R.isNonPrimary&&Hs.workspaceBadgeOther),title:R.workspaceCwd,children:GT(R.workspaceCwd,(re=i.capabilities)==null?void 0:re.workspaces)}),R.model&&l.jsx("span",{className:Hs.metaItem,title:R.model,children:R.model}),R.clientCount>0&&l.jsx("span",{className:Hs.metaItem,title:r("sessionsOverview.openElsewhere"),children:r("common.clients",{count:R.clientCount})}),R.updatedAt&&l.jsx("span",{className:Hs.metaItem,children:_3(R.updatedAt,r)})]})]},R.sessionId)})})]})}function nht({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n=!0,workspaceCwd:s}){const{t:r}=at();return l.jsx(Ph,{label:"session-overview",fallback:i=>l.jsx("div",{className:Hs.panel,children:l.jsxs("div",{className:Hs.empty,children:[r("sessionsOverview.loadFailed"),": ",i.message]})}),children:l.jsx(tht,{onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function sht(e){const t=new Map;for(const n of e){if(n.kind!=="assistant")continue;const s=Eo(n.meta);if((s==null?void 0:s.source)!=="background_notification"||s.qwenDiscreteMessage!==!0)continue;const r=Eo(s.backgroundTask),i=Zo(r,"toolUseId"),o=Zo(r,"status");(r==null?void 0:r.kind)!=="agent"||!i||!o||t.set(i,{status:o,endTime:n.serverTimestamp??n.clientReceivedAt})}return t}function rht(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={...Eo(e.rawOutput)??{},status:"cancelled"};break}}function iht(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("session_cwd_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function oht(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 aht(e,t){return e===void 0?{}:t?{data:{...Eo(e)??{value:e},errorKind:t}}:{data:e}}function lht(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 cht(e){if(!e||typeof e!="object")return null;const t=e.messages;return Array.isArray(t)&&t.filter(s=>typeof s=="string").join(`
`).trim()||null}function uht(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function dht(e){return uht(e)||!e.text&&!e.usage?null:e}function GU(e){return e.text.length===0}function hht(e){const t=e.flatMap((n,s)=>{const r=Eo(n),i=Zo(r,"content");return i?[{id:Zo(r,"id")??`plan-${s}`,content:i,status:yht(Zo(r,"status")),...(()=>{const a=vht(Zo(r,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function KU(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 fht(e,t={}){var d,h,m;const n=[],s=((d=t.labels)==null?void 0:d.promptCancelled)??"Request cancelled.",r=new Map,i=new Map,o=sht(e);let a=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":{a=null,c=null,u=!1;const x=g,y=Eo(x.meta),v=Zo(y,"source"),w=Array.isArray(y==null?void 0:y.inputAnnotations)?y.inputAnnotations:void 0,k={id:g.id,role:"user",content:x.text,timestamp:b,...v?{source:v}:{},...w?{inputAnnotations:w}:{}};x.images&&x.images.length>0&&(k.images=x.images.map(T=>({data:T.data,mimeType:T.mimeType||"image/*"}))),n.push(k);break}case"assistant":{const x=dht(g);if(!x)break;const y=x.parentToolCallId?r.get(x.parentToolCallId):void 0;if(y){YU(y,x.text);break}const v=Iht(x.text);if(v){let k=null,T=!1,C=0,_=0;for(const S of v)S.kind==="insight"?S.data.type==="insight_progress"?k=S.data:S.data.type==="insight_ready"?(T=!0,n.push({id:`${g.id}-ir-${C++}`,role:"insight_ready",path:S.data.path,timestamp:b})):S.data.type==="insight_error"&&(T=!0,n.push({id:`${g.id}-ie-${_++}`,role:"insight_error",error:S.data.error,timestamp:b})):(n.push({id:`${g.id}-t-${n.length}`,role:"assistant",content:S.text,timestamp:b}),a=n.length-1,c=null);k&&!T&&n.push({id:`${g.id}-ip`,role:"insight_progress",stage:k.stage,progress:k.progress,detail:k.detail,timestamp:b}),u=!0;break}const w=a!==null?n[a]:void 0;if(w&&w.role==="assistant"&&!u&&!GU(x)){const k=KU(w.usage,x.usage);n[a]={...w,content:w.content+x.text,isStreaming:x.streaming,...k?{usage:k}:{}},u=!1,c=null}else if(!GU(x))n.push({id:g.id,role:"assistant",content:x.text,isStreaming:x.streaming,timestamp:b,...x.usage?{usage:x.usage}:{}}),a=n.length-1,c=null,u=!1;else if(x.usage&&w&&w.role==="assistant"){const k=KU(w.usage,x.usage);n[a]={...w,...k?{usage:k}:{}}}break}case"thought":{const x=g,y=x.parentToolCallId?r.get(x.parentToolCallId):void 0;if(y){YU(y,x.text);break}const v=c!==null?n[c]:void 0;v&&v.role==="thinking"&&!u?(n[c]={...v,content:v.content+x.text,isStreaming:x.streaming},u=!1):(n.push({id:g.id,role:"thinking",content:x.text,isStreaming:x.streaming,timestamp:b}),c=n.length-1,u=!1),a=null;break}case"tool":{const y=xht(g);rht(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 w=y.parentToolCallId?r.get(y.parentToolCallId):void 0,k=r.get(y.callId);if(k){XU(k,y);break}if(w){mht(w,y),r.set(y.callId,y);break}L7(n,g.id,y,b),r.set(y.callId,y),a=null,c=null,u=!0;break}case"shell":{const x=g,y=n[n.length-1];if(y&&y.role==="tool_group"){const v=pht(y.tools),w=y.tools[v];if(w){const k=typeof w.rawOutput=="string"?w.rawOutput:"",T={...w,rawOutput:k+x.text};n[n.length-1]={...y,tools:[...y.tools.slice(0,v),T,...y.tools.slice(v+1)]},r.get(w.callId)===w&&r.set(w.callId,T)}}else n.push({id:g.id,role:"tool_group",tools:[{callId:g.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:x.text}],timestamp:b}),u=!0;break}case"user_shell":{const x=g;n.push({id:g.id,role:"user_shell",command:x.command,output:x.text,...x.cwd?{cwd:x.cwd}:{},timestamp:b}),u=!0;break}case"permission":{const x=g;kht(x,i);const y=wht(x);if(!y)break;const v=ele(y);if(!x.resolved)break;const w=r.get(y.callId);if(w){const k=w.status;y.toolName=w.toolName,x.resolved&&(P7(x.resolved)?y.status=v?y.status:"in_progress":(y.status="failed",y.endTime=x.updatedAt)),XU(w,y),x.resolved&&v&&P7(x.resolved)&&(w.status=k);break}if(x.resolved){P7(x.resolved)?(v||(y.status="in_progress"),L7(n,g.id,y,b),r.set(y.callId,y),u=!0):(y.status="failed",y.endTime=x.updatedAt,L7(n,g.id,y,b),r.set(y.callId,y),u=!0);break}break}case"status":case"debug":{const x=g,y=x.source==="session_branched"?lht(x.data):null,v=x.source==="mid_turn_message_injected"?cht(x.data):null,w=y&&((h=t.labels)!=null&&h.branchSuccess)?t.labels.branchSuccess(y):v&&((m=t.labels)!=null&&m.midTurnInserted)?t.labels.midTurnInserted(v):x.text;if(iht(w))break;const k=bht(w);if(k){n.push({id:g.id,role:"plan",todos:k,timestamp:b}),u=!0;break}n.push({id:g.id,role:"system",content:w,variant:"info",timestamp:b,...x.source?{source:x.source}:{},...x.data!==void 0?{data:x.data}:{}}),u=!0;break}case"error":{const x=g,y=x.errorKind;n.push({id:g.id,role:"system",content:oht(x,t.labels),variant:"error",retryable:x.source==="turn_error",timestamp:b,...x.source?{source:x.source}:{},...aht(x.data,y)}),u=!0;break}case"prompt_cancelled":n.push({id:g.id,role:"system",content:s,variant:"info",source:"prompt_cancelled",timestamp:b}),u=!0;break}}return n}function mht(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function YU(e,t){e.subContent=(e.subContent||"")+t}function L7(e,t,n,s){const r=o=>ele(o)||Qh(o.toolName),i=e[e.length-1];if(i&&i.role==="tool_group"&&i.id.startsWith("tg-")&&!r(n)&&!i.tools.some(r)){i.tools.push(n);return}e.push({id:`tg-${t}`,role:"tool_group",tools:[n],timestamp:s})}function pht(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 XU(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 ele(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||ght(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function ght(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function bht(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),s=Eo(n);return(s==null?void 0:s.sessionUpdate)!=="plan"||!Array.isArray(s.entries)?void 0:hht(s.entries)}catch{return}}function Eo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Zo(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function yht(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function vht(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function xht(e){const t=Sht(e),n=_ht(e,t),s=Cht(e.content),r={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":r[e.status])||e.status||"in_progress",kind:nle(e.toolName,e.toolKind),rawOutput:t,args:e.rawInput,parentToolCallId:e.parentToolCallId,startTime:e.createdAt,endTime:i&&!n?e.updatedAt:void 0,...s?{content:s}:{}}}function wht(e){const t=Eo(e.toolCall);if(!t)return;const n=tle(t);if(Array.isArray(n==null?void 0:n.questions))return;const s=Eo(t._meta),r=Zo(t,"kind"),i=Zo(s,"toolName")??Zo(t,"toolName")??Zo(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(r==="fetch"?"web_fetch":r),o=Zo(t,"toolCallId")??Zo(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:Zo(t,"title")??e.title,status:"pending",kind:nle(i,r),args:n,startTime:e.createdAt}}function kht(e,t){const n=Eo(e.toolCall),s=Zo(n,"toolCallId")??Zo(n,"id");if(!s)return;const r=Zo(n,"title")??e.title,i=n?tle(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(s,{...r?{title:r}:{},...i?{args:i}:{}})}function P7(e){const[t="",n=""]=e.toLowerCase().split(":",2);return QU(t)?!0:t!=="selected"?!1:QU(n.trim())}function QU(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_always_project"||e==="proceed_always_user"||e==="allow_once"||e==="allow_always"||e==="success"||e==="succeeded"}function tle(e){return Eo(e.rawInput)??Eo(e.input)??Eo(e.args)}function _ht(e,t){var r;const n=(r=e.toolName)==null?void 0:r.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const s=Eo(t);return(s==null?void 0:s.status)==="background"}function Sht(e){return Tht(e)&&e.status==="failed"?Eht(e)??e.details??e.rawOutput:!Aht(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 Cht(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const s=Eo(n);if(!s)return[];const r=s.type;if(r==="content"){const i=Eo(s.content);return!i||typeof i.type!="string"?[]:[{type:"content",content:{...i,type:i.type}}]}if(r==="diff"){const i=s.newText;if(typeof i!="string")return[];const o=s.path,a=s.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof a=="string"?{oldText:a}:{},newText:i}]}if(r==="terminal"){const i=s.terminalId;return[{type:"terminal",...typeof i=="string"?{terminalId:i}:{}}]}return[]});return t.length>0?t:void 0}function Tht(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Eht(e){if(!Array.isArray(e.content))return;const t=e.content.map(n=>{var s;return(s=n==null?void 0:n.content)==null?void 0:s.text}).filter(n=>!!n);if(!(!t||t.length===0))return t.join(`
`)}function Aht(e){return e==="cancelled"||e==="canceled"}const jht=['"insight_progress":','"insight_ready":','"insight_error":'];function Nht(e){try{const t=JSON.parse(e),n=Eo(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 s=Eo(t.insight_ready);if(s&&typeof s.path=="string")return{type:"insight_ready",path:s.path};const r=Eo(t.insight_error);if(r&&typeof r.error=="string")return{type:"insight_error",error:r.error}}catch{}return null}function Mht(e,t){if(e[t]!=="{")return null;let n=0,s=!1,r=!1;for(let i=t;i<e.length;i++){const o=e[i];if(r){r=!1;continue}if(o==="\\"&&s){r=!0;continue}if(o==='"'){s=!s;continue}if(!s){if(o==="{")n++;else if(o==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function Iht(e){const t=[];let n=0,s=0,r=!1;for(;s<e.length;){const o=e.indexOf("{",s);if(o===-1)break;const a=e.slice(o+1).trimStart();if(!jht.some(m=>a.startsWith(m))){s=o+1;continue}const u=Mht(e,o);if(!u){s=o+1;continue}const d=Nht(u);if(!d){s=o+1;continue}r=!0;const h=e.slice(n,o).trim();h&&t.push({kind:"text",text:h}),t.push({kind:"insight",data:d}),n=o+u.length,s=n}if(!r)return null;const i=e.slice(n).trim();return i&&t.push({kind:"text",text:i}),t.length>0?t:null}function nle(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 Rht(e,t){return fht(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 sle(e){return e==="pending"||e==="in_progress"||e==="running"}function SD(e){return e==="completed"||e==="failed"||e==="cancelled"||e==="canceled"}function JU(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function Dht(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.kind!=="assistant")continue;const s=JU(n.meta),r=JU(s==null?void 0:s.backgroundTask),i=r==null?void 0:r.status;if((s==null?void 0:s.source)==="background_notification"&&(r==null?void 0:r.kind)==="agent"&&typeof i=="string"&&SD(i))return`${n.id}:${i}`}return""}function Lht(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)sle(s.status)&&Oh(s)&&t.push(s.callId);return t.join("|")}function Pht(e,t){if(t.size===0)return e;let n=!1;const s=e.map(r=>{if(r.role!=="tool_group")return r;let i=!1;const o=r.tools.map(a=>{const c=t.get(a.callId);if(!c||!SD(c.status)||!sle(a.status)||!Oh(a))return a;i=!0;const u=c.status==="cancelled"||c.status==="canceled",d=c.status==="failed"?"failed":"completed";return{...a,status:d,...a.startTime!==void 0?{endTime:a.startTime+(c.durationMs??0)}:{},...u?{rawOutput:{...typeof a.rawOutput=="object"&&a.rawOutput!==null&&!Array.isArray(a.rawOutput)?a.rawOutput:{},status:"cancelled"}}:{}}});return i?(n=!0,{...r,tools:o}):r});return n?s:e}function KT(e){const t=Cw(),n=la(),s=xa(),r=f.useMemo(()=>Rht(t,e),[t,e]),i=f.useMemo(()=>Lht(r),[r]),o=f.useMemo(()=>Dht(t),[t]),[a,c]=f.useState(),u=f.useRef(void 0);return f.useEffect(()=>{const d=s.sessionId;if(!d||s.status!=="connected"||s.loadingTranscript||s.catchingUp||!i){(!d||s.status!=="connected"||s.loadingTranscript||s.catchingUp)&&(u.current=void 0);return}const h=`${d}:${i}:${o}`,m=u.current,p=i.split("|"),g=(m==null?void 0:m.key)===h?m.request:Promise.allSettled(p.map(async x=>{const y=await n.client.resolveSubagentSession(d,x);return[x,y]})).then(x=>{const y=new Map;return x.forEach(v=>{v.status==="fulfilled"&&SD(v.value[1].status)&&y.set(...v.value)}),y});u.current={key:h,request:g};let b=!0;return g.then(x=>{b&&c(y=>({sessionId:d,resolutions:new Map([...(y==null?void 0:y.sessionId)===d?y.resolutions:[],...x])}))}).catch(()=>{var x;((x=u.current)==null?void 0:x.request)===g&&(u.current=void 0)}),()=>{b=!1}},[o,s.catchingUp,s.loadingTranscript,s.sessionId,s.status,i,n.client]),f.useMemo(()=>!a||a.sessionId!==s.sessionId?r:Pht(r,a.resolutions),[s.sessionId,r,a])}const Oht="session_artifacts";function rle(){var T,C;const e=Ib(),t=xa(),n=qY(),s=wd(),r=s==null?void 0:s.artifactsVersion,i=t.status==="connected",o=((C=(T=t.capabilities)==null?void 0:T.features)==null?void 0:C.includes(Oht))??!1,a=t.sessionId,[c,u]=f.useState([]),[d,h]=f.useState(!1),[m,p]=f.useState(null),g=f.useRef(0),b=f.useRef(void 0),x=f.useRef(n),y=f.useRef(r),v=f.useCallback(async()=>{const _=g.current+1;if(g.current=_,!a){b.current=void 0,u([]),p(null),h(!1);return}if(!i){b.current=void 0,u([]),p(null),h(!1);return}if(!o){b.current=void 0,u([]),p(null),h(!1);return}b.current!==void 0&&b.current!==a&&u([]),h(!0);try{const S=await e.loadArtifacts();if(g.current!==_)return;b.current=a,u(S.artifacts),p(null)}catch{if(g.current!==_)return;p(null)}finally{g.current===_&&h(!1)}},[e,i,a,o]),w=f.useRef(v);w.current=v,f.useEffect(()=>{v()},[v]),f.useEffect(()=>{const _=x.current;x.current=n,_!=="idle"&&n==="idle"&&w.current()},[n]),f.useEffect(()=>{const _=y.current;y.current=r,_!==void 0&&r!==void 0&&r!==_&&w.current()},[r]);const k=f.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 $ht(e,t,n,s){const r=[...e];let i=!1;for(const o of t)if(o.sessionId===n&&!(o.originatorClientId!==void 0&&o.originatorClientId!==s))for(const a of o.messages){const c=r.findIndex(u=>u.text===a&&(!u.images||u.images.length===0));c>=0&&(r.splice(c,1),i=!0)}return i?r:null}function Bht(e,t,n,s){return e?!0:(s.append(t),!1)}function ile(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const zht=100;function Fht(e,t){return e.trim()?e===t||e.startsWith(`${t}
`)?e:`${t}
${e}`:t}function ZU(e,t){return e.length!==t.length?!1:e.every((n,s)=>{var i,o,a,c;const r=t[s];return r!==void 0&&n.id===r.id&&n.sessionId===r.sessionId&&n.text===r.text&&n.serverPromptId===r.serverPromptId&&n.serverState===r.serverState&&n.isEditing===r.isEditing&&n.isRemoving===r.isRemoving&&(((i=n.images)==null?void 0:i.length)??0)===(((o=r.images)==null?void 0:o.length)??0)&&(((a=n.inputAnnotations)==null?void 0:a.length)??0)===(((c=r.inputAnnotations)==null?void 0:c.length)??0)})}function eW(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function ole({connected:e,sessionId:t,clientId:n,streamingState:s,sessionActions:r,store:i,editorRef:o,reportError:a,notifySuccess:c,t:u}){const[d,h]=f.useState([]),m=f.useRef([]),p=f.useRef(1),g=f.useRef(t),b=f.useRef(null),x=f.useRef(new Set),y=f.useRef(new Set),v=f.useRef(new Set),w=f.useRef(new Map),k=f.useRef(new Set),T=f.useRef([]),C=f.useRef(s),_=f.useRef(0);g.current=t,C.current=s;const S=f.useMemo(()=>d.map(le=>le.text),[d]);f.useEffect(()=>{m.current=d},[d]),f.useEffect(()=>{var le;m.current=[],h([]),w.current.clear(),k.current.clear(),T.current=[];for(const te of x.current)te.abort();x.current.clear(),y.current.clear(),v.current.clear(),A.current=void 0,(le=b.current)==null||le.abort(),b.current=null},[t]);const D=f.useCallback((le,te)=>{const z=m.current.filter(X=>X.serverPromptId?le.some(fe=>fe.promptId===X.serverPromptId):!0);for(const X of le){if(y.current.has(X.promptId))continue;const fe=z.findIndex(Ce=>Ce.serverPromptId===X.promptId),xe=v.current.has(X.promptId);if(fe!==-1){if(xe){z.splice(fe,1);continue}z[fe]={...z[fe],text:X.text,serverState:X.state};continue}const ie=z.filter(Ce=>!Ce.serverPromptId&&Ce.serverState==="submitting"&&Ce.text===X.text);if(ie.length===1){const Ce=z.indexOf(ie[0]);if(xe){z.splice(Ce,1);continue}z[Ce]={...ie[0],serverPromptId:X.promptId,serverState:X.state};continue}X.state==="running"||xe||z.push({id:p.current++,sessionId:te,text:X.text,serverPromptId:X.promptId,serverState:X.state})}ZU(m.current,z)||(m.current=z,h(z))},[]),E=f.useCallback(async(le=t)=>{if(!e||!le||g.current!==le)return"skipped";const te=++_.current;try{const z=await r.getPendingPrompts({sessionId:le});return te!==_.current?"superseded":g.current!==le?"skipped":(D(z.pendingPrompts.filter(X=>X.state==="queued"||X.state==="running"),le),"refreshed")}catch(z){return console.warn("Failed to refresh pending prompts",z),"failed"}},[e,r,t,D]),B=f.useCallback(le=>{const te=g.current,z=le.filter(ie=>ie.sessionId===void 0||ie.sessionId===te);if(z.length===0)return;const X=new Set(m.current.map(ie=>ie.id)),fe=z.filter(ie=>!X.has(ie.id));if(fe.length===0)return;const xe=[...m.current,...fe].sort((ie,Ce)=>ie.id-Ce.id);m.current=xe,h(xe)},[]),I=f.useCallback((le,te,z)=>{var xe,ie,Ce,Ke;if(z!==void 0&&g.current!==z)return;const X=((xe=o.current)==null?void 0:xe.getText())??"",fe=Fht(X,le);fe!==X&&((ie=o.current)==null||ie.setText(fe),te&&te.length>0&&((Ce=o.current)==null||Ce.restoreImages(te))),(Ke=o.current)==null||Ke.focus()},[o]),L=f.useSyncExternalStore(m0e,f0e),O=f.useRef(L),A=f.useRef(void 0);f.useEffect(()=>{if(!e||!t)return;const le=O.current!==L;if(O.current=L,!le){if(m.current.length>0||s==="idle"||A.current===t)return;A.current=t}E()},[L,e,t,s,E]);const $=f.useSyncExternalStore(p0e,t$,t$);f.useEffect(()=>{var te;if(!t||$.length===0)return;const le=[];for(const z of $){if(z.data.sessionId!==t)continue;le.push(z);const X=z.data.promptId;if(X){if(z.type==="pending_prompt_started"){if(y.current.has(X))continue;if((z.originatorClientId===void 0||z.originatorClientId===n)&&!v.current.has(X)){const xe=typeof z.data.text=="string"?z.data.text:"",ie=m.current.find(Ke=>Ke.serverPromptId===X)??m.current.find(Ke=>!Ke.serverPromptId&&Ke.serverState==="submitting"&&Ke.text===xe),Ce=(ie==null?void 0:ie.text)??"";Ce&&(v.current.add(X),i.appendLocalUserMessage(Ce,eW(ie==null?void 0:ie.images),(te=ie==null?void 0:ie.inputAnnotations)!=null&&te.length?{inputAnnotations:ie.inputAnnotations}:void 0))}E()}else if(z.type==="turn_complete"){v.current.delete(X);const fe=w.current.get(X);if(w.current.delete(X),fe)fe();else if(!k.current.has(X))for(k.current.add(X),T.current.push(X);T.current.length>zht;){const xe=T.current.shift();xe&&k.current.delete(xe)}}else if(z.type==="turn_error"||z.type==="pending_prompt_completed"&&z.data.state==="removed"){v.current.delete(X);const fe=w.current.get(X);w.current.delete(X),fe==null||fe(),k.current.delete(X),T.current=T.current.filter(xe=>xe!==X)}}}b0e(le)},[$,t,n,i,E]);const q=f.useCallback((le,te)=>{if(k.current.delete(le)){T.current=T.current.filter(z=>z!==le),te();return}w.current.set(le,te)},[]),U=f.useCallback((le,te,z,X)=>{const fe=le.trim();if(!fe)return!0;const xe=p.current++,ie=g.current,Ce=new AbortController;x.current.add(Ce);const Ke=te?[...te]:void 0,ut=X?[...X]:void 0,Et={id:xe,sessionId:ie,text:fe,images:Ke,inputAnnotations:ut,onComplete:z,serverState:"submitting"};return m.current=[...m.current,Et],h(m.current),r.submitPrompt(fe,{images:te,inputAnnotations:ut,optimisticUserMessage:!1,sessionId:ie,signal:Ce.signal}).then(st=>{if(x.current.delete(Ce),g.current!==ie){r.removePendingPrompt(st.promptId,{sessionId:ie}).catch(Yt=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:ie,promptId:st.promptId,error:Yt})});return}if(C.current==="idle"){v.current.has(st.promptId)||(v.current.add(st.promptId),i.appendLocalUserMessage(fe,eW(Ke),ut!=null&&ut.length?{inputAnnotations:ut}:void 0));const Yt=m.current.filter(It=>It.id!==xe);m.current=Yt,h(Yt),z&&q(st.promptId,z);return}const xt=m.current,He=xt.findIndex(Yt=>Yt.id===xe);if(He===-1){r.removePendingPrompt(st.promptId,{sessionId:ie}).then(Yt=>{Yt.removed||E(ie)},()=>{E(ie)});return}const pn=[...xt];pn[He]={...pn[He],serverPromptId:st.promptId,serverState:"queued"},m.current=pn,h(pn),z&&q(st.promptId,z)}).catch(st=>{if(x.current.delete(Ce),g.current!==ie||!m.current.some(He=>He.id===xe))return;const xt=m.current.filter(He=>He.id!==xe);m.current=xt,h(xt),I(fe,Ke,ie),a(st,u("queue.queueFailed"))}),!0},[E,a,I,r,q,i,u]);f.useEffect(()=>{if(s!=="idle")return;const le=b.current;le&&(le.abort(),b.current=null)},[s]);const H=f.useCallback(le=>{const te=m.current;if(te.length===0)return null;const z=le===void 0?te.length-1:te.findIndex(xe=>xe.id===le);if(z<0)return null;const X=te[z],fe=te.filter((xe,ie)=>ie!==z);return m.current=fe,h(fe),(X==null?void 0:X.text)??null},[]),M=f.useCallback((le,te)=>{const z=m.current.map(X=>X.id===le?{...X,...te}:X);ZU(z,m.current)||(m.current=z,h(z))},[]),ee=f.useCallback(async(le,te,z)=>{if(!le.serverPromptId)return!0;if(le.serverState!=="queued"||y.current.has(le.serverPromptId))return!1;const X=le.sessionId;y.current.add(le.serverPromptId),M(le.id,te);try{const fe=await r.removePendingPrompt(le.serverPromptId,{sessionId:X});return y.current.delete(le.serverPromptId),fe.removed?(w.current.delete(le.serverPromptId),await E(X)==="failed"&&(M(le.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),z)),!0):(M(le.id,{isEditing:!1,isRemoving:!1}),await E(X),a(new Error("Prompt could not be removed from queue"),z),!1)}catch(fe){return y.current.delete(le.serverPromptId),M(le.id,{isEditing:!1,isRemoving:!1}),await E(X)!=="refreshed"&&B([le]),a(fe,z),!1}},[E,a,B,r,M]),V=f.useCallback(le=>{const te=m.current.find(z=>z.id===le);if((te==null?void 0:te.serverState)!=="submitting"&&te){if(!te.serverPromptId){const z=m.current.filter(X=>X.id!==le);m.current=z,h(z);return}ee(te,{isRemoving:!0},u("queue.deleteFailed"))}},[ee,u]),R=f.useCallback(async le=>{var ie;const te=m.current.find(Ce=>Ce.id===le);if(!te||(((ie=te.images)==null?void 0:ie.length)??0)>0||te.serverState==="submitting"||te.isEditing||te.isRemoving||ile(te.text))return;const z=te.serverPromptId?te.onComplete??w.current.get(te.serverPromptId):void 0,X=()=>{te.serverPromptId&&w.current.delete(te.serverPromptId),z==null||z()};if(te.serverPromptId&&!await ee(te,{isRemoving:!0},u("queue.insertFailed")))return;let fe=b.current;fe||(fe=new AbortController,b.current=fe);let xe;try{xe=await r.enqueueMidTurnMessage(te.text,{signal:fe.signal})}catch(Ce){te.serverPromptId&&(I(te.text,te.images,te.sessionId),X()),a(Ce,u("queue.insertFailed"));return}if(!xe.accepted){te.serverPromptId&&(I(te.text,te.images,te.sessionId),X()),a(new Error("Queued message was not accepted for insertion"),u("queue.insertFailed"));return}if(X(),!te.serverPromptId){const Ce=m.current.filter(Ke=>Ke.id!==le);m.current=Ce,h(Ce)}c(u("queue.inserted"))},[ee,c,a,I,r,u]),re=f.useCallback(async le=>{const te=m.current.find(X=>X.id===le);if(!te||te.serverState==="submitting"||te.isEditing||te.isRemoving)return;if(te.serverPromptId){if(!await ee(te,{isEditing:!0},u("queue.editFailed")))return;I(te.text,te.images,te.sessionId);return}const z=H(le);z&&I(z,te.images,te.sessionId)},[H,ee,I,u]),Z=f.useCallback(()=>{const le=m.current;if(le.length===0)return!1;const te=le[le.length-1];if(!te)return!1;if(te.serverState==="submitting"||te.isEditing||te.isRemoving)return!0;if(!te.serverPromptId){const z=H(te.id);return z?(I(z,te.images,te.sessionId),!0):!1}return te.serverState!=="queued"?!1:((async()=>{await ee(te,{isEditing:!0},u("queue.editFailed"))&&I(te.text,te.images,te.sessionId)})().catch(z=>{a(z,u("queue.editFailed"))}),!0)},[H,ee,a,I,u]),K=f.useCallback(()=>{if(m.current.length===0)return!1;const le=g.current,te=m.current.filter(Ce=>Ce.serverState==="submitting"),z=m.current.filter(Ce=>Ce.serverState!=="submitting");for(const Ce of[...te].reverse())I(Ce.text,Ce.images,Ce.sessionId);for(const Ce of x.current)Ce.abort();const X=z.filter(Ce=>Ce.serverPromptId);if(X.length===0)return m.current=[],h([]),i.dispatch([{type:"status",text:u("queue.cleared")}]),!0;const fe=new Set(m.current.map(Ce=>Ce.id)),xe=new Set(X.map(Ce=>Ce.serverPromptId).filter(Ce=>!!Ce));for(const Ce of xe)y.current.add(Ce);const ie=m.current.filter(Ce=>!fe.has(Ce.id)).concat(X.map(Ce=>({...Ce,isRemoving:!0})));return m.current=ie,h(ie),(async()=>{var Et;const Ce=[];if(await Promise.all(X.map(async st=>{const xt=st.serverPromptId;try{if((await r.removePendingPrompt(xt,{sessionId:st.sessionId})).removed){w.current.delete(xt);return}Ce.push(st)}catch{Ce.push(st)}finally{y.current.delete(xt)}})),g.current!==le)return;const Ke=Ce.map(st=>({...st,isRemoving:!1})),ut=m.current.filter(st=>st.serverPromptId?!xe.has(st.serverPromptId):!fe.has(st.id)).concat(Ke);if(m.current=ut,h(ut),Ce.length>0){a(new Error("Some prompts could not be removed from queue"),u("queue.deleteFailed")),E((Et=Ce[0])==null?void 0:Et.sessionId);return}i.dispatch([{type:"status",text:u("queue.cleared")}])})(),!0},[E,a,I,i,u,r]),{batches:Y,consume:ae}=Y0e();return f.useEffect(()=>{if(!t||Y.length===0)return;const le=$ht(m.current,Y,t,n);le&&(m.current=le,h(le)),ae(Y.filter(te=>te.sessionId===t))},[Y,t,n,ae]),{queuedPrompts:d,queuedTexts:S,enqueuePrompt:U,removeQueuedPrompt:V,insertQueuedPrompt:R,editQueuedPrompt:re,editLastQueuedPrompt:Z,clearQueuedPrompts:K}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function KN(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?yu(e.toolName):!0}const Hht=3e4;function I3(e){return Mb.includes(e)}async function qht({sessionActions:e,modelId:t,modeId:n,workspaceCwd:s,worktree:r,branch:i,onSessionCreated:o,onSessionAllocated:a,getCurrentSessionId:c,warn:u=console.warn}){const d=n&&I3(n)?n:void 0,{sessionId:h,worktree:m,branch:p}=await e.createSession({workspaceCwd:s,sourceType:o4,...d?{approvalMode:d}:{},...r?{worktree:r}:{},...i?{branch:i}:{}});a==null||a(h);let g="prepare new session";try{if(o){g="run onSessionCreated";let y;try{await Promise.race([o(h),new Promise((v,w)=>{y=setTimeout(()=>w(new Error("onSessionCreated timed out")),Hht)})])}finally{clearTimeout(y)}}g="verify session identity";const b=c();if(b!==void 0&&b!==h)throw new Error(`Session changed before attach: expected ${h}, found ${b}`);g="attach new session",await e.attachSession(),g="verify attached session";const x=c();if(x!==void 0&&x!==h)throw new Error(`Session changed while attaching: expected ${h}, found ${x}`)}catch(b){u(`[WebShell] failed to ${g}:`,b),await e.releaseSession(h).catch(y=>{u("[WebShell] failed to release unattached session:",y)});const x=c();throw x===void 0||x===h?await e.clearSession().catch(y=>{u("[WebShell] failed to clear unattached session:",y)}):u(`[WebShell] skipping clearSession: expected ${h}, found ${x}`),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 Uht=new Set(["coder-model(qwen-oauth)"]);function Ev(e){return!Uht.has(e.id)}function Wht({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function ale({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"loading":t||n?"processing":"idle"}function Vht(e){switch(ale(e)){case"loading":return"common.loading";case"processing":return"editor.processing";case"idle":return"editor.placeholder"}}function lle({connectionStatus:e,hasSession:t,restartSseOnPrompt:n}){return e==="error"?!0:e==="disconnected"&&(!n||!t)}const cle=/^\/([\w-]+)(?=\s|$)/;function ule(e,t,n){if(!t)return!1;const s=e.match(cle);if(!s)return!1;try{return t({command:s[1].toLowerCase(),args:e.slice(s[0].length).trim(),input:e})===!0}catch(r){return n(r,"onSlashCommand callback failed"),!1}}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const YN=["blue","green","purple","orange","yellow","red"];for(const e of YN){if(gD[e])continue;const t=`WorkspaceAccent.module.css is missing a class for the "${e}" accent`;console.error(t)}function Ght(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function Kht(e,t){if(!e)return;const s=((t==null?void 0:t.workspaces)??[]).findIndex(i=>i.cwd===e),r=s>=0?s:Ght(e);return YN[r%YN.length]}function dle(e){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:"<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:"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(n=>({...n,source:"builtin-command"}))}const Yht={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"},Xht={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 hle(e){return Xht[e]}function fle(e,t){return e.map(n=>{const s=Yht[n.name];return!s||n.source&&n.source!=="builtin-command"?n:{...n,description:t(s)}})}function mle(...e){const t=new Map;for(const n of e)for(const s of n){const r=t.get(s.name);r?t.set(s.name,{...r,...s,description:s.description||r.description,argumentHint:s.argumentHint??r.argumentHint}):t.set(s.name,s)}return[...t.values()]}const Qht="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",Jht="/assets/insert-DmRbh9Rv.svg",Zht="/assets/queue-DWpnpFgW.svg",eft="_app_7uwuo_1",tft="_appChat_7uwuo_43",nft="_appChatEmpty_7uwuo_49",sft="_appShell_7uwuo_54",rft="_chatPane_7uwuo_62",ift="_artifactResizeHandle_7uwuo_71",oft="_artifactPanelDock_7uwuo_88",aft="_artifactPanelClip_7uwuo_96",lft="_chatPaneShowingPage_7uwuo_124",cft="_fullPage_7uwuo_130",uft="_fullPageHeader_7uwuo_139",dft="_splitApprovalNotice_7uwuo_149",hft="_fullPageBack_7uwuo_175",fft="_fullPageTitle_7uwuo_192",mft="_fullPageBody_7uwuo_197",pft="_mobileDrawer_7uwuo_204",gft="_mobileBackdrop_7uwuo_208",bft="_mobileDrawerForced_7uwuo_215",yft="_hamburgerButton_7uwuo_243",vft="_mobileDrawerOpen_7uwuo_288",xft="_hamburgerButtonFloating_7uwuo_323",wft="_appWithSidebar_7uwuo_331",kft="_themeDark_7uwuo_341",_ft="_themeLight_7uwuo_414",Sft="_content_7uwuo_487",Cft="_contentHasMessages_7uwuo_495",Tft="_missingSessionState_7uwuo_504",Eft="_missingSessionMessage_7uwuo_517",Aft="_missingSessionButton_7uwuo_524",jft="_panelHost_7uwuo_559",Nft="_panelHeader_7uwuo_567",Mft="_panelBack_7uwuo_577",Ift="_panelTitle_7uwuo_603",Rft="_panelBody_7uwuo_612",Dft="_chatViewWrap_7uwuo_624",Lft="_chatViewHidden_7uwuo_632",Pft="_chatSubtree_7uwuo_636",Oft="_chatSubtreeHidden_7uwuo_640",$ft="_footer_7uwuo_653",Bft="_bottomPanels_7uwuo_663",zft="_approvalOverlay_7uwuo_678",Fft="_scrollToBottomLayer_7uwuo_692",Hft="_scrollToBottomLayerWithTodos_7uwuo_703",qft="_scrollToBottomButton_7uwuo_710",Uft="_scrollToBottomIcon_7uwuo_739",Wft="_btwPanel_7uwuo_745",Vft="_composer_7uwuo_752",Gft="_composerHeader_7uwuo_757",Kft="_chatHeader_7uwuo_761",Yft="_customFooter_7uwuo_765",Xft="_escClearStatus_7uwuo_771",Qft="_composerActionTip_7uwuo_778",Jft="_composerActionTipIcon_7uwuo_788",Zft="_composerActionTipText_7uwuo_795",emt="_composerActionTipActions_7uwuo_802",tmt="_composerActionTipButton_7uwuo_808",nmt="_composerActionTipButtonPrimary_7uwuo_825",smt="_emptyWelcomeFooter_7uwuo_844",rmt="_mobileWelcomeFooterMiddle_7uwuo_848",imt="_mobileWelcomeGroup_7uwuo_852",omt="_chatPaneWithMobileComposerBottom_7uwuo_857",amt="_chatViewWithMobileComposerBottom_7uwuo_862",lmt="_chatViewWithWelcomeMiddle_7uwuo_875",cmt="_footerWithCustomFooter_7uwuo_875",umt="_desktopWelcomeFooter_7uwuo_909",dmt="_queuedPrompts_7uwuo_918",hmt="_queuedPrompt_7uwuo_918",fmt="_queuedPromptIcon_7uwuo_948",mmt="_queuedPromptMaskIcon_7uwuo_958",pmt="_queuedPromptActionIcon_7uwuo_959",gmt="_queuedPromptText_7uwuo_972",bmt="_queuedPromptState_7uwuo_980",ymt="_queuedPromptSpinner_7uwuo_988",vmt="_queuedPromptActions_7uwuo_1003",xmt="_queuedPromptAction_7uwuo_959",wmt="_queuedHint_7uwuo_1048",At={app:eft,appChat:tft,appChatEmpty:nft,appShell:sft,chatPane:rft,artifactResizeHandle:ift,artifactPanelDock:oft,artifactPanelClip:aft,chatPaneShowingPage:lft,fullPage:cft,fullPageHeader:uft,splitApprovalNotice:dft,fullPageBack:hft,fullPageTitle:fft,fullPageBody:mft,mobileDrawer:pft,mobileBackdrop:gft,mobileDrawerForced:bft,hamburgerButton:yft,mobileDrawerOpen:vft,hamburgerButtonFloating:xft,appWithSidebar:wft,themeDark:kft,themeLight:_ft,content:Sft,contentHasMessages:Cft,missingSessionState:Tft,missingSessionMessage:Eft,missingSessionButton:Aft,panelHost:jft,panelHeader:Nft,panelBack:Mft,panelTitle:Ift,panelBody:Rft,chatViewWrap:Dft,chatViewHidden:Lft,chatSubtree:Pft,chatSubtreeHidden:Oft,footer:$ft,bottomPanels:Bft,approvalOverlay:zft,scrollToBottomLayer:Fft,scrollToBottomLayerWithTodos:Hft,scrollToBottomButton:qft,scrollToBottomIcon:Uft,btwPanel:Wft,composer:Vft,composerHeader:Gft,chatHeader:Kft,customFooter:Yft,escClearStatus:Xft,composerActionTip:Qft,composerActionTipIcon:Jft,composerActionTipText:Zft,composerActionTipActions:emt,composerActionTipButton:tmt,composerActionTipButtonPrimary:nmt,emptyWelcomeFooter:smt,mobileWelcomeFooterMiddle:rmt,mobileWelcomeGroup:imt,chatPaneWithMobileComposerBottom:omt,chatViewWithMobileComposerBottom:amt,chatViewWithWelcomeMiddle:lmt,footerWithCustomFooter:cmt,desktopWelcomeFooter:umt,queuedPrompts:dmt,queuedPrompt:hmt,queuedPromptIcon:fmt,queuedPromptMaskIcon:mmt,queuedPromptActionIcon:pmt,queuedPromptText:gmt,queuedPromptState:bmt,queuedPromptSpinner:ymt,queuedPromptActions:vmt,queuedPromptAction:xmt,queuedHint:wmt},kmt=240;function _mt(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function Smt(e,t){if(e.inputAnnotations&&e.inputAnnotations.length>0)return oX(e.text,e.inputAnnotations).map(s=>s.type==="text"?s:{type:"tag",tag:s.tag,preserveCustomKindLabel:!0});const n=A9(e.text,t,"[WebShell] failed to parse queued prompt content",{requireSourcePreservation:!0});return n?n.map(s=>s.type==="text"?s:{type:"tag",tag:s.tag,preserveCustomKindLabel:!1}):[{type:"text",text:e.text}]}function Cmt(e){const t=[];let n=kmt,s=!1;for(const i of e){if(i.type==="tag"){if(n<=0){s=!0;break}const a=_mt(i.tag).length;if(a>n){s=!0;break}t.push(i),n-=a;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)}),s=!0;break}t.push({type:"text",text:o}),n-=o.length}}const r=t[t.length-1];if((r==null?void 0:r.type)==="text"){const i=r.text.trimEnd();i?r.text=i:t.pop()}return{parts:t,truncated:s}}function ple({prompts:e,t,onDelete:n,onInsert:s,onEdit:r}){const{parseUserMessageContent:i,composerTagIcons:o,renderComposerTag:a,renderComposerTagTooltip:c,onComposerTagClick:u}=mu();return e.length===0?null:l.jsxs("div",{className:At.queuedPrompts,children:[e.map(d=>{var T;const h=Cmt(Smt(d,i)),m=((T=d.images)==null?void 0:T.length)??0,p=ile(d.text),g=d.serverState==="submitting",b=d.serverState==="running",x=d.isRemoving===!0,y=g||b||d.isEditing===!0||x;let v=t("queue.insertTip");y?v=t("queue.submittingDisabled"):p&&(v=t("queue.insertCommandDisabled"));let w=t("queue.editTip");y&&(w=t("queue.submittingDisabled"));const k=t(y?"queue.submittingDisabled":"queue.deleteTip");return l.jsxs("div",{className:At.queuedPrompt,children:[l.jsx("span",{className:At.queuedPromptIcon,"aria-hidden":"true",children:l.jsx("span",{className:At.queuedPromptMaskIcon,style:Kf("--queued-icon-url",Zht)})}),l.jsxs("span",{className:At.queuedPromptText,children:[h.parts.map((C,_)=>C.type==="text"?l.jsx(f.Fragment,{children:C.text},_):l.jsx(tD,{tag:C.tag,composerTagIcons:o,renderComposerTag:a,renderComposerTagTooltip:c,onComposerTagClick:u,preserveCustomKindLabel:C.preserveCustomKindLabel},`${C.tag.id}:${_}`)),h.truncated?"...":null,m>0?` ${t("queue.imageCount",{count:m})}`:"",g||d.isEditing||x?l.jsxs("span",{className:At.queuedPromptState,children:[l.jsx("span",{className:At.queuedPromptSpinner}),x?t("queue.removing"):d.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),l.jsxs("span",{className:At.queuedPromptActions,children:[m===0&&l.jsxs("button",{type:"button",className:At.queuedPromptAction,onClick:()=>s(d.id),disabled:p||y,title:v,children:[l.jsx("span",{className:At.queuedPromptActionIcon,style:Kf("--queued-icon-url",Jht),"aria-hidden":"true"}),t("queue.insert")]}),l.jsx("button",{type:"button",className:At.queuedPromptAction,onClick:()=>n(d.id),disabled:y,"aria-label":t("queue.delete"),title:k,children:l.jsx("span",{className:At.queuedPromptActionIcon,style:Kf("--queued-icon-url",Qht),"aria-hidden":"true"})}),l.jsx("button",{type:"button",className:At.queuedPromptAction,onClick:()=>r(d.id),disabled:y,"aria-label":t("queue.edit"),title:w,children:l.jsx("span",{className:At.queuedPromptActionIcon,style:Kf("--queued-icon-url",Mae),"aria-hidden":"true"})})]})]},d.id)}),l.jsx("div",{className:At.queuedHint,children:t("queue.footer")})]})}const Tmt="_approval_5nswb_1",Emt="_floating_5nswb_18",Amt="_header_5nswb_31",jmt="_icon_5nswb_41",Nmt="_name_5nswb_56",Mmt="_desc_5nswb_67",Imt="_content_5nswb_87",Rmt="_code_5nswb_105",Dmt="_codeBlock_5nswb_113",Lmt="_question_5nswb_136",Pmt="_options_5nswb_148",Omt="_option_5nswb_148",$mt="_optionPlain_5nswb_183",Bmt="_optionSecondary_5nswb_193",zmt="_optionPrimary_5nswb_200",Fmt="_optionActive_5nswb_211",Hmt="_pointer_5nswb_215",qmt="_num_5nswb_219",Umt="_label_5nswb_223",Wi={approval:Tmt,floating:Emt,header:Amt,icon:jmt,name:Nmt,desc:Mmt,content:Imt,code:Rmt,codeBlock:Dmt,question:Lmt,options:Pmt,option:Omt,optionPlain:$mt,optionSecondary:Bmt,optionPrimary:zmt,optionActive:Fmt,pointer:Hmt,num:qmt,label:Umt};function Wmt(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 Vmt(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function Gmt(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 Kmt(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 Ymt(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function O7(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 tW(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 y2(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const s=tW(t.option)-tW(n.option);return s===0?t.index-n.index:s}).map(({option:t})=>t)}function Xmt(e){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 Qmt(e){return e.kind==="allow_once"?Wi.optionPrimary:e.kind==="allow_always"?Wi.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?Wi.optionPlain:Wi.optionSecondary}function gle({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=at(),i=f.useMemo(()=>y2(e.options),[e.options]),[o,a]=f.useState(()=>O7(y2(e.options))),c=f.useRef(e);c.current=e;const u=f.useRef(o);u.current=o;const d=f.useRef(!1),h=f.useRef([]),m=f.useId(),p=f.useId(),g=f.useId(),b=f.useId();f.useEffect(()=>{const $=O7(y2(c.current.options));d.current=!1,u.current=$,a($)},[e.id]);const x=Wmt(e.title),y=e.toolName||x.toolName||e.kind||"Tool",v=uu(y,r),w=Ymt(e),k=Vmt(e),T=f.useCallback($=>{d.current||(d.current=!0,t(c.current.id,$))},[t]),C=f.useCallback($=>{const q=h.current[$];q&&(document.activeElement===q&&q.blur(),q.focus())},[]),_=f.useRef(!1),S=f.useRef(e.id);f.useEffect(()=>{const $=_.current,q=S.current;if(_.current=s,S.current=e.id,!s)return;const U=e.id!==q;$&&!U||C(U?O7(y2(c.current.options)):u.current)},[s,e.id,C]);const D=f.useCallback($=>{const q=i.length,U=(u.current+$+q)%q;u.current=U,a(U),C(U)},[i.length,C]),E=f.useCallback($=>{const q=i.length;if($.key==="ArrowDown"||$.key==="j")$.preventDefault(),D(1);else if($.key==="ArrowUp"||$.key==="k")$.preventDefault(),D(-1);else if($.key==="Home")$.preventDefault(),u.current=0,a(0),C(0);else if($.key==="End"){$.preventDefault();const U=q-1;u.current=U,a(U),C(U)}else if($.key==="Escape"){$.preventDefault();const U=c.current.options.find(H=>H.kind==="reject_once"||H.kind==="reject_always");U&&T(U.id)}else if($.key>="1"&&$.key<="9"){const U=parseInt($.key,10)-1;U<q&&($.preventDefault(),T(i[U].id))}},[i,D,T,C]),B=Gmt(e),I=Afe(e.toolName),L=Kmt(e),O=!!(B&&L||k&&k!==e.title),A=I?r("approval.launchAgentQuestion"):B?r("approval.execQuestion",{tool:v}):r("approval.changeQuestion");return l.jsxs("div",{className:n==="floating"?`${Wi.approval} ${Wi.floating}`:Wi.approval,"data-web-shell-permission-panel":!0,role:"alertdialog","aria-labelledby":m,"aria-describedby":[p,w?g:null,O?b:null].filter(Boolean).join(" "),onKeyDown:E,children:[l.jsxs("div",{className:Wi.header,children:[l.jsx("span",{className:Wi.icon,"aria-hidden":"true",children:"?"}),l.jsx("span",{className:Wi.name,id:m,children:v})]}),w&&l.jsx("div",{className:Wi.desc,id:g,title:w,children:w}),B&&L?l.jsx("div",{className:Wi.code,children:l.jsx("pre",{className:Wi.codeBlock,id:b,title:L,children:L})}):k&&k!==e.title?l.jsx("pre",{className:Wi.content,id:b,title:k,children:k}):null,l.jsx("div",{className:Wi.question,id:p,children:A}),l.jsx("div",{className:Wi.options,role:"radiogroup",children:i.map(($,q)=>{const U=q===o,H=Xmt($),M=H?r(H):$.label;return l.jsxs("button",{type:"button",ref:ee=>{h.current[q]=ee},className:`${Wi.option} ${Qmt($)} ${U?Wi.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":$.id,tabIndex:U?0:-1,role:"radio","aria-checked":U,"aria-keyshortcuts":q<9?String(q+1):void 0,onClick:()=>T($.id),onFocus:()=>{u.current=q,a(q)},children:[l.jsx("span",{className:Wi.pointer,"aria-hidden":"true",children:U?"›":" "}),l.jsxs("span",{className:Wi.num,"aria-hidden":"true",children:[q+1,"."]}),l.jsx("span",{className:Wi.label,children:M})]},$.id)})})]})}const Jmt="_question_1paag_1",Zmt="_floating_1paag_18",ept="_titleLine_1paag_30",tpt="_icon_1paag_38",npt="_toolName_1paag_42",spt="_toolDesc_1paag_46",rpt="_tabs_1paag_53",ipt="_topRight_1paag_63",opt="_collapseButton_1paag_70",apt="_collapseIcon_1paag_89",lpt="_collapseIconCollapsed_1paag_95",cpt="_collapsed_1paag_99",upt="_tab_1paag_53",dpt="_tabActive_1paag_118",hpt="_text_1paag_135",fpt="_description_1paag_143",mpt="_multiHint_1paag_151",ppt="_options_1paag_157",gpt="_option_1paag_157",bpt="_optionActive_1paag_194",ypt="_optionSelected_1paag_195",vpt="_optionLabel_1paag_200",xpt="_pointer_1paag_205",wpt="_optionNum_1paag_209",kpt="_editIcon_1paag_226",_pt="_optionContent_1paag_258",Spt="_optionPlaceholder_1paag_274",Cpt="_optionDesc_1paag_279",Tpt="_customInput_1paag_286",Ept="_customTrigger_1paag_301",Apt="_actions_1paag_327",jpt="_button_1paag_335",Npt="_submitButton_1paag_361",Mpt="_ignoreButton_1paag_367",Os={question:Jmt,floating:Zmt,titleLine:ept,icon:tpt,toolName:npt,toolDesc:spt,tabs:rpt,topRight:ipt,collapseButton:opt,collapseIcon:apt,collapseIconCollapsed:lpt,collapsed:cpt,tab:upt,tabActive:dpt,text:hpt,description:fpt,multiHint:mpt,options:ppt,option:gpt,optionActive:bpt,optionSelected:ypt,optionLabel:vpt,pointer:xpt,optionNum:wpt,editIcon:kpt,optionContent:_pt,optionPlaceholder:Spt,optionDesc:Cpt,customInput:Tpt,customTrigger:Ept,actions:Apt,button:jpt,submitButton:Npt,ignoreButton:Mpt};function ble({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=at(),i=f.useMemo(()=>{var z;return Array.isArray((z=e.rawInput)==null?void 0:z.questions)?e.rawInput.questions:[]},[e.rawInput]),[o,a]=f.useState(0),[c,u]=f.useState(null),[d,h]=f.useState({}),[m,p]=f.useState({}),[g,b]=f.useState({}),[x,y]=f.useState(!1),[v,w]=f.useState(!1),k=f.useRef(!1),T=f.useRef([]),C=f.useRef(null),_=f.useRef(c);_.current=c;const S=f.useId(),D=f.useId();f.useEffect(()=>{const z=i[0];k.current=!1,w(!1),a(0),_.current=z!=null&&z.options.length?0:null,u(z!=null&&z.options.length?0:null),h(z&&!z.multiSelect&&z.options[0]?{0:z.options[0].label}:{}),p({}),b(z!=null&&z.multiSelect&&z.options[0]?{0:[z.options[0].label]}:{}),y(!1)},[i,e.id]);const E=i[o],B=(E==null?void 0:E.multiSelect)??!1,I=f.useCallback(()=>{const z={};for(let X=0;X<i.length;X++){const fe=i[X];if(fe)if(fe.multiSelect){const xe=g[X]||[],ie=m[X],Ce=ie?[...xe,ie]:xe;z[String(X)]=Ce.join(", ")}else z[String(X)]=d[X]||m[X]||""}return z},[i,g,m,d]),L=f.useCallback(()=>{if(k.current)return;const z=e.options.find(X=>X.kind==="allow_once");z&&(k.current=!0,t(e.id,z.id,I()))},[I,e,t]),O=f.useCallback(()=>{if(k.current)return;const z=e.options.find(X=>X.kind==="reject_once"||X.kind==="reject_always");z&&(k.current=!0,t(e.id,z.id,void 0))},[e,t]),A=f.useCallback(z=>{z!==void 0&&p(X=>({...X,[o]:z})),B||h(X=>{if(!(o in X))return X;const fe={...X};return delete fe[o],fe}),y(!0)},[o,B]),$=f.useCallback(z=>{if(!E)return;if(z===E.options.length){A();return}const fe=E.options[z].label;if(B){const xe=g[o]||[],ie=xe.includes(fe)?xe.filter(Ce=>Ce!==fe):[...xe,fe];b({...g,[o]:ie})}else{const xe={...d,[o]:fe};h(xe),p(ie=>{if(!(o in ie))return ie;const Ce={...ie};return delete Ce[o],Ce})}},[E,o,B,g,d,A]),q=f.useCallback(z=>{if(!E||!B)return;if(z===E.options.length){A();return}const X=E.options[z].label,fe=g[o]||[],xe=fe.includes(X)?fe.filter(ie=>ie!==X):[...fe,X];b({...g,[o]:xe})},[E,B,g,o,A]),U=f.useCallback(z=>{if(E){if(_.current=z,u(z),z===E.options.length){A();return}B?q(z):$(z)}},[E,B,A,q,$]),H=f.useCallback(z=>{var X,fe;E&&(_.current=z,u(z),z===E.options.length?((X=C.current)==null||X.focus(),B||h(xe=>{if(!(o in xe))return xe;const ie={...xe};return delete ie[o],ie})):((fe=T.current[z])==null||fe.focus(),B||$(z)))},[E,o,B,$]),M=f.useCallback(z=>{if(!E)return;const X=E.options.length+1,fe=_.current??0;H((fe+z+X)%X)},[E,H]),ee=f.useCallback(z=>{if(N0(z.target)||!z.target.closest("[data-web-shell-ask-option]")||!E)return;const X=E.options.length+1;if(z.key==="ArrowDown"||z.key==="j")z.preventDefault(),M(1);else if(z.key==="ArrowUp"||z.key==="k")z.preventDefault(),M(-1);else if(z.key==="Home")z.preventDefault(),H(0);else if(z.key==="End")z.preventDefault(),H(X-1);else if(z.key==="Escape")z.preventDefault(),O();else if(z.key>="1"&&z.key<="9"){const fe=parseInt(z.key,10)-1;fe<X&&(z.preventDefault(),U(fe))}},[E,M,H,O,U]),V=f.useRef(!1),R=f.useRef(e.id),re=f.useRef((E==null?void 0:E.options.length)??0);if(re.current=(E==null?void 0:E.options.length)??0,f.useEffect(()=>{var xe,ie;const z=V.current,X=R.current;if(V.current=s,R.current=e.id,!s||z&&e.id===X)return;const fe=_.current??0;fe===re.current?(xe=C.current)==null||xe.focus():(ie=T.current[fe])==null||ie.focus()},[s,e.id]),i.length===0)return null;const Z=z=>{const X=i[z];return X?X.multiSelect?(g[z]||[]).length>0||!!m[z]:!!d[z]||!!m[z]:!1},K=i.every((z,X)=>Z(X)),Y=Math.min(o,i.length-1),ae=z=>{const X=i[z];if(a(z),y(!1),!(X!=null&&X.options.length)){u(null);return}if(u(0),X.multiSelect){b(fe=>(fe[z]||[]).length>0||m[z]?fe:{...fe,[z]:[X.options[0].label]});return}h(fe=>fe[z]||m[z]?fe:{...fe,[z]:X.options[0].label})},le=()=>{o<=0||ae(o-1)},te=()=>{o>=i.length-1||ae(o+1)};return l.jsxs("div",{className:`${Os.question} ${n==="floating"?Os.floating:""} ${v?Os.collapsed:""}`,"data-web-shell-ask-panel":!0,role:"alertdialog","aria-label":uu("ask_user_question",r),"aria-labelledby":v?void 0:`${D} ${S}`,onKeyDown:ee,children:[l.jsxs("div",{className:Os.titleLine,children:[l.jsx("span",{className:Os.icon,"aria-hidden":"true",children:"?"}),l.jsx("span",{className:Os.toolName,id:D,children:uu("ask_user_question",r)}),l.jsx("span",{className:Os.toolDesc,children:r("askUser.progress",{current:Y+1,total:i.length})}),l.jsxs("div",{className:Os.topRight,children:[l.jsx("div",{className:Os.tabs,children:i.map((z,X)=>l.jsx("span",{className:`${Os.tab} ${X===o?Os.tabActive:""}`,"aria-hidden":"true"},X))}),l.jsx("button",{type:"button",className:Os.collapseButton,onClick:()=>w(z=>!z),"aria-expanded":!v,"aria-label":r(v?"common.expand":"common.collapse"),title:r(v?"common.expand":"common.collapse"),children:l.jsx("svg",{viewBox:"0 0 16 16",className:`${Os.collapseIcon} ${v?Os.collapseIconCollapsed:""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!v&&l.jsxs(l.Fragment,{children:[E?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:Os.text,id:S,children:[E.question,B&&l.jsxs("span",{className:Os.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),l.jsx("p",{className:Os.description,children:r("askUser.selectAnswer")}),l.jsxs("div",{className:Os.options,role:B?"group":"radiogroup","aria-labelledby":S,children:[E.options.map((z,X)=>{const fe=X===c,xe=B?(g[o]||[]).includes(z.label):d[o]===z.label;return l.jsxs("button",{type:"button",ref:ie=>{T.current[X]=ie},className:`${Os.option} ${fe?Os.optionActive:""} ${xe?Os.optionSelected:""}`,"data-web-shell-ask-option":!0,tabIndex:fe?0:-1,role:B?void 0:"radio","aria-checked":B?void 0:xe,"aria-pressed":B?xe:void 0,"aria-keyshortcuts":X<9?String(X+1):void 0,onClick:()=>U(X),onFocus:()=>u(X),children:[l.jsx("span",{className:Os.pointer,"aria-hidden":"true",children:fe?"›":" "}),l.jsx("span",{className:Os.optionNum,"aria-hidden":"true",children:X+1}),l.jsxs("span",{className:Os.optionContent,children:[l.jsx("span",{className:Os.optionLabel,children:z.label}),z.description&&l.jsx("span",{className:Os.optionDesc,children:z.description})]})]},z.label)}),(()=>{const z=c===E.options.length,X=!!m[o];return l.jsxs("div",{className:`${Os.option} ${z?Os.optionActive:""} ${X?Os.optionSelected:""}`,onClick:()=>U(E.options.length),children:[l.jsx("span",{className:Os.pointer,"aria-hidden":"true",children:z?"›":" "}),l.jsx("span",{className:Os.editIcon,"aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 16 16",children:l.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"})})}),x?l.jsx("input",{type:"text",className:Os.customInput,placeholder:r("askUser.typePlaceholder"),value:m[o]||"","aria-label":r("askUser.typePlaceholder"),onChange:fe=>p({...m,[o]:fe.target.value}),onClick:fe=>fe.stopPropagation(),onFocus:()=>u(E.options.length),onBlur:()=>y(!1),autoFocus:!0}):l.jsx("button",{type:"button",ref:C,className:`${Os.customTrigger} ${m[o]?"":Os.optionPlaceholder}`,"data-web-shell-ask-option":!0,tabIndex:z?0:-1,role:B?void 0:"radio","aria-checked":B?void 0:X,"aria-pressed":B?X:void 0,"aria-keyshortcuts":E.options.length<9?String(E.options.length+1):void 0,onFocus:()=>u(E.options.length),children:m[o]||r("askUser.typePlaceholder")})]})})()]})]}):null,l.jsxs("div",{className:Os.actions,children:[l.jsx("button",{type:"button",className:Os.ignoreButton,onClick:O,children:r("askUser.ignore")}),i.length>1&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:Os.button,disabled:o<=0,onClick:le,children:r("common.previous")}),l.jsx("button",{type:"button",className:Os.button,disabled:o>=i.length-1,onClick:te,children:r("common.next")})]}),l.jsx("button",{type:"button",className:`${Os.button} ${Os.submitButton}`,disabled:!K,onClick:L,children:r("askUser.submit")})]})]})]})}const Ipt=1e6;function yle(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 s of yle(n))t.add(s);return Array.from(t)}function vle(e,t,n){const s=new Map,r=[];let i=null;for(const a of e){if(a.role==="user"||a.role==="user_shell"){i=a.id;continue}if(i||(i=a.id),a.role==="tool_group")for(const c of a.tools){for(const u of yle(c))s.set(u,i);xle(c,i,r)}}const o=new Map;for(const a of t){const c=Rpt(r,a,n);if(c.size===0&&a.toolCallId){const u=s.get(a.toolCallId);u&&c.add(u)}for(const u of c){const d=o.get(u);d?d.some(h=>h.id===a.id)||d.push(a):o.set(u,[a])}}return o}function xle(e,t,n){e.toolName.toLowerCase()==="record_artifact"&&n.push({turnId:t,workspacePath:bh(e.args,"workspacePath"),managedId:bh(e.args,"managedId"),url:bh(e.args,"url")});for(const s of e.subTools??[])xle(s,t,n)}function Rpt(e,t,n){const s=new Set;for(const r of e){if(r.workspacePath&&t.workspacePath&&Ale(r.workspacePath,t.workspacePath,n)){s.add(r.turnId);continue}if(r.managedId&&r.managedId===t.managedId){s.add(r.turnId);continue}r.url&&r.url===t.url&&s.add(r.turnId)}return s}function wle(e,t,n){const s=new Map;let r=null;for(const i of e){if(i.role==="user"||i.role==="user_shell"){r=i.id;continue}if(r||(r=i.id),i.role!=="tool_group")continue;const o=new Set((t.get(r)??[]).map(a=>M0(a.workspacePath)).filter(a=>!!a));for(const a of i.tools)Sle(a,r,o,s,n)}return s}function kle(e){const t=new Map;let n=null;for(const s of e){if(s.role==="user"||s.role==="user_shell"){n=s.id;continue}if(n||(n=s.id),s.role==="tool_group")for(const r of s.tools)_le(r,n,t)}return t}function _le(e,t,n){const s=Dpt(e);if(s){const r=n.get(t);r?r.push(s):n.set(t,[s])}for(const r of e.subTools??[])_le(r,t,n)}function Dpt(e){if(e.status!=="completed"||e.toolName.toLowerCase()!=="cron_create")return null;const t=CD(e);if(t!=null&&t.error)return null;const n=bh(e.args,"cron"),s=bh(e.args,"prompt");if(!n||!s)return null;const r=bh(t,"returnDisplay")??bh(t,"llmContent")??(typeof e.rawOutput=="string"?e.rawOutput:void 0),i=r?Cle(r):void 0;return{id:r?zpt(r)??e.callId:e.callId,toolCallId:e.callId,title:Fpt(s),cron:n,prompt:s,recurring:nW(e.args,"recurring")??!0,durable:nW(e.args,"durable")??!1,...i?{display:i}:{}}}function Sle(e,t,n,s,r){const i=Lpt(e,n,r);if(i){const o=s.get(t);o?Hpt(o,i):s.set(t,[i])}for(const o of e.subTools??[])Sle(o,t,n,s,r)}function Lpt(e,t,n){if(e.status!=="completed")return null;const s=e.toolName.toLowerCase();if(s!=="write_file"&&s!=="edit")return null;const r=Ppt(e);if(!r)return null;const i=M0(r),o=Opt(e),a=Bpt(e),c=$pt(a);return{path:r,status:o,toolCallId:e.callId,isArtifact:Array.from(t).some(u=>Ale(i,u,n)),...c?{additions:c.additions,deletions:c.deletions}:{},diffs:a}}function Ppt(e){var n,s;const t=gS(e.args,"file_path","filePath","path");if(t!==void 0&&t.length>0)return t;for(const r of e.content??[])if(r.path)return r.path;return(s=(n=e.locations)==null?void 0:n[0])==null?void 0:s.file}function bh(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string"&&s.trim())return s}}function gS(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string")return s}}function Opt(e){if(e.toolName.toLowerCase()==="write_file")return"created";const t=CD(e),n=(bh(t,"returnDisplay")??"").toLowerCase();return n.includes("created new file")||n.includes("successfully created")||n.includes("created and wrote")?"created":"modified"}function $pt(e){const t=Tle(e);return t?Ele(t.oldText,t.newText):void 0}function Bpt(e){const t=CD(e),n=gS(t,"originalContent"),s=gS(t,"newContent");if(n!==void 0||s!==void 0)return[{oldText:n??"",newText:s??"",fileDiff:bh(t,"fileDiff"),fullContent:!0}];const r=[];for(const i of e.content??[])i.type==="diff"&&r.push({oldText:i.oldText??"",newText:i.newText??""});if(r.length>0)return r;if(e.toolName.toLowerCase()==="write_file"){const i=gS(e.args,"content");return i!==void 0?[{oldText:"",newText:i,fullContent:!0}]:[]}return[]}function CD(e){return e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0}function nW(e,t){const n=e==null?void 0:e[t];return typeof n=="boolean"?n:void 0}function Cle(e){return e.split(/\r\n|\r|\n/).map(t=>t.trim()).find(Boolean)}function zpt(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 Fpt(e){const t=Cle(e)??e.trim();return t.length>36?`${t.slice(0,36)}...`:t}function Hpt(e,t){const n=M0(t.path),s=e.findIndex(h=>M0(h.path)===n);if(s<0){e.push(t);return}const r=e[s],{additions:i,deletions:o,...a}=r,c=qpt(r.diffs,t.diffs),u=Tle(c),d=u?Ele(u.oldText,u.newText):void 0;e[s]={...a,status:r.status==="created"||t.status==="created"?"created":"modified",isArtifact:r.isArtifact||t.isArtifact,...d?{additions:d.additions,deletions:d.deletions}:{},diffs:c}}function qpt(e,t){const n=[...e,...t];if(!n.every(i=>i.fullContent))return n;const s=n[0],r=n.at(-1);return!s||!r?n:[{oldText:s.oldText,newText:r.newText,fullContent:!0}]}function Tle(e){const t=e.at(-1);return t!=null&&t.fullContent?t:void 0}function Ele(e,t){const n=sW(e),s=sW(t);if(n.length*s.length>Ipt)return;const r=Upt(n,s);return{additions:s.length-r,deletions:n.length-r}}function sW(e){return e?e.replace(/\r?\n$/,"").split(/\r\n|\r|\n/):[]}function Upt(e,t){const n=new Array(t.length+1).fill(0),s=new Array(t.length+1).fill(0);for(const r of e){for(let i=0;i<t.length;i++)s[i+1]=r===t[i]?n[i]+1:Math.max(n[i+1],s[i]);for(let i=0;i<s.length;i++)n[i]=s[i];s.fill(0)}return n[t.length]??0}function Ale(e,t,n){return wae(e,t,n)}const Wpt="_pane_4s0kf_1",Vpt="_header_4s0kf_13",Gpt="_workspaceTag_4s0kf_36",Kpt="_workspaceTagDot_4s0kf_52",Ypt="_workspaceTagText_4s0kf_60",Xpt="_connectionError_4s0kf_69",Qpt="_connectionErrorText_4s0kf_77",Jpt="_title_4s0kf_84",Zpt="_closeButton_4s0kf_95",e0t="_maximizeButton_4s0kf_96",t0t="_body_4s0kf_124",n0t="_footer_4s0kf_132",s0t="_approval_4s0kf_138",il={pane:Wpt,header:Vpt,workspaceTag:Gpt,workspaceTagDot:Kpt,workspaceTagText:Ypt,connectionError:Xpt,connectionErrorText:Qpt,title:Jpt,closeButton:Zpt,maximizeButton:e0t,body:t0t,footer:n0t,approval:s0t},rW=["approvalMode","model","voice"];function r0t({title:e,workspaceCwd:t,onClose:n,onToggleMaximize:s,isMaximized:r=!1,onError:i,onSlashCommand:o,onRightPanelOpen:a,onPaneArtifactsChange:c,messageTurnOutputs:u,restartSseOnPrompt:d=!1}){var Rt,ht,gn,Ue;const{t:h}=at(),m=xa(),p=Ib(),g=Vo(),b=la(),x=KT(h),y=Cw(),v=HY(),w=iC(),k=oC(),{artifacts:T}=rle(),C=f.useCallback(De=>{var Ie;if(!m.sessionId||!a)return;const Re=De.rawOutput&&typeof De.rawOutput=="object"?De.rawOutput:void 0,be=(typeof((Ie=De.args)==null?void 0:Ie.subagent_type)=="string"?De.args.subagent_type:void 0)??(typeof(Re==null?void 0:Re.subagentName)=="string"?Re.subagentName:void 0);a({id:`subagent:${m.sessionId}:${De.callId}`,kind:"subagent",title:De.title||be||h("agent.label"),turnId:De.callId,tool:De,sessionId:m.sessionId,workspaceCwd:m.workspaceCwd??t})},[m.sessionId,m.workspaceCwd,a,h,t]);f.useEffect(()=>{const De=m.sessionId;if(De)return c==null||c(De,T,g),()=>{c==null||c(De,[],g)}},[T,m.sessionId,c,g]);const _=f.useRef(k);_.current=k;const S=f.useCallback(async De=>{m.sessionId&&await p.reloadSession(De)},[p,m.sessionId]),D=((Rt=m.capabilities)==null?void 0:Rt.features.includes(JY))===!0,E=f.useRef(null),{followupState:B,onAcceptFollowup:I,onDismissFollowup:L,clear:O}=VY({onAccept:De=>{var Re;(Re=E.current)==null||Re.insertText(De)}}),A=f.useCallback((De,Re)=>{i?i(De,Re):console.error(Re,De)},[i]),$=f.useRef(o);$.current=o;const q=f.useCallback(De=>w.dispatch([{type:"status",text:De}]),[w]),U=f.useMemo(()=>wA(y),[y]),H=KN(U),M=U&&!H?U:null,ee=U&&H?U:null,V=f.useRef(M);V.current=M;const R=M!==null||ee!==null,re=k!=="idle",Z=f.useMemo(()=>vle(x,T,m.workspaceCwd||""),[x,T,m.workspaceCwd]),K=f.useMemo(()=>wle(x,Z,m.workspaceCwd||""),[x,Z,m.workspaceCwd]),Y=f.useMemo(()=>kle(x),[x]),ae=f.useMemo(()=>new Set(u??_ae),[u]),{queuedPrompts:le,queuedTexts:te,enqueuePrompt:z,removeQueuedPrompt:X,insertQueuedPrompt:fe,editQueuedPrompt:xe,editLastQueuedPrompt:ie,clearQueuedPrompts:Ce}=ole({connected:m.status==="connected",sessionId:m.sessionId,clientId:m.clientId,streamingState:k,sessionActions:p,store:w,editorRef:E,reportError:A,notifySuccess:q,t:h}),Ke=f.useMemo(()=>{if(re)for(let De=x.length-1;De>=0;De--){const Re=x[De];if((Re==null?void 0:Re.role)==="user")return Re.timestamp}},[x,re]),ut=f.useCallback((De,Re,be,Ie)=>{const ne=De.trim();if(!ne)return!1;if(ule(De,$.current,A))return!0;if(lle({connectionStatus:m.status,hasSession:!!m.sessionId,restartSseOnPrompt:d}))return!1;const Ee=Ie==null?void 0:Ie.inputAnnotations;return _.current==="idle"?(p.sendPrompt(ne,{...Re&&Re.length?{images:Re}:{},...Ee?{inputAnnotations:Ee}:{},onAdmitted:()=>{O(),be==null||be()}}).catch(qe=>A(qe,"Failed to send prompt")),!1):Ee?z(ne,Re,void 0,Ee):z(ne,Re)},[p,O,m.sessionId,m.status,z,A,d]),Et=f.useCallback((De,Re,be)=>{p.submitPermission(De,Re,be).catch(Ie=>A(Ie,"Failed to submit permission choice"))},[p,A]),st=f.useCallback(()=>{p.cancel().catch(De=>A(De,"Failed to cancel request"))},[p,A]),xt=f.useCallback(De=>{if(a){if(De.kind==="subagent"){a(De);return}a({...De,workspaceActions:g})}},[a,g]),He=f.useMemo(()=>fle(mle(m.commands??[],dle(h)),h).map(De=>{const Re=hle(De.name);return Re?{...De,displayCategory:"skill",description:h(Re)}:De}),[m.commands,h]),pn=f.useMemo(()=>(m.models??[]).filter(Ev).map(De=>({id:De.id,label:Yf(De.label||De.id)})),[m.models]),Yt=f.useCallback(De=>{if(!I3(De)){A(new Error(`Unsupported approval mode: ${De}`),"Failed to set approval mode");return}p.setApprovalMode(De).then(()=>{const Re=V.current;if(!Re||!(De==="yolo"||De==="auto-edit"&&Re.toolKind==="edit"))return;const Ie=Re.options.find(ne=>ne.kind==="allow_once");Ie&&p.submitPermission(Re.id,Ie.id).catch(ne=>A(ne,"Failed to auto-approve tool call"))}).catch(Re=>A(Re,"Failed to set approval mode"))},[p,A]),It=f.useCallback(De=>{p.setModel(De).catch(Re=>A(Re,"Failed to switch model"))},[p,A]),me=e||m.displayName||((ht=m.sessionId)==null?void 0:ht.slice(0,8))||"",$e=t??m.workspaceCwd,yt=_D(b.capabilities)&&!!$e,Me=f.useMemo(()=>yt?[...rW,"workspace"]:rW,[yt]),Le=yt&&$e?GT($e,(gn=b.capabilities)==null?void 0:gn.workspaces):void 0,vn=yt?Kht($e,b.capabilities):void 0,ge=vn?gD[vn]:void 0;return l.jsxs("section",{className:il.pane,"data-testid":"chat-pane","aria-label":me,children:[l.jsxs("header",{className:`${il.header} ${ge??""}`.trim(),children:[Le&&l.jsxs("span",{role:"img",className:il.workspaceTag,title:$e,"aria-label":h("workspace.paneLabel",{name:Le}),"data-web-shell-pane-workspace":!0,children:[l.jsx("span",{className:il.workspaceTagDot,"aria-hidden":"true"}),l.jsx("span",{className:il.workspaceTagText,children:Le})]}),l.jsx("span",{className:il.title,title:me,children:me}),s&&l.jsx("button",{type:"button",className:il.maximizeButton,onClick:s,"aria-pressed":r,"aria-label":h(r?"splitView.restorePane":"splitView.maximizePane"),title:h(r?"splitView.restorePane":"splitView.maximizePane"),children:r?l.jsx(XY,{size:16,"aria-hidden":!0}):l.jsx(YY,{size:16,"aria-hidden":!0})}),n&&l.jsx("button",{type:"button",className:il.closeButton,onClick:n,"aria-label":h("splitView.closePane"),title:h("splitView.closePane"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:l.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),m.error&&l.jsx("div",{className:il.connectionError,role:"alert",children:l.jsxs("span",{className:il.connectionErrorText,children:[h("splitView.paneConnectionError"),": ",m.error]})}),l.jsx("div",{className:il.body,children:l.jsx(aae,{onOpen:C,children:l.jsx(pD,{messages:x,pendingApproval:M,loadingTranscript:m.loadingTranscript,catchingUp:m.catchingUp,hasOlderHistory:v.hasMore,loadingOlderHistory:v.loading,historyCapacityReached:v.capacityReached,onLoadOlderHistory:v.loadMore,transcriptBlockCount:y.length,transcriptActivity:w,onReloadTranscript:D?S:void 0,isResponding:re,workspaceCwd:m.workspaceCwd||"",hideSessionTimeline:!0,turnFileChanges:ae.has("file")?K:void 0,turnArtifacts:ae.has("artifact")?Z:void 0,turnScheduledTasks:ae.has("scheduled_task")?Y:void 0,onTurnOutputOpen:xt,generateContent:(Ue=m.capabilities)!=null&&Ue.features.includes("session_generation")?p.generateSessionContent:void 0})})}),l.jsxs("div",{className:il.footer,children:[M&&l.jsx("div",{className:il.approval,"data-testid":"pane-approval",children:l.jsx(gle,{request:M,onConfirm:Et,variant:"floating",keyboardActive:!1})}),ee&&l.jsx("div",{className:il.approval,"data-testid":"pane-approval",children:l.jsx(ble,{request:ee,onConfirm:Et,variant:"floating",keyboardActive:!1})}),l.jsx($ae,{startedAt:Ke,showPhrase:!1}),l.jsx(ple,{prompts:le,t:h,onDelete:X,onInsert:fe,onEdit:xe}),l.jsx(Pae,{ref:E,onSubmit:ut,onCancel:st,isRunning:re,commands:He,queuedMessages:te,onPopQueuedMessages:ie,onClearQueuedMessages:Ce,visibleToolbarActions:Me,workspaceName:yt?Le:void 0,workspaceTitle:$e,workspaceColor:vn,currentMode:m.currentMode??"default",currentModel:m.currentModel??"",availableModels:pn,onSelectMode:Yt,onSelectModel:It,dialogOpen:R,followupState:B,onAcceptFollowup:I,onDismissFollowup:L,placeholderText:h("splitView.composerPlaceholder")})]})]})}const i0t="_split_99j2q_1",o0t="_toolbar_99j2q_9",a0t="_backButton_99j2q_18",l0t="_title_99j2q_35",c0t="_count_99j2q_40",u0t="_addWrap_99j2q_45",d0t="_addButton_99j2q_50",h0t="_picker_99j2q_70",f0t="_pickerItem_99j2q_87",m0t="_pickerItemLabel_99j2q_102",p0t="_pickerItemWorkspace_99j2q_112",g0t="_panes_99j2q_131",b0t="_paneSlot_99j2q_140",y0t="_empty_99j2q_153",v0t="_paneError_99j2q_162",x0t="_paneErrorTitle_99j2q_175",w0t="_paneErrorMessage_99j2q_180",k0t="_paneErrorClose_99j2q_185",Lo={split:i0t,toolbar:o0t,backButton:a0t,title:l0t,count:c0t,addWrap:u0t,addButton:d0t,picker:h0t,pickerItem:f0t,pickerItemLabel:m0t,pickerItemWorkspace:p0t,panes:g0t,paneSlot:b0t,empty:y0t,paneError:v0t,paneErrorTitle:x0t,paneErrorMessage:w0t,paneErrorClose:k0t},$7=hm;function _0t({sessionIds:e,onPanesChange:t,onExit:n,onError:s,onSlashCommand:r,onRightPanelOpen:i,onPaneArtifactsChange:o,messageTurnOutputs:a,sessionListReloadToken:c,includeOtherWorkspaces:u=!0,workspaceCwd:d,restartSseOnPrompt:h,historyPageSize:m=ZY}){var le,te;const{t:p}=at(),g=xa(),b=g.sessionId,x=((te=(le=g.capabilities)==null?void 0:le.features)==null?void 0:te.includes(_9))??!1,{sessions:y,reload:v}=ek(d,{autoLoad:!0,pageSize:oh,archiveState:"active",...x?{view:"organized",group:"all"}:{}}),{sessions:w,reload:k}=Qae(u&&!d),T=f.useMemo(()=>Xae(y,w),[y,w]),C=!d&&u&&_D(g.capabilities),_=!!d||C,S=e!==void 0,D=f.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,$7),[e]),[E,B]=f.useState(()=>D.length>0?D:b?[b]:[]),[I,L]=f.useState(!1),[O,A]=f.useState(null),$=f.useRef(null),[q]=f.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));f.useEffect(()=>{S&&B(z=>z.length===D.length&&z.every((X,fe)=>X===D[fe])?z:D)},[D,S]);const U=f.useRef(E);U.current=E,f.useEffect(()=>{if(!I)return;const z=fe=>{var xe;(xe=$.current)!=null&&xe.contains(fe.target)||L(!1)},X=fe=>{fe.key==="Escape"&&L(!1)};return document.addEventListener("mousedown",z),document.addEventListener("keydown",X),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("keydown",X)}},[I]),f.useEffect(()=>{I&&(v(),k())},[I,v,k]);const H=f.useRef(c);f.useEffect(()=>{c!==void 0&&c!==H.current&&(H.current=c,v(),k())},[c,v,k]);const M=f.useMemo(()=>{var X;const z=new Map;for(const fe of T)z.set(fe.sessionId,((X=fe.displayName)==null?void 0:X.trim())||fe.sessionId.slice(0,8));return z},[T]),ee=f.useMemo(()=>{const z=new Map;for(const X of T)z.set(X.sessionId,X.workspaceCwd);return b&&g.workspaceCwd&&!z.has(b)&&z.set(b,g.workspaceCwd),z},[T,b,g.workspaceCwd]),V=f.useCallback(z=>{const X=U.current;if(X.includes(z)||X.length>=$7){L(!1);return}const fe=[...X,z];A(null),S?t==null||t(fe):B(fe),L(!1)},[t,S]),R=f.useRef(!1);f.useEffect(()=>{E.length>0?R.current=!0:R.current&&n()},[E,n]),f.useEffect(()=>{S||t==null||t(E)},[E,t,S]);const re=f.useCallback(z=>{const X=U.current;if(!X.includes(z))return;const fe=X.filter(xe=>xe!==z);S?t==null||t(fe):B(fe)},[t,S]),Z=f.useCallback(z=>{A(X=>X===z?null:z)},[]);f.useEffect(()=>{O&&(E.length<2||!E.includes(O))&&A(null)},[E,O]),f.useEffect(()=>{if(!O)return;const z=X=>{X.key!=="Escape"||X.defaultPrevented||I||N0(X.target)||A(null)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[O,I]);const K=f.useMemo(()=>T.filter(z=>!E.includes(z.sessionId)),[T,E]),Y=E.length<$7&&K.length>0,ae=E.length>1;return l.jsxs("div",{className:Lo.split,"data-testid":"split-view",children:[l.jsxs("header",{className:Lo.toolbar,children:[l.jsx("button",{type:"button",className:Lo.backButton,onClick:n,"aria-label":p("common.back"),title:p("common.back"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:l.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("span",{className:Lo.title,children:p("splitView.title")}),l.jsx("span",{className:Lo.count,children:p("splitView.count",{count:E.length})}),l.jsxs("div",{className:Lo.addWrap,ref:$,children:[l.jsxs("button",{type:"button",className:Lo.addButton,disabled:!Y,"aria-haspopup":"listbox","aria-expanded":I,onClick:()=>L(z=>!z),children:["+ ",p("splitView.addPane")]}),I&&K.length>0&&l.jsx("ul",{className:Lo.picker,role:"listbox",children:K.map(z=>{var X;return l.jsx("li",{role:"option","aria-selected":"false",children:l.jsxs("button",{type:"button",className:Lo.pickerItem,onClick:()=>V(z.sessionId),children:[l.jsx("span",{className:Lo.pickerItemLabel,children:M.get(z.sessionId)??z.sessionId.slice(0,8)}),C&&l.jsx("span",{className:Lo.pickerItemWorkspace,title:z.workspaceCwd,children:GT(z.workspaceCwd,(X=g.capabilities)==null?void 0:X.workspaces)})]})},z.sessionId)})})]})]}),l.jsx("div",{className:Lo.panes,children:E.length===0?l.jsx("div",{className:Lo.empty,children:p("splitView.empty")}):E.map(z=>{const X=ee.get(z),fe=O===z,xe=O!==null&&!fe;return l.jsx("div",{className:Lo.paneSlot,"data-pane-hidden":xe?"":void 0,children:l.jsx(Ph,{label:`split-pane:${z}`,resetKeys:[z],fallback:ie=>l.jsxs("div",{className:Lo.paneError,role:"alert",children:[l.jsx("div",{className:Lo.paneErrorTitle,children:M.get(z)??z.slice(0,8)}),l.jsxs("div",{className:Lo.paneErrorMessage,children:[p("splitView.paneError"),": ",ie.message]}),l.jsx("button",{type:"button",className:Lo.paneErrorClose,onClick:()=>re(z),children:p("splitView.closePane")})]}),children:l.jsx(x9,{sessionId:z,workspaceCwd:_?X??d:void 0,clientId:`split-pane:${q}:${z}`,historyPageSize:m,subagentTranscriptMode:"summary",maxBlocks:eX,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:h,children:l.jsx(r0t,{title:M.get(z),workspaceCwd:X,onClose:()=>re(z),onToggleMaximize:ae?()=>Z(z):void 0,isMaximized:fe,onError:s,onSlashCommand:r,onRightPanelOpen:i,onPaneArtifactsChange:o,messageTurnOutputs:a,restartSseOnPrompt:h})})})},_?`${z}:${X??""}`:z)})})]})}const S0t="_root_1l1wz_1",C0t="_intro_1l1wz_8",T0t="_toolbar_1l1wz_14",E0t="_count_1l1wz_22",A0t="_toolbarActions_1l1wz_28",j0t="_primaryButton_1l1wz_34",N0t="_secondaryButton_1l1wz_35",M0t="_formFields_1l1wz_73",I0t="_field_1l1wz_79",R0t="_fieldGrow_1l1wz_86",D0t="_fieldLabel_1l1wz_90",L0t="_required_1l1wz_96",P0t="_input_1l1wz_107",O0t="_textarea_1l1wz_108",$0t="_select_1l1wz_109",B0t="_promptEditorWrap_1l1wz_127",z0t="_promptEditor_1l1wz_127",F0t="_promptPlaceholder_1l1wz_160",H0t="_promptTag_1l1wz_174",q0t="_promptTagIcon_1l1wz_190",U0t="_promptTagValue_1l1wz_201",W0t="_promptTagRemove_1l1wz_211",V0t="_referencePopover_1l1wz_239",G0t="_referenceBar_1l1wz_243",K0t="_referenceButton_1l1wz_250",Y0t="_referenceButtonActive_1l1wz_267",X0t="_referenceButtonIcon_1l1wz_272",Q0t="_referencePicker_1l1wz_282",J0t="_referenceItem_1l1wz_295",Z0t="_referenceItemLabel_1l1wz_318",egt="_referenceItemDescription_1l1wz_319",tgt="_referenceEmpty_1l1wz_336",ngt="_referenceError_1l1wz_337",sgt="_scheduleRow_1l1wz_347",rgt="_preview_1l1wz_359",igt="_previewLabel_1l1wz_367",ogt="_previewCron_1l1wz_372",agt="_previewInvalid_1l1wz_382",lgt="_formError_1l1wz_387",cgt="_loadError_1l1wz_388",ugt="_formActions_1l1wz_394",dgt="_empty_1l1wz_402",hgt="_list_1l1wz_409",fgt="_card_1l1wz_417",mgt="_cardDisabled_1l1wz_428",pgt="_cardHeader_1l1wz_432",ggt="_cardTitle_1l1wz_438",bgt="_cardMenu_1l1wz_449",ygt="_iconAction_1l1wz_456",vgt="_toggle_1l1wz_482",xgt="_toggleOn_1l1wz_501",wgt="_toggleKnob_1l1wz_505",kgt="_cardPrompt_1l1wz_520",_gt="_cardFooter_1l1wz_533",Sgt="_schedulePill_1l1wz_542",Cgt="_clockIcon_1l1wz_554",Tgt="_recurringTag_1l1wz_559",Egt="_workspacePill_1l1wz_567",Agt="_workspaceIcon_1l1wz_584",jgt="_countdown_1l1wz_589",Ngt="_hourglassIcon_1l1wz_600",Mgt="_lastFired_1l1wz_605",Igt="_runsToggle_1l1wz_613",Rgt="_runsList_1l1wz_630",Dgt="_runsItem_1l1wz_644",Xe={root:S0t,intro:C0t,toolbar:T0t,count:E0t,toolbarActions:A0t,primaryButton:j0t,secondaryButton:N0t,formFields:M0t,field:I0t,fieldGrow:R0t,fieldLabel:D0t,required:L0t,input:P0t,textarea:O0t,select:$0t,promptEditorWrap:B0t,promptEditor:z0t,promptPlaceholder:F0t,promptTag:H0t,promptTagIcon:q0t,promptTagValue:U0t,promptTagRemove:W0t,referencePopover:V0t,referenceBar:G0t,referenceButton:K0t,referenceButtonActive:Y0t,referenceButtonIcon:X0t,referencePicker:Q0t,referenceItem:J0t,referenceItemLabel:Z0t,referenceItemDescription:egt,referenceEmpty:tgt,referenceError:ngt,scheduleRow:sgt,preview:rgt,previewLabel:igt,previewCron:ogt,previewInvalid:agt,formError:lgt,loadError:cgt,formActions:ugt,empty:dgt,list:hgt,card:fgt,cardDisabled:mgt,cardHeader:pgt,cardTitle:ggt,cardMenu:bgt,iconAction:ygt,toggle:vgt,toggleOn:xgt,toggleKnob:wgt,cardPrompt:kgt,cardFooter:_gt,schedulePill:Sgt,clockIcon:Cgt,recurringTag:Tgt,workspacePill:Egt,workspaceIcon:Agt,countdown:jgt,hourglassIcon:Ngt,lastFired:Mgt,runsToggle:Igt,runsList:Rgt,runsItem:Dgt},Lgt="_panel_tz8v7_1",Pgt="_panelDrawer_tz8v7_11",Ogt="_header_tz8v7_18",$gt="_tabs_tz8v7_35",Bgt="_tabItem_tz8v7_44",zgt="_tab_tz8v7_35",Fgt="_tabTitle_tz8v7_72",Hgt="_tabIcon_tz8v7_79",qgt="_tabIconSvg_tz8v7_89",Ugt="_tabActive_tz8v7_96",Wgt="_tabCloseButton_tz8v7_111",Vgt="_tabCloseIcon_tz8v7_141",Ggt="_iconButton_tz8v7_147",Kgt="_iconButtonActive_tz8v7_165",Ygt="_toolbarIcon_tz8v7_169",Xgt="_body_tz8v7_175",Qgt="_empty_tz8v7_182",Jgt="_meta_tz8v7_220",Zgt="_detail_tz8v7_225",e1t="_section_tz8v7_230",t1t="_sectionTitle_tz8v7_235",n1t="_description_tz8v7_242",s1t="_actionsRow_tz8v7_246",r1t="_fieldGrid_tz8v7_253",i1t="_fieldLabel_tz8v7_260",o1t="_fieldValue_tz8v7_269",a1t="_link_tz8v7_274",l1t="_review_tz8v7_283",c1t="_reviewToolbar_tz8v7_290",u1t="_reviewToolbarTitle_tz8v7_299",d1t="_reviewToolbarActions_tz8v7_306",h1t="_reviewTotalsButton_tz8v7_312",f1t="_reviewContent_tz8v7_330",m1t="_reviewContentListOnly_tz8v7_340",p1t="_reviewContentStacked_tz8v7_344",g1t="_reviewList_tz8v7_349",b1t="_reviewListWithExpanded_tz8v7_357",y1t="_reviewSplitHandle_tz8v7_370",v1t="_reviewItem_tz8v7_385",x1t="_reviewItemExpanded_tz8v7_390",w1t="_reviewRow_tz8v7_397",k1t="_reviewRowToggle_tz8v7_419",_1t="_reviewFileName_tz8v7_440",S1t="_reviewOpenButton_tz8v7_447",C1t="_fileIcon_tz8v7_465",T1t="_reviewPath_tz8v7_479",E1t="_treeName_tz8v7_480",A1t="_pathPrefix_tz8v7_496",j1t="_pathFileName_tz8v7_502",N1t="_lineStats_tz8v7_510",M1t="_additions_tz8v7_519",I1t="_deletions_tz8v7_523",R1t="_chevron_tz8v7_527",D1t="_chevronOpen_tz8v7_533",L1t="_chevronIcon_tz8v7_537",P1t="_diffPreview_tz8v7_543",O1t="_codeMirrorDiff_tz8v7_553",$1t="_codeMirrorDiffWrap_tz8v7_561",B1t="_diffError_tz8v7_569",z1t="_codeMirrorFile_tz8v7_594",F1t="_diffEmpty_tz8v7_660",H1t="_tree_tz8v7_480",q1t="_treeNode_tz8v7_673",U1t="_treeChildren_tz8v7_677",W1t="_treeRow_tz8v7_691",V1t="_treeFolder_tz8v7_724",G1t="_treeFile_tz8v7_728",K1t="_treeTwisty_tz8v7_737",Y1t="_treeChevronIcon_tz8v7_746",X1t="_treeChevron_tz8v7_746",Q1t="_treeChevronClosed_tz8v7_757",J1t="_treeContent_tz8v7_761",Z1t="_reviewBadge_tz8v7_784",ebt="_htmlPreviewWrap_tz8v7_797",tbt="_markdownPreviewWrap_tz8v7_803",nbt="_htmlPreview_tz8v7_797",sbt="_previewError_tz8v7_819",rbt="_filePreviewWrap_tz8v7_825",Ze={panel:Lgt,panelDrawer:Pgt,header:Ogt,tabs:$gt,tabItem:Bgt,tab:zgt,tabTitle:Fgt,tabIcon:Hgt,tabIconSvg:qgt,tabActive:Ugt,tabCloseButton:Wgt,tabCloseIcon:Vgt,iconButton:Ggt,iconButtonActive:Kgt,toolbarIcon:Ygt,body:Xgt,empty:Qgt,meta:Jgt,detail:Zgt,section:e1t,sectionTitle:t1t,description:n1t,actionsRow:s1t,fieldGrid:r1t,fieldLabel:i1t,fieldValue:o1t,link:a1t,review:l1t,reviewToolbar:c1t,reviewToolbarTitle:u1t,reviewToolbarActions:d1t,reviewTotalsButton:h1t,reviewContent:f1t,reviewContentListOnly:m1t,reviewContentStacked:p1t,reviewList:g1t,reviewListWithExpanded:b1t,reviewSplitHandle:y1t,reviewItem:v1t,reviewItemExpanded:x1t,reviewRow:w1t,reviewRowToggle:k1t,reviewFileName:_1t,reviewOpenButton:S1t,fileIcon:C1t,reviewPath:T1t,treeName:E1t,pathPrefix:A1t,pathFileName:j1t,lineStats:N1t,additions:M1t,deletions:I1t,chevron:R1t,chevronOpen:D1t,chevronIcon:L1t,diffPreview:P1t,codeMirrorDiff:O1t,codeMirrorDiffWrap:$1t,diffError:B1t,codeMirrorFile:z1t,diffEmpty:F1t,tree:H1t,treeNode:q1t,treeChildren:U1t,treeRow:W1t,treeFolder:V1t,treeFile:G1t,treeTwisty:K1t,treeChevronIcon:Y1t,treeChevron:X1t,treeChevronClosed:Q1t,treeContent:J1t,reviewBadge:Z1t,htmlPreviewWrap:ebt,markdownPreviewWrap:tbt,htmlPreview:nbt,previewError:sbt,filePreviewWrap:rbt},ibt="_detail_56y5v_1",obt="_state_56y5v_7",abt="_overview_56y5v_15",lbt="_descriptionRow_56y5v_23",cbt="_statusTag_56y5v_31",ubt="_statusActions_56y5v_36",dbt="_stopButton_56y5v_43",hbt="_stopError_56y5v_65",fbt="_description_56y5v_23",mbt="_prompt_56y5v_112",pbt="_transcript_56y5v_124",gbt="_retry_56y5v_133",Bl={detail:ibt,state:obt,overview:abt,descriptionRow:lbt,statusTag:cbt,statusActions:ubt,stopButton:dbt,stopError:hbt,description:fbt,prompt:mbt,transcript:pbt,retry:gbt};function bbt(e,t){const n=typeof e.rawOutput=="object"&&e.rawOutput!==null?e.rawOutput:void 0,s=typeof(n==null?void 0:n.executionSummary)=="object"&&n.executionSummary!==null?n.executionSummary:void 0,r=s==null?void 0:s.totalDurationMs,i=s==null?void 0:s.inputTokens,o=s==null?void 0:s.outputTokens,a=s==null?void 0:s.cachedTokens;return{status:t.status,durationMs:typeof r=="number"?r: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 a=="number"?a:t.cachedTokens}}function iW(){return`subagent-detail:${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)}`}function ybt(e,t){for(const n of e){if(n.role!=="tool_group")continue;const s=n.tools.find(r=>r.callId===t);if(s)return s}}function vbt(e,t){var s;const n=e.find(r=>r.role==="user");return((n==null?void 0:n.role)==="user"?n.content:"")||(typeof((s=t.args)==null?void 0:s.prompt)=="string"?t.args.prompt:"")}function xbt(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 wbt({rootTool:e,resolution:t,onStop:n}){const{t:s}=at(),r=xa(),i=KT(s),o=zT(e),a=vbt(i,e),c=f.useMemo(()=>bbt(e,t),[t,e]),u=c.status==="running"||c.status==="in_progress",[d,h]=f.useState(!1),[m,p]=f.useState("");f.useEffect(()=>{u||(h(!1),p(""))},[u]);const g=async()=>{if(!d){h(!0),p("");try{(await n()).cancelled||h(!1)}catch{h(!1),p(s("tasks.cancelFailed"))}}};return l.jsxs("div",{className:Bl.detail,children:[l.jsxs("div",{className:Bl.overview,children:[l.jsxs("div",{className:Bl.descriptionRow,children:[o&&l.jsx("div",{className:Bl.description,children:o}),l.jsxs("div",{className:Bl.statusActions,children:[l.jsx(mo,{variant:"outline",className:Bl.statusTag,"data-status":c.status,children:xbt(c.status,s)}),u&&l.jsx("button",{type:"button",className:Bl.stopButton,disabled:d,onClick:()=>void g(),children:s(d?"common.loading":"tasks.action.stop")})]})]}),m&&l.jsx("div",{className:Bl.stopError,children:m}),a&&l.jsx("pre",{className:Bl.prompt,children:a})]}),l.jsx("div",{className:Bl.transcript,children:l.jsx(pD,{messages:i,pendingApproval:null,loadingTranscript:r.loadingTranscript,isResponding:u,workspaceCwd:r.workspaceCwd||"",hideSessionTimeline:!0,hideFirstUserMessage:!0,firstTurnMetrics:c,includeSubagentToolUsageInMetrics:!1})})]})}function kbt({sessionId:e,rootToolCallId:t,initialRootTool:n,workspaceCwd:s}){const{t:r}=at(),i=la(),o=xa(),a=KT(r),c=(o.sessionId===e?ybt(a,t):void 0)??n,[u,d]=f.useState(()=>({key:0,clientId:iW()})),[h,m]=f.useState(),[p,g]=f.useState(!1);return f.useEffect(()=>{let b=!1,x=!1,y=0,v;m(void 0),g(!1);const w=async()=>{try{const k=await i.client.resolveSubagentSession(e,t);if(b)return;x=!0,m(k),k.status==="running"&&(v=setTimeout(()=>void w(),3e3))}catch{if(b)return;!x&&y<3?(y+=1,v=setTimeout(()=>void w(),3e3)):x?v=setTimeout(()=>void w(),3e3):g(!0)}};return w(),()=>{b=!0,v&&clearTimeout(v)}},[u.key,t,e,i.client]),p?l.jsxs("div",{className:Bl.state,children:[l.jsx("div",{children:r("subagent.detailsLoadFailed")}),l.jsx("button",{type:"button",className:Bl.retry,onClick:()=>d(b=>({key:b.key+1,clientId:iW()})),children:r("common.retry")})]}):h?l.jsx(x9,{sessionId:h.sessionId,workspaceCwd:s,clientId:u.clientId,maxQueued:256,subagentTranscriptMode:"full",suppressOwnUserEcho:!0,children:l.jsx(wbt,{rootTool:c,resolution:h,onStop:()=>i.client.cancelSubagentSession(e,t)})},`${u.key}:${h.sessionId}`):l.jsx("div",{className:Bl.state,children:r("subagent.detailsLoading")})}const _bt=700,Sbt=["daily","weekdays","weekly","hourly","minutes","custom"],Cbt=[1,2,3,4,5,6,10,12,15,20,30];function oW({artifacts:e,tabs:t,activeTabId:n,reviewChanges:s,selectedReviewPath:r,panelWidth:i,workspaceCwd:o,loading:a,error:c,onSelectTab:u,onCloseTab:d,onOpenFilePreview:h,onClose:m,variant:p="docked"}){const g=t.find(y=>y.id===n)??t[0],b=Vo(),x=g&&"workspaceActions"in g?g.workspaceActions??b:b;return l.jsxs("aside",{className:`${Ze.panel} ${p==="drawer"?Ze.panelDrawer:""}`,style:p==="docked"&&i?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[l.jsxs("div",{className:Ze.header,children:[l.jsx("div",{className:Ze.tabs,role:"tablist","aria-label":"Right panel",children:t.map(y=>l.jsxs("div",{className:[Ze.tabItem,y.id===(g==null?void 0:g.id)?Ze.tabActive:""].filter(Boolean).join(" "),children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":y.id===(g==null?void 0:g.id),className:Ze.tab,onClick:()=>u(y.id),title:y.title,children:[l.jsx("span",{className:Ze.tabIcon,"aria-hidden":"true",children:y.kind==="review"?l.jsx(Abt,{}):y.kind==="artifact"||y.kind==="file"?l.jsx(jbt,{}):y.kind==="subagent"?l.jsx(Tbt,{}):l.jsx(Nbt,{})}),l.jsx("span",{className:Ze.tabTitle,children:y.title})]}),l.jsx("button",{type:"button",className:Ze.tabCloseButton,onClick:()=>d(y.id),"aria-label":`Close ${y.title}`,title:"Close",children:l.jsx(Ebt,{})})]},y.id))}),l.jsx("button",{type:"button",className:Ze.iconButton,onClick:m,"aria-label":"Close artifacts panel",title:"Close",children:"×"})]}),l.jsx("div",{className:Ze.body,children:g?g.kind==="review"?l.jsx(Rbt,{changes:s,selectedPath:r,workspaceCwd:g.workspaceCwd??o,onOpenFilePreview:y=>h(y,x,g.workspaceCwd??o)}):g.kind==="file"?l.jsx(Rle,{workspacePath:g.workspacePath,workspaceActions:x,previewContent:g.previewContent},g.id):g.kind==="artifact"?l.jsx(Mbt,{artifacts:e,artifactId:g.artifactId,workspaceActions:x,previewContent:g.previewContent,loading:a,error:c},g.id):g.kind==="subagent"?l.jsx(kbt,{sessionId:g.sessionId,rootToolCallId:g.rootToolCallId,initialRootTool:g.rootTool,workspaceCwd:g.workspaceCwd??o}):l.jsx(Ibt,{task:g.task,actions:x},g.id):l.jsx("div",{className:Ze.empty,children:"No panel selected."})})]})}function Tbt(){return l.jsxs("svg",{className:Ze.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.6"}),l.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 Ebt(){return l.jsx("svg",{className:Ze.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function Abt(){return l.jsxs("svg",{className:Ze.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),l.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function jbt(){return l.jsxs("svg",{className:Ze.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function Nbt(){return l.jsxs("svg",{className:Ze.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mbt({artifacts:e,artifactId:t,workspaceActions:n,previewContent:s,loading:r,error:i}){const o=e.find(a=>a.id===t);return o?l.jsx(Wbt,{artifact:o,workspaceActions:n,previewContent:s}):r?l.jsx("div",{className:Ze.empty,children:"Loading artifact..."}):i?l.jsx("div",{className:Ze.empty,children:i}):l.jsx("div",{className:Ze.empty,children:"Artifact not found."})}function Ibt({task:e,actions:t}){const{t:n}=at(),[s,r]=f.useState(null),[i,o]=f.useState(!0),[a,c]=f.useState(null),[u,d]=f.useState(""),[h,m]=f.useState(e.prompt),[p,g]=f.useState(()=>_f(e.cron)),[b,x]=f.useState(!1),[y,v]=f.useState(!1),[w,k]=f.useState(!1),[T,C]=f.useState(!1),[_,S]=f.useState(null),D=f.useCallback(async()=>{if(!e.durable){r(null),d(""),m(e.prompt),g(_f(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const K=(await t.listScheduledTasks()).find(Y=>Y.id===e.id)??null;r(K),K?(d(K.name??""),m(K.prompt),g(_f(K.cron))):(d(""),m(e.prompt),g(_f(e.cron)))}catch(Z){c(Z instanceof Error?Z.message:String(Z))}finally{o(!1)}},[t,e.cron,e.durable,e.id,e.prompt]);f.useEffect(()=>{D()},[D]);const E=!e.durable,B=e.durable&&!i&&!a&&!s,I=!!s,L=(s==null?void 0:s.name)||(s==null?void 0:s.prompt)||e.title,O=(s==null?void 0:s.prompt)??e.prompt,A=(s==null?void 0:s.cron)??e.cron,$=(s==null?void 0:s.recurring)??e.recurring,q=s==null?void 0:s.enabled,U=f.useCallback(()=>{s&&(d(s.name??""),m(s.prompt),g(_f(s.cron)),S(null),x(!0))},[s]),H=f.useCallback(()=>{x(!1),S(null),s&&(d(s.name??""),m(s.prompt),g(_f(s.cron)))},[s]),M=f.useCallback(async()=>{if(!s)return;const Z=w3(p);if(!Z){S(n("scheduledTasks.error.invalidSchedule"));return}if(h.trim().length===0){S(n("scheduledTasks.error.emptyPrompt"));return}C(!0),S(null);try{const K=await t.updateScheduledTask(s.id,{cron:Z,prompt:h.trim(),name:u.trim()||null});r(K),d(K.name??""),m(K.prompt),g(_f(K.cron)),x(!1)}catch(K){S(K instanceof Error?K.message:String(K))}finally{C(!1)}},[t,p,s,u,h,n]),ee=f.useCallback(async()=>{if(s){k(!0),S(null);try{const Z=await t.updateScheduledTask(s.id,{enabled:!s.enabled});r(Z)}catch(Z){S(Z instanceof Error?Z.message:String(Z))}finally{k(!1)}}},[t,s]),V=f.useCallback(async()=>{if(s){k(!0),S(null);try{await t.deleteScheduledTask(s.id),r(null),v(!1)}catch(Z){S(Z instanceof Error?Z.message:String(Z))}finally{k(!1)}}},[t,s]),R=w3(p),re=R?uw(R,n):null;return l.jsxs("div",{className:Ze.detail,children:[i&&l.jsx("div",{className:Ze.empty,children:n("scheduledTasks.loading")}),a&&l.jsx("div",{className:Xe.loadError,children:a}),B&&l.jsx("div",{className:Ze.empty,children:n("scheduledTasks.deletedSnapshot")}),E&&l.jsx("div",{className:Ze.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!B&&l.jsx("div",{className:Ze.section,children:l.jsxs("div",{className:Ze.fieldGrid,children:[l.jsx("span",{className:Ze.fieldLabel,children:n("scheduledTasks.name")}),l.jsx("span",{className:Ze.fieldValue,children:L}),l.jsx("span",{className:Ze.fieldLabel,children:n("scheduledTasks.taskId")}),l.jsx("span",{className:Ze.fieldValue,children:e.id}),l.jsx("span",{className:Ze.fieldLabel,children:n("scheduledTasks.schedule")}),l.jsx("span",{className:Ze.fieldValue,children:uw(A,n)}),l.jsx("span",{className:Ze.fieldLabel,children:"Cron"}),l.jsx("span",{className:Ze.fieldValue,children:A}),l.jsx("span",{className:Ze.fieldLabel,children:n("scheduledTasks.type")}),l.jsx("span",{className:Ze.fieldValue,children:n($?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),q!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ze.fieldLabel,children:n("scheduledTasks.status")}),l.jsx("span",{className:Ze.fieldValue,children:n(q?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!B&&l.jsxs("div",{className:Ze.section,children:[l.jsx("div",{className:Ze.sectionTitle,children:"Prompt"}),l.jsx("div",{className:Ze.description,children:O})]}),_&&l.jsx("div",{className:Xe.formError,children:_}),l.jsxs("div",{className:Ze.actionsRow,children:[l.jsx("button",{type:"button",className:Xe.primaryButton,disabled:!I||w,onClick:U,children:n("scheduledTasks.edit")}),l.jsx("button",{type:"button",className:Xe.secondaryButton,disabled:!I||w,onClick:()=>void ee(),children:s!=null&&s.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),l.jsx("button",{type:"button",className:Xe.secondaryButton,disabled:!I||w,onClick:()=>v(!0),children:n("scheduledTasks.delete")})]}),y&&s&&l.jsx(pi,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>v(!1),children:l.jsxs("div",{className:Xe.formFields,children:[l.jsx("div",{className:Ze.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),_&&l.jsx("div",{className:Xe.formError,children:_}),l.jsxs("div",{className:Xe.formActions,children:[l.jsx("button",{type:"button",className:Xe.secondaryButton,onClick:()=>v(!1),disabled:w,children:n("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:Xe.primaryButton,onClick:()=>void V(),disabled:w,children:n("scheduledTasks.delete")})]})]})}),b&&l.jsx(pi,{title:n("scheduledTasks.editTitle"),size:"md",onClose:H,children:l.jsxs("div",{className:Xe.formFields,children:[l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.name")}),l.jsx("input",{className:Xe.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:Z=>d(Z.target.value)})]}),l.jsxs("label",{className:Xe.field,children:[l.jsxs("span",{className:Xe.fieldLabel,children:[n("scheduledTasks.prompt"),l.jsx("span",{className:Xe.required,children:"*"})]}),l.jsx("textarea",{className:Xe.textarea,value:h,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:Z=>m(Z.target.value)})]}),l.jsxs("div",{className:Xe.scheduleRow,children:[l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.frequency")}),l.jsx("select",{className:Xe.select,value:p.frequency,onChange:Z=>{const K=Z.target.value;g(Y=>({...Y,frequency:K,...K==="hourly"?{time:"00:00"}:{}}))},children:Sbt.map(Z=>l.jsx("option",{value:Z,children:n(`scheduledTasks.freq.${Z}`)},Z))})]}),(p.frequency==="daily"||p.frequency==="weekdays"||p.frequency==="weekly")&&l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.time")}),l.jsx("input",{className:Xe.input,type:"time",value:p.time,onChange:Z=>g(K=>({...K,time:Z.target.value}))})]}),p.frequency==="weekly"&&l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.weekday")}),l.jsx("select",{className:Xe.select,value:p.weekday,onChange:Z=>g(K=>({...K,weekday:Number(Z.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((Z,K)=>l.jsx("option",{value:K,children:Z},K))})]}),p.frequency==="minutes"&&l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.interval")}),l.jsx("select",{className:Xe.select,value:p.minuteInterval,onChange:Z=>g(K=>({...K,minuteInterval:Number(Z.target.value)})),children:Cbt.map(Z=>l.jsx("option",{value:Z,children:Z},Z))})]}),p.frequency==="custom"&&l.jsxs("label",{className:`${Xe.field} ${Xe.fieldGrow}`,children:[l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.cron")}),l.jsx("input",{className:Xe.input,type:"text",value:p.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:Z=>g(K=>({...K,customCron:Z.target.value}))})]})]}),l.jsx("div",{className:Xe.preview,children:re?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Xe.previewLabel,children:re}),l.jsx("code",{className:Xe.previewCron,children:R})]}):l.jsx("span",{className:Xe.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),_&&l.jsx("div",{className:Xe.formError,children:_}),l.jsxs("div",{className:Xe.formActions,children:[l.jsx("button",{type:"button",className:Xe.secondaryButton,onClick:H,disabled:T,children:n("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:Xe.primaryButton,onClick:()=>void M(),disabled:T,children:n(T?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function Rbt({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s}){const{t:r}=at(),[i,o]=f.useState(!1),[a,c]=f.useState(!0),[u,d]=f.useState(!1),[h,m]=f.useState(520),p=f.useRef(h),g=f.useRef(null),b=f.useRef(null),[x,y]=f.useState(null),v=i,w=f.useMemo(()=>qbt(e,n),[e,n]);f.useEffect(()=>{y(t)},[t]),f.useEffect(()=>{p.current=h},[h]),f.useEffect(()=>{const _=g.current;if(!_)return;const S=()=>{d(_.clientWidth<_bt)};S();const D=new ResizeObserver(S);return D.observe(_),()=>D.disconnect()},[a]),f.useEffect(()=>()=>{var _;return(_=b.current)==null?void 0:_.call(b)},[]);const k=f.useCallback(_=>{const S=g.current;if(!S)return;_.preventDefault();const D=_.currentTarget;D.setPointerCapture(_.pointerId);const E=_.clientX,B=p.current,I=S.getBoundingClientRect().width,L=Math.max(180,I-180),O=document.body.style.cursor,A=document.body.style.userSelect;let $=B,q=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const U=()=>{q=null,m($)},H=V=>{$=Math.min(L,Math.max(180,B+(V.clientX-E))),q===null&&(q=window.requestAnimationFrame(U))};let M=()=>{};const ee=V=>{b.current=null,q!==null&&(window.cancelAnimationFrame(q),q=null),V&&m($),D.hasPointerCapture(_.pointerId)&&D.releasePointerCapture(_.pointerId),document.body.style.cursor=O,document.body.style.userSelect=A,window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M)};M=()=>ee(!0),b.current=()=>ee(!1),window.addEventListener("pointermove",H),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M)},[]);if(e.length===0)return l.jsx("div",{className:Ze.empty,children:"No file changes to review."});const T=kae(e),C=_=>{y(S=>S===_?null:_)};return l.jsxs("div",{className:Ze.review,children:[l.jsxs("div",{className:Ze.reviewToolbar,children:[l.jsxs("div",{className:Ze.reviewToolbarTitle,children:[l.jsx("span",{children:r("turnOutputs.previousTurn")}),l.jsx(k3,{additions:T==null?void 0:T.additions,deletions:T==null?void 0:T.deletions,className:Ze.lineStats,additionsClassName:Ze.additions,deletionsClassName:Ze.deletions})]}),l.jsxs("div",{className:Ze.reviewToolbarActions,children:[l.jsxs("button",{type:"button",className:Ze.reviewTotalsButton,onClick:()=>c(_=>!_),"aria-expanded":a,children:[l.jsx("span",{children:r("turnOutputs.fileCount",{count:e.length})}),l.jsx("span",{className:[Ze.chevron,a?Ze.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.jsx(lW,{})})]}),l.jsx("button",{type:"button",className:[Ze.iconButton,i?Ze.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>o(_=>!_),"aria-label":r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:i?l.jsx(Fbt,{}):l.jsx(zbt,{})})]})]}),a&&l.jsxs("div",{ref:g,className:[Ze.reviewContent,v?"":Ze.reviewContentListOnly,v&&u?Ze.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${h}px`},children:[l.jsx("div",{className:[Ze.reviewList,x?Ze.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(_=>{const S=x===_.path,D=Cae(_.path);return l.jsxs("div",{className:[Ze.reviewItem,S?Ze.reviewItemExpanded:""].filter(Boolean).join(" "),children:[l.jsxs("div",{className:Ze.reviewRow,"data-selected":_.path===t||void 0,children:[l.jsx("button",{type:"button",className:Ze.reviewRowToggle,onClick:()=>C(_.path),"aria-label":_.path,"aria-expanded":S}),l.jsx("span",{className:Ze.fileIcon,children:Ile(_.path)}),l.jsxs("span",{className:Ze.reviewFileName,children:[l.jsx(Obt,{path:UT(_.path,n),title:_.path}),D&&l.jsx("button",{type:"button",className:Ze.reviewOpenButton,onClick:()=>s(_),title:`${r("turnOutputs.preview")} ${_.path}`,children:r("turnOutputs.preview")})]}),l.jsx(k3,{additions:_.additions,deletions:_.deletions,className:Ze.lineStats,additionsClassName:Ze.additions,deletionsClassName:Ze.deletions}),l.jsx("span",{className:[Ze.chevron,S?Ze.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.jsx(lW,{})})]}),S&&l.jsx(Dbt,{change:_})]},`${_.toolCallId}:${_.path}`)})}),v&&!u&&l.jsx("div",{className:Ze.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:k}),v&&l.jsx("div",{className:Ze.tree,children:w.children.map(_=>l.jsx(jle,{node:_,depth:0,selectedPath:t},_.path))})]})]})}function Dbt({change:e}){if(e.diffs.length===0)return l.jsx("div",{className:Ze.diffEmpty,children:"No diff available."});const t=Lbt(e.diffs);return l.jsx("div",{className:Ze.diffPreview,children:t.map((n,s)=>l.jsx(Pbt,{oldText:n.oldText,newText:n.newText},s))})}function Lbt(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 Pbt({oldText:e,newText:t}){const n=f.useRef(null),[s,r]=f.useState(null),[i,o]=f.useState(null);return f.useEffect(()=>{const a=n.current;if(!a)return;const c=()=>r(a.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(a),()=>u.disconnect()},[]),f.useEffect(()=>{const a=n.current;if(!a||s===null)return;a.replaceChildren(),o(null);let c=!1,u=null;const d=[_oe,Pt.editable.of(!1),nr.readOnly.of(!0),Pt.lineWrapping],h={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return oe(async()=>{const{MergeView:p,unifiedMergeView:g}=await import("./index-D0GX0zZf.js");return{MergeView:p,unifiedMergeView:g}},[]).then(({MergeView:p,unifiedMergeView:g})=>{if(!c)try{if(s){u=new p({a:{doc:e,extensions:d},b:{doc:t,extensions:d},parent:a,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:h});return}u=new Pt({doc:t,extensions:[...d,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:h})],parent:a})}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()}},[s,t,e]),l.jsxs("div",{className:Ze.codeMirrorDiffWrap,children:[l.jsx("div",{ref:n,className:Ze.codeMirrorDiff}),i&&l.jsxs("div",{className:Ze.diffError,children:["Diff unavailable: ",i]})]})}function jle({node:e,depth:t,selectedPath:n}){var d,h;const s=!!e.file,[r,i]=f.useState(!0),o=[Ze.treeRow,s?Ze.treeFile:Ze.treeFolder].filter(Boolean).join(" "),a={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=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ze.treeTwisty,children:!s&&l.jsx("span",{className:[Ze.treeChevron,r?"":Ze.treeChevronClosed].filter(Boolean).join(" "),children:l.jsx(Hbt,{})})}),l.jsxs("span",{className:Ze.treeContent,children:[s&&l.jsx("span",{className:Ze.fileIcon,children:Ile(e.path)}),l.jsx("span",{className:Ze.treeName,children:e.name})]}),((d=e.file)==null?void 0:d.isArtifact)&&l.jsx("span",{className:Ze.reviewBadge,children:"artifact"})]});return l.jsxs("div",{className:Ze.treeNode,children:[s?l.jsx("div",{className:o,"data-selected":((h=e.file)==null?void 0:h.path)===n||void 0,"data-depth":t,style:a,title:e.path,children:u}):l.jsx("button",{type:"button",className:o,"data-depth":t,style:a,title:e.path,"aria-expanded":r,onClick:()=>i(m=>!m),children:u}),!s&&r&&e.children.length>0&&l.jsx("div",{className:Ze.treeChildren,style:c,children:e.children.map(m=>l.jsx(jle,{node:m,depth:t+1,selectedPath:n},m.path))})]})}function Obt({path:e,title:t}){const n=f.useRef(null),[s,r]=f.useState(()=>Nle(e));return f.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r($bt(e,i));o();const a=new ResizeObserver(o);return a.observe(i),()=>a.disconnect()},[e]),l.jsxs("span",{ref:n,className:Ze.reviewPath,title:t??e,children:[s.prefix&&l.jsx("span",{className:Ze.pathPrefix,children:s.prefix}),l.jsx("span",{className:Ze.pathFileName,children:s.leaf})]})}function Nle(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let aW=null;function $bt(e,t){const n=Nle(e),s=t.clientWidth;if(s<=0)return n;const r=Bbt(t);if(r(e)<=s)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,a=r(o);if(i.length<=1||a+r(".../")>s)return{prefix:"",leaf:o};let c=".../";for(let u=1;u<i.length;u++){const h=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(r(h)+a>s)break;c=h}return{prefix:c,leaf:o}}function Bbt(e){aW??(aW=document.createElement("canvas"));const t=aW.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),s=>(t==null?void 0:t.measureText(s).width)??s.length*8}function zbt(){return l.jsxs("svg",{className:Ze.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.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"}),l.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 Fbt(){return l.jsxs("svg",{className:Ze.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.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"}),l.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 lW(){return l.jsx("svg",{className:Ze.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Hbt(){return l.jsx("svg",{className:Ze.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function qbt(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=UT(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const a=r[o],c=r.slice(0,o+1).join("/");let u=i.children.find(d=>d.name===a);u||(u={name:a,path:c,children:[]},i.children.push(u)),o===r.length-1&&(u.file=s),i=u}}return Mle(n),n}function Mle(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)Mle(t)}function Ubt(e){return M0(e).split("/").filter(Boolean).at(-1)??e}function Ile(e){var r;const t=Ubt(e),n=t.includes(".")?(r=t.split(".").pop())==null?void 0:r.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 Wbt({artifact:e,workspaceActions:t,previewContent:n}){var a;const s=_Ye(e),r=_se(e.url)?e.url:void 0,i=((a=e.metadata)==null?void 0:a.artifactType)==="automation_snapshot";return e.storage==="workspace"&&!!e.workspacePath&&e.workspacePath?l.jsx(Rle,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t,previewContent:n,previewKind:Vbt(e)?"html":Gbt(e)?"markdown":"source"}):l.jsxs("div",{className:Ze.detail,children:[l.jsxs("div",{className:Ze.section,children:[l.jsx("div",{className:Ze.sectionTitle,children:i?"Automation Snapshot":"Artifact"}),l.jsxs("div",{className:Ze.fieldGrid,children:[l.jsx(Fu,{label:"Type",value:vae(e.kind)}),l.jsx(Fu,{label:"Storage",value:e.storage}),l.jsx(Fu,{label:"Status",value:e.status}),l.jsx(Fu,{label:"Source",value:e.source}),l.jsx(Fu,{label:"Size",value:xae(e.sizeBytes)}),l.jsx(Fu,{label:"Created",value:e.createdAt}),l.jsx(Fu,{label:"Updated",value:e.updatedAt}),e.toolName&&l.jsx(Fu,{label:"Tool",value:e.toolName}),e.toolCallId&&l.jsx(Fu,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&l.jsxs("div",{className:Ze.section,children:[l.jsx("div",{className:Ze.sectionTitle,children:"Description"}),l.jsx("div",{className:Ze.description,children:e.description})]}),i&&e.metadata&&l.jsxs("div",{className:Ze.section,children:[l.jsx("div",{className:Ze.sectionTitle,children:"Details"}),l.jsxs("div",{className:Ze.fieldGrid,children:[Pg(e.metadata,"automationId","Automation ID"),Pg(e.metadata,"schedule","Schedule"),Pg(e.metadata,"timezone","Timezone"),Pg(e.metadata,"status","Status"),Pg(e.metadata,"nextRunAt","Next run"),Pg(e.metadata,"prompt","Prompt")]})]}),(s||r)&&l.jsxs("div",{className:Ze.section,children:[l.jsx("div",{className:Ze.sectionTitle,children:"Location"}),r?l.jsx("a",{className:Ze.link,href:r,target:"_blank",rel:"noreferrer",children:r}):l.jsx("div",{className:Ze.meta,children:s})]})]})}function Vbt(e){var s,r;const t=((s=e.workspacePath)==null?void 0:s.toLowerCase())??"",n=((r=e.mimeType)==null?void 0:r.toLowerCase())??"";return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function Gbt(e){var n,s;const t=((n=e.workspacePath)==null?void 0:n.toLowerCase())??"";return t.endsWith(".md")||t.endsWith(".markdown")||((s=e.mimeType)==null?void 0:s.toLowerCase())==="text/markdown"}function Rle({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewKind:r=e.toLowerCase().endsWith(".html")||e.toLowerCase().endsWith(".htm")?"html":e.toLowerCase().endsWith(".md")||e.toLowerCase().endsWith(".markdown")?"markdown":"source"}){return r==="html"?l.jsx(Kbt,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}):r==="markdown"?l.jsx(Xbt,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}):l.jsx(Ybt,{workspacePath:e,artifactVersion:t,workspaceActions:n})}function TD({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:r}){const[i,o]=f.useState(s??null),[a,c]=f.useState(null);return f.useEffect(()=>{let u=!1;return o(s??null),c(null),n.readWorkspaceFile(e).then(d=>{u||(o(d.content),d.truncated&&c(r))}).catch(d=>{u||c(d instanceof Error?d.message:String(d))}),()=>{u=!0}},[t,s,r,n,e]),{content:i,error:a}}function Kbt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const{content:r,error:i}=TD({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:"Preview is truncated because the file is too large."});return l.jsxs("div",{className:Ze.htmlPreviewWrap,children:[r===null?l.jsx("div",{className:Ze.empty,children:"Loading preview..."}):l.jsx("iframe",{className:Ze.htmlPreview,referrerPolicy:"no-referrer",sandbox:"",srcDoc:SYe(r),title:`Preview ${e}`}),i&&l.jsx("div",{className:Ze.previewError,children:i})]})}function Ybt({workspacePath:e,artifactVersion:t,workspaceActions:n}){const s=f.useRef(null),[r,i]=f.useState(null),{content:o,error:a}=TD({workspacePath:e,artifactVersion:t,workspaceActions:n,truncatedMessage:"File is truncated because it is too large."});return f.useEffect(()=>{const c=s.current;if(!c||o===null)return;c.replaceChildren(),i(null);let u;try{u=new Pt({doc:o,extensions:[_oe,Pt.editable.of(!1),nr.readOnly.of(!0),Pt.lineWrapping],parent:c})}catch(d){i(d instanceof Error?d.message:String(d));return}return()=>u.destroy()},[o]),l.jsxs("div",{className:Ze.filePreviewWrap,children:[o===null?l.jsx("div",{className:Ze.empty,children:"Loading file..."}):l.jsx("div",{ref:s,className:Ze.codeMirrorFile}),(a||r)&&l.jsx("div",{className:Ze.previewError,children:a||r})]})}function Xbt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const{content:r,error:i}=TD({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:"Preview is truncated because the file is too large."});return l.jsxs("div",{className:Ze.markdownPreviewWrap,children:[r===null?l.jsx("div",{className:Ze.empty,children:"Loading preview..."}):l.jsx(Tm,{content:r}),i&&l.jsx("div",{className:Ze.previewError,children:i})]})}function Fu({label:e,value:t}){return t?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ze.fieldLabel,children:e}),l.jsx("span",{className:Ze.fieldValue,children:t})]}):null}function Pg(e,t,n){const s=e[t];return s==null||s===""?null:l.jsx(Fu,{label:n,value:String(s)},t)}function Qbt(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 Dle=bn.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}),nk=()=>{const e=bn.useContext(Dle);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Qbt(`[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 Jbt(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Zbt(){return ED(/^Mac/)}function eyt(){return ED(/^iPhone/)}function cW(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function tyt(){return ED(/^iPad/)||Zbt()&&navigator.maxTouchPoints>1}function Lle(){return eyt()||tyt()}function ED(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const nyt=24,syt=typeof window<"u"?f.useLayoutEffect:f.useEffect;function uW(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const B7=typeof document<"u"&&window.visualViewport;function dW(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Ple(e){for(dW(e)&&(e=e.parentElement);e&&!dW(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const ryt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let v2=0,z7;function iyt(e={}){let{isDisabled:t}=e;syt(()=>{if(!t)return v2++,v2===1&&Lle()&&(z7=oyt()),()=>{v2--,v2===0&&(z7==null||z7())}},[t])}function oyt(){let e,t=0,n=h=>{e=Ple(h.target),!(e===document.documentElement&&e===document.body)&&(t=h.changedTouches[0].pageY)},s=h=>{if(!e||e===document.documentElement||e===document.body){h.preventDefault();return}let m=h.changedTouches[0].pageY,p=e.scrollTop,g=e.scrollHeight-e.clientHeight;g!==0&&((p<=0&&m>t||p>=g&&m<t)&&h.preventDefault(),t=m)},r=h=>{let m=h.target;XN(m)&&m!==document.activeElement&&(h.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=h=>{let m=h.target;XN(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",B7&&(B7.height<window.innerHeight?requestAnimationFrame(()=>{hW(m)}):B7.addEventListener("resize",()=>hW(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},a=window.pageXOffset,c=window.pageYOffset,u=uW(ayt(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=uW(nv(document,"touchstart",n,{passive:!1,capture:!0}),nv(document,"touchmove",s,{passive:!1,capture:!0}),nv(document,"touchend",r,{passive:!1,capture:!0}),nv(document,"focus",i,!0),nv(window,"scroll",o));return()=>{u(),d(),window.scrollTo(a,c)}}function ayt(e,t,n){let s=e.style[t];return e.style[t]=n,()=>{e.style[t]=s}}function nv(e,t,n,s){return e.addEventListener(t,n,s),()=>{e.removeEventListener(t,n,s)}}function hW(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Ple(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let s=n.getBoundingClientRect().top,r=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const o=n.getBoundingClientRect().bottom+nyt;i>o&&(n.scrollTop+=r-s)}e=n.parentElement}}function XN(e){return e instanceof HTMLInputElement&&!ryt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function lyt(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function cyt(...e){return t=>e.forEach(n=>lyt(n,t))}function Ole(...e){return f.useCallback(cyt(...e),e)}const $le=new WeakMap;function yo(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let s={};Object.entries(t).forEach(([r,i])=>{if(r.startsWith("--")){e.style.setProperty(r,i);return}s[r]=e.style[r],e.style[r]=i}),!n&&$le.set(e,s)}function uyt(e,t){if(!e||!(e instanceof HTMLElement))return;let n=$le.get(e);n&&(e.style[t]=n[t])}const so=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function x2(e,t){if(!e)return null;const n=window.getComputedStyle(e),s=n.transform||n.webkitTransform||n.mozTransform;let r=s.match(/^matrix3d\((.+)\)$/);return r?parseFloat(r[1].split(", ")[so(t)?13:12]):(r=s.match(/^matrix\((.+)\)$/),r?parseFloat(r[1].split(", ")[so(t)?5:4]):null)}function dyt(e){return 8*(Math.log(e+1)-2)}function F7(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function hyt(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const Ai={DURATION:.5,EASE:[.32,.72,0,1]},Ble=.4,fyt=.25,myt=100,zle=8,Np=16,QN=26,H7="vaul-dragging";function Fle(e){const t=bn.useRef(e);return bn.useEffect(()=>{t.current=e}),bn.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function pyt({defaultProp:e,onChange:t}){const n=bn.useState(e),[s]=n,r=bn.useRef(s),i=Fle(t);return bn.useEffect(()=>{r.current!==s&&(i(s),r.current=s)},[s,r,i]),n}function Hle({prop:e,defaultProp:t,onChange:n=()=>{}}){const[s,r]=pyt({defaultProp:t,onChange:n}),i=e!==void 0,o=i?e:s,a=Fle(n),c=bn.useCallback(u=>{if(i){const h=typeof u=="function"?u(e):u;h!==e&&a(h)}else r(u)},[i,e,r,a]);return[o,c]}function gyt({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:s,overlayRef:r,fadeFromIndex:i,onSnapPointChange:o,direction:a="bottom",container:c,snapToSequentialPoint:u}){const[d,h]=Hle({prop:e,defaultProp:n==null?void 0:n[0],onChange:t}),[m,p]=bn.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);bn.useEffect(()=>{function _(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const g=bn.useMemo(()=>d===(n==null?void 0:n[n.length-1])||null,[n,d]),b=bn.useMemo(()=>{var _;return(_=n==null?void 0:n.findIndex(S=>S===d))!=null?_:null},[n,d]),x=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===d||!n,y=bn.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 S;return(S=n==null?void 0:n.map(D=>{const E=typeof D=="string";let B=0;if(E&&(B=parseInt(D,10)),so(a)){const L=E?B:m?D*_.height:0;return m?a==="bottom"?_.height-L:-_.height+L:L}const I=E?B:m?D*_.width:0;return m?a==="right"?_.width-I:-_.width+I:I}))!=null?S:[]},[n,m,c]),v=bn.useMemo(()=>b!==null?y==null?void 0:y[b]:null,[y,b]),w=bn.useCallback(_=>{var S;const D=(S=y==null?void 0:y.findIndex(E=>E===_))!=null?S:null;o(D),yo(s.current,{transition:`transform ${Ai.DURATION}s cubic-bezier(${Ai.EASE.join(",")})`,transform:so(a)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`}),y&&D!==y.length-1&&i!==void 0&&D!==i&&D<i?yo(r.current,{transition:`opacity ${Ai.DURATION}s cubic-bezier(${Ai.EASE.join(",")})`,opacity:"0"}):yo(r.current,{transition:`opacity ${Ai.DURATION}s cubic-bezier(${Ai.EASE.join(",")})`,opacity:"1"}),h(n==null?void 0:n[Math.max(D,0)])},[s.current,n,y,i,r,h]);bn.useEffect(()=>{if(d||e){var _;const S=(_=n==null?void 0:n.findIndex(D=>D===e||D===d))!=null?_:-1;y&&S!==-1&&typeof y[S]=="number"&&w(y[S])}},[d,e,n,y,w]);function k({draggedDistance:_,closeDrawer:S,velocity:D,dismissible:E}){if(i===void 0)return;const B=a==="bottom"||a==="right"?(v??0)-_:(v??0)+_,I=b===i-1,L=b===0,O=_>0;if(I&&yo(r.current,{transition:`opacity ${Ai.DURATION}s cubic-bezier(${Ai.EASE.join(",")})`}),!u&&D>2&&!O){E?S():w(y[0]);return}if(!u&&D>2&&O&&y&&n){w(y[n.length-1]);return}const A=y==null?void 0:y.reduce((q,U)=>typeof q!="number"||typeof U!="number"?q:Math.abs(U-B)<Math.abs(q-B)?U:q),$=so(a)?window.innerHeight:window.innerWidth;if(D>Ble&&Math.abs(_)<$*.4){const q=O?1:-1;if(q>0&&g&&n){w(y[n.length-1]);return}if(L&&q<0&&E&&S(),b===null)return;w(y[b+q]);return}w(A)}function T({draggedDistance:_}){if(v===null)return;const S=a==="bottom"||a==="right"?v-_:v+_;(a==="bottom"||a==="right")&&S<y[y.length-1]||(a==="top"||a==="left")&&S>y[y.length-1]||yo(s.current,{transform:so(a)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`})}function C(_,S){if(!n||typeof b!="number"||!y||i===void 0)return null;const D=b===i-1;if(b>=i&&S)return 0;if(D&&!S)return 1;if(!x&&!D)return null;const B=D?b+1:b-1,I=D?y[B]-y[B-1]:y[B+1]-y[B],L=_/Math.abs(I);return D?1-L:L}return{isLastSnapPoint:g,activeSnapPoint:d,shouldFade:x,getPercentageDragged:C,setActiveSnapPoint:h,activeSnapPointIndex:b,onRelease:k,onDrag:T,snapPointsOffset:y}}const byt=()=>()=>{};function yyt(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:s,noBodyStyles:r}=nk(),i=bn.useRef(null),o=f.useMemo(()=>document.body.style.backgroundColor,[]);function a(){return(window.innerWidth-QN)/window.innerWidth}bn.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;hyt(s&&!r?F7(document.body,{background:"black"}):byt,F7(c,{transformOrigin:so(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Ai.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ai.EASE.join(",")})`}));const u=F7(c,{borderRadius:`${zle}px`,overflow:"hidden",...so(e)?{transform:`scale(${a()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${a()}) 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")},Ai.DURATION*1e3)}}},[t,n,o])}let sv=null;function vyt({isOpen:e,modal:t,nested:n,hasBeenOpened:s,preventScrollRestoration:r,noBodyStyles:i}){const[o,a]=bn.useState(()=>typeof window<"u"?window.location.href:""),c=bn.useRef(0),u=bn.useCallback(()=>{if(cW()&&sv===null&&e&&!i){sv={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:h,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-h}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=bn.useCallback(()=>{if(cW()&&sv!==null&&!i){const h=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,sv),window.requestAnimationFrame(()=>{if(r&&o!==window.location.href){a(window.location.href);return}window.scrollTo(m,h)}),sv=null}},[o]);return bn.useEffect(()=>{function h(){c.current=window.scrollY}return h(),window.addEventListener("scroll",h),()=>{window.removeEventListener("scroll",h)}},[]),bn.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||d()}},[t,d]),bn.useEffect(()=>{n||!s||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{d()},500)):d())},[e,s,o,t,n,u,d]),{restorePositionSetting:d}}function xyt({open:e,onOpenChange:t,children:n,onDrag:s,onRelease:r,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:a=!0,closeThreshold:c=fyt,scrollLockTimeout:u=myt,dismissible:d=!0,handleOnly:h=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:g,fixed:b,modal:x=!0,onClose:y,nested:v,noBodyStyles:w=!1,direction:k="bottom",defaultOpen:T=!1,disablePreventScroll:C=!0,snapToSequentialPoint:_=!1,preventScrollRestoration:S=!1,repositionInputs:D=!0,onAnimationEnd:E,container:B,autoFocus:I=!1}){var L,O;const[A=!1,$]=Hle({defaultProp:T,prop:e,onChange:be=>{t==null||t(be),!be&&!v&&$e(),setTimeout(()=>{E==null||E(be)},Ai.DURATION*1e3),be&&!x&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),be||(document.body.style.pointerEvents="auto")}}),[q,U]=bn.useState(!1),[H,M]=bn.useState(!1),[ee,V]=bn.useState(!1),R=bn.useRef(null),re=bn.useRef(null),Z=bn.useRef(null),K=bn.useRef(null),Y=bn.useRef(null),ae=bn.useRef(!1),le=bn.useRef(null),te=bn.useRef(0),z=bn.useRef(!1),X=bn.useRef(!T),fe=bn.useRef(0),xe=bn.useRef(null),ie=bn.useRef(((L=xe.current)==null?void 0:L.getBoundingClientRect().height)||0),Ce=bn.useRef(((O=xe.current)==null?void 0:O.getBoundingClientRect().width)||0),Ke=bn.useRef(0),ut=bn.useCallback(be=>{i&&be===pn.length-1&&(re.current=new Date)},[]),{activeSnapPoint:Et,activeSnapPointIndex:st,setActiveSnapPoint:xt,onRelease:He,snapPointsOffset:pn,onDrag:Yt,shouldFade:It,getPercentageDragged:me}=gyt({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:g,drawerRef:xe,fadeFromIndex:m,overlayRef:R,onSnapPointChange:ut,direction:k,container:B,snapToSequentialPoint:_});iyt({isDisabled:!A||H||!x||ee||!q||!D||!C});const{restorePositionSetting:$e}=vyt({isOpen:A,modal:x,nested:v??!1,hasBeenOpened:q,preventScrollRestoration:S,noBodyStyles:w});function yt(){return(window.innerWidth-QN)/window.innerWidth}function Me(be){var Ie,ne;!d&&!i||xe.current&&!xe.current.contains(be.target)||(ie.current=((Ie=xe.current)==null?void 0:Ie.getBoundingClientRect().height)||0,Ce.current=((ne=xe.current)==null?void 0:ne.getBoundingClientRect().width)||0,M(!0),Z.current=new Date,Lle()&&window.addEventListener("touchend",()=>ae.current=!1,{once:!0}),be.target.setPointerCapture(be.pointerId),te.current=so(k)?be.pageY:be.pageX)}function Le(be,Ie){var ne;let Ee=be;const qe=(ne=window.getSelection())==null?void 0:ne.toString(),Je=xe.current?x2(xe.current,k):null,Qe=new Date;if(Ee.tagName==="SELECT"||Ee.hasAttribute("data-vaul-no-drag")||Ee.closest("[data-vaul-no-drag]"))return!1;if(k==="right"||k==="left")return!0;if(re.current&&Qe.getTime()-re.current.getTime()<500)return!1;if(Je!==null&&(k==="bottom"?Je>0:Je<0))return!0;if(qe&&qe.length>0)return!1;if(Y.current&&Qe.getTime()-Y.current.getTime()<u&&Je===0||Ie)return Y.current=Qe,!1;for(;Ee;){if(Ee.scrollHeight>Ee.clientHeight){if(Ee.scrollTop!==0)return Y.current=new Date,!1;if(Ee.getAttribute("role")==="dialog")return!0}Ee=Ee.parentNode}return!0}function vn(be){if(xe.current&&H){const Ie=k==="bottom"||k==="right"?1:-1,ne=(te.current-(so(k)?be.pageY:be.pageX))*Ie,Ee=ne>0,qe=i&&!d&&!Ee;if(qe&&st===0)return;const Je=Math.abs(ne),Qe=document.querySelector("[data-vaul-drawer-wrapper]"),cn=k==="bottom"||k==="top"?ie.current:Ce.current;let Kn=Je/cn;const _e=me(Je,Ee);if(_e!==null&&(Kn=_e),qe&&Kn>=1||!ae.current&&!Le(be.target,Ee))return;if(xe.current.classList.add(H7),ae.current=!0,yo(xe.current,{transition:"none"}),yo(R.current,{transition:"none"}),i&&Yt({draggedDistance:ne}),Ee&&!i){const $t=dyt(ne),pe=Math.min($t*-1,0)*Ie;yo(xe.current,{transform:so(k)?`translate3d(0, ${pe}px, 0)`:`translate3d(${pe}px, 0, 0)`});return}const ft=1-Kn;if((It||m&&st===m-1)&&(s==null||s(be,Kn),yo(R.current,{opacity:`${ft}`,transition:"none"},!0)),Qe&&R.current&&o){const $t=Math.min(yt()+Kn*(1-yt()),1),pe=8-Kn*8,Be=Math.max(0,14-Kn*14);yo(Qe,{borderRadius:`${pe}px`,transform:so(k)?`scale(${$t}) translate3d(0, ${Be}px, 0)`:`scale(${$t}) translate3d(${Be}px, 0, 0)`,transition:"none"},!0)}if(!i){const $t=Je*Ie;yo(xe.current,{transform:so(k)?`translate3d(0, ${$t}px, 0)`:`translate3d(${$t}px, 0, 0)`})}}}bn.useEffect(()=>{window.requestAnimationFrame(()=>{X.current=!0})},[]),bn.useEffect(()=>{var be;function Ie(){if(!xe.current||!D)return;const ne=document.activeElement;if(XN(ne)||z.current){var Ee;const qe=((Ee=window.visualViewport)==null?void 0:Ee.height)||0,Je=window.innerHeight;let Qe=Je-qe;const cn=xe.current.getBoundingClientRect().height||0,Kn=cn>Je*.8;Ke.current||(Ke.current=cn);const _e=xe.current.getBoundingClientRect().top;if(Math.abs(fe.current-Qe)>60&&(z.current=!z.current),i&&i.length>0&&pn&&st){const ft=pn[st]||0;Qe+=ft}if(fe.current=Qe,cn>qe||z.current){const ft=xe.current.getBoundingClientRect().height;let $t=ft;ft>qe&&($t=qe-(Kn?_e:QN)),b?xe.current.style.height=`${ft-Math.max(Qe,0)}px`:xe.current.style.height=`${Math.max($t,qe-_e)}px`}else Jbt()||(xe.current.style.height=`${Ke.current}px`);i&&i.length>0&&!z.current?xe.current.style.bottom="0px":xe.current.style.bottom=`${Math.max(Qe,0)}px`}}return(be=window.visualViewport)==null||be.addEventListener("resize",Ie),()=>{var ne;return(ne=window.visualViewport)==null?void 0:ne.removeEventListener("resize",Ie)}},[st,i,pn]);function ge(be){ht(),y==null||y(),be||$(!1),setTimeout(()=>{i&&xt(i[0])},Ai.DURATION*1e3)}function Rt(){if(!xe.current)return;const be=document.querySelector("[data-vaul-drawer-wrapper]"),Ie=x2(xe.current,k);yo(xe.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Ai.DURATION}s cubic-bezier(${Ai.EASE.join(",")})`}),yo(R.current,{transition:`opacity ${Ai.DURATION}s cubic-bezier(${Ai.EASE.join(",")})`,opacity:"1"}),o&&Ie&&Ie>0&&A&&yo(be,{borderRadius:`${zle}px`,overflow:"hidden",...so(k)?{transform:`scale(${yt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${yt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ai.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ai.EASE.join(",")})`},!0)}function ht(){!H||!xe.current||(xe.current.classList.remove(H7),ae.current=!1,M(!1),K.current=new Date)}function gn(be){if(!H||!xe.current)return;xe.current.classList.remove(H7),ae.current=!1,M(!1),K.current=new Date;const Ie=x2(xe.current,k);if(!be||!Le(be.target,!1)||!Ie||Number.isNaN(Ie)||Z.current===null)return;const ne=K.current.getTime()-Z.current.getTime(),Ee=te.current-(so(k)?be.pageY:be.pageX),qe=Math.abs(Ee)/ne;if(qe>.05&&(V(!0),setTimeout(()=>{V(!1)},200)),i){He({draggedDistance:Ee*(k==="bottom"||k==="right"?1:-1),closeDrawer:ge,velocity:qe,dismissible:d}),r==null||r(be,!0);return}if(k==="bottom"||k==="right"?Ee>0:Ee<0){Rt(),r==null||r(be,!0);return}if(qe>Ble){ge(),r==null||r(be,!1);return}var Je;const Qe=Math.min((Je=xe.current.getBoundingClientRect().height)!=null?Je:0,window.innerHeight);var cn;const Kn=Math.min((cn=xe.current.getBoundingClientRect().width)!=null?cn:0,window.innerWidth),_e=k==="left"||k==="right";if(Math.abs(Ie)>=(_e?Kn:Qe)*c){ge(),r==null||r(be,!1);return}r==null||r(be,!0),Rt()}bn.useEffect(()=>(A&&(yo(document.documentElement,{scrollBehavior:"auto"}),re.current=new Date),()=>{uyt(document.documentElement,"scrollBehavior")}),[A]);function Ue(be){const Ie=be?(window.innerWidth-Np)/window.innerWidth:1,ne=be?-Np:0;le.current&&window.clearTimeout(le.current),yo(xe.current,{transition:`transform ${Ai.DURATION}s cubic-bezier(${Ai.EASE.join(",")})`,transform:so(k)?`scale(${Ie}) translate3d(0, ${ne}px, 0)`:`scale(${Ie}) translate3d(${ne}px, 0, 0)`}),!be&&xe.current&&(le.current=setTimeout(()=>{const Ee=x2(xe.current,k);yo(xe.current,{transition:"none",transform:so(k)?`translate3d(0, ${Ee}px, 0)`:`translate3d(${Ee}px, 0, 0)`})},500))}function De(be,Ie){if(Ie<0)return;const ne=(window.innerWidth-Np)/window.innerWidth,Ee=ne+Ie*(1-ne),qe=-Np+Ie*Np;yo(xe.current,{transform:so(k)?`scale(${Ee}) translate3d(0, ${qe}px, 0)`:`scale(${Ee}) translate3d(${qe}px, 0, 0)`,transition:"none"})}function Re(be,Ie){const ne=so(k)?window.innerHeight:window.innerWidth,Ee=Ie?(ne-Np)/ne:1,qe=Ie?-Np:0;Ie&&yo(xe.current,{transition:`transform ${Ai.DURATION}s cubic-bezier(${Ai.EASE.join(",")})`,transform:so(k)?`scale(${Ee}) translate3d(0, ${qe}px, 0)`:`scale(${Ee}) translate3d(${qe}px, 0, 0)`})}return bn.useEffect(()=>{x||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[x]),bn.createElement($C,{defaultOpen:T,onOpenChange:be=>{!d&&!be||(be?U(!0):ge(!0),$(be))},open:A},bn.createElement(Dle.Provider,{value:{activeSnapPoint:Et,snapPoints:i,setActiveSnapPoint:xt,drawerRef:xe,overlayRef:R,onOpenChange:t,onPress:Me,onRelease:gn,onDrag:vn,dismissible:d,shouldAnimate:X,handleOnly:h,isOpen:A,isDragging:H,shouldFade:It,closeDrawer:ge,onNestedDrag:De,onNestedOpenChange:Ue,onNestedRelease:Re,keyboardIsOpen:z,modal:x,snapPointsOffset:pn,activeSnapPointIndex:st,direction:k,shouldScaleBackground:o,setBackgroundColorOnScale:a,noBodyStyles:w,container:B,autoFocus:I}},n))}const qle=bn.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:s,onRelease:r,shouldFade:i,isOpen:o,modal:a,shouldAnimate:c}=nk(),u=Ole(t,n),d=s&&s.length>0;if(!a)return null;const h=bn.useCallback(m=>r(m),[r]);return bn.createElement(zC,{onMouseUp:h,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})});qle.displayName="Drawer.Overlay";const Ule=bn.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...s},r){const{drawerRef:i,onPress:o,onRelease:a,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:h,modal:m,isOpen:p,direction:g,snapPoints:b,container:x,handleOnly:y,shouldAnimate:v,autoFocus:w}=nk(),[k,T]=bn.useState(!1),C=Ole(r,i),_=bn.useRef(null),S=bn.useRef(null),D=bn.useRef(!1),E=b&&b.length>0;yyt();const B=(L,O,A=0)=>{if(D.current)return!0;const $=Math.abs(L.y),q=Math.abs(L.x),U=q>$,H=["bottom","right"].includes(O)?1:-1;if(O==="left"||O==="right"){if(!(L.x*H<0)&&q>=0&&q<=A)return U}else if(!(L.y*H<0)&&$>=0&&$<=A)return!U;return D.current=!0,!0};bn.useEffect(()=>{E&&window.requestAnimationFrame(()=>{T(!0)})},[]);function I(L){_.current=null,D.current=!1,a(L)}return bn.createElement(FC,{"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":x?"true":"false","data-vaul-animate":v!=null&&v.current?"true":"false",...s,ref:C,style:d&&d.length>0?{"--snap-point-height":`${d[h??0]}px`,...t}:t,onPointerDown:L=>{y||(s.onPointerDown==null||s.onPointerDown.call(s,L),_.current={x:L.pageX,y:L.pageY},o(L))},onOpenAutoFocus:L=>{n==null||n(L),w||L.preventDefault()},onPointerDownOutside:L=>{if(e==null||e(L),!m||L.defaultPrevented){L.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:L=>{if(!m){L.preventDefault();return}},onPointerMove:L=>{if(S.current=L,y||(s.onPointerMove==null||s.onPointerMove.call(s,L),!_.current))return;const O=L.pageY-_.current.y,A=L.pageX-_.current.x,$=L.pointerType==="touch"?10:2;B({x:A,y:O},g,$)?c(L):(Math.abs(A)>$||Math.abs(O)>$)&&(_.current=null)},onPointerUp:L=>{s.onPointerUp==null||s.onPointerUp.call(s,L),_.current=null,D.current=!1,a(L)},onPointerOut:L=>{s.onPointerOut==null||s.onPointerOut.call(s,L),I(S.current)},onContextMenu:L=>{s.onContextMenu==null||s.onContextMenu.call(s,L),S.current&&I(S.current)}})});Ule.displayName="Drawer.Content";const wyt=250,kyt=120,_yt=bn.forwardRef(function({preventCycle:e=!1,children:t,...n},s){const{closeDrawer:r,isDragging:i,snapPoints:o,activeSnapPoint:a,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:h,onPress:m,onDrag:p}=nk(),g=bn.useRef(null),b=bn.useRef(!1);function x(){if(b.current){w();return}window.setTimeout(()=>{y()},kyt)}function y(){if(i||e||b.current){w();return}if(w(),!o||o.length===0){u||r();return}if(a===o[o.length-1]&&u){r();return}const T=o.findIndex(_=>_===a);if(T===-1)return;const C=o[T+1];c(C)}function v(){g.current=window.setTimeout(()=>{b.current=!0},wyt)}function w(){g.current&&window.clearTimeout(g.current),b.current=!1}return bn.createElement("div",{onClick:x,onPointerCancel:w,onPointerDown:k=>{d&&m(k),v()},onPointerMove:k=>{d&&p(k)},ref:s,"data-vaul-drawer-visible":h?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},bn.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});_yt.displayName="Drawer.Handle";function Syt(e){const t=nk(),{container:n=t.container,...s}=e;return bn.createElement(BC,{container:n,...s})}const sk={Root:xyt,Content:Ule,Overlay:qle,Portal:Syt,Title:HC};function Cyt({...e}){return l.jsx(sk.Root,{"data-slot":"drawer",...e})}function Tyt({container:e,...t}){const n=Hc();return l.jsx(sk.Portal,{"data-slot":"drawer-portal",container:e??n??void 0,...t})}const Eyt=f.forwardRef(function({className:t,...n},s){return l.jsx(sk.Overlay,{ref:s,"data-slot":"drawer-overlay",className:Qt("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})}),Ayt=f.forwardRef(function({className:t,children:n,overlayProps:s,...r},i){return l.jsxs(Tyt,{children:[l.jsx(Eyt,{...s}),l.jsx(sk.Content,{ref:i,"data-slot":"drawer-content",className:Qt("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),...r,children:n})]})});function jyt({className:e,...t}){return l.jsx(sk.Title,{"data-slot":"drawer-title",className:Qt("text-base font-medium text-foreground",e),...t})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Nyt="(min-width: 1024px)";function q7(e=Nyt){const[t,n]=f.useState(()=>Myt(e));return f.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const s=window.matchMedia(e);n(s.matches);const r=i=>n(i.matches);return s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[e]),t}function Myt(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function Wle(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function Iyt(e,t){const n=e.kind==="catch-up"?` · ${t("scheduledTasks.runKind.catchUp")}`:e.kind==="manual"?` · ${t("scheduledTasks.runKind.manual")}`:"",s=e.withheld?` · ${t("scheduledTasks.runKind.withheld")}`:"";return`${Wle(e.at)}${n}${s}`}function xf(e){return`${e.workspaceId??""}:${e.id}`}const Ryt=["daily","weekdays","weekly","hourly","minutes","custom"],Dyt=[1,2,3,4,5,6,10,12,15,20,30],Lyt=2147483647,Pyt=3,Oyt=3e4,dw=1e5,$yt=/[^\p{L}\p{N}_.-]/gu,fW=/(^|[\s])(@(?:ext|mcp):(?:\\.[^\s\\]*|[^\s\\])+|\/(?:\\.[^\s\\/]*|[^\s\\/])+)(?=$|\s)/gu,Byt=["--background","--foreground","--muted","--muted-foreground","--border","--error-color","--font-mono"];function U7(e){return e.replace($yt,"\\$&")}function W7(e){return e.replace(/\\(.)/g,"$1")}function zyt(e){if(e.startsWith("@ext:")){const t=W7(e.slice(5));return{id:`extension:${t}`,kind:"extension",label:t,insertText:e}}if(e.startsWith("@mcp:")){const t=W7(e.slice(5));return{id:`mcp:${t}`,kind:"mcp",label:t,insertText:e}}if(e.startsWith("/")){const t=W7(e.slice(1));return t?{id:`skill:${t}`,kind:"skill",label:t,insertText:e}:null}return null}function Fyt(e){return e.displayName&&e.displayName!==e.name?e.displayName:e.description}function Hyt(e){return e.description||e.argumentHint||e.level}function qyt(e){return e.description||e.mcpStatus}function Vle(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(s=>{n+=Vle(s)}),e.tagName==="DIV"||e.tagName==="P"?`${n}
`:n}function Gle(e){let t="";return e.childNodes.forEach(n=>{t+=Vle(n)}),t}function Kle(e){return e.replace(/\u00a0/g," ").replace(/\n$/,"")}function YT(e){return Kle(Gle(e))}function Uyt(e){return Kle(Gle(e))}function AD(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function V7(e,t){t&&e.appendChild(document.createTextNode(t))}function Yle(e,t,n){if(AD(e),!t)return;t.split(`
`).forEach((r,i)=>{i>0&&e.appendChild(document.createElement("br")),Wyt(e,r,n)})}function G7(e,t){let n=YT(e);return n.length>dw?(n=n.slice(0,dw),Yle(e,n,t)):n.trim().length===0&&(AD(e),n=""),n}function mW(e,t){const n=dw-YT(e).length;n<=0||document.execCommand("insertText",!1,t.slice(0,n))}function pW(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:Uyt(n.cloneContents())}:null}function Xle(e,t){const n=document.createElement("span");n.className=Xe.promptTag,n.contentEditable="false",n.dataset.promptTagSerialized=e.insertText.trim();const s=z0(e.kind);if(s){const o=document.createElement("span");o.className=Xe.promptTagIcon,o.style.setProperty("--composer-tag-icon-url",DT(s)),o.setAttribute("aria-hidden","true"),n.appendChild(o)}const r=document.createElement("span");r.className=Xe.promptTagValue,r.textContent=e.tagLabel??e.label,n.appendChild(r);const i=document.createElement("span");return i.className=Xe.promptTagRemove,i.setAttribute("role","button"),i.tabIndex=-1,i.dataset.promptTagRemove="",i.setAttribute("aria-label",`${t} ${e.label}`),n.appendChild(i),n}function Wyt(e,t,n){let s=0;fW.lastIndex=0;for(const r of t.matchAll(fW)){const[i,o,a]=r,c=r.index??0,u=zyt(a);u&&(V7(e,t.slice(s,c)),V7(e,o),e.appendChild(Xle(u,n)),s=c+i.length)}V7(e,t.slice(s))}function Vyt(e,t,n){var c;const s=window.getSelection(),r=Xle(t,n),i=document.createTextNode(" ");YT(e).trim().length===0&&AD(e);const o=((c=e.lastChild)==null?void 0:c.textContent)??"";e.childNodes.length>0&&!/\s$/.test(o)&&e.appendChild(document.createTextNode(" ")),e.appendChild(r),e.appendChild(i);const a=document.createRange();a.setStartAfter(i),a.collapse(!0),s==null||s.removeAllRanges(),s==null||s.addRange(a)}function Gyt(e){const t=e.parentElement,n=e.previousSibling,s=e.nextSibling;e.remove(),(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&/^[ \u00a0]/.test(s.textContent??"")?s.textContent=(s.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 Kyt({value:e,label:t,placeholder:n,onChange:s,insertItem:r,onInserted:i}){const{t:o}=at(),a=o("scheduledTasks.reference.remove"),c=f.useRef(null),u=f.useRef(""),d=f.useRef("");return f.useEffect(()=>{const h=c.current;h&&(e===u.current&&a===d.current||(Yle(h,e,a),u.current=e,d.current=a))},[a,e]),f.useEffect(()=>{const h=c.current;if(!h||!r)return;Vyt(h,r,a);const m=YT(h);u.current=m,s(m),h.focus(),i()},[r,s,i,a]),l.jsxs("div",{className:Xe.promptEditorWrap,children:[l.jsx("div",{ref:c,className:Xe.promptEditor,contentEditable:!0,role:"textbox","aria-label":t,"aria-multiline":"true","aria-placeholder":n,onMouseDown:h=>{h.target instanceof Element&&h.target.closest("[data-prompt-tag-remove]")&&h.preventDefault()},onClick:h=>{if(!(h.target instanceof Element))return;const m=h.target.closest("[data-prompt-tag-remove]"),p=m==null?void 0:m.closest("[data-prompt-tag-serialized]");if(!p||!h.currentTarget.contains(p))return;Gyt(p);const g=G7(h.currentTarget,a);u.current=g,s(g),h.currentTarget.focus()},onInput:h=>{const m=G7(h.currentTarget,a);u.current=m,s(m)},onPaste:h=>{h.preventDefault(),mW(h.currentTarget,h.clipboardData.getData("text/plain"))},onDrop:h=>{h.preventDefault(),mW(h.currentTarget,h.dataTransfer.getData("text/plain"))},onCopy:h=>{const m=pW(h.currentTarget);m&&(h.preventDefault(),h.clipboardData.setData("text/plain",m.text))},onCut:h=>{const m=pW(h.currentTarget);if(!m)return;h.preventDefault(),h.clipboardData.setData("text/plain",m.text),m.selection.deleteFromDocument();const p=G7(h.currentTarget,a);u.current=p,s(p)}}),e.trim().length===0&&l.jsx("div",{className:Xe.promptPlaceholder,children:n})]})}function Yyt({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,workspaces:s,lockedWorkspace:r,onError:i}){const{t:o}=at(),a=Vo(),c=Hc(),u=f.useMemo(()=>s??[],[s]),d=!r&&u.length>1,h=f.useMemo(()=>u.filter(ne=>ne.primary||ne.trusted),[u]),m=f.useCallback(ne=>ne.primary?void 0:ne.id,[]),p=r?m(r):void 0,[g,b]=f.useState(null),[x,y]=f.useState(null),[v,w]=f.useState(null),[k,T]=f.useState(null),[C,_]=f.useState(!1),[S,D]=f.useState(null),[E,B]=f.useState(p),[I,L]=f.useState(""),[O,A]=f.useState(""),[$,q]=f.useState(Uu),[U,H]=f.useState(!1),[M,ee]=f.useState(null),[V,R]=f.useState(null),[re,Z]=f.useState([]),[K,Y]=f.useState(!1),[ae,le]=f.useState(null),[te,z]=f.useState(null),X=f.useRef(null),fe=f.useRef(null),[xe,ie]=f.useState(null),[Ce,Ke]=f.useState({}),[ut,Et]=f.useState(null),[st,xt]=f.useState(()=>Date.now()),He=f.useRef(!0),pn=f.useRef(0),Yt=f.useRef(0);f.useEffect(()=>(He.current=!0,()=>{He.current=!1}),[]);const It=f.useCallback(async()=>{const ne=++pn.current;try{let Ee,qe=null;if(r?Ee=(await a.listScheduledTasks(p)).map(Qe=>({...Qe,workspaceId:p,workspaceCwd:r.cwd})):d?Ee=(await Promise.all(h.map(async cn=>{try{return(await a.listScheduledTasks(m(cn))).map(_e=>({..._e,workspaceId:m(cn),workspaceCwd:cn.cwd}))}catch(Kn){return qe||(qe=Kn instanceof Error?Kn.message:String(Kn)),[]}}))).flat():Ee=await a.listScheduledTasks(),!He.current||ne!==pn.current)return;const Je=[...Ee].sort((Qe,cn)=>cn.createdAt-Qe.createdAt);b(Je),y(qe)}catch(Ee){if(!He.current||ne!==pn.current)return;y(Ee instanceof Error?Ee.message:String(Ee)),b(qe=>qe??[])}},[a,d,r,p,h,m]);f.useEffect(()=>{It()},[It]);const me=!!(g!=null&&g.some(ne=>ne.nextRunAt!=null));f.useEffect(()=>{if(!me)return;const ne=window.setInterval(()=>xt(Date.now()),1e3);return()=>window.clearInterval(ne)},[me]);const $e=f.useRef(0);f.useEffect(()=>{if(!g)return;let ne=1/0;for(const Qe of g)Qe.nextRunAt!=null&&Qe.nextRunAt<ne&&(ne=Qe.nextRunAt);if(!Number.isFinite(ne))return;const Ee=ne-Date.now();let qe;Ee>0?($e.current=0,qe=Math.min(Ee+2e3,Lyt)):qe=$e.current++<Pyt?1e3:Oyt;const Je=window.setTimeout(()=>void It(),qe);return()=>window.clearTimeout(Je)},[g,It]);const yt=w3($),Me=yt?uw(yt,o):null,Le=f.useCallback(()=>{const ne=X.current;if(!ne){ie(null);return}const Ee=getComputedStyle(ne);Ke(Object.fromEntries(Byt.map(_e=>[_e,Ee.getPropertyValue(_e)])));const qe=ne.getBoundingClientRect(),Je=Math.min(420,window.innerWidth-24),Qe=Math.max(12,Math.min(qe.left,window.innerWidth-Je-12)),cn=qe.bottom+6,Kn=Math.max(140,Math.min(320,window.innerHeight-cn-12));ie(_e=>{const ft={left:Qe,top:cn,width:Je,maxHeight:Kn};return _e&&_e.left===ft.left&&_e.top===ft.top&&_e.width===ft.width&&_e.maxHeight===ft.maxHeight?_e:ft})},[]),vn=f.useCallback(()=>{Yt.current+=1,R(null),Z([]),Y(!1),le(null),z(null),ie(null),Ke({})},[]),ge=f.useCallback(async ne=>{const Ee=++Yt.current;if(V===ne){vn();return}Le(),R(ne),Y(!0),le(null),Z([]);try{let qe;if(ne==="extension"?qe=((await a.loadExtensionsStatus()).extensions??[]).filter(Qe=>Qe.isActive).map(Qe=>({id:Qe.id||Qe.name,kind:ne,label:Qe.name,tagLabel:Hr(Qe.displayName??"")||Qe.name,description:Fyt(Qe),insertText:`@ext:${U7(Qe.name)} `})):ne==="skill"?qe=((await a.loadSkillsStatus()).skills??[]).filter(Qe=>Qe.modelInvocable).map(Qe=>({id:Qe.name,kind:ne,label:Qe.name,description:Hyt(Qe),insertText:`/${U7(Qe.name)} `})):qe=((await a.loadMcpStatus()).servers??[]).filter(Qe=>!Qe.disabled).map(Qe=>({id:Qe.name,kind:ne,label:Qe.name,description:qyt(Qe),insertText:`@mcp:${U7(Qe.name)} `})),!He.current||Ee!==Yt.current)return;Z(qe)}catch(qe){if(!He.current||Ee!==Yt.current)return;le(qe instanceof Error?qe.message:String(qe))}finally{He.current&&Ee===Yt.current&&Y(!1)}},[a,V,vn,Le]);f.useEffect(()=>{if(!V)return;Le();const ne=Je=>{const Qe=X.current,cn=fe.current;Qe!=null&&Qe.contains(Je.target)||cn!=null&&cn.contains(Je.target)||vn()},Ee=Je=>{Je.key==="Escape"&&(Je.preventDefault(),Je.stopPropagation(),vn())},qe=()=>Le();return document.addEventListener("pointerdown",ne),document.addEventListener("keydown",Ee,!0),window.addEventListener("resize",qe),window.addEventListener("scroll",qe,!0),()=>{document.removeEventListener("pointerdown",ne),document.removeEventListener("keydown",Ee,!0),window.removeEventListener("resize",qe),window.removeEventListener("scroll",qe,!0)}},[V,vn,Le]);const Rt=f.useCallback(()=>{L(""),A(""),q(Uu),ee(null),_(!1),D(null),B(p),vn()},[p,vn]),ht=f.useCallback(()=>{D(null),B(p),L(""),A(""),q(Uu),ee(null),vn(),_(!0)},[p,vn]),gn=f.useCallback(ne=>{D(ne.id),B(ne.workspaceId),L(ne.name??""),A(ne.prompt),q(_f(ne.cron)),ee(null),vn(),_(!0)},[vn]),Ue=f.useCallback(async()=>{const ne=w3($);if(!ne){ee(o("scheduledTasks.error.invalidSchedule"));return}if(O.trim().length===0){ee(o("scheduledTasks.error.emptyPrompt"));return}if(O.length>dw){ee(o("scheduledTasks.error.promptTooLong",{max:dw}));return}H(!0),ee(null);try{if(S?await a.updateScheduledTask(S,{cron:ne,prompt:O.trim(),name:I.trim()||null},E):await a.createScheduledTask({cron:ne,prompt:O.trim(),name:I.trim()||null,recurring:!0,enabled:!0},E),!He.current)return;Rt(),await It()}catch(Ee){if(!He.current)return;ee(Ee instanceof Error?Ee.message:String(Ee))}finally{He.current&&H(!1)}},[a,$,S,E,I,O,It,Rt,o]),De=f.useCallback(async ne=>{w(xf(ne));try{await a.updateScheduledTask(ne.id,{enabled:!ne.enabled},ne.workspaceId),await It()}catch(Ee){i(Ee,o("scheduledTasks.error.toggleFailed"))}finally{He.current&&w(null)}},[a,i,It,o]),Re=f.useCallback(async ne=>{if(!(!ne.enabled||k!==null)){T(ne.id);try{const Ee=(await a.listScheduledTasks(ne.workspaceId)).find(qe=>qe.id===ne.id);if(!Ee||!Ee.enabled){await It().catch(()=>{}),i(new Error("This task is no longer runnable."),o("scheduledTasks.error.runFailed"));return}if(Ee.recurring){await e(Ee.prompt,Ee.sessionId);try{await a.runScheduledTask(Ee.id,ne.workspaceId),await It()}catch(qe){i(qe,o("scheduledTasks.error.runFailed"))}}else{await a.runScheduledTask(Ee.id,ne.workspaceId),await It();try{await e(Ee.prompt,Ee.sessionId)}catch(qe){i(qe,o("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(Ee){i(Ee,o("scheduledTasks.error.runFailed"))}finally{T(null)}}},[a,i,e,It,k,o]),be=f.useCallback(async ne=>{const Ee=ne.name||ne.prompt,qe=Ee.length>60?`${Ee.slice(0,57)}…`:Ee;if(window.confirm(o("scheduledTasks.deleteConfirm",{name:qe}))){w(xf(ne));try{await a.deleteScheduledTask(ne.id,ne.workspaceId),await It()}catch(Je){i(Je,o("scheduledTasks.error.deleteFailed"))}finally{He.current&&w(null)}}},[a,i,It,o]),Ie=V&&xe?hu.createPortal(l.jsx("div",{ref:fe,className:Xe.referencePicker,role:"listbox","aria-label":o("scheduledTasks.referencePicker"),style:{...Ce,left:xe.left,top:xe.top,width:xe.width,maxHeight:xe.maxHeight},onWheel:ne=>{ne.stopPropagation()},onTouchMove:ne=>ne.stopPropagation(),children:K?l.jsx("div",{className:Xe.referenceEmpty,children:o("scheduledTasks.reference.loading")}):ae?l.jsx("div",{className:Xe.referenceError,children:ae}):re.length===0?l.jsx("div",{className:Xe.referenceEmpty,children:o("scheduledTasks.reference.empty")}):re.map(ne=>l.jsxs("button",{type:"button",className:Xe.referenceItem,role:"option","aria-selected":"false",onMouseDown:Ee=>Ee.preventDefault(),onClick:()=>{z(ne),R(null)},children:[l.jsx("span",{className:Xe.referenceItemLabel,children:ne.label}),ne.description&&l.jsx("span",{className:Xe.referenceItemDescription,children:ne.description})]},`${ne.kind}:${ne.id}`))}),c??document.body):null;return l.jsxs("div",{className:Xe.root,children:[l.jsx("div",{className:Xe.intro,children:o("scheduledTasks.subtitle")}),l.jsxs("div",{className:Xe.toolbar,children:[l.jsx("div",{className:Xe.count,children:g===null?o("scheduledTasks.loading"):o("scheduledTasks.count",{count:g.length})}),l.jsxs("div",{className:Xe.toolbarActions,children:[l.jsx("button",{type:"button",className:Xe.secondaryButton,onClick:()=>void It(),children:o("scheduledTasks.refresh")}),l.jsx("button",{type:"button",className:Xe.secondaryButton,onClick:t,children:o("scheduledTasks.createViaChat")}),l.jsx("button",{type:"button",className:Xe.primaryButton,onClick:ht,children:o("scheduledTasks.new")})]})]}),C&&l.jsx(pi,{title:o(S?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:Rt,children:l.jsxs("div",{className:Xe.formFields,children:[d&&l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:o("scheduledTasks.workspace")}),l.jsx("select",{className:Xe.select,value:E??"",disabled:!!S||h.length<=1,onChange:ne=>B(ne.target.value||void 0),children:h.map(ne=>l.jsx("option",{value:m(ne)??"",children:VT(ne)},ne.id))})]}),l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:o("scheduledTasks.name")}),l.jsx("input",{className:Xe.input,type:"text",value:I,maxLength:200,placeholder:o("scheduledTasks.namePlaceholder"),onChange:ne=>L(ne.target.value)})]}),l.jsxs("label",{className:Xe.field,children:[l.jsxs("span",{className:Xe.fieldLabel,children:[o("scheduledTasks.prompt"),l.jsx("span",{className:Xe.required,children:"*"})]}),l.jsx(Kyt,{value:O,label:o("scheduledTasks.prompt"),placeholder:o("scheduledTasks.promptPlaceholder"),onChange:A,insertItem:te,onInserted:()=>z(null)})]}),l.jsx("div",{ref:X,className:Xe.referencePopover,children:l.jsx("div",{className:Xe.referenceBar,children:["extension","skill","mcp"].map(ne=>{const Ee=z0(ne);return l.jsxs("button",{type:"button",className:`${Xe.referenceButton} ${V===ne?Xe.referenceButtonActive:""}`,"aria-expanded":V===ne,onClick:()=>void ge(ne),children:[Ee&&l.jsx("span",{className:Xe.referenceButtonIcon,style:{"--composer-tag-icon-url":DT(Ee)},"aria-hidden":!0}),o(`scheduledTasks.reference.${ne}`)]},ne)})})}),l.jsxs("div",{className:Xe.scheduleRow,children:[l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:o("scheduledTasks.frequency")}),l.jsx("select",{className:Xe.select,value:$.frequency,onChange:ne=>{const Ee=ne.target.value;q(qe=>({...qe,frequency:Ee,...Ee==="hourly"?{time:"00:00"}:{}}))},children:Ryt.map(ne=>l.jsx("option",{value:ne,children:o(`scheduledTasks.freq.${ne}`)},ne))})]}),($.frequency==="daily"||$.frequency==="weekdays"||$.frequency==="weekly")&&l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:o("scheduledTasks.time")}),l.jsx("input",{className:Xe.input,type:"time",value:$.time,onChange:ne=>q(Ee=>({...Ee,time:ne.target.value}))})]}),$.frequency==="weekly"&&l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:o("scheduledTasks.weekday")}),l.jsx("select",{className:Xe.select,value:$.weekday,onChange:ne=>q(Ee=>({...Ee,weekday:Number(ne.target.value)})),children:o("scheduledTasks.weekdayNames").split(",").map((ne,Ee)=>l.jsx("option",{value:Ee,children:ne},Ee))})]}),$.frequency==="minutes"&&l.jsxs("label",{className:Xe.field,children:[l.jsx("span",{className:Xe.fieldLabel,children:o("scheduledTasks.interval")}),l.jsx("select",{className:Xe.select,value:$.minuteInterval,onChange:ne=>q(Ee=>({...Ee,minuteInterval:Number(ne.target.value)})),children:Dyt.map(ne=>l.jsx("option",{value:ne,children:ne},ne))})]}),$.frequency==="custom"&&l.jsxs("label",{className:`${Xe.field} ${Xe.fieldGrow}`,children:[l.jsx("span",{className:Xe.fieldLabel,children:o("scheduledTasks.cron")}),l.jsx("input",{className:Xe.input,type:"text",value:$.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:ne=>q(Ee=>({...Ee,customCron:ne.target.value}))})]})]}),l.jsx("div",{className:Xe.preview,children:Me?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Xe.previewLabel,children:Me}),l.jsx("code",{className:Xe.previewCron,children:yt})]}):l.jsx("span",{className:Xe.previewInvalid,children:o("scheduledTasks.error.invalidSchedule")})}),M&&l.jsx("div",{className:Xe.formError,children:M}),l.jsxs("div",{className:Xe.formActions,children:[l.jsx("button",{type:"button",className:Xe.secondaryButton,onClick:Rt,disabled:U,children:o("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:Xe.primaryButton,onClick:()=>void Ue(),disabled:U,children:o(U?S?"scheduledTasks.saving":"scheduledTasks.creating":S?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),Ie,x&&l.jsx("div",{className:Xe.loadError,children:x}),g!==null&&g.length===0&&!x&&l.jsx("div",{className:Xe.empty,children:o("scheduledTasks.empty")}),l.jsx("div",{className:Xe.list,children:(g??[]).map(ne=>{const Ee=ne.name||ne.prompt,qe=v===xf(ne);return l.jsxs("div",{className:`${Xe.card} ${ne.enabled?"":Xe.cardDisabled}`,children:[l.jsxs("div",{className:Xe.cardHeader,children:[l.jsx("button",{type:"button",role:"switch","aria-checked":ne.enabled,"aria-label":ne.enabled?o("scheduledTasks.disable"):o("scheduledTasks.enable"),className:`${Xe.toggle} ${ne.enabled?Xe.toggleOn:""}`,onClick:()=>void De(ne),disabled:qe,children:l.jsx("span",{className:Xe.toggleKnob})}),l.jsx("div",{className:Xe.cardTitle,title:Ee,children:Ee}),l.jsxs("div",{className:Xe.cardMenu,children:[l.jsx("button",{type:"button",className:Xe.iconAction,onClick:()=>void Re(ne),disabled:!ne.enabled||k!==null,title:o("scheduledTasks.runNow"),"aria-label":o("scheduledTasks.runNow"),children:"▶"}),l.jsx("button",{type:"button",className:Xe.iconAction,onClick:()=>gn(ne),disabled:qe,title:o("scheduledTasks.edit"),"aria-label":o("scheduledTasks.edit"),children:"✎"}),l.jsx("button",{type:"button",className:Xe.iconAction,onClick:()=>void be(ne),disabled:qe,title:o("scheduledTasks.delete"),"aria-label":o("scheduledTasks.delete"),children:"✕"})]})]}),ne.name&&l.jsx("div",{className:Xe.cardPrompt,title:ne.prompt,children:ne.prompt}),l.jsxs("div",{className:Xe.cardFooter,children:[d&&ne.workspaceCwd&&l.jsxs("span",{className:Xe.workspacePill,title:ne.workspaceCwd,children:[l.jsx("span",{className:Xe.workspaceIcon,"aria-hidden":"true",children:"⌂"}),GT(ne.workspaceCwd,u)]}),l.jsxs("span",{className:Xe.schedulePill,children:[l.jsx("span",{className:Xe.clockIcon,"aria-hidden":"true",children:"◷"}),uw(ne.cron,o)]}),l.jsx("span",{className:Xe.recurringTag,children:o(ne.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ne.nextRunAt!=null&&l.jsxs("span",{className:Xe.countdown,"data-testid":"scheduled-task-next-run",title:o("scheduledTasks.nextRunTooltip",{when:Wle(ne.nextRunAt)}),children:[l.jsx("span",{className:Xe.hourglassIcon,"aria-hidden":"true",children:"⏳"}),wYe(ne.nextRunAt-st,o)]}),l.jsx("span",{className:Xe.lastFired,children:kYe(ne,o)}),ne.sessionId&&n?l.jsx("button",{type:"button",className:Xe.runsToggle,onClick:()=>n(ne.sessionId),title:o("scheduledTasks.viewHistoryHint"),children:ne.runs.length>0?o("scheduledTasks.viewHistory",{count:ne.runs.length}):o("scheduledTasks.viewHistoryEmpty")}):ne.runs.length>0&&l.jsx("button",{type:"button",className:Xe.runsToggle,"aria-expanded":ut===xf(ne),onClick:()=>Et(Je=>Je===xf(ne)?null:xf(ne)),children:o("scheduledTasks.runHistory",{count:ne.runs.length})})]}),ut===xf(ne)&&ne.runs.length>0&&l.jsx("ul",{className:Xe.runsList,children:[...ne.runs].reverse().map((Je,Qe)=>l.jsx("li",{className:Xe.runsItem,children:Iyt(Je,o)},`${Je.at}-${Qe}`))})]},xf(ne))})})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Xyt=new Set(["clear","stop","off","reset","none","cancel"]);function JN(e){return e.replace(/^\/goal\b/i,"").trim()}function Qyt(e){return/^\/goal\b/i.test(e.trim())?jD(JN(e.trim())):!1}function jD(e){return Xyt.has(e.trim().toLowerCase())}const Jyt="_root_v50oc_1",Zyt="_intro_v50oc_8",evt="_toolbar_v50oc_14",tvt="_count_v50oc_22",nvt="_toolbarActions_v50oc_28",svt="_primaryButton_v50oc_34",rvt="_secondaryButton_v50oc_35",ivt="_formFields_v50oc_80",ovt="_field_v50oc_86",avt="_fieldLabel_v50oc_93",lvt="_required_v50oc_102",cvt="_textarea_v50oc_59",uvt="_formHint_v50oc_126",dvt="_formError_v50oc_132",hvt="_loadError_v50oc_133",fvt="_degraded_v50oc_140",mvt="_formActions_v50oc_148",pvt="_empty_v50oc_156",gvt="_list_v50oc_163",bvt="_card_v50oc_169",yvt="_cardHeader_v50oc_180",vvt="_statusDot_v50oc_188",xvt="_statusDotRunning_v50oc_196",wvt="_cardTitle_v50oc_200",kvt="_cardMenu_v50oc_211",_vt="_iconAction_v50oc_218",Svt="_cardReason_v50oc_250",Cvt="_reasonLabel_v50oc_262",Tvt="_cardFooter_v50oc_266",Evt="_statusPill_v50oc_274",Avt="_meta_v50oc_285",jvt="_sessionLink_v50oc_290",er={root:Jyt,intro:Zyt,toolbar:evt,count:tvt,toolbarActions:nvt,primaryButton:svt,secondaryButton:rvt,formFields:ivt,field:ovt,fieldLabel:avt,required:lvt,textarea:cvt,formHint:uvt,formError:dvt,loadError:hvt,degraded:fvt,formActions:mvt,empty:pvt,list:gvt,card:bvt,cardHeader:yvt,statusDot:vvt,statusDotRunning:xvt,cardTitle:wvt,cardMenu:kvt,iconAction:_vt,cardReason:Svt,reasonLabel:Cvt,cardFooter:Tvt,statusPill:Evt,meta:Avt,sessionLink:jvt},Nvt=1e4,Mvt=1e3;function Ivt({onCreateGoal:e,onOpenSession:t,onError:n}){const{t:s}=at(),r=Vo(),[i,o]=f.useState(null),[a,c]=f.useState(0),[u,d]=f.useState(null),[h,m]=f.useState(null),[p,g]=f.useState(!1),[b,x]=f.useState(""),[y,v]=f.useState(!1),[w,k]=f.useState(null),[T,C]=f.useState(()=>Date.now()),_=f.useRef(!0),S=f.useRef(0);f.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]);const D=f.useCallback(async()=>{const O=++S.current;try{const A=await r.listGoals();if(!_.current||O!==S.current)return;o(A.goals),c(A.droppedCount),d(null)}catch(A){if(!_.current||O!==S.current)return;d(A instanceof Error?A.message:String(A)),o($=>$??[]),c(0)}},[r]);f.useEffect(()=>{let O=!1,A=0;const $=async()=>{await D(),!O&&(A=window.setTimeout(()=>void $(),Nvt))};return $(),()=>{O=!0,window.clearTimeout(A)}},[D]);const E=!!(i!=null&&i.length);f.useEffect(()=>{if(!E)return;const O=window.setInterval(()=>C(Date.now()),Mvt);return()=>window.clearInterval(O)},[E]);const B=f.useCallback(()=>{x(""),k(null),g(!1)},[]),I=f.useCallback(async()=>{const O=b.trim();if(O.length===0){k(s("goals.error.emptyCondition"));return}if(jD(O)){k(s("goals.error.clearKeyword",{word:O}));return}v(!0),k(null);try{const A=await e(O);if(!_.current||A===!1)return;B()}catch(A){if(!_.current){n(A,s("goals.error.createFailed"));return}k(A instanceof Error?A.message:String(A))}finally{_.current&&v(!1)}},[b,e,n,B,s]),L=f.useCallback(async O=>{const A=O.condition.length>60?`${O.condition.slice(0,57)}…`:O.condition;if(window.confirm(s("goals.clearConfirm",{condition:A}))){m(O.sessionId);try{await r.clearGoal(O.sessionId),await D()}catch($){n($,s("goals.error.clearFailed"))}finally{_.current&&m(null)}}},[r,n,D,s]);return l.jsxs("div",{className:er.root,children:[l.jsx("div",{className:er.intro,children:s("goals.subtitle")}),l.jsxs("div",{className:er.toolbar,children:[l.jsx("div",{className:er.count,children:i===null?s("goals.loading"):s("goals.count",{count:i.length})}),l.jsxs("div",{className:er.toolbarActions,children:[l.jsx("button",{type:"button",className:er.secondaryButton,onClick:()=>void D(),children:s("goals.refresh")}),l.jsx("button",{type:"button",className:er.primaryButton,onClick:()=>{x(""),k(null),g(!0)},children:s("goals.new")})]})]}),p&&l.jsx(pi,{title:s("goals.new"),size:"md",onClose:B,children:l.jsxs("div",{className:er.formFields,children:[l.jsxs("label",{className:er.field,children:[l.jsxs("span",{className:er.fieldLabel,children:[s("goals.condition"),l.jsx("span",{className:er.required,children:"*"})]}),l.jsx("textarea",{className:er.textarea,value:b,rows:4,placeholder:s("goals.conditionPlaceholder"),onChange:O=>x(O.target.value)})]}),l.jsx("div",{className:er.formHint,children:s("goals.newHint")}),w&&l.jsx("div",{className:er.formError,role:"alert",children:w}),l.jsxs("div",{className:er.formActions,children:[l.jsx("button",{type:"button",className:er.secondaryButton,onClick:B,disabled:y,children:s("goals.cancel")}),l.jsx("button",{type:"button",className:er.primaryButton,onClick:()=>void I(),disabled:y,children:s(y?"goals.creating":"goals.create")})]})]})}),u&&l.jsx("div",{className:er.loadError,role:"alert",children:u}),a>0&&l.jsx("div",{className:er.degraded,"data-testid":"goals-dropped",children:s("goals.dropped",{count:a})}),i!==null&&i.length===0&&!u&&l.jsx("div",{className:er.empty,children:s("goals.empty")}),l.jsx("div",{className:er.list,role:"list",children:(i??[]).map(O=>{const A=h===O.sessionId;return l.jsxs("div",{className:er.card,role:"listitem",children:[l.jsxs("div",{className:er.cardHeader,children:[l.jsx("span",{className:`${er.statusDot} ${O.hasActivePrompt?er.statusDotRunning:""}`,"aria-hidden":"true"}),l.jsx("div",{className:er.cardTitle,title:O.condition,children:O.condition}),l.jsx("div",{className:er.cardMenu,children:l.jsx("button",{type:"button",className:er.iconAction,onClick:()=>void L(O),disabled:A,title:s("goals.clear"),"aria-label":s("goals.clear"),children:"✕"})})]}),O.lastReason&&l.jsxs("div",{className:er.cardReason,children:[l.jsxs("span",{className:er.reasonLabel,children:[s("goal.lastCheck"),":"]})," ",O.lastReason]}),l.jsxs("div",{className:er.cardFooter,children:[l.jsx("span",{className:er.statusPill,children:s(O.hasActivePrompt?"goals.running":"goals.idle")}),l.jsx("span",{className:er.meta,children:O.iterations>0?s(O.iterations===1?"goal.turn":"goal.turns",{count:O.iterations}):s("goals.notYetEvaluated")}),l.jsx("span",{className:er.meta,"data-testid":"goal-elapsed",children:b3(Math.max(0,T-O.setAt))}),l.jsx("button",{type:"button",className:er.sessionLink,onClick:()=>t(O.sessionId),title:s("goals.openSessionHint"),"aria-label":`${s("goals.openSessionHint")}: ${O.displayName||O.sessionId}`,children:O.displayName||O.sessionId})]})]},O.sessionId)})})]})}function e1(e){return e.replace(/[：:\s]+$/u,"")}const Rvt="_extensionGrid_1aki4_1",Dvt={extensionGrid:Rvt};function Lvt(e,t){return e&&t.some(n=>n.name===e)?e:null}function Pvt(e,t){const n=t.trim().toLowerCase();return n?e.filter(s=>[s.name,s.displayName,s.description].filter(r=>!!r).some(r=>r.toLowerCase().includes(n))):[...e]}function Ovt({className:e,...t}){return l.jsx(Rte,{"data-slot":"radio-group",className:Qt("grid w-full gap-2",e),...t})}function $vt({className:e,...t}){return l.jsx(Pte,{"data-slot":"radio-group-item",className:Qt("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:l.jsx($te,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:l.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 gW="update available";function rv(e){return e.displayName||e.name}function ZN(e){return e.workspaceActivation&&e.workspaceActivation!=="inherit"?e.workspaceActivation==="enabled":e.defaultActivation?e.defaultActivation==="enabled":e.isActive}function K7(e,t){return ZN(e)?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function Y7(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 w2(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 bW(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 th({label:e,value:t}){return l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:e1(e)}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function iv({items:e,empty:t,icon:n}){return e.length?l.jsx(So,{children:l.jsx(Gl,{className:"flex flex-col",children:e.map((s,r)=>l.jsxs("div",{children:[r>0?l.jsx(yD,{}):null,l.jsxs("div",{className:"flex min-w-0 items-center gap-3 py-3 [contain-intrinsic-size:auto_44px] [content-visibility:auto]",children:[l.jsx(n,{className:"size-4 shrink-0 text-muted-foreground"}),l.jsx("span",{className:"min-w-0 break-words",children:s})]})]},s))})}):l.jsx(ud,{className:"border",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:l.jsx(n,{})}),l.jsx(fd,{children:t})]})})}function yW({pendingInteraction:e,submitting:t,selectedPlugin:n,interactionValue:s,setSelectedPlugin:r,setInteractionValue:i,submit:o,t:a}){return l.jsx(y0,{open:!!e,onOpenChange:c=>{!c&&e&&!t&&o({cancelled:!0})},children:l.jsxs(v0,{showCloseButton:!1,className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-3xl",children:[l.jsxs(x0,{className:"items-start px-3 text-left",children:[l.jsx(k0,{children:(e==null?void 0:e.interaction.kind)==="setting"?e.interaction.setting.name:a("extensions.manage.selectExtension")}),l.jsx(ub,{children:(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?a("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"?l.jsx(Ovt,{"aria-label":a("extensions.manage.selectExtension"),value:n,onValueChange:r,className:"flex flex-col gap-2 px-3",children:e.interaction.plugins.map(c=>{var d;const u=`marketplace-plugin-${c.name}`;return l.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-border p-3 has-data-[state=checked]:bg-accent/50",children:[l.jsx($vt,{id:u,value:c.name,disabled:t,className:"mt-0.5"}),l.jsxs("label",{htmlFor:u,className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-1",children:[l.jsx("span",{className:"font-medium",children:c.name}),l.jsx("span",{className:"text-sm text-muted-foreground",children:c.description??c.category??(c.source==="."||c.source==="./"?a("extensions.manage.marketplaceRoot"):c.source)??a("extensions.manage.noDescription")}),(d=c.tags)!=null&&d.length?l.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"?l.jsxs(w0,{children:[l.jsx(An,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),l.jsxs(An,{disabled:t||!n,onClick:()=>o({pluginName:n}),children:[t?l.jsx(li,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]}):(e==null?void 0:e.interaction.kind)==="setting"?l.jsxs(l.Fragment,{children:[l.jsx(qr,{autoComplete:"off","aria-label":e.interaction.setting.name,type:e.interaction.setting.sensitive?"password":"text",value:s,onChange:c=>i(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!t&&(c.preventDefault(),o({value:s}))}}),l.jsxs(w0,{children:[l.jsx(An,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),l.jsxs(An,{disabled:t,onClick:()=>o({value:s}),children:[t?l.jsx(li,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]})]}):null]})})}function Qle({onClose:e,initialFocusRef:t,embedded:n}){const{t:s}=at(),r=xa(),i=la(),o=Vo(),a=wd(),[c,u]=f.useState([]),[d,h]=f.useState(null),[m,p]=f.useState(""),[g,b]=f.useState({}),[x,y]=f.useState(!1),[v,w]=f.useState(null),[k,T]=f.useState(null),[C,_]=f.useState(null),[S,D]=f.useState("info"),[E,B]=f.useState(null),[I,L]=f.useState(null),[O,A]=f.useState(!1),[$,q]=f.useState(null),[U,H]=f.useState(!1),[M,ee]=f.useState(""),[V,R]=f.useState(!1),[re,Z]=f.useState(null),[K,Y]=f.useState(null),ae=f.useRef(null),[le,te]=f.useState(""),[z,X]=f.useState(""),[fe,xe]=f.useState(!1),[ie,Ce]=f.useState(!1),Ke=f.useRef(!1),ut=f.useRef(null),Et=f.useRef(null),st=f.useRef(new Map),xt=f.useRef(null),[He,pn]=f.useState(null),Yt=f.useCallback(be=>{be&&Et.current!==be||(Et.current=null,ae.current=null,Y(null),te(""),X(""))},[]),It=f.useCallback((be,Ie,ne)=>{ae.current!==Ie.id&&(te(""),X(""),ae.current=Ie.id),Et.current=be,Y({operationId:be,interaction:Ie,owner:ne})},[]),me=f.useCallback((be=!1)=>{y(!0);const Ie=i.workspaceCwd?i.client.workspaceByCwd(i.workspaceCwd).workspaceExtensions().catch(()=>null):Promise.resolve(null);return Promise.all([o.loadExtensionsStatus(),Ie]).then(([ne,Ee])=>{var Qe,cn,Kn;const qe=new Map(((Ee==null?void 0:Ee.extensions)??[]).map(_e=>[_e.extensionId,_e])),Je=(ne.extensions??[]).map(_e=>{const ft=qe.get(_e.id);return ft?{..._e,defaultActivation:ft.defaultActivation,workspaceActivation:ft.workspaceActivation??"inherit"}:_e});u(_e=>{const ft=ut.current;if(!ft||Je.some(pe=>pe.name===ft))return Je;const $t=_e.find(pe=>pe.name===ft);return $t?[...Je,$t]:Je}),be||(B(null),D((Qe=ne.errors)!=null&&Qe[0]?"error":"info"),_(((Kn=(cn=ne.errors)==null?void 0:cn[0])==null?void 0:Kn.error)??null)),h(_e=>_e&&ut.current===_e?_e:Lvt(_e,Je))}).catch(ne=>{be||(B(null),D("error"),_(ne instanceof Error?ne.message:String(ne)))}).finally(()=>y(!1))},[o,i.client,i.workspaceCwd]);f.useEffect(()=>{me()},[me]),f.useEffect(()=>{let be=!1,Ie,ne=2e3;const Ee=async()=>{try{const{operations:qe}=await o.activeExtensionOperations();if(be)return;const Je=qe.filter(cn=>cn.operation==="install").sort((cn,Kn)=>Kn.createdAt-cn.createdAt)[0];Je&&Z(cn=>cn??{operationId:Je.operationId,source:Je.source??Je.name??"extension"});const Qe=qe.find(cn=>cn.operation!=="install");Qe&&(Ke.current=!0,Qe.operation==="uninstall"&&(ut.current=Qe.name??"extension"),pn(cn=>cn??{operationId:Qe.operationId,name:Qe.name??"extension",operation:Qe.operation}),T(cn=>cn??Qe.name??null)),L(null),Ce(!0)}catch(qe){be||(L(qe instanceof Error?qe.message:String(qe)),Ie=setTimeout(()=>void Ee(),ne),ne=Math.min(ne*2,3e4))}};return Ee(),()=>{be=!0,Ie&&clearTimeout(Ie)}},[o]);const $e=f.useRef((a==null?void 0:a.extensionsVersion)??0);f.useEffect(()=>{const be=(a==null?void 0:a.extensionsVersion)??0;be!==$e.current&&($e.current=be,b({}),me(!0))},[me,a==null?void 0:a.extensionsVersion]),f.useEffect(()=>{if(!re)return;let be=!1,Ie,ne=1e3;const Ee=async()=>{var qe,Je;try{const Qe=await o.extensionOperationStatus(re.operationId);if(be)return;if(ne=1e3,Qe.status==="waiting_for_input"){Qe.interaction?(It(Qe.operationId,Qe.interaction,"install"),Ie=setTimeout(()=>void Ee(),5e3)):(D("error"),_(s("extensions.manage.operationFailed")),Yt(re.operationId),Z(null));return}if(Qe.status==="failed"){D("error"),_(s("extensions.install.failed",{source:re.source,error:Qe.error??""})),Yt(re.operationId),Z(null);return}if(Qe.status==="succeeded"||Qe.status==="succeeded_with_refresh_error"){D(Qe.status==="succeeded_with_refresh_error"?"error":"success"),_(Qe.status==="succeeded_with_refresh_error"?s("extensions.manage.refreshFailed",{error:((qe=Qe.result)==null?void 0:qe.error)??""}):s("extensions.install.installed",{name:((Je=Qe.result)==null?void 0:Je.name)??re.source})),Yt(re.operationId),Z(null),me(!0);return}D("progress"),_(s("extensions.install.started",{source:re.source})),Ie=setTimeout(()=>void Ee(),1e3)}catch(Qe){if(be)return;if(D("error"),_(Qe instanceof Error?Qe.message:String(Qe)),Qe instanceof ic&&Qe.status===404){Yt(re.operationId),Z(null);return}Ie=setTimeout(()=>void Ee(),ne),ne=Math.min(ne*2,3e4)}};return Ee(),()=>{be=!0,Ie&&clearTimeout(Ie)}},[o,Yt,me,re,It,s]);const yt=f.useCallback(be=>{if(!K)return;const Ie=K.owner,ne=()=>{Ie==="install"?Z(Ee=>Ee&&{...Ee}):pn(Ee=>Ee&&{...Ee})};xe(!0),o.respondToExtensionInteraction(K.operationId,K.interaction.id,be,r.clientId).then(()=>{Yt(K.operationId),ne()}).catch(Ee=>{D("error"),_(Ee instanceof Error?Ee.message:String(Ee)),Yt(K.operationId),ne()}).finally(()=>xe(!1))},[o,Yt,r.clientId,K]);f.useEffect(()=>{if(!He)return;let be=!1,Ie,ne=1e3;const Ee=async()=>{var qe;try{const Je=await o.extensionOperationStatus(He.operationId);if(be)return;if(ne=1e3,Je.status==="waiting_for_input"){Je.interaction?(It(Je.operationId,Je.interaction,"mutation"),Ie=setTimeout(()=>void Ee(),5e3)):(D("error"),_(s("extensions.manage.operationFailed")),Yt(He.operationId),pn(null),T(null),Ke.current=!1,He.operation==="uninstall"&&(ut.current=null,me(!0)));return}if(Je.status==="failed"){D("error"),_(Je.error??s("extensions.manage.operationFailed")),Yt(He.operationId),pn(null),T(null),Ke.current=!1,Je.operation==="uninstall"&&(ut.current=null,me(!0));return}if(Je.status==="succeeded"||Je.status==="succeeded_with_refresh_error"){Je.status==="succeeded_with_refresh_error"?(D("error"),_(s("extensions.manage.refreshFailed",{error:((qe=Je.result)==null?void 0:qe.error)??""}))):Je.operation==="uninstall"?_(null):(D("success"),_(bW(Je.operation,He.name,s))),Yt(He.operationId),pn(null),T(null),Ke.current=!1,Je.operation==="uninstall"&&(ut.current=null,B(null),h(null)),Je.operation==="update"&&b(Qe=>{const cn={...Qe};return delete cn[He.name],cn}),me(!0);return}D("progress"),_(w2(Je.operation,He.name,s)),Ie=setTimeout(()=>void Ee(),1e3)}catch(Je){if(be)return;if(D("error"),_(Je instanceof Error?Je.message:String(Je)),Je instanceof ic&&Je.status===404){Yt(He.operationId),pn(null),T(null),Ke.current=!1,He.operation==="uninstall"&&(ut.current=null,me(!0));return}Ie=setTimeout(()=>void Ee(),ne),ne=Math.min(ne*2,3e4)}};return Ee(),()=>{be=!0,Ie&&clearTimeout(Ie)}},[o,Yt,me,He,It,s]);const Me=f.useCallback(()=>{B(null),D("info"),_(null),me()},[me]),Le=f.useCallback(be=>{w(be),B(d===be?be:null),D("info"),_(null),b(Ie=>({...Ie,[be]:"checking for updates"})),o.checkExtensionUpdates(r.clientId).then(Ie=>{b(Ie.states),_(Y7(Ie.states[be],s))}).catch(Ie=>{b(ne=>({...ne,[be]:"error"})),D("error"),_(Ie instanceof Error?Ie.message:String(Ie))}).finally(()=>w(null))},[o,r.clientId,d,s]),vn=f.useCallback(()=>{const be=M.trim(),Ie=r.clientId;!be||!ie||re||He||Ke.current||(R(!0),B(null),D("progress"),_(null),o.installExtension({source:be,consent:!0},Ie).then(ne=>{Z({operationId:ne.operationId,source:be}),ee(""),H(!1)}).catch(ne=>{D("error"),_(ne instanceof Error?ne.message:String(ne))}).finally(()=>R(!1)))},[o,r.clientId,M,ie,re,He]),ge=f.useCallback((be,Ie,ne={})=>{const Ee=r.clientId;if(!ie||re||He||v||Ke.current)return!1;Ke.current=!0,ne.operation==="uninstall"&&(ut.current=be),T(be),B(d===be?be:null),D("progress"),_(ne.startMessage??null);let qe=!1;return Ie(Ee).then(Je=>{const Qe=Je&&typeof Je=="object"&&"operationId"in Je&&typeof Je.operationId=="string"?Je.operationId:void 0;if(Qe){qe=!0,pn({operationId:Qe,name:be,operation:ne.operation});return}_(s("extensions.manage.queued",{name:be}))}).catch(Je=>{D("error"),_(Je instanceof Error?Je.message:String(Je))}).finally(()=>{qe||(Ke.current=!1,T(null),ne.operation==="uninstall"&&(ut.current=null),me(!0))}),!0},[r.clientId,v,me,ie,re,He,d,s]),Rt=f.useCallback(async(be,Ie,ne)=>{if(k||re||He||v||!i.workspaceCwd)return;const Ee=ne==="enabled"?"enable":ne==="disabled"?"disable":"inherit";T(be.name),B(be.name),D("progress"),_(Ee==="inherit"?s("extensions.manage.inheriting",{name:be.name}):w2(Ee,be.name,s));try{const qe=Ie==="user"?await i.client.setExtensionDefaultActivation(be.id,ne):ne==="inherit"?await i.client.workspaceByCwd(i.workspaceCwd).clearExtensionActivation(be.id):await i.client.workspaceByCwd(i.workspaceCwd).setExtensionActivation(be.id,ne),Je=await i.client.waitForExtensionOperation(qe);if(Je.status==="failed")throw new Error(Je.error??s("extensions.manage.operationFailed"));await me(!0),D("success"),_(Ee==="inherit"?s("extensions.manage.inherited",{name:be.name}):bW(Ee,be.name,s))}catch(qe){D("error"),_(qe instanceof Error?qe.message:String(qe))}finally{T(null)}},[k,v,me,re,He,s,i.client,i.workspaceCwd]),ht=f.useMemo(()=>c.find(be=>be.name===d),[c,d]);f.useEffect(()=>{n==null||n.onDetailChange(!!ht)},[n,ht]);const gn=f.useMemo(()=>Pvt(c,m),[c,m]),Ue=f.useCallback(()=>{xt.current=d,h(null)},[d]);f.useEffect(()=>{var be;d||!xt.current||((be=st.current.get(xt.current))==null||be.focus(),xt.current=null)},[d]);const De=l.jsx(Pm,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Om,{className:"text-base",children:[l.jsx(Ni,{children:l.jsx(An,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(aC,{})})}),l.jsx(Ni,{children:ht?l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",onClick:Ue,children:s("extensions.manage.title")})}):l.jsx(za,{children:s("extensions.manage.title")})}),ht?l.jsx(od,{}):null,ht?l.jsx(Ni,{children:l.jsx(za,{children:rv(ht)})}):null]})}),Re=n?ht?l.jsx(Pm,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Om,{className:"h-8 text-sm",children:[l.jsx(Ni,{children:l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",onClick:n.onRoot,children:s("extensions.manage.title")})})}),l.jsx(od,{}),l.jsx(Ni,{children:l.jsx(za,{children:rv(ht)})})]})}):null:De;if(ht){const be=ht.details,Ie=g[ht.name]??ht.updateState,ne=!ie||re!==null||k!==null||He!==null,Ee=v===ht.name,qe=ht.defaultActivation,Je=ht.workspaceActivation,Qe=qe===void 0||Je===void 0,cn=(be==null?void 0:be.commands)??[],Kn=(be==null?void 0:be.skills)??[],_e=(be==null?void 0:be.agents)??[],ft=(be==null?void 0:be.mcpServers)??[],$t=(be==null?void 0:be.contextFiles)??[];return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Re,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(c$,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-xl font-semibold",children:rv(ht)}),l.jsxs(mo,{variant:"outline",children:["v",ht.version]}),l.jsx(mo,{variant:"secondary",className:ZN(ht)?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:K7(ht,s)})]})}),l.jsxs(mh,{open:O,onOpenChange:A,children:[l.jsx(ph,{asChild:!0,children:l.jsx(An,{variant:"ghost",size:"icon",disabled:ne||Ee,"aria-label":s("extensions.manage.actions"),children:ne||Ee?l.jsx(li,{}):l.jsx(qf,{})})}),l.jsxs(gh,{align:"end",children:[l.jsxs(dm,{children:[l.jsx(Gi,{disabled:ne||v!==null,onSelect:()=>Le(ht.name),children:s("extensions.manage.checkUpdates")}),l.jsx(Gi,{disabled:ne||Ee||Ie!==gW,onSelect:()=>ge(ht.name,pe=>o.updateExtension(ht.name,pe),{operation:"update",startMessage:w2("update",ht.name,s)}),children:s("extensions.manage.update")})]}),l.jsx(Dae,{}),l.jsx(dm,{children:l.jsx(Gi,{variant:"destructive",disabled:ne||Ee,onSelect:pe=>{pe.preventDefault(),A(!1),q(ht.name)},children:s("extensions.manage.uninstallAction")})})]})]})]}),E===ht.name&&C?l.jsx(yl,{tone:S,noticeKey:C,closeLabel:s("common.close"),onDismiss:()=>_(null),className:"break-words",children:C}):null,Qe?l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(Vl,{children:s("extensions.manage.setting.unavailableDescription")})]}):null,l.jsx(So,{className:"gap-0 py-1",children:l.jsxs(Gl,{className:"flex flex-col p-0",children:[l.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"font-medium",children:s("extensions.manage.userSetting")}),l.jsx("p",{className:"text-sm text-muted-foreground",children:s("extensions.manage.userSettingDescription")})]}),l.jsxs(kl,{value:qe,disabled:ne||Ee||Qe,onValueChange:pe=>void Rt(ht,"user",pe),children:[l.jsx(Sl,{className:"w-28 shrink-0",children:l.jsx(_l,{placeholder:s("extensions.manage.setting.unknown")})}),l.jsxs(Cl,{children:[l.jsx(bi,{value:"enabled",children:s("extensions.manage.setting.enabled")}),l.jsx(bi,{value:"disabled",children:s("extensions.manage.setting.disabled")})]})]})]}),l.jsx(yD,{}),l.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"font-medium",children:s("extensions.manage.workspaceSetting")}),l.jsx("p",{className:"text-sm text-muted-foreground",children:s("extensions.manage.workspaceSettingDescription")})]}),l.jsxs(kl,{value:Je,disabled:ne||Ee||Qe,onValueChange:pe=>void Rt(ht,"workspace",pe),children:[l.jsx(Sl,{className:"w-28 shrink-0",children:l.jsx(_l,{placeholder:s("extensions.manage.setting.unknown")})}),l.jsxs(Cl,{children:[l.jsx(bi,{value:"inherit",children:s("extensions.manage.setting.default")}),l.jsx(bi,{value:"enabled",children:s("extensions.manage.setting.enabled")}),l.jsx(bi,{value:"disabled",children:s("extensions.manage.setting.disabled")})]})]})]})]})}),l.jsxs(Q0,{defaultValue:"overview",children:[l.jsxs(J0,{className:"max-w-full overflow-x-auto",children:[l.jsx(Fr,{value:"overview",children:s("extensions.manage.overview")}),l.jsxs(Fr,{value:"commands",children:[e1(s("extensions.manage.commands"))," ",cn.length]}),l.jsxs(Fr,{value:"skills",children:[e1(s("extensions.manage.skills"))," ",Kn.length]}),l.jsxs(Fr,{value:"agents",children:[e1(s("extensions.manage.agents"))," ",_e.length]}),l.jsxs(Fr,{value:"mcp",children:[e1(s("extensions.manage.mcpServers"))," ",ft.length]}),l.jsxs(Fr,{value:"context",children:[e1(s("extensions.manage.contextFiles"))," ",$t.length]})]}),l.jsx(gi,{value:"overview",className:"pt-4",children:l.jsxs(So,{children:[l.jsxs(ml,{children:[l.jsx(pl,{children:s("extensions.manage.overview")}),ht.description?l.jsx(iu,{children:ht.description}):null]}),l.jsxs(Gl,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(th,{label:s("extensions.manage.name"),value:ht.name}),l.jsx(th,{label:s("extensions.manage.version"),value:ht.version}),l.jsx(th,{label:s("extensions.manage.status"),value:K7(ht,s)}),l.jsx(th,{label:s("extensions.manage.source"),value:ht.source??"-"}),l.jsx(th,{label:s("extensions.manage.path"),value:ht.path}),l.jsx(th,{label:s("extensions.manage.updateStatus"),value:Y7(Ie,s)}),l.jsx(th,{label:s("extensions.manage.installType"),value:ht.installType??"-"}),l.jsx(th,{label:s("extensions.manage.origin"),value:ht.originSource??"-"}),l.jsx(th,{label:s("extensions.manage.settings"),value:((be==null?void 0:be.settings)??[]).join(", ")||"-"})]})]})}),l.jsx(gi,{value:"commands",className:"pt-4",children:l.jsx(iv,{items:cn,empty:s("extensions.manage.emptyCommands"),icon:Rge})}),l.jsx(gi,{value:"skills",className:"pt-4",children:l.jsx(iv,{items:Kn,empty:s("extensions.manage.emptySkills"),icon:N1})}),l.jsx(gi,{value:"agents",className:"pt-4",children:l.jsx(iv,{items:_e,empty:s("extensions.manage.emptyAgents"),icon:Vv})}),l.jsx(gi,{value:"mcp",className:"pt-4",children:l.jsx(iv,{items:ft,empty:s("extensions.manage.emptyMcpServers"),icon:j1})}),l.jsx(gi,{value:"context",className:"pt-4",children:l.jsx(iv,{items:$t,empty:s("extensions.manage.emptyContextFiles"),icon:zge})})]})]}),l.jsx(S3,{open:$===ht.name,onOpenChange:pe=>{pe||q(null)},children:l.jsxs(C3,{children:[l.jsxs(T3,{className:"place-items-start text-left",children:[l.jsx(A3,{children:s("extensions.manage.uninstallAction")}),l.jsx(j3,{children:s("extensions.manage.uninstallConfirm",{name:ht.name})})]}),l.jsxs(E3,{children:[l.jsx(N3,{children:s("common.cancel")}),l.jsx(vD,{variant:"destructive",onClick:()=>{$&&ge($,pe=>o.uninstallExtension($,pe),{operation:"uninstall",startMessage:w2("uninstall",$,s)})&&q(null)},children:s("extensions.manage.uninstallAction")})]})]})}),l.jsx(yW,{pendingInteraction:K,submitting:fe,selectedPlugin:z,interactionValue:le,setSelectedPlugin:X,setInteractionValue:te,submit:yt,t:s})]})}return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Re,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{ref:t,tabIndex:-1,className:"text-xl font-semibold outline-none",children:s("extensions.manage.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("extensions.manage.count",{count:c.length})})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[l.jsxs(An,{variant:"outline",disabled:x,onClick:Me,children:[x?l.jsx(li,{}):l.jsx(uC,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(An,{disabled:!ie||!!(re||He||k),onClick:()=>H(!0),children:[l.jsx(eb,{"data-icon":"inline-start"}),s("extensions.manage.add")]})]})]}),E===null&&C||I?l.jsx(yl,{tone:I?"error":S,noticeKey:(E===null?C:null)??I??"",closeLabel:s("common.close"),onDismiss:()=>{_(null),L(null)},className:"break-words",children:(E===null?C:null)??I}):null,l.jsxs("div",{className:"relative",children:[l.jsx(lu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(qr,{name:"extension-search","aria-label":s("extensions.manage.search"),autoComplete:"off",value:m,onChange:be=>p(be.target.value),placeholder:s("extensions.manage.search"),className:"pl-9"})]}),gn.length?l.jsx("div",{className:Dvt.extensionGrid,"data-column-count":Math.min(gn.length,4),children:gn.map(be=>{const Ie=g[be.name]??be.updateState;return l.jsx(So,{ref:ne=>{ne?st.current.set(be.name,ne):st.current.delete(be.name)},size:"sm",role:"button",tabIndex:0,"aria-label":rv(be),className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>h(be.name),onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),h(be.name))},children:l.jsx(ml,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(c$,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(pl,{className:"min-w-0 truncate",children:rv(be)}),l.jsx("div",{className:"flex shrink-0 justify-end",children:l.jsx(mo,{variant:"secondary",className:ZN(be)?"bg-[var(--success-bg)] text-[10px] text-[var(--success-color)]":"text-[10px]",children:K7(be,s)})})]}),Ie===gW?l.jsx("div",{className:"mt-1",children:l.jsx(mo,{className:"text-[10px]",children:Y7(Ie,s)})}):null,l.jsx(iu,{className:"mt-1 min-w-0 text-xs",children:l.jsx(Ad,{delayDuration:300,children:l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:be.description||s("extensions.manage.noDescription")})}),l.jsx(Md,{children:be.description||s("extensions.manage.noDescription")})]})})})]})]})})},be.id||be.name)})}):l.jsx(ud,{className:"border",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:m?l.jsx(lu,{}):l.jsx(yge,{})}),l.jsx(fd,{children:s(m?"extensions.manage.noMatches":"extensions.manage.empty")}),m?null:l.jsx(tk,{children:s("extensions.manage.emptyDescription")})]})})]}),l.jsx(S3,{open:U,onOpenChange:be=>{(be||!V)&&H(be)},children:l.jsxs(C3,{size:"middle",children:[l.jsxs(T3,{className:"place-items-start text-left",children:[l.jsx(A3,{children:s("extensions.manage.add")}),l.jsx(j3,{children:s("extensions.manage.installDescription")})]}),l.jsx(qr,{id:"extension-source",name:"extension-source","aria-label":s("extensions.manage.installDescription"),autoComplete:"off",value:M,onChange:be=>ee(be.target.value),placeholder:s("extensions.manage.sourcePlaceholder")}),l.jsxs(E3,{children:[l.jsx(N3,{disabled:V,children:s("common.cancel")}),l.jsxs(An,{disabled:V||!ie||!!(re||He||k)||!M.trim(),onClick:vn,children:[V?l.jsx(li,{}):null,s("extensions.manage.install")]})]})]})}),l.jsx(yW,{pendingInteraction:K,submitting:fe,selectedPlugin:z,interactionValue:le,setSelectedPlugin:X,setInteractionValue:te,submit:yt,t:s})]})}const Bvt="_connectedBadge_1erz5_1",zvt="_serverGrid_1erz5_6",Jle={connectedBadge:Bvt,serverGrid:zvt},k2=`{
  "command": "",
  "args": []
}`;function XT(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 bS(e){const t=XT(e);return t==="workspace_settings"?"workspace":t==="extension"?"extension":"user"}function Fvt(e){const t=XT(e);return t==="extension"||t==="workspace_settings"||t==="user_settings"}function vW(e,t){const n=bS(e);return t(n==="workspace"?"mcp.source.workspace":n==="extension"?"mcp.source.extension":"mcp.source.user")}function xW(e,t){var s;const n=(s=e.settings.find(r=>r.key==="mcpServers"))==null?void 0:s.values[t];return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n))}function wW(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 kW(e){return!e.disabled&&!e.approvalState&&e.mcpStatus==="connected"?Jle.connectedBadge:""}function Hvt(e,t){var s;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} ${((s=n.args)==null?void 0:s.join(" "))??""} (stdio)`.trim():e.transport?`(${e.transport})`:t("mcp.status.unknown")}function qvt(e,t){const n=[],s=!!e.approvalState,r=XT(e);return(r==="user_settings"||r==="workspace_settings")&&n.push({id:"edit",label:t("mcp.action.edit")}),!e.disabled&&!s&&!e.requiresAuth&&e.mcpStatus==="disconnected"&&n.push({id:"reconnect",label:t("mcp.action.reconnect")}),!e.disabled&&s&&n.push({id:"approve",label:t("mcp.action.approve")}),(r!=="extension"||e.disabled)&&n.push({id:e.disabled?"enable":"disable",label:e.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!e.disabled&&!s&&(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 Uvt(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Wvt(e,t){const n=e.annotations??{},s=[];return n.destructiveHint&&s.push(t("mcp.annotation.destructive")),n.readOnlyHint&&s.push(t("mcp.annotation.readOnly")),n.openWorldHint&&s.push(t("mcp.annotation.openWorld")),n.idempotentHint&&s.push(t("mcp.annotation.idempotent")),s.join(", ")}function ql({label:e,value:t}){return l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function Vvt({tool:e,t}){var i;const n=Wvt(e,t),s=e.schema,r=(s==null?void 0:s.parametersJsonSchema)??(s==null?void 0:s.parameters)??s;return l.jsxs("div",{className:"flex flex-col gap-5",children:[e.isValid?null:l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(ux,{children:t("mcp.invalidToolWarning")}),l.jsxs(Vl,{children:[e.invalidReason||t("mcp.status.unknown"),l.jsx("span",{className:"mt-1 block",children:t("mcp.invalidToolHelp")})]})]}),l.jsx(ql,{label:t("mcp.description"),value:((i=e.description)==null?void 0:i.trim())||t("mcp.noDescription")}),n?l.jsx(ql,{label:t("mcp.annotations"),value:n}):null,l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("div",{className:"text-sm font-medium",children:t("mcp.inputSchema")}),r?l.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg bg-muted p-4 text-xs leading-relaxed",children:JSON.stringify(r,null,2)}):l.jsx("div",{className:"text-sm text-muted-foreground",children:t("mcp.noSchema")})]})]})}function Gvt({resource:e,t}){const n=e.title||e.name||"";return l.jsxs("div",{className:"flex flex-col gap-5",children:[l.jsx(ql,{label:t("mcp.resource.uriLabel"),value:e.uri}),n&&n!==e.uri?l.jsx(ql,{label:t("mcp.resource.nameLabel"),value:n}):null,e.mimeType?l.jsx(ql,{label:t("mcp.resource.mimeTypeLabel"),value:e.mimeType}):null,typeof e.size=="number"?l.jsx(ql,{label:t("mcp.resource.sizeLabel"),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?l.jsx(ql,{label:t("mcp.description"),value:e.description.trim()}):null]})}function Zle({message:e,onClose:t,embedded:n}){var Je,Qe,cn,Kn;const{t:s}=at(),r=w9({autoLoad:!1}),i=k9({autoLoad:!1}),[o,a]=f.useState(e.status),[c,u]=f.useState(e.toolsByServer),[d,h]=f.useState(e.resourcesByServer??{}),[m,p]=f.useState(null),[g,b]=f.useState(null),[x,y]=f.useState(null),[v,w]=f.useState("overview"),[k,T]=f.useState(""),[C,_]=f.useState("all"),[S,D]=f.useState(null),[E,B]=f.useState(!1),[I,L]=f.useState(!1),[O,A]=f.useState(!1),[$,q]=f.useState(null),[U,H]=f.useState(""),[M,ee]=f.useState(""),[V,R]=f.useState("workspace"),[re,Z]=f.useState(k2),[K,Y]=f.useState(!1),[ae,le]=f.useState(null),[te,z]=f.useState(null),[X,fe]=f.useState(null),xe=X!=null&&X.error?"error":X!=null&&X.success?"success":X!=null&&X.progress?"progress":"info",[ie,Ce]=f.useState({}),Ke=f.useRef(e.status.discoveryState==="completed"),ut=f.useRef(!0);f.useEffect(()=>(ut.current=!0,()=>{ut.current=!1}),[]);const Et=f.useCallback(async()=>(await new Promise(_e=>window.setTimeout(_e,1500)),ut.current),[]),st=f.useCallback(async(_e,ft=!0,$t=!1)=>{var pe;if(await(_e==="initialize"?r.initialize():r.reloadConfig()),!ut.current)return!1;for(let Be=0;Be<40;Be+=1){if(!await Et())return!1;const ue=await r.reload();if(!ut.current)return!1;if(ue){if((!$t||ue.discoveryState==="completed")&&a(Wt=>ft&&ue.servers.length===0&&Wt.servers.length>0?{...ue,servers:Wt.servers}:ue),(pe=ue.errors)!=null&&pe.length)return ft&&fe({text:ue.errors.map(Wt=>Wt.error||Wt.hint||Wt.kind).join(`
`),error:!0}),!1;if(ue.discoveryState==="completed")return ft&&fe(null),!0;if(ue.initialized&&ue.discoveryState==="not_started"&&ue.servers.length===0)return $t&&a(ue),ft&&fe({text:s("mcp.discovery.empty")}),!0}}return ft&&fe({text:s("mcp.discovery.timeout"),error:!0}),!1},[r,s,Et]);f.useEffect(()=>{Ke.current||(Ke.current=!0,B(!0),st("initialize").catch(_e=>{ut.current&&fe({text:Ra(_e),error:!0})}).finally(()=>{ut.current&&B(!1)}))},[st]);const xt=f.useMemo(()=>(o.servers??[]).filter(Fvt),[o.servers]),He=xt.find(_e=>_e.name===m)??null,pn=He?((Je=c[He.name])==null?void 0:Je.tools)??[]:[],Yt=He?((Qe=d[He.name])==null?void 0:Qe.resources)??[]:[],It=pn.find(_e=>_e.name===g)??null,me=Yt.find(_e=>_e.uri===x)??null;f.useEffect(()=>{n==null||n.onDetailChange(!!He)},[n,He]);const $e=f.useMemo(()=>{const _e=k.trim().toLowerCase();return xt.filter(ft=>{var Be,ue;const $t=C==="all"||bS(ft)===C,pe=!_e||ft.name.toLowerCase().includes(_e)||((Be=ft.description)==null?void 0:Be.toLowerCase().includes(_e))||((ue=ft.extensionName)==null?void 0:ue.toLowerCase().includes(_e));return $t&&!!pe})},[k,xt,C]),yt=f.useCallback(async _e=>{const ft=[],[$t,pe]=await Promise.allSettled([r.loadTools(_e.name),_e.resourceCount?r.loadResources(_e.name):Promise.resolve(null)]);if($t.status==="fulfilled")u(Be=>({...Be,[_e.name]:$t.value})),Ce(Be=>({...Be,[_e.name]:{...Be[_e.name],tools:void 0}}));else{ft.push($t.reason);const Be=Ra($t.reason);Ce(ue=>({...ue,[_e.name]:{...ue[_e.name],tools:Be}}))}if(pe.status==="fulfilled"&&pe.value!==null){const Be=pe.value;h(ue=>({...ue,[_e.name]:Be})),Ce(ue=>({...ue,[_e.name]:{...ue[_e.name],resources:void 0}}))}else if(pe.status==="rejected"){ft.push(pe.reason);const Be=Ra(pe.reason);Ce(ue=>({...ue,[_e.name]:{...ue[_e.name],resources:Be}}))}else h(Be=>{if(!(_e.name in Be))return Be;const ue={...Be};return delete ue[_e.name],ue}),Ce(Be=>({...Be,[_e.name]:{...Be[_e.name],resources:void 0}}));if(ft.length>0)throw new AggregateError(ft,`${_e.name}: ${ft.map(Ra).join("; ")}`)},[r]),Me=f.useCallback(async()=>{if(!I){L(!0),fe(null);try{const _e=await r.reload();if(!_e)return;a(_e)}catch(_e){fe({text:Ra(_e),error:!0})}finally{L(!1)}}},[r,I]),Le=f.useCallback(async()=>{const _e=U.trim(),ft=$!==null;if(!_e){le(s("mcp.add.nameRequired"));return}let $t;try{const Be=JSON.parse(re);if(!Be||typeof Be!="object"||Array.isArray(Be))throw new Error(s("mcp.add.configInvalid"));const ue=M.trim();$t={...Be,...ue?{description:ue}:{}}}catch(Be){le(Ra(Be));return}le(null),Y(!0);let pe=!1;try{await i.setValue(V,"mcpServers",$t,{mcpServerMutation:{operation:"set",name:_e}}),pe=!0,fe(null);const Be=await st("reload",!1).catch(()=>!1);fe({...ft?{serverName:_e}:{},text:Be?s(ft?"mcp.edit.done":"mcp.add.done",{name:_e}):s("mcp.runtime.notUpdated"),error:!Be,success:Be}),A(!1),q(null),H(""),ee(""),Z(k2)}catch(Be){pe?(fe({...ft?{serverName:_e}:{},text:s("mcp.runtime.notUpdated"),error:!0}),A(!1),q(null),H(""),ee(""),Z(k2)):le(Ra(Be))}finally{Y(!1)}},[r,$,re,M,U,V,i,st,s]),vn=f.useCallback(async()=>{if(!te)return;D(te.name);let _e=!1;try{const ft=await i.reload();if(!ft){fe({serverName:te.name,text:s("mcp.add.settingsUnavailable"),error:!0});return}const $t=bS(te)==="workspace"?"workspace":"user",pe=xW(ft,$t);if(!(te.name in pe)){fe({serverName:te.name,text:s("mcp.remove.notWorkspace"),error:!0});return}await i.setValue($t,"mcpServers",{},{mcpServerMutation:{operation:"remove",name:te.name}}),_e=!0,z(null),fe({serverName:te.name,text:s("mcp.action.running",{action:s("mcp.action.remove")}),progress:!0}),await st("reload",!1,!0).catch(()=>!1)?(p(null),b(null),y(null),fe(null)):fe({serverName:te.name,text:s("mcp.runtime.removeNotUpdated"),error:!0})}catch(ft){fe({serverName:te.name,text:_e?s("mcp.runtime.removeNotUpdated"):s("mcp.action.failed",{error:Ra(ft)}),error:!0})}finally{D(null)}},[te,i,st,s]),ge=f.useCallback(async _e=>{if(S)return;const ft=XT(_e);if(ft!=="user_settings"&&ft!=="workspace_settings")return;const $t=ft==="workspace_settings"?"workspace":"user";D(_e.name),fe(null);try{const pe=await i.reload();if(!pe)throw new Error(s("mcp.add.settingsUnavailable"));const Be=xW(pe,$t)[_e.name];if(!Be||typeof Be!="object"||Array.isArray(Be))throw new Error(s("mcp.edit.notFound"));const ue={...Be},Wt=ue.description;delete ue.description,q(_e),H(_e.name),R($t),ee(typeof Wt=="string"?Wt:""),Z(JSON.stringify(ue,null,2)),le(null),A(!0)}catch(pe){fe({serverName:_e.name,text:s("mcp.action.failed",{error:Ra(pe)}),error:!0})}finally{D(null)}},[S,i,s]),Rt=f.useCallback(async(_e,ft)=>{var $t,pe,Be,ue;if(!S){if(ft.id==="remove"){z(_e);return}if(ft.id==="edit"){await ge(_e);return}D(_e.name),fe({serverName:_e.name,text:ft.id==="authenticate"?X7(_e.name,s):s("mcp.action.running",{action:ft.label}),progress:!0});try{let Wt="",Bt,hn=!1;if(ft.id==="reconnect"){const Ae=await r.restartServer(_e.name);if(!ut.current)return;if("restarted"in Ae&&!Ae.restarted)throw Ae.reason==="authentication_required"?new Error(s("mcp.reconnect.authenticationRequired")):new Error(s("mcp.reconnect.skipped",{reason:Ae.reason}));if("entries"in Ae&&(Ae.entries.length===0||Ae.entries.every(kn=>!kn.restarted)))throw new Error(s("mcp.reconnect.skipped",{reason:Ae.entries.map(kn=>kn.reason).filter(Boolean).join(", ")||"not connected"}))}else{const Ae=await r.manageServer(_e.name,ft.id);if(!ut.current)return;Bt=Ae.authUrl,Wt=[...Ae.messages??[]].join(`
`),hn=ft.id==="authenticate"&&Ae.pending===!0,hn&&fe({serverName:_e.name,text:X7(_e.name,s,Wt),progress:!0,...Bt?{authUrl:Bt}:{}})}let gt;if(hn){for(let Ae=0;Ae<400;Ae+=1){if(!await Et())return;const kn=await r.reload();if(!ut.current)return;if(!kn)continue;a(kn);const Dn=($t=kn.errors)==null?void 0:$t[0];if(Dn)throw new Error(Dn.error||Dn.hint||s("mcp.oauth.statusFailed"));const qn=(pe=kn.servers)==null?void 0:pe.find(ir=>ir.name===_e.name);if(!qn)throw new Error(s("mcp.oauth.serverRemoved"));if(qn.authenticationState==="failed")throw new Error(qn.authenticationError||s("mcp.oauth.authenticationFailed"));if(qn.authenticationState==="succeeded"||qn.authenticationState===void 0&&qn.mcpStatus==="connected"){gt=kn;break}}if(!gt)throw new Error(s("mcp.oauth.timeout"))}else{if(gt=await r.reload(),!ut.current)return;for(let Ae=0;(gt==null?void 0:gt.discoveryState)!==void 0&&gt.discoveryState!=="completed"&&!((Be=gt.errors)!=null&&Be.length)&&Ae<40;Ae+=1){if(!await Et())return;const kn=await r.reload();if(!ut.current)return;kn&&(gt=kn,a(kn))}}if(gt){a(gt);const Ae=(ue=gt.servers)==null?void 0:ue.find(kn=>kn.name===_e.name);if(Ae&&(gt.discoveryState===void 0||gt.discoveryState==="completed")){try{await yt(Ae)}catch{}if(!ut.current)return}}fe({serverName:_e.name,text:hn?s("mcp.action.done",{action:ft.label}):ft.id==="authenticate"&&Wt?X7(_e.name,s,Wt):Wt||s("mcp.action.done",{action:ft.label}),success:!0,...!hn&&Bt?{authUrl:Bt}:{}})}catch(Wt){ut.current&&fe({serverName:_e.name,text:s("mcp.action.failed",{error:Ra(Wt)}),error:!0})}finally{ut.current&&D(null)}}},[S,yt,r,ge,s,Et]),ht=_e=>{p(_e.name),w("overview"),b(null),y(null),fe(null),!_e.approvalState&&yt(_e).catch(ft=>{fe({serverName:_e.name,text:s("mcp.action.failed",{error:Ra(ft)}),error:!0})})},gn=()=>{S===null&&(p(null),b(null),y(null),L(!0),r.reload().then(_e=>{_e&&a(_e)}).catch(_e=>{fe({text:Ra(_e),error:!0})}).finally(()=>L(!1)))},Ue=()=>{b(null),y(null)},De=l.jsx(Pm,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Om,{className:"text-base",children:[l.jsx(Ni,{children:l.jsx(An,{variant:"ghost",size:"icon",disabled:S!==null,onClick:t,"aria-label":s("common.back"),children:l.jsx(aC,{})})}),l.jsx(Ni,{children:He?l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",disabled:S!==null,onClick:gn,children:s("mcp.title")})}):l.jsx(za,{children:s("mcp.title")})}),He?l.jsx(od,{}):null,He?l.jsx(Ni,{children:It||me?l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",onClick:Ue,children:He.name})}):l.jsx(za,{children:He.name})}):null,It||me?l.jsx(od,{}):null,It?l.jsx(Ni,{children:l.jsx(za,{children:It.name})}):null,me?l.jsx(Ni,{children:l.jsx(za,{children:me.title||me.name||me.uri})}):null]})}),Re=It?It.name:me?me.title||me.name||me.uri:He==null?void 0:He.name,be=n?He?l.jsx(Pm,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Om,{className:"h-8 text-sm",children:[l.jsx(Ni,{children:l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",disabled:S!==null,onClick:gn,children:s("mcp.title")})})}),l.jsx(od,{}),l.jsx(Ni,{children:It||me?l.jsx(id,{asChild:!0,children:l.jsx("button",{type:"button",onClick:Ue,children:He.name})}):l.jsx(za,{children:He.name})}),It||me?l.jsx(od,{}):null,It||me?l.jsx(Ni,{children:l.jsx(za,{children:Re})}):null]})}):null:De,Ie=l.jsx(y0,{open:te!==null,onOpenChange:_e=>!_e&&z(null),children:l.jsxs(v0,{showCloseButton:!1,children:[l.jsxs(x0,{children:[l.jsx(k0,{children:s("mcp.remove.title")}),l.jsx(ub,{children:s(te&&bS(te)==="workspace"?"mcp.remove.description":"mcp.remove.description.global",{name:(te==null?void 0:te.name)??""})})]}),l.jsxs(w0,{children:[l.jsx(An,{variant:"outline",onClick:()=>z(null),disabled:S!==null,children:s("common.cancel")}),l.jsxs(An,{variant:"destructive",onClick:()=>void vn(),disabled:S!==null,children:[S?l.jsx(li,{"data-icon":"inline-start"}):l.jsx(Wp,{"data-icon":"inline-start"}),s("mcp.action.remove")]})]})]})}),ne=l.jsx(y0,{open:O,onOpenChange:_e=>{K||(A(_e),_e||q(null))},children:l.jsxs(v0,{className:"sm:max-w-lg",showCloseButton:!1,children:[l.jsxs(x0,{children:[l.jsx(k0,{children:s($?"mcp.edit.title":"mcp.add.title")}),l.jsx(ub,{children:s($?"mcp.edit.description":"mcp.add.description")})]}),l.jsxs("div",{className:"grid gap-4",children:[ae?l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(Vl,{children:ae})]}):null,l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.name"),l.jsx(qr,{value:U,onChange:_e=>H(_e.target.value),placeholder:"my-mcp-server",disabled:K||$!==null})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.serverDescription"),l.jsx(qr,{value:M,onChange:_e=>ee(_e.target.value),placeholder:s("mcp.add.serverDescriptionPlaceholder"),disabled:K})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.scope"),l.jsxs(kl,{value:V,onValueChange:_e=>R(_e),disabled:K||$!==null,children:[l.jsx(Sl,{className:"w-full",children:l.jsx(_l,{})}),l.jsxs(Cl,{children:[l.jsx(bi,{value:"workspace",children:s("settings.scope.workspace")}),l.jsx(bi,{value:"user",children:s("mcp.add.scope.global")})]})]})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.config"),l.jsx(Op,{className:"min-h-44 font-mono text-xs",value:re,onChange:_e=>Z(_e.target.value),disabled:K})]})]}),l.jsxs(w0,{children:[l.jsx(An,{variant:"outline",onClick:()=>{A(!1),q(null)},disabled:K,children:s("common.cancel")}),l.jsxs(An,{onClick:()=>void Le(),disabled:K,children:[K?l.jsx(li,{"data-icon":"inline-start"}):null,s(K?$?"mcp.edit.saving":"mcp.add.adding":$?"mcp.edit.save":"mcp.add.button")]})]})]})});if(It&&He)return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[be,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(xA,{})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"break-words text-xl font-semibold",children:It.name}),l.jsx("p",{className:"text-sm text-muted-foreground",children:It.serverToolName||He.name})]})]}),l.jsx(So,{children:l.jsx(Gl,{children:l.jsx(Vvt,{tool:It,t:s})})})]})]}),ne]});if(me&&He)return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[be,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(bA,{})}),l.jsx("h1",{className:"min-w-0 break-words text-xl font-semibold",children:me.title||me.name||me.uri})]}),l.jsx(So,{children:l.jsx(Gl,{children:l.jsx(Gvt,{resource:me,t:s})})})]})]}),ne]});if(He){const _e=pn,ft=Yt,$t=ie[He.name],pe=qvt(He,s);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[be,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(j1,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-xl font-semibold",children:He.name}),l.jsx(mo,{variant:"secondary",className:kW(He),children:wW(He,s)}),l.jsx(mo,{variant:"outline",children:vW(He,s)})]})}),l.jsxs(mh,{children:[l.jsx(ph,{asChild:!0,children:l.jsx(An,{variant:"ghost",size:"icon",disabled:S!==null,"aria-label":s("mcp.actions"),"data-testid":"mcp-server-actions",children:S===He.name?l.jsx(li,{}):l.jsx(qf,{})})}),l.jsx(gh,{align:"end",onCloseAutoFocus:Be=>Be.preventDefault(),children:l.jsx(dm,{children:pe.map(Be=>l.jsx(Gi,{"data-testid":`mcp-server-action-${Be.id}`,variant:Be.id==="remove"?"destructive":"default",disabled:S!==null,onSelect:()=>void Rt(He,Be),children:Be.label},Be.id))})})]})]}),(X==null?void 0:X.serverName)===He.name?l.jsxs(yl,{tone:xe,noticeKey:X.text,closeLabel:s("common.close"),onDismiss:()=>fe(null),className:"whitespace-pre-wrap break-words",children:[l.jsx("p",{children:X.text}),X.authUrl&&Uvt(X.authUrl)?l.jsx("a",{className:"mt-2 inline-block underline underline-offset-3",href:X.authUrl,target:"_blank",rel:"noreferrer",children:s("mcp.oauth.open")}):null]}):null,l.jsxs(Q0,{value:v,onValueChange:w,children:[l.jsxs(J0,{children:[l.jsx(Fr,{value:"overview",children:s("mcp.basicInfo")}),l.jsxs(Fr,{value:"tools",children:[s("mcp.tools")," ",_e.length]}),l.jsxs(Fr,{value:"resources",children:[s("mcp.resources")," ",He.resourceCount??ft.length]})]}),l.jsx(gi,{value:"overview",className:"pt-4",children:l.jsxs(So,{children:[l.jsxs(ml,{children:[l.jsx(pl,{className:"text-sm",children:s("mcp.descriptionTitle")}),l.jsx(iu,{children:((cn=He.description)==null?void 0:cn.trim())||"-"})]}),l.jsxs(Gl,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(ql,{label:s("mcp.source"),value:vW(He,s)}),l.jsx(ql,{label:s("mcp.transport"),value:He.transport}),l.jsx(ql,{label:s("mcp.command"),value:Hvt(He,s)}),l.jsx(ql,{label:s("mcp.workingDirectory"),value:((Kn=He.config)==null?void 0:Kn.cwd)||o.workspaceCwd}),He.error?l.jsx(ql,{label:s("mcp.invalidReasonLabel"),value:He.error}):null,He.hint?l.jsx(ql,{label:s("mcp.description"),value:He.hint}):null]})]})}),l.jsx(gi,{value:"tools",className:"pt-4",children:$t!=null&&$t.tools?l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(ux,{children:s("mcp.loadingTools")}),l.jsx(Vl,{children:$t.tools})]}):_e.length?l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:_e.map(Be=>l.jsx(So,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>b(Be.name),onKeyDown:ue=>{(ue.key==="Enter"||ue.key===" ")&&(ue.preventDefault(),b(Be.name))},children:l.jsxs(ml,{children:[l.jsx(pl,{className:"break-words",children:Be.name}),l.jsx(iu,{className:"line-clamp-2 text-xs",children:Be.description||s("mcp.noDescription")}),Be.isValid?null:l.jsx(qit,{children:l.jsx(mo,{variant:"destructive",children:s("mcp.status.blocked")})})]})},Be.name))}):l.jsx(ud,{className:"rounded-xl border border-dashed",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:l.jsx(xA,{})}),l.jsx(fd,{children:s("mcp.emptyTools")})]})})}),l.jsx(gi,{value:"resources",className:"pt-4",children:$t!=null&&$t.resources?l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(ux,{children:s("mcp.resourcesUnavailable")}),l.jsx(Vl,{children:$t.resources})]}):ft.length?l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:ft.map(Be=>l.jsx(So,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>y(Be.uri),onKeyDown:ue=>{(ue.key==="Enter"||ue.key===" ")&&(ue.preventDefault(),y(Be.uri))},children:l.jsxs(ml,{children:[l.jsx(pl,{className:"break-words",children:Be.title||Be.name||Be.uri}),l.jsx(iu,{className:"break-all",children:Be.uri})]})},Be.uri))}):l.jsx(ud,{className:"rounded-xl border border-dashed",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:l.jsx(bA,{})}),l.jsx(fd,{children:s("mcp.noResources")})]})})})]})]})]}),Ie,ne]})}const Ee=xt.filter(_e=>!_e.disabled&&_e.mcpStatus==="connecting").length,qe=[{value:"all",label:s("mcp.source.all")},{value:"user",label:s("mcp.source.user")},{value:"workspace",label:s("mcp.source.workspace")},{value:"extension",label:s("mcp.source.extension")}];return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[be,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold text-balance",children:s("mcp.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("mcp.servers",{count:xt.length})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(An,{variant:"outline",onClick:()=>void Me(),disabled:I,children:[I?l.jsx(li,{"data-icon":"inline-start"}):l.jsx(uC,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(An,{onClick:()=>{q(null),H(""),ee(""),R("workspace"),Z(k2),le(null),A(!0)},disabled:K,children:[l.jsx(eb,{"data-icon":"inline-start"}),s("mcp.add.button")]})]})]}),E&&Ee===0?l.jsx(yl,{tone:"progress",noticeKey:"mcp-initializing",closeLabel:s("common.close"),onDismiss:()=>{},children:l.jsxs("span",{className:"grid gap-1",children:[l.jsx("span",{className:"font-medium",children:s("mcp.discovery.initializing")}),l.jsx("span",{children:s("mcp.startingNote")})]})}):Ee>0?l.jsx(yl,{tone:"progress",noticeKey:`mcp-connecting-${Ee}`,closeLabel:s("common.close"),onDismiss:()=>{},children:l.jsxs("span",{className:"grid gap-1",children:[l.jsx("span",{className:"font-medium",children:s("mcp.starting",{count:Ee})}),l.jsx("span",{children:s("mcp.startingNote")})]})}):null,X&&!X.serverName?l.jsx(yl,{tone:xe,noticeKey:X.text,closeLabel:s("common.close"),onDismiss:()=>fe(null),children:X.text}):null,(o.errors??[]).map((_e,ft)=>l.jsxs(Wl,{variant:"destructive",children:[l.jsx(nu,{}),l.jsx(ux,{children:_e.kind}),l.jsx(Vl,{children:_e.error||_e.hint||s("mcp.status.unknown")})]},`${_e.kind}-${ft}`)),o.budgetMode&&o.budgetMode!=="off"?l.jsxs(Wl,{children:[l.jsx(nu,{}),l.jsx(Vl,{children:s("mcp.clientBudget",{count:o.clientCount??0,budget:o.clientBudget??"∞"})})]}):null,l.jsxs("div",{className:"relative",children:[l.jsx(lu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(qr,{className:"pl-9",value:k,onChange:_e=>T(_e.target.value),placeholder:`${s("common.search")} MCP…`})]}),l.jsx(xD,{type:"single",value:C,onValueChange:_e=>{_e&&_(_e)},variant:"outline",size:"sm","aria-label":s("mcp.source"),children:qe.map(_e=>l.jsx(wD,{value:_e.value,children:_e.label},_e.value))}),$e.length?l.jsx("div",{className:Jle.serverGrid,"data-column-count":Math.min($e.length,4),children:$e.map(_e=>{var ft,$t;return l.jsx(So,{size:"sm",role:"button",tabIndex:0,"aria-label":_e.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>ht(_e),onKeyDown:pe=>{(pe.key==="Enter"||pe.key===" ")&&(pe.preventDefault(),ht(_e))},children:l.jsx(ml,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(j1,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(pl,{className:"min-w-0 flex-1 truncate",children:_e.name}),l.jsx(mo,{variant:"secondary",className:`${kW(_e)} shrink-0 text-[10px]`,children:wW(_e,s)})]}),l.jsx(iu,{className:"mt-1 min-w-0 text-xs",children:l.jsx(Ad,{delayDuration:300,children:l.jsxs(jd,{children:[l.jsx(Nd,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:((ft=_e.description)==null?void 0:ft.trim())||"-"})}),l.jsx(Md,{children:(($t=_e.description)==null?void 0:$t.trim())||"-"})]})})})]})]})})},_e.name)})}):l.jsx(ud,{className:"border",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:k||C!=="all"?l.jsx(lu,{}):l.jsx(j1,{})}),l.jsx(fd,{children:s(k||C!=="all"?"mcp.noMatches":"mcp.empty")}),!k&&C==="all"?l.jsx(tk,{children:s("mcp.emptyDescription")}):null]})})]}),ne]})}function Kvt({mcpMessage:e,loadMcpMessage:t,onClose:n,onUseSkill:s,initialFocusRef:r}){const{t:i}=at(),[o,a]=f.useState("extensions"),[c,u]=f.useState(!1),[d,h]=f.useState(0),[m,p]=f.useState(!1),[g,b]=f.useState(null),x=f.useCallback(()=>{p(!1),b(null),t().then(()=>p(!0)).catch(k=>{b(k instanceof Error?k.message:String(k))})},[t]),y=f.useCallback(()=>{u(!1),h(k=>k+1)},[]),v=f.useMemo(()=>({onRoot:y,onDetailChange:u}),[y]),w=k=>{const T=k;a(T),u(!1),h(C=>C+1),T==="mcp"&&x()};return l.jsxs(Q0,{value:o,onValueChange:w,className:"w-full",children:[c?null:l.jsx("div",{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(J0,{className:"h-8","aria-label":i("plugins.sections"),children:[l.jsx(Fr,{ref:r,value:"extensions",children:i("plugins.extensions")}),l.jsx(Fr,{value:"mcp",children:i("plugins.mcp")}),l.jsx(Fr,{value:"skills",children:i("plugins.skills")}),l.jsx(Fr,{value:"agents",children:i("plugins.agents")})]})}),l.jsx(gi,{value:o,className:"mt-0",children:o==="extensions"?l.jsx(Qle,{onClose:n,embedded:v},`extensions-${d}`):o==="skills"?l.jsx(Uae,{onClose:n,onUseSkill:s,embedded:v},`skills-${d}`):o==="agents"?l.jsx(Hae,{onClose:n,embedded:v},`agents-${d}`):g?l.jsxs(Wl,{variant:"destructive",className:"mt-4",children:[l.jsx(ux,{children:i("plugins.mcpLoadFailed")}),l.jsxs(Vl,{className:"space-y-3",children:[l.jsx("p",{children:g}),l.jsx(An,{variant:"outline",size:"sm",onClick:x,children:i("common.retry")})]})]}):e&&m?l.jsx(Zle,{message:e,onClose:n,embedded:v},`mcp-${d}`):l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8 pt-4",children:[l.jsxs("div",{className:"relative",children:[l.jsx(lu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(qr,{"aria-label":i("common.search"),readOnly:!0,className:"pl-9",placeholder:`${i("common.search")} MCP…`})]}),l.jsx(ud,{className:"border",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:l.jsx(j1,{})}),l.jsx(fd,{children:i("mcp.empty")}),l.jsx(tk,{children:i("mcp.emptyDescription")})]})})]})})]})}const Yvt=new Set(["plugins","extensions","mcp","skills","agents"]);function Xvt(e){return e!==null&&Yvt.has(e)}function Qvt(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 _W=new WeakMap;function Jvt(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 s=n.dataset.viteDevId??"";return s.includes("/packages/web-shell/")||s.includes("/web-shell/client/")}).map(n=>n.textContent??"").filter(Boolean).join(`
`)}function ece(e,t){var r;const n=(r=e.defaultView)==null?void 0:r.CSSStyleSheet;if(!n||typeof n.prototype.replaceSync!="function")return null;const s=new n;return s.replaceSync(t),s}function Zvt(e,t){const n=_W.get(e);if((n==null?void 0:n.css)===t)return n.sheet;const s=ece(e,t);return s&&_W.set(e,{css:t,sheet:s}),s}function tce(e,t){const n=Jvt(e.ownerDocument),s=[n,t].filter(i=>!!i);try{const i=n?Zvt(e.ownerDocument,n):null,o=t?ece(e.ownerDocument,t):null,a=[i,o].filter(c=>!!c);if(a.length===s.length&&a.length>0)return e.adoptedStyleSheets=[...e.adoptedStyleSheets,...a],()=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(c=>!a.includes(c))}}catch{}const r=s.map(i=>{const o=e.ownerDocument.createElement("style");return o.dataset.qwenWebShellShadow="",o.textContent=i,e.appendChild(o),o});return()=>{for(const i of r)i.remove()}}function ext({children:e,enabled:t,language:n,themeClassName:s,styles:r,initialFocusRef:i}){const o=f.useRef(null),[a,c]=f.useState(null);return f.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 h=tce(u,r);return u.appendChild(d),c(d),()=>{d.remove(),h(),c(null)}},[t,r]),f.useLayoutEffect(()=>{a&&(a.className=s,a.lang=n)},[n,a,s]),f.useLayoutEffect(()=>{var u;a&&((u=i==null?void 0:i.current)==null||u.focus())},[i,a]),t?l.jsx("div",{ref:o,"data-web-shell-shadow-host":"plugins",children:a?hu.createPortal(e,a):null}):e}const txt="_section_1ghly_1",nxt="_header_1ghly_12",sxt="_title_1ghly_19",rxt="_addButton_1ghly_24",ixt="_hint_1ghly_38",oxt="_empty_1ghly_39",axt="_provider_1ghly_45",lxt="_providerName_1ghly_51",cxt="_modelRow_1ghly_59",uxt="_modelInfo_1ghly_70",dxt="_modelName_1ghly_78",hxt="_modelBaseUrl_1ghly_84",fxt="_currentBadge_1ghly_91",mxt="_runtimeBadge_1ghly_99",pxt="_modelActions_1ghly_107",gxt="_actionButton_1ghly_114",bxt="_deleteButton_1ghly_115",yxt="_confirmButton_1ghly_116",to={section:txt,header:nxt,title:sxt,addButton:rxt,hint:ixt,empty:oxt,provider:axt,providerName:lxt,modelRow:cxt,modelInfo:uxt,modelName:dxt,modelBaseUrl:hxt,currentBadge:fxt,runtimeBadge:mxt,modelActions:pxt,actionButton:gxt,deleteButton:bxt,confirmButton:yxt};function yS(e,t){return`${e.authType}:${t.modelId}:${t.baseUrl??""}`}function vxt(e,t){const n=e.flatMap(r=>r.models.map(i=>({provider:r,model:i})));if(t){const r=n.find(({model:o})=>o.modelId===t);if(r)return yS(r.provider,r.model);const i=n.filter(({model:o})=>o.baseModelId===t);if(i.length===1)return yS(i[0].provider,i[0].model)}const s=n.find(({model:r})=>r.isCurrent);return s?yS(s.provider,s.model):void 0}function xxt({providers:e,currentModelId:t,loading:n,error:s,busy:r,onSelectModel:i,onDeleteModel:o,onAddModel:a}){const{t:c}=at(),[u,d]=f.useState(null);f.useEffect(()=>{if(u===null)return;const p=g=>{g.key==="Escape"&&d(null)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[u]);const h=e.some(p=>p.models.length>0),m=vxt(e,t);return l.jsxs("div",{className:to.section,"data-testid":"model-management",children:[l.jsxs("div",{className:to.header,children:[l.jsx("span",{className:to.title,children:c("settings.models.title")}),l.jsx("button",{type:"button",className:to.addButton,disabled:r,onClick:a,children:c("settings.models.add")})]}),s&&l.jsx("div",{className:to.hint,children:s.message}),n&&!h&&l.jsx("div",{className:to.hint,children:c("settings.models.loading")}),!n&&!h&&!s&&l.jsx("div",{className:to.empty,children:c("settings.models.empty")}),e.map((p,g)=>p.models.length===0?null:l.jsxs("div",{className:to.provider,children:[l.jsx("div",{className:to.providerName,children:p.authType}),p.models.map(b=>{const x=yS(p,b),y=x===m,v=u===x,w=b.name||b.baseModelId;return l.jsxs("div",{className:to.modelRow,children:[l.jsxs("div",{className:to.modelInfo,children:[l.jsx("span",{className:to.modelName,children:b.name||b.baseModelId}),y&&l.jsx("span",{className:to.currentBadge,children:c("settings.models.current")}),b.isRuntime&&l.jsx("span",{className:to.runtimeBadge,children:c("settings.models.runtime")}),b.baseUrl&&l.jsx("span",{className:to.modelBaseUrl,children:b.baseUrl})]}),l.jsxs("div",{className:to.modelActions,children:[!y&&l.jsx("button",{type:"button",className:to.actionButton,disabled:r,"aria-label":`${c("settings.models.setCurrent")} ${w}`,onClick:()=>i(b.modelId),children:c("settings.models.setCurrent")}),!b.isRuntime&&(v?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:to.confirmButton,disabled:r,"aria-label":`${c("settings.models.confirmDelete")} ${w}`,onClick:()=>{d(null),o({authType:p.authType,modelId:b.baseModelId,...b.baseUrl?{baseUrl:b.baseUrl}:{}})},children:c("settings.models.confirmDelete")}),l.jsx("button",{type:"button",className:to.actionButton,disabled:r,"aria-label":`${c("settings.models.cancel")} ${w}`,onClick:()=>d(null),children:c("settings.models.cancel")})]}):l.jsx("button",{type:"button",className:to.deleteButton,disabled:r,"aria-label":`${c("settings.models.delete")} ${w}`,onClick:()=>d(x),children:c("settings.models.delete")}))]})]},x)})]},`${p.authType}:${g}`))]})}function nce({className:e,size:t="default",...n}){return l.jsx(vne,{"data-slot":"switch","data-size":t,className:Qt("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:l.jsx(wne,{"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 wxt=new Set(["fastModel","visionModel","voiceModel","modelFallbacks"]),kxt=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline","mcpServers"]);function QT(e,t,n){const s=e(t);return s===t?n:s}function SW(e,t){return QT(t,`settings.category.${e}`,e)}function Og(e,t){return QT(t,`settings.label.${e.key}`,e.label)}function _xt(e,t){if(e.description)return QT(t,`settings.description.${e.key}`,e.description)}function sce(e,t,n,s){return QT(s,`settings.option.${e.key}.${String(t)}`,n)}function Sxt(e,t,n){const s=ice(e,t);if(s==null)return"";if(e.key===Vp){const i=M9(s,zr.Dark);return n(`theme.${i}`)}if(e.key===l4){const i=C9(s);return i?T9(i):String(s)}if(e.type==="boolean")return n(s===!0?"settings.value.on":"settings.value.off");if(e.type==="enum"&&e.options){const i=e.options.find(o=>o.value===s);return i?sce(e,i.value,i.label,n):String(s)}const r=String(s);return r.length>24?`${r.slice(0,21)}…`:r}function rce(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function Cxt(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return rce(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function ice(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function Txt(e){const t=new Map;for(const n of e){let s=t.get(n.category);s||(s=[],t.set(n.category,s)),s.push(n)}return Array.from(t.entries()).map(([n,s])=>({category:n,items:s}))}function CW({category:e}){const t=e.toLowerCase(),n=t.includes("ui")?p1e:t.includes("tool")?xA:t.includes("context")?bA:t.includes("privacy")?I1e:t.includes("model")?Vv:t.includes("daemon")?j1:t.includes("advanced")?D1e:t.includes("experimental")?Hge:QY;return l.jsx(n,{"data-icon":"inline-start","aria-hidden":"true"})}function TW({title:e,description:t,metadata:n,control:s}){return l.jsxs($i,{orientation:"responsive",className:"min-h-20 gap-6 px-5 py-4 max-md:px-4",children:[l.jsxs(zae,{className:"min-w-0",children:[l.jsxs(Eit,{children:[e,n]}),t&&l.jsx(tu,{className:"max-w-3xl",children:t})]}),l.jsx("div",{className:"flex min-w-0 justify-end max-md:justify-start",children:s})]})}function Ext({name:e,label:t,type:n,value:s,disabled:r,onCommit:i,onInvalid:o}){const a=String(s??""),[c,u]=f.useState(a);f.useEffect(()=>u(a),[a]);const d=()=>{if(n==="number"){const h=c.trim(),m=Number(h);if(!h||!Number.isFinite(m)){u(a),o();return}m!==s&&i(m);return}c!==a&&i(c)};return l.jsx(qr,{type:n,name:e,autoComplete:"off","aria-label":t,value:c,disabled:r,className:"w-[min(80px,50vw)] max-md:w-full",onChange:h=>u(h.target.value),onBlur:d,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur(),h.key==="Escape"&&(u(a),h.currentTarget.blur())}})}function Axt({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:s,chatWidthMode:r,onChatWidthModeChange:i,modelManagement:o,embedded:a=!1}){const{language:c,t:u}=at(),d=Lb(),{status:h,settings:m,loading:p,error:g,reload:b,setValue:x}=e,[y,v]=f.useState("workspace"),[w,k]=f.useState(""),[T,C]=f.useState(null),[_,S]=f.useState(null),[D,E]=f.useState(!1),B=p&&!h,I=f.useMemo(()=>{const U=m.filter(V=>!kxt.has(V.key)),H=Txt(U).map(V=>({id:V.category,label:SW(V.category,u),items:V.items.map(R=>({type:"setting",setting:R}))})),M={type:"local",localKey:"chatWidth"},ee=H.find(V=>V.items.some(R=>R.type==="setting"&&R.setting.key===Vp));if(ee){const V=ee.items.findIndex(R=>R.type==="setting"&&R.setting.key===Vp);ee.items.splice(V+1,0,M)}else H.push({id:"UI",label:SW("UI",u),items:[M]});return H},[m,u]);f.useEffect(()=>{I.length!==0&&(I.some(U=>U.id===w)||k(I[0].id))},[w,I]),f.useEffect(()=>{var U;g?S(g.message):(U=h==null?void 0:h.warnings)!=null&&U.length?S(h.warnings.map(H=>u("settings.corrupted",{recovered:H.recovered?"true":"false"})).join("; ")):m.length>0&&S(null)},[g,m,h,u]);const L=f.useCallback((U,H)=>{D||S(null),C(U),x(y,U,H).then(async M=>{try{await b()}catch{}M!=null&&M.requiresRestart&&U!==l4&&E(!0)}).catch(M=>{S(M instanceof Error?M.message:String(M))}).finally(()=>C(null))},[b,D,y,x]),O=I.find(U=>U.id===w)??I[0],A=O==null?void 0:O.items.some(U=>U.type==="setting"&&U.setting.category==="Model"),$=(U,H,M,ee,V=!1)=>l.jsxs(kl,{value:U,disabled:V,onValueChange:H,children:[l.jsx(Sl,{size:"sm","aria-label":ee,className:"w-[min(160px,50vw)] bg-background max-md:w-full",children:l.jsx(_l,{})}),l.jsx(Cl,{position:"popper",align:"end",children:l.jsx(gse,{children:M.map(R=>l.jsx(bi,{value:R.value,children:R.label},R.value))})})]}),q=U=>{var V;const H=ice(U,y),ee=T===U.key;if(U.key===Vp)return $(M9(H)??d,R=>{const re=R;s(re),L(Vp,cX(re))},aX.map(R=>({value:R,label:u(`theme.${R}`)})),Og(U,u),ee);if(U.key===l4)return $(C9(H)??c,R=>t(R,y),gbe.map(R=>({value:R,label:T9(R)})),Og(U,u),ee);if(wxt.has(U.key))return l.jsx(An,{type:"button",variant:"outline",size:"sm",disabled:ee,className:"max-w-[260px] truncate",onClick:()=>n(U.key,y),children:Sxt(U,y,u)||u("settings.action.select")});if(U.type==="boolean"){const R=H===!0;return l.jsx(nce,{checked:R,disabled:ee,onCheckedChange:re=>L(U.key,re),"aria-label":Og(U,u)})}if(U.type==="enum"&&((V=U.options)!=null&&V.length)){const R=U.options.findIndex(re=>re.value===H);return $(R>=0?String(R):"",re=>{var K;const Z=(K=U.options)==null?void 0:K[Number(re)];Z&&L(U.key,Z.value)},U.options.map((re,Z)=>({value:String(Z),label:sce(U,re.value,re.label,u)})),Og(U,u),ee)}return l.jsx(Ext,{name:U.key,label:Og(U,u),type:U.type==="number"?"number":"text",value:H,disabled:ee,onCommit:R=>L(U.key,R),onInvalid:()=>S(u("settings.invalidNumber"))})};return l.jsxs("div",{className:a?"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:[!a&&l.jsx("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:l.jsxs("div",{children:[l.jsx("h2",{className:"text-base font-semibold text-balance",children:u("settings.title")}),l.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:u("settings.scope.workspace")})]})}),(_||B)&&l.jsxs(Wl,{className:"mx-4 mt-3 w-auto",children:[B&&l.jsx(li,{}),l.jsx(Vl,{children:_||u("settings.loading")})]}),l.jsxs(Q0,{value:y,className:"flex min-h-0 flex-1 flex-col gap-0",onValueChange:U=>{v(U)},children:[l.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border px-3 py-2",children:[l.jsxs(J0,{className:"p-0",children:[l.jsx(Fr,{value:"workspace",children:u("settings.scope.workspace")}),l.jsx(Fr,{value:"user",children:u("settings.scope.user")})]}),D&&l.jsx(mo,{variant:"secondary",children:u("settings.requiresRestart")})]}),l.jsxs(gi,{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:[l.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:I.map(U=>l.jsxs(An,{type:"button",variant:U.id===w?"secondary":"ghost",size:"sm","aria-current":U.id===w?"page":void 0,className:"w-full justify-start gap-2 px-2.5 max-md:w-auto max-md:shrink-0",onClick:()=>k(U.id),children:[l.jsx(CW,{category:U.id}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:U.label}),l.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:U.items.length})]},U.id))}),l.jsxs("section",{className:"min-h-0 min-w-0 overflow-y-auto bg-background p-5 max-md:p-3",children:[!p&&!O&&l.jsx(ud,{className:"min-h-60",children:l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:l.jsx(QY,{})}),l.jsx(fd,{children:u("settings.empty")}),l.jsx(tk,{children:u("settings.empty")})]})}),O&&l.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[l.jsxs(So,{children:[l.jsx(ml,{children:l.jsxs(pl,{className:"flex items-center gap-2",children:[l.jsx(CW,{category:O.id}),O.label]})}),l.jsx(Gl,{className:"-mb-(--card-spacing) p-0",children:l.jsx(H1,{className:"gap-0",children:O.items.map((U,H)=>{const M=H>0&&l.jsx(yD,{className:"mx-5 w-auto max-md:mx-4"});if(U.type==="local")return l.jsxs("div",{children:[M,l.jsx(TW,{title:u("settings.label.ui.chatWidth"),description:u("settings.description.ui.chatWidth"),control:$(r,K=>i(K),[{value:"1000",label:u("settings.option.ui.chatWidth.1000")},{value:"wide",label:u("settings.option.ui.chatWidth.wide")}],u("settings.label.ui.chatWidth"),!1)})]},U.localKey);const ee=U.setting,V=_xt(ee,u),R=Cxt(ee,y),re=rce(ee,y),Z=R?u(R,{scope:u(y==="workspace"?"settings.scope.user":"settings.scope.workspace")}):void 0;return l.jsxs("div",{children:[M,l.jsx(TW,{title:Og(ee,u),description:[V,Z].filter(Boolean).join(" · ")||void 0,metadata:re?l.jsx(mo,{variant:"secondary",children:u(y==="workspace"?"settings.scope.workspace":"settings.scope.user")}):void 0,control:T===ee.key?l.jsx(li,{}):q(ee)})]},ee.key)})})})]}),A&&o&&l.jsx("div",{className:"mt-4",children:l.jsx(xxt,{...o})})]})]})]})]}),!a&&l.jsx("div",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:u("settings.footer")})]})}const jxt="_dialog_1ymqd_1",Nxt="_toolbar_1ymqd_12",Mxt="_tabs_1ymqd_21",Ixt="_tab_1ymqd_21",Rxt="_tabActive_1ymqd_39",Dxt="_search_1ymqd_48",Lxt="_general_1ymqd_60",Pxt="_shortcuts_1ymqd_67",Oxt="_shortcut_1ymqd_67",$xt="_shortcutKey_1ymqd_87",Bxt="_shortcutDesc_1ymqd_95",zxt="_commandList_1ymqd_101",Fxt="_commandCard_1ymqd_108",Hxt="_commandCardExpanded_1ymqd_115",qxt="_commandRow_1ymqd_119",Uxt="_commandName_1ymqd_135",Wxt="_commandTag_1ymqd_142",Vxt="_chevron_1ymqd_152",Gxt="_chevronExpanded_1ymqd_160",Kxt="_commandDetail_1ymqd_164",Yxt="_commandDescription_1ymqd_174",Xxt="_commandSubcommands_1ymqd_175",Qxt="_empty_1ymqd_182",ji={dialog:jxt,toolbar:Nxt,tabs:Mxt,tab:Ixt,tabActive:Rxt,search:Dxt,general:Lxt,shortcuts:Pxt,shortcut:Oxt,shortcutKey:$xt,shortcutDesc:Bxt,commandList:zxt,commandCard:Fxt,commandCardExpanded:Hxt,commandRow:qxt,commandName:Uxt,commandTag:Wxt,chevron:Vxt,chevronExpanded:Gxt,commandDetail:Kxt,commandDescription:Yxt,commandSubcommands:Xxt,empty:Qxt},Jxt=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],Zxt=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"]),ewt=[["@","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 twt(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function eM(e){return!Zxt.has(e.name)}function nwt(e,t){return eM(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function swt(e,t,n){const s=n.trim().toLowerCase();return e.filter(r=>r.name&&r.description!==void 0).filter(r=>t==="commands"?!eM(r):t==="custom-commands"?eM(r):!0).filter(r=>s?r.name.toLowerCase().includes(s)||(r.description??"").toLowerCase().includes(s)||(r.argumentHint??"").toLowerCase().includes(s):!0).sort((r,i)=>r.name.localeCompare(i.name))}function rwt(){const{t:e}=at();return l.jsx("div",{className:ji.general,children:l.jsx("div",{className:ji.shortcuts,children:ewt.map(([t,n])=>l.jsxs("div",{className:ji.shortcut,children:[l.jsx("span",{className:ji.shortcutDesc,children:e(n)}),l.jsx("span",{className:ji.shortcutKey,children:t})]},t))})})}function iwt({commands:e,tab:t,query:n}){const{t:s}=at(),[r,i]=f.useState(null),o=f.useMemo(()=>swt(e,t,n),[e,n,t]);return o.length===0?l.jsx("div",{className:ji.empty,children:s(t==="custom-commands"?"help.emptyCustom":"help.empty")}):l.jsx("div",{className:ji.commandList,children:o.map(a=>{var u;const c=r===a.name;return l.jsxs("article",{className:`${ji.commandCard} ${c?ji.commandCardExpanded:""}`,children:[l.jsxs("button",{type:"button",className:ji.commandRow,onClick:()=>i(c?null:a.name),"aria-expanded":c,children:[l.jsx("span",{className:ji.commandName,children:twt(a)}),l.jsx("span",{className:ji.commandTag,children:nwt(a,s)}),l.jsx("svg",{className:`${ji.chevron} ${c?ji.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),c&&l.jsxs("div",{className:ji.commandDetail,children:[a.description&&l.jsx("div",{className:ji.commandDescription,children:a.description}),!!((u=a.subcommands)!=null&&u.length)&&l.jsxs("div",{className:ji.commandSubcommands,children:[s("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function owt({commands:e}){const{t}=at(),[n,s]=f.useState("general"),{filterValue:r,inputProps:i}=WT(),o=n!=="general";return l.jsxs("div",{className:ji.dialog,children:[l.jsxs("div",{className:ji.toolbar,children:[l.jsx("div",{className:ji.tabs,children:Jxt.map(a=>l.jsx("button",{type:"button",className:`${ji.tab} ${a.id===n?ji.tabActive:""}`,onClick:()=>s(a.id),children:t(a.labelKey)},a.id))}),o&&l.jsx("input",{className:ji.search,...i,placeholder:t("help.search")})]}),n==="general"?l.jsx(rwt,{}):l.jsx(iwt,{commands:e,tab:n,query:r})]})}function awt({currentTheme:e,onSelect:t,onClose:n}){const{t:s}=at(),r=aX.map(d=>({id:d,label:s(`theme.${d}`),description:s(`theme.${d}.desc`)})),[i,o]=f.useState(()=>{const d=r.findIndex(h=>h.id===e);return d>=0?d:0}),a=f.useRef(null),c=d=>{const h=r[d];h&&(t(h.id),n())},{keyboardMode:u}=ep({itemCount:r.length,activeIndex:i,onActiveIndexChange:o,onConfirm:c});return f.useEffect(()=>{var h;const d=(h=a.current)==null?void 0:h.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),l.jsx("div",{className:an("picker-list","picker-list-compact",u?"picker-keyboard-only":void 0),ref:a,role:"listbox","aria-label":s("theme.title"),tabIndex:0,"aria-activedescendant":r.length>0?`theme-opt-${i}`:void 0,"data-web-shell-theme-dialog":!0,children:r.map((d,h)=>{const m=d.id===e;return l.jsxs("div",{id:`theme-opt-${h}`,role:"option","aria-selected":m,className:an("picker-item","picker-session-item",h===i?"selected":void 0,m?"dialog-current":void 0),"data-web-shell-theme-option":!0,"data-theme-id":d.id,onClick:()=>c(h),onMouseMove:()=>o(h),children:[l.jsx("div",{className:an("picker-item-row"),children:l.jsx("span",{className:an("picker-item-title"),children:d.label})}),l.jsx("div",{className:an("picker-item-meta"),children:d.description})]},d.id)})})}const tM="delete-session-list",EW=e=>`${tM}-opt-${e}`;function lwt({onDeleted:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=at(),i=xa(),{sessions:o,loading:a,error:c,deleteSession:u,deleteSessions:d}=ek(s,{autoLoad:!0}),h=i.sessionId,[m,p]=f.useState(!1),[g,b]=f.useState(-1),[x,y]=f.useState(new Set),{filterValue:v,inputProps:w}=WT(()=>{b(-1),y(new Set)}),[k,T]=f.useState(null),C=f.useRef(null),_=f.useRef(null);f.useEffect(()=>{c&&T(c.message)},[c]);const S=f.useMemo(()=>v?o.filter(O=>{const A=v.toLowerCase();return(O.displayName||"").toLowerCase().includes(A)||O.sessionId.toLowerCase().includes(A)}):o,[o,v]),D=f.useCallback(O=>{O!==h&&y(A=>{const $=new Set(A);return $.has(O)?$.delete(O):$.add(O),$})},[h]);f.useEffect(()=>{if(x.size===0)return;const O=new Set(S.map(A=>A.sessionId));y(A=>{const $=new Set([...A].filter(q=>O.has(q)));return $.size===A.size?A:$})},[S,x.size]),f.useEffect(()=>{g>=S.length&&S.length>0&&b(S.length-1)},[S.length,g]),f.useEffect(()=>{var A;const O=(A=C.current)==null?void 0:A.children[g];O==null||O.scrollIntoView({block:"nearest"})},[g]),f.useEffect(()=>{var O;(O=_.current)==null||O.focus()},[]);const{keyboardMode:E}=ep({itemCount:S.length,activeIndex:g,onActiveIndexChange:b,onConfirm:O=>{const A=S[O];A&&D(A.sessionId)}}),B=f.useCallback(()=>{if(m)return;if(x.size>0){const A=new Set(S.map(q=>q.sessionId)),$=Array.from(x).filter(q=>A.has(q));if($.length===0)return;p(!0),d($).then(q=>{const U=q.removed.length+q.notFound.length,H=q.errors.length;if(H>0&&U>0){t(new Error(r("delete.partialFail",{removed:U,failed:H,detail:q.errors[0].error}))),n();return}if(H>0){T(r("delete.allFailed",{count:H,reason:q.errors[0].error})),p(!1),y(new Set);return}if(U===0){T(r("delete.nonRemoved")),p(!1),y(new Set);return}e([...q.removed,...q.notFound]),n()}).catch(q=>{t(q),p(!1)});return}const O=S[g];if(O){if(O.sessionId===h){T(r("delete.cannotCurrent"));return}p(!0),u(O.sessionId).then(A=>{if(!A){T(r("delete.notFound")),p(!1);return}e([O.sessionId]),n()}).catch(A=>{t(A),p(!1)})}},[h,u,d,m,S,n,e,t,g,x,r]),I=x.size>0,L=!m&&!a&&I;return l.jsxs("div",{className:an("picker","picker-in-shell"),children:[l.jsxs("div",{className:an("picker-search"),children:[l.jsxs("span",{className:an("picker-search-label"),children:[r("resume.search"),":"," "]}),l.jsx("input",{ref:_,className:an("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":tM,"aria-activedescendant":g>=0&&g<S.length?EW(g):void 0,...w,placeholder:""}),l.jsx("span",{className:an("picker-search-hint"),children:k||(m?r("delete.deleting"):a?r("common.loading"):I?r("delete.selected",{count:x.size}):v?r("delete.matches",{count:S.length}):"")})]}),l.jsx("div",{className:an("picker-sep")}),l.jsxs("div",{id:tM,role:"listbox","aria-multiselectable":"true",className:an("picker-list",E?"picker-keyboard-only":void 0),ref:C,children:[a&&l.jsx("div",{className:an("picker-empty"),children:r("common.loading")}),!a&&c&&l.jsx("div",{className:an("picker-empty"),children:c.message}),!a&&!c&&S.length===0&&l.jsx("div",{className:an("picker-empty"),children:v?r("delete.noMatch",{query:v}):r("delete.none")}),!a&&S.map((O,A)=>{const $=O.sessionId===h,q=x.has(O.sessionId);return l.jsx(bD,{session:O,optionId:EW(A),active:A===g,ariaSelected:q,current:!1,disabled:$,leading:l.jsx("span",{className:an("picker-item-checkbox",q?"picker-item-checkbox-checked":void 0),children:q?"[x] ":"[ ] "}),trailing:$?l.jsx("span",{className:an("picker-item-badge"),children:r("resume.current")}):void 0,onClick:()=>{b(A),$||D(O.sessionId)},onActivate:()=>b(A)},O.sessionId)})]}),l.jsx("div",{className:an("picker-sep")}),l.jsxs("div",{className:an("dialog-footer-actions"),children:[l.jsx("button",{type:"button",className:an("dialog-inline-button"),onClick:n,disabled:m,children:r("common.cancel")}),l.jsx("button",{type:"button",className:an("dialog-danger-button"),onClick:B,disabled:!L,children:r(m?"delete.deleting":"delete.action")})]})]})}const nM="release-session-list",AW=e=>`${nM}-opt-${e}`;function cwt({onReleased:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=at(),i=xa(),{sessions:o,loading:a,error:c,releaseSession:u}=ek(s,{autoLoad:!0}),d=i.sessionId,[h,m]=f.useState(!1),[p,g]=f.useState(-1),[b,x]=f.useState(null),{filterValue:y,inputProps:v}=WT(()=>{g(-1),x(null)}),[w,k]=f.useState(null),T=f.useRef(null),C=f.useRef(null);f.useEffect(()=>{c&&k(c.message)},[c]);const _=y?o.filter(O=>{const A=y.toLowerCase();return(O.displayName||"").toLowerCase().includes(A)||O.sessionId.toLowerCase().includes(A)}):o,S=O=>{const A=_[O];if(!A)return;const $=A.sessionId===d,q=(A.clientCount??0)>0||A.hasActivePrompt===!0;$||!q||(g(O),x(A.sessionId))};f.useEffect(()=>{p>=_.length&&_.length>0&&g(_.length-1)},[_.length,p]),f.useEffect(()=>{var A;const O=(A=T.current)==null?void 0:A.children[p];O==null||O.scrollIntoView({block:"nearest"})},[p]),f.useEffect(()=>{var O;(O=C.current)==null||O.focus()},[]);const{keyboardMode:D}=ep({itemCount:_.length,activeIndex:p,onActiveIndexChange:g,onConfirm:S}),E=f.useCallback(O=>{const A=O??_.find(q=>q.sessionId===b)??void 0;if(!A||h)return;if(!((A.clientCount??0)>0||A.hasActivePrompt===!0)){k(r("release.inactive"));return}if(A.sessionId===d){k(r("release.cannotCurrent"));return}u&&(m(!0),u(A.sessionId).then(()=>{e(A.sessionId),n()}).catch(q=>{t(q),m(!1)}))},[d,h,_,n,t,e,u,b,r]),B=_.find(O=>O.sessionId===b)??void 0,I=B&&((B.clientCount??0)>0||B.hasActivePrompt===!0),L=!h&&!a&&!!B&&B.sessionId!==d&&!!I;return l.jsxs("div",{className:an("picker","picker-in-shell"),children:[l.jsxs("div",{className:an("picker-search"),children:[l.jsxs("span",{className:an("picker-search-label"),children:[r("resume.search"),":"," "]}),l.jsx("input",{ref:C,className:an("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":nM,"aria-activedescendant":p>=0&&p<_.length?AW(p):void 0,...v,placeholder:""}),l.jsx("span",{className:an("picker-search-hint"),children:w||(h?r("release.releasing"):a?r("common.loading"):y?r("release.matches",{count:_.length}):"")})]}),l.jsx("div",{className:an("picker-sep")}),l.jsxs("div",{id:nM,role:"listbox",className:an("picker-list",D?"picker-keyboard-only":void 0),ref:T,children:[a&&l.jsx("div",{className:an("picker-empty"),children:r("common.loading")}),!a&&_.length===0&&l.jsx("div",{className:an("picker-empty"),children:y?r("release.noMatch",{query:y}):r("release.none")}),!a&&_.map((O,A)=>{const $=O.sessionId===d,q=(O.clientCount??0)>0||O.hasActivePrompt===!0,U=$||!q;return l.jsx(bD,{session:O,optionId:AW(A),active:A===p,confirmed:O.sessionId===b,ariaSelected:O.sessionId===b,current:!1,disabled:U,trailing:$?l.jsx("span",{className:an("picker-item-badge"),children:r("resume.current")}):q?void 0:l.jsx("span",{className:an("picker-item-badge"),children:r("release.inactiveBadge")}),onClick:()=>S(A),onActivate:()=>g(A)},O.sessionId)})]}),l.jsx("div",{className:an("picker-sep")}),l.jsxs("div",{className:an("dialog-footer-actions"),children:[l.jsx("button",{type:"button",className:an("dialog-inline-button"),onClick:n,disabled:h,children:r("common.cancel")}),l.jsx("button",{type:"button",className:an("dialog-danger-button"),onClick:()=>E(),disabled:!L,children:r(h?"release.releasing":"release.action")})]})]})}const uwt="_root_ieg2d_1",dwt="_list_ieg2d_8",hwt="_item_ieg2d_21",fwt="_itemCursor_ieg2d_42",mwt="_itemSelected_ieg2d_49",pwt="_prompt_ieg2d_61",gwt="_keyboardOnly_ieg2d_68",bwt="_itemDisabled_ieg2d_77",ywt="_turn_ieg2d_91",vwt="_time_ieg2d_96",xwt="_footer_ieg2d_102",wwt="_footerMessage_ieg2d_112",kwt="_dangerButton_ieg2d_118",Pl={root:uwt,list:dwt,item:hwt,itemCursor:fwt,itemSelected:mwt,prompt:pwt,keyboardOnly:gwt,itemDisabled:bwt,turn:ywt,time:vwt,footer:xwt,footerMessage:wwt,dangerButton:kwt},_wt="rewind-snapshot-list",jW=e=>`${_wt}-opt-${e}`;function Swt(e,t){let n=0;for(const s of e)if(s.kind==="user"){if(n===t)return s.text.trim();n+=1}return""}function Cwt(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function Twt({blocks:e,loadSnapshots:t,rewind:n,onError:s,onClose:r}){const{t:i}=at(),[o,a]=f.useState([]),[c,u]=f.useState(!0),[d,h]=f.useState(null),[m,p]=f.useState(0),[g,b]=f.useState(null),[x,y]=f.useState(null);f.useEffect(()=>{let S=!0;return u(!0),t().then(D=>{S&&a(D.snapshots)}).catch(D=>{S&&s(D)}).finally(()=>{S&&u(!1)}),()=>{S=!1}},[t,s]);const v=f.useMemo(()=>o.map(S=>({snapshot:S,promptText:Swt(e,S.turnIndex)})).sort((S,D)=>S.snapshot.turnIndex-D.snapshot.turnIndex),[e,o]);f.useEffect(()=>{m>=v.length&&v.length>0&&p(v.length-1)},[v.length,m]);const w=f.useRef(null),k=d!==null,T=S=>{!S||d||(h(S),y(null),n(S).then(()=>{r()}).catch(D=>{s(D),y(i("rewind.failed",{reason:D instanceof Error?D.message:String(D)})),h(null)}))},C=S=>{const D=v[S];D&&(p(S),b(D.snapshot.promptId))},{keyboardMode:_}=ep({itemCount:v.length,activeIndex:m,onActiveIndexChange:p,onConfirm:C,enabled:!k});return f.useEffect(()=>{var D;const S=(D=w.current)==null?void 0:D.children[m];S==null||S.scrollIntoView({block:"nearest"})},[m]),f.useEffect(()=>{var D;if(c||v.length===0)return;const S=document.activeElement;(S==null?void 0:S.getAttribute("role"))==="dialog"&&((D=w.current)==null||D.focus())},[c,v.length]),c?l.jsx("div",{className:an("picker-empty"),children:i("rewind.loading")}):v.length===0?l.jsx("div",{className:an("picker-empty"),children:i("rewind.empty")}):l.jsxs("div",{className:Pl.root,children:[l.jsx("div",{className:`${Pl.list} ${_?Pl.keyboardOnly:""}`,ref:w,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":v.length>0?jW(m):void 0,children:v.map(({snapshot:S,promptText:D},E)=>{const B=E===m,I=g===S.promptId,L=D||i("rewind.promptFallback",{id:S.promptId.slice(-8)});return l.jsxs("div",{id:jW(E),role:"option","aria-selected":I,"aria-disabled":k||void 0,className:`${Pl.item} ${B?Pl.itemCursor:""} ${I?Pl.itemSelected:""} ${k?Pl.itemDisabled:""}`,onClick:()=>{k||C(E)},onMouseMove:()=>p(E),children:[l.jsxs("div",{className:Pl.prompt,title:L,children:[l.jsxs("span",{className:Pl.turn,children:["#",S.turnIndex+1]})," ",L]}),l.jsx("div",{className:Pl.time,children:Cwt(S.timestamp)})]},S.promptId)})}),l.jsxs("div",{className:Pl.footer,children:[x&&l.jsx("span",{className:Pl.footerMessage,role:"alert",children:x}),l.jsx("button",{type:"button",className:an("dialog-inline-button"),onClick:r,disabled:d!==null,children:i("common.cancel")}),l.jsx("button",{type:"button",className:`${an("dialog-danger-button")} ${Pl.dangerButton}`,onClick:()=>T(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const Q7="add-workspace-hint",NW="add-workspace-display-name-hint",MW="add-workspace-error",_2="add-workspace-suggestions",Ewt=150;function IW(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}function Awt({onClose:e,onAdd:t,displayNameEnabled:n=!1,onSuggest:s,persistenceSupported:r=!0}){const{t:i}=at(),[o,a]=f.useState(""),[c,u]=f.useState(""),[d,h]=f.useState(null),[m,p]=f.useState(!1),[g,b]=f.useState(!0),[x,y]=f.useState([]),[v,w]=f.useState(!1),[k,T]=f.useState(-1),[C,_]=f.useState("/"),S=f.useRef(null),D=f.useRef(!1);D.current=v&&x.length>0;const E=f.useRef(0),B=f.useRef(!1);f.useEffect(()=>{var q;(q=S.current)==null||q.focus()},[]);const I=f.useCallback(()=>{w(!1),T(-1)},[]);f.useEffect(()=>{if(!s)return;if(!IW(o)){y([]),I();return}const q=++E.current,U=!B.current;B.current=!1;const H=setTimeout(()=>{s(o).then(M=>{q===E.current&&(y(M.suggestions),_(M.sep||"/"),T(-1),(U||D.current)&&w(M.suggestions.length>0))},()=>{q===E.current&&(y([]),I())})},Ewt);return()=>clearTimeout(H)},[o,s,I]),f.useEffect(()=>{const q=U=>{U.key!=="Escape"||!D.current||U.isComposing||U.keyCode===229||(U.preventDefault(),I())};return window.addEventListener("keydown",q,{capture:!0}),()=>window.removeEventListener("keydown",q,{capture:!0})},[I]);const L=f.useCallback(q=>{var U;B.current=!1,a(q.path+C),h(null),I(),(U=S.current)==null||U.focus()},[C,I]),O=f.useCallback(q=>{const U=v&&x.length>0;if(q.key==="ArrowDown"){if(q.preventDefault(),!U){x.length>0&&w(!0);return}T(H=>(H+1)%x.length);return}if(q.key==="ArrowUp"){if(!U)return;q.preventDefault(),T(H=>(H<=0?x.length:H)-1);return}if(q.key==="Tab"&&U&&!q.shiftKey){const H=k>=0?x[k]:x.length===1?x[0]:void 0;H&&(q.preventDefault(),L(H));return}q.key==="Enter"&&U&&k>=0&&(q.preventDefault(),L(x[k]))},[v,x,k,L]),A=f.useCallback(async q=>{q.preventDefault();const U=o.trim();if(U){if(!IW(U)){h(i("sidebar.addWorkspaceAbsError"));return}h(null),p(!0),I();try{const H=r?g:!1,M=n?c.trim():"";M?await t(U,H,M):await t(U,H),e()}catch(H){h(H instanceof Error?H.message:i("sidebar.addWorkspaceError"))}finally{p(!1)}}},[o,c,n,g,r,t,e,I,i]),$=v&&x.length>0;return l.jsx(pi,{title:i("sidebar.addWorkspaceTitle"),size:"md",onClose:e,children:l.jsxs("form",{className:"flex flex-col gap-6",onSubmit:A,children:[l.jsxs(H1,{children:[l.jsxs($i,{"data-invalid":d?!0:void 0,children:[l.jsx(vo,{htmlFor:"add-workspace-path",children:i("sidebar.addWorkspacePath")}),l.jsxs("div",{className:"relative",children:[l.jsx(qr,{ref:S,id:"add-workspace-path",type:"text",placeholder:"/absolute/path/to/project",value:o,onChange:q=>{a(q.target.value),d&&h(null)},onKeyDown:O,onBlur:()=>{setTimeout(()=>{B.current=!0,I()},100)},disabled:m,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,role:"combobox","aria-expanded":$,"aria-controls":$?_2:void 0,"aria-activedescendant":$&&k>=0?`${_2}-${k}`:void 0,"aria-describedby":d?`${MW} ${Q7}`:Q7,"aria-invalid":d?!0:void 0}),$&&l.jsx("ul",{id:_2,role:"listbox","aria-label":i("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:x.map((q,U)=>l.jsxs("li",{id:`${_2}-${U}`,role:"option","aria-selected":U===k,className:`cursor-pointer truncate px-3 py-1.5 ${U===k?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:H=>{H.preventDefault(),L(q)},onMouseEnter:()=>T(U),children:[q.name,l.jsx("span",{className:"text-muted-foreground",children:C})]},q.path))})]}),l.jsx(tu,{id:Q7,children:i("sidebar.addWorkspaceHint")}),d&&l.jsx(Ait,{id:MW,children:d})]}),n&&l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"add-workspace-display-name",children:i("sidebar.addWorkspaceDisplayName")}),l.jsx(qr,{id:"add-workspace-display-name",type:"text",value:c,onChange:q=>u(q.target.value),disabled:m,maxLength:256,autoComplete:"off","aria-describedby":NW}),l.jsx(tu,{id:NW,children:i("sidebar.addWorkspaceDisplayNameHint")})]}),r&&l.jsxs($i,{orientation:"horizontal",children:[l.jsxs(zae,{children:[l.jsx(vo,{htmlFor:"add-workspace-persist",children:i("sidebar.addWorkspacePersist")}),l.jsx(tu,{children:i("sidebar.addWorkspacePersistHint")})]}),l.jsx(nce,{id:"add-workspace-persist",checked:g,onCheckedChange:b,disabled:m})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(An,{type:"button",variant:"outline",onClick:e,disabled:m,children:i("sidebar.addWorkspaceCancel")}),l.jsx(An,{type:"submit",disabled:m||!o.trim(),children:i(m?"sidebar.addWorkspaceAdding":"sidebar.addWorkspaceRegister")})]})]})})}const oce="qwen-code-web-shell-collapsed-session-groups",rk="ws:";function RW(e){return!e.startsWith(rk)}function jwt(e,t){return`${rk}${e}|group:${t}`}function ace(e){return`${rk}${e}|ungrouped`}function Nwt(e,t){return t.startsWith(`${rk}${e}|`)}function ND(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(oce);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 Mwt(e){try{window.localStorage.setItem(oce,JSON.stringify(Array.from(e).sort()))}catch{}}function lce(e,t){const n=ND(),s=new Set(Array.from(n).filter(r=>!t(r)));for(const r of e)s.add(r);Mwt(s)}function Iwt(e){const t=ND(),n=new Set,s=`${rk}${e}|group:`,r=ace(e);for(const i of t)i===r?n.add("ungrouped"):i.startsWith(s)&&n.add(i.slice(s.length));return n}function Rwt(e,t){const n=new Set;for(const s of t)n.add(s==="ungrouped"?ace(e):jwt(e,s));lce(n,s=>Nwt(e,s))}const Dwt="_sidebar_dp3e8_1",Lwt="_resizing_dp3e8_20",Pwt="_collapsed_dp3e8_24",Owt="_newChatButton_dp3e8_30",$wt="_pluginButton_dp3e8_31",Bwt="_footerButton_dp3e8_32",zwt="_collapseButton_dp3e8_33",Fwt="_projectRow_dp3e8_34",Hwt="_sessionRow_dp3e8_35",qwt="_sessionGroupHeader_dp3e8_36",Uwt="_sessionGroupActionButton_dp3e8_37",Wwt="_retry_dp3e8_38",Vwt="_iconButton_dp3e8_39",Gwt="_projectIconButton_dp3e8_40",Kwt="_sessionActionButton_dp3e8_41",Ywt="_groupMenuItem_dp3e8_42",Xwt="_secondaryButton_dp3e8_43",Qwt="_dangerButton_dp3e8_44",Jwt="_primaryNav_dp3e8_80",Zwt="_navIcon_dp3e8_129",ekt="_topRow_dp3e8_155",tkt="_brandLogo_dp3e8_170",nkt="_brandName_dp3e8_186",skt="_workspacePicker_dp3e8_206",rkt="_workspacePickerLabel_dp3e8_213",ikt="_workspacePickerHeader_dp3e8_220",okt="_workspaceAddIconButton_dp3e8_227",akt="_workspaceList_dp3e8_247",lkt="_workspaceSessionBody_dp3e8_253",ckt="_projectsHeader_dp3e8_257",ukt="_pinnedSessionList_dp3e8_267",dkt="_projectsHeaderToggle_dp3e8_275",hkt="_projectsHeaderAction_dp3e8_276",fkt="_projectsHeaderActions_dp3e8_284",mkt="_projectSearch_dp3e8_335",pkt="_addWorkspaceButton_dp3e8_357",gkt="_body_dp3e8_377",bkt="_sectionTitle_dp3e8_387",ykt="_projectRowExpanded_dp3e8_402",vkt="_workspaceHeaderActions_dp3e8_428",xkt="_workspaceHeaderAction_dp3e8_428",wkt="_projectName_dp3e8_471",kkt="_sessionText_dp3e8_472",_kt="_sessionBadgeIcon_dp3e8_479",Skt="_projectHoverAction_dp3e8_495",Ckt="_sessionList_dp3e8_504",Tkt="_sessionGroupSection_dp3e8_519",Ekt="_sessionGroupHeaderRow_dp3e8_525",Akt="_sessionGroupDot_dp3e8_561",jkt="_sessionGroupDotMuted_dp3e8_568",Nkt="_sessionGroupTitle_dp3e8_572",Mkt="_sessionGroupCount_dp3e8_579",Ikt="_sessionGroupChevron_dp3e8_584",Rkt="_sessionGroupHeaderActions_dp3e8_605",Dkt="_sessionGroupList_dp3e8_635",Lkt="_currentSession_dp3e8_653",Pkt="_busySession_dp3e8_658",Okt="_floatingTooltip_dp3e8_663",$kt="_tooltipContent_dp3e8_693",Bkt="_tooltipTitle_dp3e8_699",zkt="_tooltipTags_dp3e8_706",Fkt="_tooltipTag_dp3e8_706",Hkt="_tooltipTagRunning_dp3e8_726",qkt="_tooltipTagNew_dp3e8_731",Ukt="_tooltipMeta_dp3e8_736",Wkt="_sessionStatusSlot_dp3e8_751",Vkt="_sessionStatusDot_dp3e8_763",Gkt="_sidebarPulse_dp3e8_1",Kkt="_sessionTitlePin_dp3e8_773",Ykt="_sessionMetaSlot_dp3e8_805",Xkt="_sessionAttention_dp3e8_815",Qkt="_sessionAttentionUserInput_dp3e8_829",Jkt="_sessionLoading_dp3e8_834",Zkt="_sessionTime_dp3e8_844",e_t="_sidebarSpin_dp3e8_1",t_t="_runningSession_dp3e8_863",n_t="_sessionActions_dp3e8_879",s_t="_activeSessionActionButton_dp3e8_945",r_t="_searchInput_dp3e8_964",i_t="_renameInput_dp3e8_978",o_t="_dialogSelect_dp3e8_984",a_t="_dialogInput_dp3e8_994",l_t="_groupMenu_dp3e8_42",c_t="_groupMenuItemActive_dp3e8_1036",u_t="_groupMenuName_dp3e8_1042",d_t="_groupMenuDot_dp3e8_1050",h_t="_groupMenuEmptyDot_dp3e8_1051",f_t="_groupMenuIcon_dp3e8_1052",m_t="_groupMenuCheck_dp3e8_1080",p_t="_groupMenuSeparator_dp3e8_1087",g_t="_groupColorRed_dp3e8_1093",b_t="_groupColorOrange_dp3e8_1097",y_t="_groupColorYellow_dp3e8_1101",v_t="_groupColorGreen_dp3e8_1105",x_t="_groupColorBlue_dp3e8_1109",w_t="_groupColorPurple_dp3e8_1113",k_t="_groupColorCustom_dp3e8_1117",__t="_renameForm_dp3e8_1127",S_t="_notice_dp3e8_1143",C_t="_confirmContent_dp3e8_1158",T_t="_confirmDescription_dp3e8_1164",E_t="_workspaceRemovalActivityList_dp3e8_1171",A_t="_confirmActions_dp3e8_1179",j_t="_groupForm_dp3e8_1185",N_t="_fieldStack_dp3e8_1192",M_t="_groupCustomColorRow_dp3e8_1220",I_t="_groupColorPicker_dp3e8_1227",R_t="_groupHexField_dp3e8_1237",D_t="_groupColorError_dp3e8_1247",L_t="_footer_dp3e8_32",P_t="_footerPrimary_dp3e8_1308",O_t="_footerActions_dp3e8_1309",$_t="_footerButtonLabel_dp3e8_1325",B_t="_footerCompact_dp3e8_1332",z_t="_footerTight_dp3e8_1333",F_t="_version_dp3e8_1368",H_t="_resizeHandle_dp3e8_1411",q_t="_sessionActionButtonActive_dp3e8_1439",U_t="_menuActive_dp3e8_1445",W_t="_actionMenu_dp3e8_1449",V_t="_actionMenuItem_dp3e8_1466",G_t="_actionMenuItemDanger_dp3e8_1497",K_t="_actionMenuIcon_dp3e8_1507",Y_t="_actionMenuLabel_dp3e8_1526",X_t="_archivedSection_dp3e8_1534",Q_t="_archivedHeader_dp3e8_1541",J_t="_archivedChevron_dp3e8_1567",Z_t="_archivedTitle_dp3e8_1586",e2t="_archivedCount_dp3e8_1595",t2t="_archivedList_dp3e8_1610",n2t="_archivedRow_dp3e8_1617",s2t="_mobileOpen_dp3e8_1626",Ne={sidebar:Dwt,resizing:Lwt,collapsed:Pwt,newChatButton:Owt,pluginButton:$wt,footerButton:Bwt,collapseButton:zwt,projectRow:Fwt,sessionRow:Hwt,sessionGroupHeader:qwt,sessionGroupActionButton:Uwt,retry:Wwt,iconButton:Vwt,projectIconButton:Gwt,sessionActionButton:Kwt,groupMenuItem:Ywt,secondaryButton:Xwt,dangerButton:Qwt,primaryNav:Jwt,navIcon:Zwt,topRow:ekt,brandLogo:tkt,brandName:nkt,workspacePicker:skt,workspacePickerLabel:rkt,workspacePickerHeader:ikt,workspaceAddIconButton:okt,workspaceList:akt,workspaceSessionBody:lkt,projectsHeader:ckt,pinnedSessionList:ukt,projectsHeaderToggle:dkt,projectsHeaderAction:hkt,projectsHeaderActions:fkt,projectSearch:mkt,addWorkspaceButton:pkt,body:gkt,sectionTitle:bkt,projectRowExpanded:ykt,workspaceHeaderActions:vkt,workspaceHeaderAction:xkt,projectName:wkt,sessionText:kkt,sessionBadgeIcon:_kt,projectHoverAction:Skt,sessionList:Ckt,sessionGroupSection:Tkt,sessionGroupHeaderRow:Ekt,sessionGroupDot:Akt,sessionGroupDotMuted:jkt,sessionGroupTitle:Nkt,sessionGroupCount:Mkt,sessionGroupChevron:Ikt,sessionGroupHeaderActions:Rkt,sessionGroupList:Dkt,currentSession:Lkt,busySession:Pkt,floatingTooltip:Okt,tooltipContent:$kt,tooltipTitle:Bkt,tooltipTags:zkt,tooltipTag:Fkt,tooltipTagRunning:Hkt,tooltipTagNew:qkt,tooltipMeta:Ukt,sessionStatusSlot:Wkt,sessionStatusDot:Vkt,sidebarPulse:Gkt,sessionTitlePin:Kkt,sessionMetaSlot:Ykt,sessionAttention:Xkt,sessionAttentionUserInput:Qkt,sessionLoading:Jkt,sessionTime:Zkt,sidebarSpin:e_t,runningSession:t_t,sessionActions:n_t,activeSessionActionButton:s_t,searchInput:r_t,renameInput:i_t,dialogSelect:o_t,dialogInput:a_t,groupMenu:l_t,groupMenuItemActive:c_t,groupMenuName:u_t,groupMenuDot:d_t,groupMenuEmptyDot:h_t,groupMenuIcon:f_t,groupMenuCheck:m_t,groupMenuSeparator:p_t,groupColorRed:g_t,groupColorOrange:b_t,groupColorYellow:y_t,groupColorGreen:v_t,groupColorBlue:x_t,groupColorPurple:w_t,groupColorCustom:k_t,renameForm:__t,notice:S_t,confirmContent:C_t,confirmDescription:T_t,workspaceRemovalActivityList:E_t,confirmActions:A_t,groupForm:j_t,fieldStack:N_t,groupCustomColorRow:M_t,groupColorPicker:I_t,groupHexField:R_t,groupColorError:D_t,footer:L_t,footerPrimary:P_t,footerActions:O_t,footerButtonLabel:$_t,footerCompact:B_t,footerTight:z_t,version:F_t,resizeHandle:H_t,sessionActionButtonActive:q_t,menuActive:U_t,actionMenu:W_t,actionMenuItem:V_t,actionMenuItemDanger:G_t,actionMenuIcon:K_t,actionMenuLabel:Y_t,archivedSection:X_t,archivedHeader:Q_t,archivedChevron:J_t,archivedTitle:Z_t,archivedCount:e2t,archivedList:t2t,archivedRow:n2t,mobileOpen:s2t};function sM({label:e,count:t,expanded:n,color:s,children:r,onToggle:i,onRename:o,onDelete:a,renameLabel:c,deleteLabel:u,actionsDisabled:d}){const h=s!=null&&s.startsWith("#")?Ne.groupColorCustom:s?Ne[`groupColor${s[0].toUpperCase()}${s.slice(1)}`]:Ne.sessionGroupDotMuted,m=s!=null&&s.startsWith("#")?{"--session-group-custom-color":s}:void 0;return l.jsxs("section",{className:Ne.sessionGroupSection,"aria-label":e,children:[l.jsxs("div",{className:Ne.sessionGroupHeaderRow,children:[l.jsxs("button",{type:"button",className:Ne.sessionGroupHeader,"aria-expanded":n,onClick:i,children:[l.jsx("span",{className:`${Ne.sessionGroupDot} ${h}`,style:m,"aria-hidden":"true"}),l.jsx("span",{className:Ne.sessionGroupTitle,children:e}),l.jsxs("span",{className:Ne.sessionGroupCount,children:["· ",t]}),l.jsx("span",{className:Ne.sessionGroupChevron,"aria-hidden":"true",children:n?l.jsx(wc,{}):l.jsx(cC,{})})]}),(o||a)&&l.jsxs("div",{className:Ne.sessionGroupHeaderActions,children:[o&&l.jsx("button",{className:Ne.sessionGroupActionButton,type:"button",title:c,"aria-label":c,disabled:d,onClick:o,children:l.jsx(i4,{})}),a&&l.jsx("button",{className:Ne.sessionGroupActionButton,type:"button",title:u,"aria-label":u,disabled:d,onClick:a,children:l.jsx(Wp,{})})]})]}),n&&l.jsx("div",{className:Ne.sessionGroupList,children:r})]})}const r2t="_section_kbnw6_1",i2t="_headerRow_kbnw6_6",o2t="_header_kbnw6_6",a2t="_headerDisabled_kbnw6_34",l2t="_headerContent_kbnw6_42",c2t="_chevron_kbnw6_50",u2t="_folderIcon_kbnw6_55",d2t="_chevronOpen_kbnw6_59",h2t="_name_kbnw6_63",f2t="_badge_kbnw6_71",m2t="_gitPill_kbnw6_85",p2t="_sessions_kbnw6_107",g2t="_empty_kbnw6_114",b2t="_error_kbnw6_120",y2t="_sessionItemReadOnly_kbnw6_126",v2t="_sessionName_kbnw6_137",x2t="_sessionTime_kbnw6_144",Po={section:r2t,headerRow:i2t,header:o2t,headerDisabled:a2t,headerContent:l2t,chevron:c2t,folderIcon:u2t,chevronOpen:d2t,name:h2t,badge:f2t,gitPill:m2t,sessions:p2t,empty:g2t,error:b2t,sessionItemReadOnly:y2t,sessionName:v2t,sessionTime:x2t};function DW(...e){return e.filter(Boolean).join(" ")}function w2t(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:[\\/]/.test(e)}function k2t(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function _2t({open:e}){const t=e?Gge:s4;return l.jsx(t,{className:Po.folderIcon,size:16,strokeWidth:1.2,"aria-hidden":"true"})}function S2t({workspace:e,renderHeader:t,client:n,reloadToken:s,untrustedLabel:r,readOnlyLabel:i,trustToOpenLabel:o,noSessionsLabel:a,loadErrorLabel:c,organizationEnabled:u,ungroupedLabel:d,formatTime:h,searchQuery:m="",expanded:p,autoExpandKey:g,onExpandedChange:b,renderSessions:x=!0,renderSession:y,headerActions:v,onRenameGroup:w,onDeleteGroup:k,renameGroupLabel:T,deleteGroupLabel:C,groupActionsDisabled:_,excludePinned:S=!1,onOpenGitDiff:D}){const{t:E}=at(),[B,I]=f.useState([]),[L,O]=f.useState([]),[A,$]=f.useState(!1),[q,U]=f.useState(!1),[H,M]=f.useState(()=>Iwt(e.id)),[ee,V]=f.useState(!1),[R,re]=f.useState(),Z=p??q,K=!e.primary&&!e.trusted,Y=e.primary&&!e.trusted;f.useEffect(()=>{p===void 0&&U(!1)},[p,e.id]),f.useEffect(()=>{Rwt(e.id,H)},[H,e.id]),f.useEffect(()=>{p===void 0&&g&&U(!0)},[g,p]);const ae=f.useCallback(async()=>{if(!Y)try{const ie=await n.workspaceByCwd(e.cwd).listWorkspaceSessions({pageSize:oh,archiveState:"active",...u?{view:"organized",group:"all"}:{}});I(ie),$(!1)}catch(ie){console.warn("[WorkspaceSection] session poll failed:",ie),$(!0)}},[n,Y,u,e.cwd]);f.useEffect(()=>{if(!x||Y||!u){O([]);return}let ie=!1;return n.workspaceByCwd(e.cwd).listSessionGroups().then(Ce=>{ie||O(Ce.groups)}).catch(Ce=>{console.warn("[WorkspaceSection] group catalog load failed:",Ce)}),()=>{ie=!0}},[n,Y,u,s,x,e.cwd]),f.useEffect(()=>{if(!x||!Z&&!m.trim()||(ae(),K))return;const ie=setInterval(()=>void ae(),1e4);return()=>clearInterval(ie)},[Z,ae,K,s,x,m]);const le=w2t(e.cwd)?e.cwd:void 0,te=!!D,z=f.useRef(!1),X=f.useCallback(async()=>{if(!(!te||!e.trusted||!le))try{const ie=await n.workspaceByCwd(le).workspaceGit();z.current=!1,re(ie)}catch(ie){z.current||(console.warn("[WorkspaceSection] git status poll failed:",ie),z.current=!0)}},[n,le,te,e.trusted]);f.useEffect(()=>{if(!te||!e.trusted||!le){re(void 0);return}X();const ie=()=>void X();window.addEventListener("focus",ie);const Ce=window.setInterval(()=>{document.visibilityState==="visible"&&X()},6e4);return()=>{window.removeEventListener("focus",ie),window.clearInterval(Ce)}},[le,te,X,s,e.trusted]);const fe=f.useMemo(()=>{const ie=m.trim().toLowerCase();return B.filter(Ce=>S&&Ce.isPinned?!1:ie?(Ce.displayName||"").toLowerCase().includes(ie)||Ce.sessionId.toLowerCase().includes(ie):!0)},[S,m,B]),xe=f.useMemo(()=>{if(!u||L.length===0)return null;const ie=new Set;return{sections:L.map(Ke=>{const ut=fe.filter(Et=>Et.groupId===Ke.id);return ut.forEach(Et=>ie.add(Et.sessionId)),{group:Ke,sessions:ut}}),ungrouped:fe.filter(Ke=>!ie.has(Ke.sessionId))}},[L,u,fe]);return l.jsxs("div",{className:Po.section,children:[l.jsxs("div",{className:DW(Po.headerRow,Y&&Po.headerDisabled),onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),onFocus:()=>V(!0),onBlur:ie=>{ie.currentTarget.contains(ie.relatedTarget)||V(!1)},children:[l.jsx("button",{className:Po.header,type:"button",disabled:Y,"aria-expanded":Z,onClick:()=>{const ie=!Z;U(ie),b==null||b(ie)},children:t?t(Z):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:DW(Po.chevron,Z&&Po.chevronOpen),children:l.jsx(_2t,{open:Z})}),l.jsx("span",{className:Po.headerContent,children:l.jsx("span",{className:Po.name,children:VT(e)})}),!e.trusted&&l.jsx("span",{className:Po.badge,children:r}),K&&l.jsx("span",{className:Po.badge,children:i})]})}),D&&e.trusted&&(R==null?void 0:R.branch)&&l.jsx("button",{type:"button",className:Po.gitPill,"aria-label":`${E("gitDiff.title")} — ${R.branch}`,onClick:()=>D(e.cwd),children:l.jsx(Rae,{branch:R.branch,status:R,compact:!0})}),v==null?void 0:v(ee)]}),x&&(Z||!!m.trim())&&!Y&&l.jsx("div",{className:Po.sessions,children:A?l.jsx("div",{className:Po.error,role:"status",children:c}):fe.length===0?l.jsx("div",{className:Po.empty,children:a}):xe?l.jsxs(l.Fragment,{children:[xe.sections.map(({group:ie,sessions:Ce})=>l.jsx(sM,{id:`group:${ie.id}`,label:ie.name,count:Ce.length,color:ie.color,expanded:!H.has(ie.id),onToggle:()=>{M(Ke=>{const ut=new Set(Ke);return ut.has(ie.id)?ut.delete(ie.id):ut.add(ie.id),ut})},onRename:w?()=>w(ie,e.cwd):void 0,onDelete:k?()=>k(ie,e.cwd):void 0,renameLabel:T,deleteLabel:C,actionsDisabled:_,children:Ce.map(Ke=>y(Ke))},ie.id)),xe.ungrouped.length>0&&l.jsx(sM,{id:"ungrouped",label:d,count:xe.ungrouped.length,expanded:!H.has("ungrouped"),onToggle:()=>{M(ie=>{const Ce=new Set(ie);return Ce.has("ungrouped")?Ce.delete("ungrouped"):Ce.add("ungrouped"),Ce})},children:xe.ungrouped.map(ie=>y(ie))})]}):fe.map(ie=>{if(!K)return y(ie);const Ce=k2t(ie),Ke=ie.createdAt?h(ie.createdAt):"";return l.jsxs("div",{className:Po.sessionItemReadOnly,role:"note","aria-label":`${Ce}${Ke?`, ${Ke}`:""}. ${o}`,children:[l.jsx("span",{className:Po.sessionName,title:Ce,children:Ce}),Ke&&l.jsx("span",{className:Po.sessionTime,children:Ke})]},ie.sessionId)})})]})}const cce="qwen-code-web-shell-sidebar-width",S2=260,C2t=220,uce=420,T2t=344,E2t=250,dce=200,A2t=56,LW=dce-A2t,j2t=2e3,N2t=3e4,PW=96,M2t="recent",J7=240,$g=8,Z7="__custom__",Bg="#416ef5";function zg(e,t){return`${t??""}\0${e}`}const I2t=["settings","version","theme","sessionsOverview","splitView","daemonStatus","collapse"],R2t=["newTask","plugins","scheduledTasks","goals"],D2t=["details","rename","group","export","delete","pin","archive"],L2t=["pin","archive"],Fg=["red","orange","yellow","green","blue","purple"];function Ol(...e){return e.filter(Boolean).join(" ")}function OW(e){return e instanceof DOMException&&e.name==="AbortError"}function P2t(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function vS(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function O2t(e){const t=vS(e).replace(/\s+/g," ").trim();return t.length<=PW?t:`${t.slice(0,PW-3).trimEnd()}...`}function $2t(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function C2(e){return e[0]??"blue"}function rM(e){const t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase()}function $W(e,t){const n=e.trim();return t.includes(n)?n:rM(n)}function BW(e){if(e.startsWith("#"))return Ne.groupColorCustom;switch(e){case"red":return Ne.groupColorRed;case"orange":return Ne.groupColorOrange;case"yellow":return Ne.groupColorYellow;case"green":return Ne.groupColorGreen;case"blue":return Ne.groupColorBlue;case"purple":return Ne.groupColorPurple}}function B2t(e){return e.startsWith("#")?{backgroundColor:e}:void 0}function R3(e){return Math.min(uce,Math.max(C2t,e))}function z2t(e){return Math.min(uce,Math.max(dce,e))}function F2t(){if(typeof window>"u")return S2;try{const e=window.localStorage.getItem(cce),t=e?Number(e):S2;return Number.isFinite(t)?R3(t):S2}catch{return S2}}function zW(e){try{window.localStorage.setItem(cce,String(R3(e)))}catch{}}function H2t(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v14M5 12h14"})})}function q2t(){return l.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:l.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 FW({expanded:e}){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?l.jsx("path",{d:"m6 9 6 6 6-6"}):l.jsx("path",{d:"m9 6 6 6-6 6"})})}function U2t({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenPlugins:s,onOpenDaemonStatus:r,onOpenScheduledTasks:i,onOpenGoals:o,onOpenSessions:a,canOpenSessionsOverview:c,onOpenSplitView:u,canOpenSplitView:d,onNewSession:h,onLoadSession:m,onSelectCurrentSession:p,onError:g,theme:b,onThemeChange:x,mobileOpen:y,sessionListReloadToken:v,selectedWorkspaceCwd:w,onSelectWorkspace:k,onOpenGitDiff:T,onOpenAddWorkspace:C,workspaces:_,lockedWorkspaceCwd:S,lockedWorkspace:D,branding:E,primaryNav:B,hideProjectHeader:I,sessionActions:L,footer:O}){var fk,mk,iy,oy,Bd,pk,gk,rp,nf,dr,vu,cg,ay,ly,zd,ip,sf,rf,ug,op,dg,mc;const{t:A}=at(),$=xa(),q=Ib(),U=Vo(),H=la(),M=f.useMemo(()=>new Set(O===!1?[]:(O==null?void 0:O.items)??I2t),[O]),ee=f.useMemo(()=>new Set((B==null?void 0:B.items)??R2t),[B==null?void 0:B.items]),V=f.useMemo(()=>new Set((L==null?void 0:L.items)??D2t),[L==null?void 0:L.items]),R=f.useMemo(()=>new Set((L==null?void 0:L.inlineItems)??L2t),[L==null?void 0:L.inlineItems]),re=E!==!1&&!(y&&((E==null?void 0:E.hideWhenCompact)??!0)),Z=!!((mk=(fk=$.capabilities)==null?void 0:fk.features)!=null&&mk.includes(_9)),K=!!((oy=(iy=$.capabilities)==null?void 0:iy.features)!=null&&oy.includes("session_archive")),Y=!!((pk=(Bd=$.capabilities)==null?void 0:Bd.features)!=null&&pk.includes("workspace_qualified_rest_core")),ae=f.useMemo(()=>{var W;return _??((W=H.capabilities)==null?void 0:W.workspaces)??[]},[_,(gk=H.capabilities)==null?void 0:gk.workspaces]),le=ae.length>0||((rp=H.capabilities)==null?void 0:rp.workspaces)!==void 0||((nf=$.capabilities)==null?void 0:nf.workspaces)!==void 0,te=((dr=ae.find(W=>W.primary))==null?void 0:dr.cwd)??((vu=H.capabilities)==null?void 0:vu.workspaceCwd)??$.workspaceCwd,z=S?ae.find(W=>W.cwd===S):void 0,X=!S||(z==null?void 0:z.primary)===!0,{sessions:fe,loading:xe,error:ie,data:Ce,reload:Ke,deleteSession:ut,exportSession:Et,archiveSession:st}=W2({autoLoad:!0,enabled:X,pageSize:oh,archiveState:"active",...Z?{view:"organized",group:"all"}:{}}),xt=!Z||!X||Ce!==void 0,{sessions:He,reload:pn}=W2({autoLoad:Z,enabled:Z&&X,pageSize:oh,archiveState:"active",view:"organized",group:"pinned"}),[Yt,It]=f.useState(!1),[me,$e]=f.useState(!0),[yt,Me]=f.useState([]),{sessions:Le,loading:vn,error:ge,reload:Rt,deleteSession:ht,unarchiveSession:gn}=W2({autoLoad:!0,enabled:K&&Yt&&X,pageSize:oh,archiveState:"archived",...Z?{view:"organized",group:"all"}:{}}),[Ue,De]=f.useState([]),[Re,be]=f.useState(!1),[Ie,ne]=f.useState(!1),[Ee,qe]=f.useState(0),[Je,Qe]=f.useState([]),[cn,Kn]=f.useState([]),[_e,ft]=f.useState([]),[$t,pe]=f.useState(!1),[Be,ue]=f.useState(null),[Wt,Bt]=f.useState(""),[hn,gt]=f.useState(()=>new Set),Ae=f.useRef(new Set),[kn,Dn]=f.useState(()=>new Set),qn=f.useRef(new Set),[ir,Qn]=f.useState(!1),jr=f.useRef(!1),[es,Gn]=f.useState(null),[Dt,ps]=f.useState(null),[is,os]=f.useState(null),[ts,Wn]=f.useState(""),[ds,Sn]=f.useState("blue"),[ui,Ur]=f.useState(Bg),[lr,Cs]=f.useState(null),[js,Ii]=f.useState(()=>new Set(Array.from(ND()).filter(RW))),Jr=f.useRef(new Set),ve=f.useRef(!0),[ze,lt]=f.useState(!Z),[_t,Xt]=f.useState(Z);_t!==Z&&(Xt(Z),lt(!Z));const[rs,fs]=f.useState(F2t),[gs,Ps]=f.useState(!1),[mr,Ri]=f.useState(!0),[si,cr]=f.useState(!1),[Jn,Ln]=f.useState(null),[Vn,Hi]=f.useState(null),[Di,Mo]=f.useState(!1),ns=f.useRef(!1),Rr=f.useRef(!1),[pr,Cr]=f.useState(!1),[Fe,xn]=f.useState(0),[kt,ms]=f.useState(null),In=f.useCallback(()=>{xn(W=>W+1)},[]);f.useEffect(()=>(ns.current=!0,()=>{ns.current=!1,Rr.current=!0}),[]);const[we,We]=f.useState(""),[St,fn]=f.useState(!1),[Ct,$n]=f.useState(()=>new Set),as=f.useRef(null),Rs=f.useRef(!1),ki=f.useRef(null),zs=f.useRef(null),Yn=f.useRef(!1),or=f.useRef(null),ur=$.sessionId,Dr=!!((ay=(cg=$.capabilities)==null?void 0:cg.features)!=null&&ay.includes("workspace_runtime_removal")),ri=((zd=(ly=$.capabilities)==null?void 0:ly.features)==null?void 0:zd.includes("session_export"))??!1,ua=((sf=(ip=$.capabilities)==null?void 0:ip.features)==null?void 0:sf.includes("workspace_session_export"))??!1,Ya=((ug=(rf=$.capabilities)==null?void 0:rf.features)==null?void 0:ug.includes("workspace_archived_session_export"))??!1,go=ur?zg(ur,$.workspaceCwd||te):null,Xa=P2t($.workspaceCwd)||A("sidebar.projectFallback"),di=f.useMemo(()=>{const W=ae.length>0?ae:[{id:"primary",cwd:$.workspaceCwd||Xa,primary:!0,trusted:!0}];return S?W.filter(Te=>Te.cwd===S):W},[$.workspaceCwd,S,Xa,ae]),se=f.useMemo(()=>{const W=new Map;for(const Te of[...X?He:[],...yt])W.set(zg(Te.sessionId,Te.workspaceCwd||te),Te);return[...W.values()]},[X,te,He,yt]),de=f.useCallback(W=>{const Te=W.workspaceCwd,Oe=Te||te||"",Ge=ae.find(mt=>mt.cwd===Oe);return Te&&!Ge?!le&&Oe===te?{kind:"primary",cwd:Oe}:{kind:"unknown",cwd:Oe}:Ge&&!Ge.trusted?{kind:"untrusted",cwd:Oe,workspace:Ge}:Ge!=null&&Ge.primary||!Te&&Oe===te?{kind:"primary",cwd:Oe}:Ge?S===Oe?{kind:"locked",cwd:Oe,workspace:Ge}:{kind:"restricted",cwd:Oe,workspace:Ge}:{kind:"unknown",cwd:Oe}},[S,te,le,ae]),Ve=f.useCallback(W=>de(W).cwd,[de]),et=f.useCallback(W=>W.kind==="primary"||W.kind==="locked",[]),Cn=f.useCallback(W=>W.kind==="primary"||W.kind==="locked"&&Y,[Y]),Lt=f.useCallback(W=>!et(de(W)),[et,de]),Rn=f.useCallback(W=>{const Te=de(W);if(Te.kind==="primary")return U;if(Te.kind==="locked")return H.client.workspaceByCwd(Te.cwd)},[de,H.client,U]),Pn=f.useCallback(W=>zg(W.sessionId,Ve(W)),[Ve]),bs=f.useCallback(W=>go===Pn(W),[go,Pn]),Fs=f.useCallback(W=>V.has("rename")&&bs(W)&&et(de(W)),[bs,et,de,V]),Ts=f.useCallback(W=>V.has("delete")&&Cn(de(W)),[Cn,de,V]),gr=f.useCallback(W=>!bs(W)&&Ts(W),[Ts,bs]),Ns=f.useCallback((W,Te)=>Z&&V.has(Te)&&Cn(de(W)),[Cn,Z,de,V]),qi=f.useCallback(W=>de({sessionId:"",workspaceCwd:W}),[de]),ys=f.useCallback(W=>Z&&V.has("group")&&Cn(qi(W)),[Cn,Z,qi,V]),Go=f.useRef(null);Go.current={canOrganizeSession:Ns,getSessionWorkspaceActions:Rn,resolveWorkspaceScope:qi};const Tr=f.useCallback(W=>{const Te=de(W);return Te.kind==="unknown"||Te.kind==="untrusted"?!1:K&&(Te.kind==="primary"||Y)},[de,K,Y]),vt=f.useCallback(W=>{const Te=de(W);if(Te.kind==="primary"&&ri||Te.kind==="locked"&&ua)return Te},[ri,ua,de]),Ye=f.useCallback(W=>{const Te=de(W);return Ya&&Te.kind!=="unknown"&&Te.kind!=="untrusted"?Te.cwd:void 0},[Ya,de]),Ht=f.useCallback(W=>V.has("archive")&&!bs(W)&&Tr(W),[Tr,bs,V]),zt=f.useCallback(W=>V.has("archive")&&Tr(W),[Tr,V]);f.useEffect(()=>{if(!Z){Me([]);return}const W=di.filter(Oe=>!Oe.primary&&Oe.trusted);let Te=!1;return Promise.allSettled(W.map(async Oe=>(await H.client.workspaceByCwd(Oe.cwd).listWorkspaceSessions({pageSize:oh,archiveState:"active",view:"organized",group:"pinned"})).map(mt=>({...mt,workspaceCwd:Oe.cwd})))).then(Oe=>{Te||Me(Oe.flatMap(Ge=>Ge.status==="fulfilled"?Ge.value:[]))}),()=>{Te=!0}},[di,Z,H.client,Fe]);const qt=f.useMemo(()=>{const W=new Map;for(const Te of[...X?Le:[],...Ue])W.set(Pn(Te),Te);return[...W.values()]},[Le,Pn,X,Ue]),Fn=X&&vn||Re,Bn=X&&!!ge||Ie;f.useEffect(()=>{if(!Yt)return;if(!K||!Y){De([]),be(!1),ne(!1);return}const W=di.filter(Oe=>!Oe.primary&&Oe.trusted);if(W.length===0){De([]),be(!1),ne(!1);return}let Te=!1;return be(!0),Promise.allSettled(W.map(async Oe=>(await H.client.workspaceByCwd(Oe.cwd).listWorkspaceSessions({pageSize:oh,archiveState:"archived",...Z?{view:"organized",group:"all"}:{}})).map(mt=>({...mt,workspaceCwd:Oe.cwd})))).then(Oe=>{if(Te)return;const Ge=Oe.filter(mt=>mt.status==="rejected");De(Oe.flatMap(mt=>mt.status==="fulfilled"?mt.value:[])),ne(Ge.length>0);for(const mt of Ge)console.warn("[WebShellSidebar] archived session load failed:",mt.reason)}).finally(()=>{Te||be(!1)}),()=>{Te=!0}},[Yt,di,Z,Ee,K,H.client,Y,Fe]);const Ms=((op=$.capabilities)==null?void 0:op.qwenCodeVersion)||"",Lr=Ms?/^\d/.test(Ms)?`v${Ms}`:Ms:"",Io=!e&&rs<T2t,_i=!e&&rs<E2t,ls={"--web-shell-sidebar-width":`${rs}px`},Ss=ir;f.useEffect(()=>{var Oe;if(!ur)return;const W=di.find(Ge=>Ge.cwd===$.workspaceCwd)??(di.length===1&&((Oe=di[0])!=null&&Oe.primary)?di[0]:void 0);if(!W)return;const Te=`session:${ur}:${W.id}`;zs.current!==Te&&(zs.current=Te,Ri(!0),W.primary?Ps(!0):ms({id:W.id,key:Te}))},[$.workspaceCwd,ur,di]),f.useEffect(()=>{if(ur||w!==void 0||!H.capabilities)return;const W=ae.find(Oe=>Oe.cwd===$.workspaceCwd),Te=`new:${(W==null?void 0:W.id)??"primary"}`;if(zs.current!==Te){if(zs.current=Te,Ri(!0),W&&!W.primary){Ps(!1),ms({id:W.id,key:Te}),k==null||k(W.cwd);return}Ps(!0)}},[$.workspaceCwd,ur,k,w,H.capabilities,ae]);const Xs=f.useCallback((W,Te,Oe)=>{const Ge=zg(W,Oe||te),mt=new Set(Ae.current);Te?mt.add(Ge):mt.delete(Ge),Ae.current=mt,gt(mt)},[te]),xr=f.useCallback(async()=>{if(!Z){Qe([]),ft([]),lt(!0);return}try{const W=await U.listSessionGroups();Qe(W.groups),Kn(W.groups),ft(W.colorOptions),lt(!0)}catch(W){g(W,A("sidebar.groupsLoadFailed"))}},[g,Z,A,U]);f.useEffect(()=>{if(!Z){Qe([]),ft([]),lt(!0);return}lt(!1),xr()},[Z,xr]),f.useEffect(()=>{if(!Dt)return;const W=Oe=>{var Ge;(Ge=as.current)!=null&&Ge.contains(Oe.target)||ps(null)},Te=Oe=>{Oe.key==="Escape"&&ps(null)};return document.addEventListener("mousedown",W),document.addEventListener("keydown",Te),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("keydown",Te)}},[Dt]),f.useEffect(()=>{if(!Dt)return;const W=window.requestAnimationFrame(()=>{var Ge;const Te=Array.from(((Ge=as.current)==null?void 0:Ge.querySelectorAll("button:not(:disabled)"))??[]),Oe=Te.find(mt=>mt.getAttribute("aria-checked")==="true")??Te[0];Oe==null||Oe.focus()});return()=>window.cancelAnimationFrame(W)},[Dt]);const Ta=f.useCallback(W=>{var jn,Tn;const Te=Array.from(((jn=as.current)==null?void 0:jn.querySelectorAll("button:not(:disabled)"))??[]);if(Te.length===0)return;const Oe=Te.indexOf(document.activeElement),Ge=Oe>=0?Oe:-1;let mt;if(W.key==="ArrowDown")mt=(Ge+1)%Te.length;else if(W.key==="ArrowUp")mt=(Ge-1+Te.length)%Te.length;else if(W.key==="Home")mt=0;else if(W.key==="End")mt=Te.length-1;else if(W.key==="Escape"){W.preventDefault(),ps(null);return}mt!==void 0&&(W.preventDefault(),(Tn=Te[mt])==null||Tn.focus())},[]);f.useEffect(()=>()=>{var W;(W=or.current)==null||W.call(or,!1)},[]),f.useEffect(()=>{e&&(Ps(!1),cr(!1),We(""))},[e]);const hc=f.useMemo(()=>fe.some(W=>W.hasActivePrompt),[fe]);f.useEffect(()=>{if(!gs&&!hc)return;const W=hc&&!ie?j2t:N2t,Te=window.setInterval(()=>{document.hidden||Yn.current||(Yn.current=!0,Ke().finally(()=>{Yn.current=!1}))},W);return()=>window.clearInterval(Te)},[ie,hc,gs,Ke]);const Ji=f.useRef(v);f.useEffect(()=>{v!==void 0&&v!==Ji.current&&!document.hidden&&!Yn.current&&(Ji.current=v,Yn.current=!0,Ke().finally(()=>{Yn.current=!1}))},[v,Ke]),f.useEffect(()=>{const W=new Map(fe.map(Oe=>[Pn(Oe),!!Oe.hasActivePrompt])),Te=ki.current;ki.current=W,Te!==null&&$n(Oe=>{const Ge=new Set(Oe);let mt=!1;for(const[jn,Tn]of Te){const On=W.get(jn);Tn&&On===!1&&jn!==go&&!Ge.has(jn)&&(Ge.add(jn),mt=!0)}for(const jn of Ge)(jn===go||!W.has(jn)||W.get(jn))&&(Ge.delete(jn),mt=!0);return mt?Ge:Oe})},[go,Pn,fe]);const Uc=f.useCallback(async W=>{var Te;if(ns.current){w===W.cwd&&(k==null||k(void 0)),xn(Oe=>Oe+1);try{await((Te=H.refreshCapabilities)==null?void 0:Te.call(H))}catch{}ns.current&&(Ln(null),Hi(null),Cr(!1),Ke().catch(()=>{}),Rt().catch(()=>{}))}},[k,Ke,Rt,w,H]),Id=f.useCallback(W=>{Di||(Rr.current=!1,Hi(null),Cr(!1),Ln(W))},[Di]),tp=f.useCallback(async()=>{const W=Jn;if(!W||Di)return;const Te=Vn!==null;if(!(Te&&$.sessionId&&$.workspaceCwd===W.cwd)){Mo(!0);try{await U.removeWorkspace(W.id,{force:Te}),await Uc(W)}catch(Oe){if(!ns.current)return;if(Oe instanceof ic){const Ge=Oe.body;if(Oe.status===409&&(Ge==null?void 0:Ge.code)==="workspace_busy"&&Ge.activity){Hi(Ge.activity);return}if(Oe.status===400&&(Ge==null?void 0:Ge.code)==="workspace_mismatch"){await Uc(W);return}if(Oe.status===409&&((Ge==null?void 0:Ge.code)==="workspace_removal_in_progress"||(Ge==null?void 0:Ge.code)==="workspace_registration_in_progress")){Cr(!0);let mt=Oe,jn=!0;for(let Tn=0;Tn<20;Tn++){if(!ns.current||Rr.current||(await new Promise(On=>window.setTimeout(On,250)),!ns.current||Rr.current))return;try{await U.removeWorkspace(W.id,{force:Te}),await Uc(W);return}catch(On){if(!ns.current)return;if(mt=On,On instanceof ic){const Hn=On.body;if(On.status===400&&(Hn==null?void 0:Hn.code)==="workspace_mismatch"){await Uc(W);return}if(On.status===409&&(Hn==null?void 0:Hn.code)==="workspace_busy"&&Hn.activity){Cr(!1),Hi(Hn.activity);return}if(On.status===409&&((Hn==null?void 0:Hn.code)==="workspace_removal_in_progress"||(Hn==null?void 0:Hn.code)==="workspace_registration_in_progress"))continue}jn=!1;break}}if(!ns.current||Rr.current)return;Cr(!1),g(jn?new Error("Workspace removal remained in progress after retries."):mt,A("sidebar.removeWorkspaceError"));return}}g(Oe,A("sidebar.removeWorkspaceError"))}finally{ns.current&&Mo(!1)}}},[$.sessionId,$.workspaceCwd,g,Uc,A,U,Vn,Jn,Di]),Z0=f.useCallback(W=>{jr.current||(jr.current=!0,Qn(!0),(async()=>{try{await h(W)&&(Ke().catch(()=>{}),In())}catch(Te){OW(Te)||g(Te,A("sidebar.newSessionFailed"))}finally{jr.current=!1,Qn(!1)}})())},[In,g,h,Ke,A]),Rd=f.useCallback((W,Te)=>{const Oe=zg(W,Te||te);if(Oe===go){p==null||p();return}Ae.current.has(Oe)||($n(Ge=>{if(!Ge.has(Oe))return Ge;const mt=new Set(Ge);return mt.delete(Oe),mt}),Xs(W,!0,Te),(async()=>{try{await m(W,Te)}catch(Ge){OW(Ge)||g(Ge,A("sidebar.switchFailed"))}finally{Xs(W,!1,Te)}})())},[go,g,m,p,te,Xs,A]),Qa=f.useCallback(W=>{Fs(W)&&(ue(Pn(W)),Bt(vS(W)))},[Fs,Pn]),Ja=f.useCallback(()=>{ue(null),Bt("")},[]);f.useEffect(()=>{const W=ur?{sessionId:ur,workspaceCwd:$.workspaceCwd}:void 0;Be!==null&&(!W||Be!==go||!Fs(W))&&Ja()},[Fs,Ja,$.workspaceCwd,ur,go,Be]);const eg=f.useCallback(()=>{const W=Wt.trim();if(!W||!ur||Be!==go||!Fs({sessionId:ur,workspaceCwd:$.workspaceCwd})){Ja();return}const Te=ur,Oe=go;!Oe||Ae.current.has(Oe)||(Xs(Te,!0,$.workspaceCwd),q.renameSession(W).then(()=>{Ja(),Ke(),In()}).catch(Ge=>{g(Ge,A("sidebar.renameFailed")),Ja()}).finally(()=>{Xs(Te,!1,$.workspaceCwd)}))},[q,In,Fs,Ja,$.workspaceCwd,go,ur,Wt,Be,g,Ke,Xs,A]),Jh=f.useCallback(W=>{gr(W)&&Gn(W)},[gr]),Dd=f.useCallback((W,Te,Oe)=>{const Ge=zg(W,Oe||te),mt=new Set(qn.current);Te?mt.add(Ge):mt.delete(Ge),qn.current=mt,Dn(mt)},[te]),Zh=f.useCallback(W=>{const Te=W.sessionId,Oe=Pn(W),Ge=W.isArchived===!0,mt=vt(W);!V.has("export")||(Ge?!Ye(W):!mt)||qn.current.has(Oe)||(Dd(Te,!0,W.workspaceCwd),(async()=>{try{let jn;if(Ge){const Hn=Ye(W);if(!Hn)return;jn=await H.client.workspaceByCwd(Hn).exportArchivedSession(Te,{format:"html"})}else if((mt==null?void 0:mt.kind)==="primary")jn=await Et(Te,"html");else if((mt==null?void 0:mt.kind)==="locked")jn=await H.client.workspaceByCwd(mt.cwd).exportSession(Te,{format:"html"});else return;const Tn=new Blob([jn.content],{type:jn.mimeType||"text/html"}),On=URL.createObjectURL(Tn);try{const Hn=document.createElement("a");Hn.href=On,Hn.download=jn.filename,document.body.appendChild(Hn),Hn.click(),Hn.remove()}finally{URL.revokeObjectURL(On)}}catch(jn){g(jn,A("sidebar.exportFailed"))}finally{Dd(Te,!1,W.workspaceCwd)}})())},[Et,vt,Ye,Pn,g,Dd,V,A,H.client]),tg=f.useCallback(()=>{if(!es)return;const W=es.sessionId,Te=Pn(es);if(!gr(es)){Gn(null);return}const Oe=de(es),Ge=!!es.isArchived,mt=Oe.kind==="locked"?async jn=>{const On=(await H.client.workspaceByCwd(Oe.cwd).deleteSessionsData([jn])).errors.find(Hn=>Hn.sessionId===jn);if(On)throw new Error(On.error)}:Oe.kind==="primary"?Ge?ht:ut:void 0;Gn(null),mt&&(Ae.current.has(Te)||(Xs(W,!0,es.workspaceCwd),mt(W).then(()=>{Ke(),Rt(),In()}).catch(jn=>g(jn,A("sidebar.deleteFailed"))).finally(()=>{Xs(W,!1,es.workspaceCwd)})))},[In,gr,ht,es,ut,Pn,g,Ke,Rt,de,Xs,A,H.client]),ng=f.useCallback(W=>{bs(W)&&Qa(W)},[bs,Qa]),sg=f.useCallback(()=>{ys()&&(ps(null),Wn(""),Sn(C2(_e)),Ur(Bg),os({mode:"create"}))},[ys,_e]),np=f.useCallback(W=>{ys(W)&&(async()=>{try{const Te=await H.client.workspaceByCwd(W).listSessionGroups();ps(null),Wn(""),Sn(C2(Te.colorOptions)),Ur(Bg),os({mode:"create",workspaceCwd:W})}catch(Te){g(Te,A("sidebar.groupsLoadFailed"))}})()},[ys,g,A,H.client]),ik=f.useCallback(W=>{Ns(W,"group")&&(ps(null),Wn(""),Sn(C2(_e)),Ur(Bg),os({mode:"create",targetSession:W,workspaceCwd:W.workspaceCwd}))},[Ns,_e]),Nl=f.useCallback((W,Te)=>{ys(Te)&&(Wn(W.name),Sn(W.color),Ur(rM(W.color)??Bg),os({mode:"edit",group:W,workspaceCwd:Te}))},[ys]),Ld=f.useCallback(()=>{$t||(os(null),Wn(""),Sn(C2(_e)),Ur(Bg))},[_e,$t]),ok=f.useCallback(()=>{if(!is)return;if(!ys(is.workspaceCwd)||is.targetSession&&!Ns(is.targetSession,"group")){Ld();return}const W=ts.trim(),Te=$W(ds,_e.length>0?_e:Fg);!W||!Te||(async()=>{pe(!0);const Oe=Ge=>{os(null),Wn(""),is.workspaceCwd?In():xr().catch(()=>{}),g(Ge,A("sidebar.groupAssignFailedAfterCreate"))};try{const Ge=qi(is.workspaceCwd),mt=Ge.kind==="primary"?U:Ge.kind==="locked"?H.client.workspaceByCwd(Ge.cwd):void 0;if(!mt)return;const jn=is.mode==="create"?await mt.createSessionGroup({name:W,color:Te}):await mt.updateSessionGroup(is.group.id,{name:W,color:Te});if(is.mode==="create"&&is.targetSession)try{const Tn=Go.current,On=Tn==null?void 0:Tn.resolveWorkspaceScope(is.targetSession.workspaceCwd);if(!Tn||!On||!Tn.canOrganizeSession(is.targetSession,"group")||On.kind!==Ge.kind||On.cwd!==Ge.cwd){Oe(new Error(A("sidebar.groupAssignFailedAfterCreate")));return}const Hn=Tn.getSessionWorkspaceActions(is.targetSession);if(!Hn){Oe(new Error(A("sidebar.groupAssignFailedAfterCreate")));return}await Hn.updateSessionOrganization(is.targetSession.sessionId,{groupId:jn.id,color:null}),is.workspaceCwd||Ke().catch(()=>{}),In()}catch(Tn){Oe(Tn);return}os(null),Wn(""),is.workspaceCwd?In():xr().catch(()=>{})}catch(Ge){g(Ge,is.mode==="create"?A("sidebar.groupCreateFailed"):A("sidebar.groupUpdateFailed"))}finally{pe(!1)}})()},[In,_e,ds,is,ts,Ns,ys,Ld,g,Ke,xr,qi,A,U,H.client]),rg=f.useCallback((W,Te)=>{ys(Te)&&Cs({group:W,workspaceCwd:Te})},[ys]),ty=f.useCallback(()=>{if(!lr)return;if(!ys(lr.workspaceCwd)){Cs(null);return}pe(!0);const W=qi(lr.workspaceCwd),Te=W.kind==="primary"?U:W.kind==="locked"?H.client.workspaceByCwd(W.cwd):void 0;if(!Te){pe(!1);return}Te.deleteSessionGroup(lr.group.id).then(()=>{Cs(null),lr.workspaceCwd?In():Ke().catch(()=>{})}).catch(Oe=>g(Oe,A("sidebar.groupDeleteFailed"))).then(()=>lr.workspaceCwd?void 0:xr().catch(()=>{})).finally(()=>pe(!1))},[lr,ys,g,Ke,xr,A,In,qi,H.client,U]);f.useEffect(()=>{es&&!gr(es)&&Gn(null)},[gr,es]),f.useEffect(()=>{Dt&&!Ns(Dt.session,"group")&&ps(null)},[Ns,Dt]),f.useEffect(()=>{is&&(!ys(is.workspaceCwd)||is.targetSession&&!Ns(is.targetSession,"group"))&&(os(null),Wn(""))},[Ns,ys,is]),f.useEffect(()=>{lr&&!ys(lr.workspaceCwd)&&Cs(null)},[ys,lr]);const sp=f.useCallback(W=>{const Te=W.sessionId,Oe=Pn(W);if(!Ns(W,"pin")||Ae.current.has(Oe))return;Xs(Te,!0,W.workspaceCwd);const Ge=Rn(W);if(!Ge){Xs(Te,!1,W.workspaceCwd);return}Ge.updateSessionOrganization(Te,{isPinned:!W.isPinned}).then(()=>{Ke().catch(()=>{}),pn().catch(()=>{}),In()}).catch(mt=>g(mt,A("sidebar.organizationFailed"))).finally(()=>{Xs(Te,!1,W.workspaceCwd)})},[In,Pn,Rn,g,Ns,Ke,pn,Xs,A]),ef=f.useCallback(W=>{const Te=W.sessionId,Oe=Pn(W);Ht(W)&&(Ae.current.has(Oe)||(Xs(Te,!0,W.workspaceCwd),(async()=>{try{const Ge=de(W);if(Ge.kind==="locked"||Ge.kind==="restricted"){const jn=(await H.client.workspaceByCwd(Ge.cwd).archiveSessionsData([Te])).errors.find(Tn=>Tn.sessionId===Te);jn&&g(new Error(jn.error),A("sidebar.archiveFailed"))}else if(Ge.kind==="primary")await st(Te);else return}catch(Ge){g(Ge,A("sidebar.archiveFailed"))}finally{Ke().catch(()=>{}),Rt().catch(()=>{}),In(),Xs(Te,!1,W.workspaceCwd)}})()))},[st,In,Ht,Pn,g,Ke,Rt,Xs,A,de,H.client]),ig=f.useCallback(W=>{const Te=W.sessionId,Oe=Pn(W);zt(W)&&(Ae.current.has(Oe)||(Xs(Te,!0,W.workspaceCwd),(async()=>{try{const Ge=de(W);if(Ge.kind==="locked"||Ge.kind==="restricted"){const jn=(await H.client.workspaceByCwd(Ge.cwd).unarchiveSessionsData([Te])).errors.find(Tn=>Tn.sessionId===Te);jn&&g(new Error(jn.error),A("sidebar.unarchiveFailed"))}else if(Ge.kind==="primary")await gn(Te);else return}catch(Ge){g(Ge,A("sidebar.unarchiveFailed"))}finally{Ke().catch(()=>{}),Rt().catch(()=>{}),In(),Xs(Te,!1,W.workspaceCwd)}})()))},[In,zt,Pn,g,Ke,Rt,Xs,A,gn,de,H.client]),og=f.useCallback(async(W,Te)=>{if(!Ns(Te,"group"))return;let Oe=0;try{const Za=Rn(Te);if(!Za)return;const Ci=await Za.listSessionGroups();if(!Ns(Te,"group"))return;Kn(Ci.groups),ft(Ci.colorOptions),Oe=Ci.groups.length}catch(Za){g(Za,A("sidebar.groupsLoadFailed"));return}if(!W.isConnected)return;const Ge=W.getBoundingClientRect(),mt=typeof window>"u"?Ge.right+J7:window.innerWidth,jn=typeof window>"u"?Ge.top+320:window.innerHeight,Tn=Math.min(320,34*(Oe+Fg.length+2)+25),On=Ge.right+$g+J7<=mt?Ge.right+$g:Math.max($g,Ge.left-J7-$g),Hn=Math.max($g,Math.min(Ge.top,jn-Tn-$g));ps({session:Te,top:Hn,left:On})},[Ns,Rn,g,A]),ak=f.useCallback((W,Te)=>{const Oe=W.sessionId,Ge=Pn(W);if(!Ns(W,"group")||Ae.current.has(Ge))return;ps(null),Xs(Oe,!0,W.workspaceCwd);const mt=Rn(W);if(!mt){Xs(Oe,!1,W.workspaceCwd);return}mt.updateSessionOrganization(Oe,{groupId:Te,color:null}).then(()=>{Ke().catch(()=>{}),In()}).catch(jn=>g(jn,A("sidebar.organizationFailed"))).finally(()=>{Xs(Oe,!1,W.workspaceCwd)})},[In,Pn,Rn,g,Ns,Ke,Xs,A]),ny=f.useCallback((W,Te)=>{const Oe=W.sessionId,Ge=Pn(W);if(!Ns(W,"group")||Ae.current.has(Ge))return;ps(null),Xs(Oe,!0,W.workspaceCwd);const mt=Rn(W);if(!mt){Xs(Oe,!1,W.workspaceCwd);return}mt.updateSessionOrganization(Oe,{color:Te,groupId:null}).then(()=>{Ke().catch(()=>{}),In()}).catch(jn=>g(jn,A("sidebar.organizationFailed"))).finally(()=>{Xs(Oe,!1,W.workspaceCwd)})},[In,Pn,Rn,g,Ns,Ke,Xs,A]),Pd=f.useMemo(()=>{const W=we.trim().toLowerCase(),Te=fe.filter(mt=>!mt.isPinned),Oe=W?Te.filter(mt=>vS(mt).toLowerCase().includes(W)||mt.sessionId.toLowerCase().includes(W)):Te.slice();if(Z)return Oe;const Ge=new Map(Oe.map(mt=>[mt.sessionId,$2t(mt)]));return Oe.sort((mt,jn)=>(Ge.get(jn.sessionId)??0)-(Ge.get(mt.sessionId)??0))},[Z,we,fe]),Od=f.useMemo(()=>{if(!Z)return[];const W=we.trim().length>0,Te=new Set(Je.map(Tn=>Tn.id)),Oe=new Map,Ge=new Map;for(const Tn of Je)Ge.set(Tn.id,[]);const mt=[];for(const Tn of Pd){if(Tn.color&&Fg.includes(Tn.color)){const Hn=Oe.get(Tn.color)??[];Hn.push(Tn),Oe.set(Tn.color,Hn);continue}const On=Tn.groupId&&Te.has(Tn.groupId)?Ge.get(Tn.groupId):void 0;On?On.push(Tn):mt.push(Tn)}const jn=[];for(const Tn of Fg){const On=Oe.get(Tn);!On||On.length===0||jn.push({id:`color:${Tn}`,kind:"color",label:A(`sidebar.groupColor.${Tn}`),countLabel:String(On.length),color:Tn,sessions:On})}for(const Tn of Je){const On=Ge.get(Tn.id)??[];W&&On.length===0||jn.push({id:`group:${Tn.id}`,kind:"group",label:Tn.name,countLabel:String(On.length),color:Tn.color,group:Tn,sessions:On})}return mt.length>0&&jn.length>0&&jn.push({id:M2t,kind:"recent",label:A("sidebar.groupUngrouped"),countLabel:String(mt.length),sessions:mt}),jn},[Pd,Je,Z,we,A]);f.useEffect(()=>{if(!Z||!ze||!xt)return;const W=Od.map(Oe=>Oe.id).filter(Oe=>!Jr.current.has(Oe));if(ve.current){ve.current=!1;for(const Oe of W)Jr.current.add(Oe);return}if(W.length!==0){for(const Oe of W)Jr.current.add(Oe);Ii(Oe=>{const Ge=new Set(Oe);for(const mt of W)Ge.add(mt);return Ge})}},[ze,Z,Od,xt]),f.useEffect(()=>{lce(js,RW)},[js]);const ag=f.useCallback(W=>{Ii(Te=>{const Oe=new Set(Te);return Oe.has(W)?Oe.delete(W):Oe.add(W),Oe})},[]),Si=f.useCallback(W=>{var Fd;if(e)return;W.preventDefault(),(Fd=or.current)==null||Fd.call(or,!0),fn(!0);const Te=W.clientX,Oe=rs,Ge=document.body.style.cursor,mt=document.body.style.userSelect;let jn=!1,Tn=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{W.currentTarget.setPointerCapture(W.pointerId)}catch{}function On(Ea){return Oe+Ea-Te}function Hn(){const Ea=R3(Oe);fs(Ea),zW(Ea)}function Za(){jn||(jn=!0,Hn(),Tn(!0),t(!0))}function Ci(Ea){const el=On(Ea.clientX);if(el<=LW){Za();return}fs(z2t(el))}Tn=function(el){document.body.style.cursor=Ge,document.body.style.userSelect=mt,window.removeEventListener("pointermove",Ci),window.removeEventListener("pointerup",Vc),window.removeEventListener("pointercancel",Nr),or.current=null,el&&fn(!1)};function Vc(Ea){const el=On(Ea.clientX);if(el<=LW){Za();return}const ap=R3(el);fs(ap),zW(ap),Tn(!0)}function Nr(){Tn(!0)}or.current=Tn,window.addEventListener("pointermove",Ci),window.addEventListener("pointerup",Vc,{once:!0}),window.addEventListener("pointercancel",Nr,{once:!0})},[e,t,rs]),lk=es?O2t(es):"",sy=Dt!=null&&Dt.session.color&&Fg.includes(Dt.session.color)?Dt.session.color:null,ck=!sy&&(Dt!=null&&Dt.session.groupId)&&cn.some(W=>W.id===Dt.session.groupId)?Dt.session.groupId:null,uk=_e.length>0?_e:Fg,lg=ck===null&&sy===null,Wc=(lr==null?void 0:lr.group.name)??"",ry=_e.length>0?_e:["blue"],tf=$W(ds,ry),$d=!ry.includes(ds),JT=ts.trim().length>0&&tf!==void 0&&!$t,dk=(is==null?void 0:is.mode)==="create"?A("sidebar.groupCreate"):A("sidebar.groupRename"),fc=f.useCallback((W,Te={})=>{const{isArchived:Oe=!1}=Te,Ge=Te.readOnly??Lt(W),mt=Pn(W),jn=vS(W),Tn=W.updatedAt||W.createdAt,On=Tn?_3(Tn,A):"",Hn=hn.has(mt),Za=kn.has(mt),Ci=!bs(W)&&Ct.has(mt),Vc=l.jsxs("div",{className:Ne.tooltipContent,children:[l.jsx("div",{className:Ne.tooltipTitle,children:jn}),l.jsxs("div",{className:Ne.tooltipTags,children:[W.hasActivePrompt&&l.jsx("span",{className:Ol(Ne.tooltipTag,Ne.tooltipTagRunning),children:A("sidebar.running")}),Ci&&l.jsx("span",{className:Ol(Ne.tooltipTag,Ne.tooltipTagNew),children:A("sidebar.completedUnread")}),l.jsx("span",{className:Ne.tooltipTag,children:A("sidebar.clients",{count:W.clientCount??0})})]}),l.jsx("div",{className:Ne.tooltipMeta,children:W.sessionId})]});if(Oe){const Er=Ye(W),Zi=V.has("details"),uy=V.has("export")&&!!Er,mg=zt(W),dy=gr(W),hy=Zi||uy||mg||dy;return l.jsxs("div",{className:Ol(Ne.sessionRow,Ne.archivedRow,Hn&&Ne.busySession),children:[l.jsx("span",{className:Ne.sessionText,title:jn,children:jn}),l.jsxs("div",{className:Ne.sessionMetaSlot,children:[l.jsx("span",{className:Ne.sessionTime,children:On}),hy&&l.jsx("div",{className:Ne.sessionActions,onClick:of=>of.stopPropagation(),onKeyDown:of=>of.stopPropagation(),children:l.jsxs(mh,{children:[l.jsx(ph,{asChild:!0,children:l.jsx("button",{className:Ne.sessionActionButton,type:"button","aria-label":A("sidebar.moreActions"),title:A("sidebar.moreActions"),children:l.jsx(qf,{})})}),l.jsx(gh,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Rs.current=!0},onCloseAutoFocus:of=>{Rs.current&&(Rs.current=!1,of.preventDefault())},children:l.jsxs(dm,{children:[Zi&&l.jsxs(zN,{children:[l.jsxs(FN,{children:[l.jsx(vA,{}),A("sidebar.details")]}),l.jsx(HN,{className:"min-w-64 p-3",children:Vc})]}),uy&&l.jsxs(Gi,{disabled:Za,onSelect:()=>Zh(W),children:[l.jsx(N6,{}),A("sidebar.export")]}),mg&&l.jsxs(Gi,{onSelect:()=>ig(W),children:[l.jsx(dge,{}),A("sidebar.unarchive")]}),dy&&l.jsxs(Gi,{variant:"destructive",onSelect:()=>Jh(W),children:[l.jsx(Wp,{}),A("sidebar.delete")]})]})})]})})]})]},mt)}const Nr=bs(W),Fd=Nr&&Be===mt,Ea=!W.isWaitingForPermission&&W.isWaitingForUserQuestion,el=W.isWaitingForPermission?A("sidebar.waitingForApproval"):Ea?A("sidebar.userInputNeeded"):null,ap=!Lt(W),xu=Ns(W,"pin"),Gc=V.has("archive")&&Tr(W),hg=V.has("rename")&&ap,cy=vt(W),fg=V.has("export")&&!!cy,lp=Ts(W);return l.jsx("div",{className:Ol(Ne.sessionRow,Nr&&Ne.currentSession,W.isPinned&&Ne.pinnedSession,W.hasActivePrompt&&Ne.runningSession,Hn&&Ne.busySession),role:"button",tabIndex:0,"aria-current":Nr?"page":void 0,onClick:()=>Rd(W.sessionId,W.workspaceCwd),onDoubleClick:()=>{!e&&Fs(W)&&Qa(W)},onKeyDown:Er=>{Er.key==="Enter"&&Rd(W.sessionId,W.workspaceCwd)},children:!e&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ne.sessionStatusSlot,children:Ci?l.jsx("span",{className:Ne.sessionStatusDot,"aria-hidden":"true"}):null}),Fd&&Fs(W)?l.jsx("form",{className:Ne.renameForm,onClick:Er=>Er.stopPropagation(),onSubmit:Er=>{Er.preventDefault(),eg()},children:l.jsx("input",{autoFocus:!0,className:Ne.renameInput,value:Wt,onChange:Er=>Bt(Er.target.value),onBlur:Ja,onKeyDown:Er=>{Er.key==="Escape"&&(Er.preventDefault(),Ja())}})}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Ne.sessionText,title:jn,children:[W.worktree&&l.jsx(r4,{size:11,strokeWidth:1.5,className:Ne.sessionBadgeIcon,"aria-label":A("sidebar.newWorktreeTask")}),W.branch&&l.jsx(yA,{size:11,strokeWidth:1.5,className:Ne.sessionBadgeIcon,"aria-label":W.branch.name}),jn]}),l.jsxs("div",{className:Ne.sessionMetaSlot,children:[el&&l.jsx("span",{className:Ol(Ne.sessionAttention,Ea&&Ne.sessionAttentionUserInput),"aria-label":el,children:el}),W.hasActivePrompt?l.jsx("span",{className:Ne.sessionLoading,"aria-label":A("sidebar.running")}):el?null:l.jsx("span",{className:Ne.sessionTime,children:On}),Ge&&Gc&&l.jsx("div",{className:Ne.sessionActions,onClick:Er=>Er.stopPropagation(),onKeyDown:Er=>Er.stopPropagation(),children:R.has("archive")?l.jsx("button",{className:Ne.sessionActionButton,type:"button",disabled:Hn||Nr,"aria-label":A("sidebar.archive"),title:A(Nr?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>ef(W),children:l.jsx(l_,{})}):l.jsxs(mh,{children:[l.jsx(ph,{asChild:!0,children:l.jsx("button",{className:Ne.sessionActionButton,type:"button","aria-label":A("sidebar.moreActions"),title:A("sidebar.moreActions"),children:l.jsx(qf,{})})}),l.jsx(gh,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Rs.current=!0},onCloseAutoFocus:Er=>{Rs.current&&(Rs.current=!1,Er.preventDefault())},children:l.jsx(dm,{children:l.jsxs(Gi,{disabled:Hn||Nr,title:Nr?A("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>ef(W),children:[l.jsx(l_,{}),A("sidebar.archive")]})})})]})}),!Ge&&l.jsxs("div",{className:Ne.sessionActions,onClick:Er=>Er.stopPropagation(),onKeyDown:Er=>Er.stopPropagation(),children:[[{key:"pin",icon:l.jsx(u$,{size:16,strokeWidth:1.2}),label:W.isPinned?A("sidebar.unpin"):A("sidebar.pin"),disabled:Hn,active:W.isPinned,visible:xu&&R.has("pin"),onClick:()=>sp(W)},{key:"archive",icon:l.jsx(l_,{size:16,strokeWidth:1.2}),label:A("sidebar.archive"),disabled:Hn||Nr,title:A(Nr?"sidebar.archiveCurrentDisabled":"sidebar.archive"),visible:Gc&&R.has("archive"),onClick:()=>ef(W)},{key:"rename",icon:l.jsx(i4,{size:16,strokeWidth:1.2}),label:A("sidebar.rename"),disabled:!Nr,title:Nr?void 0:A("sidebar.renameCurrentOnly"),visible:hg&&R.has("rename"),onClick:()=>ng(W)},{key:"export",icon:l.jsx(N6,{size:16,strokeWidth:1.2}),label:A("sidebar.export"),disabled:Za,visible:fg&&R.has("export"),onClick:()=>Zh(W)},{key:"delete",icon:l.jsx(Wp,{size:16,strokeWidth:1.2}),label:A("sidebar.delete"),disabled:Nr,destructive:!0,title:Nr?A("sidebar.currentDeleteDisabled"):void 0,visible:lp&&R.has("delete"),onClick:()=>Jh(W)}].filter(Zi=>Zi.visible).map(Zi=>l.jsx("button",{className:Ol(Ne.sessionActionButton,Zi.active&&Ne.activeSessionActionButton),type:"button",disabled:Zi.disabled,"aria-label":Zi.label,title:Zi.title??Zi.label,onClick:Zi.onClick,style:Zi.destructive&&!Zi.disabled?{color:"var(--destructive, #dc2626)"}:void 0,children:Zi.icon??l.jsx("span",{style:{fontSize:12},children:Zi.label})},Zi.key)),xu&&!R.has("pin")||Gc&&!R.has("archive")||V.has("details")||hg&&!R.has("rename")||Ns(W,"group")||fg&&!R.has("export")||lp&&!R.has("delete")?l.jsxs(mh,{children:[l.jsx(ph,{asChild:!0,children:l.jsx("button",{className:Ne.sessionActionButton,type:"button","aria-label":A("sidebar.moreActions"),title:A("sidebar.moreActions"),children:l.jsx(qf,{})})}),l.jsx(gh,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Rs.current=!0},onCloseAutoFocus:Er=>{Rs.current&&(Rs.current=!1,Er.preventDefault())},children:l.jsxs(dm,{children:[xu&&!R.has("pin")&&l.jsxs(Gi,{disabled:Hn,onSelect:()=>sp(W),children:[l.jsx(u$,{}),W.isPinned?A("sidebar.unpin"):A("sidebar.pin")]}),Gc&&!R.has("archive")&&l.jsxs(Gi,{disabled:Hn||Nr,title:Nr?A("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>ef(W),children:[l.jsx(l_,{}),A("sidebar.archive")]}),V.has("details")&&l.jsxs(zN,{children:[l.jsxs(FN,{children:[l.jsx(vA,{}),A("sidebar.details")]}),l.jsx(HN,{className:"min-w-64 p-3",children:Vc})]}),hg&&!R.has("rename")&&l.jsxs(Gi,{disabled:!Nr,title:Nr?void 0:A("sidebar.renameCurrentOnly"),onSelect:()=>ng(W),children:[l.jsx(i4,{}),A("sidebar.rename")]}),Ns(W,"group")&&l.jsxs(Gi,{disabled:Hn,onSelect:Er=>og(Er.currentTarget,W),children:[l.jsx(Wge,{}),A("sidebar.sessionGroup")]}),fg&&!R.has("export")&&l.jsxs(Gi,{disabled:Za,onSelect:()=>Zh(W),children:[l.jsx(N6,{}),A("sidebar.export")]}),lp&&!R.has("delete")&&l.jsxs(Gi,{variant:"destructive",disabled:Nr,title:Nr?A("sidebar.currentDeleteDisabled"):void 0,onSelect:()=>Jh(W),children:[l.jsx(Wp,{}),A("sidebar.delete")]})]})})]}):null]})]})]})]})},mt)},[hn,gr,Ts,Ns,Fs,zt,Tr,Ja,e,Ct,Wt,Be,kn,Ye,vt,Pn,ef,Jh,Zh,Rd,ng,sp,ig,bs,og,eg,V,R,Lt,Qa,A]),hk=f.useMemo(()=>xe&&fe.length===0?l.jsx("div",{className:Ne.notice,children:A("sidebar.loadingSessions")}):ie&&fe.length===0?l.jsx("button",{className:Ne.retry,type:"button",onClick:Ke,children:A("sidebar.loadFailed")}):Pd.length===0&&(we.trim()||!Z||Od.length===0)?l.jsx("div",{className:Ne.notice,children:A("sidebar.searchEmpty")}):Z?Od.length===0?Pd.map(W=>fc(W)):Od.map(W=>{const Te=!js.has(W.id),Oe=W.group;return l.jsx(sM,{id:W.id,label:W.label,count:W.sessions.length,color:W.color,expanded:Te,onToggle:()=>ag(W.id),onRename:W.kind==="group"&&Oe&&ys()?()=>Nl(Oe):void 0,onDelete:W.kind==="group"&&Oe&&ys()?()=>rg(Oe):void 0,renameLabel:A("sidebar.groupRename"),deleteLabel:A("sidebar.groupDelete"),actionsDisabled:$t,children:W.sessions.map(Ge=>fc(Ge))},W.id)}):Pd.map(W=>fc(W)),[js,ys,ie,Pd,$t,rg,Nl,xe,Z,Ke,fc,we,Od,fe.length,A,ag]),ZT=f.useMemo(()=>{if(!K||e||we.trim())return null;const W=l.jsxs("button",{type:"button",className:Ne.archivedHeader,"aria-expanded":Yt,onClick:()=>It(Ge=>!Ge),children:[l.jsx("span",{className:Ne.archivedTitle,style:{flex:"0 1 auto"},children:A("sidebar.archivedTitle")}),l.jsx("span",{className:Ne.archivedChevron,"aria-hidden":"true",children:Yt?l.jsx(wc,{}):l.jsx(cC,{})}),Yt&&qt.length>0&&l.jsx("span",{className:Ne.archivedCount,children:qt.length})]});if(!Yt)return l.jsx("div",{className:Ne.archivedSection,children:W});const Te=l.jsx("button",{className:Ne.retry,type:"button",onClick:()=>{Rt(),qe(Ge=>Ge+1)},children:A("sidebar.loadFailed")});let Oe;return Fn&&qt.length===0?Oe=l.jsx("div",{className:Ne.notice,children:A("sidebar.loadingSessions")}):Bn&&qt.length===0?Oe=Te:qt.length===0?Oe=l.jsx("div",{className:Ne.notice,children:A("sidebar.archivedEmpty")}):Oe=l.jsxs(l.Fragment,{children:[qt.map(Ge=>fc(Ge,{isArchived:!0})),Bn&&Te]}),l.jsxs("div",{className:Ne.archivedSection,children:[W,l.jsx("div",{className:Ne.archivedList,children:Oe})]})},[Yt,qt,e,Bn,Fn,Rt,fc,we,K,qe,A]);return l.jsx(l.Fragment,{children:l.jsxs("aside",{className:Ol(Ne.sidebar,e&&Ne.collapsed,St&&Ne.resizing,y&&Ne.mobileOpen),"aria-label":A("sidebar.label"),style:ls,children:[Dt&&l.jsxs("div",{ref:as,className:Ne.groupMenu,role:"menu","aria-label":A("sidebar.sessionGroup"),style:{top:Dt.top,left:Dt.left},onClick:W=>W.stopPropagation(),onKeyDown:Ta,onMouseDown:W=>W.stopPropagation(),children:[l.jsxs("button",{className:Ol(Ne.groupMenuItem,lg&&Ne.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":lg,onClick:()=>ak(Dt.session,null),children:[l.jsx("span",{className:Ne.groupMenuEmptyDot}),l.jsx("span",{className:Ne.groupMenuName,children:A("sidebar.groupUngrouped")}),lg&&l.jsx("span",{className:Ne.groupMenuCheck,children:"✓"})]}),uk.map(W=>{const Te=sy===W;return l.jsxs("button",{className:Ol(Ne.groupMenuItem,Te&&Ne.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Te,onClick:()=>ny(Dt.session,W),children:[l.jsx("span",{className:Ol(Ne.groupMenuDot,BW(W))}),l.jsx("span",{className:Ne.groupMenuName,children:A(`sidebar.groupColor.${W}`)}),Te&&l.jsx("span",{className:Ne.groupMenuCheck,children:"✓"})]},`color:${W}`)}),cn.map(W=>{const Te=ck===W.id;return l.jsxs("button",{className:Ol(Ne.groupMenuItem,Te&&Ne.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Te,onClick:()=>ak(Dt.session,W.id),children:[l.jsx("span",{className:Ol(Ne.groupMenuDot,BW(W.color)),style:B2t(W.color)}),l.jsx("span",{className:Ne.groupMenuName,children:W.name}),Te&&l.jsx("span",{className:Ne.groupMenuCheck,children:"✓"})]},W.id)}),l.jsx("div",{className:Ne.groupMenuSeparator}),l.jsxs("button",{className:Ne.groupMenuItem,type:"button",role:"menuitem",onClick:()=>ik(Dt.session),children:[l.jsx("span",{className:Ne.groupMenuIcon,children:l.jsx(H2t,{})}),l.jsx("span",{className:Ne.groupMenuName,children:A("sidebar.groupCreate")})]})]}),es&&l.jsx(pi,{title:A("delete.title"),size:"sm",onClose:()=>Gn(null),children:l.jsxs("div",{className:Ne.confirmContent,children:[l.jsx("p",{className:Ne.confirmDescription,children:A("sidebar.deleteConfirmDescription",{name:lk})}),l.jsxs("div",{className:Ne.confirmActions,children:[l.jsx("button",{className:Ne.secondaryButton,type:"button",onClick:()=>Gn(null),children:A("common.cancel")}),l.jsx("button",{className:Ne.dangerButton,type:"button",onClick:tg,children:A("sidebar.delete")})]})]})}),Jn&&l.jsx(pi,{title:A("sidebar.removeWorkspaceTitle"),size:"sm",onClose:()=>{(!Di||pr)&&(Rr.current=!0,Ln(null),Hi(null),Cr(!1))},children:l.jsxs("div",{className:Ne.confirmContent,children:[l.jsx("p",{className:Ne.confirmDescription,children:Vn?A("sidebar.removeWorkspaceBusy",{name:Jn.cwd}):A("sidebar.removeWorkspaceConfirm",{name:Jn.cwd})}),Vn&&l.jsxs("ul",{className:Ne.workspaceRemovalActivityList,children:[l.jsx("li",{children:A("sidebar.removeWorkspaceSessions",{count:Vn.sessions})}),l.jsx("li",{children:A("sidebar.removeWorkspacePrompts",{count:Vn.activePrompts})}),l.jsx("li",{children:A("sidebar.removeWorkspaceStarts",{count:Vn.pendingSessionStarts})}),l.jsx("li",{children:A("sidebar.removeWorkspaceConnections",{count:Vn.acpConnections})}),l.jsx("li",{children:A("sidebar.removeWorkspaceMemoryTasks",{count:Vn.memoryTasks})}),l.jsx("li",{children:A("sidebar.removeWorkspaceWorkers",{count:Vn.channelWorkers})}),l.jsx("li",{children:A("sidebar.removeWorkspaceVoiceSessions",{count:Vn.voiceSessions??0})})]}),Vn&&$.sessionId&&$.workspaceCwd===Jn.cwd&&l.jsx("p",{className:Ne.confirmDescription,children:A("sidebar.removeWorkspaceCurrentSession")}),pr&&l.jsx("p",{className:Ne.confirmDescription,children:A("sidebar.removeWorkspaceInProgress")}),l.jsxs("div",{className:Ne.confirmActions,children:[l.jsx("button",{className:Ne.secondaryButton,type:"button",disabled:Di&&!pr,onClick:()=>{Rr.current=!0,Ln(null),Hi(null),Cr(!1)},children:A("common.cancel")}),l.jsx("button",{className:Ne.dangerButton,type:"button",disabled:Di||pr||Vn!==null&&!!$.sessionId&&$.workspaceCwd===Jn.cwd,onClick:()=>void tp(),children:A(Vn?"sidebar.forceRemoveWorkspace":"sidebar.removeWorkspace")})]})]})}),is&&l.jsx(pi,{title:dk,size:"sm",onClose:Ld,children:l.jsxs("form",{className:"flex flex-col gap-6",onSubmit:W=>{W.preventDefault(),ok()},children:[l.jsxs(H1,{children:[l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"session-group-name",children:A("sidebar.groupNamePrompt")}),l.jsx(qr,{id:"session-group-name",value:ts,autoFocus:!0,maxLength:64,onChange:W=>Wn(W.target.value)})]}),l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"session-group-color",children:A("sidebar.groupColor")}),l.jsxs(kl,{value:$d?Z7:ds,onValueChange:W=>{Sn(W===Z7?ui:W)},children:[l.jsx(Sl,{id:"session-group-color",className:"w-full",children:l.jsx(_l,{})}),l.jsx(Cl,{children:l.jsxs(gse,{children:[ry.map(W=>l.jsx(bi,{value:W,children:A(`sidebar.groupColor.${W}`)},W)),l.jsx(bi,{value:Z7,children:A("sidebar.groupColor.custom")})]})})]})]}),$d&&l.jsxs($i,{children:[l.jsx(vo,{htmlFor:"session-group-hex-color",children:A("sidebar.groupColor.hex")}),l.jsxs("div",{className:Ne.groupCustomColorRow,children:[l.jsx(qr,{className:Ne.groupColorPicker,type:"color",value:ui,"aria-label":A("sidebar.groupColor.picker"),onChange:W=>{const Te=W.target.value.toLowerCase();Ur(Te),Sn(Te)}}),l.jsx(qr,{id:"session-group-hex-color",value:ds,maxLength:7,spellCheck:!1,"aria-invalid":tf===void 0,onChange:W=>{const Te=W.target.value,Oe=Te.trim(),Ge=Oe&&!Oe.startsWith("#")?`#${Oe}`:Te;Sn(Ge);const mt=rM(Ge);mt&&Ur(mt)}})]}),tf===void 0&&l.jsx("span",{className:Ne.groupColorError,role:"alert",children:A("sidebar.groupColor.invalid")})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(An,{type:"button",variant:"outline",disabled:$t,onClick:Ld,children:A("common.cancel")}),l.jsx(An,{type:"submit",disabled:!JT,children:A("common.save")})]})]})}),lr&&l.jsx(pi,{title:A("sidebar.groupDelete"),size:"sm",onClose:()=>{$t||Cs(null)},children:l.jsxs("div",{className:Ne.confirmContent,children:[l.jsx("p",{className:Ne.confirmDescription,children:A("sidebar.groupDeleteConfirm",{name:Wc})}),l.jsxs("div",{className:Ne.confirmActions,children:[l.jsx("button",{className:Ne.secondaryButton,type:"button",disabled:$t,onClick:()=>Cs(null),children:A("common.cancel")}),l.jsx("button",{className:Ne.dangerButton,type:"button",disabled:$t,onClick:ty,children:A("sidebar.groupDelete")})]})]})}),re&&l.jsx("div",{className:Ne.topRow,children:E!=null&&E.render?E.render():l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ne.brandLogo,"aria-hidden":"true",children:l.jsx(q2t,{})}),!e&&l.jsx("span",{className:Ne.brandName,children:"Qwen Code"})]})}),l.jsxs("div",{className:Ne.primaryNav,children:[ee.has("newTask")&&l.jsxs("button",{className:Ne.newChatButton,type:"button",title:A("sidebar.newTask"),"aria-label":A("sidebar.newTask"),disabled:Ss,onClick:()=>Z0(),children:[l.jsx("span",{className:Ne.navIcon,children:l.jsx(d$,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:A("sidebar.newTask")})]}),ee.has("plugins")&&l.jsxs("button",{className:Ne.pluginButton,type:"button",title:A("sidebar.plugins"),"aria-label":A("sidebar.plugins"),onClick:s,children:[l.jsx("span",{className:Ne.navIcon,children:l.jsx(pge,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:A("sidebar.plugins")})]}),ee.has("scheduledTasks")&&l.jsxs("button",{className:Ne.pluginButton,type:"button",title:A("sidebar.scheduledTasks"),"aria-label":A("sidebar.scheduledTasks"),onClick:i,children:[l.jsx("span",{className:Ne.navIcon,children:l.jsx(xge,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:A("sidebar.scheduledTasks")})]}),ee.has("goals")&&l.jsxs("button",{className:Ne.pluginButton,type:"button",title:A("sidebar.goals"),"aria-label":A("sidebar.goals"),onClick:o,children:[l.jsx("span",{className:Ne.navIcon,children:l.jsx(z1e,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:A("sidebar.goals")})]}),(dg=B==null?void 0:B.render)==null?void 0:dg.call(B)]}),l.jsx("div",{className:Ne.body,children:l.jsxs("div",{className:Ne.sessionList,children:[!e&&se.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Ne.projectsHeader,children:l.jsxs("button",{className:Ne.projectsHeaderToggle,type:"button","aria-expanded":me,onClick:()=>$e(W=>!W),children:[l.jsx("span",{children:A("sidebar.pinnedSessions")}),l.jsx(FW,{expanded:me})]})}),me&&l.jsx("div",{className:Ne.pinnedSessionList,children:se.map(W=>fc(W,{readOnly:Lt(W)}))})]}),!e&&!I&&l.jsxs("div",{className:Ne.projectsHeader,children:[l.jsxs("button",{className:Ne.projectsHeaderToggle,type:"button","aria-expanded":mr,onClick:()=>Ri(W=>!W),children:[l.jsx("span",{children:A("sidebar.project")}),l.jsx(FW,{expanded:mr})]}),l.jsxs("div",{className:Ne.projectsHeaderActions,children:[l.jsx("button",{className:Ne.projectsHeaderAction,type:"button",title:A("sidebar.search"),"aria-label":A("sidebar.search"),onClick:()=>{cr(W=>(W&&We(""),!W)),Ri(!0)},children:l.jsx(lu,{})}),!S&&C&&l.jsx("button",{className:Ne.projectsHeaderAction,type:"button",title:A("sidebar.addWorkspace"),"aria-label":A("sidebar.addWorkspace"),onClick:C,children:l.jsx(eb,{})})]})]}),si&&!e&&!I&&l.jsxs("div",{className:Ne.projectSearch,children:[l.jsx(lu,{"aria-hidden":"true"}),l.jsx(qr,{value:we,placeholder:A("sidebar.searchPlaceholder"),"aria-label":A("sidebar.search"),autoFocus:!0,onChange:W=>We(W.target.value),onKeyDown:W=>{W.key==="Escape"&&(We(""),cr(!1))}})]}),(e||mr)&&l.jsx(l.Fragment,{children:!e&&l.jsx("div",{className:Ne.workspacePicker,children:l.jsx("div",{className:Ne.workspaceList,children:di.map(W=>l.jsxs(f.Fragment,{children:[l.jsx(S2t,{workspace:W,renderHeader:S&&(D!=null&&D.render)?Te=>{var Oe;return(Oe=D.render)==null?void 0:Oe.call(D,W,{expanded:Te})}:void 0,client:H.client,reloadToken:Fe,untrustedLabel:A("sidebar.workspaceUntrusted"),readOnlyLabel:A("sidebar.workspaceReadOnly"),trustToOpenLabel:A("sidebar.workspaceTrustToOpen"),noSessionsLabel:A("sidebar.noSessions"),loadErrorLabel:A("sidebar.loadFailed"),organizationEnabled:Z,ungroupedLabel:A("sidebar.groupUngrouped"),onRenameGroup:ys(W.cwd)?Nl:void 0,onDeleteGroup:ys(W.cwd)?rg:void 0,renameGroupLabel:A("sidebar.groupRename"),deleteGroupLabel:A("sidebar.groupDelete"),groupActionsDisabled:$t,excludePinned:!0,onOpenGitDiff:T,formatTime:Te=>_3(Te,A),searchQuery:we,expanded:W.primary?gs:void 0,autoExpandKey:(kt==null?void 0:kt.id)===W.id?kt==null?void 0:kt.key:void 0,onExpandedChange:W.primary?Ps:void 0,renderSessions:!W.primary,renderSession:Te=>fc({...Te,workspaceCwd:W.cwd},{readOnly:Lt({...Te,workspaceCwd:W.cwd})}),headerActions:Te=>{if(S&&(D!=null&&D.render))return null;const Oe=!S&&Dr&&!W.primary&&W.removable===!0;if(!W.trusted&&!Oe)return null;const Ge=W.primary?void 0:W.cwd;return l.jsxs("div",{className:Ne.workspaceHeaderActions,style:{visibility:Te?"visible":"hidden"},children:[W.trusted&&l.jsxs(l.Fragment,{children:[ys(W.cwd)&&l.jsx("button",{className:Ne.workspaceHeaderAction,type:"button","aria-label":A("sidebar.groupCreate"),onClick:mt=>{mt.preventDefault(),mt.stopPropagation(),W.primary?sg():np(W.cwd)},children:l.jsx(eb,{size:16,strokeWidth:1.2})}),l.jsx("button",{className:Ne.workspaceHeaderAction,type:"button",title:A("sidebar.newTask"),"aria-label":A("sidebar.newTask"),onClick:mt=>{mt.preventDefault(),mt.stopPropagation(),Z0(Ge)},children:l.jsx(d$,{size:16,strokeWidth:1.2})})]}),Oe&&l.jsxs(mh,{children:[l.jsx(ph,{asChild:!0,children:l.jsx("button",{className:Ne.workspaceHeaderAction,type:"button","aria-label":A("sidebar.workspaceActions"),disabled:Di&&(Jn==null?void 0:Jn.id)===W.id,children:l.jsx(qf,{size:16,strokeWidth:1.2})})}),l.jsx(gh,{align:"end",className:"w-auto min-w-40",children:l.jsxs(Gi,{variant:"destructive","aria-label":`${A("sidebar.removeWorkspace")}: ${W.cwd}`,onSelect:()=>Id(W),children:[l.jsx(Wp,{}),A("sidebar.removeWorkspace")]})})]})]})}}),W.primary&&(gs||we.trim())?l.jsx("div",{className:Ne.workspaceSessionBody,children:hk}):null]},W.id))})})}),ZT]})}),O!==!1&&l.jsxs("div",{className:Ol(Ne.footer,Io&&Ne.footerCompact,_i&&Ne.footerTight),children:[l.jsxs("div",{className:Ne.footerPrimary,children:[O&&typeof O=="object"&&((mc=O.render)==null?void 0:mc.call(O)),M.has("settings")&&l.jsxs("button",{className:Ne.footerButton,type:"button",title:A("sidebar.settings"),"aria-label":A("sidebar.settings"),onClick:n,children:[l.jsx("span",{className:`${Ne.navIcon} ${Ne.settingsIcon}`,children:l.jsx(N1e,{size:16,strokeWidth:1.2})}),!e&&!Io&&l.jsx("span",{className:Ne.footerButtonLabel,children:A("sidebar.settings")})]}),!e&&!_i&&Lr&&M.has("version")&&l.jsx("span",{className:Ne.version,title:`Qwen Code ${Lr}`,children:Lr})]}),l.jsxs("div",{className:Ne.footerActions,children:[M.has("theme")&&l.jsx("button",{className:Ne.collapseButton,type:"button",title:b===zr.Dark?A("sidebar.themeLight"):A("sidebar.themeDark"),"aria-label":b===zr.Dark?A("sidebar.themeLight"):A("sidebar.themeDark"),onClick:()=>x(b===zr.Dark?zr.Light:zr.Dark),children:b===zr.Dark?l.jsx($1e,{size:16,strokeWidth:1.2}):l.jsx(h1e,{size:16,strokeWidth:1.2})}),c&&M.has("sessionsOverview")&&l.jsx("button",{className:Ne.collapseButton,type:"button",title:A("sidebar.sessionsOverview"),"aria-label":A("sidebar.sessionsOverview"),onClick:a,children:l.jsx(r1e,{size:16,strokeWidth:1.2})}),d&&M.has("splitView")&&l.jsx("button",{className:Ne.collapseButton,type:"button",title:A("sidebar.splitView"),"aria-label":A("sidebar.splitView"),onClick:u,children:l.jsx(Mge,{size:16,strokeWidth:1.2})}),M.has("daemonStatus")&&l.jsx("button",{className:Ne.collapseButton,type:"button",title:A("sidebar.daemonStatus"),"aria-label":A("sidebar.daemonStatus"),onClick:r,children:l.jsx(cge,{size:16,strokeWidth:1.2})}),!y&&M.has("collapse")&&l.jsx("button",{className:Ne.collapseButton,type:"button",title:A(e?"sidebar.expand":"sidebar.collapse"),"aria-label":A(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:e?l.jsx(v1e,{size:16,strokeWidth:1.2}):l.jsx(b1e,{size:16,strokeWidth:1.2})})]})]}),l.jsx("div",{className:Ne.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:Si})]})})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function W2t(e){return e.key!=="b"&&e.key!=="B"||e.altKey||e.shiftKey?!1:e.metaKey!==e.ctrlKey}function V2t(e){const[t,n]=f.useState(e);return f.useEffect(()=>{const s=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(s)},[e]),t}const G2t=3e3,K2t=2;function HW(e){return e.some(t=>t.status==="running"||t.status==="paused")}function Y2t(e,t,n=0){const s=Ib(),[r,i]=f.useState([]),[o,a]=f.useState(!1),[c,u]=f.useState(!1),d=f.useRef(0),h=f.useRef(!1);f.useEffect(()=>{if(!t){i([]),a(!1),d.current=0;return}},[t]),f.useEffect(()=>{!t||!e||(d.current=0,a(!0))},[t,e]),f.useEffect(()=>{!t||n===0||(d.current=0,a(!0))},[t,n]),f.useEffect(()=>{if(c||!t||!o)return;let p=!1;const g=()=>{h.current||(h.current=!0,s.getTasks().then(x=>{if(p)return;const y=x.tasks.filter(Oae);if(i(y),y.length===0){d.current+=1,d.current>=K2t&&a(!1);return}d.current=0,HW(y)||a(!1)}).catch(x=>{p||console.warn("[web-shell] failed to refresh tasks:",x)}).finally(()=>{h.current=!1}))};g();const b=setInterval(g,G2t);return()=>{p=!0,clearInterval(b)}},[s,t,o,c]);const m=f.useRef(r);return m.current=r,f.useEffect(()=>{const p=g=>{const b=g.detail,x=(b==null?void 0:b.active)===!0;u(x),!x&&HW(m.current)&&a(!0)};return window.addEventListener(cw,p),()=>window.removeEventListener(cw,p)},[]),r}function X2t(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),s=t,r=e;return n.length!==Object.keys(s).length?!1:n.every(i=>{const o=r[i],a=s[i];return o===a?!0:Array.isArray(o)&&Array.isArray(a)?o.length===a.length&&o.every((c,u)=>c===a[u]):!1})}function Q2t(e){const t=f.useRef(e);return X2t(t.current,e)||(t.current=e),t.current}function J2t(e,t){const n=f.useRef(e);return e.length!==n.current.length?(n.current=e,e):(e.some((r,i)=>t(r)!==t(n.current[i]))&&(n.current=e),n.current)}const wo={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"},qW=1024,Z2t=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${qW}}\S\$)([^$\n]{1,${qW}})\$(?![\w$])`,"g");function eSt(e){var u,d,h;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=new Map;let i=null,o=null,a=null,c=[];for(const m of n){const p=m.match(s);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=(r.get(o)??0)+1;r.set(o,g),a=g}else a=null;c=[]}continue}if(p&&((h=p[1])!=null&&h.startsWith(i[0]??""))&&p[1].length>=i.length){t.push({lang:o,content:c.join(`
`),index:t.length+1,langIndex:a}),i=null,o=null,a=null,c=[];continue}c.push(m)}return t}function tSt(e){var c;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const u of n){const d=u.match(s);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}r.test(u)&&(o=!0,a=[]);continue}if(r.test(u)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(u)}return t}function nSt(e){var a;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1;for(const c of n){const u=c.match(s);if(i){u&&((a=u[1])!=null&&a.startsWith(i[0]??""))&&u[1].length>=i.length&&(i=null);continue}if(o){r.test(c)&&(o=!1);continue}if(u){i=u[1]??null;continue}if(r.test(c)){o=!0;continue}for(const d of c.matchAll(Z2t)){const h=d[1];h&&t.push({content:h,index:t.length+1})}}return t}function UW(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function sSt(e,t){var d;const n=t.trim().split(/\s+/).filter(Boolean),s=(d=n[0])==null?void 0:d.toLowerCase();if(!s)return;const r=eSt(e);if(r.length===0)return null;let i=null,o=null;const a=s==="code"?n.slice(1):n.map(h=>h);s!=="code"&&(i=s);for(const h of a)/^\d+$/.test(h)?o=Number(h):h.toLowerCase()!=="code"&&(i=h.toLowerCase());const c=i?r.filter(h=>h.lang===i):r;if(c.length===0)return null;if(o!==null){const h=i?c.find(m=>m.langIndex===o):r.find(m=>m.index===o);return h?{content:h.content,label:UW(h,i)}:null}const u=c[c.length-1];return u?{content:u.content,label:UW(u,i)}:null}function WW(e,t){const n=nSt(e);if(n.length===0)return null;let s=null;for(const i of t)/^\d+$/.test(i)&&(s=Number(i));const r=s!==null?n.find(i=>i.index===s):n[n.length-1];return r?{content:r.content,label:`Inline LaTeX expression ${r.index}`}:null}function rSt(e,t){var u;const n=t.trim().split(/\s+/).filter(Boolean),s=(u=n[0])==null?void 0:u.toLowerCase();if(s!=="latex"&&s!=="math"&&s!=="inline-latex")return;if(s==="inline-latex")return WW(e,n.slice(1));const r=n.slice(1),i=r.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return WW(e,r.filter((d,h)=>h!==i));const o=tSt(e);if(o.length===0)return null;let a=null;for(const d of r)/^\d+$/.test(d)&&(a=Number(d));const c=a!==null?o.find(d=>d.index===a):o[o.length-1];return c?{content:c.content,label:`LaTeX block ${c.index}`}:null}function iSt(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 oSt(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 aSt(e,t,n=oSt){const s=iSt(e);if(s===null)return{status:"info",message:wo.NO_OUTPUT};if(!s)return{status:"info",message:wo.NO_TEXT};try{const r=rSt(s,t);if(r===null)return{status:"info",message:t.trim().split(/\s+/).some(c=>c==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?wo.INLINE_LATEX_MISSING:wo.LATEX_MISSING};if(r!==void 0)return await n(r.content),{status:"info",message:`${r.label}${wo.COPIED_SUFFIX}`};const i=sSt(s,t);if(i===null)return{status:"info",message:wo.CODE_MISSING};const o=(i==null?void 0:i.content)??s;return await n(o),{status:"info",message:i?`${i.label}${wo.COPIED_SUFFIX}`:wo.OUTPUT_COPIED}}catch(r){const i=r instanceof Error?r.message:String(r);return{status:"error",message:`${wo.CLIPBOARD_PREFIX}${i}`}}}function lSt(e){return typeof e=="object"&&e!==null}function hce(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function MD(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function cSt(e){if(!MD(e)||!lSt(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function uSt(e){const t=new Set;for(const n of e){if(!MD(n))continue;const s=cSt(n);s&&t.add(s)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const s=hce(n.content);return!s||!t.has(s)})}function dSt(e){return e.role!=="system"||e.variant!=="info"?!1:hce(e.content)!==null||MD(e)}function hSt(e){const t=e.findIndex(n=>!dSt(n));return t<0?[]:e.slice(t)}function VW(e){return hSt(uSt(e))}function fSt(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 GW(e,t){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(e)for(const s of e.cells){const r=s.detail;s.kind==="node_version"&&(r!=null&&r.version)?n.nodeVersion=r.version:s.kind==="npm"&&(r!=null&&r.version)?n.npmVersion=String(r.version).replace(/^npm\s*/i,""):s.kind==="auth"&&(r!=null&&r.source)&&(n.authSource=r.source)}if(t)for(const s of t.cells)s.kind==="platform"?(n.platform=s.name,s.value&&(n.arch=s.value)):s.kind==="sandbox"&&s.name==="SANDBOX"?n.sandbox=s.value||"":s.kind==="proxy"&&s.present&&s.value?n.proxy=`${s.name}: ${s.value}`:s.kind==="memory"&&s.value&&(n.memoryUsage=s.value);return n}function mSt(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function KW(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function pSt(e){const t=e.indexOf("\0"),n=t>=0?e.slice(0,t):e,s=n.indexOf(":");return s>0?`${n.slice(s+1)}(${n.slice(0,s)})`:n}const gSt=12,bSt=8,ySt=.35,vSt=2,xSt=.1,wSt=700,kSt=10*60*1e3,_St=.75,SSt=280,CSt=[/^继续[吧呢]?$/,/^行[吧吗]?$/,/^好的?$/,/^再[看试说解释改跑补].*/,/^顺手.*/,/^上面.*/,/^刚才.*/,/^这个报错.*/,/^那你.*/,/^帮我修.*/,/^帮我看下.*/,/^跑(一下)?(测试|看看).*/,/^这个实现.*/,/^这个 PR.*/i,/^继续当前.*/,/^continue$/i,/^ok(?:ay)?$/i,/^retry$/i,/^fix (?:that|this|it)/i,/^run (?:the )?tests?/i],TSt=[/新的?(功能|任务|方向|话题)/,/写(一篇)?(设计文档|文档|spec|方案)/i,/产品方案/,/脑爆/,/另一个(功能|方向|任务|主题)/,/不继续当前/,/切到(一个)?新的?(任务|方向|话题)/,/start (a )?new/i,/new (feature|task|design|spec|doc|workflow)/i,/product (design|plan|spec)/i,/brainstorm/i];function ESt(e){const t=e.trim();return CSt.some(n=>n.test(t))}function ASt(e){const t=e.trim();return TSt.some(n=>n.test(t))}function jSt(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,SSt)}))}function NSt(e){const t=e.recentMessages.map((n,s)=>`${s+1}. ${n.role}: ${n.text}`).join(`
`);return["You are deciding whether a user's new message still belongs in the current coding session.","Suggest starting a new session only when the new message is clearly a different task or topic, and continuing in the current session would likely add context noise or wasted token usage.","Be conservative. When in doubt, keep the current session.","Do NOT suggest a new session for follow-up questions, implementation continuations, debugging iterations, review follow-ups, or adjacent design discussion about the same repo, PR, bug, or feature.","Return JSON only with keys: shouldSuggestNewSession (boolean) 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 YW(e){try{const t=JSON.parse(e);return typeof t.shouldSuggestNewSession!="boolean"||typeof t.confidence!="number"?null:{shouldSuggestNewSession:t.shouldSuggestNewSession,confidence:t.confidence}}catch{return null}}function MSt(e){const t=YW(e);if(t)return t;const n=e.indexOf("{"),s=e.lastIndexOf("}");if(n===-1||s<=n)return null;const r=e.slice(n,s+1);return r===e?null:YW(r)}function ISt({enabled:e,inputText:t,messages:n,sessionId:s,contextUsageRatio:r,isRunning:i,dialogOpen:o,generateContent:a}){const[c,u]=f.useState(null),d=f.useRef(null),h=f.useRef(null),m=f.useRef(0),p=f.useRef(s),g=f.useMemo(()=>jSt(n),[n]),b=f.useCallback(()=>{var v;d.current&&(clearTimeout(d.current),d.current=null),(v=h.current)==null||v.abort(),h.current=null},[]),x=f.useCallback(()=>{u(null),b()},[b]),y=f.useCallback(()=>{m.current=Date.now()+kSt,u(null),b()},[b]);return f.useEffect(()=>{p.current!==s&&(u(null),b(),p.current=s)},[b,s]),f.useEffect(()=>{if(b(),!e||!a||!s){u(null);return}const v=t.trim();if(v.length<gSt){u(null);return}if(ESt(v)){u(null);return}const w=ASt(v);if(i||o){u(null);return}if(w?g.length<vSt&&r<xSt:g.length<bSt&&r<ySt){u(null);return}if(Date.now()<m.current){u(null);return}return u(null),d.current=setTimeout(()=>{const k=new AbortController;h.current=k;const T=NSt({recentMessages:g,currentInput:v,contextUsageRatio:r,messageCount:g.length});(async()=>{let C="";try{for await(const S of a(T,{signal:k.signal})){if(h.current!==k)return;if(S.type==="delta")C+=S.text;else if(S.type==="error"){h.current===k&&u(null);return}}if(h.current!==k)return;const _=MSt(C.trim());if(_&&_.shouldSuggestNewSession&&_.confidence>=_St){u({isVisible:!0,classifiedInput:v});return}u(null)}catch{k.signal.aborted||u(null)}finally{h.current===k&&(h.current=null)}})()},wSt),()=>{b()}},[b,r,o,e,a,t,i,g,s]),{suggestion:c,dismiss:x,suppress:y}}const R0=f.createContext(!1),ID=f.createContext(new Map),fce=f.createContext(new Map);function RSt({timeline:e,details:t,children:n}){return l.jsx(ID.Provider,{value:e,children:l.jsx(fce.Provider,{value:t,children:n})})}const ov=Mb,eE=760,Hg=320,T2=500,DSt=20,LSt=3e4;function PSt(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 OSt="ui.compactMode",$St="ui.hideTips",BSt={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function tE(e){return e.trim().replace(/^\/+/,"").toLowerCase()}function zSt(e){const t=e;return t.source!=="goal"?null:y3(t.data)??y3(t.text)}function FSt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const s=zSt(n);if(s)return s.kind==="set"||s.kind==="checking"?{condition:s.condition,setAt:s.setAt??n.serverTimestamp??n.createdAt}:null}return null}const XW={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},HSt=[],mce=1e3,QW=6,JW=40,pce="qwen-code-web-shell-chat-width",qSt=40,gce="qwen-code-web-shell-sidebar-collapsed";function USt(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 WSt(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(gce);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function ZW(e){try{window.localStorage.setItem(gce,String(e))}catch{}}function xS(){return`${mce}`}function VSt(){if(typeof window>"u")return xS();try{return window.localStorage.getItem(pce)==="wide"?"wide":xS()}catch{return xS()}}function GSt(e){try{window.localStorage.setItem(pce,e)}catch{}}function bce(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:mce}function KSt(e,t){const n=`${bce(t)}px`,s=`calc(${n} + ${qSt}px)`;return{"--chat-regular-content-width":n,"--chat-regular-shell-width":s,"--chat-content-width":e==="wide"?"100%":n,"--chat-shell-width":e==="wide"?"100%":s}}function eV(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function tV(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function YSt(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function XSt(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return wh(e.get("language")??e.get("lang")??navigator.language)}function QSt(e,t){return e instanceof Error?e.message:t}function nE(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function qg(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function JSt(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function ZSt(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function sE(e){return typeof e=="object"&&e!==null}function e4t(e){if(!sE(e))return null;const t=e._meta;if(!sE(t))return null;const n=t.qwenModelSwitch;if(!sE(n))return null;const s=n.authType,r=n.modelId,i=n.baseUrl,o=n.apiKey;return typeof s!="string"||typeof r!="string"||typeof i!="string"||typeof o!="string"?null:{authType:s,modelId:r,baseUrl:i,apiKey:o,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function t4t(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function n4t(e){return e.toolKind==="edit"}function s4t(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 r4t(e){var n;if(((n=e.args)==null?void 0:n.is_background)!==!0)return!1;const t=e.toolName.toLowerCase();return t==="shell"||t==="bash"||t==="run_shell_command"||t==="exec"}function i4t(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)r4t(s)&&t.push(`${s.callId}:${s.status}`);return t.join("|")}function o4t(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 a4t(e,t){return e===wo.NO_OUTPUT?t("copy.noOutput"):e===wo.NO_TEXT?t("copy.noText"):e===wo.CODE_MISSING?t("copy.codeMissing"):e===wo.LATEX_MISSING?t("copy.latexMissing"):e===wo.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===wo.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(wo.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(wo.CLIPBOARD_PREFIX.length)}`:e.endsWith(wo.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-wo.COPIED_SUFFIX.length)}):e}function E2(e,t,n){const s=e.find(r=>r.key===n);if(s)return t==="user"?s.values.user:s.values.workspace}function l4t({onSessionIdChange:e,onSessionCreated:t,theme:n,onThemeChange:s,language:r,onLanguageChange:i,className:o,style:a,shadowDom:c,onConnectionChange:u,onStreamingStateChange:d,onError:h,onBugReport:m,hiddenSlashCommands:p,slashCommandCategoryOrder:g,onSlashCommand:b,builtinAtProviders:x,atProviders:y,composerTagIcons:v,renderToolHeaderExtra:w,renderWelcomeHeader:k,renderWelcomeFooter:T,mobileWelcomeFooterMiddle:C=!1,parseUserMessageContent:_,renderUserMessageContent:S,renderComposerTag:D,renderComposerTagTooltip:E,onComposerTagClick:B,renderAssistantTurnFooter:I,renderComposerToolbarStart:L,renderComposerToolbarEnd:O,renderComposerToolbarRight:A,renderComposerHeader:$,renderChatHeader:q,renderFooter:U,bottomStatusItems:H,chatMaxWidth:M,sidebar:ee,splitSessionIds:V,onSplitSessionIdsChange:R,onRightPanelOpen:re,messageTurnOutputs:Z,shellRef:K,composerToolbarActions:Y,composerPlaceholders:ae,compactThinking:le=!1,collapseCompletedTurns:te=!0,markdownTableMode:z="basic",virtualScrollThreshold:X,markdown:fe,loadingPhrases:xe,onTranscriptChange:ie,onToast:Ce,composerRef:Ke,onComposerReady:ut,composerInput:Et,composerInputVersion:st,onSessionChange:xt,onSubmitBefore:He,restartSseOnPrompt:pn,historyPageSize:Yt,initialSelectedWorkspaceCwd:It,lockedWorkspaceCwd:me,lockedWorkspaceCapability:$e}={}){var ML,IL,RL,DL,LL,PL,OL,$L,BL,zL,FL,HL,qL,UL,WL;const[yt,Me]=f.useState(VSt),[Le,vn]=f.useState(()=>r===void 0?XSt():wh(r)),ge=f.useMemo(()=>E9(Le),[Le]),Rt=f.useMemo(()=>Qvt(c),[c]),ht=f.useMemo(()=>USt(ee),[ee]),[gn,Ue]=f.useState(()=>WSt(ht.defaultCollapsed)),[De,Re]=f.useState(null),[be,Ie]=f.useState(!1),[ne,Ee]=f.useState(!1),qe=f.useCallback(()=>{Ie(!1),Ee(!1)},[]),Je=q7(),Qe=q7("(min-width: 1001px)"),cn=q7("(min-width: 1200px)");f.useEffect(()=>{ht.enabled||qe()},[qe,ht.enabled]),f.useEffect(()=>{const j=window.matchMedia("(max-width: 760px)"),F=J=>{J.matches||qe()};return j.addEventListener("change",F),()=>j.removeEventListener("change",F)},[qe]),f.useEffect(()=>{if(!be)return;const j=ce=>{if(ce.key!=="Escape"||hc.current)return;const je=ce.target;N0(je)&&!(je!=null&&je.closest("[data-sidebar-shell]"))||(ce.stopPropagation(),ce.preventDefault(),qe())},F=document.body.style.overflow;document.body.style.overflow="hidden";const J=ce=>{const je=ce.target;je!=null&&je.closest("[data-sidebar-shell]")&&!je.closest(`.${At.mobileBackdrop}`)||ce.preventDefault()};return document.addEventListener("touchmove",J,{passive:!1}),window.addEventListener("keydown",j,!0),()=>{document.body.style.overflow=F,document.removeEventListener("touchmove",J),window.removeEventListener("keydown",j,!0)}},[be,qe]);const Kn=f.useCallback(j=>{Ue(j),ZW(j)},[]);f.useEffect(()=>{if(!ht.enabled)return;const j=F=>{if(!W2t(F))return;const J=F.target;if(N0(J)&&!(J!=null&&J.closest("[data-web-shell-composer-editor]")))return;if(F.preventDefault(),ne||window.matchMedia("(max-width: 760px)").matches){be?(Ie(!1),Ee(!1)):Ie(!0);return}const ce=!gn;Ue(ce),ZW(ce)};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[ht.enabled,be,ne,gn]);const _e=f.useMemo(()=>({composerTagIcons:v,renderToolHeaderExtra:w,renderWelcomeHeader:k,renderWelcomeFooter:T,parseUserMessageContent:_,renderUserMessageContent:S,renderComposerTag:D,renderComposerTagTooltip:E,onComposerTagClick:B,renderAssistantTurnFooter:I,renderComposerToolbarStart:L,renderComposerToolbarEnd:O,renderComposerToolbarRight:A,renderComposerHeader:$,renderFooter:U,compactThinking:le,collapseCompletedTurns:te,markdownTableMode:z,markdown:fe,loadingPhrases:xe}),[v,w,k,T,_,S,D,E,B,I,L,O,A,$,U,le,te,z,fe,xe]),ft=U,$t=$,pe=iC(),Be=Cw(),ue=xa(),Wt=HY(),Bt=la(),hn=f.useMemo(()=>{var F;const j=((F=Bt.capabilities)==null?void 0:F.workspaces)??[];return $e&&!j.some(J=>J.cwd===$e.cwd)?[...j,$e]:j},[$e,(ML=Bt.capabilities)==null?void 0:ML.workspaces]),gt=f.useMemo(()=>me?hn.filter(j=>j.cwd===me):hn,[me,hn]),Ae=Ib(),kn=f.useCallback(async j=>{ue.sessionId&&await Ae.reloadSession(j)},[ue.sessionId,Ae]),Dn=((IL=ue.capabilities)==null?void 0:IL.features.includes(JY))===!0,{notices:qn,dismissNotice:ir}=P0e(),Qn=Vo(),jr=((DL=(RL=Bt.capabilities)==null?void 0:RL.features)==null?void 0:DL.includes("dynamic_workspace_registration"))===!0,es=((PL=(LL=Bt.capabilities)==null?void 0:LL.features)==null?void 0:PL.includes("persistent_workspace_registration"))===!0,Gn=(($L=(OL=Bt.capabilities)==null?void 0:OL.features)==null?void 0:$L.includes("scratch_workspace_registration"))===!0,Dt=((zL=(BL=Bt.capabilities)==null?void 0:BL.features)==null?void 0:zL.includes("workspace_display_name"))===!0,[ps,is]=f.useState(!1),[os,ts]=f.useState(!1),Wn=f.useRef(null),ds=f.useRef(null),Sn=f.useRef("clear"),ui=f.useRef(void 0),[Ur,lr]=f.useState("clear"),Cs=f.useCallback(j=>{Sn.current=j,lr(j)},[]),[js,Ii]=f.useState(It),Jr=f.useRef(js);Jr.current=js;const[ve,ze]=f.useState(void 0);f.useEffect(()=>{if(!Bt.capabilities||!js)return;const j=hn.find(F=>F.cwd===js);j!=null&&j.trusted||(Jr.current=void 0,Ii(void 0))},[js,Bt.capabilities,hn]);const lt=f.useRef(void 0),[_t,Xt]=f.useState(void 0),[rs,fs]=f.useState(void 0),gs=f.useRef(void 0);f.useEffect(()=>{const j=ue.sessionId;if(gs.current=j,!j){Xt(void 0),fs(void 0);return}Bt.client.sessionStatus(j).then(F=>{gs.current===j&&(Xt(F.worktree),fs(F.branch))}).catch(()=>{gs.current===j&&(Xt(void 0),fs(void 0))})},[ue.sessionId,Bt.client]);const Ps=f.useMemo(()=>{var j;return ue.sessionId?ue.workspaceCwd:me??js??((j=hn.find(F=>F.primary))==null?void 0:j.cwd)},[ue.sessionId,ue.workspaceCwd,me,js,hn]);f.useEffect(()=>{if(!Ps){lt.current=void 0,ze(void 0);return}const j=(_t==null?void 0:_t.path)??Ps;lt.current!==j&&(lt.current=j,ze(void 0));let F=!1;const J=()=>{Bt.client.workspaceByCwd(Ps).workspaceGit(_t==null?void 0:_t.path).then(tt=>{F||ze(tt)}).catch(()=>{F||ze(void 0)})};J();const ce=()=>J();window.addEventListener("focus",ce);const je=window.setInterval(()=>{document.visibilityState==="visible"&&J()},3e4);return()=>{F=!0,window.removeEventListener("focus",ce),window.clearInterval(je)}},[Ps,ue.gitBranch,Bt.client,_t]);const mr=f.useRef(Ce);mr.current=Ce;const Ri=f.useRef(0),[si,cr]=f.useState([]),Jn=f.useCallback(j=>{cr(F=>F.filter(J=>J.id!==j))},[]),Ln=f.useCallback((j,F)=>{if(mr.current){mr.current(j,F);return}const J={id:`web-shell-toast-${Date.now()}-${++Ri.current}`,tone:j,message:F};cr(ce=>[...ce.filter(tt=>tt.tone!==j||tt.message!==F),J].slice(-4))},[]),Vn=KT(ge),Hi=f.useRef(Vn);Hi.current=Vn;const[Di,Mo]=f.useState(null),[ns,Rr]=f.useState(null),pr=f.useRef(1),Cr=f.useRef(1),Fe=f.useRef(null),xn=f.useRef(null),kt=f.useRef(ue.sessionId),ms=f.useRef(void 0),In=f.useRef(void 0),we=f.useRef(void 0),We=f.useRef(ue.sessionId),St=f.useMemo(()=>{const j=[Di].filter(J=>J!==null);if(j.length===0)return VW(Vn);const F=[...Vn];for(const J of j.sort((ce,je)=>ce.anchorIndex-je.anchorIndex)){const ce=J.anchorAfterId?F.findIndex(tt=>tt.id===J.anchorAfterId):-1,je=ce>=0?ce+1:Math.min(J.anchorIndex,F.length);F.splice(je,0,J.message)}return VW(F)},[Vn,Di]),{artifacts:fn,loading:Ct,error:$n}=rle(),[as,Rs]=f.useState([]),[ki,zs]=f.useState(()=>new Map),[Yn,or]=f.useState([]);f.useEffect(()=>{if(as.length===0||fn.length===0)return;const j=new Set(fn.map(J=>J.id)),F=new Set(Yn.filter(J=>J.kind==="artifact"&&J.workspaceActions).map(J=>J.kind==="artifact"?J.artifactId:""));Rs(J=>{const ce=J.filter(je=>!j.has(je.id)||F.has(je.id));return ce.length===J.length?J:ce})},[fn,as.length,Yn]);const ur=f.useMemo(()=>Array.from(ki.values()).flatMap(j=>[...j.artifacts]),[ki]),Dr=f.useMemo(()=>{if(as.length===0&&ur.length===0)return fn;const j=[...fn];for(const F of[...as,...ur])j.findIndex(ce=>ce.id===F.id)<0&&j.push(F);return j},[fn,as,ur]),ri=f.useCallback((j,F,J)=>{zs(je=>{const tt=je.get(j);if((tt==null?void 0:tt.workspaceActions)===J&&tt.artifacts.length===F.length&&tt.artifacts.every((Vt,pt)=>{const it=F[pt];return(it==null?void 0:it.id)===Vt.id&&it.updatedAt===Vt.updatedAt&&it.sizeBytes===Vt.sizeBytes}))return je;const Jt=new Map(je);return F.length===0?Jt.delete(j):Jt.set(j,{artifacts:[...F],workspaceActions:J}),Jt});const ce=new Set(F.map(je=>je.id));or(je=>{let tt=!1;const nn=je.map(Jt=>{if(Jt.kind!=="artifact"||!ce.has(Jt.artifactId))return Jt;const Vt={id:Jt.id,kind:"artifact",title:Jt.title,artifactId:Jt.artifactId,workspaceActions:Jt.workspaceActions??J};return Jt.previewContent!==void 0&&(tt=!0),Jt.workspaceActions||(tt=!0),Vt});return tt?nn:je})},[]),ua=f.useMemo(()=>vle(St,fn,ue.workspaceCwd||""),[St,fn,ue.workspaceCwd]),Ya=f.useMemo(()=>wle(St,ua,ue.workspaceCwd||""),[St,ua,ue.workspaceCwd]),go=f.useMemo(()=>kle(St),[St]),Xa=f.useMemo(()=>new Set(Z??_ae),[Z]),[di,se]=f.useState(!1),de=f.useRef(di);de.current=di;const[Ve,et]=f.useState(null),Cn=f.useRef(Ve);Cn.current=Ve;const[Lt,Rn]=f.useState([]),[Pn,bs]=f.useState(null),[Fs,Ts]=f.useState(eE),gr=f.useRef(null),Ns=f.useRef(null),qi=f.useRef(new Map),ys=f.useRef(ue.sessionId);Ns.current={open:di,tabs:Yn,activeTabId:Ve,reviewChanges:Lt,selectedReviewPath:Pn,extraArtifacts:as,width:Fs},f.useEffect(()=>{const j=ys.current;if(j){const ce=Ns.current;if(ce&&(qi.current.set(j,ce),qi.current.size>DSt)){const je=qi.current.keys().next().value;je&&qi.current.delete(je)}}const F=ue.sessionId;ys.current=F;const J=F?qi.current.get(F):void 0;if(!J){se(!1),or([]),et(null),Rn([]),bs(null),Rs([]),zs(new Map),Ts(eE);return}se(J.open),or(J.tabs),et(J.activeTabId),Rn(J.reviewChanges),bs(J.selectedReviewPath),Rs(J.extraArtifacts),zs(new Map),Ts(J.width)},[ue.sessionId]);const Go=f.useCallback(()=>{var F;const j=(F=xn.current)==null?void 0:F.getBoundingClientRect().width;return j?Math.max(Hg,Fs+j-T2):Math.max(Hg,window.innerWidth-T2)},[Fs]),Tr=f.useCallback(()=>{var J;const j=((J=xn.current)==null?void 0:J.getBoundingClientRect().width)??window.innerWidth,F=Math.max(Hg,j-T2);return Math.min(F,Math.max(eE,Math.round(j*.56)))},[]),vt=f.useCallback((j,F)=>{if(!j)return;const J=Dr.find(je=>je.id===j),ce={id:`artifact:${j}`,kind:"artifact",artifactId:j,title:(J==null?void 0:J.title)??"Artifact",...F!==void 0?{previewContent:F}:{}};or(je=>je.some(tt=>tt.id===ce.id)?je.map(tt=>tt.id===ce.id?{...tt,...ce}:tt):[...je,ce]),et(ce.id),Ts(je=>de.current?je:Tr()),se(!0)},[Dr,Tr]),Ye=f.useCallback((j,F,J,ce)=>{const je={id:"review",kind:"review",title:ge("turnOutputs.review"),...J?{workspaceActions:J}:{},...ce?{workspaceCwd:ce}:{}};or(tt=>tt.some(nn=>nn.id===je.id)?tt.map(nn=>nn.id===je.id?je:nn):[je,...tt]),et(je.id),Rn(j),bs(F??null),Ts(tt=>de.current?tt:Tr()),se(!0)},[Tr,ge]),Ht=f.useCallback((j,F)=>{const J={id:`scheduled-task:${j.toolCallId}`,kind:"scheduled_task",title:ge("scheduledTasks.title"),task:j,...F?{workspaceActions:F}:{}};or(ce=>ce.some(je=>je.id===J.id)?ce.map(je=>je.id===J.id?J:je):[...ce,J]),et(J.id),Ts(ce=>de.current?ce:Tr()),se(!0)},[Tr,ge]),zt=f.useCallback((j,F,J)=>{var nn;const ce=j.rawOutput&&typeof j.rawOutput=="object"?j.rawOutput:void 0,je=(typeof((nn=j.args)==null?void 0:nn.subagent_type)=="string"?j.args.subagent_type:void 0)??(typeof(ce==null?void 0:ce.subagentName)=="string"?ce.subagentName:void 0),tt={id:`subagent:${F}:${j.callId}`,kind:"subagent",title:j.title||je||ge("agent.label"),sessionId:F,rootToolCallId:j.callId,rootTool:j,...J?{workspaceCwd:J}:{}};or(Jt=>Jt.some(Vt=>Vt.id===tt.id)?Jt.map(Vt=>Vt.id===tt.id?tt:Vt):[...Jt,tt]),et(tt.id),Ts(Jt=>de.current?Jt:Tr()),se(!0)},[Tr,ge]),qt=f.useCallback(j=>{ue.sessionId&&zt(j,ue.sessionId,ue.workspaceCwd)},[ue.sessionId,ue.workspaceCwd,zt]),Fn=f.useCallback(j=>{if(re){re(j);return}if(j.kind==="review"){Ye(j.changes,j.selectedPath,j.workspaceActions,j.workspaceCwd);return}if(j.kind==="scheduled_task"){Ht(j.task,j.workspaceActions);return}if(j.kind==="subagent"){zt(j.tool,j.sessionId,j.workspaceCwd);return}j.workspaceActions||Rs(J=>{const ce=J.findIndex(tt=>tt.id===j.artifact.id);if(ce<0)return[...J,j.artifact];const je=[...J];return je[ce]=j.artifact,je});const F={id:j.id,kind:"artifact",title:j.title,artifactId:j.artifactId,...j.workspaceActions?{workspaceActions:j.workspaceActions}:{},...j.previewContent!==void 0?{previewContent:j.previewContent}:{}};or(J=>J.some(ce=>ce.id===F.id)?J.map(ce=>ce.id===F.id?{...ce,...F}:ce):[...J,F]),et(F.id),Ts(J=>de.current?J:Tr()),se(!0)},[Tr,re,Ye,Ht,zt]),Bn=f.useCallback((j,F,J)=>{const ce=Sae(j),je={id:`file:${J??""}:${j.path}`,kind:"file",title:UT(j.path,J),workspacePath:j.path,workspaceActions:F,...ce!==void 0?{previewContent:ce}:{}};or(tt=>tt.some(nn=>nn.id===je.id)?tt.map(nn=>nn.id===je.id?je:nn):[...tt,je]),et(je.id)},[]),Ms=f.useCallback(()=>{se(!1),or([]),et(null),Rn([]),bs(null),Rs([]),zs(new Map)},[]);f.useLayoutEffect(()=>{if(!di)return;const j=()=>{Ts(ce=>{var nn;const je=((nn=xn.current)==null?void 0:nn.getBoundingClientRect().width)??window.innerWidth-ce,tt=Math.max(Hg,ce+je-T2);return Math.min(ce,tt)})};j(),window.addEventListener("resize",j);const F=xn.current,J=new ResizeObserver(j);return F&&J.observe(F),()=>{window.removeEventListener("resize",j),J.disconnect()}},[di]);const Lr=f.useCallback(j=>{or(F=>{const J=F.filter(ce=>ce.id!==j);if(J.length===0)return se(!1),et(null),Rn([]),bs(null),Rs([]),zs(new Map),J;if(Cn.current===j){const ce=F.findIndex(tt=>tt.id===j),je=J[Math.min(ce,J.length-1)]??J[0];et(je.id)}return J})},[]),Io=f.useCallback(j=>{j.preventDefault();const F=j.currentTarget;F.setPointerCapture(j.pointerId);const J=j.clientX,ce=Fs,je=Go(),tt=document.body.style.cursor,nn=document.body.style.userSelect;let Jt=ce,Vt=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const pt=()=>{Vt=null,Ts(Jt)},it=ei=>{Jt=Math.min(je,Math.max(Hg,ce-(ei.clientX-J))),Vt===null&&(Vt=window.requestAnimationFrame(pt))};let vs=()=>{};const xs=ei=>{gr.current=null,Vt!==null&&(window.cancelAnimationFrame(Vt),Vt=null),ei&&Ts(Jt),F.hasPointerCapture(j.pointerId)&&F.releasePointerCapture(j.pointerId),document.body.style.cursor=tt,document.body.style.userSelect=nn,window.removeEventListener("pointermove",it),window.removeEventListener("pointerup",vs),window.removeEventListener("pointercancel",vs)};vs=()=>xs(!0),gr.current=()=>xs(!1),window.addEventListener("pointermove",it),window.addEventListener("pointerup",vs),window.addEventListener("pointercancel",vs)},[Fs,Go]);f.useEffect(()=>()=>{var j;return(j=gr.current)==null?void 0:j.call(gr)},[]);const _i=V2t(Be),ls=f.useMemo(()=>wA(_i),[_i]),Ss=Q2t(ls),Xs=!(ue.catchingUp&&De!==null),xr=KN(Ss)&&Xs?Ss:null,Ta=Ss&&!KN(Ss)&&Xs?Ss:null,hc=f.useRef(Ss);hc.current=Xs?Ss:null;const Ji=Ta!==null||xr!==null,Uc=f.useRef(Ji);Uc.current=Ji||Xs&&wA(Be)!==null;const Id=f.useMemo(()=>hGe(Vn),[Vn]),tp=f.useRef(null),Z0=f.useMemo(()=>{const j=mGe(Vn),F=tp.current;if(F&&F.signature===j)return F.timeline;const J=fGe(Vn);return tp.current={signature:j,timeline:J},J},[Vn]),Rd=f.useRef(null),Qa=f.useMemo(()=>{const j=pGe(Vn),F=Rd.current;if(F&&F.signature===j)return F.details;const J=wGe(Vn);return Rd.current={signature:j,details:J},J},[Vn]),Ja=J2t(Id.todos,j=>`${j.id}:${j.status}:${j.content}`),eg=Id.allCompleted,[Jh,Dd]=f.useState("hidden"),Zh=ue.catchingUp||Ja.length===0||eg?"hidden":"active";Zh!==Jh&&Dd(Zh);const tg=Zh!=="hidden",ng=H??HSt,sg=tg||ng.length>0,np=f.useRef(null),ik=f.useRef(null),[Nl,Ld]=f.useState(null),ok=f.useRef(new Set),rg=f.useRef(null),[ty,sp]=f.useState(0),[ef,ig]=f.useState(0);f.useLayoutEffect(()=>{if(!sg){sp(0),ig(0);return}const j=rg.current;if(!j){sp(JW),ig(0);return}const F=()=>{const ce=np.current,je=j.getBoundingClientRect(),tt=ce==null?void 0:ce.getBoundingClientRect(),nn=Math.ceil(je.height),Jt=tt?Math.max(0,tt.top-je.top):nn+QW;ig(nn),sp(Math.max(JW,Math.ceil(Jt)))};if(F(),typeof ResizeObserver>"u")return;const J=new ResizeObserver(F);return J.observe(j),np.current&&J.observe(np.current),()=>J.disconnect()},[sg]);const og=f.useMemo(()=>({"--web-shell-bottom-panel-inset":`${ty}px`,"--web-shell-bottom-panel-height":`${ef}px`,"--web-shell-bottom-panel-gap":`${QW}px`}),[ef,ty]),ak=f.useMemo(()=>i4t(Vn),[Vn]),ny=Y2t(ak,ue.status==="connected"),Pd=f.useMemo(()=>U?ny.map(o4t):[],[ny,U]),Od=f.useRef(null),ag=f.useRef(null),Si=f.useRef(null),lk=f.useRef(null),[sy,ck]=f.useState(!1),uk=f.useRef(null),lg=f.useRef(!1),Wc=f.useCallback((j="smooth")=>{requestAnimationFrame(()=>{var F;(F=ag.current)==null||F.scrollToBottom(j),requestAnimationFrame(()=>{var J;(J=ag.current)==null||J.scrollToBottom(j)})})},[]),ry=f.useCallback(j=>{Si.current=j,eV(Ke,j??XW),j&&lk.current!==j&&(lk.current=j,ut==null||ut(j))},[Ke,ut]);f.useEffect(()=>{eV(Ke,Si.current??XW)},[Ke]);const[tf,$d]=f.useState(null),[JT,dk]=f.useState(!1),fc=f.useRef(!1),hk=f.useRef(null);hk.current=tf;const{followupState:ZT,onAcceptFollowup:fk,onDismissFollowup:mk,clear:iy}=VY({onAccept:j=>{var F;(F=Si.current)==null||F.insertText(j)}}),oy=f.useRef(""),Bd=f.useRef(null),[pk,gk]=f.useState(""),[rp,nf]=f.useState(!1),dr=oC(),vu=f.useRef(dr),cg=f.useRef(Date.now()),ay=f.useRef(dr);ay.current==="idle"&&dr!=="idle"&&(cg.current=Date.now()),ay.current=dr;const ly=f.useMemo(()=>{if(dr!=="idle"){for(let j=St.length-1;j>=0;j--){const F=St[j];if((F==null?void 0:F.role)==="user")return F.timestamp??cg.current}return cg.current}},[St,dr]),zd=f.useRef(""),ip=f.useRef(void 0),sf=f.useRef(null),rf=f.useRef(null),[ug,op]=f.useState(!1),dg=f.useRef(ug);dg.current=ug;const mc=ue.status==="connected",W=wd(),[Te,Oe]=f.useState([]),[Ge,mt]=f.useState(!1),jn=f.useRef(0),Tn=f.useCallback(async j=>{const F=++jn.current;try{const J=j&&Bt.client?await Bt.client.workspaceByCwd(j).workspaceSkills():await Qn.loadSkillsStatus();if(F!==jn.current)return;Oe(PSt(J)),mt(!0)}catch{return}},[Bt.client,Qn]);f.useEffect(()=>{mc&&Tn(ue.workspaceCwd)},[mc,ue.workspaceCwd,Tn]);const[On,Hn]=f.useState(null),Za=f.useRef(On),[Ci,Vc]=f.useState("workspace"),[Nr,Fd]=f.useState(!1),Ea=f.useRef(Nr),[el,ap]=f.useState([]),[xu,Gc]=f.useState(!1),[hg,cy]=f.useState(!1),[fg,lp]=f.useState(!1),[Er,Zi]=f.useState(!1),[uy,mg]=f.useState(!1),[dy,hy]=f.useState(!1),[of,e5]=f.useState(!1),[RD,DD]=f.useState(!1),[pg,fy]=f.useState(void 0),[Zr,Ui]=f.useState("chat"),wce=!Qe||Zr==="split",[Hd,t5]=f.useState([]),n5=f.useRef(Hd);n5.current=Hd;const[bk,s5]=f.useState(null),[hs,qd]=f.useState(null),eo=f.useCallback(()=>qd(null),[]),LD=f.useCallback(j=>{eo(),window.setTimeout(()=>{var F,J;(F=Si.current)==null||F.setText(`/${j} `),(J=Si.current)==null||J.focus()},0)},[eo]),Aa=f.useCallback(j=>{Ui("chat"),qd(j)},[]),kce=f.useCallback(async()=>{const j=await Qn.loadMcpStatus();s5({status:j,toolsByServer:{},resourcesByServer:{},showDescriptions:!1,showSchema:!1,showTips:!1})},[Qn]),r5=f.useCallback(()=>{qd(null),Ui("scheduledTasks")},[]),gg=f.useCallback(()=>{qd(null),Ui("goals")},[]),PD=f.useCallback(()=>{ht.enabled&&(qd(null),Ui("chat"),Ee(!0),Ie(!0))},[ht.enabled]),cp=f.useCallback(j=>{qd(null),t5(F=>{const J=Array.from(new Set((j??[]).filter(Boolean))).slice(0,hm);return J.length>0?J:F.length>0?F:ue.sessionId?[ue.sessionId]:[]}),Ui("split")},[ue.sessionId]),i5=f.useMemo(()=>Array.from(new Set((V??[]).filter(Boolean))).slice(0,hm).join("\0"),[V]),da=V!==void 0,wu=f.useRef(R);wu.current=R;const OD=f.useCallback(()=>{var F;if(!da){cp();return}const j=Hd.length>0?Hd:ue.sessionId?[ue.sessionId]:[];(F=wu.current)==null||F.call(wu,j)},[ue.sessionId,da,cp,Hd]);f.useEffect(()=>{if(!da)return;const j=i5?i5.split("\0"):[];t5(F=>YSt(F,j)?F:j),j.length>0?(qd(F=>F===null?F:null),Ui(F=>F==="split"?F:"split")):Ui(F=>F==="split"?"chat":F)},[da,i5]);const _ce=f.useCallback(j=>{var F;da||t5(j),(F=wu.current)==null||F.call(wu,j)},[da]),yk=f.useCallback(()=>{var j;da&&((j=wu.current)==null||j.call(wu,[]))},[da]),Sce=f.useCallback(()=>{yk(),ddt(),Aa("sessions")},[yk,Aa]);f.useEffect(()=>{const j=ldt(window.location.search);if(j.length>0){const J=new URL(window.location.href);J.searchParams.delete("split"),window.history.replaceState(null,"",J),da||cp(j);return}if(da)return;const F=udt();F.length>0&&cp(F)},[da,cp]),f.useEffect(()=>{da||Zr==="split"&&Hd.length>0&&cdt(Hd)},[Zr,Hd,da]);const o5=f.useRef(!1),a5=f.useRef(!1);f.useEffect(()=>{if(Je){a5.current&&(a5.current=!1,!da&&n5.current.length>0&&Ui(j=>j==="chat"?"split":j));return}if(hs==="sessions"&&qd(null),Zr==="split"&&(yk(),Ui("chat"),o5.current=!0,!da)){a5.current=!0;const j=n5.current[0];j&&!kt.current&&Ae.loadSession(j).catch(()=>{})}},[Je,hs,Zr,yk,da,Ae]),f.useEffect(()=>{var j;Zr!=="chat"||!o5.current||(o5.current=!1,!hs&&!Ji&&((j=Si.current)==null||j.focus()))},[Zr,hs,Ji]);const $D=f.useRef(null),l5=f.useRef(null),c5=f.useRef(null),BD=f.useRef(hs),zD=f.useRef(Ji);f.useEffect(()=>{var J,ce,je,tt,nn;const j=BD.current,F=zD.current;if(BD.current=hs,zD.current=Ji,hs){if(hs==="extensions"){(J=l5.current)==null||J.focus();return}if(hs==="plugins"){(ce=c5.current)==null||ce.focus();return}(je=$D.current)==null||je.focus()}else j?Ji||(tt=Si.current)==null||tt.focus():F&&!Ji&&((nn=Si.current)==null||nn.focus())},[hs,Ji]),f.useEffect(()=>{Ji&&(hs&&qd(null),On&&Hn(null),xu&&Gc(!1),(Zr==="scheduledTasks"||Zr==="goals")&&Ui("chat"))},[Ji,hs,On,xu,Zr]);const Cce=Ta!==null&&!hs&&On===null&&!xu&&Zr==="chat",Tce=xr!==null&&!hs&&On===null&&!xu&&Zr==="chat",[FD,HD]=f.useState(!1),[up,u5]=f.useState(!1),qD=f.useRef(up),[Ece,Ace]=f.useState(0),[jce,Nce]=f.useState(0),[Mce,UD]=f.useState(0),Ice=f.useCallback(()=>{let j=!1;return UD(F=>F+1),()=>{j||(j=!0,UD(F=>Math.max(0,F-1)))}},[]),WD=f.useRef((W==null?void 0:W.extensionsVersion)??0);f.useEffect(()=>{const j=(W==null?void 0:W.extensionsVersion)??0;if(j!==WD.current){WD.current=j;const F=W==null?void 0:W.lastExtensionChange;if((F==null?void 0:F.status)==="failed"){pe.dispatch([{type:"error",text:ge("extensions.action.failed",{name:F.name??"",source:F.source??"",error:F.error??ge("error.unknown")})}]);return}if((F==null?void 0:F.status)==="installed"){const J=F.name??F.source??ge("extensions.label");pe.dispatch([{type:"status",text:F.version?ge("extensions.install.installedWithVersion",{name:J,version:F.version}):ge("extensions.install.installed",{name:J})}])}else if(F!=null&&F.status){const J=F.name??F.source??ge("extensions.label"),ce=F.status==="updated"&&F.version?"extensions.manage.updatedWithVersion":`extensions.manage.${F.status}`;pe.dispatch([{type:"status",text:ge(ce,{name:J,version:F.version??""})}])}Ae.refreshCommands().catch(()=>{pe.dispatch([{type:"error",text:ge("extensions.commands.refreshFailed")}])})}},[W==null?void 0:W.extensionsVersion,W==null?void 0:W.lastExtensionChange,Ae,pe,ge]);const[Rce,Dce]=f.useState("workspace"),[Lce,my]=f.useState(null),[Pce,VD]=f.useState(!1),[Oce,GD]=f.useState(!1),vk=f.useRef(null),bg=f.useRef(null),[d5,xk]=f.useState(null),[Ud,h5]=f.useState(n??zr.Dark),[af,KD]=f.useState(""),wk=f.useRef(af);wk.current=af;const yg=f.useCallback(j=>{wk.current=j,KD(j)},[]),Ws=f.useRef(ue);Ws.current=ue;const Ro=f.useCallback(()=>Ws.current.sessionId?!0:(Ln("info",ge("localCommand.noSession")),!1),[Ln,ge]),f5=ue.displayName,[pc,m5]=f.useState("default"),p5=f.useRef(pc);p5.current=pc;const py=f.useCallback(j=>{p5.current=j,m5(j)},[]),[g5,dp]=f.useState(!1),gy=f.useRef(null),b5=f.useRef(null),[kk,by]=f.useState({mode:"current"}),yy=f.useRef(kk);f.useEffect(()=>{yy.current=kk},[kk]);const YD=f.useRef(0),ku=f.useRef(null),XD=f.useRef(t);XD.current=t;const _k=f.useRef(void 0);f.useEffect(()=>{Zr!=="goals"&&(_k.current=void 0)},[Zr]);const QD=f.useCallback(()=>{const j=Ws.current.sessionId;if(gy.current)return!j||j===b5.current?gy.current:Promise.resolve();if(j)return Promise.resolve();const F=(async()=>{var Vt,pt;const ce=wk.current||Ws.current.currentModel,je=p5.current||Ws.current.currentMode,tt=(Vt=hn.find(it=>it.primary))==null?void 0:Vt.cwd,nn=Jr.current,Jt=nn?(pt=hn.find(it=>it.cwd===nn&&it.trusted===!0))==null?void 0:pt.cwd:void 0;await qht({sessionActions:Ae,modelId:ce,modeId:je,workspaceCwd:me??Jt??tt,worktree:yy.current.mode==="worktree"?{slug:yy.current.slug}:void 0,branch:yy.current.mode==="branch"?{name:yy.current.name}:void 0,onSessionCreated:XD.current,onSessionAllocated:it=>{b5.current=it},getCurrentSessionId:()=>Ws.current.sessionId}).then(it=>{it.worktree&&Xt(it.worktree),it.branch&&fs(it.branch),by({mode:"current"})}),Ii(void 0)})();gy.current=F;const J=()=>{gy.current===F&&(gy.current=null,b5.current=null)};return F.then(J,J),F},[me,Ae,hn]),Wd=f.useRef(He);Wd.current=He;const JD=f.useRef(b);JD.current=b;const[ZD,eL]=f.useState(0),vy=f.useRef(null);f.useEffect(()=>()=>{vy.current!==null&&clearTimeout(vy.current)},[]);const tL=f.useCallback(j=>{xt==null||xt(j),eL(F=>F+1)},[xt]),ha=f.useRef(tL);ha.current=tL;const ja=f.useCallback(async(j,F,J)=>{var xs,ei;const ce=!j.trimStart().startsWith("/"),je=zd.current,tt=ip.current,nn=rf.current,Jt=dg.current;!(J!=null&&J.retry)&&ce&&(zd.current=j,ip.current=F,rf.current=null),op(!1);const Vt=!Ws.current.sessionId;if(Wd.current){dp(!0);try{await Wd.current({sessionId:Ws.current.sessionId,prompt:j})}catch(hi){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",hi),dp(!1),zd.current=je,ip.current=tt,rf.current=nn,op(Jt);return}Vt||dp(!1)}!Wd.current&&Vt&&dp(!0),iy();try{await QD()}finally{Vt&&dp(!1)}const pt={images:F,inputAnnotations:J==null?void 0:J.inputAnnotations,optimisticUserMessage:J==null?void 0:J.optimisticUserMessage,retry:J==null?void 0:J.retry,...J!=null&&J.onAdmitted?{onAdmitted:J.onAdmitted}:{}};J!=null&&J.commitComposerAccepted?J.commitComposerAccepted():J!=null&&J.clearComposerOnPromptStart&&((xs=Si.current)==null||xs.clear());const it=Ws.current.sessionId;return it&&j.trim()&&((ei=ha.current)==null||ei.call(ha,{type:"submit",sessionId:it,prompt:j,queued:!1}),vy.current!==null&&clearTimeout(vy.current),vy.current=setTimeout(()=>{eL(hi=>hi+1)},2e3)),await Ae.sendPrompt(j,pt)},[iy,QD,Ae]),$ce=f.useMemo(()=>(ue.models??[]).filter(Ev).map(j=>({id:j.id,label:Yf(j.label||j.id)})),[ue.models]),hp=Ps,Sk=!!(!ue.sessionId&&((FL=hn.find(j=>j.cwd===Ps))!=null&&FL.trusted)&&(ve!=null&&ve.branch));f.useEffect(()=>{Sk||by({mode:"current"})},[Sk]);const _u=hg||fg||Er||uy||dy||of||RD||pg!==void 0||On!==null||xu||d5!==null||bk!==null||FD||up||ps||Ur!=="clear"||Mce>0||hs!==null||Zr!=="chat",tn=f.useCallback((j,F)=>{if(nE(j)||lY(j)||qg(j))return;const J=QSt(j,F);console.error("[web-shell]",J,j),Ln("error",J)},[Ln]),Bce=f.useCallback(j=>Ln("success",j),[Ln]),{queuedPrompts:zce,queuedTexts:Fce,enqueuePrompt:y5,removeQueuedPrompt:Hce,insertQueuedPrompt:qce,editQueuedPrompt:Uce,editLastQueuedPrompt:Wce,clearQueuedPrompts:Vce}=ole({connected:mc,sessionId:ue.sessionId,clientId:ue.clientId,streamingState:dr,sessionActions:Ae,store:pe,editorRef:Si,reportError:tn,notifySuccess:Bce,t:ge}),fp=f.useCallback((j,F,J,ce,je)=>{var Jt;if(Wd.current)return Wd.current({sessionId:Ws.current.sessionId,prompt:j}).then(()=>{var it,vs;y5(j,F,J,je)!==!1&&(ce?ce():(it=Si.current)==null||it.clear());const pt=Ws.current.sessionId;pt&&j.trim()&&((vs=ha.current)==null||vs.call(ha,{type:"submit",sessionId:pt,prompt:j,queued:!0}))}).catch(Vt=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",Vt)}),!1;const tt=y5(j,F,J,je),nn=Ws.current.sessionId;return nn&&j.trim()&&((Jt=ha.current)==null||Jt.call(ha,{type:"submit",sessionId:nn,prompt:j,queued:!0})),tt},[y5]);f.useEffect(()=>{for(const j of qn)JSt(j)?Ln(ZSt(j),j.message):j.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",j),ir(j.id)},[ir,qn,Ln]);const v5=f.useRef(m);v5.current=m,f.useEffect(()=>{var j;kt.current=ue.sessionId,(j=Fe.current)==null||j.abort(),Fe.current=null,Mo(null),Rr(null),xk(null),Nk.current=0},[ue.sessionId]);const nL=f.useCallback(()=>{var je;if(!Ro())return;const j=`local-recap-${pr.current++}`,F=Vn.length,J=(je=Vn.at(-1))==null?void 0:je.id,ce=ue.sessionId;Mo({anchorAfterId:J,anchorIndex:F,message:{id:j,role:"system",content:`※ ${ge("recap.label")}: ${ge("recap.loading")}`,variant:"info",source:"recap"}}),Ae.recapSession().then(tt=>{kt.current===ce&&Mo({anchorAfterId:J,anchorIndex:F,message:{id:j,role:"system",content:tt.recap?`※ ${ge("recap.label")}: ${tt.recap}`:ge("recap.empty"),variant:"info",source:"recap"}})},tt=>{kt.current===ce&&(Mo(null),!nE(tt)&&!qg(tt)&&console.warn("[web-shell] unhandled recap failure",tt))})},[ue.sessionId,Vn,Ro,Ae,ge]),sL=f.useCallback(j=>{var tt;const F=j.trim();if(!F){Ln("error",ge("btw.empty"));return}if(!Ro())return;const J=`local-btw-${Cr.current++}`,ce=ue.sessionId;(tt=Fe.current)==null||tt.abort();const je=new AbortController;Fe.current=je,Rr({id:J,role:"btw",question:F,answer:"",isPending:!0}),Ae.btwSession(F,{signal:je.signal}).then(nn=>{kt.current===ce&&Fe.current===je&&(Fe.current=null,Rr({id:J,role:"btw",question:F,answer:nn.answer||ge("btw.emptyAnswer"),isPending:!1}))},nn=>{kt.current===ce&&Fe.current===je&&(Fe.current=null,Rr(null),!nE(nn)&&!qg(nn)&&console.warn("[web-shell] unhandled btw failure",nn))})},[ue.sessionId,Ln,Ro,Ae,ge]),rL=f.useCallback(()=>{var j;(j=Fe.current)==null||j.abort(),Fe.current=null,Rr(null)},[]);f.useEffect(()=>{const j=F=>{var nn;if(_u||Ss)return;const J=ns;if(!J||J.role!=="btw")return;const ce=F.key.toLowerCase(),je=F.key==="Escape"&&!F.ctrlKey&&!F.metaKey&&!F.altKey&&!F.shiftKey,tt=F.ctrlKey&&!F.metaKey&&!F.altKey&&!F.shiftKey&&(ce==="c"||ce==="d");if(J.isPending){if(!je&&!tt)return}else{const Jt=((nn=Si.current)==null?void 0:nn.hasInput())??!1;if(!(!F.ctrlKey&&!F.metaKey&&!F.altKey&&!F.shiftKey&&(F.key==="Escape"||!Jt&&(F.key==="Enter"||F.key===" "))))return}F.preventDefault(),F.stopPropagation(),rL()};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[_u,ns,rL,Ss]);const Vd=f.useCallback((j,F)=>Bht(vu.current!=="idle",j,F,{append:J=>pe.appendLocalUserMessage(J)}),[pe]),Su=f.useCallback(()=>(Ln("error",ge("queue.commandBlocked")),!1),[Ln,ge]),xy=f.useCallback(j=>{h5(j),s==null||s(j)},[s]),vg=f.useCallback(j=>{vn(j),i==null||i(j)},[i]),iL=f.useCallback(()=>{hy(!0)},[]),oL=k9({autoLoad:!0}),Ck=W0e({autoLoad:!0}),Tk=Ck.reload,[Gce,Ek]=f.useState(!1),{settings:lf,setValue:gc,reload:cf}=oL,xg=lf.find(j=>j.key===Vp),wg=lf.find(j=>j.key===$St),kg=lf.find(j=>j.key===l4),Kce=(()=>{const j=E2(lf,Ci,"voiceModel");return typeof j=="string"&&j.trim()?j.trim():void 0})(),Yce=(()=>{const j=E2(lf,Ci,"visionModel");if(!(typeof j!="string"||!j.trim()))return pSt(j.trim())})(),Xce=(()=>{const j=E2(lf,Ci,"fastModel");return typeof j=="string"&&j.trim()?j.trim():void 0})(),Qce=f.useMemo(()=>{const j=E2(lf,Ci,"modelFallbacks");return typeof j=="string"?j.split(",").map(F=>F.trim()).filter(Boolean):[]},[lf,Ci]),Jce=f.useMemo(()=>{const j=new Set,F=[];for(const J of(ue.models??[]).filter(Ev).filter(ce=>!ce.isRuntime)){const ce=J.baseModelId??KW(J.id);j.has(ce)||(j.add(ce),F.push({baseId:ce,label:Yf(J.label||J.baseModelId||J.id)}))}return F},[ue.models]),[Ak,aL]=f.useState(!1),x5=f.useRef(Ak);x5.current=Ak,f.useEffect(()=>{if(n){h5(n);return}const j=M9(xg==null?void 0:xg.values.effective);j&&h5(j)},[n,xg==null?void 0:xg.values.effective]),f.useEffect(()=>{if(r!==void 0){vn(wh(r));return}const j=C9(kg==null?void 0:kg.values.effective);j&&vn(j)},[r,kg==null?void 0:kg.values.effective]);const Zce=f.useCallback((j,F="user")=>{const J=Le,je=`/language ui ${j}${F==="workspace"?" --project":" --global"}`;vg(j);const tt=()=>Promise.all([Ae.refreshCommands(),cf()]);if(vu.current!=="idle"){vg(J),Su();return}ja(je,void 0).then(tt).catch(nn=>{vg(J),tn(nn,"Failed to sync /language command")})},[Su,vg,cf,tn,ja,Le,Ae]),lL=f.useCallback(()=>{if(vu.current!=="idle"){pe.dispatch([{type:"status",text:ge("clear.blocked")}]);return}pe.reset()},[pe,ge]),cL=f.useCallback(()=>{const j=x5.current,F=!x5.current;aL(F),gc("workspace",OSt,F).catch(J=>{aL(j),tn(J,ge("compact.saveFailed"))})},[tn,gc,ge]),uf=f.useCallback(j=>{if(!I3(j)){tn(new Error(`Unsupported approval mode: ${j}`),ge("local.approvalMode"));return}if(!Ws.current.sessionId){py(j);return}Ae.setApprovalMode(j).then(F=>{const J=F.mode||j;m5(J);const ce=hc.current;if(!ce)return;if(j==="yolo"||j==="auto-edit"&&n4t(ce)){const tt=ce.options.find(nn=>nn.kind==="allow_once");if(tt){const nn=ce.title||"";pe.dispatch([{type:"status",text:ge("mode.autoApproved",{tool:nn})}]),Ae.submitPermission(ce.id,tt.id).catch(Jt=>{tn(Jt,"Failed to auto-approve tool call")})}}}).catch(F=>{tn(F,ge("local.approvalMode"))})},[Ae,tn,pe,ge,py]);f.useEffect(()=>{vu.current=dr},[dr]),f.useEffect(()=>{Za.current=On,Ea.current=Nr,qD.current=up},[On,Nr,up]),f.useEffect(()=>{let j=null;for(let J=Be.length-1;J>=0;J--){const ce=Be[J];if((ce==null?void 0:ce.kind)==="user")break;if((ce==null?void 0:ce.kind)==="error"&&ce.source==="turn_error"){j=ce.id;break}if((ce==null?void 0:ce.kind)!=="debug")break}const F=mc&&j!==null&&j!==rf.current&&zd.current.length>0;sf.current=F?j:null,op(F)},[Be,mc]),f.useEffect(()=>{d==null||d(dr)},[dr,d]);const uL=f.useRef(dr),dL=f.useRef(void 0);f.useEffect(()=>{var F;const j=uL.current;if(uL.current=dr,dr!=="idle"&&(dL.current=Ws.current.sessionId),j!=="idle"&&dr==="idle"){const J=Ws.current.sessionId;if(!J||J!==dL.current)return;const ce=sf.current!=null?new Error(`Turn error (block ${sf.current})`):void 0;(F=ha.current)==null||F.call(ha,{type:"turn_complete",sessionId:J,error:ce})}},[dr]),f.useEffect(()=>{u==null||u(ue.status)},[ue.status,u]),f.useEffect(()=>{ie==null||ie(Be)},[Be,ie]),f.useEffect(()=>{if(ue.error){const j=new Error(ue.error);h==null||h(j)}},[ue.error,h]),f.useEffect(()=>{KD(ue.currentModel??"")},[ue.currentModel,ue.sessionId]),f.useEffect(()=>{m5(ue.currentMode??"default")},[ue.currentMode,ue.sessionId]),f.useEffect(()=>{const j=We.current;if(ue.sessionId&&ue.sessionId!==j&&$d(null),We.current=ue.sessionId,!ue.sessionId&&ue.missingSession){ms.current=ue.sessionId,In.current=void 0,we.current=void 0;return}const F=hn.find(ce=>ce.cwd===ue.workspaceCwd);if(ue.sessionId&&!Bt.capabilities)return;const J=F&&!F.primary?F.id:void 0;ms.current===ue.sessionId&&In.current===J&&we.current===ue.workspaceCwd||(ms.current=ue.sessionId,In.current=J,we.current=ue.workspaceCwd,e==null||e(ue.sessionId,J,ue.workspaceCwd))},[ue.missingSession,ue.sessionId,ue.workspaceCwd,e,Bt.capabilities,hn]);const hL=f.useRef(void 0),w5=f.useRef(void 0);f.useEffect(()=>{var J;const j=ue.sessionId,F=ue.displayName;if(!(!j||!F)){if(j!==hL.current){hL.current=j,w5.current=F;return}F!==w5.current&&(w5.current=F,(J=ha.current)==null||J.call(ha,{type:"rename",sessionId:j,newName:F}))}},[ue.sessionId,ue.displayName]),f.useEffect(()=>{const j=FSt(Be);$d(F=>j?(F==null?void 0:F.condition)===j.condition&&F.setAt===j.setAt?F:j:F&&null)},[Be]),f.useEffect(()=>{const j=F=>{const J=F.detail;if(!(J!=null&&J.active)){$d(null);return}J.condition&&$d({condition:J.condition,setAt:J.setAt??Date.now()})};return window.addEventListener(IN,j),()=>window.removeEventListener(IN,j)},[]);const jk=f.useRef(null),Nk=f.useRef(0);f.useEffect(()=>{Nk.current=0},[ue.sessionId]),f.useEffect(()=>{function J(){if(document.hidden){jk.current===null&&(jk.current=Date.now());return}const ce=jk.current;if(jk.current=null,ce===null||Date.now()-ce<18e4||vu.current!=="idle"||!ue.sessionId)return;const je=pe.getSnapshot().blocks.length;je-Nk.current<4||(Nk.current=je,Ae.recapSession().then(tt=>{tt.recap&&pe.dispatch([{type:"status",text:`※ ${ge("recap.label")}: ${tt.recap}`,source:"recap"}])},tt=>{console.error("[auto-recap] failed:",tt)}))}return document.addEventListener("visibilitychange",J),()=>document.removeEventListener("visibilitychange",J)},[ue.sessionId,Ae,pe,ge]);const k5=f.useCallback(()=>{const j=I3(pc)?ov.indexOf(pc):-1,F=ov[(j+1)%ov.length];uf(F)},[pc,uf]),wy=f.useCallback((j,F)=>{Ro()&&(Vd(j)||Ae.getContextUsage({detail:F}).then(J=>{pe.dispatch([{type:"status",text:rHe(J)}]),Wc("smooth")}).catch(J=>{tn(J,"Failed to load context usage")}))},[Vd,pe,Ro,Ae,tn,Wc]),eue=f.useCallback(()=>{wy("/context detail",!0)},[wy]),Mk=f.useCallback(j=>{Ro()&&Ae.branchSession(j||void 0).then(F=>{pe.dispatch([{type:"status",text:ge("branch.success",{name:F.displayName})}])}).catch(F=>{tn(F,ge("branch.failed"))})},[tn,Ro,Ae,pe,ge]),tue=f.useCallback(()=>{Mk()},[Mk]),ky=f.useRef(0),Ik=f.useCallback(j=>{const F=++ky.current;return window.setTimeout(()=>{var J;F!==ky.current||Uc.current||j!==void 0&&Ws.current.sessionId!==j||(J=Si.current)==null||J.focus()},0),F},[]),tl=f.useCallback(async(j,F)=>{const J=me??j;Jr.current=J,Ii(J),by({mode:"current"}),qe(),eo(),F!=null&&F.keepView||Ui("chat");let ce;try{const je=Ae.clearSession();return ce=Ik(),await Promise.all([je,Tn(J)]),Xt(void 0),fs(void 0),!0}catch(je){return ky.current===ce&&(ky.current+=1),tn(je,"Failed to start a new chat"),!1}},[qe,eo,me,tn,Tn,Ik,Ae]),_y=f.useCallback(async(j,F=hn)=>{var ce;if(ds.current)return;const J=Symbol("workspace-switch");ds.current=J;try{const je=(ce=F.find(nn=>nn.primary))==null?void 0:ce.cwd,tt=j??je;if(j){const nn=F.find(Jt=>Jt.cwd===j);if(!(nn!=null&&nn.trusted))return}if(Ws.current.sessionId){if(Ws.current.workspaceCwd===tt)return;await tl(j);return}Jr.current=j,Ii(j)}finally{ds.current===J&&(ds.current=null)}},[tl,hn]),Rk=f.useCallback(async j=>{var F;try{const J=await((F=Bt.refreshCapabilities)==null?void 0:F.call(Bt)),ce=(J==null?void 0:J.workspaces)??[],je=ce.find(tt=>tt.cwd===j);return je!=null&&je.trusted&&await _y(je.primary?void 0:je.cwd,ce),J!==void 0}catch(J){return tn(J,"Failed to refresh the workspace list"),!1}},[tn,_y,Bt]),nue=f.useCallback(async(j,F,J)=>{if(Wn.current)throw new Error(ge("sidebar.addWorkspaceBusyError"));const ce=Symbol("workspace-mutation");Wn.current=ce,ts(!0);try{const je=es===!0&&F,tt=Dt?J:void 0,nn=await Qn.addWorkspace(j,{persist:je,...tt?{displayName:tt}:{}});if(je&&nn.persisted!==!0)throw new Error(ge("sidebar.addWorkspacePersistenceError"));if(!await Rk(nn.cwd))throw new Error(ge("sidebar.addWorkspaceRefreshError"))}finally{Wn.current===ce&&(Wn.current=null,ts(!1))}},[es,Rk,ge,Dt,Qn]),_5=f.useCallback(async()=>{var j;Cs("refreshing");try{const F=await((j=Bt.refreshCapabilities)==null?void 0:j.call(Bt));if(!F)return;const J=F.workspaces??[],ce=ui.current;if(ce){const je=J.find(tt=>tt.cwd===ce);je!=null&&je.trusted&&await _y(je.primary?void 0:je.cwd,J),ui.current=void 0,Cs("clear")}else Cs("awaiting-ack")}catch(F){tn(F,"Failed to refresh the workspace list")}},[tn,Cs,_y,Bt]),sue=f.useCallback(async()=>{if(Sn.current!=="clear"||Wn.current)return;const j=Symbol("workspace-mutation");Wn.current=j,ts(!0);try{const F=await Qn.addScratchWorkspace();await Rk(F.cwd)||(ui.current=F.cwd,Cs("refreshing"))}catch(F){F instanceof ic&&(F.status<500||F.status===501)?tn(F,ge("sidebar.addWorkspaceError")):(ui.current=void 0,Cs("refreshing"),await _5())}finally{Wn.current===j&&(Wn.current=null,ts(!1))}},[Rk,_5,tn,Cs,ge,Qn]);f.useEffect(()=>()=>{Bd.current&&clearTimeout(Bd.current)},[]);const rue=f.useCallback(j=>{oy.current=j,Bd.current&&clearTimeout(Bd.current),Bd.current=setTimeout(()=>{gk(j),Bd.current=null},120)},[]),{suggestion:Sy,dismiss:fL,suppress:mL}=ISt({enabled:((HL=ue.capabilities)==null?void 0:HL.features.includes("session_generation"))===!0,inputText:pk,messages:Vn,sessionId:ue.sessionId,contextUsageRatio:(ue.contextWindow??0)>0?(ue.tokenCount??0)/(ue.contextWindow??0):0,isRunning:dr!=="idle",dialogOpen:_u||Ji,generateContent:Ae.generateSessionContent}),Dk=f.useCallback(j=>{const F=ku.current;if(!F||j!==void 0&&F.token!==j)return;const J=Ws.current.sessionId;if(F.sourceSessionId!==void 0&&J!==void 0&&J!==F.sourceSessionId){ku.current=null,nf(!1);return}F.sessionClearCompleted&&J===void 0&&(F.submitScheduled||(ku.current={...F,submitScheduled:!0},window.setTimeout(()=>{var je,tt;const ce=ku.current;if(!(!ce||ce.token!==F.token)){if(Ws.current.sessionId!==void 0){ku.current=null,nf(!1);return}ku.current=null,(je=Si.current)==null||je.submit(),(tt=Si.current)==null||tt.focus(),nf(!1)}},0)))},[]);f.useEffect(()=>{Dk()},[ue.sessionId,Dk]);const iue=f.useCallback(()=>{const j=oy.current.trim();if(!j||rp)return;if((Sy==null?void 0:Sy.classifiedInput)!==j){fL();return}mL(),nf(!0);const F=YD.current+1;YD.current=F,ku.current={token:F,sourceSessionId:Ws.current.sessionId,sessionClearCompleted:!1,submitScheduled:!1},tl().then(J=>{const ce=ku.current;if(!J||(ce==null?void 0:ce.token)!==F){(ce==null?void 0:ce.token)===F&&(ku.current=null),nf(!1);return}ku.current={...ce,sessionClearCompleted:!0},e==null||e(void 0),Dk(F)})},[tl,fL,Dk,rp,Sy,e,mL]),pL=f.useMemo(()=>({openSplitView:()=>{qe(),OD()},openSessionOverview:()=>{qe(),Aa("sessions")},openSessionDrawer:PD,createNewSession:()=>tl()}),[qe,tl,Aa,PD,OD]);f.useEffect(()=>{tV(K,pL)},[pL,K]),f.useEffect(()=>()=>{tV(K,null)},[K]);const oue=f.useCallback(async()=>{if(!fc.current){fc.current=!0,dk(!0);try{await tl()&&(e==null||e(void 0))}finally{fc.current=!1,dk(!1)}}},[tl,e]),mp=f.useCallback(async(j,F)=>{ky.current+=1,Re(j),by({mode:"current"}),Xt(void 0),fs(void 0),qe(),eo();try{await Ae.loadSession(j,{workspaceCwd:F})}catch(J){throw Re(ce=>ce===j?null:ce),J}},[qe,eo,Ae]),S5=f.useCallback(j=>{Ui("chat"),mp(j).catch(F=>{tn(F,"Failed to open session")})},[mp,tn]);f.useEffect(()=>{const j=F=>{const J=F.detail;typeof J=="string"&&J&&S5(J)};return window.addEventListener("qwen:open-session",j),()=>window.removeEventListener("qwen:open-session",j)},[S5]),f.useEffect(()=>{De!==null&&ue.sessionId===De&&!ue.loadingTranscript&&!ue.catchingUp&&(Re(null),Ik(De))},[ue.catchingUp,ue.loadingTranscript,ue.sessionId,Ik,De]);const pp=f.useRef(null),C5=f.useCallback(j=>{const F=pp.current;F&&F.sessionId===j&&(clearTimeout(F.timer),pp.current=null)},[]),Lk=f.useCallback(j=>new Promise((F,J)=>{let ce=!1;ja(j,void 0,{onAdmitted:()=>{ce||(ce=!0,F())}}).then(()=>{ce||J(new Error("Run was cancelled before it started"))},tt=>{ce||J(tt)})}),[ja]),Pk=f.useCallback(()=>{const j=pp.current,F=Ws.current;!j||F.sessionId!==j.sessionId||F.loadingTranscript||F.catchingUp||(clearTimeout(j.timer),pp.current=null,Lk(j.prompt).then(()=>j.resolve(),J=>j.reject(J)))},[Lk]),aue=f.useCallback((j,F)=>{if(Ui("chat"),!F)return Lk(j);const J=pp.current;return J&&(clearTimeout(J.timer),pp.current=null,J.reject(new Error("superseded by another run"))),new Promise((ce,je)=>{const tt=setTimeout(()=>{C5(F),je(new Error("Timed out switching to the task session"))},LSt);pp.current={sessionId:F,prompt:j,resolve:ce,reject:je,timer:tt},mp(F).then(()=>Pk()).catch(nn=>{C5(F),je(nn)})})},[Lk,mp,C5,Pk]);f.useEffect(()=>{Pk()},[ue.sessionId,ue.loadingTranscript,ue.catchingUp,Pk]);const T5=f.useCallback(()=>{Ro()&&Ae.getTasks().then(j=>{xk({snapshot:j})}).catch(j=>{tn(j,"Failed to load tasks")})},[tn,Ro,Ae]),gL=f.useCallback((j,F)=>{$d({condition:j,setAt:F}),pe.dispatch([{type:"status",text:Lq({kind:"set",condition:j,setAt:F})}])},[pe]),bL=f.useCallback(j=>{j&&(pe.dispatch([{type:"status",text:Lq({kind:"cleared",condition:j.condition,durationMs:Date.now()-j.setAt})}]),$d(null))},[pe]),Ok=f.useCallback(j=>Ro()?(pe.appendLocalUserMessage(j),Ae.clearGoal().catch(F=>{tn(F,"Failed to clear /goal")}),!0):!1,[tn,Ro,Ae,pe]),lue=f.useCallback(()=>Ae.getRewindSnapshots(),[Ae]),cue=f.useCallback(j=>Ae.rewindSession(j,{rewindFiles:!1}).then(()=>{}),[Ae]),uue=f.useCallback(j=>{if(qg(j))return;const F=j instanceof Error?j.message:String(j);Ln("error",ge("rewind.failed",{reason:F}))},[Ln,ge]),yL=f.useCallback((j,F,J)=>{const ce=JN(j),je=(J==null?void 0:J.sendToDaemon)??!0,tt=()=>{const nn=!!Wd.current,Jt=!Ws.current.sessionId||nn;return ja(j,F,{clearComposerOnPromptStart:Jt,commitComposerAccepted:nn?J==null?void 0:J.commitComposerAccepted:void 0}).catch(Vt=>{tn(Vt,"Failed to send /goal command")}),!Jt};return ce&&jD(ce)?je?Ok(j):(pe.appendLocalUserMessage(j),bL(hk.current),!0):ce?je?tt():(pe.appendLocalUserMessage(j),gL(ce,Date.now()),!0):(gg(),!0)},[bL,gL,Ok,gg,tn,ja,pe,Ws]),Cy=f.useMemo(()=>new Set((p??[]).map(tE).filter(Boolean)),[p]),due=Cy.has("settings"),vL=f.useCallback((j,F,J,ce)=>{var nn;if(ule(j,JD.current,tn))return!0;if(Ws.current.loadingTranscript)return Ln("warning",ge("editor.sessionLoading")),!1;if(lle({connectionStatus:Ws.current.status,hasSession:!!Ws.current.sessionId,restartSseOnPrompt:!!pn}))return Ln("warning",ge("editor.connectionDisconnected")),!1;const je=vu.current!=="idle",tt=(Jt,Vt,pt,it)=>{const vs=!!Wd.current,xs=!Ws.current.sessionId||vs;return ja(Jt,Vt,{...it,clearComposerOnPromptStart:xs,commitComposerAccepted:vs?J:void 0}).catch(ei=>tn(ei,pt)),!xs};if(j.startsWith("/")){const Jt=j.match(cle);if(Jt){const Vt=Jt[1];if(Cy.has(tE(Vt)))return je?fp(j,F,void 0,J,ce==null?void 0:ce.inputAnnotations):tt(j,F,"Failed to send hidden slash command",{inputAnnotations:ce==null?void 0:ce.inputAnnotations});if(Vt==="help")return hy(!0),!0;if(Vt==="diff")return hp?(fy({workspaceCwd:hp,view:"diff"}),!0):(Ln("info",ge("localCommand.diffNoWorkspace")),!0);if(Vt==="log")return hp?(fy({workspaceCwd:hp,view:"log"}),!0):(Ln("info",ge("localCommand.logNoWorkspace")),!0);if(Vt==="tasks")return T5(),!0;if(Vt==="goal")return JN(j)?je?Qyt(j)?Ok(j):Su():yL(j,F,{commitComposerAccepted:J}):(gg(),!0);if(Vt==="theme"){const pt=j.slice(Jt[0].length).trim().toLowerCase();return pt==="dark"||pt==="light"?xy(pt):pt?Ln("error",ge("error.unsupportedTheme")):e5(!0),!0}if(Vt==="language"){const pt=j.slice(Jt[0].length).trim(),[it,vs]=pt.split(/\s+/);if(!pt)return pe.dispatch([{type:"status",text:[ge("language.current",{language:T9(Le)}),ge("language.usage"),ge("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((it==null?void 0:it.toLowerCase())==="ui"){if(!vs)return pe.dispatch([{type:"status",text:[ge("language.set"),"",ge("language.usage"),"",ge("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const xs=vs.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(xs))return Ln("error",ge("language.invalid")),!0;const hi=wh(vs);if(vg(hi),!je){const Il=!!Wd.current,Cu=!Ws.current.sessionId||Il;return ja(`/language ui ${hi}`,void 0,{clearComposerOnPromptStart:Cu,commitComposerAccepted:Il?J:void 0}).then(()=>Ae.refreshCommands()).catch(bc=>{tn(bc,"Failed to sync /language command")}),!Cu}return!0}}if(Vt==="copy"){const pt=j.slice(Jt[0].length).trim();return aSt(Hi.current,pt).then(it=>{pe.dispatch([{type:it.status==="error"?"error":"status",text:a4t(it.message,ge)}])}).catch(it=>{tn(it,ge("copy.failedFallback"))}),!0}if(Vt==="delete")return lp(!0),!0;if(Vt==="release")return Zi(!0),!0;if(Vt==="rewind")return Ro()?(mg(!0),!0):!1;if(Vt==="branch"){if(je)return Su();const pt=j.slice(Jt[0].length).trim();return Mk(pt||void 0),!0}if(Vt==="fork"){if(je)return Su();if(!Ro())return!1;const pt=j.slice(Jt[0].length).trim();return pt?(Ae.forkSession(pt).then(it=>{if(!it.launched){Ln("warning",ge("fork.notStarted"));return}Ln("success",ge("fork.started",{name:it.description}))}).catch(it=>{const vs=it instanceof Error?it.message:String(it);tn(it,ge("fork.failed",{reason:vs}))}),!0):(Ln("error",ge("fork.empty")),!0)}if(Vt==="auth")return u5(!0),!0;if(Vt==="model"){const pt=j.slice(Jt[0].length).trim();if(pt==="--fast")return Hn("fast"),!0;if(pt.startsWith("--fast "))return je?fp(j,F,void 0,J,ce==null?void 0:ce.inputAnnotations):tt(j,F,"Failed to send /model --fast",{inputAnnotations:ce==null?void 0:ce.inputAnnotations});if(pt==="--voice")return Vd(j,F)||Qn.loadProviders().then(it=>{ap(iU(it)),Hn("voice")}).catch(it=>tn(it,ge("model.setVoice"))),!0;if(pt.startsWith("--voice ")){const it=pt.replace(/^--voice\s+/,"");return gc("workspace","voiceModel",it).catch(vs=>tn(vs,ge("model.setVoice"))),!0}if(pt==="--vision")return Hn("vision"),!0;if(pt.startsWith("--vision ")){const it=pt.replace(/^--vision\s+/,"");return gc("workspace","visionModel",it).catch(vs=>tn(vs,ge("model.setVision"))),!0}if(pt){if(!Ws.current.sessionId)return yg(pt),!0;Ae.setModel(pt).then(()=>{yg(pt)}).catch(it=>{tn(it,ge("model.switch"))})}else Hn("main");return!0}if(Vt==="plan"){if(je)return Su();const pt=j.slice(Jt[0].length).trim();return Ws.current.sessionId?(pt&&dp(!0),Ae.setApprovalMode("plan").then(()=>{if(py("plan"),pt)return ja(pt,F,{clearComposerOnPromptStart:!0,inputAnnotations:ce==null?void 0:ce.inputAnnotations}).catch(it=>tn(it,"Failed to send plan prompt"))}).catch(it=>{tn(it,ge("mode.plan"))}).finally(()=>{pt&&dp(!1)}),!pt):(py("plan"),pt?tt(pt,F,"Failed to send plan prompt",{inputAnnotations:ce==null?void 0:ce.inputAnnotations}):!0)}if(Vt==="approval-mode"){const pt=j.slice(Jt[0].length).trim();return pt?uf(pt):Gc(!0),!0}if(Vt==="mcp"){const pt=j.slice(Jt[0].length).trim().toLowerCase();return Qn.loadMcpStatus().then(it=>{s5({status:it,toolsByServer:{},resourcesByServer:{},showDescriptions:pt==="desc",showSchema:pt==="schema",showTips:!pt}),Aa("mcp")}).catch(it=>{tn(it,"Failed to load MCP status")}),!0}if(Vt==="skills"){const pt=j.slice(Jt[0].length).trim();if(!pt||pt==="detail"||pt==="details")Aa("skills");else return je?fp(j,F,void 0,J,ce==null?void 0:ce.inputAnnotations):tt(j,F,"Failed to send /skills command",{inputAnnotations:ce==null?void 0:ce.inputAnnotations});return!0}if(Vt==="tools"){const pt=j.slice(Jt[0].length).trim().toLowerCase();if(pt==="desc"||pt==="descriptions")DD(!0);else{if(Vd(j,F))return!0;Qn.loadToolsStatus().then(it=>{const vs=(it==null?void 0:it.tools)??[];if(vs.length===0)pe.dispatch([{type:"status",text:ge("tools.none")}]);else{const xs=vs.map(ei=>`- ${ei.displayName||ei.name}`).join(`
`);pe.dispatch([{type:"status",text:`${ge("tools.available")}

${xs}`}])}Wc("smooth")}).catch(it=>{tn(it,"Failed to load tools")})}return!0}if(Vt==="settings")return Aa("settings"),!0;if(Vt==="schedule")return r5(),!0;if(Vt==="context"){const pt=j.slice(Jt[0].length).trim().toLowerCase();if(pt===""||pt==="detail"||pt==="-d")return wy(j,pt==="detail"||pt==="-d"),!0}if(Vt==="memory"){const pt=j.slice(Jt[0].length).trim().toLowerCase();if(pt==="refresh")Ace(it=>it+1);else if(pt==="add"||pt.startsWith("add ")){const it=pt.slice(3).trim();Dce(it==="user"||it==="global"?"global":"workspace"),Nce(vs=>vs+1)}return HD(!0),!0}if(Vt==="agents"){const pt=j.slice(Jt[0].length).trim().toLowerCase();return my(pt==="create"||pt==="create user"||pt==="create global"?"global":pt==="create project"||pt==="create workspace"?"workspace":null),Aa("agents"),!0}if(Vt==="extensions"){const pt=j.slice(Jt[0].length).trim(),it=(nn=pt.split(/\s+/)[0])==null?void 0:nn.toLowerCase();if(!it||it==="manage")return Aa("extensions"),!0;if(it==="install"){if(je)return Su();const vs=pt.slice(7).trim().split(/\s+/);let xs="",ei,hi,Il,Cu,bc=null;for(let yc=0;yc<vs.length;yc++){const Na=vs[yc];if(Na)if(Na==="--auto-update")Il=!0;else if(Na==="--pre-release"||Na==="--allow-pre-release")Cu=!0;else if(Na==="--ref"||Na==="--registry"){const gp=vs[yc+1];if(!gp||gp.startsWith("--")){bc=ge("extensions.install.missingOptionValue",{option:Na});break}Na==="--ref"?ei=gp:hi=gp,yc+=1}else if(Na.startsWith("--")){bc=ge("extensions.install.unknownOption",{option:Na});break}else if(!xs)xs=Na;else{bc=ge("extensions.install.usage");break}}if(bc)return pe.appendLocalUserMessage(j),pe.dispatch([{type:"error",text:bc}]),!0;if(!xs)return pe.appendLocalUserMessage(j),pe.dispatch([{type:"error",text:ge("extensions.install.usage")}]),!0;const Tu=Ws.current.clientId;return Tu?(pe.appendLocalUserMessage(j),pe.dispatch([{type:"status",text:ge("extensions.install.started",{source:xs})}]),Qn.installExtension({source:xs,...ei?{ref:ei}:{},...hi?{registry:hi}:{},...Il!==void 0?{autoUpdate:Il}:{},...Cu!==void 0?{allowPreRelease:Cu}:{},consent:!0},Tu).then(()=>{}).catch(yc=>{tn(yc,ge("extensions.install.requestFailed"))}),!0):(Ln("warning",ge("extensions.install.waitForSession")),!0)}return Vd(j,F)||pe.dispatch([{type:"error",text:ge("extensions.install.usage")}]),!0}if(Vt==="clear"||Vt==="new"||Vt==="reset")return tl(),!0;if(Vt==="rename"){const pt=s4t(j.slice(Jt[0].length));if(pt.type==="auto"||pt.type==="delegate")return je?fp(j,F,void 0,J,ce==null?void 0:ce.inputAnnotations):tt(j,F,"Failed to send /rename command",{inputAnnotations:ce==null?void 0:ce.inputAnnotations});const it=pt.displayName;return it?Ro()?(Ae.renameSession(it).then(()=>{pe.dispatch([{type:"status",text:ge("rename.success",{name:it})}])}).catch(vs=>{tn(vs,"Failed to rename session")}),!0):!1:(Ln("error",ge("rename.empty")),!0)}if(Vt==="resume"){const pt=j.slice(Jt[0].length).trim();return pt?(qe(),eo(),Ae.loadSession(pt).catch(it=>{tn(it,"Failed to load session")})):(qe(),cy(!0)),!0}if(Vt==="recap")return nL(),!0;if(Vt==="btw")return sL(j.slice(Jt[0].length)),!0;if(Vt==="stats"){const pt=j.slice(Jt[0].length).trim().toLowerCase();let it="overview";return pt==="model"?it="model":pt==="tools"&&(it="tools"),Ro()?(Vd(j,F)||Ae.getStats().then(vs=>{pe.dispatch([{type:"status",text:VHe(vs,it)}]),Wc("smooth")}).catch(()=>{}),!0):!1}if(Vt==="status"||Vt==="about")return Vd(j,F)||Promise.all([Qn.loadPreflight().catch(()=>null),Qn.loadProviders().catch(()=>null),Qn.loadEnv().catch(()=>null)]).then(([pt,it,vs])=>{var gp,VL,GL,KL,YL,XL;const xs=GW(pt,vs);let ei=xs.authSource;!ei&&((gp=it==null?void 0:it.current)!=null&&gp.authType)&&(ei=it.current.authType);const hi=[];xs.nodeVersion&&hi.push(`Node.js v${xs.nodeVersion}`),xs.npmVersion&&hi.push(`npm ${xs.npmVersion}`);let Il="";ei&&(ei.startsWith("oauth")||ei==="qwen-oauth"?Il="Qwen OAuth":Il=`API Key - ${ei}`);const Cu=`${xs.platform} ${xs.arch}`.trim(),bc=wk.current,Tu=Ws.current,Na={cliVersion:((VL=Tu.capabilities)==null?void 0:VL.qwenCodeVersion)||"",runtime:hi.join(" / "),platform:Cu,auth:Il,baseUrl:((GL=it==null?void 0:it.current)==null?void 0:GL.baseUrl)||"",model:bc||Tu.currentModel||((KL=it==null?void 0:it.current)==null?void 0:KL.modelId)||"",fastModel:((YL=it==null?void 0:it.current)==null?void 0:YL.fastModelId)||bc||Tu.currentModel||((XL=it==null?void 0:it.current)==null?void 0:XL.modelId)||"",sessionId:Tu.sessionId||"",sandbox:xs.sandbox,proxy:xs.proxy,memoryUsage:xs.memoryUsage};pe.dispatch([{type:"status",text:cqe(Na)}]),Wc("smooth")}),!0;if(Vt==="bug"){const pt=j.slice(Jt[0].length).trim();return Vd(j,F)||Promise.all([Qn.loadPreflight().catch(()=>null),Qn.loadEnv().catch(()=>null)]).then(([it,vs])=>{var Il;const xs=GW(it,vs),ei=((Il=Ws.current.capabilities)==null?void 0:Il.qwenCodeVersion)||"",hi={};if(ei&&(hi.cliVersion=ei),xs.nodeVersion&&(hi.nodeVersion=xs.nodeVersion),xs.npmVersion&&(hi.npmVersion=xs.npmVersion),xs.platform&&(hi.platform=xs.platform),xs.arch&&(hi.arch=xs.arch),xs.sandbox&&(hi.sandbox=xs.sandbox),xs.memoryUsage&&(hi.memoryUsage=xs.memoryUsage),v5.current)v5.current({title:pt,systemInfo:hi}),pe.dispatch([{type:"status",text:ge("bug.submitted")}]);else{const Cu=Object.entries(hi).filter(([,yc])=>yc).map(([yc,Na])=>`${yc}: ${Na}`).join(`
`),bc=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(pt)}&info=${encodeURIComponent(`
`+Cu+`
`)}`,Tu=window.open(bc,"_blank");Tu?(Tu.opener=null,pe.dispatch([{type:"status",text:ge("bug.submitted")}])):Ln("error",ge("bug.popupBlocked"))}}).catch(it=>{tn(it,ge("bug.failed"))}),!0}}return je?fp(j,F,void 0,J,ce==null?void 0:ce.inputAnnotations):tt(j,F,"Failed to send command",{inputAnnotations:ce==null?void 0:ce.inputAnnotations})}else if(j.startsWith("!")){if(je)return Ln("error",ge("queue.shellBlocked")),!1;const Jt=j.slice(1).trim();return!Jt||!Ro()?!1:(Ae.sendShellCommand(Jt).catch(Vt=>{tn(Vt,"Failed to execute shell command")}),!0)}else return je?fp(j,F,void 0,J,ce==null?void 0:ce.inputAnnotations):tt(j,F,"Failed to send message",{inputAnnotations:ce==null?void 0:ce.inputAnnotations})},[ja,Ae,pe,fp,Vd,Mk,qe,eo,Aa,r5,gg,tl,hp,Ok,yL,xy,uf,vg,Su,T5,Cy,Ln,tn,nL,sL,Ro,pn,Wc,Le,yg,py,gc,wy,ge,Qn]),hue=f.useCallback((j,F,J,ce)=>{const je=vL(j,F,J,ce);return je!==!1&&Wc("smooth"),je},[vL,Wc]),xL=f.useCallback((j,F,J)=>{Ae.submitPermission(j,F,J).catch(ce=>{tn(ce,"Failed to submit permission choice")})},[Ae,tn]),E5=f.useCallback(()=>{Ae.cancel().catch(j=>{tn(j,"Failed to cancel request")})},[Ae,tn]),fue=f.useCallback(()=>{var j;return _u?!1:((j=Od.current)==null?void 0:j.focusTaskPill())??!1},[_u]),mue=f.useCallback(j=>{var F,J;if(j){(F=Si.current)==null||F.insertText(j);return}(J=Si.current)==null||J.focus()},[]),pue=f.useCallback(j=>{ck(j)},[]),A5=f.useCallback(()=>{dg.current&&mc&&vu.current==="idle"&&sf.current&&zd.current?(rf.current=sf.current,op(!1),ja(zd.current,ip.current,{optimisticUserMessage:!1,retry:!0}).catch(j=>tn(j,"Failed to retry prompt"))):pe.dispatch([{type:"status",text:ge("retry.none")}])},[mc,ja,tn,pe,ge]);f.useEffect(()=>{const j=F=>{if(!_u&&F.ctrlKey&&!F.metaKey&&!F.altKey&&!F.shiftKey){if(F.key==="l"){F.preventDefault(),lL();return}if(F.key==="o"){F.preventDefault(),cL();return}if(F.key==="y"){F.preventDefault(),A5();return}}};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[_u,lL,cL,A5,pe,ge]);const df=f.useCallback(()=>{vk.current=null,VD(!1),GD(!1),bg.current&&(clearTimeout(bg.current),bg.current=null)},[]),wL=f.useRef({streamingState:dr,pendingApproval:Ss,interactionBlocked:_u,activePanel:hs,closePanel:eo,handleCancel:E5,handleCycleMode:k5});wL.current={streamingState:dr,pendingApproval:Ss,interactionBlocked:_u,activePanel:hs,closePanel:eo,handleCancel:E5,handleCycleMode:k5};const gue=dr!=="idle";f.useEffect(()=>{df()},[gue,df]),f.useEffect(()=>{const J=(je,tt)=>{vk.current=je,je==="cancel"?GD(!0):VD(!0),bg.current&&clearTimeout(bg.current),bg.current=setTimeout(df,tt)},ce=je=>{var Jt,Vt;if(je.defaultPrevented||je.isComposing)return;const tt=wL.current;if(je.key==="Escape"&&tt.activePanel){const pt=je.target;pt!=null&&pt.closest("[data-sidebar-shell]")||(je.preventDefault(),tt.closePanel());return}if(je.key!=="Escape"){vk.current!==null&&df(),je.key==="Tab"&&je.shiftKey&&!tt.interactionBlocked&&(je.preventDefault(),tt.handleCycleMode());return}const nn=fSt({blocked:!!tt.pendingApproval||tt.interactionBlocked,streaming:tt.streamingState!=="idle",hasInput:!!((Jt=Si.current)!=null&&Jt.hasInput()),armed:vk.current});if(nn.kind!=="ignore")switch(je.preventDefault(),nn.kind){case"cancel":tt.handleCancel(),df();break;case"clear":(Vt=Si.current)==null||Vt.clear(),df();break;case"arm":J(nn.action,nn.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",ce),()=>{window.removeEventListener("keydown",ce),df()}},[df]);const kL=Wht({catchingUp:!!ue.catchingUp,pendingApproval:Ss!==null,isPreparingPrompt:g5}),_L={catchingUp:!!ue.catchingUp,isPreparingPrompt:g5,isStreaming:dr!=="idle"},bue=ale(_L),$k=ae==null?void 0:ae[bue],yue=$k!=null&&$k.trim()?$k:ge(Vht(_L)),Ty=f.useCallback(j=>{if(!Ws.current.sessionId){yg(j);return}Ek(!0),Ae.setModel(j).then(F=>{const J=e4t(F);yg((J==null?void 0:J.modelId)??j),J&&pe.dispatch({type:"debug",text:t4t(J,ge),source:"model_switch_summary",data:J})}).catch(F=>{tn(F,ge("model.switch"))}).finally(()=>Ek(!1))},[Ae,pe,tn,ge,yg]),vue=f.useCallback(j=>{Ek(!0),Qn.deleteModel(j).then(F=>{F!=null&&F.requiresRestart&&pe.dispatch([{type:"status",text:ge("settings.requiresRestart")}]),Tk().catch(J=>{console.warn("[web-shell] failed to reload providers after delete",J)}),cf().catch(J=>{console.warn("[web-shell] failed to reload settings after delete",J)})}).catch(F=>{tn(F,ge("settings.models.deleteFailed"))}).finally(()=>Ek(!1))},[Qn,Tk,cf,tn,pe,ge]),SL=f.useCallback(()=>{u5(!1),Tk().catch(j=>{console.warn("[web-shell] failed to reload providers after auth dialog close",j)})},[Tk]),xue=f.useCallback(j=>{Fd(!1),gc(Ci,"modelFallbacks",j.join(",")).then(F=>{F!=null&&F.requiresRestart&&pe.dispatch([{type:"status",text:ge("settings.requiresRestart")}]),cf().catch(J=>{console.warn("[web-shell] failed to reload settings after fallbacks save",J)})}).catch(F=>tn(F,ge("settings.models.fallbacks.saveFailed")))},[Ci,gc,cf,tn,pe,ge]),wue=f.useCallback(j=>{if(dr!=="idle"){Su();return}eo(),ja(`/model --fast ${j}${Ci==="user"?" --global":" --project"}`).then(()=>{cf().catch(J=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",J)})}).catch(J=>{tn(J,"Failed to switch fast model")})},[Su,eo,ja,dr,tn,cf,Ci]),kue=f.useCallback(j=>{const F=KW(j);gc(Ci,"voiceModel",F).catch(J=>tn(J,ge("model.setVoice")))},[Ci,tn,gc,ge]),_ue=f.useCallback(j=>{const F=mSt(j);gc(Ci,"visionModel",F).catch(J=>tn(J,ge("model.setVision")))},[Ci,tn,gc,ge]),Sue={main:Ty,fast:wue,voice:kue,vision:_ue};f.useEffect(()=>{!On&&!Nr&&!up&&Vc("workspace")},[On,Nr,up]);const CL=f.useMemo(()=>{const j=new Set((ue.skills??[]).map(ce=>ce.toLowerCase())),F=Ge?(ue.commands??[]).filter(ce=>ce.source!=="skill"&&!j.has(ce.name.toLowerCase())):ue.commands??[],J=Ge?Te.map(ce=>({name:ce.name,description:ce.description,...ce.argumentHint?{argumentHint:ce.argumentHint}:{},source:"skill",displayCategory:"skill"})):[];return fle(mle(F,J,dle(ge)),ge).filter(ce=>!Cy.has(tE(ce.name))).map(ce=>{const je=hle(ce.name);return je?{...ce,displayCategory:"skill",description:ge(je)}:ce})},[ue.commands,ue.skills,Cy,Te,Ge,ge]),Ey=f.useMemo(()=>{var j;return{version:((j=ue.capabilities)==null?void 0:j.qwenCodeVersion)||"",cwd:ue.workspaceCwd||"",currentModel:af,currentMode:pc,hideTips:(wg==null?void 0:wg.values.effective)===!0}},[(qL=ue.capabilities)==null?void 0:qL.qwenCodeVersion,ue.workspaceCwd,af,pc,wg==null?void 0:wg.values.effective]),Cue=f.useMemo(()=>l.jsx(l.Fragment,{children:k?k(Ey):l.jsx(wrt,{...Ey})}),[k,Ey]),Bk=f.useMemo(()=>T==null?void 0:T(Ey),[T,Ey]),Ml=!ue.sessionId&&St.length===0&&!tg&&!Ss&&!ns,TL=Ml&&C,Ay=TL&&!!Bk,Tue=Ml&&Ay,j5=Ml&&TL,EL=ue.status!=="connecting"&&!ue.sessionId&&ue.missingSession===!0&&!hs&&Zr==="chat",N5=Ml?xS():yt,Eue=bce(M),AL=[At.app,At.appChat,Ml?At.appChatEmpty:void 0,ht.enabled?At.appWithSidebar:void 0,Ud===zr.Light?At.themeLight:At.themeDark,Ud===zr.Dark?"dark":void 0,o].filter(Boolean).join(" "),jL=f.useMemo(()=>({...a,...KSt(N5,M)}),[M,N5,a]),NL=f.useCallback(j=>{Me(j),GSt(j)},[]);return f.useLayoutEffect(()=>{const j=np.current;if(!j)return;const F=uk.current,J=lg.current,ce=j.getBoundingClientRect();if(J&&!Ml&&F){const je=F.top-ce.top;Math.abs(je)>1&&(j.style.transition="width 320ms ease",j.style.transform=`translateY(${je}px)`,requestAnimationFrame(()=>{j.style.transition="width 320ms ease, transform 280ms ease",j.style.transform=""}),window.setTimeout(()=>{j.style.transition=""},320))}uk.current=ce,lg.current=Ml},[Ml]),f.useLayoutEffect(()=>{const j=Rt.portals?document.createElement("div"):null,F=(j==null?void 0:j.attachShadow({mode:"open"}))??null,J=document.createElement("div");if(J.dataset.webShellPortalRoot="",J.dataset.webShellShadcn="",j&&F){j.dataset.webShellShadowHost="portals",j.style.setProperty("all","initial","important"),j.style.setProperty("position","fixed","important"),j.style.setProperty("inset","0","important"),j.style.setProperty("width","0","important"),j.style.setProperty("height","0","important"),j.style.setProperty("z-index","var(--web-shell-portal-root-z-index, 1000)","important");const ce=tce(F,Rt.styles);return F.appendChild(J),document.body.appendChild(j),Ld(J),()=>{j.remove(),ce(),Ld(null)}}else return document.body.appendChild(J),Ld(J),()=>{J.remove(),Ld(null)}},[Rt.portals,Rt.styles]),f.useLayoutEffect(()=>{const j=ik.current;if(!j||!Nl)return;const F=Nl.getRootNode(),J=F instanceof ShadowRoot?F.host:null;let ce=null;const je=()=>{ce=null;const Vt=getComputedStyle(j),pt=new Set;Nl.dataset.webShellShadcn="",Nl.classList.toggle("dark",Ud===zr.Dark),Nl.lang=Le;for(let it=0;it<Vt.length;it+=1){const vs=Vt[it];if(!vs.startsWith("--"))continue;pt.add(vs);const xs=Vt.getPropertyValue(vs);Nl.style.setProperty(vs,xs),J==null||J.style.setProperty(vs,xs)}for(const it of ok.current)pt.has(it)||(Nl.style.removeProperty(it),J==null||J.style.removeProperty(it));ok.current=pt},tt=()=>{ce===null&&(ce=requestAnimationFrame(je))};je();const nn=new MutationObserver(tt);let Jt=j;for(;Jt;)nn.observe(Jt,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),Jt=Jt.parentElement;return window.addEventListener("resize",tt),()=>{nn.disconnect(),window.removeEventListener("resize",tt),ce!==null&&cancelAnimationFrame(ce)}},[AL,jL,Nl,Le,Ud]),l.jsx(zbe,{value:Ud,children:l.jsx(xbe,{language:Le,children:l.jsx(iX.Provider,{value:Nl,children:l.jsxs("div",{ref:ik,className:AL,style:jL,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,lang:Le,children:[!Ce&&l.jsx(Yst,{toasts:si,onDismiss:Jn}),hg&&l.jsx(pi,{title:ge("resume.title"),size:"lg",onClose:()=>cy(!1),children:l.jsx(Frt,{workspaceCwd:me,onSelect:j=>{qe(),eo(),Ae.loadSession(j).catch(F=>{tn(F,"Failed to load session")})},onClose:()=>cy(!1)})}),On&&l.jsx(pi,{title:ge(BSt[On]),size:"lg",onClose:()=>Hn(null),children:l.jsx(lit,{mode:On,models:On==="voice"?el:void 0,currentModelId:On==="voice"?Kce:On==="vision"?Yce:On==="fast"?Xce:void 0,onSelect:j=>{On&&Sue[On](j),Hn(null)}})}),xu&&l.jsx(pi,{title:ge("mode.select"),size:"sm",onClose:()=>Gc(!1),children:l.jsx(zrt,{currentMode:pc,onSelect:j=>{uf(j),Gc(!1)}})}),RD&&l.jsx(pi,{title:ge("tools.title"),size:"lg",onClose:()=>DD(!1),children:l.jsx(qot,{})}),pg&&l.jsx(rlt,{workspaceCwd:pg.workspaceCwd,initialView:pg.view,onClose:()=>fy(void 0)},`${pg.workspaceCwd}:${pg.view}`),d5&&l.jsx(pi,{title:ge("tasks.title"),size:"lg",onClose:()=>xk(null),children:l.jsx(tae,{message:d5,embedded:!0,manageActiveEvent:!1,onClose:()=>xk(null)})}),FD&&l.jsx(pi,{title:ge("memory.menu"),size:"lg",onClose:()=>HD(!1),children:l.jsx(mot,{refreshSignal:Ece,addSignal:jce,addScope:Rce,onMessage:(j,F="status")=>{pe.dispatch([{type:F,text:j}])}})}),dy&&l.jsx(pi,{title:ge("help.title"),size:"md",onClose:()=>hy(!1),children:l.jsx(owt,{commands:CL})}),of&&l.jsx(pi,{title:ge("theme.title"),size:"sm",onClose:()=>e5(!1),children:l.jsx(awt,{currentTheme:Ud,onSelect:xy,onClose:()=>e5(!1)})}),up&&l.jsx(pi,{title:ge("auth.title"),size:"lg",onClose:SL,children:l.jsx(Fot,{onMessage:(j,F="status")=>{pe.dispatch([F==="error"?{type:"error",text:j}:{type:"status",text:j}])},onClose:SL})}),Nr&&l.jsx(pi,{title:ge("settings.models.fallbacks.title"),size:"md",onClose:()=>Fd(!1),children:l.jsx(kit,{models:Jce,current:Qce,max:3,onConfirm:xue,onClose:()=>Fd(!1)})}),fg&&l.jsx(pi,{title:ge("delete.title"),size:"lg",onClose:()=>lp(!1),children:l.jsx(lwt,{workspaceCwd:me,onDeleted:j=>{pe.dispatch([{type:"status",text:j.length===1?`${ge("delete.deleted")} (${j[0].slice(0,8)})`:ge("delete.deletedCount",{count:j.length})}])},onError:j=>{if(qg(j))return;const F=j instanceof Error?j.message:String(j);Ln("error",ge("delete.failed",{reason:F}))},onClose:()=>lp(!1)})}),Er&&l.jsx(pi,{title:ge("release.title"),size:"lg",onClose:()=>Zi(!1),children:l.jsx(cwt,{workspaceCwd:me,onReleased:j=>{pe.dispatch([{type:"status",text:`${ge("release.released")} (${j.slice(0,8)})`}])},onError:j=>{if(qg(j))return;const F=j instanceof Error?j.message:String(j);Ln("error",ge("release.failed",{reason:F}))},onClose:()=>Zi(!1)})}),uy&&l.jsx(pi,{title:ge("rewind.title"),subtitle:ge("rewind.subtitle"),size:"lg",onClose:()=>mg(!1),children:l.jsx(Twt,{blocks:Be,loadSnapshots:lue,rewind:cue,onError:uue,onClose:()=>mg(!1)})}),!me&&ps&&l.jsx(Awt,{onClose:()=>is(!1),onAdd:nue,onSuggest:j=>Qn.suggestWorkspacePaths(j),persistenceSupported:es,displayNameEnabled:Dt}),Ur!=="clear"&&l.jsx(pi,{title:ge("sidebar.scratchOutcomeUnknownTitle"),size:"md",dismissible:!1,onClose:()=>{},children:l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsx("p",{children:ge("sidebar.scratchOutcomeUnknown")}),l.jsx("ul",{className:"max-h-48 overflow-y-auto text-sm text-muted-foreground",children:hn.map(j=>l.jsx("li",{children:j.cwd},j.id))}),l.jsx("div",{className:"flex justify-end",children:Ur==="refreshing"?l.jsx(An,{type:"button",onClick:()=>void _5(),children:ge("sidebar.scratchOutcomeRefresh")}):l.jsx(An,{type:"button",onClick:()=>Cs("clear"),children:ge("sidebar.scratchOutcomeAcknowledge")})})]})}),l.jsxs("div",{className:At.appShell,children:[ht.enabled&&l.jsxs("div",{"data-sidebar-shell":"",...be?{role:"dialog","aria-modal":"true"}:{},"aria-label":ge("sidebar.label"),className:[At.mobileDrawer,be?At.mobileDrawerOpen:void 0,ne?At.mobileDrawerForced:void 0].filter(Boolean).join(" "),children:[l.jsx("div",{className:At.mobileBackdrop,onClick:qe,"aria-hidden":"true"}),l.jsx(U2t,{collapsed:(gn||Zr==="split"&&!cn)&&!be,onCollapsedChange:Kn,onOpenSettings:()=>{qe(),Aa("settings")},onOpenPlugins:()=>{qe(),Aa("plugins")},onOpenDaemonStatus:()=>{qe(),Aa("status")},onOpenScheduledTasks:()=>{qe(),r5()},onOpenGoals:()=>{qe(),gg()},onOpenSessions:()=>{qe(),Aa("sessions")},canOpenSessionsOverview:Je,onOpenSplitView:()=>{qe(),cp()},canOpenSplitView:Je,theme:Ud,onThemeChange:j=>{xy(j),gc("workspace",Vp,cX(j))},onNewSession:j=>tl(j),onLoadSession:(j,F)=>(Ui("chat"),mp(j,F)),onSelectCurrentSession:()=>{qe(),Ui("chat"),eo()},onError:tn,mobileOpen:be,sessionListReloadToken:ZD,selectedWorkspaceCwd:js,onSelectWorkspace:Ii,onOpenGitDiff:j=>fy({workspaceCwd:j,view:"diff"}),onOpenAddWorkspace:jr?()=>is(!0):void 0,workspaces:hn,lockedWorkspaceCwd:me,lockedWorkspace:ht.lockedWorkspace,branding:ht.branding,primaryNav:ht.primaryNav,hideProjectHeader:ht.hideProjectHeader,sessionActions:ht.sessionActions,footer:ht.footer})]}),l.jsxs("div",{ref:xn,className:[At.chatPane,Zr!=="chat"?At.chatPaneShowingPage:void 0,j5?At.chatPaneWithMobileComposerBottom:void 0].filter(Boolean).join(" "),children:[ht.enabled&&ht.showCompactToggle&&!hs&&Zr==="chat"&&l.jsx("button",{type:"button",className:[At.hamburgerButton,Ml?At.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>{Ee(!1),Ie(j=>!j)},"aria-label":ge("sidebar.toggleMenu"),"aria-expanded":be,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),l.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),l.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),hs&&l.jsxs("section",{className:At.panelHost,role:"region","data-testid":"inline-panel","aria-label":ge(hs==="settings"?"settings.title":hs==="status"?"daemon.title":hs==="extensions"?"extensions.manage.title":hs==="mcp"?"mcp.title":hs==="skills"?"skills.title":hs==="agents"?"agents.title":hs==="plugins"?"plugins.title":"sessionsOverview.title"),children:[hs!=="extensions"&&hs!=="mcp"&&hs!=="skills"&&hs!=="agents"&&hs!=="plugins"&&l.jsxs("div",{className:At.panelHeader,children:[l.jsx("button",{ref:$D,type:"button",className:At.panelBack,"data-testid":"panel-back",onClick:eo,"aria-label":ge("common.back"),title:ge("common.back"),children:l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("div",{className:At.panelTitle,children:ge(hs==="settings"?"settings.title":hs==="status"?"daemon.title":"sessionsOverview.title")})]}),l.jsx("div",{className:At.panelBody,children:l.jsx(ext,{enabled:Rt.plugins&&Xvt(hs),language:Le,themeClassName:[Ud===zr.Light?At.themeLight:At.themeDark,Ud===zr.Dark?"dark":void 0].filter(Boolean).join(" "),styles:Rt.styles,initialFocusRef:hs==="plugins"?c5:hs==="extensions"?l5:void 0,children:hs==="settings"?l.jsx(Axt,{settingsState:oL,embedded:!0,onLanguageChange:Zce,onThemeChange:xy,chatWidthMode:yt,onChatWidthModeChange:NL,modelManagement:{providers:Ck.providers,currentModelId:ue.currentModel??void 0,loading:Ck.loading,error:Ck.error,busy:Gce,onSelectModel:Ty,onDeleteModel:vue,onAddModel:()=>u5(!0)},onSubDialog:(j,F)=>{j==="fastModel"?(Vc(F),Hn("fast")):j==="visionModel"?(Vc(F),Hn("vision")):j==="voiceModel"?Qn.loadProviders().then(J=>{ap(iU(J)),Za.current===null&&!Ea.current&&!qD.current&&(Vc(F),Hn("voice"))}).catch(J=>tn(J,ge("model.setVoice"))):j==="modelFallbacks"?(Vc(F),Fd(!0)):j==="tools.approvalMode"&&Gc(!0)}}):hs==="status"?l.jsx(odt,{}):hs==="extensions"?l.jsx(Qle,{onClose:eo,initialFocusRef:l5}):hs==="mcp"&&bk?l.jsx(Zle,{message:bk,onClose:()=>{s5(null),eo()}}):hs==="skills"?l.jsx(Uae,{onClose:eo,onUseSkill:LD}):hs==="agents"?l.jsx(Hae,{onClose:()=>{my(null),eo()},initialCreateScope:Lce}):hs==="plugins"?l.jsx(Kvt,{mcpMessage:bk,loadMcpMessage:async()=>{try{await kce()}catch(j){throw tn(j,"Failed to load MCP status"),j}},onClose:eo,onUseSkill:LD,initialFocusRef:c5}):l.jsx(nht,{onOpenSession:S5,onOpenSplit:cp,includeOtherWorkspaces:!me,workspaceCwd:me})})},hs)]}),Zr==="scheduledTasks"&&l.jsxs("div",{className:At.fullPage,"data-testid":"scheduled-tasks-page",children:[l.jsxs("div",{className:At.fullPageHeader,children:[l.jsx("button",{type:"button",className:At.fullPageBack,onClick:()=>Ui("chat"),"aria-label":ge("common.back"),title:ge("common.back"),children:l.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:l.jsx("path",{d:"M15 18l-6-6 6-6"})})}),l.jsx("div",{className:At.fullPageTitle,children:ge("scheduledTasks.title")})]}),l.jsx("div",{className:At.fullPageBody,children:l.jsx(Yyt,{onRunPrompt:aue,workspaces:me?gt:hn,lockedWorkspace:$e,onCreateViaChat:()=>{tl().then(j=>{j&&(e==null||e(void 0),window.setTimeout(()=>{var F,J;(F=Si.current)==null||F.insertText(ge("scheduledTasks.chatStarter"),{mode:"replace"}),(J=Si.current)==null||J.focus()},0))})},onOpenSession:j=>{Ui("chat"),mp(j).catch(F=>{tn(F,"Failed to open session")})},onError:tn})})]}),Zr==="goals"&&l.jsxs("div",{className:At.fullPage,"data-testid":"goals-page",children:[l.jsxs("div",{className:At.fullPageHeader,children:[l.jsx("button",{type:"button",className:At.fullPageBack,onClick:()=>Ui("chat"),"aria-label":ge("common.back"),title:ge("common.back"),children:l.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:l.jsx("path",{d:"M15 18l-6-6 6-6"})})}),l.jsx("div",{className:At.fullPageTitle,children:ge("goals.title")})]}),l.jsx("div",{className:At.fullPageBody,children:l.jsx(Ivt,{onCreateGoal:async j=>{const F=_k.current;if(!(F!==void 0&&Ws.current.sessionId===F)){if(!await tl(void 0,{keepView:!0}))return!1;e==null||e(void 0)}try{await ja(`/goal ${j}`,void 0,{clearComposerOnPromptStart:!0})}catch(ce){throw _k.current=Ws.current.sessionId,ce}_k.current=void 0,Ui("chat")},onOpenSession:j=>{Ui("chat"),mp(j).catch(F=>{tn(F,"Failed to open session")})},onError:tn})})]}),Zr==="split"&&l.jsxs("div",{className:At.fullPage,"data-testid":"split-view-page",children:[Ji&&l.jsxs("div",{className:At.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[l.jsx("span",{children:ge("splitView.outerApprovalPending")}),l.jsx("button",{type:"button",onClick:()=>Ui("chat"),children:ge("splitView.goToApproval")})]}),l.jsx(p$,{value:_e,children:l.jsx(R0.Provider,{value:Ak,children:l.jsx(_0t,{sessionIds:Hd,onPanesChange:_ce,sessionListReloadToken:ZD,includeOtherWorkspaces:!me,workspaceCwd:me,onExit:Sce,onError:tn,onSlashCommand:b,onRightPanelOpen:Fn,onPaneArtifactsChange:ri,messageTurnOutputs:Z,restartSseOnPrompt:pn,historyPageSize:Yt})})})]}),l.jsxs("div",{className:[At.chatViewWrap,j5?At.chatViewWithMobileComposerBottom:void 0,Tue?At.chatViewWithWelcomeMiddle:void 0,hs||Zr!=="chat"?At.chatViewHidden:void 0].filter(Boolean).join(" "),"aria-hidden":hs||Zr!=="chat"?!0:void 0,children:[EL&&l.jsxs("div",{className:At.missingSessionState,children:[l.jsx("div",{className:At.missingSessionMessage,children:ge("session.missing")}),l.jsx("button",{type:"button",className:At.missingSessionButton,disabled:JT,onClick:oue,children:ge("session.new")})]}),l.jsx("div",{className:EL?At.chatSubtreeHidden:At.chatSubtree,children:l.jsxs(p$,{value:_e,children:[l.jsx(R0.Provider,{value:Ak,children:l.jsx(RSt,{timeline:Z0,details:Qa,children:l.jsx(uZ.Provider,{value:Ice,children:(()=>{var tt;const j=[At.content,tg||St.length>0||Ss?At.contentHasMessages:void 0].filter(Boolean).join(" "),F=l.jsx(pD,{ref:ag,messages:St,pendingApproval:Ta,onShowContextDetail:eue,loadingTranscript:ue.loadingTranscript,catchingUp:ue.catchingUp,hasOlderHistory:Wt.hasMore,loadingOlderHistory:Wt.loading,historyCapacityReached:Wt.capacityReached,onLoadOlderHistory:Wt.loadMore,transcriptBlockCount:Be.length,transcriptActivity:pe,onReloadTranscript:Dn?kn:void 0,isResponding:dr!=="idle",activeTurnStartedAt:ly,workspaceCwd:ue.workspaceCwd||"",hideSessionTimeline:N5==="wide",showRetryHint:ug,onRetryClick:A5,onBranchSession:tue,bottomOverlayInset:ty,welcomeHeader:Ml?Cue:void 0,centerWelcomeHeader:Ay||void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:pue,virtualScrollThreshold:X,turnFileChanges:Xa.has("file")?Ya:void 0,turnArtifacts:Xa.has("artifact")?ua:void 0,turnScheduledTasks:Xa.has("scheduled_task")?go:void 0,onTurnOutputOpen:Fn,onReviewChanges:Ye,onOpenArtifact:vt,onOpenScheduledTask:Ht,generateContent:(tt=ue.capabilities)!=null&&tt.features.includes("session_generation")?Ae.generateSessionContent:void 0}),J=l.jsx(aae,{onOpen:qt,children:F}),ce=!Ay&&(ns==null?void 0:ns.role)==="btw"?l.jsx("div",{className:At.btwPanel,children:l.jsx(bae,{question:ns.question,answer:ns.answer,isPending:ns.isPending})}):null;if(Ay)return l.jsxs("div",{className:At.mobileWelcomeGroup,children:[l.jsxs("div",{style:og,className:j,children:[J,ce]}),l.jsx("div",{className:At.mobileWelcomeFooterMiddle,children:Bk})]});const je=!Ml&&q?l.jsx("div",{className:At.chatHeader,children:q({sessionId:ue.sessionId,sessionName:f5,workspaceCwd:ue.workspaceCwd})}):null;return l.jsxs(l.Fragment,{children:[je,l.jsxs("div",{style:og,className:j,children:[J,ce]})]})})()})})}),l.jsxs("div",{ref:np,style:og,className:ft?`${At.footer} ${At.footerWithCustomFooter}`:At.footer,children:[sy&&l.jsx("div",{className:sg?`${At.scrollToBottomLayer} ${At.scrollToBottomLayerWithTodos}`:At.scrollToBottomLayer,children:l.jsx("button",{type:"button",className:At.scrollToBottomButton,"aria-label":ge("chat.scrollToBottom"),onClick:()=>Wc("smooth"),children:l.jsx("svg",{className:At.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),sg&&l.jsx("div",{ref:rg,className:At.bottomPanels,children:l.jsx(grt,{todos:tg?Ja:[],statusItems:ng})}),Ta&&Zr==="chat"&&l.jsx("div",{"data-testid":"approval-overlay",className:At.approvalOverlay,children:l.jsx(gle,{request:Ta,onConfirm:xL,variant:"floating",keyboardActive:Cce})}),xr&&Zr==="chat"&&l.jsx("div",{"data-testid":"approval-overlay",className:At.approvalOverlay,children:l.jsx(ble,{request:xr,onConfirm:xL,variant:"floating",keyboardActive:Tce})}),l.jsxs("div",{className:At.composer,children:[dr!=="idle"?l.jsx($ae,{startedAt:ly}):Sy?l.jsxs("div",{className:At.composerActionTip,role:"status","data-testid":"new-session-suggestion",children:[l.jsx("span",{className:At.composerActionTipIcon,"aria-hidden":"true",children:"✦"}),l.jsx("span",{className:At.composerActionTipText,children:ge("editor.newSessionSuggestionTitle")}),l.jsx("div",{className:At.composerActionTipActions,children:l.jsx("button",{type:"button",className:`${At.composerActionTipButton} ${At.composerActionTipButtonPrimary}`,"data-testid":"new-session-suggestion-start",onMouseDown:j=>j.preventDefault(),onClick:iue,children:ge("editor.newSessionSuggestionStart")})})]}):Pce&&dr==="idle"?l.jsx("div",{className:At.escClearStatus,role:"status",children:ge("editor.escClearHint")}):null,l.jsx(ple,{prompts:zce,t:ge,onDelete:Hce,onInsert:qce,onEdit:Uce}),$t&&l.jsx("div",{className:At.composerHeader,children:l.jsx($t,{disabled:kL,isRunning:dr!=="idle",currentMode:pc,currentModel:af,sessionName:f5})}),l.jsx(Pae,{ref:ry,onSubmit:hue,onInputTextChange:rue,onCycleMode:k5,onToggleShortcuts:iL,onCancel:E5,isRunning:dr!=="idle",isPreparing:g5||rp,cancelArmed:Oce,disabled:kL||rp,commands:CL,skills:Te,slashCommandCategoryOrder:g,builtinAtProviders:x,atProviders:y,composerTagIcons:v,queuedMessages:Fce,onFocusFooter:fue,onPopQueuedMessages:Wce,onClearQueuedMessages:Vce,currentMode:pc,currentModel:af,gitBranch:_t?(ve==null?void 0:ve.branch)??_t.branch:rs?(ve==null?void 0:ve.branch)??rs.name:ue.sessionId?ue.gitBranch:(ve==null?void 0:ve.branch)??void 0,gitWorktree:!!_t,gitModeIntent:Sk?kk:void 0,onGitModeIntentChange:Sk?by:void 0,gitStatus:ve,onOpenGitDiff:hp&&!_t?()=>fy({workspaceCwd:hp,view:"diff"}):void 0,chatWidthMode:yt,showChatWidthToggle:!Ml,chatWidthToggleMin:Eue,visibleToolbarActions:Y,availableModels:$ce,onSelectMode:uf,onSelectModel:Ty,workspaces:me?void 0:hn.map(j=>({id:j.id,cwd:j.cwd,label:VT(j),primary:j.primary,trusted:j.trusted})),selectedWorkspaceCwd:ue.sessionId?(UL=hn.find(j=>j.cwd===ue.workspaceCwd))!=null&&UL.primary?void 0:ue.workspaceCwd:js,workspaceSelectionDisabled:!1,atWorkspaceCwd:me??(ue.sessionId?ue.workspaceCwd:js??((WL=hn.find(j=>j.primary))==null?void 0:WL.cwd)),onSelectWorkspace:j=>{_y(j)},scratchWorkspaceSupported:Gn,existingFolderWorkspaceSupported:jr,workspaceMutationBusy:os,onCreateScratchWorkspace:()=>{sue()},onOpenExistingWorkspace:()=>is(!0),onChatWidthModeChange:NL,sessionName:f5,dialogOpen:_u||Ji,followupState:ZT,onAcceptFollowup:fk,onDismissFollowup:mk,composerInput:Et,composerInputVersion:st,placeholderText:yue})]}),ft?j5?l.jsx("div",{className:At.customFooter,children:l.jsx(ft,{connected:mc,mode:pc,model:af,streamingState:dr,contextUsageRatio:(ue.contextWindow??0)>0?(ue.tokenCount??0)/(ue.contextWindow??0):0,activeGoal:tf,tasks:Pd,availableModes:ov,availableModels:(ue.models??[]).filter(Ev).map(j=>({id:j.id,label:Yf(j.label||j.id),contextWindow:j.contextWindow})),skills:Te,onSelectMode:uf,onSelectModel:Ty})}):l.jsx(ft,{connected:mc,mode:pc,model:af,streamingState:dr,contextUsageRatio:(ue.contextWindow??0)>0?(ue.tokenCount??0)/(ue.contextWindow??0):0,activeGoal:tf,tasks:Pd,availableModes:ov,availableModels:(ue.models??[]).filter(Ev).map(j=>({id:j.id,label:Yf(j.label||j.id),contextWindow:j.contextWindow})),skills:Te,onSelectMode:uf,onSelectModel:Ty}):l.jsx(jst,{onSelectMode:()=>Gc(j=>!j),onSelectModel:()=>Hn(j=>j?null:"main"),onShowContext:()=>wy("/context",!1),onOpenSettings:()=>Aa("settings"),ref:Od,onOpenTasks:()=>T5(),onReturnToInput:mue,tasks:ny,activeGoal:tf,onOpenGoals:gg,hideSettings:due,onToggleShortcuts:iL,compact:!0}),Ml&&Bk&&l.jsx("div",{className:[At.emptyWelcomeFooter,Ay?At.desktopWelcomeFooter:void 0].filter(Boolean).join(" "),children:Bk})]})]})})]})]}),di&&wce?l.jsx(Cyt,{open:!0,direction:"right",shouldScaleBackground:!1,onOpenChange:j=>{j||Ms()},children:l.jsxs(Ayt,{className:"data-[vaul-drawer-direction=right]:w-[min(520px,calc(100vw-16px))] data-[vaul-drawer-direction=right]:sm:max-w-[520px]",children:[l.jsx(jyt,{className:"sr-only",children:"Right panel"}),l.jsx(oW,{artifacts:Dr,tabs:Yn,activeTabId:Ve,reviewChanges:Lt,selectedReviewPath:Pn,workspaceCwd:ue.workspaceCwd||"",loading:Ct,error:$n,onSelectTab:et,onCloseTab:Lr,onOpenFilePreview:Bn,onClose:Ms,variant:"drawer"})]})}):di?l.jsxs("div",{className:At.artifactPanelDock,style:{"--artifact-panel-dock-width":`${Fs+4}px`},children:[l.jsx("div",{className:At.artifactResizeHandle,role:"separator","aria-orientation":"vertical","aria-valuemin":Hg,"aria-valuemax":Go(),"aria-valuenow":Fs,onPointerDown:Io}),l.jsx("div",{className:At.artifactPanelClip,children:l.jsx(oW,{artifacts:Dr,tabs:Yn,activeTabId:Ve,reviewChanges:Lt,selectedReviewPath:Pn,panelWidth:Fs,workspaceCwd:ue.workspaceCwd||"",loading:Ct,error:$n,onSelectTab:et,onCloseTab:Lr,onOpenFilePreview:Bn,onClose:Ms})})]}):null]})]})})})})}function rE({title:e,description:t,actionLabel:n,onAction:s,theme:r,icon:i}){return l.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 ${r==="dark"?"dark":""}`,children:l.jsxs(ud,{className:"border",children:[l.jsxs(dd,{children:[l.jsx(hd,{variant:"icon",children:i??l.jsx(Qge,{})}),l.jsx(fd,{children:e}),l.jsx(tk,{children:t})]}),l.jsx(Wit,{children:l.jsx(An,{onClick:s,children:n})})]})})}function c4t({sessionId:e,workspaceId:t,workspaceCwd:n,lockWorkspaceCwd:s,clientId:r,restartSseOnPrompt:i,historyPageSize:o=ZY,webShellProps:a}){var S,D,E,B;const c=la(),u=Vo(),[d,h]=f.useState(!1),[m,p]=f.useState(),[g,b]=f.useState(),x=f.useRef(void 0);f.useEffect(()=>h(!1),[e,s,n,t]);const y=d?void 0:e,v=d?void 0:s??n,w=v?void 0:t,k=f.useMemo(()=>{var L,O,A;const I=(O=(L=c.capabilities)==null?void 0:L.workspaces)==null?void 0:O.find($=>$.cwd===v);if(I)return I;if(v&&v===((A=c.capabilities)==null?void 0:A.workspaceCwd))return{id:"primary",cwd:v,primary:!0,trusted:!0}},[v,(S=c.capabilities)==null?void 0:S.workspaceCwd,(D=c.capabilities)==null?void 0:D.workspaces]),T=s&&(m==null?void 0:m.requestedCwd)===s?m.workspace:void 0,C=v?k??T:(B=(E=c.capabilities)==null?void 0:E.workspaces)==null?void 0:B.find(I=>I.id===w),_=f.useMemo(()=>E9(wh(a.language)),[a.language]);return f.useEffect(()=>{var L;if(!s||!c.capabilities||k||(m==null?void 0:m.requestedCwd)===s||g===s)return;((L=x.current)==null?void 0:L.cwd)!==s&&(x.current={cwd:s,promise:u.addWorkspace(s,{persist:!0}).then(O=>{if(O.persisted!==!0)throw new Error("Workspace registration was not persisted");return O})});let I=!1;return x.current.promise.then(async O=>{var A;if(!I){p({requestedCwd:s,workspace:O}),b(void 0);try{await((A=c.refreshCapabilities)==null?void 0:A.call(c))}catch{}}}).catch(()=>{I||b(s)}),()=>{I=!0}},[k,m,g,c,c.capabilities,c.refreshCapabilities,u,s]),(v||w)&&c.status==="error"?l.jsx(rE,{title:_("workspace.loadFailed"),description:_("workspace.loadFailedDescription"),actionLabel:_("common.retry"),theme:a.theme,icon:l.jsx(h$,{}),onAction:()=>{var I;(I=c.refreshCapabilities)==null||I.call(c).catch(()=>{})}}):(v||w)&&!c.capabilities?l.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 ${a.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[l.jsx(li,{}),l.jsx("span",{children:_("common.loading")})]}):s&&g===s?l.jsx(rE,{title:_("workspace.loadFailed"),description:_("workspace.loadFailedDescription"),actionLabel:_("common.retry"),theme:a.theme,icon:l.jsx(h$,{}),onAction:()=>{x.current=void 0,b(void 0)}}):s&&!C?l.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 ${a.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[l.jsx(li,{}),l.jsx("span",{children:_("common.loading")})]}):(v||w)&&!C?l.jsx(rE,{title:_("workspace.notFound"),description:_("workspace.notFoundDescription"),actionLabel:_("session.new"),theme:a.theme,onAction:()=>{var I;h(!0),(I=a.onSessionIdChange)==null||I.call(a,void 0,void 0)}}):l.jsx(x9,{sessionId:y,workspaceCwd:C==null?void 0:C.cwd,clientId:r,historyPageSize:o,subagentTranscriptMode:"summary",maxBlocks:eX,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:i,children:l.jsx(l4t,{...a,historyPageSize:o,restartSseOnPrompt:i,initialSelectedWorkspaceCwd:!s&&C?C.cwd:void 0,lockedWorkspaceCwd:s?C==null?void 0:C.cwd:void 0,lockedWorkspaceCapability:s?C:void 0})},`${(C==null?void 0:C.id)??w??"primary"}:${y??"new"}`)}const u4t=fdt(),yce="qwen-code-web-shell-language",vce="qwen-code-web-shell-theme";function xce(e){if(e===zr.Dark||e===zr.Light)return e}function d4t(){const e=new URLSearchParams(window.location.search).get("theme");return xce(e)}function h4t(){try{return xce(window.localStorage.getItem(vce))}catch{return}}function f4t(e){try{window.localStorage.setItem(vce,e)}catch{}}function m4t(){return d4t()??h4t()??zr.Dark}function p4t(){try{const e=window.localStorage.getItem(yce);return e?wh(e):void 0}catch{return}}function g4t(e){try{window.localStorage.setItem(yce,e)}catch{}}function b4t(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return wh(t||(p4t()??navigator.language))}function y4t(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function v4t(){return new URLSearchParams(window.location.search).get("workspace")||void 0}function x4t(e,t){const n=new URL(window.location.href);n.pathname=e?`/session/${encodeURIComponent(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 w4t({daemonToken:e}){const[t,n]=f.useState(()=>m4t()),[s,r]=f.useState(()=>b4t()),[i]=f.useState(()=>y4t()),[o]=f.useState(()=>v4t()),a=u4t||window.location.origin;f.useEffect(()=>{const h=document.documentElement;h.classList.remove("theme-dark","theme-light","dark"),h.classList.add(`theme-${t}`),h.classList.toggle("dark",t===zr.Dark);const m=document.querySelector('meta[name="theme-color"]');m&&m.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const c=f.useCallback(h=>{n(h),f4t(h)},[]),u=f.useCallback(h=>{r(h),g4t(h)},[]),d=f.useCallback((h,m)=>{x4t(h,m)},[]);return l.jsx(Ph,{label:"web-shell-root",fallback:(h,m)=>l.jsx(tge,{error:h,onRetry:m,language:s}),children:l.jsx(s0e,{baseUrl:a,token:e,children:l.jsx(c4t,{sessionId:i,workspaceId:o,webShellProps:{theme:t,onThemeChange:c,language:s,onLanguageChange:u,onSessionIdChange:d,sidebar:!0,compactThinking:!0,markdownTableMode:"advanced"}})})})}async function k4t(){const e=Zae()??await ydt();vdt(),Tfe.createRoot(document.getElementById("root")).render(l.jsx(bn.StrictMode,{children:l.jsx(w4t,{daemonToken:e})}))}k4t();export{K0 as C,Nn as D,Pt as E,dn as F,Fh as G,Jm as P,Ks as R,ca as S,fr as T,xi as V,dc as W,oe as _,_s as a,nr as b,_o as c,Am as d,gd as e,Y4t as f,BDe as g,dLe as h,wS as i,D3 as j,I4t as k,Rm as l};
