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 HH=Object.defineProperty;var UH=(e,t,n)=>t in e?HH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ge=(e,t,n)=>UH(e,typeof t!="symbol"?t+"":t,n);(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 Wy=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var VI={exports:{}},Aw={};/**
 * @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 VH=Symbol.for("react.transitional.element"),WH=Symbol.for("react.fragment");function WI(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:VH,type:e,key:s,ref:t!==void 0?t:null,props:n}}Aw.Fragment=WH;Aw.jsx=WI;Aw.jsxs=WI;VI.exports=Aw;var u=VI.exports,GI={exports:{}},Sn={};/**
 * @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 LS=Symbol.for("react.transitional.element"),GH=Symbol.for("react.portal"),KH=Symbol.for("react.fragment"),YH=Symbol.for("react.strict_mode"),QH=Symbol.for("react.profiler"),XH=Symbol.for("react.consumer"),JH=Symbol.for("react.context"),ZH=Symbol.for("react.forward_ref"),eU=Symbol.for("react.suspense"),tU=Symbol.for("react.memo"),KI=Symbol.for("react.lazy"),nU=Symbol.for("react.activity"),q7=Symbol.iterator;function sU(e){return e===null||typeof e!="object"?null:(e=q7&&e[q7]||e["@@iterator"],typeof e=="function"?e:null)}var YI={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},QI=Object.assign,XI={};function um(e,t,n){this.props=e,this.context=t,this.refs=XI,this.updater=n||YI}um.prototype.isReactComponent={};um.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")};um.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function JI(){}JI.prototype=um.prototype;function DS(e,t,n){this.props=e,this.context=t,this.refs=XI,this.updater=n||YI}var OS=DS.prototype=new JI;OS.constructor=DS;QI(OS,um.prototype);OS.isPureReactComponent=!0;var H7=Array.isArray;function b_(){}var Vs={H:null,A:null,T:null,S:null},ZI=Object.prototype.hasOwnProperty;function BS(e,t,n){var s=n.ref;return{$$typeof:LS,type:e,key:t,ref:s!==void 0?s:null,props:n}}function rU(e,t){return BS(e.type,t,e.props)}function PS(e){return typeof e=="object"&&e!==null&&e.$$typeof===LS}function iU(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var U7=/\/+/g;function k2(e,t){return typeof e=="object"&&e!==null&&e.key!=null?iU(""+e.key):t.toString(36)}function oU(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(b_,b_):(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 Wh(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 LS:case GH:o=!0;break;case KI:return o=e._init,Wh(o(e._payload),t,n,s,r)}}if(o)return r=r(e),o=s===""?"."+k2(e,0):s,H7(r)?(n="",o!=null&&(n=o.replace(U7,"$&/")+"/"),Wh(r,t,n,"",function(c){return c})):r!=null&&(PS(r)&&(r=rU(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(U7,"$&/")+"/")+o)),t.push(r)),1;o=0;var a=s===""?".":s+":";if(H7(e))for(var l=0;l<e.length;l++)s=e[l],i=a+k2(s,l),o+=Wh(s,t,n,i,r);else if(l=sU(e),typeof l=="function")for(e=l.call(e),l=0;!(s=e.next()).done;)s=s.value,i=a+k2(s,l++),o+=Wh(s,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return Wh(oU(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 Wg(e,t,n){if(e==null)return e;var s=[],r=0;return Wh(e,s,"","",function(i){return t.call(n,i,r++)}),s}function aU(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 V7=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)},lU={map:Wg,forEach:function(e,t,n){Wg(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Wg(e,function(){t++}),t},toArray:function(e){return Wg(e,function(t){return t})||[]},only:function(e){if(!PS(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Sn.Activity=nU;Sn.Children=lU;Sn.Component=um;Sn.Fragment=KH;Sn.Profiler=QH;Sn.PureComponent=DS;Sn.StrictMode=YH;Sn.Suspense=eU;Sn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Vs;Sn.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Vs.H.useMemoCache(e)}};Sn.cache=function(e){return function(){return e.apply(null,arguments)}};Sn.cacheSignal=function(){return null};Sn.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=QI({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!ZI.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 BS(e.type,r,s)};Sn.createContext=function(e){return e={$$typeof:JH,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:XH,_context:e},e};Sn.createElement=function(e,t,n){var s,r={},i=null;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)ZI.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),l=0;l<o;l++)a[l]=arguments[l+2];r.children=a}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)r[s]===void 0&&(r[s]=o[s]);return BS(e,i,r)};Sn.createRef=function(){return{current:null}};Sn.forwardRef=function(e){return{$$typeof:ZH,render:e}};Sn.isValidElement=PS;Sn.lazy=function(e){return{$$typeof:KI,_payload:{_status:-1,_result:e},_init:aU}};Sn.memo=function(e,t){return{$$typeof:tU,type:e,compare:t===void 0?null:t}};Sn.startTransition=function(e){var t=Vs.T,n={};Vs.T=n;try{var s=e(),r=Vs.S;r!==null&&r(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(b_,V7)}catch(i){V7(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Vs.T=t}};Sn.unstable_useCacheRefresh=function(){return Vs.H.useCacheRefresh()};Sn.use=function(e){return Vs.H.use(e)};Sn.useActionState=function(e,t,n){return Vs.H.useActionState(e,t,n)};Sn.useCallback=function(e,t){return Vs.H.useCallback(e,t)};Sn.useContext=function(e){return Vs.H.useContext(e)};Sn.useDebugValue=function(){};Sn.useDeferredValue=function(e,t){return Vs.H.useDeferredValue(e,t)};Sn.useEffect=function(e,t){return Vs.H.useEffect(e,t)};Sn.useEffectEvent=function(e){return Vs.H.useEffectEvent(e)};Sn.useId=function(){return Vs.H.useId()};Sn.useImperativeHandle=function(e,t,n){return Vs.H.useImperativeHandle(e,t,n)};Sn.useInsertionEffect=function(e,t){return Vs.H.useInsertionEffect(e,t)};Sn.useLayoutEffect=function(e,t){return Vs.H.useLayoutEffect(e,t)};Sn.useMemo=function(e,t){return Vs.H.useMemo(e,t)};Sn.useOptimistic=function(e,t){return Vs.H.useOptimistic(e,t)};Sn.useReducer=function(e,t,n){return Vs.H.useReducer(e,t,n)};Sn.useRef=function(e){return Vs.H.useRef(e)};Sn.useState=function(e){return Vs.H.useState(e)};Sn.useSyncExternalStore=function(e,t,n){return Vs.H.useSyncExternalStore(e,t,n)};Sn.useTransition=function(){return Vs.H.useTransition()};Sn.version="19.2.4";GI.exports=Sn;var p=GI.exports;const cU=Cw(p);var ej={exports:{}},Ew={},tj={exports:{}},nj={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(B,Q){var Y=B.length;B.push(Q);e:for(;0<Y;){var ne=Y-1>>>1,P=B[ne];if(0<r(P,Q))B[ne]=Q,B[Y]=P,Y=ne;else break e}}function n(B){return B.length===0?null:B[0]}function s(B){if(B.length===0)return null;var Q=B[0],Y=B.pop();if(Y!==Q){B[0]=Y;e:for(var ne=0,P=B.length,le=P>>>1;ne<le;){var z=2*(ne+1)-1,M=B[z],re=z+1,U=B[re];if(0>r(M,Y))re<P&&0>r(U,M)?(B[ne]=U,B[re]=Y,ne=re):(B[ne]=M,B[z]=Y,ne=z);else if(re<P&&0>r(U,Y))B[ne]=U,B[re]=Y,ne=re;else break e}}return Q}function r(B,Q){var Y=B.sortIndex-Q.sortIndex;return Y!==0?Y:B.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 l=[],c=[],d=1,h=null,f=3,m=!1,g=!1,y=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function C(B){for(var Q=n(c);Q!==null;){if(Q.callback===null)s(c);else if(Q.startTime<=B)s(c),Q.sortIndex=Q.expirationTime,t(l,Q);else break;Q=n(c)}}function A(B){if(y=!1,C(B),!g)if(n(l)!==null)g=!0,T||(T=!0,N());else{var Q=n(c);Q!==null&&F(A,Q.startTime-B)}}var T=!1,_=-1,R=5,I=-1;function k(){return b?!0:!(e.unstable_now()-I<R)}function j(){if(b=!1,T){var B=e.unstable_now();I=B;var Q=!0;try{e:{g=!1,y&&(y=!1,v(_),_=-1),m=!0;var Y=f;try{t:{for(C(B),h=n(l);h!==null&&!(h.expirationTime>B&&k());){var ne=h.callback;if(typeof ne=="function"){h.callback=null,f=h.priorityLevel;var P=ne(h.expirationTime<=B);if(B=e.unstable_now(),typeof P=="function"){h.callback=P,C(B),Q=!0;break t}h===n(l)&&s(l),C(B)}else s(l);h=n(l)}if(h!==null)Q=!0;else{var le=n(c);le!==null&&F(A,le.startTime-B),Q=!1}}break e}finally{h=null,f=Y,m=!1}Q=void 0}}finally{Q?N():T=!1}}}var N;if(typeof x=="function")N=function(){x(j)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,$=L.port2;L.port1.onmessage=j,N=function(){$.postMessage(null)}}else N=function(){w(j,0)};function F(B,Q){_=w(function(){B(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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(B){switch(f){case 1:case 2:case 3:var Q=3;break;default:Q=f}var Y=f;f=Q;try{return B()}finally{f=Y}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(B,Q){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Y=f;f=B;try{return Q()}finally{f=Y}},e.unstable_scheduleCallback=function(B,Q,Y){var ne=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?ne+Y:ne):Y=ne,B){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=Y+P,B={id:d++,callback:Q,priorityLevel:B,startTime:Y,expirationTime:P,sortIndex:-1},Y>ne?(B.sortIndex=Y,t(c,B),n(l)===null&&B===n(c)&&(y?(v(_),_=-1):y=!0,F(A,Y-ne))):(B.sortIndex=P,t(l,B),g||m||(g=!0,T||(T=!0,N()))),B},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(B){var Q=f;return function(){var Y=f;f=Q;try{return B.apply(this,arguments)}finally{f=Y}}}})(nj);tj.exports=nj;var uU=tj.exports,sj={exports:{}},so={};/**
 * @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 dU=p;function rj(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 zc(){}var Zi={d:{f:zc,r:function(){throw Error(rj(522))},D:zc,C:zc,L:zc,m:zc,X:zc,S:zc,M:zc},p:0,findDOMNode:null},hU=Symbol.for("react.portal");function fU(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:hU,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var N0=dU.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Mw(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}so.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Zi;so.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(rj(299));return fU(e,t,null,n)};so.flushSync=function(e){var t=N0.T,n=Zi.p;try{if(N0.T=null,Zi.p=2,e)return e()}finally{N0.T=t,Zi.p=n,Zi.d.f()}};so.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Zi.d.C(e,t))};so.prefetchDNS=function(e){typeof e=="string"&&Zi.d.D(e)};so.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=Mw(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Zi.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:r,fetchPriority:i}):n==="script"&&Zi.d.X(e,{crossOrigin:s,integrity:r,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};so.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Mw(t.as,t.crossOrigin);Zi.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&&Zi.d.M(e)};so.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=Mw(n,t.crossOrigin);Zi.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})}};so.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Mw(t.as,t.crossOrigin);Zi.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 Zi.d.m(e)};so.requestFormReset=function(e){Zi.d.r(e)};so.unstable_batchedUpdates=function(e,t){return e(t)};so.useFormState=function(e,t,n){return N0.H.useFormState(e,t,n)};so.useFormStatus=function(){return N0.H.useHostTransitionStatus()};so.version="19.2.4";function ij(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ij)}catch(e){console.error(e)}}ij(),sj.exports=so;var dm=sj.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 zr=uU,oj=p,mU=dm;function je(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 aj(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Zp(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 lj(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 cj(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 W7(e){if(Zp(e)!==e)throw Error(je(188))}function pU(e){var t=e.alternate;if(!t){if(t=Zp(e),t===null)throw Error(je(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 W7(r),e;if(i===s)return W7(r),t;i=i.sibling}throw Error(je(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(je(189))}}if(n.alternate!==s)throw Error(je(190))}if(n.tag!==3)throw Error(je(188));return n.stateNode.current===n?e:t}function uj(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=uj(e),t!==null)return t;e=e.sibling}return null}var Gs=Object.assign,gU=Symbol.for("react.element"),Gg=Symbol.for("react.transitional.element"),d0=Symbol.for("react.portal"),ef=Symbol.for("react.fragment"),dj=Symbol.for("react.strict_mode"),w_=Symbol.for("react.profiler"),hj=Symbol.for("react.consumer"),oc=Symbol.for("react.context"),$S=Symbol.for("react.forward_ref"),v_=Symbol.for("react.suspense"),x_=Symbol.for("react.suspense_list"),zS=Symbol.for("react.memo"),Xc=Symbol.for("react.lazy"),__=Symbol.for("react.activity"),yU=Symbol.for("react.memo_cache_sentinel"),G7=Symbol.iterator;function zm(e){return e===null||typeof e!="object"?null:(e=G7&&e[G7]||e["@@iterator"],typeof e=="function"?e:null)}var bU=Symbol.for("react.client.reference");function k_(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===bU?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ef:return"Fragment";case w_:return"Profiler";case dj:return"StrictMode";case v_:return"Suspense";case x_:return"SuspenseList";case __:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case d0:return"Portal";case oc:return e.displayName||"Context";case hj:return(e._context.displayName||"Context")+".Consumer";case $S:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case zS:return t=e.displayName||null,t!==null?t:k_(e.type)||"Memo";case Xc:t=e._payload,e=e._init;try{return k_(e(t))}catch{}}return null}var h0=Array.isArray,dn=oj.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,hs=mU.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,zd={pending:!1,data:null,method:null,action:null},S_=[],tf=-1;function Il(e){return{current:e}}function ti(e){0>tf||(e.current=S_[tf],S_[tf]=null,tf--)}function Fs(e,t){tf++,S_[tf]=e.current,e.current=t}var Al=Il(null),up=Il(null),Su=Il(null),Gy=Il(null);function Ky(e,t){switch(Fs(Su,t),Fs(up,e),Fs(Al,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ZT(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ZT(t),e=jL(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ti(Al),Fs(Al,e)}function Bf(){ti(Al),ti(up),ti(Su)}function T_(e){e.memoizedState!==null&&Fs(Gy,e);var t=Al.current,n=jL(t,e.type);t!==n&&(Fs(up,e),Fs(Al,n))}function Yy(e){up.current===e&&(ti(Al),ti(up)),Gy.current===e&&(ti(Gy),xp._currentValue=zd)}var S2,K7;function _d(e){if(S2===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);S2=t&&t[1]||"",K7=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+S2+e+K7}var T2=!1;function C2(e,t){if(!e||T2)return"";T2=!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(m){var f=m}Reflect.construct(e,[],h)}else{try{h.call()}catch(m){f=m}e.call(h.prototype)}}else{try{throw Error()}catch(m){f=m}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(m){if(m&&f&&typeof m.stack=="string")return[m.stack,f.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 l=o.split(`
`),c=a.split(`
`);for(r=s=0;s<l.length&&!l[s].includes("DetermineComponentFrameRoot");)s++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(s===l.length||r===c.length)for(s=l.length-1,r=c.length-1;1<=s&&0<=r&&l[s]!==c[r];)r--;for(;1<=s&&0<=r;s--,r--)if(l[s]!==c[r]){if(s!==1||r!==1)do if(s--,r--,0>r||l[s]!==c[r]){var d=`
`+l[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{T2=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?_d(n):""}function wU(e,t){switch(e.tag){case 26:case 27:case 5:return _d(e.type);case 16:return _d("Lazy");case 13:return e.child!==t&&t!==null?_d("Suspense Fallback"):_d("Suspense");case 19:return _d("SuspenseList");case 0:case 15:return C2(e.type,!1);case 11:return C2(e.type.render,!1);case 1:return C2(e.type,!0);case 31:return _d("Activity");default:return""}}function Y7(e){try{var t="",n=null;do t+=wU(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var C_=Object.prototype.hasOwnProperty,FS=zr.unstable_scheduleCallback,A2=zr.unstable_cancelCallback,vU=zr.unstable_shouldYield,xU=zr.unstable_requestPaint,Fo=zr.unstable_now,_U=zr.unstable_getCurrentPriorityLevel,fj=zr.unstable_ImmediatePriority,mj=zr.unstable_UserBlockingPriority,Qy=zr.unstable_NormalPriority,kU=zr.unstable_LowPriority,pj=zr.unstable_IdlePriority,SU=zr.log,TU=zr.unstable_setDisableYieldValue,eg=null,qo=null;function hu(e){if(typeof SU=="function"&&TU(e),qo&&typeof qo.setStrictMode=="function")try{qo.setStrictMode(eg,e)}catch{}}var Ho=Math.clz32?Math.clz32:EU,CU=Math.log,AU=Math.LN2;function EU(e){return e>>>=0,e===0?32:31-(CU(e)/AU|0)|0}var Kg=256,Yg=262144,Qg=4194304;function kd(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 Nw(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=kd(s):(o&=a,o!==0?r=kd(o):n||(n=a&~e,n!==0&&(r=kd(n))))):(a=s&~i,a!==0?r=kd(a):o!==0?r=kd(o):n||(n=s&~e,n!==0&&(r=kd(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 tg(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function MU(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 gj(){var e=Qg;return Qg<<=1,!(Qg&62914560)&&(Qg=4194304),e}function E2(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ng(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function NU(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,l=e.expirationTimes,c=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-Ho(n),h=1<<d;a[d]=0,l[d]=-1;var f=c[d];if(f!==null)for(c[d]=null,d=0;d<f.length;d++){var m=f[d];m!==null&&(m.lane&=-536870913)}n&=~h}s!==0&&yj(e,s,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function yj(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ho(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function bj(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ho(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function wj(e,t){var n=t&-t;return n=n&42?1:qS(n),n&(e.suspendedLanes|t)?0:n}function qS(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 HS(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function vj(){var e=hs.p;return e!==0?e:(e=window.event,e===void 0?32:HL(e.type))}function Q7(e,t){var n=hs.p;try{return hs.p=e,t()}finally{hs.p=n}}var Zu=Math.random().toString(36).slice(2),fi="__reactFiber$"+Zu,_o="__reactProps$"+Zu,hm="__reactContainer$"+Zu,A_="__reactEvents$"+Zu,IU="__reactListeners$"+Zu,jU="__reactHandles$"+Zu,X7="__reactResources$"+Zu,sg="__reactMarker$"+Zu;function US(e){delete e[fi],delete e[_o],delete e[A_],delete e[IU],delete e[jU]}function nf(e){var t=e[fi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[hm]||n[fi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=rC(e);e!==null;){if(n=e[fi])return n;e=rC(e)}return t}e=n,n=e.parentNode}return null}function fm(e){if(e=e[fi]||e[hm]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function f0(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(je(33))}function vf(e){var t=e[X7];return t||(t=e[X7]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Zr(e){e[sg]=!0}var xj=new Set,_j={};function mh(e,t){Pf(e,t),Pf(e+"Capture",t)}function Pf(e,t){for(_j[e]=t,e=0;e<t.length;e++)xj.add(t[e])}var RU=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]*$"),J7={},Z7={};function LU(e){return C_.call(Z7,e)?!0:C_.call(J7,e)?!1:RU.test(e)?Z7[e]=!0:(J7[e]=!0,!1)}function uy(e,t,n){if(LU(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 Xg(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 Wl(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 ra(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function kj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function DU(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 E_(e){if(!e._valueTracker){var t=kj(e)?"checked":"value";e._valueTracker=DU(e,t,""+e[t])}}function Sj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=kj(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Xy(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 OU=/[\n"\\]/g;function ua(e){return e.replace(OU,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function M_(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=""+ra(t)):e.value!==""+ra(t)&&(e.value=""+ra(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?N_(e,o,ra(t)):n!=null?N_(e,o,ra(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=""+ra(a):e.removeAttribute("name")}function Tj(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)){E_(e);return}n=n!=null?""+ra(n):"",t=t!=null?""+ra(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),E_(e)}function N_(e,t,n){t==="number"&&Xy(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function xf(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=""+ra(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 Cj(e,t,n){if(t!=null&&(t=""+ra(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+ra(n):""}function Aj(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(je(92));if(h0(s)){if(1<s.length)throw Error(je(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=ra(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),E_(e)}function $f(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var BU=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 eT(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||BU.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Ej(e,t,n){if(t!=null&&typeof t!="object")throw Error(je(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&&eT(e,r,s)}else for(var i in t)t.hasOwnProperty(i)&&eT(e,i,t[i])}function VS(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 PU=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"]]),$U=/^[\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 dy(e){return $U.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ac(){}var I_=null;function WS(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sf=null,_f=null;function tT(e){var t=fm(e);if(t&&(e=t.stateNode)){var n=e[_o]||null;e:switch(e=t.stateNode,t.type){case"input":if(M_(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="'+ua(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[_o]||null;if(!r)throw Error(je(90));M_(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&&Sj(s)}break e;case"textarea":Cj(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&xf(e,!!n.multiple,t,!1)}}}var M2=!1;function Mj(e,t,n){if(M2)return e(t,n);M2=!0;try{var s=e(t);return s}finally{if(M2=!1,(sf!==null||_f!==null)&&(qw(),sf&&(t=sf,e=_f,_f=sf=null,tT(t),e)))for(t=0;t<e.length;t++)tT(e[t])}}function dp(e,t){var n=e.stateNode;if(n===null)return null;var s=n[_o]||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(je(231,t,typeof n));return n}var wc=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),j_=!1;if(wc)try{var Fm={};Object.defineProperty(Fm,"passive",{get:function(){j_=!0}}),window.addEventListener("test",Fm,Fm),window.removeEventListener("test",Fm,Fm)}catch{j_=!1}var fu=null,GS=null,hy=null;function Nj(){if(hy)return hy;var e,t=GS,n=t.length,s,r="value"in fu?fu.value:fu.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 hy=r.slice(e,1<s?1-s:void 0)}function fy(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 Jg(){return!0}function nT(){return!1}function To(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)?Jg:nT,this.isPropagationStopped=nT,this}return Gs(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=Jg)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Jg)},persist:function(){},isPersistent:Jg}),t}var ph={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Iw=To(ph),rg=Gs({},ph,{view:0,detail:0}),zU=To(rg),N2,I2,qm,jw=Gs({},rg,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:KS,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!==qm&&(qm&&e.type==="mousemove"?(N2=e.screenX-qm.screenX,I2=e.screenY-qm.screenY):I2=N2=0,qm=e),N2)},movementY:function(e){return"movementY"in e?e.movementY:I2}}),sT=To(jw),FU=Gs({},jw,{dataTransfer:0}),qU=To(FU),HU=Gs({},rg,{relatedTarget:0}),j2=To(HU),UU=Gs({},ph,{animationName:0,elapsedTime:0,pseudoElement:0}),VU=To(UU),WU=Gs({},ph,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),GU=To(WU),KU=Gs({},ph,{data:0}),rT=To(KU),YU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},QU={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"},XU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function JU(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=XU[e])?!!t[e]:!1}function KS(){return JU}var ZU=Gs({},rg,{key:function(e){if(e.key){var t=YU[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=fy(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?QU[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:KS,charCode:function(e){return e.type==="keypress"?fy(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?fy(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),eV=To(ZU),tV=Gs({},jw,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),iT=To(tV),nV=Gs({},rg,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:KS}),sV=To(nV),rV=Gs({},ph,{propertyName:0,elapsedTime:0,pseudoElement:0}),iV=To(rV),oV=Gs({},jw,{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}),aV=To(oV),lV=Gs({},ph,{newState:0,oldState:0}),cV=To(lV),uV=[9,13,27,32],YS=wc&&"CompositionEvent"in window,I0=null;wc&&"documentMode"in document&&(I0=document.documentMode);var dV=wc&&"TextEvent"in window&&!I0,Ij=wc&&(!YS||I0&&8<I0&&11>=I0),oT=" ",aT=!1;function jj(e,t){switch(e){case"keyup":return uV.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var rf=!1;function hV(e,t){switch(e){case"compositionend":return Rj(t);case"keypress":return t.which!==32?null:(aT=!0,oT);case"textInput":return e=t.data,e===oT&&aT?null:e;default:return null}}function fV(e,t){if(rf)return e==="compositionend"||!YS&&jj(e,t)?(e=Nj(),hy=GS=fu=null,rf=!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 Ij&&t.locale!=="ko"?null:t.data;default:return null}}var mV={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 lT(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!mV[e.type]:t==="textarea"}function Lj(e,t,n,s){sf?_f?_f.push(s):_f=[s]:sf=s,t=pb(t,"onChange"),0<t.length&&(n=new Iw("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var j0=null,hp=null;function pV(e){ML(e,0)}function Rw(e){var t=f0(e);if(Sj(t))return e}function cT(e,t){if(e==="change")return t}var Dj=!1;if(wc){var R2;if(wc){var L2="oninput"in document;if(!L2){var uT=document.createElement("div");uT.setAttribute("oninput","return;"),L2=typeof uT.oninput=="function"}R2=L2}else R2=!1;Dj=R2&&(!document.documentMode||9<document.documentMode)}function dT(){j0&&(j0.detachEvent("onpropertychange",Oj),hp=j0=null)}function Oj(e){if(e.propertyName==="value"&&Rw(hp)){var t=[];Lj(t,hp,e,WS(e)),Mj(pV,t)}}function gV(e,t,n){e==="focusin"?(dT(),j0=t,hp=n,j0.attachEvent("onpropertychange",Oj)):e==="focusout"&&dT()}function yV(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rw(hp)}function bV(e,t){if(e==="click")return Rw(t)}function wV(e,t){if(e==="input"||e==="change")return Rw(t)}function vV(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Go=typeof Object.is=="function"?Object.is:vV;function fp(e,t){if(Go(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(!C_.call(t,r)||!Go(e[r],t[r]))return!1}return!0}function hT(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fT(e,t){var n=hT(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=hT(n)}}function Bj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pj(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Xy(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=Xy(e.document)}return t}function QS(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 xV=wc&&"documentMode"in document&&11>=document.documentMode,of=null,R_=null,R0=null,L_=!1;function mT(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;L_||of==null||of!==Xy(s)||(s=of,"selectionStart"in s&&QS(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}),R0&&fp(R0,s)||(R0=s,s=pb(R_,"onSelect"),0<s.length&&(t=new Iw("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=of)))}function md(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var af={animationend:md("Animation","AnimationEnd"),animationiteration:md("Animation","AnimationIteration"),animationstart:md("Animation","AnimationStart"),transitionrun:md("Transition","TransitionRun"),transitionstart:md("Transition","TransitionStart"),transitioncancel:md("Transition","TransitionCancel"),transitionend:md("Transition","TransitionEnd")},D2={},$j={};wc&&($j=document.createElement("div").style,"AnimationEvent"in window||(delete af.animationend.animation,delete af.animationiteration.animation,delete af.animationstart.animation),"TransitionEvent"in window||delete af.transitionend.transition);function gh(e){if(D2[e])return D2[e];if(!af[e])return e;var t=af[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in $j)return D2[e]=t[n];return e}var zj=gh("animationend"),Fj=gh("animationiteration"),qj=gh("animationstart"),_V=gh("transitionrun"),kV=gh("transitionstart"),SV=gh("transitioncancel"),Hj=gh("transitionend"),Uj=new Map,D_="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(" ");D_.push("scrollEnd");function Ua(e,t){Uj.set(e,t),mh(t,[e])}var Jy=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)},na=[],lf=0,XS=0;function Lw(){for(var e=lf,t=XS=lf=0;t<e;){var n=na[t];na[t++]=null;var s=na[t];na[t++]=null;var r=na[t];na[t++]=null;var i=na[t];if(na[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&&Vj(n,r,i)}}function Dw(e,t,n,s){na[lf++]=e,na[lf++]=t,na[lf++]=n,na[lf++]=s,XS|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function JS(e,t,n,s){return Dw(e,t,n,s),Zy(e)}function yh(e,t){return Dw(e,null,null,t),Zy(e)}function Vj(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-Ho(n),e=i.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),i):null}function Zy(e){if(50<q0)throw q0=0,nk=null,Error(je(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var cf={};function TV(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 Oo(e,t,n,s){return new TV(e,t,n,s)}function ZS(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hc(e,t){var n=e.alternate;return n===null?(n=Oo(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 Wj(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 my(e,t,n,s,r,i){var o=0;if(s=e,typeof e=="function")ZS(e)&&(o=1);else if(typeof e=="string")o=NW(e,n,Al.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case __:return e=Oo(31,n,t,r),e.elementType=__,e.lanes=i,e;case ef:return Fd(n.children,r,i,t);case dj:o=8,r|=24;break;case w_:return e=Oo(12,n,t,r|2),e.elementType=w_,e.lanes=i,e;case v_:return e=Oo(13,n,t,r),e.elementType=v_,e.lanes=i,e;case x_:return e=Oo(19,n,t,r),e.elementType=x_,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case oc:o=10;break e;case hj:o=9;break e;case $S:o=11;break e;case zS:o=14;break e;case Xc:o=16,s=null;break e}o=29,n=Error(je(130,e===null?"null":typeof e,"")),s=null}return t=Oo(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function Fd(e,t,n,s){return e=Oo(7,e,s,t),e.lanes=n,e}function O2(e,t,n){return e=Oo(6,e,null,t),e.lanes=n,e}function Gj(e){var t=Oo(18,null,null,0);return t.stateNode=e,t}function B2(e,t,n){return t=Oo(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var pT=new WeakMap;function da(e,t){if(typeof e=="object"&&e!==null){var n=pT.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Y7(t)},pT.set(e,t),t)}return{value:e,source:t,stack:Y7(t)}}var uf=[],df=0,eb=null,mp=0,ia=[],oa=0,Pu=null,vl=1,xl="";function tc(e,t){uf[df++]=mp,uf[df++]=eb,eb=e,mp=t}function Kj(e,t,n){ia[oa++]=vl,ia[oa++]=xl,ia[oa++]=Pu,Pu=e;var s=vl;e=xl;var r=32-Ho(s)-1;s&=~(1<<r),n+=1;var i=32-Ho(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,vl=1<<32-Ho(t)+r|n<<r|s,xl=i+e}else vl=1<<i|n<<r|s,xl=e}function e6(e){e.return!==null&&(tc(e,1),Kj(e,1,0))}function t6(e){for(;e===eb;)eb=uf[--df],uf[df]=null,mp=uf[--df],uf[df]=null;for(;e===Pu;)Pu=ia[--oa],ia[oa]=null,xl=ia[--oa],ia[oa]=null,vl=ia[--oa],ia[oa]=null}function Yj(e,t){ia[oa++]=vl,ia[oa++]=xl,ia[oa++]=Pu,vl=t.id,xl=t.overflow,Pu=e}var mi=null,Us=null,Qn=!1,Tu=null,ha=!1,O_=Error(je(519));function $u(e){var t=Error(je(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pp(da(t,e)),O_}function gT(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[fi]=e,t[_o]=s,n){case"dialog":$n("cancel",t),$n("close",t);break;case"iframe":case"object":case"embed":$n("load",t);break;case"video":case"audio":for(n=0;n<wp.length;n++)$n(wp[n],t);break;case"source":$n("error",t);break;case"img":case"image":case"link":$n("error",t),$n("load",t);break;case"details":$n("toggle",t);break;case"input":$n("invalid",t),Tj(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":$n("invalid",t);break;case"textarea":$n("invalid",t),Aj(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||IL(t.textContent,n)?(s.popover!=null&&($n("beforetoggle",t),$n("toggle",t)),s.onScroll!=null&&$n("scroll",t),s.onScrollEnd!=null&&$n("scrollend",t),s.onClick!=null&&(t.onclick=ac),t=!0):t=!1,t||$u(e,!0)}function yT(e){for(mi=e.return;mi;)switch(mi.tag){case 5:case 31:case 13:ha=!1;return;case 27:case 3:ha=!0;return;default:mi=mi.return}}function Oh(e){if(e!==mi)return!1;if(!Qn)return yT(e),Qn=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||ak(e.type,e.memoizedProps)),n=!n),n&&Us&&$u(e),yT(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(je(317));Us=sC(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(je(317));Us=sC(e)}else t===27?(t=Us,ed(e.type)?(e=dk,dk=null,Us=e):Us=t):Us=mi?ba(e.stateNode.nextSibling):null;return!0}function Qd(){Us=mi=null,Qn=!1}function P2(){var e=Tu;return e!==null&&(go===null?go=e:go.push.apply(go,e),Tu=null),e}function pp(e){Tu===null?Tu=[e]:Tu.push(e)}var B_=Il(null),bh=null,lc=null;function iu(e,t,n){Fs(B_,t._currentValue),t._currentValue=n}function fc(e){e._currentValue=B_.current,ti(B_)}function P_(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 $_(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 l=0;l<t.length;l++)if(a.context===t[l]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),P_(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(je(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),P_(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 mm(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(je(387));if(o=o.memoizedProps,o!==null){var a=r.type;Go(r.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(r===Gy.current){if(o=r.alternate,o===null)throw Error(je(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(xp):e=[xp])}r=r.return}e!==null&&$_(t,e,n,s),t.flags|=262144}function tb(e){for(e=e.firstContext;e!==null;){if(!Go(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Xd(e){bh=e,lc=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function pi(e){return Qj(bh,e)}function Zg(e,t){return bh===null&&Xd(e),Qj(e,t)}function Qj(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},lc===null){if(e===null)throw Error(je(308));lc=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else lc=lc.next=t;return n}var CV=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()})}},AV=zr.unstable_scheduleCallback,EV=zr.unstable_NormalPriority,Cr={$$typeof:oc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function n6(){return{controller:new CV,data:new Map,refCount:0}}function ig(e){e.refCount--,e.refCount===0&&AV(EV,function(){e.controller.abort()})}var L0=null,z_=0,zf=0,kf=null;function MV(e,t){if(L0===null){var n=L0=[];z_=0,zf=A6(),kf={status:"pending",value:void 0,then:function(s){n.push(s)}}}return z_++,t.then(bT,bT),t}function bT(){if(--z_===0&&L0!==null){kf!==null&&(kf.status="fulfilled");var e=L0;L0=null,zf=0,kf=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function NV(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 wT=dn.S;dn.S=function(e,t){uL=Fo(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&MV(e,t),wT!==null&&wT(e,t)};var qd=Il(null);function s6(){var e=qd.current;return e!==null?e:Ls.pooledCache}function py(e,t){t===null?Fs(qd,qd.current):Fs(qd,t.pool)}function Xj(){var e=s6();return e===null?null:{parent:Cr._currentValue,pool:e}}var pm=Error(je(460)),r6=Error(je(474)),Ow=Error(je(542)),nb={then:function(){}};function vT(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Jj(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(ac,ac),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_T(e),e;default:if(typeof t.status=="string")t.then(ac,ac);else{if(e=Ls,e!==null&&100<e.shellSuspendCounter)throw Error(je(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,_T(e),e}throw Hd=t,pm}}function Sd(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Hd=n,pm):n}}var Hd=null;function xT(){if(Hd===null)throw Error(je(459));var e=Hd;return Hd=null,e}function _T(e){if(e===pm||e===Ow)throw Error(je(483))}var Sf=null,gp=0;function e1(e){var t=gp;return gp+=1,Sf===null&&(Sf=[]),Jj(Sf,e,t)}function Hm(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function t1(e,t){throw t.$$typeof===gU?Error(je(525)):(e=Object.prototype.toString.call(t),Error(je(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Zj(e){function t(w,v){if(e){var x=w.deletions;x===null?(w.deletions=[v],w.flags|=16):x.push(v)}}function n(w,v){if(!e)return null;for(;v!==null;)t(w,v),v=v.sibling;return null}function s(w){for(var v=new Map;w!==null;)w.key!==null?v.set(w.key,w):v.set(w.index,w),w=w.sibling;return v}function r(w,v){return w=hc(w,v),w.index=0,w.sibling=null,w}function i(w,v,x){return w.index=x,e?(x=w.alternate,x!==null?(x=x.index,x<v?(w.flags|=67108866,v):x):(w.flags|=67108866,v)):(w.flags|=1048576,v)}function o(w){return e&&w.alternate===null&&(w.flags|=67108866),w}function a(w,v,x,C){return v===null||v.tag!==6?(v=O2(x,w.mode,C),v.return=w,v):(v=r(v,x),v.return=w,v)}function l(w,v,x,C){var A=x.type;return A===ef?d(w,v,x.props.children,C,x.key):v!==null&&(v.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===Xc&&Sd(A)===v.type)?(v=r(v,x.props),Hm(v,x),v.return=w,v):(v=my(x.type,x.key,x.props,null,w.mode,C),Hm(v,x),v.return=w,v)}function c(w,v,x,C){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=B2(x,w.mode,C),v.return=w,v):(v=r(v,x.children||[]),v.return=w,v)}function d(w,v,x,C,A){return v===null||v.tag!==7?(v=Fd(x,w.mode,C,A),v.return=w,v):(v=r(v,x),v.return=w,v)}function h(w,v,x){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=O2(""+v,w.mode,x),v.return=w,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Gg:return x=my(v.type,v.key,v.props,null,w.mode,x),Hm(x,v),x.return=w,x;case d0:return v=B2(v,w.mode,x),v.return=w,v;case Xc:return v=Sd(v),h(w,v,x)}if(h0(v)||zm(v))return v=Fd(v,w.mode,x,null),v.return=w,v;if(typeof v.then=="function")return h(w,e1(v),x);if(v.$$typeof===oc)return h(w,Zg(w,v),x);t1(w,v)}return null}function f(w,v,x,C){var A=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return A!==null?null:a(w,v,""+x,C);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Gg:return x.key===A?l(w,v,x,C):null;case d0:return x.key===A?c(w,v,x,C):null;case Xc:return x=Sd(x),f(w,v,x,C)}if(h0(x)||zm(x))return A!==null?null:d(w,v,x,C,null);if(typeof x.then=="function")return f(w,v,e1(x),C);if(x.$$typeof===oc)return f(w,v,Zg(w,x),C);t1(w,x)}return null}function m(w,v,x,C,A){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return w=w.get(x)||null,a(v,w,""+C,A);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Gg:return w=w.get(C.key===null?x:C.key)||null,l(v,w,C,A);case d0:return w=w.get(C.key===null?x:C.key)||null,c(v,w,C,A);case Xc:return C=Sd(C),m(w,v,x,C,A)}if(h0(C)||zm(C))return w=w.get(x)||null,d(v,w,C,A,null);if(typeof C.then=="function")return m(w,v,x,e1(C),A);if(C.$$typeof===oc)return m(w,v,x,Zg(v,C),A);t1(v,C)}return null}function g(w,v,x,C){for(var A=null,T=null,_=v,R=v=0,I=null;_!==null&&R<x.length;R++){_.index>R?(I=_,_=null):I=_.sibling;var k=f(w,_,x[R],C);if(k===null){_===null&&(_=I);break}e&&_&&k.alternate===null&&t(w,_),v=i(k,v,R),T===null?A=k:T.sibling=k,T=k,_=I}if(R===x.length)return n(w,_),Qn&&tc(w,R),A;if(_===null){for(;R<x.length;R++)_=h(w,x[R],C),_!==null&&(v=i(_,v,R),T===null?A=_:T.sibling=_,T=_);return Qn&&tc(w,R),A}for(_=s(_);R<x.length;R++)I=m(_,w,R,x[R],C),I!==null&&(e&&I.alternate!==null&&_.delete(I.key===null?R:I.key),v=i(I,v,R),T===null?A=I:T.sibling=I,T=I);return e&&_.forEach(function(j){return t(w,j)}),Qn&&tc(w,R),A}function y(w,v,x,C){if(x==null)throw Error(je(151));for(var A=null,T=null,_=v,R=v=0,I=null,k=x.next();_!==null&&!k.done;R++,k=x.next()){_.index>R?(I=_,_=null):I=_.sibling;var j=f(w,_,k.value,C);if(j===null){_===null&&(_=I);break}e&&_&&j.alternate===null&&t(w,_),v=i(j,v,R),T===null?A=j:T.sibling=j,T=j,_=I}if(k.done)return n(w,_),Qn&&tc(w,R),A;if(_===null){for(;!k.done;R++,k=x.next())k=h(w,k.value,C),k!==null&&(v=i(k,v,R),T===null?A=k:T.sibling=k,T=k);return Qn&&tc(w,R),A}for(_=s(_);!k.done;R++,k=x.next())k=m(_,w,R,k.value,C),k!==null&&(e&&k.alternate!==null&&_.delete(k.key===null?R:k.key),v=i(k,v,R),T===null?A=k:T.sibling=k,T=k);return e&&_.forEach(function(N){return t(w,N)}),Qn&&tc(w,R),A}function b(w,v,x,C){if(typeof x=="object"&&x!==null&&x.type===ef&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Gg:e:{for(var A=x.key;v!==null;){if(v.key===A){if(A=x.type,A===ef){if(v.tag===7){n(w,v.sibling),C=r(v,x.props.children),C.return=w,w=C;break e}}else if(v.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===Xc&&Sd(A)===v.type){n(w,v.sibling),C=r(v,x.props),Hm(C,x),C.return=w,w=C;break e}n(w,v);break}else t(w,v);v=v.sibling}x.type===ef?(C=Fd(x.props.children,w.mode,C,x.key),C.return=w,w=C):(C=my(x.type,x.key,x.props,null,w.mode,C),Hm(C,x),C.return=w,w=C)}return o(w);case d0:e:{for(A=x.key;v!==null;){if(v.key===A)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(w,v.sibling),C=r(v,x.children||[]),C.return=w,w=C;break e}else{n(w,v);break}else t(w,v);v=v.sibling}C=B2(x,w.mode,C),C.return=w,w=C}return o(w);case Xc:return x=Sd(x),b(w,v,x,C)}if(h0(x))return g(w,v,x,C);if(zm(x)){if(A=zm(x),typeof A!="function")throw Error(je(150));return x=A.call(x),y(w,v,x,C)}if(typeof x.then=="function")return b(w,v,e1(x),C);if(x.$$typeof===oc)return b(w,v,Zg(w,x),C);t1(w,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(w,v.sibling),C=r(v,x),C.return=w,w=C):(n(w,v),C=O2(x,w.mode,C),C.return=w,w=C),o(w)):n(w,v)}return function(w,v,x,C){try{gp=0;var A=b(w,v,x,C);return Sf=null,A}catch(_){if(_===pm||_===Ow)throw _;var T=Oo(29,_,null,w.mode);return T.lanes=C,T.return=w,T}finally{}}}var Jd=Zj(!0),eR=Zj(!1),Jc=!1;function i6(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function F_(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 Cu(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Au(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,us&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=Zy(e),Vj(e,null,n),t}return Dw(e,s,t,n),Zy(e)}function D0(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,bj(e,n)}}function $2(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 q_=!1;function O0(){if(q_){var e=kf;if(e!==null)throw e}}function B0(e,t,n,s){q_=!1;var r=e.updateQueue;Jc=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var h=r.baseState;o=0,d=c=l=null,a=i;do{var f=a.lane&-536870913,m=f!==a.lane;if(m?(Vn&f)===f:(s&f)===f){f!==0&&f===zf&&(q_=!0),d!==null&&(d=d.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var g=e,y=a;f=t;var b=n;switch(y.tag){case 1:if(g=y.payload,typeof g=="function"){h=g.call(b,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=y.payload,f=typeof g=="function"?g.call(b,h,f):g,f==null)break e;h=Gs({},h,f);break e;case 2:Jc=!0}}f=a.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=r.callbacks,m===null?r.callbacks=[f]:m.push(f))}else m={lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=m,l=h):d=d.next=m,o|=f;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;m=a,a=m.next,m.next=null,r.lastBaseUpdate=m,r.shared.pending=null}}while(!0);d===null&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=d,i===null&&(r.shared.lanes=0),Fu|=o,e.lanes=o,e.memoizedState=h}}function tR(e,t){if(typeof e!="function")throw Error(je(191,e));e.call(t)}function nR(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)tR(n[e],t)}var Ff=Il(null),sb=Il(0);function kT(e,t){e=kc,Fs(sb,e),Fs(Ff,t),kc=e|t.baseLanes}function H_(){Fs(sb,kc),Fs(Ff,Ff.current)}function o6(){kc=sb.current,ti(Ff),ti(sb)}var Ko=Il(null),ya=null;function ou(e){var t=e.alternate;Fs(gr,gr.current&1),Fs(Ko,e),ya===null&&(t===null||Ff.current!==null||t.memoizedState!==null)&&(ya=e)}function U_(e){Fs(gr,gr.current),Fs(Ko,e),ya===null&&(ya=e)}function sR(e){e.tag===22?(Fs(gr,gr.current),Fs(Ko,e),ya===null&&(ya=e)):au()}function au(){Fs(gr,gr.current),Fs(Ko,Ko.current)}function Do(e){ti(Ko),ya===e&&(ya=null),ti(gr)}var gr=Il(0);function rb(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ck(n)||uk(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 vc=0,En=null,Cs=null,kr=null,ib=!1,Tf=!1,Zd=!1,ob=0,yp=0,Cf=null,IV=0;function lr(){throw Error(je(321))}function a6(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Go(e[n],t[n]))return!1;return!0}function l6(e,t,n,s,r,i){return vc=i,En=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,dn.H=e===null||e.memoizedState===null?LR:w6,Zd=!1,i=n(s,r),Zd=!1,Tf&&(i=iR(t,n,s,r)),rR(e),i}function rR(e){dn.H=bp;var t=Cs!==null&&Cs.next!==null;if(vc=0,kr=Cs=En=null,ib=!1,yp=0,Cf=null,t)throw Error(je(300));e===null||Ar||(e=e.dependencies,e!==null&&tb(e)&&(Ar=!0))}function iR(e,t,n,s){En=e;var r=0;do{if(Tf&&(Cf=null),yp=0,Tf=!1,25<=r)throw Error(je(301));if(r+=1,kr=Cs=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}dn.H=DR,i=t(n,s)}while(Tf);return i}function jV(){var e=dn.H,t=e.useState()[0];return t=typeof t.then=="function"?og(t):t,e=e.useState()[0],(Cs!==null?Cs.memoizedState:null)!==e&&(En.flags|=1024),t}function c6(){var e=ob!==0;return ob=0,e}function u6(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function d6(e){if(ib){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ib=!1}vc=0,kr=Cs=En=null,Tf=!1,yp=ob=0,Cf=null}function Wi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kr===null?En.memoizedState=kr=e:kr=kr.next=e,kr}function yr(){if(Cs===null){var e=En.alternate;e=e!==null?e.memoizedState:null}else e=Cs.next;var t=kr===null?En.memoizedState:kr.next;if(t!==null)kr=t,Cs=e;else{if(e===null)throw En.alternate===null?Error(je(467)):Error(je(310));Cs=e,e={memoizedState:Cs.memoizedState,baseState:Cs.baseState,baseQueue:Cs.baseQueue,queue:Cs.queue,next:null},kr===null?En.memoizedState=kr=e:kr=kr.next=e}return kr}function Bw(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function og(e){var t=yp;return yp+=1,Cf===null&&(Cf=[]),e=Jj(Cf,e,t),t=En,(kr===null?t.memoizedState:kr.next)===null&&(t=t.alternate,dn.H=t===null||t.memoizedState===null?LR:w6),e}function Pw(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return og(e);if(e.$$typeof===oc)return pi(e)}throw Error(je(438,String(e)))}function h6(e){var t=null,n=En.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=En.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=Bw(),En.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]=yU;return t.index++,n}function xc(e,t){return typeof t=="function"?t(e):t}function gy(e){var t=yr();return f6(t,Cs,e)}function f6(e,t,n){var s=e.queue;if(s===null)throw Error(je(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,l=null,c=t,d=!1;do{var h=c.lane&-536870913;if(h!==c.lane?(Vn&h)===h:(vc&h)===h){var f=c.revertLane;if(f===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),h===zf&&(d=!0);else if((vc&f)===f){c=c.next,f===zf&&(d=!0);continue}else h={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=h,o=i):l=l.next=h,En.lanes|=f,Fu|=f;h=c.action,Zd&&n(i,h),i=c.hasEagerState?c.eagerState:n(i,h)}else f={lane:h,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=f,o=i):l=l.next=f,En.lanes|=h,Fu|=h;c=c.next}while(c!==null&&c!==t);if(l===null?o=i:l.next=a,!Go(i,e.memoizedState)&&(Ar=!0,d&&(n=kf,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=l,s.lastRenderedState=i}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function z2(e){var t=yr(),n=t.queue;if(n===null)throw Error(je(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);Go(i,t.memoizedState)||(Ar=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function oR(e,t,n){var s=En,r=yr(),i=Qn;if(i){if(n===void 0)throw Error(je(407));n=n()}else n=t();var o=!Go((Cs||r).memoizedState,n);if(o&&(r.memoizedState=n,Ar=!0),r=r.queue,m6(cR.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||kr!==null&&kr.memoizedState.tag&1){if(s.flags|=2048,qf(9,{destroy:void 0},lR.bind(null,s,r,n,t),null),Ls===null)throw Error(je(349));i||vc&127||aR(s,t,n)}return n}function aR(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=En.updateQueue,t===null?(t=Bw(),En.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function lR(e,t,n,s){t.value=n,t.getSnapshot=s,uR(t)&&dR(e)}function cR(e,t,n){return n(function(){uR(t)&&dR(e)})}function uR(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Go(e,n)}catch{return!0}}function dR(e){var t=yh(e,2);t!==null&&xo(t,e,2)}function V_(e){var t=Wi();if(typeof e=="function"){var n=e;if(e=n(),Zd){hu(!0);try{n()}finally{hu(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xc,lastRenderedState:e},t}function hR(e,t,n,s){return e.baseState=n,f6(e,Cs,typeof s=="function"?s:xc)}function RV(e,t,n,s,r){if(zw(e))throw Error(je(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)}};dn.T!==null?n(!0):i.isTransition=!1,s(i),n=t.pending,n===null?(i.next=t.pending=i,fR(t,i)):(i.next=n.next,t.pending=n.next=i)}}function fR(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var i=dn.T,o={};dn.T=o;try{var a=n(r,s),l=dn.S;l!==null&&l(o,a),ST(e,t,a)}catch(c){W_(e,t,c)}finally{i!==null&&o.types!==null&&(i.types=o.types),dn.T=i}}else try{i=n(r,s),ST(e,t,i)}catch(c){W_(e,t,c)}}function ST(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){TT(e,t,s)},function(s){return W_(e,t,s)}):TT(e,t,n)}function TT(e,t,n){t.status="fulfilled",t.value=n,mR(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,fR(e,n)))}function W_(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,mR(t),t=t.next;while(t!==s)}e.action=null}function mR(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function pR(e,t){return t}function CT(e,t){if(Qn){var n=Ls.formState;if(n!==null){e:{var s=En;if(Qn){if(Us){t:{for(var r=Us,i=ha;r.nodeType!==8;){if(!i){r=null;break t}if(r=ba(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){Us=ba(r.nextSibling),s=r.data==="F!";break e}}$u(s)}s=!1}s&&(t=n[0])}}return n=Wi(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pR,lastRenderedState:t},n.queue=s,n=IR.bind(null,En,s),s.dispatch=n,s=V_(!1),i=b6.bind(null,En,!1,s.queue),s=Wi(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=RV.bind(null,En,r,i,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function AT(e){var t=yr();return gR(t,Cs,e)}function gR(e,t,n){if(t=f6(e,t,pR)[0],e=gy(xc)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=og(t)}catch(o){throw o===pm?Ow:o}else s=t;t=yr();var r=t.queue,i=r.dispatch;return n!==t.memoizedState&&(En.flags|=2048,qf(9,{destroy:void 0},LV.bind(null,r,n),null)),[s,i,e]}function LV(e,t){e.action=t}function ET(e){var t=yr(),n=Cs;if(n!==null)return gR(t,n,e);yr(),t=t.memoizedState,n=yr();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function qf(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=En.updateQueue,t===null&&(t=Bw(),En.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 yR(){return yr().memoizedState}function yy(e,t,n,s){var r=Wi();En.flags|=e,r.memoizedState=qf(1|t,{destroy:void 0},n,s===void 0?null:s)}function $w(e,t,n,s){var r=yr();s=s===void 0?null:s;var i=r.memoizedState.inst;Cs!==null&&s!==null&&a6(s,Cs.memoizedState.deps)?r.memoizedState=qf(t,i,n,s):(En.flags|=e,r.memoizedState=qf(1|t,i,n,s))}function MT(e,t){yy(8390656,8,e,t)}function m6(e,t){$w(2048,8,e,t)}function DV(e){En.flags|=4;var t=En.updateQueue;if(t===null)t=Bw(),En.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function bR(e){var t=yr().memoizedState;return DV({ref:t,nextImpl:e}),function(){if(us&2)throw Error(je(440));return t.impl.apply(void 0,arguments)}}function wR(e,t){return $w(4,2,e,t)}function vR(e,t){return $w(4,4,e,t)}function xR(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 _R(e,t,n){n=n!=null?n.concat([e]):null,$w(4,4,xR.bind(null,t,e),n)}function p6(){}function kR(e,t){var n=yr();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&a6(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function SR(e,t){var n=yr();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&a6(t,s[1]))return s[0];if(s=e(),Zd){hu(!0);try{e()}finally{hu(!1)}}return n.memoizedState=[s,t],s}function g6(e,t,n){return n===void 0||vc&1073741824&&!(Vn&261930)?e.memoizedState=t:(e.memoizedState=n,e=hL(),En.lanes|=e,Fu|=e,n)}function TR(e,t,n,s){return Go(n,t)?n:Ff.current!==null?(e=g6(e,n,s),Go(e,t)||(Ar=!0),e):!(vc&42)||vc&1073741824&&!(Vn&261930)?(Ar=!0,e.memoizedState=n):(e=hL(),En.lanes|=e,Fu|=e,t)}function CR(e,t,n,s,r){var i=hs.p;hs.p=i!==0&&8>i?i:8;var o=dn.T,a={};dn.T=a,b6(e,!1,t,n);try{var l=r(),c=dn.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var d=NV(l,s);P0(e,t,d,Uo(e))}else P0(e,t,s,Uo(e))}catch(h){P0(e,t,{then:function(){},status:"rejected",reason:h},Uo())}finally{hs.p=i,o!==null&&a.types!==null&&(o.types=a.types),dn.T=o}}function OV(){}function G_(e,t,n,s){if(e.tag!==5)throw Error(je(476));var r=AR(e).queue;CR(e,r,t,zd,n===null?OV:function(){return ER(e),n(s)})}function AR(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:zd,baseState:zd,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xc,lastRenderedState:zd},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xc,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ER(e){var t=AR(e);t.next===null&&(t=e.alternate.memoizedState),P0(e,t.next.queue,{},Uo())}function y6(){return pi(xp)}function MR(){return yr().memoizedState}function NR(){return yr().memoizedState}function BV(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Uo();e=Cu(n);var s=Au(t,e,n);s!==null&&(xo(s,t,n),D0(s,t,n)),t={cache:n6()},e.payload=t;return}t=t.return}}function PV(e,t,n){var s=Uo();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},zw(e)?jR(t,n):(n=JS(e,t,n,s),n!==null&&(xo(n,e,s),RR(n,t,s)))}function IR(e,t,n){var s=Uo();P0(e,t,n,s)}function P0(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(zw(e))jR(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,Go(a,o))return Dw(e,t,r,0),Ls===null&&Lw(),!1}catch{}finally{}if(n=JS(e,t,r,s),n!==null)return xo(n,e,s),RR(n,t,s),!0}return!1}function b6(e,t,n,s){if(s={lane:2,revertLane:A6(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},zw(e)){if(t)throw Error(je(479))}else t=JS(e,n,s,2),t!==null&&xo(t,e,2)}function zw(e){var t=e.alternate;return e===En||t!==null&&t===En}function jR(e,t){Tf=ib=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function RR(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,bj(e,n)}}var bp={readContext:pi,use:Pw,useCallback:lr,useContext:lr,useEffect:lr,useImperativeHandle:lr,useLayoutEffect:lr,useInsertionEffect:lr,useMemo:lr,useReducer:lr,useRef:lr,useState:lr,useDebugValue:lr,useDeferredValue:lr,useTransition:lr,useSyncExternalStore:lr,useId:lr,useHostTransitionStatus:lr,useFormState:lr,useActionState:lr,useOptimistic:lr,useMemoCache:lr,useCacheRefresh:lr};bp.useEffectEvent=lr;var LR={readContext:pi,use:Pw,useCallback:function(e,t){return Wi().memoizedState=[e,t===void 0?null:t],e},useContext:pi,useEffect:MT,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,yy(4194308,4,xR.bind(null,t,e),n)},useLayoutEffect:function(e,t){return yy(4194308,4,e,t)},useInsertionEffect:function(e,t){yy(4,2,e,t)},useMemo:function(e,t){var n=Wi();t=t===void 0?null:t;var s=e();if(Zd){hu(!0);try{e()}finally{hu(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Wi();if(n!==void 0){var r=n(t);if(Zd){hu(!0);try{n(t)}finally{hu(!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=PV.bind(null,En,e),[s.memoizedState,e]},useRef:function(e){var t=Wi();return e={current:e},t.memoizedState=e},useState:function(e){e=V_(e);var t=e.queue,n=IR.bind(null,En,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:p6,useDeferredValue:function(e,t){var n=Wi();return g6(n,e,t)},useTransition:function(){var e=V_(!1);return e=CR.bind(null,En,e.queue,!0,!1),Wi().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=En,r=Wi();if(Qn){if(n===void 0)throw Error(je(407));n=n()}else{if(n=t(),Ls===null)throw Error(je(349));Vn&127||aR(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,MT(cR.bind(null,s,i,e),[e]),s.flags|=2048,qf(9,{destroy:void 0},lR.bind(null,s,i,n,t),null),n},useId:function(){var e=Wi(),t=Ls.identifierPrefix;if(Qn){var n=xl,s=vl;n=(s&~(1<<32-Ho(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ob++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=IV++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:y6,useFormState:CT,useActionState:CT,useOptimistic:function(e){var t=Wi();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=b6.bind(null,En,!0,n),n.dispatch=t,[e,t]},useMemoCache:h6,useCacheRefresh:function(){return Wi().memoizedState=BV.bind(null,En)},useEffectEvent:function(e){var t=Wi(),n={impl:e};return t.memoizedState=n,function(){if(us&2)throw Error(je(440));return n.impl.apply(void 0,arguments)}}},w6={readContext:pi,use:Pw,useCallback:kR,useContext:pi,useEffect:m6,useImperativeHandle:_R,useInsertionEffect:wR,useLayoutEffect:vR,useMemo:SR,useReducer:gy,useRef:yR,useState:function(){return gy(xc)},useDebugValue:p6,useDeferredValue:function(e,t){var n=yr();return TR(n,Cs.memoizedState,e,t)},useTransition:function(){var e=gy(xc)[0],t=yr().memoizedState;return[typeof e=="boolean"?e:og(e),t]},useSyncExternalStore:oR,useId:MR,useHostTransitionStatus:y6,useFormState:AT,useActionState:AT,useOptimistic:function(e,t){var n=yr();return hR(n,Cs,e,t)},useMemoCache:h6,useCacheRefresh:NR};w6.useEffectEvent=bR;var DR={readContext:pi,use:Pw,useCallback:kR,useContext:pi,useEffect:m6,useImperativeHandle:_R,useInsertionEffect:wR,useLayoutEffect:vR,useMemo:SR,useReducer:z2,useRef:yR,useState:function(){return z2(xc)},useDebugValue:p6,useDeferredValue:function(e,t){var n=yr();return Cs===null?g6(n,e,t):TR(n,Cs.memoizedState,e,t)},useTransition:function(){var e=z2(xc)[0],t=yr().memoizedState;return[typeof e=="boolean"?e:og(e),t]},useSyncExternalStore:oR,useId:MR,useHostTransitionStatus:y6,useFormState:ET,useActionState:ET,useOptimistic:function(e,t){var n=yr();return Cs!==null?hR(n,Cs,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:h6,useCacheRefresh:NR};DR.useEffectEvent=bR;function F2(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Gs({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var K_={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Uo(),r=Cu(s);r.payload=t,n!=null&&(r.callback=n),t=Au(e,r,s),t!==null&&(xo(t,e,s),D0(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Uo(),r=Cu(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=Au(e,r,s),t!==null&&(xo(t,e,s),D0(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Uo(),s=Cu(n);s.tag=2,t!=null&&(s.callback=t),t=Au(e,s,n),t!==null&&(xo(t,e,n),D0(t,e,n))}};function NT(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?!fp(n,s)||!fp(r,i):!0}function IT(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&&K_.enqueueReplaceState(t,t.state,null)}function eh(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=Gs({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function OR(e){Jy(e)}function BR(e){console.error(e)}function PR(e){Jy(e)}function ab(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function jT(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 Y_(e,t,n){return n=Cu(n),n.tag=3,n.payload={element:null},n.callback=function(){ab(e,t)},n}function $R(e){return e=Cu(e),e.tag=3,e}function zR(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(){jT(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){jT(t,n,s),typeof r!="function"&&(Eu===null?Eu=new Set([this]):Eu.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function $V(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&mm(t,n,r,!0),n=Ko.current,n!==null){switch(n.tag){case 31:case 13:return ya===null?hb():n.alternate===null&&cr===0&&(cr=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===nb?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),J2(e,s,r)),!1;case 22:return n.flags|=65536,s===nb?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)),J2(e,s,r)),!1}throw Error(je(435,n.tag))}return J2(e,s,r),hb(),!1}if(Qn)return t=Ko.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==O_&&(e=Error(je(422),{cause:s}),pp(da(e,n)))):(s!==O_&&(t=Error(je(423),{cause:s}),pp(da(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=da(s,n),r=Y_(e.stateNode,s,r),$2(e,r),cr!==4&&(cr=2)),!1;var i=Error(je(520),{cause:s});if(i=da(i,n),F0===null?F0=[i]:F0.push(i),cr!==4&&(cr=2),t===null)return!0;s=da(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=Y_(n.stateNode,s,e),$2(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"&&(Eu===null||!Eu.has(i))))return n.flags|=65536,r&=-r,n.lanes|=r,r=$R(r),zR(r,e,n,s),$2(n,r),!1}n=n.return}while(n!==null);return!1}var v6=Error(je(461)),Ar=!1;function ci(e,t,n,s){t.child=e===null?eR(t,null,n,s):Jd(t,e.child,n,s)}function RT(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 Xd(t),s=l6(e,t,n,o,i,r),a=c6(),e!==null&&!Ar?(u6(e,t,r),_c(e,t,r)):(Qn&&a&&e6(t),t.flags|=1,ci(e,t,s,r),t.child)}function LT(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!ZS(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,FR(e,t,i,s,r)):(e=my(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!x6(e,r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:fp,n(o,s)&&e.ref===t.ref)return _c(e,t,r)}return t.flags|=1,e=hc(i,s),e.ref=t.ref,e.return=t,t.child=e}function FR(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(fp(i,s)&&e.ref===t.ref)if(Ar=!1,t.pendingProps=s=i,x6(e,r))e.flags&131072&&(Ar=!0);else return t.lanes=e.lanes,_c(e,t,r)}return Q_(e,t,n,s,r)}function qR(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 DT(e,t,i,n,s)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&py(t,i!==null?i.cachePool:null),i!==null?kT(t,i):H_(),sR(t);else return s=t.lanes=536870912,DT(e,t,i!==null?i.baseLanes|n:n,n,s)}else i!==null?(py(t,i.cachePool),kT(t,i),au(),t.memoizedState=null):(e!==null&&py(t,null),H_(),au());return ci(e,t,r,n),t.child}function m0(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function DT(e,t,n,s,r){var i=s6();return i=i===null?null:{parent:Cr._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&py(t,null),H_(),sR(t),e!==null&&mm(e,t,s,!0),t.childLanes=r,null}function by(e,t){return t=lb({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function OT(e,t,n){return Jd(t,e.child,null,n),e=by(t,t.pendingProps),e.flags|=2,Do(t),t.memoizedState=null,e}function zV(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Qn){if(s.mode==="hidden")return e=by(t,s),t.lanes=536870912,m0(null,e);if(U_(t),(e=Us)?(e=LL(e,ha),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Pu!==null?{id:vl,overflow:xl}:null,retryLane:536870912,hydrationErrors:null},n=Gj(e),n.return=t,t.child=n,mi=t,Us=null)):e=null,e===null)throw $u(t);return t.lanes=536870912,null}return by(t,s)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(U_(t),r)if(t.flags&256)t.flags&=-257,t=OT(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(je(558));else if(Ar||mm(e,t,n,!1),r=(n&e.childLanes)!==0,Ar||r){if(s=Ls,s!==null&&(o=wj(s,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,yh(e,o),xo(s,e,o),v6;hb(),t=OT(e,t,n)}else e=i.treeContext,Us=ba(o.nextSibling),mi=t,Qn=!0,Tu=null,ha=!1,e!==null&&Yj(t,e),t=by(t,s),t.flags|=4096;return t}return e=hc(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function wy(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(je(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Q_(e,t,n,s,r){return Xd(t),n=l6(e,t,n,s,void 0,r),s=c6(),e!==null&&!Ar?(u6(e,t,r),_c(e,t,r)):(Qn&&s&&e6(t),t.flags|=1,ci(e,t,n,r),t.child)}function BT(e,t,n,s,r,i){return Xd(t),t.updateQueue=null,n=iR(t,s,n,r),rR(e),s=c6(),e!==null&&!Ar?(u6(e,t,i),_c(e,t,i)):(Qn&&s&&e6(t),t.flags|=1,ci(e,t,n,i),t.child)}function PT(e,t,n,s,r){if(Xd(t),t.stateNode===null){var i=cf,o=n.contextType;typeof o=="object"&&o!==null&&(i=pi(o)),i=new n(s,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=K_,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=s,i.state=t.memoizedState,i.refs={},i6(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?pi(o):cf,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(F2(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&&K_.enqueueReplaceState(i,i.state,null),B0(t,s,i,r),O0(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,l=eh(n,a);i.props=l;var c=i.context,d=n.contextType;o=cf,typeof d=="object"&&d!==null&&(o=pi(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||c!==o)&&IT(t,i,s,o),Jc=!1;var f=t.memoizedState;i.state=f,B0(t,s,i,r),O0(),c=t.memoizedState,a||f!==c||Jc?(typeof h=="function"&&(F2(t,n,h,s),c=t.memoizedState),(l=Jc||NT(t,n,l,s,f,c,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=c),i.props=s,i.state=c,i.context=o,s=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{i=t.stateNode,F_(e,t),o=t.memoizedProps,d=eh(n,o),i.props=d,h=t.pendingProps,f=i.context,c=n.contextType,l=cf,typeof c=="object"&&c!==null&&(l=pi(c)),a=n.getDerivedStateFromProps,(c=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==h||f!==l)&&IT(t,i,s,l),Jc=!1,f=t.memoizedState,i.state=f,B0(t,s,i,r),O0();var m=t.memoizedState;o!==h||f!==m||Jc||e!==null&&e.dependencies!==null&&tb(e.dependencies)?(typeof a=="function"&&(F2(t,n,a,s),m=t.memoizedState),(d=Jc||NT(t,n,d,s,f,m,l)||e!==null&&e.dependencies!==null&&tb(e.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(s,m,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(s,m,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=m),i.props=s,i.state=m,i.context=l,s=d):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),s=!1)}return i=s,wy(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=Jd(t,e.child,null,r),t.child=Jd(t,null,n,r)):ci(e,t,n,r),t.memoizedState=i.state,e=t.child):e=_c(e,t,r),e}function $T(e,t,n,s){return Qd(),t.flags|=256,ci(e,t,n,s),t.child}var q2={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function H2(e){return{baseLanes:e,cachePool:Xj()}}function U2(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Po),e}function HR(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:(gr.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Qn){if(r?ou(t):au(),(e=Us)?(e=LL(e,ha),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Pu!==null?{id:vl,overflow:xl}:null,retryLane:536870912,hydrationErrors:null},n=Gj(e),n.return=t,t.child=n,mi=t,Us=null)):e=null,e===null)throw $u(t);return uk(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(au(),r=t.mode,a=lb({mode:"hidden",children:a},r),s=Fd(s,r,n,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=H2(n),s.childLanes=U2(e,o,n),t.memoizedState=q2,m0(null,s)):(ou(t),X_(t,a))}var l=e.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(i)t.flags&256?(ou(t),t.flags&=-257,t=V2(e,t,n)):t.memoizedState!==null?(au(),t.child=e.child,t.flags|=128,t=null):(au(),a=s.fallback,r=t.mode,s=lb({mode:"visible",children:s.children},r),a=Fd(a,r,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,Jd(t,e.child,null,n),s=t.child,s.memoizedState=H2(n),s.childLanes=U2(e,o,n),t.memoizedState=q2,t=m0(null,s));else if(ou(t),uk(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,s=Error(je(419)),s.stack="",s.digest=o,pp({value:s,source:null,stack:null}),t=V2(e,t,n)}else if(Ar||mm(e,t,n,!1),o=(n&e.childLanes)!==0,Ar||o){if(o=Ls,o!==null&&(s=wj(o,n),s!==0&&s!==l.retryLane))throw l.retryLane=s,yh(e,s),xo(o,e,s),v6;ck(a)||hb(),t=V2(e,t,n)}else ck(a)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Us=ba(a.nextSibling),mi=t,Qn=!0,Tu=null,ha=!1,e!==null&&Yj(t,e),t=X_(t,s.children),t.flags|=4096);return t}return r?(au(),a=s.fallback,r=t.mode,l=e.child,c=l.sibling,s=hc(l,{mode:"hidden",children:s.children}),s.subtreeFlags=l.subtreeFlags&65011712,c!==null?a=hc(c,a):(a=Fd(a,r,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,m0(null,s),s=t.child,a=e.child.memoizedState,a===null?a=H2(n):(r=a.cachePool,r!==null?(l=Cr._currentValue,r=r.parent!==l?{parent:l,pool:l}:r):r=Xj(),a={baseLanes:a.baseLanes|n,cachePool:r}),s.memoizedState=a,s.childLanes=U2(e,o,n),t.memoizedState=q2,m0(e.child,s)):(ou(t),n=e.child,e=n.sibling,n=hc(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 X_(e,t){return t=lb({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function lb(e,t){return e=Oo(22,e,null,t),e.lanes=0,e}function V2(e,t,n){return Jd(t,e.child,null,n),e=X_(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function zT(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),P_(e.return,t,n)}function W2(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 UR(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;s=s.children;var o=gr.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,Fs(gr,o),ci(e,t,s,n),s=Qn?mp:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&zT(e,n,t);else if(e.tag===19)zT(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&&rb(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),W2(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&&rb(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}W2(t,!0,n,null,i,s);break;case"together":W2(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function _c(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Fu|=t.lanes,!(n&t.childLanes))if(e!==null){if(mm(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(je(153));if(t.child!==null){for(e=t.child,n=hc(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=hc(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function x6(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&tb(e)))}function FV(e,t,n){switch(t.tag){case 3:Ky(t,t.stateNode.containerInfo),iu(t,Cr,e.memoizedState.cache),Qd();break;case 27:case 5:T_(t);break;case 4:Ky(t,t.stateNode.containerInfo);break;case 10:iu(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,U_(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ou(t),t.flags|=128,null):n&t.child.childLanes?HR(e,t,n):(ou(t),e=_c(e,t,n),e!==null?e.sibling:null);ou(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(mm(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return UR(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Fs(gr,gr.current),s)break;return null;case 22:return t.lanes=0,qR(e,t,n,t.pendingProps);case 24:iu(t,Cr,e.memoizedState.cache)}return _c(e,t,n)}function VR(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ar=!0;else{if(!x6(e,n)&&!(t.flags&128))return Ar=!1,FV(e,t,n);Ar=!!(e.flags&131072)}else Ar=!1,Qn&&t.flags&1048576&&Kj(t,mp,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Sd(t.elementType),t.type=e,typeof e=="function")ZS(e)?(s=eh(e,s),t.tag=1,t=PT(null,t,e,s,n)):(t.tag=0,t=Q_(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===$S){t.tag=11,t=RT(null,t,e,s,n);break e}else if(r===zS){t.tag=14,t=LT(null,t,e,s,n);break e}}throw t=k_(e)||e,Error(je(306,t,""))}}return t;case 0:return Q_(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=eh(s,t.pendingProps),PT(e,t,s,r,n);case 3:e:{if(Ky(t,t.stateNode.containerInfo),e===null)throw Error(je(387));s=t.pendingProps;var i=t.memoizedState;r=i.element,F_(e,t),B0(t,s,null,n);var o=t.memoizedState;if(s=o.cache,iu(t,Cr,s),s!==i.cache&&$_(t,[Cr],n,!0),O0(),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=$T(e,t,s,n);break e}else if(s!==r){r=da(Error(je(424)),t),pp(r),t=$T(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(Us=ba(e.firstChild),mi=t,Qn=!0,Tu=null,ha=!0,n=eR(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Qd(),s===r){t=_c(e,t,n);break e}ci(e,t,s,n)}t=t.child}return t;case 26:return wy(e,t),e===null?(n=oC(t.type,null,t.pendingProps,null))?t.memoizedState=n:Qn||(n=t.type,e=t.pendingProps,s=gb(Su.current).createElement(n),s[fi]=t,s[_o]=e,yi(s,n,e),Zr(s),t.stateNode=s):t.memoizedState=oC(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return T_(t),e===null&&Qn&&(s=t.stateNode=DL(t.type,t.pendingProps,Su.current),mi=t,ha=!0,r=Us,ed(t.type)?(dk=r,Us=ba(s.firstChild)):Us=r),ci(e,t,t.pendingProps.children,n),wy(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Qn&&((r=s=Us)&&(s=yW(s,t.type,t.pendingProps,ha),s!==null?(t.stateNode=s,mi=t,Us=ba(s.firstChild),ha=!1,r=!0):r=!1),r||$u(t)),T_(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,ak(r,i)?s=null:o!==null&&ak(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=l6(e,t,jV,null,null,n),xp._currentValue=r),wy(e,t),ci(e,t,s,n),t.child;case 6:return e===null&&Qn&&((e=n=Us)&&(n=bW(n,t.pendingProps,ha),n!==null?(t.stateNode=n,mi=t,Us=null,e=!0):e=!1),e||$u(t)),null;case 13:return HR(e,t,n);case 4:return Ky(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Jd(t,null,s,n):ci(e,t,s,n),t.child;case 11:return RT(e,t,t.type,t.pendingProps,n);case 7:return ci(e,t,t.pendingProps,n),t.child;case 8:return ci(e,t,t.pendingProps.children,n),t.child;case 12:return ci(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,iu(t,t.type,s.value),ci(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,Xd(t),r=pi(r),s=s(r),t.flags|=1,ci(e,t,s,n),t.child;case 14:return LT(e,t,t.type,t.pendingProps,n);case 15:return FR(e,t,t.type,t.pendingProps,n);case 19:return UR(e,t,n);case 31:return zV(e,t,n);case 22:return qR(e,t,n,t.pendingProps);case 24:return Xd(t),s=pi(Cr),e===null?(r=s6(),r===null&&(r=Ls,i=n6(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=n),r=i),t.memoizedState={parent:s,cache:r},i6(t),iu(t,Cr,r)):(e.lanes&n&&(F_(e,t),B0(t,null,null,n),O0()),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),iu(t,Cr,s)):(s=i.cache,iu(t,Cr,s),s!==r.cache&&$_(t,[Cr],n,!0))),ci(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(je(156,t.tag))}function Gl(e){e.flags|=4}function G2(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(pL())e.flags|=8192;else throw Hd=nb,r6}else e.flags&=-16777217}function FT(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!PL(t))if(pL())e.flags|=8192;else throw Hd=nb,r6}function n1(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?gj():536870912,e.lanes|=t,Hf|=t)}function Um(e,t){if(!Qn)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 Hs(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 qV(e,t,n){var s=t.pendingProps;switch(t6(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Hs(t),null;case 1:return Hs(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),fc(Cr),Bf(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Oh(t)?Gl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,P2())),Hs(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(Gl(t),i!==null?(Hs(t),FT(t,i)):(Hs(t),G2(t,r,null,s,n))):i?i!==e.memoizedState?(Gl(t),Hs(t),FT(t,i)):(Hs(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Gl(t),Hs(t),G2(t,r,e,s,n)),null;case 27:if(Yy(t),n=Su.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Gl(t);else{if(!s){if(t.stateNode===null)throw Error(je(166));return Hs(t),null}e=Al.current,Oh(t)?gT(t):(e=DL(r,s,n),t.stateNode=e,Gl(t))}return Hs(t),null;case 5:if(Yy(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Gl(t);else{if(!s){if(t.stateNode===null)throw Error(je(166));return Hs(t),null}if(i=Al.current,Oh(t))gT(t);else{var o=gb(Su.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[fi]=t,i[_o]=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(yi(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&&Gl(t)}}return Hs(t),G2(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Gl(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(je(166));if(e=Su.current,Oh(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=mi,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[fi]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||IL(e.nodeValue,n)),e||$u(t,!0)}else e=gb(e).createTextNode(s),e[fi]=t,t.stateNode=e}return Hs(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Oh(t),n!==null){if(e===null){if(!s)throw Error(je(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(je(557));e[fi]=t}else Qd(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Hs(t),e=!1}else n=P2(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Do(t),t):(Do(t),null);if(t.flags&128)throw Error(je(558))}return Hs(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Oh(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(je(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(je(317));r[fi]=t}else Qd(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Hs(t),r=!1}else r=P2(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Do(t),t):(Do(t),null)}return Do(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),n1(t,t.updateQueue),Hs(t),null);case 4:return Bf(),e===null&&E6(t.stateNode.containerInfo),Hs(t),null;case 10:return fc(t.type),Hs(t),null;case 19:if(ti(gr),s=t.memoizedState,s===null)return Hs(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)Um(s,!1);else{if(cr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=rb(e),i!==null){for(t.flags|=128,Um(s,!1),e=i.updateQueue,t.updateQueue=e,n1(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Wj(n,e),n=n.sibling;return Fs(gr,gr.current&1|2),Qn&&tc(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Fo()>ub&&(t.flags|=128,r=!0,Um(s,!1),t.lanes=4194304)}else{if(!r)if(e=rb(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,n1(t,e),Um(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!Qn)return Hs(t),null}else 2*Fo()-s.renderingStartTime>ub&&n!==536870912&&(t.flags|=128,r=!0,Um(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=Fo(),e.sibling=null,n=gr.current,Fs(gr,r?n&1|2:n&1),Qn&&tc(t,s.treeForkCount),e):(Hs(t),null);case 22:case 23:return Do(t),o6(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(Hs(t),t.subtreeFlags&6&&(t.flags|=8192)):Hs(t),n=t.updateQueue,n!==null&&n1(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&&ti(qd),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),fc(Cr),Hs(t),null;case 25:return null;case 30:return null}throw Error(je(156,t.tag))}function HV(e,t){switch(t6(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return fc(Cr),Bf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Yy(t),null;case 31:if(t.memoizedState!==null){if(Do(t),t.alternate===null)throw Error(je(340));Qd()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Do(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(je(340));Qd()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ti(gr),null;case 4:return Bf(),null;case 10:return fc(t.type),null;case 22:case 23:return Do(t),o6(),e!==null&&ti(qd),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return fc(Cr),null;case 25:return null;default:return null}}function WR(e,t){switch(t6(t),t.tag){case 3:fc(Cr),Bf();break;case 26:case 27:case 5:Yy(t);break;case 4:Bf();break;case 31:t.memoizedState!==null&&Do(t);break;case 13:Do(t);break;case 19:ti(gr);break;case 10:fc(t.type);break;case 22:case 23:Do(t),o6(),e!==null&&ti(qd);break;case 24:fc(Cr)}}function ag(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){ks(t,t.return,a)}}function zu(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 l=n,c=a;try{c()}catch(d){ks(r,l,d)}}}s=s.next}while(s!==i)}}catch(d){ks(t,t.return,d)}}function GR(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{nR(t,n)}catch(s){ks(e,e.return,s)}}}function KR(e,t,n){n.props=eh(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){ks(e,t,s)}}function $0(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){ks(e,t,r)}}function _l(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){ks(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){ks(e,t,r)}else n.current=null}function YR(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){ks(e,e.return,r)}}function K2(e,t,n){try{var s=e.stateNode;dW(s,e.type,n,t),s[_o]=t}catch(r){ks(e,e.return,r)}}function QR(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ed(e.type)||e.tag===4}function Y2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||QR(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&&ed(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 J_(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=ac));else if(s!==4&&(s===27&&ed(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(J_(e,t,n),e=e.sibling;e!==null;)J_(e,t,n),e=e.sibling}function cb(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&&ed(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(cb(e,t,n),e=e.sibling;e!==null;)cb(e,t,n),e=e.sibling}function XR(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);yi(t,s,n),t[fi]=e,t[_o]=n}catch(i){ks(e,e.return,i)}}var sc=!1,Sr=!1,Q2=!1,qT=typeof WeakSet=="function"?WeakSet:Set,Jr=null;function UV(e,t){if(e=e.containerInfo,ik=vb,e=Pj(e),QS(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,l=-1,c=0,d=0,h=e,f=null;t:for(;;){for(var m;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==i||s!==0&&h.nodeType!==3||(l=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)f=h,h=m;for(;;){if(h===e)break t;if(f===n&&++c===r&&(a=o),f===i&&++d===s&&(l=o),(m=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ok={focusedElem:e,selectionRange:n},vb=!1,Jr=t;Jr!==null;)if(t=Jr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Jr=e;else for(;Jr!==null;){switch(t=Jr,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=eh(n.type,r);e=s.getSnapshotBeforeUpdate(g,i),s.__reactInternalSnapshotBeforeUpdate=e}catch(y){ks(n,n.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)lk(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":lk(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(je(163))}if(e=t.sibling,e!==null){e.return=t.return,Jr=e;break}Jr=t.return}}function JR(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Yl(e,n),s&4&&ag(5,n);break;case 1:if(Yl(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){ks(n,n.return,o)}else{var r=eh(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){ks(n,n.return,o)}}s&64&&GR(n),s&512&&$0(n,n.return);break;case 3:if(Yl(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{nR(e,t)}catch(o){ks(n,n.return,o)}}break;case 27:t===null&&s&4&&XR(n);case 26:case 5:Yl(e,n),t===null&&s&4&&YR(n),s&512&&$0(n,n.return);break;case 12:Yl(e,n);break;case 31:Yl(e,n),s&4&&tL(e,n);break;case 13:Yl(e,n),s&4&&nL(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ZV.bind(null,n),wW(e,n))));break;case 22:if(s=n.memoizedState!==null||sc,!s){t=t!==null&&t.memoizedState!==null||Sr,r=sc;var i=Sr;sc=s,(Sr=t)&&!i?Zl(e,n,(n.subtreeFlags&8772)!==0):Yl(e,n),sc=r,Sr=i}break;case 30:break;default:Yl(e,n)}}function ZR(e){var t=e.alternate;t!==null&&(e.alternate=null,ZR(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&US(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 Ys=null,po=!1;function Kl(e,t,n){for(n=n.child;n!==null;)eL(e,t,n),n=n.sibling}function eL(e,t,n){if(qo&&typeof qo.onCommitFiberUnmount=="function")try{qo.onCommitFiberUnmount(eg,n)}catch{}switch(n.tag){case 26:Sr||_l(n,t),Kl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Sr||_l(n,t);var s=Ys,r=po;ed(n.type)&&(Ys=n.stateNode,po=!1),Kl(e,t,n),H0(n.stateNode),Ys=s,po=r;break;case 5:Sr||_l(n,t);case 6:if(s=Ys,r=po,Ys=null,Kl(e,t,n),Ys=s,po=r,Ys!==null)if(po)try{(Ys.nodeType===9?Ys.body:Ys.nodeName==="HTML"?Ys.ownerDocument.body:Ys).removeChild(n.stateNode)}catch(i){ks(n,t,i)}else try{Ys.removeChild(n.stateNode)}catch(i){ks(n,t,i)}break;case 18:Ys!==null&&(po?(e=Ys,tC(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Gf(e)):tC(Ys,n.stateNode));break;case 4:s=Ys,r=po,Ys=n.stateNode.containerInfo,po=!0,Kl(e,t,n),Ys=s,po=r;break;case 0:case 11:case 14:case 15:zu(2,n,t),Sr||zu(4,n,t),Kl(e,t,n);break;case 1:Sr||(_l(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&KR(n,t,s)),Kl(e,t,n);break;case 21:Kl(e,t,n);break;case 22:Sr=(s=Sr)||n.memoizedState!==null,Kl(e,t,n),Sr=s;break;default:Kl(e,t,n)}}function tL(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Gf(e)}catch(n){ks(t,t.return,n)}}}function nL(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Gf(e)}catch(n){ks(t,t.return,n)}}function VV(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new qT),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new qT),t;default:throw Error(je(435,e.tag))}}function s1(e,t){var n=VV(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=eW.bind(null,e,s);s.then(r,r)}})}function co(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(ed(a.type)){Ys=a.stateNode,po=!1;break e}break;case 5:Ys=a.stateNode,po=!1;break e;case 3:case 4:Ys=a.stateNode.containerInfo,po=!0;break e}a=a.return}if(Ys===null)throw Error(je(160));eL(i,o,r),Ys=null,po=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)sL(t,e),t=t.sibling}var Oa=null;function sL(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:co(t,e),uo(e),s&4&&(zu(3,e,e.return),ag(3,e),zu(5,e,e.return));break;case 1:co(t,e),uo(e),s&512&&(Sr||n===null||_l(n,n.return)),s&64&&sc&&(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=Oa;if(co(t,e),uo(e),s&512&&(Sr||n===null||_l(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[sg]||i[fi]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(s),r.head.insertBefore(i,r.querySelector("head > title"))),yi(i,s,n),i[fi]=e,Zr(i),s=i;break e;case"link":var o=lC("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),yi(i,s,n),r.head.appendChild(i);break;case"meta":if(o=lC("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),yi(i,s,n),r.head.appendChild(i);break;default:throw Error(je(468,s))}i[fi]=e,Zr(i),s=i}e.stateNode=s}else cC(r,e.type,e.stateNode);else e.stateNode=aC(r,s,e.memoizedProps);else i!==s?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,s===null?cC(r,e.type,e.stateNode):aC(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&K2(e,e.memoizedProps,n.memoizedProps)}break;case 27:co(t,e),uo(e),s&512&&(Sr||n===null||_l(n,n.return)),n!==null&&s&4&&K2(e,e.memoizedProps,n.memoizedProps);break;case 5:if(co(t,e),uo(e),s&512&&(Sr||n===null||_l(n,n.return)),e.flags&32){r=e.stateNode;try{$f(r,"")}catch(g){ks(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,K2(e,r,n!==null?n.memoizedProps:r)),s&1024&&(Q2=!0);break;case 6:if(co(t,e),uo(e),s&4){if(e.stateNode===null)throw Error(je(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(g){ks(e,e.return,g)}}break;case 3:if(_y=null,r=Oa,Oa=yb(t.containerInfo),co(t,e),Oa=r,uo(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Gf(t.containerInfo)}catch(g){ks(e,e.return,g)}Q2&&(Q2=!1,rL(e));break;case 4:s=Oa,Oa=yb(e.stateNode.containerInfo),co(t,e),uo(e),Oa=s;break;case 12:co(t,e),uo(e);break;case 31:co(t,e),uo(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,s1(e,s)));break;case 13:co(t,e),uo(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Fw=Fo()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,s1(e,s)));break;case 22:r=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=sc,d=Sr;if(sc=c||r,Sr=d||l,co(t,e),Sr=d,sc=c,uo(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||l||sc||Sr||Td(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,r)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=l.stateNode;var h=l.memoizedProps.style,f=h!=null&&h.hasOwnProperty("display")?h.display:null;a.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(g){ks(l,l.return,g)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=r?"":l.memoizedProps}catch(g){ks(l,l.return,g)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;r?nC(m,!0):nC(l.stateNode,!1)}catch(g){ks(l,l.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,s1(e,n))));break;case 19:co(t,e),uo(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,s1(e,s)));break;case 30:break;case 21:break;default:co(t,e),uo(e)}}function uo(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(QR(s)){n=s;break}s=s.return}if(n==null)throw Error(je(160));switch(n.tag){case 27:var r=n.stateNode,i=Y2(e);cb(e,i,r);break;case 5:var o=n.stateNode;n.flags&32&&($f(o,""),n.flags&=-33);var a=Y2(e);cb(e,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,c=Y2(e);J_(e,c,l);break;default:throw Error(je(161))}}catch(d){ks(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rL(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;rL(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Yl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)JR(e,t.alternate,t),t=t.sibling}function Td(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zu(4,t,t.return),Td(t);break;case 1:_l(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&KR(t,t.return,n),Td(t);break;case 27:H0(t.stateNode);case 26:case 5:_l(t,t.return),Td(t);break;case 22:t.memoizedState===null&&Td(t);break;case 30:Td(t);break;default:Td(t)}e=e.sibling}}function Zl(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:Zl(r,i,n),ag(4,i);break;case 1:if(Zl(r,i,n),s=i,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(c){ks(s,s.return,c)}if(s=i,r=s.updateQueue,r!==null){var a=s.stateNode;try{var l=r.shared.hiddenCallbacks;if(l!==null)for(r.shared.hiddenCallbacks=null,r=0;r<l.length;r++)tR(l[r],a)}catch(c){ks(s,s.return,c)}}n&&o&64&&GR(i),$0(i,i.return);break;case 27:XR(i);case 26:case 5:Zl(r,i,n),n&&s===null&&o&4&&YR(i),$0(i,i.return);break;case 12:Zl(r,i,n);break;case 31:Zl(r,i,n),n&&o&4&&tL(r,i);break;case 13:Zl(r,i,n),n&&o&4&&nL(r,i);break;case 22:i.memoizedState===null&&Zl(r,i,n),$0(i,i.return);break;case 30:break;default:Zl(r,i,n)}t=t.sibling}}function _6(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&&ig(n))}function k6(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ig(e))}function ja(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)iL(e,t,n,s),t=t.sibling}function iL(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:ja(e,t,n,s),r&2048&&ag(9,t);break;case 1:ja(e,t,n,s);break;case 3:ja(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&&ig(e)));break;case 12:if(r&2048){ja(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(l){ks(t,t.return,l)}}else ja(e,t,n,s);break;case 31:ja(e,t,n,s);break;case 13:ja(e,t,n,s);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?ja(e,t,n,s):z0(e,t):i._visibility&2?ja(e,t,n,s):(i._visibility|=2,Gh(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&_6(o,t);break;case 24:ja(e,t,n,s),r&2048&&k6(t.alternate,t);break;default:ja(e,t,n,s)}}function Gh(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,l=s,c=o.flags;switch(o.tag){case 0:case 11:case 15:Gh(i,o,a,l,r),ag(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?Gh(i,o,a,l,r):z0(i,o):(d._visibility|=2,Gh(i,o,a,l,r)),r&&c&2048&&_6(o.alternate,o);break;case 24:Gh(i,o,a,l,r),r&&c&2048&&k6(o.alternate,o);break;default:Gh(i,o,a,l,r)}t=t.sibling}}function z0(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:z0(n,s),r&2048&&_6(s.alternate,s);break;case 24:z0(n,s),r&2048&&k6(s.alternate,s);break;default:z0(n,s)}t=t.sibling}}var p0=8192;function Bh(e,t,n){if(e.subtreeFlags&p0)for(e=e.child;e!==null;)oL(e,t,n),e=e.sibling}function oL(e,t,n){switch(e.tag){case 26:Bh(e,t,n),e.flags&p0&&e.memoizedState!==null&&IW(n,Oa,e.memoizedState,e.memoizedProps);break;case 5:Bh(e,t,n);break;case 3:case 4:var s=Oa;Oa=yb(e.stateNode.containerInfo),Bh(e,t,n),Oa=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=p0,p0=16777216,Bh(e,t,n),p0=s):Bh(e,t,n));break;default:Bh(e,t,n)}}function aL(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 Vm(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];Jr=s,cL(s,e)}aL(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)lL(e),e=e.sibling}function lL(e){switch(e.tag){case 0:case 11:case 15:Vm(e),e.flags&2048&&zu(9,e,e.return);break;case 3:Vm(e);break;case 12:Vm(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,vy(e)):Vm(e);break;default:Vm(e)}}function vy(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];Jr=s,cL(s,e)}aL(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zu(8,t,t.return),vy(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,vy(t));break;default:vy(t)}e=e.sibling}}function cL(e,t){for(;Jr!==null;){var n=Jr;switch(n.tag){case 0:case 11:case 15:zu(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:ig(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,Jr=s;else e:for(n=e;Jr!==null;){s=Jr;var r=s.sibling,i=s.return;if(ZR(s),s===n){Jr=null;break e}if(r!==null){r.return=i,Jr=r;break e}Jr=i}}}var WV={getCacheForType:function(e){var t=pi(Cr),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return pi(Cr).controller.signal}},GV=typeof WeakMap=="function"?WeakMap:Map,us=0,Ls=null,zn=null,Vn=0,xs=0,Ro=null,mu=!1,gm=!1,S6=!1,kc=0,cr=0,Fu=0,Ud=0,T6=0,Po=0,Hf=0,F0=null,go=null,Z_=!1,Fw=0,uL=0,ub=1/0,db=null,Eu=null,Br=0,Mu=null,Uf=null,mc=0,ek=0,tk=null,dL=null,q0=0,nk=null;function Uo(){return us&2&&Vn!==0?Vn&-Vn:dn.T!==null?A6():vj()}function hL(){if(Po===0)if(!(Vn&536870912)||Qn){var e=Yg;Yg<<=1,!(Yg&3932160)&&(Yg=262144),Po=e}else Po=536870912;return e=Ko.current,e!==null&&(e.flags|=32),Po}function xo(e,t,n){(e===Ls&&(xs===2||xs===9)||e.cancelPendingCommit!==null)&&(Vf(e,0),pu(e,Vn,Po,!1)),ng(e,n),(!(us&2)||e!==Ls)&&(e===Ls&&(!(us&2)&&(Ud|=n),cr===4&&pu(e,Vn,Po,!1)),jl(e))}function fL(e,t,n){if(us&6)throw Error(je(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||tg(e,t),r=s?QV(e,t):X2(e,t,!0),i=s;do{if(r===0){gm&&!s&&pu(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!KV(n)){r=X2(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=F0;var l=a.current.memoizedState.isDehydrated;if(l&&(Vf(a,o).flags|=256),o=X2(a,o,!1),o!==2){if(S6&&!l){a.errorRecoveryDisabledLanes|=i,Ud|=i,r=4;break e}i=go,go=r,i!==null&&(go===null?go=i:go.push.apply(go,i))}r=o}if(i=!1,r!==2)continue}}if(r===1){Vf(e,0),pu(e,t,0,!0);break}e:{switch(s=e,i=r,i){case 0:case 1:throw Error(je(345));case 4:if((t&4194048)!==t)break;case 6:pu(s,t,Po,!mu);break e;case 2:go=null;break;case 3:case 5:break;default:throw Error(je(329))}if((t&62914560)===t&&(r=Fw+300-Fo(),10<r)){if(pu(s,t,Po,!mu),Nw(s,0,!0)!==0)break e;mc=t,s.timeoutHandle=RL(HT.bind(null,s,n,go,db,Z_,t,Po,Ud,Hf,mu,i,"Throttled",-0,0),r);break e}HT(s,n,go,db,Z_,t,Po,Ud,Hf,mu,i,null,-0,0)}}break}while(!0);jl(e)}function HT(e,t,n,s,r,i,o,a,l,c,d,h,f,m){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:ac},oL(t,i,h);var g=(i&62914560)===i?Fw-Fo():(i&4194048)===i?uL-Fo():0;if(g=jW(h,g),g!==null){mc=i,e.cancelPendingCommit=g(VT.bind(null,e,t,i,n,s,r,o,a,l,d,h,null,f,m)),pu(e,i,o,!c);return}}VT(e,t,i,n,s,r,o,a,l)}function KV(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(!Go(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 pu(e,t,n,s){t&=~T6,t&=~Ud,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var i=31-Ho(r),o=1<<i;s[i]=-1,r&=~o}n!==0&&yj(e,n,t)}function qw(){return us&6?!0:(lg(0),!1)}function C6(){if(zn!==null){if(xs===0)var e=zn.return;else e=zn,lc=bh=null,d6(e),Sf=null,gp=0,e=zn;for(;e!==null;)WR(e.alternate,e),e=e.return;zn=null}}function Vf(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,mW(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),mc=0,C6(),Ls=e,zn=n=hc(e.current,null),Vn=t,xs=0,Ro=null,mu=!1,gm=tg(e,t),S6=!1,Hf=Po=T6=Ud=Fu=cr=0,go=F0=null,Z_=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-Ho(s),i=1<<r;t|=e[r],s&=~i}return kc=t,Lw(),n}function mL(e,t){En=null,dn.H=bp,t===pm||t===Ow?(t=xT(),xs=3):t===r6?(t=xT(),xs=4):xs=t===v6?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ro=t,zn===null&&(cr=1,ab(e,da(t,e.current)))}function pL(){var e=Ko.current;return e===null?!0:(Vn&4194048)===Vn?ya===null:(Vn&62914560)===Vn||Vn&536870912?e===ya:!1}function gL(){var e=dn.H;return dn.H=bp,e===null?bp:e}function yL(){var e=dn.A;return dn.A=WV,e}function hb(){cr=4,mu||(Vn&4194048)!==Vn&&Ko.current!==null||(gm=!0),!(Fu&134217727)&&!(Ud&134217727)||Ls===null||pu(Ls,Vn,Po,!1)}function X2(e,t,n){var s=us;us|=2;var r=gL(),i=yL();(Ls!==e||Vn!==t)&&(db=null,Vf(e,t)),t=!1;var o=cr;e:do try{if(xs!==0&&zn!==null){var a=zn,l=Ro;switch(xs){case 8:C6(),o=6;break e;case 3:case 2:case 9:case 6:Ko.current===null&&(t=!0);var c=xs;if(xs=0,Ro=null,hf(e,a,l,c),n&&gm){o=0;break e}break;default:c=xs,xs=0,Ro=null,hf(e,a,l,c)}}YV(),o=cr;break}catch(d){mL(e,d)}while(!0);return t&&e.shellSuspendCounter++,lc=bh=null,us=s,dn.H=r,dn.A=i,zn===null&&(Ls=null,Vn=0,Lw()),o}function YV(){for(;zn!==null;)bL(zn)}function QV(e,t){var n=us;us|=2;var s=gL(),r=yL();Ls!==e||Vn!==t?(db=null,ub=Fo()+500,Vf(e,t)):gm=tg(e,t);e:do try{if(xs!==0&&zn!==null){t=zn;var i=Ro;t:switch(xs){case 1:xs=0,Ro=null,hf(e,t,i,1);break;case 2:case 9:if(vT(i)){xs=0,Ro=null,UT(t);break}t=function(){xs!==2&&xs!==9||Ls!==e||(xs=7),jl(e)},i.then(t,t);break e;case 3:xs=7;break e;case 4:xs=5;break e;case 7:vT(i)?(xs=0,Ro=null,UT(t)):(xs=0,Ro=null,hf(e,t,i,7));break;case 5:var o=null;switch(zn.tag){case 26:o=zn.memoizedState;case 5:case 27:var a=zn;if(o?PL(o):a.stateNode.complete){xs=0,Ro=null;var l=a.sibling;if(l!==null)zn=l;else{var c=a.return;c!==null?(zn=c,Hw(c)):zn=null}break t}}xs=0,Ro=null,hf(e,t,i,5);break;case 6:xs=0,Ro=null,hf(e,t,i,6);break;case 8:C6(),cr=6;break e;default:throw Error(je(462))}}XV();break}catch(d){mL(e,d)}while(!0);return lc=bh=null,dn.H=s,dn.A=r,us=n,zn!==null?0:(Ls=null,Vn=0,Lw(),cr)}function XV(){for(;zn!==null&&!vU();)bL(zn)}function bL(e){var t=VR(e.alternate,e,kc);e.memoizedProps=e.pendingProps,t===null?Hw(e):zn=t}function UT(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=BT(n,t,t.pendingProps,t.type,void 0,Vn);break;case 11:t=BT(n,t,t.pendingProps,t.type.render,t.ref,Vn);break;case 5:d6(t);default:WR(n,t),t=zn=Wj(t,kc),t=VR(n,t,kc)}e.memoizedProps=e.pendingProps,t===null?Hw(e):zn=t}function hf(e,t,n,s){lc=bh=null,d6(t),Sf=null,gp=0;var r=t.return;try{if($V(e,r,t,n,Vn)){cr=1,ab(e,da(n,e.current)),zn=null;return}}catch(i){if(r!==null)throw zn=r,i;cr=1,ab(e,da(n,e.current)),zn=null;return}t.flags&32768?(Qn||s===1?e=!0:gm||Vn&536870912?e=!1:(mu=e=!0,(s===2||s===9||s===3||s===6)&&(s=Ko.current,s!==null&&s.tag===13&&(s.flags|=16384))),wL(t,e)):Hw(t)}function Hw(e){var t=e;do{if(t.flags&32768){wL(t,mu);return}e=t.return;var n=qV(t.alternate,t,kc);if(n!==null){zn=n;return}if(t=t.sibling,t!==null){zn=t;return}zn=t=e}while(t!==null);cr===0&&(cr=5)}function wL(e,t){do{var n=HV(e.alternate,e);if(n!==null){n.flags&=32767,zn=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){zn=e;return}zn=e=n}while(e!==null);cr=6,zn=null}function VT(e,t,n,s,r,i,o,a,l){e.cancelPendingCommit=null;do Uw();while(Br!==0);if(us&6)throw Error(je(327));if(t!==null){if(t===e.current)throw Error(je(177));if(i=t.lanes|t.childLanes,i|=XS,NU(e,n,i,o,a,l),e===Ls&&(zn=Ls=null,Vn=0),Uf=t,Mu=e,mc=n,ek=i,tk=r,dL=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,tW(Qy,function(){return SL(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=dn.T,dn.T=null,r=hs.p,hs.p=2,o=us,us|=4;try{UV(e,t,n)}finally{us=o,hs.p=r,dn.T=s}}Br=1,vL(),xL(),_L()}}function vL(){if(Br===1){Br=0;var e=Mu,t=Uf,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=dn.T,dn.T=null;var s=hs.p;hs.p=2;var r=us;us|=4;try{sL(t,e);var i=ok,o=Pj(e.containerInfo),a=i.focusedElem,l=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&Bj(a.ownerDocument.documentElement,a)){if(l!==null&&QS(a)){var c=l.start,d=l.end;if(d===void 0&&(d=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(d,a.value.length);else{var h=a.ownerDocument||document,f=h&&h.defaultView||window;if(f.getSelection){var m=f.getSelection(),g=a.textContent.length,y=Math.min(l.start,g),b=l.end===void 0?y:Math.min(l.end,g);!m.extend&&y>b&&(o=b,b=y,y=o);var w=fT(a,y),v=fT(a,b);if(w&&v&&(m.rangeCount!==1||m.anchorNode!==w.node||m.anchorOffset!==w.offset||m.focusNode!==v.node||m.focusOffset!==v.offset)){var x=h.createRange();x.setStart(w.node,w.offset),m.removeAllRanges(),y>b?(m.addRange(x),m.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),m.addRange(x))}}}}for(h=[],m=a;m=m.parentNode;)m.nodeType===1&&h.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<h.length;a++){var C=h[a];C.element.scrollLeft=C.left,C.element.scrollTop=C.top}}vb=!!ik,ok=ik=null}finally{us=r,hs.p=s,dn.T=n}}e.current=t,Br=2}}function xL(){if(Br===2){Br=0;var e=Mu,t=Uf,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=dn.T,dn.T=null;var s=hs.p;hs.p=2;var r=us;us|=4;try{JR(e,t.alternate,t)}finally{us=r,hs.p=s,dn.T=n}}Br=3}}function _L(){if(Br===4||Br===3){Br=0,xU();var e=Mu,t=Uf,n=mc,s=dL;t.subtreeFlags&10256||t.flags&10256?Br=5:(Br=0,Uf=Mu=null,kL(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Eu=null),HS(n),t=t.stateNode,qo&&typeof qo.onCommitFiberRoot=="function")try{qo.onCommitFiberRoot(eg,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=dn.T,r=hs.p,hs.p=2,dn.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{dn.T=t,hs.p=r}}mc&3&&Uw(),jl(e),r=e.pendingLanes,n&261930&&r&42?e===nk?q0++:(q0=0,nk=e):q0=0,lg(0)}}function kL(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ig(t)))}function Uw(){return vL(),xL(),_L(),SL()}function SL(){if(Br!==5)return!1;var e=Mu,t=ek;ek=0;var n=HS(mc),s=dn.T,r=hs.p;try{hs.p=32>n?32:n,dn.T=null,n=tk,tk=null;var i=Mu,o=mc;if(Br=0,Uf=Mu=null,mc=0,us&6)throw Error(je(331));var a=us;if(us|=4,lL(i.current),iL(i,i.current,o,n),us=a,lg(0,!1),qo&&typeof qo.onPostCommitFiberRoot=="function")try{qo.onPostCommitFiberRoot(eg,i)}catch{}return!0}finally{hs.p=r,dn.T=s,kL(e,t)}}function WT(e,t,n){t=da(n,t),t=Y_(e.stateNode,t,2),e=Au(e,t,2),e!==null&&(ng(e,2),jl(e))}function ks(e,t,n){if(e.tag===3)WT(e,e,n);else for(;t!==null;){if(t.tag===3){WT(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Eu===null||!Eu.has(s))){e=da(n,e),n=$R(2),s=Au(t,n,2),s!==null&&(zR(n,s,t,e),ng(s,2),jl(s));break}}t=t.return}}function J2(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new GV;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)||(S6=!0,r.add(n),e=JV.bind(null,e,t,n),t.then(e,e))}function JV(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ls===e&&(Vn&n)===n&&(cr===4||cr===3&&(Vn&62914560)===Vn&&300>Fo()-Fw?!(us&2)&&Vf(e,0):T6|=n,Hf===Vn&&(Hf=0)),jl(e)}function TL(e,t){t===0&&(t=gj()),e=yh(e,t),e!==null&&(ng(e,t),jl(e))}function ZV(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),TL(e,n)}function eW(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(je(314))}s!==null&&s.delete(t),TL(e,n)}function tW(e,t){return FS(e,t)}var fb=null,Kh=null,sk=!1,mb=!1,Z2=!1,gu=0;function jl(e){e!==Kh&&e.next===null&&(Kh===null?fb=Kh=e:Kh=Kh.next=e),mb=!0,sk||(sk=!0,sW())}function lg(e,t){if(!Z2&&mb){Z2=!0;do for(var n=!1,s=fb;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-Ho(42|e)+1)-1,i&=r&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,GT(s,i))}else i=Vn,i=Nw(s,s===Ls?i:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(i&3)||tg(s,i)||(n=!0,GT(s,i));s=s.next}while(n);Z2=!1}}function nW(){CL()}function CL(){mb=sk=!1;var e=0;gu!==0&&fW()&&(e=gu);for(var t=Fo(),n=null,s=fb;s!==null;){var r=s.next,i=AL(s,t);i===0?(s.next=null,n===null?fb=r:n.next=r,r===null&&(Kh=n)):(n=s,(e!==0||i&3)&&(mb=!0)),s=r}Br!==0&&Br!==5||lg(e),gu!==0&&(gu=0)}function AL(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Ho(i),a=1<<o,l=r[o];l===-1?(!(a&n)||a&s)&&(r[o]=MU(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}if(t=Ls,n=Vn,n=Nw(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(xs===2||xs===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&A2(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||tg(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&A2(s),HS(n)){case 2:case 8:n=mj;break;case 32:n=Qy;break;case 268435456:n=pj;break;default:n=Qy}return s=EL.bind(null,e),n=FS(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&A2(s),e.callbackPriority=2,e.callbackNode=null,2}function EL(e,t){if(Br!==0&&Br!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uw()&&e.callbackNode!==n)return null;var s=Vn;return s=Nw(e,e===Ls?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(fL(e,s,t),AL(e,Fo()),e.callbackNode!=null&&e.callbackNode===n?EL.bind(null,e):null)}function GT(e,t){if(Uw())return null;fL(e,t,!0)}function sW(){pW(function(){us&6?FS(fj,nW):CL()})}function A6(){if(gu===0){var e=zf;e===0&&(e=Kg,Kg<<=1,!(Kg&261888)&&(Kg=256)),gu=e}return gu}function KT(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:dy(""+e)}function YT(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 rW(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var i=KT((r[_o]||null).action),o=s.submitter;o&&(t=(t=o[_o]||null)?KT(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new Iw("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(gu!==0){var l=o?YT(r,o):new FormData(r);G_(n,{pending:!0,data:l,method:r.method,action:i},null,l)}}else typeof i=="function"&&(a.preventDefault(),l=o?YT(r,o):new FormData(r),G_(n,{pending:!0,data:l,method:r.method,action:i},i,l))},currentTarget:r}]})}}for(var ex=0;ex<D_.length;ex++){var tx=D_[ex],iW=tx.toLowerCase(),oW=tx[0].toUpperCase()+tx.slice(1);Ua(iW,"on"+oW)}Ua(zj,"onAnimationEnd");Ua(Fj,"onAnimationIteration");Ua(qj,"onAnimationStart");Ua("dblclick","onDoubleClick");Ua("focusin","onFocus");Ua("focusout","onBlur");Ua(_V,"onTransitionRun");Ua(kV,"onTransitionStart");Ua(SV,"onTransitionCancel");Ua(Hj,"onTransitionEnd");Pf("onMouseEnter",["mouseout","mouseover"]);Pf("onMouseLeave",["mouseout","mouseover"]);Pf("onPointerEnter",["pointerout","pointerover"]);Pf("onPointerLeave",["pointerout","pointerover"]);mh("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));mh("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));mh("onBeforeInput",["compositionend","keypress","textInput","paste"]);mh("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));mh("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));mh("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wp="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(" "),aW=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wp));function ML(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],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=c;try{i(r)}catch(d){Jy(d)}r.currentTarget=null,i=l}else for(o=0;o<s.length;o++){if(a=s[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=c;try{i(r)}catch(d){Jy(d)}r.currentTarget=null,i=l}}}}function $n(e,t){var n=t[A_];n===void 0&&(n=t[A_]=new Set);var s=e+"__bubble";n.has(s)||(NL(t,e,2,!1),n.add(s))}function nx(e,t,n){var s=0;t&&(s|=4),NL(n,e,s,t)}var r1="_reactListening"+Math.random().toString(36).slice(2);function E6(e){if(!e[r1]){e[r1]=!0,xj.forEach(function(n){n!=="selectionchange"&&(aW.has(n)||nx(n,!1,e),nx(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[r1]||(t[r1]=!0,nx("selectionchange",!1,t))}}function NL(e,t,n,s){switch(HL(t)){case 2:var r=DW;break;case 8:r=OW;break;default:r=j6}n=r.bind(null,t,n,e),r=void 0,!j_||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 sx(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 l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===r)return;o=o.return}for(;a!==null;){if(o=nf(a),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){s=i=o;continue e}a=a.parentNode}}s=s.return}Mj(function(){var c=i,d=WS(n),h=[];e:{var f=Uj.get(e);if(f!==void 0){var m=Iw,g=e;switch(e){case"keypress":if(fy(n)===0)break e;case"keydown":case"keyup":m=eV;break;case"focusin":g="focus",m=j2;break;case"focusout":g="blur",m=j2;break;case"beforeblur":case"afterblur":m=j2;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":m=sT;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=qU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=sV;break;case zj:case Fj:case qj:m=VU;break;case Hj:m=iV;break;case"scroll":case"scrollend":m=zU;break;case"wheel":m=aV;break;case"copy":case"cut":case"paste":m=GU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=iT;break;case"toggle":case"beforetoggle":m=cV}var y=(t&4)!==0,b=!y&&(e==="scroll"||e==="scrollend"),w=y?f!==null?f+"Capture":null:f;y=[];for(var v=c,x;v!==null;){var C=v;if(x=C.stateNode,C=C.tag,C!==5&&C!==26&&C!==27||x===null||w===null||(C=dp(v,w),C!=null&&y.push(vp(v,C,x))),b)break;v=v.return}0<y.length&&(f=new m(f,g,null,n,d),h.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==I_&&(g=n.relatedTarget||n.fromElement)&&(nf(g)||g[hm]))break e;if((m||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,m?(g=n.relatedTarget||n.toElement,m=c,g=g?nf(g):null,g!==null&&(b=Zp(g),y=g.tag,g!==b||y!==5&&y!==27&&y!==6)&&(g=null)):(m=null,g=c),m!==g)){if(y=sT,C="onMouseLeave",w="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(y=iT,C="onPointerLeave",w="onPointerEnter",v="pointer"),b=m==null?f:f0(m),x=g==null?f:f0(g),f=new y(C,v+"leave",m,n,d),f.target=b,f.relatedTarget=x,C=null,nf(d)===c&&(y=new y(w,v+"enter",g,n,d),y.target=x,y.relatedTarget=b,C=y),b=C,m&&g)t:{for(y=lW,w=m,v=g,x=0,C=w;C;C=y(C))x++;C=0;for(var A=v;A;A=y(A))C++;for(;0<x-C;)w=y(w),x--;for(;0<C-x;)v=y(v),C--;for(;x--;){if(w===v||v!==null&&w===v.alternate){y=w;break t}w=y(w),v=y(v)}y=null}else y=null;m!==null&&QT(h,f,m,y,!1),g!==null&&b!==null&&QT(h,b,g,y,!0)}}e:{if(f=c?f0(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var T=cT;else if(lT(f))if(Dj)T=wV;else{T=yV;var _=gV}else m=f.nodeName,!m||m.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&VS(c.elementType)&&(T=cT):T=bV;if(T&&(T=T(e,c))){Lj(h,T,n,d);break e}_&&_(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&N_(f,"number",f.value)}switch(_=c?f0(c):window,e){case"focusin":(lT(_)||_.contentEditable==="true")&&(of=_,R_=c,R0=null);break;case"focusout":R0=R_=of=null;break;case"mousedown":L_=!0;break;case"contextmenu":case"mouseup":case"dragend":L_=!1,mT(h,n,d);break;case"selectionchange":if(xV)break;case"keydown":case"keyup":mT(h,n,d)}var R;if(YS)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else rf?jj(e,n)&&(I="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(Ij&&n.locale!=="ko"&&(rf||I!=="onCompositionStart"?I==="onCompositionEnd"&&rf&&(R=Nj()):(fu=d,GS="value"in fu?fu.value:fu.textContent,rf=!0)),_=pb(c,I),0<_.length&&(I=new rT(I,e,null,n,d),h.push({event:I,listeners:_}),R?I.data=R:(R=Rj(n),R!==null&&(I.data=R)))),(R=dV?hV(e,n):fV(e,n))&&(I=pb(c,"onBeforeInput"),0<I.length&&(_=new rT("onBeforeInput","beforeinput",null,n,d),h.push({event:_,listeners:I}),_.data=R)),rW(h,e,c,n,d)}ML(h,t)})}function vp(e,t,n){return{instance:e,listener:t,currentTarget:n}}function pb(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=dp(e,n),r!=null&&s.unshift(vp(e,r,i)),r=dp(e,t),r!=null&&s.push(vp(e,r,i))),e.tag===3)return s;e=e.return}return[]}function lW(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function QT(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var a=n,l=a.alternate,c=a.stateNode;if(a=a.tag,l!==null&&l===s)break;a!==5&&a!==26&&a!==27||c===null||(l=c,r?(c=dp(n,i),c!=null&&o.unshift(vp(n,c,l))):r||(c=dp(n,i),c!=null&&o.push(vp(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var cW=/\r\n?/g,uW=/\u0000|\uFFFD/g;function XT(e){return(typeof e=="string"?e:""+e).replace(cW,`
`).replace(uW,"")}function IL(e,t){return t=XT(t),XT(e)===t}function Ts(e,t,n,s,r,i){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||$f(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&$f(e,""+s);break;case"className":Xg(e,"class",s);break;case"tabIndex":Xg(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Xg(e,n,s);break;case"style":Ej(e,s,i);break;case"data":if(t!=="object"){Xg(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=dy(""+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"&&Ts(e,t,"name",r.name,r,null),Ts(e,t,"formEncType",r.formEncType,r,null),Ts(e,t,"formMethod",r.formMethod,r,null),Ts(e,t,"formTarget",r.formTarget,r,null)):(Ts(e,t,"encType",r.encType,r,null),Ts(e,t,"method",r.method,r,null),Ts(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=dy(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=ac);break;case"onScroll":s!=null&&$n("scroll",e);break;case"onScrollEnd":s!=null&&$n("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(je(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(je(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=dy(""+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":$n("beforetoggle",e),$n("toggle",e),uy(e,"popover",s);break;case"xlinkActuate":Wl(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Wl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Wl(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Wl(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Wl(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Wl(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Wl(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Wl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Wl(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":uy(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=PU.get(n)||n,uy(e,n,s))}}function rk(e,t,n,s,r,i){switch(n){case"style":Ej(e,s,i);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(je(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(je(60));e.innerHTML=n}}break;case"children":typeof s=="string"?$f(e,s):(typeof s=="number"||typeof s=="bigint")&&$f(e,""+s);break;case"onScroll":s!=null&&$n("scroll",e);break;case"onScrollEnd":s!=null&&$n("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ac);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_j.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[_o]||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,""):uy(e,n,s)}}}function yi(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$n("error",e),$n("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(je(137,t));default:Ts(e,t,i,o,n,null)}}r&&Ts(e,t,"srcSet",n.srcSet,n,null),s&&Ts(e,t,"src",n.src,n,null);return;case"input":$n("invalid",e);var a=i=o=r=null,l=null,c=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":l=d;break;case"defaultChecked":c=d;break;case"value":i=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(je(137,t));break;default:Ts(e,t,s,d,n,null)}}Tj(e,i,a,l,c,o,r,!1);return;case"select":$n("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:Ts(e,t,r,a,n,null)}t=i,n=o,e.multiple=!!s,t!=null?xf(e,!!s,t,!1):n!=null&&xf(e,!!s,n,!0);return;case"textarea":$n("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(je(91));break;default:Ts(e,t,o,a,n,null)}Aj(e,s,r,i);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(s=n[l],s!=null))switch(l){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Ts(e,t,l,s,n,null)}return;case"dialog":$n("beforetoggle",e),$n("toggle",e),$n("cancel",e),$n("close",e);break;case"iframe":case"object":$n("load",e);break;case"video":case"audio":for(s=0;s<wp.length;s++)$n(wp[s],e);break;case"image":$n("error",e),$n("load",e);break;case"details":$n("toggle",e);break;case"embed":case"source":case"link":$n("error",e),$n("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(c in n)if(n.hasOwnProperty(c)&&(s=n[c],s!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(je(137,t));default:Ts(e,t,c,s,n,null)}return;default:if(VS(t)){for(d in n)n.hasOwnProperty(d)&&(s=n[d],s!==void 0&&rk(e,t,d,s,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(s=n[a],s!=null&&Ts(e,t,a,s,n,null))}function dW(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,l=null,c=null,d=null;for(m in n){var h=n[m];if(n.hasOwnProperty(m)&&h!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":l=h;default:s.hasOwnProperty(m)||Ts(e,t,m,null,s,h)}}for(var f in s){var m=s[f];if(h=n[f],s.hasOwnProperty(f)&&(m!=null||h!=null))switch(f){case"type":i=m;break;case"name":r=m;break;case"checked":c=m;break;case"defaultChecked":d=m;break;case"value":o=m;break;case"defaultValue":a=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(je(137,t));break;default:m!==h&&Ts(e,t,f,m,s,h)}}M_(e,o,a,l,c,d,i,r);return;case"select":m=o=a=f=null;for(i in n)if(l=n[i],n.hasOwnProperty(i)&&l!=null)switch(i){case"value":break;case"multiple":m=l;default:s.hasOwnProperty(i)||Ts(e,t,i,null,s,l)}for(r in s)if(i=s[r],l=n[r],s.hasOwnProperty(r)&&(i!=null||l!=null))switch(r){case"value":f=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==l&&Ts(e,t,r,i,s,l)}t=a,n=o,s=m,f!=null?xf(e,!!n,f,!1):!!s!=!!n&&(t!=null?xf(e,!!n,t,!0):xf(e,!!n,n?[]:"",!1));return;case"textarea":m=f=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:Ts(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":f=r;break;case"defaultValue":m=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(je(91));break;default:r!==i&&Ts(e,t,o,r,s,i)}Cj(e,f,m);return;case"option":for(var g in n)if(f=n[g],n.hasOwnProperty(g)&&f!=null&&!s.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:Ts(e,t,g,null,s,f)}for(l in s)if(f=s[l],m=n[l],s.hasOwnProperty(l)&&f!==m&&(f!=null||m!=null))switch(l){case"selected":e.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Ts(e,t,l,f,s,m)}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 y in n)f=n[y],n.hasOwnProperty(y)&&f!=null&&!s.hasOwnProperty(y)&&Ts(e,t,y,null,s,f);for(c in s)if(f=s[c],m=n[c],s.hasOwnProperty(c)&&f!==m&&(f!=null||m!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(je(137,t));break;default:Ts(e,t,c,f,s,m)}return;default:if(VS(t)){for(var b in n)f=n[b],n.hasOwnProperty(b)&&f!==void 0&&!s.hasOwnProperty(b)&&rk(e,t,b,void 0,s,f);for(d in s)f=s[d],m=n[d],!s.hasOwnProperty(d)||f===m||f===void 0&&m===void 0||rk(e,t,d,f,s,m);return}}for(var w in n)f=n[w],n.hasOwnProperty(w)&&f!=null&&!s.hasOwnProperty(w)&&Ts(e,t,w,null,s,f);for(h in s)f=s[h],m=n[h],!s.hasOwnProperty(h)||f===m||f==null&&m==null||Ts(e,t,h,f,s,m)}function JT(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function hW(){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&&JT(o)){for(o=0,a=r.responseEnd,s+=1;s<n.length;s++){var l=n[s],c=l.startTime;if(c>a)break;var d=l.transferSize,h=l.initiatorType;d&&JT(h)&&(l=l.responseEnd,o+=d*(l<a?1:(a-c)/(l-c)))}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 ik=null,ok=null;function gb(e){return e.nodeType===9?e:e.ownerDocument}function ZT(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 jL(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 ak(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 rx=null;function fW(){var e=window.event;return e&&e.type==="popstate"?e===rx?!1:(rx=e,!0):(rx=null,!1)}var RL=typeof setTimeout=="function"?setTimeout:void 0,mW=typeof clearTimeout=="function"?clearTimeout:void 0,eC=typeof Promise=="function"?Promise:void 0,pW=typeof queueMicrotask=="function"?queueMicrotask:typeof eC<"u"?function(e){return eC.resolve(null).then(e).catch(gW)}:RL;function gW(e){setTimeout(function(){throw e})}function ed(e){return e==="head"}function tC(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),Gf(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")H0(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,H0(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[sg]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&H0(e.ownerDocument.body);n=r}while(n);Gf(t)}function nC(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 lk(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":lk(n),US(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function yW(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[sg])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=ba(e.nextSibling),e===null)break}return null}function bW(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ba(e.nextSibling),e===null))return null;return e}function LL(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ba(e.nextSibling),e===null))return null;return e}function ck(e){return e.data==="$?"||e.data==="$~"}function uk(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function wW(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 ba(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 dk=null;function sC(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ba(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function rC(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 DL(e,t,n){switch(t=gb(n),e){case"html":if(e=t.documentElement,!e)throw Error(je(452));return e;case"head":if(e=t.head,!e)throw Error(je(453));return e;case"body":if(e=t.body,!e)throw Error(je(454));return e;default:throw Error(je(451))}}function H0(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);US(e)}var va=new Map,iC=new Set;function yb(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Mc=hs.d;hs.d={f:vW,r:xW,D:_W,C:kW,L:SW,m:TW,X:AW,S:CW,M:EW};function vW(){var e=Mc.f(),t=qw();return e||t}function xW(e){var t=fm(e);t!==null&&t.tag===5&&t.type==="form"?ER(t):Mc.r(e)}var ym=typeof document>"u"?null:document;function OL(e,t,n){var s=ym;if(s&&typeof t=="string"&&t){var r=ua(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),iC.has(r)||(iC.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),yi(t,"link",e),Zr(t),s.head.appendChild(t)))}}function _W(e){Mc.D(e),OL("dns-prefetch",e,null)}function kW(e,t){Mc.C(e,t),OL("preconnect",e,t)}function SW(e,t,n){Mc.L(e,t,n);var s=ym;if(s&&e&&t){var r='link[rel="preload"][as="'+ua(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+ua(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+ua(n.imageSizes)+'"]')):r+='[href="'+ua(e)+'"]';var i=r;switch(t){case"style":i=Wf(e);break;case"script":i=bm(e)}va.has(i)||(e=Gs({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),va.set(i,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(cg(i))||t==="script"&&s.querySelector(ug(i))||(t=s.createElement("link"),yi(t,"link",e),Zr(t),s.head.appendChild(t)))}}function TW(e,t){Mc.m(e,t);var n=ym;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+ua(s)+'"][href="'+ua(e)+'"]',i=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=bm(e)}if(!va.has(i)&&(e=Gs({rel:"modulepreload",href:e},t),va.set(i,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ug(i)))return}s=n.createElement("link"),yi(s,"link",e),Zr(s),n.head.appendChild(s)}}}function CW(e,t,n){Mc.S(e,t,n);var s=ym;if(s&&e){var r=vf(s).hoistableStyles,i=Wf(e);t=t||"default";var o=r.get(i);if(!o){var a={loading:0,preload:null};if(o=s.querySelector(cg(i)))a.loading=5;else{e=Gs({rel:"stylesheet",href:e,"data-precedence":t},n),(n=va.get(i))&&M6(e,n);var l=o=s.createElement("link");Zr(l),yi(l,"link",e),l._p=new Promise(function(c,d){l.onload=c,l.onerror=d}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,xy(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:a},r.set(i,o)}}}function AW(e,t){Mc.X(e,t);var n=ym;if(n&&e){var s=vf(n).hoistableScripts,r=bm(e),i=s.get(r);i||(i=n.querySelector(ug(r)),i||(e=Gs({src:e,async:!0},t),(t=va.get(r))&&N6(e,t),i=n.createElement("script"),Zr(i),yi(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function EW(e,t){Mc.M(e,t);var n=ym;if(n&&e){var s=vf(n).hoistableScripts,r=bm(e),i=s.get(r);i||(i=n.querySelector(ug(r)),i||(e=Gs({src:e,async:!0,type:"module"},t),(t=va.get(r))&&N6(e,t),i=n.createElement("script"),Zr(i),yi(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function oC(e,t,n,s){var r=(r=Su.current)?yb(r):null;if(!r)throw Error(je(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Wf(n.href),n=vf(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=Wf(n.href);var i=vf(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(cg(e)))&&!i._p&&(o.instance=i,o.state.loading=5),va.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},va.set(e,n),i||MW(r,e,n,o.state))),t&&s===null)throw Error(je(528,""));return o}if(t&&s!==null)throw Error(je(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=bm(n),n=vf(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(je(444,e))}}function Wf(e){return'href="'+ua(e)+'"'}function cg(e){return'link[rel="stylesheet"]['+e+"]"}function BL(e){return Gs({},e,{"data-precedence":e.precedence,precedence:null})}function MW(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}),yi(t,"link",n),Zr(t),e.head.appendChild(t))}function bm(e){return'[src="'+ua(e)+'"]'}function ug(e){return"script[async]"+e}function aC(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+ua(n.href)+'"]');if(s)return t.instance=s,Zr(s),s;var r=Gs({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Zr(s),yi(s,"style",r),xy(s,n.precedence,e),t.instance=s;case"stylesheet":r=Wf(n.href);var i=e.querySelector(cg(r));if(i)return t.state.loading|=4,t.instance=i,Zr(i),i;s=BL(n),(r=va.get(r))&&M6(s,r),i=(e.ownerDocument||e).createElement("link"),Zr(i);var o=i;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),yi(i,"link",s),t.state.loading|=4,xy(i,n.precedence,e),t.instance=i;case"script":return i=bm(n.src),(r=e.querySelector(ug(i)))?(t.instance=r,Zr(r),r):(s=n,(r=va.get(i))&&(s=Gs({},n),N6(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),Zr(r),yi(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(je(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,xy(s,n.precedence,e));return t.instance}function xy(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 M6(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function N6(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var _y=null;function lC(e,t,n){if(_y===null){var s=new Map,r=_y=new Map;r.set(n,s)}else r=_y,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[sg]||i[fi]||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 cC(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function NW(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 PL(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function IW(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=Wf(s.href),i=t.querySelector(cg(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=bb.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Zr(i);return}i=t.ownerDocument||t,s=BL(s),(r=va.get(r))&&M6(s,r),i=i.createElement("link"),Zr(i);var o=i;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),yi(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=bb.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var ix=0;function jW(e,t){return e.stylesheets&&e.count===0&&ky(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&ky(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&ix===0&&(ix=62500*hW());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ky(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>ix?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function bb(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ky(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wb=null;function ky(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wb=new Map,t.forEach(RW,e),wb=null,bb.call(e))}function RW(e,t){if(!(t.state.loading&4)){var n=wb.get(e);if(n)var s=n.get(null);else{n=new Map,wb.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=bb.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 xp={$$typeof:oc,Provider:null,Consumer:null,_currentValue:zd,_currentValue2:zd,_threadCount:0};function LW(e,t,n,s,r,i,o,a,l){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=E2(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=E2(0),this.hiddenUpdates=E2(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function $L(e,t,n,s,r,i,o,a,l,c,d,h){return e=new LW(e,t,n,o,l,c,d,h,a),t=1,i===!0&&(t|=24),i=Oo(3,null,null,t),e.current=i,i.stateNode=e,t=n6(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:s,isDehydrated:n,cache:t},i6(i),e}function zL(e){return e?(e=cf,e):cf}function FL(e,t,n,s,r,i){r=zL(r),s.context===null?s.context=r:s.pendingContext=r,s=Cu(t),s.payload={element:n},i=i===void 0?null:i,i!==null&&(s.callback=i),n=Au(e,s,t),n!==null&&(xo(n,e,t),D0(n,e,t))}function uC(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function I6(e,t){uC(e,t),(e=e.alternate)&&uC(e,t)}function qL(e){if(e.tag===13||e.tag===31){var t=yh(e,67108864);t!==null&&xo(t,e,67108864),I6(e,67108864)}}function dC(e){if(e.tag===13||e.tag===31){var t=Uo();t=qS(t);var n=yh(e,t);n!==null&&xo(n,e,t),I6(e,t)}}var vb=!0;function DW(e,t,n,s){var r=dn.T;dn.T=null;var i=hs.p;try{hs.p=2,j6(e,t,n,s)}finally{hs.p=i,dn.T=r}}function OW(e,t,n,s){var r=dn.T;dn.T=null;var i=hs.p;try{hs.p=8,j6(e,t,n,s)}finally{hs.p=i,dn.T=r}}function j6(e,t,n,s){if(vb){var r=hk(s);if(r===null)sx(e,t,s,xb,n),hC(e,s);else if(PW(r,e,t,n,s))s.stopPropagation();else if(hC(e,s),t&4&&-1<BW.indexOf(e)){for(;r!==null;){var i=fm(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=kd(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-Ho(o);a.entanglements[1]|=l,o&=~l}jl(i),!(us&6)&&(ub=Fo()+500,lg(0))}}break;case 31:case 13:a=yh(i,2),a!==null&&xo(a,i,2),qw(),I6(i,2)}if(i=hk(s),i===null&&sx(e,t,s,xb,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else sx(e,t,s,null,n)}}function hk(e){return e=WS(e),R6(e)}var xb=null;function R6(e){if(xb=null,e=nf(e),e!==null){var t=Zp(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=lj(t),e!==null)return e;e=null}else if(n===31){if(e=cj(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 xb=e,null}function HL(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(_U()){case fj:return 2;case mj:return 8;case Qy:case kU:return 32;case pj:return 268435456;default:return 32}default:return 32}}var fk=!1,Nu=null,Iu=null,ju=null,_p=new Map,kp=new Map,lu=[],BW="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 hC(e,t){switch(e){case"focusin":case"focusout":Nu=null;break;case"dragenter":case"dragleave":Iu=null;break;case"mouseover":case"mouseout":ju=null;break;case"pointerover":case"pointerout":_p.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":kp.delete(t.pointerId)}}function Wm(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=fm(t),t!==null&&qL(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function PW(e,t,n,s,r){switch(t){case"focusin":return Nu=Wm(Nu,e,t,n,s,r),!0;case"dragenter":return Iu=Wm(Iu,e,t,n,s,r),!0;case"mouseover":return ju=Wm(ju,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return _p.set(i,Wm(_p.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,kp.set(i,Wm(kp.get(i)||null,e,t,n,s,r)),!0}return!1}function UL(e){var t=nf(e.target);if(t!==null){var n=Zp(t);if(n!==null){if(t=n.tag,t===13){if(t=lj(n),t!==null){e.blockedOn=t,Q7(e.priority,function(){dC(n)});return}}else if(t===31){if(t=cj(n),t!==null){e.blockedOn=t,Q7(e.priority,function(){dC(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 Sy(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hk(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);I_=s,n.target.dispatchEvent(s),I_=null}else return t=fm(n),t!==null&&qL(t),e.blockedOn=n,!1;t.shift()}return!0}function fC(e,t,n){Sy(e)&&n.delete(t)}function $W(){fk=!1,Nu!==null&&Sy(Nu)&&(Nu=null),Iu!==null&&Sy(Iu)&&(Iu=null),ju!==null&&Sy(ju)&&(ju=null),_p.forEach(fC),kp.forEach(fC)}function i1(e,t){e.blockedOn===t&&(e.blockedOn=null,fk||(fk=!0,zr.unstable_scheduleCallback(zr.unstable_NormalPriority,$W)))}var o1=null;function mC(e){o1!==e&&(o1=e,zr.unstable_scheduleCallback(zr.unstable_NormalPriority,function(){o1===e&&(o1=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(R6(s||n)===null)continue;break}var i=fm(n);i!==null&&(e.splice(t,3),t-=3,G_(i,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function Gf(e){function t(l){return i1(l,e)}Nu!==null&&i1(Nu,e),Iu!==null&&i1(Iu,e),ju!==null&&i1(ju,e),_p.forEach(t),kp.forEach(t);for(var n=0;n<lu.length;n++){var s=lu[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<lu.length&&(n=lu[0],n.blockedOn===null);)UL(n),n.blockedOn===null&&lu.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[_o]||null;if(typeof i=="function")o||mC(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(r=i,o=i[_o]||null)a=o.formAction;else if(R6(r)!==null)continue}else a=o.action;typeof a=="function"?n[s+1]=a:(n.splice(s,3),s-=3),mC(n)}}}function VL(){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 L6(e){this._internalRoot=e}Vw.prototype.render=L6.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(je(409));var n=t.current,s=Uo();FL(n,s,e,t,null,null)};Vw.prototype.unmount=L6.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;FL(e.current,2,null,e,null,null),qw(),t[hm]=null}};function Vw(e){this._internalRoot=e}Vw.prototype.unstable_scheduleHydration=function(e){if(e){var t=vj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<lu.length&&t!==0&&t<lu[n].priority;n++);lu.splice(n,0,e),n===0&&UL(e)}};var pC=oj.version;if(pC!=="19.2.4")throw Error(je(527,pC,"19.2.4"));hs.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(je(188)):(e=Object.keys(e).join(","),Error(je(268,e)));return e=pU(t),e=e!==null?uj(e):null,e=e===null?null:e.stateNode,e};var zW={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:dn,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var a1=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!a1.isDisabled&&a1.supportsFiber)try{eg=a1.inject(zW),qo=a1}catch{}}Ew.createRoot=function(e,t){if(!aj(e))throw Error(je(299));var n=!1,s="",r=OR,i=BR,o=PR;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=$L(e,1,!1,null,null,n,s,null,r,i,o,VL),e[hm]=t.current,E6(e),new L6(t)};Ew.hydrateRoot=function(e,t,n){if(!aj(e))throw Error(je(299));var s=!1,r="",i=OR,o=BR,a=PR,l=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&&(l=n.formState)),t=$L(e,1,!0,t,n??null,s,r,l,i,o,a,VL),t.context=zL(null),n=t.current,s=Uo(),s=qS(s),r=Cu(s),r.callback=null,Au(n,r,s),n=s,t.current.lanes=n,ng(t,n),jl(t),e[hm]=t.current,E6(e),new Vw(t)};Ew.version="19.2.4";function WL(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(WL)}catch(e){console.error(e)}}WL(),ej.exports=Ew;var mk=ej.exports;const FW=Cw(mk);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const qW="agent";function HW(e){return e===qW}var UW=3e4,VW=new Set(["authorized","expired","error","cancelled"]),WW=class{constructor(e){this.client=e}async start(e){let t=await this.client.startDeviceFlow(e),n=this.client;return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,userCode:t.userCode,verificationUri:t.verificationUri,verificationUriComplete:t.verificationUriComplete,expiresAt:t.expiresAt,intervalMs:t.intervalMs,attached:t.attached,cancel:()=>n.cancelDeviceFlow(t.deviceFlowId,{clientId:e.clientId}),awaitCompletion:async(s={})=>await GW(n,t,e.clientId,s)}}status(e,t){return this.client.getDeviceFlow(e,t)}cancel(e,t){return this.client.cancelDeviceFlow(e,t)}};async function GW(e,t,n,s){return await KW(e,t,n,s)}async function gC(e,t,n,s){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:s})}catch(r){if(r instanceof th&&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 yC(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function KW(e,t,n,s){var d;let r=s.signal,i=yC(s.timeoutMs,{allowZero:!0}),o=yC(s.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+UW,l=Math.max(1e3,o??t.intervalMs??5e3),c=l;for(;;){if(r!=null&&r.aborted)throw pk(r);if(Date.now()>=a)return await gC(e,t,n,r);let h=await gC(e,t,n,r);if(h.intervalMs&&h.intervalMs!==c&&(c=h.intervalMs,l=h.intervalMs,(d=s.onThrottled)==null||d.call(s,h.intervalMs)),VW.has(h.status))return h;await YW(l,r)}}async function YW(e,t){if(t!=null&&t.aborted)throw pk(t);await new Promise((n,s)=>{let r=setTimeout(()=>{o(),n()},e),i=()=>{o(),s(pk(t))};function o(){clearTimeout(r),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function pk(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var th=class extends Error{constructor(t,n,s){super(s);ge(this,"status");ge(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},bC=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},QW=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},wC=16*1024*1024;async function*XW(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(c){if(t!=null&&t.aborted)return;throw c}if(a){if(r+=s.decode(),r.length>0){let c=vC(r);for(let d of c.frames){let h=ox(d);h&&(yield h)}if(c.tail.length>0){let d=ox(c.tail);d&&(yield d)}}return}if(r+=s.decode(o,{stream:!0}),r.length>wC)throw new QW(`parseSseStream: unread buffer exceeded ${wC} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=vC(r);if(l.frames.length>0)for(let c of l.frames){let d=ox(c);d&&(yield d)}r=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function vC(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 ox(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 JW=class{constructor(e,t,n){ge(this,"baseUrl");ge(this,"token");ge(this,"_fetch");ge(this,"_disposed",!1);ge(this,"type","rest");ge(this,"supportsReplay",!0);this.baseUrl=e,this.token=t,this._fetch=n}get connected(){return!this._disposed}async fetch(e,t,n){if(this._disposed)throw new bC;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var d;if(this._disposed)throw new bC;let n={Accept:"text/event-stream"};this.token&&(n.Authorization=`Bearer ${this.token}`),t.lastEventId!==void 0&&(n["Last-Event-ID"]=String(t.lastEventId));let s=new AbortController,r,i=t.connectTimeoutMs;i&&Number.isFinite(i)&&(r=setTimeout(()=>s.abort(new DOMException("Initial connect timed out","TimeoutError")),i),typeof r=="object"&&r&&"unref"in r&&r.unref());let o=t.signal?ZW([t.signal,s.signal]):s.signal,a=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(a+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let l;try{l=await this._fetch(a,{headers:n,signal:o})}finally{r!==void 0&&clearTimeout(r)}if(!l.ok){let h;try{let m=await l.text();try{h=JSON.parse(m)}catch{h=m}}catch{}let f=h&&typeof h=="object"&&"error"in h?String(h.error):`HTTP ${l.status}`;throw new th(l.status,h,`GET /session/:id/events: ${f}`)}let c=l.headers.get("content-type")??"";if(!c.toLowerCase().includes("text/event-stream")){try{await((d=l.body)==null?void 0:d.cancel())}catch{}throw new th(l.status,c,`GET /session/:id/events: expected content-type text/event-stream, got "${c}"`)}if(!l.body)throw new Error("No SSE body");yield*XW(l.body,t.signal)}dispose(){this._disposed=!0}};function ZW(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 l1="/workspace/memory/remember",c1="/workspace/memory/forget",u1="/workspace/memory/dream",_b=20,eG=3e4,tG=65e3,nG=9e4,sG=5,Yh=33e4,rG="X-Qwen-Client-Id",ot=encodeURIComponent;function xC(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function GL(e){if(e===void 0)return sG;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 iG(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function oG(){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 _C=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 KL(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var gk=class{constructor(e){ge(this,"baseUrl");ge(this,"token");ge(this,"_fetch");ge(this,"fetchTimeoutMs");ge(this,"promptLimit");ge(this,"promptCounts",Object.create(null));ge(this,"transport");ge(this,"_authFlow");this.baseUrl=iG(e.baseUrl),this.token=e.token??oG(),this._fetch=e.fetch??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??eG;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=GL(e.maxPendingPromptsPerSession),this.transport=e.transport??new JW(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new WW(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 _C(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 l=t.signal??void 0,c=l?SC([l,o.signal]):o.signal;try{let d=r==="rest"?await this._fetch(e,{...t,signal:c}):await this.transport.fetch(e,{...t,signal:c});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[rG]=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 _C(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new th(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)}:{}},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 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 kC(this,ot(e))}workspaceByCwd(e){return new kC(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 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 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.fetchWithTimeout(`${this.baseUrl}/workspace/acp/preheat${n}`,{method:"POST",headers:this.headers()},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/acp/preheat");return await s.json()},t+2e3)}async workspaceAcpStatus(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/acp/status`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/acp/status");return await e.json()})}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")}async installExtension(e,t){return await this.jsonRequest("/workspace/extensions/install","POST /workspace/extensions/install",{method:"POST",body:e,clientId:t})}async extensionOperationStatus(e){return await this.jsonRequest(`/workspace/extensions/operations/${ot(e)}`,"GET /workspace/extensions/operations/:operationId")}async checkExtensionUpdates(e){return await this.jsonRequest("/workspace/extensions/check-updates","POST /workspace/extensions/check-updates",{method:"POST",body:{},clientId:e})}async refreshExtensions(e){return await this.jsonRequest("/workspace/extensions/refresh","POST /workspace/extensions/refresh",{method:"POST",body:{},clientId:e})}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})}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})}async updateExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${ot(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${ot(e)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:t})}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 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(l1,`POST ${l1}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${l1}/${ot(e)}`,`GET ${l1}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(c1,`POST ${c1}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${c1}/${ot(e)}`,`GET ${c1}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(u1,`POST ${u1}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${u1}/${ot(e)}`,`GET ${u1}/: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()},Yh)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${ot(e)}`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/agents/:agentType");return await t.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 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}:{}})},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){let n=(t==null?void 0:t.pageSize)??_b,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:_b))),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),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={}){let n=t.format??"html",s=t.format?`?format=${ot(t.format)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}/session/${ot(e)}/export${s}`,{headers:this.headers({},t.clientId)},async r=>{var l;if(!r.ok)throw await this.failOnError(r,"GET /session/:id/export");let i=await r.text(),o=r.headers.get("content-type")??"",a=((l=/filename="([^"]+)"/i.exec(r.headers.get("content-disposition")??""))==null?void 0:l[1])??`export.${n}`;return{content:i,filename:a,mimeType:o,format:n}},void 0,"rest")}async getSessionTranscriptPage(e,t={}){let n=new URLSearchParams;t.cursor!==void 0&&n.set("cursor",t.cursor),t.limit!==void 0&&n.set("limit",String(t.limit));let s=n.toString();return await this.jsonRequest(`/session/${ot(e)}/transcript${s?`?${s}`:""}`,"GET /session/:id/transcript",{clientId:t.clientId,mode:"rest"})}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}:{}})},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()})}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()})}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 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 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})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/settings");return await r.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){let n=t.voiceModel?`?${new URLSearchParams({voiceModel:t.voiceModel}).toString()}`:"";return await this.fetchWithTimeout(`${this.baseUrl}/workspace/voice/transcribe${n}`,{method:"POST",headers:this.headers({"Content-Type":t.mimeType},t.clientId),body:e},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/voice/transcribe");return await s.json()},tG,"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=xC(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=xC(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)??Yh)}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)}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)??Yh)}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)??Yh)}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)??Yh)}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:nG})}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)}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){let i=new AbortController,o=s?SC([s,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let l of a){let c=D6(l,t);if(c!==void 0)return c}throw new Error("SSE stream ended")}catch(a){throw s!=null&&s.aborted&&a instanceof DOMException&&a.name==="AbortError"&&this.cancel(e,r).catch(()=>{}),a}finally{i.signal.aborted||i.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,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){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify({cwd:e})},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspaces");return await t.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")})}},kC=class{constructor(e,t){this.client=e,this.workspaceSelector=t}workspaceMcp(){return this.get("/mcp","GET /workspaces/:workspace/mcp")}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")}writeWorkspaceMemory(e,t){return this.post("/memory","POST /workspaces/:workspace/memory",{...e,scope:"workspace"},t)}listWorkspaceAgents(){return this.get("/agents","GET /workspaces/:workspace/agents")}createWorkspaceAgent(e,t){return this.post("/agents","POST /workspaces/:workspace/agents",{...e,scope:e.scope??"workspace"},t)}getWorkspaceAgent(e){return this.get(`/agents/${ot(e)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(e,t,n={}){let s=n.scope?`?scope=${ot(n.scope)}`:"";return this.post(`/agents/${ot(e)}${s}`,"POST /workspaces/:workspace/agents/:agentType",t,n.clientId)}async deleteWorkspaceAgent(e,t={}){let n=t.scope?`?scope=${ot(t.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${ot(e)}${n}`,"DELETE /workspaces/:workspace/agents/:agentType",{method:"DELETE",clientId:t.clientId,okNotFoundCode:"agent_not_found"})}listWorkspaceSessionsPage(e){let t=(e==null?void 0:e.pageSize)??_b,n=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(t)?t:_b))),s=new URLSearchParams({size:String(n)});return(e==null?void 0:e.cursor)!==void 0&&s.set("cursor",e.cursor),(e==null?void 0:e.archiveState)!==void 0&&s.set("archiveState",e.archiveState),(e==null?void 0:e.view)!==void 0&&s.set("view",e.view),(e==null?void 0:e.group)!==void 0&&s.set("group",e.group),(e==null?void 0:e.parentSessionId)!==void 0&&s.set("parentSessionId",e.parentSessionId),this.get(`/sessions?${s.toString()}`,"GET /workspaces/:workspace/sessions")}async listWorkspaceSessions(e){return(await this.listWorkspaceSessionsPage(e)).sessions}listSessionGroups(){return this.get("/session-groups","GET /workspaces/:workspace/session-groups")}async createSessionGroup(e){return(await this.post("/session-groups","POST /workspaces/:workspace/session-groups",e)).group}async updateSessionGroup(e,t){return(await this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${ot(e)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:t})).group}deleteSessionGroup(e){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${ot(e)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}deleteSessionsData(e,t){return this.post("/sessions/delete","POST /workspaces/:workspace/sessions/delete",{sessionIds:e},t)}archiveSessionsData(e,t){return this.post("/sessions/archive","POST /workspaces/:workspace/sessions/archive",{sessionIds:e},t)}unarchiveSessionsData(e,t){return this.post("/sessions/unarchive","POST /workspaces/:workspace/sessions/unarchive",{sessionIds:e},t)}readWorkspaceFile(e,t={},n){let s=new URLSearchParams({path:e});return t.maxBytes!==void 0&&s.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&s.set("line",String(t.line)),t.limit!==void 0&&s.set("limit",String(t.limit)),this.get(`/file?${s.toString()}`,"GET /workspaces/:workspace/file",n)}readWorkspaceFileBytes(e,t={},n){let s=new URLSearchParams({path:e});return t.offset!==void 0&&s.set("offset",String(t.offset)),t.maxBytes!==void 0&&s.set("maxBytes",String(t.maxBytes)),this.get(`/file/bytes?${s.toString()}`,"GET /workspaces/:workspace/file/bytes",n)}fileStat(e){let t=new URLSearchParams({path:e});return this.get(`/stat?${t.toString()}`,"GET /workspaces/:workspace/stat")}dirList(e){let t=new URLSearchParams({path:e});return this.get(`/list?${t.toString()}`,"GET /workspaces/:workspace/list")}glob(e){let t=new URLSearchParams({pattern:e});return this.get(`/glob?${t.toString()}`,"GET /workspaces/:workspace/glob")}writeWorkspaceFile(e,t){return this.post("/file/write","POST /workspaces/:workspace/file/write",e,t)}editWorkspaceFile(e,t){return this.post("/file/edit","POST /workspaces/:workspace/file/edit",e,t)}workspaceSettings(e){return this.get("/settings","GET /workspaces/:workspace/settings",e==null?void 0:e.clientId)}setWorkspaceSetting(e,t,n,s){return this.post("/settings","POST /workspaces/:workspace/settings",{scope:e,key:t,value:n},s==null?void 0:s.clientId)}workspaceTrust(e){return this.get("/trust","GET /workspaces/:workspace/trust",e==null?void 0:e.clientId)}requestWorkspaceTrustChange(e,t){return this.post("/trust/request","POST /workspaces/:workspace/trust/request",e,t)}workspacePermissions(e){return this.get("/permissions","GET /workspaces/:workspace/permissions",e==null?void 0:e.clientId)}setWorkspacePermissionRules(e,t,n){return this.post("/permissions","POST /workspaces/:workspace/permissions",{scope:"workspace",ruleType:e,rules:[...t]},n==null?void 0:n.clientId)}setWorkspaceToolEnabled(e,t,n){return this.post(`/tools/${ot(e)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:t},n==null?void 0:n.clientId)}restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${ot(String(t.entryIndex))}`;return this.post(`/mcp/${ot(e)}/restart${n}`,"POST /workspaces/:workspace/mcp/:server/restart",{},t==null?void 0:t.clientId,(t==null?void 0:t.timeoutMs)??Yh)}reload(e){return this.post("/reload","POST /workspaces/:workspace/reload",{},e==null?void 0:e.clientId,e==null?void 0:e.timeoutMs)}initWorkspace(e){return this.post("/init","POST /workspaces/:workspace/init",(e==null?void 0:e.force)===!0?{force:!0}:{},e==null?void 0:e.clientId)}get(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{clientId:n})}post(e,t,n,s,r){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{method:"POST",body:n,clientId:s,timeoutMs:r})}};function SC(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 D6(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 th(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function TC(e){return"promptId"in e&&"lastEventId"in e}var Gm=class Ty{constructor(t){ge(this,"client");ge(this,"session");ge(this,"state");ge(this,"replaySnapshot");ge(this,"hasActivePrompt");ge(this,"lastSeenEventId");ge(this,"subscriptionActive",!1);ge(this,"reattaching");ge(this,"promptLimit");ge(this,"_pendingPrompts",new Map);this.client=t.client,this.session={...t.session},this.state={...t.state??{}},this.hasActivePrompt=t.hasActivePrompt??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=d1(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:GL(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 Ty({client:t,session:r,hasActivePrompt:r.hasActivePrompt,lastEventId:i})}static async load(t,n,s={},r){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:l,lastEventId:c,...d}=await t.loadSession(n,s,r);return new Ty({client:t,session:d,hasActivePrompt:o,state:i,lastEventId:c??0,replaySnapshot:{compactedReplay:a??[],liveJournal:l??[]}})}static async resume(t,n,s={},r){let{state:i,hasActivePrompt:o,lastEventId:a,...l}=await t.resumeSession(n,s,r);return new Ty({client:t,session:l,hasActivePrompt:o,state:i,lastEventId:a??0})}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 lastEventId(){return this.lastSeenEventId}setLastEventId(t){this.lastSeenEventId=d1(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)),!TC(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 c=this._pendingPrompts.get(r.promptId);c&&this._pendingPrompts.delete(r.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),c.reject(n.reason??new DOMException("Aborted","AbortError")))},l=()=>n==null?void 0:n.removeEventListener("abort",a);this._pendingPrompts.set(r.promptId,{resolve:c=>{l(),s(),i(c)},reject:c=>{l(),s(),o(c)}}),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(!TC(s))throw new Error("Expected non-blocking prompt acceptance");return s}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!aG(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}:{}})}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=d1(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 l=>(r||o(),await a.next(l)),return:async()=>{try{return await a.return(void 0)}finally{i()}},throw:async l=>{try{return await a.throw(l)}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);for await(let o of this.client.subscribeEvents(this.sessionId,{...r,lastEventId:i}))this._dispatchTurnEvent(o),yield o,o.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,d1(o.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=D6(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 d1(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function aG(e){return e instanceof th&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var YL="mid_turn_message_injected",O6="pending_prompt_added",B6="pending_prompt_started",P6="pending_prompt_completed",lG=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated","artifact_changed",YL,O6,B6,P6,"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","settings_reloaded","mcp_server_added","mcp_server_removed","extensions_changed","permission_partial_vote","permission_forbidden","prompt_cancelled","replay_complete","followup_suggestion","user_shell_command","user_shell_result","turn_complete","turn_error","session_rewound","session_branched","session_snapshot"];new Set(lG);var cG=["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"],Ww=["plan","default","auto-edit","auto","yolo"],yk="daemon-plan";function Ot(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ze(e,t){if(!Ot(e))return;let n=e[t];return typeof n=="string"?n:void 0}function cs(e,t){if(Ot(e))for(let n of t){let s=e[n];if(typeof s=="string"&&s.trim().length>0)return s}}function qu(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 Sc(e){return qu(cc(e))}function cc(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>cc(n,t+1)):Ot(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,QL(n)?"[redacted]":cc(s,t+1)])):e}function QL(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 ax(e){if(typeof e=="string")return e;if(!Ot(e))return"";let t=e.text;return typeof t=="string"?t:""}function uG(e){if(typeof e=="string")return{kind:"text",text:e};if(!Ot(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=Ot(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=Ot(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 dG=64;function kb(e,t=0){if(t>dG)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>kb(s,t+1)).filter(Boolean).join(`
`);if(!Ot(e))return e===void 0?"":qu(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=kb(n,t+1);if(s)return s}return qu(e)}var hG=new Set(cG),XL=new Set(["qwen","qwen-oauth"]),fG=new Set(["in_flight","disabled","budget_would_exceed"]),CC="malformed memory_changed payload",AC=4096;function mG(e,t={}){let n=xG(e,t);switch(e.type){case"session_update":return _G(e,n,t);case"shell_output":{let s=kb(e.data),r=wk(e.data),i=vk(e.data);return s?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:s,...r?{stream:r}:{}}]:[]}case"permission_request":return MG(e,n);case"permission_resolved":case"permission_already_resolved":return NG(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:ze(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:ze(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let s=lx(ze(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...s?{errorKind:s}:{},text:ze(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${ze(e.data,"reason")??"closed"}`}];case"client_evicted":return[{...n,type:"error",recoverable:!0,text:ze(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=lx(ze(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...s?{errorKind:s}:{},text:ze(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let s=ze(e.data,"code"),r=lx(ze(e.data,"errorKind")),i=ze(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...s?{code:s}:{},...r?{errorKind:r}:{},...i?{promptId:i}:{},text:ze(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return pG(e,n);case"history_truncated":return gG(e,n);case"session_rewound":return yG(e,n);case"session_branched":return bG(e,n);case"prompt_cancelled":{let s=nK(e.data,"reason");return[{...n,type:"prompt.cancelled",...s?{reason:s}:{}}]}case"followup_suggestion":return wG(e,n);case"mid_turn_message_injected":return vG(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let s=ze(e.data,"command"),r=ze(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=Rs(e.data,"exitCode"),r=Ot(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=Rs(e.data,"replayedCount")??0,r=Rs(e.data,"lastReplayedEventId")??Rs(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:s,...r!==void 0?{lastReplayedEventId:r}:{}}]}case"session_metadata_updated":return DG(e,n);case"approval_mode_changed":return OG(e,n);case"memory_changed":return BG(e,n);case"agent_changed":return PG(e,n);case"tool_toggled":return $G(e,n);case"settings_changed":return zG(e,n);case"settings_reloaded":return FG(e,n);case"trust_change_requested":return HG(e,n);case"workspace_initialized":return qG(e,n);case"github_setup_completed":return UG(e,n);case"mcp_budget_warning":return VG(e,n);case"mcp_child_refused_batch":return WG(e,n);case"mcp_server_restarted":return GG(e,n);case"mcp_server_restart_refused":return KG(e,n);case"extensions_changed":return YG(e,n);case"auth_device_flow_started":return QG(e,n);case"auth_device_flow_throttled":return XG(e,n);case"auth_device_flow_authorized":return JG(e,n);case"auth_device_flow_failed":return ZG(e,n);case"auth_device_flow_cancelled":return tK(e,n);default:return[{...n,type:"debug",text:`${e.type} (unrecognized daemon event): ${Sc(e.data)}`}]}}function pG(e,t){let n=ze(e.data,"reason"),s=Rs(e.data,"lastDeliveredId"),r=Rs(e.data,"earliestAvailableId");return!n||s===void 0||r===void 0?bs(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:s,earliestAvailableId:r}]}function gG(e,t){let n=ze(e.data,"reason"),s=Rs(e.data,"truncatedEvents"),r=Rs(e.data,"retainedEvents"),i=Rs(e.data,"maxBytes");return n!=="replay_window_exceeded"||s===void 0||r===void 0||i===void 0||!Ot(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?bs(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${r}, dropped ${s} (window ${i} bytes).`,source:"history_truncated"}]}function yG(e,t){let n=ze(e.data,"promptId"),s=Rs(e.data,"targetTurnIndex");if(!n||s===void 0)return bs(e,t,"malformed session_rewound payload");let r=ze(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:s,...r?{sessionId:r}:{}}]}function bG(e,t){let n=ze(e.data,"sourceSessionId"),s=ze(e.data,"newSessionId"),r=ze(e.data,"displayName");return!n||!s||!r?bs(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:s,displayName:r}]}function wG(e,t){let n=ze(e.data,"sessionId"),s=ze(e.data,"suggestion"),r=ze(e.data,"promptId");return!n||!s||!r?bs(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:s,promptId:r}]}function vG(e,t){if(!Ot(e.data))return bs(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?bs(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function xG(e,t){let n=JL(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:cc(e.data)}}:{}}}function JL(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(Ot(n)){let s=n.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}if(Ot(e.data)){let s=e.data._meta;if(Ot(s)){let i=s.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let r=e.data.update;if(Ot(r)){let i=r._meta;if(Ot(i)){let o=i.serverTimestamp;if(typeof o=="number"&&Number.isFinite(o))return o;let a=i.timestamp;if(typeof a=="number"&&Number.isFinite(a))return a}}}}function _G(e,t,n){let s=IG(e.data);if(!s)return[{...t,type:"debug",text:`session_update: ${Sc(e.data)}`}];let r=ze(s,"sessionUpdate");switch(r){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=MC(s),o=s.content,a=uG(o);if(a){if(a.kind==="image"){let c=a.source.data,d=a.mediaType||"image/*";if(d==="image/*"&&c){let h=(c.startsWith("data:")?c.split(",")[1]??"":c).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 c?[{...t,type:"user.image.delta",data:c,mimeType:d}]:[]}return a.kind==="text"?a.text?[{...t,type:"user.text.delta",text:a.text,...i?{meta:i}:{}}]:[]:[]}let l=ax(o);return l?[{...t,type:"user.text.delta",text:l,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=ax(s.content),o=EC(s),a=MC(s),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let c=kG(s);return c&&l.push({...t,type:"assistant.usage",usage:c,...o?{parentToolCallId:o}:{}}),l}case"agent_thought_chunk":{let i=ax(s.content);if(!i)return[];let o=EC(s);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":return[SG(s,t)];case"shell_output":case"tool_output":{let i=kb(s),o=wk(s)??wk(e.data),a=vk(s)??vk(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(Ot);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[TG(s,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${r??"session_update"}: ${Sc(s)}`}]}}function EC(e){let t=Ot(e._meta)?e._meta:void 0;return t?ze(t,"parentToolCallId"):void 0}function MC(e){let t=Ot(e._meta)?e._meta:void 0;return t?{...t}:void 0}function kG(e){let t=Ot(e._meta)?e._meta:void 0,n=t&&Ot(t.usage)?t.usage:void 0;if(!n)return;let s=Rs(n,"inputTokens"),r=Rs(n,"outputTokens");if(s===void 0&&r===void 0)return;let i=Rs(n,"cachedReadTokens");return{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}function SG(e,t){let n=Ot(e._meta)?e._meta:void 0,s=ze(e,"toolName")??ze(e,"name")??(n?ze(n,"toolName"):void 0)??(n?ze(n,"name"):void 0),r=ze(e,"kind"),i=ze(e,"title")??s??r,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,l=o!==void 0?cc(o):void 0,c=a!==void 0?cc(a):void 0,d=e.content!==void 0?cc(e.content):void 0,h=e.locations!==void 0?cc(e.locations):void 0,f=ze(e,"toolCallId"),m=ze(e,"status");if(!f)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:y}=EG(e,s),b=ze(e,"parentToolCallId")??(n?ze(n,"parentToolCallId"):void 0),w=b&&b!==f?b:void 0,v=ze(e,"subagentType")??(n?ze(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:f,...m?{status:m}:{},...i?{title:i}:{},...s?{toolName:s}:{},...r?{toolKind:r}:{},...d!==void 0?{content:d}:{},...h!==void 0?{locations:h}:{},...g?{provenance:g}:{},...y?{serverId:y}:{},...w?{parentToolCallId:w}:{},...v?{subagentType:v}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:bk(Sc(l))}:c!==void 0?{details:bk(Sc(c))}:{}}}function TG(e,t){let n=Array.isArray(e.entries)?e.entries:[],s=bk(CG(n)),r=t.eventId!==void 0?`${yk}-${t.eventId}`:yk,i=Ot(e._meta)?e._meta:void 0,o=i&&Ot(i.stats)?i.stats:void 0;return{...t,type:"tool.update",toolCallId:r,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:s}}],rawOutput:o?{entries:n,stats:o}:{entries:n}}}function CG(e){return e.flatMap(t=>{if(!Ot(t))return[];let n=ze(t,"content");return n?[`- [${AG(ze(t,"status"))}] ${n}`]:[]}).join(`
`)}function AG(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function EG(e,t){let n=ze(e,"provenance"),s=ze(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 lx(e){if(e)return hG.has(e)?e:void 0}function bk(e){return e.length<=AC?e:`${e.slice(0,AC)}... [truncated]`}function MG(e,t){if(!Ot(e.data))return[{...t,type:"debug",text:`permission_request: ${Sc(e.data)}`}];let n=ze(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${Sc(e.data)}`}];let s=e.data.toolCall!==void 0?cc(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:ze(e.data,"sessionId"),title:LG(s),options:jG(e.data.options),toolCall:s}]}function NG(e,t){let n=ze(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${Sc(e.data)}`}];let s=ze(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:RG(e.data),...s?{voterClientId:s}:{}}]}function IG(e){if(!Ot(e))return;let t=e.update;return Ot(t)?t:e}function jG(e){return Array.isArray(e)?e.flatMap(t=>{if(!Ot(t))return[];let n=ze(t,"optionId");return n?[{optionId:n,label:ze(t,"label")??ze(t,"title")??ze(t,"name")??n,...ze(t,"description")?{description:ze(t,"description")}:{},raw:t}]:[]}):[]}function RG(e){if(!Ot(e))return qu(e);let t=e.outcome;if(typeof t=="string")return t;if(Ot(t)){let n=ze(t,"outcome")??"selected",s=ze(t,"optionId");return s?`${n}:${s}`:n}return cs(e,["status","reason"])??qu(e)}function LG(e){return Ot(e)?ze(e,"title")??ze(e,"name")??ze(e,"kind")??ze(e,"toolName")??"Tool permission":"Tool permission"}function wk(e){let t=ze(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function vk(e){if(!Ot(e))return;let t=ze(e,"source");if(t)return t;let n=e._meta;return Ot(n)?ze(n,"source"):void 0}function bs(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function DG(e,t){let n=ze(e.data,"sessionId");if(!n)return bs(e,t,"missing sessionId");let s=ze(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...s!==void 0?{displayName:s}:{}}]}function OG(e,t){let n=ze(e.data,"sessionId"),s=ze(e.data,"previous"),r=ze(e.data,"next");if(!n||!s||!r)return bs(e,t,"missing sessionId / previous / next");let i=Ot(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 BG(e,t){var o;let n=ze(e.data,"scope");if(n==="managed"){let a=ze(e.data,"source"),l=ze(e.data,"taskId"),c=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&l&&Array.isArray(c))||c.some(d=>d!=="user"&&d!=="project")?bs(e,t,CC):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:l,touchedScopes:c}]}let s=ze(e.data,"filePath"),r=ze(e.data,"mode"),i=Rs(Ot(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!s||r!=="append"&&r!=="replace"||i===void 0?bs(e,t,CC):[{...t,type:"workspace.memory.changed",scope:n,filePath:s,mode:r,bytesWritten:i}]}function PG(e,t){let n=ze(e.data,"change"),s=ze(e.data,"name"),r=ze(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!s||r!=="project"&&r!=="user"?bs(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:s,level:r}]}function $G(e,t){let n=ze(e.data,"toolName"),s=Ot(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||s===void 0?bs(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:s}]}function zG(e,t){let n=ze(e.data,"key"),s=ze(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:s??"workspace",value:Ot(e.data)?e.data.value:void 0}]:bs(e,t,"malformed settings_changed payload")}function FG(e,t){return Ot(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:bs(e,t,"malformed settings_reloaded payload")}function qG(e,t){let n=ze(e.data,"path"),s=ze(e.data,"action");return!n||s!=="created"&&s!=="overwrote"&&s!=="noop"?bs(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:s}]}function HG(e,t){let n=ze(e.data,"workspaceCwd"),s=ze(e.data,"desiredState"),r=ze(e.data,"reason");return!n||s!=="trusted"&&s!=="untrusted"?bs(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:s,...r!==void 0?{reason:r}:{}}]}function UG(e,t){let n=ze(e.data,"releaseTag"),s=ze(e.data,"readmeUrl");if(!n||!s||!Ot(e.data))return bs(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 VG(e,t){if(!Ot(e.data))return bs(e,t,"non-object payload");let n=Rs(e.data,"liveCount"),s=Rs(e.data,"reservedCount"),r=Rs(e.data,"budget"),i=Rs(e.data,"thresholdRatio"),o=ze(e.data,"mode");return n===void 0||s===void 0||r===void 0||i===void 0||o!=="warn"&&o!=="enforce"?bs(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:s,budget:r,thresholdRatio:i,mode:o}]}function WG(e,t){if(!Ot(e.data))return bs(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(Ot).map(o=>{let a=ze(o,"name"),l=ze(o,"transport"),c=ze(o,"reason");return!a||!l||c!=="budget_exhausted"?null:{name:a,transport:l,reason:"budget_exhausted"}}).filter(o=>o!==null):[],s=Rs(e.data,"budget"),r=Rs(e.data,"liveCount"),i=Rs(e.data,"reservedCount");return n.length===0||s===void 0||r===void 0||i===void 0?bs(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:s,liveCount:r,reservedCount:i}]}function GG(e,t){let n=ze(e.data,"serverName"),s=Rs(e.data,"durationMs");return!n||s===void 0?bs(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:s}]}function KG(e,t){let n=ze(e.data,"serverName"),s=ze(e.data,"reason");return!n||!s||!fG.has(s)?bs(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:s}]}function YG(e,t){let n=Rs(e.data,"refreshed"),s=Rs(e.data,"failed"),r=ze(e.data,"status"),i=ze(e.data,"source"),o=ze(e.data,"name"),a=ze(e.data,"version"),l=ze(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"?bs(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}:{},...l?{error:l}:{}}]}function QG(e,t){let n=ze(e.data,"deviceFlowId"),s=ze(e.data,"providerId"),r=Rs(e.data,"expiresAt");return!n||!s||!XL.has(s)||r===void 0?bs(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:s,expiresAt:r}]}function XG(e,t){let n=ze(e.data,"deviceFlowId"),s=Rs(e.data,"intervalMs");return!n||s===void 0?bs(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:s}]}function JG(e,t){let n=ze(e.data,"deviceFlowId"),s=ze(e.data,"providerId");if(!n||!s||!XL.has(s))return bs(e,t,"malformed auth_device_flow_authorized payload");let r=Rs(e.data,"expiresAt"),i=ze(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:s,...r!==void 0?{expiresAt:r}:{},...i?{accountAlias:i}:{}}]}function ZG(e,t){let n=ze(e.data,"deviceFlowId"),s=ze(e.data,"errorKind");if(!n||!eK(s))return bs(e,t,"malformed auth_device_flow_failed payload");let r=ze(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:s,...r?{hint:r}:{}}]}function eK(e){return typeof e=="string"&&e.trim().length>0}function tK(e,t){let n=ze(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:bs(e,t,"malformed auth_device_flow_cancelled payload")}function Rs(e,t){if(!Ot(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function nK(e,t){if(!Ot(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var sK=8;function Sb(e,t={},n=0){if(n>sK){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(Ot(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let y=Sb(g,{title:t.title??cs(e,["title"]),toolName:t.toolName??cs(e,["toolName","name"]),toolKind:t.toolKind??cs(e,["kind"])},n+1);if(y.kind!=="generic"||!y.summary)return y}}let s=lK(e);if(s.length>0)return{kind:"ask_user_question",questions:s};let r=aK(e,t);if(r)return r;let i=hK(e,t);if(i)return i;let o=fK(e,t);if(o)return o;let a=mK(e,t);if(a)return a;let l=rK(e,t);if(l)return l;let c=iK(e,t);if(c)return c;let d=oK(e);if(d)return d;let h=pK(e,t);if(h)return h;let f=gK(e);if(f)return f;if(Ot(e)){let g=cs(e,["command","cmd"]);if(g){let b=cs(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...b?{cwd:b}:{}}}let y=uK(e);if(y.length>0)return{kind:"key_value",rows:y}}let m=t.title??t.toolName??t.toolKind;return{kind:"generic",...m?{summary:m}:{}}}function rK(e,t={}){if(!Ot(e))return;let n=cs(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=cs(e,["oldText","old_text","old_str","oldString"]),r=cs(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?cs(e,["content"]):void 0,l=r??a,c=cs(e,["patch","diff","unified_diff"]);if(!(!s&&!l&&!c))return{kind:"file_diff",path:n,...s?{oldText:s}:{},...l?{newText:l}:{},...c?{patch:c}:{}}}function iK(e,t){if(!Ot(e))return;let n=cs(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=t.toolName??cs(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,l=e.limit;typeof a=="number"&&typeof l=="number"&&l>0&&(o=[a+1,a+l])}if(!(!r&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function oK(e){if(!Ot(e))return;let t=cs(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=cs(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function aK(e,t){let n=t.toolName??(Ot(e)?cs(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(Ot(e)){let l=e.arguments??e.args??e;if(Ot(l)){let c=Object.entries(l).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,h])=>{let f=typeof h=="string"?h:JSON.stringify(h),m=f.length>60?`${f.slice(0,60)}…`:f;return`${d}=${m}`})[0];c&&(a=c)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function lK(e){return!Ot(e)||!Array.isArray(e.questions)?[]:e.questions.filter(Ot).map(t=>{let n=cs(t,["header","title","label"]),s=cs(t,["question","prompt","text"])??"Question",r=Array.isArray(t.options)?t.options.filter(Ot).map(cK):[];return{...n?{header:n}:{},question:s,options:r,raw:t}})}function cK(e){let t=cs(e,["label","title","value"])??"Option",n=cs(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function uK(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=cs(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)||Ot(r)||t.push({label:s,value:QL(s)?"[redacted]":Sc(r)});return t}var NC=50,dK=5;function hK(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!Ot(e))return;let s=cs(e,["subagent_type","agent","agentName","agent_name","subagent"]),r=cs(e,["prompt","task","description","instruction","query"]);if(!s&&!r)return;let i=cs(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:s??"subagent",task:r??"(no task description)",...i?{parentDelegationId:i}:{}}}function fK(e,t){if(!Ot(e))return;let n=cs(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,dK).map(a=>typeof a=="string"?a:Ot(a)?cs(a,["path","file","name","title","text"])??qu(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 mK(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!Ot(e))return;let s=cs(e,["prompt","description","query"]);if(!s)return;let r=cs(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=cs(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:s,...r?{thumbnailUrl:r}:{},...i?{model:i}:{}}}function pK(e,t){if(!Ot(e))return;let n=cs(e,["code","snippet","source"]);if(!n)return;let s=cs(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=cs(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...s?{language:s}:{},...o?{origin:o}:{}}}function gK(e){if(!Ot(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,NC).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:qu(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&&Ot(s[0])){let r=Object.keys(s[0]).slice(0,30);if(r.length===0)return;let i=s.slice(0,NC).map(o=>{let a=o;return r.map(l=>{let c=a[l];return typeof c=="string"?c:qu(c).slice(0,80)})});return{kind:"tabular",columns:r,rows:i,...s.length>i.length?{totalRows:s.length}:{}}}}var yK=1e3,Vd="__trimmed_tool_block__",Gw="__trimmed_permission_block__",xk=1e5,IC=`
[truncated]
`,bK=16;function wK(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??yK}}var $6=new Set(["pending","confirming","running","in_progress"]),vK=new Set(["completed","success","failed","error","canceled","cancelled"]),xK=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function _K(e,t,n={}){let s=nD(e,n);H6(s);let r=U6(s,"user",t);return n.images&&n.images.length>0&&(r.images=[...n.images]),Rl(s,r),s.activeUserBlockId=r.id,sD(s)}function kK(e,t,n={}){if(t.length===0)return e;let s=nD(e,n);for(let i of t)SK(s,i);let r=sD(s);return Object.freeze(r.blocks),r}function z6(e){let t={};return e.forEach((n,s)=>{t[n.id]=s}),t}function SK(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!xK.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),cx(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let s=xa(e,e.activeUserBlockId);s&&s.kind==="user"&&(s.images=[...s.images??[],{data:t.data,mimeType:t.mimeType}])}else{let s=U6(e,"user","");s.images=[{data:t.data,mimeType:t.mimeType}],Rl(e,s),e.activeUserBlockId=s.id}break}case"assistant.text.delta":cx(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":H6(e,t),(t.reason==="cancelled"||t.reason==="error")&&_k(e);break;case"assistant.usage":AK(e,t);break;case"thought.text.delta":cx(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":tD(e,t);break;case"shell.output":NK(e,t);break;case"user.shell.output":IK(e,t);break;case"permission.request":jK(e,t);break;case"permission.resolved":RK(e,t);break;case"model.changed":U0(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":U0(e,t.type,t.text,t);break;case"session.approval_mode.changed":e.approvalMode=t.next;break;case"session.metadata.changed":case"session.available_commands":break;case"session.state_resync_required":TK(e,t);break;case"prompt.cancelled":_k(e),t.reason!=="forward_failed"&&LK(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":OK(e,t.targetTurnIndex);break;case"session.branched":U0(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function TK(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},_k(e),U0(e,"error",`State resync required: ${CK(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function CK(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 Kw(e,t,n){let s=xa(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 ZL(e,t){Kw(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function AK(e,t){let n=xa(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 eD(e,t){Kw(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function F6(e,t,n){Kw(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function q6(e,t,n){Kw(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function cx(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],l=xa(e,a);if(l&&l.kind===t&&EK(l,r)){l.text=W6(l.text,s),l.updatedAt=e.now,r.eventId!==void 0&&(l.eventId=r.eventId),r.serverTimestamp!==void 0&&(l.serverTimestamp=r.serverTimestamp),"meta"in r&&r.meta&&(l.meta={...l.meta,...r.meta}),(t==="assistant"||t==="thought")&&(l.streaming=!0);return}let c=U6(e,t,s,r.eventId,r.serverTimestamp,"meta"in r?r.meta:void 0);(t==="assistant"||t==="thought")&&(c.streaming=!0),t==="thought"&&(c.collapsed=!0),i!=null&&(c.parentToolCallId=i),Rl(e,c),o&&i!=null?o[i]=c.id:e[n]=c.id,i!=null?(t==="assistant"&&q6(e,i),t==="thought"&&F6(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&ZL(e),t!=="thought"&&eD(e))}function EK(e,t){var n,s;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0?!1:!("meta"in t)||((s=t.meta)==null?void 0:s.qwenDiscreteMessage)!==!0}function H6(e,t){ZL(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))F6(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))q6(e,n,t);eD(e,t)}function tD(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===Vd){if(DK(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],tD(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,U0(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let s=xa(e,n);if((s==null?void 0:s.kind)==="tool"){if(t.title!==void 0&&(s.title=t.title),t.status!==void 0&&(s.status=t.status),t.rawInput!==void 0&&(s.preview=Sb(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId),t.details&&(s.details=t.details),t.content!==void 0&&(s.content=t.content),t.locations!==void 0&&(s.locations=t.locations),t.rawInput!==void 0&&(s.rawInput=t.rawInput),t.rawOutput!==void 0&&(s.rawOutput=t.rawOutput),t.toolName&&(s.toolName=t.toolName),t.toolKind&&(s.toolKind=t.toolKind),t.parentToolCallId&&!s.parentToolCallId&&(s.parentToolCallId=t.parentToolCallId),s.parentToolCallId&&!s.parentBlockId){let o=e.toolBlockByCallId[s.parentToolCallId];o&&o!==Vd&&(s.parentBlockId=o)}t.subagentType&&!s.subagentType&&(s.subagentType=t.subagentType),jC(e,t.toolCallId,t.status);return}let r=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==Vd?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:td(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:Sb(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.details?{details:t.details}:{},...t.content!==void 0?{content:t.content}:{},...t.locations!==void 0?{locations:t.locations}:{},...t.rawInput!==void 0?{rawInput:t.rawInput}:{},...t.rawOutput!==void 0?{rawOutput:t.rawOutput}:{},...t.toolName?{toolName:t.toolName}:{},...t.toolKind?{toolKind:t.toolKind}:{},...t.parentToolCallId?{parentToolCallId:t.parentToolCallId}:{},...t.subagentType?{subagentType:t.subagentType}:{},...r?{parentBlockId:r}:{}};Rl(e,i),e.toolBlockByCallId[t.toolCallId]=i.id;for(let o of e.blocks)if(o.kind==="tool"&&o.parentToolCallId===t.toolCallId&&!o.parentBlockId){let a=xa(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}jC(e,t.toolCallId,t.status??"pending"),wh(e,t.parentToolCallId)}function jC(e,t,n){if(n!==void 0){if($6.has(n)){e.currentToolCallId=t;return}if(vK.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=MK(e));return}}}function MK(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"&&$6.has(n.status))return n.toolCallId}}function _k(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===Vd)continue;let n=xa(e,t);!n||n.kind!=="tool"||$6.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function NK(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 r=xa(e,n.id);(r==null?void 0:r.kind)==="shell"&&(r.text=W6(r.text,t.text),r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId));return}let s={id:td(e,"shell"),kind:"shell",text:dg(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}:{}};Rl(e,s),wh(e)}function IK(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 o=xa(e,n.id);(o==null?void 0:o.kind)==="user_shell"&&(o.text=W6(o.text,t.text),o.updatedAt=e.now,t.eventId!==void 0&&(o.eventId=t.eventId));return}let s=e.pendingUserShellCommand,r=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i={id:td(e,"user-shell"),kind:"user_shell",text:dg(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,Rl(e,i),wh(e)}function jK(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===Gw)return;let s=xa(e,n),r=Sb(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:td(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}:{}};Rl(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,wh(e)}function RK(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===Gw)return;let s=xa(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:td(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}:{}};Rl(e,r),e.permissionBlockByRequestId[t.requestId]=r.id,wh(e)}function U0(e,t,n,s,r={}){let i={id:td(e,t),kind:t,text:dg(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}}:{}};Rl(e,i),r.clearActiveText!==!1&&wh(e)}function LK(e,t){let n={id:td(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}:{}};Rl(e,n),wh(e)}function U6(e,t,n,s,r,i){return{id:td(e,t),kind:t,text:dg(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...s!==void 0?{eventId:s}:{},...r!==void 0?{serverTimestamp:r}:{},...i?{meta:{...i}}:{}}}function nD(e,t){return{...e,now:t.now??Date.now(),maxBlocks:t.maxBlocks??e.maxBlocks,blocks:e.blocks,blockIndexById:e.blockIndexById,toolBlockByCallId:{...e.toolBlockByCallId},activeAssistantBlockByParent:{...e.activeAssistantBlockByParent},activeThoughtBlockByParent:{...e.activeThoughtBlockByParent},trimmedToolNotificationByCallId:{...e.trimmedToolNotificationByCallId},permissionBlockByRequestId:{...e.permissionBlockByRequestId},toolProgress:Object.fromEntries(Object.entries(e.toolProgress).map(([n,s])=>[n,{...s}])),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion}}function sD(e){if(e.blocks.length<=e.maxBlocks)return e;let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(s=>s.id));e.blocks=t,e.blockIndexById=z6(t),Tb.set(e,e.blocks);for(let[s,r]of Object.entries(e.toolBlockByCallId))n.has(r)||(e.toolBlockByCallId[s]=Vd);$K(e);for(let[s]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[s]!==Vd&&delete e.trimmedToolNotificationByCallId[s];for(let[s,r]of Object.entries(e.permissionBlockByRequestId))n.has(r)||(e.permissionBlockByRequestId[s]=Gw);zK(e);for(let s of e.blocks)if(s.kind==="tool"&&s.parentBlockId&&!n.has(s.parentBlockId)){let r=xa(e,s.id);(r==null?void 0:r.kind)==="tool"&&(r.parentBlockId=void 0)}n.has(e.activeUserBlockId??"")||(e.activeUserBlockId=void 0),n.has(e.activeAssistantBlockId??"")||(e.activeAssistantBlockId=void 0),n.has(e.activeThoughtBlockId??"")||(e.activeThoughtBlockId=void 0);for(let[s,r]of Object.entries(e.activeAssistantBlockByParent))n.has(r)||delete e.activeAssistantBlockByParent[s];for(let[s,r]of Object.entries(e.activeThoughtBlockByParent))n.has(r)||delete e.activeThoughtBlockByParent[s];return e}function DK(e){return e.toolCallId===yk||e.toolKind==="updated_plan"}var Tb=new WeakMap;function V6(e){Tb.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},Tb.set(e,e.blocks))}function OK(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){RC(e,i);return}n+=1}s>=0&&t>=n&&RC(e,s)}function RC(e,t){V6(e),e.blocks=e.blocks.slice(0,t),Tb.set(e,e.blocks),BK(e)}function BK(e){e.blockIndexById=z6(e.blocks),e.toolBlockByCallId={},e.permissionBlockByRequestId={},e.trimmedToolNotificationByCallId={},e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent={},e.activeThoughtBlockByParent={},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 Rl(e,t){V6(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function xa(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=PK(s);return V6(e),e.blocks[n]=r,r}function PK(e){return e.kind==="permission"?{...e,options:e.options.map(t=>fl(t)),toolCall:fl(e.toolCall),preview:fl(e.preview)}:e.kind==="tool"?{...e,preview:fl(e.preview),content:fl(e.content),locations:fl(e.locations),rawInput:fl(e.rawInput),rawOutput:fl(e.rawOutput)}:{...e}}function td(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function wh(e,t){t?(F6(e,t),q6(e,t)):(H6(e),e.activeUserBlockId=void 0)}function W6(e,t){return e.length>=xk?e:dg(e+t)}function dg(e){if(e.length<=xk)return e;let t=Math.max(0,xk-IC.length);return`${e.slice(0,t)}${IC}`}function $K(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,r])=>r===Vd).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 zK(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,r])=>r===Gw).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.permissionBlockByRequestId[r]}function fl(e,t=0){return t>bK?e:Array.isArray(e)?e.map(n=>fl(n,t+1)):Ot(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,fl(s,t+1)])):e}function FK(e={}){let t=LC(e),n=new Set,s=!1,r=()=>{for(let o of n)try{o()}catch(a){qK(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=kK(t,a),i())},appendLocalUserMessage(o,a){t=_K(t,o,{images:a}),i()},reset(o={}){t=LC({maxBlocks:o.maxBlocks??t.maxBlocks,...o}),i()},clearAwaitingResync(){t.awaitingResync&&(t={...t,awaitingResync:!1},i())},clearFollowupSuggestion(){t.lastFollowupSuggestion!==void 0&&(t={...t,lastFollowupSuggestion:void 0},i())}}}function qK(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 LC(e){let t=e.blocks?[...e.blocks]:[];return{...wK({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:z6(t),toolBlockByCallId:{...e.toolBlockByCallId??{}},trimmedToolNotificationByCallId:{...e.trimmedToolNotificationByCallId??{}},permissionBlockByRequestId:{...e.permissionBlockByRequestId??{}},toolProgress:{...e.toolProgress??{}},activeAssistantBlockByParent:{...e.activeAssistantBlockByParent??{}},activeThoughtBlockByParent:{...e.activeThoughtBlockByParent??{}},lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}var HK="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function DC(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 l of e.providers)for(const c of l.models){!i&&c.isCurrent&&(i=c.modelId),a===void 0&&(i?c.modelId===i:c.isCurrent)&&(a=c.contextLimit);const d=[l.authType,c.modelId,c.baseUrl??"",c.envKey??""].join("\0");s.has(d)||(s.add(d),r.push({id:c.modelId,baseModelId:c.baseModelId,label:c.name||c.modelId,authType:l.authType,...c.contextLimit!==void 0?{contextWindow:c.contextLimit}:{},...c.modalities!==void 0?{modalities:c.modalities}:{},...c.baseUrl!==void 0?{baseUrl:c.baseUrl}:{},...c.envKey!==void 0?{envKey:c.envKey}:{},...c.isRuntime?{isRuntime:!0}:{}}))}return{models:r,currentModel:i,currentMode:o,contextWindow:a}}function UK(e){var t;const n=Ri((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const s=Tr(n,"currentModelId")??Tr(n,"currentModel"),r=n.availableModels,i=[];let o;if(Array.isArray(r))for(const a of r){const l=Ri(a),c=Tr(l,"modelId")??Tr(l,"id")??Tr(l,"value");if(!c)continue;const d=Ri(l==null?void 0:l._meta),h=g0(d,"contextLimit")??g0(d,"contextWindow")??g0(l,"contextLimit")??g0(l,"contextWindow");o===void 0&&s!==void 0&&c===s&&(o=h),i.push({id:c,baseModelId:Tr(l,"baseModelId")??YK(c),label:Tr(l,"name")??Tr(l,"label")??c,...h!==void 0?{contextWindow:h}:{}})}if(!(!s&&i.length===0))return{models:i,currentModel:s,contextWindow:o}}function rD(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}:{},...aD(s._meta),raw:s}}),n=e.availableSkills.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:iD(t,n),skills:e.availableSkills}}function OC(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 iD(...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 VK(e,t){var n;if(e.type==="session_update"){const s=Ri((n=Ri(e.data))==null?void 0:n.update),r=oD(s);if(r&&t(i=>({...i,tokenUsage:r,tokenCount:G6(r)})),Tr(s,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=KK(s);t(a=>({...a,commands:i,skills:o}))}return}switch(e.type){case"session_metadata_updated":{const s=Ri(e.data);Object.prototype.hasOwnProperty.call(s??{},"displayName")&&t(r=>({...r,displayName:Tr(s,"displayName")}));break}case"model_switched":{const s=Tr(Ri(e.data),"modelId");s&&t(r=>({...r,currentModel:s}));break}case"approval_mode_changed":{const s=Ri(e.data),r=Tr(s,"next")??Tr(s,"mode");r&&t(i=>({...i,currentMode:r}));break}}}function BC(e){const t=Tr(e,"displayName");return t!=null&&t.trim()?t:void 0}function WK(e){var t;const n=Ri((t=e==null?void 0:e.state)==null?void 0:t.modes);return Tr(n,"currentModeId")??Tr(n,"currentMode")}function G6(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 GK(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=Ri((t=Ri(s.data))==null?void 0:t.update),i=oD(r);if(i)return i}catch{}}function oD(e){const t=Ri(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=Ri(t==null?void 0:t.usage),s={...Km(n,"inputTokens"),...Km(n,"outputTokens"),...Km(n,"totalTokens"),...Km(n,"thoughtTokens"),...Km(n,"cachedReadTokens")};return G6(s)!==void 0?s:void 0}function Km(e,t){const n=g0(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function KK(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=Ri(i),l=Tr(a,"name");if(!l)return[];const c=Ri(a==null?void 0:a.input),d={name:l,description:Tr(a,"description")??"",input:c?{hint:Tr(c,"hint")??""}:null,_meta:Ri(a==null?void 0:a._meta)??null};return[{name:l,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...aD(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:iD(n,r),skills:s}}function aD(e){const n=Tr(e??void 0,"source");return{...n?{source:n}:{}}}function Ri(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Tr(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function g0(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function YK(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 PC(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 QK=3e4;function XK(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 tt(e,t,n=QK){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 JK(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 fr(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function ZK(e,t,n="replay",s=80,r){fr(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 eY="qwen-code-webui-client-id:session:";function ux(e,t){if(e)return e;if(typeof window>"u")return dx();try{if(t){const n=window.sessionStorage.getItem(lD(t));if(n)return n}return dx()}catch{return dx()}}function Cy(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(lD(t),e)}catch{}}async function $C(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${tY(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 dx(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function lD(e){return`${eY}${encodeURIComponent(e)}`}function tY(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 nY(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 sY({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:s,pendingSessionLoadRef:r,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:l,passiveAssistantDoneTimerRef:c,getCreateSessionRequest:d,createDetachedSession:h,getConnection:f,hasSessionActivePrompt:m,resetCurrentSessionActivePrompt:g,addNotice:y,setConnection:b,setPromptStatus:w,setRestoreSessionId:v,setRestoreMode:x,setRestoreSessionNonce:C,setAttachSessionNonce:A,setNewSessionNonce:T}){function _(){for(const[,k]of n.current)k.controller.abort();n.current.clear(),s.current.clear(),w("idle"),fr(c),r.current&&(l.current===r.current.sessionId&&(l.current=void 0),clearTimeout(r.current.timeout),r.current.reject(new DOMException("Session cleared","AbortError")),r.current=void 0),e.reset(),v(void 0)}function R(k,j){const N=i.current+1;return i.current=N,r.current&&(clearTimeout(r.current.timeout),r.current.reject(new DOMException(`Session ${j} superseded by a newer request`,"AbortError"))),new Promise(($,F)=>{const B=setTimeout(()=>{var Q;((Q=r.current)==null?void 0:Q.id)===N&&(r.current=void 0,F(gs(y,`${lY(j)} session failed`,new Error(`Session ${j} timed out`),cY(j))))},3e4);r.current={id:N,sessionId:k,mode:j,timeout:B,resolve:$,reject:F}})}function I(k,j){var N;a.current=!1;const L=R(k,j),$=t.current,F=$==null?void 0:$.sessionId,B=F?n.current.get(F):void 0;return(N=B==null?void 0:B.reject)==null||N.call(B,new DOMException("Session switch interrupted prompt wait","AbortError")),F&&n.current.delete(F),g(),$&&$.detach().catch(Q=>{console.warn("[DaemonSessionActions] detach before session switch failed:",Q)}),t.current=void 0,b(Q=>({...Q,status:"connecting",sessionId:k,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),w("idle"),s.current.clear(),fr(c),e.reset(),x(j),v(k),C(Q=>Q+1),L.catch(Q=>{throw y0(Q)||b(Y=>({...Y,loadingTranscript:void 0,catchingUp:void 0})),Q})}return{async sendPrompt(k,j){var N,L,$,F;const B=$s(y,t.current,"Prompt failed","send_prompt"),Q=B.sessionId;if(n.current.has(Q))throw gs(y,"Prompt failed","A prompt is already in progress","send_prompt");fr(c),w("waiting");const Y=new AbortController;n.current.set(Q,{controller:Y});try{const ne=((j==null?void 0:j.images)??[]).map(z=>({data:z.data,mimeType:z.mimeType||z.mediaType||z.media_type||"image/*"}));(j==null?void 0:j.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(k,ne);const P={prompt:PC(k,ne)};j!=null&&j.retry&&(P.retry=!0);const le=await B.submitPrompt(P,Y.signal);return(N=j==null?void 0:j.onAdmitted)==null||N.call(j),await rY(n.current,s.current,Q,Y,le.promptId)}catch(ne){if(y0(ne))return((L=t.current)==null?void 0:L.sessionId)===Q&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw KL(ne)?ne:((($=t.current)==null?void 0:$.sessionId)===Q&&e.dispatch({type:"assistant.done",reason:"error"}),gs(y,"Prompt failed",ne,"send_prompt"))}finally{const ne=n.current.get(Q);(ne==null?void 0:ne.controller)===Y&&n.current.delete(Q),((F=t.current)==null?void 0:F.sessionId)===Q&&!m()&&w("idle")}},async submitPrompt(k,j){var N;const L=$s(y,t.current,"Prompt failed","send_prompt");if(j!=null&&j.sessionId&&L.sessionId!==j.sessionId)throw new Error("Session changed before prompt submission");const $=((j==null?void 0:j.images)??[]).map(Q=>({data:Q.data,mimeType:Q.mimeType||Q.mediaType||Q.media_type||"image/*"}));(j==null?void 0:j.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(k,$);const F={prompt:PC(k,$)};j!=null&&j.retry&&(F.retry=!0);const B=await L.submitPrompt(F);if((N=j==null?void 0:j.signal)!=null&&N.aborted)throw await L.removePendingPrompt(B.promptId).catch(Q=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",Q),y({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:Q instanceof Error?Q.message:String(Q),recoverable:!0})}),j.signal.reason??new DOMException("Aborted","AbortError");return{promptId:B.promptId}},async cancel(){var k,j;const N=$s(y,t.current,"Cancel failed","cancel_prompt"),L=n.current.get(N.sessionId);L==null||L.controller.abort(),fr(c);const $=L?new AbortController:void 0;$&&n.current.set(N.sessionId,{controller:$});try{await tt(N.cancel(),"Cancel timed out")}catch(F){throw gs(y,"Cancel failed",F,"cancel_prompt")}finally{$&&((k=n.current.get(N.sessionId))==null?void 0:k.controller)===$&&n.current.delete(N.sessionId),((j=t.current)==null?void 0:j.sessionId)===N.sessionId&&!m()&&w("idle")}},async setModel(k){const j=$s(y,t.current,"Set model failed","switch_model");try{const N=await tt(j.setModel(k),"Set model timed out");return b(L=>({...L,currentModel:k})),N}catch(N){throw gs(y,"Set model failed",N,"switch_model")}},async setApprovalMode(k,j){const N=$s(y,t.current,"Set approval mode failed","set_approval_mode");try{const L=await tt(N.client.setSessionApprovalMode(N.sessionId,k,{persist:j==null?void 0:j.persist,clientId:N.clientId}),"Set approval mode timed out");return b($=>({...$,currentMode:L.mode||k})),L}catch(L){throw gs(y,"Set approval mode failed",L,"set_approval_mode")}},async respondToPermission(k,j){const N=$s(y,t.current,"Permission response failed","submit_permission");try{return await tt(N.respondToSessionPermission(k,j),"Permission response timed out")}catch(L){throw gs(y,"Permission response failed",L,"submit_permission")}},async submitPermission(k,j,N){const L=$s(y,t.current,"Permission response failed","submit_permission"),$=j!==void 0&&j.length>0?{outcome:{outcome:"selected",optionId:j},...N?{answers:N}:{}}:{outcome:{outcome:"cancelled"},...N?{answers:N}:{}};try{return await tt(L.respondToSessionPermission(k,$),"Permission response timed out")}catch(F){throw gs(y,"Permission response failed",F,"submit_permission")}},async heartbeat(){const k=t.current;if(!(!k||!o.current))return tt(k.heartbeat(),"Heartbeat timed out")},async listSessions(k){const j=t.current;if(!j)return[];try{return await tt(j.client.listWorkspaceSessions(j.workspaceCwd,k),"List sessions timed out")}catch(N){throw gs(y,"List sessions failed",N,"list_sessions")}},async loadSession(k){return I(k,"load")},async resumeSession(k){return I(k,"resume")},async createSession(k){try{a.current=!1;const j=t.current,N=j&&f().sessionId===j.sessionId?j:void 0;if(N){const $=await tt(N.client.createOrAttachSession({...d(),...(k==null?void 0:k.workspaceCwd)!==void 0?{workspaceCwd:k.workspaceCwd}:{}}),"Create session timed out");return Cy($.clientId,$.sessionId),$}const L=await tt(h(k==null?void 0:k.workspaceCwd),"Create session timed out");if(a.current){try{await tt(L.detach(),"Detach cleared session timed out")}catch($){console.warn("[DaemonSessionActions] detach after interrupted create failed:",$)}throw new DOMException("Session creation interrupted","AbortError")}return Cy(L.clientId,L.sessionId),t.current=L,l.current=L.sessionId,b($=>({...$,status:"connected",sessionId:L.sessionId,...L.clientId?{clientId:L.clientId}:{},workspaceCwd:L.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),L}catch(j){throw gs(y,`Create session failed${k!=null&&k.workspaceCwd?` (workspace: ${k.workspaceCwd})`:""}`,j,"create_session")}},async attachSession(){const k=$s(y,t.current,"Attach session failed","attach_session"),j=R(k.sessionId,"attach");return A(N=>N+1),j},async clearSession(){const k=t.current;if(a.current=!0,_(),t.current=void 0,b(j=>nY(j,k==null?void 0:k.sessionId)),k)try{await tt(k.detach(),"Clear session timed out")}catch(j){console.warn("[DaemonSessionActions] detach on clear failed:",j)}},async newSession(){a.current=!1,_(),b(k=>({...k,missingSession:!1,error:void 0,errorStatus:void 0})),T(k=>k+1)},async releaseSession(k){try{const j=$s(y,t.current,"Release session failed","release_session");await tt(j.client.closeSession(k),"Release session timed out")}catch(j){throw gs(y,"Release session failed",j,"release_session")}},async closeSession(){const k=$s(y,t.current,"Close session failed","close_session");try{await tt(k.close(),"Close session timed out")}catch(j){throw gs(y,"Close session failed",j,"close_session")}},async refreshCommands(){const k=$s(y,t.current,"Refresh commands failed","refresh_commands");try{const j=await tt(k.supportedCommands(),"Refresh commands timed out"),{commands:N,skills:L}=rD(j);b($=>({...$,commands:N,skills:L,supportedCommands:j}))}catch(j){throw gs(y,"Refresh commands failed",j,"refresh_commands")}},async getContext(){const k=$s(y,t.current,"Load context failed","load_context");try{const j=await tt(k.context(),"Load context timed out");return b(N=>({...N,context:j,currentMode:iY(j)??N.currentMode,currentModel:oY(j)??N.currentModel})),j}catch(j){throw gs(y,"Load context failed",j,"load_context")}},async getContextUsage(k){const j=$s(y,t.current,"Load context usage failed","load_context_usage");try{return await tt(j.contextUsage(k),"Load context usage timed out")}catch(N){throw gs(y,"Load context usage failed",N,"load_context_usage")}},async renameSession(k){const j=$s(y,t.current,"Rename session failed","rename_session");try{return await tt(j.updateMetadata({displayName:k}),"Rename session timed out")}catch(N){throw gs(y,"Rename session failed",N,"rename_session")}},async recapSession(){const k=$s(y,t.current,"Recap session failed","recap_session");try{return await tt(k.recap(),"Recap session timed out")}catch(j){throw gs(y,"Recap session failed",j,"recap_session")}},async getRewindSnapshots(){const k=$s(y,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await tt(k.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(j){throw gs(y,"Load rewind snapshots failed",j,"rewind_snapshots")}},async rewindSession(k,j){const N=$s(y,t.current,"Rewind session failed","rewind_session");try{return await tt(N.rewind(k,j),"Rewind session timed out")}catch(L){throw gs(y,"Rewind session failed",L,"rewind_session")}},async btwSession(k,j){var N;const L=$s(y,t.current,"Side question failed","btw_session");try{return await tt(L.btw(k,j),"Side question timed out")}catch($){throw(N=j==null?void 0:j.signal)!=null&&N.aborted||y0($)?$:gs(y,"Side question failed",$,"btw_session")}},async enqueueMidTurnMessage(k,j){const N=t.current;if(!N)return{accepted:!1};try{return await N.enqueueMidTurnMessage(k,j)}catch(L){return L instanceof DOMException&&L.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",L),{accepted:!1}}},async getPendingPrompts(k){const j=t.current;if(!j)return{pendingPrompts:[]};if(k!=null&&k.sessionId&&j.sessionId!==k.sessionId)throw new Error("Session changed before pending prompts refresh");return await j.getPendingPrompts()},async removePendingPrompt(k,j){const N=t.current;return N?j!=null&&j.sessionId&&N.sessionId!==j.sessionId?await N.client.removePendingPrompt(j.sessionId,k):await N.removePendingPrompt(k):{removed:!1}},async sendShellCommand(k){var j,N;const L=$s(y,t.current,"Shell command failed","send_shell_command"),$=`${L.sessionId}:shell`;w("waiting");const F=new AbortController;n.current.set($,{controller:F});try{return await L.shellCommand(k,F.signal)}catch(B){throw gs(y,"Shell command failed",B,"send_shell_command")}finally{((j=n.current.get($))==null?void 0:j.controller)===F&&n.current.delete($),((N=t.current)==null?void 0:N.sessionId)===L.sessionId&&!m()&&w("idle")}},async getTasks(){const k=$s(y,t.current,"Get tasks failed","load_tasks");try{return await tt(k.tasks(),"Get tasks timed out")}catch(j){throw gs(y,"Get tasks failed",j,"load_tasks")}},async cancelTask(k,j){const N=$s(y,t.current,"Cancel task failed","cancel_task");try{return await tt(N.cancelTask(k,j),"Cancel task timed out")}catch(L){throw gs(y,"Cancel task failed",L,"cancel_task")}},async clearGoal(){const k=$s(y,t.current,"Clear goal failed","clear_goal");try{return await tt(k.clearGoal(),"Clear goal timed out")}catch(j){throw gs(y,"Clear goal failed",j,"clear_goal")}},async getStats(){const k=$s(y,t.current,"Load stats failed","load_stats");try{return await tt(k.stats(),"Load stats timed out")}catch(j){throw gs(y,"Load stats failed",j,"load_stats")}},async respondToGlobalPermission(k,j){const N=$s(y,t.current,"Global permission response failed","submit_permission");try{return await tt(N.client.respondToPermission(k,j),"Global permission response timed out")}catch(L){throw gs(y,"Global permission response failed",L,"submit_permission")}},async branchSession(k){const j=$s(y,t.current,"Branch session failed","branch_session");try{const N=await tt(j.client.branchSession(j.sessionId,{name:k},j.clientId),"Branch session timed out");return Cy(N.clientId,N.sessionId),I(N.sessionId,"load").catch(L=>{y0(L)||gs(y,"Branch session failed",L,"branch_session")}),{sessionId:N.sessionId,displayName:N.displayName}}catch(N){throw gs(y,"Branch session failed",N,"branch_session")}},async forkSession(k){const j=$s(y,t.current,"Fork session failed","fork_session");try{return await tt(j.fork(k),"Fork session timed out")}catch(N){throw gs(y,"Fork session failed",N,"fork_session")}}}}function rY(e,t,n,s,r){return new Promise((i,o)=>{const a=kk(n,r),l=t.get(a);if(l){t.delete(a),l.status==="resolved"?i(l.result):o(l.error);return}const c=e.get(n);if((c==null?void 0:c.controller)!==s){o(new DOMException("Aborted","AbortError"));return}if(c.promptId!==void 0&&c.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 f=e.get(n);(f==null?void 0:f.controller)===s&&e.delete(n),d(),o(s.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...c,promptId:r,resolve:f=>{d(),i(f)},reject:f=>{d(),o(f)}}),s.signal.addEventListener("abort",h,{once:!0})})}function kk(e,t){return JSON.stringify([e,t])}function iY(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 oY(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 $s(e,t,n,s){if(!t)throw gs(e,n,"Daemon session is not connected",s);return t}function gs(e,t,n,s){if(y0(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}),aY(n instanceof Error?n:new Error(r))}function y0(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function aY(e){return Object.assign(e,{_alreadyDispatched:!0})}function lY(e){return e.charAt(0).toUpperCase()+e.slice(1)}function cY(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const uY=33e4;function dY({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:s}){return{async listSessions(r){const i=Pt(e,"List sessions failed"),o=t();return o?tt(i.listWorkspaceSessionsPage(o,r).then(a=>a.sessions),"List sessions timed out"):[]},async listSessionsPage(r){const i=Pt(e,"List sessions failed"),o=t();return o?tt(i.listWorkspaceSessionsPage(o,r),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const r=Pt(e,"List session groups failed"),i=t();return i?tt(r.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(r){const i=Pt(e,"Create session group failed"),o=hx(t);return tt(i.createSessionGroup(o,r),"Create session group timed out")},async updateSessionGroup(r,i){const o=Pt(e,"Update session group failed"),a=hx(t);return tt(o.updateSessionGroup(a,r,i),"Update session group timed out")},async deleteSessionGroup(r){const i=Pt(e,"Delete session group failed"),o=hx(t);return tt(i.deleteSessionGroup(o,r),"Delete session group timed out")},async updateSessionOrganization(r,i){const o=Pt(e,"Update session organization failed");return tt(o.updateSessionOrganization(r,i),"Update session organization timed out")},async deleteSession(r){const i=Pt(e,"Delete session failed"),o=await tt(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=Pt(e,"Delete sessions failed");return tt(i.deleteSessionsData(r),"Delete sessions timed out")},async exportSession(r,i="html"){const o=Pt(e,"Export session failed");return tt(o.exportSession(r,{format:i}),"Export session timed out")},async archiveSession(r){const i=Pt(e,"Archive session failed"),o=await tt(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=Pt(e,"Unarchive session failed"),o=await tt(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=Pt(e,"Load MCP status failed");return tt(r.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(r){const i=Pt(e,"Load MCP tools failed");try{return await tt(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=Pt(e,"Load MCP resources failed");try{return await tt(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=Pt(e,"Restart MCP server failed");return tt(i.restartMcpServer(r),"Restart MCP server timed out",5*6e4)},async manageMcpServer(r,i){const o=Pt(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return tt(o.manageMcpServer(r,i),"Manage MCP server timed out",a)},async loadDaemonStatus(r){const i=Pt(e,"Load daemon status failed");return tt(i.daemonStatus(r),"Load daemon status timed out")},async loadUsageDashboard(r){const i=Pt(e,"Load usage dashboard failed");return tt(i.usageDashboard(r),"Load usage dashboard timed out")},async loadSkillsStatus(){const r=Pt(e,"Load skills failed");return tt(r.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const r=Pt(e,"Load extensions failed");return tt(r.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const r=Pt(e,"Load tools failed");return tt(r.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(r,i){const o=Pt(e,"Set tool enabled failed");return tt(o.setWorkspaceToolEnabled(r,i),"Set tool enabled timed out")},async loadSettingsStatus(){const r=Pt(e,"Load settings failed");return tt(r.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(r,i,o){const a=Pt(e,"Set setting failed");return tt(a.setWorkspaceSetting(r,i,o),"Set setting timed out")},async loadMemoryStatus(){const r=Pt(e,"Load memory failed");return tt(r.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(r){const i=Pt(e,"Read workspace file failed");return tt(i.readWorkspaceFile(r),"Read workspace file timed out")},async writeMemory(r){const i=Pt(e,"Write memory failed");return tt(i.writeWorkspaceMemory(r),"Write memory timed out")},async listAgents(){const r=Pt(e,"List agents failed");return tt(r.listWorkspaceAgents(),"List agents timed out")},async getAgent(r){const i=Pt(e,"Get agent failed");return tt(i.getWorkspaceAgent(r),"Get agent timed out")},async createAgent(r){const i=Pt(e,"Create agent failed");return tt(i.createWorkspaceAgent(r),"Create agent timed out")},async generateAgent(r){const i=Pt(e,"Generate agent failed");return tt(i.generateWorkspaceAgent(r),"Generate agent timed out",uY)},async deleteAgent(r,i){const o=Pt(e,"Delete agent failed");return tt(o.deleteWorkspaceAgent(r,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(r,i){Pt(e,"Glob workspace failed");const o=Fc(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 tt(fetch(qc(o,n),{headers:Ym(s)}),"Glob workspace timed out");if(!a.ok)throw new Error(await Hc(a,"GET /glob"));const l=await a.json();return{matches:Array.isArray(l.matches)?l.matches.filter(c=>typeof c=="string"):[]}},async loadProviders(){const r=Pt(e,"Load providers failed");return tt(r.workspaceProviders(),"Load providers timed out")},async readFileBytes(r,i){const o=Pt(e,"Read file bytes failed");return tt(o.readWorkspaceFileBytes(r,i??{}),"Read file bytes timed out")},async writeFile(r){const i=Pt(e,"Write file failed");return tt(i.writeWorkspaceFile(r),"Write file timed out")},async editFile(r){const i=Pt(e,"Edit file failed");return tt(i.editWorkspaceFile(r),"Edit file timed out")},async stat(r){Pt(e,"Stat file failed");const i=Fc(n,"/stat");i.searchParams.set("path",r);const o=await tt(fetch(qc(i,n),{headers:Ym(s)}),"Stat file timed out");if(!o.ok)throw new Error(await Hc(o,"GET /stat"));return await o.json()},async listDirectory(r){Pt(e,"List directory failed");const i=Fc(n,"/list");i.searchParams.set("path",r);const o=await tt(fetch(qc(i,n),{headers:Ym(s)}),"List directory timed out");if(!o.ok)throw new Error(await Hc(o,"GET /list"));return await o.json()},async listScheduledTasks(){Pt(e,"List scheduled tasks failed");const r=Fc(n,"/scheduled-tasks"),i=await tt(fetch(qc(r,n),{headers:Ym(s)}),"List scheduled tasks timed out");if(!i.ok)throw new Error(await Hc(i,"GET /scheduled-tasks"));const o=await i.json();return Array.isArray(o.tasks)?o.tasks:[]},async createScheduledTask(r){Pt(e,"Create scheduled task failed");const i=Fc(n,"/scheduled-tasks"),o=await tt(fetch(qc(i,n),{method:"POST",headers:fx(s),body:JSON.stringify(r)}),"Create scheduled task timed out");if(!o.ok)throw new Error(await Hc(o,"POST /scheduled-tasks"));return await o.json()},async updateScheduledTask(r,i){Pt(e,"Update scheduled task failed");const o=Fc(n,`/scheduled-tasks/${encodeURIComponent(r)}`),a=await tt(fetch(qc(o,n),{method:"PATCH",headers:fx(s),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!a.ok)throw new Error(await Hc(a,`PATCH /scheduled-tasks/${r}`));return await a.json()},async runScheduledTask(r){Pt(e,"Run scheduled task failed");const i=Fc(n,`/scheduled-tasks/${encodeURIComponent(r)}/run`),o=await tt(fetch(qc(i,n),{method:"POST",headers:fx(s)}),"Run scheduled task timed out");if(!o.ok)throw new Error(await Hc(o,`POST /scheduled-tasks/${r}/run`));return await o.json()},async deleteScheduledTask(r){Pt(e,"Delete scheduled task failed");const i=Fc(n,`/scheduled-tasks/${encodeURIComponent(r)}`),o=await tt(fetch(qc(i,n),{method:"DELETE",headers:Ym(s)}),"Delete scheduled task timed out");if(!o.ok)throw new Error(await Hc(o,`DELETE /scheduled-tasks/${r}`))},async loadEnv(){const r=Pt(e,"Load env failed");return tt(r.workspaceEnv(),"Load env timed out")},async loadPreflight(){const r=Pt(e,"Load preflight failed");return tt(r.workspacePreflight(),"Load preflight timed out")},async initWorkspace(r){const i=Pt(e,"Init workspace failed");return tt(i.initWorkspace(r),"Init workspace timed out")},async updateAgent(r,i,o){const a=Pt(e,"Update agent failed");return tt(a.updateWorkspaceAgent(r,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(r,i){const o=Pt(e,"Install extension failed");return tt(o.installExtension(r,i),"Install extension timed out")},async extensionOperationStatus(r){const i=Pt(e,"Load extension operation failed");return tt(i.extensionOperationStatus(r),"Load extension operation timed out")},async checkExtensionUpdates(r){const i=Pt(e,"Check extension updates failed");return tt(i.checkExtensionUpdates(r),"Check extension updates timed out")},async refreshExtensions(r){const i=Pt(e,"Refresh extensions failed");return tt(i.refreshExtensions(r),"Refresh extensions timed out")},async enableExtension(r,i,o){const a=Pt(e,"Enable extension failed");return tt(a.enableExtension(r,i,o),"Enable extension timed out")},async disableExtension(r,i,o){const a=Pt(e,"Disable extension failed");return tt(a.disableExtension(r,i,o),"Disable extension timed out")},async updateExtension(r,i){const o=Pt(e,"Update extension failed");return tt(o.updateExtension(r,i),"Update extension timed out")},async uninstallExtension(r,i){const o=Pt(e,"Uninstall extension failed");return tt(o.uninstallExtension(r,i),"Uninstall extension timed out")},async startDeviceFlow(r){const i=Pt(e,"Start device flow failed");return tt(i.startDeviceFlow({providerId:r}),"Start device flow timed out")},async getDeviceFlow(r,i){const o=Pt(e,"Get device flow failed");return tt(o.getDeviceFlow(r,i),"Get device flow timed out")},async cancelDeviceFlow(r){const i=Pt(e,"Cancel device flow failed");return tt(i.cancelDeviceFlow(r),"Cancel device flow timed out")},async getAuthStatus(){const r=Pt(e,"Get auth status failed");return tt(r.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const r=Pt(e,"Get auth providers failed");return tt(r.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(r){const i=Pt(e,"Install auth provider failed");return tt(i.installAuthProvider(r),"Install auth provider timed out")},async addWorkspace(r){const i=Pt(e,"Add workspace failed");return tt(i.addWorkspace(r),"Add workspace timed out")}}}function Pt(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function hx(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function Ym(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function fx(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Fc(e,t){const n=cD(e),s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,s)}function qc(e,t){return cD(t)?e.toString():`${e.pathname}${e.search}`}function cD(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 Hc(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 K6=p.createContext(void 0);let Qm;function hY({baseUrl:e,token:t,workspaceCwd:n,autoConnect:s=!0,transport:r,children:i}){const o=p.useMemo(()=>s?new gk({baseUrl:e,token:t,transport:r}):void 0,[s,e,t,r]),a=p.useRef(o);a.current=o;const l=p.useRef(void 0),c=p.useRef(void 0),d=p.useRef(n),[h,f]=p.useState(void 0),[m,g]=p.useState(s?"connecting":"idle"),[y,b]=p.useState(void 0),w=p.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(l.current!==o&&(l.current=o,c.current=void 0),!c.current){const A=o.capabilities().catch(T=>{throw c.current===A&&(c.current=void 0),T});c.current=A}return c.current},[o]),v=p.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));l.current=o;const A=o.capabilities().catch(T=>{throw c.current===A&&(c.current=void 0,b(T instanceof Error?T:new Error(String(T))),g("error")),T});return c.current=A,A.then(T=>(l.current===o&&c.current===A&&(f(T),g("connected"),b(void 0)),T))},[o]);p.useEffect(()=>{if(!o)return;g("connecting"),b(void 0),f(void 0),Qm===o&&(Qm=void 0);let A=!1;return w().then(T=>{A||(f(T),g("connected"))}).catch(T=>{A||(b(T instanceof Error?T:new Error(String(T))),g("error"))}),()=>{A=!0,Qm=o,queueMicrotask(()=>{Qm===o&&(Qm=void 0,o.dispose())})}},[o,w]),d.current=(h==null?void 0:h.workspaceCwd)??n;const x=p.useMemo(()=>dY({getClient:()=>a.current,getWorkspaceCwd:()=>d.current,baseUrl:e,token:t}),[e,t]),C=p.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(h==null?void 0:h.workspaceCwd)??n,status:m,error:y,capabilities:h,getCapabilities:w,refreshCapabilities:v,actions:x}},[o,t,e,n,m,y,h,w,v,x]);return u.jsx(K6.Provider,{value:C,children:i})}function Yw(){const e=p.useContext(K6);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function Sa(){return Yw().actions}function uD(){return p.useContext(K6)}function fY(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&zC(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&zC(t)||(t==null?void 0:t.kind)==="tool"&&FC(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"&&FC(s))return"responding"}return"idle"}function mY(e,t){const n=fY(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function zC(e){return e.streaming===!0}function FC(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Sk=new Set;let Cb;function qC(){return Cb}function pY(e){return Sk.add(e),()=>{Sk.delete(e)}}function gY(e){Cb={...e},dD()}function h1(){Cb!==void 0&&(Cb=void 0,dD())}function dD(){for(const e of Sk)e()}function yY(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 Tk=new Set,hD=Object.freeze([]),mx=64;let yu=hD;function HC(){return yu}function bY(e){return Tk.add(e),()=>{Tk.delete(e)}}function wY(e){const t=[...yu,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>mx){const n=t.length-mx;console.debug(`[mid-turn] sidechannel buffer over ${mx}; evicting ${n} oldest batch(es)`),yu=t.slice(n)}else yu=t;fD()}function vY(e){if(e.length===0||yu.length===0)return;const t=new Set(e),n=yu.filter(s=>!t.has(s));n.length!==yu.length&&(yu=n.length===0?hD:n,fD())}function fD(){for(const e of Tk)e()}function xY(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==YL)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(l=>typeof l=="string"&&l.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 Ck=new Set,Ak=new Set;let mD=0,Af=[];function _Y(){return mD}function UC(){return Af}function kY(e){return Ck.add(e),()=>{Ck.delete(e)}}function SY(e){return Ak.add(e),()=>{Ak.delete(e)}}function TY(){mD++;for(const e of Ck)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function pD(){for(const e of Ak)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function CY(e){if(e.length===0)return;const t=new Set(e),n=Af.filter(s=>!t.has(s));n.length!==Af.length&&(Af=n,pD())}function AY(e){const t=gD(e);return t?(Af=[...Af,t].slice(-200),pD(),(t.type===O6||t.type===B6||t.type===P6)&&TY(),!0):!1}function EY(e){return gD(e)!==void 0}function gD(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===O6||n===B6||n===P6)&&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 yD=[404,410],MY=new Set(yD);function V0(e){return e!==void 0&&MY.has(e)}function sl(e,t){return V0(t)&&!V0(e)?t:e}function Zc(e,t){const n=JL(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const bD=p.createContext(void 0),wD=p.createContext(void 0),Y6=p.createContext(void 0),vD=p.createContext(void 0),xD=p.createContext(void 0),_D=p.createContext(void 0),Q6=new Set([401,403]),NY=new Set([...Q6,...yD]),IY=2e5,jY={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,initVersion:0,authVersion:0},RY=Symbol("unhandled session");function kD(e){const{baseUrl:t,token:n,workspaceCwd:s,sessionId:r,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:l=IY,suppressOwnUserEcho:c=!0,includeRawEvent:d=!1,autoConnect:h=!0,autoReconnect:f=!0,reconnectDelayMs:m=1e3,maxReconnectDelayMs:g=1e4,heartbeatIntervalMs:y=3e4,heartbeatFailureThreshold:b=3,loadWarnings:w,children:v}=e,x=uD(),C=t??(x==null?void 0:x.baseUrl),A=n??(x==null?void 0:x.token),T=s??(x==null?void 0:x.workspaceCwd),_=p.useRef(x==null?void 0:x.client);_.current=x==null?void 0:x.client;const R=p.useRef(x==null?void 0:x.capabilities);R.current=x==null?void 0:x.capabilities;const I=p.useRef(x==null?void 0:x.getCapabilities);I.current=x==null?void 0:x.getCapabilities;const k=p.useRef(!1),N=p.useRef(r).current,L=N===void 0,$=p.useRef(T);$.current=T;const F=p.useRef(T);T&&(F.current=T);const B=p.useMemo(()=>FK({maxBlocks:l}),[l]),Q=p.useRef(void 0),Y=p.useRef(void 0),ne=p.useRef(new Map),P=p.useRef(new Map),le=p.useRef(void 0),z=p.useRef(0),M=p.useRef(void 0),re=p.useRef(!1),U=p.useRef({consecutiveFailures:0}),W=p.useRef(!1),J=p.useRef(void 0),G=p.useRef(new WeakSet),te=p.useRef({suppressOwnUserEcho:c,includeRawEvent:d}),H=p.useRef({reconnectDelayMs:m,maxReconnectDelayMs:g}),ie=p.useRef(w),fe=p.useRef(void 0);(!fe.current||i)&&(fe.current=ux(i)),te.current={suppressOwnUserEcho:c,includeRawEvent:d},H.current={reconnectDelayMs:m,maxReconnectDelayMs:g},ie.current=w;const Ne=o==null?void 0:o.modelServiceId,Ie=o==null?void 0:o.sessionScope,Ce=p.useRef(o);Ce.current=o;const[ve,ut]=p.useState("idle"),[ae,Ct]=p.useState(N),[Ke,on]=p.useState("load"),[qt,gt]=p.useState(0),[St,ft]=p.useState(0),[de,_e]=p.useState(0),[Ue,Xe]=p.useState({status:h?"connecting":"idle",...N?{sessionId:N}:{}}),yt=p.useRef(Ue);yt.current=Ue;const ye=p.useRef(0),[Kt,Ee]=p.useState([]),ct=p.useCallback(Ut=>{const vn={...Ut,id:Ut.id??`daemon-notice-${Date.now()}-${++ye.current}`,createdAt:Ut.createdAt??Date.now()};return Ee(tn=>[...tn.slice(-49),vn]),vn},[]),qn=p.useCallback(Ut=>{Ee(vn=>vn.filter(tn=>tn.id!==Ut))},[]),Me=p.useCallback(()=>{Ee([])},[]),qe=p.useMemo(()=>({notices:Kt,dismissNotice:qn,clearNotices:Me}),[Me,qn,Kt]),[Fe,Ht]=p.useState(jY),Mn=p.useRef(()=>!1),Rn=p.useRef(!1);p.useEffect(()=>(Rn.current=!0,()=>{Rn.current=!1}),[]),p.useEffect(()=>{if(!h)return;if(!_.current&&!C){Xe({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Ut=new AbortController;let vn=!1;return(async()=>{var Jt,Nn,fn,Pn,Gn,Hn,qs,br,Dn,ln,Es;const Te=_.current??new gk({baseUrl:C,token:A});let Ye,_t,Bt=ae,bn=!ae&&de>0,ws=0,Zs=()=>!1,Ir=!1;for(;!vn&&!Ut.signal.aborted;){let Ur=!1;try{let xe=!1,wt=!1,oe=!1,ue=!1,be,lt;if(!Ye){const Se=Q.current;Se&&!ae&&!Bt&&!bn&&(Ye=Se,Bt=Se.sessionId,Y.current=Se.sessionId,ue=!0)}if(!Ye){Xe(rs=>({...rs,status:"connecting",error:void 0,errorStatus:sl(void 0,rs.errorStatus)}));const Se=I.current,dt=R.current??(Se?await Se():await Te.capabilities());if(vn||Ut.signal.aborted)return;_t=dt,re.current=Array.isArray(dt.features)&&dt.features.includes("client_heartbeat");const $t=$.current??dt.workspaceCwd;if(F.current=$t,(L||W.current)&&!ae&&!Bt&&!bn){const[rs,ms,es]=await Promise.allSettled([Te.workspaceProviders(),Te.workspaceSkills(),Te.workspaceAcpStatus()]);rs.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",rs.reason),ms.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",ms.reason),es.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",es.reason);const Vr=rs.status==="fulfilled"?rs.value:void 0,De=DC(Vr),{commands:vt,skills:Vt}=OC(ms.status==="fulfilled"?ms.value:void 0),nn=ms.status==="rejected"||W.current&&vt.length===0;Xe(Yt=>({...Yt,status:"connected",workspaceCwd:$t,models:De.models,currentModel:De.currentModel,currentMode:De.currentMode,contextWindow:De.contextWindow,providers:Vr,capabilities:dt,commands:nn?Yt.commands:vt,skills:nn?Yt.skills:Vt})),es.status==="fulfilled"&&!es.value.channelLive&&!k.current&&(k.current=!0,(async()=>{try{const Yt=await Te.workspaceAcpPreheat(5e3);if(vn||Ut.signal.aborted||!Yt.ready||yt.current.sessionId)return;const mn=await Te.workspaceSkills();if(vn||Ut.signal.aborted||yt.current.sessionId)return;const{commands:_n,skills:Ks}=OC(mn);Xe(dr=>dr.sessionId?dr:{...dr,commands:_n,skills:Ks})}catch(Yt){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",Yt)}finally{k.current=!1}})());return}const Xn=ae&&Ke==="resume"?Gm.resume:Gm.load,Tn=ae??Bt,ss=i?fe.current:ux(void 0,Tn);Ur=!!ae,Tn&&Xe(rs=>({...rs,sessionId:Tn,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const Yn=ae?await Xn(Te,ae,{workspaceCwd:$t},ss):Bt?await Gm.load(Te,Bt,{workspaceCwd:$t},ss):await Gm.createOrAttach(Te,{...Ne!==void 0?{modelServiceId:Ne}:{},...bn?{sessionScope:"thread"}:Ie!==void 0?{sessionScope:Ie}:{},workspaceCwd:$t},ss);if(Ur=!1,!i&&Yn.clientId&&(fe.current=Yn.clientId,Cy(Yn.clientId,Yn.sessionId)),vn||Ut.signal.aborted){$C({baseUrl:C,token:A,sessionId:Yn.sessionId,clientId:Yn.clientId}).catch(rs=>console.warn("[DaemonSessionProvider] detach failed:",rs));return}const xn=Y.current;xn!==Yn.sessionId&&Me(),xn!==void 0&&Yn.sessionId!==xn?(ut("idle"),fr(M),oe=!0):xn!==void 0&&(Yn.replaySnapshot.compactedReplay.length+Yn.replaySnapshot.liveJournal.length>0?(ut("idle"),fr(M),oe=!0):(B.dispatch({type:"assistant.done",reason:"reconnected"}),B.getSnapshot().awaitingResync&&B.clearAwaitingResync())),xe=xn!==void 0&&xn===Yn.sessionId,wt=Yn.replaySnapshot.compactedReplay.length>0||Yn.replaySnapshot.liveJournal.length>0;const jr=[...Yn.replaySnapshot.compactedReplay,...Yn.replaySnapshot.liveJournal];be=GK(jr),lt=G6(be),Ye=Yn,Bt=Ye.sessionId,bn=!1,Y.current=Ye.sessionId,Q.current=Ye}const Re=Ye,Nt=G.current.has(Re);let bt=Re.hasActivePrompt===!0&&!Nt;const rn=()=>{G.current.add(Re),bt=!1},Kn=()=>bt||ne.current.has(Re.sessionId);Zs=Kn,Mn.current=Kn,ut(Kn()?"streaming":"idle");const er=le.current,vs=(er==null?void 0:er.sessionId)===Re.sessionId?er:void 0,{compactedReplay:tr,liveJournal:ni}=Re.replaySnapshot,ns=[...tr,...ni],bi=wt&&ns.length>0;if(oe&&!bi&&B.reset(),bi){const Se={...te.current,suppressOwnUserEcho:!1},dt=[];for(const $t of ns)try{const Xn=WC($t,Re.clientId,Se,Xe,{updateConnection:!1});if(dt.push(...GC($t,Xn,ct)),$t.type==="turn_complete"){const Tn=((Jt=$t.data)==null?void 0:Jt.stopReason)??"end_turn";dt.push(Zc($t,Tn))}else $t.type==="turn_error"&&dt.push(Zc($t,"error"))}catch(Xn){const Tn=Xn instanceof Error?Xn.message:String(Xn);ct({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Tn,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",Xn)}oe&&B.reset(),dt.length>0&&(B.dispatch(dt),YC(dt,Ht));for(const $t of ns)VC(ne.current,P.current,Re.sessionId,$t,B,ut,M,{requireBoundPromptId:!0});Xe($t=>({...$t,catchingUp:void 0}))}Xe(Se=>({...Se,status:"connected",sessionId:Re.sessionId,...Re.clientId?{clientId:Re.clientId}:{},workspaceCwd:Re.workspaceCwd,displayName:BC(Re.state)??(Se.sessionId===Re.sessionId?Se.displayName:void 0),tokenUsage:be!==void 0?be:Se.sessionId===Re.sessionId?Se.tokenUsage:void 0,tokenCount:lt!==void 0?lt:Se.sessionId===Re.sessionId?Se.tokenCount??0:0,loadingTranscript:void 0,catchingUp:bi?Se.catchingUp:xe||Re.lastEventId!=null||void 0})),vs&&(le.current=void 0,clearTimeout(vs.timeout),J.current===Re.sessionId&&(J.current=void 0),vs.resolve());const Aa=ue&&yt.current.commands!==void 0&&yt.current.skills!==void 0&&yt.current.supportedCommands!==void 0&&yt.current.context!==void 0,[Ao,Eo,io]=Aa?[void 0,void 0,void 0]:await Promise.allSettled([Te.workspaceProviders(),Re.supportedCommands(),Re.context()]),Ea=(Ao==null?void 0:Ao.status)==="fulfilled"?Ao.value:void 0,oo=(Eo==null?void 0:Eo.status)==="fulfilled"?Eo.value:void 0,wi=(io==null?void 0:io.status)==="fulfilled"?io.value:void 0,vi=[(Ao==null?void 0:Ao.status)==="rejected"?(Nn=ie.current)==null?void 0:Nn.models:void 0,(Eo==null?void 0:Eo.status)==="rejected"?(fn=ie.current)==null?void 0:fn.commands:void 0,(io==null?void 0:io.status)==="rejected"?(Pn=ie.current)==null?void 0:Pn.context:void 0].filter(Se=>!!Se),xi=DC(Ea),Ss=UK(wi),ao=Ss&&Ss.models.length>0?Ss.models:xi.models,Mo=(Ss==null?void 0:Ss.currentModel)??xi.currentModel,Ka=Mo===xi.currentModel?xi.contextWindow:(Gn=xi.models.find(Se=>Se.id===Mo))==null?void 0:Gn.contextWindow,Oc=(Ss==null?void 0:Ss.contextWindow)??((Hn=ao.find(Se=>Se.id===Mo))==null?void 0:Hn.contextWindow)??Ka,{commands:Ma,skills:si}=rD(oo),se=WK(wi)??xi.currentMode;Xe(Se=>Se.sessionId!==Re.sessionId?Se:{...Se,status:"connected",sessionId:Re.sessionId,...Re.clientId?{clientId:Re.clientId}:{},workspaceCwd:Re.workspaceCwd,commands:oo!==void 0?Ma:Se.commands,skills:oo!==void 0?si:Se.skills,models:ao.length>0?ao:Se.models,currentModel:Mo??Se.currentModel,currentMode:se??Se.currentMode,displayName:BC(Re.state)??Se.displayName,contextWindow:Oc??Se.contextWindow,providers:Ea??Se.providers,supportedCommands:oo??Se.supportedCommands,context:wi??Se.context,capabilities:_t??Se.capabilities,loadingTranscript:void 0,catchingUp:bi?Se.catchingUp:xe||Re.lastEventId!=null||void 0}),vi.length>0&&B.dispatch(vi.map(Se=>({type:"status",text:Se})));let me=!1,Oe=!1;const et=()=>{const Se=ne.current.get(Re.sessionId);Se==null||Se.controller.abort(),ne.current.delete(Re.sessionId),bt&&rn(),fr(M),ut("idle"),B.reset(),Re.setLastEventId(0),Bt=Re.sessionId,Oe=!0,Ye=void 0,Q.current=void 0,Mn.current=()=>!1,Xe(dt=>({...dt,status:"connecting",error:void 0,errorStatus:sl(void 0,dt.errorStatus)}))};for await(const Se of Re.events({signal:Ut.signal,maxQueued:a})){if(((qs=Q.current)==null?void 0:qs.sessionId)!==Re.sessionId)break;me||(me=!0,ws=0);try{const dt=yY(Se);if(dt){gY(dt);continue}const $t=xY(Se);$t&&wY($t),EY(Se)&&(AY(Se),Se.type==="pending_prompt_started"&&(fr(M),ut("waiting")));const Xn=WC(Se,Re.clientId,te.current,Xe),Tn=GC(Se,Xn,ct);if(Se.type==="state_resync_required"&&(typeof Se.data=="object"&&Se.data!==null?Se.data.reason:void 0)==="epoch_reset"){et();break}if(YC(Tn,Ht),Tn.length>0){const ms=px(Tn);ut(es=>es==="waiting"||es==="idle"&&ms?"streaming":es)}const ss=VC(ne.current,P.current,Re.sessionId,Se,B,ut,M);let Yn=!1;if(!ss&&bt&&(Se.type==="turn_complete"||Se.type==="turn_error")){rn(),Yn=!0,fr(M);const ms=Se.type==="turn_complete"?((br=Se.data)==null?void 0:br.stopReason)??"end_turn":"error";B.dispatch(Zc(Se,ms)),Kn()||ut("idle")}const jr=!Kn()&&B.getSnapshot().activeAssistantBlockId!=null?Tn.filter(ms=>ms.type!=="debug"):Tn;B.dispatch(jr);for(const ms of Tn)if(ms.type==="prompt.cancelled"&&(bt||ms.originatorClientId!==Re.clientId)){B.dispatch(Zc(Se,"cancelled"));const es=bt;rn(),Yn=!0,fr(M),es||ne.current.delete(Re.sessionId),Kn()||ut("idle")}else ms.type==="session.replay_complete"&&(Xe(es=>({...es,catchingUp:void 0})),B.getSnapshot().awaitingResync&&B.clearAwaitingResync(),Kn()||(fr(M),B.dispatch({type:"assistant.done",reason:"replay_complete"}),ut("idle")));const rs=!ss&&!Yn&&!Kn();if(rs&&(Tn.some(es=>es.type==="user.text.delta")?ut("waiting"):px(Tn)&&ut(es=>es==="idle"?"streaming":es)),rs&&Se.type==="turn_complete"){fr(M);const ms=((Dn=Se.data)==null?void 0:Dn.stopReason)??"end_turn";B.dispatch(Zc(Se,ms)),ut("idle")}else rs&&Se.type==="turn_error"?(fr(M),B.dispatch(Zc(Se,"error")),ut("idle")):rs&&px(Tn)&&ZK(B,M,"passive_observer",3e3,()=>ut("idle"));if(Se.type==="state_resync_required"&&(typeof Se.data=="object"&&Se.data!==null?Se.data.reason:void 0)!=="epoch_reset"){Kn()||(ut("idle"),fr(M)),B.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",Re.sessionId),Oe=!0,Ye=void 0,Q.current=void 0,Mn.current=()=>!1,Xe(es=>({...es,status:"connecting",error:void 0,errorStatus:sl(void 0,es.errorStatus)}));break}if(Se.type==="session_closed"&&((ln=Se.data)==null?void 0:ln.reason)==="client_close"){Ir=!0;const ms=Re.sessionId,es=ne.current.get(ms);es==null||es.controller.abort(),ne.current.delete(ms),Ye=void 0,Q.current=void 0;break}}catch(dt){const $t=dt instanceof Error?dt.message:String(dt);ct({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:$t,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",dt)}}if(Ir){B.dispatch({type:"assistant.done",reason:"cancelled"}),ut("idle"),fr(M),Xe(Se=>({...Se,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(W.current){Ye=void 0,Q.current=void 0,Mn.current=()=>!1;return}!vn&&!Ut.signal.aborted&&!Oe&&(((Es=Q.current)==null?void 0:Es.sessionId)===Re.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),Kn()||(fr(M),ut("idle"),B.dispatch({type:"assistant.done",reason:"stream_ended"}))),Xe(Se=>({...Se,status:Se.status==="error"?"error":"disconnected",error:Se.status==="error"?Se.error:void 0,errorStatus:sl(void 0,Se.errorStatus)})))}catch(xe){if(vn||Ut.signal.aborted)return;const wt=xe instanceof Error?xe.message:String(xe),oe=Ab(xe),ue=Ye==null?void 0:Ye.sessionId,be=WY(xe),lt=VY(xe);if(ue&&(be||lt)){const Nt=ne.current.get(ue);Nt==null||Nt.controller.abort(),ne.current.delete(ue)}(be||lt||!Zs())&&(fr(M),ut("idle"));const Re=le.current;if(Re&&(Re.sessionId===ae||Re.sessionId===Bt)&&(J.current===Re.sessionId&&(J.current=void 0),le.current=void 0,clearTimeout(Re.timeout),Re.reject(xe)),be||lt){if(Ye=void 0,Q.current=void 0,be){Xe(bt=>({...bt,status:"error",sessionId:void 0,error:wt,errorStatus:sl(oe,bt.errorStatus),missingSession:!1,capabilities:_t??bt.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const Nt=Ur&&V0(oe);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",ue,oe,wt),Xe(bt=>({...bt,status:"disconnected",sessionId:void 0,error:wt,errorStatus:sl(oe,bt.errorStatus),missingSession:Nt||bt.missingSession===!0,capabilities:_t??bt.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",Ye==null?void 0:Ye.sessionId);if(!f){Ye=void 0,Q.current=void 0,Xe(Nt=>({...Nt,status:"error",error:wt,errorStatus:sl(oe,Nt.errorStatus),missingSession:!1}));return}Xe(Nt=>({...Nt,status:"disconnected",error:wt,errorStatus:sl(oe,Nt.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!f){Q.current=void 0,Xe(xe=>({...xe,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}ws+=1;const Bs=H.current,we=XK(ws,Bs.reconnectDelayMs,Bs.maxReconnectDelayMs);Xe(xe=>({...xe,status:"disconnected",error:`Reconnecting in ${we}ms`})),await JK(we,Ut.signal)}})(),()=>{const Jt=Q.current;vn=!0,Ut.abort(),Mn.current=()=>!1,ut("idle"),fr(M);const Nn=(Jt==null?void 0:Jt.sessionId)===J.current,fn=!Rn.current;le.current&&(!Nn||fn)&&(clearTimeout(le.current.timeout),le.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),le.current=void 0),(!Nn||fn)&&(Jt!=null&&Jt.clientId)&&$C({baseUrl:C,token:A,sessionId:Jt.sessionId,clientId:Jt.clientId}).catch(Pn=>console.warn("[DaemonSessionProvider] detach failed:",Pn)),(!Nn||fn)&&(Q.current=void 0)}},[h,f,C,A,s,Ne,Ie,a,B,ae,Ke,qt,St,de,i,L,Me,ct]),p.useEffect(()=>{if(!re.current||Ue.status!=="connected"||y<=0||b<=0||!Ue.sessionId)return;U.current.sessionId!==Ue.sessionId&&(U.current={sessionId:Ue.sessionId,consecutiveFailures:0});const Ut=U.current;let vn=!1;const tn=setInterval(()=>{const Jt=Q.current;Jt&&Jt.heartbeat().then(()=>{vn||(Ut.consecutiveFailures>=b&&Xe(Nn=>Nn.sessionId===Jt.sessionId?{...Nn,status:"connected",error:void 0,errorStatus:void 0}:Nn),Ut.consecutiveFailures=0,Ut.lastHttpError=void 0)}).catch(Nn=>{var fn,Pn,Gn,Hn,qs;if(vn)return;Ut.consecutiveFailures+=1;const br=Nn instanceof Error?Nn.message:"Session heartbeat failed",Dn=Ab(Nn);if(Dn!==void 0){const _t=(fn=Ut.lastHttpError)==null?void 0:fn.status;Ut.lastHttpError={status:sl(Dn,_t)??Dn,message:V0(_t)?((Pn=Ut.lastHttpError)==null?void 0:Pn.message)??br:br}}if(Ut.consecutiveFailures<b)return;const ln=(Gn=Ut.lastHttpError)==null?void 0:Gn.status,Es=((Hn=Ut.lastHttpError)==null?void 0:Hn.message)??br,Te=ln!==void 0&&Q6.has(ln),Ye=V0(ln);if(Te||Ye){const _t=Jt.sessionId;console.warn(Ye?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",_t,ln);const Bt=ne.current.get(_t);Bt==null||Bt.controller.abort(),ne.current.delete(_t),fr(M),ut("idle"),((qs=Q.current)==null?void 0:qs.sessionId)===_t&&(Ye&&(W.current=!0),Q.current=void 0)}Xe(_t=>_t.sessionId===Jt.sessionId?{..._t,status:Te?"error":"disconnected",error:Es,errorStatus:sl(ln,_t.errorStatus),missingSession:Ye,...Te||Ye?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:_t)})},y);return()=>{vn=!0,clearInterval(tn)}},[Ue.sessionId,Ue.status,b,y]);const Bn=p.useMemo(()=>sY({store:B,sessionRef:Q,activePromptsRef:ne,settledPromptsRef:P,pendingSessionLoadRef:le,pendingSessionLoadIdRef:z,heartbeatSupportedRef:re,manualSessionClearRef:W,skipNextCleanupDetachSessionIdRef:J,passiveAssistantDoneTimerRef:M,hasSessionActivePrompt:()=>Mn.current(),resetCurrentSessionActivePrompt:()=>{Mn.current=()=>!1},getCreateSessionRequest:()=>{var Ut;return{...Ce.current,sessionScope:"thread",workspaceCwd:F.current??((Ut=Q.current)==null?void 0:Ut.workspaceCwd)}},createDetachedSession:Ut=>{var vn;const tn=_.current??new gk({baseUrl:C,token:A}),Jt={...Ce.current,sessionScope:"thread",workspaceCwd:Ut??F.current??((vn=Q.current)==null?void 0:vn.workspaceCwd)},Nn=i?fe.current:ux(void 0);return Gm.createOrAttach(tn,Jt,Nn)},getConnection:()=>yt.current,addNotice:ct,setConnection:Xe,setPromptStatus:ut,setRestoreSessionId:Ct,setRestoreMode:on,setRestoreSessionNonce:gt,setAttachSessionNonce:ft,setNewSessionNonce:_e}),[ct,i,C,A,B]),Hr=p.useRef(RY);return p.useEffect(()=>{if(Hr.current===r)return;Hr.current=r;const Ut=yt.current.sessionId;if(r===Ut)return;const vn=r?Bn.loadSession(r):Ut?Bn.clearSession():void 0;vn&&vn.catch(tn=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",tn)})},[Bn,r]),u.jsx(bD.Provider,{value:B,children:u.jsx(wD.Provider,{value:Ue,children:u.jsx(vD.Provider,{value:ve,children:u.jsx(xD.Provider,{value:qe,children:u.jsx(_D.Provider,{value:Fe,children:u.jsx(Y6.Provider,{value:Bn,children:v})})})})})})}function VC(e,t,n,s,r,i,o,a={}){var l;if(s.type!=="turn_complete"&&s.type!=="turn_error")return!1;const c=(l=s.data)==null?void 0:l.promptId;if(!c)return!1;const d=e.get(n);if(!d||a.requireBoundPromptId&&d.promptId===void 0||d.promptId!==void 0&&d.promptId!==c)return!1;fr(o);try{const h=D6(s,c);if(!h)return!1;r.dispatch(Zc(s,h.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(h)):(e.delete(n),t.set(kk(n,c),{status:"resolved",result:h}))}catch(h){r.dispatch(Zc(s,"error")),i("idle"),d.reject?(e.delete(n),d.reject(h)):(e.delete(n),t.set(kk(n,c),{status:"rejected",error:h}))}return!0}function LY(e){return e.type==="turn_complete"}function WC(e,t,n,s,r={}){DY(e),r.updateConnection!==!1&&VK(e,s);const i=mG(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=qY(e);return LY(e)?o?[o]:[]:o?[...i,o]:i}function DY(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",OY(e))}function OY(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!Ba(e.data))return t.payload="non-object",t;const n=BY(e.data.env),s=W0(e.data.changedKeys),r=W0(e.data.sessionsRefreshed),i=W0(e.data.sessionsSkipped),o=e.data.childReloaded,a=Ru(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 BY(e){if(Ba(e))return{updatedKeys:W0(e.updatedKeys)??[],removedKeys:W0(e.removedKeys)??[]}}function W0(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function GC(e,t,n){const s=[];for(const r of t){if(r.type!=="error"){s.push(r);continue}if(e.type==="turn_error"){s.push(r);continue}const i=n(PY(e,r));(i.category==="protocol"||i.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",i)}return s}function PY(e,t){const n={message:t.text,debugMessage:t.text,recoverable:t.recoverable};switch(e.type){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 Qw(){const e=p.useContext(bD);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function hg(){const e=Qw(),t=p.useCallback(()=>e.getSnapshot().blocks,[e]);return p.useSyncExternalStore(e.subscribe,t,t)}function Xw(){const e=hg(),t=zY();return p.useMemo(()=>mY(e,t),[e,t])}function fg(){const e=p.useContext(Y6);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function $Y(){return p.useContext(Y6)}function vh(){return p.useContext(_D)}function zY(){const e=p.useContext(vD);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function Ta(){const e=p.useContext(wD);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function FY(){const e=p.useContext(xD);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function px(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function qY(e){if(e.type!=="session_update")return null;const t=Ba(e.data)?e.data:void 0,n=Ba(t==null?void 0:t.update)?t.update:Ba(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const s=n._meta;if(!Ba(s))return null;const r=HY(s.goalStatus);if(r)return KC(e,r);const i=UY(s.goalTerminal);if(i)return KC(e,i);const o=s.stopHookLoop;if(!Ba(o))return null;const a=o.goal;return!Ba(a)||!Ru(a,"condition"),null}function KC(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function HY(e){if(!Ba(e))return null;const t=Ru(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Ru(e,"condition");if(!n)return null;const s=G0(e,"iterations"),r=G0(e,"durationMs"),i=G0(e,"setAt"),o=Ru(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 UY(e){if(!Ba(e))return null;const t=Ru(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Ru(e,"condition");if(!n)return null;const s=G0(e,"iterations"),r=G0(e,"durationMs"),i=Ru(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i?{lastReason:i}:{}}}function Ru(e,t){const n=e[t];return typeof n=="string"?n:void 0}function G0(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function YC(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,l,c=0,d=0;for(const h of e)switch(h.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":o+=1;break;case"workspace.extensions.changed":a+=1,l={...h.status?{status:h.status}:{},...h.source?{source:h.source}:{},...h.name?{name:h.name}:{},...h.version?{version:h.version}:{},...h.error?{error:h.error}:{},refreshed:h.refreshed,failed:h.failed};break;case"workspace.initialized":c+=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":d+=1;break}n+s+r+i+o+a+c+d!==0&&t(h=>({memoryVersion:h.memoryVersion+n,agentsVersion:h.agentsVersion+s,toolsVersion:h.toolsVersion+r,settingsVersion:h.settingsVersion+i,mcpVersion:h.mcpVersion+o,extensionsVersion:h.extensionsVersion+a,...l?{lastExtensionChange:l}:{},initVersion:h.initVersion+c,authVersion:h.authVersion+d}))}function VY(e){const t=Ab(e);return t!==void 0&&NY.has(t)}function WY(e){const t=Ab(e);return t!==void 0&&Q6.has(t)}function Ab(e){if(e instanceof th||Ba(e)&&typeof e.status=="number")return e.status}function Ba(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function nd(e,t){const{autoLoad:n=!1,enabled:s=!0}=t,[r,i]=p.useState({data:void 0,loading:!1,error:void 0}),o=p.useRef(0),a=p.useCallback(async()=>{if(!s)return;const l=++o.current;i(c=>({...c,loading:!0,error:void 0}));try{const c=await e();return l!==o.current?void 0:(i({data:c,loading:!1,error:void 0}),c)}catch(c){if(l!==o.current)return;const d=c instanceof Error?c:new Error(String(c));i(h=>({...h,loading:!1,error:d}));return}},[s,e]);return p.useEffect(()=>{!n||!s||a()},[n,s,a]),{...r,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function mg(e,t,n){const s=p.useRef(!1);p.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 GY(e={}){var t;const n=Sa(),s=p.useCallback(()=>n.listAgents(),[n]),r=nd(s,e),i=vh();return mg(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,deleteAgent:n.deleteAgent,updateAgent:n.updateAgent}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function SD(e={}){const t=Sa(),n=p.useCallback(()=>t.loadMcpStatus(),[t]),s=nd(n,e),r=vh();return mg(r==null?void 0:r.mcpVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,loadTools:t.loadMcpTools,loadResources:t.loadMcpResources,restartServer:t.restartMcpServer,manageServer:t.manageMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function KY(e={}){var t;const n=Sa(),s=p.useCallback(()=>n.loadMemoryStatus(),[n]),r=nd(s,e),i=vh();return mg(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 nh(e={}){const{pageSize:t,cursor:n,archiveState:s,view:r,group:i,...o}=e,a=Yw(),l=$Y(),c=p.useCallback(()=>{const A={...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}:{}};return a.actions.listSessionsPage(A)},[s,n,i,t,r,a.actions]),d=!!a.workspaceCwd,h=nd(c,{...o,enabled:(o.enabled??!0)&&d}),f=h.reload,m=p.useCallback(async()=>{const A=await f();return A==null?void 0:A.sessions},[f]),g=h.data,y=(g==null?void 0:g.sessions)??[],b=p.useCallback(async A=>{const T=await a.actions.deleteSession(A);return T&&m(),T},[a.actions,m]),w=p.useCallback(async A=>{const T=await a.actions.deleteSessions(A);return(T.removed.length>0||T.notFound.length>0)&&m(),T},[a.actions,m]),v=p.useCallback((A,T="html")=>a.actions.exportSession(A,T),[a.actions]),x=p.useCallback(async A=>{const T=await a.actions.archiveSession(A);return T&&m(),T},[a.actions,m]),C=p.useCallback(async A=>{const T=await a.actions.unarchiveSession(A);return T&&m(),T},[a.actions,m]);return{...h,data:g!==void 0?y:void 0,reload:m,sessions:y,nextCursor:g==null?void 0:g.nextCursor,liveMergeFailed:(g==null?void 0:g.liveMergeFailed)===!0,truncated:(g==null?void 0:g.truncated)===!0,loadSession:l==null?void 0:l.loadSession,resumeSession:l==null?void 0:l.resumeSession,newSession:l==null?void 0:l.newSession,releaseSession:l==null?void 0:l.releaseSession,deleteSession:b,deleteSessions:w,exportSession:v,archiveSession:x,unarchiveSession:C}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Ek(e={}){const{detail:t="summary",...n}=e,s=Sa(),r=p.useCallback(()=>s.loadDaemonStatus(t),[s,t]),i=nd(r,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function YY(e={}){const{range:t,heatmapDays:n,...s}=e,r=Sa(),i=p.useCallback(()=>r.loadUsageDashboard({range:t,heatmapDays:n}),[r,t,n]),o=nd(i,s);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function TD(e={}){var t;const n=Sa(),s=p.useCallback(()=>n.loadToolsStatus(),[n]),r=nd(s,e),i=vh();return mg(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)??[],setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function QY(e={}){var t;const n=Sa(),s=p.useCallback(()=>n.loadSettingsStatus(),[n]),r=nd(s,e),i=vh();return mg(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
 */const XY=300,JY=100,Qh=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function gx(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function ZY(e){const{enabled:t=!0,onStateChange:n,getOnAccept:s,getOnOutcome:r}=e;let i=Qh,o=null,a=!1,l=null;function c(b){i=b,n(b)}function d(){o&&(clearTimeout(o),o=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:b=>{if(o&&(clearTimeout(o),o=null),!b){c(Qh);return}t&&(o=setTimeout(()=>{c({suggestion:b,isVisible:!0,shownAt:Date.now()})},XY))},accept:(b,w)=>{var v;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const x=i.suggestion,{shownAt:C}=i;if(!x){a=!1;return}try{(v=r())==null||v({outcome:"accepted",accept_method:b,time_ms:C>0?Date.now()-C:0,suggestion_length:x.length})}catch(A){console.error("[followup] onOutcome callback threw:",A)}c(Qh),queueMicrotask(()=>{var A;try{w!=null&&w.skipOnAccept||(A=s())==null||A(x)}catch(T){console.error("[followup] onAccept callback threw:",T)}finally{l&&clearTimeout(l),l=setTimeout(()=>{a=!1},JY)}})},dismiss:()=>{var b;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(b=r())==null||b({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(w){console.error("[followup] onOutcome callback threw:",w)}c(Qh)}},clear:()=>{d(),a=!1,c(Qh)},cleanup:()=>{d(),a=!1}}}function CD(e={}){const{enabled:t=!0,onAccept:n,onOutcome:s}=e,r=Qw(),i=Ta().sessionId,[o,a]=p.useState(Qh),l=p.useRef(n);l.current=n;const c=p.useRef(s);c.current=s;const d=p.useSyncExternalStore(r.subscribe,()=>r.getSnapshot().lastFollowupSuggestion,()=>r.getSnapshot().lastFollowupSuggestion),h=p.useSyncExternalStore(pY,qC,qC),f=(h==null?void 0:h.sessionId)===i?h:d,m=p.useMemo(()=>ZY({enabled:t,onStateChange:a,getOnAccept:()=>l.current,getOnOutcome:()=>c.current}),[t]),{setSuggestion:g}=m;p.useEffect(()=>(t||m.clear(),()=>m.cleanup()),[m,t]);const y=p.useRef(void 0),b=p.useRef(i);p.useEffect(()=>{const C=b.current;b.current=i,C!==void 0&&i!==void 0&&C!==i&&(m.clear(),h1(),y.current=void 0)},[m,i]),p.useEffect(()=>{const C=f==null?void 0:f.promptId;C!==y.current&&(y.current=C,g((f==null?void 0:f.suggestion)??null))},[f,g]);const w=p.useCallback(()=>{m.clear(),gx(r),h1(),y.current=void 0},[m,r]),v=p.useCallback((C,A)=>{m.accept(C,A),gx(r),h1(),y.current=void 0},[m,r]),x=p.useCallback(()=>{m.dismiss(),gx(r),h1(),y.current=void 0},[m,r]);return p.useMemo(()=>({followupState:o,onAcceptFollowup:v,onDismissFollowup:x,clear:w}),[o,v,x,w])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function eQ(){const e=p.useSyncExternalStore(bY,HC,HC),t=p.useCallback(n=>vY(n),[]);return{batches:e,consume:t}}function AD(e){for(const t of e){if(!tQ(t))continue;const n=t;if(n.resolved)continue;const s=ff(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=ff(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(l=>({id:l.optionId,label:l.label,kind:sQ(l.raw)})),rawInput:nQ(n.toolCall)}}return null}function tQ(e){return e.kind==="permission"}function nQ(e){const t=ff(e);return t?ff(t.rawInput)??ff(t.input)??ff(t.args)??t:void 0}function ff(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function sQ(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 rQ(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 l=+i;if(Number.isInteger(l)&&l>=0&&l<e){let c=r[l];if(!c){const d=t[l*2];c=r[l]={index:l,key:n(l),start:d,size:t[l*2+1],end:d+t[l*2+1],lane:0}}return c}}if(i==="length")return e}return Reflect.get(r,i,o)}})}function Ph(e,t,n){let s=n.initialDeps??[],r,i=!0;function o(){const a=e();return(a.length!==s.length||a.some((c,d)=>s[d]!==c))&&(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 QC(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const iQ=(e,t)=>Math.abs(e-t)<1.01,oQ=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let Xm;const yx=()=>{if(Xm!==void 0)return Xm;if(typeof navigator>"u")return Xm=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Xm=!0;const e=navigator.maxTouchPoints;return Xm=navigator.platform==="MacIntel"&&e!==void 0&&e>0},XC=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},aQ=e=>e,lQ=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},cQ=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(r(XC(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){r({width:c.inlineSize,height:c.blockSize});return}}r(XC(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Eb={passive:!0},uQ=typeof window>"u"?!0:"onscrollend"in window,dQ=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const i=e.options.useScrollendEvent&&uQ;let o=0;const a=i?null:oQ(r,()=>t(o,!1),e.options.isScrollingResetDelay),l=h=>()=>{o=n(s),a==null||a(),t(o,h)},c=l(!0),d=l(!1);return s.addEventListener("scroll",c,Eb),i&&s.addEventListener("scrollend",d,Eb),()=>{s.removeEventListener("scroll",c),i&&s.removeEventListener("scrollend",d)}},hQ=(e,t)=>dQ(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),fQ=(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"]},mQ=(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})},pQ=mQ;class gQ{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,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[c,d]of this.elementsCache)if(d===a){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,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:aQ,rangeExtractor:lQ,onChange:()=>{},measureElement:fQ,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 f in n){const m=n[f];m!==void 0&&(i[f]=m)}const o=this.options;let a=null,l=null,c=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,m=i.count,g=this.getMeasurements(),y=f>0?((s=g[0])==null?void 0:s.key)??o.getItemKey(0):null,b=f>0?((r=g[f-1])==null?void 0:r.key)??o.getItemKey(f-1):null;if(m!==f||f>0&&m>0&&(i.getItemKey(0)!==y||i.getItemKey(m-1)!==b)){c=!0;const x=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;x&&(a=[x.key,this.getScrollOffset()-x.start]);const C=i.followOnAppend===!0?"auto":i.followOnAppend||null;C&&m>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||i.getItemKey(m-1)!==b)&&(l=C)}}this.options=i,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,h=0;if(a&&this.scrollOffset!==null){const[f,m]=a,g=this.getMeasurements(),{count:y,getItemKey:b}=this.options;let w=0;for(;w<y&&b(w)!==f;)w++;if(w<y){const v=g[w];if(v){const x=v.start+m;x!==this.scrollOffset&&(h=x-this.scrollOffset,this.scrollOffset=x,d=!0)}}}(d||l)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,l,h])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Ph(()=>(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,!(!yx()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,Eb),i.addEventListener("touchend",a,Eb),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,l]=r;i!==null&&!a&&(yx()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):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 l=i.get(a.lane);if(l==null||a.end>l.end?i.set(a.lane,a):a.end<l.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=Ph(()=>[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,l)=>(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:l}),{key:!1}),this.getMeasurements=Ph(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{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,y=n*2;let b=this._flatMeasurements;if(!b||b.length<y){const x=new Float64Array(y);b&&h>0&&x.set(b.subarray(0,h*2)),b=x,this._flatMeasurements=b}let w;if(h===0)w=s+r;else{const x=h-1;w=b[x*2]+b[x*2+1]+g}for(let x=h;x<n;x++){const C=i(x),A=d.get(C),T=typeof A=="number"?A:this.options.estimateSize(x);b[x*2]=w,b[x*2+1]=T,w+=T+g}const v=rQ(n,b,i);return this.measurementsCache=v,v}const f=this.measurementsCache.slice(0,h),m=new Array(a).fill(void 0);for(let g=0;g<h;g++){const y=f[g];y&&(m[y.lane]=g)}for(let g=h;g<n;g++){const y=i(g),b=this.laneAssignments.get(g);let w,v;const x=l==="estimate"||d.has(y);if(b!==void 0&&this.options.lanes>1){w=b;const _=m[w],R=_!==void 0?f[_]:void 0;v=R?R.end+this.options.gap:s+r}else{const _=this.options.lanes===1?f[g-1]:this.getFurthestMeasurement(f,g);v=_?_.end+this.options.gap:s+r,w=_?_.lane:g%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(g,w)}const C=d.get(y),A=typeof C=="number"?C:this.options.estimateSize(g),T=v+A;f[g]={index:g,start:v,size:A,end:T,key:y,lane:w},m[w]=g}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ph(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?yQ({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=Ph(()=>{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,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),a=c[n*2],o=c[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;l=f.key,a=f.start,o=f.size}const d=this.itemSizeCache.get(l)??o,h=s-d;if(h!==0){const f=this.options.anchorTo==="end"&&((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=f?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:l,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(l,s),this.itemSizeCacheVersion++,f?this.applyScrollAdjustment(this.getTotalSize()-m):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=Ph(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],l=s[a];r.push(l)}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=ED(0,s.length-1,i?a=>r[a*2]:a=>QC(s[a]).start,n);return QC(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,l=this.now();this.scrollState={index:n,align:a,behavior:r,startedAt:l,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&&(yx()&&(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&&iQ(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,l=Math.abs(r-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=r,c||(this.scrollState.behavior="auto"),this._scrollToOffset(r,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const ED=(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 yQ({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 l=ED(0,i,o,n),c=l;if(s===1)for(;c<i&&a(c)<n+t;)c++;else if(s>1){const d=Array(s).fill(0);for(;c<i&&d.some(f=>f<n+t);){const f=e[c];d[f.lane]=f.end,c++}const h=Array(s).fill(n+t);for(;l>=0&&h.some(f=>f>=n);){const f=e[l];h[f.lane]=f.start,l--}l=Math.max(0,l-l%s),c=Math.min(i,c+(s-1-c%s))}return{startIndex:l,endIndex:c}}const bx=typeof document<"u"?p.useLayoutEffect:p.useEffect;function bQ({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...s}){const r=p.useReducer(c=>c+1,0)[1],i=p.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=c=>{const d=i.current;if(!d.enabled)return;const h=c.getTotalSize();if(d.container&&h!==d.lastSize){d.lastSize=h;const w=c.options.horizontal?"width":"height";d.container.style[w]=`${h}px`}const f=!!c.options.horizontal,m=d.mode==="transform",g=f?"left":"top",y=c.options.scrollMargin,b=c.getVirtualItems();for(const w of b){const v=w.start-y,x=c.elementsCache.get(w.key);x&&d.lastPositions.get(x)!==v&&(d.lastPositions.set(x,v),m?x.style.transform=f?`translate3d(${v}px, 0, 0)`:`translate3d(0, ${v}px, 0)`:x.style[g]=`${v}px`)}},a={...s,onChange:(c,d)=>{var h;const f=i.current;let m=!0;if(f.enabled){o(c);const g=c.range,y=f.prevRange;m=!y||y.isScrolling!==c.isScrolling||y.startIndex!==(g==null?void 0:g.startIndex)||y.endIndex!==(g==null?void 0:g.endIndex),m&&(f.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:c.isScrolling}:null)}m&&(e&&d?dm.flushSync(r):r()),(h=s.onChange)==null||h.call(s,c,d)}},[l]=p.useState(()=>{const c=new gQ(a);return Object.assign(c,{containerRef:d=>{const h=i.current;if(h.container=d,h.lastSize=null,d&&h.enabled){const f=c.getTotalSize();h.lastSize=f;const m=c.options.horizontal?"width":"height";d.style[m]=`${f}px`}}})});return l.setOptions(a),bx(()=>l._didMount(),[]),bx(()=>l._willUpdate()),bx(()=>{o(l)}),l}function wQ(e){return bQ({observeElementRect:cQ,observeElementOffset:hQ,scrollToFn:pQ,...e})}function MD(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function vQ(e){var t;return((t=MD(e))==null?void 0:t.type)==="task_execution"}function Jw(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||vQ(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function ND(e){var n;if(!Jw(e))return!1;const t=MD(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const ID=p.createContext({}),JC=ID.Provider;function Va(){return p.useContext(ID)}const xQ=["en","zh-CN"],X6={"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 Your Subagent","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.generatingConfig":"Generating subagent configuration...","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 name, prompt, and description","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":"Project-level (.qwen/agents/)","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":"Describe what this subagent should do and when it should be used. (Be comprehensive for best results)","agent.create.qwenPlaceholder":"> e.g., Expert code reviewer that reviews code based on best practices...","agent.create.required":"Name, description, and system prompt are required.","agent.create.save":"Save Agent","agent.create.scope":"Choose where to save the subagent","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.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":"User-level (~/.qwen/agents/)","agent.create.user.desc":"Create a user-level subagent","agent.createFirstHint":"Use '/agents create' to create your first subagent.","agent.created":e=>`Created ${(e==null?void 0:e.name)??""}`,"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.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.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.step":e=>`Step ${(e==null?void 0:e.n)??""}`,"agent.tools":"Tools","agent.toolsLabel":"Tools: ","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","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.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.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.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.cellsSelected":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} cell${t===1?"":"s"} selected`},"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.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":"⊞","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.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.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","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...","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","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.namePlaceholder":"Optional — defaults to the prompt","scheduledTasks.prompt":"Prompt","scheduledTasks.promptPlaceholder":"What should this task do?","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.deleteConfirm":e=>`Delete scheduled task "${(e==null?void 0:e.name)??""}"?`,"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.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","sidebar.label":"Workspace sidebar","sidebar.toggleMenu":"Toggle menu","sidebar.newChat":"New chat","sidebar.project":"Project","sidebar.workspaceSelectLabel":"Workspace","sidebar.workspacePrimary":"primary","sidebar.workspaceUntrusted":"untrusted","sidebar.addWorkspace":"Add workspace","sidebar.addWorkspaceTitle":"Add Workspace","sidebar.addWorkspacePath":"Directory path","sidebar.addWorkspaceRegister":"Register","sidebar.addWorkspaceCancel":"Cancel","sidebar.addWorkspaceError":"Failed to add workspace","sidebar.addWorkspaceAbsError":"Path must be absolute","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.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.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","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.","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.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.checkingUpdates":"Checking 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.detailsTitle":"Extension Details","extensions.manage.disable":"Disable Extension","extensions.manage.disabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" disabled.`,"extensions.manage.empty":"No extensions installed.","extensions.manage.enable":"Enable Extension","extensions.manage.enabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" enabled.`,"extensions.manage.footer.back":"Esc to go back","extensions.manage.footer.confirm":"Enter confirm · Esc cancel","extensions.manage.footer.list":"↑↓ to navigate · Enter select · r refresh · Esc close","extensions.manage.footer.select":"↑↓ to navigate · Enter select · Esc back","extensions.manage.loading":"Loading extensions...","extensions.manage.mcpServers":"MCP servers:","extensions.manage.name":"Name:","extensions.manage.notUpdatable":"not updatable","extensions.manage.path":"Path:","extensions.manage.queued":e=>`Extension action queued for "${(e==null?void 0:e.name)??"extension"}".`,"extensions.manage.refreshed":e=>`Extensions refreshed in ${(e==null?void 0:e.refreshed)??0} session(s), ${(e==null?void 0:e.failed)??0} failed.`,"extensions.manage.settings":"Settings:","extensions.manage.skills":"Skills:","extensions.manage.source":"Source:","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.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.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.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.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.action.reconnect":"Reconnect","mcp.action.restart":"Restart","mcp.action.tools":"View tools","mcp.action.toolsHint":"Enter to inspect","mcp.empty":"No MCP servers configured.","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.noSchema":"No input schema.","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.parameters":"Parameters:","mcp.required":" required","mcp.resources":"Resources","mcp.resourcesUnavailable":"Resource details unavailable.","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":"Workspace Settings","mcp.source.user":"User Settings","mcp.status":"Status","mcp.status.blocked":"Blocked","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","mcp.use":"Use","mcp.userMcp":"User 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`,"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.available":"Available skills:","skills.none":"No skills are currently available.","skills.empty":"No skills available.","skills.footer":e=>e!=null&&e.name?`Use /skills ${e.name} to invoke · r to refresh · Esc to close`:"r to refresh · Esc to close","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} invocable`,"skills.loading":"Loading skills...","skills.run":"Run skill","skills.status.disabled":"disabled","skills.title":"Skills","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.loading":"Loading tools...","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.askedUser":"Asked user","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.done":e=>e!=null&&e.duration?`Thought for ${e.duration}`:"Done thinking","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.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.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.readOnly":"User-scope settings are read-only in daemon mode.","settings.requiresRestart":"This change requires a restart to take effect.","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:"},_Q={...X6,"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.structured_output":"结构化输出","toolName.monitor":"监控","toolName.notebook_edit":"编辑 Notebook","toolName.tool_search":"工具搜索","toolName.enter_worktree":"进入 Worktree","toolName.exit_worktree":"退出 Worktree","toolName.workflow":"工作流","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.generatingConfig":"正在生成子智能体配置...","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":"项目级 (.qwen/agents/)","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.required":"名称、描述和系统提示词均为必填项。","agent.create.save":"保存智能体","agent.create.scope":"选择智能体的保存位置","agent.create.manualDescHelp":"描述此子智能体应该在何时以及如何使用。","agent.create.manualDescPlaceholder":"例如：根据最佳实践和潜在 bug 审查代码。","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":"用户级 (~/.qwen/agents/)","agent.create.user.desc":"创建用户级智能体","agent.createFirstHint":"使用 '/agents create' 创建第一个智能体。","agent.created":e=>`已创建 ${(e==null?void 0:e.name)??""}`,"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.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.manage":"管理","agent.manage.desc":"管理已有智能体","agent.modelLabel":"模型：","agent.overriddenBadge":"（已被项目级智能体覆盖）","agent.readonly":"该智能体是只读的。","agent.select":"请选择一个智能体。","agent.selectAction":"选择操作","agent.descriptionLabel":"描述：","agent.systemPromptLabel":"系统提示词：","agent.step":e=>`步骤 ${(e==null?void 0:e.n)??""}`,"agent.tools":"工具","agent.toolsLabel":"工具：","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":"运行中","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.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.cancel":"取消","common.close":"关闭","common.fullscreen":"全屏","common.exitFullscreen":"退出全屏","common.continue":"继续","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","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.cellsSelected":e=>`${(e==null?void 0:e.count)??0} 个单元格已选中`,"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.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":"⊞","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.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.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":"输入消息或 @ 文件路径","editor.shellPlaceholder":"请输入终端命令","editor.send":"发送消息","editor.connectionDisconnected":"连接已中断，请在恢复后重试。","editor.sessionLoading":"会话正在加载，请稍后再发送。","editor.processing":"处理中。新消息会进入队列。","editor.searchHint":"ctrl+r 下一条 · tab 采纳 · enter 发送 · esc 取消","editor.searchLabel":"历史搜索：","editor.searchPlaceholder":"输入以搜索…","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":"新建会话","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.namePlaceholder":"可选 —— 默认取提示词","scheduledTasks.prompt":"提示词","scheduledTasks.promptPlaceholder":"这个任务要做什么？","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.deleteConfirm":e=>`确定删除定时任务「${(e==null?void 0:e.name)??""}」？`,"scheduledTasks.empty":"还没有定时任务，创建一个开始吧。","scheduledTasks.create":"创建","scheduledTasks.creating":"创建中…","scheduledTasks.cancel":"取消","scheduledTasks.error.invalidSchedule":"计划无效","scheduledTasks.error.emptyPrompt":"提示词不能为空","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":"秒","sidebar.label":"工作区侧边栏","sidebar.toggleMenu":"切换菜单","sidebar.newChat":"新对话","sidebar.project":"项目","sidebar.workspaceSelectLabel":"工作区","sidebar.workspacePrimary":"主","sidebar.workspaceUntrusted":"未信任","sidebar.addWorkspace":"添加工作区","sidebar.addWorkspaceTitle":"添加工作区","sidebar.addWorkspacePath":"目录路径","sidebar.addWorkspaceRegister":"注册","sidebar.addWorkspaceCancel":"取消","sidebar.addWorkspaceError":"添加工作区失败","sidebar.addWorkspaceAbsError":"路径必须是绝对路径","sidebar.noSessions":"暂无会话","sidebar.projectFallback":"项目","sidebar.sessionsOverview":"会话总览","sidebar.splitView":"分屏","sidebar.settings":"设置","sidebar.daemonStatus":"Daemon 状态","sidebar.scheduledTasks":"定时任务","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.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":"紫色","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":"当前还没有会话。请先发送第一条消息，再使用这个命令。","local.agents":"管理智能体","local.bug":"提交错误报告","local.compress":"将上下文压缩为摘要","local.compressFast":"无需 AI 的快速上下文压缩","local.config":"通过点分路径键获取或设置配置项","local.diff":"显示工作区相对 HEAD 的改动统计","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.checkingUpdates":"正在检查更新...","extensions.manage.commands":"命令：","extensions.manage.contextFiles":"上下文文件：","extensions.manage.count":e=>`已安装 ${(e==null?void 0:e.count)??0} 个扩展`,"extensions.manage.detailsTitle":"扩展详情","extensions.manage.disable":"禁用扩展","extensions.manage.disabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已禁用。`,"extensions.manage.empty":"未安装扩展。","extensions.manage.enable":"启用扩展","extensions.manage.enabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已启用。`,"extensions.manage.footer.back":"Esc 返回","extensions.manage.footer.confirm":"Enter 确认 · Esc 取消","extensions.manage.footer.list":"↑↓ 导航 · Enter 选择 · r 刷新 · Esc 关闭","extensions.manage.footer.select":"↑↓ 导航 · Enter 选择 · Esc 返回","extensions.manage.loading":"正在加载扩展...","extensions.manage.mcpServers":"MCP servers：","extensions.manage.name":"名称：","extensions.manage.notUpdatable":"不可更新","extensions.manage.path":"路径：","extensions.manage.queued":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 的操作已提交。`,"extensions.manage.refreshed":e=>`已刷新 ${(e==null?void 0:e.refreshed)??0} 个 session，${(e==null?void 0:e.failed)??0} 个失败。`,"extensions.manage.settings":"设置：","extensions.manage.skills":"Skills：","extensions.manage.source":"来源：","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.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.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.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.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.action.reconnect":"重新连接","mcp.action.restart":"重启","mcp.action.tools":"查看工具","mcp.action.toolsHint":"Enter 查看","mcp.empty":"未配置 MCP 服务器。","mcp.emptyTools":"没有发现工具。","mcp.expand":"展开 MCP server","mcp.collapse":"收起 MCP server","mcp.inputSchema":"输入 schema","mcp.loadingStatus":"正在加载 MCP 状态...","mcp.loadingTools":"正在加载工具...","mcp.name":"名称","mcp.noDescription":"没有描述","mcp.noSchema":"没有输入 schema。","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.parameters":"参数：","mcp.required":" 必填","mcp.resources":"资源","mcp.resourcesUnavailable":"无法加载资源详情。","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.source.user":"用户设置","mcp.status":"状态","mcp.status.blocked":"已阻止","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} 轮`,"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.available":"可用 skills:","skills.none":"当前没有可用 skill。","skills.empty":"没有可用 skill。","skills.footer":e=>e!=null&&e.name?`使用 /skills ${e.name} 调用 · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 可调用`,"skills.loading":"正在加载 skills...","skills.run":"运行 skill","skills.status.disabled":"已禁用","skills.title":"Skills","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.loading":"正在加载工具...","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.askedUser":"已询问用户","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.done":e=>e!=null&&e.duration?`已思考 ${e.duration}`:"思考完成","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.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.save":"保存","settings.modifiedIn":e=>`（已在${(e==null?void 0:e.scope)??""}中修改）`,"settings.alsoModifiedIn":e=>`（同时在${(e==null?void 0:e.scope)??""}中修改）`,"settings.invalidNumber":"无效数字","settings.readOnly":"User 级别设置在 daemon 模式下为只读。","settings.requiresRestart":"此更改需要重启后才能生效。","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":"提示："},kQ={en:X6,"zh-CN":_Q},SQ={en:"English [en]","zh-CN":"中文 [zh-CN]"},jD=p.createContext({language:"en",t:e=>e});function Lu(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function J6(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return Lu(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 Z6(e){return SQ[e]}function RD(e){const t=kQ[e];return(n,s)=>{const r=t[n]??X6[n]??n;return typeof r=="function"?r(s):r}}function TQ({language:e,children:t}){const n=p.useMemo(()=>({language:e,t:RD(e)}),[e]);return u.jsx(jD.Provider,{value:n,children:t})}function it(){return p.useContext(jD)}const ZC=[];function CQ(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,s)=>!Object.is(n,t[s]))}class Tc extends p.Component{constructor(){super(...arguments);ge(this,"state",{error:null,resetKeys:this.props.resetKeys??ZC});ge(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){const r=n.resetKeys??ZC;return CQ(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 AQ="_row_19m4s_1",EQ="_tip_19m4s_13",MQ="_chatRow_19m4s_35",NQ="_chatTip_19m4s_43",IQ="_chatActions_19m4s_56",jQ="_copyButton_19m4s_71",Uc={row:AQ,tip:EQ,chatRow:MQ,chatTip:NQ,chatActions:IQ,copyButton:jQ};function Mk({timestamp:e,children:t,chatMode:n=!1,copyText:s,copyTitle:r="Copy"}){const[i,o]=p.useState(!1),a=p.useCallback(()=>{var c;s&&((c=navigator.clipboard)==null||c.writeText(s).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[s]);if(e===void 0&&!s)return u.jsx(u.Fragment,{children:t});const l=s?u.jsx("button",{type:"button",className:Uc.copyButton,title:r,"aria-label":r,onClick:a,children:i?u.jsx(LQ,{}):u.jsx(RQ,{})}):null;return e===void 0?u.jsxs("div",{className:n?Uc.chatRow:Uc.row,children:[t,l]}):u.jsxs("div",{className:n?Uc.chatRow:Uc.row,children:[t,n?u.jsxs("span",{className:Uc.chatActions,children:[u.jsx("span",{className:Uc.chatTip,"aria-hidden":"true",children:Kf(e)}),l]}):u.jsx("span",{className:Uc.tip,"aria-hidden":"true",children:Kf(e)})]})}function RQ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.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"}),u.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function LQ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Kf(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 DQ="modulepreload",OQ=function(e){return"/"+e},e9={},K=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(l=>{if(l=OQ(l),l in e9)return;e9[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":DQ,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((f,m)=>{h.addEventListener("load",f),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}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)})},Li={Dark:"dark",Light:"light"},LD=[Li.Dark,Li.Light],DD=p.createContext(Li.Dark),BQ=DD.Provider;function Zw(){return p.useContext(DD)}const Ed="ui.theme",K0="general.language";function e5(e,t){return e===Li.Light||e==="Qwen Light"?Li.Light:e===Li.Dark||e==="Qwen Dark"?Li.Dark:t}function PQ(e){return e===Li.Light?"Qwen Light":"Qwen Dark"}function t9(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 OD(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $Q=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zQ=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FQ={};function n9(e,t){return(FQ.jsx?zQ:$Q).test(e)}const qQ=/[ \t\n\f\r]/g;function ev(e){return typeof e=="object"?e.type==="text"?s9(e.value):!1:s9(e)}function s9(e){return e.replace(qQ,"")===""}class pg{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}pg.prototype.normal={};pg.prototype.property={};pg.prototype.space=void 0;function BD(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new pg(n,s,t)}function Sp(e){return e.toLowerCase()}class Co{constructor(t,n){this.attribute=n,this.property=t}}Co.prototype.attribute="";Co.prototype.booleanish=!1;Co.prototype.boolean=!1;Co.prototype.commaOrSpaceSeparated=!1;Co.prototype.commaSeparated=!1;Co.prototype.defined=!1;Co.prototype.mustUseProperty=!1;Co.prototype.number=!1;Co.prototype.overloadedBoolean=!1;Co.prototype.property="";Co.prototype.spaceSeparated=!1;Co.prototype.space=void 0;let HQ=0;const gn=xh(),_r=xh(),Nk=xh(),nt=xh(),Ns=xh(),Wd=xh(),jo=xh();function xh(){return 2**++HQ}const Ik=Object.freeze(Object.defineProperty({__proto__:null,boolean:gn,booleanish:_r,commaOrSpaceSeparated:jo,commaSeparated:Wd,number:nt,overloadedBoolean:Nk,spaceSeparated:Ns},Symbol.toStringTag,{value:"Module"})),wx=Object.keys(Ik);class t5 extends Co{constructor(t,n,s,r){let i=-1;if(super(t,n),r9(this,"space",r),typeof s=="number")for(;++i<wx.length;){const o=wx[i];r9(this,wx[i],(s&Ik[o])===Ik[o])}}}t5.prototype.defined=!0;function r9(e,t,n){n&&(e[t]=n)}function wm(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new t5(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Sp(s)]=s,n[Sp(i.attribute)]=s}return new pg(t,n,e.space)}const PD=wm({properties:{ariaActiveDescendant:null,ariaAtomic:_r,ariaAutoComplete:null,ariaBusy:_r,ariaChecked:_r,ariaColCount:nt,ariaColIndex:nt,ariaColSpan:nt,ariaControls:Ns,ariaCurrent:null,ariaDescribedBy:Ns,ariaDetails:null,ariaDisabled:_r,ariaDropEffect:Ns,ariaErrorMessage:null,ariaExpanded:_r,ariaFlowTo:Ns,ariaGrabbed:_r,ariaHasPopup:null,ariaHidden:_r,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ns,ariaLevel:nt,ariaLive:null,ariaModal:_r,ariaMultiLine:_r,ariaMultiSelectable:_r,ariaOrientation:null,ariaOwns:Ns,ariaPlaceholder:null,ariaPosInSet:nt,ariaPressed:_r,ariaReadOnly:_r,ariaRelevant:null,ariaRequired:_r,ariaRoleDescription:Ns,ariaRowCount:nt,ariaRowIndex:nt,ariaRowSpan:nt,ariaSelected:_r,ariaSetSize:nt,ariaSort:null,ariaValueMax:nt,ariaValueMin:nt,ariaValueNow:nt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function $D(e,t){return t in e?e[t]:t}function zD(e,t){return $D(e,t.toLowerCase())}const UQ=wm({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wd,acceptCharset:Ns,accessKey:Ns,action:null,allow:null,allowFullScreen:gn,allowPaymentRequest:gn,allowUserMedia:gn,alpha:gn,alt:null,as:null,async:gn,autoCapitalize:null,autoComplete:Ns,autoFocus:gn,autoPlay:gn,blocking:Ns,capture:null,charSet:null,checked:gn,cite:null,className:Ns,closedBy:null,colorSpace:null,cols:nt,colSpan:nt,command:null,commandFor:null,content:null,contentEditable:_r,controls:gn,controlsList:Ns,coords:nt|Wd,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gn,defer:gn,dir:null,dirName:null,disabled:gn,download:Nk,draggable:_r,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gn,formTarget:null,headers:Ns,height:nt,hidden:Nk,high:nt,href:null,hrefLang:null,htmlFor:Ns,httpEquiv:Ns,id:null,imageSizes:null,imageSrcSet:null,inert:gn,inputMode:null,integrity:null,is:null,isMap:gn,itemId:null,itemProp:Ns,itemRef:Ns,itemScope:gn,itemType:Ns,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gn,low:nt,manifest:null,max:null,maxLength:nt,media:null,method:null,min:null,minLength:nt,multiple:gn,muted:gn,name:null,nonce:null,noModule:gn,noValidate:gn,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:gn,optimum:nt,pattern:null,ping:Ns,placeholder:null,playsInline:gn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gn,referrerPolicy:null,rel:Ns,required:gn,reversed:gn,rows:nt,rowSpan:nt,sandbox:Ns,scope:null,scoped:gn,seamless:gn,selected:gn,shadowRootClonable:gn,shadowRootCustomElementRegistry:gn,shadowRootDelegatesFocus:gn,shadowRootMode:null,shadowRootSerializable:gn,shape:null,size:nt,sizes:null,slot:null,span:nt,spellCheck:_r,src:null,srcDoc:null,srcLang:null,srcSet:null,start:nt,step:null,style:null,tabIndex:nt,target:null,title:null,translate:null,type:null,typeMustMatch:gn,useMap:null,value:_r,width:nt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ns,axis:null,background:null,bgColor:null,border:nt,borderColor:null,bottomMargin:nt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gn,declare:gn,event:null,face:null,frame:null,frameBorder:null,hSpace:nt,leftMargin:nt,link:null,longDesc:null,lowSrc:null,marginHeight:nt,marginWidth:nt,noResize:gn,noHref:gn,noShade:gn,noWrap:gn,object:null,profile:null,prompt:null,rev:null,rightMargin:nt,rules:null,scheme:null,scrolling:_r,standby:null,summary:null,text:null,topMargin:nt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:nt,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:gn,disablePictureInPicture:gn,disableRemotePlayback:gn,exportParts:Wd,part:Ns,prefix:null,property:null,results:nt,security:null,unselectable:null},space:"html",transform:zD}),VQ=wm({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:jo,accentHeight:nt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:nt,amplitude:nt,arabicForm:null,ascent:nt,attributeName:null,attributeType:null,azimuth:nt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:nt,by:null,calcMode:null,capHeight:nt,className:Ns,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:nt,diffuseConstant:nt,direction:null,display:null,dur:null,divisor:nt,dominantBaseline:null,download:gn,dx:null,dy:null,edgeMode:null,editable:null,elevation:nt,enableBackground:null,end:null,event:null,exponent:nt,externalResourcesRequired:null,fill:null,fillOpacity:nt,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:Wd,g2:Wd,glyphName:Wd,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:nt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:nt,horizOriginX:nt,horizOriginY:nt,id:null,ideographic:nt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:nt,k:nt,k1:nt,k2:nt,k3:nt,k4:nt,kernelMatrix:jo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:nt,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:nt,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:nt,overlineThickness:nt,paintOrder:null,panose1:null,path:null,pathLength:nt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ns,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:nt,pointsAtY:nt,pointsAtZ:nt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:jo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:jo,rev:jo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:jo,requiredFeatures:jo,requiredFonts:jo,requiredFormats:jo,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:nt,specularExponent:nt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:nt,strikethroughThickness:nt,string:null,stroke:null,strokeDashArray:jo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:nt,strokeOpacity:nt,strokeWidth:null,style:null,surfaceScale:nt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:jo,tabIndex:nt,tableValues:null,target:null,targetX:nt,targetY:nt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:jo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:nt,underlineThickness:nt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:nt,values:null,vAlphabetic:nt,vMathematical:nt,vectorEffect:null,vHanging:nt,vIdeographic:nt,version:null,vertAdvY:nt,vertOriginX:nt,vertOriginY:nt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:nt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$D}),FD=wm({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()}}),qD=wm({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zD}),HD=wm({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),WQ={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"},GQ=/[A-Z]/g,i9=/-[a-z]/g,KQ=/^data[-\w.:]+$/i;function n5(e,t){const n=Sp(t);let s=t,r=Co;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&KQ.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(i9,QQ);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!i9.test(i)){let o=i.replace(GQ,YQ);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=t5}return new r(s,t)}function YQ(e){return"-"+e.toLowerCase()}function QQ(e){return e.charAt(1).toUpperCase()}const s5=BD([PD,UQ,FD,qD,HD],"html"),vm=BD([PD,VQ,FD,qD,HD],"svg");function o9(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function UD(e){return e.join(" ").trim()}var r5={},a9=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,XQ=/\n/g,JQ=/^\s*/,ZQ=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,eX=/^:\s*/,tX=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,nX=/^[;\s]*/,sX=/^\s+|\s+$/g,rX=`
`,l9="/",c9="*",Md="",iX="comment",oX="declaration";function aX(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 y=g.match(XQ);y&&(n+=y.length);var b=g.lastIndexOf(rX);s=~b?g.length-b:s+g.length}function i(){var g={line:n,column:s};return function(y){return y.position=new o(g),c(),y}}function o(g){this.start=g,this.end={line:n,column:s},this.source=t.source}o.prototype.content=e;function a(g){var y=new Error(t.source+":"+n+":"+s+": "+g);if(y.reason=g,y.filename=t.source,y.line=n,y.column=s,y.source=e,!t.silent)throw y}function l(g){var y=g.exec(e);if(y){var b=y[0];return r(b),e=e.slice(b.length),y}}function c(){l(JQ)}function d(g){var y;for(g=g||[];y=h();)y!==!1&&g.push(y);return g}function h(){var g=i();if(!(l9!=e.charAt(0)||c9!=e.charAt(1))){for(var y=2;Md!=e.charAt(y)&&(c9!=e.charAt(y)||l9!=e.charAt(y+1));)++y;if(y+=2,Md===e.charAt(y-1))return a("End of comment missing");var b=e.slice(2,y-2);return s+=2,r(b),e=e.slice(y),s+=2,g({type:iX,comment:b})}}function f(){var g=i(),y=l(ZQ);if(y){if(h(),!l(eX))return a("property missing ':'");var b=l(tX),w=g({type:oX,property:u9(y[0].replace(a9,Md)),value:b?u9(b[0].replace(a9,Md)):Md});return l(nX),w}}function m(){var g=[];d(g);for(var y;y=f();)y!==!1&&(g.push(y),d(g));return g}return c(),m()}function u9(e){return e?e.replace(sX,Md):Md}var lX=aX,cX=Wy&&Wy.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r5,"__esModule",{value:!0});r5.default=dX;const uX=cX(lX);function dX(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,uX.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 tv={};Object.defineProperty(tv,"__esModule",{value:!0});tv.camelCase=void 0;var hX=/^--[a-zA-Z0-9_-]+$/,fX=/-([a-z])/g,mX=/^[^-]+$/,pX=/^-(webkit|moz|ms|o|khtml)-/,gX=/^-(ms)-/,yX=function(e){return!e||mX.test(e)||hX.test(e)},bX=function(e,t){return t.toUpperCase()},d9=function(e,t){return"".concat(t,"-")},wX=function(e,t){return t===void 0&&(t={}),yX(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(gX,d9):e=e.replace(pX,d9),e.replace(fX,bX))};tv.camelCase=wX;var vX=Wy&&Wy.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},xX=vX(r5),_X=tv;function jk(e,t){var n={};return!e||typeof e!="string"||(0,xX.default)(e,function(s,r){s&&r&&(n[(0,_X.camelCase)(s,t)]=r)}),n}jk.default=jk;var kX=jk;const SX=Cw(kX),VD=WD("end"),i5=WD("start");function WD(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 TX(e){const t=i5(e),n=VD(e);if(t&&n)return{start:t,end:n}}function Y0(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?h9(e.position):"start"in e||"end"in e?h9(e):"line"in e||"column"in e?Rk(e):""}function Rk(e){return f9(e&&e.line)+":"+f9(e&&e.column)}function h9(e){return Rk(e&&e.start)+"-"+Rk(e&&e.end)}function f9(e){return e&&typeof e=="number"?e:1}class $i 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 l=s.indexOf(":");l===-1?i.ruleId=s:(i.source=s.slice(0,l),i.ruleId=s.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.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=Y0(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}}$i.prototype.file="";$i.prototype.name="";$i.prototype.reason="";$i.prototype.message="";$i.prototype.stack="";$i.prototype.column=void 0;$i.prototype.line=void 0;$i.prototype.ancestors=void 0;$i.prototype.cause=void 0;$i.prototype.fatal=void 0;$i.prototype.place=void 0;$i.prototype.ruleId=void 0;$i.prototype.source=void 0;const o5={}.hasOwnProperty,CX=new Map,AX=/[A-Z]/g,EX=new Set(["table","tbody","thead","tfoot","tr"]),MX=new Set(["td","th"]),GD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function NX(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=PX(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=BX(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"?vm:s5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=KD(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function KD(e,t,n){if(t.type==="element")return IX(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return jX(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return LX(e,t,n);if(t.type==="mdxjsEsm")return RX(e,t);if(t.type==="root")return DX(e,t,n);if(t.type==="text")return OX(e,t)}function IX(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=vm,e.schema=r),e.ancestors.push(t);const i=QD(e,t.tagName,!1),o=$X(e,t);let a=l5(e,t);return EX.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!ev(l):!0})),YD(e,o,i,t),a5(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function jX(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)}Tp(e,t.position)}function RX(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Tp(e,t.position)}function LX(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=vm,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:QD(e,t.name,!0),o=zX(e,t),a=l5(e,t);return YD(e,o,i,t),a5(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function DX(e,t,n){const s={};return a5(s,l5(e,t)),e.create(t,e.Fragment,s,n)}function OX(e,t){return t.value}function YD(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function a5(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function BX(e,t,n){return s;function s(r,i,o,a){const c=Array.isArray(o.children)?n:t;return a?c(i,o,a):c(i,o)}}function PX(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),l=i5(s);return t(r,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function $X(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&o5.call(t.properties,r)){const i=FX(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&MX.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 zX(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 Tp(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 Tp(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function l5(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:CX;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=r.get(l)||0;o=l+"-"+c,r.set(l,c+1)}}const a=KD(e,i,o);a!==void 0&&n.push(a)}return n}function FX(e,t,n){const s=n5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?OD(n):UD(n)),s.property==="style"){let r=typeof n=="object"?n:qX(e,String(n));return e.stylePropertyNameCase==="css"&&(r=HX(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?WQ[s.property]||s.property:s.attribute,n]}}function qX(e,t){try{return SX(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new $i("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=GD+"#cannot-parse-style-attribute",r}}function QD(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=n9(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=n9(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return o5.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);Tp(e)}function Tp(e,t){const n=new $i("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=GD+"#cannot-handle-mdx-estrees-without-createevaluater",n}function HX(e){const t={};let n;for(n in e)o5.call(e,n)&&(t[UX(n)]=e[n]);return t}function UX(e){let t=e.replace(AX,VX);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function VX(e){return"-"+e.toLowerCase()}const vx={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},WX={};function c5(e,t){const n=WX,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return XD(e,s,r)}function XD(e,t,n){if(GX(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 m9(e.children,t,n)}return Array.isArray(e)?m9(e,t,n):""}function m9(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=XD(e[r],t,n);return s.join("")}function GX(e){return!!(e&&typeof e=="object")}const p9=document.createElement("i");function u5(e){const t="&"+e+";";p9.innerHTML=t;const n=p9.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Vo(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 aa(e,t){return e.length>0?(Vo(e,e.length,0,t),e):t}const g9={}.hasOwnProperty;function JD(e){const t={};let n=-1;for(;++n<e.length;)KX(t,e[n]);return t}function KX(e,t){let n;for(n in t){const r=(g9.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){g9.call(r,o)||(r[o]=[]);const a=i[o];YX(r[o],Array.isArray(a)?a:a?[a]:[])}}}function YX(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Vo(e,0,0,s)}function ZD(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 za(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ji=sd(/[A-Za-z]/),Di=sd(/[\dA-Za-z]/),QX=sd(/[#-'*+\--9=?A-Z^-~]/);function Mb(e){return e!==null&&(e<32||e===127)}const Lk=sd(/\d/),XX=sd(/[\dA-Fa-f]/),JX=sd(/[!-/:-@[-`{-~]/);function Wt(e){return e!==null&&e<-2}function Ds(e){return e!==null&&(e<0||e===32)}function Fn(e){return e===-2||e===-1||e===32}const nv=sd(new RegExp("\\p{P}|\\p{S}","u")),sh=sd(/\s/);function sd(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function xm(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Di(e.charCodeAt(n+1))&&Di(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 On(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Fn(l)?(e.enter(n),a(l)):t(l)}function a(l){return Fn(l)&&i++<r?(e.consume(l),a):(e.exit(n),t(l))}}const ZX={tokenize:eJ};function eJ(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"),On(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return Wt(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const tJ={tokenize:nJ},y9={tokenize:sJ};function nJ(e){const t=this,n=[];let s=0,r,i,o;return a;function a(x){if(s<n.length){const C=n[s];return t.containerState=C[1],e.attempt(C[0].continuation,l,c)(x)}return c(x)}function l(x){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&v();const C=t.events.length;let A=C,T;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){T=t.events[A][1].end;break}w(s);let _=C;for(;_<t.events.length;)t.events[_][1].end={...T},_++;return Vo(t.events,A+1,0,t.events.slice(C)),t.events.length=_,c(x)}return a(x)}function c(x){if(s===n.length){if(!r)return f(x);if(r.currentConstruct&&r.currentConstruct.concrete)return g(x);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(y9,d,h)(x)}function d(x){return r&&v(),w(s),f(x)}function h(x){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,g(x)}function f(x){return t.containerState={},e.attempt(y9,m,g)(x)}function m(x){return s++,n.push([t.currentConstruct,t.containerState]),f(x)}function g(x){if(x===null){r&&v(),w(0),e.consume(x);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),y(x)}function y(x){if(x===null){b(e.exit("chunkFlow"),!0),w(0),e.consume(x);return}return Wt(x)?(e.consume(x),b(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(x),y)}function b(x,C){const A=t.sliceStream(x);if(C&&A.push(null),x.previous=i,i&&(i.next=x),i=x,r.defineSkip(x.start),r.write(A),t.parser.lazy[x.start.line]){let T=r.events.length;for(;T--;)if(r.events[T][1].start.offset<o&&(!r.events[T][1].end||r.events[T][1].end.offset>o))return;const _=t.events.length;let R=_,I,k;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(I){k=t.events[R][1].end;break}I=!0}for(w(s),T=_;T<t.events.length;)t.events[T][1].end={...k},T++;Vo(t.events,R+1,0,t.events.slice(_)),t.events.length=T}}function w(x){let C=n.length;for(;C-- >x;){const A=n[C];t.containerState=A[1],A[0].exit.call(t,e)}n.length=x}function v(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function sJ(e,t,n){return On(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Yf(e){if(e===null||Ds(e)||sh(e))return 1;if(nv(e))return 2}function sv(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 Dk={name:"attention",resolveAll:rJ,tokenize:iJ};function rJ(e,t){let n=-1,s,r,i,o,a,l,c,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;l=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},f={...e[n][1].start};b9(h,-l),b9(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},c=[],e[s][1].end.offset-e[s][1].start.offset&&(c=aa(c,[["enter",e[s][1],t],["exit",e[s][1],t]])),c=aa(c,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=aa(c,sv(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),c=aa(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=aa(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Vo(e,s-1,n-s+3,c),n=s+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function iJ(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=Yf(s);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),d=Yf(l),h=!d||d===2&&r||n.includes(l),f=!r||r===2&&d||n.includes(s);return c._open=!!(i===42?h:h&&(r||!f)),c._close=!!(i===42?f:f&&(d||!h)),t(l)}}function b9(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const oJ={name:"autolink",tokenize:aJ};function aJ(e,t,n){let s=0;return r;function r(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Ji(m)?(e.consume(m),o):m===64?n(m):c(m)}function o(m){return m===43||m===45||m===46||Di(m)?(s=1,a(m)):c(m)}function a(m){return m===58?(e.consume(m),s=0,l):(m===43||m===45||m===46||Di(m))&&s++<32?(e.consume(m),a):(s=0,c(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Mb(m)?n(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),d):QX(m)?(e.consume(m),c):n(m)}function d(m){return Di(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),s=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):f(m)}function f(m){if((m===45||Di(m))&&s++<63){const g=m===45?f:h;return e.consume(m),g}return n(m)}}const gg={partial:!0,tokenize:lJ};function lJ(e,t,n){return s;function s(i){return Fn(i)?On(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||Wt(i)?t(i):n(i)}}const eO={continuation:{tokenize:uJ},exit:dJ,name:"blockQuote",tokenize:cJ};function cJ(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 Fn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function uJ(e,t,n){const s=this;return r;function r(o){return Fn(o)?On(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(eO,t,n)(o)}}function dJ(e){e.exit("blockQuote")}const tO={name:"characterEscape",tokenize:hJ};function hJ(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 JX(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const nO={name:"characterReference",tokenize:fJ};function fJ(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"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=Di,d(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=XX,d):(e.enter("characterReferenceValue"),i=7,o=Lk,d(h))}function d(h){if(h===59&&r){const f=e.exit("characterReferenceValue");return o===Di&&!u5(s.sliceSerialize(f))?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 w9={partial:!0,tokenize:pJ},v9={concrete:!0,name:"codeFenced",tokenize:mJ};function mJ(e,t,n){const s=this,r={partial:!0,tokenize:A};let i=0,o=0,a;return l;function l(T){return c(T)}function c(T){const _=s.events[s.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,a=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===a?(o++,e.consume(T),d):o<3?n(T):(e.exit("codeFencedFenceSequence"),Fn(T)?On(e,h,"whitespace")(T):h(T))}function h(T){return T===null||Wt(T)?(e.exit("codeFencedFence"),s.interrupt?t(T):e.check(w9,y,C)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(T))}function f(T){return T===null||Wt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Fn(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),On(e,m,"whitespace")(T)):T===96&&T===a?n(T):(e.consume(T),f)}function m(T){return T===null||Wt(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||Wt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===a?n(T):(e.consume(T),g)}function y(T){return e.attempt(r,C,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),w}function w(T){return i>0&&Fn(T)?On(e,v,"linePrefix",i+1)(T):v(T)}function v(T){return T===null||Wt(T)?e.check(w9,y,C)(T):(e.enter("codeFlowValue"),x(T))}function x(T){return T===null||Wt(T)?(e.exit("codeFlowValue"),v(T)):(e.consume(T),x)}function C(T){return e.exit("codeFenced"),t(T)}function A(T,_,R){let I=0;return k;function k(F){return T.enter("lineEnding"),T.consume(F),T.exit("lineEnding"),j}function j(F){return T.enter("codeFencedFence"),Fn(F)?On(T,N,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):N(F)}function N(F){return F===a?(T.enter("codeFencedFenceSequence"),L(F)):R(F)}function L(F){return F===a?(I++,T.consume(F),L):I>=o?(T.exit("codeFencedFenceSequence"),Fn(F)?On(T,$,"whitespace")(F):$(F)):R(F)}function $(F){return F===null||Wt(F)?(T.exit("codeFencedFence"),_(F)):R(F)}}}function pJ(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 xx={name:"codeIndented",tokenize:yJ},gJ={partial:!0,tokenize:bJ};function yJ(e,t,n){const s=this;return r;function r(c){return e.enter("codeIndented"),On(e,i,"linePrefix",5)(c)}function i(c){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):Wt(c)?e.attempt(gJ,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||Wt(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function bJ(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):Wt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):On(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):Wt(o)?r(o):n(o)}}const wJ={name:"codeText",previous:xJ,resolve:vJ,tokenize:_J};function vJ(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 xJ(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _J(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"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),r=0,d(h)):Wt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||Wt(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),c)}function d(h){return h===96?(e.consume(h),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",c(h))}}class kJ{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&&Jm(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),Jm(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Jm(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);Jm(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Jm(this.left,n.reverse())}}}function Jm(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 sO(e){const t={};let n=-1,s,r,i,o,a,l,c;const d=new kJ(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"&&(l=s[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,SJ(d,n)),n=t[n],c=!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 Vo(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function SJ(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,l=[],c={};let d,h,f=-1,m=n,g=0,y=0;const b=[y];for(;m;){for(;e.get(++r)[1]!==m;);i.push(r),m._tokenizer||(d=s.sliceStream(m),m.next||d.push(null),h&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(y=f+1,b.push(y),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),f=b.length;f--;){const w=a.slice(b[f],b[f+1]),v=i.pop();l.push([v,v+w.length-1]),e.splice(v,2,w)}for(l.reverse(),f=-1;++f<l.length;)c[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return c}const TJ={resolve:AJ,tokenize:EJ},CJ={partial:!0,tokenize:MJ};function AJ(e){return sO(e),e}function EJ(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):Wt(a)?e.check(CJ,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 MJ(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),On(e,i,"linePrefix")}function i(o){if(o===null||Wt(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 rO(e,t,n,s,r,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(w){return w===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(w),e.exit(i),f):w===null||w===32||w===41||Mb(w)?n(w):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(w))}function f(w){return w===62?(e.enter(i),e.consume(w),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===62?(e.exit("chunkString"),e.exit(a),f(w)):w===null||w===60||Wt(w)?n(w):(e.consume(w),w===92?g:m)}function g(w){return w===60||w===62||w===92?(e.consume(w),m):m(w)}function y(w){return!d&&(w===null||w===41||Ds(w))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(w)):d<c&&w===40?(e.consume(w),d++,y):w===41?(e.consume(w),d--,y):w===null||w===32||w===40||Mb(w)?n(w):(e.consume(w),w===92?b:y)}function b(w){return w===40||w===41||w===92?(e.consume(w),y):y(w)}}function iO(e,t,n,s,r,i){const o=this;let a=0,l;return c;function c(m){return e.enter(s),e.enter(r),e.consume(m),e.exit(r),e.enter(i),d}function d(m){return a>999||m===null||m===91||m===93&&!l||m===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(e.exit(i),e.enter(r),e.consume(m),e.exit(r),e.exit(s),t):Wt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||Wt(m)||a++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Fn(m)),m===92?f:h)}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,h):h(m)}}function oO(e,t,n,s,r,i){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(s),e.enter(r),e.consume(f),e.exit(r),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(r),e.consume(f),e.exit(r),e.exit(s),t):(e.enter(i),c(f))}function c(f){return f===o?(e.exit(i),l(o)):f===null?n(f):Wt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),On(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||Wt(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function Q0(e,t){let n;return s;function s(r){return Wt(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):Fn(r)?On(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const NJ={name:"definition",tokenize:jJ},IJ={partial:!0,tokenize:RJ};function jJ(e,t,n){const s=this;let r;return i;function i(m){return e.enter("definition"),o(m)}function o(m){return iO.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return r=za(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return Ds(m)?Q0(e,c)(m):c(m)}function c(m){return rO(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(IJ,h,h)(m)}function h(m){return Fn(m)?On(e,f,"whitespace")(m):f(m)}function f(m){return m===null||Wt(m)?(e.exit("definition"),s.parser.defined.push(r),t(m)):n(m)}}function RJ(e,t,n){return s;function s(a){return Ds(a)?Q0(e,r)(a):n(a)}function r(a){return oO(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Fn(a)?On(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Wt(a)?t(a):n(a)}}const LJ={name:"hardBreakEscape",tokenize:DJ};function DJ(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return Wt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const OJ={name:"headingAtx",resolve:BJ,tokenize:PJ};function BJ(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"},Vo(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function PJ(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||Ds(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||Wt(d)?(e.exit("atxHeading"),t(d)):Fn(d)?On(e,a,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||Ds(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),c)}}const $J=["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"],x9=["pre","script","style","textarea"],zJ={concrete:!0,name:"htmlFlow",resolveTo:HJ,tokenize:UJ},FJ={partial:!0,tokenize:WJ},qJ={partial:!0,tokenize:VJ};function HJ(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 UJ(e,t,n){const s=this;let r,i,o,a,l;return c;function c(M){return d(M)}function d(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),h}function h(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),i=!0,y):M===63?(e.consume(M),r=3,s.interrupt?t:P):Ji(M)?(e.consume(M),o=String.fromCharCode(M),b):n(M)}function f(M){return M===45?(e.consume(M),r=2,m):M===91?(e.consume(M),r=5,a=0,g):Ji(M)?(e.consume(M),r=4,s.interrupt?t:P):n(M)}function m(M){return M===45?(e.consume(M),s.interrupt?t:P):n(M)}function g(M){const re="CDATA[";return M===re.charCodeAt(a++)?(e.consume(M),a===re.length?s.interrupt?t:N:g):n(M)}function y(M){return Ji(M)?(e.consume(M),o=String.fromCharCode(M),b):n(M)}function b(M){if(M===null||M===47||M===62||Ds(M)){const re=M===47,U=o.toLowerCase();return!re&&!i&&x9.includes(U)?(r=1,s.interrupt?t(M):N(M)):$J.includes(o.toLowerCase())?(r=6,re?(e.consume(M),w):s.interrupt?t(M):N(M)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(M):i?v(M):x(M))}return M===45||Di(M)?(e.consume(M),o+=String.fromCharCode(M),b):n(M)}function w(M){return M===62?(e.consume(M),s.interrupt?t:N):n(M)}function v(M){return Fn(M)?(e.consume(M),v):k(M)}function x(M){return M===47?(e.consume(M),k):M===58||M===95||Ji(M)?(e.consume(M),C):Fn(M)?(e.consume(M),x):k(M)}function C(M){return M===45||M===46||M===58||M===95||Di(M)?(e.consume(M),C):A(M)}function A(M){return M===61?(e.consume(M),T):Fn(M)?(e.consume(M),A):x(M)}function T(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),l=M,_):Fn(M)?(e.consume(M),T):R(M)}function _(M){return M===l?(e.consume(M),l=null,I):M===null||Wt(M)?n(M):(e.consume(M),_)}function R(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Ds(M)?A(M):(e.consume(M),R)}function I(M){return M===47||M===62||Fn(M)?x(M):n(M)}function k(M){return M===62?(e.consume(M),j):n(M)}function j(M){return M===null||Wt(M)?N(M):Fn(M)?(e.consume(M),j):n(M)}function N(M){return M===45&&r===2?(e.consume(M),B):M===60&&r===1?(e.consume(M),Q):M===62&&r===4?(e.consume(M),le):M===63&&r===3?(e.consume(M),P):M===93&&r===5?(e.consume(M),ne):Wt(M)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(FJ,z,L)(M)):M===null||Wt(M)?(e.exit("htmlFlowData"),L(M)):(e.consume(M),N)}function L(M){return e.check(qJ,$,z)(M)}function $(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),F}function F(M){return M===null||Wt(M)?L(M):(e.enter("htmlFlowData"),N(M))}function B(M){return M===45?(e.consume(M),P):N(M)}function Q(M){return M===47?(e.consume(M),o="",Y):N(M)}function Y(M){if(M===62){const re=o.toLowerCase();return x9.includes(re)?(e.consume(M),le):N(M)}return Ji(M)&&o.length<8?(e.consume(M),o+=String.fromCharCode(M),Y):N(M)}function ne(M){return M===93?(e.consume(M),P):N(M)}function P(M){return M===62?(e.consume(M),le):M===45&&r===2?(e.consume(M),P):N(M)}function le(M){return M===null||Wt(M)?(e.exit("htmlFlowData"),z(M)):(e.consume(M),le)}function z(M){return e.exit("htmlFlow"),t(M)}}function VJ(e,t,n){const s=this;return r;function r(o){return Wt(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 WJ(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(gg,t,n)}}const GJ={name:"htmlText",tokenize:KJ};function KJ(e,t,n){const s=this;let r,i,o;return a;function a(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),l}function l(P){return P===33?(e.consume(P),c):P===47?(e.consume(P),A):P===63?(e.consume(P),x):Ji(P)?(e.consume(P),R):n(P)}function c(P){return P===45?(e.consume(P),d):P===91?(e.consume(P),i=0,g):Ji(P)?(e.consume(P),v):n(P)}function d(P){return P===45?(e.consume(P),m):n(P)}function h(P){return P===null?n(P):P===45?(e.consume(P),f):Wt(P)?(o=h,Q(P)):(e.consume(P),h)}function f(P){return P===45?(e.consume(P),m):h(P)}function m(P){return P===62?B(P):P===45?f(P):h(P)}function g(P){const le="CDATA[";return P===le.charCodeAt(i++)?(e.consume(P),i===le.length?y:g):n(P)}function y(P){return P===null?n(P):P===93?(e.consume(P),b):Wt(P)?(o=y,Q(P)):(e.consume(P),y)}function b(P){return P===93?(e.consume(P),w):y(P)}function w(P){return P===62?B(P):P===93?(e.consume(P),w):y(P)}function v(P){return P===null||P===62?B(P):Wt(P)?(o=v,Q(P)):(e.consume(P),v)}function x(P){return P===null?n(P):P===63?(e.consume(P),C):Wt(P)?(o=x,Q(P)):(e.consume(P),x)}function C(P){return P===62?B(P):x(P)}function A(P){return Ji(P)?(e.consume(P),T):n(P)}function T(P){return P===45||Di(P)?(e.consume(P),T):_(P)}function _(P){return Wt(P)?(o=_,Q(P)):Fn(P)?(e.consume(P),_):B(P)}function R(P){return P===45||Di(P)?(e.consume(P),R):P===47||P===62||Ds(P)?I(P):n(P)}function I(P){return P===47?(e.consume(P),B):P===58||P===95||Ji(P)?(e.consume(P),k):Wt(P)?(o=I,Q(P)):Fn(P)?(e.consume(P),I):B(P)}function k(P){return P===45||P===46||P===58||P===95||Di(P)?(e.consume(P),k):j(P)}function j(P){return P===61?(e.consume(P),N):Wt(P)?(o=j,Q(P)):Fn(P)?(e.consume(P),j):I(P)}function N(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),r=P,L):Wt(P)?(o=N,Q(P)):Fn(P)?(e.consume(P),N):(e.consume(P),$)}function L(P){return P===r?(e.consume(P),r=void 0,F):P===null?n(P):Wt(P)?(o=L,Q(P)):(e.consume(P),L)}function $(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||Ds(P)?I(P):(e.consume(P),$)}function F(P){return P===47||P===62||Ds(P)?I(P):n(P)}function B(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):n(P)}function Q(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),Y}function Y(P){return Fn(P)?On(e,ne,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):ne(P)}function ne(P){return e.enter("htmlTextData"),o(P)}}const d5={name:"labelEnd",resolveAll:JJ,resolveTo:ZJ,tokenize:eZ},YJ={tokenize:tZ},QJ={tokenize:nZ},XJ={tokenize:sZ};function JJ(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&&Vo(e,0,e.length,n),e}function ZJ(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 l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={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",l,t],["enter",c,t]],a=aa(a,e.slice(i+1,i+s+3)),a=aa(a,[["enter",d,t]]),a=aa(a,sv(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=aa(a,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),a=aa(a,e.slice(o+1)),a=aa(a,[["exit",l,t]]),Vo(e,i,e.length,a),e}function eZ(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(f){return i?i._inactive?h(f):(o=s.parser.defined.includes(za(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(YJ,d,o?d:h)(f):f===91?e.attempt(QJ,d,o?c:h)(f):o?d(f):h(f)}function c(f){return e.attempt(XJ,d,h)(f)}function d(f){return t(f)}function h(f){return i._balanced=!0,n(f)}}function tZ(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 Ds(h)?Q0(e,i)(h):i(h)}function i(h){return h===41?d(h):rO(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Ds(h)?Q0(e,l)(h):d(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?oO(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return Ds(h)?Q0(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 nZ(e,t,n){const s=this;return r;function r(a){return iO.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(za(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function sZ(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 rZ={name:"labelStartImage",resolveAll:d5.resolveAll,tokenize:iZ};function iZ(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 oZ={name:"labelStartLink",resolveAll:d5.resolveAll,tokenize:aZ};function aZ(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 _x={name:"lineEnding",tokenize:lZ};function lZ(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),On(e,t,"linePrefix")}}const Ay={name:"thematicBreak",tokenize:cZ};function cZ(e,t,n){let s=0,r;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return r=c,a(c)}function a(c){return c===r?(e.enter("thematicBreakSequence"),l(c)):s>=3&&(c===null||Wt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===r?(e.consume(c),s++,l):(e.exit("thematicBreakSequence"),Fn(c)?On(e,a,"whitespace")(c):a(c))}}const fo={continuation:{tokenize:fZ},exit:pZ,name:"list",tokenize:hZ},uZ={partial:!0,tokenize:gZ},dZ={partial:!0,tokenize:mZ};function hZ(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(m){const g=s.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||m===s.containerState.marker:Lk(m)){if(s.containerState.type||(s.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Ay,n,c)(m):c(m);if(!s.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Lk(m)&&++o<10?(e.consume(m),l):(!s.interrupt||o<2)&&(s.containerState.marker?m===s.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),c(m)):n(m)}function c(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||m,e.check(gg,s.interrupt?n:d,e.attempt(uZ,f,h))}function d(m){return s.containerState.initialBlankLine=!0,i++,f(m)}function h(m){return Fn(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function fZ(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(gg,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,On(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!Fn(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(dZ,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,On(e,e.attempt(fo,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function mZ(e,t,n){const s=this;return On(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 pZ(e){e.exit(this.containerState.type)}function gZ(e,t,n){const s=this;return On(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!Fn(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const _9={name:"setextUnderline",resolveTo:yZ,tokenize:bZ};function yZ(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 bZ(e,t,n){const s=this;let r;return i;function i(c){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=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===r?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Fn(c)?On(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Wt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const wZ={tokenize:vZ};function vZ(e){const t=this,n=e.attempt(gg,s,e.attempt(this.parser.constructs.flowInitial,r,On(e,e.attempt(this.parser.constructs.flow,r,e.attempt(TJ,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 xZ={resolveAll:lO()},_Z=aO("string"),kZ=aO("text");function aO(e){return{resolveAll:lO(e==="text"?SZ: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 c(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const h=r[d];let f=-1;if(h)for(;++f<h.length;){const m=h[f];if(!m.previous||m.previous.call(s,s.previous))return!0}return!1}}}function lO(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 SZ(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,l;for(;i--;){const c=r[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||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={...c.start},s.start.offset===s.end.offset?Object.assign(s,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const TZ={42:fo,43:fo,45:fo,48:fo,49:fo,50:fo,51:fo,52:fo,53:fo,54:fo,55:fo,56:fo,57:fo,62:eO},CZ={91:NJ},AZ={[-2]:xx,[-1]:xx,32:xx},EZ={35:OJ,42:Ay,45:[_9,Ay],60:zJ,61:_9,95:Ay,96:v9,126:v9},MZ={38:nO,92:tO},NZ={[-5]:_x,[-4]:_x,[-3]:_x,33:rZ,38:nO,42:Dk,60:[oJ,GJ],91:oZ,92:[LJ,tO],93:d5,95:Dk,96:wJ},IZ={null:[Dk,xZ]},jZ={null:[42,95]},RZ={null:[]},LZ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jZ,contentInitial:CZ,disable:RZ,document:TZ,flow:EZ,flowInitial:AZ,insideSpan:IZ,string:MZ,text:NZ},Symbol.toStringTag,{value:"Module"}));function DZ(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 l={attempt:_(A),check:_(T),consume:v,enter:x,exit:C,interrupt:_(T,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:h};let d=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function h(j){return o=aa(o,j),b(),o[o.length-1]!==null?[]:(R(t,0),c.events=sv(i,c.events,c),c.events)}function f(j,N){return BZ(m(j),N)}function m(j){return OZ(o,j)}function g(){const{_bufferIndex:j,_index:N,line:L,column:$,offset:F}=s;return{_bufferIndex:j,_index:N,line:L,column:$,offset:F}}function y(j){r[j.line]=j.column,k()}function b(){let j;for(;s._index<o.length;){const N=o[s._index];if(typeof N=="string")for(j=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===j&&s._bufferIndex<N.length;)w(N.charCodeAt(s._bufferIndex));else w(N)}}function w(j){d=d(j)}function v(j){Wt(j)?(s.line++,s.column=1,s.offset+=j===-3?2:1,k()):j!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),c.previous=j}function x(j,N){const L=N||{};return L.type=j,L.start=g(),c.events.push(["enter",L,c]),a.push(L),L}function C(j){const N=a.pop();return N.end=g(),c.events.push(["exit",N,c]),N}function A(j,N){R(j,N.from)}function T(j,N){N.restore()}function _(j,N){return L;function L($,F,B){let Q,Y,ne,P;return Array.isArray($)?z($):"tokenize"in $?z([$]):le($);function le(W){return J;function J(G){const te=G!==null&&W[G],H=G!==null&&W.null,ie=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(H)?H:H?[H]:[]];return z(ie)(G)}}function z(W){return Q=W,Y=0,W.length===0?B:M(W[Y])}function M(W){return J;function J(G){return P=I(),ne=W,W.partial||(c.currentConstruct=W),W.name&&c.parser.constructs.disable.null.includes(W.name)?U():W.tokenize.call(N?Object.assign(Object.create(c),N):c,l,re,U)(G)}}function re(W){return j(ne,P),F}function U(W){return P.restore(),++Y<Q.length?M(Q[Y]):B}}}function R(j,N){j.resolveAll&&!i.includes(j)&&i.push(j),j.resolve&&Vo(c.events,N,c.events.length-N,j.resolve(c.events.slice(N),c)),j.resolveTo&&(c.events=j.resolveTo(c.events,c))}function I(){const j=g(),N=c.previous,L=c.currentConstruct,$=c.events.length,F=Array.from(a);return{from:$,restore:B};function B(){s=j,c.previous=N,c.currentConstruct=L,c.events.length=$,a=F,k()}}function k(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function OZ(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 BZ(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 PZ(e){const s={constructs:JD([LZ,...(e||{}).extensions||[]]),content:r(ZX),defined:[],document:r(tJ),flow:r(wZ),lazy:{},string:r(_Z),text:r(kZ)};return s;function r(i){return o;function o(a){return DZ(s,i,a)}}}function $Z(e){for(;!sO(e););return e}const k9=/[\0\t\n\r]/g;function zZ(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const l=[];let c,d,h,f,m;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(k9.lastIndex=h,c=k9.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){t=i.slice(h);break}if(m===10&&h===f&&s)l.push(-3),s=void 0;else switch(s&&(l.push(-5),s=void 0),h<f&&(l.push(i.slice(h,f)),e+=f-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:s=!0,e=1}h=f+1}return a&&(s&&l.push(-5),t&&l.push(t),l.push(null)),l}}const FZ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qZ(e){return e.replace(FZ,HZ)}function HZ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return ZD(n.slice(i?2:1),i?16:10)}return u5(n)||e}const cO={}.hasOwnProperty;function UZ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),VZ(n)($Z(PZ(n).document().write(zZ()(e,t,!0))))}function VZ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ct),autolinkProtocol:I,autolinkEmail:I,atxHeading:i(Ce),blockQuote:i(H),characterEscape:I,characterReference:I,codeFenced:i(ie),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ie,o),codeText:i(fe,o),codeTextData:I,data:I,codeFlowValue:I,definition:i(Ne),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ie),hardBreakEscape:i(ve),hardBreakTrailing:i(ve),htmlFlow:i(ut,o),htmlFlowData:I,htmlText:i(ut,o),htmlTextData:I,image:i(ae),label:o,link:i(Ct),listItem:i(on),listItemValue:f,listOrdered:i(Ke,h),listUnordered:i(Ke),paragraph:i(qt),reference:M,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ce),strong:i(gt),thematicBreak:i(ft)},exit:{atxHeading:l(),atxHeadingSequence:A,autolink:l(),autolinkEmail:te,autolinkProtocol:G,blockQuote:l(),characterEscapeValue:k,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:W,characterReference:J,codeFenced:l(b),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:k,codeIndented:l(w),codeText:l(F),codeTextData:k,data:k,definition:l(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:x,emphasis:l(),hardBreakEscape:l(N),hardBreakTrailing:l(N),htmlFlow:l(L),htmlFlowData:k,htmlText:l($),htmlTextData:k,image:l(Q),label:ne,labelText:Y,lineEnding:j,link:l(B),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:re,resourceDestinationString:P,resourceTitleString:le,resource:z,setextHeading:l(R),setextHeadingLineSequence:_,setextHeadingText:T,strong:l(),thematicBreak:l()}};uO(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(de){let _e={type:"root",children:[]};const Ue={stack:[_e],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:d,data:n},Xe=[];let yt=-1;for(;++yt<de.length;)if(de[yt][1].type==="listOrdered"||de[yt][1].type==="listUnordered")if(de[yt][0]==="enter")Xe.push(yt);else{const ye=Xe.pop();yt=r(de,ye,yt)}for(yt=-1;++yt<de.length;){const ye=t[de[yt][0]];cO.call(ye,de[yt][1].type)&&ye[de[yt][1].type].call(Object.assign({sliceSerialize:de[yt][2].sliceSerialize},Ue),de[yt][1])}if(Ue.tokenStack.length>0){const ye=Ue.tokenStack[Ue.tokenStack.length-1];(ye[1]||S9).call(Ue,void 0,ye[0])}for(_e.position={start:Vc(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:Vc(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},yt=-1;++yt<t.transforms.length;)_e=t.transforms[yt](_e)||_e;return _e}function r(de,_e,Ue){let Xe=_e-1,yt=-1,ye=!1,Kt,Ee,ct,qn;for(;++Xe<=Ue;){const Me=de[Xe];switch(Me[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Me[0]==="enter"?yt++:yt--,qn=void 0;break}case"lineEndingBlank":{Me[0]==="enter"&&(Kt&&!qn&&!yt&&!ct&&(ct=Xe),qn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:qn=void 0}if(!yt&&Me[0]==="enter"&&Me[1].type==="listItemPrefix"||yt===-1&&Me[0]==="exit"&&(Me[1].type==="listUnordered"||Me[1].type==="listOrdered")){if(Kt){let qe=Xe;for(Ee=void 0;qe--;){const Fe=de[qe];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;Ee&&(de[Ee][1].type="lineEndingBlank",ye=!0),Fe[1].type="lineEnding",Ee=qe}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}ct&&(!Ee||ct<Ee)&&(Kt._spread=!0),Kt.end=Object.assign({},Ee?de[Ee][1].start:Me[1].end),de.splice(Ee||Xe,0,["exit",Kt,Me[2]]),Xe++,Ue++}if(Me[1].type==="listItemPrefix"){const qe={type:"listItem",_spread:!1,start:Object.assign({},Me[1].start),end:void 0};Kt=qe,de.splice(Xe,0,["enter",qe,Me[2]]),Xe++,Ue++,ct=void 0,qn=!0}}}return de[_e][1]._spread=ye,Ue}function i(de,_e){return Ue;function Ue(Xe){a.call(this,de(Xe),Xe),_e&&_e.call(this,Xe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(de,_e,Ue){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([_e,Ue||void 0]),de.position={start:Vc(_e.start),end:void 0}}function l(de){return _e;function _e(Ue){de&&de.call(this,Ue),c.call(this,Ue)}}function c(de,_e){const Ue=this.stack.pop(),Xe=this.tokenStack.pop();if(Xe)Xe[0].type!==de.type&&(_e?_e.call(this,de,Xe[0]):(Xe[1]||S9).call(this,de,Xe[0]));else throw new Error("Cannot close `"+de.type+"` ("+Y0({start:de.start,end:de.end})+"): it’s not open");Ue.position.end=Vc(de.end)}function d(){return c5(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(de){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function m(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=de}function g(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=de}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de.replace(/(\r?\n|\r)$/g,"")}function v(de){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=_e,Ue.identifier=za(this.sliceSerialize(de)).toLowerCase()}function x(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.title=de}function C(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.url=de}function A(de){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Ue=this.sliceSerialize(de).length;_e.depth=Ue}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function _(de){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function I(de){const Ue=this.stack[this.stack.length-1].children;let Xe=Ue[Ue.length-1];(!Xe||Xe.type!=="text")&&(Xe=St(),Xe.position={start:Vc(de.start),end:void 0},Ue.push(Xe)),this.stack.push(Xe)}function k(de){const _e=this.stack.pop();_e.value+=this.sliceSerialize(de),_e.position.end=Vc(de.end)}function j(de){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=_e.children[_e.children.length-1];Ue.position.end=Vc(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&(I.call(this,de),k.call(this,de))}function N(){this.data.atHardBreak=!0}function L(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de}function $(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de}function F(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de}function B(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=_e,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function Q(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=_e,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function Y(de){const _e=this.sliceSerialize(de),Ue=this.stack[this.stack.length-2];Ue.label=qZ(_e),Ue.identifier=za(_e).toLowerCase()}function ne(){const de=this.stack[this.stack.length-1],_e=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const Xe=de.children;Ue.children=Xe}else Ue.alt=_e}function P(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.url=de}function le(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.title=de}function z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function re(de){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=_e,Ue.identifier=za(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function U(de){this.data.characterReferenceType=de.type}function W(de){const _e=this.sliceSerialize(de),Ue=this.data.characterReferenceType;let Xe;Ue?(Xe=ZD(_e,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Xe=u5(_e);const yt=this.stack[this.stack.length-1];yt.value+=Xe}function J(de){const _e=this.stack.pop();_e.position.end=Vc(de.end)}function G(de){k.call(this,de);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(de)}function te(de){k.call(this,de);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(de)}function H(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function Ne(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function Ce(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function ut(){return{type:"html",value:""}}function ae(){return{type:"image",title:null,url:"",alt:null}}function Ct(){return{type:"link",title:null,url:"",children:[]}}function Ke(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function on(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function qt(){return{type:"paragraph",children:[]}}function gt(){return{type:"strong",children:[]}}function St(){return{type:"text",value:""}}function ft(){return{type:"thematicBreak"}}}function Vc(e){return{line:e.line,column:e.column,offset:e.offset}}function uO(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?uO(e,s):WZ(e,s)}}function WZ(e,t){let n;for(n in t)if(cO.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 S9(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Y0({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Y0({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Y0({start:t.start,end:t.end})+") is still open")}function GZ(e){const t=this;t.parser=n;function n(s){return UZ(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function KZ(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 YZ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function QZ(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 XZ(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JZ(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZZ(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=xm(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 l={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,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function eee(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 tee(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function dO(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 nee(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return dO(e,t);const r={src:xm(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 see(e,t){const n={src:xm(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 ree(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 iee(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return dO(e,t);const r={href:xm(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 oee(e,t){const n={href:xm(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 aee(e,t,n){const s=e.all(t),r=n?lee(n):hO(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 l=s[s.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,c),e.applyData(t,c)}function lee(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=hO(n[s])}return t}function hO(e){const t=e.spread;return t??e.children.length>1}function cee(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 uee(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dee(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function hee(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fee(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=i5(t.children[1]),l=VD(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),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 mee(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 l=-1;const c=[];for(;++l<a;){const h=t.children[l],f={},m=o?o[l]:void 0;m&&(f.align=m);let g={type:"element",tagName:i,properties:f,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),c.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function pee(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const T9=9,C9=32;function gee(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(A9(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(A9(t.slice(r),r>0,!1)),i.join("")}function A9(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===T9||i===C9;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===T9||i===C9;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function yee(e,t){const n={type:"text",value:gee(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function bee(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wee={blockquote:KZ,break:YZ,code:QZ,delete:XZ,emphasis:JZ,footnoteReference:ZZ,heading:eee,html:tee,imageReference:nee,image:see,inlineCode:ree,linkReference:iee,link:oee,listItem:aee,list:cee,paragraph:uee,root:dee,strong:hee,table:fee,tableCell:pee,tableRow:mee,text:yee,thematicBreak:bee,toml:f1,yaml:f1,definition:f1,footnoteDefinition:f1};function f1(){}const fO=-1,rv=0,X0=1,Nb=2,h5=3,f5=4,m5=5,p5=6,mO=7,pO=8,E9=typeof self=="object"?self:globalThis,vee=(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 rv:case fO:return n(o,r);case X0:{const a=n([],r);for(const l of o)a.push(s(l));return a}case Nb:{const a=n({},r);for(const[l,c]of o)a[s(l)]=s(c);return a}case h5:return n(new Date(o),r);case f5:{const{source:a,flags:l}=o;return n(new RegExp(a,l),r)}case m5:{const a=n(new Map,r);for(const[l,c]of o)a.set(s(l),s(c));return a}case p5:{const a=n(new Set,r);for(const l of o)a.add(s(l));return a}case mO:{const{name:a,message:l}=o;return n(new E9[a](l),r)}case pO: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 E9[i](o),r)};return s},M9=e=>vee(new Map,e)(0),$h="",{toString:xee}={},{keys:_ee}=Object,Zm=e=>{const t=typeof e;if(t!=="object"||!e)return[rv,t];const n=xee.call(e).slice(8,-1);switch(n){case"Array":return[X0,$h];case"Object":return[Nb,$h];case"Date":return[h5,$h];case"RegExp":return[f5,$h];case"Map":return[m5,$h];case"Set":return[p5,$h];case"DataView":return[X0,n]}return n.includes("Array")?[X0,n]:n.includes("Error")?[mO,n]:[Nb,n]},m1=([e,t])=>e===rv&&(t==="function"||t==="symbol"),kee=(e,t,n,s)=>{const r=(o,a)=>{const l=s.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=Zm(o);switch(a){case rv:{let d=o;switch(l){case"bigint":a=pO,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return r([fO],o)}return r([a,d],o)}case X0:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),r([l,[...f]],o)}const d=[],h=r([a,d],o);for(const f of o)d.push(i(f));return h}case Nb:{if(l)switch(l){case"BigInt":return r([l,o.toString()],o);case"Boolean":case"Number":case"String":return r([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=r([a,d],o);for(const f of _ee(o))(e||!m1(Zm(o[f])))&&d.push([i(f),i(o[f])]);return h}case h5:return r([a,o.toISOString()],o);case f5:{const{source:d,flags:h}=o;return r([a,{source:d,flags:h}],o)}case m5:{const d=[],h=r([a,d],o);for(const[f,m]of o)(e||!(m1(Zm(f))||m1(Zm(m))))&&d.push([i(f),i(m)]);return h}case p5:{const d=[],h=r([a,d],o);for(const f of o)(e||!m1(Zm(f)))&&d.push(i(f));return h}}const{message:c}=o;return r([a,{name:l,message:c}],o)};return i},N9=(e,{json:t,lossy:n}={})=>{const s=[];return kee(!(t||n),!!t,new Map,s)(e),s},Ib=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?M9(N9(e,t)):structuredClone(e):(e,t)=>M9(N9(e,t));function See(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 Tee(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Cee(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||See,s=e.options.footnoteBackLabel||Tee,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const d=e.all(c),h=String(c.identifier).toUpperCase(),f=xm(h.toLowerCase());let m=0;const g=[],y=e.footnoteCounts.get(h);for(;y!==void 0&&++m<=y;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,m);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(l,m),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const v=b.children[b.children.length-1];v&&v.type==="text"?v.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else d.push(...g);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(c,w),a.push(w)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ib(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 yg=function(e){if(e==null)return Nee;if(typeof e=="function")return iv(e);if(typeof e=="object")return Array.isArray(e)?Aee(e):Eee(e);if(typeof e=="string")return Mee(e);throw new Error("Expected function, string, or object as test")};function Aee(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=yg(e[n]);return iv(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function Eee(e){const t=e;return iv(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Mee(e){return iv(t);function t(n){return n&&n.type===e}}function iv(e){return t;function t(n,s,r){return!!(Iee(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function Nee(){return!0}function Iee(e){return e!==null&&typeof e=="object"&&"type"in e}const gO=[],jee=!0,Ok=!1,yO="skip";function g5(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=yg(r),o=s?-1:1;a(e,void 0,[])();function a(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=gO,g,y,b;if((!t||i(l,c,d[d.length-1]||void 0))&&(m=Ree(n(l,d)),m[0]===Ok))return m;if("children"in l&&l.children){const w=l;if(w.children&&m[0]!==yO)for(y=(s?w.children.length:-1)+o,b=d.concat(w);y>-1&&y<w.children.length;){const v=w.children[y];if(g=a(v,y,b)(),g[0]===Ok)return g;y=typeof g[1]=="number"?g[1]:y+o}}return m}}}function Ree(e){return Array.isArray(e)?e:typeof e=="number"?[jee,e]:e==null?gO:[e]}function y5(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),g5(e,i,a,r);function a(l,c){const d=c[c.length-1],h=d?d.children.indexOf(l):void 0;return o(l,h,d)}}const Bk={}.hasOwnProperty,Lee={};function Dee(e,t){const n=t||Lee,s=new Map,r=new Map,i=new Map,o={...wee,...n.handlers},a={all:c,applyData:Bee,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:Oee,wrap:$ee};return y5(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?s:r,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),a;function l(d,h){const f=d.type,m=a.handlers[f];if(Bk.call(a.handlers,f)&&m)return m(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in d){const{children:y,...b}=d,w=Ib(b);return w.children=a.all(d),w}return Ib(d)}return(a.options.unknownHandler||Pee)(a,d,h)}function c(d){const h=[];if("children"in d){const f=d.children;let m=-1;for(;++m<f.length;){const g=a.one(f[m],d);if(g){if(m&&f[m-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=I9(g.value)),!Array.isArray(g)&&g.type==="element")){const y=g.children[0];y&&y.type==="text"&&(y.value=I9(y.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function Oee(e,t){e.position&&(t.position=TX(e))}function Bee(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,Ib(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function Pee(e,t){const n=t.data||{},s="value"in t&&!(Bk.call(n,"hProperties")||Bk.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 $ee(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 I9(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function j9(e,t){const n=Dee(e,t),s=n.one(e,void 0),r=Cee(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
`},r),i}function zee(e,t){return e&&"run"in e?async function(n,s){const r=j9(n,{file:s,...t});await e.run(r,s)}:function(n,s){return j9(n,{file:s,...e||t})}}function R9(e){if(e)throw e}var Ey=Object.prototype.hasOwnProperty,bO=Object.prototype.toString,L9=Object.defineProperty,D9=Object.getOwnPropertyDescriptor,O9=function(t){return typeof Array.isArray=="function"?Array.isArray(t):bO.call(t)==="[object Array]"},B9=function(t){if(!t||bO.call(t)!=="[object Object]")return!1;var n=Ey.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&Ey.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||Ey.call(t,r)},P9=function(t,n){L9&&n.name==="__proto__"?L9(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},$9=function(t,n){if(n==="__proto__")if(Ey.call(t,n)){if(D9)return D9(t,n).value}else return;return t[n]},Fee=function e(){var t,n,s,r,i,o,a=arguments[0],l=1,c=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)s=$9(a,n),r=$9(t,n),a!==r&&(d&&r&&(B9(r)||(i=O9(r)))?(i?(i=!1,o=s&&O9(s)?s:[]):o=s&&B9(s)?s:{},P9(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&P9(a,{name:n,newValue:r}));return a};const kx=Cw(Fee);function Pk(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 qee(){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(l,...c){const d=e[++i];let h=-1;if(l){o(l);return}for(;++h<r.length;)(c[h]===null||c[h]===void 0)&&(c[h]=r[h]);r=c,d?Hee(d,a)(...c):o(null,...c)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function Hee(e,t){let n;return s;function s(...o){const a=e.length>o.length;let l;a&&o.push(r);try{l=e.apply(this,o)}catch(c){const d=c;if(a&&n)throw d;return r(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,r):l instanceof Error?r(l):i(l))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const ml={basename:Uee,dirname:Vee,extname:Wee,join:Gee,sep:"/"};function Uee(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');bg(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 Vee(e){if(bg(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 Wee(e){bg(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 Gee(...e){let t=-1,n;for(;++t<e.length;)bg(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Kee(n)}function Kee(e){bg(e);const t=e.codePointAt(0)===47;let n=Yee(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Yee(e,t){let n="",s=0,r=-1,i=0,o=-1,a,l;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(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",s=0):(n=n.slice(0,l),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 bg(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Qee={cwd:Xee};function Xee(){return"/"}function $k(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Jee(e){if(typeof e=="string")e=new URL(e);else if(!$k(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 Zee(e)}function Zee(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 Sx=["history","path","basename","stem","extname","dirname"];class wO{constructor(t){let n;t?$k(t)?n={path:t}:typeof t=="string"||ete(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Qee.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Sx.length;){const i=Sx[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)Sx.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?ml.basename(this.path):void 0}set basename(t){Cx(t,"basename"),Tx(t,"basename"),this.path=ml.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ml.dirname(this.path):void 0}set dirname(t){z9(this.basename,"dirname"),this.path=ml.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ml.extname(this.path):void 0}set extname(t){if(Tx(t,"extname"),z9(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=ml.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){$k(t)&&(t=Jee(t)),Cx(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ml.basename(this.path,this.extname):void 0}set stem(t){Cx(t,"stem"),Tx(t,"stem"),this.path=ml.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 $i(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 Tx(e,t){if(e&&e.includes(ml.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ml.sep+"`")}function Cx(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function z9(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ete(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const tte=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},nte={}.hasOwnProperty;class b5 extends tte{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=qee()}copy(){const t=new b5;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(kx(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Mx("data",this.frozen),this.namespace[t]=n,this):nte.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Mx("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=p1(t),s=this.parser||this.Parser;return Ax("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Ax("process",this.parser||this.Parser),Ex("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=p1(t),l=s.parse(a);s.run(l,a,function(d,h,f){if(d||!h||!f)return c(d);const m=h,g=s.stringify(m,f);ite(g)?f.value=g:f.result=g,c(d,f)});function c(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),Ax("processSync",this.parser||this.Parser),Ex("processSync",this.compiler||this.Compiler),this.process(t,r),q9("processSync","process",n),s;function r(i,o){n=!0,R9(i),s=o}}run(t,n,s){F9(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 l=p1(n);r.run(t,l,c);function c(d,h,f){const m=h||t;d?a(d):o?o(m):s(void 0,m,f)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),q9("runSync","run",s),r;function i(o,a){R9(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=p1(n),r=this.compiler||this.Compiler;return Ex("stringify",r),F9(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(Mx("use",this.frozen),t!=null)if(typeof t=="function")l(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(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;l(d,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))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(c.plugins),c.settings&&(r.settings=kx(!0,r.settings,c.settings))}function a(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let h=-1,f=-1;for(;++h<s.length;)if(s[h][0]===c){f=h;break}if(f===-1)s.push([c,...d]);else if(d.length>0){let[m,...g]=d;const y=s[f][1];Pk(y)&&Pk(m)&&(m=kx(!0,y,m)),s[f]=[c,m,...g]}}}}const ste=new b5().freeze();function Ax(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ex(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Mx(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 F9(e){if(!Pk(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function q9(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function p1(e){return rte(e)?e:new wO(e)}function rte(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ite(e){return typeof e=="string"||ote(e)}function ote(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ate="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",H9=[],U9={allowDangerousHtml:!0},lte=/^(https?|ircs?|mailto|xmpp)$/i,cte=[{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 ute(e){const t=dte(e),n=hte(e);return fte(t.runSync(t.parse(n),n),e)}function dte(e){const t=e.rehypePlugins||H9,n=e.remarkPlugins||H9,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...U9}:U9;return ste().use(GZ).use(n).use(zee,s).use(t)}function hte(e){const t=e.children||"",n=new wO;return typeof t=="string"&&(n.value=t),n}function fte(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||vO;for(const d of cte)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+ate+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),y5(e,c),NX(e,{Fragment:u.Fragment,components:r,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function c(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let m;for(m in vx)if(Object.hasOwn(vx,m)&&Object.hasOwn(d.properties,m)){const g=d.properties[m],y=vx[m];(y===null||y.includes(d.tagName))&&(d.properties[m]=l(String(g||""),m,d))}}if(d.type==="element"){let m=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!m&&s&&typeof h=="number"&&(m=!s(d,h,f)),m&&f&&typeof h=="number")return a&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function vO(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||lte.test(e.slice(0,t))?e:""}function jb(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 mte(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function pte(e,t,n){const r=yg((n||{}).ignore||[]),i=gte(t);let o=-1;for(;++o<i.length;)g5(e,"text",a);function a(c,d){let h=-1,f;for(;++h<d.length;){const m=d[h],g=f?f.children:void 0;if(r(m,g?g.indexOf(m):void 0,f))return;f=m}if(f)return l(c,d)}function l(c,d){const h=d[d.length-1],f=i[o][0],m=i[o][1];let g=0;const b=h.children.indexOf(c);let w=!1,v=[];f.lastIndex=0;let x=f.exec(c.value);for(;x;){const C=x.index,A={index:x.index,input:x.input,stack:[...d,c]};let T=m(...x,A);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?f.lastIndex=C+1:(g!==C&&v.push({type:"text",value:c.value.slice(g,C)}),Array.isArray(T)?v.push(...T):T&&v.push(T),g=C+x[0].length,w=!0),!f.global)break;x=f.exec(c.value)}return w?(g<c.value.length&&v.push({type:"text",value:c.value.slice(g)}),h.children.splice(b,1,...v)):v=[c],b+v.length}}function gte(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([yte(r[0]),bte(r[1])])}return t}function yte(e){return typeof e=="string"?new RegExp(mte(e),"g"):e}function bte(e){return typeof e=="function"?e:function(){return e}}const Nx="phrasing",Ix=["autolink","link","image","label"];function wte(){return{transforms:[Cte],enter:{literalAutolink:xte,literalAutolinkEmail:jx,literalAutolinkHttp:jx,literalAutolinkWww:jx},exit:{literalAutolink:Tte,literalAutolinkEmail:Ste,literalAutolinkHttp:_te,literalAutolinkWww:kte}}}function vte(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Nx,notInConstruct:Ix},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Nx,notInConstruct:Ix},{character:":",before:"[ps]",after:"\\/",inConstruct:Nx,notInConstruct:Ix}]}}function xte(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function jx(e){this.config.enter.autolinkProtocol.call(this,e)}function _te(e){this.config.exit.autolinkProtocol.call(this,e)}function kte(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 Ste(e){this.config.exit.autolinkEmail.call(this,e)}function Tte(e){this.exit(e)}function Cte(e){pte(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ate],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ete]],{ignore:["link","linkReference"]})}function Ate(e,t,n,s,r){let i="";if(!xO(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Mte(n)))return!1;const o=Nte(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 Ete(e,t,n,s){return!xO(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Mte(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 Nte(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=jb(e,"(");let i=jb(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 xO(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||sh(n)||nv(n))&&(!t||n!==47)}_O.peek=$te;function Ite(){this.buffer()}function jte(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Rte(){this.buffer()}function Lte(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Dte(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=za(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ote(e){this.exit(e)}function Bte(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=za(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Pte(e){this.exit(e)}function $te(){return"["}function _O(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 zte(){return{enter:{gfmFootnoteCallString:Ite,gfmFootnoteCall:jte,gfmFootnoteDefinitionLabelString:Rte,gfmFootnoteDefinition:Lte},exit:{gfmFootnoteCallString:Dte,gfmFootnoteCall:Ote,gfmFootnoteDefinitionLabelString:Bte,gfmFootnoteDefinition:Pte}}}function Fte(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:_O},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),d=i.enter("label");return l+=a.move(i.safe(i.associationId(s),{before:l,after:"]"})),d(),l+=a.move("]:"),s.children&&s.children.length>0&&(a.shift(4),l+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(s,a.current()),t?kO:qte))),c(),l}}function qte(e,t,n){return t===0?e:kO(e,t,n)}function kO(e,t,n){return(n?"":"    ")+e}const Hte=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];SO.peek=Kte;function Ute(){return{canContainEols:["delete"],enter:{strikethrough:Wte},exit:{strikethrough:Gte}}}function Vte(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Hte}],handlers:{delete:SO}}}function Wte(e){this.enter({type:"delete",children:[]},e)}function Gte(e){this.exit(e)}function SO(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 Kte(){return"~"}function Yte(e){return e.length}function Qte(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||Yte,i=[],o=[],a=[],l=[];let c=0,d=-1;for(;++d<e.length;){const y=[],b=[];let w=-1;for(e[d].length>c&&(c=e[d].length);++w<e[d].length;){const v=Xte(e[d][w]);if(n.alignDelimiters!==!1){const x=r(v);b[w]=x,(l[w]===void 0||x>l[w])&&(l[w]=x)}y.push(v)}o[d]=y,a[d]=b}let h=-1;if(typeof s=="object"&&"length"in s)for(;++h<c;)i[h]=V9(s[h]);else{const y=V9(s);for(;++h<c;)i[h]=y}h=-1;const f=[],m=[];for(;++h<c;){const y=i[h];let b="",w="";y===99?(b=":",w=":"):y===108?b=":":y===114&&(w=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[h]-b.length-w.length);const x=b+"-".repeat(v)+w;n.alignDelimiters!==!1&&(v=b.length+v+w.length,v>l[h]&&(l[h]=v),m[h]=v),f[h]=x}o.splice(1,0,f),a.splice(1,0,m),d=-1;const g=[];for(;++d<o.length;){const y=o[d],b=a[d];h=-1;const w=[];for(;++h<c;){const v=y[h]||"";let x="",C="";if(n.alignDelimiters!==!1){const A=l[h]-(b[h]||0),T=i[h];T===114?x=" ".repeat(A):T===99?A%2?(x=" ".repeat(A/2+.5),C=" ".repeat(A/2-.5)):(x=" ".repeat(A/2),C=x):C=" ".repeat(A)}n.delimiterStart!==!1&&!h&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||h)&&w.push(" "),n.alignDelimiters!==!1&&w.push(x),w.push(v),n.alignDelimiters!==!1&&w.push(C),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||h!==c-1)&&w.push("|")}g.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return g.join(`
`)}function Xte(e){return e==null?"":String(e)}function V9(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 W9={}.hasOwnProperty;function Jte(e,t){const n=t||{};function s(r,...i){let o=s.invalid;const a=s.handlers;if(r&&W9.call(r,e)){const l=String(r[e]);o=W9.call(a,l)?a[l]: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 Zte(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()),ene);return r(),o}function ene(e,t,n){return">"+(n?"":" ")+e}function tne(e,t){return G9(e,t.inConstruct,!0)&&!G9(e,t.notInConstruct,!1)}function G9(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 K9(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&tne(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function TO(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 nne(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 sne(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 rne(e,t,n,s){const r=sne(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(nne(e,n)){const h=n.enter("codeIndented"),f=n.indentLines(i,ine);return h(),f}const a=n.createTracker(s),l=r.repeat(Math.max(TO(i,r)+1,3)),c=n.enter("codeFenced");let d=a.move(l);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(l),c(),d}function ine(e,t,n){return(n?"":"    ")+e}function w5(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 one(e,t,n,s){const r=w5(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+r),c+=l.move(n.safe(e.title,{before:c,after:r,...l.current()})),c+=l.move(r),a()),o(),c}function ane(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 Cp(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Rb(e,t,n){const s=Yf(e),r=Yf(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}}CO.peek=lne;function CO(e,t,n,s){const r=ane(n),i=n.enter("emphasis"),o=n.createTracker(s),a=o.move(r);let l=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const c=l.charCodeAt(0),d=Rb(s.before.charCodeAt(s.before.length-1),c,r);d.inside&&(l=Cp(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=Rb(s.after.charCodeAt(0),h,r);f.inside&&(l=l.slice(0,-1)+Cp(h));const m=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+m}function lne(e,t,n){return n.options.emphasis||"*"}function cne(e,t){let n=!1;return y5(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Ok}),!!((!e.depth||e.depth<3)&&c5(e)&&(t.options.setext||n))}function une(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(cne(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return h(),d(),f+`
`+(r===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
`))+1))}const o="#".repeat(r),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(c)&&(c=Cp(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}AO.peek=dne;function AO(e){return e.value||""}function dne(){return"<"}EO.peek=hne;function EO(e,t,n,s){const r=w5(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+r),c+=l.move(n.safe(e.title,{before:c,after:r,...l.current()})),c+=l.move(r),a()),c+=l.move(")"),o(),c}function hne(){return"!"}MO.peek=fne;function MO(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(s);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!c||c!==h?l+=a.move(h+"]"):r==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function fne(){return"!"}NO.peek=mne;function NO(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 l;if(o.atBreak)for(;l=a.exec(s);){let c=l.index;s.charCodeAt(c)===10&&s.charCodeAt(c-1)===13&&c--,s=s.slice(0,c)+" "+s.slice(l.index+1)}}return r+s+r}function mne(){return"`"}function IO(e,t){const n=c5(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))}jO.peek=pne;function jO(e,t,n,s){const r=w5(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,l;if(IO(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"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=o.move(" "+r),c+=o.move(n.safe(e.title,{before:c,after:r,...o.current()})),c+=o.move(r),l()),c+=o.move(")"),a(),c}function pne(e,t,n){return IO(e,n)?"<":"["}RO.peek=gne;function RO(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(s);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!c||c!==h?l+=a.move(h+"]"):r==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function gne(){return"["}function v5(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 yne(e){const t=v5(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 bne(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 LO(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 wne(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?bne(n):v5(n);const a=e.ordered?o==="."?")":".":yne(n);let l=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&&(l=!0),LO(n)===o&&d){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),c}function vne(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 xne(e,t,n,s){const r=vne(n);let i=n.bulletCurrent||v5(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 l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),d);return l(),c;function d(h,f,m){return f?(m?"":" ".repeat(o))+h:(m?i:i+" ".repeat(o-i.length))+h}}function _ne(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const kne=yg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Sne(e,t,n,s){return(e.children.some(function(o){return kne(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function Tne(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}DO.peek=Cne;function DO(e,t,n,s){const r=Tne(n),i=n.enter("strong"),o=n.createTracker(s),a=o.move(r+r);let l=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const c=l.charCodeAt(0),d=Rb(s.before.charCodeAt(s.before.length-1),c,r);d.inside&&(l=Cp(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=Rb(s.after.charCodeAt(0),h,r);f.inside&&(l=l.slice(0,-1)+Cp(h));const m=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+m}function Cne(e,t,n){return n.options.strong||"*"}function Ane(e,t,n,s){return n.safe(e.value,s)}function Ene(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 Mne(e,t,n){const s=(LO(n)+(n.options.ruleSpaces?" ":"")).repeat(Ene(n));return n.options.ruleSpaces?s.slice(0,-1):s}const OO={blockquote:Zte,break:K9,code:rne,definition:one,emphasis:CO,hardBreak:K9,heading:une,html:AO,image:EO,imageReference:MO,inlineCode:NO,link:jO,linkReference:RO,list:wne,listItem:xne,paragraph:_ne,root:Sne,strong:DO,text:Ane,thematicBreak:Mne};function Nne(){return{enter:{table:Ine,tableData:Y9,tableHeader:Y9,tableRow:Rne},exit:{codeText:Lne,table:jne,tableData:Rx,tableHeader:Rx,tableRow:Rx}}}function Ine(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 jne(e){this.exit(e),this.data.inTable=void 0}function Rne(e){this.enter({type:"tableRow",children:[]},e)}function Rx(e){this.exit(e)}function Y9(e){this.enter({type:"tableCell",children:[]},e)}function Lne(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Dne));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Dne(e,t){return t==="|"?t:e}function One(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:f,table:o,tableCell:l,tableRow:a}};function o(m,g,y,b){return c(d(m,y,b),m.align)}function a(m,g,y,b){const w=h(m,y,b),v=c([w]);return v.slice(0,v.indexOf(`
`))}function l(m,g,y,b){const w=y.enter("tableCell"),v=y.enter("phrasing"),x=y.containerPhrasing(m,{...b,before:i,after:i});return v(),w(),x}function c(m,g){return Qte(m,{align:g,alignDelimiters:s,padding:n,stringLength:r})}function d(m,g,y){const b=m.children;let w=-1;const v=[],x=g.enter("table");for(;++w<b.length;)v[w]=h(b[w],g,y);return x(),v}function h(m,g,y){const b=m.children;let w=-1;const v=[],x=g.enter("tableRow");for(;++w<b.length;)v[w]=l(b[w],m,g,y);return x(),v}function f(m,g,y){let b=OO.inlineCode(m,g,y);return y.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function Bne(){return{exit:{taskListCheckValueChecked:Q9,taskListCheckValueUnchecked:Q9,paragraph:$ne}}}function Pne(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:zne}}}function Q9(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function $ne(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 zne(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 l=OO.listItem(e,t,n,{...s,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(d){return d+o}}function Fne(){return[wte(),zte(),Ute(),Nne(),Bne()]}function qne(e){return{extensions:[vte(),Fte(e),Vte(),One(e),Pne()]}}const Hne={tokenize:Yne,partial:!0},BO={tokenize:Qne,partial:!0},PO={tokenize:Xne,partial:!0},$O={tokenize:Jne,partial:!0},Une={tokenize:Zne,partial:!0},zO={name:"wwwAutolink",tokenize:Gne,previous:qO},FO={name:"protocolAutolink",tokenize:Kne,previous:HO},Nc={name:"emailAutolink",tokenize:Wne,previous:UO},Ll={};function Vne(){return{text:Ll}}let pd=48;for(;pd<123;)Ll[pd]=Nc,pd++,pd===58?pd=65:pd===91&&(pd=97);Ll[43]=Nc;Ll[45]=Nc;Ll[46]=Nc;Ll[95]=Nc;Ll[72]=[Nc,FO];Ll[104]=[Nc,FO];Ll[87]=[Nc,zO];Ll[119]=[Nc,zO];function Wne(e,t,n){const s=this;let r,i;return o;function o(h){return!zk(h)||!UO.call(s,s.previous)||x5(s.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return zk(h)?(e.consume(h),a):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check(Une,d,c)(h):h===45||h===95||Di(h)?(i=!0,e.consume(h),l):d(h)}function c(h){return e.consume(h),r=!0,l}function d(h){return i&&r&&Ji(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function Gne(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!qO.call(s,s.previous)||x5(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Hne,e.attempt(BO,e.attempt(PO,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function Kne(e,t,n){const s=this;let r="",i=!1;return o;function o(h){return(h===72||h===104)&&HO.call(s,s.previous)&&!x5(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(Ji(h)&&r.length<5)return r+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const f=r.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),i?c:(i=!0,l)):n(h)}function c(h){return h===null||Mb(h)||Ds(h)||sh(h)||nv(h)?n(h):e.attempt(BO,e.attempt(PO,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function Yne(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 Qne(e,t,n){let s,r,i;return o;function o(c){return c===46||c===95?e.check($O,l,a)(c):c===null||Ds(c)||sh(c)||c!==45&&nv(c)?l(c):(i=!0,e.consume(c),o)}function a(c){return c===95?s=!0:(r=s,s=void 0),e.consume(c),o}function l(c){return r||s||!i?n(c):t(c)}}function Xne(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($O,t,i)(o):o===null||Ds(o)||sh(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function Jne(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||Ds(a)||sh(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||Ds(a)||sh(a)?t(a):s(a)}function i(a){return Ji(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):Ji(a)?(e.consume(a),o):n(a)}}function Zne(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return Di(i)?n(i):t(i)}}function qO(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ds(e)}function HO(e){return!Ji(e)}function UO(e){return!(e===47||zk(e))}function zk(e){return e===43||e===45||e===46||e===95||Di(e)}function x5(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 ese={tokenize:lse,partial:!0};function tse(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ise,continuation:{tokenize:ose},exit:ase}},text:{91:{name:"gfmFootnoteCall",tokenize:rse},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nse,resolveTo:sse}}}}function nse(e,t,n){const s=this;let r=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;r--;){const l=s.events[r][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=za(s.sliceSerialize({start:o.end,end:s.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function sse(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 rse(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"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(i>999||h===93&&!o||h===null||h===91||Ds(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return r.includes(za(s.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Ds(h)||(o=!0),i++,e.consume(h),h===92?d:c}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,c):c(h)}}function ise(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(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||Ds(g))return n(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=za(s.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ds(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 f(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),r.includes(i)||r.push(i),On(e,m,"gfmFootnoteDefinitionWhitespace")):n(g)}function m(g){return t(g)}}function ose(e,t,n){return e.check(gg,t,e.attempt(ese,t,n))}function ase(e){e.exit("gfmFootnoteDefinition")}function lse(e,t,n){const s=this;return On(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 cse(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 l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},h={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",d,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",h,a]],m=a.parser.constructs.insideSpan.null;m&&Vo(f,f.length,0,sv(m,o.slice(c+1,l),a)),Vo(f,f.length,0,[["exit",h,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",d,a]]),Vo(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const c=this.previous,d=this.events;let h=0;return f;function f(g){return c===126&&d[d.length-1][1].type!=="characterEscape"?l(g):(o.enter("strikethroughSequenceTemporary"),m(g))}function m(g){const y=Yf(c);if(g===126)return h>1?l(g):(o.consume(g),h++,m);if(h<2&&!n)return l(g);const b=o.exit("strikethroughSequenceTemporary"),w=Yf(g);return b._open=!w||w===2&&!!y,b._close=!y||y===2&&!!w,a(g)}}}class use{constructor(){this.map=[]}add(t,n,s){dse(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 dse(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 hse(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 fse(){return{flow:{null:{name:"table",tokenize:mse,resolveAll:pse}}}}function mse(e,t,n){const s=this;let r=0,i=0,o;return a;function a(k){let j=s.events.length-1;for(;j>-1;){const $=s.events[j][1].type;if($==="lineEnding"||$==="linePrefix")j--;else break}const N=j>-1?s.events[j][1].type:null,L=N==="tableHead"||N==="tableRow"?T:l;return L===T&&s.parser.lazy[s.now().line]?n(k):L(k)}function l(k){return e.enter("tableHead"),e.enter("tableRow"),c(k)}function c(k){return k===124||(o=!0,i+=1),d(k)}function d(k){return k===null?n(k):Wt(k)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),m):n(k):Fn(k)?On(e,d,"whitespace")(k):(i+=1,o&&(o=!1,r+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(k)))}function h(k){return k===null||k===124||Ds(k)?(e.exit("data"),d(k)):(e.consume(k),k===92?f:h)}function f(k){return k===92||k===124?(e.consume(k),h):h(k)}function m(k){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(k):(e.enter("tableDelimiterRow"),o=!1,Fn(k)?On(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):g(k))}function g(k){return k===45||k===58?b(k):k===124?(o=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),y):A(k)}function y(k){return Fn(k)?On(e,b,"whitespace")(k):b(k)}function b(k){return k===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),w):k===45?(i+=1,w(k)):k===null||Wt(k)?C(k):A(k)}function w(k){return k===45?(e.enter("tableDelimiterFiller"),v(k)):A(k)}function v(k){return k===45?(e.consume(k),v):k===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(k))}function x(k){return Fn(k)?On(e,C,"whitespace")(k):C(k)}function C(k){return k===124?g(k):k===null||Wt(k)?!o||r!==i?A(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(k)):A(k)}function A(k){return n(k)}function T(k){return e.enter("tableRow"),_(k)}function _(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),_):k===null||Wt(k)?(e.exit("tableRow"),t(k)):Fn(k)?On(e,_,"whitespace")(k):(e.enter("data"),R(k))}function R(k){return k===null||k===124||Ds(k)?(e.exit("data"),_(k)):(e.consume(k),k===92?I:R)}function I(k){return k===92||k===124?(e.consume(k),R):R(k)}}function pse(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,d,h;const f=new use;for(;++n<e.length;){const m=e[n],g=m[1];m[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(X9(f,t,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",c,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)},f.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=g1(f,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=g1(f,t,i,r,void 0,h)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(a=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],h=g1(f,t,i,r,n,h)):o[1]!==0&&(h=g1(f,t,o,r,n,h)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&X9(f,t,l,c,d),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=hse(t.events,n))}return e}function g1(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Xh(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Xh(t.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=Xh(t.events,n[2]),d=Xh(t.events,n[3]),h={type:a,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),s!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,y=n[3]-n[2]-1;e.add(g,y,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return r!==void 0&&(i.end=Object.assign({},Xh(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function X9(e,t,n,s,r){const i=[],o=Xh(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 Xh(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const gse={name:"tasklistCheck",tokenize:bse};function yse(){return{text:{91:gse}}}function bse(e,t,n){const s=this;return r;function r(l){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Ds(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return Wt(l)?t(l):Fn(l)?e.check({tokenize:wse},t,n)(l):n(l)}}function wse(e,t,n){return On(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function vse(e){return JD([Vne(),tse(),cse(e),fse(),yse()])}const xse={};function J9(e){const t=this,n=e||xse,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(vse(n)),i.push(Fne()),o.push(qne(n))}function _se(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:r,mathFlowFence:s,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function e(l){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function t(){this.buffer()}function n(){const l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function s(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function r(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c;const h=d.data.hChildren[0];h.type,h.tagName,h.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c,d.data.hChildren.push({type:"text",value:c})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function kse(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,l){const c=i.value||"",d=a.createTracker(l),h="$".repeat(Math.max(TO(c,"$")+1,2)),f=a.enter("mathFlow");let m=d.move(h);if(i.meta){const g=a.enter("mathFlowMeta");m+=d.move(a.safe(i.meta,{after:`
`,before:m,encode:["$"],...d.current()})),g()}return m+=d.move(`
`),c&&(m+=d.move(c+`
`)),m+=d.move(h),f(),m}function s(i,o,a){let l=i.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const d="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let h=-1;for(;++h<a.unsafe.length;){const f=a.unsafe[h];if(!f.atBreak)continue;const m=a.compilePattern(f);let g;for(;g=m.exec(l);){let y=g.index;l.codePointAt(y)===10&&l.codePointAt(y-1)===13&&y--,l=l.slice(0,y)+" "+l.slice(g.index+1)}}return d+l+d}function r(){return"$"}}const Sse={tokenize:Tse,concrete:!0,name:"mathFlow"},Z9={tokenize:Cse,partial:!0};function Tse(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"),l(v)}function l(v){return v===36?(e.consume(v),o++,l):o<2?n(v):(e.exit("mathFlowFenceSequence"),On(e,c,"whitespace")(v))}function c(v){return v===null||Wt(v)?h(v):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||Wt(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(Z9,f,b)(v)}function f(v){return e.attempt({tokenize:w,partial:!0},b,m)(v)}function m(v){return(i?On(e,g,"linePrefix",i+1):g)(v)}function g(v){return v===null?b(v):Wt(v)?e.attempt(Z9,f,b)(v):(e.enter("mathFlowValue"),y(v))}function y(v){return v===null||Wt(v)?(e.exit("mathFlowValue"),g(v)):(e.consume(v),y)}function b(v){return e.exit("mathFlow"),t(v)}function w(v,x,C){let A=0;return On(v,T,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function T(I){return v.enter("mathFlowFence"),v.enter("mathFlowFenceSequence"),_(I)}function _(I){return I===36?(A++,v.consume(I),_):A<o?C(I):(v.exit("mathFlowFenceSequence"),On(v,R,"whitespace")(I))}function R(I){return I===null||Wt(I)?(v.exit("mathFlowFence"),x(I)):C(I)}}}function Cse(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 Ase(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:s,resolve:Ese,previous:Mse,name:"mathText"};function s(r,i,o){let a=0,l,c;return d;function d(y){return r.enter("mathText"),r.enter("mathTextSequence"),h(y)}function h(y){return y===36?(r.consume(y),a++,h):a<2&&!n?o(y):(r.exit("mathTextSequence"),f(y))}function f(y){return y===null?o(y):y===36?(c=r.enter("mathTextSequence"),l=0,g(y)):y===32?(r.enter("space"),r.consume(y),r.exit("space"),f):Wt(y)?(r.enter("lineEnding"),r.consume(y),r.exit("lineEnding"),f):(r.enter("mathTextData"),m(y))}function m(y){return y===null||y===32||y===36||Wt(y)?(r.exit("mathTextData"),f(y)):(r.consume(y),m)}function g(y){return y===36?(r.consume(y),l++,g):l===a?(r.exit("mathTextSequence"),r.exit("mathText"),i(y)):(c.type="mathTextData",m(y))}}}function Ese(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 Mse(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Nse(e){return{flow:{36:Sse},text:{36:Ase(e)}}}class Ze 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 l=a.slice(r,i).replace(/[^]/g,"$&̲"),c;r>15?c="…"+a.slice(r-15,r):c=a.slice(0,r);var d;i+15<a.length?d=a.slice(i,i+15)+"…":d=a.slice(i),s+=c+l+d}super(s),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,Ze.prototype),this.position=r,r!=null&&i!=null&&(this.length=i-r),this.rawMessage=t}}var Ise=/([A-Z])/g,jse=e=>e.replace(Ise,"-$1").toLowerCase(),Rse={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Lse=/[&><"']/g,Bi=e=>String(e).replace(Lse,t=>Rse[t]),My=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?My(e.body[0]):e:e.type==="font"?My(e.body):e,Dse=new Set(["mathord","textord","atom"]),Ic=e=>Dse.has(My(e).type),Ose=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"},Lb={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 Bse(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 Pse(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return Bse(t)}function $se(e,t,n,s){var r=n[t];e[t]=r!==void 0?s.processor?s.processor(r):r:Pse(s)}class _5{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(Lb)){var s=Lb[n];s&&$se(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 Ze("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=Ose(t.url);if(n==null)return!1;t.protocol=n}var s=typeof this.trust=="function"?this.trust(t):this.trust;return!!s}}class Wc{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 gl[zse[this.id]]}sub(){return gl[Fse[this.id]]}fracNum(){return gl[qse[this.id]]}fracDen(){return gl[Hse[this.id]]}cramp(){return gl[Use[this.id]]}text(){return gl[Vse[this.id]]}isTight(){return this.size>=2}}var k5=0,Db=1,Ef=2,pc=3,Ap=4,fa=5,Qf=6,eo=7,gl=[new Wc(k5,0,!1),new Wc(Db,0,!0),new Wc(Ef,1,!1),new Wc(pc,1,!0),new Wc(Ap,2,!1),new Wc(fa,2,!0),new Wc(Qf,3,!1),new Wc(eo,3,!0)],zse=[Ap,fa,Ap,fa,Qf,eo,Qf,eo],Fse=[fa,fa,fa,fa,eo,eo,eo,eo],qse=[Ef,pc,Ap,fa,Qf,eo,Qf,eo],Hse=[pc,pc,fa,fa,eo,eo,eo,eo],Use=[Db,Db,pc,pc,fa,fa,eo,eo],Vse=[k5,Db,Ef,pc,Ef,pc,Ef,pc],yn={DISPLAY:gl[k5],TEXT:gl[Ef],SCRIPT:gl[Ap],SCRIPTSCRIPT:gl[Qf]},Fk=[{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 Wse(e){for(var t=0;t<Fk.length;t++)for(var n=Fk[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 Ny=[];Fk.forEach(e=>e.blocks.forEach(t=>Ny.push(...t)));function VO(e){for(var t=0;t<Ny.length;t+=2)if(e>=Ny[t]&&e<=Ny[t+1])return!0;return!1}var Rr=e=>e+" "+e,zh=80,Gse=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"},Kse=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"},Yse=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"},Qse=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"},Xse=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"},Jse=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},Zse=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"},ere=function(t,n,s){n=1e3*n;var r="";switch(t){case"sqrtMain":r=Gse(n,zh);break;case"sqrtSize1":r=Kse(n,zh);break;case"sqrtSize2":r=Yse(n,zh);break;case"sqrtSize3":r=Qse(n,zh);break;case"sqrtSize4":r=Xse(n,zh);break;case"sqrtTall":r=Zse(n,zh,s)}return r},tre=function(t,n){switch(t){case"⎜":return Rr("M291 0 H417 V"+n+" H291z");case"∣":return Rr("M145 0 H188 V"+n+" H145z");case"∥":return Rr("M145 0 H188 V"+n+" H145z")+Rr("M367 0 H410 V"+n+" H367z");case"⎟":return Rr("M457 0 H583 V"+n+" H457z");case"⎢":return Rr("M319 0 H403 V"+n+" H319z");case"⎥":return Rr("M263 0 H347 V"+n+" H263z");case"⎪":return Rr("M384 0 H504 V"+n+" H384z");case"⏐":return Rr("M312 0 H355 V"+n+" H312z");case"‖":return Rr("M257 0 H300 V"+n+" H257z")+Rr("M478 0 H521 V"+n+" H478z");default:return""}},eA={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:Rr("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Rr("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Rr("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Rr("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:Rr("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:Rr("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Rr("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Rr("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`},nre=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 sre(e){return"toText"in e}class _m{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(sre(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}}var qk={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},rre={ex:!0,em:!0,mu:!0},WO=function(t){return typeof t!="string"&&(t=t.unit),t in qk||t in rre||t==="ex"},or=function(t,n){var s;if(t.unit in qk)s=qk[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 Ze("Invalid unit: '"+t.unit+"'");r!==n&&(s*=r.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*s,n.maxSize)},at=function(t){return+t.toFixed(4)+"em"},Hu=function(t){return t.filter(n=>n).join(" ")},S5=function(t){var n="";for(var s of Object.keys(t)){var r=t[s];r!==void 0&&(n+=jse(s)+":"+r+";")}return n},GO=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)}},KO=function(t){var n=document.createElement(t);n.className=Hu(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},ire=/[\s"'>/=\x00-\x1f]/,YO=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+Bi(Hu(this.classes))+'"');var s=S5(this.style);s&&(n+=' style="'+Bi(s)+'"');for(var r of Object.keys(this.attributes)){if(ire.test(r))throw new Ze("Invalid attribute name '"+r+"'");n+=" "+r+'="'+Bi(this.attributes[r])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class km{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,GO.call(this,t,s,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return KO.call(this,"span")}toMarkup(){return YO.call(this,"span")}}class ov{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,GO.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 KO.call(this,"a")}toMarkup(){return YO.call(this,"a")}}class ore{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="'+Bi(this.src)+'"'+(' alt="'+Bi(this.alt)+'"'),n=S5(this.style);return n&&(t+=' style="'+Bi(n)+'"'),t+="'/>",t}}var are={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Yo{constructor(t,n,s,r,i,o,a,l){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=l||{},this.maxFontSize=0;var c=Wse(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=are[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=at(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Hu(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+=Bi(Hu(this.classes)),n+='"');var s="";this.italic>0&&(s+="margin-right:"+at(this.italic)+";"),s+=S5(this.style),s&&(t=!0,n+=' style="'+Bi(s)+'"');var r=Bi(this.text);return t?(n+=">",n+=r,n+="</span>",n):r}}class Cc{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+'="'+Bi(this.attributes[n])+'"';t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</svg>",t}}class Uu{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",eA[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+Bi(this.alternate)+'"/>':'<path d="'+Bi(eA[this.pathName])+'"/>'}}class Hk{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+'="'+Bi(this.attributes[n])+'"';return t+="/>",t}}function lre(e){if(e instanceof Yo)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function cre(e){if(e instanceof km)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var ure=e=>e instanceof km||e instanceof ov||e instanceof _m,kl={"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]}},y1={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]},tA={Å:"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 QO(e,t){kl[e]=t}function T5(e,t,n){if(!kl[t])throw new Error("Font metrics not found for font: "+t+".");var s=e.charCodeAt(0),r=kl[t][s];if(!r&&e[0]in tA&&(s=tA[e[0]].charCodeAt(0),r=kl[t][s]),!r&&n==="text"&&VO(s)&&(r=kl[t][77]),r)return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}var Lx={};function dre(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Lx[t]){var n=Lx[t]={cssEmPerMu:y1.quad[t]/18};for(var s in y1)y1.hasOwnProperty(s)&&(n[s]=y1[s][t])}return Lx[t]}var Xs={math:{},text:{}};function S(e,t,n,s,r,i){Xs[e][r]={font:t,group:n,replace:s},i&&s&&(Xs[e][s]=Xs[e][r])}var E="math",He="text",O="main",Z="ams",Js="accent-token",It="bin",ro="close",Sm="inner",sn="mathord",Nr="op-token",Qo="open",wg="punct",ee="rel",jc="spacing",ce="textord";S(E,O,ee,"≡","\\equiv",!0);S(E,O,ee,"≺","\\prec",!0);S(E,O,ee,"≻","\\succ",!0);S(E,O,ee,"∼","\\sim",!0);S(E,O,ee,"⊥","\\perp");S(E,O,ee,"⪯","\\preceq",!0);S(E,O,ee,"⪰","\\succeq",!0);S(E,O,ee,"≃","\\simeq",!0);S(E,O,ee,"∣","\\mid",!0);S(E,O,ee,"≪","\\ll",!0);S(E,O,ee,"≫","\\gg",!0);S(E,O,ee,"≍","\\asymp",!0);S(E,O,ee,"∥","\\parallel");S(E,O,ee,"⋈","\\bowtie",!0);S(E,O,ee,"⌣","\\smile",!0);S(E,O,ee,"⊑","\\sqsubseteq",!0);S(E,O,ee,"⊒","\\sqsupseteq",!0);S(E,O,ee,"≐","\\doteq",!0);S(E,O,ee,"⌢","\\frown",!0);S(E,O,ee,"∋","\\ni",!0);S(E,O,ee,"∝","\\propto",!0);S(E,O,ee,"⊢","\\vdash",!0);S(E,O,ee,"⊣","\\dashv",!0);S(E,O,ee,"∋","\\owns");S(E,O,wg,".","\\ldotp");S(E,O,wg,"⋅","\\cdotp");S(E,O,wg,"⋅","·");S(He,O,ce,"⋅","·");S(E,O,ce,"#","\\#");S(He,O,ce,"#","\\#");S(E,O,ce,"&","\\&");S(He,O,ce,"&","\\&");S(E,O,ce,"ℵ","\\aleph",!0);S(E,O,ce,"∀","\\forall",!0);S(E,O,ce,"ℏ","\\hbar",!0);S(E,O,ce,"∃","\\exists",!0);S(E,O,ce,"∇","\\nabla",!0);S(E,O,ce,"♭","\\flat",!0);S(E,O,ce,"ℓ","\\ell",!0);S(E,O,ce,"♮","\\natural",!0);S(E,O,ce,"♣","\\clubsuit",!0);S(E,O,ce,"℘","\\wp",!0);S(E,O,ce,"♯","\\sharp",!0);S(E,O,ce,"♢","\\diamondsuit",!0);S(E,O,ce,"ℜ","\\Re",!0);S(E,O,ce,"♡","\\heartsuit",!0);S(E,O,ce,"ℑ","\\Im",!0);S(E,O,ce,"♠","\\spadesuit",!0);S(E,O,ce,"§","\\S",!0);S(He,O,ce,"§","\\S");S(E,O,ce,"¶","\\P",!0);S(He,O,ce,"¶","\\P");S(E,O,ce,"†","\\dag");S(He,O,ce,"†","\\dag");S(He,O,ce,"†","\\textdagger");S(E,O,ce,"‡","\\ddag");S(He,O,ce,"‡","\\ddag");S(He,O,ce,"‡","\\textdaggerdbl");S(E,O,ro,"⎱","\\rmoustache",!0);S(E,O,Qo,"⎰","\\lmoustache",!0);S(E,O,ro,"⟯","\\rgroup",!0);S(E,O,Qo,"⟮","\\lgroup",!0);S(E,O,It,"∓","\\mp",!0);S(E,O,It,"⊖","\\ominus",!0);S(E,O,It,"⊎","\\uplus",!0);S(E,O,It,"⊓","\\sqcap",!0);S(E,O,It,"∗","\\ast");S(E,O,It,"⊔","\\sqcup",!0);S(E,O,It,"◯","\\bigcirc",!0);S(E,O,It,"∙","\\bullet",!0);S(E,O,It,"‡","\\ddagger");S(E,O,It,"≀","\\wr",!0);S(E,O,It,"⨿","\\amalg");S(E,O,It,"&","\\And");S(E,O,ee,"⟵","\\longleftarrow",!0);S(E,O,ee,"⇐","\\Leftarrow",!0);S(E,O,ee,"⟸","\\Longleftarrow",!0);S(E,O,ee,"⟶","\\longrightarrow",!0);S(E,O,ee,"⇒","\\Rightarrow",!0);S(E,O,ee,"⟹","\\Longrightarrow",!0);S(E,O,ee,"↔","\\leftrightarrow",!0);S(E,O,ee,"⟷","\\longleftrightarrow",!0);S(E,O,ee,"⇔","\\Leftrightarrow",!0);S(E,O,ee,"⟺","\\Longleftrightarrow",!0);S(E,O,ee,"↦","\\mapsto",!0);S(E,O,ee,"⟼","\\longmapsto",!0);S(E,O,ee,"↗","\\nearrow",!0);S(E,O,ee,"↩","\\hookleftarrow",!0);S(E,O,ee,"↪","\\hookrightarrow",!0);S(E,O,ee,"↘","\\searrow",!0);S(E,O,ee,"↼","\\leftharpoonup",!0);S(E,O,ee,"⇀","\\rightharpoonup",!0);S(E,O,ee,"↙","\\swarrow",!0);S(E,O,ee,"↽","\\leftharpoondown",!0);S(E,O,ee,"⇁","\\rightharpoondown",!0);S(E,O,ee,"↖","\\nwarrow",!0);S(E,O,ee,"⇌","\\rightleftharpoons",!0);S(E,Z,ee,"≮","\\nless",!0);S(E,Z,ee,"","\\@nleqslant");S(E,Z,ee,"","\\@nleqq");S(E,Z,ee,"⪇","\\lneq",!0);S(E,Z,ee,"≨","\\lneqq",!0);S(E,Z,ee,"","\\@lvertneqq");S(E,Z,ee,"⋦","\\lnsim",!0);S(E,Z,ee,"⪉","\\lnapprox",!0);S(E,Z,ee,"⊀","\\nprec",!0);S(E,Z,ee,"⋠","\\npreceq",!0);S(E,Z,ee,"⋨","\\precnsim",!0);S(E,Z,ee,"⪹","\\precnapprox",!0);S(E,Z,ee,"≁","\\nsim",!0);S(E,Z,ee,"","\\@nshortmid");S(E,Z,ee,"∤","\\nmid",!0);S(E,Z,ee,"⊬","\\nvdash",!0);S(E,Z,ee,"⊭","\\nvDash",!0);S(E,Z,ee,"⋪","\\ntriangleleft");S(E,Z,ee,"⋬","\\ntrianglelefteq",!0);S(E,Z,ee,"⊊","\\subsetneq",!0);S(E,Z,ee,"","\\@varsubsetneq");S(E,Z,ee,"⫋","\\subsetneqq",!0);S(E,Z,ee,"","\\@varsubsetneqq");S(E,Z,ee,"≯","\\ngtr",!0);S(E,Z,ee,"","\\@ngeqslant");S(E,Z,ee,"","\\@ngeqq");S(E,Z,ee,"⪈","\\gneq",!0);S(E,Z,ee,"≩","\\gneqq",!0);S(E,Z,ee,"","\\@gvertneqq");S(E,Z,ee,"⋧","\\gnsim",!0);S(E,Z,ee,"⪊","\\gnapprox",!0);S(E,Z,ee,"⊁","\\nsucc",!0);S(E,Z,ee,"⋡","\\nsucceq",!0);S(E,Z,ee,"⋩","\\succnsim",!0);S(E,Z,ee,"⪺","\\succnapprox",!0);S(E,Z,ee,"≆","\\ncong",!0);S(E,Z,ee,"","\\@nshortparallel");S(E,Z,ee,"∦","\\nparallel",!0);S(E,Z,ee,"⊯","\\nVDash",!0);S(E,Z,ee,"⋫","\\ntriangleright");S(E,Z,ee,"⋭","\\ntrianglerighteq",!0);S(E,Z,ee,"","\\@nsupseteqq");S(E,Z,ee,"⊋","\\supsetneq",!0);S(E,Z,ee,"","\\@varsupsetneq");S(E,Z,ee,"⫌","\\supsetneqq",!0);S(E,Z,ee,"","\\@varsupsetneqq");S(E,Z,ee,"⊮","\\nVdash",!0);S(E,Z,ee,"⪵","\\precneqq",!0);S(E,Z,ee,"⪶","\\succneqq",!0);S(E,Z,ee,"","\\@nsubseteqq");S(E,Z,It,"⊴","\\unlhd");S(E,Z,It,"⊵","\\unrhd");S(E,Z,ee,"↚","\\nleftarrow",!0);S(E,Z,ee,"↛","\\nrightarrow",!0);S(E,Z,ee,"⇍","\\nLeftarrow",!0);S(E,Z,ee,"⇏","\\nRightarrow",!0);S(E,Z,ee,"↮","\\nleftrightarrow",!0);S(E,Z,ee,"⇎","\\nLeftrightarrow",!0);S(E,Z,ee,"△","\\vartriangle");S(E,Z,ce,"ℏ","\\hslash");S(E,Z,ce,"▽","\\triangledown");S(E,Z,ce,"◊","\\lozenge");S(E,Z,ce,"Ⓢ","\\circledS");S(E,Z,ce,"®","\\circledR");S(He,Z,ce,"®","\\circledR");S(E,Z,ce,"∡","\\measuredangle",!0);S(E,Z,ce,"∄","\\nexists");S(E,Z,ce,"℧","\\mho");S(E,Z,ce,"Ⅎ","\\Finv",!0);S(E,Z,ce,"⅁","\\Game",!0);S(E,Z,ce,"‵","\\backprime");S(E,Z,ce,"▲","\\blacktriangle");S(E,Z,ce,"▼","\\blacktriangledown");S(E,Z,ce,"■","\\blacksquare");S(E,Z,ce,"⧫","\\blacklozenge");S(E,Z,ce,"★","\\bigstar");S(E,Z,ce,"∢","\\sphericalangle",!0);S(E,Z,ce,"∁","\\complement",!0);S(E,Z,ce,"ð","\\eth",!0);S(He,O,ce,"ð","ð");S(E,Z,ce,"╱","\\diagup");S(E,Z,ce,"╲","\\diagdown");S(E,Z,ce,"□","\\square");S(E,Z,ce,"□","\\Box");S(E,Z,ce,"◊","\\Diamond");S(E,Z,ce,"¥","\\yen",!0);S(He,Z,ce,"¥","\\yen",!0);S(E,Z,ce,"✓","\\checkmark",!0);S(He,Z,ce,"✓","\\checkmark");S(E,Z,ce,"ℶ","\\beth",!0);S(E,Z,ce,"ℸ","\\daleth",!0);S(E,Z,ce,"ℷ","\\gimel",!0);S(E,Z,ce,"ϝ","\\digamma",!0);S(E,Z,ce,"ϰ","\\varkappa");S(E,Z,Qo,"┌","\\@ulcorner",!0);S(E,Z,ro,"┐","\\@urcorner",!0);S(E,Z,Qo,"└","\\@llcorner",!0);S(E,Z,ro,"┘","\\@lrcorner",!0);S(E,Z,ee,"≦","\\leqq",!0);S(E,Z,ee,"⩽","\\leqslant",!0);S(E,Z,ee,"⪕","\\eqslantless",!0);S(E,Z,ee,"≲","\\lesssim",!0);S(E,Z,ee,"⪅","\\lessapprox",!0);S(E,Z,ee,"≊","\\approxeq",!0);S(E,Z,It,"⋖","\\lessdot");S(E,Z,ee,"⋘","\\lll",!0);S(E,Z,ee,"≶","\\lessgtr",!0);S(E,Z,ee,"⋚","\\lesseqgtr",!0);S(E,Z,ee,"⪋","\\lesseqqgtr",!0);S(E,Z,ee,"≑","\\doteqdot");S(E,Z,ee,"≓","\\risingdotseq",!0);S(E,Z,ee,"≒","\\fallingdotseq",!0);S(E,Z,ee,"∽","\\backsim",!0);S(E,Z,ee,"⋍","\\backsimeq",!0);S(E,Z,ee,"⫅","\\subseteqq",!0);S(E,Z,ee,"⋐","\\Subset",!0);S(E,Z,ee,"⊏","\\sqsubset",!0);S(E,Z,ee,"≼","\\preccurlyeq",!0);S(E,Z,ee,"⋞","\\curlyeqprec",!0);S(E,Z,ee,"≾","\\precsim",!0);S(E,Z,ee,"⪷","\\precapprox",!0);S(E,Z,ee,"⊲","\\vartriangleleft");S(E,Z,ee,"⊴","\\trianglelefteq");S(E,Z,ee,"⊨","\\vDash",!0);S(E,Z,ee,"⊪","\\Vvdash",!0);S(E,Z,ee,"⌣","\\smallsmile");S(E,Z,ee,"⌢","\\smallfrown");S(E,Z,ee,"≏","\\bumpeq",!0);S(E,Z,ee,"≎","\\Bumpeq",!0);S(E,Z,ee,"≧","\\geqq",!0);S(E,Z,ee,"⩾","\\geqslant",!0);S(E,Z,ee,"⪖","\\eqslantgtr",!0);S(E,Z,ee,"≳","\\gtrsim",!0);S(E,Z,ee,"⪆","\\gtrapprox",!0);S(E,Z,It,"⋗","\\gtrdot");S(E,Z,ee,"⋙","\\ggg",!0);S(E,Z,ee,"≷","\\gtrless",!0);S(E,Z,ee,"⋛","\\gtreqless",!0);S(E,Z,ee,"⪌","\\gtreqqless",!0);S(E,Z,ee,"≖","\\eqcirc",!0);S(E,Z,ee,"≗","\\circeq",!0);S(E,Z,ee,"≜","\\triangleq",!0);S(E,Z,ee,"∼","\\thicksim");S(E,Z,ee,"≈","\\thickapprox");S(E,Z,ee,"⫆","\\supseteqq",!0);S(E,Z,ee,"⋑","\\Supset",!0);S(E,Z,ee,"⊐","\\sqsupset",!0);S(E,Z,ee,"≽","\\succcurlyeq",!0);S(E,Z,ee,"⋟","\\curlyeqsucc",!0);S(E,Z,ee,"≿","\\succsim",!0);S(E,Z,ee,"⪸","\\succapprox",!0);S(E,Z,ee,"⊳","\\vartriangleright");S(E,Z,ee,"⊵","\\trianglerighteq");S(E,Z,ee,"⊩","\\Vdash",!0);S(E,Z,ee,"∣","\\shortmid");S(E,Z,ee,"∥","\\shortparallel");S(E,Z,ee,"≬","\\between",!0);S(E,Z,ee,"⋔","\\pitchfork",!0);S(E,Z,ee,"∝","\\varpropto");S(E,Z,ee,"◀","\\blacktriangleleft");S(E,Z,ee,"∴","\\therefore",!0);S(E,Z,ee,"∍","\\backepsilon");S(E,Z,ee,"▶","\\blacktriangleright");S(E,Z,ee,"∵","\\because",!0);S(E,Z,ee,"⋘","\\llless");S(E,Z,ee,"⋙","\\gggtr");S(E,Z,It,"⊲","\\lhd");S(E,Z,It,"⊳","\\rhd");S(E,Z,ee,"≂","\\eqsim",!0);S(E,O,ee,"⋈","\\Join");S(E,Z,ee,"≑","\\Doteq",!0);S(E,Z,It,"∔","\\dotplus",!0);S(E,Z,It,"∖","\\smallsetminus");S(E,Z,It,"⋒","\\Cap",!0);S(E,Z,It,"⋓","\\Cup",!0);S(E,Z,It,"⩞","\\doublebarwedge",!0);S(E,Z,It,"⊟","\\boxminus",!0);S(E,Z,It,"⊞","\\boxplus",!0);S(E,Z,It,"⋇","\\divideontimes",!0);S(E,Z,It,"⋉","\\ltimes",!0);S(E,Z,It,"⋊","\\rtimes",!0);S(E,Z,It,"⋋","\\leftthreetimes",!0);S(E,Z,It,"⋌","\\rightthreetimes",!0);S(E,Z,It,"⋏","\\curlywedge",!0);S(E,Z,It,"⋎","\\curlyvee",!0);S(E,Z,It,"⊝","\\circleddash",!0);S(E,Z,It,"⊛","\\circledast",!0);S(E,Z,It,"⋅","\\centerdot");S(E,Z,It,"⊺","\\intercal",!0);S(E,Z,It,"⋒","\\doublecap");S(E,Z,It,"⋓","\\doublecup");S(E,Z,It,"⊠","\\boxtimes",!0);S(E,Z,ee,"⇢","\\dashrightarrow",!0);S(E,Z,ee,"⇠","\\dashleftarrow",!0);S(E,Z,ee,"⇇","\\leftleftarrows",!0);S(E,Z,ee,"⇆","\\leftrightarrows",!0);S(E,Z,ee,"⇚","\\Lleftarrow",!0);S(E,Z,ee,"↞","\\twoheadleftarrow",!0);S(E,Z,ee,"↢","\\leftarrowtail",!0);S(E,Z,ee,"↫","\\looparrowleft",!0);S(E,Z,ee,"⇋","\\leftrightharpoons",!0);S(E,Z,ee,"↶","\\curvearrowleft",!0);S(E,Z,ee,"↺","\\circlearrowleft",!0);S(E,Z,ee,"↰","\\Lsh",!0);S(E,Z,ee,"⇈","\\upuparrows",!0);S(E,Z,ee,"↿","\\upharpoonleft",!0);S(E,Z,ee,"⇃","\\downharpoonleft",!0);S(E,O,ee,"⊶","\\origof",!0);S(E,O,ee,"⊷","\\imageof",!0);S(E,Z,ee,"⊸","\\multimap",!0);S(E,Z,ee,"↭","\\leftrightsquigarrow",!0);S(E,Z,ee,"⇉","\\rightrightarrows",!0);S(E,Z,ee,"⇄","\\rightleftarrows",!0);S(E,Z,ee,"↠","\\twoheadrightarrow",!0);S(E,Z,ee,"↣","\\rightarrowtail",!0);S(E,Z,ee,"↬","\\looparrowright",!0);S(E,Z,ee,"↷","\\curvearrowright",!0);S(E,Z,ee,"↻","\\circlearrowright",!0);S(E,Z,ee,"↱","\\Rsh",!0);S(E,Z,ee,"⇊","\\downdownarrows",!0);S(E,Z,ee,"↾","\\upharpoonright",!0);S(E,Z,ee,"⇂","\\downharpoonright",!0);S(E,Z,ee,"⇝","\\rightsquigarrow",!0);S(E,Z,ee,"⇝","\\leadsto");S(E,Z,ee,"⇛","\\Rrightarrow",!0);S(E,Z,ee,"↾","\\restriction");S(E,O,ce,"‘","`");S(E,O,ce,"$","\\$");S(He,O,ce,"$","\\$");S(He,O,ce,"$","\\textdollar");S(E,O,ce,"%","\\%");S(He,O,ce,"%","\\%");S(E,O,ce,"_","\\_");S(He,O,ce,"_","\\_");S(He,O,ce,"_","\\textunderscore");S(E,O,ce,"∠","\\angle",!0);S(E,O,ce,"∞","\\infty",!0);S(E,O,ce,"′","\\prime");S(E,O,ce,"△","\\triangle");S(E,O,ce,"Γ","\\Gamma",!0);S(E,O,ce,"Δ","\\Delta",!0);S(E,O,ce,"Θ","\\Theta",!0);S(E,O,ce,"Λ","\\Lambda",!0);S(E,O,ce,"Ξ","\\Xi",!0);S(E,O,ce,"Π","\\Pi",!0);S(E,O,ce,"Σ","\\Sigma",!0);S(E,O,ce,"Υ","\\Upsilon",!0);S(E,O,ce,"Φ","\\Phi",!0);S(E,O,ce,"Ψ","\\Psi",!0);S(E,O,ce,"Ω","\\Omega",!0);S(E,O,ce,"A","Α");S(E,O,ce,"B","Β");S(E,O,ce,"E","Ε");S(E,O,ce,"Z","Ζ");S(E,O,ce,"H","Η");S(E,O,ce,"I","Ι");S(E,O,ce,"K","Κ");S(E,O,ce,"M","Μ");S(E,O,ce,"N","Ν");S(E,O,ce,"O","Ο");S(E,O,ce,"P","Ρ");S(E,O,ce,"T","Τ");S(E,O,ce,"X","Χ");S(E,O,ce,"¬","\\neg",!0);S(E,O,ce,"¬","\\lnot");S(E,O,ce,"⊤","\\top");S(E,O,ce,"⊥","\\bot");S(E,O,ce,"∅","\\emptyset");S(E,Z,ce,"∅","\\varnothing");S(E,O,sn,"α","\\alpha",!0);S(E,O,sn,"β","\\beta",!0);S(E,O,sn,"γ","\\gamma",!0);S(E,O,sn,"δ","\\delta",!0);S(E,O,sn,"ϵ","\\epsilon",!0);S(E,O,sn,"ζ","\\zeta",!0);S(E,O,sn,"η","\\eta",!0);S(E,O,sn,"θ","\\theta",!0);S(E,O,sn,"ι","\\iota",!0);S(E,O,sn,"κ","\\kappa",!0);S(E,O,sn,"λ","\\lambda",!0);S(E,O,sn,"μ","\\mu",!0);S(E,O,sn,"ν","\\nu",!0);S(E,O,sn,"ξ","\\xi",!0);S(E,O,sn,"ο","\\omicron",!0);S(E,O,sn,"π","\\pi",!0);S(E,O,sn,"ρ","\\rho",!0);S(E,O,sn,"σ","\\sigma",!0);S(E,O,sn,"τ","\\tau",!0);S(E,O,sn,"υ","\\upsilon",!0);S(E,O,sn,"ϕ","\\phi",!0);S(E,O,sn,"χ","\\chi",!0);S(E,O,sn,"ψ","\\psi",!0);S(E,O,sn,"ω","\\omega",!0);S(E,O,sn,"ε","\\varepsilon",!0);S(E,O,sn,"ϑ","\\vartheta",!0);S(E,O,sn,"ϖ","\\varpi",!0);S(E,O,sn,"ϱ","\\varrho",!0);S(E,O,sn,"ς","\\varsigma",!0);S(E,O,sn,"φ","\\varphi",!0);S(E,O,It,"∗","*",!0);S(E,O,It,"+","+");S(E,O,It,"−","-",!0);S(E,O,It,"⋅","\\cdot",!0);S(E,O,It,"∘","\\circ",!0);S(E,O,It,"÷","\\div",!0);S(E,O,It,"±","\\pm",!0);S(E,O,It,"×","\\times",!0);S(E,O,It,"∩","\\cap",!0);S(E,O,It,"∪","\\cup",!0);S(E,O,It,"∖","\\setminus",!0);S(E,O,It,"∧","\\land");S(E,O,It,"∨","\\lor");S(E,O,It,"∧","\\wedge",!0);S(E,O,It,"∨","\\vee",!0);S(E,O,ce,"√","\\surd");S(E,O,Qo,"⟨","\\langle",!0);S(E,O,Qo,"∣","\\lvert");S(E,O,Qo,"∥","\\lVert");S(E,O,ro,"?","?");S(E,O,ro,"!","!");S(E,O,ro,"⟩","\\rangle",!0);S(E,O,ro,"∣","\\rvert");S(E,O,ro,"∥","\\rVert");S(E,O,ee,"=","=");S(E,O,ee,":",":");S(E,O,ee,"≈","\\approx",!0);S(E,O,ee,"≅","\\cong",!0);S(E,O,ee,"≥","\\ge");S(E,O,ee,"≥","\\geq",!0);S(E,O,ee,"←","\\gets");S(E,O,ee,">","\\gt",!0);S(E,O,ee,"∈","\\in",!0);S(E,O,ee,"","\\@not");S(E,O,ee,"⊂","\\subset",!0);S(E,O,ee,"⊃","\\supset",!0);S(E,O,ee,"⊆","\\subseteq",!0);S(E,O,ee,"⊇","\\supseteq",!0);S(E,Z,ee,"⊈","\\nsubseteq",!0);S(E,Z,ee,"⊉","\\nsupseteq",!0);S(E,O,ee,"⊨","\\models");S(E,O,ee,"←","\\leftarrow",!0);S(E,O,ee,"≤","\\le");S(E,O,ee,"≤","\\leq",!0);S(E,O,ee,"<","\\lt",!0);S(E,O,ee,"→","\\rightarrow",!0);S(E,O,ee,"→","\\to");S(E,Z,ee,"≱","\\ngeq",!0);S(E,Z,ee,"≰","\\nleq",!0);S(E,O,jc," ","\\ ");S(E,O,jc," ","\\space");S(E,O,jc," ","\\nobreakspace");S(He,O,jc," ","\\ ");S(He,O,jc," "," ");S(He,O,jc," ","\\space");S(He,O,jc," ","\\nobreakspace");S(E,O,jc,"","\\nobreak");S(E,O,jc,"","\\allowbreak");S(E,O,wg,",",",");S(E,O,wg,";",";");S(E,Z,It,"⊼","\\barwedge",!0);S(E,Z,It,"⊻","\\veebar",!0);S(E,O,It,"⊙","\\odot",!0);S(E,O,It,"⊕","\\oplus",!0);S(E,O,It,"⊗","\\otimes",!0);S(E,O,ce,"∂","\\partial",!0);S(E,O,It,"⊘","\\oslash",!0);S(E,Z,It,"⊚","\\circledcirc",!0);S(E,Z,It,"⊡","\\boxdot",!0);S(E,O,It,"△","\\bigtriangleup");S(E,O,It,"▽","\\bigtriangledown");S(E,O,It,"†","\\dagger");S(E,O,It,"⋄","\\diamond");S(E,O,It,"⋆","\\star");S(E,O,It,"◃","\\triangleleft");S(E,O,It,"▹","\\triangleright");S(E,O,Qo,"{","\\{");S(He,O,ce,"{","\\{");S(He,O,ce,"{","\\textbraceleft");S(E,O,ro,"}","\\}");S(He,O,ce,"}","\\}");S(He,O,ce,"}","\\textbraceright");S(E,O,Qo,"{","\\lbrace");S(E,O,ro,"}","\\rbrace");S(E,O,Qo,"[","\\lbrack",!0);S(He,O,ce,"[","\\lbrack",!0);S(E,O,ro,"]","\\rbrack",!0);S(He,O,ce,"]","\\rbrack",!0);S(E,O,Qo,"(","\\lparen",!0);S(E,O,ro,")","\\rparen",!0);S(He,O,ce,"<","\\textless",!0);S(He,O,ce,">","\\textgreater",!0);S(E,O,Qo,"⌊","\\lfloor",!0);S(E,O,ro,"⌋","\\rfloor",!0);S(E,O,Qo,"⌈","\\lceil",!0);S(E,O,ro,"⌉","\\rceil",!0);S(E,O,ce,"\\","\\backslash");S(E,O,ce,"∣","|");S(E,O,ce,"∣","\\vert");S(He,O,ce,"|","\\textbar",!0);S(E,O,ce,"∥","\\|");S(E,O,ce,"∥","\\Vert");S(He,O,ce,"∥","\\textbardbl");S(He,O,ce,"~","\\textasciitilde");S(He,O,ce,"\\","\\textbackslash");S(He,O,ce,"^","\\textasciicircum");S(E,O,ee,"↑","\\uparrow",!0);S(E,O,ee,"⇑","\\Uparrow",!0);S(E,O,ee,"↓","\\downarrow",!0);S(E,O,ee,"⇓","\\Downarrow",!0);S(E,O,ee,"↕","\\updownarrow",!0);S(E,O,ee,"⇕","\\Updownarrow",!0);S(E,O,Nr,"∐","\\coprod");S(E,O,Nr,"⋁","\\bigvee");S(E,O,Nr,"⋀","\\bigwedge");S(E,O,Nr,"⨄","\\biguplus");S(E,O,Nr,"⋂","\\bigcap");S(E,O,Nr,"⋃","\\bigcup");S(E,O,Nr,"∫","\\int");S(E,O,Nr,"∫","\\intop");S(E,O,Nr,"∬","\\iint");S(E,O,Nr,"∭","\\iiint");S(E,O,Nr,"∏","\\prod");S(E,O,Nr,"∑","\\sum");S(E,O,Nr,"⨂","\\bigotimes");S(E,O,Nr,"⨁","\\bigoplus");S(E,O,Nr,"⨀","\\bigodot");S(E,O,Nr,"∮","\\oint");S(E,O,Nr,"∯","\\oiint");S(E,O,Nr,"∰","\\oiiint");S(E,O,Nr,"⨆","\\bigsqcup");S(E,O,Nr,"∫","\\smallint");S(He,O,Sm,"…","\\textellipsis");S(E,O,Sm,"…","\\mathellipsis");S(He,O,Sm,"…","\\ldots",!0);S(E,O,Sm,"…","\\ldots",!0);S(E,O,Sm,"⋯","\\@cdots",!0);S(E,O,Sm,"⋱","\\ddots",!0);S(E,O,ce,"⋮","\\varvdots");S(He,O,ce,"⋮","\\varvdots");S(E,O,Js,"ˊ","\\acute");S(E,O,Js,"ˋ","\\grave");S(E,O,Js,"¨","\\ddot");S(E,O,Js,"~","\\tilde");S(E,O,Js,"ˉ","\\bar");S(E,O,Js,"˘","\\breve");S(E,O,Js,"ˇ","\\check");S(E,O,Js,"^","\\hat");S(E,O,Js,"⃗","\\vec");S(E,O,Js,"˙","\\dot");S(E,O,Js,"˚","\\mathring");S(E,O,sn,"","\\@imath");S(E,O,sn,"","\\@jmath");S(E,O,ce,"ı","ı");S(E,O,ce,"ȷ","ȷ");S(He,O,ce,"ı","\\i",!0);S(He,O,ce,"ȷ","\\j",!0);S(He,O,ce,"ß","\\ss",!0);S(He,O,ce,"æ","\\ae",!0);S(He,O,ce,"œ","\\oe",!0);S(He,O,ce,"ø","\\o",!0);S(He,O,ce,"Æ","\\AE",!0);S(He,O,ce,"Œ","\\OE",!0);S(He,O,ce,"Ø","\\O",!0);S(He,O,Js,"ˊ","\\'");S(He,O,Js,"ˋ","\\`");S(He,O,Js,"ˆ","\\^");S(He,O,Js,"˜","\\~");S(He,O,Js,"ˉ","\\=");S(He,O,Js,"˘","\\u");S(He,O,Js,"˙","\\.");S(He,O,Js,"¸","\\c");S(He,O,Js,"˚","\\r");S(He,O,Js,"ˇ","\\v");S(He,O,Js,"¨",'\\"');S(He,O,Js,"˝","\\H");S(He,O,Js,"◯","\\textcircled");var XO={"--":!0,"---":!0,"``":!0,"''":!0};S(He,O,ce,"–","--",!0);S(He,O,ce,"–","\\textendash");S(He,O,ce,"—","---",!0);S(He,O,ce,"—","\\textemdash");S(He,O,ce,"‘","`",!0);S(He,O,ce,"‘","\\textquoteleft");S(He,O,ce,"’","'",!0);S(He,O,ce,"’","\\textquoteright");S(He,O,ce,"“","``",!0);S(He,O,ce,"“","\\textquotedblleft");S(He,O,ce,"”","''",!0);S(He,O,ce,"”","\\textquotedblright");S(E,O,ce,"°","\\degree",!0);S(He,O,ce,"°","\\degree");S(He,O,ce,"°","\\textdegree",!0);S(E,O,ce,"£","\\pounds");S(E,O,ce,"£","\\mathsterling",!0);S(He,O,ce,"£","\\pounds");S(He,O,ce,"£","\\textsterling",!0);S(E,Z,ce,"✠","\\maltese");S(He,Z,ce,"✠","\\maltese");var nA='0123456789/@."';for(var Dx=0;Dx<nA.length;Dx++){var sA=nA.charAt(Dx);S(E,O,ce,sA,sA)}var rA='0123456789!@*()-=+";:?/.,';for(var Ox=0;Ox<rA.length;Ox++){var iA=rA.charAt(Ox);S(He,O,ce,iA,iA)}var Ob="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var Bx=0;Bx<Ob.length;Bx++){var b1=Ob.charAt(Bx);S(E,O,sn,b1,b1),S(He,O,ce,b1,b1)}S(E,Z,ce,"C","ℂ");S(He,Z,ce,"C","ℂ");S(E,Z,ce,"H","ℍ");S(He,Z,ce,"H","ℍ");S(E,Z,ce,"N","ℕ");S(He,Z,ce,"N","ℕ");S(E,Z,ce,"P","ℙ");S(He,Z,ce,"P","ℙ");S(E,Z,ce,"Q","ℚ");S(He,Z,ce,"Q","ℚ");S(E,Z,ce,"R","ℝ");S(He,Z,ce,"R","ℝ");S(E,Z,ce,"Z","ℤ");S(He,Z,ce,"Z","ℤ");S(E,O,sn,"h","ℎ");S(He,O,sn,"h","ℎ");var un;for(var Hi=0;Hi<Ob.length;Hi++){var ar=Ob.charAt(Hi);un=String.fromCharCode(55349,56320+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56372+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56424+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56580+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56684+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56736+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56788+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56840+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56944+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),Hi<26&&(un=String.fromCharCode(55349,56632+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un),un=String.fromCharCode(55349,56476+Hi),S(E,O,sn,ar,un),S(He,O,ce,ar,un))}un="𝕜";S(E,O,sn,"k",un);S(He,O,ce,"k",un);for(var gd=0;gd<10;gd++){var Gc=gd.toString();un=String.fromCharCode(55349,57294+gd),S(E,O,sn,Gc,un),S(He,O,ce,Gc,un),un=String.fromCharCode(55349,57314+gd),S(E,O,sn,Gc,un),S(He,O,ce,Gc,un),un=String.fromCharCode(55349,57324+gd),S(E,O,sn,Gc,un),S(He,O,ce,Gc,un),un=String.fromCharCode(55349,57334+gd),S(E,O,sn,Gc,un),S(He,O,ce,Gc,un)}var Uk="ÐÞþ";for(var Px=0;Px<Uk.length;Px++){var w1=Uk.charAt(Px);S(E,O,sn,w1,w1),S(He,O,ce,w1,w1)}var Vk={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},oA={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},aA={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},hre={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},Nd={mathClass:"",textClass:"",font:""},lA={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},cA={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},uA={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Wk={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},Gk={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},dA={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Kk={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},hA=[Vk,Vk,oA,oA,aA,aA,hre,Nd,Nd,Nd,lA,lA,cA,cA,uA,uA,Wk,Wk,Gk,Gk,dA,dA,Nd,Nd,Kk,Kk],fre=[Vk,Nd,Wk,Gk,Kk],mre=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 hA[r]}else if(120782<=s&&s<=120831){var i=Math.floor((s-120782)/10);return fre[i]}else{if(s===120485||s===120486)return hA[0];if(120486<s&&s<120782)return Nd;throw new Ze("Unsupported character: "+e)}},av=function(t,n,s){if(Xs[s][t]){var r=Xs[s][t].replace;r&&(t=r)}return{value:t,metrics:T5(t,n,s)}},Gi=function(t,n,s,r,i){var o=av(t,n,s),a=o.metrics;t=o.value;var l;if(a){var c=a.italic;(s==="text"||r&&r.font==="mathit")&&(c=0),l=new Yo(t,a.height,a.depth,c,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+s+"'")),l=new Yo(t,0,0,0,0,0,i);if(r){l.maxFontSize=r.sizeMultiplier,r.style.isTight()&&l.classes.push("mtight");var d=r.getColor();d&&(l.style.color=d)}return l},C5=function(t,n,s,r){return r===void 0&&(r=[]),s.font==="boldsymbol"&&av(t,"Main-Bold",n).metrics?Gi(t,"Main-Bold",n,s,r.concat(["mathbf"])):t==="\\"||Xs[n][t].font==="main"?Gi(t,"Main-Regular",n,s,r):Gi(t,"AMS-Regular",n,s,r.concat(["amsrm"]))},pre=function(t,n,s){return s!=="textord"&&av(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},lv=function(t,n,s){var r=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:l,fontWeight:c,fontShape:d}=n,h=r==="math"||r==="text"&&!!a,f=h?a:l,m="",g="";if(i.charCodeAt(0)===55349){var y=mre(i);m=y.font,g=y[r+"Class"]}if(m)return Gi(i,m,r,n,o.concat(g));if(f){var b,w;if(f==="boldsymbol"){var v=pre(i,r,s);b=v.fontName,w=[v.fontClass]}else h?(b=Yk[a].fontName,w=[a]):(b=v1(l,c,d),w=[l,c,d]);if(av(i,b,r).metrics)return Gi(i,b,r,n,o.concat(w));if(XO.hasOwnProperty(i)&&b.slice(0,10)==="Typewriter"){for(var x=[],C=0;C<i.length;C++)x.push(Gi(i[C],b,r,n,o.concat(w)));return Rc(x)}}if(s==="mathord")return Gi(i,"Math-Italic",r,n,o.concat(["mathnormal"]));if(s==="textord"){var A=Xs[r][i]&&Xs[r][i].font;if(A==="ams"){var T=v1("amsrm",c,d);return Gi(i,T,r,n,o.concat("amsrm",c,d))}else if(A==="main"||!A){var _=v1("textrm",c,d);return Gi(i,_,r,n,o.concat(c,d))}else{var R=v1(A,c,d);return Gi(i,R,r,n,o.concat(R,c,d))}}else throw new Error("unexpected type: "+s+" in makeOrd")},gre=(e,t)=>{if(Hu(e.classes)!==Hu(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},JO=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],s=e[t+1];n instanceof Yo&&s instanceof Yo&&gre(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},A5=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},Ge=function(t,n,s,r){var i=new km(t,n,s,r);return A5(i),i},Vu=(e,t,n,s)=>new km(e,t,n,s),Xf=function(t,n,s){var r=Ge([t],[],n);return r.height=Math.max(s||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),r.style.borderBottomWidth=at(r.height),r.maxFontSize=1,r},yre=function(t,n,s,r){var i=new ov(t,n,s,r);return A5(i),i},Rc=function(t){var n=new _m(t);return A5(n),n},Jf=function(t,n){return t instanceof _m?Ge([],[t],n):t},bre=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,l=a-(n[o-1].elem.height+n[o-1].elem.depth);i=i+a,s.push({type:"kern",size:l}),s.push(n[o])}return{children:s,depth:r}}var c;if(t.positionType==="top"){for(var d=t.positionData,h=0;h<t.children.length;h++){var f=t.children[h];d-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}c=d}else if(t.positionType==="bottom")c=-t.positionData;else{var m=t.children[0];if(m.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")c=-m.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")c=-m.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:c}},ds=function(t,n){for(var{children:s,depth:r}=bre(t),i=0,o=0;o<s.length;o++){var a=s[o];if(a.type==="elem"){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var c=Ge(["pstrut"],[]);c.style.height=at(i);for(var d=[],h=r,f=r,m=r,g=0;g<s.length;g++){var y=s[g];if(y.type==="kern")m+=y.size;else{var b=y.elem,w=y.wrapperClasses||[],v=y.wrapperStyle||{},x=Ge(w,[c,b],void 0,v);x.style.top=at(-i-m-b.depth),y.marginLeft&&(x.style.marginLeft=y.marginLeft),y.marginRight&&(x.style.marginRight=y.marginRight),d.push(x),m+=b.height+b.depth}h=Math.min(h,m),f=Math.max(f,m)}var C=Ge(["vlist"],d);C.style.height=at(f);var A;if(h<0){var T=Ge([],[]),_=Ge(["vlist"],[T]);_.style.height=at(-h);var R=Ge(["vlist-s"],[new Yo("​")]);A=[Ge(["vlist-r"],[C,R]),Ge(["vlist-r"],[_])]}else A=[Ge(["vlist-r"],[C])];var I=Ge(["vlist-t"],A);return A.length===2&&I.classes.push("vlist-t2"),I.height=f,I.depth=-h,I},ZO=(e,t)=>{var n=Ge(["mspace"],[],t),s=or(e,t);return n.style.marginRight=at(s),n},v1=(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},Yk={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"}},eB={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},tB=function(t,n){var[s,r,i]=eB[t],o=new Uu(s),a=new Cc([o],{width:at(r),height:at(i),style:"width:"+at(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=Vu(["overlay"],[a],n);return l.height=i,l.style.height=at(i),l.style.width=at(r),l},sr={number:3,unit:"mu"},yd={number:4,unit:"mu"},Ql={number:5,unit:"mu"},wre={mord:{mop:sr,mbin:yd,mrel:Ql,minner:sr},mop:{mord:sr,mop:sr,mrel:Ql,minner:sr},mbin:{mord:yd,mop:yd,mopen:yd,minner:yd},mrel:{mord:Ql,mop:Ql,mopen:Ql,minner:Ql},mopen:{},mclose:{mop:sr,mbin:yd,mrel:Ql,minner:sr},mpunct:{mord:sr,mop:sr,mrel:Ql,mopen:sr,mclose:sr,mpunct:sr,minner:sr},minner:{mord:sr,mop:sr,mbin:yd,mrel:Ql,mopen:sr,mpunct:sr,minner:sr}},vre={mord:{mop:sr},mop:{mord:sr,mop:sr},mbin:{},mrel:{},mopen:{},mclose:{mop:sr},mpunct:{},minner:{mop:sr}},nB={},Bb={},Pb={};function Tt(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},l=0;l<n.length;++l)nB[n[l]]=a;t&&(i&&(Bb[t]=i),o&&(Pb[t]=o))}function _h(e){var{type:t,htmlBuilder:n,mathmlBuilder:s}=e;Tt({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:s})}var $b=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Er=function(t){return t.type==="ordgroup"?t.body:[t]},xre=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),_re=new Set(["rightmost","mrel","mclose","mpunct"]),kre={display:yn.DISPLAY,text:yn.TEXT,script:yn.SCRIPT,scriptscript:yn.SCRIPTSCRIPT},Sre={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Fr=function(t,n,s,r){r===void 0&&(r=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=fs(t[o],n);if(a instanceof _m){var l=a.children;i.push(...l)}else i.push(a)}if(JO(i),!s)return i;var c=n;if(t.length===1){var d=t[0];d.type==="sizing"?c=n.havingSize(d.size):d.type==="styling"&&(c=n.havingStyle(kre[d.style]))}var h=Ge([r[0]||"leftmost"],[],n),f=Ge([r[1]||"rightmost"],[],n),m=s==="root";return Qk(i,(g,y)=>{var b=y.classes[0],w=g.classes[0];b==="mbin"&&_re.has(w)?y.classes[0]="mord":w==="mbin"&&xre.has(b)&&(g.classes[0]="mord")},{node:h},f,m),Qk(i,(g,y)=>{var b,w,v=Jk(y),x=Jk(g),C=v&&x?g.hasClass("mtight")?(b=vre[v])==null?void 0:b[x]:(w=wre[v])==null?void 0:w[x]:null;if(C)return ZO(C,c)},{node:h},f,m),i},Qk=function(t,n,s,r,i){r&&t.push(r);for(var o=0;o<t.length;o++){var a=t[o],l=sB(a);if(l){Qk(l.children,n,s,null,i);continue}var c=!a.hasClass("mspace");if(c){var d=n(a,s.node);d&&(s.insertAfter?s.insertAfter(d):(t.unshift(d),o++))}c?s.node=a:i&&a.hasClass("newline")&&(s.node=Ge(["leftmost"])),s.insertAfter=(h=>f=>{t.splice(h+1,0,f),o++})(o)}r&&t.pop()},sB=function(t){return t instanceof _m||t instanceof ov||t instanceof km&&t.hasClass("enclosing")?t:null},Xk=function(t,n){var s=sB(t);if(s){var r=s.children;if(r.length){if(n==="right")return Xk(r[r.length-1],"right");if(n==="left")return Xk(r[0],"left")}}return t},Jk=function(t,n){if(!t)return null;n&&(t=Xk(t,n));var s=t.classes[0];return Sre[s]||null},Ep=function(t,n){var s=["nulldelimiter"].concat(t.baseSizingClasses());return Ge(n.concat(s))},fs=function(t,n,s){if(!t)return Ge();if(Bb[t.type]){var r=Bb[t.type](t,n);if(s&&n.size!==s.size){r=Ge(n.sizingClasses(s),[r],n);var i=n.sizeMultiplier/s.sizeMultiplier;r.height*=i,r.depth*=i}return r}else throw new Ze("Got group of unknown type: '"+t.type+"'")};function x1(e,t){var n=Ge(["base"],e,t),s=Ge(["strut"]);return s.style.height=at(n.height+n.depth),n.depth&&(s.style.verticalAlign=at(-n.depth)),n.children.unshift(s),n}function Zk(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var s=Fr(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 l=!1;a<s.length-1&&s[a+1].hasClass("mspace")&&!s[a+1].hasClass("newline");)a++,o.push(s[a]),s[a].hasClass("nobreak")&&(l=!0);l||(i.push(x1(o,t)),o=[])}else s[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(x1(o,t)),o=[]),i.push(s[a]));o.length>0&&i.push(x1(o,t));var c;n?(c=x1(Fr(n,t,!0),t),c.classes=["tag"],i.push(c)):r&&i.push(r);var d=Ge(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=at(d.height+d.depth),d.depth&&(h.style.verticalAlign=at(-d.depth))}return d}function rB(e){return new _m(e)}class st{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=Hu(this.classes));for(var s=0;s<this.children.length;s++)if(this.children[s]instanceof Mr&&this.children[s+1]instanceof Mr){for(var r=this.children[s].toText()+this.children[++s].toText();this.children[s+1]instanceof Mr;)r+=this.children[++s].toText();t.appendChild(new Mr(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+=Bi(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+Bi(Hu(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 Mr=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Bi(this.toText())}toText(){return this.text}};class iB{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",at(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+at(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var Tre=new Set(["\\imath","\\jmath"]),Cre=new Set(["mrow","mtable"]),_a=function(t,n,s){return Xs[n][t]&&Xs[n][t].replace&&t.charCodeAt(0)!==55349&&!(XO.hasOwnProperty(t)&&s&&(s.fontFamily&&s.fontFamily.slice(4,6)==="tt"||s.font&&s.font.slice(4,6)==="tt"))&&(t=Xs[n][t].replace),new Mr(t)},E5=function(t){return t.length===1?t[0]:new st("mrow",t)},Are={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"},M5=(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=Are[n];if(r)return typeof r=="function"?r(e):r;var i=e.text;if(Tre.has(i))return null;if(Xs[s][i]){var o=Xs[s][i].replace;o&&(i=o)}var a=Yk[n].fontName;return T5(i,a,s)?Yk[n].variant:null};function $x(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Mr&&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 Mr&&n.text===","}else return!1}var Xo=function(t,n,s){if(t.length===1){var r=Os(t[0],n);return s&&r instanceof st&&r.type==="mo"&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i=[],o,a=0;a<t.length;a++){var l=Os(t[a],n);if(l instanceof st&&o instanceof st){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if($x(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&$x(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||$x(o))){var c=l.children[0];c instanceof st&&c.type==="mn"&&(c.children=[...o.children,...c.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var d=o.children[0];if(d instanceof Mr&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof Mr&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),i.pop())}}}i.push(l),o=l}return i},Wu=function(t,n,s){return E5(Xo(t,n,s))},Os=function(t,n){if(!t)return new st("mrow");if(Pb[t.type])return Pb[t.type](t,n);throw new Ze("Got group of unknown type: '"+t.type+"'")};function fA(e,t,n,s,r){var i=Xo(e,n),o;i.length===1&&i[0]instanceof st&&Cre.has(i[0].type)?o=i[0]:o=new st("mrow",i);var a=new st("annotation",[new Mr(t)]);a.setAttribute("encoding","application/x-tex");var l=new st("semantics",[o,a]),c=new st("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),s&&c.setAttribute("display","block");var d=r?"katex":"katex-mathml";return Ge([d],[c])}var Ere=[[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]],mA=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],pA=function(t,n){return n.size<2?t:Ere[t-1][n.size-1]};class nc{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||nc.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=mA[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 nc(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:pA(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:mA[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=pA(nc.BASESIZE,t);return this.size===n&&this.textSize===nc.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!==nc.BASESIZE?["sizing","reset-size"+this.size,"size"+nc.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=dre(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}nc.BASESIZE=6;var oB=function(t){return new nc({style:t.displayMode?yn.DISPLAY:yn.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},aB=function(t,n){if(n.displayMode){var s=["katex-display"];n.leqno&&s.push("leqno"),n.fleqn&&s.push("fleqn"),t=Ge(s,[t])}return t},Mre=function(t,n,s){var r=oB(s),i;if(s.output==="mathml")return fA(t,n,r,s.displayMode,!0);if(s.output==="html"){var o=Zk(t,r);i=Ge(["katex"],[o])}else{var a=fA(t,n,r,s.displayMode,!1),l=Zk(t,r);i=Ge(["katex"],[a,l])}return aB(i,s)},Nre=function(t,n,s){var r=oB(s),i=Zk(t,r),o=Ge(["katex"],[i]);return aB(o,s)},Ire={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":"="},cv=function(t){var n=new st("mo",[new Mr(Ire[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},jre={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]},Rre=new Set(["widehat","widecheck","widetilde","utilde"]),uv=function(t,n){function s(){var a=4e5,l=t.label.slice(1);if(Rre.has(l)&&"base"in t){var c=t.base.type==="ordgroup"?t.base.body.length:1,d,h,f;if(c>5)l==="widehat"||l==="widecheck"?(d=420,a=2364,f=.42,h=l+"4"):(d=312,a=2340,f=.34,h="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],d=[0,239,300,360,420][m],f=[0,.24,.3,.3,.36,.42][m],h=l+m):(a=[0,600,1033,2339,2340][m],d=[0,260,286,306,312][m],f=[0,.26,.286,.3,.306,.34][m],h="tilde"+m)}var g=new Uu(h),y=new Cc([g],{width:"100%",height:at(f),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:Vu([],[y],n),minWidth:0,height:f}}else{var b=[],w=jre[l];if(!w)throw new Error('No SVG data for "'+l+'".');var[v,x,C]=w,A=C/1e3,T=v.length,_,R;if(T===1){if(w.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');_=["hide-tail"],R=[w[3]]}else if(T===2)_=["halfarrow-left","halfarrow-right"],R=["xMinYMin","xMaxYMin"];else if(T===3)_=["brace-left","brace-center","brace-right"],R=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+T+" children.");for(var I=0;I<T;I++){var k=new Uu(v[I]),j=new Cc([k],{width:"400em",height:at(A),viewBox:"0 0 "+a+" "+C,preserveAspectRatio:R[I]+" slice"}),N=Vu([_[I]],[j],n);if(T===1)return{span:N,minWidth:x,height:A};N.style.height=at(A),b.push(N)}return{span:Ge(["stretchy"],b,n),minWidth:x,height:A}}}var{span:r,minWidth:i,height:o}=s();return r.height=o,r.style.height=at(o),i>0&&(r.style.minWidth=at(i)),r},Lre=function(t,n,s,r,i){var o,a=t.height+t.depth+s+r;if(/fbox|color|angl/.test(n)){if(o=Ge(["stretchy",n],[],i),n==="fbox"){var l=i.color&&i.getColor();l&&(o.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(n)&&c.push(new Hk({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new Hk({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new Cc(c,{width:"100%",height:at(a)});o=Vu([],[d],i)}return o.height=a,o.style.height=at(a),o},Dre={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Ore={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function Bre(e){return e in Dre}function jn(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 dv(e){var t=hv(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 hv(e){return e&&(e.type==="atom"||Ore.hasOwnProperty(e.type))?e:null}var lB=e=>{if(e instanceof Yo)return e;if(ure(e)&&e.children.length===1)return lB(e.children[0])},N5=(e,t)=>{var n,s,r;e&&e.type==="supsub"?(s=jn(e.base,"accent"),n=s.base,e.base=n,r=cre(fs(e,t)),e.base=s):(s=jn(e,"accent"),n=s.base);var i=fs(n,t.havingCrampedStyle()),o=s.isShifty&&Ic(n),a=0;if(o){var l,c;a=(l=(c=lB(i))==null?void 0:c.skew)!=null?l:0}var d=s.label==="\\c",h=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),f;if(s.isStretchy)f=uv(s,t),f=ds({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+at(2*a)+")",marginLeft:at(2*a)}:void 0}]});else{var m,g;s.label==="\\vec"?(m=tB("vec",t),g=eB.vec[1]):(m=lv({mode:s.mode,text:s.label},t,"textord"),m=lre(m),m.italic=0,g=m.width,d&&(h+=m.depth)),f=Ge(["accent-body"],[m]);var y=s.label==="\\textcircled";y&&(f.classes.push("accent-full"),h=i.height);var b=a;y||(b-=g/2),f.style.left=at(b),s.label==="\\textcircled"&&(f.style.top=".2em"),f=ds({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-h},{type:"elem",elem:f}]})}var w=Ge(["mord","accent"],[f],t);return r?(r.children[0]=w,r.height=Math.max(w.height,r.height),r.classes[0]="mord",r):w},cB=(e,t)=>{var n=e.isStretchy?cv(e.label):new st("mo",[_a(e.label,e.mode)]),s=new st("mover",[Os(e.base,t),n]);return s.setAttribute("accent","true"),s},Pre=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Tt({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=$b(t[0]),s=!Pre.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:N5,mathmlBuilder:cB});Tt({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:N5,mathmlBuilder:cB});Tt({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=fs(e.base,t),s=uv(e,t),r=e.label==="\\utilde"?.12:0,i=ds({positionType:"top",positionData:n.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:r},{type:"elem",elem:n}]});return Ge(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=cv(e.label),s=new st("munder",[Os(e.base,t),n]);return s.setAttribute("accentunder","true"),s}});var _1=e=>{var t=new st("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Tt({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=Jf(fs(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=Jf(fs(e.below,s,t),t),o.classes.push(i+"-arrow-pad"));var a=uv(e,t),l=-t.fontMetrics().axisHeight+.5*a.height,c=-t.fontMetrics().axisHeight-.5*a.height-.111;(r.depth>.25||e.label==="\\xleftequilibrium")&&(c-=r.depth);var d;if(o){var h=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=ds({positionType:"individualShift",children:[{type:"elem",elem:r,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:h}]})}else d=ds({positionType:"individualShift",children:[{type:"elem",elem:r,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return Ge(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=cv(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var s;if(e.body){var r=_1(Os(e.body,t));if(e.below){var i=_1(Os(e.below,t));s=new st("munderover",[n,i,r])}else s=new st("mover",[n,r])}else if(e.below){var o=_1(Os(e.below,t));s=new st("munder",[n,o])}else s=_1(),s=new st("mover",[n,s]);return s}});function uB(e,t){var n=Fr(e.body,t,!0);return Ge([e.mclass],n,t)}function dB(e,t){var n,s=Xo(e.body,t);return e.mclass==="minner"?n=new st("mpadded",s):e.mclass==="mord"?e.isCharacterBox?(n=s[0],n.type="mi"):n=new st("mi",s):(e.isCharacterBox?(n=s[0],n.type="mo"):n=new st("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}Tt({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:Er(r),isCharacterBox:Ic(r)}},htmlBuilder:uB,mathmlBuilder:dB});var fv=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"};Tt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:fv(t[0]),body:Er(t[1]),isCharacterBox:Ic(t[1])}}});Tt({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=fv(r):o="mrel";var a={type:"op",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:s!=="\\stackrel",body:Er(r)},l={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:[l],isCharacterBox:Ic(l)}},htmlBuilder:uB,mathmlBuilder:dB});Tt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:fv(t[0]),body:Er(t[0])}},htmlBuilder(e,t){var n=Fr(e.body,t,!0),s=Ge([e.mclass],n,t);return s.style.textShadow="0.02em 0.01em 0.04px",s},mathmlBuilder(e,t){var n=Xo(e.body,t),s=new st("mstyle",n);return s.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),s}});var $re={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},gA=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),yA=e=>e.type==="textord"&&e.text==="@",zre=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function Fre(e,t,n){var s=$re[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]],[]),l={type:"ordgroup",mode:"math",body:[r,o,a]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function qre(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 Ze("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var s=[],r=[s],i=0;i<t.length;i++){for(var o=t[i],a=gA(),l=0;l<o.length;l++)if(!yA(o[l]))a.body.push(o[l]);else{s.push(a),l+=1;var c=dv(o[l]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var h=0;h<2;h++){for(var f=!0,m=l+1;m<o.length;m++){if(zre(o[m],c)){f=!1,l=m;break}if(yA(o[m]))throw new Ze("Missing a "+c+" character to complete a CD arrow.",o[m]);d[h].body.push(o[m])}if(f)throw new Ze("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new Ze('Expected one of "<>AV=|." after @',o[l]);var g=Fre(c,d,e),y={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};s.push(y),a=gA()}i%2===0?s.push(a):s.shift(),s=[],r.push(s)}e.gullet.endGroup(),e.gullet.endGroup();var b=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:b,colSeparationType:"CD",hLinesBeforeRow:new Array(r.length+1).fill([])}}Tt({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=Jf(fs(e.label,n,t),t);return s.classes.push("cd-label-"+e.side),s.style.bottom=at(.8-s.depth),s.height=0,s.depth=0,s},mathmlBuilder(e,t){var n=new st("mrow",[Os(e.label,t)]);return n=new st("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new st("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Tt({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=Jf(fs(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new st("mrow",[Os(e.fragment,t)])}});Tt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,s=jn(t[0],"ordgroup"),r=s.body,i="",o=0;o<r.length;o++){var a=jn(r[o],"textord");i+=a.text}var l=parseInt(i),c;if(isNaN(l))throw new Ze("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new Ze("\\@char with invalid code point "+i);return l<=65535?c=String.fromCharCode(l):(l-=65536,c=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:n.mode,text:c}}});var hB=(e,t)=>{var n=Fr(e.body,t.withColor(e.color),!1);return Rc(n)},fB=(e,t)=>{var n=Xo(e.body,t.withColor(e.color)),s=new st("mstyle",n);return s.setAttribute("mathcolor",e.color),s};Tt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,s=jn(t[0],"color-token").color,r=t[1];return{type:"color",mode:n.mode,color:s,body:Er(r)}},htmlBuilder:hB,mathmlBuilder:fB});Tt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:s}=e,r=jn(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:hB,mathmlBuilder:fB});Tt({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&&jn(r,"size").value}},htmlBuilder(e,t){var n=Ge(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=at(or(e.size,t)))),n},mathmlBuilder(e,t){var n=new st("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",at(or(e.size,t)))),n}});var e3={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},mB=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Ze("Expected a control sequence",e);return t},Hre=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},pB=(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)};Tt({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(e3[s.text])return(n==="\\global"||n==="\\\\globallong")&&(s.text=e3[s.text]),jn(t.parseFunction(),"internal");throw new Ze("Invalid token after macro prefix",s)}});Tt({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 Ze("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 Ze('Invalid argument number "'+s.text+'"');if(parseInt(s.text)!==i+1)throw new Ze('Argument number "'+s.text+'" out of order');i++,a.push([])}else{if(s.text==="EOF")throw new Ze("Expected a macro definition");a[i].push(s.text)}var{tokens:l}=t.gullet.consumeArg();return o&&l.unshift(o),(n==="\\edef"||n==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(r,{tokens:l,numArgs:i,delimiters:a},n===e3[n]),{type:"internal",mode:t.mode}}});Tt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=mB(t.gullet.popToken());t.gullet.consumeSpaces();var r=Hre(t);return pB(t,s,r,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});Tt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=mB(t.gullet.popToken()),r=t.gullet.popToken(),i=t.gullet.popToken();return pB(t,s,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(r),{type:"internal",mode:t.mode}}});var b0=function(t,n,s){var r=Xs.math[t]&&Xs.math[t].replace,i=T5(r||t,n,s);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},I5=function(t,n,s,r){var i=s.havingBaseStyle(n),o=Ge(r.concat(i.sizingClasses(s)),[t],s),a=i.sizeMultiplier/s.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},gB=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=at(i),t.height-=i,t.depth+=i},Ure=function(t,n,s,r,i,o){var a=Gi(t,"Main-Regular",i,r),l=I5(a,n,r,o);return gB(l,r,n),l},Vre=function(t,n,s,r){return Gi(t,"Size"+n+"-Regular",s,r)},yB=function(t,n,s,r,i,o){var a=Vre(t,n,i,r),l=I5(Ge(["delimsizing","size"+n],[a],r),yn.TEXT,r,o);return s&&gB(l,r,yn.TEXT),l},zx=function(t,n,s){var r;n==="Size1-Regular"?r="delim-size1":r="delim-size4";var i=Ge(["delimsizinginner",r],[Ge([],[Gi(t,n,s)])]);return{type:"elem",elem:i}},Fx=function(t,n,s){var r=kl["Size4-Regular"][t.charCodeAt(0)]?kl["Size4-Regular"][t.charCodeAt(0)][4]:kl["Size1-Regular"][t.charCodeAt(0)][4],i=new Uu("inner",tre(t,Math.round(1e3*n))),o=new Cc([i],{width:at(r),height:at(n),style:"width:"+at(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=Vu([],[o],s);return a.height=n,a.style.height=at(n),a.style.width=at(r),{type:"elem",elem:a}},t3=.008,k1={type:"kern",size:-1*t3},Wre=new Set(["|","\\lvert","\\rvert","\\vert"]),Gre=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),bB=function(t,n,s,r,i,o){var a,l,c,d,h="",f=0;a=c=d=t,l=null;var m="Size1-Regular";t==="\\uparrow"?c=d="⏐":t==="\\Uparrow"?c=d="‖":t==="\\downarrow"?a=c="⏐":t==="\\Downarrow"?a=c="‖":t==="\\updownarrow"?(a="\\uparrow",c="⏐",d="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",c="‖",d="\\Downarrow"):Wre.has(t)?(c="∣",h="vert",f=333):Gre.has(t)?(c="∥",h="doublevert",f=556):t==="["||t==="\\lbrack"?(a="⎡",c="⎢",d="⎣",m="Size4-Regular",h="lbrack",f=667):t==="]"||t==="\\rbrack"?(a="⎤",c="⎥",d="⎦",m="Size4-Regular",h="rbrack",f=667):t==="\\lfloor"||t==="⌊"?(c=a="⎢",d="⎣",m="Size4-Regular",h="lfloor",f=667):t==="\\lceil"||t==="⌈"?(a="⎡",c=d="⎢",m="Size4-Regular",h="lceil",f=667):t==="\\rfloor"||t==="⌋"?(c=a="⎥",d="⎦",m="Size4-Regular",h="rfloor",f=667):t==="\\rceil"||t==="⌉"?(a="⎤",c=d="⎥",m="Size4-Regular",h="rceil",f=667):t==="("||t==="\\lparen"?(a="⎛",c="⎜",d="⎝",m="Size4-Regular",h="lparen",f=875):t===")"||t==="\\rparen"?(a="⎞",c="⎟",d="⎠",m="Size4-Regular",h="rparen",f=875):t==="\\{"||t==="\\lbrace"?(a="⎧",l="⎨",d="⎩",c="⎪",m="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",l="⎬",d="⎭",c="⎪",m="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",d="⎩",c="⎪",m="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",d="⎭",c="⎪",m="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",d="⎭",c="⎪",m="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",d="⎩",c="⎪",m="Size4-Regular");var g=b0(a,m,i),y=g.height+g.depth,b=b0(c,m,i),w=b.height+b.depth,v=b0(d,m,i),x=v.height+v.depth,C=0,A=1;if(l!==null){var T=b0(l,m,i);C=T.height+T.depth,A=2}var _=y+x+C,R=Math.max(0,Math.ceil((n-_)/(A*w))),I=_+R*A*w,k=r.fontMetrics().axisHeight;s&&(k*=r.sizeMultiplier);var j=I/2-k,N=[];if(h.length>0){var L=I-y-x,$=Math.round(I*1e3),F=nre(h,Math.round(L*1e3)),B=new Uu(h,F),Q=at(f/1e3),Y=at($/1e3),ne=new Cc([B],{width:Q,height:Y,viewBox:"0 0 "+f+" "+$}),P=Vu([],[ne],r);P.height=$/1e3,P.style.width=Q,P.style.height=Y,N.push({type:"elem",elem:P})}else{if(N.push(zx(d,m,i)),N.push(k1),l===null){var le=I-y-x+2*t3;N.push(Fx(c,le,r))}else{var z=(I-y-x-C)/2+2*t3;N.push(Fx(c,z,r)),N.push(k1),N.push(zx(l,m,i)),N.push(k1),N.push(Fx(c,z,r))}N.push(k1),N.push(zx(a,m,i))}var M=r.havingBaseStyle(yn.TEXT),re=ds({positionType:"bottom",positionData:j,children:N});return I5(Ge(["delimsizing","mult"],[re],M),yn.TEXT,r,o)},qx=80,Hx=.08,Ux=function(t,n,s,r,i){var o=ere(t,r,s),a=new Uu(t,o),l=new Cc([a],{width:"400em",height:at(n),viewBox:"0 0 400000 "+s,preserveAspectRatio:"xMinYMin slice"});return Vu(["hide-tail"],[l],i)},Kre=function(t,n){var s=n.havingBaseSizing(),r=kB("\\surd",t*s.sizeMultiplier,_B,s),i=s.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l,c,d,h;return r.type==="small"?(d=1e3+1e3*o+qx,t<1?i=1:t<1.4&&(i=.7),l=(1+o+Hx)/i,c=(1+o)/i,a=Ux("sqrtMain",l,d,o,n),a.style.minWidth="0.853em",h=.833/i):r.type==="large"?(d=(1e3+qx)*J0[r.size],c=(J0[r.size]+o)/i,l=(J0[r.size]+o+Hx)/i,a=Ux("sqrtSize"+r.size,l,d,o,n),a.style.minWidth="1.02em",h=1/i):(l=t+o+Hx,c=t+o,d=Math.floor(1e3*t+o)+qx,a=Ux("sqrtTall",l,d,o,n),a.style.minWidth="0.742em",h=1.056),a.height=c,a.style.height=at(l),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},wB=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),Yre=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),vB=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),J0=[0,1.2,1.8,2.4,3],xB=function(t,n,s,r,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),wB.has(t)||vB.has(t))return yB(t,n,!1,s,r,i);if(Yre.has(t))return bB(t,J0[n],!1,s,r,i);throw new Ze("Illegal delimiter: '"+t+"'")},Qre=[{type:"small",style:yn.SCRIPTSCRIPT},{type:"small",style:yn.SCRIPT},{type:"small",style:yn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Xre=[{type:"small",style:yn.SCRIPTSCRIPT},{type:"small",style:yn.SCRIPT},{type:"small",style:yn.TEXT},{type:"stack"}],_B=[{type:"small",style:yn.SCRIPTSCRIPT},{type:"small",style:yn.SCRIPT},{type:"small",style:yn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Jre=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.")},kB=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 l=b0(t,Jre(a),"math"),c=l.height+l.depth;if(a.type==="small"){var d=r.havingBaseStyle(a.style);c*=d.sizeMultiplier}if(c>n)return a}return s[s.length-1]},n3=function(t,n,s,r,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;vB.has(t)?a=Qre:wB.has(t)?a=_B:a=Xre;var l=kB(t,n,a,r);return l.type==="small"?Ure(t,l.style,s,r,i,o):l.type==="large"?yB(t,l.size,s,r,i,o):bB(t,n,s,r,i,o)},Vx=function(t,n,s,r,i,o){var a=r.fontMetrics().axisHeight*r.sizeMultiplier,l=901,c=5/r.fontMetrics().ptPerEm,d=Math.max(n-a,s+a),h=Math.max(d/500*l,2*d-c);return n3(t,h,!0,r,i,o)},bA={"\\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}},Zre=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 wA(e){return"isMiddle"in e}function mv(e,t){var n=hv(e);if(n&&Zre.has(n.text))return n;throw n?new Ze("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Ze("Invalid delimiter type '"+e.type+"'",e)}Tt({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=mv(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:bA[e.funcName].size,mclass:bA[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?Ge([e.mclass]):xB(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(_a(e.delim,e.mode));var n=new st("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var s=at(J0[e.size]);return n.setAttribute("minsize",s),n.setAttribute("maxsize",s),n}});function vA(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Tt({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 Ze("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:mv(t[0],e).text,color:n}}});Tt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=mv(t[0],e),s=e.parser;++s.leftrightDepth;var r=s.parseExpression(!1);--s.leftrightDepth,s.expect("\\right",!1);var i=jn(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:r,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{vA(e);for(var n=Fr(e.body,t,!0,["mopen","mclose"]),s=0,r=0,i=!1,o=0;o<n.length;o++){var a=n[o];wA(a)?i=!0:(s=Math.max(n[o].height,s),r=Math.max(n[o].depth,r))}s*=t.sizeMultiplier,r*=t.sizeMultiplier;var l;if(e.left==="."?l=Ep(t,["mopen"]):l=Vx(e.left,s,r,t,e.mode,["mopen"]),n.unshift(l),i)for(var c=1;c<n.length;c++){var d=n[c];if(wA(d)){var h=d.isMiddle;n[c]=Vx(h.delim,s,r,h.options,e.mode,[])}}var f;if(e.right===".")f=Ep(t,["mclose"]);else{var m=e.rightColor?t.withColor(e.rightColor):t;f=Vx(e.right,s,r,m,e.mode,["mclose"])}return n.push(f),Ge(["minner"],n,t)},mathmlBuilder:(e,t)=>{vA(e);var n=Xo(e.body,t);if(e.left!=="."){var s=new st("mo",[_a(e.left,e.mode)]);s.setAttribute("fence","true"),n.unshift(s)}if(e.right!=="."){var r=new st("mo",[_a(e.right,e.mode)]);r.setAttribute("fence","true"),e.rightColor&&r.setAttribute("mathcolor",e.rightColor),n.push(r)}return E5(n)}});Tt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=mv(t[0],e);if(!e.parser.leftrightDepth)throw new Ze("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=Ep(t,[]):(n=xB(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?_a("|","text"):_a(e.delim,e.mode),s=new st("mo",[n]);return s.setAttribute("fence","true"),s.setAttribute("lspace","0.05em"),s.setAttribute("rspace","0.05em"),s}});var pv=(e,t)=>{var n=Jf(fs(e.body,t),t),s=e.label.slice(1),r=t.sizeMultiplier,i,o,a=Ic(e.body);if(s==="sout")i=Ge(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/r,o=-.5*t.fontMetrics().xHeight;else if(s==="phase"){var l=or({number:.6,unit:"pt"},t),c=or({number:.35,unit:"ex"},t),d=t.havingBaseSizing();r=r/d.sizeMultiplier;var h=n.height+n.depth+l+c;n.style.paddingLeft=at(h/2+l);var f=Math.floor(1e3*h*r),m=Jse(f),g=new Cc([new Uu("phase",m)],{width:"400em",height:at(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=Vu(["hide-tail"],[g],t),i.style.height=at(h),o=n.depth+l+c}else{/cancel/.test(s)?a||n.classes.push("cancel-pad"):s==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var y,b,w=0;/box/.test(s)?(w=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(s==="colorbox"?0:w),b=y):s==="angl"?(w=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*w,b=Math.max(0,.25-n.depth)):(y=a?.2:0,b=y),i=Lre(n,s,y,b,t),/fbox|boxed|fcolorbox/.test(s)?(i.style.borderStyle="solid",i.style.borderWidth=at(w)):s==="angl"&&w!==.049&&(i.style.borderTopWidth=at(w),i.style.borderRightWidth=at(w)),o=n.depth+b,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var v;if(e.backgroundColor)v=ds({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(s)?["svg-align"]:[];v=ds({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:x}]})}return/cancel/.test(s)&&(v.height=n.height,v.depth=n.depth),/cancel/.test(s)&&!a?Ge(["mord","cancel-lap"],[v],t):Ge(["mord"],[v],t)},gv=(e,t)=>{var n,s=new st(e.label.includes("colorbox")?"mpadded":"menclose",[Os(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: "+at(r)+" solid "+e.borderColor)}break;case"\\xcancel":s.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&s.setAttribute("mathbackground",e.backgroundColor),s};Tt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=jn(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:s.mode,label:r,backgroundColor:i,body:o}},htmlBuilder:pv,mathmlBuilder:gv});Tt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=jn(t[0],"color-token").color,o=jn(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:s.mode,label:r,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:pv,mathmlBuilder:gv});Tt({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]}}});Tt({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:pv,mathmlBuilder:gv});Tt({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:pv,mathmlBuilder:gv});Tt({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 SB={};function Dl(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},l=0;l<n.length;++l)SB[n[l]]=a;i&&(Bb[t]=i),o&&(Pb[t]=o)}var TB={};function q(e,t){TB[e]=t}class bo{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 bo(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Wo{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 Wo(n,bo.range(this,t))}}function xA(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 yv=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Ze("{"+e.envName+"} can be used only in display mode.")},eie=new Set(["gather","gather*"]);function j5(e){if(!e.includes("ed"))return!e.includes("*")}function rd(e,t,n){var{hskipBeforeAndAfter:s,addJot:r,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:d,maxNumCols:h,leqno:f}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!o){var m=e.gullet.expandMacroAsText("\\arraystretch");if(m==null)o=1;else if(o=parseFloat(m),!o||o<0)throw new Ze("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var g=[],y=[g],b=[],w=[],v=l!=null?[]:void 0;function x(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function C(){v&&(e.gullet.macros.get("\\df@tag")?(v.push(e.subparse([new Wo("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):v.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),w.push(xA(e));;){var A=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var T={type:"ordgroup",mode:e.mode,body:A};n&&(T={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[T]}),g.push(T);var _=e.fetch().text;if(_==="&"){if(h&&g.length===h){if(c||a)throw new Ze("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(_==="\\end"){C(),g.length===1&&T.type==="styling"&&T.body.length===1&&T.body[0].type==="ordgroup"&&T.body[0].body.length===0&&(y.length>1||!d)&&y.pop(),w.length<y.length+1&&w.push([]);break}else if(_==="\\\\"){e.consume();var R=void 0;e.gullet.future().text!==" "&&(R=e.parseSizeGroup(!0)),b.push(R?R.value:null),C(),w.push(xA(e)),g=[],y.push(g),x()}else throw new Ze("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:y,cols:i,rowGaps:b,hskipBeforeAndAfter:s,hLinesBeforeRow:w,colSeparationType:a,tags:v,leqno:f}}function R5(e){return e.slice(0,1)==="d"?"display":"text"}var Ol=function(t,n){var s,r,i=t.body.length,o=t.hLinesBeforeRow,a=0,l=new Array(i),c=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,f=5*h;if(t.colSeparationType&&t.colSeparationType==="small"){var m=n.havingStyle(yn.SCRIPT).sizeMultiplier;f=.2778*(m/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?or({number:3,unit:"ex"},n):12*h,y=3*h,b=t.arraystretch*g,w=.7*b,v=.3*b,x=0;function C(Ue){for(var Xe=0;Xe<Ue.length;++Xe)Xe>0&&(x+=.25),c.push({pos:x,isDashed:Ue[Xe]})}for(C(o[0]),s=0;s<t.body.length;++s){var A=t.body[s],T=w,_=v;a<A.length&&(a=A.length);var R={cells:new Array(A.length),height:0,depth:0,pos:0};for(r=0;r<A.length;++r){var I=fs(A[r],n);_<I.depth&&(_=I.depth),T<I.height&&(T=I.height),R.cells[r]=I}var k=t.rowGaps[s],j=0;k&&(j=or(k,n),j>0&&(j+=v,_<j&&(_=j),j=0)),t.addJot&&s<t.body.length-1&&(_+=y),R.height=T,R.depth=_,x+=T,R.pos=x,x+=_+j,l[s]=R,C(o[s+1])}var N=x/2+n.fontMetrics().axisHeight,L=t.cols||[],$=[],F,B,Q=[];if(t.tags&&t.tags.some(Ue=>Ue))for(s=0;s<i;++s){var Y=l[s],ne=Y.pos-N,P=t.tags[s],le=void 0;P===!0?le=Ge(["eqn-num"],[],n):P===!1?le=Ge([],[],n):le=Ge([],Fr(P,n,!0),n),le.depth=Y.depth,le.height=Y.height,Q.push({type:"elem",elem:le,shift:ne})}for(r=0,B=0;r<a||B<L.length;++r,++B){for(var z,M=L[B],re=!0;((U=M)==null?void 0:U.type)==="separator";){var U;if(re||(F=Ge(["arraycolsep"],[]),F.style.width=at(n.fontMetrics().doubleRuleSep),$.push(F)),M.separator==="|"||M.separator===":"){var W=M.separator==="|"?"solid":"dashed",J=Ge(["vertical-separator"],[],n);J.style.height=at(x),J.style.borderRightWidth=at(d),J.style.borderRightStyle=W,J.style.margin="0 "+at(-d/2);var G=x-N;G&&(J.style.verticalAlign=at(-G)),$.push(J)}else throw new Ze("Invalid separator type: "+M.separator);B++,M=L[B],re=!1}if(!(r>=a)){var te=void 0;if(r>0||t.hskipBeforeAndAfter){var H,ie;te=(H=(ie=M)==null?void 0:ie.pregap)!=null?H:f,te!==0&&(F=Ge(["arraycolsep"],[]),F.style.width=at(te),$.push(F))}var fe=[];for(s=0;s<i;++s){var Ne=l[s],Ie=Ne.cells[r];if(Ie){var Ce=Ne.pos-N;Ie.depth=Ne.depth,Ie.height=Ne.height,fe.push({type:"elem",elem:Ie,shift:Ce})}}var ve=ds({positionType:"individualShift",children:fe}),ut=Ge(["col-align-"+(((z=M)==null?void 0:z.align)||"c")],[ve]);if($.push(ut),r<a-1||t.hskipBeforeAndAfter){var ae,Ct;te=(ae=(Ct=M)==null?void 0:Ct.postgap)!=null?ae:f,te!==0&&(F=Ge(["arraycolsep"],[]),F.style.width=at(te),$.push(F))}}}var Ke=Ge(["mtable"],$);if(c.length>0){for(var on=Xf("hline",n,d),qt=Xf("hdashline",n,d),gt=[{type:"elem",elem:Ke,shift:0}];c.length>0;){var St=c.pop(),ft=St.pos-N;St.isDashed?gt.push({type:"elem",elem:qt,shift:ft}):gt.push({type:"elem",elem:on,shift:ft})}Ke=ds({positionType:"individualShift",children:gt})}if(Q.length===0)return Ge(["mord"],[Ke],n);var de=ds({positionType:"individualShift",children:Q}),_e=Ge(["tag"],[de],n);return Rc([Ke,_e])},tie={c:"center ",l:"left ",r:"right "},Bl=function(t,n){for(var s=[],r=new st("mtd",[],["mtr-glue"]),i=new st("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var a=t.body[o],l=[],c=0;c<a.length;c++)l.push(new st("mtd",[Os(a[c],n)]));t.tags&&t.tags[o]&&(l.unshift(r),l.push(r),t.leqno?l.unshift(i):l.push(i)),s.push(new st("mtr",l))}var d=new st("mtable",s),h=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",at(h));var f="",m="";if(t.cols&&t.cols.length>0){var g=t.cols,y="",b=!1,w=0,v=g.length;g[0].type==="separator"&&(f+="top ",w=1),g[g.length-1].type==="separator"&&(f+="bottom ",v-=1);for(var x=w;x<v;x++){var C=g[x];C.type==="align"?(m+=tie[C.align],b&&(y+="none "),b=!0):C.type==="separator"&&b&&(y+=C.separator==="|"?"solid ":"dashed ",b=!1)}d.setAttribute("columnalign",m.trim()),/[sd]/.test(y)&&d.setAttribute("columnlines",y.trim())}if(t.colSeparationType==="align"){for(var A=t.cols||[],T="",_=1;_<A.length;_++)T+=_%2?"0em ":"1em ";d.setAttribute("columnspacing",T.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?d.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?d.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?d.setAttribute("columnspacing","0.5em"):d.setAttribute("columnspacing","1em");var R="",I=t.hLinesBeforeRow;f+=I[0].length>0?"left ":"",f+=I[I.length-1].length>0?"right ":"";for(var k=1;k<I.length-1;k++)R+=I[k].length===0?"none ":I[k][0]?"dashed ":"solid ";return/[sd]/.test(R)&&d.setAttribute("rowlines",R.trim()),f!==""&&(d=new st("menclose",[d]),d.setAttribute("notation",f.trim())),t.arraystretch&&t.arraystretch<1&&(d=new st("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},CB=function(t,n){t.envName.includes("ed")||yv(t);var s=[],r=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=rd(t.parser,{cols:s,addJot:!0,autoTag:i?void 0:j5(t.envName),emptySingleRow:!0,colSeparationType:r,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),a=0,l=0,c={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 f=jn(n[0].body[h],"textord");d+=f.text}a=Number(d),l=a*2}var m=!l;o.body.forEach(function(w){for(var v=1;v<w.length;v+=2){var x=jn(w[v],"styling"),C=jn(x.body[0],"ordgroup");C.body.unshift(c)}if(m)l<w.length&&(l=w.length);else{var A=w.length/2;if(a<A)throw new Ze("Too many math in a row: "+("expected "+a+", but got "+A),w[0])}});for(var g=0;g<l;++g){var y="r",b=0;g%2===1?y="l":g>0&&m&&(b=1),s[g]={type:"align",align:y,pregap:b,postgap:0}}return o.colSeparationType=m?"align":"alignat",o};Dl({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=hv(t[0]),s=n?[t[0]]:jn(t[0],"ordgroup").body,r=s.map(function(o){var a=dv(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Ze("Unknown column alignment: "+l,o)}),i={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return rd(e.parser,i,R5(e.envName))},htmlBuilder:Ol,mathmlBuilder:Bl});Dl({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 Ze("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[{type:"align",align:n}]}}var i=rd(e.parser,s,R5(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:Ol,mathmlBuilder:Bl});Dl({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=rd(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Ol,mathmlBuilder:Bl});Dl({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=hv(t[0]),s=n?[t[0]]:jn(t[0],"ordgroup").body,r=s.map(function(a){var l=dv(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new Ze("Unknown column alignment: "+c,a)});if(r.length>1)throw new Ze("{subarray} can contain only one column");var i={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},o=rd(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new Ze("{subarray} can contain only one column");return o},htmlBuilder:Ol,mathmlBuilder:Bl});Dl({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=rd(e.parser,t,R5(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Ol,mathmlBuilder:Bl});Dl({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:CB,htmlBuilder:Ol,mathmlBuilder:Bl});Dl({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){eie.has(e.envName)&&yv(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:j5(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return rd(e.parser,t,"display")},htmlBuilder:Ol,mathmlBuilder:Bl});Dl({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:CB,htmlBuilder:Ol,mathmlBuilder:Bl});Dl({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){yv(e);var t={autoTag:j5(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return rd(e.parser,t,"display")},htmlBuilder:Ol,mathmlBuilder:Bl});Dl({type:"array",names:["CD"],props:{numArgs:0},handler(e){return yv(e),qre(e.parser)},htmlBuilder:Ol,mathmlBuilder:Bl});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Tt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Ze(e.funcName+" valid only within array environment")}});var _A=SB;Tt({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 Ze("Invalid environment name",r);for(var i="",o=0;o<r.body.length;++o)i+=jn(r.body[o],"textord").text;if(s==="\\begin"){if(!_A.hasOwnProperty(i))throw new Ze("No such environment: "+i,r);var a=_A[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",a),d={mode:n.mode,envName:i,parser:n},h=a.handler(d,l,c);n.expect("\\end",!1);var f=n.nextToken,m=jn(n.parseFunction(),"environment");if(m.name!==i)throw new Ze("Mismatch: \\begin{"+i+"} matched by \\end{"+m.name+"}",f);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:r}}});var AB=(e,t)=>{var n=e.font,s=t.withFont(n);return fs(e.body,s)},EB=(e,t)=>{var n=e.font,s=t.withFont(n);return Os(e.body,s)},kA={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};Tt({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=$b(t[0]),i=s;return i in kA&&(i=kA[i]),{type:"font",mode:n.mode,font:i.slice(1),body:r}},htmlBuilder:AB,mathmlBuilder:EB});Tt({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:fv(s),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:s}],isCharacterBox:Ic(s)}}});Tt({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:AB,mathmlBuilder:EB});var nie=(e,t)=>{var n=t.style,s=n.fracNum(),r=n.fracDen(),i;i=t.havingStyle(s);var o=fs(e.numer,i,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}i=t.havingStyle(r);var c=fs(e.denom,i,t),d,h,f;e.hasBarLine?(e.barSize?(h=or(e.barSize,t),d=Xf("frac-line",t,h)):d=Xf("frac-line",t),h=d.height,f=d.height):(d=null,h=0,f=t.fontMetrics().defaultRuleThickness);var m,g,y;n.size===yn.DISPLAY.size?(m=t.fontMetrics().num1,h>0?g=3*f:g=7*f,y=t.fontMetrics().denom1):(h>0?(m=t.fontMetrics().num2,g=f):(m=t.fontMetrics().num3,g=3*f),y=t.fontMetrics().denom2);var b;if(d){var v=t.fontMetrics().axisHeight;m-o.depth-(v+.5*h)<g&&(m+=g-(m-o.depth-(v+.5*h))),v-.5*h-(c.height-y)<g&&(y+=g-(v-.5*h-(c.height-y)));var x=-(v-.5*h);b=ds({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:d,shift:x},{type:"elem",elem:o,shift:-m}]})}else{var w=m-o.depth-(c.height-y);w<g&&(m+=.5*(g-w),y+=.5*(g-w)),b=ds({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:o,shift:-m}]})}i=t.havingStyle(n),b.height*=i.sizeMultiplier/t.sizeMultiplier,b.depth*=i.sizeMultiplier/t.sizeMultiplier;var C;n.size===yn.DISPLAY.size?C=t.fontMetrics().delim1:n.size===yn.SCRIPTSCRIPT.size?C=t.havingStyle(yn.SCRIPT).fontMetrics().delim2:C=t.fontMetrics().delim2;var A,T;return e.leftDelim==null?A=Ep(t,["mopen"]):A=n3(e.leftDelim,C,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?T=Ge([]):e.rightDelim==null?T=Ep(t,["mclose"]):T=n3(e.rightDelim,C,!0,t.havingStyle(n),e.mode,["mclose"]),Ge(["mord"].concat(i.sizingClasses(t)),[A,Ge(["mfrac"],[b]),T],t)},sie=(e,t)=>{var n=new st("mfrac",[Os(e.numer,t),Os(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var s=or(e.barSize,t);n.setAttribute("linethickness",at(s))}if(e.leftDelim!=null||e.rightDelim!=null){var r=[];if(e.leftDelim!=null){var i=new st("mo",[new Mr(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),r.push(i)}if(r.push(n),e.rightDelim!=null){var o=new st("mo",[new Mr(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),r.push(o)}return E5(r)}return n},MB=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};Tt({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,l=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="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=s==="\\cfrac",d=null;return c||s.startsWith("\\d")?d="display":s.startsWith("\\t")&&(d="text"),MB({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},d)},htmlBuilder:nie,mathmlBuilder:sie});Tt({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 SA=["display","text","script","scriptscript"],TA=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};Tt({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=$b(t[0]),o=i.type==="atom"&&i.family==="open"?TA(i.text):null,a=$b(t[1]),l=a.type==="atom"&&a.family==="close"?TA(a.text):null,c=jn(t[2],"size"),d,h=null;c.isBlank?d=!0:(h=c.value,d=h.number>0);var f=null,m=t[3];if(m.type==="ordgroup"){if(m.body.length>0){var g=jn(m.body[0],"textord");f=SA[Number(g.text)]}}else m=jn(m,"textord"),f=SA[Number(m.text)];return MB({type:"genfrac",mode:n.mode,numer:s,denom:r,continued:!1,hasBarLine:d,barSize:h,leftDelim:o,rightDelim:l},f)}});Tt({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:jn(t[0],"size").value,token:r}}});Tt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=jn(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 NB=(e,t)=>{var n=t.style,s,r;e.type==="supsub"?(s=e.sup?fs(e.sup,t.havingStyle(n.sup()),t):fs(e.sub,t.havingStyle(n.sub()),t),r=jn(e.base,"horizBrace")):r=jn(e,"horizBrace");var i=fs(r.base,t.havingBaseStyle(yn.DISPLAY)),o=uv(r,t),a;if(r.isOver?a=ds({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=ds({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 l=Ge(["minner",r.isOver?"mover":"munder"],[a],t);r.isOver?a=ds({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:s}]}):a=ds({positionType:"bottom",positionData:l.depth+.2+s.height+s.depth,children:[{type:"elem",elem:s},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Ge(["minner",r.isOver?"mover":"munder"],[a],t)},rie=(e,t)=>{var n=cv(e.label);return new st(e.isOver?"mover":"munder",[Os(e.base,t),n])};Tt({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:NB,mathmlBuilder:rie});Tt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[1],r=jn(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:r})?{type:"href",mode:n.mode,href:r,body:Er(s)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=Fr(e.body,t,!1);return yre(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Wu(e.body,t);return n instanceof st||(n=new st("mrow",[n])),n.setAttribute("href",e.href),n}});Tt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=jn(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:Er(a)}}});Tt({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:Er(t[0])}},htmlBuilder(e,t){var n=Fr(e.body,t.withFont(""),!1);return Rc(n)},mathmlBuilder(e,t){return new st("mrow",Xo(e.body,t.withFont("")))}});Tt({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=jn(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(s){case"\\htmlClass":l.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,a={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var c=i.split(","),d=0;d<c.length;d++){var h=c[d],f=h.indexOf("=");if(f<0)throw new Ze("\\htmlData key/value '"+h+"' missing equals sign");var m=h.slice(0,f),g=h.slice(f+1);l["data-"+m.trim()]=g}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:l,body:Er(o)}:n.formatUnsupportedCmd(s)},htmlBuilder:(e,t)=>{var n=Fr(e.body,t,!1),s=["enclosing"];e.attributes.class&&s.push(...e.attributes.class.trim().split(/\s+/));var r=Ge(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)=>Wu(e.body,t)});Tt({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:Er(t[0]),mathml:Er(t[1])}},htmlBuilder:(e,t)=>{var n=Fr(e.html,t,!1);return Rc(n)},mathmlBuilder:(e,t)=>Wu(e.mathml,t)});var Wx=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 Ze("Invalid size: '"+t+"' in \\includegraphics");var s={number:+(n[1]+n[2]),unit:n[3]};if(!WO(s))throw new Ze("Invalid unit: '"+s.unit+"' in \\includegraphics.");return s};Tt({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 l=jn(n[0],"raw").string,c=l.split(","),d=0;d<c.length;d++){var h=c[d].split("=");if(h.length===2){var f=h[1].trim();switch(h[0].trim()){case"alt":a=f;break;case"width":r=Wx(f);break;case"height":i=Wx(f);break;case"totalheight":o=Wx(f);break;default:throw new Ze("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var m=jn(t[0],"url").url;return a===""&&(a=m,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),s.settings.isTrusted({command:"\\includegraphics",url:m})?{type:"includegraphics",mode:s.mode,alt:a,width:r,height:i,totalheight:o,src:m}:s.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=or(e.height,t),s=0;e.totalheight.number>0&&(s=or(e.totalheight,t)-n);var r=0;e.width.number>0&&(r=or(e.width,t));var i={height:at(n+s)};r>0&&(i.width=at(r)),s>0&&(i.verticalAlign=at(-s));var o=new ore(e.src,e.alt,i);return o.height=n,o.depth=s,o},mathmlBuilder:(e,t)=>{var n=new st("mglyph",[]);n.setAttribute("alt",e.alt);var s=or(e.height,t),r=0;if(e.totalheight.number>0&&(r=or(e.totalheight,t)-s,n.setAttribute("valign",at(-r))),n.setAttribute("height",at(s+r)),e.width.number>0){var i=or(e.width,t);n.setAttribute("width",at(i))}return n.setAttribute("src",e.src),n}});Tt({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=jn(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 ZO(e.dimension,t)},mathmlBuilder(e,t){var n=or(e.dimension,t);return new iB(n)}});Tt({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=Ge([],[fs(e.body,t)]),n=Ge(["inner"],[n],t)):n=Ge(["inner"],[fs(e.body,t)]);var s=Ge(["fix"],[]),r=Ge([e.alignment],[n,s],t),i=Ge(["strut"]);return i.style.height=at(r.height+r.depth),r.depth&&(i.style.verticalAlign=at(-r.depth)),r.children.unshift(i),r=Ge(["thinbox"],[r],t),Ge(["mord","vbox"],[r],t)},mathmlBuilder:(e,t)=>{var n=new st("mpadded",[Os(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}});Tt({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}}});Tt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Ze("Mismatched "+e.funcName)}});var CA=(e,t)=>{switch(t.style.size){case yn.DISPLAY.size:return e.display;case yn.TEXT.size:return e.text;case yn.SCRIPT.size:return e.script;case yn.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Tt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Er(t[0]),text:Er(t[1]),script:Er(t[2]),scriptscript:Er(t[3])}},htmlBuilder:(e,t)=>{var n=CA(e,t),s=Fr(n,t,!1);return Rc(s)},mathmlBuilder:(e,t)=>{var n=CA(e,t);return Wu(n,t)}});var IB=(e,t,n,s,r,i,o)=>{e=Ge([],[e]);var a=n&&Ic(n),l,c;if(t){var d=fs(t,s.havingStyle(r.sup()),s);c={elem:d,kern:Math.max(s.fontMetrics().bigOpSpacing1,s.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=fs(n,s.havingStyle(r.sub()),s);l={elem:h,kern:Math.max(s.fontMetrics().bigOpSpacing2,s.fontMetrics().bigOpSpacing4-h.height)}}var f;if(c&&l){var m=s.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+o;f=ds({positionType:"bottom",positionData:m,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:at(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:at(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else if(l){var g=e.height-o;f=ds({positionType:"top",positionData:g,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:at(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(c){var y=e.depth+o;f=ds({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:at(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else return e;var b=[f];if(l&&i!==0&&!a){var w=Ge(["mspace"],[],s);w.style.marginRight=at(i),b.unshift(w)}return Ge(["mop","op-limits"],b,s)},jB=new Set(["\\smallint"]),Tm=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=jn(e.base,"op"),r=!0):i=jn(e,"op");var o=t.style,a=!1;o.size===yn.DISPLAY.size&&i.symbol&&!jB.has(i.name)&&(a=!0);var l,c;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"),l=Gi(i.name,d,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,h.length>0){var f=tB(h+"Size"+(a?"2":"1"),t);l=ds({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]}),i.name="\\"+h,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var m=Fr(i.body,t,!0);m.length===1&&m[0]instanceof Yo?(l=m[0],l.classes[0]="mop"):l=Ge(["mop"],m,t)}else{for(var g=[],y=1;y<i.name.length;y++)g.push(C5(i.name[y],i.mode,t));l=Ge(["mop"],g,t)}var b=0,w=0;if((l instanceof Yo||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var v;b=(l.height-l.depth)/2-t.fontMetrics().axisHeight,w=(v=l.italic)!=null?v:0}return r?IB(l,n,s,t,o,w,b):(b&&(l.style.position="relative",l.style.top=at(b)),l)},vg=(e,t)=>{var n;if(e.symbol)n=new st("mo",[_a(e.name,e.mode)]),jB.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new st("mo",Xo(e.body,t));else{n=new st("mi",[new Mr(e.name.slice(1))]);var s=new st("mo",[_a("⁡","text")]);e.parentIsSupSub?n=new st("mrow",[n,s]):n=rB([n,s])}return n},iie={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Tt({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=iie[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Tm,mathmlBuilder:vg});Tt({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:Er(s)}},htmlBuilder:Tm,mathmlBuilder:vg});var oie={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Tt({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:Tm,mathmlBuilder:vg});Tt({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:Tm,mathmlBuilder:vg});Tt({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=oie[s]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Tm,mathmlBuilder:vg});var RB=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=jn(e.base,"operatorname"),r=!0):i=jn(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(h=>{var f="text"in h?h.text:void 0;return typeof f=="string"?{type:"textord",mode:h.mode,text:f}:h}),l=Fr(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof Yo&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Ge(["mop"],l,t)}else o=Ge(["mop"],[],t);return r?IB(o,n,s,t,t.style,0,0):o},aie=(e,t)=>{for(var n=Xo(e.body,t.withFont("mathrm")),s=!0,r=0;r<n.length;r++){var i=n[r];if(!(i instanceof iB))if(i instanceof st)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 Mr?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 Mr(a)]}var l=new st("mi",n);l.setAttribute("mathvariant","normal");var c=new st("mo",[_a("⁡","text")]);return e.parentIsSupSub?new st("mrow",[l,c]):rB([l,c])};Tt({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:Er(r),alwaysHandleSupSub:s==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:RB,mathmlBuilder:aie});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");_h({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?Rc(Fr(e.body,t,!1)):Ge(["mord"],Fr(e.body,t,!0),t)},mathmlBuilder(e,t){return Wu(e.body,t,!0)}});Tt({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=fs(e.body,t.havingCrampedStyle()),s=Xf("overline-line",t),r=t.fontMetrics().defaultRuleThickness,i=ds({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*r},{type:"elem",elem:s},{type:"kern",size:r}]});return Ge(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new st("mo",[new Mr("‾")]);n.setAttribute("stretchy","true");var s=new st("mover",[Os(e.body,t),n]);return s.setAttribute("accent","true"),s}});Tt({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:Er(s)}},htmlBuilder:(e,t)=>{var n=Fr(e.body,t.withPhantom(),!1);return Rc(n)},mathmlBuilder:(e,t)=>{var n=Xo(e.body,t);return new st("mphantom",n)}});q("\\hphantom","\\smash{\\phantom{#1}}");Tt({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=Ge(["inner"],[fs(e.body,t.withPhantom())]),s=Ge(["fix"],[]);return Ge(["mord","rlap"],[n,s],t)},mathmlBuilder:(e,t)=>{var n=Xo(Er(e.body),t),s=new st("mphantom",n),r=new st("mpadded",[s]);return r.setAttribute("width","0px"),r}});Tt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,s=jn(t[0],"size").value,r=t[1];return{type:"raisebox",mode:n.mode,dy:s,body:r}},htmlBuilder(e,t){var n=fs(e.body,t),s=or(e.dy,t);return ds({positionType:"shift",positionData:-s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new st("mpadded",[Os(e.body,t)]),s=e.dy.number+e.dy.unit;return n.setAttribute("voffset",s),n}});Tt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Tt({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=jn(t[0],"size"),o=jn(t[1],"size");return{type:"rule",mode:s.mode,shift:r&&jn(r,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=Ge(["mord","rule"],[],t),s=or(e.width,t),r=or(e.height,t),i=e.shift?or(e.shift,t):0;return n.style.borderRightWidth=at(s),n.style.borderTopWidth=at(r),n.style.bottom=at(i),n.width=s,n.height=r+i,n.depth=-i,n.maxFontSize=r*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=or(e.width,t),s=or(e.height,t),r=e.shift?or(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new st("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",at(n)),o.setAttribute("height",at(s));var a=new st("mpadded",[o]);return r>=0?a.setAttribute("height",at(r)):(a.setAttribute("height",at(r)),a.setAttribute("depth",at(-r))),a.setAttribute("voffset",at(r)),a}});function LB(e,t,n){for(var s=Fr(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 Rc(s)}var AA=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],lie=(e,t)=>{var n=t.havingSize(e.size);return LB(e.body,n,t)};Tt({type:"sizing",names:AA,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:AA.indexOf(s)+1,body:i}},htmlBuilder:lie,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),s=Xo(e.body,n),r=new st("mstyle",s);return r.setAttribute("mathsize",at(n.sizeMultiplier)),r}});Tt({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]&&jn(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var c=o.body[l];if(a=dv(c).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=Ge([],[fs(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 Ge(["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=ds({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Ge(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var n=new st("mpadded",[Os(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});Tt({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=fs(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=Jf(n,t);var s=t.fontMetrics(),r=s.defaultRuleThickness,i=r;t.style.id<yn.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,a=n.height+n.depth+o+r,{span:l,ruleWidth:c,advanceWidth:d}=Kre(a,t),h=l.height-c;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var f=l.height-n.height-o-c;n.style.paddingLeft=at(d);var m=ds({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+f)},{type:"elem",elem:l},{type:"kern",size:c}]});if(e.index){var g=t.havingStyle(yn.SCRIPTSCRIPT),y=fs(e.index,g,t),b=.6*(m.height-m.depth),w=ds({positionType:"shift",positionData:-b,children:[{type:"elem",elem:y}]}),v=Ge(["root"],[w]);return Ge(["mord","sqrt"],[v,m],t)}else return Ge(["mord","sqrt"],[m],t)},mathmlBuilder(e,t){var{body:n,index:s}=e;return s?new st("mroot",[Os(n,t),Os(s,t)]):new st("msqrt",[Os(n,t)])}});var s3={display:yn.DISPLAY,text:yn.TEXT,script:yn.SCRIPT,scriptscript:yn.SCRIPTSCRIPT};function cie(e){return e in s3}Tt({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(!cie(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:r.mode,style:o,body:i}},htmlBuilder(e,t){var n=s3[e.style],s=t.havingStyle(n);return e.resetFont&&(s=s.withFont("")),LB(e.body,s,t)},mathmlBuilder(e,t){var n=s3[e.style],s=t.havingStyle(n);e.resetFont&&(s=s.withFont(""));var r=Xo(e.body,s),i=new st("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 uie=function(t,n){var s=t.base;if(s)if(s.type==="op"){var r=s.limits&&(n.style.size===yn.DISPLAY.size||s.alwaysHandleSupSub);return r?Tm:null}else if(s.type==="operatorname"){var i=s.alwaysHandleSupSub&&(n.style.size===yn.DISPLAY.size||s.limits);return i?RB:null}else{if(s.type==="accent")return Ic(s.base)?N5:null;if(s.type==="horizBrace"){var o=!t.sub;return o===s.isOver?NB:null}else return null}else return null};_h({type:"supsub",htmlBuilder(e,t){var n=uie(e,t);if(n)return n(e,t);var{base:s,sup:r,sub:i}=e,o=fs(s,t),a,l,c=t.fontMetrics(),d=0,h=0,f=s&&Ic(s);if(r){var m=t.havingStyle(t.style.sup());a=fs(r,m,t),f||(d=o.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());l=fs(i,g,t),f||(h=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var y;t.style===yn.DISPLAY?y=c.sup1:t.style.cramped?y=c.sup3:y=c.sup2;var b=t.sizeMultiplier,w=at(.5/c.ptPerEm/b),v=null;if(l){var x=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof Yo||x){var C;v=at(-((C=o.italic)!=null?C:0))}}var A;if(a&&l){d=Math.max(d,y,a.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var T=c.defaultRuleThickness,_=4*T;if(d-a.depth-(l.height-h)<_){h=_-(d-a.depth)+l.height;var R=.8*c.xHeight-(d-a.depth);R>0&&(d+=R,h-=R)}var I=[{type:"elem",elem:l,shift:h,marginRight:w,marginLeft:v},{type:"elem",elem:a,shift:-d,marginRight:w}];A=ds({positionType:"individualShift",children:I})}else if(l){h=Math.max(h,c.sub1,l.height-.8*c.xHeight);var k=[{type:"elem",elem:l,marginLeft:v,marginRight:w}];A=ds({positionType:"shift",positionData:h,children:k})}else if(a)d=Math.max(d,y,a.depth+.25*c.xHeight),A=ds({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:w}]});else throw new Error("supsub must have either sup or sub.");var j=Jk(o,"right")||"mord";return Ge([j],[o,Ge(["msupsub"],[A])],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=[Os(e.base,t)];e.sub&&i.push(Os(e.sub,t)),e.sup&&i.push(Os(e.sup,t));var o;if(n)o=s?"mover":"munder";else if(e.sub)if(e.sup){var c=e.base;c&&c.type==="op"&&c.limits&&t.style===yn.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(t.style===yn.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===yn.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===yn.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===yn.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===yn.DISPLAY)?o="mover":o="msup"}return new st(o,i)}});_h({type:"atom",htmlBuilder(e,t){return C5(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new st("mo",[_a(e.text,e.mode)]);if(e.family==="bin"){var s=M5(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 DB={mi:"italic",mn:"normal",mtext:"normal"};_h({type:"mathord",htmlBuilder(e,t){return lv(e,t,"mathord")},mathmlBuilder(e,t){var n=new st("mi",[_a(e.text,e.mode,t)]),s=M5(e,t)||"italic";return s!==DB[n.type]&&n.setAttribute("mathvariant",s),n}});_h({type:"textord",htmlBuilder(e,t){return lv(e,t,"textord")},mathmlBuilder(e,t){var n=_a(e.text,e.mode,t),s=M5(e,t)||"normal",r;return e.mode==="text"?r=new st("mtext",[n]):/[0-9]/.test(e.text)?r=new st("mn",[n]):e.text==="\\prime"?r=new st("mo",[n]):r=new st("mi",[n]),s!==DB[r.type]&&r.setAttribute("mathvariant",s),r}});var Gx={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Kx={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};_h({type:"spacing",htmlBuilder(e,t){if(Kx.hasOwnProperty(e.text)){var n=Kx[e.text].className||"";if(e.mode==="text"){var s=lv(e,t,"textord");return s.classes.push(n),s}else return Ge(["mspace",n],[C5(e.text,e.mode,t)],t)}else{if(Gx.hasOwnProperty(e.text))return Ge(["mspace",Gx[e.text]],[],t);throw new Ze('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(Kx.hasOwnProperty(e.text))n=new st("mtext",[new Mr(" ")]);else{if(Gx.hasOwnProperty(e.text))return new st("mspace");throw new Ze('Unknown type of space "'+e.text+'"')}return n}});var EA=()=>{var e=new st("mtd",[]);return e.setAttribute("width","50%"),e};_h({type:"tag",mathmlBuilder(e,t){var n=new st("mtable",[new st("mtr",[EA(),new st("mtd",[Wu(e.body,t)]),EA(),new st("mtd",[Wu(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var MA={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},NA={"\\textbf":"textbf","\\textmd":"textmd"},die={"\\textit":"textit","\\textup":"textup"},IA=(e,t)=>{var n=e.font;if(n){if(MA[n])return t.withTextFontFamily(MA[n]);if(NA[n])return t.withTextFontWeight(NA[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(die[n])};Tt({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:Er(r),font:s}},htmlBuilder(e,t){var n=IA(e,t),s=Fr(e.body,n,!0);return Ge(["mord","text"],s,n)},mathmlBuilder(e,t){var n=IA(e,t);return Wu(e.body,n)}});Tt({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=fs(e.body,t),s=Xf("underline-line",t),r=t.fontMetrics().defaultRuleThickness,i=ds({positionType:"top",positionData:n.height,children:[{type:"kern",size:r},{type:"elem",elem:s},{type:"kern",size:3*r},{type:"elem",elem:n}]});return Ge(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new st("mo",[new Mr("‾")]);n.setAttribute("stretchy","true");var s=new st("munder",[Os(e.body,t),n]);return s.setAttribute("accentunder","true"),s}});Tt({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=fs(e.body,t),s=t.fontMetrics().axisHeight,r=.5*(n.height-s-(n.depth+s));return ds({positionType:"shift",positionData:r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new st("mpadded",[Os(e.body,t)],["vcenter"]);return new st("mrow",[n])}});Tt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Ze("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=jA(e),s=[],r=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push(Gi(o,"Typewriter-Regular",e.mode,r,["mord","texttt"]))}return Ge(["mord","text"].concat(r.sizingClasses(t)),JO(s),r)},mathmlBuilder(e,t){var n=new Mr(jA(e)),s=new st("mtext",[n]);return s.setAttribute("mathvariant","monospace"),s}});var jA=e=>e.body.replace(/ /g,e.star?"␣":" "),bu=nB,OB=`[ \r
	]`,hie="\\\\[a-zA-Z@]+",fie="\\\\[^\uD800-\uDFFF]",mie="("+hie+")"+OB+"*",pie=`\\\\(
|[ \r	]+
?)[ \r	]*`,r3="[̀-ͯ]",gie=new RegExp(r3+"+$"),yie="("+OB+"+)|"+(pie+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(r3+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(r3+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+mie)+("|"+fie+")");class RA{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(yie,"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 Wo("EOF",new bo(this,n,n));var s=this.tokenRegex.exec(t);if(s===null||s.index!==n)throw new Ze("Unexpected character: '"+t[n]+"'",new Wo(t[n],new bo(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 Wo(r,new bo(this,n,this.tokenRegex.lastIndex))}}class bie{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 Ze("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 wie=TB;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 LA={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 Ze("\\char` missing argument");s=t.text.charCodeAt(0)}else n=10;if(n){if(s=LA[t.text],s==null||s>=n)throw new Ze("Invalid base-"+n+" digit "+t.text);for(var r;(r=LA[e.future().text])!=null&&r<n;)s*=n,s+=r,e.popToken()}return"\\@char{"+s+"}"});var L5=(e,t,n,s)=>{var r=e.consumeArg().tokens;if(r.length!==1)throw new Ze("\\newcommand's first argument must be a macro name");var i=r[0].text,o=e.isDefined(i);if(o&&!t)throw new Ze("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new Ze("\\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 l="",c=e.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Ze("Invalid number of arguments: "+l);a=parseInt(l),r=e.consumeArg().tokens}return o&&s||e.macros.set(i,{tokens:r,numArgs:a}),""};q("\\newcommand",e=>L5(e,!1,!0,!1));q("\\renewcommand",e=>L5(e,!0,!1,!1));q("\\providecommand",e=>L5(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),bu[n],Xs.math[n],Xs.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 DA={",":"\\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"},vie=new Set(["bin","rel"]);q("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in DA?t=DA[n]:(n.slice(0,4)==="\\not"||n in Xs.math&&vie.has(Xs.math[n].group))&&(t="\\dotsb"),t});var D5={")":!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 D5?"\\ldots\\,":"\\ldots"});q("\\dotsc",function(e){var t=e.future().text;return t in D5&&t!==","?"\\ldots\\,":"\\ldots"});q("\\cdots",function(e){var t=e.future().text;return t in D5?"\\@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 Ze("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 BB=at(kl["Main-Regular"][84][1]-.7*kl["Main-Regular"][65][1]);q("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+BB+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");q("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+BB+"}{\\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 PB=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 l=h=>f=>{e&&(f.macros.set("|",o),r.length&&f.macros.set("\\|",a));var m=h;if(!h&&r.length){var g=f.future();g.text==="|"&&(f.popToken(),m=!0)}return{tokens:m?r:s,numArgs:0}};t.macros.set("|",l(!1)),r.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,d=t.expandTokens([...i,...c,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};q("\\bra@ket",PB(!1));q("\\bra@set",PB(!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 $B={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class xie{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 bie(wie,n.macros),this.mode=s,this.stack=[]}feed(t){this.lexer=new RA(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 Wo("EOF",s.loc)),this.pushTokens(r),new Wo("",bo.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 Ze("Extra }",i)}else if(i.text==="EOF")throw new Ze("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 Ze("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 Ze("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 Ze("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 Ze("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 l=i[a];if(l.text==="#"){if(a===0)throw new Ze("Incomplete placeholder at end of macro body",l);if(l=i[--a],l.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(l.text))i.splice(a,2,...o[+l.text-1]);else throw new Ze("Not a valid argument number",l)}}}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 Wo(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 RA(r,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var d={tokens:l,numArgs:i};return d}return r}isDefined(t){return this.macros.has(t)||bu.hasOwnProperty(t)||Xs.math.hasOwnProperty(t)||Xs.text.hasOwnProperty(t)||$B.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:bu.hasOwnProperty(t)&&!bu[t].primitive}}var OA=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,S1=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Yx={"́":{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"}},BA={á:"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 zB=class FB{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 xie(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 Ze("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 Wo("}")),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(FB.endOfExpression.has(r.text)||n&&r.text===n||t&&bu[r.text]&&bu[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 Ze("only one infix operator per group",i.token);n=r,s=i.replaceWith}}if(n!==-1&&s){var o,a,l=t.slice(0,n),c=t.slice(n+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};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 Ze("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 Ze("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(s)throw new Ze("Double superscript",i);s=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(r)throw new Ze("Double subscript",i);r=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(s)throw new Ze("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),s={type:"ordgroup",mode:this.mode,body:l}}else if(S1[i.text]){var c=OA.test(i.text),d=[];for(d.push(new Wo(S1[i.text])),this.consume();;){var h=this.fetch().text;if(!S1[h]||OA.test(h)!==c)break;d.unshift(new Wo(S1[h])),this.consume()}var f=this.subparse(d);c?r={type:"ordgroup",mode:"math",body:f}:s={type:"ordgroup",mode:"math",body:f}}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=bu[r];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new Ze("Got function '"+r+"' with no arguments"+(n?" as "+n:""),s);if(this.mode==="text"&&!i.allowedInText)throw new Ze("Can't use function '"+r+"' in text mode",s);if(this.mode==="math"&&i.allowedInMath===!1)throw new Ze("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=bu[t];if(a&&a.handler)return a.handler(o,n,s);throw new Ze("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],l=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&a==null||n.type==="sqrt"&&o===1&&i[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+t+"'",a,l);if(l)i.push(c);else if(c!=null)r.push(c);else throw new Ze("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 Ze("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new Ze("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(s);default:throw new Ze("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 Ze("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 Ze("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 Ze("Invalid size: '"+n.text+"'",n);var i={number:+(r[1]+r[2]),unit:r[3]};if(!WO(i))throw new Ze("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),l=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:bo.range(s,l),body:a,semisimple:r==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&r[0]==="\\"&&!$B.hasOwnProperty(r)){if(this.settings.throwOnError)throw new Ze("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:bo.range(r,a),text:"---"}),n-=2):(t.splice(s,2,{type:"textord",mode:"text",loc:bo.range(r,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(s,2,{type:"textord",mode:"text",loc:bo.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 Ze(`\\verb assertion failed --
                    please report what input caused this bug`);return s=s.slice(1,-1),{type:"verb",mode:"text",body:s,star:r}}BA.hasOwnProperty(n[0])&&!Xs[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=BA[n[0]]+n.slice(1));var i=gie.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(Xs[this.mode][n]){this.settings.strict&&this.mode==="math"&&Uk.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=Xs[this.mode][n].group,l=bo.range(t),c;Bre(a)?c={type:"atom",mode:this.mode,family:a,loc:l,text:n}:c={type:a,mode:this.mode,loc:l,text:n},o=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(VO(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:bo.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(!Yx[h])throw new Ze("Unknown accent ' "+h+"'",t);var f=Yx[h][this.mode]||Yx[h].text;if(!f)throw new Ze("Accent "+h+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:bo.range(t),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}};zB.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var O5=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var s=new zB(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 Ze("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:s.subparse([new Wo("\\df@tag")])}]}return r},B5=function(t,n,s){n.textContent="";var r=bv(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."),B5=function(){throw new Ze("KaTeX doesn't work in quirks mode.")});var qB=function(t,n){var s=bv(t,n).toMarkup();return s},HB=function(t,n){var s=new _5(n);return O5(t,s)},UB=function(t,n,s){if(s.throwOnError||!(t instanceof Ze))throw t;var r=Ge(["katex-error"],[new Yo(n)]);return r.setAttribute("title",t.toString()),r.setAttribute("style","color:"+s.errorColor),r},bv=function(t,n){var s=new _5(n);try{var r=O5(t,s);return Mre(r,t,s)}catch(i){return UB(i,t,s)}},VB=function(t,n){var s=new _5(n);try{var r=O5(t,s);return Nre(r,t,s)}catch(i){return UB(i,t,s)}},WB="0.16.47",GB={Span:km,Anchor:ov,SymbolNode:Yo,SvgNode:Cc,PathNode:Uu,LineNode:Hk},i3={version:WB,render:B5,renderToString:qB,ParseError:Ze,SETTINGS_SCHEMA:Lb,__parse:HB,__renderToDomTree:bv,__renderToHTMLTree:VB,__setFontMetrics:QO,__defineSymbol:S,__defineFunction:Tt,__defineMacro:q,__domTree:GB};const QFe=Object.freeze(Object.defineProperty({__proto__:null,ParseError:Ze,SETTINGS_SCHEMA:Lb,__defineFunction:Tt,__defineMacro:q,__defineSymbol:S,__domTree:GB,__parse:HB,__renderToDomTree:bv,__renderToHTMLTree:VB,__setFontMetrics:QO,default:i3,get render(){return B5},renderToString:qB,version:WB},Symbol.toStringTag,{value:"Module"})),_ie={};function PA(e){const t=this,n=e||_ie,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(Nse(n)),i.push(_se()),o.push(kse(n))}const $A=/[#.]/g;function kie(e,t){const n=e||"",s={};let r=0,i,o;for(;r<n.length;){$A.lastIndex=r;const a=$A.exec(n),l=n.slice(r,a?a.index:n.length);l&&(i?i==="#"?s.id=l:Array.isArray(s.className)?s.className.push(l):s.className=[l]:o=l,r+=l.length),a&&(i=a[0],r++)}return{type:"element",tagName:o||t||"div",properties:s,children:[]}}function KB(e,t,n){const s=n?Aie(n):void 0;function r(i,o,...a){let l;if(i==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=kie(i,t);const c=l.tagName.toLowerCase(),d=s?s.get(c):void 0;if(l.tagName=d||c,Sie(o))a.unshift(o);else for(const[h,f]of Object.entries(o))Tie(e,l.properties,h,f)}for(const c of a)o3(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return r}function Sie(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 Tie(e,t,n,s){const r=n5(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=o9(s):r.commaSeparated?i=t9(s):r.commaOrSpaceSeparated?i=o9(t9(s).join(" ")):i=zA(r,r.property,s):Array.isArray(s)?i=[...s]:i=r.property==="style"?Cie(s):String(s);if(Array.isArray(i)){const o=[];for(const a of i)o.push(zA(r,r.property,a));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function o3(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)o3(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?o3(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function zA(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Sp(n)===Sp(t)))return!0}return n}function Cie(e){const t=[];for(const[n,s]of Object.entries(e))t.push([n,s].join(": "));return t.join("; ")}function Aie(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Eie=["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"],Mie=KB(s5,"div"),Nie=KB(vm,"g",Eie),Qx={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Iie(e,t){return YB(e,{})||{type:"root",children:[]}}function YB(e,t){const n=jie(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function jie(e,t){switch(e.nodeType){case 1:return Oie(e,t);case 3:return Lie(e);case 8:return Die(e);case 9:return FA(e,t);case 10:return Rie();case 11:return FA(e,t);default:return}}function FA(e,t){return{type:"root",children:QB(e,t)}}function Rie(){return{type:"doctype"}}function Lie(e){return{type:"text",value:e.nodeValue||""}}function Die(e){return{type:"comment",value:e.nodeValue||""}}function Oie(e,t){const n=e.namespaceURI,s=n===Qx.svg?Nie:Mie,r=n===Qx.html?e.tagName.toLowerCase():e.tagName,i=n===Qx.html&&r==="template"?e.content:e,o=e.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=e.getAttribute(o[l])||"";return s(r,a,QB(i,t))}function QB(e,t){const n=e.childNodes,s=[];let r=-1;for(;++r<n.length;){const i=YB(n[r],t);i!==void 0&&s.push(i)}return s}new DOMParser;function Bie(e,t){const n=Pie(e);return Iie(n)}function Pie(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const qA=function(e,t,n){const s=yg(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]},kh=function(e){if(e==null)return Fie;if(typeof e=="string")return zie(e);if(typeof e=="object")return $ie(e);if(typeof e=="function")return P5(e);throw new Error("Expected function, string, or array as `test`")};function $ie(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=kh(e[n]);return P5(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function zie(e){return P5(t);function t(n){return n.tagName===e}}function P5(e){return t;function t(n,s,r){return!!(qie(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function Fie(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function qie(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const HA=/\n/g,UA=/[\t ]+/g,a3=kh("br"),VA=kh(Qie),Hie=kh("p"),WA=kh("tr"),Uie=kh(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Yie,Xie]),XB=kh(["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 Vie(e,t){const n=t||{},s="children"in e?e.children:[],r=XB(e),i=eP(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...ZB(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<s.length;)o.push(...JB(s[a],e,{whitespace:i,breakBefore:a?void 0:r,breakAfter:a<s.length-1?a3(s[a+1]):r}));const l=[];let c;for(a=-1;++a<o.length;){const d=o[a];typeof d=="number"?c!==void 0&&d>c&&(c=d):d&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(d))}return l.join("")}function JB(e,t,n){return e.type==="element"?Wie(e,t,n):e.type==="text"?n.whitespace==="normal"?ZB(e,n):Gie(e):[]}function Wie(e,t,n){const s=eP(e,n),r=e.children||[];let i=-1,o=[];if(Uie(e))return o;let a,l;for(a3(e)||WA(e)&&qA(t,e,WA)?l=`
`:Hie(e)?(a=2,l=2):XB(e)&&(a=1,l=1);++i<r.length;)o=o.concat(JB(r[i],e,{whitespace:s,breakBefore:i?void 0:a,breakAfter:i<r.length-1?a3(r[i+1]):l}));return VA(e)&&qA(t,e,VA)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function ZB(e,t){const n=String(e.value),s=[],r=[];let i=0;for(;i<=n.length;){HA.lastIndex=i;const l=HA.exec(n),c=l&&"index"in l?l.index:n.length;s.push(Kie(n.slice(i,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,c===n.length?t.breakAfter:!0)),i=c+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 Gie(e){return[String(e.value)]}function Kie(e,t,n){const s=[];let r=0,i;for(;r<e.length;){UA.lastIndex=r;const o=UA.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 eP(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 Yie(e){return!!(e.properties||{}).hidden}function Qie(e){return e.tagName==="td"||e.tagName==="th"}function Xie(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const Jie={},Zie=[];function GA(e){const t=e||Jie;return function(n,s){g5(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:Zie,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let d=l;if(!a&&!l&&!c)return;let h=i[i.length-1],f=r;if(r.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(f=h,h=i[i.length-2],d=!0),!h)return;const m=Vie(f,{whitespace:"pre"});let g;try{g=i3.renderToString(m,{...t,displayMode:d,throwOnError:!0})}catch(b){const w=b,v=w.name.toLowerCase();s.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:w,place:r.position,ruleId:v,source:"rehype-katex"});try{g=i3.renderToString(m,{...t,displayMode:d,strict:"ignore",throwOnError:!1})}catch{g=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(b)},children:[{type:"text",value:m}]}]}}typeof g=="string"&&(g=Bie(g).children);const y=h.children.indexOf(f);return h.children.splice(y,1,...g),yO})}}const tP=[{id:"abap",name:"ABAP",import:()=>K(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>K(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>K(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>K(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>K(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>K(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>K(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>K(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>K(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>K(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>K(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>K(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>K(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>K(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>K(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>K(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>K(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>K(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>K(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>K(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>K(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>K(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>K(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>K(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>K(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>K(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>K(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>K(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>K(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>K(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>K(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>K(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>K(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>K(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>K(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>K(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>K(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>K(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>K(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>K(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>K(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>K(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>K(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>K(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>K(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>K(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>K(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>K(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>K(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>K(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>K(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>K(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>K(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>K(()=>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:()=>K(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>K(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>K(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>K(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>K(()=>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:()=>K(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>K(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>K(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>K(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>K(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>K(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>K(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>K(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>K(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>K(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>K(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>K(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>K(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>K(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>K(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>K(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>K(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>K(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>K(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>K(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>K(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>K(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>K(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>K(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>K(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>K(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>K(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>K(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>K(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>K(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>K(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>K(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>K(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>K(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>K(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>K(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>K(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>K(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>K(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>K(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>K(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>K(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>K(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>K(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>K(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>K(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>K(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>K(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>K(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>K(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>K(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>K(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>K(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>K(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>K(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>K(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>K(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>K(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>K(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>K(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>K(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>K(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>K(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>K(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>K(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>K(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>K(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>K(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>K(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>K(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>K(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>K(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>K(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>K(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>K(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>K(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>K(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>K(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>K(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>K(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>K(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>K(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>K(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>K(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>K(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>K(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>K(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>K(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>K(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>K(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>K(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>K(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>K(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>K(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>K(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>K(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>K(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>K(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>K(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>K(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>K(()=>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:()=>K(()=>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:()=>K(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>K(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>K(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>K(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>K(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>K(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>K(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>K(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>K(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>K(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>K(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>K(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>K(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>K(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>K(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>K(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>K(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>K(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>K(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>K(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>K(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>K(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>K(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>K(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>K(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>K(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>K(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>K(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>K(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>K(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>K(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>K(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>K(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>K(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>K(()=>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:()=>K(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>K(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>K(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>K(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>K(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>K(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>K(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>K(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>K(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>K(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>K(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>K(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>K(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>K(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>K(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>K(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>K(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>K(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>K(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>K(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>K(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>K(()=>import("./zig-BVz_zdnA.js"),[])}],eoe=Object.fromEntries(tP.map(e=>[e.id,e.import])),toe=Object.fromEntries(tP.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),noe={...eoe,...toe},soe=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>K(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>K(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>K(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>K(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>K(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>K(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>K(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>K(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>K(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>K(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>K(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>K(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>K(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>K(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>K(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>K(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>K(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>K(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>K(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>K(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>K(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>K(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>K(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>K(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>K(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>K(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>K(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>K(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>K(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>K(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>K(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>K(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>K(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>K(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>K(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>K(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>K(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>K(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>K(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>K(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>K(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>K(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>K(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>K(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>K(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>K(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>K(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>K(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>K(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>K(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>K(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>K(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>K(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>K(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],roe=Object.fromEntries(soe.map(e=>[e.id,e.import]));let gc=class extends Error{constructor(t){super(t),this.name="ShikiError"}},$5=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function ioe(){return 2147483648}function ooe(){return typeof performance<"u"?performance.now():Date.now()}const aoe=(e,t)=>e+(t-e%t)%t;async function loe(e){let t,n;const s={};function r(m){n=m,s.HEAPU8=new Uint8Array(m),s.HEAPU32=new Uint32Array(m)}function i(m,g,y){s.HEAPU8.copyWithin(m,g,g+y)}function o(m){try{return t.grow(m-n.byteLength+65535>>>16),r(t.buffer),1}catch{}}function a(m){const g=s.HEAPU8.length;m=m>>>0;const y=ioe();if(m>y)return!1;for(let b=1;b<=4;b*=2){let w=g*(1+.2/b);w=Math.min(w,m+100663296);const v=Math.min(y,aoe(Math.max(m,w),65536));if(o(v))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(m,g,y=1024){const b=g+y;let w=g;for(;m[w]&&!(w>=b);)++w;if(w-g>16&&m.buffer&&l)return l.decode(m.subarray(g,w));let v="";for(;g<w;){let x=m[g++];if(!(x&128)){v+=String.fromCharCode(x);continue}const C=m[g++]&63;if((x&224)===192){v+=String.fromCharCode((x&31)<<6|C);continue}const A=m[g++]&63;if((x&240)===224?x=(x&15)<<12|C<<6|A:x=(x&7)<<18|C<<12|A<<6|m[g++]&63,x<65536)v+=String.fromCharCode(x);else{const T=x-65536;v+=String.fromCharCode(55296|T>>10,56320|T&1023)}}return v}function d(m,g){return m?c(s.HEAPU8,m,g):""}const h={emscripten_get_now:ooe,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function f(){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 f(),s}var coe=Object.defineProperty,uoe=(e,t,n)=>t in e?coe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dr=(e,t,n)=>(uoe(e,typeof t!="symbol"?t+"":t,n),n);let Xr=null;function doe(e){throw new $5(e.UTF8ToString(e.getLastOnigError()))}class wv{constructor(t){Dr(this,"utf16Length"),Dr(this,"utf8Length"),Dr(this,"utf16Value"),Dr(this,"utf8Value"),Dr(this,"utf16OffsetToUtf8"),Dr(this,"utf8OffsetToUtf16");const n=t.length,s=wv._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 l=0;for(let c=0;c<n;c++){const d=t.charCodeAt(c);let h=d,f=!1;if(d>=55296&&d<=56319&&c+1<n){const m=t.charCodeAt(c+1);m>=56320&&m<=57343&&(h=(d-55296<<10)+65536|m-56320,f=!0)}r&&(i[c]=l,f&&(i[c+1]=l),h<=127?o[l+0]=c:h<=2047?(o[l+0]=c,o[l+1]=c):h<=65535?(o[l+0]=c,o[l+1]=c,o[l+2]=c):(o[l+0]=c,o[l+1]=c,o[l+2]=c,o[l+3]=c)),h<=127?a[l++]=h:h<=2047?(a[l++]=192|(h&1984)>>>6,a[l++]=128|(h&63)>>>0):h<=65535?(a[l++]=224|(h&61440)>>>12,a[l++]=128|(h&4032)>>>6,a[l++]=128|(h&63)>>>0):(a[l++]=240|(h&1835008)>>>18,a[l++]=128|(h&258048)>>>12,a[l++]=128|(h&4032)>>>6,a[l++]=128|(h&63)>>>0),f&&c++}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 l=t.charCodeAt(s+1);l>=56320&&l<=57343&&(o=(i-55296<<10)+65536|l-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 ul=class{constructor(e){if(Dr(this,"id",++ul.LAST_ID),Dr(this,"_onigBinding"),Dr(this,"content"),Dr(this,"utf16Length"),Dr(this,"utf8Length"),Dr(this,"utf16OffsetToUtf8"),Dr(this,"utf8OffsetToUtf16"),Dr(this,"ptr"),!Xr)throw new $5("Must invoke loadWasm first.");this._onigBinding=Xr,this.content=e;const t=new wv(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!ul._sharedPtrInUse?(ul._sharedPtr||(ul._sharedPtr=Xr.omalloc(1e4)),ul._sharedPtrInUse=!0,Xr.HEAPU8.set(t.utf8Value,ul._sharedPtr),this.ptr=ul._sharedPtr):this.ptr=t.createString(Xr)}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===ul._sharedPtr?ul._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let xg=ul;Dr(xg,"LAST_ID",0);Dr(xg,"_sharedPtr",0);Dr(xg,"_sharedPtrInUse",!1);class hoe{constructor(t){if(Dr(this,"_onigBinding"),Dr(this,"_ptr"),!Xr)throw new $5("Must invoke loadWasm first.");const n=[],s=[];for(let a=0,l=t.length;a<l;a++){const c=new wv(t[a]);n[a]=c.createString(Xr),s[a]=c.utf8Length}const r=Xr.omalloc(4*t.length);Xr.HEAPU32.set(n,r/4);const i=Xr.omalloc(4*t.length);Xr.HEAPU32.set(s,i/4);const o=Xr.createOnigScanner(r,i,t.length);for(let a=0,l=t.length;a<l;a++)Xr.ofree(n[a]);Xr.ofree(i),Xr.ofree(r),o===0&&doe(Xr),this._onigBinding=Xr,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 xg(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 l=o/4;const c=a[l++],d=a[l++],h=[];for(let f=0;f<d;f++){const m=t.convertUtf8OffsetToUtf16(a[l++]),g=t.convertUtf8OffsetToUtf16(a[l++]);h[f]={start:m,end:g,length:g-m}}return{index:c,captureIndices:h}}}function foe(e){return typeof e.instantiator=="function"}function moe(e){return typeof e.default=="function"}function poe(e){return typeof e.data<"u"}function goe(e){return typeof Response<"u"&&e instanceof Response}function yoe(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 T1;function boe(e){if(T1)return T1;async function t(){Xr=await loe(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),foe(s)?s=await s.instantiator(n):moe(s)?s=await s.default(n):(poe(s)&&(s=s.data),goe(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await woe(s)(n):s=await voe(s)(n):yoe(s)?s=await Xx(s)(n):s instanceof WebAssembly.Module?s=await Xx(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await Xx(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return T1=t(),T1}function Xx(e){return t=>WebAssembly.instantiate(e,t)}function woe(e){return t=>WebAssembly.instantiateStreaming(e,t)}function voe(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let xoe;function _oe(){return xoe}async function nP(e){return e&&await boe(e),{createScanner(t){return new hoe(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new xg(t)}}}function koe(e){return z5(e)}function z5(e){return Array.isArray(e)?Soe(e):e instanceof RegExp?e:typeof e=="object"?Toe(e):e}function Soe(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=z5(e[n]);return t}function Toe(e){let t={};for(let n in e)t[n]=z5(e[n]);return t}function sP(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function rP(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?rP(e.substring(0,e.length-1)):e.substr(~t+1)}var Jx=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,C1=class{static hasCaptures(e){return e===null?!1:(Jx.lastIndex=0,Jx.test(e))}static replaceCaptures(e,t,n){return e.replace(Jx,(s,r,i,o)=>{let a=n[parseInt(r||i,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return s})}};function iP(e,t){return e<t?-1:e>t?1:0}function oP(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=iP(e[r],t[r]);if(i!==0)return i}return 0}return n-s}function KA(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 aP(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var lP=class{constructor(e){ge(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}},zb=class{constructor(e,t,n){ge(this,"_cachedMatchRoot",new lP(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Eoe(e),t)}static createFromParsedTheme(e,t){return Noe(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=>Coe(e.parent,r.parentScopes));return s?new cP(s.fontStyle,s.foreground,s.background):null}},Zx=class Iy{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new Iy(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new Iy(n,t[s]);return n}push(t){return new Iy(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 Coe(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&&!Aoe(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Aoe(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var cP=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Eoe(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 l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let h=o.settings.fontStyle.split(" ");for(let f=0,m=h.length;f<m;f++)switch(h[f]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof o.settings.foreground=="string"&&KA(o.settings.foreground)&&(c=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&KA(o.settings.background)&&(d=o.settings.background);for(let h=0,f=a.length;h<f;h++){let g=a[h].trim().split(" "),y=g[g.length-1],b=null;g.length>1&&(b=g.slice(0,g.length-1),b.reverse()),n[s++]=new Moe(y,b,r,l,c,d)}}return n}var Moe=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}},uc=(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))(uc||{});function Noe(e,t){e.sort((l,c)=>{let d=iP(l.scope,c.scope);return d!==0||(d=oP(l.parentScopes,c.parentScopes),d!==0)?d:l.index-c.index});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(s=l.foreground),l.background!==null&&(r=l.background)}let i=new Ioe(t),o=new cP(n,i.getId(s),i.getId(r)),a=new Roe(new l3(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let d=e[l];a.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new zb(i,o,a)}var Ioe=class{constructor(e){ge(this,"_isFrozen");ge(this,"_lastColorId");ge(this,"_id2color");ge(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)}},joe=Object.freeze([]),l3=class uP{constructor(t,n,s,r,i){ge(this,"scopeDepth");ge(this,"parentScopes");ge(this,"fontStyle");ge(this,"foreground");ge(this,"background");this.scopeDepth=t,this.parentScopes=n||joe,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new uP(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)}},Roe=class c3{constructor(t,n=[],s={}){ge(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(c3._cmpBySpecificity),n}insert(t,n,s,r,i,o){if(n===""){this._doInsertHere(t,s,r,i,o);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new c3(this._mainRule.clone(),l3.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(t+1,c,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 l=this._rulesWithParentScopes[o];if(oP(l.parentScopes,n)===0){l.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 l3(t,n,s,r,i))}},Zf=class ta{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=ta.getLanguageId(t),s=ta.getTokenType(t),r=ta.getFontStyle(t),i=ta.getForeground(t),o=ta.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 l=ta.getLanguageId(t),c=ta.getTokenType(t),d=ta.containsBalancedBrackets(t)?1:0,h=ta.getFontStyle(t),f=ta.getForeground(t),m=ta.getBackground(t);return n!==0&&(l=n),s!==8&&(c=s),r!==null&&(d=r?1:0),i!==-1&&(h=i),o!==0&&(f=o),a!==0&&(m=a),(l<<0|c<<8|d<<10|h<<11|f<<15|m<<24)>>>0}};function Fb(e,t){const n=[],s=Loe(e);let r=s.next();for(;r!==null;){let l=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let c=o();if(n.push({matcher:c,priority:l}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const l=i();return c=>!!l&&!l(c)}if(r==="("){r=s.next();const l=a();return r===")"&&(r=s.next()),l}if(YA(r)){const l=[];do l.push(r),r=s.next();while(YA(r));return c=>t(l,c)}return null}function o(){const l=[];let c=i();for(;c;)l.push(c),c=i();return d=>l.every(h=>h(d))}function a(){const l=[];let c=o();for(;c&&(l.push(c),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");c=o()}return d=>l.some(h=>h(d))}}function YA(e){return!!e&&!!e.match(/[\w\.:]+/)}function Loe(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 dP(e){typeof e.dispose=="function"&&e.dispose()}var Mp=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Doe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ooe=class{constructor(){ge(this,"_references",[]);ge(this,"_seenReferenceKeys",new Set);ge(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))}},Boe=class{constructor(e,t){ge(this,"seenFullScopeRequests",new Set);ge(this,"seenPartialScopeRequests",new Set);ge(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Mp(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Ooe;for(const n of e)Poe(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Mp){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 Poe(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 Mp?jy({baseGrammar:i,selfGrammar:r},s):u3(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 Mp(a))}function u3(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];qb([s],t,n)}}function jy(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&qb(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&qb(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function qb(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?sP({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&qb(s.patterns,{...t,repository:r},n);const i=s.include;if(!i)continue;const o=hP(i);switch(o.kind){case 0:jy({...t,selfGrammar:t.baseGrammar},n);break;case 1:jy(t,n);break;case 2:u3(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 l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:r};o.kind===4?u3(o.ruleName,l,n):jy(l,n)}else o.kind===4?n.add(new Doe(o.scopeName,o.ruleName)):n.add(new Mp(o.scopeName));break}}}var $oe=class{constructor(){ge(this,"kind",0)}},zoe=class{constructor(){ge(this,"kind",1)}},Foe=class{constructor(e){ge(this,"kind",2);this.ruleName=e}},qoe=class{constructor(e){ge(this,"kind",3);this.scopeName=e}},Hoe=class{constructor(e,t){ge(this,"kind",4);this.scopeName=e,this.ruleName=t}};function hP(e){if(e==="$base")return new $oe;if(e==="$self")return new zoe;const t=e.indexOf("#");if(t===-1)return new qoe(e);if(t===0)return new Foe(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new Hoe(n,s)}}var Uoe=/\\(\d+)/,QA=/\\(\d+)/g,Voe=-1,fP=-2;var _g=class{constructor(t,n,s,r){ge(this,"$location");ge(this,"id");ge(this,"_nameIsCapturing");ge(this,"_name");ge(this,"_contentNameIsCapturing");ge(this,"_contentName");this.$location=t,this.id=n,this._name=s||null,this._nameIsCapturing=C1.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=C1.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${rP(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:C1.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:C1.replaceCaptures(this._contentName,t,n)}},Woe=class extends _g{constructor(t,n,s,r,i){super(t,n,s,r);ge(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!")}},Goe=class extends _g{constructor(t,n,s,r,i){super(t,n,s,null);ge(this,"_match");ge(this,"captures");ge(this,"_cachedCompiledPatterns");this._match=new Np(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 Ip,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},XA=class extends _g{constructor(t,n,s,r,i){super(t,n,s,r);ge(this,"hasMissingPatterns");ge(this,"patterns");ge(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 Ip,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},d3=class extends _g{constructor(t,n,s,r,i,o,a,l,c,d){super(t,n,s,r);ge(this,"_begin");ge(this,"beginCaptures");ge(this,"_end");ge(this,"endHasBackReferences");ge(this,"endCaptures");ge(this,"applyEndPatternLast");ge(this,"hasMissingPatterns");ge(this,"patterns");ge(this,"_cachedCompiledPatterns");this._begin=new Np(i,this.id),this.beginCaptures=o,this._end=new Np(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!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 Ip;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}},Hb=class extends _g{constructor(t,n,s,r,i,o,a,l,c){super(t,n,s,r);ge(this,"_begin");ge(this,"beginCaptures");ge(this,"whileCaptures");ge(this,"_while");ge(this,"whileHasBackReferences");ge(this,"hasMissingPatterns");ge(this,"patterns");ge(this,"_cachedCompiledPatterns");ge(this,"_cachedCompiledWhilePatterns");this._begin=new Np(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Np(a,fP),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.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 Ip;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 Ip,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},mP=class Ai{static createCaptureRule(t,n,s,r,i){return t.registerRule(o=>new Woe(n,o,s,r,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new Goe(t.$vscodeTextmateLocation,t.id,t.name,t.match,Ai._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=sP({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new XA(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Ai._compilePatterns(i,n,s))}return t.while?new Hb(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Ai._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,Ai._compileCaptures(t.whileCaptures||t.captures,n,s),Ai._compilePatterns(t.patterns,n,s)):new d3(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Ai._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,Ai._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,Ai._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 l=0;t[o].patterns&&(l=Ai.getCompiledRuleId(t[o],n,s)),r[a]=Ai.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}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 l=-1;if(a.include){const c=hP(a.include);switch(c.kind){case 0:case 1:l=Ai.getCompiledRuleId(s[a.include],n,s);break;case 2:let d=s[c.ruleName];d&&(l=Ai.getCompiledRuleId(d,n,s));break;case 3:case 4:const h=c.scopeName,f=c.kind===4?c.ruleName:null,m=n.getExternalGrammar(h,s);if(m)if(f){let g=m.repository[f];g&&(l=Ai.getCompiledRuleId(g,n,m.repository))}else l=Ai.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else l=Ai.getCompiledRuleId(a,n,s);if(l!==-1){const c=n.getRule(l);let d=!1;if((c instanceof XA||c instanceof d3||c instanceof Hb)&&c.hasMissingPatterns&&c.patterns.length===0&&(d=!0),d)continue;r.push(l)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},Np=class pP{constructor(t,n){ge(this,"source");ge(this,"ruleId");ge(this,"hasAnchor");ge(this,"hasBackReferences");ge(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 c=t.charAt(a+1);c==="z"?(i.push(t.substring(r,a)),i.push("$(?!\\n)(?<!\\n)"),r=a+2):(c==="A"||c==="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=Uoe.test(this.source):this.hasBackReferences=!1}clone(){return new pP(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 QA.lastIndex=0,this.source.replace(QA,(r,i)=>aP(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,l;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&&(l=this.source.charAt(i+1),l==="A"?(t[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):l==="G"?(t[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(t[i+1]=l,n[i+1]=l,s[i+1]=l,r[i+1]=l),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}},Ip=class{constructor(){ge(this,"_items");ge(this,"_hasAnchors");ge(this,"_cached");ge(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 JA(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 JA(e,s,this._items.map(r=>r.ruleId))}},JA=class{constructor(e,t,n){ge(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}},e4=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ic,Koe=(ic=class{constructor(t,n){ge(this,"_defaultAttributes");ge(this,"_embeddedLanguagesMatcher");ge(this,"_getBasicScopeAttributes",new lP(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new e4(n,s)}));this._defaultAttributes=new e4(t,8),this._embeddedLanguagesMatcher=new Yoe(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?ic._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(ic.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!")}},ge(ic,"_NULL_SCOPE_METADATA",new e4(0,0)),ge(ic,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),ic),Yoe=class{constructor(e){ge(this,"values");ge(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>aP(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])}},ZA=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function gP(e,t,n,s,r,i,o,a){const l=t.content.length;let c=!1,d=-1;if(o){const m=Qoe(e,t,n,s,r,i);r=m.stack,s=m.linePos,n=m.isFirstLine,d=m.anchorPosition}const h=Date.now();for(;!c;){if(a!==0&&Date.now()-h>a)return new ZA(r,!0);f()}return new ZA(r,!1);function f(){const m=Xoe(e,t,n,s,r,d);if(!m){i.produce(r,l),c=!0;return}const g=m.captureIndices,y=m.matchedRuleId,b=g&&g.length>0?g[0].end>s:!1;if(y===Voe){const w=r.getRule(e);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),w0(e,t,n,r,i,w.endCaptures,g),i.produce(r,g[0].end);const v=r;if(r=r.parent,d=v.getAnchorPos(),!b&&v.getEnterPos()===s){r=v,i.produce(r,l),c=!0;return}}else{const w=e.getRule(y);i.produce(r,g[0].start);const v=r,x=w.getName(t.content,g),C=r.contentNameScopesList.pushAttributed(x,e);if(r=r.push(y,s,d,g[0].end===l,null,C,C),w instanceof d3){const A=w;w0(e,t,n,r,i,A.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const T=A.getContentName(t.content,g),_=C.pushAttributed(T,e);if(r=r.withContentNameScopesList(_),A.endHasBackReferences&&(r=r.withEndRule(A.getEndWithResolvedBackReferences(t.content,g))),!b&&v.hasSameRuleAs(r)){r=r.pop(),i.produce(r,l),c=!0;return}}else if(w instanceof Hb){const A=w;w0(e,t,n,r,i,A.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const T=A.getContentName(t.content,g),_=C.pushAttributed(T,e);if(r=r.withContentNameScopesList(_),A.whileHasBackReferences&&(r=r.withEndRule(A.getWhileWithResolvedBackReferences(t.content,g))),!b&&v.hasSameRuleAs(r)){r=r.pop(),i.produce(r,l),c=!0;return}}else if(w0(e,t,n,r,i,w.captures,g),i.produce(r,g[0].end),r=r.pop(),!b){r=r.safePop(),i.produce(r,l),c=!0;return}}g[0].end>s&&(s=g[0].end,n=!1)}}function Qoe(e,t,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const a=[];for(let l=r;l;l=l.pop()){const c=l.getRule(e);c instanceof Hb&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:d}=eae(l.rule,e,l.stack.endRule,n,s===o),h=c.findNextMatchSync(t,s,d);if(h){if(h.ruleId!==fP){r=l.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(l.stack,h.captureIndices[0].start),w0(e,t,n,l.stack,i,l.rule.whileCaptures,h.captureIndices),i.produce(l.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=l.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function Xoe(e,t,n,s,r,i){const o=Joe(e,t,n,s,r,i),a=e.getInjections();if(a.length===0)return o;const l=Zoe(a,e,t,n,s,r,i);if(!l)return o;if(!o)return l;const c=o.captureIndices[0].start,d=l.captureIndices[0].start;return d<c||l.priorityMatch&&d===c?l:o}function Joe(e,t,n,s,r,i){const o=r.getRule(e),{ruleScanner:a,findOptions:l}=yP(o,e,r.endRule,n,s===i),c=a.findNextMatchSync(t,s,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Zoe(e,t,n,s,r,i,o){let a=Number.MAX_VALUE,l=null,c,d=0;const h=i.contentNameScopesList.getScopeNames();for(let f=0,m=e.length;f<m;f++){const g=e[f];if(!g.matcher(h))continue;const y=t.getRule(g.ruleId),{ruleScanner:b,findOptions:w}=yP(y,t,null,s,r===o),v=b.findNextMatchSync(n,r,w);if(!v)continue;const x=v.captureIndices[0].start;if(!(x>=a)&&(a=x,l=v.captureIndices,c=v.ruleId,d=g.priority,a===r))break}return l?{priorityMatch:d===-1,captureIndices:l,matchedRuleId:c}:null}function yP(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function eae(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function w0(e,t,n,s,r,i,o){if(i.length===0)return;const a=t.content,l=Math.min(i.length,o.length),c=[],d=o[0].end;for(let h=0;h<l;h++){const f=i[h];if(f===null)continue;const m=o[h];if(m.length===0)continue;if(m.start>d)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)r.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?r.produceFromScopes(c[c.length-1].scopes,m.start):r.produce(s,m.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,o),b=s.contentNameScopesList.pushAttributed(y,e),w=f.getContentName(a,o),v=b.pushAttributed(w,e),x=s.push(f.retokenizeCapturedWithRuleId,m.start,-1,!1,null,b,v),C=e.createOnigString(a.substring(0,m.end));gP(e,C,n&&m.start===0,m.start,x,r,!1,0),dP(C);continue}const g=f.getName(a,o);if(g!==null){const b=(c.length>0?c[c.length-1].scopes:s.contentNameScopesList).pushAttributed(g,e);c.push(new tae(b,m.end))}}for(;c.length>0;)r.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var tae=class{constructor(e,t){ge(this,"scopes");ge(this,"endPos");this.scopes=e,this.endPos=t}};function nae(e,t,n,s,r,i,o,a){return new rae(e,t,n,s,r,i,o,a)}function eE(e,t,n,s,r){const i=Fb(t,Ub),o=mP.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 Ub(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(sae(t[r],s))return n=r+1,!0;return!1})}function sae(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 rae=class{constructor(e,t,n,s,r,i,o,a){ge(this,"_rootId");ge(this,"_lastRuleId");ge(this,"_ruleId2desc");ge(this,"_includedGrammars");ge(this,"_grammarRepository");ge(this,"_grammar");ge(this,"_injections");ge(this,"_basicScopeAttributesProvider");ge(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new Koe(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=tE(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const l of Object.keys(r)){const c=Fb(l,Ub);for(const d of c)this._tokenTypeMatchers.push({matcher:d.matcher,type:r[l]})}}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)eE(t,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const l=a.injectionSelector;l&&eE(t,l,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]=tE(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=mP.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!t||t===h3.NULL){r=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),h=Zf.set(0,c.languageId,c.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),f=this.getRule(this._rootId).getName(null,null);let m;f?m=Z0.createRootAndLookUpScopeName(f,h,this):m=Z0.createRoot("unknown",h),t=new h3(null,this._rootId,-1,-1,!1,null,m,m)}else r=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new oae(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=gP(this,i,r,0,t,a,!0,s);return dP(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function tE(e,t){return e=koe(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 Z0=class dl{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=Zx.push(r,i.scopeNames),s=new dl(s,r,i.encodedTokenAttributes);return s}static createRoot(t,n){return new dl(null,new Zx(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),i=new Zx(null,t),o=s.themeProvider.themeMatch(i),a=dl.mergeAttributes(n,r,o);return new dl(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return dl.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),Zf.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return dl._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const i of s)r=dl._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=dl.mergeAttributes(t.tokenAttributes,r,o);return new dl(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}},ca,h3=(ca=class{constructor(t,n,s,r,i,o,a,l){ge(this,"_stackElementBrand");ge(this,"_enterPos");ge(this,"_anchorPos");ge(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}equals(t){return t===null?!1:ca._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Z0.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(){ca._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,i,o,a){return new ca(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 ca(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=Z0.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new ca(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,Z0.fromExtension(s,n.contentNameScopesList))}},ge(ca,"NULL",new ca(null,0,0,0,!1,null,null,null)),ca),iae=class{constructor(e,t){ge(this,"balancedBracketScopes");ge(this,"unbalancedBracketScopes");ge(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Fb(n,Ub).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Fb(n,Ub).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}},oae=class{constructor(e,t,n,s){ge(this,"_emitBinaryTokens");ge(this,"_lineText");ge(this,"_tokens");ge(this,"_binaryTokens");ge(this,"_lastTokenEndIndex");ge(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=Zf.set(r,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=Zf.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}},aae=class{constructor(e,t){ge(this,"_grammars",new Map);ge(this,"_rawGrammars",new Map);ge(this,"_injectionGrammars",new Map);ge(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,nae(e,i,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},lae=class{constructor(t){ge(this,"_options");ge(this,"_syncRegistry");ge(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new aae(zb.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(zb.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 iae(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,r,i){const o=new Boe(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)}},f3=h3.NULL;const cae=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],uae=/["&'<>`]/g,dae=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,hae=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,fae=/[|\\{}()[\]^$+*?.]/g,nE=new WeakMap;function mae(e,t){if(e=e.replace(t.subset?pae(t.subset):uae,s),t.subset||t.escapeOnly)return e;return e.replace(dae,n).replace(hae,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 pae(e){let t=nE.get(e);return t||(t=gae(e),nE.set(e,t)),t}function gae(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(fae,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const yae=/[\dA-Fa-f]/;function bae(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!yae.test(String.fromCharCode(t))?s:s+";"}const wae=/\d/;function vae(e,t,n){const s="&#"+String(e);return n&&t&&!wae.test(String.fromCharCode(t))?s:s+";"}const xae=["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"],t4={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:"€"},_ae=["cent","copy","divide","gt","lt","not","para","times"],bP={}.hasOwnProperty,m3={};let A1;for(A1 in t4)bP.call(t4,A1)&&(m3[t4[A1]]=A1);const kae=/[^\dA-Za-z]/;function Sae(e,t,n,s){const r=String.fromCharCode(e);if(bP.call(m3,r)){const i=m3[r],o="&"+i;return n&&xae.includes(i)&&!_ae.includes(i)&&(!s||t&&t!==61&&kae.test(String.fromCharCode(t)))?o:o+";"}return""}function Tae(e,t,n){let s=bae(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=Sae(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=vae(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function Mf(e,t){return mae(e,Object.assign({format:Tae},t))}const Cae=/^>|^->|<!--|-->|--!>|<!-$/g,Aae=[">"],Eae=["<",">"];function Mae(e,t,n,s){return s.settings.bogusComments?"<?"+Mf(e.value,Object.assign({},s.settings.characterReferences,{subset:Aae}))+">":"<!--"+e.value.replace(Cae,r)+"-->";function r(i){return Mf(i,Object.assign({},s.settings.characterReferences,{subset:Eae}))}}function Nae(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const qr=vP(1),wP=vP(-1),Iae=[];function vP(e){return t;function t(n,s,r){const i=n?n.children:Iae;let o=(s||0)+e,a=i[o];if(!r)for(;a&&ev(a);)o+=e,a=i[o];return a}}const jae={}.hasOwnProperty;function xP(e){return t;function t(n,s,r){return jae.call(e,n.tagName)&&e[n.tagName](n,s,r)}}const F5=xP({body:Lae,caption:n4,colgroup:n4,dd:Pae,dt:Bae,head:n4,html:Rae,li:Oae,optgroup:$ae,option:zae,p:Dae,rp:sE,rt:sE,tbody:qae,td:rE,tfoot:Hae,th:rE,thead:Fae,tr:Uae});function n4(e,t,n){const s=qr(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&ev(s.value.charAt(0)))}function Rae(e,t,n){const s=qr(n,t);return!s||s.type!=="comment"}function Lae(e,t,n){const s=qr(n,t);return!s||s.type!=="comment"}function Dae(e,t,n){const s=qr(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 Oae(e,t,n){const s=qr(n,t);return!s||s.type==="element"&&s.tagName==="li"}function Bae(e,t,n){const s=qr(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function Pae(e,t,n){const s=qr(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function sE(e,t,n){const s=qr(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function $ae(e,t,n){const s=qr(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function zae(e,t,n){const s=qr(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function Fae(e,t,n){const s=qr(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function qae(e,t,n){const s=qr(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function Hae(e,t,n){return!qr(n,t)}function Uae(e,t,n){const s=qr(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function rE(e,t,n){const s=qr(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const Vae=xP({body:Kae,colgroup:Yae,head:Gae,html:Wae,tbody:Qae});function Wae(e){const t=qr(e,-1);return!t||t.type!=="comment"}function Gae(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 Kae(e){const t=qr(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&ev(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Yae(e,t,n){const s=wP(n,t),r=qr(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&F5(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function Qae(e,t,n){const s=wP(n,t),r=qr(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&F5(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const E1={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 Xae(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 l;r.space==="html"&&e.tagName==="svg"&&(s.schema=vm);const c=Jae(s,e.properties),d=s.all(r.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=r,d&&(o=!1),(c||!i||!Vae(e,t,n))&&(a.push("<",e.tagName,c?" "+c:""),o&&(r.space==="svg"||s.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!s.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(d),!o&&(!i||!F5(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function Jae(e,t){const n=[];let s=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const i=Zae(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 Zae(e,t,n){const s=n5(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 l=Mf(s.attribute,Object.assign({},e.settings.characterReferences,{subset:E1.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?OD:UD)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=Mf(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:E1.unquoted[r][i]}))),a!==n&&(e.settings.quoteSmart&&jb(n,o)>jb(n,e.alternative)&&(o=e.alternative),a=o+Mf(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?E1.single:E1.double)[r][i],attribute:!0}))+o),l+(a&&"="+a))}const ele=["<","&"];function _P(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Mf(e.value,Object.assign({},s.settings.characterReferences,{subset:ele}))}function tle(e,t,n,s){return s.settings.allowDangerousHtml?e.value:_P(e,t,n,s)}function nle(e,t,n,s){return s.all(e)}const sle=Jte("type",{invalid:rle,unknown:ile,handlers:{comment:Mae,doctype:Nae,element:Xae,raw:tle,root:nle,text:_P}});function rle(e){throw new Error("Expected node, not `"+e+"`")}function ile(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const ole={},ale={},lle=[];function cle(e,t){const n=ole,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:ule,all:dle,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||cae,characterReferences:n.characterReferences||ale,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?vm:s5,quote:s,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function ule(e,t,n){return sle(e,t,n,this)}function dle(e){const t=[],n=e&&e.children||lle;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function hle(e){return Array.isArray(e)?e:[e]}function vv(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 q5(e){return!e||["plaintext","txt","text","plain"].includes(e)}function kP(e){return e==="ansi"||q5(e)}function H5(e){return e==="none"}function SP(e){return H5(e)}function TP(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 fle(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 mle(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?fle(r,i):r})):e}async function CP(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function Vb(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 Ld(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function AP(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&uc.Italic&&(t["font-style"]="italic"),e.fontStyle&uc.Bold&&(t["font-weight"]="bold"),e.fontStyle&uc.Underline&&(t["text-decoration"]="underline")),t}function ple(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function gle(e){const t=vv(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 Qi extends Error{constructor(t){super(t),this.name="ShikiError"}}const EP=new WeakMap;function xv(e,t){EP.set(e,t)}function jp(e){return EP.get(e)}class Cm{constructor(...t){ge(this,"_stacks",{});ge(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 Cm(Object.fromEntries(hle(n).map(s=>[s,f3])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return iE(this._stacks[this.theme])}getScopes(t=this.theme){return iE(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function iE(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 yle(e,t){if(!(e instanceof Cm))throw new Qi("Invalid grammar state");return e.getInternalStack(t)}function ble(){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 Qi(`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 Qi(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);if(o.character<0||o.character>a.length)throw new Qi(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:r.posToIndex(o.line,o.character)}}};const r=gle(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));wle(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 mle(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 Qi(`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,f,m,g){const y=r[h];let b="",w=-1,v=-1;if(f===0&&(w=0),m===0&&(v=0),m===Number.POSITIVE_INFINITY&&(v=y.children.length),w===-1||v===-1)for(let C=0;C<y.children.length;C++)b+=MP(y.children[C]),w===-1&&b.length===f&&(w=C+1),v===-1&&b.length===m&&(v=C+1);if(w===-1)throw new Qi(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(v===-1)throw new Qi(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const x=y.children.slice(w,v);if(!g.alwaysWrap&&x.length===y.children.length)a(y,g,"line");else if(!g.alwaysWrap&&x.length===1&&x[0].type==="element")a(x[0],g,"token");else{const C={type:"element",tagName:"span",properties:{},children:x};a(C,g,"wrapper"),y.children.splice(w,x.length,C)}}function o(h,f){r[h]=a(r[h],f,"line")}function a(h,f,m){var b;const g=f.properties||{},y=f.transform||(w=>w);return h.tagName=f.tagName||"span",h.properties={...h.properties,...g,class:h.properties.class},(b=f.properties)!=null&&b.class&&TP(h,f.properties.class),h=y(h,m)||h,h}const l=[],c=s.decorations.sort((h,f)=>f.start.offset-h.start.offset);for(const h of c){const{start:f,end:m}=h;if(f.line===m.line)i(f.line,f.character,m.character,h);else if(f.line<m.line){i(f.line,f.character,Number.POSITIVE_INFINITY,h);for(let g=f.line+1;g<m.line;g++)l.unshift(()=>o(g,h));i(m.line,0,m.character,h)}}l.forEach(h=>h())}}}function wle(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Qi(`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,l=r.start.offset<n.end.offset&&n.end.offset<r.end.offset;if(i||o||a||l){if(o&&o||a&&l)continue;throw new Qi(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function MP(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(MP).join(""):""}const vle=[ble()];function Wb(e){return[...e.transformers||[],...vle]}var Dd=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],s4={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function xle(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 oE(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 _le(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)s4[r]&&t.push({type:"setDecoration",value:s4[r]});else if(r<=29){const i=s4[r-20];i&&t.push({type:"resetDecoration",value:i})}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Dd[r-30]}});else if(r===38){const[i,o]=oE(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:Dd[r-40]}});else if(r===48){const[i,o]=oE(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:Dd[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Dd[r-100+8]}})}return t}function kle(){let e=null,t=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=xle(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 l=_le(o.sequence);for(const c of l)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}i=o.position}while(i<s.length);return r}}}var Sle={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 Tle(e=Sle){function t(a){return e[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(){if(s)return s;s=[];for(let c=0;c<Dd.length;c++)s.push(t(Dd[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let d=0;d<6;d++)for(let h=0;h<6;h++)s.push(n([a[c],a[d],a[h]]));let l=8;for(let c=0;c<24;c++,l+=10)s.push(n([l,l,l]));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 Cle(e,t,n){const s=Vb(e,n),r=vv(t),i=Tle(Object.fromEntries(Dd.map(a=>{var l;return[a,(l=e.colors)==null?void 0:l[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=kle();return r.map(a=>o.parse(a[0]).map(l=>{let c,d;l.decorations.has("reverse")?(c=l.background?i.value(l.background):e.bg,d=l.foreground?i.value(l.foreground):e.fg):(c=l.foreground?i.value(l.foreground):e.fg,d=l.background?i.value(l.background):void 0),c=Ld(c,s),d=Ld(d,s),l.decorations.has("dim")&&(c=Ale(c));let h=uc.None;return l.decorations.has("bold")&&(h|=uc.Bold),l.decorations.has("italic")&&(h|=uc.Italic),l.decorations.has("underline")&&(h|=uc.Underline),{content:l.value,offset:a[1],color:c,bgColor:d,fontStyle:h}}))}function Ale(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 U5(e,t,n={}){const{lang:s="text",theme:r=e.getLoadedThemes()[0]}=n;if(q5(s)||H5(r))return vv(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(s==="ansi")return Cle(i,t,n);const a=e.getLanguage(s);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new gc(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new gc(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Mle(t,a,i,o,n)}function Ele(...e){if(e.length===2)return jp(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(q5(r)||H5(i))throw new gc("Plain language does not have grammar state");if(r==="ansi")throw new gc("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(r);return new Cm(Gb(n,l,o,a,s).stateStack,l.name,o.name)}function Mle(e,t,n,s,r){const i=Gb(e,t,n,s,r),o=new Cm(Gb(e,t,n,s,r).stateStack,t.name,n.name);return xv(i.tokens,o),i.tokens}function Gb(e,t,n,s,r){const i=Vb(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=r,l=vv(e);let c=r.grammarState?yle(r.grammarState,n.name)??f3:r.grammarContextCode!=null?Gb(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:f3,d=[];const h=[];for(let f=0,m=l.length;f<m;f++){const[g,y]=l[f];if(g===""){d=[],h.push([]);continue}if(o>0&&g.length>=o){d=[],h.push([{content:g,offset:y,color:"",fontStyle:0}]);continue}let b,w,v;r.includeExplanation&&(b=t.tokenizeLine(g,c),w=b.tokens,v=0);const x=t.tokenizeLine2(g,c,a),C=x.tokens.length/2;for(let A=0;A<C;A++){const T=x.tokens[2*A],_=A+1<C?x.tokens[2*A+2]:g.length;if(T===_)continue;const R=x.tokens[2*A+1],I=Ld(s[Zf.getForeground(R)],i),k=Zf.getFontStyle(R),j={content:g.substring(T,_),offset:y+T,color:I,fontStyle:k};if(r.includeExplanation){const N=[];if(r.includeExplanation!=="scopeName")for(const $ of n.settings){let F;switch(typeof $.scope){case"string":F=$.scope.split(/,/).map(B=>B.trim());break;case"object":F=$.scope;break;default:continue}N.push({settings:$,selectors:F.map(B=>B.split(/ /))})}j.explanation=[];let L=0;for(;T+L<_;){const $=w[v],F=g.substring($.startIndex,$.endIndex);L+=F.length,j.explanation.push({content:F,scopes:r.includeExplanation==="scopeName"?Nle($.scopes):Ile(N,$.scopes)}),v+=1}}d.push(j)}h.push(d),d=[],c=x.ruleStack}return{tokens:h,stateStack:c}}function Nle(e){return e.map(t=>({scopeName:t}))}function Ile(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const i=t[s];n[s]={scopeName:i,themeMatches:Rle(e,i,t.slice(0,s))}}return n}function aE(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function jle(e,t,n){if(!aE(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)aE(e[s],n[r])&&(s-=1),r-=1;return s===-1}function Rle(e,t,n){const s=[];for(const{selectors:r,settings:i}of e)for(const o of r)if(jle(o,t,n)){s.push(i);break}return s}function NP(e,t,n){const s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),r=s.map(l=>{const c=U5(e,t,{...n,theme:l.theme}),d=jp(c),h=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:d,theme:h}}),i=Lle(...r.map(l=>l.tokens)),o=i[0].map((l,c)=>l.map((d,h)=>{const f={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=d.explanation),i.forEach((m,g)=>{const{content:y,explanation:b,offset:w,...v}=m[c][h];f.variants[s[g].color]=v}),f})),a=r[0].state?new Cm(Object.fromEntries(r.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),r[0].state.lang):void 0;return a&&xv(o,a),o}function Lle(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(l=>l[s]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const o=r.map(()=>0),a=r.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){const d=a[c];d.content.length===l?(i[c].push(d),o[c]+=1,a[c]=r[c][o[c]]):(i[c].push({...d,content:d.content.slice(0,l)}),a[c]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}function Kb(e,t,n){let s,r,i,o,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:d="--shiki-"}=n,h=Object.entries(n.themes).filter(b=>b[1]).map(b=>({color:b[0],theme:b[1]})).sort((b,w)=>b.color===c?-1:w.color===c?1:0);if(h.length===0)throw new gc("`themes` option must not be empty");const f=NP(e,t,n);if(l=jp(f),c&&!h.find(b=>b.color===c))throw new gc(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=h.map(b=>e.getTheme(b.theme)),g=h.map(b=>b.color);i=f.map(b=>b.map(w=>Dle(w,g,d,c))),l&&xv(i,l);const y=h.map(b=>Vb(b.theme,n));r=h.map((b,w)=>(w===0&&c?"":`${d+b.color}:`)+(Ld(m[w].fg,y[w])||"inherit")).join(";"),s=h.map((b,w)=>(w===0&&c?"":`${d+b.color}-bg:`)+(Ld(m[w].bg,y[w])||"inherit")).join(";"),o=`shiki-themes ${m.map(b=>b.name).join(" ")}`,a=c?void 0:[r,s].join(";")}else if("theme"in n){const c=Vb(n.theme,n);i=U5(e,t,n);const d=e.getTheme(n.theme);s=Ld(d.bg,c),r=Ld(d.fg,c),o=d.name,l=jp(i)}else throw new gc("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:l}}function Dle(e,t,n,s){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>AP(e.variants[l])),o=new Set(i.flatMap(l=>Object.keys(l))),a={};return i.forEach((l,c)=>{for(const d of o){const h=l[d]||"inherit";if(c===0&&s)a[d]=h;else{const f=d==="color"?"":d==="background-color"?"-bg":`-${d}`,m=n+t[c]+(d==="color"?"":f);a[m]=h}}}),r.htmlStyle=a,r}function Yb(e,t,n,s={meta:{},options:n,codeToHast:(r,i)=>Yb(e,r,i),codeToTokens:(r,i)=>Kb(e,r,i)}){var m,g;let r=t;for(const y of Wb(n))r=((m=y.preprocess)==null?void 0:m.call(s,r,n))||r;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:d}=Kb(e,r,n);const{mergeWhitespaces:h=!0}=n;h===!0?i=Ble(i):h==="never"&&(i=Ple(i));const f={...s,get source(){return r}};for(const y of Wb(n))i=((g=y.tokens)==null?void 0:g.call(f,i))||i;return Ole(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},f,d)}function Ole(e,t,n,s=jp(e)){var g,y,b;const r=Wb(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t;let c={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...l!==!1&&l!=null?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([w])=>!w.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const h=[],f={...n,structure:a,addClassToHast:TP,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return d},get lines(){return h}};if(e.forEach((w,v)=>{var A,T;v&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let x={type:"element",tagName:"span",properties:{class:"line"},children:[]},C=0;for(const _ of w){let R={type:"element",tagName:"span",properties:{..._.htmlAttrs},children:[{type:"text",value:_.content}]};_.htmlStyle;const I=ple(_.htmlStyle||AP(_));I&&(R.properties.style=I);for(const k of r)R=((A=k==null?void 0:k.span)==null?void 0:A.call(f,R,v+1,C,x,_))||R;a==="inline"?o.children.push(R):a==="classic"&&x.children.push(R),C+=_.content.length}if(a==="classic"){for(const _ of r)x=((T=_==null?void 0:_.line)==null?void 0:T.call(f,x,v+1))||x;h.push(x),i.push(x)}}),a==="classic"){for(const w of r)d=((g=w==null?void 0:w.code)==null?void 0:g.call(f,d))||d;c.children.push(d);for(const w of r)c=((y=w==null?void 0:w.pre)==null?void 0:y.call(f,c))||c;o.children.push(c)}let m=o;for(const w of r)m=((b=w==null?void 0:w.root)==null?void 0:b.call(f,m))||m;return s&&xv(m,s),m}function Ble(e){return e.map(t=>{const n=[];let s="",r=0;return t.forEach((i,o)=>{const l=!(i.fontStyle&&i.fontStyle&uc.Underline);l&&i.content.match(/^\s+$/)&&t[o+1]?(r||(r=i.offset),s+=i.content):s?(l?n.push({...i,offset:r,content:s+i.content}):n.push({content:s,offset:r},i),r=0,s=""):n.push(i)}),n})}function Ple(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 $le(e,t,n){var i;const s={meta:{},options:n,codeToHast:(o,a)=>Yb(e,o,a),codeToTokens:(o,a)=>Kb(e,o,a)};let r=cle(Yb(e,t,n,s));for(const o of Wb(n))r=((i=o.postprocess)==null?void 0:i.call(s,r,n))||r;return r}const lE={light:"#333333",dark:"#bbbbbb"},cE={light:"#fffffe",dark:"#1e1e1e"},uE="__shiki_resolved";function V5(e){var a,l,c,d,h;if(e!=null&&e[uE])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 f=t.settings?t.settings.find(m=>!m.name&&!m.scope):void 0;(a=f==null?void 0:f.settings)!=null&&a.foreground&&(s=f.settings.foreground),(l=f==null?void 0:f.settings)!=null&&l.background&&(n=f.settings.background),!s&&((c=t==null?void 0:t.colors)!=null&&c["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"?lE.light:lE.dark),n||(n=t.type==="light"?cE.light:cE.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(f){var g;if(i.has(f))return i.get(f);r+=1;const m=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return(g=t.colorReplacements)!=null&&g[`#${m}`]?o(f):(i.set(f,m),m)}t.settings=t.settings.map(f=>{var b,w;const m=((b=f.settings)==null?void 0:b.foreground)&&!f.settings.foreground.startsWith("#"),g=((w=f.settings)==null?void 0:w.background)&&!f.settings.background.startsWith("#");if(!m&&!g)return f;const y={...f,settings:{...f.settings}};if(m){const v=o(f.settings.foreground);t.colorReplacements[v]=f.settings.foreground,y.settings.foreground=v}if(g){const v=o(f.settings.background);t.colorReplacements[v]=f.settings.background,y.settings.background=v}return y});for(const f of Object.keys(t.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((h=t.colors[f])!=null&&h.startsWith("#"))){const m=o(t.colors[f]);t.colorReplacements[m]=t.colors[f],t.colors[f]=m}return Object.defineProperty(t,uE,{enumerable:!1,writable:!1,value:!0}),t}async function IP(e){return Array.from(new Set((await Promise.all(e.filter(t=>!kP(t)).map(async t=>await CP(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function jP(e){return(await Promise.all(e.map(async n=>SP(n)?null:V5(await CP(n))))).filter(n=>!!n)}class zle extends lae{constructor(n,s,r,i={}){super(n);ge(this,"_resolvedThemes",new Map);ge(this,"_resolvedGrammars",new Map);ge(this,"_langMap",new Map);ge(this,"_langGraph",new Map);ge(this,"_textmateThemeCache",new WeakMap);ge(this,"_loadedThemesCache",null);ge(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=V5(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=zb.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 Qi(`Circular alias \`${Array.from(s).join(" -> ")} -> ${n}\``);s.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,l,c;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),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.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 l;return a&&((l=a.embeddedLangs)==null?void 0:l.some(c=>r.map(([d])=>d).includes(c)))}).filter(o=>!r.includes(o));throw new Qi(`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 Fle{constructor(t,n){ge(this,"_langs",new Map);ge(this,"_scopeToLang",new Map);ge(this,"_injections",new Map);ge(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 e0=0;function qle(e){e0+=1,e.warnings!==!1&&e0>=10&&e0%10===0&&console.warn(`[Shiki] ${e0} 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 Qi("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(V5),r=new Fle(e.engine,n),i=new zle(r,s,n,e.langAlias);let o;function a(v){b();const x=i.getGrammar(typeof v=="string"?v:v.name);if(!x)throw new Qi(`Language \`${v}\` not found, you may need to load it first`);return x}function l(v){if(v==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};b();const x=i.getTheme(v);if(!x)throw new Qi(`Theme \`${v}\` not found, you may need to load it first`);return x}function c(v){b();const x=l(v);o!==v&&(i.setTheme(x),o=v);const C=i.getColorMap();return{theme:x,colorMap:C}}function d(){return b(),i.getLoadedThemes()}function h(){return b(),i.getLoadedLanguages()}function f(...v){b(),i.loadLanguages(v.flat(1))}async function m(...v){return f(await IP(v))}function g(...v){b();for(const x of v.flat(1))i.loadTheme(x)}async function y(...v){return b(),g(await jP(v))}function b(){if(t)throw new Qi("Shiki instance has been disposed")}function w(){t||(t=!0,i.dispose(),e0-=1)}return{setTheme:c,getTheme:l,getLanguage:a,getLoadedThemes:d,getLoadedLanguages:h,loadLanguage:m,loadLanguageSync:f,loadTheme:y,loadThemeSync:g,dispose:w,[Symbol.dispose]:w}}async function Hle(e={}){e.loadWasm;const[t,n,s]=await Promise.all([jP(e.themes||[]),IP(e.langs||[]),e.engine||nP(e.loadWasm||_oe())]);return qle({...e,themes:t,langs:n,engine:s})}async function Ule(e={}){const t=await Hle(e);return{getLastGrammarState:(...n)=>Ele(t,...n),codeToTokensBase:(n,s)=>U5(t,n,s),codeToTokensWithThemes:(n,s)=>NP(t,n,s),codeToTokens:(n,s)=>Kb(t,n,s),codeToHast:(n,s)=>Yb(t,n,s),codeToHtml:(n,s)=>$le(t,n,s),...t,getInternalContext:()=>t}}function Vle(e,t,n){let s,r,i;{const a=e;s=a.langs,r=a.themes,i=a.engine}async function o(a){function l(m){if(typeof m=="string"){if(kP(m))return[];const g=s[m];if(!g)throw new gc(`Language \`${m}\` is not included in this bundle. You may want to load it from external source.`);return g}return m}function c(m){if(SP(m))return"none";if(typeof m=="string"){const g=r[m];if(!g)throw new gc(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return g}return m}const d=(a.themes??[]).map(m=>c(m)),h=(a.langs??[]).map(m=>l(m)),f=await Ule({engine:a.engine??i(),...a,themes:d,langs:h});return{...f,loadLanguage(...m){return f.loadLanguage(...m.map(l))},loadTheme(...m){return f.loadTheme(...m.map(c))}}}return o}const Wle=Vle({langs:noe,themes:roe,engine:()=>nP(K(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Gle=["github-light-default","github-dark-default"];let M1=null,p3=null;const g3=new Set,r4=new Map,dE=new Set,Kle=128,v0=new Map;function RP(e,t,n){return`${t}\0${n}\0${e}`}function Yle(e,t){if(v0.size>=Kle){const n=v0.keys().next().value;n!==void 0&&v0.delete(n)}v0.set(e,t)}function Qle(e,t,n){return v0.get(RP(e,t,n))??null}function Xle(){return M1||(M1=Wle({langs:[],themes:Gle}).then(e=>(p3=e,e)).catch(e=>{throw M1=null,e})),M1}async function Jle(e){const t=await Xle();if(g3.has(e))return t;if(dE.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=r4.get(e);return n||(n=t.loadLanguage(e).then(()=>{g3.add(e)}).catch(s=>{throw dE.add(e),s}).finally(()=>{r4.delete(e)}),r4.set(e,n)),await n,t}const Zle=1e5,ece=2e4;function tce(e){if(e.length>Zle)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>ece)return!0;t=s+1}return!1}function hE(e,t,n,s=!0){if(p3&&g3.has(t))try{const r=p3.codeToHtml(e,{lang:t,theme:n});return s&&Yle(RP(e,t,n),r),r}catch(r){return console.warn("[web-shell] sync highlight failed for lang=%s",t,r),null}return null}const nce="_tableShell_1dzbi_1",sce="_densityCompact_1dzbi_11",rce="_densityStandard_1dzbi_21",ice="_densityComfortable_1dzbi_29",oce="_toolbar_1dzbi_37",ace="_summary_1dzbi_48",lce="_hint_1dzbi_53",cce="_selection_1dzbi_57",uce="_copyButton_1dzbi_62",dce="_secondaryButton_1dzbi_63",hce="_primaryButton_1dzbi_64",fce="_copyCheck_1dzbi_73",mce="_scroller_1dzbi_97",pce="_table_1dzbi_1",gce="_headerCell_1dzbi_119",yce="_cell_1dzbi_120",bce="_frozenHeaderCell_1dzbi_143",wce="_headerControls_1dzbi_148",vce="_headerButton_1dzbi_154",xce="_filterTrigger_1dzbi_171",_ce="_headerText_1dzbi_175",kce="_sortIcon_1dzbi_182",Sce="_activeHeaderCell_1dzbi_198",Tce="_reorderHandle_1dzbi_202",Cce="_reorderHandleVisible_1dzbi_225",Ace="_resizeHandle_1dzbi_245",Ece="_filterTriggerActive_1dzbi_264",Mce="_filterMenu_1dzbi_269",Nce="_columnContextMenu_1dzbi_285",Ice="_columnContextMenuAction_1dzbi_298",jce="_filterMenuTitle_1dzbi_316",Rce="_filterMenuSection_1dzbi_326",Lce="_filterMenuAction_1dzbi_334",Dce="_activeAction_1dzbi_347",Oce="_filterSearch_1dzbi_356",Bce="_conditionInput_1dzbi_357",Pce="_conditionSelect_1dzbi_358",$ce="_filterOptionList_1dzbi_374",zce="_filterOption_1dzbi_374",Fce="_optionLabel_1dzbi_400",qce="_optionCount_1dzbi_408",Hce="_optionLimitHint_1dzbi_414",Uce="_conditionTitle_1dzbi_420",Vce="_conditionInputs_1dzbi_425",Wce="_filterFooter_1dzbi_430",Gce="_footerSpacer_1dzbi_437",Kce="_cellContent_1dzbi_455",Yce="_detailValueContent_1dzbi_456",Qce="_cellText_1dzbi_462",Xce="_detailValueText_1dzbi_463",Jce="_cellContentCollapsed_1dzbi_469",Zce="_detailValueCollapsed_1dzbi_470",eue="_dragging_1dzbi_477",tue="_evenRow_1dzbi_481",nue="_selectedCell_1dzbi_489",sue="_actionHeaderCell_1dzbi_496",rue="_actionCell_1dzbi_497",iue="_stickyActionHeaderCell_1dzbi_505",oue="_stickyActionCell_1dzbi_506",aue="_frozenCell_1dzbi_522",lue="_hasFrozenColumn_1dzbi_528",cue="_rowDetailButton_1dzbi_575",uue="_detailRow_1dzbi_590",due="_detailCell_1dzbi_594",hue="_detailPanel_1dzbi_601",fue="_detailTitle_1dzbi_607",mue="_detailItem_1dzbi_612",pue="_detailLabel_1dzbi_619",gue="_detailValue_1dzbi_456",yue="_emptyValue_1dzbi_634",bue="_emptyState_1dzbi_639",Je={tableShell:nce,densityCompact:sce,densityStandard:rce,densityComfortable:ice,toolbar:oce,summary:ace,hint:lce,selection:cce,copyButton:uce,secondaryButton:dce,primaryButton:hce,copyCheck:fce,scroller:mce,table:pce,headerCell:gce,cell:yce,frozenHeaderCell:bce,headerControls:wce,headerButton:vce,filterTrigger:xce,headerText:_ce,sortIcon:kce,activeHeaderCell:Sce,reorderHandle:Tce,reorderHandleVisible:Cce,resizeHandle:Ace,filterTriggerActive:Ece,filterMenu:Mce,columnContextMenu:Nce,columnContextMenuAction:Ice,filterMenuTitle:jce,filterMenuSection:Rce,filterMenuAction:Lce,activeAction:Dce,filterSearch:Oce,conditionInput:Bce,conditionSelect:Pce,filterOptionList:$ce,filterOption:zce,optionLabel:Fce,optionCount:qce,optionLimitHint:Hce,conditionTitle:Uce,conditionInputs:Vce,filterFooter:Wce,footerSpacer:Gce,cellContent:Kce,detailValueContent:Yce,cellText:Qce,detailValueText:Xce,cellContentCollapsed:Jce,detailValueCollapsed:Zce,dragging:eue,evenRow:tue,selectedCell:nue,actionHeaderCell:sue,actionCell:rue,stickyActionHeaderCell:iue,stickyActionCell:oue,frozenCell:aue,hasFrozenColumn:lue,rowDetailButton:cue,detailRow:uue,detailCell:due,detailPanel:hue,detailTitle:fue,detailItem:mue,detailLabel:pue,detailValue:gue,emptyValue:yue,emptyState:bue},wue={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"},vue={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"},xue=500,_ue=50,Du=160,LP=80,DP=640,fE=16,OP="application/x-qwen-web-shell-table-column",kue=60,Sue=3,i4=["standard","compact","comfortable"],Tue={width:Du,minWidth:Du,maxWidth:Du},Cue={width:"auto"};function mE(e){return Math.min(DP,Math.max(LP,e))}const Aue='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Eue(e){return Array.from(e.querySelectorAll(Aue)).filter(t=>!t.hasAttribute("hidden"))}function pE(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function Mue(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function Od(e,t){return p.isValidElement(e)&&e.type===t}function Nue(e){return e.replace(/\s+/g," ").trim()}function o4(e){return e.length>kue||e.split(/\r\n|\r|\n/).length>Sue}function Iue(e){const t=i4.indexOf(e);return i4[(t+1)%i4.length]??"standard"}function jue(e){switch(e){case"compact":return Je.densityCompact;case"comfortable":return Je.densityComfortable;case"standard":default:return Je.densityStandard}}function y3(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(y3).join(""):p.isValidElement(e)?e.type==="img"?e.props.alt??"":y3(e.props.children):""}function Rue(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function BP(e,t){const n=p.Children.toArray(e.props.children).filter(s=>Od(s,"td")||Od(s,"th"));return{key:t,cells:n.map((s,r)=>{var o;const i=y3(s.props.children);return{key:`${t}-${r}`,content:s.props.children,text:Nue(i),rawText:i,isHeader:s.type==="th",textAlign:(o=s.props.style)==null?void 0:o.textAlign}})}}function a4(e,t){return p.Children.toArray(e.props.children).filter(n=>Od(n,"tr")).map((n,s)=>BP(n,`${t}-${s}`))}function Lue(e,t){return{...e,cells:Array.from({length:t},(n,s)=>e.cells[s]??Rue(e.key,s))}}function Due(e,t){const n=p.Children.toArray(e),s=[],r=[],i=[];if(n.forEach((d,h)=>{Od(d,"thead")?s.push(...a4(d,`head-${h}`)):Od(d,"tbody")?r.push(...a4(d,`body-${h}`)):Od(d,"tfoot")?r.push(...a4(d,`foot-${h}`)):Od(d,"tr")&&i.push(BP(d,`row-${h}`))}),i.length>0){const[d,...h]=i;d!=null&&d.cells.some(f=>f.isHeader)?(s.push(d),r.push(...h)):r.push(...i)}const o=[...s,...r],a=Math.max(0,...o.map(d=>d.cells.length)),l=s[0];return{headers:Array.from({length:a},(d,h)=>{const f=l==null?void 0:l.cells[h];if(f)return f;const m=t(h);return{key:`header-${h}`,content:m,text:m,rawText:m,isHeader:!0}}),rows:r.map(d=>Lue(d,a)),columnCount:a}}function Ou(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 n?i/100:i}function PP(e,t){const n=Ou(e),s=Ou(t);return n!==null&&s!==null&&n!==s?n-s:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function W5(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function G5(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 b3(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function w3(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function l4(e){return e.rawText||e.text}function gE(e,t,n){if((e[t]??Du)===n)return e;if(n===Du){const r={...e};return delete r[t],r}return{...e,[t]:n}}function yE(e,t,n){if(!e)return"";const{minRow:s,maxRow:r}=W5(e),i=G5(e,n);if(i.length===0)return"";const o=[];for(let a=s;a<=r;a++){const l=t[a];l&&o.push(i.map(c=>b3(w3(l.cells[c]))).join("	"))}return o.join(`
`)}function Oue(e,t,n){return n.length===0?"":[n.map(r=>b3(w3(e[r]))).join("	"),...t.map(r=>n.map(i=>b3(w3(r.cells[i]))).join("	"))].join(`
`)}function Bue(e,t){if(!e)return 0;const{minRow:n,maxRow:s}=W5(e),r=G5(e,t).length;return(s-n+1)*r}function bE(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 Pue(e,t,n,s){if(s.size===0)return bE(e,t,n);const r=e.filter(a=>!s.has(a)),i=bE(r,t,n);if(i===r)return e;let o=0;return e.map(a=>{if(s.has(a))return a;const l=i[o];return o+=1,l??a})}function wE(e){return Array.from({length:e},(t,n)=>n)}function vE(e){return Array.from(e.types).includes(OP)}function ep(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 $ue(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 zue(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Ou(e),s=Ou(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=Ou(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 Fue(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:$ue(e,t.textFilter)&&zue(e,t.numberFilter)}function xE(e,t,n){const s=Object.entries(t).map(([r,i])=>[Number(r),i]).filter(([r,i])=>r!==n&&ep(i));return s.length===0?e:e.filter(r=>s.every(([i,o])=>{var a;return Fue(((a=r.cells[i])==null?void 0:a.text)??"",o)}))}function que(e,t){return t?e.map((n,s)=>({row:n,index:s})).sort((n,s)=>{var o,a;const r=PP(((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 Hue(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)=>PP(r.value,i.value))}function Uue(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,Ou(i)!==null&&(s+=1))}),n>0&&s/n>=.7}function Vue(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function Wue(e,t){var s,r,i;const n={};if(e.selectedValues!==void 0&&!Vue(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();Ou(o)!==null&&(e.numberFilter.operator!=="between"||Ou(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return ep(n)?n:void 0}function Gue({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:s}=it();return u.jsxs("div",{className:Je.filterMenuSection,children:[u.jsx("button",{className:`${Je.filterMenuAction} ${(t==null?void 0:t.direction)==="asc"?Je.activeAction:""}`,type:"button",onClick:()=>n(e,"asc"),children:s("markdownTable.sort.asc")}),u.jsx("button",{className:`${Je.filterMenuAction} ${(t==null?void 0:t.direction)==="desc"?Je.activeAction:""}`,type:"button",onClick:()=>n(e,"desc"),children:s("markdownTable.sort.desc")}),u.jsx("button",{className:Je.filterMenuAction,type:"button",onClick:()=>n(e,null),children:s("markdownTable.sort.clear")})]})}function Kue({onHideColumn:e}){const{t}=it();return u.jsx("div",{className:Je.filterMenuSection,children:u.jsx("button",{className:Je.filterMenuAction,type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function Yue({columnIndex:e,columnName:t,search:n,searchInputRef:s,filteredOptions:r,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:l,onFilteredSelectionChange:c,onToggleValue:d}){const{t:h}=it();return u.jsxs("div",{className:Je.filterMenuSection,children:[u.jsx("input",{ref:s,className:Je.filterSearch,value:n,onChange:f=>l(f.currentTarget.value),placeholder:h("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":h("markdownTable.filter.searchAria",{column:t})}),u.jsxs("label",{className:Je.filterOption,children:[u.jsx("input",{type:"checkbox",name:`markdown-table-filter-all-${e}`,checked:a,onChange:f=>c(f.currentTarget.checked)}),u.jsx("span",{children:h("markdownTable.filter.selectVisible")}),u.jsx("span",{className:Je.optionCount,children:r.length})]}),u.jsxs("div",{className:Je.filterOptionList,children:[i.map((f,m)=>u.jsxs("label",{className:Je.filterOption,children:[u.jsx("input",{type:"checkbox",name:`markdown-table-filter-option-${e}-${m}`,checked:o.has(f.value),onChange:()=>d(f.value)}),u.jsx("span",{className:Je.optionLabel,children:f.label}),u.jsx("span",{className:Je.optionCount,children:f.count})]},f.value)),r.length>i.length&&u.jsx("div",{className:Je.optionLimitHint,children:h("markdownTable.filter.optionLimit",{count:i.length})}),r.length===0&&u.jsx("div",{className:Je.optionLimitHint,children:h("markdownTable.filter.noOptions")})]})]})}function Que({columnIndex:e,columnName:t,isNumeric:n,textOperator:s,textValue:r,numberOperator:i,numberValue:o,numberValueTo:a,onTextOperatorChange:l,onTextValueChange:c,onNumberOperatorChange:d,onNumberValueChange:h,onNumberValueToChange:f}){const{t:m}=it();return u.jsxs("div",{className:Je.filterMenuSection,children:[u.jsx("div",{className:Je.conditionTitle,children:m("markdownTable.filter.custom")}),n?u.jsxs(u.Fragment,{children:[u.jsx("select",{className:Je.conditionSelect,value:i,name:`markdown-table-number-operator-${e}`,onChange:g=>d(g.currentTarget.value),"aria-label":m("markdownTable.filter.numberAria",{column:t}),children:Object.entries(vue).map(([g,y])=>u.jsx("option",{value:g,children:m(y)},g))}),u.jsxs("div",{className:Je.conditionInputs,children:[u.jsx("input",{className:Je.conditionInput,value:o,onChange:g=>h(g.currentTarget.value),placeholder:m("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${e}`}),i==="between"&&u.jsx("input",{className:Je.conditionInput,value:a,onChange:g=>f(g.currentTarget.value),placeholder:m("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${e}`})]})]}):u.jsxs(u.Fragment,{children:[u.jsx("select",{className:Je.conditionSelect,value:s,name:`markdown-table-text-operator-${e}`,onChange:g=>l(g.currentTarget.value),"aria-label":m("markdownTable.filter.textAria",{column:t}),children:Object.entries(wue).map(([g,y])=>u.jsx("option",{value:g,children:m(y)},g))}),u.jsx("input",{className:Je.conditionInput,value:r,onChange:g=>c(g.currentTarget.value),placeholder:m("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${e}`})]})]})}function Xue({onClear:e,onClose:t,onApply:n}){const{t:s}=it();return u.jsxs("div",{className:Je.filterFooter,children:[u.jsx("button",{className:Je.secondaryButton,type:"button",onClick:e,children:s("markdownTable.filter.reset")}),u.jsx("span",{className:Je.footerSpacer}),u.jsx("button",{className:Je.secondaryButton,type:"button",onClick:t,children:s("markdownTable.filter.cancel")}),u.jsx("button",{className:Je.primaryButton,type:"button",onClick:n,children:s("markdownTable.filter.confirm")})]})}function Jue({id:e,columnName:t,columnIndex:n,filter:s,isNumeric:r,options:i,sort:o,style:a,menuRef:l,canHideColumn:c,onApply:d,onClose:h,onHideColumn:f,onSort:m}){var z,M,re,U,W;const g=p.useMemo(()=>i.map(J=>J.value),[i]),[y,b]=p.useState(""),[w,v]=p.useState(()=>new Set((s==null?void 0:s.selectedValues)??g)),[x,C]=p.useState(((z=s==null?void 0:s.textFilter)==null?void 0:z.operator)??"contains"),[A,T]=p.useState(((M=s==null?void 0:s.textFilter)==null?void 0:M.value)??""),[_,R]=p.useState(((re=s==null?void 0:s.numberFilter)==null?void 0:re.operator)??"gt"),[I,k]=p.useState(((U=s==null?void 0:s.numberFilter)==null?void 0:U.value)??""),[j,N]=p.useState(((W=s==null?void 0:s.numberFilter)==null?void 0:W.valueTo)??""),L=p.useRef(null);p.useEffect(()=>{var J;(J=L.current)==null||J.focus()},[]);const $=p.useMemo(()=>{const J=y.trim().toLowerCase();return J?i.filter(G=>G.label.toLowerCase().includes(J)):i},[i,y]),F=$.slice(0,500),B=$.length>0&&$.every(J=>w.has(J.value)),Q=J=>{v(G=>{const te=new Set(G);return $.forEach(H=>{J?te.add(H.value):te.delete(H.value)}),te})},Y=J=>{v(G=>{const te=new Set(G);return te.has(J)?te.delete(J):te.add(J),te})},ne=()=>{d(n,Wue({selectedValues:Array.from(w),textFilter:{operator:x,value:A},numberFilter:{operator:_,value:I,valueTo:j}},g))},P=()=>{d(n,void 0)},le=(o==null?void 0:o.columnIndex)===n?o:null;return u.jsxs("div",{ref:l,id:e,className:Je.filterMenu,style:a,role:"dialog","aria-labelledby":`${e}-title`,children:[u.jsx("div",{id:`${e}-title`,className:Je.filterMenuTitle,children:t}),u.jsx(Gue,{columnIndex:n,sortedThisColumn:le,onSort:m}),c&&u.jsx(Kue,{onHideColumn:()=>f(n)}),u.jsx(Yue,{columnIndex:n,columnName:t,search:y,searchInputRef:L,filteredOptions:$,visibleOptions:F,selectedValues:w,allFilteredSelected:B,onSearchChange:b,onFilteredSelectionChange:Q,onToggleValue:Y}),u.jsx(Que,{columnIndex:n,columnName:t,isNumeric:r,textOperator:x,textValue:A,numberOperator:_,numberValue:I,numberValueTo:j,onTextOperatorChange:C,onTextValueChange:T,onNumberOperatorChange:R,onNumberValueChange:k,onNumberValueToChange:N}),u.jsx(Xue,{onClear:P,onClose:h,onApply:ne})]})}function Zue({children:e,fallback:t,toolbarExtra:n}){const{t:s}=it(),r=p.useMemo(()=>Due(e,i=>s("markdownTable.column",{index:i+1})),[e,s]);return r.columnCount===0?u.jsx(u.Fragment,{children:t??u.jsx("table",{children:e})}):r.rows.length>xue||r.columnCount>_ue?u.jsx(u.Fragment,{children:t??u.jsx("table",{children:e})}):u.jsx(ede,{table:r,toolbarExtra:n})}function ede({table:e,toolbarExtra:t}){const{t:n}=it(),s=p.useId(),[r,i]=p.useState(null),[o,a]=p.useState({}),[l,c]=p.useState(null),[d,h]=p.useState(null),[f,m]=p.useState(null),[g,y]=p.useState(()=>new Set),[b,w]=p.useState({}),[v,x]=p.useState(()=>wE(e.columnCount)),[C,A]=p.useState(null),[T,_]=p.useState(!1),[R,I]=p.useState(null),[k,j]=p.useState(null),[N,L]=p.useState(!1),[$,F]=p.useState("standard"),[B,Q]=p.useState(!1),[Y,ne]=p.useState(!1),[P,le]=p.useState(!1),z=p.useRef(!1),M=p.useRef(null),re=p.useRef(null),U=p.useRef(0),W=p.useRef(0),J=p.useRef(!0),G=p.useRef(null),te=p.useRef(null),H=p.useRef(null),ie=p.useRef(null),fe=p.useRef(null),Ne=p.useRef(0),Ie=p.useRef(null),Ce=p.useRef(0),ve=p.useRef(0),ut=p.useRef(null),ae=p.useRef(null),Ct=p.useMemo(()=>`${e.columnCount}\0${e.headers.map(oe=>oe.text).join("\0")}`,[e.columnCount,e.headers]),Ke=p.useRef(Ct),on=p.useCallback(()=>{Ne.current&&cancelAnimationFrame(Ne.current),Ne.current=requestAnimationFrame(()=>{Ne.current=0;const oe=fe.current;oe!=null&&oe.isConnected&&oe.focus()})},[]),qt=p.useCallback(()=>{h(null),on()},[on]),gt=p.useCallback(()=>{U.current+=1,M.current&&(clearTimeout(M.current),M.current=null),ne(!1)},[]),St=p.useCallback(()=>{W.current+=1,re.current&&(clearTimeout(re.current),re.current=null),le(!1)},[]),ft=p.useCallback(()=>{Ce.current&&(cancelAnimationFrame(Ce.current),Ce.current=0);const oe=Ie.current;Ie.current=null,oe&&c(ue=>ue&&{...ue,focusRow:oe.rowIndex,focusCol:oe.columnIndex})},[]),de=p.useCallback(()=>{ft(),z.current=!1,Q(!1)},[ft]);p.useEffect(()=>{const oe=()=>{document.hidden&&de()};return window.addEventListener("mouseup",de),window.addEventListener("blur",de),document.addEventListener("visibilitychange",oe),()=>{window.removeEventListener("mouseup",de),window.removeEventListener("blur",de),document.removeEventListener("visibilitychange",oe),Ce.current&&cancelAnimationFrame(Ce.current),Ne.current&&cancelAnimationFrame(Ne.current)}},[de]),p.useEffect(()=>{Ke.current!==Ct&&(Ke.current=Ct,i(null),a({}),c(null),h(null),m(null),y(new Set),w({}),x(wE(e.columnCount)),A(null),_(!1),I(null),j(null),L(!1),F("standard"),gt(),St(),z.current=!1,ae.current=null,Q(!1))},[St,gt,e.columnCount,Ct]),p.useEffect(()=>{St()},[St,l]),p.useEffect(()=>(J.current=!0,()=>{J.current=!1,M.current&&(clearTimeout(M.current),M.current=null),re.current&&(clearTimeout(re.current),re.current=null)}),[]),p.useEffect(()=>{if(!d)return;const oe=Re=>{var bt,rn;const Nt=Re.target;!((bt=H.current)!=null&&bt.contains(Nt))&&!((rn=fe.current)!=null&&rn.contains(Nt))&&h(null)},ue=Re=>{var vs;if(Re.key==="Escape"){Re.preventDefault(),qt();return}if(Re.key!=="Tab")return;const Nt=H.current,bt=document.activeElement;if(!Nt||!(bt instanceof Node)||!Nt.contains(bt))return;const rn=Eue(Nt);if(rn.length===0)return;const Kn=bt instanceof HTMLElement?rn.indexOf(bt):-1,er=Re.shiftKey?Kn<=0?rn.length-1:Kn-1:Kn===-1||Kn===rn.length-1?0:Kn+1;Re.preventDefault(),(vs=rn[er])==null||vs.focus()},be=Re=>{var bt;const Nt=Re.target;Nt instanceof Node&&((bt=H.current)!=null&&bt.contains(Nt))||h(null)},lt=()=>h(null);return document.addEventListener("mousedown",oe),document.addEventListener("keydown",ue),document.addEventListener("scroll",be,!0),window.addEventListener("resize",lt),()=>{document.removeEventListener("mousedown",oe),document.removeEventListener("keydown",ue),document.removeEventListener("scroll",be,!0),window.removeEventListener("resize",lt)}},[qt,d]),p.useEffect(()=>{if(!f)return;const oe=lt=>{var Nt;const Re=lt.target;(Nt=ie.current)!=null&&Nt.contains(Re)||m(null)},ue=lt=>{lt.key==="Escape"&&(lt.preventDefault(),m(null))},be=()=>m(null);return document.addEventListener("mousedown",oe),document.addEventListener("keydown",ue),document.addEventListener("scroll",be,!0),window.addEventListener("resize",be),()=>{document.removeEventListener("mousedown",oe),document.removeEventListener("keydown",ue),document.removeEventListener("scroll",be,!0),window.removeEventListener("resize",be)}},[f]),p.useEffect(()=>{const oe=be=>{var Re,Nt;const lt=be.target;lt instanceof Node&&!((Re=G.current)!=null&&Re.contains(lt))&&!((Nt=ie.current)!=null&&Nt.contains(lt))&&A(null)},ue=be=>{be.defaultPrevented||d||f||be.key==="Escape"&&A(null)};return document.addEventListener("mousedown",oe),document.addEventListener("keydown",ue),()=>{document.removeEventListener("mousedown",oe),document.removeEventListener("keydown",ue)}},[f,d]);const _e=p.useMemo(()=>xE(e.rows,o),[o,e.rows]),Ue=p.useMemo(()=>que(_e,r),[_e,r]),Xe=p.useMemo(()=>{if(!d)return[];const oe=d.columnIndex;return Hue(xE(e.rows,o,oe),oe,n("markdownTable.blank"))},[o,d,n,e.rows]),yt=p.useMemo(()=>e.headers.map((oe,ue)=>Uue(e.rows,ue)),[e.headers,e.rows]),ye=p.useMemo(()=>v.filter(oe=>oe>=0&&oe<e.columnCount).filter(oe=>!g.has(oe)),[v,g,e.columnCount]),Kt=T?ye[0]:void 0;p.useEffect(()=>{gt()},[gt,ye,Ue]),p.useEffect(()=>{if(!R)return;const oe=()=>{const Re=ut.current;ut.current=null,ve.current&&(cancelAnimationFrame(ve.current),ve.current=0),Re!==null&&w(Nt=>gE(Nt,R.columnIndex,Re))},ue=Re=>{ut.current=mE(R.startWidth+Re.clientX-R.startX),!ve.current&&(ve.current=requestAnimationFrame(oe))},be=()=>{oe(),I(null)},lt=()=>{document.hidden&&be()};return window.addEventListener("mousemove",ue),window.addEventListener("mouseup",be),window.addEventListener("blur",be),document.addEventListener("visibilitychange",lt),()=>{window.removeEventListener("mousemove",ue),window.removeEventListener("mouseup",be),window.removeEventListener("blur",be),document.removeEventListener("visibilitychange",lt),ve.current&&(cancelAnimationFrame(ve.current),ve.current=0),ut.current=null}},[R]),p.useEffect(()=>{k&&!Ue.some(oe=>oe.key===k)&&j(null)},[k,Ue]);const Ee=(oe,ue)=>{c(null),a(be=>{const lt={...be};return ue&&ep(ue)?lt[oe]=ue:delete lt[oe],lt}),qt()},ct=(oe,ue)=>{c(null),A(oe),i(ue?{columnIndex:oe,direction:ue}:null)},qn=oe=>{c(null),A(oe),i(ue=>(ue==null?void 0:ue.columnIndex)!==oe?{columnIndex:oe,direction:"asc"}:ue.direction==="asc"?{columnIndex:oe,direction:"desc"}:null)},Me=(oe,ue)=>{c(null),A(ue),m(null),fe.current=oe.currentTarget;const be=oe.currentTarget.getBoundingClientRect(),lt=300,Re=430,Nt={columnIndex:ue,left:Math.max(6,Math.min(be.right-lt,window.innerWidth-lt-6)),top:window.innerHeight-be.bottom<Re?Math.max(8,be.top-Re-2):be.bottom+2};h(bt=>(bt==null?void 0:bt.columnIndex)===ue?null:Nt)},qe=oe=>{ye.length<=1||(c(null),A(ue=>ue===oe?null:ue),qt(),a(ue=>{const be={...ue};return delete be[oe],be}),i(ue=>(ue==null?void 0:ue.columnIndex)===oe?null:ue),y(ue=>{const be=new Set(ue);return be.add(oe),be}))},Fe=()=>{c(null),y(new Set)},Ht=()=>{_(oe=>!oe),m(null)},Mn=(oe,ue)=>{if(ue!==ye[0])return;oe.preventDefault(),c(null),A(ue),h(null),m({left:Math.max(6,Math.min(oe.clientX,window.innerWidth-220-6)),top:Math.max(6,Math.min(oe.clientY,window.innerHeight-72-6))})},Rn=()=>{F(oe=>Iue(oe))},Bn=oe=>{c(null),j(ue=>ue===oe?null:oe)},Hr=p.useMemo(()=>l?W5(l):null,[l]),Ut=p.useMemo(()=>new Set(G5(l,ye)),[l,ye]),vn=(oe,ue)=>{if(!Hr)return!1;const{minRow:be,maxRow:lt}=Hr;return oe>=be&&oe<=lt&&Ut.has(ue)},tn=(oe,ue)=>{const be=b[oe];if(be===void 0){const lt=$==="compact"?Cue:Tue;return ue?{...lt,...ue}:lt}return{width:be,minWidth:be,maxWidth:be,...ue}},Jt=(oe,ue)=>{oe.preventDefault(),oe.stopPropagation();const be=oe.currentTarget.closest("th"),lt=be==null?void 0:be.getBoundingClientRect().width;I({columnIndex:ue,startX:oe.clientX,startWidth:b[ue]??(lt?Math.round(lt):Du)})},Nn=(oe,ue)=>{if(oe.ctrlKey||oe.metaKey||oe.altKey||oe.shiftKey)return;let be=0;if(oe.key==="ArrowRight"?be=fE:oe.key==="ArrowLeft"&&(be=-fE),be===0)return;oe.preventDefault(),oe.stopPropagation();const lt=oe.currentTarget.closest("th"),Re=lt==null?void 0:lt.getBoundingClientRect().width;w(Nt=>{const bt=Nt[ue]??(Re?Math.round(Re):Du),rn=mE(bt+be);return gE(Nt,ue,rn)})},fn=(oe,ue)=>{oe.stopPropagation(),A(ue),ae.current=ue,oe.dataTransfer.effectAllowed="move",oe.dataTransfer.setData(OP,String(ue))},Pn=()=>{ae.current=null},Gn=oe=>{ae.current===null||!vE(oe.dataTransfer)||(oe.preventDefault(),oe.dataTransfer.dropEffect="move")},Hn=(oe,ue)=>{const be=ae.current;Pn(),!(be===null||!vE(oe.dataTransfer))&&(oe.preventDefault(),oe.stopPropagation(),c(null),A(be),x(lt=>Pue(lt,be,ue,g)))},qs=(oe,ue)=>{d!==null&&h(null),A(null),z.current=!0,c({anchorRow:oe,anchorCol:ue,focusRow:oe,focusCol:ue})},br=(oe,ue,be)=>{var lt;oe.button!==0||pE(oe.target)||(oe.preventDefault(),(lt=te.current)==null||lt.focus({preventScroll:!0}),qs(ue,be))},Dn=(oe,ue)=>{z.current&&(Q(!0),Ie.current={rowIndex:oe,columnIndex:ue},!Ce.current&&(Ce.current=requestAnimationFrame(()=>{Ce.current=0;const be=Ie.current;Ie.current=null,be&&c(lt=>lt&&{...lt,focusRow:be.rowIndex,focusCol:be.columnIndex})})))},ln=oe=>{var Nt;const ue=document.elementFromPoint(oe.clientX,oe.clientY),be=ue==null?void 0:ue.closest("[data-row-index][data-column-index]");if(!be||!((Nt=G.current)!=null&&Nt.contains(be)))return null;const lt=Number(be.dataset.rowIndex),Re=Number(be.dataset.columnIndex);return!Number.isInteger(lt)||!Number.isInteger(Re)?null:{rowIndex:lt,columnIndex:Re}},Es=(oe,ue,be)=>{oe.touches.length!==1||pE(oe.target)||qs(ue,be)},Te=oe=>{if(!z.current||oe.touches.length!==1)return;const ue=oe.touches[0];if(!ue)return;const be=ln(ue);be&&(oe.preventDefault(),Dn(be.rowIndex,be.columnIndex))},Ye=()=>{const oe=yE(l,Ue,ye);if(!oe||!navigator.clipboard)return;const ue=W.current;navigator.clipboard.writeText(oe).then(()=>{J.current&&W.current===ue&&(re.current&&clearTimeout(re.current),le(!0),re.current=setTimeout(()=>le(!1),2e3))}).catch(be=>console.warn("[web-shell] clipboard write failed:",be))},_t=()=>{const oe=Oue(e.headers,Ue,ye);if(!oe||!navigator.clipboard)return;const ue=U.current;navigator.clipboard.writeText(oe).then(()=>{J.current&&U.current===ue&&(M.current&&clearTimeout(M.current),ne(!0),M.current=setTimeout(()=>ne(!1),2e3))}).catch(be=>console.warn("[web-shell] clipboard write failed:",be))},Bt=oe=>{if(Mue())return;const ue=yE(l,Ue,ye);ue&&(oe.preventDefault(),oe.clipboardData.setData("text/plain",ue))},bn=Bue(l,ye),ws=Object.values(o).filter(ep).length,Zs=n(`markdownTable.density.${$}`),Ir=p.useMemo(()=>Ue.some(oe=>ye.some(ue=>{const be=oe.cells[ue];return be?o4(l4(be)):!1})),[ye,Ue]),Ur=Ue.length===e.rows.length?n("markdownTable.rows",{count:e.rows.length}):n("markdownTable.rowsFiltered",{visible:Ue.length,total:e.rows.length}),Bs=d===null?void 0:e.headers[d.columnIndex],we=Bs&&d?Bs.text||n("markdownTable.column",{index:d.columnIndex+1}):"",xe=(oe,ue)=>{const be=l4(oe),lt=o4(be);return u.jsx("div",{className:`${Je.cellContent} ${lt&&!ue?Je.cellContentCollapsed:""}`,title:lt&&!ue?be:void 0,children:u.jsx("div",{className:Je.cellText,children:oe.content})})},wt=(oe,ue)=>{const be=oe.text.length===0,lt=l4(oe),Re=o4(lt);return u.jsx("div",{className:`${Je.detailValueContent} ${Re&&!ue?Je.detailValueCollapsed:""} ${be?Je.emptyValue:""}`,title:Re&&!ue?lt:void 0,children:u.jsx("div",{className:Je.detailValueText,children:be?n("markdownTable.emptyValue"):oe.content})})};return u.jsxs("div",{ref:G,className:`${Je.tableShell} ${jue($)} ${T?Je.hasFrozenColumn:""} ${B?Je.dragging:""}`,children:[u.jsxs("div",{className:Je.toolbar,children:[u.jsx("span",{className:Je.summary,children:Ur}),u.jsx("span",{className:Je.hint,children:n("markdownTable.hint")}),u.jsx("button",{className:Je.copyButton,type:"button",onClick:_t,children:Y?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Je.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyVisible")}),g.size>0&&u.jsx("button",{className:Je.copyButton,type:"button",onClick:Fe,children:n("markdownTable.showHiddenColumns",{count:g.size})}),u.jsx("button",{className:Je.copyButton,type:"button",onClick:Rn,children:n("markdownTable.density",{density:Zs})}),Ir&&u.jsx("button",{className:Je.copyButton,type:"button",onClick:()=>L(oe=>!oe),children:n(N?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),ws>0&&u.jsx("span",{className:Je.selection,children:n("markdownTable.filtersActive",{count:ws})}),bn>0&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Je.selection,children:n("markdownTable.cellsSelected",{count:bn})}),u.jsx("button",{className:Je.copyButton,type:"button",onClick:Ye,children:P?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Je.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyTsv")})]}),t]}),u.jsxs("div",{ref:te,className:Je.scroller,tabIndex:0,onCopy:Bt,children:[u.jsxs("table",{className:Je.table,children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{className:`${Je.headerCell} ${Je.actionHeaderCell} ${T?Je.stickyActionHeaderCell:""}`,children:n("markdownTable.actions")}),ye.map(oe=>{const ue=e.headers[oe];if(!ue)return null;const be=(r==null?void 0:r.columnIndex)===oe,lt=ep(o[oe]),Re=(d==null?void 0:d.columnIndex)===oe,Nt=be?r.direction==="asc"?"↑":"↓":"↕",bt=ue.text||n("markdownTable.column",{index:oe+1}),rn=be?n(r.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:bt}):n("markdownTable.sortByColumn",{column:bt}),Kn=be?r.direction==="asc"?"ascending":"descending":"none",er=`${s}-filter-${oe}`,vs=ue.textAlign?{textAlign:ue.textAlign}:void 0,tr=Kt===oe,ni=C===oe;return u.jsxs("th",{className:`${Je.headerCell} ${tr?Je.frozenHeaderCell:""} ${ni?Je.activeHeaderCell:""}`,"aria-sort":Kn,onContextMenu:ns=>Mn(ns,oe),onDragOver:Gn,onDrop:ns=>Hn(ns,oe),style:tn(oe,vs),title:bt,children:[u.jsxs("div",{className:Je.headerControls,children:[u.jsxs("button",{className:Je.headerButton,type:"button",onClick:()=>qn(oe),"aria-label":rn,style:vs,children:[u.jsx("span",{className:Je.headerText,style:vs,children:ue.content}),u.jsx("span",{className:Je.sortIcon,"aria-hidden":"true",children:Nt})]}),u.jsx("button",{className:`${Je.reorderHandle} ${ni?Je.reorderHandleVisible:""}`,type:"button",draggable:!0,tabIndex:ni?0:-1,onDragStart:ns=>fn(ns,oe),onDragEnd:Pn,"aria-label":n("markdownTable.moveColumn",{column:bt}),children:"⋮⋮"}),u.jsx("button",{className:`${Je.filterTrigger} ${lt?Je.filterTriggerActive:""}`,type:"button",onClick:ns=>Me(ns,oe),"aria-label":n("markdownTable.filterColumn",{column:bt}),"aria-expanded":Re,"aria-controls":Re?er:void 0,children:"▾"})]}),u.jsx("button",{className:Je.resizeHandle,type:"button",onMouseDown:ns=>Jt(ns,oe),onKeyDown:ns=>Nn(ns,oe),role:"separator","aria-label":n("markdownTable.resizeColumn",{column:bt}),"aria-orientation":"vertical","aria-valuemin":LP,"aria-valuemax":DP,"aria-valuenow":b[oe]??Du})]},ue.key)})]})}),u.jsx("tbody",{children:Ue.map((oe,ue)=>{const be=k===oe.key,lt=`${s}-detail-${oe.key}`;return u.jsxs(p.Fragment,{children:[u.jsxs("tr",{className:ue%2===1?Je.evenRow:void 0,children:[u.jsx("td",{className:`${Je.cell} ${Je.actionCell} ${T?Je.stickyActionCell:""}`,children:u.jsx("button",{className:Je.rowDetailButton,type:"button",onClick:()=>Bn(oe.key),"aria-expanded":be,"aria-controls":lt,"aria-label":n(be?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:ue+1}),children:n("markdownTable.rowDetails")})}),ye.map(Re=>{const Nt=oe.cells[Re];if(!Nt)return null;const bt=Nt.textAlign?{textAlign:Nt.textAlign}:void 0,rn=Kt===Re;return u.jsx("td",{className:`${Je.cell} ${vn(ue,Re)?Je.selectedCell:""} ${rn?Je.frozenCell:""}`,style:tn(Re,bt),"data-row-index":ue,"data-column-index":Re,onMouseDown:Kn=>br(Kn,ue,Re),onMouseEnter:()=>Dn(ue,Re),onTouchStart:Kn=>Es(Kn,ue,Re),onTouchMove:Te,onTouchEnd:de,onTouchCancel:de,children:xe(Nt,N)},Nt.key)})]}),be&&u.jsx("tr",{id:lt,className:Je.detailRow,children:u.jsx("td",{className:Je.detailCell,colSpan:ye.length+1,children:u.jsxs("div",{className:Je.detailPanel,children:[u.jsx("div",{className:Je.detailTitle,children:n("markdownTable.detailsHeader")}),ye.map(Re=>{const Nt=e.headers[Re],bt=oe.cells[Re];return!Nt||!bt?null:u.jsxs("div",{className:Je.detailItem,children:[u.jsx("div",{className:Je.detailLabel,title:Nt.text,children:Nt.content}),u.jsx("div",{className:Je.detailValue,children:wt(bt,N)})]},`${oe.key}-detail-${Re}`)})]})})})]},oe.key)})})]}),Ue.length===0&&u.jsx("div",{className:Je.emptyState,children:e.rows.length===0?n("markdownTable.empty"):n("markdownTable.emptyFiltered")})]}),f&&ye.length>0&&u.jsx("div",{ref:ie,className:Je.columnContextMenu,style:{left:f.left,top:f.top},role:"menu",children:u.jsx("button",{className:Je.columnContextMenuAction,type:"button",role:"menuitem",onClick:Ht,children:n(T?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),d&&Bs&&u.jsx(Jue,{id:`${s}-filter-${d.columnIndex}`,columnName:we,columnIndex:d.columnIndex,filter:o[d.columnIndex],isNumeric:yt[d.columnIndex]??!1,options:Xe,sort:r,style:{left:d.left,top:d.top},menuRef:H,canHideColumn:ye.length>1,onApply:Ee,onClose:qt,onHideColumn:qe,onSort:ct},d.columnIndex)]})}const tde="_content_hisx1_1",nde="_inlineCode_hisx1_127",sde="_link_hisx1_139",rde="_tableWrapper_hisx1_149",ide="_table_hisx1_149",ode="_image_hisx1_179",ade="_codeBlock_hisx1_187",lde="_codeBlockHeader_hisx1_196",cde="_codeBlockLang_hisx1_205",ude="_codeBlockCopy_hisx1_213",dde="_codeBlockContent_hisx1_231",hde="_codeBlockPlain_hisx1_251",fde="_mermaidBlock_hisx1_269",mde="_mermaidInline_hisx1_281",pde="_mermaidLoading_hisx1_300",gde="_mermaidActions_hisx1_307",ls={content:tde,inlineCode:nde,link:sde,tableWrapper:rde,table:ide,image:ode,codeBlock:ade,codeBlockHeader:lde,codeBlockLang:cde,codeBlockCopy:ude,codeBlockContent:dde,codeBlockPlain:hde,mermaidBlock:fde,mermaidInline:mde,mermaidLoading:pde,mermaidActions:gde},yde=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"]),_E={"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 $P(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(_E,t)?_E[t]:t,s=yde.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const zP=/^(https?:|mailto:)/i,bde=/^data:image\/(png|jpeg|gif|webp);base64,/i;function wde(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:zP.test(t):!1}function Am(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||bde.test(t)?!0:zP.test(t):!1}let kE,vde=0;function xde({code:e}){const{t}=it(),n=Zw(),[s,r]=p.useState(null),[i,o]=p.useState(null),[a,l]=p.useState("diagram"),[c,d]=p.useState(!1),h=n==="light"?"default":"dark";p.useEffect(()=>{let m=!1;r(null),o(null);const g=setTimeout(()=>{K(()=>import("./mermaid.core-BV5o7nW5.js").then(y=>y.bm),[]).then(async y=>{if(m)return;const b=y.default;kE!==h&&(b.initialize({startOnLoad:!1,theme:h,securityLevel:"strict",suppressErrorRendering:!0}),kE=h);try{const w=`mermaid-${++vde}`,{svg:v}=await b.render(w,e.trim());m||r(v)}catch(w){m||o(w instanceof Error?w.message:"Mermaid render failed")}})},150);return()=>{m=!0,clearTimeout(g)}},[e,h]);const f=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?u.jsxs("div",{className:ls.codeBlock,children:[u.jsx("div",{className:ls.codeBlockHeader,children:u.jsx("span",{className:ls.codeBlockLang,children:t("mermaid.errorLabel")})}),u.jsx("pre",{className:`${ls.codeBlockContent} ${ls.codeBlockPlain}`,children:u.jsx("code",{children:e})})]}):u.jsxs("div",{className:ls.codeBlock,children:[u.jsxs("div",{className:ls.codeBlockHeader,children:[u.jsx("span",{className:ls.codeBlockLang,children:t("mermaid.label")}),u.jsxs("span",{className:ls.mermaidActions,children:[u.jsx("button",{className:ls.codeBlockCopy,onClick:()=>l(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),u.jsx("button",{className:ls.codeBlockCopy,onClick:f,children:t(c?"code.copied":"code.copy")})]})]}),a==="code"?u.jsx("pre",{className:`${ls.codeBlockContent} ${ls.codeBlockPlain}`,children:u.jsx("code",{children:e})}):s?u.jsx("div",{className:`${ls.mermaidBlock} ${ls.mermaidInline}`,dangerouslySetInnerHTML:{__html:s}}):u.jsx("div",{className:`${ls.mermaidBlock} ${ls.mermaidLoading} ${ls.mermaidInline}`,children:u.jsx("span",{children:t("mermaid.rendering")})})]})}function _de({className:e,children:t,isStreaming:n}){const{t:s}=it(),r=Zw(),[i,o]=p.useState(null),[a,l]=p.useState(!1),{label:c,lang:d,resolvedLang:h}=$P(FP(e)),f=String(t).replace(/\n$/,""),m=r==="light"?"github-light-default":"github-dark-default";p.useEffect(()=>{if(d==="mermaid"||h==="text"||tce(f)){o(null);return}const y=Qle(f,h,m);if(y!==null){o(y);return}const b=!n,w=hE(f,h,m,b);if(w!==null){o(w);return}o(null);let v=!1;return Jle(h).then(()=>{if(v)return;const x=hE(f,h,m,b);x!==null&&o(x)}).catch(x=>{v||(console.warn("[web-shell] highlight failed for lang=%s",h,x),o(null))}),()=>{v=!0}},[f,d,h,m,n]);const g=()=>{navigator.clipboard.writeText(f).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return d==="mermaid"&&!n?u.jsx(xde,{code:f}):u.jsxs("div",{className:ls.codeBlock,children:[u.jsxs("div",{className:ls.codeBlockHeader,children:[u.jsx("span",{className:ls.codeBlockLang,children:c}),u.jsx("button",{className:ls.codeBlockCopy,onClick:g,children:s(a?"code.copied":"code.copy")})]}),i!==null?u.jsx("div",{className:ls.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):u.jsx("pre",{className:`${ls.codeBlockContent} ${ls.codeBlockPlain}`,children:u.jsx("code",{children:f})})]})}function FP(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 kde({children:e}){return u.jsx("code",{className:ls.inlineCode,children:e})}function SE({children:e}){return u.jsx("div",{className:ls.tableWrapper,children:u.jsx("table",{className:ls.table,children:e})})}const qP=p.createContext(!1),HP=p.createContext(void 0);function Sde({className:e,children:t}){const n=p.useContext(qP);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?u.jsx(Tde,{className:e,isStreaming:n,children:t}):u.jsx(kde,{children:t})}function Tde({className:e,children:t,isStreaming:n}){var f;const s=p.useContext(HP),r=Zw(),{markdown:i}=Va(),o=String(t),a=o.replace(/\n$/,""),l=u.jsx(_de,{className:e,isStreaming:n,children:o}),c=FP(e),{resolvedLang:d}=$P(c);if(!!s&&!!e&&!!c)try{const m=(f=i==null?void 0:i.renderCodeBlock)==null?void 0:f.call(i,{language:c,resolvedLanguage:d,className:e,code:a,isStreaming:!!n,source:s,theme:r});if(m!=null&&typeof m!="boolean")return u.jsx(Tc,{fallback:l,label:`custom code block component render (lang=${c})`,resetKeys:[c,s,r,n?"streaming":"settled",a],children:m})}catch(m){console.error("[web-shell] custom code block renderer call failed (lang=%s):",c,m)}return l}function Cde({children:e}){return u.jsx(u.Fragment,{children:e})}const v3=/^qwen-session:\/\//i;function Ade(e){return v3.test(e.trim())?e:vO(e)}function Ede({href:e,children:t}){if(e&&v3.test(e.trim())){const s=e.trim().replace(v3,"");return u.jsx("a",{href:"#",role:"button",className:ls.link,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:s}))},children:t})}const n=wde(e)?e:void 0;return u.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:ls.link,children:t})}function Mde({src:e,alt:t}){const n=Am(e)?e:void 0;return u.jsx("img",{src:n,alt:t||"",className:ls.image})}function UP(e="basic",t=""){return{code:Sde,pre:Cde,a:Ede,img:Mde,table({children:n}){if(e==="advanced"){const s=u.jsx(SE,{children:n});return u.jsx(Tc,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:u.jsx(Zue,{fallback:s,children:n})})}return u.jsx(SE,{children:n})}}}const Nde=UP(),Em=p.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=Va(),a=n?i:void 0,l=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,c=s?"basic":r??o??"basic",d=p.useMemo(()=>c==="advanced"?UP("advanced",l):Nde,[c,l]),h=a==null?void 0:a.components,f=p.useMemo(()=>h?{...d,...h,...c==="advanced"?{table:d.table}:{}}:d,[d,c,h]);if(!t)return null;const m=a!=null&&a.remarkPlugins?[J9,PA,...a.remarkPlugins]:[J9,PA],g=a!=null&&a.rehypePlugins?[GA,...a.rehypePlugins]:[GA];return u.jsx("div",{className:n!=="thinking"?ls.content:void 0,"data-markdown-source":n,children:u.jsx(qP.Provider,{value:!!s,children:u.jsx(HP.Provider,{value:n,children:u.jsx(ute,{remarkPlugins:m,rehypePlugins:g,components:f,urlTransform:Ade,children:l})})})})});let x3=[],VP=[];(()=>{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?VP:x3).push(n=n+e[t])})();function Ide(e){if(e<768)return!1;for(let t=0,n=x3.length;;){let s=t+n>>1;if(e<x3[s])n=s;else if(e>=VP[s])t=s+1;else return!0;if(t==n)return!1}}function TE(e){return e>=127462&&e<=127487}const CE=8205;function jde(e,t,n=!0,s=!0){return(n?WP:Rde)(e,t,s)}function WP(e,t,n){if(t==e.length)return t;t&&GP(e.charCodeAt(t))&&KP(e.charCodeAt(t-1))&&t--;let s=c4(e,t);for(t+=AE(s);t<e.length;){let r=c4(e,t);if(s==CE||r==CE||n&&Ide(r))t+=AE(r),s=r;else if(TE(r)){let i=0,o=t-2;for(;o>=0&&TE(c4(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function Rde(e,t,n){for(;t>0;){let s=WP(e,t-2,n);if(s<t)return s;t--}return 0}function c4(e,t){let n=e.charCodeAt(t);if(!KP(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return GP(s)?(n-55296<<10)+(s-56320)+65536:n}function GP(e){return e>=56320&&e<57344}function KP(e){return e>=55296&&e<56320}function AE(e){return e<65536?1:2}class ts{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]=em(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),yl.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]=em(this,t,n);let s=[];return this.decompose(t,n,s,0),yl.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 tp(this),i=new tp(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 tp(this,t)}iterRange(t,n=this.length){return new YP(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 QP(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]?ts.empty:t.length<=32?new mr(t):yl.from(mr.split(t,[]))}}class mr extends ts{constructor(t,n=Lde(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 Dde(r,a,s,o);r=a+1,s++}}decompose(t,n,s,r){let i=t<=0&&n>=this.length?this:new mr(EE(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=s.pop(),a=Ry(i.text,o.text.slice(),0,i.length);if(a.length<=32)s.push(new mr(a,o.length+i.length));else{let l=a.length>>1;s.push(new mr(a.slice(0,l)),new mr(a.slice(l)))}}else s.push(i)}replace(t,n,s){if(!(s instanceof mr))return super.replace(t,n,s);[t,n]=em(this,t,n);let r=Ry(this.text,Ry(s.text,EE(this.text,0,t)),n),i=this.length+s.length-(n-t);return r.length<=32?new mr(r,i):yl.from(mr.split(r,[]),i)}sliceString(t,n=this.length,s=`
`){[t,n]=em(this,t,n);let r="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>t&&o&&(r+=s),t<l&&n>i&&(r+=a.slice(Math.max(0,t-i),n-i)),i=l+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 mr(s,r)),s=[],r=-1);return r>-1&&n.push(new mr(s,r)),n}}class yl extends ts{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,l=s+o.lines-1;if((n?l:a)>=t)return o.lineInner(t,n,s,r);r=a+1,s=l+1}}decompose(t,n,s,r){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(t<=l&&n>=o){let c=r&((o<=t?1:0)|(l>=n?2:0));o>=t&&l<=n&&!c?s.push(a):a.decompose(t-o,n-o,s,c)}o=l+1}}replace(t,n,s){if([t,n]=em(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 l=o.replace(t-i,n-i,s),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[r]=l,new yl(d,this.length-(n-t)+s.length)}return super.replace(i,a,l)}i=a+1}return super.replace(t,n,s)}sliceString(t,n=this.length,s=`
`){[t,n]=em(this,t,n);let r="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],l=o+a.length;o>t&&i&&(r+=s),t<l&&n>o&&(r+=a.sliceString(t-o,n-o,s)),o=l+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof yl))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 l=this.children[r],c=t.children[i];if(l!=c)return s+l.scanIdentical(c,n);s+=l.length+1}}static from(t,n=t.reduce((s,r)=>s+r.length+1,-1)){let s=0;for(let m of t)s+=m.lines;if(s<32){let m=[];for(let g of t)g.flatten(m);return new mr(m,n)}let r=Math.max(32,s>>5),i=r<<1,o=r>>1,a=[],l=0,c=-1,d=[];function h(m){let g;if(m.lines>i&&m instanceof yl)for(let y of m.children)h(y);else m.lines>o&&(l>o||!l)?(f(),a.push(m)):m instanceof mr&&l&&(g=d[d.length-1])instanceof mr&&m.lines+g.lines<=32?(l+=m.lines,c+=m.length+1,d[d.length-1]=new mr(g.text.concat(m.text),g.length+1+m.length)):(l+m.lines>r&&f(),l+=m.lines,c+=m.length+1,d.push(m))}function f(){l!=0&&(a.push(d.length==1?d[0]:yl.from(d,c)),c=-1,l=d.length=0)}for(let m of t)h(m);return f(),a.length==1?a[0]:new yl(a,n)}}ts.empty=new mr([""],0);function Lde(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Ry(e,t,n=0,s=1e9){for(let r=0,i=0,o=!0;i<e.length&&r<=s;i++){let a=e[i],l=r+a.length;l>=n&&(l>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=l+1}return t}function EE(e,t,n){return Ry(e,[""],t,n)}class tp{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 mr?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 mr?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 mr){let l=r.text[o+(n<0?-1:0)];if(this.offsets[s]+=n,l.length>Math.max(0,t))return this.value=t==0?l:n>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=r.children[o+(n<0?-1:0)];t>l.length?(t-=l.length,this.offsets[s]+=n):(n<0&&this.offsets[s]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof mr?l.text.length:l.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class YP{constructor(t,n,s){this.value="",this.done=!1,this.cursor=new tp(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 QP{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"&&(ts.prototype[Symbol.iterator]=function(){return this.iter()},tp.prototype[Symbol.iterator]=YP.prototype[Symbol.iterator]=QP.prototype[Symbol.iterator]=function(){return this});class Dde{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 em(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Oi(e,t,n=!0,s=!0){return jde(e,t,n,s)}function Ode(e){return e>=56320&&e<57344}function Bde(e){return e>=55296&&e<56320}function eu(e,t){let n=e.charCodeAt(t);if(!Bde(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return Ode(s)?(n-55296<<10)+(s-56320)+65536:n}function Pde(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Jh(e){return e<65536?1:2}const _3=/\r\n?|\n/;var Bo=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Bo||(Bo={}));class El{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){k3(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 El(t)}composeDesc(t){return this.empty?t:t.empty?this:XP(this,t)}mapDesc(t,n=!1){return t.empty?this:S3(this,t,n)}mapPos(t,n=-1,s=Bo.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=r+a;if(l<0){if(c>t)return i+(t-r);i+=a}else{if(s!=Bo.Simple&&c>=t&&(s==Bo.TrackDel&&r<t&&c>t||s==Bo.TrackBefore&&r<t||s==Bo.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!a)return t==r||n<0?i:i+l;i+=l}r=c}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 El(t)}static create(t){return new El(t)}}class Or extends El{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 k3(this,(n,s,r,i,o)=>t=t.replace(r,r+(s-n),o),!1),t}mapDesc(t,n=!1){return S3(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 l=r>>1;for(;s.length<l;)s.push(ts.empty);s.push(o?t.slice(i,i+o):ts.empty)}i+=o}return new Or(n,s)}compose(t){return this.empty?t:t.empty?this:XP(this,t,!0)}map(t,n=!1){return t.empty?this:S3(this,t,n,!0)}iterChanges(t,n=!1){k3(this,t,n)}get desc(){return El.create(this.sections)}filter(t){let n=[],s=[],r=[],i=new Rp(this);e:for(let o=0,a=0;;){let l=o==t.length?1e9:t[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,l-a);ji(r,d,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;ji(n,d,h),h>0&&wu(s,n,i.text),i.forward(d),a+=d}let c=t[o++];for(;a<c;){if(i.done)break e;let d=Math.min(i.len,c-a);ji(n,d,-1),ji(r,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),a+=d}}return{changes:new Or(n,s),filtered:El.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 l(d=!1){if(!d&&!r.length)return;o<n&&ji(r,n-o,-1);let h=new Or(r,i);a=a?a.compose(h.map(a)):h,r=[],i=[],o=0}function c(d){if(Array.isArray(d))for(let h of d)c(h);else if(d instanceof Or){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);l(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:f=h,insert:m}=d;if(h>f||h<0||f>n)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${n})`);let g=m?typeof m=="string"?ts.of(m.split(s||_3)):m:ts.empty,y=g.length;if(h==f&&y==0)return;h<o&&l(),h>o&&ji(r,h-o,-1),ji(r,f-h,y),wu(i,r,g),o=f}}return c(t),l(!a),a}static empty(t){return new Or(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(ts.empty);s[r]=ts.of(i.slice(1)),n.push(i[0],s[r].length)}}}return new Or(n,s)}static createSet(t,n){return new Or(t,n)}}function ji(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 wu(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(ts.empty);e.push(n)}}function k3(e,t,n){let s=e.inserted;for(let r=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],l=e.sections[o++];if(l<0)r+=a,i+=a;else{let c=r,d=i,h=ts.empty;for(;c+=a,d+=l,l&&s&&(h=h.append(s[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(r,c,i,d,h),r=c,i=d}}}function S3(e,t,n,s=!1){let r=[],i=s?[]:null,o=new Rp(e),a=new Rp(t);for(let l=-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 c=Math.min(o.len,a.len);ji(r,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for(ji(r,a.ins,-1);c;){let d=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=d&&(ji(r,0,o.ins),i&&wu(i,r,o.text),l=o.i),o.forward(d),c-=d}a.next()}else if(o.ins>=0){let c=0,d=o.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);c+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;ji(r,c,l<o.i?o.ins:0),i&&l<o.i&&wu(i,r,o.text),l=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return i?Or.createSet(r,i):El.create(r);throw new Error("Mismatched change set lengths")}}}function XP(e,t,n=!1){let s=[],r=n?[]:null,i=new Rp(e),o=new Rp(t);for(let a=!1;;){if(i.done&&o.done)return r?Or.createSet(s,r):El.create(s);if(i.ins==0)ji(s,i.len,0,a),i.next();else if(o.len==0&&!o.done)ji(s,0,o.ins,a),r&&wu(r,s,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,o.len),c=s.length;if(i.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;ji(s,l,d,a),r&&d&&wu(r,s,o.text)}else o.ins==-1?(ji(s,i.off?0:i.len,l,a),r&&wu(r,s,i.textBit(l))):(ji(s,i.off?0:i.len,o.off?0:o.ins,a),r&&!o.off&&wu(r,s,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||s.length>c),i.forward2(l),o.forward(l)}}}}class Rp{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?ts.empty:t[n]}textBit(t){let{inserted:n}=this.set,s=this.i-2>>1;return s>=n.length&&!t?ts.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 Bd{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 Bd(s,r,this.flags)}extend(t,n=t,s=0){if(t<=this.anchor&&n>=this.anchor)return Qe.range(t,n,void 0,void 0,s);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Qe.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 Qe.range(t.anchor,t.head)}static create(t,n,s){return new Bd(t,n,s)}}class Qe{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Qe.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 Qe([this.main],0)}addRange(t,n=!0){return Qe.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let s=this.ranges.slice();return s[n]=t,Qe.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 Qe(t.ranges.map(n=>Bd.fromJSON(n)),t.main)}static single(t,n=t){return new Qe([Qe.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 Qe.normalized(t.slice(),n);s=i.to}return new Qe(t,n)}static cursor(t,n=0,s,r){return Bd.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?Bd.create(n,t,48|o):Bd.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,l=Math.max(i.to,o.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?Qe.range(l,a):Qe.range(a,l))}}return new Qe(t,n)}}function JP(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let K5=0;class en{constructor(t,n,s,r,i){this.combine=t,this.compareInput=n,this.compare=s,this.isStatic=r,this.id=K5++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new en(t.combine||(n=>n),t.compareInput||((n,s)=>n===s),t.compare||(t.combine?(n,s)=>n===s:Y5),!!t.static,t.enables)}of(t){return new Ly([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ly(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ly(t,this,2,n)}from(t,n){return n||(n=s=>s),this.compute([t],s=>n(s.field(t)))}}function Y5(e,t){return e==t||e.length==t.length&&e.every((n,s)=>n===t[s])}class Ly{constructor(t,n,s,r){this.dependencies=t,this.facet=n,this.type=s,this.value=r,this.id=K5++}dynamicSlot(t){var n;let s=this.value,r=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,l=!1,c=!1,d=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!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,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||T3(h,d)){let m=s(h);if(a?!ME(m,h.values[o],r):!r(m,h.values[o]))return h.values[o]=m,1}return 0},reconfigure:(h,f)=>{let m,g=f.config.address[i];if(g!=null){let y=Xb(f,g);if(this.dependencies.every(b=>b instanceof en?f.facet(b)===h.facet(b):b instanceof Pl?f.field(b,!1)==h.field(b,!1):!0)||(a?ME(m=s(h),y,r):r(m=s(h),y)))return h.values[o]=y,0}else m=s(h);return h.values[o]=m,1}}}}function ME(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 T3(e,t){let n=!1;for(let s of t)np(e,s)&1&&(n=!0);return n}function $de(e,t,n){let s=n.map(l=>e[l.id]),r=n.map(l=>l.type),i=s.filter(l=>!(l&1)),o=e[t.id]>>1;function a(l){let c=[];for(let d=0;d<s.length;d++){let h=Xb(l,s[d]);if(r[d]==2)for(let f of h)c.push(f);else c.push(h)}return t.combine(c)}return{create(l){for(let c of s)np(l,c);return l.values[o]=a(l),1},update(l,c){if(!T3(l,i))return 0;let d=a(l);return t.compare(d,l.values[o])?0:(l.values[o]=d,1)},reconfigure(l,c){let d=T3(l,s),h=c.config.facets[t.id],f=c.facet(t);if(h&&!d&&Y5(n,h))return l.values[o]=f,0;let m=a(l);return t.compare(m,f)?(l.values[o]=f,0):(l.values[o]=m,1)}}}const N1=en.define({static:!0});class Pl{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 Pl(K5++,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(N1).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(N1),o=r.facet(N1),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.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,N1.of({field:this,create:t})]}get extension(){return this}}const Id={lowest:4,low:3,default:2,high:1,highest:0};function t0(e){return t=>new ZP(t,e)}const Sh={highest:t0(Id.highest),high:t0(Id.high),default:t0(Id.default),low:t0(Id.low),lowest:t0(Id.lowest)};class ZP{constructor(t,n){this.inner=t,this.prec=n}}class Th{of(t){return new C3(this,t)}reconfigure(t){return Th.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class C3{constructor(t,n){this.compartment=t,this.inner=n}}class Qb{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 f of zde(t,n,o))f instanceof Pl?r.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of r)a[f.id]=c.length<<1,c.push(m=>f.slot(m));let d=s==null?void 0:s.config.facets;for(let f in i){let m=i[f],g=m[0].facet,y=d&&d[f]||[];if(m.every(b=>b.type==0))if(a[g.id]=l.length<<1|1,Y5(y,m))l.push(s.facet(g));else{let b=g.combine(m.map(w=>w.value));l.push(s&&g.compare(b,s.facet(g))?s.facet(g):b)}else{for(let b of m)b.type==0?(a[b.id]=l.length<<1|1,l.push(b.value)):(a[b.id]=c.length<<1,c.push(w=>b.dynamicSlot(w)));a[g.id]=c.length<<1,c.push(b=>$de(b,g,m))}}let h=c.map(f=>f(a));return new Qb(t,o,h,a,l,i)}}function zde(e,t,n){let s=[[],[],[],[],[]],r=new Map;function i(o,a){let l=r.get(o);if(l!=null){if(l<=a)return;let c=s[l].indexOf(o);c>-1&&s[l].splice(c,1),o instanceof C3&&n.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof C3){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=t.get(o.compartment)||o.inner;n.set(o.compartment,c),i(c,a)}else if(o instanceof ZP)i(o.inner,o.prec);else if(o instanceof Pl)s[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof Ly)s[a].push(o),o.facet.extensions&&i(o.facet.extensions,Id.default);else{let c=o.extension;if(!c)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(c,a)}}return i(e,Id.default),s.reduce((o,a)=>o.concat(a))}function np(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 Xb(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const e$=en.define(),A3=en.define({combine:e=>e.some(t=>t),static:!0}),t$=en.define({combine:e=>e.length?e[0]:void 0,static:!0}),n$=en.define(),s$=en.define(),r$=en.define(),i$=en.define({combine:e=>e.length?e[0]:!1});class Lc{constructor(t,n){this.type=t,this.value=n}static define(){return new Fde}}class Fde{of(t){return new Lc(this,t)}}class qde{constructor(t){this.map=t}of(t){return new As(this,t)}}class As{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 As(this.type,n)}is(t){return this.type==t}static define(t={}){return new qde(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}}As.reconfigure=As.define();As.appendConfig=As.define();class Pr{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&&JP(s,n.newLength),i.some(a=>a.type==Pr.time)||(this.annotations=i.concat(Pr.time.of(Date.now())))}static create(t,n,s,r,i,o){return new Pr(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(Pr.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Pr.time=Lc.define();Pr.userEvent=Lc.define();Pr.addToHistory=Lc.define();Pr.remote=Lc.define();function Hde(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 o$(e,t,n){var s;let r,i,o;return n?(r=t.changes,i=Or.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:As.mapEffects(e.effects,r).concat(As.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function E3(e,t,n){let s=t.selection,r=Nf(t.annotations);return t.userEvent&&(r=r.concat(Pr.userEvent.of(t.userEvent))),{changes:t.changes instanceof Or?t.changes:Or.of(t.changes||[],n,e.facet(t$)),selection:s&&(s instanceof Qe?s:Qe.single(s.anchor,s.head)),effects:Nf(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function a$(e,t,n){let s=E3(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=o$(s,E3(e,t[i],o?s.changes.newLength:e.doc.length),o)}let r=Pr.create(e,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return Vde(n?Ude(r):r)}function Ude(e){let t=e.startState,n=!0;for(let r of t.facet(n$)){let i=r(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:Hde(n,i))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=Or.empty(t.doc.length);else{let o=e.changes.filter(n);r=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=Pr.create(t,r,e.selection&&e.selection.map(i),As.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let s=t.facet(s$);for(let r=s.length-1;r>=0;r--){let i=s[r](e);i instanceof Pr?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Pr?e=i[0]:e=a$(t,Nf(i),!1)}return e}function Vde(e){let t=e.startState,n=t.facet(r$),s=e;for(let r=n.length-1;r>=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(s=o$(s,E3(t,i,e.changes.newLength),!0))}return s==e?e:Pr.create(t,e.changes,e.selection,s.effects,s.annotations,s.scrollIntoView)}const Wde=[];function Nf(e){return e==null?Wde:Array.isArray(e)?e:[e]}var dc=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(dc||(dc={}));const Gde=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let M3;try{M3=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Kde(e){if(M3)return M3.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Gde.test(n)))return!0}return!1}function Yde(e){return t=>{if(!/\S/.test(t))return dc.Space;if(Kde(t))return dc.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return dc.Word;return dc.Other}}class ys{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++)np(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 np(this,s),Xb(this,s)}update(...t){return a$(this,t,!0)}applyTransaction(t){let n=this.config,{base:s,compartments:r}=n;for(let a of t.effects)a.is(Th.reconfigure)?(n&&(r=new Map,n.compartments.forEach((l,c)=>r.set(c,l)),n=null),r.set(a.value.compartment,a.value.extension)):a.is(As.reconfigure)?(n=null,s=a.value):a.is(As.appendConfig)&&(n=null,s=Nf(s).concat(a.value));let i;n?i=t.startState.values.slice():(n=Qb.resolve(s,r,this),i=new ys(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=t.startState.facet(A3)?t.newSelection:t.newSelection.asSingle();new ys(n,t.newDoc,o,i,(a,l)=>l.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:Qe.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=Nf(s.effects);for(let a=1;a<n.ranges.length;a++){let l=t(n.ranges[a]),c=this.changes(l.changes),d=c.map(r);for(let f=0;f<a;f++)i[f]=i[f].map(d);let h=r.mapDesc(c,!0);i.push(l.range.map(h)),r=r.compose(d),o=As.mapEffects(o,d).concat(As.mapEffects(Nf(l.effects),h))}return{changes:r,selection:Qe.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof Or?t:Or.of(t,this.doc.length,this.facet(ys.lineSeparator))}toText(t){return ts.of(t.split(this.facet(ys.lineSeparator)||_3))}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:(np(this,n),Xb(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 Pl&&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(l=>o.spec.fromJSON(a,l)))}}return ys.create({doc:t.doc,selection:Qe.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=Qb.resolve(t.extensions||[],new Map),s=t.doc instanceof ts?t.doc:ts.of((t.doc||"").split(n.staticFacet(ys.lineSeparator)||_3)),r=t.selection?t.selection instanceof Qe?t.selection:Qe.single(t.selection.anchor,t.selection.head):Qe.single(0);return JP(r,s.length),n.staticFacet(A3)||(r=r.asSingle()),new ys(n,s,r,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(ys.tabSize)}get lineBreak(){return this.facet(ys.lineSeparator)||`
`}get readOnly(){return this.facet(i$)}phrase(t,...n){for(let s of this.facet(ys.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(e$))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 Yde(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 l=Oi(n,o,!1);if(i(n.slice(l,o))!=dc.Word)break;o=l}for(;a<r;){let l=Oi(n,a);if(i(n.slice(a,l))!=dc.Word)break;a=l}return o==a?null:Qe.range(o+s,a+s)}}ys.allowMultipleSelections=A3;ys.tabSize=en.define({combine:e=>e.length?e[0]:4});ys.lineSeparator=t$;ys.readOnly=i$;ys.phrases=en.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])}});ys.languageData=e$;ys.changeFilter=n$;ys.transactionFilter=s$;ys.transactionExtender=r$;Th.reconfigure=As.define();function _v(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 Gu{eq(t){return this==t}range(t,n=t){return N3.create(t,n,this)}}Gu.prototype.startSide=Gu.prototype.endSide=0;Gu.prototype.point=!1;Gu.prototype.mapMode=Bo.TrackDel;function Q5(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let N3=class l${constructor(t,n,s){this.from=t,this.to=n,this.value=s}static create(t,n,s){return new l$(t,n,s)}};function I3(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class X5{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 l=o+a>>1,c=i[l]-t||(s?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+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 l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+t,h=this.to[l]+t,f,m;if(d==h){let g=n.mapPos(d,c.startSide,c.mapMode);if(g==null||(f=m=g,c.startSide!=c.endSide&&(m=n.mapPos(d,c.endSide),m<f)))continue}else if(f=n.mapPos(d,c.startSide),m=n.mapPos(h,c.endSide),f>m||f==m&&c.startSide>0&&c.endSide<=0)continue;(m-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,m-f)),s.push(c),r.push(f-o),i.push(m-o))}return{mapped:s.length?new X5(r,i,s,a):null,pos:o}}}class _s{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 _s(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(I3)),this.isEmpty)return n.length?_s.of(n):this;let a=new c$(this,null,-1).goto(0),l=0,c=[],d=new rh;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let h=n[l++];d.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].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)||c.push(N3.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?_s.empty:this.nextLayer.update({add:c,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],l=this.chunk[o],c=t.touchesRange(a,a+l.length);if(c===!1)r=Math.max(r,l.maxPoint),n.push(l),s.push(t.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.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 _s(s,n,i||_s.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 Lp.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return Lp.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),l=NE(o,a,s),c=new n0(o,l,i),d=new n0(a,l,i);s.iterGaps((h,f,m)=>IE(c,h,d,f,m,r)),s.empty&&s.length==0&&IE(c,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=NE(i,o),l=new n0(i,a,0).goto(s),c=new n0(o,a,0).goto(s);for(;;){if(l.to!=c.to||!j3(l.active,c.active)||l.point&&(!c.point||!Q5(l.point,c.point)))return!1;if(l.to>r)return!0;l.next(),c.next()}}static spans(t,n,s,r,i=-1){let o=new n0(t,null,i).goto(n),a=n,l=o.openStart;for(;;){let c=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,l);r.point(a,c,o.point,d,h,o.pointRank),l=Math.min(o.openEnd(c),d.length)}else c>a&&(r.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>s)return l+(o.point&&o.to>s?1:0);a=o.to,o.next()}}static of(t,n=!1){let s=new rh;for(let r of t instanceof N3?[t]:n?Qde(t):t)s.add(r.from,r.to,r.value);return s.finish()}static join(t){if(!t.length)return _s.empty;let n=t[t.length-1];for(let s=t.length-2;s>=0;s--)for(let r=t[s];r!=_s.empty;r=r.nextLayer)n=new _s(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}_s.empty=new _s([],[],null,-1);function Qde(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let s=e[n];if(I3(t,s)>0)return e.slice().sort(I3);t=s}return e}_s.empty.nextLayer=_s.empty;class rh{finishChunk(t){this.chunks.push(new X5(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 rh)).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(_s.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=_s.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function NE(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 c${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 Lp{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 c$(o,n,s,i));return r.length==1?r[0]:new Lp(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--)u4(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--)u4(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(),u4(this.heap,0)}}}function u4(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 n0{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=Lp.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){I1(this.active,t),I1(this.activeTo,t),I1(this.activeRank,t),this.minActive=jE(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++;j1(this.active,n,s),j1(this.activeTo,n,r),j1(this.activeRank,n,i),t&&j1(t,n,this.cursor.from),this.minActive=jE(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&&I1(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 IE(e,t,n,s,r,i){e.goto(t),n.goto(s);let o=s+r,a=s,l=s-t,c=!!i.boundChange;for(let d=!1;;){let h=e.to+l-n.to,f=h||e.endSide-n.endSide,m=f<0?e.to+l:n.to,g=Math.min(m,o);if(e.point||n.point?(e.point&&n.point&&Q5(e.point,n.point)&&j3(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,g,e.point,n.point),d=!1):(d&&i.boundChange(a),g>a&&!j3(e.active,n.active)&&i.compareRange(a,g,e.active,n.active),c&&g<o&&(h||e.openEnd(m)!=n.openEnd(m))&&(d=!0)),m>o)break;a=m,f<=0&&e.next(),f>=0&&n.next()}}function j3(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!Q5(e[n],t[n]))return!1;return!0}function I1(e,t){for(let n=t,s=e.length-1;n<s;n++)e[n]=e[n+1];e.pop()}function j1(e,t,n){for(let s=e.length-1;s>=t;s--)e[s+1]=e[s];e[t]=n}function jE(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 kg(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=Oi(e,r));return s}function Xde(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=Oi(e,r)}return e.length}const R3="ͼ",RE=typeof Symbol>"u"?"__"+R3:Symbol.for(R3),L3=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),LE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ku{constructor(t,n){this.rules=[];let{finish:s}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,c){let d=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let m in a){let g=a[m];if(/&/.test(m))i(m.split(/,\s*/).map(y=>o.map(b=>y.replace(/&/,b))).reduce((y,b)=>y.concat(b)),g,l);else if(g&&typeof g=="object"){if(!h)throw new RangeError("The value of a property ("+m+") should be a primitive value.");i(r(m),g,d,f)}else g!=null&&d.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+g+";")}(d.length||f)&&l.push((s&&!h&&!c?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=LE[RE]||1;return LE[RE]=t+1,R3+t.toString(36)}static mount(t,n,s){let r=t[L3],i=s&&s.nonce;r?i&&r.setNonce(i):r=new Jde(t,i),r.mount(Array.isArray(n)?n:[n],t)}}let DE=new Map;class Jde{constructor(t,n){let s=t.ownerDocument||t,r=s.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let i=DE.get(s);if(i)return t[L3]=i;this.sheet=new r.CSSStyleSheet,DE.set(s,this)}else this.styleTag=s.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[L3]=this}mount(t,n){let s=this.sheet,r=0,i=0;for(let o=0;o<t.length;o++){let a=t[o],l=this.modules.indexOf(a);if(l<i&&l>-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,a),s)for(let c=0;c<a.rules.length;c++)s.insertRule(a.rules[c],r++)}else{for(;i<l;)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 l=0;l<this.modules.length;l++)o+=this.modules[l].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 Yu={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:"'"},Dp={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Zde=typeof navigator<"u"&&/Mac/.test(navigator.platform),ehe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var hi=0;hi<10;hi++)Yu[48+hi]=Yu[96+hi]=String(hi);for(var hi=1;hi<=24;hi++)Yu[hi+111]="F"+hi;for(var hi=65;hi<=90;hi++)Yu[hi]=String.fromCharCode(hi+32),Dp[hi]=String.fromCharCode(hi);for(var d4 in Yu)Dp.hasOwnProperty(d4)||(Dp[d4]=Yu[d4]);function the(e){var t=Zde&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ehe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Dp:Yu)[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}let Ki=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},D3=typeof document<"u"?document:{documentElement:{style:{}}};const O3=/Edge\/(\d+)/.exec(Ki.userAgent),u$=/MSIE \d/.test(Ki.userAgent),B3=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ki.userAgent),kv=!!(u$||B3||O3),OE=!kv&&/gecko\/(\d+)/i.test(Ki.userAgent),h4=!kv&&/Chrome\/(\d+)/.exec(Ki.userAgent),BE="webkitFontSmoothing"in D3.documentElement.style,P3=!kv&&/Apple Computer/.test(Ki.vendor),PE=P3&&(/Mobile\/\w+/.test(Ki.userAgent)||Ki.maxTouchPoints>2);var Mt={mac:PE||/Mac/.test(Ki.platform),windows:/Win/.test(Ki.platform),linux:/Linux|X11/.test(Ki.platform),ie:kv,ie_version:u$?D3.documentMode||6:B3?+B3[1]:O3?+O3[1]:0,gecko:OE,gecko_version:OE?+(/Firefox\/(\d+)/.exec(Ki.userAgent)||[0,0])[1]:0,chrome:!!h4,chrome_version:h4?+h4[1]:0,ios:PE,android:/Android\b/.test(Ki.userAgent),webkit:BE,webkit_version:BE?+(/\bAppleWebKit\/(\d+)/.exec(Ki.userAgent)||[0,0])[1]:0,safari:P3,safari_version:P3?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ki.userAgent)||[0,0])[1]:0,tabSize:D3.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function J5(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 Jb=Object.create(null);function Z5(e,t,n){if(e==t)return!0;e||(e=Jb),t||(t=Jb);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 nhe(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 $E(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 she(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 $l{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 to=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(to||(to={}));class Wn extends Gu{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 Sg(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 ih(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}=d$(t,n);s=(i?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new ih(t,s,r,n,t.widget||null,!0)}static line(t){return new Tg(t)}static set(t,n=!1){return _s.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Wn.none=_s.empty;class Sg extends Wn{constructor(t){let{start:n,end:s}=d$(t);super(n?-1:5e8,s?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?J5(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Jb}eq(t){return this==t||t instanceof Sg&&this.tagName==t.tagName&&Z5(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)}}Sg.prototype.point=!1;class Tg extends Wn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Tg&&this.spec.class==t.spec.class&&Z5(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)}}Tg.prototype.mapMode=Bo.TrackBefore;Tg.prototype.point=!0;class ih extends Wn{constructor(t,n,s,r,i,o){super(n,s,i,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?Bo.TrackBefore:Bo.TrackAfter:Bo.TrackDel}get type(){return this.startSide!=this.endSide?to.WidgetRange:this.startSide<=0?to.WidgetBefore:to.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof ih&&rhe(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)}}ih.prototype.point=!0;function d$(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 rhe(e,t){return e==t||!!(e&&t&&e.compare(t))}function If(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 Op extends Gu{constructor(t,n,s){super(),this.tagName=t,this.attributes=n,this.rank=s}eq(t){return t==this||t instanceof Op&&this.tagName==t.tagName&&Z5(this.attributes,t.attributes)}static create(t){return new Op(t.tagName,t.attributes||Jb,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return _s.of(t,n)}}Op.prototype.startSide=Op.prototype.endSide=-1;function Bp(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function $3(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function sp(e,t){if(!t.anchorNode)return!1;try{return $3(e,t.anchorNode)}catch{return!1}}function rp(e){return e.nodeType==3?$p(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function ip(e,t,n,s){return n?zE(e,t,n,s,-1)||zE(e,t,n,s,1):!1}function Qu(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Zb(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function zE(e,t,n,s,r){for(;;){if(e==n&&t==s)return!0;if(t==(r<0?0:Ac(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Qu(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?Ac(e):0}else return!1}}function Ac(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Pp(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function ihe(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 h$(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 ohe(e,t,n,s,r,i,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let d=e,h=!1;d&&!h;)if(d.nodeType==1){let f,m=d==l.body,g=1,y=1;if(m)f=ihe(c);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:y}=h$(d,v)),f={left:v.left,right:v.left+d.clientWidth*g,top:v.top,bottom:v.top+d.clientHeight*y}}let b=0,w=0;if(r=="nearest")t.top<f.top+o?(w=t.top-(f.top+o),n>0&&t.bottom>f.bottom+w&&(w=t.bottom-f.bottom+o)):t.bottom>f.bottom-o&&(w=t.bottom-f.bottom+o,n<0&&t.top-w<f.top&&(w=t.top-(f.top+o)));else{let v=t.bottom-t.top,x=f.bottom-f.top;w=(r=="center"&&v<=x?t.top+v/2-x/2:r=="start"||r=="center"&&n<0?t.top-o:t.bottom-x+o)-f.top}if(s=="nearest"?t.left<f.left+i?(b=t.left-(f.left+i),n>0&&t.right>f.right+b&&(b=t.right-f.right+i)):t.right>f.right-i&&(b=t.right-f.right+i,n<0&&t.left<f.left+b&&(b=t.left-(f.left+i))):b=(s=="center"?t.left+(t.right-t.left)/2-(f.right-f.left)/2:s=="start"==a?t.left-i:t.right-(f.right-f.left)+i)-f.left,b||w)if(m)c.scrollBy(b,w);else{let v=0,x=0;if(w){let C=d.scrollTop;d.scrollTop+=w/y,x=(d.scrollTop-C)*y}if(b){let C=d.scrollLeft;d.scrollLeft+=b/g,v=(d.scrollLeft-C)*g}t={left:t.left-v,top:t.top-x,right:t.right-v,bottom:t.bottom-x},v&&Math.abs(v-b)<1&&(s="nearest"),x&&Math.abs(x-w)<1&&(r="nearest")}if(m)break;(t.top<f.top||t.bottom>f.bottom||t.left<f.left||t.right>f.right)&&(t={left:Math.max(t.left,f.left),right:Math.min(t.right,f.right),top:Math.max(t.top,f.top),bottom:Math.min(t.bottom,f.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function f$(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 ahe{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?Ac(n):0),s,Math.min(t.focusOffset,s?Ac(s):0))}set(t,n,s,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=s,this.focusOffset=r}}let Cd=null;Mt.safari&&Mt.safari_version>=26&&(Cd=!1);function m$(e){if(e.setActive)return e.setActive();if(Cd)return e.focus(Cd);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Cd==null?{get preventScroll(){return Cd={preventScroll:!0},!0}}:void 0),!Cd){Cd=!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 FE;function $p(e,t,n=t){let s=FE||(FE=document.createRange());return s.setEnd(e,n),s.setStart(e,t),s}function jf(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 lhe(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function che(e,t){let n=t.focusNode,s=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=s)return!1;for(s=Math.min(s,Ac(n));;)if(s){if(n.nodeType!=1)return!1;let r=n.childNodes[s-1];r.contentEditable=="false"?s--:(n=r,s=Ac(n))}else{if(n==e)return!0;s=Qu(n),n=n.parentNode}}function p$(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 g$(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=Ac(n)}else if(n.parentNode&&!Zb(n))s=Qu(n),n=n.parentNode;else return null}}function y$(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&&!Zb(n))s=Qu(n)+1,n=n.parentNode;else return null}}class $a{constructor(t,n,s=!0){this.node=t,this.offset=n,this.precise=s}static before(t,n){return new $a(t.parentNode,Qu(t),n)}static after(t,n){return new $a(t.parentNode,Qu(t)+1,n)}}var Ws=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Ws||(Ws={}));const oh=Ws.LTR,e8=Ws.RTL;function b$(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const uhe=b$("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),dhe=b$("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),z3=Object.create(null),rl=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);z3[t]=n,z3[n]=-t}function w$(e){return e<=247?uhe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?dhe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const hhe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Sl{get dir(){return this.level%2?e8:oh}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 v$(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||!v$(s.inner,r.inner))return!1}return!0}const Is=[];function fhe(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,l=i?256:r;for(let c=o,d=l,h=l;c<a;c++){let f=w$(e.charCodeAt(c));f==512?f=d:f==8&&h==4&&(f=16),Is[c]=f==4?2:f,f&7&&(h=f),d=f}for(let c=o,d=l,h=l;c<a;c++){let f=Is[c];if(f==128)c<a-1&&d==Is[c+1]&&d&24?f=Is[c]=d:Is[c]=256;else if(f==64){let m=c+1;for(;m<a&&Is[m]==64;)m++;let g=c&&d==8||m<n&&Is[m]==8?h==1?1:8:256;for(let y=c;y<m;y++)Is[y]=g;c=m-1}else f==8&&h==1&&(Is[c]=1);d=f,f&7&&(h=f)}}}function mhe(e,t,n,s,r){let i=r==1?2:1;for(let o=0,a=0,l=0;o<=s.length;o++){let c=o?s[o-1].to:t,d=o<s.length?s[o].from:n;for(let h=c,f,m,g;h<d;h++)if(m=z3[f=e.charCodeAt(h)])if(m<0){for(let y=a-3;y>=0;y-=3)if(rl[y+1]==-m){let b=rl[y+2],w=b&2?r:b&4?b&1?i:r:0;w&&(Is[h]=Is[rl[y]]=w),a=y;break}}else{if(rl.length==189)break;rl[a++]=h,rl[a++]=f,rl[a++]=l}else if((g=Is[h])==2||g==1){let y=g==r;l=y?0:1;for(let b=a-3;b>=0;b-=3){let w=rl[b+2];if(w&2)break;if(y)rl[b+2]|=2;else{if(w&4)break;rl[b+2]|=4}}}}}function phe(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 l=o;l<a;){let c=Is[l];if(c==256){let d=l+1;for(;;)if(d==a){if(r==n.length)break;d=n[r++].to,a=r<n.length?n[r].from:t}else if(Is[d]==256)d++;else break;let h=i==1,f=(d<t?Is[d]:s)==1,m=h==f?h?1:2:s;for(let g=d,y=r,b=y?n[y-1].to:e;g>l;)g==b&&(g=n[--y].from,b=y?n[y-1].to:e),Is[--g]=m;l=d}else i=c,l++}}}function F3(e,t,n,s,r,i,o){let a=s%2?2:1;if(s%2==r%2)for(let l=t,c=0;l<n;){let d=!0,h=!1;if(c==i.length||l<i[c].from){let y=Is[l];y!=a&&(d=!1,h=y==16)}let f=!d&&a==1?[]:null,m=d?s:s+1,g=l;e:for(;;)if(c<i.length&&g==i[c].from){if(h)break e;let y=i[c];if(!d)for(let b=y.to,w=c+1;;){if(b==n)break e;if(w<i.length&&i[w].from==b)b=i[w++].to;else{if(Is[b]==a)break e;break}}if(c++,f)f.push(y);else{y.from>l&&o.push(new Sl(l,y.from,m));let b=y.direction==oh!=!(m%2);q3(e,b?s+1:s,r,y.inner,y.from,y.to,o),l=y.to}g=y.to}else{if(g==n||(d?Is[g]!=a:Is[g]==a))break;g++}f?F3(e,l,g,s+1,r,f,o):l<g&&o.push(new Sl(l,g,m)),l=g}else for(let l=n,c=i.length;l>t;){let d=!0,h=!1;if(!c||l>i[c-1].to){let y=Is[l-1];y!=a&&(d=!1,h=y==16)}let f=!d&&a==1?[]:null,m=d?s:s+1,g=l;e:for(;;)if(c&&g==i[c-1].to){if(h)break e;let y=i[--c];if(!d)for(let b=y.from,w=c;;){if(b==t)break e;if(w&&i[w-1].to==b)b=i[--w].from;else{if(Is[b-1]==a)break e;break}}if(f)f.push(y);else{y.to<l&&o.push(new Sl(y.to,l,m));let b=y.direction==oh!=!(m%2);q3(e,b?s+1:s,r,y.inner,y.from,y.to,o),l=y.from}g=y.from}else{if(g==t||(d?Is[g-1]!=a:Is[g-1]==a))break;g--}f?F3(e,g,l,s+1,r,f,o):g<l&&o.push(new Sl(g,l,m)),l=g}}function q3(e,t,n,s,r,i,o){let a=t%2?2:1;fhe(e,r,i,s,a),mhe(e,r,i,s,a),phe(r,i,s,a),F3(e,r,i,t,n,s,o)}function ghe(e,t,n){if(!e)return[new Sl(0,0,t==e8?1:0)];if(t==oh&&!n.length&&!hhe.test(e))return x$(e.length);if(n.length)for(;e.length>Is.length;)Is[Is.length]=256;let s=[],r=t==oh?0:1;return q3(e,r,r,n,0,e.length,s),s}function x$(e){return[new Sl(0,e,0)]}let _$="";function yhe(e,t,n,s,r){var i;let o=s.head-e.from,a=Sl.find(t,o,(i=s.bidiLevel)!==null&&i!==void 0?i:-1,s.assoc),l=t[a],c=l.side(r,n);if(o==c){let f=a+=r?1:-1;if(f<0||f>=t.length)return null;l=t[a=f],o=l.side(!r,n),c=l.side(r,n)}let d=Oi(e.text,o,l.forward(r,n));(d<l.from||d>l.to)&&(d=c),_$=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==c&&h.level+(r?0:1)<l.level?Qe.cursor(h.side(!r,n)+e.from,h.forward(r,n)?1:-1,h.level):Qe.cursor(d+e.from,l.forward(r,n)?-1:1,l.level)}function bhe(e,t,n){for(let s=t;s<n;s++){let r=w$(e.charCodeAt(s));if(r==1)return oh;if(r==2||r==4)return e8}return oh}const k$=en.define(),S$=en.define(),T$=en.define(),C$=en.define(),H3=en.define(),A$=en.define(),E$=en.define(),t8=en.define(),n8=en.define(),M$=en.define({combine:e=>e.some(t=>t)}),N$=en.define({combine:e=>e.some(t=>t)}),I$=en.define();class Rf{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 Rf(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 Rf(Qe.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const R1=As.define({map:(e,t)=>e.map(t)}),j$=As.define();function $o(e,t,n){let s=e.facet(C$);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 rc=en.define({combine:e=>e.length?e[0]:!0});let whe=0;const mf=en.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 ko{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(mf.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(mf.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:s,eventObservers:r,provide:i,decorations:o}=n||{};return new ko(whe++,t,s,r,a=>{let l=[];return o&&l.push(Sv.of(c=>{let d=c.plugin(a);return d?o(d):Wn.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return ko.define((s,r)=>new t(s,r),n)}}class f4{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($o(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){$o(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){$o(t.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const R$=en.define(),s8=en.define(),Sv=en.define(),L$=en.define(),r8=en.define(),Cg=en.define(),D$=en.define();function qE(e,t){let n=e.state.facet(D$);if(!n.length)return n;let s=n.map(i=>i instanceof Function?i(e):i),r=[];return _s.spans(s,t.from,t.to,{point(){},span(i,o,a,l){let c=i-t.from,d=o-t.from,h=r;for(let f=a.length-1;f>=0;f--,l--){let m=a[f].spec.bidiIsolate,g;if(m==null&&(m=bhe(t.text,c,d)),l>0&&h.length&&(g=h[h.length-1]).to==c&&g.direction==m)g.to=d,h=g.inner;else{let y={from:c,to:d,direction:m,inner:[]};h.push(y),h=y.inner}}}}),r}const O$=en.define();function i8(e){let t=0,n=0,s=0,r=0;for(let i of e.state.facet(O$)){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 x0=en.define();class ma{constructor(t,n,s,r){this.fromA=t,this.toA=n,this.fromB=s,this.toB=r}join(t){return new ma(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,l=i<n.length?n[i]:1e9,c=Math.min(a,l);if(c==1e9)break;let d=c+o,h=c,f=d;for(;;)if(i<n.length&&n[i]<=h){let m=n[i+1];i+=2,h=Math.max(h,m);for(let g=r;g<t.length&&t[g].fromB<=h;g++)o=t[g].toA-t[g].toB;f=Math.max(f,m+o)}else if(r<t.length&&t[r].fromB<=h){let m=t[r++];h=Math.max(h,m.toB),f=Math.max(f,m.toA),o=m.toA-m.toB}else break;s.push(new ma(d,f,c,h))}return s}}class ew{constructor(t,n,s){this.view=t,this.state=n,this.transactions=s,this.flags=0,this.startState=t.state,this.changes=Or.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,l)=>r.push(new ma(i,o,a,l))),this.changedRanges=r}static create(t,n,s){return new ew(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 vhe=[];class ur{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 vhe}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&&nhe(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=Qu(this.dom),r=this.length?t>0:n>0;return new $a(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 Cv)return t;return null}static get(t){return t.cmTile}}class Tv extends ur{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=HE(r);else n.insertBefore(a.dom,r);s=a.dom}for(r=s?s.nextSibling:n.firstChild,i&&r&&(i.written=!0);r;)r=HE(r);this.length=o}}function HE(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Cv extends Tv{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=ur.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 yc)n.push(r),s=o,r=0;else{let a=i+o.length,l=t(o,i);if(l!==void 0)return l;i=a+o.breakAfter}}}resolveBlock(t,n){let s,r=-1,i,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(t>=l&&t<=c){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(s=void 0)}(l<t||t==c&&(n<-1?a.length:a.covers(1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,r=t-l),(c>t||t==l&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-l)}}),!s&&!i)throw new Error("No tile at position "+t);return s&&n<0||!i?{tile:s,offset:r}:{tile:i,offset:o}}}class yc extends Tv{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 yc(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class tm extends Tv{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,s){let r=new tm(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 l(d,h){for(let f=0,m=0;f<d.children.length&&m<=h;f++){let g=d.children[f],y=m+g.length;y>=h&&(g.isComposite()?l(g,h-m):(!o||o.isHidden&&(n>0||s&&_he(o,g)))&&(y>h||g.flags&32)?(o=g,a=h-m):(m<h||g.flags&16&&!g.isHidden)&&(r=g,i=h-m)),m=y}}l(this,t);let c=(n<0?r:o)||r||o;return c?{tile:c,offset:c==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):xhe(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 $a(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 l of o.children){if(a)return new $a(l.dom,0);l==s.tile&&(a=!0)}}return new $a(this.dom,0)}}function xhe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=rp(t);return n[n.length-1]||null}function _he(e,t){let n=e.coordsIn(0,1),s=t.coordsIn(0,1);return n&&s&&s.top<n.bottom}class wo extends Tv{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let s=new wo(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class Pd extends ur{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?Mt.chrome||Mt.gecko||(t?(r--,o=1):i<s&&(i++,o=-1)):n<0?r--:i<s&&i++;let a=$p(this.dom,r,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return Mt.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Pp(l,o<0):l||null}static of(t,n){let s=new Pd(n||document.createTextNode(t),t);return n||(s.flags|=2),s}}class ah extends ur{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 Pp(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 l=a?i.length-1:0;o=i[l],!(t>0?l==0:l==i.length-1||o.top<o.bottom);l+=a?-1:1);return Pp(o,!a)}}get overrideDOMText(){if(!this.length)return ts.empty;let{root:t}=this;if(!t)return ts.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 ah(i,s,t,r)}}class tw extends ur{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 ts.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class khe{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 l=r.children[i],c=l.breakAfter;(n>0?l.length<=t:l.length<t)&&(!s||s.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,i++,t-=l.length):(a.push({tile:r,index:i}),r=l,i=0,s&&l.isComposite()&&s.enter(l))}else if(i==r.length)o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++;else if(t){let l=Math.min(t,r.length-i);s&&s.skip(r,i,i+l),t-=l,i+=l}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 She{constructor(t,n,s,r){this.from=t,this.to=n,this.wrapper=s,this.rank=r}}class The{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 l=o.children[o.children.length-1]=new Pd(a.dom,a.text+t);l.parent=o}else o.append(r||Pd.of(t,(i=this.cache.find(Pd))===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)?m4(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 l=n.marks[a],c=r.lastChild;if(c instanceof wo&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(m4(l.dom)),r=c;else{if(this.cache.reused.get(l)){let h=ur.get(l.dom);h&&h.setDOM(m4(l.dom))}let d=wo.of(l.mark,l.dom);r.append(d),r=d}this.cache.reused.set(l,2)}let i=ur.get(t.text);i&&this.cache.reused.set(i,2);let o=new Pd(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=B$);let r=tm.start(t,n||((s=this.cache.find(tm))===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 wo&&a.mark.eq(o))r=a,n--;else{let l=wo.of(o,(s=this.cache.find(wo,c=>c.mark.eq(o)))===null||s===void 0?void 0:s.dom);r.append(l),r=l,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!UE(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Mt.ios&&UE(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(p4,0,32)||new ah(p4.toDOM(),0,p4,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 She(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 yc&&r.wrapper.eq(s.wrapper))n=r;else{let i=yc.of(s.wrapper,(t=this.cache.find(yc,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(tw,void 0,1);return s&&(s.flags=n),s||new tw(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Che{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 nw=[ah,tm,Pd,wo,tw,yc,Cv];for(let e=0;e<nw.length;e++)nw[e].bucket=e;class Ahe{constructor(t){this.view=t,this.buckets=nw.map(()=>[]),this.index=nw.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 l=(a+o)%i.length,c=i[l];if((!n||n(c))&&!this.reused.has(c))return i.splice(l,1),l<o&&this.index[r]--,this.reused.set(c,s),c}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 ah(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 Ehe{constructor(t,n,s,r,i){this.view=t,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new Ahe(t),this.text=new Che(t.state.doc),this.builder=new The(this.cache,new Cv(t,t.contentDOM),_s.iter(s)),this.cache.reused.set(n,2),this.old=new khe(n),this.reuseWalker={skip:(o,a,l)=>{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,l=a?a.fromA:this.old.root.length;if(l>r){let c=l-r;this.preserve(c,!o,!a),r=l,i+=c}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=Ihe(this.old),i=this.openMarks;this.old.advance(t,s?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?ah.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,r,i),i=r.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==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,l),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 tw)this.cache.add(o);else if(o instanceof wo)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 wo&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=i=0):o instanceof wo&&(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=_s.spans(this.decorations,t,n,{point:(a,l,c,d,h,f)=>{if(c instanceof ih){if(this.disallowBlockEffectsFor[f]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>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(l-a);else{let m=c.widget||(c.block?nm.block:nm.inline),g=Mhe(c),y=this.cache.findWidget(m,l-a,g)||ah.of(m,this.view,l-a,g);c.block?(c.startSide>0&&r.addLineStartIfNotCovered(s),r.addBlockWidget(y)):(r.ensureLine(s),r.addInlineWidget(y,d,h))}s=null}else s=Nhe(s,c);l>a&&this.text.skip(l-a)},span:(a,l,c,d)=>{for(let h=a;h<l;){let f=this.text.next(Math.min(512,l-h));f==null?(r.addLineStartIfNotCovered(s),r.addBreak(),h++):(r.ensureLine(s),r.addText(f,c,h==a?d:c.length),h+=f.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=ur.get(r);if(r==this.view.contentDOM)break;i instanceof wo?n.push(i):i!=null&&i.isLine()?s=i:i instanceof yc||(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM?s=new tm(r,B$):s||n.push(wo.of(new Sg({tagName:r.nodeName.toLowerCase(),attributes:she(r)}),r)))}return{line:s,marks:n}}}function UE(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 Mhe(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 B$={class:"cm-line"};function Nhe(e,t){let n=t.spec.attributes,s=t.spec.class;return!n&&!s||(e||(e={class:"cm-line"}),n&&J5(n,e),s&&(e.class+=" "+s)),e}function Ihe(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 wo&&t.push(s.mark)}return t}function m4(e){let t=ur.get(e);return t&&t.setDOM(e.cloneNode()),e}class nm extends $l{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}}nm.inline=new nm("span");nm.block=new nm("div");const p4=new class extends $l{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class VE{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Wn.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 Cv(t,t.contentDOM),this.updateInner([new ma(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:!zhe(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let i=r>-1?Rhe(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:h}=this.hasComposition;s=new ma(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,(Mt.ie||Mt.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=Ohe(o,this.decorations,t.changes);l.length&&(s=ma.extendWithRanges(s,l));let c=Phe(a,this.blockWrappers,t.changes);return c.length&&(s=ma.extendWithRanges(s,c)),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 Ehe(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&ur.get(n.text)&&a.cache.reused.set(ur.get(n.text),2),this.tile=a.run(t,n),U3(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=Mt.chrome||Mt.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 g4&&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(j$)&&(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(rc)||s.tabIndex>-1)&&sp(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,d;if(l.empty?d=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(d=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),Mt.gecko&&l.empty&&!this.hasComposition&&jhe(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new $a(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!ip(c.node,c.offset,h.anchorNode,h.anchorOffset)||!ip(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{Mt.android&&Mt.chrome&&s.contains(h.focusNode)&&$he(h.focusNode,s)&&(s.blur(),s.focus({preventScroll:!0}));let f=Bp(this.view.root);if(f)if(l.empty){if(Mt.gecko){let m=Lhe(c.node,c.offset);if(m&&m!=3){let g=(m==1?g$:y$)(c.node,c.offset);g&&(c=new $a(g.node,g.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let m=document.createRange();l.anchor>l.head&&([c,d]=[d,c]),m.setEnd(d.node,d.offset),m.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(m)}o&&this.view.root.activeElement==s&&(s.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new $a(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new $a(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&ip(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=Bp(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 l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.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=Ac(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&&!ur.get(i);)i=i.nextSibling;if(!i)return r+s.length;for(let o=0,a=r;;o++){let l=s.children[o];if(l.dom==i)return a;a+=l.length+l.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,l=!1;return this.tile.blockTiles((c,d)=>{if(c.isWidget()){if(c.flags&32&&d>=t)return!0;c.flags&16&&(i=!0)}else{let h=d+c.length;if(d<=t&&(s=c,r=t-d,i=h<t),h>=t&&!o&&(o=c,a=t-d,l=d>t),d>t&&o)return!0}}),!s&&!o?this.domAtPos(t,n):(i&&o?s=null:l&&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 g4?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 l=r(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=Oi(i.text,o);if(a==o)return null;let l=$p(i.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(c==l.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,l=this.view.textDirection==Ws.LTR,c=0,d=(h,f,m)=>{for(let g=0;g<h.children.length&&!(f>r);g++){let y=h.children[g],b=f+y.length,w=y.dom.getBoundingClientRect(),{height:v}=w;if(m&&!g&&(c+=w.top-m.top),y instanceof yc)b>s&&d(y,f,w);else if(f>=s&&(c>0&&n.push(-c),n.push(v+c),c=0,o)){let x=y.dom.lastChild,C=x?rp(x):[];if(C.length){let A=C[C.length-1],T=l?A.right-w.left:w.right-A.left;T>a&&(a=T,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=b)}}m&&g==h.children.length-1&&(c+=m.bottom-w.bottom),f=b+y.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?Ws.RTL:Ws.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let d=rp(c.dom);if(d.length!=1)return;a+=d[0].width,l=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});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=rp(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(Wn.replace({widget:new g4(a),block:!0,inclusive:!0,isBlockGap:!0}).range(s,o))}if(!i)break;s=i.to+1}return Wn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(Sv).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),s=!1,r=this.view.state.facet(r8).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(_s.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(L$).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(I$))try{if(d(this.view,t.range,t))return!0}catch(h){$o(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=i8(this.view),a={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(ohe(this.view.scrollDOM,a,s.head<s.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,c),-c),this.view.textDirection==Ws.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(){U3(this.tile)}}function U3(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let s of e.children)U3(s,t)}}function jhe(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 P$(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let s=g$(n.focusNode,n.focusOffset),r=y$(n.focusNode,n.focusOffset),i=s||r;if(r&&s&&r.node!=s.node){let a=ur.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)i=r;else if(e.docView.lastCompositionAfterCursor){let l=ur.get(s.node);!l||l.isText()&&l.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 Rhe(e,t,n){let s=P$(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 l=t.invertedDesc;return{range:new ma(l.mapPos(i),l.mapPos(o),i,o),text:r}}function Lhe(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 Dhe=class{constructor(){this.changes=[]}compareRange(t,n){If(t,n,this.changes)}comparePoint(t,n){If(t,n,this.changes)}boundChange(t){If(t,t,this.changes)}};function Ohe(e,t,n){let s=new Dhe;return _s.compare(e,t,n,s),s.changes}class Bhe{constructor(){this.changes=[]}compareRange(t,n){If(t,n,this.changes)}comparePoint(){}boundChange(t){If(t,t,this.changes)}}function Phe(e,t,n){let s=new Bhe;return _s.compare(e,t,n,s),s.changes}function $he(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 zhe(e,t){let n=!1;return t&&e.iterChangedRanges((s,r)=>{s<t.to&&r>t.from&&(n=!0)}),n}class g4 extends $l{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 Fhe(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(r.length==0)return Qe.cursor(t);i==0?n=1:i==r.length&&(n=-1);let o=i,a=i;n<0?o=Oi(r.text,i,!1):a=Oi(r.text,i);let l=s(r.text.slice(o,a));for(;o>0;){let c=Oi(r.text,o,!1);if(s(r.text.slice(c,o))!=l)break;o=c}for(;a<r.length;){let c=Oi(r.text,a);if(s(r.text.slice(a,c))!=l)break;a=c}return Qe.range(o+r.from,a+r.from)}function qhe(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,l=Math.floor((r-n.top-(e.defaultLineHeight-a)*.5)/a);i+=l*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Xde(o,i,e.state.tabSize)}function V3(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==to.Text&&(r.type!=i.type||(n<0?i.from<t:i.to>t)))&&(r=i)}}return r||s}return s}function Hhe(e,t,n,s){let r=V3(e,t.head,t.assoc||-1),i=!s||r.type!=to.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),l=e.posAtCoords({x:n==(a==Ws.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return Qe.cursor(l,n?-1:1)}return Qe.cursor(n?r.to:r.from,n?-1:1)}function WE(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,l=null;;){let c=yhe(r,i,o,a,n),d=_$;if(!c){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),c=e.visualLineSide(r,!n)}if(l){if(!l(d))return a}else{if(!s)return c;l=s(d)}a=c}}function Uhe(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return i=>{let o=s(i);return r==dc.Space&&(r=o),r==o}}function Vhe(e,t,n,s){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return Qe.cursor(r,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(c)o==null&&(o=c.left-l.left),a=i<0?c.top:c.bottom;else{let g=e.viewState.lineBlockAt(r);o==null&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(r-g.from))),a=(i<0?g.top:g.bottom)+d}let h=l.left+o,f=e.viewState.heightOracle.textHeight>>1,m=s??f;for(let g=0;;g+=f){let y=a+(m+g)*i,b=W3(e,{x:h,y},!1,i);if(n?y>l.bottom:y<l.top)return Qe.cursor(b.pos,b.assoc);let w=e.coordsAtPos(b.pos,b.assoc),v=w?(w.top+w.bottom)/2:0;if(!w||(n?v>a:v<a))return Qe.cursor(b.pos,b.assoc,void 0,o)}}function op(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 l=s||n||(t-i<o-t?-1:1);t=l<0?i:o,s=l}});if(!s)return t}}function $$(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=op(e,r.from,0);o!=r.from&&(i=Qe.cursor(o,-1))}else{let o=op(e,r.from,-1),a=op(e,r.to,1);(o!=r.from||a!=r.to)&&(i=Qe.range(r.from==r.anchor?o:a,r.from==r.head?o:a))}i&&(n||(n=t.ranges.slice()),n[s]=i)}return n?Qe.create(n,t.mainIndex):t}function y4(e,t,n){let s=op(e.state.facet(Cg).map(r=>r(e)),n.from,t.head>n.from?-1:1);return s==n.from?n:Qe.cursor(s,s<n.from?1:-1)}class bl{constructor(t,n){this.pos=t,this.assoc=n}}function W3(e,t,n,s){let r=e.contentDOM.getBoundingClientRect(),i=r.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-i,c;for(;;){if(l<0)return new bl(0,1);if(l>e.viewState.docHeight)return new bl(e.state.doc.length,-1);if(c=e.elementAtHeight(l),s==null)break;if(c.type==to.Text){if(s<0?c.to<e.viewport.from:c.from>e.viewport.to)break;let f=e.docView.coordsAt(s<0?c.from:c.to,s>0?-1:1);if(f&&(s<0?f.top<=l+i:f.bottom>=l+i))break}let h=e.viewState.heightOracle.textHeight/2;l=s>0?c.bottom+h:c.top-h}if(e.viewport.from>=c.to||e.viewport.to<=c.from){if(n)return null;if(c.type==to.Text){let h=qhe(e,r,c,o,a);return new bl(h,h==c.from?1:-1)}}if(c.type!=to.Text)return l<(c.top+c.bottom)/2?new bl(c.from,1):new bl(c.to,-1);let d=e.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=e.docView.lineAt(c.from,-2)),new Whe(e,o,a,e.textDirectionAt(c.from)).scanTile(d,c.from)}class Whe{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[Sl.find(r,t-s.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[Sl.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]),l,c,d=-1,h=1e9,f;e:for(;r<i;){let g=i-r,y=r+i>>1;t:if(o.has(y)){let w=r+Math.floor(Math.random()*g);for(let v=0;v<g;v++){if(!o.has(w)){y=w;break t}w++,w==i&&(w=r)}break e}o.add(y);let b=n(y);if(b)for(let w=0;w<b.length;w++){let v=b[w],x=0;if(!(v.width==0&&b.length>1)){if(v.bottom<this.y)(!l||l.bottom<v.bottom)&&(l=v),x=1;else if(v.top>this.y)(!c||c.top>v.top)&&(c=v),x=-1;else{let C=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,A=Math.abs(C);A<h&&(d=y,h=A,f=v),C&&(x=C<0==(this.baseDir==Ws.LTR)?-1:1)}x==-1&&(!a||this.baseDirAt(t[y],1))?i=y:x==1&&(!a||this.baseDirAt(t[y+1],-1))&&(r=y+1)}}}if(!f){if(!c&&!l)return{i:t[0],after:!1};let g=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(g.top+g.bottom)/2,this.scan(t,n,!0)}if(h&&!s){let{top:g,bottom:y}=f;if(l&&l.bottom>(g+g+y)/3)return this.y=l.bottom-1,this.scan(t,n,!0);if(c&&c.top<(g+y+y)/3)return this.y=c.top+1,this.scan(t,n,!0)}let m=(a?this.dirAt(t[d],1):this.baseDir)==Ws.LTR;return{i:d,after:this.x>(f.left+f.right)/2==m}}scanText(t,n){let s=[];for(let i=0;i<t.length;i=Oi(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 $p(t.dom,o,a).getClientRects()});return r.after?new bl(s[r.i+1],-1):new bl(s[r.i],1)}scanTile(t,n){if(!t.length)return new bl(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,l=n;a<t.children.length;a++)s.push(l+=t.children[a].length);let r=this.scan(s,a=>{let l=t.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:$p(l.dom,0,l.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 bl(s[r.i+1],-1):new bl(o,1)}}const Zh="";class Ghe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(ys.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Zh}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=ur.get(r),a=r.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&s!=this.view.contentDOM&&this.lineBreak();break}let l=ur.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Zb(r))||Zb(a)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!Yhe(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 l of this.points)l.node==t&&l.pos>this.text.length&&(l.pos-=o-1);s=i+o}}readNode(t){let n=ur.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+(Khe(t,s.node,s.offset)?n:0))}}function Khe(e,t,n){for(;;){if(!t||n<Ac(t))return!1;if(t==e)return!0;n=Qu(t)+1,t=t.parentNode}}function Yhe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let s=ur.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 GE{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class Qhe{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=z$(t.docView.tile,n,s,0))){let l=i||o?[]:Jhe(t),c=new Ghe(l,t);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Zhe(l,this.bounds.from)}else{let l=t.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!$3(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),d=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!$3(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=t.viewport;if((Mt.ios||Mt.chrome)&&a.main.empty&&c!=d&&(h.from>0||h.to<t.state.doc.length)){let f=Math.min(c,d),m=Math.max(c,d),g=h.from-f,y=h.to-m;(g==0||g==1||f==0)&&(y==0||y==-1||m==t.state.doc.length)&&(c=0,d=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Qe.range(d,c));else if(t.lineWrapping&&d==c&&!(a.main.empty&&a.main.head==c)&&t.inputState.lastTouchTime>Date.now()-100){let f=t.coordsAtPos(c,-1),m=0;f&&(m=t.inputState.lastTouchY<=f.bottom?-1:1),this.newSel=Qe.create([Qe.cursor(c,m)])}else this.newSel=Qe.single(d,c)}}}function z$(e,t,n,s){if(e.isComposite()){let r=-1,i=-1,o=-1,a=-1;for(let l=0,c=s,d=s;l<e.children.length;l++){let h=e.children[l],f=c+h.length;if(c<t&&f>n)return z$(h,t,n,c);if(f>=t&&r==-1&&(r=l,i=c),c>n&&h.dom.parentNode==e.dom){o=l,a=d;break}d=f,c=f+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 F$(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:l}=t.bounds,c=i.from,d=null;(o===8||Mt.android&&t.text.length<l-a)&&(c=i.to,d="end");let h=r.doc.sliceString(a,l,Zh),f,m;!i.empty&&i.from>=a&&i.to<=l&&(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(f=t.text.length-(h.length-(i.to-a)))?n={from:i.from,to:i.to,insert:ts.of(t.text.slice(i.from-a,f).split(Zh))}:(m=q$(h,t.text,c-a,d))&&(Mt.chrome&&o==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==Zh+Zh&&m.toB--,n={from:a+m.from,to:a+m.toA,insert:ts.of(t.text.slice(m.from,m.toB).split(Zh))})}else s&&(!e.hasFocus&&r.facet(rc)||sw(s,i))&&(s=null);if(!n&&!s)return!1;if((Mt.mac||Mt.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=Qe.single(s.main.anchor-1,s.main.head-1)),n={from:n.from,to:n.to,insert:ts.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)}:Mt.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(s&&(s=Qe.single(s.main.anchor-1,s.main.head-1)),n={from:i.from,to:i.to,insert:ts.of([" "])}),n)return o8(e,n,s,o);if(s&&!sw(s,i)){let a=!1,l="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(a=!0),l=e.inputState.lastSelectionOrigin,l=="select.pointer"&&(s=$$(r.facet(Cg).map(c=>c(e)),s))),e.dispatch({selection:s,scrollIntoView:a,userEvent:l}),!0}else return!1}function o8(e,t,n,s=-1){if(Mt.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(Mt.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&&jf(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)&&jf(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&jf(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=Xhe(e,t,n));return e.state.facet(A$).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function Xhe(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 l=t.from<i.from?-1:1,c=l<0?i.from:i.to,d=op(r.facet(Cg).map(h=>h(e)),c,l);t.from==d&&(o=d)}if(o>-1)s={changes:t,selection:Qe.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 l=i.from<t.from?r.sliceDoc(i.from,t.from):"",c=i.to>t.to?r.sliceDoc(t.to,i.to):"";s=r.replaceSelection(e.state.toText(l+t.insert.sliceString(0,void 0,e.state.lineBreak)+c))}else{let l=r.changes(t),c=n&&n.main.to<=l.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,f=n&&P$(e,n.main.head);if(f){let g=t.insert.length-(t.to-t.from);h={from:f.from,to:f.to-g}}else h=e.state.doc.lineAt(i.head);let m=i.to-t.to;s=r.changeByRange(g=>{if(g.from==i.from&&g.to==i.to)return{changes:l,range:c||g.map(l)};let y=g.to-m,b=y-d.length;if(e.state.sliceDoc(b,y)!=d||y>=h.from&&b<=h.to)return{range:g};let w=r.changes({from:b,to:y,insert:t.insert}),v=g.to-i.to;return{changes:w,range:c?Qe.range(Math.max(0,c.anchor+v),Math.max(0,c.head+v)):g.map(w)}})}else s={changes:l,selection:c&&r.selection.replaceRange(c)}}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 q$(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 l=Math.max(0,i-Math.min(o,a));n-=o+l-i}if(o<i&&e.length<t.length){let l=n<=i&&n>=o?i-n:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=n<=i&&n>=a?i-n:0;i-=l,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function Jhe(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 GE(n,s)),(r!=n||i!=s)&&t.push(new GE(r,i))),t}function Zhe(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?Qe.single(n+t,s+t):null}function sw(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class efe{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,Mt.safari&&t.contentDOM.addEventListener("input",()=>null),Mt.gecko&&pfe(t.contentDOM.ownerDocument)}handleEvent(t){!lfe(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=tfe(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&&U$.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Mt.android&&Mt.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return Mt.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=H$.find(s=>s.keyCode==t.keyCode))&&!t.ctrlKey||nfe.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,jf(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:Mt.safari&&!Mt.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 KE(e,t){return(n,s)=>{try{return t.call(e,s,n)}catch(r){$o(n.state,r)}}}function tfe(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 l=i[a];l&&n(a).handlers.push(KE(s.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(KE(s.value,l))}}for(let s in Fa)n(s).handlers.push(Fa[s]);for(let s in So)n(s).observers.push(So[s]);return t}const H$=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nfe="dthko",U$=[16,17,18,20,91,92,224,225],L1=6;function D1(e){return Math.max(0,e)*.7+8}function sfe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class rfe{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=f$(t.contentDOM),this.atoms=t.state.facet(Cg).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(ys.allowMultipleSelections)&&ife(t,n),this.dragging=afe(t,n)&&G$(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&&sfe(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 l=i8(this.view);t.clientX-l.left<=r+L1?n=-D1(r-t.clientX):t.clientX+l.right>=o-L1&&(n=D1(t.clientX-o)),t.clientY-l.top<=i+L1?s=-D1(i-t.clientY):t.clientY+l.bottom>=a-L1&&(s=D1(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=$$(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 ife(e,t){let n=e.state.facet(k$);return n.length?n[0](t):Mt.mac?t.metaKey:t.ctrlKey}function ofe(e,t){let n=e.state.facet(S$);return n.length?n[0](t):Mt.mac?!t.altKey:!t.ctrlKey}function afe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let s=Bp(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 lfe(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=ur.get(n))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(t))return!1;return!0}const Fa=Object.create(null),So=Object.create(null),V$=Mt.ie&&Mt.ie_version<15||Mt.ios&&Mt.webkit_version<604;function cfe(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(),W$(e,n.value)},50)}function Av(e,t,n){for(let s of e.facet(t))n=s(n,e);return n}function W$(e,t){t=Av(e.state,t8,t);let{state:n}=e,s,r=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(G3!=null&&n.selection.ranges.every(l=>l.empty)&&G3==i.toString()){let l=-1;s=n.changeByRange(c=>{let d=n.doc.lineAt(c.from);if(d.from==l)return{range:c};l=d.from;let h=n.toText((o?i.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:h},range:Qe.cursor(c.from+h.length)}})}else o?s=n.changeByRange(l=>{let c=i.line(r++);return{changes:{from:l.from,to:l.to,insert:c.text},range:Qe.cursor(l.from+c.length)}}):s=n.replaceSelection(i);e.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}So.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};So.wheel=So.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Fa.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);So.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")};So.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Fa.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(T$))if(n=s(e,t),n)break;if(!n&&t.button==0&&(n=dfe(e,t)),n){let s=!e.hasFocus;e.inputState.startMouseSelection(new rfe(e,t,n,s)),s&&e.observer.ignore(()=>{m$(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 YE(e,t,n,s){if(s==1)return Qe.cursor(t,n);if(s==2)return Fhe(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++,Qe.range(o,a)}}const ufe=Mt.ie&&Mt.ie_version<=11;let QE=null,XE=0,JE=0;function G$(e){if(!ufe)return e.detail;let t=QE,n=JE;return QE=e,JE=Date.now(),XE=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(XE+1)%3:1}function dfe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),s=G$(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 l=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,d=YE(e,l.pos,l.assoc,s);if(n.pos!=l.pos&&!o){let h=YE(e,n.pos,n.assoc,s),f=Math.min(h.from,d.from),m=Math.max(h.to,d.to);d=f<d.from?Qe.range(f,m,d.assoc):Qe.range(m,f,d.assoc)}return o?r.replaceRange(r.main.extend(d.from,d.to,d.assoc)):a&&s==1&&r.ranges.length>1&&(c=hfe(r,l.pos))?c:a?r.addRange(d):Qe.create([d])}}}function hfe(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 Qe.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}Fa.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=Qe.range(i,o))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",Av(e.state,n8,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Fa.dragend=e=>(e.inputState.draggedContent=null,!1);function ZE(e,t,n,s){if(n=Av(e.state,t8,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=s&&i&&ofe(e,t)?{from:i.from,to:i.to}:null,a={from:r,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Fa.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&&ZE(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 ZE(e,t,s,!0),!0}return!1};Fa.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=V$?null:t.clipboardData;return n?(W$(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cfe(e),!1)};function ffe(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 mfe(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:Av(e,n8,t.join(e.lineBreak)),ranges:n,linewise:s}}let G3=null;Fa.copy=Fa.cut=(e,t)=>{if(!sp(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:s,linewise:r}=mfe(e.state);if(!n&&!r)return!1;G3=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let i=V$?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(ffe(e,n),!1)};const K$=Lc.define();function Y$(e,t){let n=[];for(let s of e.facet(E$)){let r=s(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:K$.of(!0)}):null}function Q$(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Y$(e.state,t);n?e.dispatch(n):e.update([])}},10)}So.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),Q$(e)};So.blur=e=>{e.observer.clearSelectionRange(),Q$(e)};So.compositionstart=So.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};So.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,Mt.chrome&&Mt.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};So.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Fa.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],l=e.posAtDOM(a.startContainer,a.startOffset),c=e.posAtDOM(a.endContainer,a.endOffset);return o8(e,{from:l,to:c,insert:e.state.toText(i)},null),!0}}let r;if(Mt.chrome&&Mt.android&&(r=H$.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 Mt.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),Mt.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>So.compositionend(e,t),20),!1};const eM=new Set;function pfe(e){eM.has(e)||(eM.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const tM=["pre-wrap","normal","pre-line","break-spaces"];let sm=!1;function nM(){sm=!1}class gfe{constructor(t){this.lineWrapping=t,this.doc=ts.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 tM.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=tM.indexOf(t)>-1,l=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,l){this.heightSamples={};for(let c=0;c<o.length;c++){let d=o[c];d<0?c++:this.heightSamples[Math.floor(d*10)]=!0}}return l}}class yfe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Pa{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"?to.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 ih?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 Pa(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var zs=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(zs||(zs={}));const Dy=.001;class no{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)>Dy&&(sm=!0),this.height=t)}replace(t,n,s){return no.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:l,toA:c,fromB:d,toB:h}=r[a],f=i.lineAt(l,zs.ByPosNoHeight,s.setDoc(n),0,0),m=f.to>=c?f:i.lineAt(c,zs.ByPosNoHeight,s,0,0);for(h+=m.to-c,c=m.to;a>0&&f.from<=r[a-1].toA;)l=r[a-1].fromA,d=r[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,zs.ByPosNoHeight,s,0,0));d+=f.from-l,l=f.from;let g=a8.build(s.setDoc(o),t,d,h);i=rw(i,i.replace(l,c,g))}return i.updateHeight(s,0)}static empty(){return new Lo(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 wfe(no.of(t.slice(0,n)),o,no.of(t.slice(s)))}}function rw(e,t){return e==t?e:(e.constructor!=t.constructor&&(sm=!0),t)}no.prototype.size=1;const bfe=Wn.replace({});class X$ extends no{constructor(t,n,s){super(t,n),this.deco=s,this.spaceAbove=0}mainBlock(t,n){return new Pa(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 Pa(r,0,s,this.spaceAbove,bfe):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,zs.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 Lo extends X${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 Pa(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 Lo||r instanceof ui&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof ui?r=new Lo(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):no.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 ui extends no{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 l=Math.min(this.height,t.lineHeight*i);o=l/i,this.length>i+1&&(a=(this.height-l)/(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:l}=this.heightMetrics(n,r);if(n.lineWrapping){let c=r+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-s)/this.height))*this.length)),d=n.doc.lineAt(c),h=a+d.length*l,f=Math.max(s,t-h/2);return new Pa(d.from,d.length,f,h,0)}else{let c=Math.max(0,Math.min(o-i,Math.floor((t-s)/a))),{from:d,length:h}=n.doc.line(i+c);return new Pa(d,h,s+a*c,a,0)}}lineAt(t,n,s,r,i){if(n==zs.ByHeight)return this.blockAt(t,s,r,i);if(n==zs.ByPosNoHeight){let{from:m,to:g}=s.doc.lineAt(t);return new Pa(m,g-m,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(s,i),c=s.doc.lineAt(t),d=a+c.length*l,h=c.number-o,f=r+a*h+l*(c.from-i-h);return new Pa(c.from,c.length,Math.max(r,Math.min(f,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:l,perChar:c}=this.heightMetrics(s,i);for(let d=t,h=r;d<=n;){let f=s.doc.lineAt(d);if(d==t){let g=f.number-a;h+=l*g+c*(t-i-g)}let m=l+c*f.length;o(new Pa(f.from,f.length,h,m,0)),h+=m,d=f.to+1}}replace(t,n,s){let r=this.length-n;if(r>0){let i=s[s.length-1];i instanceof ui?s[s.length-1]=new ui(i.length+r):s.push(null,new ui(r-1))}if(t>0){let i=s[0];i instanceof ui?s[0]=new ui(t+i.length):s.unshift(new ui(t-1),null)}return no.of(s)}decomposeLeft(t,n){n.push(new ui(t-1),null)}decomposeRight(t,n){n.push(null,new ui(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),l=-1;for(r.from>n&&o.push(new ui(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++],f=0;h<0&&(f=-h,h=r.heights[r.index++]),l==-1?l=h:Math.abs(h-l)>=Dy&&(l=-2);let m=new Lo(d,h,f);m.outdated=!1,o.push(m),a+=d+1}a<=i&&o.push(null,new ui(i-a).updateHeight(t,a));let c=no.of(o);return(l<0||Math.abs(c.height-this.height)>=Dy||Math.abs(l-this.heightMetrics(t,n).perLine)>=Dy)&&(sm=!0),rw(this,c)}else(s||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class wfe extends no{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,l=n==zs.ByHeight?t<o:t<a,c=l?this.left.lineAt(t,n,s,r,i):this.right.lineAt(t,n,s,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let d=n==zs.ByPosNoHeight?zs.ByPosNoHeight:zs.ByPos;return l?c.join(this.right.lineAt(a,d,s,o,a)):this.left.lineAt(a,d,s,r,i).join(c)}forEachLine(t,n,s,r,i,o){let a=r+this.left.height,l=i+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,n,s,r,i,o),n>=l&&this.right.forEachLine(t,n,s,a,l,o);else{let c=this.lineAt(l,zs.ByPos,s,r,i);t<c.from&&this.left.forEachLine(t,c.from-1,s,r,i,o),c.to>=t&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,s,a,l,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&&sM(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),sM(i,a)}return no.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?no.of(this.break?[t,null,n]:[t,n]):(this.left=rw(this.left,t),this.right=rw(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,l=null;return r&&r.from<=n+i.length&&r.more?l=i=i.updateHeight(t,n,s,r):i.updateHeight(t,n,s),r&&r.from<=a+o.length&&r.more?l=o=o.updateHeight(t,a,s,r):o.updateHeight(t,a,s),l?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 sM(e,t){let n,s;e[t]==null&&(n=e[t-1])instanceof ui&&(s=e[t+1])instanceof ui&&e.splice(t-1,3,new ui(n.length+1+s.length))}const vfe=5;class a8{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 Lo?r.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new Lo(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 X$(o,r,s)):(o||i||r>=vfe)&&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 Lo(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let s=new ui(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 Lo)return t;let n=new Lo(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 Lo)&&!this.isCovered?this.nodes.push(new Lo(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 Lo&&r.updateHeight(this.oracle,s),s+=r?r.length:1;return this.nodes}static build(t,n,s,r){let i=new a8(s,t);return _s.spans(n,s,r,i,0),i.finish(s)}}function xfe(e,t,n){let s=new _fe;return _s.compare(e,t,n,s,0),s.changes}class _fe{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,s,r){(t<n||s&&s.heightRelevant||r&&r.heightRelevant)&&If(t,n,this.changes,5)}}function kfe(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),l=Math.min(r.innerHeight,n.bottom);for(let c=e.parentNode;c&&c!=s.body;)if(c.nodeType==1){let d=c,h=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&h.overflow!="visible"){let f=d.getBoundingClientRect();i=Math.max(i,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==e.parentNode?r.innerHeight:l,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?d.offsetParent:d.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Sfe(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 Tfe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class b4{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 Wn.replace({widget:new Cfe(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class Cfe extends $l{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 rM{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=iM,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ws.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let s=n.facet(s8).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new gfe(s),this.stateDeco=oM(n),this.heightMap=no.empty().applyChanges(this.stateDeco,ts.empty,this.heightOracle.setDoc(n.doc),[new ma(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=Wn.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 O1(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?iM:new l8(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(_0(t,this.scaler))})}update(t,n=null){this.state=t.state;let s=this.stateDeco;this.stateDeco=oM(this.state);let r=t.changedRanges,i=ma.extendWithRanges(r,xfe(s,this.stateDeco,t?t.changes:Or.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);nM(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||sm)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=i.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(c||!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(N$)&&(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"?Ws.RTL:Ws.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,d=0;if(a.width&&a.height){let{scaleX:A,scaleY:T}=h$(n,a);(A>.005&&Math.abs(this.scaleX-A)>.005||T>.005&&Math.abs(this.scaleY-T)>.005)&&(this.scaleX=A,this.scaleY=T,c|=16,o=l=!0)}let h=(parseInt(s.paddingTop)||0)*this.scaleY,f=(parseInt(s.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,c|=16);let m=f$(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=p$(this.scrollParent||t.win);let y=(this.printing?Tfe:kfe)(n,this.paddingTop),b=y.top-this.pixelViewport.top,w=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(l=!0)),!this.inView&&!this.scrollTarget&&!Sfe(t.dom))return 0;let x=a.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,c|=16),l){let A=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(A)&&(o=!0),o||r.lineWrapping&&Math.abs(x-this.contentDOMWidth)>r.charWidth){let{lineHeight:T,charWidth:_,textHeight:R}=t.docView.measureTextSize();o=T>0&&r.refresh(i,T,_,R,Math.max(5,x/_),A),o&&(t.docView.minWidth=0,c|=16)}b>0&&w>0?d=Math.max(b,w):b<0&&w<0&&(d=Math.min(b,w)),nM();for(let T of this.viewports){let _=T.from==this.viewport.from?A:t.docView.measureVisibleLineHeights(T);this.heightMap=(o?no.empty().applyChanges(this.stateDeco,ts.empty,this.heightOracle,[new ma(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new yfe(T.from,_))}sm&&(c|=2)}let C=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return C&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),c|=this.updateForViewport()),(c&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),c}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,l=new O1(r.lineAt(o-s*1e3,zs.ByHeight,i,0,0).from,r.lineAt(a+(1-s)*1e3,zs.ByHeight,i,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=r.lineAt(c,zs.ByPos,i,0,0),f;n.y=="center"?f=(h.top+h.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=h.top:f=h.bottom-d,l=new O1(r.lineAt(f-1e3/2,zs.ByHeight,i,0,0).from,r.lineAt(f+d+1e3/2,zs.ByHeight,i,0,0).to)}}return l}mapViewport(t,n){let s=n.mapPos(t.from,-1),r=n.mapPos(t.to,1);return new O1(this.heightMap.lineAt(s,zs.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,zs.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,zs.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,zs.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 b4(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!=Ws.LTR&&!s)return[];let a=[],l=(d,h,f,m)=>{if(h-d<i)return;let g=this.state.selection.main,y=[g.from];g.empty||y.push(g.to);for(let w of y)if(w>d&&w<h){l(d,w-10,f,m),l(w+10,h,f,m);return}let b=Efe(t,w=>w.from>=f.from&&w.to<=f.to&&Math.abs(w.from-d)<i&&Math.abs(w.to-h)<i&&!y.some(v=>w.from<v&&w.to>v));if(!b){if(h<f.to&&n&&s&&n.visibleRanges.some(x=>x.from<=h&&x.to>=h)){let x=n.moveToLineBoundary(Qe.cursor(h),!1,!0).head;x>d&&(h=x)}let w=this.gapSize(f,d,h,m),v=s||w<2e6?w:2e6;b=new b4(d,h,w,v)}a.push(b)},c=d=>{if(d.length<o||d.type!=to.Text)return;let h=Afe(d.from,d.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,m,g;if(s){let y=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,w;if(f!=null){let v=P1(h,f),x=((this.visibleBottom-this.visibleTop)/2+y)/d.height;b=v-x,w=v+x}else b=(this.visibleTop-d.top-y)/d.height,w=(this.visibleBottom-d.top+y)/d.height;m=B1(h,b),g=B1(h,w)}else{let y=h.total*this.heightOracle.charWidth,b=r*this.heightOracle.charWidth,w=0;if(y>2e6)for(let T of t)T.from>=d.from&&T.from<d.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=T.size-T.displaySize);let v=this.pixelViewport.left+w,x=this.pixelViewport.right+w,C,A;if(f!=null){let T=P1(h,f),_=((x-v)/2+b)/y;C=T-_,A=T+_}else C=(v-b)/y,A=(x+b)/y;m=B1(h,C),g=B1(h,A)}m>d.from&&l(d.from,m,d,h),g<d.to&&l(g,d.to,d,h)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(c):c(d);return a}gapSize(t,n,s,r){let i=P1(r,s)-P1(r,n);return this.heightOracle.lineWrapping?t.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(t){b4.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Wn.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=[];_s.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)||_0(this.heightMap.lineAt(t,zs.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)||_0(this.heightMap.lineAt(this.scaler.fromDOM(t),zs.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 _0(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 O1{constructor(t,n){this.from=t,this.to=n}}function Afe(e,t,n){let s=[],r=e,i=0;return _s.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 B1({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 P1(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 Efe(e,t){for(let n of e)if(t(n))return n}const iM={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function oM(e){let t=e.facet(Sv).filter(s=>typeof s!="function"),n=e.facet(r8).filter(s=>typeof s!="function");return n.length&&t.push(_s.join(n)),t}class l8{constructor(t,n,s){let r=0,i=0,o=0;this.viewports=s.map(({from:a,to:l})=>{let c=n.lineAt(a,zs.ByPos,t,0,0).top,d=n.lineAt(l,zs.ByPos,t,0,0).bottom;return r+=d-c,{from:a,to:l,top:c,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 l8?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 _0(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),s=t.toDOM(e.bottom);return new Pa(e.from,e.length,n,s-n,Array.isArray(e._content)?e._content.map(r=>_0(r,t)):e._content)}const $1=en.define({combine:e=>e.join(" ")}),K3=en.define({combine:e=>e.indexOf(!0)>-1}),Y3=Ku.newName(),J$=Ku.newName(),Z$=Ku.newName(),ez={"&light":"."+J$,"&dark":"."+Z$};function Q3(e,t,n){return new Ku(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 Mfe=Q3("."+Y3,{"&":{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"}},ez),Nfe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},w4=Mt.ie&&Mt.ie_version<=11;class Ife{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new ahe,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);(Mt.ie&&Mt.ie_version<=11||Mt.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&&Mt.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Mt.chrome&&Mt.chrome_version<126)&&(this.editContext=new Rfe(t),t.state.facet(rc)&&(t.contentDOM.editContext=this.editContext.editContext)),w4&&(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(rc)?s.root.activeElement!=this.dom:!sp(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}(Mt.ie&&Mt.ie_version<=11||Mt.android&&Mt.chrome)&&!s.state.selection.main.empty&&r.focusNode&&ip(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Bp(t.root);if(!n)return!1;let s=Mt.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&jfe(this.view,n)||n;if(!s||this.selectionRange.eq(s))return!1;let r=sp(this.dom,s);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&che(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,Nfe),w4&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),w4&&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&&jf(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&&sp(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 Qhe(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=F$(this.view,n);return this.view.state==s&&(n.domChanged||n.newSel&&!sw(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=aM(n,t.previousSibling||t.target.previousSibling,-1),r=aM(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(rc)!=t.state.facet(rc)&&(t.view.contentDOM.editContext=t.state.facet(rc)?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 aM(e,t,n){for(;t;){let s=ur.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 lM(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 ip(o.node,o.offset,r,i)&&([n,s,r,i]=[r,i,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}}function jfe(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return lM(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?lM(e,n):null}class Rfe{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),l=this.toEditorPos(s.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:s.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>s.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let d=q$(t.state.sliceDoc(a,l),s.text,(c?r.from:r.to)-a,c?"end":null);if(!d){let f=Qe.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));sw(f,r)||t.dispatch({selection:f,userEvent:"select"});return}let h={from:d.from+a,to:d.toA+a,insert:ts.of(s.text.slice(d.from,d.toB).split(`
`))};if((Mt.mac||Mt.android)&&h.from==o-1&&/^\. ?$/.test(s.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:ts.of([s.text.replace("."," ")])}),this.pendingContextChange=h,!t.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);o8(t,h,Qe.single(this.toEditorPos(s.selectionStart,f),this.toEditorPos(s.selectionEnd,f)))}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 l=t.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.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 l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){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(Wn.mark({attributes:{style:d}}).range(l,c))}}}t.dispatch({effects:j$.of(Wn.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=Bp(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,l,c)=>{if(s)return;let d=c.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(c)){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+c.length>3e4){s=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.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 Ft{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||lhe(t.parent)||document,this.viewState=new rM(this,t.state||ys.create(t)),t.scrollTo&&t.scrollTo.is(R1)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(mf).map(r=>new f4(r));for(let r of this.plugins)r.update(this);this.observer=new Ife(this),this.inputState=new efe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new VE(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 Pr?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 f of t){if(f.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=f.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;t.some(f=>f.annotation(K$))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Y$(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,d=null;if(c?(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(ys.phrases)!=this.state.facet(ys.phrases))return this.setState(i);r=ew.create(this,i,t),r.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of t){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:m}=f.state.selection,{x:g,y}=this.state.facet(Ft.cursorScrollMargin);h=new Rf(m.empty?m:Qe.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",y,g)}for(let m of f.effects)m.is(R1)&&(h=m.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=iw.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(x0)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet($1)!=r.state.facet($1)&&(this.viewState.mustMeasureContent=!0),(n||s||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(H3))try{f(r)}catch(m){$o(this.state,m,"update listener")}(l||d)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),d&&!F$(this,d)&&c.force&&jf(this.contentDOM,c.key,c.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 rM(this,t),this.plugins=t.facet(mf).map(s=>new f4(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new VE(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(mf),s=t.state.facet(mf);if(n!=s){let r=[];for(let i of s){let o=n.indexOf(i);if(o<0)r.push(new f4(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){$o(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(p$(s||this.win))i=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(r);i=m.from,o=m.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!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 c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let d=c.map(m=>{try{return m.read(this)}catch(g){return $o(this.state,g),cM}}),h=ew.create(this,this.state,[]),f=!1;h.flags|=l,n?n.flags|=l:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let m=0;m<c.length;m++)if(d[m]!=cM)try{let g=c[m];g.write&&g.write(d[m],this)}catch(g){$o(this.state,g)}if(f&&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(H3))a(n)}get themeClasses(){return Y3+" "+(this.state.facet(K3)?Z$:J$)+" "+this.state.facet($1)}updateAttrs(){let t=uM(this,R$,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(rc)?"true":"false",class:"cm-content",style:`${Mt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),uM(this,s8,n);let s=this.observer.ignore(()=>{let r=$E(this.contentDOM,this.contentAttrs,n),i=$E(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(Ft.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(x0);let t=this.state.facet(Ft.cspNonce);Ku.mount(this.root,this.styleModules.concat(Mfe).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 y4(this,t,WE(this,t,n,s))}moveByGroup(t,n){return y4(this,t,WE(this,t,n,s=>Uhe(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 Qe.cursor(i.side(n,r)+t.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,s=!0){return Hhe(this,t,n,s)}moveVertically(t,n,s){return y4(this,t,Vhe(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=W3(this,t,n);return s&&s.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),W3(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[Sl.find(i,t-r.from,-1,n)];return Pp(s,o.dir==Ws.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(M$)||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>Lfe)return x$(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||v$(i.isolates,s=qE(this,t))))return i.order;s||(s=qE(this,t));let r=ghe(t.text,n,s);return this.bidiCache.push(new iw(t.from,t.to,n,s,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Mt.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{m$(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 R1.of(new Rf(typeof t=="number"?Qe.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 R1.of(new Rf(Qe.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 ko.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ko.define(()=>({}),{eventObservers:t})}static theme(t,n){let s=Ku.newName(),r=[$1.of(s),x0.of(Q3(`.${s}`,t))];return n&&n.dark&&r.push(K3.of(!0)),r}static baseTheme(t){return Sh.lowest(x0.of(Q3("."+Y3,t,ez)))}static findFromDOM(t){var n;let s=t.querySelector(".cm-content"),r=s&&ur.get(s)||ur.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Ft.styleModule=x0;Ft.inputHandler=A$;Ft.clipboardInputFilter=t8;Ft.clipboardOutputFilter=n8;Ft.scrollHandler=I$;Ft.focusChangeEffect=E$;Ft.perLineTextDirection=M$;Ft.exceptionSink=C$;Ft.updateListener=H3;Ft.editable=rc;Ft.mouseSelectionStyle=T$;Ft.dragMovesSelection=S$;Ft.clickAddsSelectionRange=k$;Ft.decorations=Sv;Ft.blockWrappers=L$;Ft.outerDecorations=r8;Ft.atomicRanges=Cg;Ft.bidiIsolatedRanges=D$;Ft.cursorScrollMargin=en.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}}});Ft.scrollMargins=O$;Ft.darkTheme=K3;Ft.cspNonce=en.define({combine:e=>e.length?e[0]:""});Ft.contentAttributes=s8;Ft.editorAttributes=R$;Ft.lineWrapping=Ft.contentAttributes.of({class:"cm-lineWrapping"});Ft.announce=As.define();const Lfe=4096,cM={};class iw{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:Ws.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 iw(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return s}}function uM(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&&J5(o,n)}return n}const Dfe=Mt.mac?"mac":Mt.windows?"win":Mt.linux?"linux":"key";function Ofe(e,t){const n=e.split(/-(?!$)/);let s=n[n.length-1];s=="Space"&&(s=" ");let r,i,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))t=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),a&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function z1(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 Bfe=Sh.default(Ft.domEventHandlers({keydown(e,t){return Ffe(Pfe(t.state),e,t,"editor")}})),zp=en.define({enables:Bfe}),dM=new WeakMap;function Pfe(e){let t=e.facet(zp),n=dM.get(t);return n||dM.set(t,n=zfe(t.reduce((s,r)=>s.concat(r),[]))),n}let cu=null;const $fe=4e3;function zfe(e,t=Dfe){let n=Object.create(null),s=Object.create(null),r=(o,a)=>{let l=s[o];if(l==null)s[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,c,d)=>{var h,f;let m=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(w=>Ofe(w,t));for(let w=1;w<g.length;w++){let v=g.slice(0,w).join(" ");r(v,!0),m[v]||(m[v]={preventDefault:!0,stopPropagation:!1,run:[x=>{let C=cu={view:x,prefix:v,scope:o};return setTimeout(()=>{cu==C&&(cu=null)},$fe),!0}]})}let y=g.join(" ");r(y,!1);let b=m[y]||(m[y]={preventDefault:!1,stopPropagation:!1,run:((f=(h=m._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});l&&b.run.push(l),c&&(b.preventDefault=!0),d&&(b.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let d=n[c]||(n[c]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in d)d[f].run.push(m=>h(m,X3))}let l=o[t]||o.key;if(l)for(let c of a)i(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let X3=null;function Ffe(e,t,n,s){X3=t;let r=the(t),i=eu(r,0),o=Jh(i)==r.length&&r!=" ",a="",l=!1,c=!1,d=!1;cu&&cu.view==n&&cu.scope==s&&(a=cu.prefix+" ",U$.indexOf(t.keyCode)<0&&(c=!0,cu=null));let h=new Set,f=b=>{if(b){for(let w of b.run)if(!h.has(w)&&(h.add(w),w(n)))return b.stopPropagation&&(d=!0),!0;b.preventDefault&&(b.stopPropagation&&(d=!0),c=!0)}return!1},m=e[s],g,y;return m&&(f(m[a+z1(r,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Mt.windows&&t.ctrlKey&&t.altKey)&&!(Mt.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=Yu[t.keyCode])&&g!=r?(f(m[a+z1(g,t,!0)])||t.shiftKey&&(y=Dp[t.keyCode])!=r&&y!=g&&f(m[a+z1(y,t,!1)]))&&(l=!0):o&&t.shiftKey&&f(m[a+z1(r,t,!0)])&&(l=!0),!l&&f(m._any)&&(l=!0)),c&&(l=!0),l&&d&&t.stopPropagation(),X3=null,l}class Gd{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=tz(t);return[new Gd(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return qfe(t,n,s)}}function tz(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Ws.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function hM(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}),l=e.posAtCoords({x:i.right-1,y:o});return a==null||l==null?s:{from:Math.max(s.from,Math.min(a,l)),to:Math.min(s.to,Math.max(a,l))}}function qfe(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==Ws.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=tz(e),c=o.querySelector(".cm-line"),d=c&&window.getComputedStyle(c),h=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),f=a.right-(d?parseInt(d.paddingRight):0),m=V3(e,s,1),g=V3(e,r,-1),y=m.type==to.Text?m:null,b=g.type==to.Text?g:null;if(y&&(e.lineWrapping||m.widgetLineBreaks)&&(y=hM(e,s,1,y)),b&&(e.lineWrapping||g.widgetLineBreaks)&&(b=hM(e,r,-1,b)),y&&b&&y.from==b.from&&y.to==b.to)return v(x(n.from,n.to,y));{let A=y?x(n.from,null,y):C(m,!1),T=b?x(null,n.to,b):C(g,!0),_=[];return(y||m).to<(b||g).from-(y&&b?1:0)||m.widgetLineBreaks>1&&A.bottom+e.defaultLineHeight/2<T.top?_.push(w(h,A.bottom,f,T.top)):A.bottom<T.top&&e.elementAtHeight((A.bottom+T.top)/2).type==to.Text&&(A.bottom=T.top=(A.bottom+T.top)/2),v(A).concat(_).concat(v(T))}function w(A,T,_,R){return new Gd(t,A-l.left,T-l.top,Math.max(0,_-A),R-T)}function v({top:A,bottom:T,horizontal:_}){let R=[];for(let I=0;I<_.length;I+=2)R.push(w(_[I],A,_[I+1],T));return R}function x(A,T,_){let R=1e9,I=-1e9,k=[];function j($,F,B,Q,Y){let ne=e.coordsAtPos($,$==_.to?-2:2),P=e.coordsAtPos(B,B==_.from?2:-2);!ne||!P||(R=Math.min(ne.top,P.top,R),I=Math.max(ne.bottom,P.bottom,I),Y==Ws.LTR?k.push(i&&F?h:ne.left,i&&Q?f:P.right):k.push(!i&&Q?h:P.left,!i&&F?f:ne.right))}let N=A??_.from,L=T??_.to;for(let $ of e.visibleRanges)if($.to>N&&$.from<L)for(let F=Math.max($.from,N),B=Math.min($.to,L);;){let Q=e.state.doc.lineAt(F);for(let Y of e.bidiSpans(Q)){let ne=Y.from+Q.from,P=Y.to+Q.from;if(ne>=B)break;P>F&&j(Math.max(ne,F),A==null&&ne<=N,Math.min(P,B),T==null&&P>=L,Y.dir)}if(F=Q.to+1,F>=B)break}return k.length==0&&j(N,A==null,L,T==null,e.textDirection),{top:R,bottom:I,horizontal:k}}function C(A,T){let _=a.top+(T?A.top:A.bottom);return{top:_,bottom:_,horizontal:[]}}}function Hfe(e,t){return e.constructor==t.constructor&&e.eq(t)}class Ufe{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(Oy)!=t.state.facet(Oy)&&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(Oy);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)=>!Hfe(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,Mt.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Oy=en.define();function nz(e){return[ko.define(t=>new Ufe(t,e)),Oy.of(e)]}const rm=en.define({combine(e){return _v(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function Vfe(e={}){return[rm.of(e),Wfe,Gfe,Kfe,N$.of(!0)]}function sz(e){return e.startState.facet(rm)!=e.state.facet(rm)}const Wfe=nz({above:!0,markers(e){let{state:t}=e,n=t.facet(rm),s=[];for(let r of t.selection.ranges){let i=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(i&&Mt.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:Qe.cursor(r.head,r.assoc);for(let l of Gd.forRange(e,o,a))s.push(l)}}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=sz(e);return n&&fM(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){fM(t.state,e)},class:"cm-cursorLayer"});function fM(e,t){t.style.animationDuration=e.facet(rm).cursorBlinkRate+"ms"}const Gfe=nz({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 Gd.forRange(e,"cm-selectionBackground",r))t.push(i);if(Mt.ios&&!n.empty&&e.state.facet(rm).iosSelectionHandles){for(let r of Gd.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Qe.cursor(n.from,1)))t.push(r);for(let r of Gd.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Qe.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||sz(e)},class:"cm-selectionLayer"}),Kfe=Sh.highest(Ft.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"}}}}));function mM(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 Yfe(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 Qfe{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,l,c,d)=>r(d,c,c+a[0].length,a,l);else if(typeof s=="function")this.addMatch=(a,l,c,d)=>{let h=s(a,l,c);h&&d(c,c+a[0].length,h)};else if(s)this.addMatch=(a,l,c,d)=>d(c,c+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 rh,s=n.add.bind(n);for(let{from:r,to:i}of Yfe(t,this.maxLength))mM(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,l)=>{l>=t.view.viewport.from&&a<=t.view.viewport.to&&(s=Math.min(a,s),r=Math.max(l,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 l=t.state.doc.lineAt(o),c=l.to<a?t.state.doc.lineAt(a):l,d=Math.max(i.from,l.from),h=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){d=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let f=[],m,g=(y,b,w)=>f.push(w.range(y,b));if(l==c)for(this.regexp.lastIndex=d-l.from;(m=this.regexp.exec(l.text))&&m.index<h-l.from;)this.addMatch(m,t,m.index+l.from,g);else mM(t.state.doc,this.regexp,d,h,(y,b)=>this.addMatch(b,t,y,g));n=n.update({filterFrom:d,filterTo:h,filter:(y,b)=>y<d||b>h,add:f})}}return n}}const J3=/x/.unicode!=null?"gu":"g",Xfe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,J3),Jfe={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 v4=null;function Zfe(){var e;if(v4==null&&typeof document<"u"&&document.body){let t=document.body.style;v4=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return v4||!1}const By=en.define({combine(e){let t=_v(e,{render:null,specialChars:Xfe,addSpecialChars:null});return(t.replaceTabs=!Zfe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,J3)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,J3)),t}});function eme(e={}){return[By.of(e),tme()]}let pM=null;function tme(){return pM||(pM=ko.fromClass(class{constructor(e){this.view=e,this.decorations=Wn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(By)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Qfe({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,i=eu(t[0],0);if(i==9){let o=r.lineAt(s),a=n.state.tabSize,l=kg(o.text,a,s-o.from);return Wn.replace({widget:new ime((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Wn.replace({widget:new rme(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(By);e.startState.facet(By)!=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 nme="•";function sme(e){return e>=32?nme:e==10?"␤":String.fromCharCode(9216+e)}class rme extends $l{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=sme(this.code),s=t.state.phrase("Control character")+" "+(Jfe[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 ime extends $l{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}}class ome extends $l{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?rp(t.firstChild):[];if(!n.length)return null;let s=window.getComputedStyle(t.parentNode),r=Pp(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 gM(e){let t=ko.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Wn.set([Wn.widget({widget:new ome(e),side:1}).range(0)]):Wn.none}get decorations(){return this.view.state.doc.length?Wn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Ft.contentAttributes.of({"aria-placeholder":e})]:t}const F1="-10000px";class ame{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(l=>l);if(r===this.input){for(let l of this.tooltipViews)l.update&&l.update(t);return!1}let o=[],a=n?[]:null;for(let l=0;l<i.length;l++){let c=i[l],d=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(d=h)}if(d<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[d];a&&(a[l]=n[d]),h.update&&h.update(t)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(s=l.destroy)===null||s===void 0||s.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function lme(e={}){return Py.of(e)}function cme(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const Py=en.define({combine:e=>{var t,n,s;return{position:Mt.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)||cme}}}),yM=new WeakMap,rz=ko.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(Py);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 ame(e,iz,(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(Py);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=F1,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(Mt.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=i8(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(Py).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 l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:d}=c,h=e.pos[a],f=e.size[a];if(!h||l.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=F1;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,g=m?7:0,y=f.right-f.left,b=(t=yM.get(c))!==null&&t!==void 0?t:f.bottom-f.top,w=c.offset||dme,v=this.view.textDirection==Ws.LTR,x=f.width>s.right-s.left?v?s.left:s.right-f.width:v?Math.max(s.left,Math.min(h.left-(m?14:0)+w.x,s.right-y)):Math.min(Math.max(s.left,h.left-y+(m?14:0)-w.x),s.right-y),C=this.above[a];!l.strictSide&&(C?h.top-b-g-w.y<s.top:h.bottom+b+g+w.y>s.bottom)&&C==s.bottom-h.bottom>h.top-s.top&&(C=this.above[a]=!C);let A=(C?h.top-s.top:s.bottom-h.bottom)-g;if(A<b&&c.resize!==!1){if(A<this.view.defaultLineHeight){d.style.top=F1;continue}yM.set(c,b),d.style.height=(b=A)/i+"px"}else d.style.height&&(d.style.height="");let T=C?h.top-b-g-w.y:h.bottom+g+w.y,_=x+y;if(c.overlap!==!0)for(let R of o)R.left<_&&R.right>x&&R.top<T+b&&R.bottom>T&&(T=C?R.top-b-2-g:R.bottom+g+2);if(this.position=="absolute"?(d.style.top=(T-e.parent.top)/i+"px",bM(d,(x-e.parent.left)/r)):(d.style.top=T/i+"px",bM(d,x/r)),m){let R=h.left+(v?w.x:-w.x)-(x+14-7);m.style.left=R/r+"px"}c.overlap!==!0&&o.push({left:x,top:T,right:_,bottom:T+b}),d.classList.toggle("cm-tooltip-above",C),d.classList.toggle("cm-tooltip-below",!C),c.positioned&&c.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=F1}},{eventObservers:{scroll(){this.maybeMeasure()}}});function bM(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const ume=Ft.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"}}}),dme={x:0,y:0},iz=en.define({enables:[rz,ume]});function oz(e,t){let n=e.plugin(rz);if(!n)return null;let s=n.manager.tooltips.indexOf(t);return s<0?null:n.manager.tooltipViews[s]}class im extends Gu{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}im.prototype.elementClass="";im.prototype.toDOM=void 0;im.prototype.mapMode=Bo.TrackBefore;im.prototype.startSide=im.prototype.endSide=-1;im.prototype.point=!0;const hme=1024;let fme=0;class x4{constructor(t,n){this.from=t,this.to=n}}class Zn{constructor(t={}){this.id=fme++,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=ka.match(t)),n=>{let s=t(n);return s===void 0?null:[this,s]}}}Zn.closedBy=new Zn({deserialize:e=>e.split(" ")});Zn.openedBy=new Zn({deserialize:e=>e.split(" ")});Zn.group=new Zn({deserialize:e=>e.split(" ")});Zn.isolate=new Zn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Zn.contextHash=new Zn({perNode:!0});Zn.lookAhead=new Zn({perNode:!0});Zn.mounted=new Zn({perNode:!0});class ap{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[Zn.mounted.id]}}const mme=Object.create(null);class ka{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):mme,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new ka(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(Zn.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(Zn.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?s.name:r[i]];if(o)return o}}}}ka.none=new ka("",Object.create(null),0,8);const q1=new WeakMap,wM=new WeakMap;var pr;(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"})(pr||(pr={}));class gi{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=ap.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 eS(this.topNode,t)}cursorAt(t,n=0,s=0){let r=q1.get(this)||this.topNode,i=new eS(r);return i.moveTo(t,n),q1.set(this,i._tree),i}get topNode(){return new wa(this,0,0,null)}resolve(t,n=0){let s=Fp(q1.get(this)||this.topNode,t,n,!1);return q1.set(this,s),s}resolveInner(t,n=0){let s=Fp(wM.get(this)||this.topNode,t,n,!0);return wM.set(this,s),s}resolveStack(t,n=0){return yme(this,t,n)}iterate(t){let{enter:n,leave:s,from:r=0,to:i=this.length}=t,o=t.mode||0,a=(o&pr.IncludeAnonymous)>0;for(let l=this.cursor(o|pr.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=r&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&s&&(a||!l.type.isAnonymous)&&s(l),!l.nextSibling();){if(!l.parent())return;c=!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:d8(ka.none,this.children,this.positions,0,this.children.length,0,this.length,(n,s,r)=>new gi(this.type,n,s,r,this.propValues),t.makeTree||((n,s,r)=>new gi(ka.none,n,s,r)))}static build(t){return bme(t)}}gi.empty=new gi(ka.none,[],[],0);class c8{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 c8(this.buffer,this.index)}}class Xu{constructor(t,n,s){this.buffer=t,this.length=n,this.set=s}get type(){return ka.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 l=t;l!=n&&!(az(i,r,o[l+1],o[l+2])&&(a=l,s>0));l=o[l+3]);return a}slice(t,n,s){let r=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,l=0;a<n;){i[l++]=r[a++],i[l++]=r[a++]-s;let c=i[l++]=r[a++]-s;i[l++]=r[a++]-t,o=Math.max(o,c)}return new Xu(i,o,this.set)}}function az(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 Fp(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 wa&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=s?0:pr.IgnoreOverlays;if(s)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof wa&&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 lz{cursor(t=0){return new eS(this,t)}getChild(t,n=null,s=null){let r=vM(this,t,n,s);return r.length?r[0]:null}getChildren(t,n=null,s=null){return vM(this,t,n,s)}resolve(t,n=0){return Fp(this,t,n,!1)}resolveInner(t,n=0){return Fp(this,t,n,!0)}matchContext(t){return Z3(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}}class wa extends lz{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:l}=o._tree,c=n>0?a.length:-1;t!=c;t+=n){let d=a[t],h=l[t]+o.from,f;if(!(!(i&pr.EnterBracketed&&d instanceof gi&&(f=ap.get(d))&&!f.overlay&&f.bracketed&&s>=h&&s<=h+d.length)&&!az(r,s,h,h+d.length))){if(d instanceof Xu){if(i&pr.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,s-h,r);if(m>-1)return new vu(new pme(o,d,t,h),null,m)}else if(i&pr.IncludeAnonymous||!d.type.isAnonymous||u8(d)){let m;if(!(i&pr.IgnoreMounts)&&(m=ap.get(d))&&!m.overlay)return new wa(m.tree,h,t,o);let g=new wa(d,h,t,o);return i&pr.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,s,r,i)}}}if(i&pr.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&pr.IgnoreOverlays)&&(r=ap.get(this._tree))&&r.overlay){let i=t-this.from,o=s&pr.EnterBracketed&&r.bracketed;for(let{from:a,to:l}of r.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new wa(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 vM(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 Z3(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 pme{constructor(t,n,s,r){this.parent=t,this.buffer=n,this.index=s,this.start=r}}class vu extends lz{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 vu(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&pr.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 vu(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 vu(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 vu(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 gi(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function cz(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 wa&&n.index<0?null:n.parent,r=e.slice();return s?r[t]=s:r.splice(t,1),new gme(r,n)}class gme{constructor(t,n){this.heads=t,this.node=n}get next(){return cz(this.heads)}}function yme(e,t,n){let s=e.resolveInner(t,n),r=null;for(let i=s instanceof wa?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=ap.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new wa(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[s])).push(Fp(a,t,n,!1))}}return r?cz(r):s}class eS{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&~pr.EnterBracketed,t instanceof wa)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 wa?(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&pr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&pr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&pr.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&pr.IncludeAnonymous||a instanceof Xu||!a.type.isAnonymous||u8(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 vu(this.buffer,n,this.stack[r]);return this.bufferNode=new vu(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 Z3(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 Z3(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 u8(e){return e.children.some(t=>t instanceof Xu||!t.type.isAnonymous||u8(t))}function bme(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=hme,reused:i=[],minRepeatType:o=s.types.length}=e,a=Array.isArray(n)?new c8(n,n.length):n,l=s.types,c=0,d=0;function h(A,T,_,R,I,k){let{id:j,start:N,end:L,size:$}=a,F=d,B=c;if($<0)if(a.next(),$==-1){let le=i[j];_.push(le),R.push(N-A);return}else if($==-3){c=j;return}else if($==-4){d=j;return}else throw new RangeError(`Unrecognized record size: ${$}`);let Q=l[j],Y,ne,P=N-A;if(L-N<=r&&(ne=b(a.pos-T,I))){let le=new Uint16Array(ne.size-ne.skip),z=a.pos-ne.size,M=le.length;for(;a.pos>z;)M=w(ne.start,le,M);Y=new Xu(le,L-ne.start,s),P=ne.start-A}else{let le=a.pos-$;a.next();let z=[],M=[],re=j>=o?j:-1,U=0,W=L;for(;a.pos>le;)re>=0&&a.id==re&&a.size>=0?(a.end<=W-r&&(g(z,M,N,U,a.end,W,re,F,B),U=z.length,W=a.end),a.next()):k>2500?f(N,le,z,M):h(N,le,z,M,re,k+1);if(re>=0&&U>0&&U<z.length&&g(z,M,N,U,N,W,re,F,B),z.reverse(),M.reverse(),re>-1&&U>0){let J=m(Q,B);Y=d8(Q,z,M,0,z.length,0,L-N,J,J)}else Y=y(Q,z,M,L-N,F-L,B)}_.push(Y),R.push(P)}function f(A,T,_,R){let I=[],k=0,j=-1;for(;a.pos>T;){let{id:N,start:L,end:$,size:F}=a;if(F>4)a.next();else{if(j>-1&&L<j)break;j<0&&(j=$-r),I.push(N,L,$),k++,a.next()}}if(k){let N=new Uint16Array(k*4),L=I[I.length-2];for(let $=I.length-3,F=0;$>=0;$-=3)N[F++]=I[$],N[F++]=I[$+1]-L,N[F++]=I[$+2]-L,N[F++]=F;_.push(new Xu(N,I[2]-L,s)),R.push(L-A)}}function m(A,T){return(_,R,I)=>{let k=0,j=_.length-1,N,L;if(j>=0&&(N=_[j])instanceof gi){if(!j&&N.type==A&&N.length==I)return N;(L=N.prop(Zn.lookAhead))&&(k=R[j]+N.length+L)}return y(A,_,R,I,k,T)}}function g(A,T,_,R,I,k,j,N,L){let $=[],F=[];for(;A.length>R;)$.push(A.pop()),F.push(T.pop()+_-I);A.push(y(s.types[j],$,F,k-I,N-k,L)),T.push(I-_)}function y(A,T,_,R,I,k,j){if(k){let N=[Zn.contextHash,k];j=j?[N].concat(j):[N]}if(I>25){let N=[Zn.lookAhead,I];j=j?[N].concat(j):[N]}return new gi(A,T,_,R,j)}function b(A,T){let _=a.fork(),R=0,I=0,k=0,j=_.end-r,N={size:0,start:0,skip:0};e:for(let L=_.pos-A;_.pos>L;){let $=_.size;if(_.id==T&&$>=0){N.size=R,N.start=I,N.skip=k,k+=4,R+=4,_.next();continue}let F=_.pos-$;if($<0||F<L||_.start<j)break;let B=_.id>=o?4:0,Q=_.start;for(_.next();_.pos>F;){if(_.size<0)if(_.size==-3||_.size==-4)B+=4;else break e;else _.id>=o&&(B+=4);_.next()}I=Q,R+=$,k+=B}return(T<0||R==A)&&(N.size=R,N.start=I,N.skip=k),N.size>4?N:void 0}function w(A,T,_){let{id:R,start:I,end:k,size:j}=a;if(a.next(),j>=0&&R<o){let N=_;if(j>4){let L=a.pos-(j-4);for(;a.pos>L;)_=w(A,T,_)}T[--_]=N,T[--_]=k-A,T[--_]=I-A,T[--_]=R}else j==-3?c=R:j==-4&&(d=R);return _}let v=[],x=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,v,x,-1,0);let C=(t=e.length)!==null&&t!==void 0?t:v.length?x[0]+v[0].length:0;return new gi(l[e.topID],v.reverse(),x.reverse(),C)}const xM=new WeakMap;function $y(e,t){if(!e.isAnonymous||t instanceof Xu||t.type!=e)return 1;let n=xM.get(t);if(n==null){n=1;for(let s of t.children){if(s.type!=e||!(s instanceof gi)){n=1;break}n+=$y(e,s)}xM.set(t,n)}return n}function d8(e,t,n,s,r,i,o,a,l){let c=0;for(let g=s;g<r;g++)c+=$y(e,t[g]);let d=Math.ceil(c*1.5/8),h=[],f=[];function m(g,y,b,w,v){for(let x=b;x<w;){let C=x,A=y[x],T=$y(e,g[x]);for(x++;x<w;x++){let _=$y(e,g[x]);if(T+_>=d)break;T+=_}if(x==C+1){if(T>d){let _=g[C];m(_.children,_.positions,0,_.children.length,y[C]+v);continue}h.push(g[C])}else{let _=y[x-1]+g[x-1].length-A;h.push(d8(e,g,y,C,x,A,_,null,l))}f.push(A+v-i)}}return m(t,n,s,r,0),(a||l)(h,f,o)}class Kd{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 Kd(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,l=0,c=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-l>=s)for(;o&&o.from<h;){let f=o;if(l>=f.from||h<=f.to||c){let m=Math.max(f.from,l)-c,g=Math.min(f.to,h)-c;f=m>=g?null:new Kd(m,g,f.tree,f.offset+c,a>0,!!d)}if(f&&r.push(f),o.to>h)break;o=i<t.length?t[i++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return r}}class wme{startParse(t,n,s){return typeof t=="string"&&(t=new vme(t)),s=s?s.length?s.map(r=>new x4(r.from,r.to)):[new x4(0,0)]:[new x4(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 vme{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 Zn({perNode:!0});let xme=0;class la{constructor(t,n,s,r){this.name=t,this.set=n,this.base=s,this.modified=r,this.id=xme++}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 la&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new la(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 ow(t);return s=>s.modified.indexOf(n)>-1?s:ow.get(s.base||s,s.modified.concat(n).sort((r,i)=>r.id-i.id))}}let _me=0;class ow{constructor(t){this.name=t,this.instances=[],this.id=_me++}static get(t,n){if(!n.length)return t;let s=n[0].instances.find(a=>a.base==t&&kme(n,a.modified));if(s)return s;let r=[],i=new la(t.name,r,t,n);for(let a of n)a.instances.push(i);let o=Sme(n);for(let a of t.set)if(!a.modified.length)for(let l of o)r.push(ow.get(a,l));return i}}function kme(e,t){return e.length==t.length&&e.every((n,s)=>n==t[s])}function Sme(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 Tme(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 f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+r);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==r.length)break;let m=r[h++];if(h==r.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+r);a=r.slice(h)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+r);let d=new qp(s,o,l>0?i.slice(0,l):null);t[c]=d.sort(t[c])}}return uz.add(t)}const uz=new Zn({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 qp(r.tags,r.mode,r.context);n?n.next=i:s=i,n=i}return s}});class qp{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}}qp.empty=new qp([],2,null);function dz(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 l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:s}}function Cme(e,t){let n=null;for(let s of e){let r=s.style(t);r&&(n=n?n+" "+r:r)}return n}function Ame(e,t,n,s=0,r=e.length){let i=new Eme(s,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),s,r,"",i.highlighters),i.flush(r)}class Eme{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:l}=t;if(a>=s||l<=n)return;o.isTop&&(i=this.highlighters.filter(m=>!m.scope||m.scope(o)));let c=r,d=Mme(t)||qp.empty,h=Cme(i,d.tags);if(h&&(c&&(c+=" "),c+=h,d.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(n,a),c),d.opaque)return;let f=t.tree&&t.tree.prop(Zn.mounted);if(f&&f.overlay){let m=t.node.enter(f.overlay[0].from+a,1),g=this.highlighters.filter(b=>!b.scope||b.scope(f.tree.type)),y=t.firstChild();for(let b=0,w=a;;b++){let v=b<f.overlay.length?f.overlay[b]:null,x=v?v.from+a:l,C=Math.max(n,w),A=Math.min(s,x);if(C<A&&y)for(;t.from<A&&(this.highlightRange(t,C,A,r,i),this.startSpan(Math.min(A,t.to),c),!(t.to>=x||!t.nextSibling())););if(!v||x>s)break;w=v.to+a,w>n&&(this.highlightRange(m.cursor(),Math.max(n,v.from+a),Math.min(s,w),"",g),this.startSpan(Math.min(s,w),c))}y&&t.parent()}else if(t.firstChild()){f&&(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),c)}while(t.nextSibling());t.parent()}}}function Mme(e){let t=e.type.prop(uz);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const mt=la.define,H1=mt(),tu=mt(),_M=mt(tu),kM=mt(tu),nu=mt(),U1=mt(nu),_4=mt(nu),hl=mt(),bd=mt(hl),il=mt(),ol=mt(),tS=mt(),s0=mt(tS),V1=mt(),kt={comment:H1,lineComment:mt(H1),blockComment:mt(H1),docComment:mt(H1),name:tu,variableName:mt(tu),typeName:_M,tagName:mt(_M),propertyName:kM,attributeName:mt(kM),className:mt(tu),labelName:mt(tu),namespace:mt(tu),macroName:mt(tu),literal:nu,string:U1,docString:mt(U1),character:mt(U1),attributeValue:mt(U1),number:_4,integer:mt(_4),float:mt(_4),bool:mt(nu),regexp:mt(nu),escape:mt(nu),color:mt(nu),url:mt(nu),keyword:il,self:mt(il),null:mt(il),atom:mt(il),unit:mt(il),modifier:mt(il),operatorKeyword:mt(il),controlKeyword:mt(il),definitionKeyword:mt(il),moduleKeyword:mt(il),operator:ol,derefOperator:mt(ol),arithmeticOperator:mt(ol),logicOperator:mt(ol),bitwiseOperator:mt(ol),compareOperator:mt(ol),updateOperator:mt(ol),definitionOperator:mt(ol),typeOperator:mt(ol),controlOperator:mt(ol),punctuation:tS,separator:mt(tS),bracket:s0,angleBracket:mt(s0),squareBracket:mt(s0),paren:mt(s0),brace:mt(s0),content:hl,heading:bd,heading1:mt(bd),heading2:mt(bd),heading3:mt(bd),heading4:mt(bd),heading5:mt(bd),heading6:mt(bd),contentSeparator:mt(hl),list:mt(hl),quote:mt(hl),emphasis:mt(hl),strong:mt(hl),link:mt(hl),monospace:mt(hl),strikethrough:mt(hl),inserted:mt(),deleted:mt(),changed:mt(),invalid:mt(),meta:V1,documentMeta:mt(V1),annotation:mt(V1),processingInstruction:mt(V1),definition:la.defineModifier("definition"),constant:la.defineModifier("constant"),function:la.defineModifier("function"),standard:la.defineModifier("standard"),local:la.defineModifier("local"),special:la.defineModifier("special")};for(let e in kt){let t=kt[e];t instanceof la&&(t.name=e)}dz([{tag:kt.link,class:"tok-link"},{tag:kt.heading,class:"tok-heading"},{tag:kt.emphasis,class:"tok-emphasis"},{tag:kt.strong,class:"tok-strong"},{tag:kt.keyword,class:"tok-keyword"},{tag:kt.atom,class:"tok-atom"},{tag:kt.bool,class:"tok-bool"},{tag:kt.url,class:"tok-url"},{tag:kt.labelName,class:"tok-labelName"},{tag:kt.inserted,class:"tok-inserted"},{tag:kt.deleted,class:"tok-deleted"},{tag:kt.literal,class:"tok-literal"},{tag:kt.string,class:"tok-string"},{tag:kt.number,class:"tok-number"},{tag:[kt.regexp,kt.escape,kt.special(kt.string)],class:"tok-string2"},{tag:kt.variableName,class:"tok-variableName"},{tag:kt.local(kt.variableName),class:"tok-variableName tok-local"},{tag:kt.definition(kt.variableName),class:"tok-variableName tok-definition"},{tag:kt.special(kt.variableName),class:"tok-variableName2"},{tag:kt.definition(kt.propertyName),class:"tok-propertyName tok-definition"},{tag:kt.typeName,class:"tok-typeName"},{tag:kt.namespace,class:"tok-namespace"},{tag:kt.className,class:"tok-className"},{tag:kt.macroName,class:"tok-macroName"},{tag:kt.propertyName,class:"tok-propertyName"},{tag:kt.operator,class:"tok-operator"},{tag:kt.comment,class:"tok-comment"},{tag:kt.meta,class:"tok-meta"},{tag:kt.invalid,class:"tok-invalid"},{tag:kt.punctuation,class:"tok-punctuation"}]);var k4;const k0=new Zn,Nme=new Zn;class Tl{constructor(t,n,s=[],r=""){this.data=t,this.name=r,ys.prototype.hasOwnProperty("tree")||Object.defineProperty(ys.prototype,"tree",{get(){return qa(this)}}),this.parser=n,this.extension=[am.of(this),ys.languageData.of((i,o,a)=>{let l=SM(i,o,a),c=l.type.prop(k0);if(!c)return[];let d=i.facet(c),h=l.type.prop(Nme);if(h){let f=l.resolve(o-l.from,a);for(let m of h)if(m.test(f,i)){let g=i.facet(m.facet);return m.type=="replace"?g:g.concat(d)}}return d})].concat(s)}isActiveAt(t,n,s=-1){return SM(t,n,s).type.prop(k0)==this.data}findRegions(t){let n=t.facet(am);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(k0)==this.data){s.push({from:o,to:o+i.length});return}let a=i.prop(Zn.mounted);if(a){if(a.tree.prop(k0)==this.data){if(a.overlay)for(let l of a.overlay)s.push({from:l.from+o,to:l.to+o});else s.push({from:o,to:o+i.length});return}else if(a.overlay){let l=s.length;if(r(a.tree,a.overlay[0].from+o),s.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof gi&&r(c,i.positions[l]+o)}};return r(qa(t),0),s}get allowsNesting(){return!0}}Tl.setState=As.define();function SM(e,t,n){let s=e.facet(am),r=qa(e).topNode;if(!s||s.allowsNesting)for(let i=r;i;i=i.enter(t,n,pr.ExcludeBuffers|pr.EnterBracketed))i.type.isTop&&(r=i);return r}function qa(e){let t=e.field(Tl.state,!1);return t?t.tree:gi.empty}class Ime{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 r0=null;class aw{constructor(t,n,s=[],r,i,o,a,l){this.parser=t,this.state=n,this.fragments=s,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,s){return new aw(t,n,[],gi.empty,0,s,[],null)}startParse(){return this.parser.startParse(new Ime(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=gi.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(Kd.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(Kd.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=r0;r0=this;try{return t()}finally{r0=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=TM(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 l=[];if(t.iterChangedRanges((c,d,h,f)=>l.push({fromA:c,toA:d,fromB:h,toB:f})),s=Kd.applyChanges(s,l),r=gi.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let d=t.mapPos(c.from,1),h=t.mapPos(c.to,-1);d<h&&a.push({from:d,to:h})}}}return new aw(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=TM(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 wme{createParse(n,s,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let l=r0;if(l){for(let c of r)l.tempSkipped.push(c);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new gi(ka.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 r0}}function TM(e,t,n){return Kd.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class om{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 om(n)}static init(t){let n=Math.min(3e3,t.doc.length),s=aw.create(t.facet(am).parser,t,{from:0,to:n});return s.work(20,n)||s.takeTree(),new om(s)}}Tl.state=Pl.define({create:om.init,update(e,t){for(let n of t.effects)if(n.is(Tl.setState))return n.value;return t.startState.facet(am)!=t.state.facet(am)?om.init(t.state):e.apply(t)}});let hz=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(hz=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const S4=typeof navigator<"u"&&(!((k4=navigator.scheduling)===null||k4===void 0)&&k4.isInputPending)?()=>navigator.scheduling.isInputPending():null,jme=ko.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(Tl.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(Tl.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=hz(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(Tl.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!S4?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<r&&s.doc.length>r+1e3,l=i.context.work(()=>S4&&S4()||Date.now()>o,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Tl.setState.of(new om(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>$o(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()}}}),am=en.define({combine(e){return e.length?e[0]:null},enables:e=>[Tl.state,jme,Ft.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),Rme=en.define(),h8=en.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 lw(e){let t=e.facet(h8);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function cw(e,t){let n="",s=e.tabSize,r=e.facet(h8)[0];if(r=="	"){for(;t>=s;)n+="	",t-=s;r=" "}for(let i=0;i<t;i++)n+=r;return n}function fz(e,t){e instanceof ys&&(e=new Ev(e));for(let s of e.state.facet(Rme)){let r=s(e,t);if(r!==void 0)return r}let n=qa(e.state);return n.length>=t?Dme(e,n,t):null}class Ev{constructor(t,n={}){this.state=t,this.options=n,this.unit=lw(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 kg(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 Lme=new Zn;function Dme(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 mz(s,e,n)}function mz(e,t,n){for(let s=e;s;s=s.next){let r=Bme(s.node);if(r)return r(f8.create(t,n,s))}return 0}function Ome(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Bme(e){let t=e.type.prop(Lme);if(t)return t;let n=e.firstChild,s;if(n&&(s=n.type.prop(Zn.closedBy))){let r=e.lastChild,i=r&&s.indexOf(r.name)>-1;return o=>Fme(o,!0,1,void 0,i&&!Ome(o)?r.from:void 0)}return e.parent==null?Pme:null}function Pme(){return 0}class f8 extends Ev{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 f8(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($me(s,t))break;n=this.state.doc.lineAt(s.from)}return this.lineIndent(n.from)}continue(){return mz(this.context.next,this.base,this.pos)}}function $me(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function zme(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 l=t.childAfter(a);if(!l||l==s)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function Fme(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,l=zme(e);return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}class Mv{constructor(t,n){this.specs=t;let s;function r(a){let l=Ku.newName();return(s||(s=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof Tl?a=>a.prop(k0)==o.data:o?a=>a==o:void 0,this.style=dz(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=s?new Ku(s):null,this.themeType=n.themeType}static define(t,n){return new Mv(t,n||{})}}const nS=en.define(),pz=en.define({combine(e){return e.length?[e[0]]:null}});function T4(e){let t=e.facet(nS);return t.length?t:e.facet(pz)}function qme(e,t){let n=[Ume],s;return e instanceof Mv&&(e.module&&n.push(Ft.styleModule.of(e.module)),s=e.themeType),t!=null&&t.fallback?n.push(pz.of(e)):s?n.push(nS.computeN([Ft.darkTheme],r=>r.facet(Ft.darkTheme)==(s=="dark")?[e]:[])):n.push(nS.of(e)),n}class Hme{constructor(t){this.markCache=Object.create(null),this.tree=qa(t.state),this.decorations=this.buildDeco(t,T4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=qa(t.state),s=T4(t.state),r=s!=T4(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 Wn.none;let s=new rh;for(let{from:r,to:i}of t.visibleRanges)Ame(this.tree,n,(o,a,l)=>{s.add(o,a,this.markCache[l]||(this.markCache[l]=Wn.mark({class:l})))},r,i);return s.finish()}}const Ume=Sh.high(ko.fromClass(Hme,{decorations:e=>e.decorations})),Vme=Mv.define([{tag:kt.meta,color:"#404740"},{tag:kt.link,textDecoration:"underline"},{tag:kt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:kt.emphasis,fontStyle:"italic"},{tag:kt.strong,fontWeight:"bold"},{tag:kt.strikethrough,textDecoration:"line-through"},{tag:kt.keyword,color:"#708"},{tag:[kt.atom,kt.bool,kt.url,kt.contentSeparator,kt.labelName],color:"#219"},{tag:[kt.literal,kt.inserted],color:"#164"},{tag:[kt.string,kt.deleted],color:"#a11"},{tag:[kt.regexp,kt.escape,kt.special(kt.string)],color:"#e40"},{tag:kt.definition(kt.variableName),color:"#00f"},{tag:kt.local(kt.variableName),color:"#30a"},{tag:[kt.typeName,kt.namespace],color:"#085"},{tag:kt.className,color:"#167"},{tag:[kt.special(kt.variableName),kt.macroName],color:"#256"},{tag:kt.definition(kt.propertyName),color:"#00c"},{tag:kt.comment,color:"#940"},{tag:kt.invalid,color:"#f00"}]),Wme=1e4,Gme="()[]{}",Kme=new Zn;function sS(e,t,n){let s=e.prop(t<0?Zn.openedBy:Zn.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 rS(e){let t=e.type.prop(Kme);return t?t(e.node):e}function pf(e,t,n,s={}){let r=s.maxScanDistance||Wme,i=s.brackets||Gme,o=qa(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let c=sS(l.type,n,i);if(c&&l.from<l.to){let d=rS(l);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return Yme(e,t,n,l,d,c,i)}}return Qme(e,t,n,o,a.type,r,i)}function Yme(e,t,n,s,r,i,o){let a=s.parent,l={from:r.from,to:r.to},c=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(c==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let h=rS(d);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(sS(d.type,n,o))c++;else if(sS(d.type,-n,o)){if(c==0){let h=rS(d);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(n<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function Qme(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),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={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 f=0;!d.next().done&&f<=i;){let m=d.value;n<0&&(f+=m.length);let g=t+f*n;for(let y=n>0?0:m.length-1,b=n>0?m.length:-1;y!=b;y+=n){let w=o.indexOf(m[y]);if(!(w<0||s.resolveInner(g+y,1).type!=r))if(w%2==0==n>0)h++;else{if(h==1)return{start:c,end:{from:g+y,to:g+y+1},matched:w>>1==l>>1};h--}}n>0&&(f+=m.length)}return d.done?{start:c,matched:!1}:null}const Xme=Object.create(null),CM=[ka.none],AM=[],EM=Object.create(null),Jme=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"]])Jme[e]=Zme(Xme,t);function C4(e,t){AM.indexOf(e)>-1||(AM.push(e),console.warn(t))}function Zme(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let c of a.split(".")){let d=e[c]||kt[c];d?typeof d=="function"?l.length?l=l.map(d):C4(c,`Modifier ${c} used at start of tag`):l.length?C4(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:C4(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let s=t.replace(/ /g,"_"),r=s+" "+n.map(a=>a.id),i=EM[r];if(i)return i.id;let o=EM[r]=ka.define({id:CM.length,name:s,props:[Tme({[s]:n})]});return CM.push(o),o.id}Ws.RTL,Ws.LTR;const e0e=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),s=p8(e.state,n.from);return s.line?t0e(e):s.block?s0e(e):!1};function m8(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 t0e=m8(o0e,0),n0e=m8(gz,0),s0e=m8((e,t)=>gz(e,t,i0e(t)),0);function p8(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const i0=50;function r0e(e,{open:t,close:n},s,r){let i=e.sliceDoc(s-i0,s),o=e.sliceDoc(r,r+i0),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-t.length,c)==t&&o.slice(l,l+n.length)==n)return{open:{pos:s-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let d,h;r-s<=2*i0?d=h=e.sliceDoc(s,r):(d=e.sliceDoc(s,s+i0),h=e.sliceDoc(r-i0,r));let f=/^\s*/.exec(d)[0].length,m=/\s*$/.exec(h)[0].length,g=h.length-m-n.length;return d.slice(f,f+t.length)==t&&h.slice(g,g+n.length)==n?{open:{pos:s+f+t.length,margin:/\s/.test(d.charAt(f+t.length))?1:0},close:{pos:r-m-n.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function i0e(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 gz(e,t,n=t.selection.ranges){let s=n.map(i=>p8(t,i.from).block);if(!s.every(i=>i))return null;let r=n.map((i,o)=>r0e(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 l=s[o],{open:c,close:d}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:i}}return null}function o0e(e,t,n=t.selection.ranges){let s=[],r=-1;e:for(let{from:i,to:o}of n){let a=s.length,l=1e9,c;for(let d=i;d<=o;){let h=t.doc.lineAt(d);if(c==null&&(c=p8(t,h.from).line,!c))continue e;if(h.from>r&&(i==o||o>h.from)){r=h.from;let f=/^\s*/.exec(h.text)[0].length,m=f==h.length,g=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<l&&(l=f),s.push({line:h,comment:g,token:c,indent:f,empty:m,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<s.length;d++)s[d].indent<s[d].line.text.length&&(s[d].indent=l);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:l,indent:c,empty:d,single:h}of s)(h||!d)&&i.push({from:a.from+c,insert:l+" "});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:l}of s)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,i.push({from:c,to:d})}return{changes:i}}return null}const iS=Lc.define(),a0e=Lc.define(),l0e=en.define(),yz=en.define({combine(e){return _v(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)})}}),bz=Pl.define({create(){return Cl.empty},update(e,t){let n=t.state.facet(yz),s=t.annotation(iS);if(s){let l=vo.fromTransaction(t,s.selection),c=s.side,d=c==0?e.undone:e.done;return l?d=uw(d,d.length,n.minDepth,l):d=_z(d,t.startState.selection),new Cl(c==0?s.rest:d,c==0?d:s.rest)}let r=t.annotation(a0e);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(Pr.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=vo.fromTransaction(t),o=t.annotation(Pr.time),a=t.annotation(Pr.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 Cl(e.done.map(vo.fromJSON),e.undone.map(vo.fromJSON))}});function wz(e={}){return[bz,yz.of(e),Ft.domEventHandlers({beforeinput(t,n){let s=t.inputType=="historyUndo"?vz:t.inputType=="historyRedo"?oS:null;return s?(t.preventDefault(),s(n)):!1}})]}function Nv(e,t){return function({state:n,dispatch:s}){if(!t&&n.readOnly)return!1;let r=n.field(bz,!1);if(!r)return!1;let i=r.pop(e,n,t);return i?(s(i),!0):!1}}const vz=Nv(0,!1),oS=Nv(1,!1),c0e=Nv(0,!0),u0e=Nv(1,!0);class vo{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 vo(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 vo(t.changes&&Or.fromJSON(t.changes),[],t.mapped&&El.fromJSON(t.mapped),t.startSelection&&Qe.fromJSON(t.startSelection),t.selectionsAfter.map(Qe.fromJSON))}static fromTransaction(t,n){let s=pa;for(let r of t.startState.facet(l0e)){let i=r(t);i.length&&(s=s.concat(i))}return!s.length&&t.changes.empty?null:new vo(t.changes.invert(t.startState.doc),s,void 0,n||t.startState.selection,pa)}static selection(t){return new vo(void 0,pa,void 0,void 0,t)}}function uw(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 d0e(e,t){let n=[],s=!1;return e.iterChangedRanges((r,i)=>n.push(r,i)),t.iterChangedRanges((r,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],d=n[l++];a>=c&&o<=d&&(s=!0)}}),s}function h0e(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,s)=>n.empty!=t.ranges[s].empty).length===0}function xz(e,t){return e.length?t.length?e.concat(t):e:t}const pa=[],f0e=200;function _z(e,t){if(e.length){let n=e[e.length-1],s=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-f0e));return s.length&&s[s.length-1].eq(t)?e:(s.push(t),uw(e,e.length-1,1e9,n.setSelAfter(s)))}else return[vo.selection([t])]}function m0e(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 A4(e,t){if(!e.length)return e;let n=e.length,s=pa;for(;n;){let r=p0e(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?[vo.selection(s)]:pa}function p0e(e,t,n){let s=xz(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):pa,n);if(!e.changes)return vo.selection(s);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new vo(r,As.mapEffects(e.effects,t),o,e.startSelection.map(i),s)}const g0e=/^(input\.type|delete)($|\.)/;class Cl{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 Cl(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||g0e.test(s))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,d0e(a.changes,t.changes))||s=="input.type.compose")?o=uw(o,o.length-1,r.minDepth,new vo(t.changes.compose(a.changes),xz(As.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,pa)):o=uw(o,o.length,r.minDepth,t),new Cl(o,pa,n,s)}addSelection(t,n,s,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:pa;return i.length>0&&n-this.prevTime<r&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&h0e(i[i.length-1],t)?this:new Cl(_z(this.done,t),this.undone,n,s)}addMapping(t){return new Cl(A4(this.done,t),A4(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:iS.of({side:t,rest:m0e(r),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=r.length==1?pa:r.slice(0,r.length-1);return i.mapped&&(a=A4(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:iS.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Cl.empty=new Cl(pa,pa);const kz=[{key:"Mod-z",run:vz,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:oS,preventDefault:!0},{linux:"Ctrl-Shift-z",run:oS,preventDefault:!0},{key:"Mod-u",run:c0e,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:u0e,preventDefault:!0}];function Mm(e,t){return Qe.create(e.ranges.map(t),e.mainIndex)}function Wa(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Ga({state:e,dispatch:t},n){let s=Mm(e.selection,n);return s.eq(e.selection,!0)?!1:(t(Wa(e,s)),!0)}function Iv(e,t){return Qe.cursor(t?e.to:e.from)}function Sz(e,t){return Ga(e,n=>n.empty?e.moveByChar(n,t):Iv(n,t))}function zi(e){return e.textDirectionAt(e.state.selection.main.head)==Ws.LTR}const Tz=e=>Sz(e,!zi(e)),Cz=e=>Sz(e,zi(e));function Az(e,t){return Ga(e,n=>n.empty?e.moveByGroup(n,t):Iv(n,t))}const y0e=e=>Az(e,!zi(e)),b0e=e=>Az(e,zi(e));function w0e(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 jv(e,t,n){let s=qa(e).resolveInner(t.head),r=n?Zn.closedBy:Zn.openedBy;for(let l=t.head;;){let c=n?s.childAfter(l):s.childBefore(l);if(!c)break;w0e(e,c,r)?s=c:l=n?c.to:c.from}let i=s.type.prop(r),o,a;return i&&(o=n?pf(e,s.from,1):pf(e,s.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?s.to:s.from,Qe.cursor(a,n?-1:1)}const v0e=e=>Ga(e,t=>jv(e.state,t,!zi(e))),x0e=e=>Ga(e,t=>jv(e.state,t,zi(e)));function Ez(e,t){return Ga(e,n=>{if(!n.empty)return Iv(n,t);let s=e.moveVertically(n,t);return s.head!=n.head?s:e.moveToLineBoundary(n,t)})}const Mz=e=>Ez(e,!1),Nz=e=>Ez(e,!0);function Iz(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,s=0,r;if(t){for(let i of e.state.facet(Ft.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 jz(e,t){let n=Iz(e),{state:s}=e,r=Mm(s.selection,o=>o.empty?e.moveVertically(o,t,n.height):Iv(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(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=Ft.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch(Wa(s,r),{effects:i}),!0}const MM=e=>jz(e,!1),aS=e=>jz(e,!0);function id(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=Qe.cursor(s.from+i))}return r}const _0e=e=>Ga(e,t=>id(e,t,!0)),k0e=e=>Ga(e,t=>id(e,t,!1)),S0e=e=>Ga(e,t=>id(e,t,!zi(e))),T0e=e=>Ga(e,t=>id(e,t,zi(e))),C0e=e=>Ga(e,t=>Qe.cursor(e.lineBlockAt(t.head).from,1)),A0e=e=>Ga(e,t=>Qe.cursor(e.lineBlockAt(t.head).to,-1));function E0e(e,t,n){let s=!1,r=Mm(e.selection,i=>{let o=pf(e,i.head,-1)||pf(e,i.head,1)||i.head>0&&pf(e,i.head-1,1)||i.head<e.doc.length&&pf(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 Qe.cursor(a)});return s?(t(Wa(e,r)),!0):!1}const M0e=({state:e,dispatch:t})=>E0e(e,t);function Ca(e,t){let n=Mm(e.state.selection,s=>{let r=t(s);return Qe.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Wa(e.state,n)),!0)}function Rz(e,t){return Ca(e,n=>e.moveByChar(n,t))}const Lz=e=>Rz(e,!zi(e)),Dz=e=>Rz(e,zi(e));function Oz(e,t){return Ca(e,n=>e.moveByGroup(n,t))}const N0e=e=>Oz(e,!zi(e)),I0e=e=>Oz(e,zi(e)),j0e=e=>Ca(e,t=>jv(e.state,t,!zi(e))),R0e=e=>Ca(e,t=>jv(e.state,t,zi(e)));function Bz(e,t){return Ca(e,n=>e.moveVertically(n,t))}const Pz=e=>Bz(e,!1),$z=e=>Bz(e,!0);function zz(e,t){return Ca(e,n=>e.moveVertically(n,t,Iz(e).height))}const NM=e=>zz(e,!1),IM=e=>zz(e,!0),L0e=e=>Ca(e,t=>id(e,t,!0)),D0e=e=>Ca(e,t=>id(e,t,!1)),O0e=e=>Ca(e,t=>id(e,t,!zi(e))),B0e=e=>Ca(e,t=>id(e,t,zi(e))),P0e=e=>Ca(e,t=>Qe.cursor(e.lineBlockAt(t.head).from)),$0e=e=>Ca(e,t=>Qe.cursor(e.lineBlockAt(t.head).to)),jM=({state:e,dispatch:t})=>(t(Wa(e,{anchor:0})),!0),RM=({state:e,dispatch:t})=>(t(Wa(e,{anchor:e.doc.length})),!0),LM=({state:e,dispatch:t})=>(t(Wa(e,{anchor:e.selection.main.anchor,head:0})),!0),DM=({state:e,dispatch:t})=>(t(Wa(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),z0e=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),F0e=({state:e,dispatch:t})=>{let n=Rv(e).map(({from:s,to:r})=>Qe.range(s,Math.min(r+1,e.doc.length)));return t(e.update({selection:Qe.create(n),userEvent:"select"})),!0},q0e=({state:e,dispatch:t})=>{let n=Mm(e.selection,s=>{let r=qa(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 Qe.range(a.to,a.from)}return s});return n.eq(e.selection)?!1:(t(Wa(e,n)),!0)};function Fz(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 l=e.moveVertically(a,t);if(l.head<o.from||l.head>o.to){r.some(c=>c.head==l.head)||r.push(l);break}else{if(l.head==a.head)break;a=l}}}return r.length==s.ranges.length?!1:(e.dispatch(Wa(n,Qe.create(r,r.length-1))),!0)}const H0e=e=>Fz(e,!1),U0e=e=>Fz(e,!0),V0e=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=Qe.create([n.main]):n.main.empty||(s=Qe.create([Qe.cursor(n.main.head)])),s?(t(Wa(e,s)),!0):!1};function Ag(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 l=t(i);l<o?(n="delete.backward",l=W1(e,l,!1)):l>o&&(n="delete.forward",l=W1(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=W1(e,o,!1),a=W1(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Qe.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"?Ft.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function W1(e,t,n){if(e instanceof Ft)for(let s of e.state.facet(Ft.atomicRanges).map(r=>r(e)))s.between(t,t,(r,i)=>{r<t&&i>t&&(t=n?i:r)});return t}const qz=(e,t,n)=>Ag(e,s=>{let r=s.from,{state:i}=e,o=i.doc.lineAt(r),a,l;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 c=kg(a,i.tabSize),d=c%lw(i)||lw(i);for(let h=0;h<d&&a[a.length-1-h]==" ";h++)r--;l=r}else l=Oi(o.text,r-o.from,t,t)+o.from,l==r&&o.number!=(t?i.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,r-o.from))&&(l=Oi(o.text,l-o.from,!1,!1)+o.from);return l}),lS=e=>qz(e,!1,!0),Hz=e=>qz(e,!0,!1),Uz=(e,t)=>Ag(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 l=Oi(i.text,s-i.from,t)+i.from,c=i.text.slice(Math.min(s,l)-i.from,Math.max(s,l)-i.from),d=o(c);if(a!=null&&d!=a)break;(c!=" "||s!=n.head)&&(a=d),s=l}return s}),Vz=e=>Uz(e,!1),W0e=e=>Uz(e,!0),G0e=e=>Ag(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),K0e=e=>Ag(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Y0e=e=>Ag(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Q0e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:ts.of(["",""])},range:Qe.cursor(s.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},X0e=({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:Oi(i.text,r-i.from,!1)+i.from,a=r==i.to?r+1:Oi(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:Qe.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Rv(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 Wz(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let i of Rv(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 l of i.ranges)r.push(Qe.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{s.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let l of i.ranges)r.push(Qe.range(l.anchor-a,l.head-a))}}return s.length?(t(e.update({changes:s,scrollIntoView:!0,selection:Qe.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const J0e=({state:e,dispatch:t})=>Wz(e,t,!1),Z0e=({state:e,dispatch:t})=>Wz(e,t,!0);function Gz(e,t,n){if(e.readOnly)return!1;let s=[];for(let i of Rv(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 epe=({state:e,dispatch:t})=>Gz(e,t,!1),tpe=({state:e,dispatch:t})=>Gz(e,t,!0),npe=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Rv(t).map(({from:r,to:i})=>(r>0?r--:i<t.doc.length&&i++,{from:r,to:i}))),s=Mm(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 spe(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=qa(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(Zn.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 OM=Kz(!1),rpe=Kz(!0);function Kz(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),l=!e&&i==o&&spe(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let c=new Ev(t,{simulateBreak:i,simulateDoubleBreak:!!l}),d=fz(c,i);for(d==null&&(d=kg(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",cw(t,d)];return l&&h.push(cw(t,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:ts.of(h)},range:Qe.cursor(i+1+h[1].length)}});return n(t.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function g8(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:Qe.range(i.mapPos(s.anchor,1),i.mapPos(s.head,1))}})}const ipe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),s=new Ev(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=g8(e,(i,o,a)=>{let l=fz(s,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],d=cw(e,l);(c!=d||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:d}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0},ope=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(g8(e,(n,s)=>{s.push({from:n.from,insert:e.facet(h8)})}),{userEvent:"input.indent"})),!0),ape=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(g8(e,(n,s)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=kg(r,e.tabSize),o=0,a=cw(e,Math.max(0,i-lw(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),lpe=e=>(e.setTabFocusMode(),!0),cpe=[{key:"Ctrl-b",run:Tz,shift:Lz,preventDefault:!0},{key:"Ctrl-f",run:Cz,shift:Dz},{key:"Ctrl-p",run:Mz,shift:Pz},{key:"Ctrl-n",run:Nz,shift:$z},{key:"Ctrl-a",run:C0e,shift:P0e},{key:"Ctrl-e",run:A0e,shift:$0e},{key:"Ctrl-d",run:Hz},{key:"Ctrl-h",run:lS},{key:"Ctrl-k",run:G0e},{key:"Ctrl-Alt-h",run:Vz},{key:"Ctrl-o",run:Q0e},{key:"Ctrl-t",run:X0e},{key:"Ctrl-v",run:aS}],upe=[{key:"ArrowLeft",run:Tz,shift:Lz,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:y0e,shift:N0e,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:S0e,shift:O0e,preventDefault:!0},{key:"ArrowRight",run:Cz,shift:Dz,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:b0e,shift:I0e,preventDefault:!0},{mac:"Cmd-ArrowRight",run:T0e,shift:B0e,preventDefault:!0},{key:"ArrowUp",run:Mz,shift:Pz,preventDefault:!0},{mac:"Cmd-ArrowUp",run:jM,shift:LM},{mac:"Ctrl-ArrowUp",run:MM,shift:NM},{key:"ArrowDown",run:Nz,shift:$z,preventDefault:!0},{mac:"Cmd-ArrowDown",run:RM,shift:DM},{mac:"Ctrl-ArrowDown",run:aS,shift:IM},{key:"PageUp",run:MM,shift:NM},{key:"PageDown",run:aS,shift:IM},{key:"Home",run:k0e,shift:D0e,preventDefault:!0},{key:"Mod-Home",run:jM,shift:LM},{key:"End",run:_0e,shift:L0e,preventDefault:!0},{key:"Mod-End",run:RM,shift:DM},{key:"Enter",run:OM,shift:OM},{key:"Mod-a",run:z0e},{key:"Backspace",run:lS,shift:lS,preventDefault:!0},{key:"Delete",run:Hz,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Vz,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:W0e,preventDefault:!0},{mac:"Mod-Backspace",run:K0e,preventDefault:!0},{mac:"Mod-Delete",run:Y0e,preventDefault:!0}].concat(cpe.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Yz=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:v0e,shift:j0e},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:x0e,shift:R0e},{key:"Alt-ArrowUp",run:J0e},{key:"Shift-Alt-ArrowUp",run:epe},{key:"Alt-ArrowDown",run:Z0e},{key:"Shift-Alt-ArrowDown",run:tpe},{key:"Mod-Alt-ArrowUp",run:H0e},{key:"Mod-Alt-ArrowDown",run:U0e},{key:"Escape",run:V0e},{key:"Mod-Enter",run:rpe},{key:"Alt-l",mac:"Ctrl-l",run:F0e},{key:"Mod-i",run:q0e,preventDefault:!0},{key:"Mod-[",run:ape},{key:"Mod-]",run:ope},{key:"Mod-Alt-\\",run:ipe},{key:"Shift-Mod-k",run:npe},{key:"Shift-Mod-\\",run:M0e},{key:"Mod-/",run:e0e},{key:"Alt-A",run:n0e},{key:"Ctrl-m",mac:"Shift-Alt-m",run:lpe}].concat(upe);class Qz{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=qa(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(Xz(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 BM(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 dpe(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=BM(t)+BM(n)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function hpe(e){let t=e.map(r=>typeof r=="string"?{label:r}:r),[n,s]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:dpe(t);return r=>{let i=r.matchBefore(s);return i||r.explicit?{from:i?i.from:r.pos,options:t,validFor:n}:null}}class PM{constructor(t,n,s,r){this.completion=t,this.source=n,this.match=s,this.score=r}}function Yd(e){return e.selection.main.from}function Xz(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 Jz=Lc.define();function fpe(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 l=e.toText(t);return{changes:{from:a.from+i,to:s==r.from?a.to:a.from+o,insert:l},range:Qe.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const $M=new WeakMap;function mpe(e){if(!Array.isArray(e))return e;let t=$M.get(e);return t||$M.set(e,t=hpe(e)),t}const dw=As.define(),Hp=As.define();class ppe{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=eu(t,n),r=Jh(s);this.chars.push(s);let i=t.slice(n,n+r),o=i.toUpperCase();this.folded.push(eu(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=eu(t,0),x=Jh(v),C=x==t.length?0:-100;if(v!=n[0])if(v==s[0])C+=-200;else return null;return this.ret(C,[0,x])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let v=0,x=Math.min(t.length,200);v<x&&c<l;){let C=eu(t,v);(C==n[c]||C==s[c])&&(r[c++]=v),v+=Jh(C)}if(c<l)return null}let d=0,h=0,f=!1,m=0,g=-1,y=-1,b=/[a-z]/.test(t),w=!0;for(let v=0,x=Math.min(t.length,200),C=0;v<x&&h<l;){let A=eu(t,v);a<0&&(d<l&&A==n[d]&&(i[d++]=v),m<l&&(A==n[m]||A==s[m]?(m==0&&(g=v),y=v+1,m++):m=0));let T,_=A<255?A>=48&&A<=57||A>=97&&A<=122?2:A>=65&&A<=90?1:0:(T=Pde(A))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!v||_==1&&b||C==0&&_!=0)&&(n[h]==A||s[h]==A&&(f=!0)?o[h++]=v:o.length&&(w=!1)),C=_,v+=Jh(A)}return h==l&&o[0]==0&&w?this.result(-100+(f?-200:0),o,t):m==l&&g==0?this.ret(-200-t.length+(y==t.length?0:-100),[0,y]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):m==l?this.ret(-900-t.length,[g,y]):h==l?this.result(-100+(f?-200:0)+-700+(w?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?Jh(eu(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 gpe{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 ei=en.define({combine(e){return _v(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:ype,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=>zM(t(s),n(s)),optionClass:(t,n)=>s=>zM(t(s),n(s)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function zM(e,t){return e?t?e+" "+t:e:t}function ype(e,t,n,s,r,i){let o=e.textDirection==Ws.RTL,a=o,l=!1,c="top",d,h,f=t.left-r.left,m=r.right-t.right,g=s.right-s.left,y=s.bottom-s.top;if(a&&f<Math.min(g,m)?a=!1:!a&&m<Math.min(g,f)&&(a=!0),g<=(a?f:m))d=Math.max(r.top,Math.min(n.top,r.bottom-y))-t.top,h=Math.min(400,a?f:m);else{l=!0,h=Math.min(400,(o?t.right:r.right-t.left)-30);let v=r.bottom-t.bottom;v>=y||v>t.top?d=n.bottom-t.top:(c="bottom",d=t.bottom-n.top)}let b=(t.bottom-t.top)/i.offsetHeight,w=(t.right-t.left)/i.offsetWidth;return{style:`${c}: ${d/b}px; max-width: ${h/w}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const y8=As.define();function bpe(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,l=0;for(let c=0;c<i.length;){let d=i[c++],h=i[c++];d>l&&o.appendChild(document.createTextNode(a.slice(l,d)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(d,h))),f.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),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 E4(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 wpe{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:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let r=t.state.field(n),{options:i,selected:o}=r.open,a=t.state.facet(ei);this.optionContent=bpe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=E4(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=t.state.field(n).open;for(let d=l.target,h;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(h=/-(\d+)$/.exec(d.id))&&+h[1]<c.length){this.applyCompletion(t,c[+h[1]]),l.preventDefault();return}if(l.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:y8.of(d)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(ei).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:Hp.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=E4(i.length,o,t.state.facet(ei).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=E4(n.options.length,n.selected,this.view.state.facet(ei).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=>$o(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&&xpe(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(ei).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:l}=t[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=i&&(o>s.from||s.from==0))if(i=f,typeof c!="string"&&c.header)r.appendChild(c.header(c));else{let m=r.appendChild(document.createElement("completion-section"));m.textContent=f}}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 f of this.optionContent){let m=f(a,this.view.state,this.view,l);m&&d.appendChild(m)}}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 vpe(e,t){return n=>new wpe(n,e,t)}function xpe(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 FM(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function _pe(e,t){let n=[],s=null,r=null,i=d=>{n.push(d);let{section:h}=d.completion;if(h){s||(s=[]);let f=typeof h=="string"?h:h.name;s.some(m=>m.name==f)||s.push(typeof h=="string"?{name:f}:h)}},o=t.facet(ei);for(let d of e)if(d.hasResult()){let h=d.result.getMatch;if(d.result.filter===!1)for(let f of d.result.options)i(new PM(f,d.source,h?h(f):[],1e9-n.length));else{let f=t.sliceDoc(d.from,d.to),m,g=o.filterStrict?new gpe(f):new ppe(f);for(let y of d.result.options)if(m=g.match(y.label)){let b=y.displayLabel?h?h(y,m.matched):[]:m.matched,w=m.score+(y.boost||0);if(i(new PM(y,d.source,b,w)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:v}=y.section;r||(r=Object.create(null)),r[v]=Math.max(w,r[v]||-1e9)}}}}if(s){let d=Object.create(null),h=0,f=(m,g)=>(m.rank==="dynamic"&&g.rank==="dynamic"?r[g.name]-r[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(m.name<g.name?-1:1);for(let m of s.sort(f))h-=1e5,d[m.name]=h;for(let m of n){let{section:g}=m.completion;g&&(m.score+=d[typeof g=="string"?g:g.name])}}let a=[],l=null,c=o.compareCompletions;for(let d of n.sort((h,f)=>f.score-h.score||c(h.completion,f.completion))){let h=d.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?a.push(d):FM(d.completion)>FM(l)&&(a[a.length-1]=d),l=d.completion}return a}class gf{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 gf(this.options,qM(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,s,r,i,o){if(r&&!o&&t.some(c=>c.isPending))return r.setDisabled();let a=_pe(t,n);if(!a.length)return r&&t.some(c=>c.isPending)?r.setDisabled():null;let l=n.facet(ei).selectOnOpen?0:-1;if(r&&r.selected!=l&&r.selected!=-1){let c=r.options[r.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==c){l=d;break}}return new gf(a,qM(s,l),{pos:t.reduce((c,d)=>d.hasResult()?Math.min(c,d.from):c,1e8),create:Epe,above:i.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(t){return new gf(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new gf(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class hw{constructor(t,n,s){this.active=t,this.id=n,this.open=s}static start(){return new hw(Cpe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,s=n.facet(ei),i=(s.override||n.languageDataAt("autocomplete",Yd(n)).map(mpe)).map(l=>(this.active.find(d=>d.source==l)||new ga(l,this.active.some(d=>d.state!=0)?1:0)).update(t,s));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=t.effects.some(l=>l.is(b8));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!kpe(i,this.active)||a?o=gf.build(i,n,this.id,o,s,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new ga(l.source,0):l));for(let l of t.effects)l.is(y8)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new hw(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Spe:Tpe}}function kpe(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 Spe={"aria-autocomplete":"list"},Tpe={};function qM(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const Cpe=[];function Zz(e,t){if(e.isUserEvent("input.complete")){let s=e.annotation(Jz);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 ga{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=Zz(t,n),r=this;(s&8||s&16&&this.touches(t))&&(r=new ga(r.source,0)),s&4&&r.state==0&&(r=new ga(this.source,1)),r=r.updateFor(t,s);for(let i of t.effects)if(i.is(dw))r=new ga(r.source,1,i.value);else if(i.is(Hp))r=new ga(r.source,0);else if(i.is(b8))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(Yd(t.state))}}class Lf extends ga{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=Yd(t.state);if(a>o||!r||n&2&&(Yd(t.startState)==this.from||a<this.limit))return new ga(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return Ape(r.validFor,t.state,i,o)?new Lf(this.source,this.explicit,l,r,i,o):r.update&&(r=r.update(r,i,o,new Qz(t.state,a,!1)))?new Lf(this.source,this.explicit,l,r,r.from,(s=r.to)!==null&&s!==void 0?s:Yd(t.state)):new ga(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 Lf(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new ga(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function Ape(e,t,n,s){if(!e)return!1;let r=t.sliceDoc(n,s);return typeof e=="function"?e(r,n,s,t):Xz(e,!0).test(r)}const b8=As.define({map(e,t){return e.map(n=>n.map(t))}}),Xi=Pl.define({create(){return hw.start()},update(e,t){return e.update(t)},provide:e=>[iz.from(e,t=>t.tooltip),Ft.contentAttributes.from(e,t=>t.attrs)]});function w8(e,t){const n=t.completion.apply||t.completion.label;let s=e.state.field(Xi).active.find(r=>r.source==t.source);return s instanceof Lf?(typeof n=="string"?e.dispatch({...fpe(e.state,n,s.from,s.to),annotations:Jz.of(t.completion)}):n(e,t.completion,s.from,s.to),!0):!1}const Epe=vpe(Xi,w8);function xu(e,t="option"){return n=>{let s=n.state.field(Xi,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<n.state.facet(ei).interactionDelay)return!1;let r=1,i;t=="page"&&(i=oz(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:y8.of(a)}),!0}}const eF=e=>{let t=e.state.field(Xi,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(ei).interactionDelay?!1:w8(e,t.open.options[t.open.selected])},zy=e=>e.state.field(Xi,!1)?(e.dispatch({effects:dw.of(!0)}),!0):!1,Fy=e=>{let t=e.state.field(Xi,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:Hp.of(null)}),!0)};class Mpe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Npe=50,Ipe=1e3,jpe=ko.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(Xi).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Xi),n=e.state.facet(ei);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Xi)==t)return;let s=e.transactions.some(i=>{let o=Zz(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>Npe&&Date.now()-o.time>Ipe){for(let a of o.context.abortListeners)try{a()}catch(l){$o(this.view.state,l)}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(dw)))&&(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(Xi);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(ei).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Yd(t),s=new Qz(t,n,e.explicit,this.view),r=new Mpe(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:Hp.of(null)}),$o(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(ei).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ei),s=this.view.state.field(Xi);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=Yd(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new Lf(i.active.source,i.active.explicit,l,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let d of i.updates)c=c.update(d,n);if(c.hasResult()){t.push(c);continue}}let o=s.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new ga(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||t.push(a)}else this.startQuery(o)}(t.length||s.open&&s.open.disabled)&&this.view.dispatch({effects:b8.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Xi,!1);if(t&&t.tooltip&&this.view.state.facet(ei).closeOnBlur){let n=t.open&&oz(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Hp.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:dw.of(!1)}),20),this.composing=0}}}),Rpe=typeof navigator=="object"&&/Win/.test(navigator.platform),Lpe=Sh.highest(Ft.domEventHandlers({keydown(e,t){let n=t.state.field(Xi,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Rpe&&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&&w8(t,s),!1}})),Dpe=Ft.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"}}}),tF=new class extends Gu{};tF.startSide=1;tF.endSide=-1;function Ope(e={}){return[Lpe,Xi,ei.of(e),jpe,Ppe,Dpe]}const Bpe=[{key:"Ctrl-Space",run:zy},{mac:"Alt-`",run:zy},{mac:"Alt-i",run:zy},{key:"Escape",run:Fy},{key:"ArrowDown",run:xu(!0)},{key:"ArrowUp",run:xu(!1)},{key:"PageDown",run:xu(!0,"page")},{key:"PageUp",run:xu(!1,"page")},{key:"Enter",run:eF}],Ppe=Sh.highest(zp.computeN([ei],e=>e.facet(ei).defaultKeymap?[Bpe]:[]));function No(e){let t=e.field(Xi,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const $pe=[eme(),wz(),Vfe(),qme(Vme,{fallback:!0}),zp.of([...Yz,...kz])];/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const v8={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&&(v8[r]=n)}}const M4={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(M4)){const t=e.toUpperCase();for(let n=M4[e][0];n<=M4[e][1];++n)v8[n]=n%2===0?t:e}function Eg(e){if(e<192||e>8580)return e;const t=v8[e];return t!==void 0?t.codePointAt(0):e}function su(e,t){return e>t?e:t}const nF=e=>e.split("").map(t=>t.codePointAt(0)),zpe=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)zpe.add(e);const lm="".codePointAt(0),Up="A".codePointAt(0),Vp="Z".codePointAt(0),sF="a".codePointAt(0),rF="z".codePointAt(0),Fpe="0".codePointAt(0),qpe="9".codePointAt(0);function yf(e,t,n){return n?e:t-e-1}const Wp=16,cS=-3,fw=-1,lh=Wp/2,Hpe=Wp/2,Upe=lh+fw,iF=4,oF=2;function uS(e){return e?new Set:null}function o0(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 HM(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 aF(e){return e>=sF&&e<=rF?1:e>=Up&&e<=Vp?2:e>=Fpe&&e<=qpe?4:0}function lF(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 mw(e){return e<=lm?aF(e):lF(e)}function x8(e,t){return e===0&&t!==0?lh:e===1&&t===2||e!==4&&t===4?Upe:t===0?Hpe:0}function Vpe(e,t){return t===0?lh:x8(mw(e[t-1]),mw(e[t]))}function Wpe(e,t,n,s){let r=e.slice(s),i=r.indexOf(n);if(i===0)return s;if(!t&&n>=sF&&n<=rF){i>0&&(r=r.slice(0,i));const o=r.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:s+i}function UM(e){for(const t of e)if(t>=128)return!1;return!0}function _8(e,t,n){if(!UM(e))return 0;if(!UM(t))return-1;let s=0,r=0;for(let i=0;i<t.length;i++){if(r=Wpe(e,n,t[i],r),r<0)return-1;i===0&&r>0&&(s=r-1),r++}return s}const Gpe=(e,t,n,s,r,i,o)=>{const a=r.length;if(a===0)return[{start:0,end:0,score:0},uS(i)];const l=s.length;if(o!==null&&l*a>o.i16.length)return uF(e,t,n,s,r,i);const c=_8(s,r,e);if(c<0)return[{start:-1,end:-1,score:0},null];let d=0,h=0,f=null,m=null,g=null,y=null;[d,f]=o0(d,o,l),[d,m]=o0(d,o,l),[d,g]=o0(d,o,l),[h,y]=HM(h,o,a);const[,b]=HM(h,o,l);for(let z=0;z<b.length;z++)b[z]=s[z];let w=0,v=0,x=0,C=0;const A=r[0];let T=r[0],_=0,R=0,I=!1,k=b.subarray(c),j=f.subarray(c).subarray(0,k.length),N=m.subarray(c).subarray(0,k.length),L=g.subarray(c).subarray(0,k.length);for(let[z,M]of k.entries()){let re=null;M<=lm?(re=aF(M),!e&&re===2&&(M+=32)):(re=lF(M),!e&&re===2&&(M=String.fromCodePoint(M).toLowerCase().codePointAt(0)),t&&(M=Eg(M))),k[z]=M;const U=x8(R,re);if(L[z]=U,R=re,M===T&&(x<a&&(y[x]=c+z,x++,T=r[Math.min(x,a-1)]),C=c+z),M===A){const W=Wp+U*oF;if(j[z]=W,N[z]=1,a===1&&(n&&W>w||!n&&W>=w)&&(w=W,v=c+z,n&&U===lh))break;I=!1}else I?j[z]=su(_+fw,0):j[z]=su(_+cS,0),N[z]=0,I=!0;_=j[z]}if(x!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const z={start:v,end:v+1,score:w};if(!i)return[z,null];const M=new Set;return M.add(v),[z,M]}const $=y[0],F=C-$+1;let B=null;[d,B]=o0(d,o,F*a);{const z=f.subarray($,C+1);for(const[M,re]of z.entries())B[M]=re}let[,Q]=o0(d,o,F*a);{const z=m.subarray($,C+1);for(const[M,re]of z.entries())Q[M]=re}const Y=y.subarray(1),ne=r.slice(1).slice(0,Y.length);for(const[z,M]of Y.entries()){let re=!1;const U=ne[z],W=z+1,J=W*F,G=b.subarray(M,C+1),te=g.subarray(M).subarray(0,G.length),H=Q.subarray(J+M-$).subarray(0,G.length),ie=Q.subarray(J+M-$-1-F).subarray(0,G.length),fe=B.subarray(J+M-$).subarray(0,G.length),Ne=B.subarray(J+M-$-1-F).subarray(0,G.length),Ie=B.subarray(J+M-$-1).subarray(0,G.length);Ie[0]=0;for(const[Ce,ve]of G.entries()){const ut=Ce+M;let ae=0,Ct=0,Ke=0;if(re?Ct=Ie[Ce]+fw:Ct=Ie[Ce]+cS,U===ve){ae=Ne[Ce]+Wp;let qt=te[Ce];Ke=ie[Ce]+1,qt===lh?Ke=1:Ke>1&&(qt=su(qt,su(iF,g[ut-Ke+1]))),ae+qt<Ct?(ae+=te[Ce],Ke=0):ae+=qt}H[Ce]=Ke,re=ae<Ct;const on=su(su(ae,Ct),0);W===a-1&&(n&&on>w||!n&&on>=w)&&(w=on,v=ut),fe[Ce]=on}}const P=uS(i);let le=$;if(i&&P!==null){let z=a-1;le=v;let M=!0;for(;;){const re=z*F,U=le-$,W=B[re+U];let J=0,G=0;if(z>0&&le>=y[z]&&(J=B[re-F+U-1]),le>y[z]&&(G=B[re+U-1]),W>J&&(W>G||W===G&&M)){if(P.add(le),z===0)break;z--}M=Q[re+U]>1||re+F+U+1<Q.length&&Q[re+F+U+1]>0,le--}}return[{start:le,end:v+1,score:w},P]};function cF(e,t,n,s,r,i,o){let a=0,l=0,c=!1,d=0,h=0;const f=uS(o);let m=0;r>0&&(m=mw(n[r-1]));for(let g=r;g<i;g++){let y=n[g];const b=mw(y);if(e||(y>=Up&&y<=Vp?y+=32:y>lm&&(y=String.fromCodePoint(y).toLowerCase().codePointAt(0))),t&&(y=Eg(y)),y===s[a]){o&&f!==null&&f.add(g),l+=Wp;let w=x8(m,b);d===0?h=w:(w===lh&&(h=w),w=su(su(w,h),iF)),a===0?l+=w*oF:l+=w,c=!1,d++,a++}else c?l+=fw:l+=cS,c=!0,d=0,h=0;m=b}return[l,f]}const uF=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];if(_8(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,l=-1,c=-1;const d=s.length,h=r.length;for(let f=0;f<d;f++){let m=s[yf(f,d,n)];e||(m>=Up&&m<=Vp?m+=32:m>lm&&(m=String.fromCodePoint(m).toLowerCase().codePointAt(0))),t&&(m=Eg(m));const g=r[yf(a,h,n)];if(m===g&&(l<0&&(l=f),a++,a===h)){c=f+1;break}}if(l>=0&&c>=0){a--;for(let g=c-1;g>=l;g--){const y=yf(g,d,n);let b=s[y];e||(b>=Up&&b<=Vp?b+=32:b>lm&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0)));const w=yf(a,h,n),v=r[w];if(b===v&&(a--,a<0)){l=g;break}}if(!n){const g=l;l=d-c,c=d-g}const[f,m]=cF(e,t,s,r,l,c,i);return[{start:l,end:c,score:f},m]}return[{start:-1,end:-1,score:0},null]},Kpe=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];const a=s.length,l=r.length;if(a<l)return[{start:-1,end:-1,score:0},null];if(_8(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let c=0,d=-1,h=0,f=-1;for(let m=0;m<a;m++){const g=yf(m,a,n);let y=s[g];e||(y>=Up&&y<=Vp?y+=32:y>lm&&(y=String.fromCodePoint(y).toLowerCase().codePointAt(0))),t&&(y=Eg(y));const b=yf(c,l,n);if(r[b]===y){if(b===0&&(h=Vpe(s,g)),c++,c===l){if(h>f&&(d=m,f=h),h===lh)break;m-=c-1,c=0,h=0}}else m-=c,c=0,h=0}if(d>=0){let m=0,g=0;n?(m=d-l+1,g=d+1):(m=a-(d+1),g=a-(d-l+1));const[y]=cF(e,t,s,r,m,g,!1);return[{start:m,end:g,score:y},null]}return[{start:-1,end:-1,score:0},null]},Ype=100*1024,Qpe=2048;function Xpe(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const Jpe=Xpe(Ype,Qpe),Zpe=(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=nF(e);return n&&(r=r.map(Eg)),{queryRunes:r,caseSensitive:s}};function ege(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 tge(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,Jpe);if(i.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let l=i.start;l<i.end;++l)o.add(l)}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 nge(e){const{queryRunes:t,caseSensitive:n}=Zpe(e,this.opts.casing,this.opts.normalize),s={},r=tge.bind(this)(s,t,n);for(let i=0,o=this.runesList.length;i<o;++i)r(i);return ege(s,this.opts.limit)}const dF={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class sge{constructor(t,...n){switch(this.opts={...dF,...n[0]},this.items=t,this.runesList=t.map(s=>nF(this.opts.selector(s).normalize())),this.algoFn=Kpe,this.opts.fuzzy){case"v2":this.algoFn=Gpe;break;case"v1":this.algoFn=uF;break}}}const rge={...dF,match:nge};class ige extends sge{constructor(t,...n){super(t,...n),this.opts={...rge,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(oge);t=t.normalize();let n=this.opts.match.bind(this)(t);return age(n,this.opts)}}const oge=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function age(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 lge{constructor(t,...n){this.finder=new ige(t,...n),this.find=this.finder.find.bind(this.finder)}}const Gp=["custom","skill","system"];function dS(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function cge(e,t,n=Gp){return VM(dS(e),n)-VM(dS(t),n)}function VM(e,t=Gp){const n=t.indexOf(e);return n>=0?n:t.length+Gp.indexOf(e)}const k8=String.raw`([^\s/]+)`,Lv={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:"安装扩展"}]},Dv={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"}]},Ov={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 文件列表"}]},Bv={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 uge(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"?Lv:Dv)[e];if(o||(o=(s==="zh-CN"?Ov:Bv)[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 l=o.find(c=>c.name===a);if(!(l!=null&&l.children))return null;o=l.children}return o}function dge(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 hge(e,t,n,s){const r=cge(e,t,s);return r!==0?r:0}const fge={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function mge(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 pge(e,t,n){var c;const s=e.match(new RegExp(`^/${k8}\\s+$`));if(!s)return null;const r=s[1],i=t.find(d=>d.name===r),o=n==="zh-CN"?Lv:Dv;if((c=i==null?void 0:i.subcommands)!=null&&c.length||o[r]||r==="skills")return null;const l=(n==="zh-CN"?Ov:Bv)[r];return!l||l.length===0?null:`/${r} ${l[0].name} `}function gge(e,t,n){var d,h;const s=e.match(new RegExp(`^/${k8}(\\s*)$`));if(!s)return null;const r=s[1],i=t.find(f=>f.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"?Lv:Dv;if((h=i.subcommands)!=null&&h.length||a[r]||r==="skills")return null;const c=(n==="zh-CN"?Ov:Bv)[r];return!c||c.length===0?null:`[${c.map(f=>f.name).join("|")}]`}function yge(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 WM=new WeakMap;function bge(e){let t=WM.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 lge(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:s},WM.set(e,t)}return t}function wge(e,t){try{const{fzf:n,byName:s}=bge(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 vge(e,t,n,s=[],r="en",i=a=>a,o=Gp){var v,x;const{lineStart:a,lineEnd:l,lineText:c,textBefore:d,cursor:h}=yge(e,t),f=d.match(new RegExp(`^/${k8}\\s+(.*)$`));if(f){const[,C,A]=f,T=n.find(P=>P.name===C),_=r==="zh-CN"?Lv:Dv,R=r==="zh-CN"?Ov:Bv,I=!!_[C]||C==="skills",k=!!R[C];if(!((v=T==null?void 0:T.subcommands)!=null&&v.length)&&!I&&!k)return null;const j=A.split(/\s+/),N=j.pop()||"",L=j;if(!((x=T==null?void 0:T.subcommands)!=null&&x.length)&&!I&&k&&!N)return null;const $=uge(C,L,s,r,T==null?void 0:T.subcommands);if(!$)return null;const F=N.toLowerCase(),B=`/${C} ${L.length>0?L.join(" ")+" ":""}`,Q=$.filter(P=>!N||P.name.toLowerCase().includes(F)).sort((P,le)=>N?dge(P.name,le.name,F):0),Y=C==="skills"&&L.length===0,ne=Q.map(P=>{const le=`${B}${P.name}`;return{id:le,label:P.name,detail:P.description||void 0,apply:`${le} `,...Y?{type:"skill"}:{}}});return ne.length===0?null:{kind:"subcommand",from:a,to:h,query:N,items:ne}}const m=c.match(/^\/([^\s/]*)$/);if(!m)return null;const g=m[1],y=g.length===0,w=(y?[...n].sort((C,A)=>hge(C,A,"",o)):wge(n,g)).map(C=>{const A=`/${C.name} `,T=dS(C),_=T==="custom"||T==="skill";return{id:C.name,label:`/${C.name}`,detail:C.description||void 0,apply:A,category:T,...y?{section:i(fge[T])}:{},..._&&C.description?{type:"command-info"}:{}}});return w.length===0?null:{kind:"command",from:a,to:l,query:g,items:w}}const xge="qwen-web-shell-history",hF=100;function _ge(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 kge(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-hF)))}catch{}}function GM(e=xge){const t=p.useRef(e);t.current=e;const n=p.useRef(_ge(e)),s=p.useRef(-1),r=p.useRef(""),i=p.useRef(-1),[o,a]=p.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=p.useCallback(()=>{const v=n.current,x=s.current;a({canUp:v.length>0&&(x===-1||x>0),canDown:x!==-1})},[]),c=p.useCallback(v=>{const x=n.current;x[x.length-1]!==v&&(x.push(v),x.length>hF&&x.shift(),kge(t.current,x),s.current=-1,l())},[l]),d=p.useCallback(v=>{const x=n.current;if(x.length===0)return null;if(s.current===-1)r.current=v,s.current=x.length-1;else if(s.current>0)s.current--;else return null;return l(),x[s.current]},[l]),h=p.useCallback(()=>{const v=n.current;return s.current===-1?null:s.current<v.length-1?(s.current++,l(),v[s.current]):(s.current=-1,l(),r.current)},[l]),f=p.useCallback(()=>s.current!==-1,[]),m=p.useCallback(()=>{s.current=-1,i.current=-1,l()},[l]),g=p.useCallback(v=>{const x=n.current;if(x.length===0||!v)return null;const C=i.current===-1?x.length-1:i.current-1;if(C<0)return i.current=-1,null;const A=v.toLowerCase();for(let T=C;T>=0;T--)if(x[T].toLowerCase().includes(A))return i.current=T,x[T];return i.current=-1,null},[]),y=p.useCallback(v=>{const x=v.trim().toLowerCase();return n.current.slice().reverse().filter(C=>!x||C.toLowerCase().includes(x))},[]),b=p.useCallback(v=>{const x=n.current;if(!v)return x.length>0?x[x.length-1]:null;for(let C=x.length-1;C>=0;C--)if(v(x[C]))return x[C];return null},[]),w=p.useCallback(()=>{i.current=-1},[]);return{push:c,navigateUp:d,navigateDown:h,isNavigating:f,reset:m,searchReverse:g,getReverseMatches:y,getLastEntry:b,resetSearch:w,nav:o}}function N4(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function hS(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 Sge=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,Tge=[],KM=150,ch=50,fF=ch+1,li="files",Nm="extensions",di="mcp-resources",mF=[li,Nm,di],Cge="\x1B",pF=new RegExp(`${Cge}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),gF=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,Kp="[invalid]",Age=/[^\p{L}\p{N}_./-]/gu;function qy(e){return mF.includes(e)}function Ege(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 Mge(e){const t=new Set(mF),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 YM(e){return(e.textValue===void 0?void 0:js(e.textValue))??(typeof e.label=="string"?js(e.label)??void 0:void 0)??Ec(e.id)??Kp}function yF(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function bc(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 bF(e){return e.replace(/[\\*?[{\]}]/g,"\\$&")}function pw(e,...t){const n=e.toLowerCase();return t.some(s=>s==null?void 0:s.toLowerCase().includes(n))}function QM(e){const t=bc(e),n=Nl(t);return t==="."?"@./ ":`@${uh(n)}/ `}function Nge(e,t){return`${e}:${t}`}function uh(e){return e.replace(Age,"\\$&")}function S8(e){return e.replace(/\\(.)/g,"$1")}function wF(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function Ige(e,t){return`@${uh(Nge(Nl(e),Nl(t)))} `}function jge(e,t,n){const s=S8(e);return t===di&&n&&s.startsWith(`${n}:`)?{providerId:di,serverName:n,itemQuery:s.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:Nm,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:di,itemQuery:e.slice(4)}:null}function Rge(e,t,n){if(e===Nm&&t.startsWith("ext:")||e===di&&t.startsWith("mcp:"))return t.slice(4);const s=S8(t);return e===di&&n&&s.startsWith(`${n}:`)?s.slice(n.length+1):!qy(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function Lge(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 Dge(e){const t=bc(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function vF(e,t){const n=S8(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),s=n.lastIndexOf("/");if(s<0)return{dirPath:bc(t),entryQuery:n};const r=n.slice(0,s),i=bc(t),o=i==="."?r:yF(i,r);return{dirPath:bc(o),entryQuery:n.slice(s+1)}}function Oge(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(Sge);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 js(e){const t=e.replace(pF,"").replace(gF,"").split("").filter(wF).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function Nl(e){const t=e.replace(pF,"").replace(gF,"").split("").filter(wF).join("");return t.length>0?t:Kp}function Ec(e){return e===void 0?Kp:js(e)??Kp}function Bge(e){if(e!==void 0)return Nl(e).trim()}function Pge(e){if(!e)return;const t=e.kind===void 0?void 0:js(e.kind);return{id:js(e.id)??Kp,label:e.label===void 0?void 0:js(e.label),value:e.value===void 0?void 0:js(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:Bge(e.serialized)}}function $ge(e,t){const n={...e,label:js(e.label)??Ec(e.id),description:e.description===void 0?void 0:js(e.description),subtitle:e.subtitle===void 0?void 0:js(e.subtitle),detail:e.detail===void 0?void 0:js(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:js(e.iconTooltip),insertText:e.insertText===void 0?void 0:Nl(e.insertText),composerTag:Pge(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const s={...n};return delete s.targetPath,delete s.serverName,{...s,kind:"insert"}}function zge(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===Nm?{id:`extension:${s}`,kind:"extension",value:t.label,serialized:s}:e===di?{id:`mcp:${s}`,kind:"mcp",value:t.label,serialized:s}:e===li?{id:`file:${s}`,kind:"file",value:t.description??t.label,serialized:s}:null:null}function Fge(e,t,n,s,r){return{id:li,label:s,description:r,order:1,async search({query:i,signal:o}){const a=e(),l=bc(t()),c=a==null?void 0:a.listDirectory;if(c)try{const{dirPath:h,entryQuery:f}=vF(i,l),m=f.toLowerCase(),g=await hS(n().directories,h,()=>c(h,{signal:o}));if(o.aborted)return[];const y=g.entries.filter(w=>!w.ignored).filter(w=>w.name.toLowerCase().includes(m)).sort((w,v)=>w.kind==="directory"&&v.kind!=="directory"?-1:w.kind!=="directory"&&v.kind==="directory"?1:w.name.localeCompare(v.name)),b={id:`current:${h}`,label:QM(h).trim(),description:js(h),insertText:QM(h),kind:"insert"};return[...f?[]:[b],...y.map(w=>{const v=yF(h,w.name),x=Ec(w.name),C=js(v),A=Nl(v);return w.kind==="directory"?{id:`dir:${v}`,label:`${x}/`,description:C,kind:"directory",targetPath:v}:{id:`file:${v}`,label:x,description:C,insertText:`@${uh(A)} `,kind:"insert"}})].slice(0,f?ch:fF)}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=i?`${bF(i)}*`:"**/*",f=await hS(n().globResults,h,()=>d(h,{maxResults:ch,signal:o}));return o.aborted?[]:f.matches.filter(m=>m!==".").map(m=>({id:m,label:Ec(m),insertText:`@${uh(Nl(m))} `,kind:"insert"}))}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}}}}function qge(e,t,n,s){return{id:Nm,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 l=t();l.extensionsStatus??(l.extensionsStatus=o().catch(h=>{throw l.extensionsStatus=void 0,h}));const c=await l.extensionsStatus;if(i.aborted)return[];const d=r.toLowerCase();return c.extensions.filter(h=>h.isActive).map(h=>{const f=Ec(h.name),m=uh(Nl(h.name)),g=js(h.displayName??""),y=js(h.description??"");return{id:h.name,label:f,description:g&&g!==f?g:y,detail:g&&y?`${g} - ${y}`:g??y,insertText:`@ext:${m} `}}).filter(h=>pw(d,h.label,h.description)).sort((h,f)=>{const m=h.label.toLowerCase(),g=f.label.toLowerCase(),y=m.startsWith(d)?0:1,b=g.startsWith(d)?0:1;return y!==b?y-b:m.localeCompare(g)}).slice(0,ch)}catch(l){return i.aborted||console.warn("Failed to load @ extension suggestions",l),[]}}}}function Hge(e,t,n,s,r){return{id:di,label:n,description:s,order:3,async search({query:i,signal:o}){var l;const a=(l=e())==null?void 0:l.loadMcpStatus;if(!a)return[];try{const c=t();c.mcpStatus??(c.mcpStatus=a().catch(f=>{throw c.mcpStatus=void 0,f}));const d=await c.mcpStatus;if(o.aborted)return[];const h=i.toLowerCase();return d.servers.filter(f=>!f.disabled).map(f=>{const m=Nl(f.name),g=f.resourceCount===void 0?void 0:r(f.resourceCount);return f.resourceCount===0?{id:`mcp-server-ref:${f.name}`,label:Ec(f.name),description:js(f.description??""),detail:js(f.description??""),insertText:`@mcp:${uh(m)} `,kind:"insert"}:{id:`mcp-server:${f.name}`,label:Ec(f.name),description:g===void 0?js(f.description??""):g,detail:js(f.description??""),kind:"mcp-server",serverName:f.name}}).filter(f=>pw(h,f.label,f.description)).sort((f,m)=>f.label.localeCompare(m.label)).slice(0,ch)}catch(c){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",c),[]}}}}function Uge(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function Vge({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:s,builtinProviders:r,providers:i=Tge,createInlineTagEffect:o}){const{t:a}=it(),[l,c]=p.useState(null),d=p.useRef(null),h=p.useRef(0),f=p.useRef(null),m=p.useRef(null),g=p.useRef("."),y=p.useRef(N4()),b=p.useRef(null),w=p.useRef(null),v=p.useRef(!1),x=p.useMemo(()=>[...[Fge(()=>s.current,()=>g.current,()=>y.current,a("at.category.files"),a("at.category.files.description")),qge(()=>s.current,()=>y.current,a("at.category.extensions"),a("at.category.extensions.description")),Hge(()=>s.current,()=>y.current,a("at.category.mcpResources"),a("at.category.mcpResources.description"),W=>a("mcp.resourceCount",{count:W}))].filter(W=>Ege(W.id,r)),...Mge(i)].sort((W,J)=>(W.order??0)-(J.order??0)),[r,i,a,s]),C=p.useRef(x);C.current=x;const A=p.useMemo(()=>x.map(U=>({id:U.id,provider:U,textValue:YM(U),label:typeof U.label=="string"?YM(U):U.label,description:U.description===void 0?void 0:js(U.description),tabs:U.tabs,renderItem:U.renderItem})),[x]),T=p.useRef(A);T.current=A;const _=p.useCallback(U=>{const W=typeof U=="function"?U(d.current):U;d.current=W,c(W)},[]),R=p.useCallback(()=>{var U;(U=f.current)==null||U.abort(),f.current=null,m.current&&(clearTimeout(m.current),m.current=null)},[]),I=p.useCallback((U={})=>{R(),y.current=N4();const W=U.preserveProviderSelection||v.current;v.current=!1,W||(b.current=null,w.current=null),_(null)},[R,_]),k=p.useCallback(()=>{const U=d.current;return U?U.level==="items"?(R(),_({...U,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"):(I(),"closed"):!1},[R,I,_]);p.useEffect(()=>()=>{var U;m.current&&clearTimeout(m.current),(U=f.current)==null||U.abort(),f.current=null,g.current=".",y.current=N4()},[]);const j=p.useCallback((U,W,J)=>{const G=d.current;return(G==null?void 0:G.level)!=="items"||G.selectedProviderId!==U||G.selectedTabId!==J.selectedTabId||G.itemMode!==J.itemMode||G.mcpServerName!==J.mcpServerName||G.fileDirectory!==J.fileDirectory?[]:G.query!==W&&!qy(U)?[]:U===li&&W===""&&g.current==="."?[]:G.items},[]),N=p.useCallback((U,W)=>{const J=s.current,G=y.current;if(U===li){if(J!=null&&J.listDirectory){const{dirPath:H}=vF(W,bc(g.current));return G.directories.has(H)}const te=W?`${bF(W)}*`:"**/*";return!!(J!=null&&J.globWorkspace)&&G.globResults.has(te)}return U===Nm?G.extensionsStatus!==void 0:U===di?G.mcpStatus!==void 0:!1},[s]),L=p.useCallback((U,W,J,G={})=>{var Ne;const te=C.current.find(Ie=>Ie.id===U);if(!te){console.warn(`[@mention] provider="${U}" not found (may have been removed)`),_(null);return}(Ne=f.current)==null||Ne.abort();const H=new AbortController;f.current=H;const ie=h.current+1;h.current=ie;const fe=j(U,W,J);G.loadingAlreadySet||_({...J,items:fe,loading:!0}),Promise.resolve().then(()=>te.search({query:W,signal:H.signal,tabId:J.selectedTabId})).then(Ie=>{H.signal.aborted||h.current!==ie||_(Ce=>{if(!Ce||Ce.level!=="items")return Ce;const ve=U===li&&W.length===0?fF:ch;return{...Ce,items:Ie.slice(0,ve).map(ut=>$ge(ut,{customProvider:!qy(U)})),selectedIndex:0,loading:!1}})}).catch(Ie=>{H.signal.aborted||h.current!==ie||(console.warn(`[@mention] provider="${U}" query=<redacted> failed`,Ie),_(Ce=>!Ce||Ce.level!=="items"?Ce:{...Ce,items:[],selectedIndex:0,loading:!1}))})},[j,_]),$=p.useCallback((U,W,J)=>{var te;m.current&&clearTimeout(m.current),(te=f.current)==null||te.abort(),f.current=null;const G=j(U,W,J);if(_({...J,items:G,loading:!0}),N(U,W)){L(U,W,J,{loadingAlreadySet:!0});return}m.current=setTimeout(()=>{m.current=null,L(U,W,J,{loadingAlreadySet:!0})},KM)},[j,N,L,_]),F=p.useCallback((U,W,J,G={})=>{var ve,ut;const te=s.current,H=te==null?void 0:te.loadMcpResources;if(!H){console.warn(`[@mention] loadMcpResources not available for server="${U}"`),_({...J,items:[],loading:!1});return}(ve=f.current)==null||ve.abort();const ie=new AbortController;f.current=ie;const fe=h.current+1;h.current=fe;const Ne=((ut=d.current)==null?void 0:ut.level)==="items"&&d.current.itemMode==="mcpResources"&&d.current.mcpServerName===U?d.current.items:[];G.loadingAlreadySet||_({...J,items:Ne,loading:!0});const Ie=te==null?void 0:te.loadMcpStatus;(G.validateServer?Lge(te,U,ie.signal,Ie?()=>{const ae=y.current;return ae.mcpStatus??(ae.mcpStatus=Ie().catch(Ct=>{throw ae.mcpStatus=void 0,Ct})),ae.mcpStatus}:void 0):Promise.resolve(!0)).then(ae=>ie.signal.aborted?{resources:[]}:ae?hS(y.current.mcpResources,U,()=>H(U,{signal:ie.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:U}),{resources:[]})).then(ae=>{if(ie.signal.aborted||h.current!==fe)return;const Ct=ae.resources.map(Ke=>{const on=js(Ke.title??"")??js(Ke.name??"")??Ec(Ke.uri);return{id:`mcp-resource:${U}:${Ke.uri}`,label:on,description:js(Ke.description??"")??js(Ke.mimeType??""),detail:Ec(Ke.uri),insertText:Ige(U,Ke.uri),kind:"insert"}}).filter(Ke=>pw(W,Ke.label,Ke.description,Ke.detail)).sort((Ke,on)=>Ke.label.localeCompare(on.label)).slice(0,ch);_(Ke=>!Ke||Ke.level!=="items"?Ke:{...Ke,items:Ct,selectedIndex:0,loading:!1})}).catch(ae=>{ie.signal.aborted||h.current!==fe||(console.warn("Failed to load @ MCP resources",ae),_(Ct=>!Ct||Ct.level!=="items"?Ct:{...Ct,items:[],selectedIndex:0,loading:!1}))})},[_,s]),B=p.useCallback((U,W,J,G={})=>{var H,ie;m.current&&clearTimeout(m.current),(H=f.current)==null||H.abort(),f.current=null;const te=((ie=d.current)==null?void 0:ie.level)==="items"&&d.current.itemMode==="mcpResources"&&d.current.mcpServerName===U&&J.itemMode==="mcpResources"?d.current.items:[];if(_({...J,items:te,loading:!0}),y.current.mcpResources.has(U)){F(U,W,J,{...G,loadingAlreadySet:!0});return}m.current=setTimeout(()=>{m.current=null,F(U,W,J,{...G,loadingAlreadySet:!0})},KM)},[F,_]),Q=p.useCallback(U=>{if(t.current||n.current)return I(),!1;const W=Oge(U);if(!W)return I(),!1;const J=d.current;if((J==null?void 0:J.level)==="items"&&J.from===W.from&&(J.to===W.to||J.inputMode==="search"&&W.to>=J.to||J.inputMode==="context"&&W.to>=J.to)&&J.selectedProviderId!==void 0&&T.current.some(H=>H.id===J.selectedProviderId)){if(!J.selectedProviderId)return!0;const H=J.selectedProviderId,ie=J.inputMode==="context"?Rge(H,W.query,J.mcpServerName):J.query;if(ie!==J.query){const fe={...J,from:W.from,to:W.to,query:ie,selectedIndex:0,providers:T.current};return H===di&&J.itemMode==="mcpResources"&&J.mcpServerName?(B(J.mcpServerName,ie,fe,{validateServer:J.validateMcpServer}),!0):($(H,ie,fe),!0)}return _({...J,from:W.from,to:W.to,query:ie,providers:T.current}),!0}const te=T.current.filter(H=>pw(W.query,H.textValue,H.description));if(te.length===0&&W.query){const H=jge(W.query,b.current,w.current);if(H&&T.current.some(fe=>fe.id===H.providerId))return H.providerId===di&&H.serverName?(w.current=H.serverName,B(H.serverName,H.itemQuery,{from:W.from,to:W.to,query:H.itemQuery,level:"items",selectedProviderId:di,selectedIndex:0,providers:T.current,itemMode:"mcpResources",mcpServerName:H.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:H.validateServer},{validateServer:H.validateServer}),!0):($(H.providerId,H.itemQuery,{from:W.from,to:W.to,query:H.itemQuery,level:"items",selectedProviderId:H.providerId,selectedIndex:0,providers:T.current,itemMode:"default",mcpServerName:void 0,fileDirectory:H.providerId===li?g.current:void 0,inputMode:"context"}),!0);const ie=T.current.find(fe=>!qy(fe.id)&&W.query.startsWith(`${fe.id}:`));if(ie){const fe=W.query.slice(ie.id.length+1);return $(ie.id,fe,{from:W.from,to:W.to,query:fe,level:"items",selectedProviderId:ie.id,selectedIndex:0,providers:T.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(T.current.some(fe=>fe.id===li))return g.current=".",$(li,W.query,{from:W.from,to:W.to,query:W.query,level:"items",selectedProviderId:li,selectedIndex:0,providers:T.current,itemMode:"default",mcpServerName:void 0,fileDirectory:g.current,inputMode:"context"}),!0}return _({from:W.from,to:W.to,query:W.query,level:"categories",selectedIndex:0,providers:te,items:[],loading:!1,inputMode:void 0}),!0},[I,t,$,B,_,n]),Y=p.useCallback(U=>{const W=d.current;if(!W)return!1;const J=W.level==="categories"?W.providers.length:W.items.length;if(J<=0)return!0;const G=Uge(W.selectedIndex,J,U);return G===null||_({...W,selectedIndex:G}),!0},[_]),ne=p.useCallback(U=>{const W=d.current;if(!W)return!1;const J=W.level==="categories"?W.providers.length:W.items.length;return U<0||U>=J?!1:(_({...W,selectedIndex:U}),!0)},[_]),P=p.useCallback(U=>{var te,H;const W=d.current;if(!W||W.level!=="categories")return!1;const J=W.providers[U??W.selectedIndex];if(!J)return!1;b.current=J.id,J.id===li&&(g.current=".");const G=(H=(te=J.tabs)==null?void 0:te.find(ie=>!ie.disabled))==null?void 0:H.id;return $(J.id,W.query,{...W,level:"items",selectedProviderId:J.id,selectedIndex:0,tabs:J.tabs,selectedTabId:G,itemMode:J.id===di?"mcpServers":"default",mcpServerName:void 0,fileDirectory:J.id===li?g.current:void 0,inputMode:"search"}),!0},[$]),le=p.useCallback(U=>{const W=d.current;if(!W||W.level!=="items"||!W.selectedProviderId)return!1;const J={...W,query:U,selectedIndex:0,inputMode:"search"};return W.selectedProviderId===di&&W.itemMode==="mcpResources"&&W.mcpServerName?(B(W.mcpServerName,U,J,{validateServer:W.validateMcpServer}),!0):($(W.selectedProviderId,U,J),!0)},[$,B]),z=p.useCallback(U=>{var G;const W=d.current;if(!W||W.level!=="items"||!W.selectedProviderId||!((G=W.tabs)!=null&&G.some(te=>te.id===U&&!te.disabled)))return!1;if(W.selectedTabId===U)return!0;const J={...W,selectedTabId:U,selectedIndex:0,inputMode:"search"};return $(W.selectedProviderId,W.query,J),!0},[$]),M=p.useCallback(()=>{const U=d.current;if(!U||U.level!=="items")return!1;if(U.selectedProviderId===di&&U.itemMode==="mcpResources")return $(di,"",{...U,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(U.selectedProviderId===li){const W=bc(U.fileDirectory??g.current);if(W!==".")return g.current=Dge(W),$(li,"",{...U,query:"",selectedIndex:0,fileDirectory:g.current,inputMode:"search"}),"items"}return _({...U,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}),R(),"categories"},[R,$,_]),re=p.useCallback(U=>{const W=d.current;if(!W)return!1;if(W.level==="categories")return P(U);const J=e.current;if(!J)return!1;if(W.loading)return!0;const G=W.items[U??W.selectedIndex];if(!G)return!1;if(W.selectedProviderId&&(b.current=W.selectedProviderId),W.selectedProviderId===li&&G.kind==="directory"&&G.targetPath)return g.current=bc(G.targetPath),$(li,"",{...W,query:"",selectedIndex:0,fileDirectory:g.current,inputMode:"search"}),!0;if(W.selectedProviderId===di&&G.kind==="mcp-server"&&G.serverName)return w.current=G.serverName,B(G.serverName,"",{...W,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:G.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const te=G.insertText??`@${uh(Nl(G.label))} `,H=G.composerTag&&!/\s$/.test(te)?`${te} `:te,ie=J.state.doc.length;if(W.from<0||W.to<W.from||W.to>ie)return console.warn("[@mention] stale insertion range",{from:W.from,to:W.to,docLength:ie}),I(),!0;if(!J.state.doc.sliceString(W.from,W.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:W.from,to:W.to}),I(),!0;v.current=!0;const Ne=zge(W.selectedProviderId,G,H),Ie=H.trimEnd(),Ce=Ne&&o?[o({from:W.from,to:W.from+Ie.length,tag:Ne})]:void 0;return J.dispatch({changes:{from:W.from,to:W.to,insert:H},...Ce?{effects:Ce}:{},selection:{anchor:W.from+H.length},scrollIntoView:!0}),J.focus(),I({preserveProviderSelection:!0}),!0},[I,P,o,$,B,e]);return{state:l,close:I,closeIfOpen:k,refreshForView:Q,moveSelection:Y,select:ne,accept:re,enterCategory:P,selectTab:z,backToCategories:M,updateSearch:le}}const Wge=Wn.mark({class:"cm-input-slash"}),Gge=Wn.mark({class:"cm-input-at"}),Kge=Wn.mark({class:"cm-input-code"});class Yge extends $l{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 XM(e,t,n){const s=new rh,r=e.state.doc,i=[];for(let o=1;o<=r.lines;o++){const a=r.line(o),l=a.text,c=a.from;if(l.startsWith("/")){const g=l.indexOf(" "),y=g===-1?l.length:g;i.push({from:c,to:c+y,deco:Wge})}const d=gge(l,t(),n());if(d){const g=l.endsWith(" ")?"":" ";i.push({from:c+l.length,to:c+l.length,deco:Wn.widget({widget:new Yge(`${g}${d}`),side:1})})}const h=/@[^\s]+/g;let f;for(;(f=h.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:Gge});const m=/`[^`]+`/g;for(;(f=m.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:Kge})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:l}of i)s.add(o,a,l);return s.finish()}function Qge(e=()=>[],t=()=>"en"){return ko.fromClass(class{constructor(n){ge(this,"decorations");this.decorations=XM(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=XM(n.view,e,t))}},{decorations:n=>n.decorations})}const Xge=Ft.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 Yp(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function xF(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 _u(e,t){return{[e]:xF(t)}}const Jge="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",Zge="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",e1e="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",t1e="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",n1e={extension:Jge,file:Zge,mcp:e1e,skill:t1e};function JM(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function Pv(e,t){if(e)return JM(t,e)??JM(n1e,e)}const s1e=1e3,r1e=10,ZM="web-shell-tooltip-styles",i1e=`
[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 o1e(){if(document.getElementById(ZM))return;const e=document.createElement("style");e.id=ZM,e.textContent=i1e,document.head.appendChild(e)}function a1e(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function l1e(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function T8(e){return l1e(e)}function c1e(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function u1e(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function d1e(e,t,n){if(!t.detail||!T8(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=`${c1e(t)}

${t.detail}`;const i=r.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete r.dataset.hideTimerId);const o=r.getBoundingClientRect(),a=18,l=12,c=12,d=window.innerWidth,h=window.innerHeight,f=n.clientX+a,m=f+o.width+c>d?Math.max(c,n.clientX-o.width-a):f,g=Math.min(Math.max(c,n.clientY+l),Math.max(c,h-o.height-c));r.style.position="fixed",r.style.left=`${m}px`,r.style.top=`${g}px`,r.style.right="auto",r.style.bottom="auto"}function h1e(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 f1e(e){if(!e.detail||!T8(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=>{d1e(t,e,s)}),n.addEventListener("mouseleave",()=>{const s=t.closest("[data-web-shell-tooltip-portal]");s&&h1e(s)}))}),t}function m1e(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function p1e(e){return[...e].length>s1e||e.split(`
`).length>r1e}function g1e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y1e(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 b1e(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function w1e(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((r,i)=>i.length-r.length),s=new RegExp(n.map(g1e).join("|"),"g");return t.replace(s,r=>e.get(r)??r)}function lp(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 v1e(e){return e.map(lp).join(`
`)}function $v(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function zv(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function C8(e){return zv(e)||$v(e)||e.id}function I4(e,t){const n=v1e(t);return n?e?`${n}

${e}`:n:e}function x1e(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(lp(i.tag)),s=i.end);return r.push(e.slice(s)),r.join("")}function Fv(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const S0=As.define({map:e=>e}),A8=As.define(),ec=As.define();class _1e extends $l{constructor(n){super();ge(this,"contentRoot",null);ge(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 f,m,g;const s=document.createElement("span"),r=Fv(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.tooltipText&&(s.title=this.tag.tooltipText),this.tag.onClick&&(s.setAttribute("role","button"),s.tabIndex=0,s.style.cursor="pointer",s.addEventListener("pointerdown",y=>{y.preventDefault(),y.stopPropagation()}),s.addEventListener("mousedown",y=>{y.preventDefault(),y.stopPropagation()}),s.addEventListener("click",y=>{var b,w;y.stopPropagation(),(w=(b=this.tag).onClick)==null||w.call(b,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()})}),s.addEventListener("keydown",y=>{var b,w;y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),(w=(b=this.tag).onClick)==null||w.call(b,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()}))}));const i=$v(this.tag),o=zv(this.tag),a=this.tag.kind?"":i,l=this.tag.iconUrl??Pv(this.tag.kind),c=l&&Am(l)?l:void 0;let d;try{d=(m=(f=this.tag).renderContent)==null?void 0:m.call(f,{tag:r,placement:"composer",readonly:!1})}catch(y){console.warn("[WebShell] inline tag renderContent failed",y)}let h=!1;if(d!=null){const y=document.createElement("span");y.style.cssText="display:inline-flex;align-items:center;min-width:0;max-width:100%;";try{this.contentRoot=mk.createRoot(y),this.contentRoot.render(d),s.appendChild(y),h=!0}catch(b){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",b)}}if(!h&&c){const y=document.createElement("span");y.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;",y.style.setProperty("--composer-tag-icon-url",xF(c)),s.appendChild(y)}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;";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);try{this.tooltipRoot=mk.createRoot(r),this.tooltipRoot.render(s),n.appendChild(r)}catch(l){(a=this.tooltipRoot)==null||a.unmount(),this.tooltipRoot=null,console.warn("[WebShell] inline tag tooltip render failed",l)}}appendRemoveButton(n,s){const r=document.createElement("button");r.type="button",r.setAttribute("aria-label",`Remove ${C8(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(uu).between(0,s.state.doc.length,(a,l,c)=>{const d=c.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:a,to:l,insert:""})}),o.length!==0&&(s.dispatch({changes:o,effects:A8.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 k1e(e){const t={widget:new _1e(e.tag),inclusive:!1,tag:e.tag};return Wn.replace(t).range(e.from,e.to)}const uu=Pl.define({create(){return Wn.none},update(e,t){let n=e.map(t.changes);for(const s of t.effects)s.is(S0)?n=n.update({add:[k1e(s.value)]}):s.is(A8)?n=n.update({filter:(r,i,o)=>{const a=o.spec.tag;return a&&s.value.predicate?!s.value.predicate(a):!0}}):s.is(ec)&&(n=Wn.none);return n},provide:e=>[Ft.decorations.from(e),Ft.atomicRanges.of(t=>t.state.field(e))]});function eN(e){const t=[];return e.state.field(uu).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push(Fv(i))}),t}function S1e(e){const t=[];return e.state.field(uu).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push({start:n,end:s,tag:Fv(i)})}),t}const tN=new Th,nN=new Th,sN=new Th;function Ad(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function T1e(e,t){const n=Ad(e,t);if(!n||e.length===0)return null;const s=n.slice(e.length);return s.length>0?s:null}class C1e extends $l{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 rN(e){return ko.fromClass(class{constructor(t){ge(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return Wn.none;const n=t.state.selection.main,s=t.state.doc.toString(),r=T1e(s,e);return!r||!n.empty||n.head!==s.length?Wn.none:Wn.set([Wn.widget({widget:new C1e(r),side:1}).range(s.length)])}},{decorations:t=>t.decorations})}function iN(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 A1e(e){const{onSubmit:t,onCycleMode:n,onToggleShortcuts:s,disabled:r=!1,placeholderText:i="Type a message...",commands:o,skills:a=[],slashCommandCategoryOrder:l,queuedMessages:c=[],onPopQueuedMessages:d,currentMode:h="default",onFocusFooter:f,dialogOpen:m=!1,followupState:g,onAcceptFollowup:y,onDismissFollowup:b,sessionName:w,composerInput:v,composerInputVersion:x,builtinAtProviders:C,atProviders:A,composerTagIcons:T,renderComposerTag:_,renderComposerTagTooltip:R,onComposerTagClick:I,editorTheme:k}=e,j=uD(),{language:N,t:L}=it(),$=p.useRef(null),F=p.useRef(null),B=p.useRef(t);B.current=t;const Q=p.useRef(n);Q.current=n;const Y=p.useRef(s);Y.current=s;const ne=p.useRef(r);ne.current=r;const P=p.useRef(o);P.current=o;const le=p.useRef(a);le.current=a;const z=p.useRef(l);z.current=l;const M=p.useRef(L);M.current=L;const re=p.useRef(c);re.current=c;const U=p.useRef(d);U.current=d;const W=p.useRef(g);W.current=g;const J=p.useRef(y);J.current=y;const G=p.useRef(b);G.current=b;const te=p.useRef(f);te.current=f;const H=p.useRef(N);H.current=N;const ie=p.useRef(j==null?void 0:j.actions);ie.current=j==null?void 0:j.actions;const fe=p.useRef(T);fe.current=T;const Ne=p.useRef(_);Ne.current=_;const Ie=p.useRef(R);Ie.current=R;const Ce=p.useRef(I);Ce.current=I;const ve=p.useCallback(se=>{var dt;const me=se.icon??Pv(se.kind,fe.current),Oe={tag:se,placement:"composer",readonly:!1};let et;try{et=(dt=Ie.current)==null?void 0:dt.call(Ie,Oe)}catch($t){console.warn("[WebShell] inline tag tooltip render failed",$t)}const Se=typeof et=="string"||typeof et=="number"?String(et):void 0;return{...se,...me?{iconUrl:me}:{},...Ne.current?{renderContent:Ne.current}:{},...et!=null?{tooltip:et}:{},...Se?{tooltipText:Se}:{},...Ce.current?{onClick:Ce.current}:{}}},[]),[ut,ae]=p.useState(!1),Ct=p.useRef(ut);Ct.current=ut;const Ke=Vge({viewRef:F,disabledRef:ne,shellModeRef:Ct,workspaceActionsRef:ie,builtinProviders:C,providers:A,createInlineTagEffect:se=>S0.of({...se,tag:ve(se.tag)})}),on=Ke.close,qt=Ke.refreshForView;p.useEffect(()=>{const se=F.current;if(!se)return;const me=[ec.of()];se.state.field(uu).between(0,se.state.doc.length,(Oe,et,Se)=>{const dt=Se.spec.tag;dt&&me.push(S0.of({from:Oe,to:et,tag:ve(Fv(dt))}))}),me.length!==1&&se.dispatch({effects:me})},[T,I,_,R,ve]);const gt=p.useCallback(()=>{var se,me,Oe;(se=W.current)!=null&&se.isVisible&&((me=G.current)==null||me.call(G)),ae(et=>!et),(Oe=F.current)==null||Oe.focus()},[]),[St,ft]=p.useState(!1),[de,_e]=p.useState(""),[Ue,Xe]=p.useState([]),[yt,ye]=p.useState(0),Kt=p.useRef(null),Ee=p.useRef(null),ct=p.useRef(""),[qn,Me]=p.useState([]),qe=p.useRef([]),Fe=p.useRef(new Map),Ht=p.useRef(1),[Mn,Rn]=p.useState([]),Bn=p.useRef([]);Bn.current=Mn;const Hr=p.useRef(v);Hr.current=v;const Ut=p.useRef(()=>!0),vn=p.useRef(null),[tn,Jt]=p.useState(null),Nn=p.useRef(null),fn=p.useRef(!1),Pn=p.useCallback(se=>{Nn.current=se,Jt(se)},[]),Gn=p.useCallback(()=>{const se=vn.current,me=F.current;if(!se||!me)return;const Oe=me.state.doc,et=se.from+se.text.length;Oe.length===et&&Oe.sliceString(se.from,et)===se.text&&me.dispatch({changes:{from:se.from,to:et,insert:""}}),vn.current=null},[]),Hn=p.useCallback(()=>{Gn(),on()},[Gn,on]),qs=Ke.closeIfOpen,br=p.useCallback(()=>{const se=qs();return se?(se==="closed"&&Gn(),!0):!1},[Gn,qs]),Dn=p.useCallback((se,me)=>{var $t;if(!se||ne.current||Ct.current){Pn(null);return}if(fn.current){Pn(null);return}const Oe=se.state.selection.main;if(!Oe.empty){Pn(null);return}const et=vge(se.state.doc.toString(),Oe.head,P.current,le.current,H.current,Xn=>M.current(Xn),z.current??Gp);if(!et){Pn(null);return}Hn();const Se=me??(($t=Nn.current)==null?void 0:$t.selectedIndex)??0,dt=Math.max(0,Math.min(Se,et.items.length-1));Pn({...et,selectedIndex:dt})},[Hn,Pn]),ln=p.useCallback(()=>{Pn(null)},[Pn]),Es=p.useCallback(se=>{const me=Nn.current;return!me||se<0||se>=me.items.length?!1:(me.selectedIndex===se||Pn({...me,selectedIndex:se}),!0)},[Pn]),Te=p.useCallback(se=>{const me=Nn.current;if(!me)return!1;const Oe=a1e(me.selectedIndex,me.items.length,se);return Oe===null?!1:(Pn({...me,selectedIndex:Oe}),!0)},[Pn]),Ye=p.useCallback(se=>{const me=F.current,Oe=Nn.current;if(!me||!Oe)return!1;const et=Oe.items[se??Oe.selectedIndex];return et?(me.dispatch({changes:{from:Oe.from,to:Oe.to,insert:et.apply},selection:{anchor:Oe.from+et.apply.length},scrollIntoView:!0}),me.focus(),!0):!1},[]),[_t,Bt]=p.useState(!1);p.useEffect(()=>{const se=F.current,me=(se==null?void 0:se.state.doc.toString())??"",Oe=Ad(me,g!=null&&g.isVisible?g.suggestion:null);Bt(me.trim().length>0||!!Oe||Mn.length>0||qn.length>0)},[Mn,qn,g==null?void 0:g.isVisible,g==null?void 0:g.suggestion]);const bn=GM(),ws=GM("qwen-web-shell-command-history"),{push:Zs,navigateUp:Ir,navigateDown:Ur,isNavigating:Bs,reset:we,getReverseMatches:xe,getLastEntry:wt,resetSearch:oe}=bn,ue=p.useRef({push:Zs,navigateUp:Ir,navigateDown:Ur,isNavigating:Bs,reset:we,getReverseMatches:xe,getLastEntry:wt,resetSearch:oe});ue.current={push:Zs,navigateUp:Ir,navigateDown:Ur,isNavigating:Bs,reset:we,getReverseMatches:xe,getLastEntry:wt,resetSearch:oe};const be=p.useRef(ws);be.current=ws,qe.current=qn;const lt=p.useCallback(se=>{const me=Ct.current,et=(me?be.current:ue.current).getReverseMatches(se);return me?et:et.filter(Se=>!Se.trimStart().startsWith("/"))},[]),Re=p.useCallback(()=>{if(ne.current)return;const se=F.current;if(!se)return;ln(),Hn();const me=se.state.doc.toString();ct.current=me,ft(!0),_e("");const Oe=Ct.current?be.current:ue.current;Xe(lt("")),ye(0),Oe.resetSearch(),setTimeout(()=>{var et;return(et=Kt.current)==null?void 0:et.focus()},0)},[Hn,ln,lt]),Nt=p.useRef(Re);Nt.current=Re;const bt=p.useCallback(()=>{if(ne.current)return;const se=F.current;if(!se)return;if(No(se.state)==="active"){xu(!1)(se),se.focus();return}if(se.state.doc.lines>1){se.focus();return}const me=Ct.current?be.current:ue.current,Oe=se.state.doc.toString(),et=me.navigateUp(Oe);et!==null&&se.dispatch({changes:{from:0,to:se.state.doc.length,insert:et},selection:{anchor:et.length}}),se.focus()},[]),rn=p.useCallback(()=>{if(ne.current)return;const se=F.current;if(!se)return;if(No(se.state)==="active"){xu(!0)(se),se.focus();return}if(se.state.doc.lines>1){se.focus();return}const Oe=(Ct.current?be.current:ue.current).navigateDown();Oe!==null&&se.dispatch({changes:{from:0,to:se.state.doc.length,insert:Oe},selection:{anchor:Oe.length}}),se.focus()},[]);p.useEffect(()=>{var es,Vr;if(!$.current)return;o1e();const se=document.createElement("div");se.setAttribute("data-web-shell-tooltip-portal",""),se.style.position="fixed",se.style.inset="0",se.style.zIndex="var(--web-shell-tooltip-z-index)",se.style.pointerEvents="none";const me=/\b\S*theme(?:Dark|Light)\S*/gi,Oe=()=>{var Vt,nn;let De=$.current,vt=null;if($.current){const Yt=getComputedStyle($.current);for(let mn=0;mn<Yt.length;mn+=1){const _n=Yt[mn];_n.startsWith("--")&&se.style.setProperty(_n,Yt.getPropertyValue(_n))}Yt.getPropertyValue("--web-shell-tooltip-z-index").trim()||se.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;De;){const Yt=(nn=(Vt=De.className)==null?void 0:Vt.match)==null?void 0:nn.call(Vt,me);if(Yt){vt=Yt[0];break}De=De.parentElement}vt&&(se.className=vt)};Oe(),document.body.appendChild(se);const et=new MutationObserver(Oe);let Se=$.current;for(;Se&&(et.observe(Se,{attributes:!0,attributeFilter:["class","style"]}),!((Vr=(es=Se.className)==null?void 0:es.match)!=null&&Vr.call(es,me)));)Se=Se.parentElement;const dt=(De,vt,Vt)=>{const nn=Vt===void 0?S1e(De):[],Yt=De.state.doc.toString(),mn=W.current,_n=vt===void 0&&nn.length===0&&(mn!=null&&mn.isVisible)?Ad(Yt,mn.suggestion):null,Ks=vt??_n??Yt,dr=Ks.length-Ks.trimStart().length,X=Ks.trim(),ke=vt===void 0&&_n===null?nn.map(wr=>({...wr,start:wr.start-dr,end:wr.end-dr})).filter(wr=>wr.end>0).map(wr=>({...wr,start:Math.max(0,wr.start)})):[],Le=Vt??Bn.current;if(!X&&Le.length===0)return!0;const Xt=Vt===void 0?x1e(X,ke):X,hn=w1e(Fe.current,Xt),pn=I4(hn,Le),cn=qe.current,is=Ct.current;let ri=!1;const _i=()=>{var wr,Na;ri||(ri=!0,Pn(null),_n&&((wr=J.current)==null||wr.call(J,"enter",{skipOnAccept:!0})),(Na=G.current)==null||Na.call(G),Fe.current.clear(),Ht.current=1,is?(be.current.push(hn),be.current.reset()):(ue.current.push(hn),ue.current.reset()),fn.current=!1,Rn([]),Me([]),De.dispatch({changes:{from:0,to:De.state.doc.length,insert:""},effects:ec.of()}))};return B.current(is?`!${pn}`:pn,cn.length>0?[...cn]:void 0,_i)===!1||_i(),!0};Ut.current=dt;const $t=De=>(De.dispatch(De.state.replaceSelection(`
`)),!0),Xn=(De,vt)=>{var mn;const Vt=W.current,nn=Vt==null?void 0:Vt.suggestion,Yt=Ad(De.state.doc.toString(),nn);return!(Vt!=null&&Vt.isVisible)||!Yt?!1:(De.dispatch({changes:{from:0,to:De.state.doc.length,insert:Yt},selection:{anchor:Yt.length},scrollIntoView:!0}),De.focus(),(mn=J.current)==null||mn.call(J,vt,{skipOnAccept:!0}),!0)},Tn=zp.of([{key:"Backspace",run:De=>{var Yt;const vt=De.state.selection.main;if(!vt.empty||vt.from!==0)return!1;let Vt=!1;if(De.state.field(uu).between(0,1,mn=>{mn===0&&(Vt=!0)}),Vt)return!1;let nn=-1;for(let mn=Bn.current.length-1;mn>=0;mn-=1)if(((Yt=Bn.current[mn])==null?void 0:Yt.removable)!==!1){nn=mn;break}return nn<0?!1:(Rn(mn=>mn.filter((_n,Ks)=>Ks!==nn)),!0)}},{key:"Delete",run:De=>{const vt=De.state.selection.main;if(!vt.empty||vt.from!==0)return!1;let Vt=!1;if(De.state.field(uu).between(0,1,Yt=>{Yt===0&&(Vt=!0)}),Vt)return!1;const nn=Bn.current.findIndex(Yt=>Yt.removable!==!1);return nn<0?!1:(Rn(Yt=>Yt.filter((mn,_n)=>_n!==nn)),!0)}},{key:"Enter",run:De=>{var Yt;if(Ke.accept())return!0;if(Nn.current)return Ye();if(No(De.state)==="active")return!1;const vt=W.current,nn=eN(De).length>0?null:Ad(De.state.doc.toString(),vt==null?void 0:vt.suggestion);return vt!=null&&vt.isVisible&&nn?((Yt=J.current)==null||Yt.call(J,"enter",{skipOnAccept:!0}),dt(De,nn)):dt(De)}},{key:"Shift-Enter",run:$t},{key:"Ctrl-j",run:$t},{key:"Mod-Enter",run:$t},{key:"Alt-Enter",run:$t},{key:"Escape",run:()=>br()?!0:Nn.current?(ln(),!0):Ct.current?(ae(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:De=>{var _n;const vt=Ct.current?be.current:ue.current;if(fn.current)Fy(De),ln(),Hn();else{if(Ke.moveSelection("up")||Te("up"))return!0;if(No(De.state)==="active")return xu(!1)(De)}const nn=iN(De,"up");if(nn==="handled")return!0;if(nn==="editor")return!1;if(Ct.current){const Ks=De.state.doc.toString(),dr=vt.navigateUp(Ks);return dr===null||(fn.current=!0,De.dispatch({changes:{from:0,to:De.state.doc.length,insert:dr},selection:{anchor:dr.length}})),!0}if(re.current.length>0&&(_n=U.current)!=null&&_n.call(U))return!0;const Yt=De.state.doc.toString(),mn=vt.navigateUp(Yt);return mn===null?!1:(fn.current=!0,De.dispatch({changes:{from:0,to:De.state.doc.length,insert:mn},selection:{anchor:mn.length}}),!0)}},{key:"ArrowDown",run:De=>{var mn;const vt=Ct.current?be.current:ue.current;if(fn.current)Fy(De),ln(),Hn();else{if(Ke.moveSelection("down")||Te("down"))return!0;if(No(De.state)==="active")return xu(!0)(De)}const nn=iN(De,"down");if(nn==="handled")return!0;if(nn==="editor")return!1;if(Ct.current){const _n=vt.navigateDown();return _n===null||(fn.current=vt.isNavigating(),De.dispatch({changes:{from:0,to:De.state.doc.length,insert:_n},selection:{anchor:_n.length}})),!0}const Yt=vt.navigateDown();return Yt===null?((mn=te.current)==null?void 0:mn.call(te))??!1:(fn.current=vt.isNavigating(),De.dispatch({changes:{from:0,to:De.state.doc.length,insert:Yt},selection:{anchor:Yt.length}}),!0)}},{key:"Ctrl-r",run:()=>(Nt.current(),!0)},{key:"Tab",run:De=>{if(Ke.accept()||Xn(De,"tab"))return!0;if(Nn.current)return Ye();if(No(De.state)==="active")return eF(De);const vt=De.state.doc.toString(),Vt=pge(vt,P.current,H.current);if(Vt)return De.dispatch({changes:{from:0,to:De.state.doc.length,insert:Vt},selection:{anchor:Vt.length}}),!0;const nn=mge(vt,P.current);return nn&&De.dispatch({changes:{from:0,to:De.state.doc.length,insert:nn},selection:{anchor:nn.length}}),!0}},{key:"ArrowRight",run:De=>!!(No(De.state)!=="active"&&Xn(De,"right"))},{key:"Shift-Tab",run:()=>{var De;return(De=Q.current)==null||De.call(Q),!0}}]),ss=Ft.updateListener.of(De=>{if(De.docChanged&&Fe.current.size>0){const Vt=b1e(Fe.current,De.state.doc.toString());Vt!==null&&(Ht.current=Vt)}De.transactions.some(Vt=>Vt.isUserEvent("input")||Vt.isUserEvent("delete"))&&(fn.current=!1),(De.docChanged||De.selectionSet)&&(Dn(De.view),fn.current?Hn():qt(De.view)&&ln())});let Yn=!1;const xn=Ft.updateListener.of(De=>{const vt=vn.current,Vt=No(De.state)==="active";if(vt){const nn=De.state.doc;if(!(nn.length===vt.from+vt.text.length&&nn.sliceString(vt.from)===vt.text))vn.current=null;else if(Yn&&!Vt){vn.current=null;const{view:mn}=De,{from:_n}=vt;window.setTimeout(()=>{if(F.current!==mn)return;const Ks=mn.state.doc;Ks.length===_n+vt.text.length&&Ks.sliceString(_n)===vt.text&&mn.dispatch({changes:{from:_n,to:_n+vt.text.length,insert:""}})},0)}}Yn=Vt,Vt||u1e(se)}),jr=ys.create({doc:"",extensions:[Sh.highest(Tn),$pe,wz(),zp.of([...Yz,...kz]),Ope({override:[],activateOnTyping:!0,icons:!1,optionClass:De=>{const vt=[];return De.type==="file"&&vt.push("cm-file-completion"),T8(De)&&vt.push("cm-command-info-completion"),vt.join(" ")},addToOptions:[{render:f1e,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(De,vt,Vt,nn,Yt)=>{const mn=nn.bottom-nn.top,_n=Yt.bottom-vt.bottom,Ks=_n>=mn||_n>vt.top,dr=Ks?"top":"bottom",X=Ks?Vt.bottom-vt.top:vt.bottom-Vt.top;return{style:`${dr}: ${X}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:De=>typeof De.apply=="string"&&De.apply.endsWith(" ")}),lme({parent:se}),nN.of(gM("")),sN.of(rN(null)),Ft.lineWrapping,tN.of(Ft.editable.of(!0)),Qge(()=>P.current,()=>H.current),Xge,uu,ss,xn,Ft.updateListener.of(De=>{if(De.docChanged){const vt=De.state.doc.toString(),Vt=W.current,nn=Ad(vt,Vt!=null&&Vt.isVisible?Vt.suggestion:null);Bt(vt.trim().length>0||!!nn||Bn.current.length>0||qe.current.length>0)}}),Ft.inputHandler.of((De,vt,Vt,nn)=>{var Yt;return nn==="!"&&De.state.doc.toString()===""&&No(De.state)!=="active"?(gt(),!0):nn==="?"&&De.state.doc.toString()===""&&No(De.state)!=="active"?((Yt=Y.current)==null||Yt.call(Y),!0):!1}),Ft.domEventHandlers({blur(De){return ln(),De.relatedTarget instanceof Element&&De.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const vt=F.current;vt!=null&&vt.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||Hn()},0),!1},paste(De){var Ks,dr,X,ke;const vt=(Ks=De.clipboardData)==null?void 0:Ks.items;if(!vt)return!1;let Vt=!1;for(const Le of vt)if(Le.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(Le.type)){Vt=!0;const Xt=Le.getAsFile();if(!Xt)continue;const hn=Le.type,pn=new FileReader;pn.onload=()=>{const cn=pn.result.split(",")[1];Me(is=>[...is,{data:cn,media_type:hn}])},pn.readAsDataURL(Xt)}if(Vt)return De.preventDefault(),!0;const nn=m1e(((dr=De.clipboardData)==null?void 0:dr.getData("text/plain"))??"");if(!nn||!p1e(nn))return!1;De.preventDefault(),rs.state.doc.toString()===""&&((X=W.current)!=null&&X.isVisible)&&((ke=G.current)==null||ke.call(G));const{placeholderText:Yt,nextPasteId:mn}=y1e(Fe.current,Ht.current,nn);Ht.current=mn;const _n=rs.state.selection.main;return rs.dispatch({changes:{from:_n.from,to:_n.to,insert:Yt},selection:{anchor:_n.from+Yt.length},scrollIntoView:!0}),!0}}),Ft.theme(k)]}),rs=new Ft({state:jr,parent:$.current});F.current=rs,rs.focus();const ms=rs.state.doc.toString().trim();return Bt(ms.length>0||Bn.current.length>0||qe.current.length>0),()=>{rs.dispatch({effects:ec.of()}),rs.destroy(),F.current=null,et.disconnect(),se.remove()}},[]),p.useEffect(()=>{const se=F.current;se&&(se.dispatch({effects:tN.reconfigure(Ft.editable.of(!r))}),r||se.focus())},[r]),p.useEffect(()=>{const se=F.current;if(!se)return;const me=!r&&(g!=null&&g.isVisible)&&g.suggestion?g.suggestion:null,Oe=me??(ut?L("editor.shellPlaceholder"):i);se.dispatch({effects:[nN.reconfigure(gM(Oe)),sN.reconfigure(rN(me))]})},[r,i,ut,L,g==null?void 0:g.isVisible,g==null?void 0:g.suggestion]),p.useEffect(()=>{const se=F.current;!se||No(se.state)!=="active"||(Fy(se),window.setTimeout(()=>{F.current===se&&zy(se)},0))},[N]);const Kn=[o.map(se=>{var me;return[se.name,se.description??"",se.source??"",se.displayCategory??"",se.argumentHint??"",((me=se.subcommands)==null?void 0:me.join(","))??""].join("\0")}).join(""),a.map(se=>[se.name,se.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");p.useEffect(()=>{Nn.current&&Dn(F.current)},[Kn,N,Dn]),p.useEffect(()=>{const se=F.current;se&&(m?(ln(),Hn(),se.contentDOM.blur()):se.focus())},[Hn,m,ln]),p.useEffect(()=>{const se=me=>{var ss,Yn,xn;if(ne.current||St||m||me.defaultPrevented)return;const Oe=me.target,et=(ss=$.current)==null?void 0:ss.contains(Oe),Se=document.activeElement===document.body;if(!et&&!Se)return;const dt=F.current,$t=W.current,Xn=Ad((dt==null?void 0:dt.state.doc.toString())??"",$t==null?void 0:$t.suggestion);if(dt&&!dt.hasFocus&&($t!=null&&$t.isVisible)&&Xn&&!Yp(me.target)){if(me.key==="Tab"&&!me.shiftKey&&!me.metaKey&&!me.ctrlKey&&!me.altKey&&No(dt.state)!=="active"){me.preventDefault(),dt.dispatch({changes:{from:0,to:dt.state.doc.length,insert:Xn},selection:{anchor:Xn.length},scrollIntoView:!0}),dt.focus(),(Yn=J.current)==null||Yn.call(J,"tab",{skipOnAccept:!0});return}if(me.key==="ArrowRight"&&!me.shiftKey&&!me.metaKey&&!me.ctrlKey&&!me.altKey&&No(dt.state)!=="active"){me.preventDefault(),dt.dispatch({changes:{from:0,to:dt.state.doc.length,insert:Xn},selection:{anchor:Xn.length},scrollIntoView:!0}),dt.focus(),(xn=J.current)==null||xn.call(J,"right",{skipOnAccept:!0});return}}if(me.metaKey||me.ctrlKey||me.altKey||me.key.length!==1||Yp(me.target)||!dt||dt.hasFocus)return;if(me.preventDefault(),me.key==="!"&&dt.state.doc.toString()===""){gt();return}const Tn=dt.state.selection.main;dt.dispatch({changes:{from:Tn.from,to:Tn.to,insert:me.key},selection:{anchor:Tn.from+me.key.length},scrollIntoView:!0}),dt.focus(),me.key==="/"?window.setTimeout(()=>{Dn(F.current)},0):me.key==="@"&&window.setTimeout(()=>{const jr=F.current;jr&&jr.hasFocus&&(ln(),qt(jr))},0)};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[qt,ln,St,m,Dn,gt]);const er=p.useCallback(()=>{var se;(se=F.current)==null||se.focus()},[]),vs=p.useCallback((se,me)=>{const Oe=F.current;if(!Oe||!se){Oe==null||Oe.focus();return}if((me==null?void 0:me.mode)==="replace"){Oe.dispatch({changes:{from:0,to:Oe.state.doc.length,insert:se},effects:ec.of(),selection:{anchor:se.length},scrollIntoView:!0}),Oe.focus();return}const et=Oe.state.selection.main;let Se=se,dt=!1,$t=null;const Xn=se==="@";let Tn=se==="/";if(se==="/")Oe.state.doc.lineAt(et.head).text.startsWith("/")?dt=!0:Oe.state.doc.length>0&&(dt=!0,Tn=!1);else if(se==="@"){const ss=et.from>0?Oe.state.doc.sliceString(et.from-1,et.from):"";Oe.state.doc.sliceString(et.from,et.from+1)==="@"?(dt=!0,$t=et.from+1):ss==="@"?dt=!0:ss&&!/\s/.test(ss)&&(Se=" @")}dt?$t!==null&&Oe.dispatch({selection:{anchor:$t},scrollIntoView:!0}):(Oe.dispatch({changes:{from:et.from,to:et.to,insert:Se},selection:{anchor:et.from+Se.length},scrollIntoView:!0}),Xn&&(vn.current={text:Se,from:et.from})),Oe.focus(),Tn?window.setTimeout(()=>{Dn(F.current)},0):Xn&&window.setTimeout(()=>{const ss=F.current;ss&&ss.hasFocus&&(ln(),qt(ss))},0)},[ln,qt,Dn]),tr=p.useCallback(()=>{var se;return((se=F.current)==null?void 0:se.state.doc.toString())??""},[]),ni=p.useCallback(se=>{const me=F.current;me&&(me.dispatch({changes:{from:0,to:me.state.doc.length,insert:se},effects:ec.of(),selection:{anchor:se.length},scrollIntoView:!0}),me.focus())},[]),ns=p.useCallback(se=>{const me=F.current;if(!me)return;const Oe=[];me.state.field(uu).between(0,me.state.doc.length,(et,Se,dt)=>{const $t=dt.spec.tag;$t&&(!se||se($t))&&Oe.push({from:et,to:Se,insert:""})}),me.dispatch({...Oe.length>0?{changes:Oe}:{},effects:A8.of({predicate:se}),scrollIntoView:!0})},[]),bi=p.useCallback(se=>{const me=(se==null?void 0:se.text)??!0,Oe=(se==null?void 0:se.tags)??!0,et=F.current;me&&et&&et.state.doc.length>0&&et.dispatch({changes:{from:0,to:et.state.doc.length,insert:""},effects:ec.of()}),me&&(Me([]),Fe.current.clear(),Ht.current=1),Oe&&(Rn([]),me||ns())},[ns]),Aa=p.useCallback(()=>{bi({text:!0,tags:!1})},[bi]),Ao=p.useCallback((se,me)=>{if(se.length!==0){if((me==null?void 0:me.placement)==="inline"){const Oe=F.current;if(!Oe)return;const et=Oe.state.selection.main;let Se=et.from;const dt=[],$t=se.map(Tn=>{const ss=lp(Tn);return dt.push({from:Se,to:Se+ss.length,tag:Tn}),Se+=ss.length+1,ss}).join(" "),Xn=$t?`${$t} `:"";Oe.dispatch({changes:{from:et.from,to:et.to,insert:Xn},effects:dt.length>0?dt.map(Tn=>S0.of({...Tn,tag:ve(Tn.tag)})):void 0,selection:{anchor:et.from+Xn.length},scrollIntoView:!0}),Oe.focus();return}Rn(Oe=>{const et=[...Oe];for(const Se of se){const dt=et.findIndex($t=>$t.id===Se.id);dt>=0?et[dt]=Se:et.push(Se)}return et})}},[ve]),Eo=p.useCallback(se=>{Rn(me=>me.filter(Oe=>Oe.id!==se||Oe.removable===!1)),ns(me=>me.id===se&&me.removable!==!1)},[ns]),io=p.useCallback(()=>{var se;return(((se=F.current)==null?void 0:se.state.doc.toString().trim().length)??0)>0||Bn.current.length>0||qe.current.length>0},[]),Ea=p.useCallback(se=>{const me=F.current;if(!me)return;const Oe=eN(me);if((se==null?void 0:se.tagPlacement)==="inline"){Ut.current(me,I4(se.text??"",se.tags??Oe),[]);return}if((se==null?void 0:se.text)!==void 0&&se.tags===void 0&&Oe.length>0){Ut.current(me,I4(se.text,Oe),[]);return}Ut.current(me,se==null?void 0:se.text,se?se.tags??[]:void 0)},[]),oo=p.useCallback(()=>{const se=ue.current.getLastEntry(Oe=>!Oe.startsWith("/")&&!Oe.startsWith("!"));!se||B.current(se)===!1||Me([])},[]),wi=p.useCallback(se=>{const me=F.current;me&&me.dispatch({changes:{from:0,to:me.state.doc.length,insert:se},selection:{anchor:se.length},scrollIntoView:!0})},[]);p.useEffect(()=>{const se=Hr.current;if(!se)return;const me=F.current;if(!me)return;const Oe=se.tagPlacement??"top";if(se.tags!==void 0&&Oe==="top"&&Rn([...se.tags]),se.text!==void 0||Oe==="inline"){const Se=Oe==="inline"?[...se.tags??[]]:[],dt=Se.map(lp).join(" "),$t=Oe==="inline"?dt&&se.text?`${dt} ${se.text}`:dt||(se.text??""):se.text??"",Xn=[ec.of()];if(Se.length>0){let Tn=0;for(const ss of Se){const Yn=lp(ss);Xn.push(S0.of({from:Tn,to:Tn+Yn.length,tag:ve(ss)})),Tn+=Yn.length+1}}me.dispatch({changes:{from:0,to:me.state.doc.length,insert:$t},effects:Xn,selection:{anchor:$t.length},scrollIntoView:!0})}else me.dispatch({effects:ec.of()});(se.text!==void 0||se.submit)&&me.focus();let et=null;return se.submit&&(et=window.setTimeout(()=>{F.current&&Ea(se)},0)),()=>{et!==null&&window.clearTimeout(et)}},[x,ve,Ea]);const vi=p.useCallback((se,me=!0)=>{var et;se&&wi(ct.current),ft(!1),_e(""),Xe([]),ye(0),(Ct.current?be.current:ue.current).resetSearch(),me&&((et=F.current)==null||et.focus())},[wi]);p.useEffect(()=>{if(!St)return;const se=me=>{if(me instanceof MouseEvent&&me.button!==0||me.defaultPrevented)return;const Oe=Ee.current,et=me.target;Oe&&et instanceof Node&&!Oe.contains(et)&&vi(!0,!1)};return window.addEventListener("mousedown",se),window.addEventListener("touchstart",se),()=>{window.removeEventListener("mousedown",se),window.removeEventListener("touchstart",se)}},[St,vi]);const xi=p.useCallback(se=>{var $t;if(!F.current)return;vi(!1);const Oe=se.trim();if(!Oe)return;const et=qe.current,Se=Ct.current;if(B.current(Se?`!${Oe}`:Oe,et.length>0?[...et]:void 0)===!1){wi(se);return}($t=G.current)==null||$t.call(G),Se?(be.current.push(Oe),be.current.reset()):(ue.current.push(Oe),ue.current.reset()),Me([]),wi("")},[vi,wi]),Ss=se=>{if(!se.nativeEvent.isComposing)if(se.key==="Escape")se.preventDefault(),vi(!0);else if(se.key==="Tab"){se.preventDefault();const me=Ue[yt];me&&wi(me),vi(!1)}else if(se.key==="Enter"){se.preventDefault();const me=Ue[yt];me?xi(me):vi(!1)}else se.key==="r"&&se.ctrlKey&&(se.preventDefault(),Ue.length>0&&ye(me=>(me+1)%Ue.length))},ao=se=>{const me=Ct.current?be.current:ue.current;Xe(lt(se)),ye(0),me.resetSearch()},Mo=se=>{const me=se.target.value;_e(me),!se.nativeEvent.isComposing&&ao(me)},Ka=se=>{const me=se.currentTarget.value;_e(me),ao(me)},Oc=p.useCallback(se=>{Me(me=>me.filter((Oe,et)=>et!==se))},[]),Ma=!ut&&!St&&!(g!=null&&g.isVisible)&&!r&&!m,si={clearText:Aa,clear:bi,focus:er,getText:tr,hasInput:io,setText:ni,addTags:Ao,removeTag:Eo,insertText:vs,retryLast:oo,restoreImages:se=>{Me(me=>[...me,...se])},submit:Ea};return{containerRef:$,viewRef:F,focus:er,submitText:p.useCallback(()=>{const se=F.current;se&&Ut.current(se)},[]),clearText:Aa,getText:tr,hasInput:io,hasContent:_t,handle:si,pastedImages:qn,removeImage:Oc,composerTags:Mn,removeTopTag:Eo,addTags:Ao,removeInlineTags:ns,insertText:vs,setText:ni,submit:Ea,clear:bi,retryLast:oo,replaceEditorText:wi,shellMode:ut,setShellMode:ae,toggleShellMode:gt,currentMode:h,sessionName:w,searchState:{searchMode:St,searchQuery:de,searchMatches:Ue,searchActiveIndex:yt,searchInputRef:Kt,searchUiRef:Ee,openHistorySearch:Re,closeSearch:vi,submitSearchMatch:xi,handleSearchKeyDown:Ss,handleSearchInput:Mo,handleSearchCompositionEnd:Ka},navigatePrevHistory:bt,navigateNextHistory:rn,showShortcutHints:Ma,followupState:g,disabled:r,onAcceptFollowup:y,onDismissFollowup:b,slashMenu:tn,closeSlashMenu:ln,selectSlashCompletion:Es,acceptSlashCompletion:Ye,atMenu:Ke.state,closeAtMenu:Hn,selectAtCompletion:Ke.select,acceptAtCompletion:Ke.accept,enterAtCategory:Ke.enterCategory,backAtCategories:Ke.backToCategories,updateAtSearch:Ke.updateSearch,selectAtTab:Ke.selectTab}}const E1e="_flash_96ig5_1",Ju={flash:E1e},M1e="_chatMessageRow_17pz3_41",N1e="_chatBubble_17pz3_48",I1e="_chatContent_17pz3_61",j1e="_messageTag_17pz3_66",R1e="_messageTagTooltip_17pz3_83",L1e="_messageTagClickable_17pz3_117",D1e="_messageTagIcon_17pz3_127",O1e="_messageTagLabel_17pz3_138",B1e="_messageTagValue_17pz3_139",P1e="_chatContentCollapsed_17pz3_162",$1e="_toggleButton_17pz3_167",z1e="_toggleIcon_17pz3_188",F1e="_toggleIconExpanded_17pz3_195",q1e="_chatImages_17pz3_199",H1e="_chatImageThumb_17pz3_206",Ii={chatMessageRow:M1e,chatBubble:N1e,chatContent:I1e,messageTag:j1e,messageTagTooltip:R1e,messageTagClickable:L1e,messageTagIcon:D1e,messageTagLabel:O1e,messageTagValue:B1e,chatContentCollapsed:P1e,toggleButton:$1e,toggleIcon:z1e,toggleIconExpanded:F1e,chatImages:q1e,chatImageThumb:H1e},U1e=p.memo(function({content:t,images:n,isLocateFlashing:s=!1}){const{t:r}=it(),{parseUserMessageContent:i,renderUserMessageContent:o,composerTagIcons:a,renderComposerTag:l,renderComposerTagTooltip:c,onComposerTagClick:d}=Va(),h=p.useRef(null),[f,m]=p.useState(!1),[g,y]=p.useState(!1),b=p.useMemo(()=>{const v=o==null?void 0:o({content:t,images:n});if(v!=null)return v;let x;try{x=i==null?void 0:i(t)}catch(C){return console.warn("[WebShell] failed to parse user message content",C),t}return!x||x.length===0?t:x.map((C,A)=>C.type==="text"?C.text:u.jsx(W1e,{tag:C.tag,composerTagIcons:a,renderComposerTag:l,renderComposerTagTooltip:c,onComposerTagClick:d},`${C.tag.id}-${A}`))},[t,n,d,i,a,l,c,o]),w=p.useCallback(()=>{const v=h.current;v&&y(v.scrollHeight>400)},[]);return p.useLayoutEffect(()=>{m(!1),w()},[t,n==null?void 0:n.length,w]),p.useEffect(()=>{const v=h.current;if(!v||typeof ResizeObserver>"u")return;const x=new ResizeObserver(w);return x.observe(v),()=>x.disconnect()},[w]),u.jsx("div",{className:Ii.chatMessageRow,children:u.jsxs("div",{className:`${Ii.chatBubble}${s?` ${Ju.flash}`:""}`,children:[u.jsxs("div",{ref:h,className:`${Ii.chatContent} ${g&&!f?Ii.chatContentCollapsed:""}`,children:[n&&n.length>0&&u.jsx("div",{className:Ii.chatImages,children:n.map((v,x)=>{const C=v.data.startsWith("data:")?v.data:`data:${v.mimeType};base64,${v.data}`;return Am(C)?u.jsx("img",{src:C,alt:r("user.uploadedImage",{index:x+1}),className:Ii.chatImageThumb,onLoad:w},x):null})}),b]}),g&&u.jsxs("button",{type:"button",className:Ii.toggleButton,onClick:()=>m(v=>!v),children:[u.jsx("span",{children:r(f?"userMessage.showLess":"userMessage.showMore")}),u.jsx("svg",{className:`${Ii.toggleIcon} ${f?Ii.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})});function V1e(e){return C8(e)}function W1e({tag:e,composerTagIcons:t,renderComposerTag:n,renderComposerTagTooltip:s,onComposerTagClick:r}){const i={tag:e,placement:"user-message",readonly:!0};let o,a;try{o=n==null?void 0:n(i)}catch(g){console.warn("[WebShell] user message tag render failed",g)}try{a=s==null?void 0:s(i)}catch(g){console.warn("[WebShell] user message tag tooltip render failed",g)}const l=!!r,c=$v(e),d=zv(e),h=e.kind?"":c,f=e.icon??Pv(e.kind,t),m=f&&Am(f)?f:void 0;return u.jsxs("span",{className:`${Ii.messageTag}${l?` ${Ii.messageTagClickable}`:""}`,role:l?"button":void 0,tabIndex:l?0:void 0,title:V1e(e),onClick:g=>{l&&(g.stopPropagation(),r==null||r({...i,anchorRect:g.currentTarget.getBoundingClientRect()}))},onKeyDown:g=>{l&&(g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),r==null||r({...i,anchorRect:g.currentTarget.getBoundingClientRect()})))},children:[o??u.jsxs(u.Fragment,{children:[m&&u.jsx("span",{className:Ii.messageTagIcon,style:_u("--user-message-tag-icon-url",m),"aria-hidden":"true"}),h&&u.jsx("span",{className:Ii.messageTagLabel,children:h}),d?u.jsx("span",{className:Ii.messageTagValue,children:d}):h?null:u.jsx("span",{className:Ii.messageTagLabel,children:e.id})]}),a!=null&&u.jsx("span",{className:Ii.messageTagTooltip,role:"tooltip",children:a})]})}const G1e="_message_yozed_1",K1e="_customFooter_yozed_7",Y1e="_messageFooter_yozed_11",Q1e="_copyButton_yozed_27",X1e="_footerTime_yozed_53",J1e="_thinking_yozed_65",Z1e="_thinkingBody_yozed_77",eye="_thinkingSummary_yozed_108",tye="_thinkingSummaryTextActive_yozed_130",nye="_thinkingSummaryIcon_yozed_136",sye="_thinkingSummaryText_yozed_130",rye="_thinkingChevronRight_yozed_193",iye="_thinkingChevronDown_yozed_194",oye="_thinkingExpandedWrap_yozed_255",aye="_thinkingExpandedClip_yozed_259",lye="_thinkingExpandedCollapsed_yozed_267",cye="_thinkingExpandedInner_yozed_271",uye="_content_yozed_319",dye="_contentBody_yozed_324",rr={message:G1e,customFooter:K1e,messageFooter:Y1e,copyButton:Q1e,footerTime:X1e,thinking:J1e,thinkingBody:Z1e,thinkingSummary:eye,thinkingSummaryTextActive:tye,thinkingSummaryIcon:nye,thinkingSummaryText:sye,thinkingChevronRight:rye,thinkingChevronDown:iye,thinkingExpandedWrap:oye,thinkingExpandedClip:aye,thinkingExpandedCollapsed:lye,thinkingExpandedInner:cye,content:uye,contentBody:dye},hye=p.memo(function({content:t,isStreaming:n,timestamp:s,onBranchSession:r,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:a=!1,customFooterInfo:l}){const{t:c}=it(),{renderAssistantTurnFooter:d}=Va(),[h,f]=p.useState(!1),m=!!t&&!n&&i,g=p.useMemo(()=>l?d==null?void 0:d(l):void 0,[l,d]),y=p.useCallback(()=>{var w;const b=(w=navigator.clipboard)==null?void 0:w.writeText(t);b&&b.then(()=>{f(!0),window.setTimeout(()=>f(!1),2e3)}).catch(()=>{})},[t]);return u.jsxs("div",{className:rr.message,children:[t&&u.jsx("div",{className:`${rr.content}${a?` ${Ju.flash}`:""}`,children:u.jsx("div",{className:rr.contentBody,children:u.jsx(Em,{content:t,source:"assistant",isStreaming:n})})}),g&&u.jsx("div",{className:rr.customFooter,children:g}),m&&u.jsxs("div",{className:rr.messageFooter,children:[u.jsx("button",{type:"button",className:rr.copyButton,title:c("assistant.copy"),"aria-label":c("assistant.copy"),onClick:y,children:h?u.jsx(mye,{}):u.jsx(fye,{})}),o&&r&&u.jsx("button",{type:"button",className:rr.copyButton,title:c("assistant.branch"),"aria-label":c("assistant.branch"),onClick:r,children:u.jsx(pye,{})}),s!==void 0&&u.jsx("span",{className:rr.footerTime,"aria-hidden":"true",children:Kf(s)})]})]})});function fye(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.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"}),u.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function mye(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function pye(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.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"}),u.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"}),u.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const gye=p.memo(function({content:t,isStreaming:n,timestamp:s,isLocateFlashing:r=!1}){const{t:i}=it(),o=p.useContext(fh),[a,l]=p.useState(!1),c=yye({isStreaming:n}),d=c==="thinking.running",h=p.useRef(s??Date.now()),f=p.useRef(d),[m,g]=p.useState(()=>Date.now()),[y,b]=p.useState(null);p.useEffect(()=>{if(!t||!d)return;g(Date.now());const x=setInterval(()=>g(Date.now()),1e3);return()=>clearInterval(x)},[t,d]),p.useEffect(()=>{if(t){if(d){f.current=!0,b(null);return}f.current&&y===null&&b(Date.now())}},[t,y,d]);const w=d||y?bye((d?m:y)-h.current):"",v=p.useCallback(()=>{l(x=>!x)},[]);return u.jsx("div",{className:`${rr.message}${r?` ${Ju.flash}`:""}`,children:t&&!o&&u.jsx("div",{className:rr.thinking,children:u.jsxs("div",{className:rr.thinkingBody,children:[u.jsxs("button",{type:"button",className:rr.thinkingSummary,onClick:v,"aria-expanded":a,title:i(a?"thinking.collapse":"thinking.expand"),children:[u.jsx("span",{className:rr.thinkingSummaryIcon,"aria-hidden":"true",children:u.jsx(wye,{})}),u.jsx("span",{className:d?`${rr.thinkingSummaryText} ${rr.thinkingSummaryTextActive}`:rr.thinkingSummaryText,children:i(c,d?{duration:w}:{})}),u.jsx("span",{className:a?rr.thinkingChevronDown:rr.thinkingChevronRight,"aria-hidden":"true"})]}),u.jsx("div",{className:a?rr.thinkingExpandedClip:`${rr.thinkingExpandedClip} ${rr.thinkingExpandedCollapsed}`,children:u.jsx("div",{className:rr.thinkingExpandedInner,children:u.jsx("div",{className:rr.thinkingExpandedWrap,children:u.jsx(Em,{content:t,source:"thinking",isStreaming:n})})})})]})})})});function yye({isStreaming:e}){return e?"thinking.running":"thinking.done"}function bye(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 wye(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),u.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),u.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"}),u.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 vye="_panel_8ng9u_1",xye="_title_8ng9u_16",_ye="_metaLine_8ng9u_22",kye="_progress_8ng9u_32",Sye="_spacer_8ng9u_38",Tye="_row_8ng9u_42",Cye="_detailRow_8ng9u_43",Aye="_subDetailRow_8ng9u_44",Eye="_symbol_8ng9u_65",Mye="_label_8ng9u_69",Nye="_value_8ng9u_73",Iye="_detailName_8ng9u_80",jye="_sectionTitle_8ng9u_88",Rye="_detailSection_8ng9u_94",Lye="_skillBlock_8ng9u_100",Dye="_hint_8ng9u_105",Oye="_detailCommand_8ng9u_111",Bye="_bodyLoaded_8ng9u_132",Pye="_accent_8ng9u_137",$ye="_secondary_8ng9u_141",zye="_warning_8ng9u_145",Fye="_error_8ng9u_149",qye="_success_8ng9u_153",an={panel:vye,title:xye,metaLine:_ye,progress:kye,spacer:Sye,row:Tye,detailRow:Cye,subDetailRow:Aye,symbol:Eye,label:Mye,value:Nye,detailName:Iye,sectionTitle:jye,detailSection:Rye,skillBlock:Lye,hint:Dye,detailCommand:Oye,bodyLoaded:Bye,accent:Pye,secondary:$ye,warning:zye,error:Fye,success:qye},fS="web-shell:context-usage:v1:",Qc="█",_F="▒",kF="░",SF=30;function Hye(e){return`${fS}${JSON.stringify(e)}`}function Uye(e){if(!e.startsWith(fS))return null;try{const t=JSON.parse(e.slice(fS.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function TF(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function cm(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function Vye(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function Wye(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function Gye({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?an.error:e>60?an.warning:an.accent;return u.jsxs("div",{className:an.progress,"aria-hidden":"true",children:[u.jsx("span",{className:o,children:Qc.repeat(Math.max(0,s))}),u.jsx("span",{className:an.secondary,children:kF.repeat(Math.max(0,i))}),u.jsx("span",{className:an.warning,children:_F.repeat(Math.max(0,r))})]})}function Xl({symbol:e,label:t,tokens:n,tokenLabel:s,contextWindowSize:r,symbolClassName:i=an.secondary,isOverLimit:o}){return u.jsxs("div",{className:an.row,children:[u.jsx("span",{className:`${an.symbol} ${i}`,children:e}),u.jsx("span",{className:an.label,children:t}),u.jsxs("span",{className:o?an.error:an.value,children:[cm(n)," ",s," (",Vye(n,r),"%)"]})]})}const j4="/context detail";function Kye({hint:e,onShowDetail:t}){const n=t?e.indexOf(j4):-1;return n<0?u.jsx("div",{className:an.hint,children:e}):u.jsxs("div",{className:an.hint,children:[e.slice(0,n),u.jsx("button",{type:"button",className:an.detailCommand,onClick:t,children:j4}),e.slice(n+j4.length)]})}function Yye({name:e,tokens:t,tokenLabel:n}){return u.jsxs("div",{className:an.detailRow,children:[u.jsxs("span",{className:an.secondary,children:["└"," "]}),u.jsx("span",{className:an.detailName,title:e,children:TF(e,SF)}),u.jsxs("span",{className:an.value,children:[cm(t)," ",n]})]})}function R4({title:e,items:t,getName:n,tokenLabel:s}){const r=Wye(t);return r.length===0?null:u.jsxs("section",{className:an.detailSection,children:[u.jsx("div",{className:an.sectionTitle,children:e}),r.map(i=>u.jsx(Yye,{name:n(i),tokens:i.tokens,tokenLabel:s},n(i)))]})}function Qye({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:u.jsxs("section",{className:an.detailSection,children:[u.jsx("div",{className:an.sectionTitle,children:t.skills}),n.map(s=>u.jsxs("div",{className:an.skillBlock,children:[u.jsxs("div",{className:an.detailRow,children:[u.jsxs("span",{className:an.secondary,children:["└"," "]}),u.jsxs("span",{className:an.detailName,title:s.name,children:[TF(s.name,SF),s.loaded&&u.jsxs("span",{className:an.success,children:[" ",t.active]})]}),u.jsxs("span",{className:an.value,children:[cm(s.tokens)," ",t.tokens]})]}),s.loaded&&s.bodyTokens!=null&&s.bodyTokens>0&&u.jsxs("div",{className:an.subDetailRow,children:[u.jsxs("span",{className:an.secondary,children:["  └"," "]}),u.jsx("span",{className:an.bodyLoaded,children:t.bodyLoaded}),u.jsxs("span",{className:an.success,children:["+",cm(s.bodyTokens)," ",t.tokens]})]})]},s.name))]})}function Xye({status:e,onShowDetail:t}){const{t:n}=it(),{usage:s}=e,{breakdown:r,contextWindowSize:i}=s,o=i>0?s.totalTokens/i*100:0,a=o>100,l=i>0?r.autocompactBuffer/i*100:0;return u.jsxs("div",{className:an.panel,children:[u.jsx("div",{className:an.title,children:n("contextUsage.title")}),s.isEstimated?u.jsx(u.Fragment,{children:u.jsxs("div",{className:an.metaLine,children:[u.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),u.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",cm(i)," ",n("contextUsage.tokens")]})]})}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:an.metaLine,children:[u.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),u.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",cm(i)," ",n("contextUsage.tokens")]})]}),a&&u.jsx("div",{className:an.error,children:n("contextUsage.overLimit")})]}),u.jsx(Gye,{usedPercentage:Math.min(o,100),bufferPercentage:l}),u.jsx("div",{className:an.spacer}),u.jsx(Xl,{symbol:Qc,label:n("contextUsage.used"),tokens:s.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?an.error:an.accent,isOverLimit:a}),u.jsx(Xl,{symbol:kF,label:n("contextUsage.free"),tokens:r.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),u.jsx(Xl,{symbol:_F,label:n("contextUsage.autocompactBuffer"),tokens:r.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:an.warning}),u.jsx("div",{className:an.spacer}),u.jsx("div",{className:an.sectionTitle,children:n("contextUsage.usageByCategory")}),u.jsx(Xl,{symbol:Qc,label:n("contextUsage.systemPrompt"),tokens:r.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:an.accent}),u.jsx(Xl,{symbol:Qc,label:n("contextUsage.builtinTools"),tokens:r.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:an.accent}),r.mcpTools>0&&u.jsx(Xl,{symbol:Qc,label:n("contextUsage.mcpTools"),tokens:r.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:an.accent}),u.jsx(Xl,{symbol:Qc,label:n("contextUsage.memoryFiles"),tokens:r.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:an.accent}),u.jsx(Xl,{symbol:Qc,label:n("contextUsage.skills"),tokens:r.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:an.accent}),!s.isEstimated&&u.jsx(Xl,{symbol:Qc,label:n("contextUsage.messages"),tokens:r.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:an.accent}),s.showDetails?u.jsxs(u.Fragment,{children:[u.jsx(R4,{title:n("contextUsage.builtinTools"),items:s.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),u.jsx(R4,{title:n("contextUsage.mcpTools"),items:s.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),u.jsx(R4,{title:n("contextUsage.memoryFiles"),items:s.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),u.jsx(Qye,{skills:s.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):u.jsx(Kye,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const Jye={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",task_stop:"TaskStop",send_message:"SendMessage",structured_output:"StructuredOutput",monitor:"Monitor",notebook_edit:"NotebookEdit",tool_search:"ToolSearch",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",workflow:"Workflow",web_search:"WebSearch",bash:"Shell",shell:"Shell Command",read:"ReadFile",write:"WriteFile",search:"Grep"};function CF(e){if(!e.trim())return"Tool";const t=Jye[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function zl(e,t){const n=CF(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 Fl(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function $r(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const Df=2e3;function E8(e,t){if(Hv(e.toolName)){const r=qv(e.args,"skill");if(r)return $r(r,Df)}const n=tbe(e,t);if(n)return $r(n,Df);const s=EF(e,t);return s?$r(s,Df):""}function AF(e,t){if(!zo(e.toolName))return E8(e,t);const n=qv(e.args,"description");if(n)return $r(n,Df);const s=EF(e,t,{includeTimeout:!1});return s?$r(s,Df):""}function Zye(e){return zo(e.toolName)?qv(e.args,"description"):""}function Ml(e){var t;if(!e.content)return pS(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return pS(e.rawOutput)}function ebe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=oN((pS(e.rawOutput)??"").trim());if(o)return o}const n=Ml(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(zo(t)){if(r>3)return`${r} lines of output`;const o=s[0]||"";return $r(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=oN(n.trim());return o||`${s.filter(l=>l.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 $r(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(Fl(t))return"";const i=s[0]||"";return $r(i,80)}function tbe(e,t){if(!e.title)return null;const n=CF(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 aN(o.replace(/^:\s*|\s+/,""),t)}return aN(s,t)}function oN(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function EF(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 ${bf(String(s.directory),t)}]`),s.is_background?o+=" [background]":i&&s.timeout&&(o+=` [timeout: ${String(s.timeout)}ms]`);const a=qv(s,"description");return a&&(o+=` (${a})`),$r(o,Df)}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):bf(String(s.file_path),t);if(s.url){const o=String(s.url),a=typeof s.prompt=="string"?s.prompt:void 0,l=a?`${o} — "${$r(a,40)}"`:o;return $r(l,80)}if(s.path)return bf(String(s.path),t);if(s.query)return $r(String(s.query),60);if(r==="list_directory"||r==="listfiles"){const o=s.path||s.directory||"";return bf(String(o),t)}return s.description?String(s.description):""}function qv(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function zo(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function Hv(e){return e.toLowerCase()==="skill"}function Ha(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(s=>Ha(s,t)))??!1}function aN(e,t){const n=e.trim();return MF(mS(n))?bf(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,s=>bf(s,t))}function bf(e,t){const n=mS(e),s=t?mS(t).replace(/\/+$/,""):"";return s&&(n===s||n.startsWith(`${s}/`))?n.slice(s.length+1)||".":MF(n)?nbe(n):n}function mS(e){return e.replace(/\\/g,"/")}function MF(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function nbe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function Mg(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function M8(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 Qp(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=M8(e);return n==="cancelled"||n==="canceled"||s.toLowerCase().includes("cancel")?"failed":e.status}function N8(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const sbe="general-purpose";function I8(e){var s;const t=Mg(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":sbe}function j8(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=Mg(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 rbe(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=zl(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 $r(r,50)}function pS(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 ibe="_panel_qchwm_1",obe="_title_qchwm_17",abe="_sectionTitle_qchwm_23",lbe="_spacer_qchwm_29",cbe="_pivotRow_qchwm_35",ube="_metricCell_qchwm_41",dbe="_metricCellSection_qchwm_48",hbe="_metricCellSub_qchwm_56",fbe="_modelCell_qchwm_64",mbe="_modelCellHeader_qchwm_71",pbe="_divider_qchwm_79",gbe="_kvRow_qchwm_87",ybe="_kvSubRow_qchwm_94",bbe="_kvLabel_qchwm_102",wbe="_kvValue_qchwm_106",vbe="_tableRow_qchwm_115",xbe="_modelUsageRow_qchwm_121",_be="_tableNameCol_qchwm_129",kbe="_tableToolCol_qchwm_137",Sbe="_tableNumCol_qchwm_145",Tbe="_tableValueCol_qchwm_153",Cbe="_success_qchwm_162",Abe="_error_qchwm_166",Ebe="_secondary_qchwm_170",Mbe="_warning_qchwm_174",rt={panel:ibe,title:obe,sectionTitle:abe,spacer:lbe,pivotRow:cbe,metricCell:ube,metricCellSection:dbe,metricCellSub:hbe,modelCell:fbe,modelCellHeader:mbe,divider:pbe,kvRow:gbe,kvSubRow:ybe,kvLabel:bbe,kvValue:wbe,tableRow:vbe,modelUsageRow:xbe,tableNameCol:_be,tableToolCol:kbe,tableNumCol:Sbe,tableValueCol:Tbe,success:Cbe,error:Abe,secondary:Ebe,warning:Mbe},gS="web-shell:session-stats:v1:";function Nbe(e,t="overview"){return`${gS}${JSON.stringify({_view:t,...e})}`}function Ibe(e){if(!e.startsWith(gS))return null;try{const t=JSON.parse(e.slice(gS.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 Bu(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 jd({label:e,children:t}){return u.jsxs("div",{className:rt.kvRow,children:[u.jsx("span",{className:rt.kvLabel,children:e}),u.jsx("span",{className:rt.kvValue,children:t})]})}function cp({label:e,children:t}){return u.jsxs("div",{className:rt.kvSubRow,children:[u.jsxs("span",{className:rt.secondary,children:["»"," ",e]}),u.jsx("span",{className:rt.kvValue,children:t})]})}function NF(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 jbe(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function Rbe(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function Lbe(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function al({metric:e,values:t,variant:n="normal"}){const s=n==="section"?rt.metricCellSection:n==="sub"?rt.metricCellSub:rt.metricCell;return u.jsxs("div",{className:rt.pivotRow,children:[u.jsx("span",{className:s,children:n==="sub"?`↳ ${e}`:e}),t.map((r,i)=>u.jsx("span",{className:rt.modelCell,children:r},i))]})}function Dbe({status:e}){const{t}=it(),{models:n,tools:s,files:r}=e,i=Object.values(n).reduce((y,b)=>y+b.api.totalLatencyMs,0),o=s.totalDurationMs,a=i+o,l=a>0?i/a*100:0,c=a>0?o/a*100:0,d=s.totalCalls>0?s.totalSuccess/s.totalCalls*100:0,h=NF(n),f=h.reduce((y,b)=>y+b.metrics.tokens.cached,0),m=h.reduce((y,b)=>y+b.metrics.tokens.prompt,0),g=m>0?f/m*100:0;return u.jsxs("div",{className:rt.panel,children:[u.jsx("div",{className:rt.title,children:t("stats.title")}),u.jsx("div",{className:rt.sectionTitle,children:t("stats.overview")}),u.jsx(jd,{label:t("stats.duration"),children:Bu(e.durationMs)}),u.jsx(jd,{label:t("stats.prompts"),children:e.promptCount}),u.jsx(jd,{label:t("stats.toolCalls"),children:u.jsxs("span",{children:[s.totalCalls," ",u.jsx("span",{className:rt.secondary,children:"("}),u.jsxs("span",{className:rt.success,children:["✓",s.totalSuccess]})," ",u.jsxs("span",{className:rt.error,children:["✗",s.totalFail]}),u.jsx("span",{className:rt.secondary,children:")"})]})}),u.jsx(jd,{label:t("stats.successRate"),children:u.jsxs("span",{className:d>=90?rt.success:d>=70?rt.warning:rt.error,children:[d.toFixed(1),"%"]})}),(r.totalLinesAdded>0||r.totalLinesRemoved>0)&&u.jsx(jd,{label:t("stats.codeChanges"),children:u.jsxs("span",{children:[u.jsxs("span",{className:rt.success,children:["+",r.totalLinesAdded]})," ",u.jsxs("span",{className:rt.error,children:["-",r.totalLinesRemoved]})]})}),u.jsx("div",{className:rt.spacer}),u.jsx("div",{className:rt.sectionTitle,children:t("stats.performance")}),u.jsxs(cp,{label:t("stats.apiTime"),children:[Bu(i)," ",u.jsxs("span",{className:rt.secondary,children:["(",l.toFixed(1),"%)"]})]}),u.jsxs(cp,{label:t("stats.toolTime"),children:[Bu(o)," ",u.jsxs("span",{className:rt.secondary,children:["(",c.toFixed(1),"%)"]})]}),h.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:rt.spacer}),u.jsx("div",{className:rt.sectionTitle,children:t("stats.modelUsage")}),u.jsx("div",{className:rt.spacer}),u.jsxs("div",{className:`${rt.tableRow} ${rt.modelUsageRow}`,children:[u.jsx("span",{className:rt.tableNameCol,children:t("stats.modelUsage")}),u.jsx("span",{className:rt.tableValueCol,children:t("stats.reqs")}),u.jsx("span",{className:rt.tableValueCol,children:t("stats.inputTokens")}),u.jsx("span",{className:rt.tableValueCol,children:t("stats.outputTokens")})]}),u.jsx("div",{className:rt.divider}),h.map(y=>u.jsxs("div",{className:`${rt.tableRow} ${rt.modelUsageRow}`,children:[u.jsx("span",{className:rt.tableNameCol,children:y.label}),u.jsx("span",{className:rt.tableValueCol,children:y.metrics.api.totalRequests}),u.jsx("span",{className:`${rt.tableValueCol} ${rt.warning}`,children:y.metrics.tokens.prompt.toLocaleString()}),u.jsx("span",{className:`${rt.tableValueCol} ${rt.warning}`,children:y.metrics.tokens.candidates.toLocaleString()})]},y.key)),g>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:rt.spacer}),u.jsxs("div",{children:[u.jsx("span",{className:rt.success,children:t("stats.savingsHighlight")})," ",f.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),u.jsxs("div",{className:rt.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function Obe({status:e}){const{t}=it(),n=NF(e.models);if(n.length===0)return u.jsxs("div",{className:rt.panel,children:[u.jsx("div",{className:rt.title,children:t("stats.modelStats")}),u.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 u.jsxs("div",{className:rt.panel,children:[u.jsx("div",{className:rt.title,children:t("stats.modelStats")}),u.jsx("div",{className:rt.spacer}),u.jsxs("div",{className:rt.pivotRow,children:[u.jsx("span",{className:rt.metricCellSection,children:t("stats.metric")}),n.map(o=>u.jsx("span",{className:rt.modelCellHeader,children:o.label},o.key))]}),u.jsx("div",{className:rt.divider}),u.jsx(al,{metric:t("stats.api"),values:[],variant:"section"}),u.jsx(al,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),u.jsx(al,{metric:t("stats.errors"),values:i(o=>{const a=jbe(o);return u.jsxs("span",{className:o.api.totalErrors>0?rt.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),u.jsx(al,{metric:t("stats.avgLatency"),values:i(o=>Bu(Rbe(o)))}),u.jsx("div",{className:rt.spacer}),u.jsx(al,{metric:t("stats.tokens"),values:[],variant:"section"}),u.jsx(al,{metric:t("stats.total"),values:i(o=>u.jsx("span",{className:rt.warning,children:o.tokens.total.toLocaleString()}))}),u.jsx(al,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),s&&u.jsx(al,{metric:t("stats.cached"),values:i(o=>u.jsxs("span",{className:rt.success,children:[o.tokens.cached.toLocaleString()," (",Lbe(o).toFixed(1),"%)"]})),variant:"sub"}),u.jsx(al,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),r&&u.jsx(al,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function Bbe(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 Pbe({status:e}){const{t}=it(),n=Bbe(e.tools.byName);if(n.length===0)return u.jsxs("div",{className:rt.panel,children:[u.jsx("div",{className:rt.title,children:t("stats.toolStats")}),u.jsx("div",{children:t("stats.noToolCalls")})]});const s=Object.values(e.tools.byName).reduce((o,a)=>{var l,c,d;return o.accept+=((l=a.decisions)==null?void 0:l.accept)??0,o.reject+=((c=a.decisions)==null?void 0:c.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 u.jsxs("div",{className:rt.panel,children:[u.jsx("div",{className:rt.title,children:t("stats.toolStats")}),u.jsx("div",{className:rt.spacer}),u.jsxs("div",{className:rt.tableRow,children:[u.jsx("span",{className:rt.tableToolCol,children:t("stats.toolName")}),u.jsx("span",{className:rt.tableNumCol,children:t("stats.calls")}),u.jsx("span",{className:rt.tableNumCol,children:t("stats.successRate")}),u.jsx("span",{className:rt.tableNumCol,children:t("stats.avgDuration")})]}),u.jsx("div",{className:rt.divider}),n.map(o=>{const a=o.stats.count>0?o.stats.success/o.stats.count*100:0,l=o.stats.count>0?o.stats.durationMs/o.stats.count:0;return u.jsxs("div",{className:rt.tableRow,children:[u.jsx("span",{className:`${rt.tableToolCol} ${rt.metricCell}`,children:zl(o.name,t)}),u.jsx("span",{className:rt.tableNumCol,children:o.stats.count}),u.jsxs("span",{className:`${rt.tableNumCol} ${a>=90?rt.success:a>=70?rt.warning:rt.error}`,children:[a.toFixed(1),"%"]}),u.jsx("span",{className:rt.tableNumCol,children:Bu(l)})]},o.name)}),u.jsx("div",{className:rt.spacer}),u.jsx("div",{className:rt.sectionTitle,children:t("stats.decisionSummary")}),u.jsx(jd,{label:t("stats.totalReviewed"),children:r}),u.jsx(cp,{label:t("stats.accepted"),children:u.jsx("span",{className:rt.success,children:s.accept})}),u.jsx(cp,{label:t("stats.rejected"),children:u.jsx("span",{className:rt.error,children:s.reject})}),u.jsx(cp,{label:t("stats.modified"),children:u.jsx("span",{className:rt.warning,children:s.modify})}),u.jsx("div",{className:rt.divider}),u.jsx(jd,{label:t("stats.agreementRate"),children:u.jsx("span",{className:r>0?i>=90?rt.success:i>=70?rt.warning:rt.error:void 0,children:r>0?`${i.toFixed(1)}%`:"--"})})]})}function $be({view:e,status:t}){switch(e){case"model":return u.jsx(Obe,{status:t});case"tools":return u.jsx(Pbe,{status:t});default:return u.jsx(Dbe,{status:t})}}function Uv(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 zbe="_panel_13hcg_1",Fbe="_title_13hcg_17",qbe="_row_13hcg_23",Hbe="_rowGap_13hcg_31",Ube="_label_13hcg_35",Vbe="_value_13hcg_41",Wbe="_accent_13hcg_46",$d={panel:zbe,title:Fbe,row:qbe,rowGap:Hbe,label:Ube,value:Vbe,accent:Wbe},{serialize:Gbe,parse:Kbe}=Uv("web-shell:status:v1:");function Ra({label:e,children:t,gap:n}){return u.jsxs("div",{className:`${$d.row}${n?` ${$d.rowGap}`:""}`,children:[u.jsx("span",{className:$d.label,children:e}),u.jsx("span",{className:$d.value,children:t})]})}function Ybe({info:e}){const{t}=it();return u.jsxs("div",{className:$d.panel,children:[u.jsx("div",{className:$d.title,children:t("about.title")}),e.cliVersion&&u.jsx(Ra,{label:t("about.qwenCode"),children:u.jsx("span",{className:$d.accent,children:e.cliVersion})}),e.runtime&&u.jsx(Ra,{label:t("about.runtime"),children:e.runtime}),e.platform&&u.jsx(Ra,{label:t("about.platform"),children:e.platform}),e.auth&&u.jsx(Ra,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&u.jsx(Ra,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&u.jsx(Ra,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&u.jsx(Ra,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&u.jsx(Ra,{label:t("about.sessionId"),children:e.sessionId}),u.jsx(Ra,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),u.jsx(Ra,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&u.jsx(Ra,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function Qbe(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function IF(e,t,n=50){const s=p.useRef(e);p.useEffect(()=>{s.current=e},[e]),p.useEffect(()=>{const r=o=>{o.defaultPrevented||Yp(o.target)&&!Qbe(o.target)||s.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",r)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",r)}},t)}const Xbe="_panel_1jx2a_1",Jbe="_title_1jx2a_13",Zbe="_header_1jx2a_18",ewe="_startup_1jx2a_24",twe="_note_1jx2a_28",nwe="_secondary_1jx2a_29",swe="_row_1jx2a_39",rwe="_selected_1jx2a_48",iwe="_disabled_1jx2a_52",owe="_pointer_1jx2a_56",awe="_nameCell_1jx2a_62",lwe="_truncate_1jx2a_69",cwe="_separator_1jx2a_75",uwe="_sectionTitle_1jx2a_79",dwe="_groupTitle_1jx2a_80",hwe="_success_1jx2a_84",fwe="_warning_1jx2a_88",mwe="_error_1jx2a_92",pwe="_group_1jx2a_80",gwe="_list_1jx2a_102",ywe="_description_1jx2a_108",bwe="_schema_1jx2a_113",wwe="_shortcuts_1jx2a_131",vwe="_detail_1jx2a_137",xwe="_serverFields_1jx2a_143",_we="_serverField_1jx2a_143",kwe="_serverFieldLabel_1jx2a_156",Swe="_detailBlock_1jx2a_160",Twe="_parameters_1jx2a_161",Cwe="_invalidBlock_1jx2a_162",Awe="_parameterRow_1jx2a_172",Ewe="_actionMessage_1jx2a_177",Mwe="_oauthPage_1jx2a_183",Nwe="_scrollHint_1jx2a_189",Et={panel:Xbe,title:Jbe,header:Zbe,startup:ewe,note:twe,secondary:nwe,row:swe,selected:rwe,disabled:iwe,pointer:owe,nameCell:awe,truncate:lwe,separator:cwe,sectionTitle:uwe,groupTitle:dwe,success:hwe,warning:fwe,error:mwe,group:pwe,list:gwe,description:ywe,schema:bwe,shortcuts:wwe,detail:vwe,serverFields:xwe,serverField:_we,serverFieldLabel:kwe,detailBlock:Swe,parameters:Twe,invalidBlock:Cwe,parameterRow:Awe,actionMessage:Ewe,oauthPage:Mwe,scrollHint:Nwe},yS="web-shell:mcp-panel-active",wd=10,{parse:Iwe}=Uv("web-shell:mcp-status:v1:");function jwe(e){const t=Iwe(e);return!t||!t.status?null:t}function G1(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:Et.error};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:Et.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:Et.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:Et.error}}}function jF(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 Rwe(e){const t=jF(e);return t?JSON.stringify(t,null,2):""}function Lwe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function Dwe(e,t){return e.source==="project"?t("mcp.source.project"):e.source==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function Owe(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 L4(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 lN(e,t){window.dispatchEvent(new CustomEvent(yS,{detail:{id:e,active:t}}))}function cN(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)}function K1(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function Bwe(e,t){return e?t("mcp.required"):""}function Pwe(e,t){const n=jF(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=Rwe(e);return o?u.jsx("pre",{className:Et.schema,children:o}):null}const i=Object.entries(s);return i.length===0?null:u.jsxs("div",{className:Et.parameters,children:[u.jsx("div",{className:Et.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",d=typeof l.description=="string"?l.description:"";return u.jsx("div",{className:Et.parameterRow,children:`• ${o}${Bwe(r.has(o),t)}: ${c}${d?` - ${d}`:""}`},o)})]})}function $we({message:e}){var le;const{t}=it(),n=SD({autoLoad:!1}),[s,r]=p.useState(e.status),[i,o]=p.useState(e.toolsByServer),[a,l]=p.useState(null),[c,d]=p.useState(!1),h=p.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[f,m]=p.useState(!0),[g,y]=p.useState("servers"),[b,w]=p.useState(0),[v,x]=p.useState(0),[C,A]=p.useState(0),T=p.useMemo(()=>s.servers??[],[s.servers]),_=T[b]??null,R=p.useMemo(()=>{var z;return _?((z=i[_.name])==null?void 0:z.tools)??[]:[]},[_,i]),I=R[C]??null,k=p.useMemo(()=>R.length<=wd||C<wd-1?0:Math.min(C-wd+1,R.length-wd),[C,R.length]),j=p.useMemo(()=>R.slice(k,k+wd),[R,k]),N=T.filter(z=>!z.disabled&&z.mcpStatus==="connecting").length,L=p.useMemo(()=>{const z=[];for(const M of T){const re=Lwe(M,t),U=z.find(W=>W.label===re);U?U.servers.push(M):z.push({label:re,servers:[M]})}return z},[T,t]),$=p.useMemo(()=>T.length===0?20:Math.min(Math.max(...T.map(z=>z.name.length))+2,35),[T]),F=p.useMemo(()=>R.length===0?30:Math.min(Math.max(...R.map(z=>z.name.length))+2,50),[R]),B=p.useMemo(()=>{if(!_)return[];const z=[];return!_.disabled&&R.length>0&&z.push({id:"view-tools",label:t("mcp.action.tools")}),!_.disabled&&_.mcpStatus==="disconnected"&&z.push({id:"reconnect",label:t("mcp.action.reconnect")}),z.push({id:_.disabled?"enable":"disable",label:_.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),_.disabled||(z.push({id:"authenticate",label:_.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),_.hasOAuthTokens&&z.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),z},[_,R.length,t]),Q=p.useCallback(async()=>{var M;const z=await n.reload();if(z){r(z);const re=((M=z.servers)==null?void 0:M.find(U=>U.name===(_==null?void 0:_.name)))??null;if(re){const U=await n.loadTools(re.name);o(W=>({...W,[re.name]:U}))}}},[n,_==null?void 0:_.name]),Y=p.useCallback(async z=>{if(!(!_||z.disabled||c)){if(z.id==="view-tools"){y("tools"),A(0),l(null);return}d(!0),z.id==="authenticate"&&y("oauth"),l(z.id==="authenticate"?K1(_.name,t):t("mcp.action.running",{action:z.label}));try{let M=null;if(z.id==="reconnect")await n.restartServer(_.name);else{const re=await n.manageServer(_.name,z.id),U=[...re.messages??[],...re.authUrl?[re.authUrl]:[]].join(`
`);U&&(M=z.id==="authenticate"?K1(_.name,t,U):U)}await Q(),l(M??t("mcp.action.done",{action:z.label}))}catch(M){l(z.id==="authenticate"?K1(_.name,t,cN(M)):t("mcp.action.failed",{error:cN(M)}))}finally{d(!1)}}},[c,n,Q,_,t]);if(p.useEffect(()=>{const z=h.current;return lN(z,f),()=>lN(z,!1)},[f]),p.useEffect(()=>{const z=M=>{const re=M.detail;re!=null&&re.active&&re.id&&re.id!==h.current&&m(!1)};return window.addEventListener(yS,z),()=>window.removeEventListener(yS,z)},[]),IF(z=>{if(f){if(z.key==="Escape"){z.preventDefault(),z.stopPropagation(),g==="servers"?m(!1):g==="server"?(y("servers"),x(0),l(null)):g==="oauth"?(y("server"),l(null)):g==="tools"?(y("server"),A(0)):y("tools");return}if(z.key==="ArrowUp"||z.key==="ArrowDown"){z.preventDefault(),z.stopPropagation();const M=z.key==="ArrowUp"?-1:1;g==="servers"?(w(re=>Math.min(Math.max(re+M,0),T.length-1)),x(0)):g==="server"?x(re=>Math.min(Math.max(re+M,0),B.length-1)):g==="tools"&&A(re=>Math.min(Math.max(re+M,0),R.length-1));return}if(z.key==="Enter")if(z.preventDefault(),z.stopPropagation(),g==="servers"&&T.length>0)y("server"),x(0);else if(g==="server"&&B.length>0){const M=B[v];M&&Y(M)}else g==="tools"&&R.length>0&&y("tool")}},[f,v,R.length,B,Y,T.length,g]),!f)return null;if(T.length===0)return u.jsxs("div",{className:Et.panel,"data-keyboard-scope":!0,children:[u.jsxs("div",{className:Et.header,children:[u.jsx("div",{className:Et.title,children:t("mcp.manageServers")}),u.jsx("div",{className:Et.secondary,children:t("mcp.servers",{count:0})})]}),u.jsx("div",{className:Et.secondary,children:t("mcp.empty")}),u.jsx("div",{className:Et.shortcuts,children:t("mcp.shortcut.close")})]});const ne=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")}):(I==null?void 0:I.name)??t("mcp.toolDetail"),P=g==="servers"?t("mcp.servers",{count:T.length}):g==="server"||g==="oauth"?"":g==="tools"?t(R.length===1?"mcp.toolCount":"mcp.toolsCount",{count:R.length}):(I==null?void 0:I.serverToolName)??(_==null?void 0:_.name)??"";return u.jsxs("div",{className:Et.panel,"data-keyboard-scope":!0,children:[N>0&&u.jsxs("div",{children:[u.jsx("div",{className:Et.startup,children:t("mcp.starting",{count:N})}),u.jsx("div",{className:Et.note,children:t("mcp.startingNote")})]}),u.jsxs("div",{className:Et.header,children:[u.jsx("div",{className:Et.title,children:ne}),P&&u.jsx("div",{className:Et.secondary,children:P})]}),g==="servers"&&u.jsx("div",{className:Et.list,children:L.map(z=>{let M=0;for(const re of L){if(re===z)break;M+=re.servers.length}return u.jsxs("div",{className:Et.group,children:[u.jsx("div",{className:Et.groupTitle,children:z.label}),z.servers.map((re,U)=>{const W=M+U,J=W===b,G=G1(re,t);return u.jsxs("div",{className:J?`${Et.row} ${Et.selected}`:Et.row,onClick:()=>{w(W),y("server"),x(0)},onMouseEnter:()=>w(W),children:[u.jsx("span",{className:Et.pointer,children:J?"❯":""}),u.jsx("span",{className:Et.nameCell,style:{width:`${$}ch`},children:re.name}),u.jsx("span",{className:Et.separator,children:"·"}),u.jsxs("span",{className:G.className,children:[G.icon," ",G.text]})]},re.name)})]},z.label)})}),g==="server"&&_&&u.jsxs("div",{className:Et.detail,children:[u.jsxs("div",{className:Et.serverFields,children:[u.jsxs("div",{className:Et.serverField,children:[u.jsxs("span",{className:Et.serverFieldLabel,children:[t("mcp.status"),":"]}),u.jsxs("span",{className:G1(_,t).className,children:[G1(_,t).icon," ",G1(_,t).text]})]}),u.jsxs("div",{className:Et.serverField,children:[u.jsxs("span",{className:Et.serverFieldLabel,children:[t("mcp.source"),":"]}),u.jsx("span",{children:Dwe(_,t)})]}),u.jsxs("div",{className:Et.serverField,children:[u.jsxs("span",{className:Et.serverFieldLabel,children:[t("mcp.command"),":"]}),u.jsx("span",{className:Et.truncate,children:Owe(_,t)})]}),((le=_.config)==null?void 0:le.cwd)&&u.jsxs("div",{className:Et.serverField,children:[u.jsxs("span",{className:Et.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),u.jsx("span",{className:Et.truncate,children:_.config.cwd})]}),!_.disabled&&u.jsxs("div",{className:Et.serverField,children:[u.jsxs("span",{className:Et.serverFieldLabel,children:[t("mcp.tools"),":"]}),u.jsx("span",{children:t(R.length===1?"mcp.toolCount":"mcp.toolsCount",{count:R.length})})]})]}),u.jsx("div",{className:Et.list,children:B.map((z,M)=>{const re=M===v,U=[Et.row,re?Et.selected:"",z.disabled?Et.disabled:""].filter(Boolean).join(" ");return u.jsxs("div",{className:U,onClick:()=>{x(M),Y(z)},children:[u.jsx("span",{className:Et.pointer,children:re?"❯":""}),u.jsx("span",{children:z.label})]},z.id)})}),a&&u.jsx("pre",{className:Et.actionMessage,children:a})]}),g==="oauth"&&u.jsx("div",{className:Et.oauthPage,children:u.jsx("pre",{className:Et.actionMessage,children:a??(_?K1(_.name,t):t("mcp.status.unknown"))})}),g==="tools"&&u.jsx("div",{className:Et.list,children:R.length===0?u.jsx("div",{className:Et.secondary,children:t("mcp.emptyTools")}):j.map((z,M)=>{const re=k+M,U=re===C,W=L4(z,t);return u.jsxs("div",{className:U?`${Et.row} ${Et.selected}`:Et.row,onClick:()=>{A(re),y("tool")},onMouseEnter:()=>A(re),children:[u.jsx("span",{className:Et.pointer,children:U?"❯":""}),u.jsx("span",{className:Et.nameCell,style:{width:`${F}ch`},children:z.name}),z.isValid?W?u.jsx("span",{className:Et.secondary,children:W}):null:u.jsx("span",{className:Et.warning,children:t("mcp.invalidReason",{reason:z.invalidReason||t("mcp.status.unknown")})})]},z.name)})}),g==="tools"&&R.length>wd&&u.jsxs("div",{className:Et.scrollHint,children:[k>0?"↑ ":"  ",t("mcp.scrollPosition",{current:C+1,total:R.length}),k+wd<R.length?" ↓":""]}),g==="tool"&&I&&u.jsxs("div",{className:Et.detail,children:[!I.isValid&&u.jsxs("div",{className:Et.invalidBlock,children:[u.jsx("div",{className:Et.sectionTitle,children:t("mcp.invalidToolWarning")}),u.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",I.invalidReason||t("mcp.status.unknown")]}),u.jsx("div",{className:Et.secondary,children:t("mcp.invalidToolHelp")})]}),I.description&&u.jsxs("div",{className:Et.detailBlock,children:[u.jsx("div",{className:Et.sectionTitle,children:t("mcp.description")}),u.jsx("div",{className:Et.description,children:I.description.trim()})]}),L4(I,t)&&u.jsxs("div",{className:Et.detailBlock,children:[u.jsx("span",{className:Et.sectionTitle,children:t("mcp.annotations")})," ",u.jsx("span",{children:L4(I,t)})]}),Pwe(I,t)]}),u.jsx("div",{className:Et.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 zwe=3;function gw(e){return e.kind==="agent"&&typeof e.id=="string"}function Fwe(e){const t=e.filter(gw),n=new Map;for(const c of t)n.set(c.id,c);const s=new Map,r=[];for(const c of t){const d=c.parentAgentId;if(d!=null&&d!==c.id&&n.has(d)){const h=s.get(d);h?h.push(c):s.set(d,[c])}else r.push(c)}if(s.size===0)return[...e];const i=[],o=new Set,a=c=>{if(!o.has(c.id)){o.add(c.id),i.push(c);for(const d of s.get(c.id)??[])a(d)}};for(const c of r)a(c);for(const c of t)o.has(c.id)||(o.add(c.id),i.push(c));let l=0;return e.map(c=>gw(c)?i[l++]:c)}function RF(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 qwe(e){const t=new Map;for(const s of e)gw(s)&&t.set(s.id,s);const n=new Map;for(const s of t.values()){const{chain:r,terminatedBy:i}=RF(s,o=>t.get(o));n.set(s.id,{visibleDepth:i==="cycle"?0:r.length,orphaned:r.length===0&&i==="missing"})}return n}function Hwe(e){const t=new Map;for(const s of e)gw(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}=RF(s,o=>t.get(o));i==="root"&&r.every(o=>o.isBackgrounded===!1)&&n.add(s.id)}return n}function bS(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 Uwe="_panel_1c0ra_1",Vwe="_embeddedPanel_1c0ra_12",Wwe="_title_1c0ra_19",Gwe="_sectionTitle_1c0ra_24",Kwe="_overflowHint_1c0ra_28",Ywe="_header_1c0ra_33",Qwe="_secondary_1c0ra_39",Xwe="_row_1c0ra_43",Jwe="_selected_1c0ra_51",Zwe="_pointer_1c0ra_55",eve="_nameCell_1c0ra_61",tve="_treeMarker_1c0ra_70",nve="_orphanNote_1c0ra_74",sve="_status_1c0ra_78",rve="_chevronCell_1c0ra_84",ive="_chevron_1c0ra_84",ove="_chevronExpanded_1c0ra_101",ave="_separator_1c0ra_111",lve="_list_1c0ra_115",cve="_task_1c0ra_121",uve="_taskExpanded_1c0ra_127",dve="_success_1c0ra_132",hve="_warning_1c0ra_136",fve="_error_1c0ra_140",mve="_detail_1c0ra_144",pve="_detailTop_1c0ra_153",gve="_detailTopMain_1c0ra_160",yve="_inlineDetail_1c0ra_200",bve="_taskIcon_1c0ra_222",wve="_detailField_1c0ra_251",vve="_detailFieldLabel_1c0ra_258",xve="_detailContent_1c0ra_264",_ve="_compactSummary_1c0ra_271",kve="_actionBar_1c0ra_280",Sve="_actionHint_1c0ra_289",Tve="_actionButton_1c0ra_294",Cve="_dangerButton_1c0ra_314",Ave="_shortcuts_1c0ra_318",Eve="_confirmHint_1c0ra_324",Mve="_statusBadge_1c0ra_328",Nve="_activityCurrent_1c0ra_334",Ive="_activityPast_1c0ra_341",jve="_promptContent_1c0ra_348",ht={panel:Uwe,embeddedPanel:Vwe,title:Wwe,sectionTitle:Gwe,overflowHint:Kwe,header:Ywe,secondary:Qwe,row:Xwe,selected:Jwe,pointer:Zwe,nameCell:eve,treeMarker:tve,orphanNote:nve,status:sve,chevronCell:rve,chevron:ive,chevronExpanded:ove,separator:ave,list:lve,task:cve,taskExpanded:uve,success:dve,warning:hve,error:fve,detail:mve,detailTop:pve,detailTopMain:gve,inlineDetail:yve,taskIcon:bve,detailField:wve,detailFieldLabel:vve,detailContent:xve,compactSummary:_ve,actionBar:kve,actionHint:Sve,actionButton:Tve,dangerButton:Cve,shortcuts:Ave,confirmHint:Eve,statusBadge:Mve,activityCurrent:Nve,activityPast:Ive,promptContent:jve},Xp="web-shell:tasks-panel-active",Rve=3e3,uN=8,{parse:Lve}=Uv("web-shell:tasks-status:v1:");function Dve(e){const t=Lve(e);return!t||!t.snapshot?null:t}function dN(e,t){window.dispatchEvent(new CustomEvent(Xp,{detail:{id:e,active:t}}))}function hN(e){return e.status==="running"||e.status==="paused"}function Ove(e){return[...e].sort((t,n)=>{const s=hN(t),r=hN(n);return s!==r?s?-1:1:s?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function D4(e){return Fwe(Ove(e))}function fN(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function LF(e){switch(e){case"running":return ht.success;case"paused":return ht.warning;case"completed":return ht.success;case"failed":return ht.error;case"cancelled":return ht.warning;default:return""}}function Bve(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 Pve(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function $ve({expanded:e}){return u.jsx("svg",{className:`${ht.chevron} ${e?ht.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function zve(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 Fve(e,t){if(e.length<=uN)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,uN-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 qve(e,t,n){const s=zl(e,n),r=t?t.replace(/\s*\n\s*/g," ").trim():"";return r?`${s}(${r})`:s}function DF({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:s}){const{t:r}=it(),i=fg(),[o,a]=p.useState(()=>D4(e.snapshot.tasks)),[l,c]=p.useState(!0),[d,h]=p.useState("list"),[f,m]=p.useState(0),[g,y]=p.useState(null),[b,w]=p.useState(!1),[v,x]=p.useState(!1),[C,A]=p.useState(null),T=p.useRef(`tasks-${Math.random().toString(36).slice(2)}`),_=p.useRef(!1),R=p.useRef(null),I=o.length===0?0:Math.min(f,o.length-1),k=o[I]??null,j=p.useMemo(()=>qwe(o),[o]),N=p.useMemo(()=>Hwe(o),[o]);p.useEffect(()=>{if(!l)return;const re=setInterval(()=>{_.current||(_.current=!0,i.getTasks().then(U=>{a(D4(U.tasks)),x(!1)}).catch(U=>{console.warn("[web-shell] failed to refresh tasks:",U),x(!0)}).finally(()=>{_.current=!1}))},Rve);return()=>clearInterval(re)},[l,i]),p.useEffect(()=>{o.length===0&&f!==0&&m(0),f>=o.length&&o.length>0&&m(o.length-1)},[o.length,f]),p.useEffect(()=>{if(!l||d!=="detail"){R.current=null;return}if(!k){R.current=null,h("list");return}const M=R.current;if(!M||M.taskId!==k.id){R.current={taskId:k.id,status:k.status};return}M.status==="running"&&k.status!=="running"&&(y(null),h("list"))},[l,d,k]),p.useEffect(()=>{if(!n)return;const M=T.current;return dN(M,l),()=>dN(M,!1)},[l,n]),p.useEffect(()=>{if(!n)return;const M=re=>{const U=re.detail;U!=null&&U.active&&U.id&&U.id!==T.current&&c(!1)};return window.addEventListener(Xp,M),()=>window.removeEventListener(Xp,M)},[n]),p.useEffect(()=>{l||s==null||s()},[l,s]);const L=p.useCallback(async M=>{if(b)return;const re=M.status==="running",U=M.kind==="agent"&&M.status==="paused";if(!re&&!U)return;if(M.kind==="agent"&&N.has(M.id)&&g!==M.id){y(M.id);return}y(null),w(!0);try{if(!(await i.cancelTask(M.id,M.kind)).cancelled){A(r("tasks.alreadyStopped"));return}const G=await i.getTasks();a(D4(G.tasks)),A(null)}catch(J){console.warn("[web-shell] failed to cancel task:",J),A(r("tasks.cancelFailed"))}finally{w(!1)}},[i,b,N,g,r]);if(IF(M=>{if(l){if(M.key==="Escape"){if(M.preventDefault(),M.stopPropagation(),g){y(null);return}d==="detail"?h("list"):c(!1);return}if(M.key==="ArrowLeft"){M.preventDefault(),M.stopPropagation(),d==="detail"?(y(null),h("list")):c(!1);return}if((M.key==="ArrowUp"||M.key==="ArrowDown")&&d==="list"){if(M.preventDefault(),M.stopPropagation(),o.length===0)return;const re=M.key==="ArrowUp"?-1:1;m(U=>Math.min(Math.max(U+re,0),o.length-1)),y(null);return}if(M.key==="Enter"){M.preventDefault(),M.stopPropagation(),d==="list"&&k?h("detail"):d==="detail"&&c(!1);return}if(M.key===" "&&d==="detail"){M.preventDefault(),M.stopPropagation(),c(!1);return}if(M.key==="x"&&!M.ctrlKey&&!M.metaKey){M.preventDefault(),M.stopPropagation(),k&&L(k);return}}},[l,d,o.length,k,L,g]),!l)return null;const $=g!==null&&k!==null&&g===k.id,F=[];$?(F.push(r("tasks.confirmStop")),F.push(r("tasks.shortcut.cancelConfirm"))):(F.push(r("tasks.shortcut.select")),F.push(r("tasks.shortcut.view")),(k==null?void 0:k.status)==="running"?F.push(r("tasks.shortcut.stop")):(k==null?void 0:k.kind)==="agent"&&(k==null?void 0:k.status)==="paused"&&F.push(r("tasks.shortcut.abandon")),F.push(r("tasks.shortcut.listClose")));const B=[];if($?(B.push(r("tasks.confirmStop")),B.push(r("tasks.shortcut.cancelConfirm"))):(B.push(r("tasks.shortcut.detailBack")),B.push(r("tasks.shortcut.detailClose")),(k==null?void 0:k.status)==="running"?B.push(r("tasks.shortcut.stop")):(k==null?void 0:k.kind)==="agent"&&(k==null?void 0:k.status)==="paused"&&B.push(r("tasks.shortcut.abandon"))),o.length===0)return u.jsxs("div",{className:t?`${ht.panel} ${ht.embeddedPanel}`:ht.panel,"data-keyboard-scope":!0,children:[(v||C||!t)&&u.jsxs("div",{className:ht.header,children:[!t&&u.jsx("div",{className:ht.title,children:r("tasks.title")}),v&&u.jsx("div",{className:ht.warning,children:r("tasks.refreshStale")}),C&&u.jsx("div",{className:ht.error,children:C})]}),u.jsx("div",{children:u.jsx("div",{className:ht.secondary,children:r("tasks.empty")})}),!t&&u.jsx("div",{className:ht.shortcuts,children:r("tasks.shortcut.close")})]});const{visible:Q,windowStart:Y,hiddenAbove:ne,hiddenBelow:P}=Fve(o,I),le=t?o:Q,z=t?0:Y;return u.jsxs("div",{className:t?`${ht.panel} ${ht.embeddedPanel}`:ht.panel,"data-keyboard-scope":!0,children:[(t||d==="list")&&(v||C||!t)&&u.jsxs("div",{className:ht.header,children:[!t&&u.jsx("div",{className:ht.title,children:r("tasks.title")}),v&&u.jsx("div",{className:ht.warning,children:r("tasks.refreshStale")}),C&&u.jsx("div",{className:ht.error,children:C})]}),(t||d==="list")&&u.jsxs("div",{className:ht.list,children:[!t&&u.jsxs("div",{className:ht.sectionTitle,children:[r("tasks.title")," ",u.jsxs("span",{className:ht.secondary,children:["(",o.length,")"]})]}),!t&&ne>0&&u.jsx("div",{className:ht.overflowHint,children:r("tasks.moreAbove",{count:ne})}),le.map((M,re)=>{const U=z+re,W=U===I,J=LF(M.status),G=Bve(M.status,r),te=t&&W&&d==="detail",H=t?te:W,ie=M.kind==="agent"?j.get(M.id):void 0,fe=Math.min((ie==null?void 0:ie.visibleDepth)??0,zwe),Ne=M.kind==="agent"&&M.parentAgentId!=null,Ie=ie!=null&&ie.orphaned?M.kind==="agent"&&M.parentName?r("tasks.row.from",{parent:M.parentName}):r("tasks.row.nested"):null;return u.jsxs("div",{className:`${ht.task} ${te?ht.taskExpanded:""}`,children:[u.jsxs("div",{className:H?`${ht.row} ${ht.selected}`:ht.row,onClick:()=>{m(U),h(t&&te?"list":"detail")},onMouseEnter:()=>{t||m(U)},children:[u.jsx("span",{className:ht.pointer,children:H?"❯":""}),t&&u.jsx("span",{className:ht.taskIcon,"aria-hidden":"true"}),u.jsxs("span",{className:ht.nameCell,style:fe>0?{paddingLeft:`${fe*16}px`}:void 0,children:[Ne&&u.jsx("span",{className:ht.treeMarker,"aria-hidden":"true",children:"↳ "}),zve(M,N.has(M.id)),Ie&&u.jsxs("span",{className:ht.orphanNote,children:[" · ",Ie]})]}),u.jsx("span",{className:`${ht.status} ${J}`,children:G}),u.jsx("span",{className:ht.chevronCell,children:u.jsx($ve,{expanded:te})})]}),te&&u.jsx("div",{className:ht.inlineDetail,children:u.jsx(mN,{task:M,t:r,hideHeader:!0,busy:b,showCancelConfirm:g===M.id,onCancel:()=>void L(M),onCancelConfirmDismiss:()=>y(null)})})]},M.id)}),!t&&P>0&&u.jsx("div",{className:ht.overflowHint,children:r("tasks.moreBelow",{count:P})})]}),!t&&d==="detail"&&k&&u.jsxs(u.Fragment,{children:[C&&u.jsx("div",{className:ht.error,children:C}),u.jsx(mN,{task:k,t:r,busy:b,showCancelConfirm:g===k.id,onCancel:()=>void L(k),onCancelConfirmDismiss:()=>y(null)})]}),!t&&u.jsx("div",{className:$?`${ht.shortcuts} ${ht.confirmHint}`:ht.shortcuts,children:(d==="list"?F:B).join(" · ")})]})}function Hve(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 mN({task:e,t,hideHeader:n=!1,busy:s=!1,showCancelConfirm:r=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,C,A;const a=Pve(e.status),l=LF(e.status),c=e.kind==="agent"&&e.status==="paused",d=e.status==="running"||c,h=t(c?"tasks.action.abandon":"tasks.action.stop"),f=t(c?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),m=[bS(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:bS(e.runtimeMs)}],y=e.kind==="agent"?((x=e.stats)==null?void 0:x.outputTokens)??((C=e.stats)==null?void 0:C.totalTokens):void 0;y&&(m.push(t("tasks.detail.tokens",{count:fN(y)})),g.push({label:t("tasks.detail.tokenCount"),value:fN(y)})),e.kind==="agent"&&((A=e.stats)==null?void 0:A.toolUses)!==void 0&&(m.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&&m.push(`pid ${e.pid}`),e.kind==="shell"&&e.exitCode!==void 0&&m.push(t("tasks.detail.exit",{exitCode:e.exitCode})),e.kind==="monitor"&&(m.push(t("tasks.detail.events",{count:e.eventCount})),e.droppedLines>0&&m.push(t("tasks.detail.dropped",{count:e.droppedLines})),e.exitCode!==void 0&&m.push(t("tasks.detail.exit",{exitCode:e.exitCode})));const b=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],w=d&&i?u.jsx("div",{className:ht.actionBar,children:r?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:ht.actionHint,children:t("tasks.action.confirmHint")}),u.jsx("button",{type:"button",className:`${ht.actionButton} ${ht.dangerButton}`,disabled:s,onClick:i,children:f}),u.jsx("button",{type:"button",className:ht.actionButton,onClick:o,children:t("common.cancel")})]}):u.jsx("button",{type:"button",className:`${ht.actionButton} ${ht.dangerButton}`,disabled:s,onClick:i,children:h})}):null,v=n?g.length>0?u.jsx("div",{className:ht.compactSummary,children:g.map(T=>`${T.label} ${T.value}`).join(" · ")}):null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:ht.title,children:Hve(e,t)}),u.jsxs("div",{className:ht.statusBadge,children:[a&&u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:l,children:[a," ",t(`tasks.${e.status}`)]}),u.jsx("span",{className:ht.separator,children:"·"})]}),u.jsx("span",{className:ht.secondary,children:m.join(" · ")})]})]});return u.jsxs("div",{className:ht.detail,children:[(v||w)&&u.jsxs("div",{className:ht.detailTop,children:[v&&u.jsx("div",{className:ht.detailTopMain,children:v}),w]}),e.kind==="shell"&&u.jsxs(u.Fragment,{children:[u.jsx(Fh,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&u.jsx(Fh,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&u.jsx(Fh,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&u.jsx(Fh,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&u.jsx(Fh,{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&&u.jsxs("div",{className:ht.detailField,children:[u.jsx("div",{className:ht.detailFieldLabel,children:t("tasks.detail.progress")}),u.jsx("div",{className:ht.detailContent,children:e.recentActivities.slice(-5).map((T,_,R)=>{const I=_===R.length-1,k=qve(T.name,T.description,t);return u.jsxs("div",{className:I?ht.activityCurrent:ht.activityPast,children:[I?"> ":"  ",k]},`${T.at}-${_}`)})})]}),e.kind==="agent"&&e.prompt&&u.jsxs("div",{className:ht.detailField,children:[u.jsx("div",{className:ht.detailFieldLabel,children:t("tasks.detail.prompt")}),u.jsx("div",{className:ht.promptContent,children:b.slice(0,5).map((T,_,R)=>u.jsx("div",{children:_===R.length-1&&b.length>5?`${T}…`:T||" "},_))})]}),e.kind==="agent"&&e.outputFile&&u.jsx(Fh,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&u.jsxs("div",{className:ht.detailField,children:[u.jsx("div",{className:`${ht.detailFieldLabel} ${ht.error}`,children:t("tasks.detail.resumeBlocked")}),u.jsx("div",{className:ht.error,children:e.resumeBlockedReason})]}),e.error&&u.jsxs("div",{className:ht.detailField,children:[u.jsx("div",{className:`${ht.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?ht.warning:ht.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),u.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?ht.warning:ht.error,children:e.error})]})]})}function Fh({label:e,value:t}){return u.jsxs("div",{className:ht.detailField,children:[u.jsx("div",{className:ht.detailFieldLabel,children:e}),u.jsx("div",{className:ht.detailContent,children:t})]})}const Uve="_message_fm8gc_1",Vve="_body_fm8gc_15",Wve="_title_fm8gc_20",Gve="_muted_fm8gc_24",Kve="_accent_fm8gc_28",Yve="_success_fm8gc_32",Qve="_error_fm8gc_36",Xve="_warning_fm8gc_40",Jve="_row_fm8gc_44",Zve="_label_fm8gc_50",e2e="_value_fm8gc_55",yo={message:Uve,body:Vve,title:Wve,muted:Gve,accent:Kve,success:Yve,error:Qve,warning:Xve,row:Jve,label:Zve,value:e2e},wS="web-shell-goal-status-active",{serialize:pN,parse:t2e}=Uv(HK),n2e=new Set(["set","achieved","cleared","failed","aborted","checking"]);function yw(e){const t=typeof e=="string"?t2e(e):e;return s2e(t)}function s2e(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,s=t.condition;if(typeof n!="string"||!n2e.has(n)||typeof s!="string")return null;const r=O4(t.iterations),i=O4(t.durationMs),o=O4(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 O4(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function r2e(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function i2e(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:yo.muted};case"set":return{title:t("goal.set"),colorClass:yo.accent};case"achieved":return{title:t("goal.achieved"),colorClass:yo.success};case"cleared":return{title:t("goal.cleared"),colorClass:yo.muted};case"failed":return{title:t("goal.failed"),colorClass:yo.error};case"aborted":return{title:t("goal.aborted"),colorClass:yo.warning}}}function o2e({status:e,activateFooter:t=!1}){var l;const{t:n}=it();p.useEffect(()=>{if(!t)return;const c=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(wS,{detail:{active:c,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const s=i2e(e,n),r=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&r.push(r2e(e.iterations,n)),typeof e.durationMs=="number"&&r.push(bS(e.durationMs)));const i=r.length>0?` · ${r.join(" · ")}`:"",o=(e.kind==="checking"||e.kind==="achieved"||e.kind==="failed"||e.kind==="aborted")&&((l=e.lastReason)==null?void 0:l.trim()),a=e.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return u.jsx("div",{className:yo.message,children:u.jsxs("div",{className:yo.body,children:[u.jsxs("div",{className:`${yo.title} ${s.colorClass}`,children:[s.title,i&&u.jsx("span",{className:yo.muted,children:i})]}),u.jsxs("div",{className:yo.row,children:[u.jsxs("span",{className:yo.label,children:[n("goal.label"),":"]}),u.jsx("span",{className:yo.value,children:e.condition})]}),o&&u.jsxs("div",{className:yo.muted,children:[a,": ",o]})]})})}const a2e="_message_u8kmd_1",l2e="_flushMessage_u8kmd_12",c2e="_noMarker_u8kmd_26",u2e="_content_u8kmd_30",d2e="_info_u8kmd_49",h2e="_recap_u8kmd_54",f2e="_modelSwitch_u8kmd_67",m2e="_error_u8kmd_71",p2e="_warning_u8kmd_77",g2e="_retryHint_u8kmd_83",y2e="_retryButton_u8kmd_90",b2e="_cancelled_u8kmd_108",ho={message:a2e,flushMessage:l2e,noMarker:c2e,content:u2e,info:d2e,recap:h2e,modelSwitch:f2e,error:m2e,warning:p2e,retryHint:g2e,retryButton:y2e,cancelled:b2e},w2e=p.memo(function({content:t,variant:n,source:s,data:r,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:l}){const{t:c}=it();if(s==="prompt_cancelled")return u.jsx("div",{className:ho.cancelled,role:"status",children:u.jsx("span",{children:c("turn.stopped")})});const d=n==="info"?Uye(t):null;if(d)return u.jsx("div",{className:ho.flushMessage,children:u.jsx(Xye,{status:d,onShowDetail:i})});const h=n==="info"?Ibe(t):null;if(h)return u.jsx("div",{className:ho.flushMessage,children:u.jsx($be,{view:h.view,status:h.status})});const f=n==="info"?Kbe(t):null;if(f)return u.jsx("div",{className:ho.flushMessage,children:u.jsx(Ybe,{info:f})});const m=n==="info"?jwe(t):null;if(m)return u.jsx("div",{className:ho.flushMessage,children:u.jsx($we,{message:m})});const g=n==="info"?Dve(t):null;if(g)return u.jsx("div",{className:ho.flushMessage,children:u.jsx(DF,{message:g})});const y=n==="info"?yw(s==="goal"?r:t):null;if(y)return u.jsx("div",{className:ho.flushMessage,children:u.jsx(o2e,{status:y,activateFooter:o})});const b=n==="info"&&s==="model_switch_summary",w=n==="info"&&s==="recap";return u.jsx("div",{className:`${ho.message} ${ho[n]} ${b?ho.modelSwitch:""} ${w?ho.recap:""}`,children:u.jsxs("div",{className:ho.content,children:[b?u.jsx("pre",{children:t}):n==="info"?u.jsx(Em,{content:t}):u.jsx("pre",{children:t}),a&&l&&u.jsx("div",{className:ho.retryHint,children:u.jsx("button",{type:"button",className:ho.retryButton,onClick:l,children:c("retry.hint")})})]})})}),v2e="_group_emvwk_1",x2e="_chatSummaryGroup_emvwk_14",_2e="_line_emvwk_22",k2e="_chatSummary_emvwk_14",S2e="_chatSummaryTextActive_emvwk_49",T2e="_chatSummaryIcon_emvwk_55",C2e="_chatSummaryToolIcon_emvwk_69",A2e="_chatSummaryText_emvwk_49",E2e="_chatSummaryInline_emvwk_85",M2e="_chatChevronRight_emvwk_122",N2e="_chatChevronDown_emvwk_123",I2e="_chatSummaryContentClip_emvwk_184",j2e="_chatSummaryContentCollapsed_emvwk_192",R2e="_chatSummaryContentInner_emvwk_196",L2e="_lineMain_emvwk_201",D2e="_icon_emvwk_211",O2e="_iconError_emvwk_216",B2e="_lineName_emvwk_220",P2e="_lineArg_emvwk_224",$2e="_lineElapsed_emvwk_232",z2e="_lineExpandable_emvwk_238",F2e="_lineChevronRight_emvwk_258",q2e="_lineChevronDown_emvwk_259",H2e="_lineOutput_emvwk_296",U2e="_expandedCard_emvwk_305",V2e="_expandedCardHeader_emvwk_315",W2e="_expandedCardTitle_emvwk_324",G2e="_expandedCardDetail_emvwk_331",K2e="_expandedCardBody_emvwk_341",Y2e="_expandedAgentCard_emvwk_346",Q2e="_expandedLineOutput_emvwk_356",X2e="_lineDetail_emvwk_360",J2e="_markdownLineDetail_emvwk_366",Z2e="_expandedBash_emvwk_374",exe="_expandedRead_emvwk_375",txe="_expandedOutput_emvwk_379",nxe="_expandedEdit_emvwk_393",sxe="_todoProgress_emvwk_407",rxe="_todoBody_emvwk_414",ixe="_compactGroup_emvwk_422",oxe="_compactHeader_emvwk_429",axe="_compactCount_emvwk_439",lxe="_compactHint_emvwk_445",xt={group:v2e,chatSummaryGroup:x2e,line:_2e,chatSummary:k2e,chatSummaryTextActive:S2e,chatSummaryIcon:T2e,chatSummaryToolIcon:C2e,chatSummaryText:A2e,chatSummaryInline:E2e,chatChevronRight:M2e,chatChevronDown:N2e,chatSummaryContentClip:I2e,chatSummaryContentCollapsed:j2e,chatSummaryContentInner:R2e,lineMain:L2e,icon:D2e,iconError:O2e,lineName:B2e,lineArg:P2e,lineElapsed:$2e,lineExpandable:z2e,lineChevronRight:F2e,lineChevronDown:q2e,lineOutput:H2e,expandedCard:U2e,expandedCardHeader:V2e,expandedCardTitle:W2e,expandedCardDetail:G2e,expandedCardBody:K2e,expandedAgentCard:Y2e,expandedLineOutput:Q2e,lineDetail:X2e,markdownLineDetail:J2e,expandedBash:Z2e,expandedRead:exe,expandedOutput:txe,expandedEdit:nxe,todoProgress:sxe,todoBody:rxe,compactGroup:ixe,compactHeader:oxe,compactCount:axe,compactHint:lxe};function dh({status:e}){const{t}=it();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return u.jsx("span",{className:`${xt.icon} ${xt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function Ng(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 OF(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 BF(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 cxe="_panel_3zg2e_1",uxe="_header_3zg2e_11",dxe="_desc_3zg2e_23",hxe="_toggle_3zg2e_32",fxe="_meta_3zg2e_38",mxe="_body_3zg2e_44",pxe="_content_3zg2e_55",gxe="_stream_3zg2e_70",yxe="_streamCollapsed_3zg2e_80",bxe="_scrollWindow_3zg2e_87",wxe="_expandToggle_3zg2e_92",vxe="_tabBar_3zg2e_107",xxe="_tab_3zg2e_107",_xe="_tabActive_3zg2e_129",kxe="_tools_3zg2e_134",Sxe="_toolTimeRow_3zg2e_151",Txe="_toolTimeTip_3zg2e_155",Qs={panel:cxe,header:uxe,desc:dxe,toggle:hxe,meta:fxe,body:mxe,content:pxe,stream:gxe,streamCollapsed:yxe,scrollWindow:bxe,expandToggle:wxe,tabBar:vxe,tab:xxe,tabActive:_xe,tools:kxe,toolTimeRow:Sxe,toolTimeTip:Txe};function PF(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function Cxe({timestamp:e,children:t}){return e===void 0?u.jsx(u.Fragment,{children:t}):u.jsxs("div",{className:Qs.toolTimeRow,children:[t,u.jsx("span",{className:Qs.toolTimeTip,"aria-hidden":"true",children:Kf(e)})]})}const Axe=p.memo(function({tool:t}){const n=t.subTools||t.subContent?u.jsx(R8,{tool:t}):u.jsx(_S,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return u.jsx(Cxe,{timestamp:t.startTime,children:n})});function Exe({tc:e}){const{t}=it();return u.jsx("div",{className:xt.line,children:u.jsxs("div",{className:xt.lineMain,children:[u.jsx(dh,{status:e.status}),u.jsx("span",{className:xt.lineName,children:zl(e.name,t)})]})})}function Mxe(e){var t;if(e.rawOutput&&PF(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 Nxe({text:e}){const{compactThinking:t}=Va(),{t:n}=it(),[s,r]=p.useState(!1),[i,o]=p.useState(!1),a=p.useRef(null),l=t&&!s;return p.useEffect(()=>{const c=a.current;!c||!l||(o(c.scrollHeight>c.clientHeight),c.scrollTop=c.scrollHeight)},[l,e]),p.useEffect(()=>{const c=a.current;if(!c||!l)return;const d=()=>o(c.scrollHeight>c.clientHeight),h=new ResizeObserver(d);return h.observe(c),()=>h.disconnect()},[l]),u.jsxs("div",{children:[u.jsx("pre",{ref:a,className:l?`${Qs.stream} ${Qs.streamCollapsed}`:Qs.stream,children:e}),t&&(i||s)&&u.jsx("button",{className:Qs.expandToggle,onClick:()=>r(c=>!c),"aria-expanded":s,"aria-label":n("subagent.toggleStream"),children:s?"▲":"▼"})]})}function Ixe({content:e}){const{compactThinking:t}=Va();return u.jsx("div",{className:t?Qs.scrollWindow:void 0,children:u.jsx(Em,{content:e,source:"assistant"})})}function gN({pinTail:e,itemCount:t,children:n}){const{compactThinking:s}=Va(),r=p.useRef(null);return p.useEffect(()=>{const i=r.current;!i||!s||(i.scrollTop=e?i.scrollHeight:0)},[s,e,t]),u.jsx("div",{ref:r,className:s?`${Qs.tools} ${Qs.scrollWindow}`:Qs.tools,children:n})}function R8({tool:e,defaultExpanded:t,hideHeader:n,inline:s}){var _,R,I,k;const{t:r}=it(),i=e.status==="completed"||e.status==="failed",o=Qp(e),[a,l]=p.useState(t??!1),[c,d]=p.useState("result"),h=PF(e.rawOutput)?e.rawOutput:null,f=((_=e.subTools)==null?void 0:_.length)||((R=h==null?void 0:h.toolCalls)==null?void 0:R.length)||0,m=j8(e),g=I8(e),y=Ng(e.startTime,e.endTime)||OF((I=h==null?void 0:h.executionSummary)==null?void 0:I.totalDurationMs),b=h!=null&&h.tokenCount&&h.tokenCount>0?h.tokenCount:(k=h==null?void 0:h.executionSummary)==null?void 0:k.outputTokens,w=b?N8(b):"",v=i?Mxe(e):"",x=p.useMemo(()=>e.subTools&&e.subTools.length>0?null:(h==null?void 0:h.toolCalls)||null,[e.subTools,h]),C=!!(e.subContent||v),A=!!(e.subTools&&e.subTools.length>0||x&&x.length>0),T=C&&A;return u.jsxs("div",{className:s?void 0:Qs.panel,children:[!n&&u.jsxs("div",{className:Qs.header,onClick:()=>l(!a),children:[u.jsx(dh,{status:o}),u.jsxs("span",{className:xt.lineName,children:[g,":"]}),m&&u.jsx("span",{className:Qs.desc,children:$r(m,50)}),i&&f>0&&u.jsxs("span",{className:Qs.meta,children:["· ",r("subagent.toolsCount",{count:f})]}),y&&u.jsxs("span",{className:Qs.meta,children:["· ",y]}),w&&u.jsxs("span",{className:Qs.meta,children:["· ",w]}),!i&&u.jsx("span",{className:Qs.toggle,children:a?"▼":"▶"})]}),(a||n)&&u.jsxs("div",{className:Qs.body,children:[T&&u.jsxs("div",{className:Qs.tabBar,children:[u.jsx("button",{className:`${Qs.tab} ${c==="result"?Qs.tabActive:""}`,onClick:()=>d("result"),children:r("subagent.result")}),u.jsx("button",{className:`${Qs.tab} ${c==="tools"?Qs.tabActive:""}`,onClick:()=>d("tools"),children:r("subagent.tools",{count:f})})]}),(!T||c==="result")&&C&&u.jsx("div",{className:Qs.content,children:i?u.jsx(Ixe,{content:e.subContent||v}):e.subContent&&u.jsx(Nxe,{text:e.subContent})}),(!T||c==="tools")&&u.jsxs(u.Fragment,{children:[e.subTools&&e.subTools.length>0&&u.jsx(gN,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(j=>u.jsx(Axe,{tool:j},j.callId))}),x&&x.length>0&&u.jsx(gN,{pinTail:!i,itemCount:x.length,children:x.map(j=>u.jsx(Exe,{tc:j},j.callId))})]})]})]})}const jxe="_view_1ycry_1",Rxe="_stats_1ycry_7",Lxe="_statAdd_1ycry_16",Dxe="_statDel_1ycry_20",Oxe="_lines_1ycry_24",Bxe="_line_1ycry_24",Pxe="_lineAdd_1ycry_36",$xe="_lineDel_1ycry_40",zxe="_lineHeader_1ycry_44",Fxe="_lineContext_1ycry_50",qxe="_lineNo_1ycry_54",Hxe="_marker_1ycry_64",Uxe="_content_1ycry_79",ll={view:jxe,stats:Rxe,statAdd:Lxe,statDel:Dxe,lines:Oxe,line:Bxe,lineAdd:Pxe,lineDel:$xe,lineHeader:zxe,lineContext:Fxe,lineNo:qxe,marker:Hxe,content:Uxe};function Vxe(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 Wxe=p.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:s,deletions:r}=Vxe(t);return u.jsxs("div",{className:ll.view,children:[u.jsxs("div",{className:ll.stats,children:[s>0&&u.jsxs("span",{className:ll.statAdd,children:["+",s]}),r>0&&u.jsxs("span",{className:ll.statDel,children:["-",r]})]}),u.jsx("div",{className:ll.lines,children:n.map((i,o)=>u.jsxs("div",{className:`${ll.line} ${ll[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[u.jsx("span",{className:ll.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),u.jsx("span",{className:ll.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),u.jsx("span",{className:ll.content,children:i.content})]},o))})]})}),yN={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 Gxe(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 l=a[1].split(";").map(Number);for(const c of l)c===0?(n=void 0,s=!1,r=!1):c===1?s=!0:c===2?r=!0:c===22?(s=!1,r=!1):c>=30&&c<=37||c>=90&&c<=97?n=yN[c]:c===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:s,dim:r}),t}function Kxe(e){return new RegExp(String.raw`\x1b\[`).test(e)}function Dc(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function B4(e){const t=e.flatMap((n,s)=>{const r=ww(n),i=Y1(r,"content");return i?[{id:Y1(r,"id")??`plan-${s}`,content:i,status:o4e(Y1(r,"status")),priority:a4e(Y1(r,"priority"))}]:[]});return t.length>0?t:void 0}function L8(e){if(!Dc(e.toolName)&&e.kind!=="other")return;const t=wN(e.args);if(t)return B4(t);const n=ww(e.rawOutput),s=wN(n);if(s)return B4(s);const r=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return r?B4(r):void 0}function Yxe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function bw(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const bN={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function Qxe(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 l=L8(a);l&&(t=l,n=o.id,s=a.callId,r=!1)}}if(t.length===0)return bN;const i=!Yxe(t);return r?bN:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:s}}function D8(e){return JSON.stringify([e.id,e.content])}function Vv(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=L8(n);s&&t.push({key:n.callId,todos:s,stats:e4e(n)})}return t}return[]}function Xxe(e){const t=new Map,n=new Map;for(const s of e)for(const{key:r,todos:i}of Vv(s)){const o=[];for(const a of i){const l=D8(a),c=n.get(l);a.status==="in_progress"&&c!=="in_progress"?o.push({kind:"started",id:a.id,content:a.content}):a.status==="completed"&&c!=="completed"&&c!==void 0&&o.push({kind:"completed",id:a.id,content:a.content}),n.set(l,a.status)}t.set(r,{events:o})}return t}function Jxe(e){const t=[];for(const n of e)for(const{key:s,todos:r}of Vv(n))t.push(JSON.stringify([s,r.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function Zxe(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const s of n.tools)!Dc(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 Vv(n))t.push(JSON.stringify([s,n.timestamp,r.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function e4e(e){var o;const t=ww((o=ww(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=a=>{const l=t[a];return typeof l=="number"&&Number.isFinite(l)?l: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 t4e(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools){if(Dc(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 n4e(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 s4e(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 r4e(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 i4e(e){var a;const t=new Map,n=new Map,s=new Map,r=new Set,i=t4e(e),o=l=>{let c=t.get(l);return c||(c={},t.set(l,c)),c};for(const l of e){const c=l.timestamp;for(const{todos:d,stats:h}of Vv(l))for(const f of d){const m=D8(f),g=n.get(m);if(f.status==="in_progress"&&g!=="in_progress")r.has(m)&&(r.delete(m),s.delete(m),t.delete(m)),s.get(m)===void 0&&(s.set(m,h),c!==void 0&&(o(m).startTs=c));else if(f.status==="completed"&&g!=="completed"&&g!==void 0){const y=s.get(m),b=y&&h?s4e(y,h):void 0,w=(a=t.get(m))==null?void 0:a.startTs,v=w!==void 0&&c!==void 0?n4e(i,w,c):void 0,x=r4e(b,v);if(c!==void 0||x){const C=o(m);c!==void 0&&(C.endTs=c),x&&(C.resources=x)}}f.status==="completed"&&r.add(m),n.set(m,f.status)}}return t}function wN(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function o4e(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function a4e(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function ww(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Y1(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const Hy=new Set;let a0=null,$F=Date.now();function l4e(){$F=Date.now();for(const e of Hy)e()}function c4e(e){return Hy.add(e),a0||(a0=setInterval(l4e,1e3)),()=>{Hy.delete(e),Hy.size===0&&a0&&(clearInterval(a0),a0=null)}}function O8(e){const[t,n]=p.useState(()=>Date.now());return p.useEffect(()=>{if(e)return n(Date.now()),c4e(()=>n($F))},[e]),t}const u4e="_list_1bo8s_1",d4e="_summary_1bo8s_2",h4e="_row_1bo8s_8",f4e="_num_1bo8s_16",m4e="_icon_1bo8s_23",p4e="_text_1bo8s_29",g4e="_inProgress_1bo8s_43",y4e="_completed_1bo8s_48",b4e="_item_1bo8s_62",w4e="_rowButton_1bo8s_69",v4e="_detailChevron_1bo8s_82",x4e="_detail_1bo8s_82",_4e="_detailSection_1bo8s_100",k4e="_detailSectionTitle_1bo8s_106",S4e="_detailRows_1bo8s_114",T4e="_detailLabel_1bo8s_122",C4e="_detailValue_1bo8s_126",A4e="_detailDuration_1bo8s_132",E4e="_detailHint_1bo8s_136",Jn={list:u4e,summary:d4e,row:h4e,num:f4e,icon:m4e,text:p4e,inProgress:g4e,completed:y4e,item:b4e,rowButton:w4e,detailChevron:v4e,detail:x4e,detailSection:_4e,detailSectionTitle:k4e,detailRows:S4e,detailLabel:T4e,detailValue:C4e,detailDuration:A4e,detailHint:E4e};function vS(e){switch(e){case"completed":return Jn.completed;case"in_progress":return Jn.inProgress;case"pending":return""}}function zF({todos:e,events:t}){const{t:n}=it();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return u.jsx("div",{className:Jn.summary,children:u.jsxs("div",{className:`${Jn.row} ${Jn.completed}`,children:[u.jsx("span",{className:Jn.icon,"aria-hidden":"true",children:"✓"}),u.jsx("span",{className:Jn.text,children:n("todo.allDone")})]})});const r=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return r?u.jsx("div",{className:Jn.summary,children:u.jsxs("div",{className:`${Jn.row} ${vS(r.status)}`,children:[u.jsx("span",{className:Jn.icon,"aria-hidden":"true",children:bw(r.status)}),u.jsx("span",{className:Jn.text,children:r.content})]})}):null}return u.jsx("div",{className:Jn.summary,children:t.map(s=>u.jsxs("div",{className:`${Jn.row} ${s.kind==="completed"?Jn.completed:Jn.inProgress}`,children:[u.jsx("span",{className:Jn.icon,"aria-hidden":"true",children:bw(s.kind==="completed"?"completed":"in_progress")}),u.jsx("span",{className:Jn.text,children:s.content})]},`${s.kind}-${s.id}`))})}function vd({label:e,value:t,suffix:n}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Jn.detailLabel,children:e}),u.jsxs("span",{className:Jn.detailValue,children:[t,n]})]})}function P4({title:e,children:t}){return u.jsxs("div",{className:Jn.detailSection,children:[u.jsx("div",{className:Jn.detailSectionTitle,children:e}),u.jsx("div",{className:Jn.detailRows,children:t})]})}function M4e({detail:e}){const{t}=it(),{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 u.jsxs("div",{className:Jn.detail,children:[i&&u.jsxs(P4,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&u.jsx(vd,{label:t("todo.detail.start"),value:Kf(n)}),s!==void 0&&u.jsx(vd,{label:t("todo.detail.end"),value:Kf(s),suffix:n!==void 0?u.jsxs("span",{className:Jn.detailDuration,children:[" ","(",Bu(s-n),")"]}):void 0})]}),o&&u.jsxs(P4,{title:t("todo.detail.sectionTokens"),children:[u.jsx(vd,{label:t("todo.detail.input"),value:((r==null?void 0:r.inputTokens)??0).toLocaleString()}),u.jsx(vd,{label:t("todo.detail.output"),value:((r==null?void 0:r.outputTokens)??0).toLocaleString()}),u.jsx(vd,{label:t("todo.detail.cached"),value:((r==null?void 0:r.cachedTokens)??0).toLocaleString()})]}),a&&u.jsxs(P4,{title:t("todo.detail.sectionSpent"),children:[(r==null?void 0:r.apiTimeMs)!==void 0&&u.jsx(vd,{label:t("todo.detail.api"),value:Bu(r.apiTimeMs)}),(r==null?void 0:r.toolTimeMs)!==void 0&&u.jsx(vd,{label:t("todo.detail.tool"),value:Bu(r.toolTimeMs)})]}),!r&&u.jsx("div",{className:Jn.detailHint,children:t("todo.detail.noResources")})]})}function N4e(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function FF({todos:e,numbered:t=!1}){const{t:n}=it(),s=p.useContext(qq),[r,i]=p.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=l=>i(c=>{const d=new Set(c);return d.has(l)?d.delete(l):d.add(l),d});return u.jsx("div",{className:Jn.list,children:e.map((l,c)=>{const d=l.id||String(c),h=s.get(D8(l)),f=N4e(h),m=f&&r.has(d),g=u.jsxs(u.Fragment,{children:[t&&u.jsxs("span",{className:Jn.num,style:{minWidth:o},children:[c+1,"."]}),u.jsx("span",{className:Jn.icon,"aria-hidden":"true",children:bw(l.status)}),u.jsx("span",{className:Jn.text,children:l.content}),f&&u.jsx("span",{className:Jn.detailChevron,"aria-hidden":"true",children:m?"▾":"▸"})]});return u.jsxs("div",{className:Jn.item,children:[f?u.jsx("button",{type:"button",className:`${Jn.row} ${Jn.rowButton} ${vS(l.status)}`,onClick:y=>{y.stopPropagation(),a(d)},"aria-expanded":m,title:n(m?"todo.detail.hide":"todo.detail.show"),children:g}):u.jsx("div",{className:`${Jn.row} ${vS(l.status)}`,children:g}),m&&h&&u.jsx(M4e,{detail:h})]},d)})})}function I4e(e){const t=e.toolName.toLowerCase();if(Fl(e.toolName))return!!Ml(e);if(t==="write_file"||t==="writefile")return!!K4e(e)||vN(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(zo(t)){const n=Ml(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(Hv(t))return!!HF(e);if(t==="edit"||t==="write"||t==="editfile")return vN(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Ml(e);return!!n&&n.split(`
`).length>3}return!1}function j4e(e){const t=e.toolName.toLowerCase();return zo(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||Hv(t)||Fl(e.toolName)}function R4e(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!qF(e)}function vN(e){return R4e(e)||!!Ml(e)}function L4e(e){const t=qF(e);if(t)return t;if(e.content){const n=e.content.find(s=>s.type==="diff");if(n&&n.type==="diff")return B4e(n.oldText||"",n.newText||"")}return""}function qF(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(D4e(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function D4e(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const O4e=25e4;function B4e(e,t){const n=e.split(`
`),s=t.split(`
`),r=n.length,i=s.length;if(r*i>O4e){const d=n.map(f=>f?`-${f}`:"-"),h=s.map(f=>f?`+${f}`:"+");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 l=r,c=i;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===s[c-1]?(a.push(` ${n[l-1]}`),l--,c--):c>0&&(l===0||o[l][c-1]>=o[l-1][c])?(a.push(`+${s[c-1]}`),c--):(a.push(`-${n[l-1]}`),l--);return a.reverse().join(`
`)}const P4e=60,$4e=2e5,z4e=1e3,F4e={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 q4e({tool:e}){const t=p.useMemo(()=>Ml(e)||"",[e]),n=p.useMemo(()=>Kxe(t)?Gxe(t):null,[t]);return u.jsx("div",{className:xt.expandedBash,children:u.jsx("pre",{className:xt.expandedOutput,children:n?n.map((s,r)=>u.jsx("span",{style:{color:s.color,fontWeight:s.bold?"bold":void 0,opacity:s.dim?.6:void 0},children:s.text},r)):t})})}function H4e({tool:e}){const t=p.useMemo(()=>Ml(e)||"",[e]),n=W4e(U4e(e)),s=n==="text"||t.length>$4e||V4e(t,z4e);return u.jsx("div",{className:xt.expandedRead,children:s?u.jsx("pre",{className:xt.expandedOutput,children:t}):u.jsx(Em,{content:G4e(n,t)})})}function U4e(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 V4e(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 W4e(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=F4e[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function G4e(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 xN({tool:e}){const t=p.useMemo(()=>L4e(e),[e]),n=p.useMemo(()=>Ml(e)||"",[e]);return!t&&!n?null:u.jsx("div",{className:xt.expandedEdit,children:t?u.jsx(Wxe,{diff:t}):u.jsx("pre",{className:xt.expandedOutput,children:n})})}function xS({title:e,detail:t,children:n}){return u.jsxs("div",{className:xt.expandedCard,children:[u.jsxs("div",{className:xt.expandedCardHeader,children:[u.jsx("span",{className:xt.expandedCardTitle,children:e}),t&&u.jsx("span",{className:xt.expandedCardDetail,children:t})]}),n&&u.jsx("div",{className:xt.expandedCardBody,children:n})]})}function K4e(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=Ml(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 Y4e({tool:e,todos:t,expanded:n,title:s}){var o;const i=((o=p.useContext(G8).get(e.callId))==null?void 0:o.events)??[];return n?u.jsx(xS,{title:s,children:u.jsx("div",{className:xt.todoBody,children:u.jsx(FF,{todos:t})})}):u.jsx("div",{className:xt.todoBody,children:u.jsx(zF,{todos:t,events:i})})}function Q4e(e,t){var m,g;const n=Mg(e.rawOutput),s=M8(e),r=Qp(e),i=I8(e),o=X4e(e),a=j8(e),l=((m=e.subTools)==null?void 0:m.length)||((g=n==null?void 0:n.toolCalls)==null?void 0:g.length)||0,c=n==null?void 0:n.executionSummary,d=c&&typeof c.totalDurationMs=="number"?OF(c.totalDurationMs):Ng(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),h=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:c&&typeof c.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,f=h>0?N8(h):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:l,elapsed:d,tokens:f,status:r,reason:s}}function X4e(e){var r;const t=Mg(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 _N(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Fl(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||zo(t))}function J4e({tool:e}){const t=Ml(e)||"";return u.jsx("pre",{className:xt.expandedOutput,children:t})}function Z4e({tool:e}){var n;const t=HF(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return u.jsx("pre",{className:xt.expandedOutput,children:t})}function HF(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 Wv(e){const t=e.toolName.toLowerCase();return Jw(e)?"agent":Fl(e.toolName)?"ask":zo(t)?"shell":$8(t)?"fetch":Dc(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 e_e({description:e,elapsed:t}){return u.jsxs(u.Fragment,{children:[e&&u.jsx("span",{className:xt.lineArg,children:e}),t&&u.jsx("span",{className:xt.lineElapsed,children:t})]})}function vw({info:e}){const{renderToolHeaderExtra:t}=Va(),n=t==null?void 0:t(e);return n?u.jsx(u.Fragment,{children:n}):u.jsx(e_e,{description:e.description,elapsed:e.elapsed})}function t_e(e){return e.length>P4e||e.includes(`
`)}function B8(e){return e==="in_progress"||e==="pending"||e==="running"}function P8(e){return e.find(t=>B8(t.status))??e[e.length-1]}function n_e(e,t,n){if(VF(e)){const r=P8(e);return t("toolGroup.running",{name:zl(r.toolName,t),count:e.length,duration:n??""})}const s=i_e(e,t);return s||t("toolGroup.summary",{count:e.length})}function s_e(e,t,n){if(Dc(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Fl(e.toolName))return t("toolGroup.summary.askedUser",{count:1});const{displayName:s,description:r,hideDisplayName:i}=UF(e,t,n);return[i?"":s,r].filter(Boolean).join(" ")}function UF(e,t,n){const s=zl(e.toolName,t),r=$r(AF(e,n),120);return{kind:Wv(e),tool:e,displayName:s,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!Zye(e)}}function r_e({tool:e,runningDuration:t,workspaceCwd:n}){const{t:s}=it(),r=B8(e.status)&&s("toolGroup.runningPrefix").trim();if(Dc(e.toolName)||Fl(e.toolName))return u.jsxs(u.Fragment,{children:[r&&u.jsxs("span",{children:[r," "]}),s_e(e,s,n),t&&u.jsxs("span",{children:[" ",t]})]});const i=UF(e,s,n);return u.jsxs(u.Fragment,{children:[r&&u.jsxs("span",{children:[r," "]}),u.jsxs("span",{className:xt.chatSummaryInline,children:[!i.hideDisplayName&&u.jsx("span",{className:xt.lineName,children:i.displayName}),u.jsx(vw,{info:i})]}),t&&u.jsxs("span",{children:[" ",t]})]})}function i_e(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,l=0;for(const d of e){const h=d.toolName.toLowerCase();zo(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++:Dc(h)?o++:Fl(h)?a++:l++}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.askedUser"):"",l?t("toolGroup.summary.otherTools",{count:l}):""].filter(Boolean).join(" ")}function VF(e){return e.some(t=>B8(t.status))}function o_e(){return u.jsxs("svg",{className:xt.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:[u.jsx("path",{d:"M12 20h9"}),u.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function WF(){return u.jsxs("svg",{className:xt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function a_e(){return u.jsxs("svg",{className:xt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),u.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 l_e(){return u.jsxs("svg",{className:xt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function c_e(){return u.jsx("svg",{className:xt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u.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 u_e(){return u.jsx("svg",{className:xt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u.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 d_e(){return u.jsx("svg",{className:xt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:u.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 h_e({tool:e}){const t=Wv(e);return t==="agent"?u.jsx(d_e,{}):t==="ask"?u.jsx(u_e,{}):t==="edit"||t==="write"?u.jsx(o_e,{}):t==="fetch"?u.jsx(a_e,{}):t==="read"?u.jsx(l_e,{}):t==="todo"?u.jsx(c_e,{}):u.jsx(WF,{})}function $8(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const f_e=Qp;function m_e({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:s}=it(),r=P8(e),i=zl(r.toolName,s),o=f_e(r),a=E8(r,t),l=zo(r.toolName)||$8(r.toolName)?"":Ng(r.startTime,r.endTime);return u.jsxs("div",{className:`${xt.compactGroup}${n?` ${Ju.flash}`:""}`,children:[u.jsxs("div",{className:xt.compactHeader,children:[u.jsx(dh,{status:o}),u.jsx("span",{className:xt.lineName,children:i}),e.length>1&&u.jsxs("span",{className:xt.compactCount,children:["× ",e.length]}),u.jsx(vw,{info:{kind:Wv(r),tool:r,displayName:i,description:a,elapsed:l,workspaceCwd:t}})]}),u.jsx("div",{className:xt.compactHint,children:s("compact.hint")})]})}function p_e(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&&g_e(n.subTools,s.subTools)}function g_e(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 kN=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function $4(e){if(!e||!e.includes("qwen-session://"))return e;const t=[];let n=0,s;for(kN.lastIndex=0;(s=kN.exec(e))!==null;){s.index>n&&t.push(e.slice(n,s.index));const r=s[2];t.push(u.jsx("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:r}))},children:s[1]},s.index)),n=s.index+s[0].length}return n<e.length&&t.push(e.slice(n)),t.length===1?t[0]:u.jsx(u.Fragment,{children:t})}const _S=p.memo(function({tool:t,approval:n,workspaceCwd:s,summaryOnly:r=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:a=!1,hideCollapsedOutput:l=!1}){const{t:c}=it(),d=p.useContext(fh),[h,f]=p.useState(()=>i||!d&&_N(t)),m=p.useRef(!1);p.useEffect(()=>{f(i||(d?!1:_N(t))),m.current=!1},[d,i,t.callId,t.toolName]);const g=Jw(t),y=n&&n.toolCallId===t.callId,b=!y&&(n==null?void 0:n.toolCallId)&&g&&Ha(t,n.toolCallId),w=g&&t.status==="in_progress",v=O8(w);if(p.useEffect(()=>{!i&&!g&&t.status==="completed"&&!m.current&&f(!1)},[i,g,t.status]),g){const U=Q4e(t,v),W=U.explicitAgentType?`${c("agent.label")} (${U.explicitAgentType})`:c("agent.label"),J=t.status==="completed"||t.status==="failed",te=[t.status==="pending"?c("subagent.pending"):c("subagent.running"),U.elapsed].filter(Boolean).join(" · "),H=[U.subToolCount>0?c("subagent.toolsCount",{count:U.subToolCount}):"",U.elapsed,U.tokens,U.reason?$r(U.reason,80):""].filter(Boolean).join(" · "),ie=i||h||!!y||!!b,fe=u.jsx(R8,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return u.jsxs("div",{className:xt.line,children:[!a&&u.jsxs("div",{className:`${xt.lineMain} ${xt.lineExpandable}`,onClick:()=>f(!h),children:[u.jsx(dh,{status:J?U.status:t.status}),u.jsx("span",{className:xt.lineName,children:W}),u.jsx(vw,{info:{kind:"agent",tool:t,displayName:W,description:U.description?$r(U.description,60):"",elapsed:J?H:te,workspaceCwd:s}}),u.jsx("span",{className:h?xt.lineChevronDown:xt.lineChevronRight,"aria-hidden":"true"})]}),ie&&u.jsx("div",{className:xt.lineDetail,children:a?u.jsx("div",{className:xt.expandedAgentCard,children:fe}):fe})]})}const x=E8(t,s),C=ebe(t),T=r&&zo(t.toolName)?AF(t,s):x,_=zl(t.toolName,c),R=zo(t.toolName)||$8(t.toolName)?"":Ng(t.startTime,t.endTime),I=t.toolName.toLowerCase(),k=Dc(I),j=k?L8(t):void 0,N=!!j&&j.length>0,L=j?j.filter(U=>U.status==="completed").length:0,$=zo(I),F=I==="grep"||I==="grep_search"||I==="search"||I==="glob",B=I==="read"||I==="read_file"||I==="readfile",Q=!k&&t_e(T),Y=!i&&(o||(k?N:I4e(t)||Q)),ne=j4e(t),P=h&&Q,le=B,z=P&&!$&&!F&&!B,M=x,re=!k&&h&&!ne&&(P||C);return u.jsxs("div",{className:xt.line,children:[!a&&u.jsxs("div",{className:`${xt.lineMain} ${Y?xt.lineExpandable:""}`,title:Y?c(h?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":Y?h:void 0,role:Y?"button":void 0,tabIndex:Y?0:void 0,onClick:Y?()=>{m.current=!0,f(U=>!U)}:void 0,onKeyDown:Y?U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),m.current=!0,f(W=>!W))}:void 0,children:[u.jsx(dh,{status:t.status}),u.jsx("span",{className:xt.lineName,children:_}),k&&N&&u.jsxs("span",{className:xt.todoProgress,children:[L,"/",j.length]}),u.jsx(vw,{info:{kind:Wv(t),tool:t,displayName:_,description:k||z?"":T,elapsed:k?"":R,workspaceCwd:s}}),Y&&u.jsx("span",{className:h?xt.lineChevronDown:xt.lineChevronRight,"aria-hidden":"true"})]}),(!r||h)&&k&&N&&u.jsx(Y4e,{tool:t,todos:j,expanded:h,title:_}),(!r||h)&&k&&!N&&C&&u.jsx("div",{className:xt.lineOutput,children:$4(C)}),re&&u.jsx(xS,{title:_,detail:M,children:C&&u.jsx("div",{className:`${xt.lineOutput} ${xt.expandedLineOutput}`,children:$4(C)})}),!k&&!l&&C&&!re&&(!h||!ne)&&(!r||h)&&u.jsx("div",{className:h?`${xt.lineOutput} ${xt.expandedLineOutput}`:xt.lineOutput,children:$4(C)}),!k&&h&&ne&&u.jsx("div",{className:le?`${xt.lineDetail} ${xt.markdownLineDetail}`:xt.lineDetail,children:B?u.jsx(H4e,{tool:t}):u.jsxs(xS,{title:_,detail:M,children:[zo(I)&&u.jsx(q4e,{tool:t}),(I==="write_file"||I==="writefile")&&u.jsx(xN,{tool:t}),(I==="edit"||I==="write"||I==="editfile")&&u.jsx(xN,{tool:t}),Fl(t.toolName)&&u.jsx(J4e,{tool:t}),Hv(I)&&u.jsx(Z4e,{tool:t})]})})]})},p_e),y_e=p.memo(function({tools:t,pendingApproval:n,workspaceCwd:s,isLocateFlashing:r=!1}){const{t:i}=it(),o=p.useContext(fh),[a,l]=p.useState(!1),c=VF(t),d=t.length>0?P8(t):void 0,h=t.length===1?t[0]:void 0,f=t[0]??d,m=p.useRef(Date.now()),g=O8(c),y=(n==null?void 0:n.toolCallId)&&t.some(v=>Ha(v,n.toolCallId)),b=o&&!y,w=c?BF(g-m.current):void 0;return p.useEffect(()=>{c&&(m.current=Date.now())},[c,d==null?void 0:d.callId]),b?u.jsx(m_e,{tools:t,workspaceCwd:s,isLocateFlashing:r}):y?u.jsx("div",{className:`${xt.group}${r?` ${Ju.flash}`:""}`,children:t.map(v=>u.jsx(_S,{tool:v,approval:n,workspaceCwd:s},v.callId))}):u.jsxs("div",{className:r?Ju.flash:void 0,children:[u.jsxs("button",{type:"button",className:xt.chatSummary,onClick:()=>l(v=>!v),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[u.jsx("span",{className:xt.chatSummaryIcon,"aria-hidden":"true",children:f?u.jsx(h_e,{tool:f}):u.jsx(WF,{})}),u.jsx("span",{className:c?`${xt.chatSummaryText} ${xt.chatSummaryTextActive}`:xt.chatSummaryText,children:h?u.jsx(r_e,{tool:h,runningDuration:c?w:void 0,workspaceCwd:s}):n_e(t,i,w)}),u.jsx("span",{className:a?xt.chatChevronDown:xt.chatChevronRight,"aria-hidden":"true"})]}),u.jsx("div",{className:a?xt.chatSummaryContentClip:`${xt.chatSummaryContentClip} ${xt.chatSummaryContentCollapsed}`,children:u.jsx("div",{className:xt.chatSummaryContentInner,children:u.jsx("div",{className:`${xt.group} ${xt.chatSummaryGroup}`,children:t.map(v=>u.jsx(_S,{tool:v,approval:n,workspaceCwd:s,summaryOnly:!h,forceExpanded:!!h,hideHeader:!!h},v.callId))})})})]})}),b_e="_message_kwepu_1",w_e="_header_kwepu_6",v_e="_chevron_kwepu_20",x_e="_title_kwepu_26",__e="_progress_kwepu_35",l0={message:b_e,header:w_e,chevron:v_e,title:x_e,progress:__e};function k_e({id:e,todos:t}){var r;const s=((r=p.useContext(G8).get(e))==null?void 0:r.events)??[];return u.jsx(zF,{todos:t,events:s})}const S_e=p.memo(function({id:t,todos:n,isLocateFlashing:s=!1}){const{t:r}=it(),[i,o]=p.useState(!1);if(n.length===0)return null;const a=n.length,l=n.filter(c=>c.status==="completed").length;return u.jsxs("div",{className:`${l0.message}${s?` ${Ju.flash}`:""}`,children:[u.jsxs("button",{type:"button",className:l0.header,onClick:()=>o(c=>!c),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[u.jsx("span",{className:l0.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),u.jsx("span",{className:l0.title,children:r("plan.title")}),u.jsxs("span",{className:l0.progress,children:[l,"/",a]})]}),i?u.jsx(FF,{todos:n,numbered:!0}):u.jsx(k_e,{id:t,todos:n})]})}),T_e="_message_1abcu_1",C_e="_content_1abcu_11",A_e="_question_1abcu_17",E_e="_prefix_1abcu_24",M_e="_answer_1abcu_28",N_e="_pending_1abcu_32",I_e="_shortcuts_1abcu_36",xd={message:T_e,content:C_e,question:A_e,prefix:E_e,answer:M_e,pending:N_e,shortcuts:I_e},GF=p.memo(function({question:t,answer:n,isPending:s}){const{t:r}=it();return u.jsxs("div",{className:xd.message,children:[u.jsxs("div",{className:xd.content,children:[u.jsxs("div",{className:xd.question,children:[u.jsx("span",{className:xd.prefix,children:"/btw "}),u.jsx("span",{children:t})]}),u.jsx("div",{className:xd.answer,children:s?u.jsx("span",{className:xd.pending,children:r("btw.answering")}):u.jsx(Em,{content:n})})]}),u.jsx("div",{className:xd.shortcuts,children:r(s?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),j_e="_message_1q4dw_1",R_e="_compact_1q4dw_16",L_e="_header_1q4dw_21",D_e="_status_1q4dw_30",O_e="_name_1q4dw_35",B_e="_command_1q4dw_42",P_e="_output_1q4dw_51",$_e="_compactHint_1q4dw_62",Jl={message:j_e,compact:R_e,header:L_e,status:D_e,name:O_e,command:B_e,output:P_e,compactHint:$_e},z_e=p.memo(function({command:t,output:n}){const s=p.useContext(fh),{t:r}=it();return u.jsxs("div",{className:s?`${Jl.message} ${Jl.compact}`:Jl.message,children:[u.jsxs("div",{className:Jl.header,children:[u.jsx("span",{className:Jl.status,children:"✓"}),u.jsx("span",{className:Jl.name,children:r("shell.command")}),t&&u.jsx("span",{className:Jl.command,children:t})]}),s?u.jsx("div",{className:Jl.compactHint,children:r("compact.hint")}):n&&u.jsx("pre",{className:Jl.output,children:n})]})}),F_e="_progress_1j3ys_1",q_e="_spinner_1j3ys_12",H_e="_bar_1j3ys_19",U_e="_stage_1j3ys_25",V_e="_icon_1j3ys_29",W_e="_done_1j3ys_35",G_e="_error_1j3ys_43",K_e="_detail_1j3ys_51",Y_e="_path_1j3ys_56",Qr={progress:F_e,spinner:q_e,bar:H_e,stage:U_e,icon:V_e,done:W_e,error:G_e,detail:K_e,path:Y_e},SN=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function Q_e({progress:e}){const{stage:t,progress:n,detail:s,isComplete:r,error:i}=e,[o,a]=p.useState(0),l=30,c=Math.round(n/100*l),d=l-c,h="█".repeat(Math.max(0,c))+"░".repeat(Math.max(0,d));return p.useEffect(()=>{if(r||i)return;const f=setInterval(()=>{a(m=>(m+1)%SN.length)},120);return()=>clearInterval(f)},[r,i]),i?u.jsxs("div",{className:`${Qr.progress} ${Qr.error}`,children:[u.jsx("span",{className:Qr.icon,children:"✕"}),u.jsx("span",{className:Qr.stage,children:t}),u.jsx("div",{className:Qr.detail,children:i})]}):r?u.jsxs("div",{className:`${Qr.progress} ${Qr.done}`,children:[u.jsx("span",{className:Qr.icon,children:"✓"}),u.jsx("span",{className:Qr.stage,children:t})]}):u.jsxs("div",{className:Qr.progress,children:[u.jsx("span",{className:Qr.spinner,children:SN[o]}),u.jsx("span",{className:Qr.bar,children:h}),u.jsxs("span",{className:Qr.stage,children:[t,s?` (${s})`:""]})]})}function X_e({path:e}){const{t}=it();return u.jsxs("div",{className:`${Qr.progress} ${Qr.done}`,children:[u.jsx("span",{className:Qr.icon,children:"✓"}),u.jsx("span",{className:Qr.stage,children:t("insight.ready")}),u.jsx("span",{className:Qr.path,children:e})]})}const J_e=p.memo(function({message:t,pendingApproval:n,onShowContextDetail:s,workspaceCwd:r,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:l,showAssistantActions:c=!1,showAssistantBranch:d=!1,isLocateFlashing:h=!1,assistantTurnFooterInfo:f}){const{t:m}=it(),g=(()=>{switch(t.role){case"user":return u.jsx(U1e,{content:t.content,images:t.images,isLocateFlashing:h});case"assistant":return u.jsx(hye,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:l,showFooterActions:c,showBranchAction:d,isLocateFlashing:h,customFooterInfo:f});case"thinking":return u.jsx(gye,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:h});case"tool_group":return u.jsx(y_e,{tools:t.tools,pendingApproval:n,workspaceCwd:r,isLocateFlashing:h});case"plan":return u.jsx(S_e,{id:t.id,todos:t.todos,isLocateFlashing:h});case"system":return u.jsx(w2e,{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 u.jsx(z_e,{command:t.command,output:t.output});case"btw":return u.jsx(GF,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return u.jsx(Q_e,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return u.jsx(X_e,{path:t.path});case"insight_error":return u.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(g===null)return null;const y=u.jsx(Tc,{label:`message:${t.role}`,resetKeys:[t],fallback:u.jsx(Z_e,{align:t.role==="user"?"end":"start"}),children:g}),b=u.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:y});return t.role==="assistant"?c?b:u.jsx(Mk,{timestamp:t.timestamp,children:b}):t.role==="system"&&t.source==="prompt_cancelled"?b:u.jsx(Mk,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:m("common.copy"),children:b})},eke);function Z_e({align:e}){const{t}=it();return u.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:u.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function eke(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||!tke(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:nke(e.message,t.message)}function tke(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 nke(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&&ike(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"&&ske(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,s)=>KF(n,t.tools[s]));default:return!1}}function ske(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 KF(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&&Kc(e.args)===Kc(t.args)&&Kc(e.rawOutput)===Kc(t.rawOutput)&&Kc(e.locations)===Kc(t.locations)&&Kc(e.content)===Kc(t.content)&&rke(e.subTools,t.subTools):!1}function rke(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>KF(n,t[s]))}const TN=new WeakMap;function ike(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 Kc(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=TN.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return TN.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}const oke="_wrap_1yq18_1",ake="_summary_1yq18_5",lke="_summaryTextActive_1yq18_27",cke="_summaryIcon_1yq18_33",uke="_summaryStatus_1yq18_47",dke="_summaryToolIcon_1yq18_54",hke="_summaryText_1yq18_27",fke="_summaryDot_1yq18_96",mke="_chevronRight_1yq18_100",pke="_chevronDown_1yq18_101",gke="_group_1yq18_161",yke="_list_1yq18_190",bke="_row_1yq18_196",wke="_rowStats_1yq18_210",vke="_rowDesc_1yq18_218",xke="_rowTool_1yq18_228",_ke="_detail_1yq18_232",Kr={wrap:oke,summary:ake,summaryTextActive:lke,summaryIcon:cke,summaryStatus:uke,summaryToolIcon:dke,summaryText:hke,summaryDot:fke,chevronRight:mke,chevronDown:pke,group:gke,list:yke,row:bke,rowStats:wke,rowDesc:vke,rowTool:xke,detail:_ke};function kke(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 Ske(e,t){const n=[],s=Mg(e.rawOutput),r=s==null?void 0:s.executionSummary,i=r&&typeof r.totalDurationMs=="number"?kke(r.totalDurationMs):Ng(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(N8(o));const a=M8(e);return a&&n.push($r(a,80)),n.join(" · ")}function Tke(){return u.jsx("svg",{className:Kr.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:u.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 Cke({agents:e,pendingApproval:t}){const{t:n}=it(),[s,r]=p.useState(!1),[i,o]=p.useState(null),[a,l]=p.useState(()=>Date.now()),c=p.useRef(Date.now()),d=e.some(w=>w.status==="in_progress");p.useEffect(()=>{d&&(c.current=Date.now(),l(Date.now()))},[d]),p.useEffect(()=>{if(!d)return;const w=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(w)},[d]);const h=d?BF(a-c.current):"",f=e.filter(w=>w.status==="completed"||w.status==="failed").length,m=e.length,g=t!=null&&t.toolCallId?e.find(w=>Ha(w,t.toolCallId)):void 0,y=s||!!g,b=e.some(w=>Qp(w)==="failed")?"failed":d?"in_progress":"completed";return u.jsxs("div",{className:Kr.wrap,children:[u.jsxs("button",{type:"button",className:Kr.summary,onClick:()=>r(w=>!w),"aria-expanded":y,title:n(y?"tool.collapseHint":"tool.expand"),children:[b==="failed"?u.jsx("span",{className:Kr.summaryStatus,children:u.jsx(dh,{status:b})}):u.jsx("span",{className:Kr.summaryIcon,"aria-hidden":"true",children:u.jsx(Tke,{})}),u.jsxs("span",{className:d?`${Kr.summaryText} ${Kr.summaryTextActive}`:Kr.summaryText,children:[n("parallelAgents.title"),h&&u.jsxs(u.Fragment,{children:[" ",h]}),u.jsx("span",{className:Kr.summaryDot,children:"·"}),n("parallelAgents.done",{done:f,total:m})]}),u.jsx("span",{className:y?Kr.chevronDown:Kr.chevronRight,"aria-hidden":"true"})]}),y&&u.jsx("div",{className:Kr.group,children:u.jsx("div",{className:Kr.list,children:e.map(w=>{const v=I8(w),x=j8(w),C=rbe(w,n),A=Ske(w,a),T=Qp(w),_=i===w.callId;return u.jsxs("div",{children:[u.jsxs("div",{className:Kr.row,onClick:()=>o(_?null:w.callId),children:[u.jsx(dh,{status:T}),u.jsxs("span",{className:Kr.rowDesc,children:[$r(x||v,50),C&&u.jsx("span",{className:Kr.rowTool,children:` (${C})`})]}),A&&u.jsx("span",{className:Kr.rowStats,children:A})]}),_&&u.jsx("div",{className:Kr.detail,children:u.jsx(R8,{tool:w,hideHeader:!0})})]},w.callId)})})})]})}const Ake="_collapseRow_d7f01_1",Eke="_collapseRowClickable_d7f01_14",Mke="_collapseLabel_d7f01_19",Nke="_processedLabel_d7f01_36",Ike="_processedMeta_d7f01_43",jke="_hiddenMetrics_d7f01_47",Rke="_summaryMetrics_d7f01_51",Lke="_collapseIcon_d7f01_59",Dke="_chevronRight_d7f01_72",Oke="_chevronDown_d7f01_73",La={collapseRow:Ake,collapseRowClickable:Eke,collapseLabel:Mke,processedLabel:Nke,processedMeta:Ike,hiddenMetrics:jke,summaryMetrics:Rke,collapseIcon:Lke,chevronRight:Dke,chevronDown:Oke},Bke="_list_djj49_1",Pke="_virtualSizer_djj49_34",$ke="_virtualRow_djj49_43",zke="_loadingSkeleton_djj49_53",Fke="_srOnly_djj49_61",qke="_loadingSkeletonUserRow_djj49_73",Hke="_loadingSkeletonAssistantRow_djj49_79",Uke="_loadingSkeletonUserBubble_djj49_85",Vke="_loadingSkeletonUserBubbleCompact_djj49_86",Wke="_loadingSkeletonAssistantBlock_djj49_100",Gke="_loadingSkeletonLineWide_djj49_108",Kke="_loadingSkeletonLineMedium_djj49_109",Yke="_loadingSkeletonLineShort_djj49_110",Qke="_loadingSkeletonLineNarrow_djj49_111",Xke="_turnStatusRow_djj49_151",Jke="_turnAnswerRow_djj49_152",Zke="_turnContentRow_djj49_163",e3e="_turnContentClip_djj49_167",t3e="_turnContentCollapsed_djj49_175",n3e="_turnContentInner_djj49_179",s3e="_sessionTimelineLayer_djj49_184",r3e="_sessionTimelinePanel_djj49_197",i3e="_sessionTimelineViewport_djj49_208",o3e="_sessionTimelineList_djj49_249",a3e="_sessionTimelineItem_djj49_259",l3e="_sessionTimelineButton_djj49_264",c3e="_sessionTimelineTick_djj49_283",u3e="_sessionTimelineButtonInRange_djj49_370",d3e="_sessionTimelineButtonCurrent_djj49_374",h3e="_sessionTimelineDetails_djj49_385",f3e="_sessionTimelineDetailsTitle_djj49_419",m3e="_sessionTimelineDetailsIcon_djj49_426",p3e="_sessionTimelineDetailsTitleText_djj49_438",g3e="_sessionTimelineDetailsDetail_djj49_448",In={list:Bke,virtualSizer:Pke,virtualRow:$ke,loadingSkeleton:zke,srOnly:Fke,loadingSkeletonUserRow:qke,loadingSkeletonAssistantRow:Hke,loadingSkeletonUserBubble:Uke,loadingSkeletonUserBubbleCompact:Vke,loadingSkeletonAssistantBlock:Wke,loadingSkeletonLineWide:Gke,loadingSkeletonLineMedium:Kke,loadingSkeletonLineShort:Yke,loadingSkeletonLineNarrow:Qke,turnStatusRow:Xke,turnAnswerRow:Jke,turnContentRow:Zke,turnContentClip:e3e,turnContentCollapsed:t3e,turnContentInner:n3e,sessionTimelineLayer:s3e,sessionTimelinePanel:r3e,sessionTimelineViewport:i3e,sessionTimelineList:o3e,sessionTimelineItem:a3e,sessionTimelineButton:l3e,sessionTimelineTick:c3e,sessionTimelineButtonInRange:u3e,sessionTimelineButtonCurrent:d3e,sessionTimelineDetails:h3e,sessionTimelineDetailsTitle:f3e,sessionTimelineDetailsIcon:m3e,sessionTimelineDetailsTitleText:p3e,sessionTimelineDetailsDetail:g3e};function y3e(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 b3e(e){return e[e.length-1]}function w3e(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&Im(n))return n.id}return null}function CN(e){return e.role==="tool_group"&&e.tools.length===1&&Jw(e.tools[0])}function z4(e){return e.role==="tool_group"&&e.tools.length===1&&ND(e.tools[0])}function AN(e){return e.role==="thinking"}function EN(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Ha(n,t.toolCallId)))}function MN(e){return e.role==="thinking"}function v3e(e,t){const n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.role!=="tool_group"||EN(r,t)){MN(r)||n.push(r),s++;continue}const i=[r];let o=s,a=s+1;for(;a<e.length;){const c=e[a];if(MN(c)){a++;continue}if(c.role==="tool_group"&&!EN(c,t)){i.push(c),o=a,a++;continue}break}if(i.length===1){n.push(r),s++;continue}const l=i.flatMap(c=>c.role==="tool_group"?c.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:l}),s=o+1}return n}function YF(e){const t=[];let n=0;for(;n<e.length;){if(z4(e[n])){const s=[];let r=n;for(;r<e.length;){const i=e[r];if(z4(i)){s.push(i),r++;continue}if(AN(i)){let o=r+1;for(;o<e.length&&AN(e[o]);)o++;if(o<e.length&&z4(e[o])){r=o;continue}}break}if(s.length>=2){t.push({type:"parallel_agents",key:`par-${s[0].id}`,agents:s.map(i=>i.tools[0]),timestamp:s[0].timestamp}),n=r;continue}}if(CN(e[n])){const s=n;for(;n<e.length&&CN(e[n]);)n++;if(n-s>=2){const r=e.slice(s,n);t.push({type:"parallel_agents",key:`par-${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 NN(e){if(e.type==="parallel_agents")return`group:${e.key}`;if(e.type==="turn_collapse"){const t=e.turnCollapse.liveStartedAt;return t===void 0?`tc:${e.key}`:`tc:${e.key}:${t}`}return e.type==="turn_content"?`turn-content:${e.key}`:`msg:${e.key}`}function x3e(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function z8(e,t,n){let s=t;for(let r=n;r>t;r--)if(QF(e[r])){s=r;break}for(let r=n;r>s;r--)if(x3e(e[r]))return r;return-1}function _3e(e,t){const n=[];for(let r=0;r<e.length;r++){const i=e[r];i.type==="message"&&Im(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],l=z8(e,i,o);if(l<0)continue;const c=e[l];(a==null?void 0:a.type)==="message"&&c.type==="message"&&c.message.role==="assistant"&&s.set(c.message.id,a.message.id)}return s}function kS(e,t){if(e.type==="parallel_agents")return!0;if(e.type==="turn_collapse")return!1;if(e.type==="turn_content")return e.items.some(n=>kS(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return F8(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 F8(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 k3e(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};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}:hh(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 F8(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 hh(e,t,n={}){const r=(n.stripMarkdown===!0?S3e(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 S3e(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=F4(s,"~~"),s=F4(s,"**"),s=F4(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 F4(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 T3e(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",s=hh(n,32);return s||(t?t("timeline.userTurn"):"User turn")}function C3e(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function Im(e){return e.role==="user"||e.role==="user_shell"}function A3e(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return hh(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 F8(e)?hh(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 E3e(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!=="message"?"":A3e(e.message,t)}function M3e(e,t){return t?t(`timeline.kind.${e}`):eSe[e]}function N3e(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 l=hh(a.content,180,{stripMarkdown:!0});if(l)return l}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 l=E3e(a,s);l&&r.push(l)}const i=hh(r.join(" · "),180);return i||(n.length>0?n.map(o=>M3e(o,s)).join(" · "):s?s("timeline.noActivity"):"No activity")}function I3e(e,t){const n=[];let s=null,r=[];const i=()=>{if(!s)return;const o=YF(r),a=z8(o,-1,o.length-1),l=a>=0?o[a]:null,c=(l==null?void 0:l.type)==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&hh(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(const h of o){if(h.type==="message"&&c!==null&&h.message.id===c)continue;const f=k3e(h,t);f.kind!=="none"&&!d.includes(f.kind)&&d.push(f.kind)}n.push({id:s.id,label:T3e(s,t),detail:N3e(o,c,d,t),timestamp:s.timestamp,nodeKinds:d,...C3e(s)?{isScheduledTask:!0}:{}})};for(const o of e){if(Im(o)){i(),s=o,r=[];continue}s&&r.push(o)}return i(),n}function j3e(){return u.jsxs("svg",{className:In.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),u.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function R3e(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 L3e(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(R3e).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 QF(e){return e.type==="parallel_agents"?!0:e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(QF):e.message.role==="tool_group"||e.message.role==="plan"}function IN(e){return e==="pending"||e==="running"||e==="in_progress"}function XF(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const s=XF(e.items[n]);if(s)return s}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=>IN(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=>IN(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function D3e(e){for(let t=e.length-1;t>=0;t--){const n=XF(e[t]);if(n)return n}return null}function O3e(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 B3e(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function P3e(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 $3e(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function JF(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+JF(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function ZF(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const s=e[n];if(s.type==="message"&&Im(s.message))return s.message.id}return null}function eq(e){const t=[];let n=null;for(const s of e)s.type==="message"&&Im(s.message)&&(n=s.message.id),t.push(n);return t}function jN(e,t,n,s){const r=s===void 0?ZF(e,t):s[t]??null;return r?n.get(r)??null:null}function z3e(e,t,n,s,r=eq(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const l of t){if(l<0||l>=e.length)continue;const c=jN(e,l,n,r);c!==null&&(i=Math.min(i,c),o=Math.max(o,c))}if(o<0)return null;const a=s==null?null:jN(e,s,n,r);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function F3e(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=>Ha(o,s)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>Ha(o,s)))return!0}return!1}function q3e(e,{overrides:t,isResponding:n,activeTurnStartedAt:s,pendingApprovalCallId:r,enabled:i}){if(!i||e.length===0)return e;const o=[];for(let l=0;l<e.length;l++){const c=e[l];c.type==="message"&&Im(c.message)&&o.push(l)}if(o.length===0)return e;const a=[];for(let l=0;l<o[0];l++)a.push(e[l]);for(let l=0;l<o.length;l++){const c=o[l],d=(l+1<o.length?o[l+1]:e.length)-1,h=e[c],f=h.message.id,m=h.message.timestamp,g=l===o.length-1&&n,y=F3e(e,c,d,r),b=z8(e,c,d);let w=0,v,x,C=0,A=0,T=0,_=0,R=0,I=!1,k=!1;for(let M=c+1;M<=d;M++){const re=e[M];kS(re,M===b)&&w++,B3e(re)&&(k=!0),_+=JF(re),re.type==="message"&&re.message.role==="thinking"&&R++;const W=O3e(re);W!==void 0&&(v=v===void 0?W:Math.max(v,W));const J=P3e(re);J!==void 0&&(x=x===void 0?J:Math.max(x,J));const G=$3e(re);G&&(C+=G.inputTokens,A+=G.outputTokens,T+=G.cachedTokens??0,I=!0)}const j=g?s??m??Date.now():void 0,N=v??x,L=m!==void 0&&N!==void 0&&N>=m?N-m:void 0;if(y||w===0&&!(I||L!==void 0||j!==void 0)){for(let M=c;M<=d;M++)a.push(e[M]);continue}const F=g||k||b<0,Q=!(w===0?!0:t.has(f)?t.get(f):F);let Y=0;const ne=M=>{M.length!==0&&a.push({type:"turn_content",key:`${f}-content-${Y++}`,turnId:f,collapsed:Q,items:M})};a.push({type:"message",key:h.key,message:h.message});const P={turnId:f,collapsed:Q,hiddenCount:w,...L!==void 0?{elapsedMs:L}:{},...I?{inputTokens:C,outputTokens:A}:{},...T>0?{cachedTokens:T}:{},..._>0?{toolCallCount:_}:{},...R>0?{thinkingCount:R}:{},...j!==void 0?{liveStartedAt:j}:{}};if(a.push({type:"turn_collapse",key:`tc-${f}`,turnCollapse:P}),!Q){let M=[];for(let re=c+1;re<=d;re++){const U=e[re];re===b&&U.type==="message"&&U.message.role==="assistant"?(ne(M),M=[],a.push({...U,turnCollapse:P})):M.push(U)}ne(M);continue}const le=[],z=[];for(let M=c+1;M<=d;M++){const re=e[M];if(!(M===b&&g)){if(M===b&&re.type==="message"&&re.message.role==="assistant"){z.push({...re,turnCollapse:P});continue}if(kS(re,M===b)){le.push(re);continue}z.push(re)}}ne(le),a.push(...z)}return a}function Uy(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=>Ha(i,n)))return s}else{if(r.type==="parallel_agents"&&n&&r.agents.some(i=>Ha(i,n)))return s;if(r.type==="turn_content"&&Uy(r.items,t,n)>=0)return s}}return-1}function SS(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=>Ha(s,n)):e.type==="parallel_agents"?!!n&&e.agents.some(s=>Ha(s,n)):e.type==="turn_content"?e.items.some(s=>SS(s,t)):!1}const q4=0,H3e=120,H4=80,U3e=32,V3e=240,U4=30,tq=200,W3e=4;function G3e(e,t=tq){return e>t}function K3e(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 V4(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function Y3e(e){return e!==void 0?K3e(e):""}function Q3e(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,s=n>0&&e.inputTokens>0?` (${V4(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${V4(e.inputTokens)}${s} ↓${V4(e.outputTokens)}`}function RN(e,t){const n=[],s=Q3e(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 X3e(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const J3e=p.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:s}=it(),r=t.hiddenCount>0,i=t.liveStartedAt,o=r||i!==void 0||X3e(t),a=O8(i!==void 0&&o),l=p.useRef(0),c=p.useRef(i);c.current!==i&&(c.current=i,l.current=0);let d;i!==void 0&&o?(l.current=Math.max(l.current,Math.max(0,a-i)),d=l.current):o&&t.elapsedMs!==void 0?(l.current=0,d=t.elapsedMs):(l.current=0,d=void 0);const h=Y3e(d),f=RN(t,s),m=RN(t,s),g=s(i!==void 0?"turn.processing":"turn.processed"),y=!!h&&o,b=!!f&&o,w=!!m&&o;if(!o)return null;const v=()=>{if(!r)return;const x=t.collapsed;n(t.turnId,x)};return u.jsxs("div",{className:r?`${La.collapseRow} ${La.collapseRowClickable}`:La.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?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),v())}:void 0,children:[u.jsxs("span",{className:La.collapseLabel,children:[u.jsxs("span",{className:La.processedLabel,children:[g,y&&u.jsxs("span",{className:La.processedMeta,children:[" ",h]})]}),w&&u.jsx("span",{className:La.summaryMetrics,children:m}),b&&u.jsx("span",{className:La.hiddenMetrics,children:f})]}),r&&u.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:La.collapseIcon,onClick:x=>{x.stopPropagation(),v()},children:u.jsx("span",{className:t.collapsed?La.chevronRight:La.chevronDown,"aria-hidden":"true"})})]})});function LN(e){if(e.type==="turn_collapse")return In.turnStatusRow;if(e.type==="turn_content")return In.turnContentRow;if(e.type==="message"&&e.turnCollapse)return In.turnAnswerRow}const Z3e=p.memo(function({collapsed:t,children:n}){const s=q8(In.turnContentClip,t?In.turnContentCollapsed:void 0);return u.jsx("div",{className:s,"data-collapsed":t?"true":"false",children:u.jsx("div",{className:In.turnContentInner,children:n})})}),eSe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},tSe=["--background","--foreground","--muted-foreground","--border","--font-sans"],DN="session-timeline-detail-tooltip",nSe=p.memo(function({entries:t,currentTurnId:n,currentRange:s,hidden:r,onSelect:i}){const{t:o}=it(),a=p.useRef(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(!1),h=p.useRef(!1),f=p.useRef(null),m=p.useRef(null),[g,y]=p.useState(null),b=s!==null?s.currentIndex:t.findIndex(I=>I.id===n),w=p.useCallback(()=>y(null),[]),v=p.useCallback(()=>{d.current||h.current||w()},[w]),x=p.useCallback((I,k)=>{const j=a.current;if(!j)return null;const N=getComputedStyle(j),L=k.getBoundingClientRect();return{entry:I,top:L.top+L.height/2,left:L.right+8,clamped:!1,themeVars:Object.fromEntries(tSe.map($=>[$,N.getPropertyValue($)]))}},[]),C=p.useCallback(I=>{const k=l.current;if(!k)return null;const j=Array.from(k.querySelectorAll('[data-testid="session-timeline-entry"]')).find(N=>N.getAttribute("data-turn-id")===I.id);return(j==null?void 0:j.querySelector("button"))??null},[]),A=p.useCallback(I=>{const k=l.current;if(!k)return!1;const j=k.getBoundingClientRect(),N=I.getBoundingClientRect();return N.bottom>=j.top&&N.top<=j.bottom},[]),T=p.useCallback(()=>{y(I=>{if(!I)return null;const k=C(I.entry);return!k||!A(k)?null:x(I.entry,k)})},[x,C,A]),_=p.useCallback((I,k)=>{y(x(I,k))},[x]),R=p.useCallback(()=>{typeof window>"u"||(f.current!==null&&window.cancelAnimationFrame(f.current),m.current!==null&&window.clearTimeout(m.current),h.current=!0,f.current=window.requestAnimationFrame(()=>{f.current=null,h.current=!1,T()}),m.current=window.setTimeout(()=>{m.current=null,h.current=!1},100))},[T]);return p.useLayoutEffect(()=>{if(r)return;const I=l.current;if(!I||b<0)return;const k=I.querySelector(`[data-timeline-index="${b}"]`);if(!k)return;const j=k.offsetTop+k.offsetHeight/2,N=I.scrollHeight-I.clientHeight,L=Math.max(0,Math.min(j-I.clientHeight/2,N));if(I.scrollTop===L)return;d.current=!0,I.scrollTop=L;const $=window.requestAnimationFrame(()=>{d.current=!1,T()}),F=window.setTimeout(()=>{d.current=!1},100);return()=>{window.cancelAnimationFrame($),window.clearTimeout(F),d.current=!1}},[b,r,T]),p.useLayoutEffect(()=>{if(!(!g||typeof window>"u"))return window.addEventListener("resize",T),()=>{window.removeEventListener("resize",T)}},[T,g]),p.useLayoutEffect(()=>()=>{f.current!==null&&window.cancelAnimationFrame(f.current),m.current!==null&&window.clearTimeout(m.current),h.current=!1},[]),p.useLayoutEffect(()=>{if(!g||g.clamped)return;const I=a.current,k=c.current;if(!I||!k||typeof window>"u")return;const j=k.getBoundingClientRect(),N=12;let L=g.top;j.top<N?L+=N-j.top:j.bottom>window.innerHeight-N&&(L-=j.bottom-(window.innerHeight-N)),L!==g.top&&y($=>($==null?void 0:$.entry.id)===g.entry.id?{...$,top:L,clamped:!0}:$)},[g]),r||t.length===0?null:u.jsx("div",{className:In.sessionTimelineLayer,"aria-hidden":"false",children:u.jsxs("nav",{ref:a,className:In.sessionTimelinePanel,"aria-label":o("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:w,children:[u.jsx("div",{ref:l,className:In.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:v,children:u.jsx("ol",{className:In.sessionTimelineList,children:t.map((I,k)=>{const j=s!==null&&k>=s.startIndex&&k<=s.endIndex,N=s!==null?k===s.currentIndex:I.id===n,L=I.nodeKinds.join(","),$=[`${o("timeline.turnPrefix",{index:k+1})}: ${I.label}`,N?o("timeline.currentTurn"):null].filter(Boolean).join(". "),F=Y=>_(I,Y.currentTarget),B=Y=>{R(),_(I,Y.currentTarget)},Q=(g==null?void 0:g.entry.id)===I.id;return u.jsx("li",{className:In.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":I.id,"data-timeline-index":k,"data-node-kinds":L,"data-in-current-range":j?"true":void 0,children:u.jsx("button",{type:"button",className:q8(In.sessionTimelineButton,j?In.sessionTimelineButtonInRange:void 0,N?In.sessionTimelineButtonCurrent:void 0),"aria-current":N?"step":void 0,"aria-describedby":Q?DN:void 0,"aria-label":$,onClick:()=>i(I.id),onFocus:B,onBlur:w,onMouseEnter:F,onMouseLeave:w,children:u.jsx("span",{className:In.sessionTimelineTick})})},I.id)})})}),g&&typeof document<"u"&&dm.createPortal(u.jsxs("div",{ref:c,className:In.sessionTimelineDetails,id:DN,"data-testid":"session-timeline-detail","data-title":g.entry.label,"data-detail":g.entry.detail,"data-scheduled-task":g.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...g.themeVars,top:g.top,left:g.left},children:[u.jsxs("span",{className:In.sessionTimelineDetailsTitle,children:[g.entry.isScheduledTask&&u.jsx(j3e,{}),u.jsx("span",{className:In.sessionTimelineDetailsTitleText,children:g.entry.label})]}),u.jsx("span",{className:In.sessionTimelineDetailsDetail,children:g.entry.detail})]}),document.body)]})})});function q8(...e){return e.filter(Boolean).join(" ")||void 0}const sSe=[];function rSe({label:e}){return u.jsxs(u.Fragment,{children:[u.jsx("div",{role:"status","aria-live":"polite",className:In.srOnly,children:e}),u.jsxs("div",{className:In.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[u.jsx("div",{className:In.loadingSkeletonUserRow,children:u.jsxs("div",{className:In.loadingSkeletonUserBubble,children:[u.jsx("span",{className:In.loadingSkeletonLineWide}),u.jsx("span",{className:In.loadingSkeletonLineShort})]})}),u.jsx("div",{className:In.loadingSkeletonAssistantRow,children:u.jsxs("div",{className:In.loadingSkeletonAssistantBlock,children:[u.jsx("span",{className:In.loadingSkeletonLineMedium}),u.jsx("span",{className:In.loadingSkeletonLineWide}),u.jsx("span",{className:In.loadingSkeletonLineNarrow})]})}),u.jsx("div",{className:In.loadingSkeletonUserRow,children:u.jsx("div",{className:In.loadingSkeletonUserBubbleCompact,children:u.jsx("span",{className:In.loadingSkeletonLineMedium})})}),u.jsx("div",{className:In.loadingSkeletonAssistantRow,children:u.jsxs("div",{className:In.loadingSkeletonAssistantBlock,children:[u.jsx("span",{className:In.loadingSkeletonLineWide}),u.jsx("span",{className:In.loadingSkeletonLineMedium})]})})]})]})}const nq=p.memo(p.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:s,loadingTranscript:r,catchingUp:i,isResponding:o=!1,activeTurnStartedAt:a,welcomeHeader:l,workspaceCwd:c,tailContent:d,tailKey:h="tail",virtualScrollThreshold:f=tq,autoScrollTailIntoView:m=!1,bottomOverlayInset:g=0,hideSessionTimeline:y=!1,showRetryHint:b=!1,onRetryClick:w,onBranchSession:v,onCanScrollToBottomChange:x},C){var Bs;const{t:A}=it(),T=p.useContext(fh),_=p.useMemo(()=>T?v3e(t,n):t,[T,t,n]),R=p.useMemo(()=>YF(_),[_]),[I,k]=p.useState(!1),j=p.useRef(null),N=p.useMemo(()=>{var xe,wt;if(!I)return sSe;const we=L3e(_);return(((xe=j.current)==null?void 0:xe.signature)!==we||((wt=j.current)==null?void 0:wt.t)!==A)&&(j.current={signature:we,t:A,entries:I3e(_,A)}),j.current.entries},[I,_,A]),L=p.useMemo(()=>new Map(N.map((we,xe)=>[we.id,xe])),[N]),$=p.useMemo(()=>w3e(_),[_]),[F,B]=p.useState(null),Q=F!==null?((Bs=N[F.currentIndex])==null?void 0:Bs.id)??$:$,Y=p.useMemo(()=>{var we;if(o)return null;for(let xe=_.length-1;xe>=0;xe-=1){const wt=_[xe];if(wt&&(wt.role==="tool_group"||wt.role==="plan"))return null;if((wt==null?void 0:wt.role)==="assistant"&&!wt.isStreaming&&((we=wt.content)!=null&&we.trim()))return wt.id}return null},[o,_]),ne=p.useMemo(()=>_3e(R,o),[R,o]),{collapseCompletedTurns:P}=Va(),le=P??!0,[z,M]=p.useState(()=>new Map),re=p.useRef(!0),U=p.useRef(!1),W=p.useRef(0),J=p.useRef(0),G=p.useRef(!1),te=p.useRef(0),H=p.useRef(null),ie=p.useRef(null),fe=p.useRef(!1),Ne=p.useRef(null),Ie=p.useRef(!1),Ce=p.useRef(r),ve=p.useRef(!!r),ut=p.useRef(void 0),ae=p.useRef(void 0),Ct=p.useRef(g),Ke=p.useRef(null),on=p.useRef(i),qt=p.useRef(i),gt=p.useRef(!1),St=p.useRef(!1),ft=p.useRef(void 0),de=p.useRef(void 0),_e=p.useRef(void 0);qt.current=i;const Ue=p.useRef(null),Xe=p.useCallback(()=>{const we=Ue.current,xe=we?we.scrollHeight-we.scrollTop-we.clientHeight:0,wt=!re.current&&xe>1;ie.current!==wt&&(ie.current=wt,x==null||x(wt))},[x]),yt=p.useCallback(()=>{_e.current!==void 0&&window.cancelAnimationFrame(_e.current),_e.current=window.requestAnimationFrame(Xe)},[Xe]),ye=p.useCallback(we=>{re.current!==we&&(re.current=we,yt())},[yt]),Kt=p.useMemo(()=>q3e(R,{overrides:z,isResponding:o,activeTurnStartedAt:a,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:le}),[R,z,o,a,n==null?void 0:n.toolCallId,le]),Ee=p.useMemo(()=>eq(Kt),[Kt]),ct=N.length>=W3e;p.useLayoutEffect(()=>{if(y){k(oe=>oe&&!1);return}const we=Ue.current;if(!we)return;const xe=()=>{const ue=we.getBoundingClientRect().width>=1160;k(be=>be===ue?be:ue)};if(xe(),typeof ResizeObserver>"u")return;const wt=new ResizeObserver(xe);return wt.observe(we),()=>wt.disconnect()},[y]);const qn=d!=null,Me=!!r,qe=!!l,Fe=qe?1:0,Ht=Fe+Kt.length,Mn=Ht+(qn?1:0),Rn=G3e(Mn,f),Bn=p.useCallback(()=>Ue.current,[]),Hr=p.useCallback(()=>{const we=Ue.current;if(!we)return;const wt=we.scrollHeight-we.scrollTop-we.clientHeight<U4;U.current=!wt,ye(wt),yt()},[yt,ye]),Ut=p.useCallback(()=>{W.current=Date.now()+1e3},[]),vn=p.useCallback(()=>{St.current=!0,ft.current!==void 0&&window.cancelAnimationFrame(ft.current),de.current!==void 0&&window.clearTimeout(de.current),ft.current=window.requestAnimationFrame(Hr),de.current=window.setTimeout(()=>{St.current=!1,ft.current=void 0,de.current=void 0,Hr()},220)},[Hr]);p.useEffect(()=>()=>{ft.current!==void 0&&window.cancelAnimationFrame(ft.current),de.current!==void 0&&window.clearTimeout(de.current),_e.current!==void 0&&window.cancelAnimationFrame(_e.current),ut.current!==void 0&&window.cancelAnimationFrame(ut.current),ae.current!==void 0&&window.cancelAnimationFrame(ae.current)},[]);const tn=p.useCallback((we,xe)=>{const wt=Ue.current;(!wt||wt.scrollHeight>wt.clientHeight+1)&&(U.current=!0,ye(!1)),vn(),M(oe=>{const ue=new Map(oe);return ue.set(we,xe),ue})},[vn,ye]),Jt=p.useCallback(we=>{const xe=we.target;xe instanceof HTMLElement&&xe.closest("[aria-expanded]")&&(U.current=!0,ye(!1),vn())},[vn,ye]),Nn=p.useCallback(we=>{if(qe&&we===q4)return"slot:header";if(qn&&we===Ht)return`slot:tail:${h}`;const xe=Kt[we-Fe];return xe?NN(xe):`slot:row:${we}`},[qe,qn,Ht,h,Kt,Fe]),fn=p.useCallback((we="auto")=>{const xe=Bn();if(!xe||xe.scrollHeight<=xe.clientHeight)return;te.current+=1;const wt=te.current;G.current=!0,we==="smooth"?xe.scrollTo({top:xe.scrollHeight,behavior:we}):xe.scrollTop=xe.scrollHeight,yt(),J.current=Math.max(0,xe.scrollHeight-xe.clientHeight),Xe();const oe=()=>{te.current===wt&&(G.current=!1)};we==="smooth"?setTimeout(oe,350):requestAnimationFrame(oe)},[Bn,Xe,yt]),Pn=p.useCallback((we="smooth")=>{U.current=!1,ye(!0),fn(we)},[fn,ye]),Gn=wQ({count:Mn,enabled:Rn,getScrollElement:Bn,getItemKey:Nn,estimateSize:we=>{if(qe&&we===q4)return H3e;if(qn&&we===Ht)return V3e;const xe=Kt[we-Fe];return(xe==null?void 0:xe.type)==="turn_collapse"?U3e:(xe==null?void 0:xe.type)==="turn_content"?Math.max(H4,xe.items.length*H4):H4},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Hn=Gn.getVirtualItems(),qs=Gn.getTotalSize(),br=p.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});br.current={entryIndexById:L,headerOffset:Fe,isVisible:I,turnIdByDisplayIndex:Ee,visibleItems:Kt};const Dn=p.useCallback(()=>{const we=Bn(),xe=br.current;if(!we||!xe.isVisible||xe.entryIndexById.size===0){B(rn=>rn===null?rn:null);return}const wt=we.getBoundingClientRect(),oe=wt.top,ue=wt.bottom,be=oe+(ue-oe)/2,lt=[];let Re=null,Nt=Number.POSITIVE_INFINITY;we.querySelectorAll("[data-index]").forEach(rn=>{const Kn=rn.dataset.index;if(Kn===void 0)return;const er=Number(Kn);if(!Number.isFinite(er))return;const vs=er-xe.headerOffset;if(vs<0||vs>=xe.visibleItems.length)return;const tr=rn.getBoundingClientRect();if(tr.bottom<oe||tr.top>ue)return;lt.push(vs);const ni=tr.top+(tr.bottom-tr.top)/2,ns=Math.abs(ni-be);ns<Nt&&(Nt=ns,Re=vs)});const bt=z3e(xe.visibleItems,lt,xe.entryIndexById,Re,xe.turnIdByDisplayIndex);B(rn=>(rn==null?void 0:rn.startIndex)===(bt==null?void 0:bt.startIndex)&&(rn==null?void 0:rn.endIndex)===(bt==null?void 0:bt.endIndex)&&(rn==null?void 0:rn.currentIndex)===(bt==null?void 0:bt.currentIndex)?rn:bt)},[Bn]),ln=p.useCallback(()=>{H.current!==null&&cancelAnimationFrame(H.current),H.current=requestAnimationFrame(()=>{H.current=null,Dn()})},[Dn]);p.useEffect(()=>()=>{H.current!==null&&(cancelAnimationFrame(H.current),H.current=null)},[]),p.useEffect(()=>{ln()},[ln,Mn,qs,Rn,Hn.length,I]);const[Es,Te]=p.useState(null);p.useEffect(()=>{if(!Es)return;const we=setTimeout(()=>Te(null),1600);return()=>clearTimeout(we)},[Es]);const Ye=p.useCallback((we,xe)=>{var oe,ue;U.current=!0,ye(!1),te.current+=1;const wt=te.current;G.current=!0,Rn?Gn.scrollToIndex(we,{align:"center"}):(ue=(oe=Ue.current)==null?void 0:oe.querySelector(`[data-index="${we}"]`))==null||ue.scrollIntoView({block:"center"}),setTimeout(()=>{te.current===wt&&(G.current=!1,ln(),yt())},150),Te(null),requestAnimationFrame(()=>Te(xe))},[Rn,Gn,ye,ln,yt]),_t=p.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});_t.current={visibleItems:Kt,displayItems:R,headerOffset:Fe,performScrollToRow:Ye};const Bt=p.useRef(null),bn=p.useCallback((we,xe)=>{const{visibleItems:wt,displayItems:oe,headerOffset:ue,performScrollToRow:be}=_t.current,lt=Uy(wt,we,xe);if(lt>=0){const bt=wt[lt];return(bt==null?void 0:bt.type)==="turn_content"&&bt.collapsed?(Bt.current={messageId:we,callId:xe},M(rn=>{if(rn.get(bt.turnId)===!0)return rn;const Kn=new Map(rn);return Kn.set(bt.turnId,!0),Kn}),!0):(Bt.current=null,be(lt+ue,{messageId:we,callId:xe}),!0)}const Re=Uy(oe,we,xe);if(Re<0)return!1;const Nt=ZF(oe,Re);return Nt?(Bt.current={messageId:we,callId:xe},M(bt=>{if(bt.get(Nt)===!0)return bt;const rn=new Map(bt);return rn.set(Nt,!0),rn}),!0):!1},[]);p.useImperativeHandle(C,()=>({scrollToMessage:bn,scrollToBottom:Pn}),[bn,Pn]),p.useEffect(()=>{const we=Bt.current;if(!we)return;const xe=Uy(Kt,we.messageId,we.callId);xe<0||(Bt.current=null,Ye(xe+Fe,we))},[Kt,Fe,Ye]);const ws=p.useCallback(()=>{const we=Bn();if(!we)return;if(G.current){J.current=we.scrollTop;return}ln();const xe=J.current,wt=we.scrollTop;J.current=wt;const oe=we.scrollHeight-wt-we.clientHeight;if(yt(),wt<xe-1){const ue=oe<U4,be=Date.now()<=W.current;ue?(U.current=!1,ye(!0)):be?(U.current=!0,ye(!1)):U.current||ye(!1);return}oe<U4&&(U.current=!1,ye(!0))},[Bn,yt,ln,ye]);p.useEffect(()=>{const we=Bn();if(we)return we.addEventListener("scroll",ws,{passive:!0}),()=>we.removeEventListener("scroll",ws)},[Bn,ws]),p.useEffect(()=>{const we=Bn();if(!we)return;const xe=oe=>{const ue=we.getBoundingClientRect(),be=20;(oe.clientX>=ue.right-be||oe.clientY>=ue.bottom-be)&&Ut()},wt=oe=>{(oe.key==="ArrowUp"||oe.key==="ArrowDown"||oe.key==="PageUp"||oe.key==="PageDown"||oe.key==="Home"||oe.key==="End"||oe.key===" ")&&Ut()};return we.addEventListener("wheel",Ut,{passive:!0}),we.addEventListener("touchstart",Ut,{passive:!0}),we.addEventListener("pointerdown",xe,{passive:!0}),we.addEventListener("keydown",wt,{passive:!0}),()=>{we.removeEventListener("wheel",Ut),we.removeEventListener("touchstart",Ut),we.removeEventListener("pointerdown",xe),we.removeEventListener("keydown",wt)}},[Bn,Ut]),p.useEffect(()=>{const we=Bn();if(!we||typeof ResizeObserver>"u")return;const xe=new ResizeObserver(yt);xe.observe(we);for(const oe of Array.from(we.children))xe.observe(oe);const wt=new MutationObserver(oe=>{for(const ue of oe){for(const be of Array.from(ue.addedNodes))be instanceof HTMLElement&&xe.observe(be);for(const be of Array.from(ue.removedNodes))be instanceof HTMLElement&&xe.unobserve(be)}yt()});return wt.observe(we,{childList:!0}),yt(),()=>{xe.disconnect(),wt.disconnect()}},[Bn,yt]),p.useEffect(()=>{t.length===0&&(U.current=!1,ye(!0),Bt.current=null,M(we=>we.size?new Map:we))},[t.length,ye]),p.useEffect(()=>{const we=Ue.current;if(!we)return;const xe=new ResizeObserver(()=>{ln(),!qt.current&&(U.current||(ye(!0),requestAnimationFrame(()=>{!qt.current&&!U.current&&fn()})))});return xe.observe(we),()=>xe.disconnect()},[fn,ln,ye]),p.useLayoutEffect(()=>{const we=y3e(t);if(i||r||Ce.current){Ne.current=we,fe.current=!0,Ie.current=!1,Ce.current=r;return}if(Ce.current=r,!fe.current){Ne.current=we,fe.current=!0,Ie.current=!1;return}const xe=b3e(t);we&&(xe==null?void 0:xe.role)==="user"&&we!==Ne.current?(U.current=!1,ye(!0),Bt.current=null,Ie.current=!0):Ie.current=!1,Ne.current=we},[t,i,r,ye]),p.useLayoutEffect(()=>{on.current&&!i&&(U.current=!1,ye(!0),fn("auto")),on.current=i},[i,fn,ye]),p.useLayoutEffect(()=>{if(r){ve.current=!0;return}if(!ve.current||i||t.length===0)return;ve.current=!1,U.current=!1,ye(!0),Bt.current=null,ut.current!==void 0&&window.cancelAnimationFrame(ut.current),ae.current!==void 0&&window.cancelAnimationFrame(ae.current);const we=()=>{qt.current||U.current||(ye(!0),fn("auto"))};ut.current=window.requestAnimationFrame(()=>{ut.current=void 0,we(),ae.current=window.requestAnimationFrame(()=>{ae.current=void 0,we()})})},[i,r,t.length,fn,ye]),p.useLayoutEffect(()=>{const we=Ct.current!==g;Ct.current=g,we&&(i||U.current||(ye(!0),requestAnimationFrame(()=>{!qt.current&&!U.current&&fn("auto")})))},[g,i,fn,ye]);const Zs=p.useMemo(()=>D3e(Kt),[Kt]);p.useLayoutEffect(()=>{if(!i){if(!Zs){Ke.current=null;return}Zs!==Ke.current&&(Ke.current=Zs,(re.current||!U.current)&&requestAnimationFrame(()=>{U.current||(ye(!0),fn())}))}},[i,Zs,fn,ye]),p.useEffect(()=>{m&&qn&&!gt.current&&(U.current=!1,ye(!0),requestAnimationFrame(()=>{U.current||fn()})),gt.current=qn},[m,qn,fn,ye]);const Ir=p.useCallback(we=>{const xe=(ue,be)=>{if(ue.type==="parallel_agents")return u.jsx(Mk,{timestamp:ue.timestamp,children:u.jsx("div",{className:SS(ue,Es)?Ju.flash:void 0,children:u.jsx(Cke,{agents:ue.agents,pendingApproval:n})})});if(ue.type==="turn_collapse")return u.jsx(J3e,{turnCollapse:ue.turnCollapse,onToggleCollapse:tn});if(ue.type==="turn_content")return u.jsx(Z3e,{collapsed:ue.collapsed,children:ue.items.map(Nt=>u.jsx("div",{className:LN(Nt),children:xe(Nt,!1)},NN(Nt)))});const lt=ue.message.role==="assistant"?ne.get(ue.message.id):void 0;let Re;return ue.message.role==="assistant"&&lt&&(Re={turnId:lt,message:{id:ue.message.id,content:ue.message.content,isStreaming:ue.message.isStreaming,timestamp:ue.message.timestamp}}),u.jsx(J_e,{message:ue.message,pendingApproval:n,onShowContextDetail:s,workspaceCwd:c,isLatest:be,showRetryHint:b,onRetryClick:w,onBranchSession:v,showAssistantActions:ue.message.role==="assistant"&&ne.has(ue.message.id),showAssistantBranch:ue.message.role==="assistant"&&ue.message.id===Y,isLocateFlashing:SS(ue,Es),assistantTurnFooterInfo:Re})};if(qe&&we===q4)return l;if(qn&&we===Ht)return d;const wt=we-Fe,oe=Kt[wt];return oe?xe(oe,wt===Kt.length-1):null},[qe,l,qn,d,Ht,n,s,Fe,Kt,Es,ne,Y,c,b,w,v,tn]),Ur=p.useCallback(we=>we?LN(we):void 0,[]);return p.useLayoutEffect(()=>{if(i)return;const we=Ie.current;G.current&&!we||St.current&&!we||(re.current||we||!U.current)&&(U.current||ye(!0),fn(we?"smooth":"auto"),Ie.current=!1)},[qs,t,Mn,i,fn,ye]),p.useLayoutEffect(()=>{yt()},[t,yt,Mn,qs]),u.jsxs("div",{ref:Ue,className:In.list,"data-web-shell-message-list":!0,onClickCapture:Jt,children:[Me&&u.jsx(rSe,{label:A("editor.sessionLoading")}),u.jsx(nSe,{entries:N,currentTurnId:Q,currentRange:F,hidden:!I||!ct,onSelect:bn}),Rn?u.jsx("div",{className:In.virtualSizer,style:{height:qs},children:Hn.map(we=>u.jsx("div",{"data-index":we.index,ref:Gn.measureElement,className:q8(In.virtualRow,Ur(Kt[we.index-Fe])),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${we.start}px)`},children:Ir(we.index)},we.key))}):Array.from({length:Mn},(we,xe)=>{const wt=Nn(xe),oe=Kt[xe-Fe];return u.jsx("div",{"data-index":xe,className:Ur(oe),"data-web-shell-message-row":!0,children:Ir(xe)},wt)})]})}));/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function iSe(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 oSe(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||!iSe(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 aSe="_editorShell_2kl66_1",lSe="_container_2kl66_7",cSe="_content_2kl66_22",uSe="_dacAura_2kl66_35",dSe="_dacHalo_2kl66_36",hSe="_slashPortalLayer_2kl66_177",fSe="_atPortalLayer_2kl66_181",mSe="_slashPanel_2kl66_185",pSe="_slashPanelBody_2kl66_220",gSe="_slashList_2kl66_226",ySe="_slashEntry_2kl66_255",bSe="_slashSection_2kl66_261",wSe="_slashSectionHeader_2kl66_267",vSe="_slashSectionCount_2kl66_280",xSe="_slashItem_2kl66_288",_Se="_slashItemActive_2kl66_309",kSe="_slashCommand_2kl66_313",SSe="_slashDetail_2kl66_318",TSe="_slashDetailCommand_2kl66_337",CSe="_slashDetailText_2kl66_347",ASe="_slashDescription_2kl66_367",ESe="_atPanel_2kl66_378",MSe="_atPanelHeaderWrap_2kl66_402",NSe="_atPanelHeader_2kl66_402",ISe="_atBackButton_2kl66_417",jSe="_atPanelTitle_2kl66_439",RSe="_atTabsWrap_2kl66_448",LSe="_atTabs_2kl66_448",DSe="_atTab_2kl66_448",OSe="_atTabScrollButton_2kl66_472",BSe="_atTabActive_2kl66_504",PSe="_atSearchInput_2kl66_515",$Se="_atList_2kl66_534",zSe="_atItem_2kl66_562",FSe="_atItemActive_2kl66_584",qSe="_atItemSingleLine_2kl66_588",HSe="_atItemMain_2kl66_594",USe="_atItemLeading_2kl66_605",VSe="_atItemIcon_2kl66_615",WSe="_atItemImageIcon_2kl66_626",GSe="_atItemIconSpin_2kl66_634",KSe="_atItemLabel_2kl66_638",YSe="_atItemSubtitle_2kl66_639",QSe="_atItemDescription_2kl66_666",XSe="_atItemTrailing_2kl66_677",JSe="_atEmpty_2kl66_684",ZSe="_tags_2kl66_708",e6e="_tag_2kl66_708",t6e="_tagTooltip_2kl66_730",n6e="_tagLabel_2kl66_755",s6e="_tagValue_2kl66_756",r6e="_tagIcon_2kl66_760",i6e="_tagRemove_2kl66_795",o6e="_editorArea_2kl66_815",a6e="_shellPrefix_2kl66_830",l6e="_toolbar_2kl66_867",c6e="_toolbarLeading_2kl66_876",u6e="_toolbarStart_2kl66_877",d6e="_toolbarEnd_2kl66_878",h6e="_toolbarLeft_2kl66_879",f6e="_toolbarRight_2kl66_880",m6e="_toolbarRightCustom_2kl66_908",p6e="_toolBtn_2kl66_915",g6e="_toolBtnText_2kl66_921",y6e="_dropdownWrapper_2kl66_926",b6e="_dropdown_2kl66_926",w6e="_dropdownRich_2kl66_948",v6e="_dropdownCheck_2kl66_954",x6e="_dropdownItem_2kl66_960",_6e="_dropdownItemActive_2kl66_998",k6e="_dropdownItemIcon_2kl66_1003",S6e="_dropdownItemCheck_2kl66_1004",T6e="_dropdownItemContent_2kl66_1021",C6e="_dropdownItemLabel_2kl66_1028",A6e="_dropdownItemDesc_2kl66_1038",E6e="_toolBtnIcon_2kl66_1096",M6e="_widthModeBtn_2kl66_1112",N6e="_quickActionsBtn_2kl66_1121",I6e="_toolBtnModeIcon_2kl66_1130",j6e="_toolBtnModelIcon_2kl66_1131",R6e="_toolBtnArrow_2kl66_1158",L6e="_chevronDown_2kl66_1171",D6e="_quickActionsPanel_2kl66_1180",O6e="_quickActionsHeader_2kl66_1193",B6e="_quickActionsLayout_2kl66_1200",P6e="_quickActionsGrid_2kl66_1207",$6e="_quickAction_2kl66_1121",z6e="_quickActionLabel_2kl66_1238",F6e="_quickKeysGrid_2kl66_1253",q6e="_quickKey_2kl66_1253",H6e="_quickKeyLabel_2kl66_1282",U6e="_sendBtn_2kl66_1295",V6e="_sendBtnRunning_2kl66_1333",W6e="_sendIcon_2kl66_1346",G6e="_stopIcon_2kl66_1352",K6e="_loadingIcon_2kl66_1359",Y6e="_sendBtnArmed_2kl66_1371",Q6e="_escLabel_2kl66_1439",X6e="_srOnly_2kl66_1447",J6e="_images_2kl66_1469",Z6e="_imageThumb_2kl66_1476",e5e="_imageRemove_2kl66_1491",t5e="_searchPanel_2kl66_1512",n5e="_searchBar_2kl66_1529",s5e="_searchLabel_2kl66_1537",r5e="_searchInput_2kl66_1542",i5e="_searchResults_2kl66_1556",o5e="_searchResult_2kl66_1556",a5e="_searchResultActive_2kl66_1589",l5e="_searchResultMarker_2kl66_1594",c5e="_searchResultText_2kl66_1599",u5e="_searchEmpty_2kl66_1606",Ae={editorShell:aSe,container:lSe,content:cSe,dacAura:uSe,dacHalo:dSe,slashPortalLayer:hSe,atPortalLayer:fSe,slashPanel:mSe,slashPanelBody:pSe,slashList:gSe,slashEntry:ySe,slashSection:bSe,slashSectionHeader:wSe,slashSectionCount:vSe,slashItem:xSe,slashItemActive:_Se,slashCommand:kSe,slashDetail:SSe,slashDetailCommand:TSe,slashDetailText:CSe,slashDescription:ASe,atPanel:ESe,atPanelHeaderWrap:MSe,atPanelHeader:NSe,atBackButton:ISe,atPanelTitle:jSe,atTabsWrap:RSe,atTabs:LSe,atTab:DSe,atTabScrollButton:OSe,atTabActive:BSe,atSearchInput:PSe,atList:$Se,atItem:zSe,atItemActive:FSe,atItemSingleLine:qSe,atItemMain:HSe,atItemLeading:USe,atItemIcon:VSe,atItemImageIcon:WSe,atItemIconSpin:GSe,atItemLabel:KSe,atItemSubtitle:YSe,atItemDescription:QSe,atItemTrailing:XSe,atEmpty:JSe,tags:ZSe,tag:e6e,tagTooltip:t6e,tagLabel:n6e,tagValue:s6e,tagIcon:r6e,tagRemove:i6e,editorArea:o6e,shellPrefix:a6e,toolbar:l6e,toolbarLeading:c6e,toolbarStart:u6e,toolbarEnd:d6e,toolbarLeft:h6e,toolbarRight:f6e,toolbarRightCustom:m6e,toolBtn:p6e,toolBtnText:g6e,dropdownWrapper:y6e,dropdown:b6e,dropdownRich:w6e,dropdownCheck:v6e,dropdownItem:x6e,dropdownItemActive:_6e,dropdownItemIcon:k6e,dropdownItemCheck:S6e,dropdownItemContent:T6e,dropdownItemLabel:C6e,dropdownItemDesc:A6e,toolBtnIcon:E6e,widthModeBtn:M6e,quickActionsBtn:N6e,toolBtnModeIcon:I6e,toolBtnModelIcon:j6e,toolBtnArrow:R6e,chevronDown:L6e,quickActionsPanel:D6e,quickActionsHeader:O6e,quickActionsLayout:B6e,quickActionsGrid:P6e,quickAction:$6e,quickActionLabel:z6e,quickKeysGrid:F6e,quickKey:q6e,quickKeyLabel:H6e,sendBtn:U6e,sendBtnRunning:V6e,sendIcon:W6e,stopIcon:G6e,loadingIcon:K6e,sendBtnArmed:Y6e,escLabel:Q6e,srOnly:X6e,images:J6e,imageThumb:Z6e,imageRemove:e5e,searchPanel:t5e,searchBar:n5e,searchLabel:s5e,searchInput:r5e,searchResults:i5e,searchResult:o5e,searchResultActive:a5e,searchResultMarker:l5e,searchResultText:c5e,searchEmpty:u5e},d5e=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function h5e({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r,onBack:i,onSearch:o,onSelectTab:a}){const{t:l}=it(),c=p.useRef([]),d=p.useRef(null),h=p.useRef(null),[f,m]=p.useState(null),[g,y]=p.useState({});p.useEffect(()=>{var _;(_=c.current[e.selectedIndex])==null||_.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),p.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===d.current)return;const _=()=>{var k;return(k=d.current)==null?void 0:k.focus()},R=window.requestAnimationFrame(_),I=window.setTimeout(_,0);return()=>{window.cancelAnimationFrame(R),window.clearTimeout(I)}},[e.inputMode,e.level,e.selectedProviderId]),p.useLayoutEffect(()=>{const _=t.current;if(!_)return;const R=getComputedStyle(_);y(Object.fromEntries(d5e.map(I=>[I,R.getPropertyValue(I)])))},[t]),p.useLayoutEffect(()=>{const _=t.current;if(!_)return;let R=null;const I=()=>{var Y;const N=_.getBoundingClientRect(),L=((Y=n.current)==null?void 0:Y.offsetWidth)??360,$=getComputedStyle(_),F=Number.parseFloat($.getPropertyValue("--web-shell-popover-safe-top"))||48,B=Math.max(96,Math.min(300,N.top-F-8)),Q={left:Math.max(12,Math.min(N.left+16,window.innerWidth-L-12)),bottom:window.innerHeight-N.top+8,width:N.width,maxHeight:B};m(ne=>ne&&ne.left===Q.left&&ne.bottom===Q.bottom&&ne.width===Q.width&&ne.maxHeight===Q.maxHeight?ne:Q)},k=()=>{R===null&&(R=window.requestAnimationFrame(()=>{R=null,I()}))};I();const j=new ResizeObserver(k);return j.observe(_),window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{R!==null&&window.cancelAnimationFrame(R),j.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[t,n]);const b=e.level==="categories"?e.providers.map(_=>({id:_.id,label:_.label,labelTitle:_.textValue,description:_.description,trailing:"›",provider:_})):e.items.map(_=>({id:_.id,label:_.label,labelTitle:_.label,subtitle:_.subtitle,description:e.selectedProviderId===li?void 0:_.description??_.detail,icon:_.icon,iconMode:_.iconMode,iconColor:_.iconColor,iconSpin:_.iconSpin,iconTooltip:_.iconTooltip,trailing:_.kind==="directory"||_.kind==="mcp-server"?"›":"",item:_}));if(p.useEffect(()=>{c.current.length=b.length},[b.length]),!f)return null;const w=e.providers.find(_=>_.id===e.selectedProviderId),v=e.itemMode==="mcpResources"&&e.mcpServerName?js(e.mcpServerName)??"[invalid]":(w==null?void 0:w.label)??"",x=e.itemMode==="mcpResources"&&e.mcpServerName?js(e.mcpServerName)??"[invalid]":(w==null?void 0:w.textValue)??"",C=e.level==="items"?(w==null?void 0:w.textValue)??l("at.menu"):l("at.menu"),A="at-mention-listbox",T=e.selectedIndex>=0&&e.selectedIndex<b.length?`at-mention-option-${e.selectedIndex}`:void 0;return dm.createPortal(u.jsx("div",{className:Ae.atPortalLayer,style:g,children:u.jsxs("div",{ref:n,className:Ae.atPanel,"data-at-mention-panel":"true",style:{...g,left:f.left,bottom:f.bottom,"--at-anchor-width":`${f.width}px`,"--at-panel-max-height":`${f.maxHeight}px`},role:"region","aria-label":C,onMouseDown:_=>{_.target instanceof HTMLInputElement||_.preventDefault()},children:[e.level==="items"&&u.jsxs("div",{className:Ae.atPanelHeaderWrap,children:[u.jsxs("div",{className:Ae.atPanelHeader,children:[u.jsx("button",{type:"button",className:Ae.atBackButton,"aria-label":l("common.back"),onMouseDown:_=>{_.preventDefault(),_.stopPropagation()},onClick:_=>{_.preventDefault(),_.stopPropagation(),i()},children:"‹"}),u.jsx("span",{className:Ae.atPanelTitle,title:x,children:v})]}),u.jsx("input",{ref:d,className:Ae.atSearchInput,value:e.query,placeholder:l("common.search"),"aria-label":l("common.search"),"aria-controls":A,"aria-activedescendant":T,onMouseDown:_=>_.stopPropagation(),onClick:_=>_.stopPropagation(),onChange:_=>o(_.currentTarget.value),onKeyDown:_=>{if(!(_.nativeEvent.isComposing||_.nativeEvent.keyCode===229)){if(_.key==="Escape")_.preventDefault(),_.stopPropagation(),i();else if(_.key==="Enter")_.preventDefault(),_.stopPropagation(),r();else if(_.key==="Tab"&&!_.shiftKey&&!_.altKey&&!_.ctrlKey&&!_.metaKey)_.preventDefault(),_.stopPropagation(),r();else if(_.key==="ArrowUp"){if(_.preventDefault(),_.stopPropagation(),b.length===0)return;s(Math.max(0,e.selectedIndex-1))}else if(_.key==="ArrowDown"){if(_.preventDefault(),_.stopPropagation(),b.length===0)return;s(Math.min(b.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&u.jsxs("div",{className:Ae.atTabsWrap,children:[u.jsx("button",{type:"button",className:Ae.atTabScrollButton,"aria-label":"Previous tab",onClick:_=>{_.preventDefault(),_.stopPropagation(),ON(h.current,"previous")},children:"‹"}),u.jsx("div",{ref:h,className:Ae.atTabs,role:"tablist",children:e.tabs.map(_=>{const R=_.id===e.selectedTabId,I=_.textValue??(typeof _.label=="string"?_.label:_.id);return u.jsx("button",{type:"button",role:"tab","aria-selected":R,disabled:_.disabled,className:`${Ae.atTab} ${R?Ae.atTabActive:""}`,title:I,onClick:k=>{k.preventDefault(),k.stopPropagation(),a(_.id)},children:_.label},_.id)})}),u.jsx("button",{type:"button",className:Ae.atTabScrollButton,"aria-label":"Next tab",onClick:_=>{_.preventDefault(),_.stopPropagation(),ON(h.current,"next")},children:"›"})]})]}),u.jsx("div",{id:A,className:Ae.atList,role:b.length>0?"listbox":void 0,"aria-label":b.length>0?C:void 0,children:e.loading&&b.length===0?u.jsx("div",{className:Ae.atEmpty,role:"status","aria-live":"polite",children:l("common.loading")}):b.length===0?u.jsx("div",{className:Ae.atEmpty,role:"status","aria-live":"polite",children:l("common.noResults")}):b.map((_,R)=>{const I=R===e.selectedIndex,k="item"in _?w==null?void 0:w.provider:_.provider.provider;let j;if("item"in _&&(k!=null&&k.renderItem))try{j=k.renderItem({item:_.item,provider:k,selected:I})}catch(L){console.warn("[WebShell] at mention item render failed",L)}const N="icon"in _&&_.icon&&Am(_.icon)?_.icon:void 0;return u.jsxs("button",{ref:L=>{c.current[R]=L},type:"button",id:`at-mention-option-${R}`,role:"option","aria-selected":I,className:`${Ae.atItem} ${I?Ae.atItemActive:""} ${_.description?"":Ae.atItemSingleLine}`,style:{"--at-item-main-template":f5e(m5e(_.label,_.labelTitle),"subtitle"in _?_.subtitle:void 0)},onMouseEnter:()=>s(R),onMouseDown:L=>{L.preventDefault(),L.stopPropagation()},onClick:L=>{L.preventDefault(),L.stopPropagation(),r(R)},children:[j??u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:Ae.atItemMain,children:[u.jsxs("span",{className:Ae.atItemLeading,children:["icon"in _&&N&&(_.iconMode==="image"?u.jsx("img",{className:Ae.atItemImageIcon,src:N,title:_.iconTooltip,alt:"","aria-hidden":"true"}):u.jsx("span",{className:`${Ae.atItemIcon} ${_.iconSpin?Ae.atItemIconSpin:""}`,style:{..._u("--at-item-icon-url",N),color:_.iconColor},title:_.iconTooltip,"aria-hidden":"true"})),u.jsx("span",{className:Ae.atItemLabel,title:_.labelTitle,children:_.label})]}),"subtitle"in _&&_.subtitle&&u.jsx("span",{className:Ae.atItemSubtitle,title:_.subtitle,children:_.subtitle})]}),_.description&&u.jsx("span",{className:Ae.atItemDescription,title:_.description,children:_.description})]}),_.trailing&&u.jsx("span",{className:Ae.atItemTrailing,"aria-hidden":"true",children:_.trailing})]},_.id)})})]})}),document.body)}function ON(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function f5e(e,t){if(!t)return"minmax(0, 1fr)";const n=BN(e);return BN(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function m5e(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function BN(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const p5e="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",g5e="/assets/default-aEtf0G7-.svg",sq="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",y5e="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",b5e="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",w5e="_icon_i7y0u_1",v5e={icon:w5e},x5e={auto:p5e,"auto-edit":sq,default:g5e,plan:y5e,yolo:b5e};function TS({mode:e}){const t=x5e[e];return t?u.jsx("span",{className:v5e.icon,style:_u("--mode-icon-url",t),"aria-hidden":"true"}):u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.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 _5e(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,l=a&&i>0;return s=o??s,{showHeader:a,showDivider:l,count:a&&o?n.get(o)??0:0}})}function Jp(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const W4=16e3,k5e=4096,PN=6e4;function S5e(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 T5e="qwen-bearer.",C5e="qwen-ws";function A5e(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`${T5e}${s}`}function E5e(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 M5e(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 N5e(e){const{baseUrl:t,token:n,onFinal:s,onError:r}=e,[i,o]=p.useState("idle"),[a,l]=p.useState(""),[c,d]=p.useState(0),[h,f]=p.useState(void 0),m=p.useRef({}),g=p.useRef(!0),y=p.useRef(0),b=p.useRef("idle"),w=p.useRef(s);w.current=s;const v=p.useRef(r);v.current=r;const x=p.useCallback(N=>{b.current=N,o(N)},[]),C=p.useCallback(()=>{const N=m.current;N.transcribeTimeout&&(clearTimeout(N.transcribeTimeout),N.transcribeTimeout=void 0)},[]),A=p.useCallback(()=>{var L;const N=m.current;N.processor&&(N.processor.onaudioprocess=null);for(const $ of[N.processor,N.source,N.sink])try{$==null||$.disconnect()}catch{}(L=N.stream)==null||L.getTracks().forEach($=>$.stop()),N.context&&N.context.state!=="closed"&&N.context.close().catch(()=>{}),N.processor=void 0,N.sink=void 0,N.source=void 0,N.stream=void 0,N.context=void 0},[]),T=p.useCallback(()=>{y.current++,A();const N=m.current;if(C(),N.ws){try{N.ws.onmessage=null,N.ws.onerror=null,N.ws.onclose=null,N.ws.close()}catch{}N.ws=void 0}},[A,C]),_=p.useCallback((N,L)=>{var $;!g.current||L!==void 0&&y.current!==L||(T(),x("error"),l(""),d(0),f(N),($=v.current)==null||$.call(v,N))},[T,x]),R=p.useCallback((N,L)=>{L!==void 0&&y.current!==L||(T(),g.current&&(x("idle"),l(""),d(0),w.current(N)))},[T,x]),I=p.useCallback(()=>{if(b.current!=="idle"&&b.current!=="error")return;f(void 0),l(""),x("connecting");const N=++y.current,L=()=>!g.current||y.current!==N;(async()=>{var $;try{if(!(($=navigator.mediaDevices)!=null&&$.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 F;try{F=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(le){throw new Error(E5e(le))}if(L()){F.getTracks().forEach(le=>le.stop());return}m.current.stream=F;const B=new AudioContext({sampleRate:W4});if(B.sampleRate!==W4)throw F.getTracks().forEach(le=>le.stop()),B.close().catch(()=>{}),new Error(`Browser audio rate ${B.sampleRate} Hz is not the required ${W4} Hz.`);if(m.current.context=B,B.state==="suspended"&&await B.resume(),L()){F.getTracks().forEach(le=>le.stop()),B.close().catch(()=>{});return}const Q=B.createMediaStreamSource(F),Y=B.createScriptProcessor(k5e,1,1),ne=B.createGain();ne.gain.value=0,m.current.source=Q,m.current.processor=Y,m.current.sink=ne;const P=new WebSocket(S5e(t),n?[C5e,A5e(n)]:void 0);P.binaryType="arraybuffer",m.current.ws=P,Y.onaudioprocess=le=>{const{pcm:z,level:M}=M5e(le.inputBuffer.getChannelData(0));g.current&&d(M),P.readyState===WebSocket.OPEN&&P.send(z)},P.onopen=()=>{if(L()){Y.onaudioprocess=null;for(const z of[Y,Q,ne])try{z.disconnect()}catch{}F.getTracks().forEach(z=>z.stop()),B.state!=="closed"&&B.close().catch(()=>{});const le=m.current;le.ws===P&&(le.ws=void 0),le.processor===Y&&(le.processor=void 0),le.source===Q&&(le.source=void 0),le.sink===ne&&(le.sink=void 0),le.stream===F&&(le.stream=void 0),le.context===B&&(le.context=void 0);try{P.close()}catch{}return}P.send(JSON.stringify({type:"start"})),Q.connect(Y),Y.connect(ne),ne.connect(B.destination),C(),m.current.transcribeTimeout=setTimeout(()=>{b.current==="recording"&&_("No response from server. Check that the voice model is running.",N)},PN),g.current&&x("recording")},P.onmessage=le=>{(b.current==="connecting"||b.current==="recording")&&C();let z;try{z=JSON.parse(String(le.data))}catch{return}z.type==="interim"?g.current&&l(z.text??""):z.type==="final"?R(z.text??"",N):z.type==="error"&&_(z.message??z.text??"Voice transcription failed.",N)},P.onerror=()=>{},P.onclose=le=>{if(g.current&&(b.current==="recording"||b.current==="connecting"||b.current==="transcribing")){const z=le.code||1006,M=le.reason||"none";_(`Voice connection closed (code=${z}, reason=${M}).`,N)}}}catch(F){_(F instanceof Error?F.message:String(F),N)}})()},[t,n,_,R,x,C]),k=p.useCallback(()=>{const N=m.current.ws;if(!N||N.readyState!==WebSocket.OPEN){T(),x("idle");return}A(),d(0),x("transcribing");const L=y.current;try{N.send(JSON.stringify({type:"stop"})),C(),m.current.transcribeTimeout=setTimeout(()=>{b.current==="transcribing"&&_("Transcription timed out.",L)},PN)}catch{_("Failed to finalize voice transcription.",L)}},[T,A,_,x,C]),j=p.useCallback(()=>{const N=m.current.ws;if(N&&N.readyState===WebSocket.OPEN)try{N.send(JSON.stringify({type:"abort"}))}catch{}T(),x("idle"),l(""),d(0)},[T,x]);return p.useEffect(()=>(g.current=!0,()=>{g.current=!1,T()}),[T]),{status:i,interimText:a,audioLevel:c,errorMessage:h,start:I,stop:k,abort:j}}const I5e="_root_9hwm9_7",j5e="_iconBtn_9hwm9_14",R5e="_error_9hwm9_47",L5e="_connecting_9hwm9_51",D5e="_pill_9hwm9_56",O5e="_transcribing_9hwm9_75",B5e="_recDot_9hwm9_79",P5e="_wave_9hwm9_88",$5e="_bar_9hwm9_95",z5e="_time_9hwm9_103",F5e="_stop_9hwm9_111",q5e="_spinner_9hwm9_118",H5e="_interim_9hwm9_128",Ti={root:I5e,iconBtn:j5e,error:R5e,connecting:L5e,pill:D5e,transcribing:O5e,recDot:B5e,wave:P5e,bar:$5e,time:z5e,stop:F5e,spinner:q5e,interim:H5e},U5e="voice_transcribe",$N=16,V5e=()=>u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[u.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),u.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"})]}),W5e=()=>u.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:u.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function G5e(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${n}:${s}`}function K5e({onInsert:e,disabled:t}){var j;const n=Yw(),{t:s}=it(),r=((j=n.capabilities)==null?void 0:j.features)??[],[i,o]=p.useState(void 0),{status:a,interimText:l,audioLevel:c,errorMessage:d,start:h,stop:f,abort:m}=N5e({baseUrl:n.baseUrl,token:n.token,onFinal:N=>{const L=N.trim();L?(o(void 0),e(L)):o(s("voice.noSpeech"))}}),g=a==="recording",[y,b]=p.useState(()=>new Array($N).fill(0));p.useEffect(()=>{if(!g){b(new Array($N).fill(0));return}b(N=>[...N.slice(1),Math.min(1,c*8)])},[c,g]);const[w,v]=p.useState(0);if(p.useEffect(()=>{if(!g){v(0);return}const N=performance.now(),L=setInterval(()=>v(performance.now()-N),200);return()=>clearInterval(L)},[g]),!r.includes(U5e))return null;const x=a==="connecting",C=a==="transcribing",A=a==="error",T=!!i&&!A,_=g||x,R=g?s("voice.stopDictation"):C?s("voice.transcribing"):x?s("voice.starting"):A?s("voice.errorRetry",{message:d??""}):s(T?"voice.noSpeechRetry":"voice.startDictation");let I;if(g)I=u.jsxs("button",{type:"button",className:Ti.pill,onClick:()=>f(),"aria-label":R,title:R,children:[u.jsx("span",{className:Ti.recDot,"aria-hidden":"true"}),u.jsx("span",{className:Ti.wave,"aria-hidden":"true",children:y.map((N,L)=>u.jsx("span",{className:Ti.bar,style:{height:`${2+Math.round(N*14)}px`}},L))}),u.jsx("span",{className:Ti.time,children:G5e(w)}),u.jsx("span",{className:Ti.stop,"aria-hidden":"true",children:u.jsx(W5e,{})})]});else if(C)I=u.jsxs("span",{className:`${Ti.pill} ${Ti.transcribing}`,role:"status","aria-label":R,children:[u.jsx("span",{className:Ti.spinner,"aria-hidden":"true"}),u.jsx("span",{className:Ti.time,children:"…"})]});else{const N=[Ti.iconBtn,A?Ti.error:"",x?Ti.connecting:""].filter(Boolean).join(" ");I=u.jsx("button",{type:"button",className:N,onClick:()=>{if(x)m();else{if(t)return;o(void 0),h()}},disabled:!!t&&!_,"aria-label":R,title:d??i??R,children:u.jsx(V5e,{})})}const k=g&&l||A||T;return u.jsxs("span",{className:Ti.root,children:[I,k&&u.jsx("span",{role:"status","aria-live":"polite",className:`${Ti.interim}${A?` ${Ti.error}`:""}`,children:A?d||s("voice.error"):T?i:l})]})}const Y5e=["approvalMode","model","widthMode","voice"],Q5e=new Set(Y5e),X5e={"&":{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 zN(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}const J5e=["--chat-editor-accent-color","--accent","--background","--chat-editor-bg-tertiary","--chat-editor-border-color","--foreground","--font-mono","--font-sans","--muted-foreground","--chat-editor-text-primary","--chat-editor-text-secondary"];function Z5e(){return u.jsx("svg",{className:Ae.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:u.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function e8e(){return u.jsx("span",{className:Ae.stopIcon,"aria-hidden":"true"})}function t8e(){return u.jsx("span",{className:Ae.loadingIcon,"aria-hidden":"true"})}function n8e(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>u.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function s8e(e,t){let n,s,r,i,o=0,a=0;const l=(y,b)=>{e.style.setProperty("--dac-glow-on",y.toFixed(4)),e.style.setProperty("--dac-glow-pulse",b.toFixed(4))},c=y=>{n!==void 0&&window.cancelAnimationFrame(n);const b=o,w=y-b;if(Math.abs(w)<.001){o=y,l(y,a);return}const v=performance.now(),x=C=>{const A=Math.min((C-v)/220,1);o=b+w*(1-(1-A)**2),l(o,a),n=A<1?window.requestAnimationFrame(x):void 0};n=window.requestAnimationFrame(x)},d=()=>{s!==void 0&&window.cancelAnimationFrame(s);const y=a,b=performance.now(),w=v=>{const x=Math.min((v-b)/300,1);a=y*(1-x),l(o,a),s=x<1?window.requestAnimationFrame(w):void 0};s=window.requestAnimationFrame(w)},h=y=>{y?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},f=()=>c(1),m=()=>{c(0),h(!1),i!==void 0&&window.clearTimeout(i)},g=()=>{s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),a=1,l(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",f),t.addEventListener("blur",m),t.addEventListener("keydown",g),document.activeElement===t&&c(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",f),t.removeEventListener("blur",m),t.removeEventListener("keydown",g),l(0,0),h(!1)}}function r8e({mode:e}){return e==="wide"?u.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[u.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)"}),u.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)"})]}):u.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:u.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 FN(){return u.jsx("span",{className:Ae.chevronDown,"aria-hidden":"true"})}function i8e(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.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"}),u.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 o8e(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 a8e=[{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 l8e(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function rq(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 c8e(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]??rq(e,t)}function qN({open:e,items:t,activeId:n,onClose:s,onSelect:r,anchorRef:i,showCheck:o=!1,maxHeight:a}){const l=p.useRef(null);if(p.useEffect(()=>{if(!e)return;const h=f=>{if(f instanceof MouseEvent&&f.button!==0||f.defaultPrevented)return;const m=l.current,g=i.current,y=f.target;m&&y instanceof Node&&!m.contains(y)&&g&&!g.contains(y)&&s()};return window.addEventListener("mousedown",h),()=>window.removeEventListener("mousedown",h)},[e,s,i]),p.useEffect(()=>{if(!e)return;const h=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),s())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[e,s]),!e)return null;const c=t.some(h=>h.description||h.icon),d=c||o;return u.jsx("div",{ref:l,className:`${Ae.dropdown} ${c?Ae.dropdownRich:o?Ae.dropdownCheck:""}`,style:a?{maxHeight:a,overflowY:"auto"}:void 0,children:t.map(h=>u.jsx("button",{type:"button",className:`${Ae.dropdownItem} ${h.id===n?Ae.dropdownItemActive:""}`,onMouseDown:f=>{f.preventDefault(),r(h.id)},children:d?u.jsxs(u.Fragment,{children:[c&&u.jsx("span",{className:Ae.dropdownItemIcon,children:h.icon}),u.jsxs("span",{className:Ae.dropdownItemContent,children:[u.jsx("span",{className:Ae.dropdownItemLabel,children:h.label}),h.description&&u.jsx("span",{className:Ae.dropdownItemDesc,children:h.description})]}),u.jsx("span",{className:Ae.dropdownItemCheck,children:h.id===n?u.jsx(l8e,{}):null})]}):h.label},h.id))})}function u8e({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r}){const i=p.useRef([]),[o,a]=p.useState(null),[l,c]=p.useState({}),[d,h]=p.useState(null),f=p.useRef(null);p.useEffect(()=>{var C;(C=i.current[e.selectedIndex])==null||C.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),p.useLayoutEffect(()=>{const C=t.current;if(!C)return;const A=()=>{const _=C.getBoundingClientRect(),R=getComputedStyle(C),I=Object.fromEntries(J5e.map(k=>[k,R.getPropertyValue(k)]));a({left:Math.max(12,Math.min(_.left+16,window.innerWidth-252)),bottom:window.innerHeight-_.top+8,width:_.width}),c(I)};A();const T=new ResizeObserver(A);return T.observe(C),window.addEventListener("resize",A),window.addEventListener("scroll",A,!0),()=>{T.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0)}},[t,e.items]),p.useEffect(()=>{h(null)},[e.items]);const m=C=>Array.from(C).length,g=Math.max(...e.items.map(C=>m(C.label)),0),y=Math.max(...e.items.map(C=>m(C.detail??"")),0),b=y>0,w={"--slash-command-col":`${Math.min(Math.max(g+1,10),24)}ch`,"--slash-desc-col":b?`${Math.min(Math.max(y+1,18),36)}ch`:"0px","--slash-column-gap":b?"2ch":"0px"};if(!o)return null;const v=_5e(e.items,e.kind),x={...w,...l,left:o.left,bottom:o.bottom,"--slash-anchor-width":`${o.width}px`};return dm.createPortal(u.jsxs("div",{ref:n,className:Ae.slashPortalLayer,style:l,"data-web-shell-slash-menu":!0,children:[u.jsx("div",{className:Ae.slashPanel,style:x,role:"listbox",onMouseDown:C=>C.preventDefault(),onMouseLeave:C=>{var T;const A=C.relatedTarget;A instanceof Node&&((T=f.current)!=null&&T.contains(A))||h(null)},children:u.jsx("div",{className:Ae.slashPanelBody,children:u.jsx("div",{className:Ae.slashList,onScroll:()=>h(null),children:e.items.map((C,A)=>{const T=v[A];return u.jsxs("div",{className:Ae.slashEntry,children:[T.showHeader&&u.jsxs(u.Fragment,{children:[T.showDivider&&u.jsx("div",{className:Ae.slashSection}),u.jsxs("div",{className:Ae.slashSectionHeader,children:[u.jsx("span",{children:C.section}),T.count>0?u.jsx("span",{className:Ae.slashSectionCount,children:T.count}):null]})]}),u.jsxs("button",{ref:_=>{i.current[A]=_},type:"button",role:"option","aria-selected":A===e.selectedIndex,className:`${Ae.slashItem} ${A===e.selectedIndex?Ae.slashItemActive:""}`,onMouseEnter:_=>{if(s(A),!C.detail){h(null);return}const R=_.currentTarget,I=8,k=180,j=R.getBoundingClientRect(),L=Math.min(j.left+Math.min(220,j.width*.34),window.innerWidth-320-12),$=window.innerHeight-j.bottom-I-12,F=j.top-I-12,B=$>=96||$>=F,Q=Math.max(72,Math.min(k,B?$:F));h({label:C.label,detail:C.detail,left:Math.max(12,L),...B?{top:j.bottom+I}:{bottom:window.innerHeight-j.top+I},maxHeight:Q})},onMouseDown:_=>{_.preventDefault(),_.stopPropagation(),r(A)},children:[u.jsx("span",{className:Ae.slashCommand,children:C.label}),C.detail&&u.jsx("span",{className:Ae.slashDescription,children:C.detail})]})]},`${C.id}:${A}`)})})})}),d&&u.jsxs("div",{ref:f,className:Ae.slashDetail,style:{...l,left:d.left,top:d.top,bottom:d.bottom,maxHeight:d.maxHeight},children:[u.jsx("div",{className:Ae.slashDetailCommand,children:d.label}),u.jsx("div",{className:Ae.slashDetailText,children:d.detail})]})]}),document.body)}function d8e({actions:e,onRun:t,onPressKey:n}){const{t:s}=it();return u.jsxs("div",{className:Ae.quickActionsPanel,onMouseDown:r=>r.stopPropagation(),onClick:r=>r.stopPropagation(),children:[u.jsx("div",{className:Ae.quickActionsHeader,children:s("quickActions.title")}),u.jsxs("div",{className:Ae.quickActionsLayout,children:[u.jsx("div",{className:Ae.quickActionsGrid,children:e.map(r=>u.jsx("button",{type:"button",className:Ae.quickAction,onClick:()=>t(r),children:u.jsx("span",{className:Ae.quickActionLabel,children:r.label})},r.id))}),u.jsx("div",{className:Ae.quickKeysGrid,children:a8e.map(r=>u.jsx("button",{type:"button",className:Ae.quickKey,title:s(r.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(r),children:u.jsx("span",{className:Ae.quickKeyLabel,children:r.label})},r.id))})]})]})}const iq=p.memo(p.forwardRef(function(t,n){const{onSubmit:s,onCycleMode:r,onToggleShortcuts:i,onCancel:o,isRunning:a=!1,isPreparing:l=!1,cancelArmed:c=!1,disabled:d=!1,placeholderText:h="Type a message...",commands:f,skills:m=[],slashCommandCategoryOrder:g,queuedMessages:y=[],onPopQueuedMessages:b,currentMode:w="default",currentModel:v="",chatWidthMode:x="1000",showChatWidthToggle:C=!0,chatWidthToggleMin:A,visibleToolbarActions:T,availableModels:_=[],onSelectMode:R,onSelectModel:I,onChatWidthModeChange:k,onFocusFooter:j,dialogOpen:N=!1,followupState:L,onAcceptFollowup:$,onDismissFollowup:F,sessionName:B,composerInput:Q,composerInputVersion:Y,builtinAtProviders:ne,atProviders:P,composerTagIcons:le}=t,{renderComposerToolbarStart:z,renderComposerToolbarEnd:M,renderComposerToolbarRight:re,renderComposerTag:U,renderComposerTagTooltip:W,onComposerTagClick:J}=Va(),G=A1e({onSubmit:s,onCycleMode:r,onToggleShortcuts:i,disabled:d,placeholderText:h,commands:f,skills:m,slashCommandCategoryOrder:g,queuedMessages:y,onPopQueuedMessages:b,currentMode:w,onFocusFooter:j,dialogOpen:N,followupState:L,onAcceptFollowup:$,onDismissFollowup:F,sessionName:B,composerInput:Q,composerInputVersion:Y,builtinAtProviders:ne,atProviders:P,composerTagIcons:le,renderComposerTag:U,renderComposerTagTooltip:W,onComposerTagClick:J,editorTheme:X5e}),{t:te}=it();p.useImperativeHandle(n,()=>G.handle,[G.handle]);const[H,ie]=p.useState(!1),[fe,Ne]=p.useState(!1),[Ie,Ce]=p.useState(!1),[ve,ut]=p.useState(zN),ae=p.useRef(null),Ct=p.useRef(null),Ke=p.useRef(null),on=p.useRef(null),qt=p.useRef(null),[gt,St]=p.useState(!1),ft=G.slashMenu,de=G.closeSlashMenu,_e=G.atMenu,Ue=G.closeAtMenu,Xe=!!ft,yt=!!_e,ye=G.viewRef;p.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Te=window.matchMedia("(hover: none), (pointer: coarse)"),Ye=()=>ut(zN());return Ye(),Te.addEventListener("change",Ye),()=>Te.removeEventListener("change",Ye)},[]),p.useEffect(()=>{ve||Ce(!1)},[ve]),p.useEffect(()=>{if(!Xe&&!yt)return;const Te=Ye=>{var bn,ws;const _t=Ye.target,Bt=ae.current;_t instanceof Node&&Bt&&!Bt.contains(_t)&&!((bn=Ct.current)!=null&&bn.contains(_t))&&!((ws=Ke.current)!=null&&ws.contains(_t))&&(de(),Ue())};return window.addEventListener("mousedown",Te),window.addEventListener("touchstart",Te),()=>{window.removeEventListener("mousedown",Te),window.removeEventListener("touchstart",Te)}},[yt,Xe,Ue,de]),p.useEffect(()=>{var _t;const Te=ae.current,Ye=(_t=ye.current)==null?void 0:_t.contentDOM;if(!(!Te||!Ye))return s8e(Te,Ye)},[ye]),p.useEffect(()=>{const Te=ae.current,Ye=A;if(!Te||Ye===void 0){St(!1);return}const _t=()=>{St(Te.getBoundingClientRect().width>=Ye-50)};_t();const Bt=new ResizeObserver(_t);return Bt.observe(Te),()=>Bt.disconnect()},[A]);const Kt=p.useMemo(()=>Ww.map(Te=>({id:Te,label:c8e(Te,te),description:te(`mode.desc.${Te}`),icon:u.jsx(TS,{mode:Te})})),[te]),Ee=p.useMemo(()=>{if(!T)return null;const Te=T.filter(Ye=>Q5e.has(Ye));return new Set(Te)},[T]),ct=Te=>Ee?Ee.has(Te):!0,qn=p.useMemo(()=>new Set(f.map(Te=>Te.name.replace(/^\/+/,""))),[f]),Me=p.useCallback(Te=>qn.has(Te),[qn]),qe=p.useMemo(()=>[{id:"new",label:te("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:te("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:te("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:te("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:te("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:te("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:te("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:te("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:te("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:te("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:te("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:te("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:te("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:te("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:te("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:te("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:G.shellMode?te("quickActions.exitShellMode"):te("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:te("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Te=>{const Ye=o8e(Te);return!Ye||Me(Ye)}),[G.shellMode,Me,te]),Fe=p.useMemo(()=>_.map(Te=>({id:Te.id,label:Jp(Te.label||Te.id)})),[_]),Ht=p.useCallback(Te=>{R==null||R(Te),ie(!1),G.focus()},[R,G]),Mn=p.useCallback(Te=>{I==null||I(Te),Ne(!1),G.focus()},[I,G]),Rn=p.useCallback(Te=>{const Ye=G.viewRef.current;Ye&&(Ye.focus(),Ye.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Te,bubbles:!0,cancelable:!0})))},[G]),Bn=p.useCallback(Te=>{if(Ce(!1),ie(!1),Ne(!1),G.closeSlashMenu(),G.closeAtMenu(),Te.action.type==="insert"){G.insertText(Te.action.text,{mode:"replace"});return}if(Te.action.type==="shell"){G.toggleShellMode();return}if(Te.action.type==="key"){Rn(Te.action.item.event);return}s(Te.action.command)},[G,Rn,s]),Hr=p.useCallback(Te=>{Rn(Te.event),Te.id==="ctrl-r"&&Ce(!1)},[Rn]),{searchMode:Ut,searchQuery:vn,searchMatches:tn,searchActiveIndex:Jt,searchInputRef:Nn,searchUiRef:fn,closeSearch:Pn,handleSearchKeyDown:Gn,handleSearchInput:Hn,handleSearchCompositionEnd:qs}=G.searchState,br=Te=>{const Ye=U==null?void 0:U({tag:Te,placement:"composer",readonly:!1});if(Ye!=null)return Ye;const _t=$v(Te),Bt=zv(Te),bn=Te.kind?"":_t,ws=Te.icon??Pv(Te.kind,le),Zs=ws&&Am(ws)?ws:void 0;return!bn&&!Bt?u.jsx("span",{className:Ae.tagLabel,children:Te.id}):u.jsxs(u.Fragment,{children:[Zs&&u.jsx("span",{className:Ae.tagIcon,style:_u("--composer-tag-icon-url",Zs),"aria-hidden":"true"}),bn&&u.jsx("span",{className:Ae.tagLabel,children:bn}),Bt&&u.jsx("span",{className:Ae.tagValue,children:Bt})]})},Dn=rq(w,te),ln=Jp(v),Es=a&&!G.hasContent;return u.jsxs("div",{className:Ae.editorShell,"data-composer":!0,"data-web-shell-composer":!0,children:[u.jsxs("div",{ref:ae,className:Ae.container,"data-web-shell-composer-surface":!0,"data-dac-glow":!0,onClick:()=>{ie(!1),Ne(!1),Ce(!1),G.focus()},children:[u.jsx("div",{className:Ae.dacAura,"aria-hidden":"true"}),u.jsx("div",{className:Ae.dacHalo,"aria-hidden":"true"}),Ut&&u.jsxs("div",{ref:fn,className:Ae.searchPanel,onMouseDown:Te=>Te.stopPropagation(),onClick:Te=>Te.stopPropagation(),children:[u.jsxs("div",{className:Ae.searchBar,children:[u.jsx("span",{className:Ae.searchLabel,children:te("editor.searchLabel")}),u.jsx("input",{ref:Nn,className:Ae.searchInput,value:vn,onChange:Hn,onCompositionEnd:qs,onKeyDown:Gn,placeholder:te("editor.searchPlaceholder")})]}),tn.length>0&&u.jsx("div",{className:Ae.searchResults,children:tn.map((Te,Ye)=>u.jsxs("button",{type:"button",className:`${Ae.searchResult} ${Ye===Jt?Ae.searchResultActive:""}`,onMouseDown:_t=>{_t.preventDefault(),G.replaceEditorText(Te),Pn(!1)},children:[u.jsx("span",{className:Ae.searchResultMarker,children:Ye===Jt?"›":""}),u.jsx("span",{className:Ae.searchResultText,children:Te})]},`${Te}-${Ye}`))}),tn.length===0&&u.jsx("div",{className:Ae.searchEmpty,children:te("editor.noHistory")})]}),u.jsxs("div",{className:Ae.content,children:[G.composerTags.length>0&&u.jsx("div",{className:Ae.tags,children:G.composerTags.map(Te=>{const Ye={tag:Te,placement:"composer",readonly:!1},_t=W==null?void 0:W(Ye);return u.jsxs("span",{className:Ae.tag,role:J?"button":void 0,tabIndex:J?0:void 0,onClick:Bt=>{J&&(Bt.stopPropagation(),J({...Ye,anchorRect:Bt.currentTarget.getBoundingClientRect()}))},onKeyDown:Bt=>{J&&(Bt.key!=="Enter"&&Bt.key!==" "||(Bt.preventDefault(),J({...Ye,anchorRect:Bt.currentTarget.getBoundingClientRect()})))},children:[br(Te),Te.removable!==!1&&u.jsx("button",{type:"button",className:Ae.tagRemove,"aria-label":`Remove ${C8(Te)}`,onMouseDown:Bt=>Bt.preventDefault(),onClick:Bt=>{var bn;Bt.stopPropagation(),G.removeTopTag(Te.id),(bn=G.viewRef.current)==null||bn.focus()},onKeyDown:Bt=>{var bn;if(Bt.key==="Enter"||Bt.key===" "){Bt.stopPropagation();return}Bt.key!=="Backspace"&&Bt.key!=="Delete"||(Bt.preventDefault(),Bt.stopPropagation(),G.removeTopTag(Te.id),(bn=G.viewRef.current)==null||bn.focus())},children:"×"}),_t!=null&&u.jsx("span",{className:Ae.tagTooltip,role:"tooltip",children:_t})]},Te.id)})}),G.pastedImages.length>0&&u.jsx("div",{className:Ae.images,children:G.pastedImages.map((Te,Ye)=>u.jsxs("div",{className:Ae.imageThumb,children:[u.jsx("img",{src:`data:${Te.media_type};base64,${Te.data}`,alt:""}),u.jsx("button",{className:Ae.imageRemove,onClick:_t=>{_t.stopPropagation(),G.removeImage(Ye)},children:"×"})]},Ye))}),G.slashMenu&&u.jsx(u8e,{menu:G.slashMenu,anchorRef:ae,panelRef:Ct,onSelect:G.selectSlashCompletion,onAccept:G.acceptSlashCompletion}),G.atMenu&&u.jsx(h5e,{menu:G.atMenu,anchorRef:ae,panelRef:Ke,onSelect:G.selectAtCompletion,onAccept:G.acceptAtCompletion,onBack:()=>{const Te=G.backAtCategories();return Te==="categories"&&window.setTimeout(()=>G.focus(),0),!!Te},onSearch:G.updateAtSearch,onSelectTab:G.selectAtTab}),u.jsxs("div",{className:Ae.editorArea,children:[G.shellMode&&u.jsx("span",{className:Ae.shellPrefix,"aria-hidden":"true",children:"!"}),u.jsx("div",{ref:G.containerRef,"data-web-shell-composer-editor":!0})]}),u.jsxs("div",{className:Ae.toolbar,children:[u.jsxs("div",{className:Ae.toolbarLeading,children:[z&&u.jsx("div",{className:Ae.toolbarStart,children:u.jsx(z,{disabled:d,isRunning:a,currentMode:w,currentModel:v,sessionName:B})}),u.jsxs("div",{className:Ae.toolbarLeft,children:[ct("approvalMode")&&u.jsxs("div",{className:Ae.dropdownWrapper,children:[u.jsx(qN,{open:H,items:Kt,activeId:w,onClose:()=>ie(!1),onSelect:Ht,anchorRef:on}),u.jsxs("button",{ref:on,className:Ae.toolBtn,"data-web-shell-mode-button":!0,onClick:Te=>{Te.stopPropagation(),G.closeSlashMenu(),G.closeAtMenu(),Ce(!1),ie(Ye=>!Ye),Ne(!1)},"aria-label":te("status.mode"),children:[u.jsx("span",{className:Ae.toolBtnModeIcon,children:u.jsx(TS,{mode:w})}),u.jsx("span",{className:Ae.toolBtnText,children:Dn}),u.jsx("span",{className:Ae.toolBtnArrow,children:u.jsx(FN,{})})]})]}),ct("model")&&u.jsxs("div",{className:Ae.dropdownWrapper,children:[u.jsx(qN,{open:fe,items:Fe,activeId:v,onClose:()=>Ne(!1),onSelect:Mn,anchorRef:qt,showCheck:!0,maxHeight:300}),u.jsxs("button",{ref:qt,className:Ae.toolBtn,"data-web-shell-model-button":!0,onClick:Te=>{Te.stopPropagation(),G.closeSlashMenu(),G.closeAtMenu(),Ce(!1),Ne(Ye=>!Ye),ie(!1)},"aria-label":te("model.select"),children:[u.jsx("span",{className:Ae.toolBtnModelIcon,children:u.jsx(i8e,{})}),u.jsx("span",{className:Ae.toolBtnText,children:ln}),u.jsx("span",{className:Ae.toolBtnArrow,children:u.jsx(FN,{})})]})]}),M&&u.jsx("div",{className:Ae.toolbarEnd,children:u.jsx(M,{disabled:d,isRunning:a,currentMode:w,currentModel:v,sessionName:B})})]})]}),u.jsxs("div",{className:Ae.toolbarRight,children:[ve&&qe.length>0&&u.jsx("button",{className:`${Ae.toolBtn} ${Ae.quickActionsBtn}`,onClick:Te=>{Te.stopPropagation(),G.closeSlashMenu(),G.closeAtMenu(),ie(!1),Ne(!1),Ce(Ye=>!Ye)},"aria-expanded":Ie,"aria-label":te("quickActions.open"),title:te("quickActions.open"),"data-tooltip":te("quickActions.open"),children:u.jsx("span",{className:Ae.toolBtnIcon,children:u.jsx(n8e,{})})}),re&&u.jsx("div",{className:Ae.toolbarRightCustom,children:u.jsx(re,{disabled:d,isRunning:a,currentMode:w,currentModel:v,sessionName:B})}),C&&gt&&ct("widthMode")&&u.jsx("button",{className:`${Ae.toolBtn} ${Ae.widthModeBtn}`,onClick:Te=>{Te.stopPropagation(),k==null||k(x==="wide"?"1000":"wide")},disabled:!k,"aria-label":te(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:te(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":te(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:u.jsx("span",{className:Ae.toolBtnIcon,children:u.jsx(r8e,{mode:x})})}),ct("voice")&&u.jsx(K5e,{disabled:d,onInsert:Te=>{const Ye=G.getText(),_t=Ye&&!/\s$/.test(Ye)?" ":"";G.insertText(`${_t}${Te} `),G.focus()}}),u.jsx("button",{className:l||Es?`${Ae.sendBtn} ${Ae.sendBtnRunning}${c?` ${Ae.sendBtnArmed}`:""}`:Ae.sendBtn,disabled:l?!0:Es?!o:G.disabled||!G.hasContent,"data-web-shell-composer-submit":!0,onClick:Te=>{if(Te.stopPropagation(),!l){if(Es){o==null||o();return}G.submitText()}},"aria-label":te(l?"common.loading":Es?c?"stream.cancelArmed":"stream.cancel":"editor.send"),title:a&&c?te("stream.cancelArmed"):void 0,children:l?u.jsx(t8e,{}):Es?c?u.jsx("span",{className:Ae.escLabel,"aria-hidden":"true",children:"Esc"}):u.jsx(e8e,{}):u.jsx(Z5e,{})}),u.jsx("span",{role:"status","aria-live":"polite",className:Ae.srOnly,children:a&&c?te("stream.cancelArmed"):""})]})]})]})]}),ve&&Ie&&qe.length>0&&u.jsx(d8e,{actions:qe,onRun:Bn,onPressKey:Hr})]})})),h8e="_bar_agzxl_1",f8e="_left_agzxl_12",m8e="_right_agzxl_13",p8e="_settingsButton_agzxl_23",g8e="_modeButton_agzxl_49",y8e="_modeHint_agzxl_62",b8e="_modeLabel_agzxl_67",w8e="_modeDefault_agzxl_71",v8e="_modePlan_agzxl_75",x8e="_modeAutoEdit_agzxl_79",_8e="_modeAuto_agzxl_79",k8e="_modeYolo_agzxl_87",S8e="_shortcutsButton_agzxl_96",T8e="_modelButton_agzxl_114",C8e="_model_agzxl_114",A8e="_contextButton_agzxl_138",E8e="_context_agzxl_138",M8e="_goal_agzxl_161",N8e="_separator_agzxl_167",I8e="_taskPill_agzxl_171",vr={bar:h8e,left:f8e,right:m8e,settingsButton:p8e,modeButton:g8e,modeHint:y8e,modeLabel:b8e,modeDefault:w8e,modePlan:v8e,modeAutoEdit:x8e,modeAuto:_8e,modeYolo:k8e,shortcutsButton:S8e,modelButton:T8e,model:C8e,contextButton:A8e,context:E8e,goal:M8e,separator:N8e,taskPill:I8e},j8e=1e3;function R8e(e,t){switch(e){case"default":return{label:t("mode.default"),className:vr.modeDefault};case"plan":return{label:t("mode.plan"),className:vr.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:vr.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:vr.modeAuto};case"yolo":return{label:t("mode.yolo"),className:vr.modeYolo};default:return null}}function L8e(){return u.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:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.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 G4(e,t,n,s){return s(e===1?t:n,{count:e})}function D8e(e,t){if(e.length===0)return"";const n=e.filter(r=>r.status==="running");if(n.length>0){const r={agent:0,shell:0,monitor:0};for(const o of n)r[o.kind]++;const i=[];return r.shell>0&&i.push(G4(r.shell,"tasks.pill.shell","tasks.pill.shells",t)),r.agent>0&&i.push(G4(r.agent,"tasks.pill.agent","tasks.pill.agents",t)),r.monitor>0&&i.push(G4(r.monitor,"tasks.pill.monitor","tasks.pill.monitors",t)),i.join(", ")}const s=e.filter(r=>r.kind==="agent"&&r.status==="paused");return s.length>0?t(s.length===1?"tasks.pill.agentPaused":"tasks.pill.agentsPaused",{count:s.length}):t(e.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:e.length})}function O8e(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 B8e=p.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:s,onOpenSettings:r,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:l,hideSettings:c,onToggleShortcuts:d,compact:h=!1},f){const m=Ta(),g=m.status==="connected",y=m.currentModel??"",b=m.currentMode??"",w=m.tokenCount??0,v=m.contextWindow??0,{t:x}=it(),A=(v>0?w/v*100:0).toFixed(1),T=R8e(b,x),[,_]=p.useState(0),R=p.useRef(null);p.useEffect(()=>{if(!l)return;const B=setInterval(()=>_(Q=>(Q+1)%1e6),j8e);return()=>clearInterval(B)},[l]);const I=p.useMemo(()=>D8e(a,x),[a,x]),k=!h&&(g||!!T),j=l?O8e(Date.now()-l.setAt):"",N=l?`◎ ${x("goal.statusActive")}${j?` (${j})`:""}`:"",L=!!I||!h,$=!h&&!!y||!h&&v>0&&w>0||!!N;if(p.useImperativeHandle(f,()=>({focusTaskPill(){var B;return I?((B=R.current)==null||B.focus({preventScroll:!0}),!0):!1}}),[I]),!L&&!$)return null;const F=B=>{if(B.key==="Enter"||B.key==="ArrowDown"||B.key==="n"&&B.ctrlKey){B.preventDefault(),B.stopPropagation(),i==null||i();return}if(B.key==="ArrowUp"||B.key==="Escape"||B.key==="p"&&B.ctrlKey){B.preventDefault(),B.stopPropagation(),o==null||o();return}B.key.length===1&&!B.metaKey&&!B.ctrlKey&&!B.altKey&&(B.preventDefault(),B.stopPropagation(),o==null||o(B.key))};return u.jsxs("div",{className:vr.bar,children:[u.jsxs("div",{className:vr.left,children:[g&&!c&&!h&&u.jsx("button",{type:"button",className:vr.settingsButton,onClick:r,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),title:x("settings.title"),"aria-label":x("settings.title"),"aria-haspopup":"dialog",children:u.jsx(L8e,{})}),T&&!h&&u.jsxs("button",{type:"button",className:vr.modeButton,onClick:t,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),title:x("mode.select"),"aria-haspopup":"listbox",children:[u.jsx("span",{className:`${vr.modeLabel} ${T.className}`,children:T.label}),!h&&u.jsx("span",{className:vr.modeHint,children:x("status.modeHint")})]}),!h&&u.jsx(u.Fragment,{children:d?u.jsx("button",{type:"button",className:vr.shortcutsButton,onClick:d,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),"aria-haspopup":"dialog","aria-label":x("status.shortcuts"),children:x("status.shortcuts")}):u.jsx("span",{children:x("status.shortcuts")})}),I&&u.jsxs(u.Fragment,{children:[k&&u.jsx("span",{className:vr.separator,children:"·"}),u.jsx("button",{ref:R,type:"button",className:vr.taskPill,onClick:i,onKeyDown:F,disabled:!i,children:I})]})]}),u.jsxs("div",{className:vr.right,children:[!h&&y&&u.jsx("button",{type:"button",className:vr.modelButton,onClick:n,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),title:x("model.select"),"aria-haspopup":"listbox",children:u.jsx("span",{className:vr.model,children:y})}),!h&&v>0&&w>0&&u.jsx("button",{type:"button",className:vr.contextButton,onClick:s,title:x("contextUsage.title"),children:u.jsx("span",{className:vr.context,children:x("status.contextUsed",{pct:A})})}),N&&u.jsx("span",{className:vr.goal,title:l==null?void 0:l.condition,children:N})]})]})}),P8e=15e3,$8e=["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."],z8e=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function HN(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?z8e:$8e}function F8e(){const e=Xw(),t=hg(),n=e!=="idle",s=p.useRef(0),r=p.useRef(0),[i,o]=p.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=p.useMemo(()=>{let c=0,d=0,h=!1;const f=new Set;let m=-1;for(let g=t.length-1;g>=0;g--)if(t[g].kind==="user"){m=g;break}for(let g=m+1;g<t.length;g++){const y=t[g];if(y.kind==="assistant"&&!y.parentToolCallId&&(c+=y.text.length,y.streaming&&(h=!0)),y.kind==="tool"&&!y.parentToolCallId){if(y.rawInput!==void 0)try{c+=JSON.stringify(y.rawInput).length}catch{}const b=q8e(y.rawOutput);b!==void 0&&!f.has(y.toolCallId)&&(d+=b,f.add(y.toolCallId))}}return{chars:c,agentTokens:d,isReceiving:h}},[t]),l=p.useRef(a);return l.current=a,a.chars<r.current&&(s.current=a.chars),r.current=a.chars,p.useEffect(()=>{if(!n){s.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const c=setInterval(()=>{const{chars:d,agentTokens:h,isReceiving:f}=l.current;if(d<s.current){s.current=d,o({estimatedOutputTokens:h+Math.round(d/4),isReceivingContent:f});return}const m=d-s.current;if(m<=0){o(b=>{const w={estimatedOutputTokens:h+Math.round(s.current/4),isReceivingContent:f};return b.estimatedOutputTokens===w.estimatedOutputTokens&&b.isReceivingContent===w.isReceivingContent?b:w});return}let g;m<70?g=3:m<=200?g=Math.max(3,Math.round(m*.2)):g=50;const y=Math.min(s.current+g,d);s.current=y,o({estimatedOutputTokens:h+Math.round(y/4),isReceivingContent:f})},100);return()=>clearInterval(c)},[n]),i}function q8e(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 H8e(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function wf(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const U8e="_status_zld2v_1",V8e="_spinner_zld2v_11",W8e="_label_zld2v_15",G8e="_meta_zld2v_19",Q1={status:U8e,spinner:V8e,label:W8e,meta:G8e},K4=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function oq({startedAt:e,showPhrase:t=!0}){const n=Xw(),{estimatedOutputTokens:s,isReceivingContent:r}=F8e(),{language:i,t:o}=it(),{loadingPhrases:a}=Va(),l=p.useRef(a);l.current=a;const c=p.useCallback(T=>{var _;try{return((_=l.current)==null?void 0:_.call(l,T))??HN(T)}catch(R){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",R),HN(T)}},[]),[d,h]=p.useState(0),f=p.useRef(Date.now()),[m,g]=p.useState(0),[y,b]=p.useState(()=>c(i)[0]??""),w=n!=="idle";if(p.useEffect(()=>{if(!w){h(0);return}f.current=e??Date.now(),h(UN(f.current));const T=setInterval(()=>{h(UN(f.current))},1e3);return()=>clearInterval(T)},[w,e]),p.useEffect(()=>{if(!t)return;if(n==="idle"){b(c(i)[0]??"");return}const T=()=>{const R=c(i),I=Math.floor(Math.random()*R.length);b(R[I]??"")};T();const _=setInterval(T,P8e);return()=>clearInterval(_)},[i,n,c,t]),p.useEffect(()=>{if(n==="idle")return;const T=setInterval(()=>{g(_=>(_+1)%K4.length)},250);return()=>clearInterval(T)},[n]),n==="idle")return null;const v=K4[m%K4.length],x=r?"↓":"↑",C=d<60?`${d}s`:K8e(d*1e3),A=s>0?` · ${x} ${o("stream.tokens",{count:H8e(s)})}`:"";return u.jsxs("div",{className:Q1.status,children:[u.jsx("span",{className:Q1.spinner,children:v}),t&&y&&u.jsx("span",{className:Q1.label,children:y}),u.jsxs("span",{className:Q1.meta,children:["(",C,A," · ",o("stream.cancel"),")"]})]})}function K8e(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 UN(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const Y8e="_host_1scjy_1",Q8e="_toast_1scjy_13",X8e="_message_1scjy_31",J8e="_close_1scjy_39",Z8e="_info_1scjy_58",e7e="_success_1scjy_62",t7e="_warning_1scjy_66",n7e="_error_1scjy_70",T0={host:Y8e,toast:Q8e,message:X8e,close:J8e,info:Z8e,success:e7e,warning:t7e,error:n7e};function s7e({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:u.jsx("div",{className:T0.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(s=>u.jsx(r7e,{toast:s,onDismiss:t,autoDismissMs:n},s.id))})}function r7e({toast:e,onDismiss:t,autoDismissMs:n}){const{t:s}=it();return p.useEffect(()=>{const r=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(r)},[n,t,e.id]),u.jsxs("div",{className:`${T0.toast} ${T0[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[u.jsx("div",{className:T0.message,children:e.message}),u.jsx("button",{type:"button",className:T0.close,onClick:()=>t(e.id),"aria-label":s("toast.dismiss"),title:s("toast.dismissShort"),children:"x"})]})}const i7e="_panel_n876c_1",o7e="_summary_n876c_10",a7e="_progressRing_n876c_27",l7e="_stepText_n876c_41",c7e="_statusSegmentWrap_n876c_48",u7e="_separator_n876c_55",d7e="_statusSegment_n876c_48",h7e="_statusSegmentButton_n876c_61",f7e="_fullText_n876c_83",m7e="_compactText_n876c_87",p7e="_detail_n876c_106",g7e="_item_n876c_138",y7e="_icon_n876c_148",b7e="_loadingIcon_n876c_156",w7e="_content_n876c_165",v7e="_completed_n876c_173",x7e="_inProgress_n876c_187",_7e="_pending_n876c_192",Yr={panel:i7e,summary:o7e,progressRing:a7e,stepText:l7e,statusSegmentWrap:c7e,separator:u7e,statusSegment:d7e,statusSegmentButton:h7e,fullText:f7e,compactText:m7e,detail:p7e,item:g7e,icon:y7e,loadingIcon:b7e,content:w7e,completed:v7e,inProgress:x7e,pending:_7e};function k7e(e){switch(e){case"completed":return Yr.completed;case"in_progress":return Yr.inProgress;case"pending":return Yr.pending}}const S7e=p.memo(function({todos:t,title:n,statusItems:s=[]}){const{t:r}=it();if(t.length===0&&s.length===0)return null;const i=t.length,o=i>0,a=t.findIndex(m=>m.status==="in_progress"),l=a>=0?a:t.findIndex(m=>m.status==="pending"),c=o?l>=0?l+1:i:0,d=o?c/i:0,h=s.map(m=>m.ariaLabel??m.title??(typeof m.label=="string"?m.label:void 0)).filter(Boolean).join(", ")||void 0,f=o?r("todo.stepProgress",{current:c,total:i}):h;return u.jsxs("section",{className:Yr.panel,"aria-label":n??(o?r("todo.title"):h),tabIndex:0,children:[u.jsxs("div",{className:Yr.summary,"aria-label":f,children:[o&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Yr.progressRing,style:{"--todo-progress":String(d)},"aria-hidden":"true"}),u.jsxs("span",{className:Yr.stepText,children:[u.jsx("span",{className:Yr.fullText,children:r("todo.stepProgress",{current:c,total:i})}),u.jsx("span",{className:Yr.compactText,children:r("todo.stepFraction",{current:c,total:i})})]})]}),s.map((m,g)=>u.jsxs("span",{className:Yr.statusSegmentWrap,children:[(i>0||g>0)&&u.jsx("span",{className:Yr.separator,"aria-hidden":"true",children:"·"}),m.onClick?u.jsx("button",{type:"button",className:Yr.statusSegmentButton,title:m.title,"aria-label":m.ariaLabel,onClick:m.onClick,children:m.label}):u.jsx("span",{className:Yr.statusSegment,title:m.title,children:m.label})]},m.id))]}),i>0&&u.jsx("div",{className:Yr.detail,role:"tooltip",children:t.map((m,g)=>u.jsxs("div",{className:`${Yr.item} ${k7e(m.status)}`,children:[u.jsx("span",{className:Yr.icon,"aria-hidden":"true",children:m.status==="in_progress"?u.jsx("span",{className:Yr.loadingIcon}):bw(m.status)}),u.jsx("span",{className:Yr.content,title:m.content,children:m.content})]},`${m.id||g}:${m.content}`))})]})}),T7e="_header_leiy3_1",C7e="_titleRow_leiy3_11",A7e="_title_leiy3_11",E7e="_subtitle_leiy3_31",X1={header:T7e,titleRow:C7e,title:A7e,subtitle:E7e};function M7e(e){const{t}=it();return u.jsxs("div",{className:X1.header,children:[u.jsxs("div",{className:X1.titleRow,children:[u.jsx("span",{children:t("welcome.titlePrefix")}),u.jsx("span",{className:X1.title,children:"Qwen Code"})]}),u.jsx("div",{className:X1.subtitle,children:t("welcome.prompt")})]})}const N7e="_themeDark_1tp31_1",I7e="_themeLight_1tp31_25",j7e="_backdrop_1tp31_47",R7e="_panel_1tp31_67",L7e="_sizeSm_1tp31_85",D7e="_sizeMd_1tp31_89",O7e="_sizeLg_1tp31_93",B7e="_sizeXl_1tp31_97",P7e="_header_1tp31_101",$7e="_titleWrap_1tp31_110",z7e="_title_1tp31_110",F7e="_subtitle_1tp31_122",q7e="_close_1tp31_129",H7e="_iconButton_1tp31_170",U7e="_body_1tp31_10",V7e="_panelFullscreen_1tp31_202",Ni={themeDark:N7e,themeLight:I7e,backdrop:j7e,panel:R7e,sizeSm:L7e,sizeMd:D7e,sizeLg:O7e,sizeXl:B7e,header:P7e,titleWrap:$7e,title:z7e,subtitle:F7e,close:q7e,iconButton:H7e,body:U7e,panelFullscreen:V7e},W7e={sm:Ni.sizeSm,md:Ni.sizeMd,lg:Ni.sizeLg,xl:Ni.sizeXl},G7e=["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 Y4(e){return e?Array.from(e.querySelectorAll(G7e)):[]}const ru=[],aq=p.createContext(null);function K7e(e){return e===null?!0:ru[ru.length-1]===e}function xr({title:e,subtitle:t,size:n="md",allowFullscreen:s=!1,onClose:r,children:i}){const{t:o}=it(),[a,l]=p.useState(!1),d=Zw()===Li.Light?Ni.themeLight:Ni.themeDark,h=p.useRef(null),f=p.useRef(r);f.current=r;const[m]=p.useState(()=>typeof document<"u"?document.activeElement:null),g=p.useRef(!1),y=p.useRef(!1),b=p.useRef(null);b.current===null&&(b.current={}),p.useEffect(()=>{const A=h.current,T=b.current;ru.push(T),A&&!A.contains(document.activeElement)&&(Y4(A).find(k=>!k.hasAttribute("data-dialog-close"))??A).focus();const _=R=>{var I;if(ru[ru.length-1]===T&&!R.defaultPrevented&&!(R.isComposing||R.keyCode===229)){if(R.key==="Escape"){R.preventDefault(),R.stopPropagation(),f.current();return}if(R.key==="Tab"){const k=Y4(h.current);if(k.length===0){R.preventDefault(),(I=h.current)==null||I.focus();return}const j=k[0],N=k[k.length-1],L=document.activeElement;k.includes(L)?R.shiftKey&&L===j?(R.preventDefault(),N.focus()):!R.shiftKey&&L===N&&(R.preventDefault(),j.focus()):(R.preventDefault(),(R.shiftKey?N:j).focus())}}};return document.addEventListener("keydown",_),()=>{var L,$,F;document.removeEventListener("keydown",_);const R=ru.indexOf(T);if(R>=0&&ru.splice(R,1),ru.length===0){(L=m==null?void 0:m.focus)==null||L.call(m);return}const I=Array.from(document.querySelectorAll("[data-keyboard-scope]")),k=($=I[I.length-1])==null?void 0:$.querySelector('[role="dialog"]');(F=Y4(k).find(B=>!B.hasAttribute("data-dialog-close"))??k)==null||F.focus()}},[m]);const w=A=>{g.current=A.target===A.currentTarget,y.current=!1},v=A=>{y.current=A.target===A.currentTarget},x=A=>{const T=g.current&&y.current&&A.target===A.currentTarget;g.current=!1,y.current=!1,T&&r()},C=u.jsx("div",{className:`${Ni.backdrop} ${d}`,"data-keyboard-scope":!0,onMouseDown:w,onMouseUp:v,onClick:x,children:u.jsx(aq.Provider,{value:b.current,children:u.jsxs("section",{ref:h,className:`${Ni.panel} ${a?Ni.panelFullscreen:W7e[n]}`,role:"dialog","aria-modal":"true","aria-label":e,tabIndex:-1,"data-web-shell-dialog":!0,"data-web-shell-dialog-title":e,children:[u.jsxs("header",{className:Ni.header,children:[u.jsxs("div",{className:Ni.titleWrap,children:[u.jsx("div",{className:Ni.title,children:e}),t&&u.jsx("div",{className:Ni.subtitle,children:t})]}),s&&u.jsx("button",{type:"button",className:Ni.iconButton,onClick:()=>l(A=>!A),"aria-label":o(a?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":a,title:o(a?"common.exitFullscreen":"common.fullscreen"),children:u.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a?u.jsx("path",{d:"M6 2v4H2M14 6h-4V2M6 14v-4H2M14 10h-4v4"}):u.jsx("path",{d:"M2 6V2h4M10 2h4v4M2 10v4h4M10 14h4v-4"})})}),u.jsx("button",{type:"button",className:Ni.close,onClick:r,"aria-label":o("common.close"),title:o("common.close"),"data-dialog-close":!0})]}),u.jsx("div",{className:Ni.body,"data-dialog-fullscreen":a?"":void 0,children:i})]})})});return typeof document>"u"?C:dm.createPortal(C,document.body)}function J1(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const Y7e=new Set(["button","submit","reset"]),Q7e=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function VN(){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 Y7e.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function Q4(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!Q7e.has(e.type):e.isContentEditable===!0}function od({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s,enabled:r=!0}){const i=p.useContext(aq),o=p.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s};const[a,l]=p.useState(!1);return p.useEffect(()=>{if(!r)return;const c=()=>l(!0),d=()=>l(!1),h=f=>{if(!K7e(i)||f.defaultPrevented||f.isComposing||f.keyCode===229||f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;const{itemCount:m,activeIndex:g}=o.current;if(!(m<=0))switch(f.key){case"ArrowDown":f.preventDefault(),c(),o.current.onActiveIndexChange(J1(g+1,m));break;case"ArrowUp":f.preventDefault(),c(),o.current.onActiveIndexChange(J1(g-1,m));break;case"Home":if(Q4())return;f.preventDefault(),c(),o.current.onActiveIndexChange(0);break;case"End":if(Q4())return;f.preventDefault(),c(),o.current.onActiveIndexChange(m-1);break;case"Enter":{if(VN()||g<0)return;f.preventDefault(),o.current.onConfirm(J1(g,m));break}case" ":{if(VN()||Q4()||g<0)return;f.preventDefault(),o.current.onConfirm(J1(g,m));break}}};return window.addEventListener("keydown",h),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",h),window.removeEventListener("mousemove",d)}},[i,r]),{keyboardMode:a}}const X7e="_picker_5cmbf_4",J7e="_selected_5cmbf_98",Z7e="_disabled_5cmbf_114",eTe={picker:X7e,"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:J7e,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:Z7e,"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 $e(...e){return e.filter(t=>!!t).map(t=>eTe[t]).filter(Boolean).join(" ")}const tTe="_list_jbgdx_1",nTe="_row_jbgdx_16",sTe="_selected_jbgdx_32",rTe="_keyboardOnly_jbgdx_39",iTe="_modeName_jbgdx_47",oTe="_modeIcon_jbgdx_51",aTe="_modeText_jbgdx_67",lTe="_modeDesc_jbgdx_83",Yc={list:tTe,row:nTe,selected:sTe,keyboardOnly:rTe,modeName:iTe,modeIcon:oTe,modeText:aTe,modeDesc:lTe};function cTe({currentMode:e,onSelect:t}){const{t:n}=it(),s=p.useRef(null),r=Ww.map(f=>({id:f,name:n(`mode.listLabel.${f}`),description:n(`mode.desc.${f}`)})),i=r.findIndex(f=>f.id===e),[o,a]=p.useState(i>=0?i:0),l=p.useRef(!1);p.useEffect(()=>{l.current||i<0||a(i)},[i]);const c=f=>{l.current=!0,a(f)},d=f=>{const m=r[f];m&&t(m.id)},{keyboardMode:h}=od({itemCount:r.length,activeIndex:o,onActiveIndexChange:c,onConfirm:d});return p.useEffect(()=>{var m;const f=(m=s.current)==null?void 0:m.children[o];f==null||f.scrollIntoView({block:"nearest"})},[o]),u.jsx("div",{className:`${Yc.list} ${h?Yc.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((f,m)=>{const g=m===o,y=f.id===e;return u.jsxs("div",{id:`mode-opt-${m}`,role:"option","aria-selected":y,className:`${Yc.row} ${g?Yc.selected:""} ${y?$e("dialog-current"):""}`,"data-web-shell-approval-mode-option":!0,"data-mode-id":f.id,onClick:()=>d(m),onMouseMove:()=>c(m),children:[u.jsx("span",{className:Yc.modeIcon,children:u.jsx(TS,{mode:f.id})}),u.jsxs("span",{className:Yc.modeText,children:[u.jsx("span",{className:Yc.modeName,children:f.name}),u.jsx("span",{className:Yc.modeDesc,children:f.description})]})]},f.id)})})}function Gv(e){const[t,n]=p.useState(""),[s,r]=p.useState(""),i=p.useRef(!1),o=p.useRef(""),a=p.useRef(e);a.current=e;const l=p.useCallback(f=>{var m;f!==o.current&&(o.current=f,r(f),(m=a.current)==null||m.call(a,f))},[]),c=p.useCallback(f=>{const m=f.target.value;n(m),i.current||l(m)},[l]),d=p.useCallback(()=>{i.current=!0},[]),h=p.useCallback(f=>{i.current=!1;const m=f.currentTarget.value;n(m),l(m)},[l]);return{filterValue:s,inputProps:{value:t,onChange:c,onCompositionStart:d,onCompositionEnd:h}}}function xw(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 H8({session:e,active:t,current:n,confirmed:s,disabled:r,currentLabel:i,optionId:o,ariaSelected:a,leading:l,trailing:c,resumeSelector:d,onClick:h,onActivate:f}){const{t:m}=it(),g=e.updatedAt||e.createdAt;return u.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":r||void 0,className:$e("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:f,children:[u.jsxs("div",{className:$e("picker-item-row"),children:[l,u.jsx("span",{className:$e("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),c]}),u.jsxs("div",{className:$e("picker-item-meta"),children:[u.jsx("span",{children:g&&xw(g,m)}),u.jsx("span",{className:$e("picker-item-detail"),children:m("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&u.jsx("span",{className:$e("picker-item-detail"),children:m("resume.activePrompt")})]})]})}const CS="resume-session-list",WN=e=>`${CS}-opt-${e}`;function uTe({onSelect:e,onClose:t}){const{t:n}=it(),s=Ta(),{sessions:r,loading:i,error:o}=nh({autoLoad:!0}),a=s.sessionId,[l,c]=p.useState(-1),{filterValue:d,inputProps:h}=Gv(()=>c(-1)),f=p.useRef(null),m=p.useRef(null),g=d?r.filter(w=>{const v=d.toLowerCase();return(w.displayName||"").toLowerCase().includes(v)||w.sessionId.toLowerCase().includes(v)}):r;p.useEffect(()=>{l>=g.length&&g.length>0&&c(g.length-1)},[g.length,l]),p.useEffect(()=>{var v;const w=(v=f.current)==null?void 0:v.children[l];w==null||w.scrollIntoView({block:"nearest"})},[l]);const y=w=>{const v=g[w];v&&(e(v.sessionId),t())},{keyboardMode:b}=od({itemCount:g.length,activeIndex:l,onActiveIndexChange:c,onConfirm:y});return p.useEffect(()=>{var w;(w=m.current)==null||w.focus()},[]),u.jsxs("div",{className:$e("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[u.jsxs("div",{className:$e("picker-search"),children:[u.jsxs("span",{className:$e("picker-search-label"),children:[n("resume.search"),":"," "]}),u.jsx("input",{ref:m,className:$e("picker-search-input"),"aria-label":n("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":CS,"aria-activedescendant":l>=0&&l<g.length?WN(l):void 0,...h,placeholder:""})]}),u.jsx("div",{className:$e("picker-sep")}),u.jsxs("div",{id:CS,role:"listbox",className:$e("picker-list",b?"picker-keyboard-only":void 0),ref:f,children:[i&&u.jsx("div",{className:$e("picker-empty"),children:n("common.loading")}),!i&&o&&u.jsx("div",{className:$e("picker-empty"),children:o.message||n("resume.failedToLoad")}),!i&&!o&&g.length===0&&u.jsx("div",{className:$e("picker-empty"),children:d?n("resume.noMatch",{query:d}):n("resume.none")}),!i&&g.map((w,v)=>u.jsx(H8,{session:w,optionId:WN(v),active:v===l,current:w.sessionId===a,currentLabel:n("resume.current"),resumeSelector:!0,onClick:()=>y(v),onActivate:()=>c(v)},w.sessionId))]})]})}const dTe="_layout_1sigx_1",hTe="_list_1sigx_9",fTe="_row_1sigx_23",mTe="_selected_1sigx_39",pTe="_keyboardOnly_1sigx_46",gTe="_label_1sigx_54",yTe="_divider_1sigx_58",bTe="_number_1sigx_65",wTe="_provider_1sigx_71",vTe="_badge_1sigx_86",xTe="_detail_1sigx_92",_Te="_detailRow_1sigx_104",kTe="_detailLabel_1sigx_111",STe="_detailValue_1sigx_117",TTe="_empty_1sigx_122",Vi={layout:dTe,list:hTe,row:fTe,selected:mTe,keyboardOnly:pTe,label:gTe,divider:yTe,number:bTe,provider:wTe,badge:vTe,detail:xTe,detailRow:_Te,detailLabel:kTe,detailValue:STe,empty:TTe};function CTe(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function ATe(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 GN(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function ETe(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function MTe(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function NTe(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function Z1({label:e,value:t}){return u.jsxs("div",{className:Vi.detailRow,children:[u.jsx("span",{className:Vi.detailLabel,children:e}),u.jsx("span",{className:Vi.detailValue,children:t})]})}function ITe({mode:e="main",onSelect:t,models:n,currentModelId:s}){const r=Ta(),i=s??r.currentModel??"",o=p.useMemo(()=>n??r.models??[],[n,r.models]),{t:a}=it(),l=p.useRef(null),c=e==="fast",d=e==="voice",h=e==="vision",f=o.findIndex(C=>C.id===i),[m,g]=p.useState(f>=0?f:0),y=p.useRef(!1);p.useEffect(()=>{y.current||o.length===0||g(f>=0?f:0)},[o.length,f]);const b=C=>{y.current=!0,g(C)};p.useEffect(()=>{m>=o.length&&o.length>0&&g(o.length-1)},[o.length,m]);const w=o[m]??o[0],v=C=>{const A=o[C];A&&t(NTe(A,c))},{keyboardMode:x}=od({itemCount:o.length,activeIndex:m,onActiveIndexChange:b,onConfirm:v});return p.useEffect(()=>{var A;const C=(A=l.current)==null?void 0:A.children[m];C==null||C.scrollIntoView({block:"nearest"})},[m]),u.jsxs("div",{className:Vi.layout,children:[u.jsxs("div",{className:`${Vi.list} ${x?Vi.keyboardOnly:""}`,ref:l,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${m}`:void 0,"aria-label":a(c?"model.setFast":d?"model.setVoice":h?"model.setVision":"model.select"),"data-web-shell-model-dialog":!0,children:[o.length===0?u.jsx("div",{className:Vi.empty,children:a("model.none")}):null,o.map((C,A)=>{const T=A===m,_=A===f,R=GN(C);return u.jsxs("div",{id:`model-opt-${A}`,role:"option","aria-selected":_,className:`${Vi.row} ${T?Vi.selected:""} ${_?$e("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":C.id,onClick:()=>v(A),onMouseMove:()=>b(A),children:[u.jsxs("span",{className:Vi.number,children:[A+1,"."]}),R?u.jsxs("span",{className:Vi.provider,children:["[",R,"]"]}):null,u.jsx("span",{className:Vi.label,children:ETe(C)}),C.isRuntime?u.jsx("span",{className:Vi.badge,children:a("common.runtime")}):null]},MTe(C))})]}),w?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Vi.divider}),u.jsxs("div",{className:Vi.detail,children:[u.jsx(Z1,{label:a("model.modality"),value:ATe(w.modalities,a)}),u.jsx(Z1,{label:a("model.contextWindow"),value:CTe(w.contextWindow,a)}),GN(w)!=="qwen-oauth"?u.jsxs(u.Fragment,{children:[u.jsx(Z1,{label:a("model.baseUrl"),value:w.baseUrl??a("model.default")}),u.jsx(Z1,{label:a("model.apiKey"),value:w.envKey??a("model.notSet")})]}):null]})]}):null]})}function U8(e){return e.replace(/[：:\s]+$/u,"")}const jTe="_panel_irhhk_1",RTe="_embedded_irhhk_13",LTe="_footer_irhhk_21",DTe="_titleLine_irhhk_25",OTe="_icon_irhhk_32",BTe="_title_irhhk_25",PTe="_subtitle_irhhk_44",$Te="_text_irhhk_49",zTe="_options_irhhk_55",FTe="_option_irhhk_55",qTe="_optionActive_irhhk_77",HTe="_optionLabel_irhhk_81",UTe="_optionIcon_irhhk_86",VTe="_optionContent_irhhk_119",WTe="_optionDesc_irhhk_129",GTe="_badge_irhhk_135",KTe="_toolDetail_irhhk_170",YTe="_toolDetailTitle_irhhk_175",QTe="_toolDetailBody_irhhk_180",XTe="_toolList_irhhk_181",JTe="_textInput_irhhk_193",ZTe="_textArea_irhhk_211",eCe="_summary_irhhk_231",tCe="_summaryRow_irhhk_238",nCe="_summaryLabel_irhhk_244",sCe="_summaryValue_irhhk_250",rCe="_summaryBlockTitle_irhhk_255",iCe="_summaryBlock_irhhk_255",oCe="_manageList_irhhk_295",aCe="_manageItem_irhhk_301",lCe="_manageItemExpanded_irhhk_307",cCe="_manageRow_irhhk_312",uCe="_manageRowActive_irhhk_329",dCe="_manageIcon_irhhk_333",hCe="_manageName_irhhk_362",fCe="_levelTag_irhhk_370",mCe="_manageChevron_irhhk_380",pCe="_manageChevronExpanded_irhhk_398",gCe="_manageDetail_irhhk_402",yCe="_manageDetailInner_irhhk_409",bCe="_manageDetailHeader_irhhk_419",wCe="_manageActions_irhhk_426",vCe="_manageButton_irhhk_433",xCe="_dangerButton_irhhk_453",_Ce="_deleteText_irhhk_457",kCe="_viewerRow_irhhk_487",SCe="_viewerLabel_irhhk_500",TCe="_viewerField_irhhk_507",CCe="_viewerSectionTitle_irhhk_512",ACe="_viewerBlock_irhhk_518",ECe="_closed_irhhk_524",MCe="_closedText_irhhk_528",NCe="_loading_irhhk_534",ICe="_error_irhhk_539",jCe="_createWizard_irhhk_545",RCe="_createSteps_irhhk_551",LCe="_createStepPill_irhhk_559",DCe="_createStepPillActive_irhhk_571",OCe="_createStepPillDone_irhhk_576",BCe="_createStepNumber_irhhk_580",PCe="_createStepLabel_irhhk_591",$Ce="_createBody_irhhk_597",zCe="_createActions_irhhk_601",Be={panel:jTe,embedded:RTe,footer:LTe,titleLine:DTe,icon:OTe,title:BTe,subtitle:PTe,text:$Te,options:zTe,option:FTe,optionActive:qTe,optionLabel:HTe,optionIcon:UTe,optionContent:VTe,optionDesc:WTe,badge:GTe,toolDetail:KTe,toolDetailTitle:YTe,toolDetailBody:QTe,toolList:XTe,textInput:JTe,textArea:ZTe,summary:eCe,summaryRow:tCe,summaryLabel:nCe,summaryValue:sCe,summaryBlockTitle:rCe,summaryBlock:iCe,manageList:oCe,manageItem:aCe,manageItemExpanded:lCe,manageRow:cCe,manageRowActive:uCe,manageIcon:dCe,manageName:hCe,levelTag:fCe,manageChevron:mCe,manageChevronExpanded:pCe,manageDetail:gCe,manageDetailInner:yCe,manageDetailHeader:bCe,manageActions:wCe,manageButton:vCe,dangerButton:xCe,deleteText:_Ce,viewerRow:kCe,viewerLabel:SCe,viewerField:TCe,viewerSectionTitle:CCe,viewerBlock:ACe,closed:ECe,closedText:MCe,loading:NCe,error:ICe,createWizard:jCe,createSteps:RCe,createStepPill:LCe,createStepPillActive:DCe,createStepPillDone:OCe,createStepNumber:BCe,createStepLabel:PCe,createBody:$Ce,createActions:zCe};function lq(e){if(e==="project")return"workspace";if(e==="user")return"global"}function cq(e){return lq(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function FCe(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}const wl=U8;function qCe(e){return e.displayName||e.name}function uq(e){const t=e.toLowerCase();return["read","grep","glob","ls","list","search","fetch","webfetch","web_fetch","websearch","web_search","think","todo","context"].some(n=>t.includes(n))}function dq(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function hq(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function HCe(e,t){if(!t||t.length===0)return 0;const n=new Set(t),s=e.findIndex(r=>r.id==="all"||r.tools.length!==n.size?!1:r.tools.every(i=>n.has(i)));return s>=0?s:0}function UCe({mode:e,embedded:t=!1,onMessage:n,onClose:s}){const{t:r}=it(),{agents:i,loading:o,reload:a,getAgent:l,createAgent:c,generateAgent:d,deleteAgent:h}=GY({autoLoad:!0}),{tools:f}=TD({autoLoad:!0}),[m,g]=p.useState(!1),[y,b]=p.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[w,v]=p.useState(0),[x,C]=p.useState(0),[A,T]=p.useState(null),[_,R]=p.useState(null),[I,k]=p.useState(!1),[j,N]=p.useState(null),[L,$]=p.useState(1),[F,B]=p.useState(()=>e==="create-user"?"global":"workspace"),[Q,Y]=p.useState("manual"),[ne,P]=p.useState(""),[le,z]=p.useState(""),[M,re]=p.useState(""),[U,W]=p.useState([]),[J,G]=p.useState(0),[te,H]=p.useState(!1),[ie,fe]=p.useState(!1),Ne=p.useRef(0),Ie=p.useCallback(()=>{g(!0),s()},[s]),Ce=p.useMemo(()=>{const gt=i.filter(_e=>_e.level==="project"),St=i.filter(_e=>_e.level==="user"),ft=i.filter(_e=>_e.level==="builtin"),de=i.filter(_e=>_e.level==="extension");return{project:gt,user:St,builtin:ft,extension:de}},[i]),ve=p.useMemo(()=>[...Ce.project,...Ce.user,...Ce.builtin,...Ce.extension],[Ce]),ut=p.useMemo(()=>{const gt=f.filter(_e=>_e.enabled).map(qCe).sort((_e,Ue)=>_e.localeCompare(Ue)),St=gt.filter(uq),ft=gt.filter(dq),de=gt.filter(hq);return[{id:"all",label:r("agent.create.tools.all"),tools:[]},{id:"read",label:r("agent.create.tools.readOnly"),tools:St},{id:"edit",label:r("agent.create.tools.readEdit"),tools:[...new Set([...St,...ft])]},{id:"execute",label:r("agent.create.tools.readEditExecute"),tools:[...new Set([...St,...ft,...de])]}]},[r,f]);p.useEffect(()=>{if(y!=="manage")return;const gt=_!==null?ve[_]:void 0;gt&&l(gt.name).then(T).catch(St=>N(St instanceof Error?St.message:String(St)))},[y,ve,_,l]),p.useEffect(()=>{x>=ve.length&&ve.length>0&&C(ve.length-1),_!==null&&_>=ve.length&&R(null)},[_,ve.length,x]);const ae=p.useCallback((gt=x)=>{const St=ve[gt];if(!St||!cq(St))return;const ft=lq(St.level);ft&&(k(!0),h(St.name,ft).then(()=>{n(r("agent.deleted",{name:St.name})),T(null),R(null),C(0),a()}).catch(de=>N(de instanceof Error?de.message:String(de))).finally(()=>k(!1)))},[ve,x,h,n,a,r]),Ct=p.useCallback(()=>{if(!ne.trim()||!le.trim()||!M.trim()){N(r("agent.create.required"));return}k(!0),c({name:ne.trim(),description:le.trim(),systemPrompt:M.trim(),scope:F,tools:U}).then(gt=>{n(r("agent.created",{name:gt.agent.name})),Ie()}).catch(gt=>N(gt instanceof Error?gt.message:String(gt))).finally(()=>k(!1))},[ne,le,M,F,U,c,n,Ie,r]),Ke=p.useCallback(async()=>{const gt=le.trim();if(!gt||te)return;const St=Ne.current+1;Ne.current=St,H(!0),fe(!1),N(null);try{const ft=await d(gt);if(Ne.current!==St)return;P(ft.name),z(ft.description),re(ft.systemPrompt),$(Q==="manual"?6:4),G(0)}catch(ft){if(Ne.current!==St)return;N(r("agent.create.generateFailed",{error:ft instanceof Error?ft.message:String(ft)})),fe(!0)}finally{Ne.current===St&&H(!1)}},[le,te,Q,d,r]),on=p.useCallback(gt=>{if(gt==="name"&&ne.trim())$(4),fe(!0);else if(gt==="prompt"&&M.trim())$(5),fe(!0);else if(gt==="desc"&&le.trim()){if(Q==="qwen"){Ke();return}$(Q==="manual"?6:4),G(0),fe(!1)}},[ne,le,M,Q,Ke]);if(m)return u.jsx("div",{className:`${Be.panel} ${t?Be.embedded:""} ${Be.closed}`,children:u.jsx("div",{className:Be.closedText,children:r("agents.closed")})});if(o&&i.length===0)return u.jsxs("div",{className:`${Be.panel} ${t?Be.embedded:""}`,children:[u.jsxs("div",{className:Be.titleLine,children:[u.jsx("span",{className:Be.icon,children:"?"}),u.jsx("span",{className:Be.title,children:r("agents.title")})]}),u.jsx("div",{className:Be.loading,children:r("common.loading")})]});const qt=r("agents.title");return u.jsxs("div",{className:`${Be.panel} ${t?Be.embedded:""}`,children:[!t&&y!=="create"&&u.jsxs("div",{className:Be.titleLine,children:[u.jsx("span",{className:Be.icon,children:"?"}),u.jsx("span",{className:Be.title,children:qt}),u.jsx("span",{className:Be.subtitle,children:r("agent.count",{count:i.length})})]}),j&&u.jsx("div",{className:Be.error,children:j}),y==="menu"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.text,children:r("agent.selectAction")}),u.jsxs("div",{className:Be.options,children:[u.jsx(Rd,{idx:0,active:w===0,label:r("agent.manage"),desc:r("agent.manage.desc"),onClick:()=>{v(0),b("manage")},onHover:()=>v(0)}),u.jsx(Rd,{idx:1,active:w===1,label:r("agent.create"),desc:r("agent.create.desc"),onClick:()=>{v(1),b("create")},onHover:()=>v(1)})]}),u.jsx("div",{className:Be.footer,children:r("agent.footer.nav")})]}),y==="manage"&&u.jsx(VCe,{agents:ve,expandedAgentIdx:_,selectedAgent:A,busy:I,onToggleAgent:gt=>{C(gt),R(St=>St===gt?null:gt),T(null)},onDelete:gt=>{I||ae(gt)},t:r}),y==="create"&&u.jsx(WCe,{step:L,method:Q,scope:F,name:ne,desc:le,prompt:M,tools:U,toolCategories:ut,selIdx:J,busy:I,generating:te,inputFocused:ie,onSetName:P,onSetDesc:z,onSetPrompt:re,onInputNext:on,onInputFocus:()=>fe(!0),onInputBlur:()=>fe(!1),onSetStep:$,onSetSelectedIndex:G,onSelectLocation:gt=>{G(gt),B(gt===0?"workspace":"global")},onSelectMethod:gt=>{G(gt),Y(gt===0?"qwen":"manual")},onSelectTools:gt=>{var St;G(gt),W(((St=ut[gt])==null?void 0:St.tools)??[])},onSave:()=>{I||Ct()},t:r})]})}function Rd({idx:e,active:t,label:n,desc:s,badge:r,numbered:i=!1,onClick:o,onHover:a}){return u.jsxs("div",{className:`${Be.option} ${t?Be.optionActive:""}`,onClick:o,onMouseEnter:a,children:[u.jsx("span",{className:Be.optionIcon,"aria-hidden":"true"}),u.jsxs("span",{className:Be.optionContent,children:[u.jsxs("span",{className:Be.optionLabel,children:[i?`${e+1}. `:"",n,r&&u.jsx("span",{className:Be.badge,children:r})]}),s&&u.jsx("span",{className:Be.optionDesc,children:s})]})]})}function VCe({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:s,onToggleAgent:r,onDelete:i,t:o}){const[a,l]=p.useState(null),c=p.useMemo(()=>new Set(e.filter(d=>d.level==="project").map(d=>d.name)),[e]);return e.length===0?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.text,children:o("agent.empty")}),u.jsx("div",{className:Be.text,children:o("agent.createFirstHint")})]}):u.jsx("div",{className:Be.manageList,children:e.map((d,h)=>{const f=t===h,m=f&&(n==null?void 0:n.name)===d.name?n:null,g=cq(d),y=(m==null?void 0:m.tools)??[],b=y.length===0||y.includes("*")?o("agent.create.tools.all"):y.join(", ");return u.jsxs("div",{className:`${Be.manageItem} ${f?Be.manageItemExpanded:""}`,children:[u.jsxs("button",{type:"button",className:`${Be.manageRow} ${f?Be.manageRowActive:""}`,onClick:()=>{l(null),r(h)},children:[u.jsx("span",{className:Be.manageIcon,"aria-hidden":"true"}),u.jsx("span",{className:Be.manageName,children:d.name}),u.jsx("span",{className:Be.levelTag,children:FCe(d.level,o)}),d.level==="user"&&c.has(d.name)?u.jsx("span",{className:Be.levelTag,children:o("agent.overriddenBadge")}):null,u.jsx("span",{className:`${Be.manageChevron} ${f?Be.manageChevronExpanded:""}`})]}),f?u.jsx("div",{className:Be.manageDetail,children:m?u.jsxs("div",{className:Be.manageDetailInner,children:[u.jsx("div",{className:Be.manageDetailHeader,children:g?u.jsx("div",{className:Be.manageActions,children:a===h?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Be.deleteText,children:s?o("agent.delete.loading"):o("agent.delete.confirm",{name:d.name})}),u.jsx("button",{type:"button",className:Be.manageButton,onClick:()=>l(null),disabled:s,children:o("common.cancel")}),u.jsx("button",{type:"button",className:`${Be.manageButton} ${Be.dangerButton}`,onClick:()=>i(h),disabled:s,children:o("agent.action.delete")})]}):u.jsx("button",{type:"button",className:`${Be.manageButton} ${Be.dangerButton}`,onClick:()=>l(h),disabled:s,children:o("agent.action.delete")})}):null}),u.jsxs("div",{className:Be.viewerField,children:[u.jsx("div",{className:Be.viewerSectionTitle,children:wl(o("agent.toolsLabel"))}),u.jsx("div",{className:Be.viewerBlock,children:b})]}),u.jsxs("div",{className:Be.viewerField,children:[u.jsx("div",{className:Be.viewerSectionTitle,children:wl(o("agent.filePathLabel"))}),u.jsx("div",{className:Be.viewerBlock,children:m.filePath||"—"})]}),m.model?u.jsxs("div",{className:Be.viewerRow,children:[u.jsx("span",{className:Be.viewerLabel,children:wl(o("agent.modelLabel"))}),u.jsx("span",{children:m.model})]}):null,u.jsxs("div",{className:Be.viewerField,children:[u.jsx("div",{className:Be.viewerSectionTitle,children:wl(o("agent.descriptionLabel"))}),u.jsx("div",{className:Be.viewerBlock,children:m.description||"—"})]}),u.jsxs("div",{className:Be.viewerField,children:[u.jsx("div",{className:Be.viewerSectionTitle,children:wl(o("agent.systemPromptLabel"))}),u.jsx("div",{className:Be.viewerBlock,children:m.systemPrompt||"—"})]})]}):u.jsx("div",{className:Be.loading,children:o("common.loading")})}):null]},`${d.level}:${d.name}`)})})}function WCe({step:e,method:t,scope:n,name:s,desc:r,prompt:i,tools:o,toolCategories:a,selIdx:l,busy:c,generating:d,inputFocused:h,onSetName:f,onSetDesc:m,onSetPrompt:g,onInputNext:y,onInputFocus:b,onInputBlur:w,onSetStep:v,onSetSelectedIndex:x,onSelectLocation:C,onSelectMethod:A,onSelectTools:T,onSave:_,t:R}){const I=p.useRef(null),k=p.useRef(null),j=p.useRef(null);p.useEffect(()=>{var le,z,M,re;h&&(t==="manual"?e===3?(le=I.current)==null||le.focus():e===4?(z=j.current)==null||z.focus():e===5&&((M=k.current)==null||M.focus()):e===3&&((re=k.current)==null||re.focus()))},[e,t,h]);const N=t==="manual"?6:4,L=N+1,$=t==="manual"?[R("agent.create.location"),R("agent.create.method"),R("agent.create.name"),R("agent.create.prompt"),R("agent.create.description"),R("agent.create.toolsSelection")]:[R("agent.create.location"),R("agent.create.method"),R("agent.create.describeAgent"),R("agent.create.toolsSelection")],F=le=>le===1?n==="workspace"?0:1:le===2?t==="qwen"?0:1:le===N?HCe(a,o):0,B=le=>{v(le),x(F(le)),t==="manual"&&(le===3||le===4||le===5)||t==="qwen"&&le===3?b():w()},Q=()=>{e<=1||d||B(e-1)},Y=()=>{if(!d){if(e===1){B(2);return}if(e===2){B(3);return}if(t==="manual"&&e===3){y("name");return}if(t==="manual"&&e===4){y("prompt");return}if(t==="manual"&&e===5||t==="qwen"&&e===3){y("desc");return}e===N&&(T(l),B(L))}},ne=d||t==="manual"&&e===3&&!s.trim()||t==="manual"&&e===4&&!i.trim()||t==="manual"&&e===5&&!r.trim()||t==="qwen"&&e===3&&!r.trim();let P=null;if(e===1&&(P=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Be.options,children:[u.jsx(Rd,{idx:0,active:l===0,label:R("agent.create.project.cli"),numbered:!0,onClick:()=>C(0)}),u.jsx(Rd,{idx:1,active:l===1,label:R("agent.create.user.cli"),numbered:!0,onClick:()=>C(1)})]})})),e===2&&(P=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Be.options,children:[u.jsx(Rd,{idx:0,active:l===0,label:R("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>A(0)}),u.jsx(Rd,{idx:1,active:l===1,label:R("agent.create.method.manual"),numbered:!0,onClick:()=>A(1)})]})})),t==="manual"&&e===3&&(P=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.text,children:R("agent.create.nameHelp")}),u.jsx("input",{ref:I,className:Be.textInput,value:s,onChange:le=>f(le.target.value),onFocus:b,onBlur:w,placeholder:R("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(P=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.text,children:R("agent.create.promptHelp")}),u.jsx("textarea",{ref:j,className:Be.textArea,value:i,onChange:le=>g(le.target.value),onFocus:b,onBlur:w,placeholder:R("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(P=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.text,children:R("agent.create.manualDescHelp")}),u.jsx("textarea",{ref:k,className:Be.textArea,value:r,onChange:le=>m(le.target.value),onFocus:b,onBlur:w,placeholder:R("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(P=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.text,children:R("agent.create.qwenHint")}),d?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.text,children:R("agent.create.generatingConfig")}),u.jsx("div",{className:Be.footer,children:R("agent.footer.generating")})]}):u.jsx(u.Fragment,{children:u.jsx("textarea",{ref:k,className:Be.textArea,value:r,onChange:le=>m(le.target.value),onFocus:b,onBlur:w,placeholder:R("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===N){const le=a[l]??a[0],z=(le==null?void 0:le.tools)??[],M=(le==null?void 0:le.id)==="all"?R("agent.create.tools.allInfo"):z.length>0?z.join(", "):R("agent.create.tools.none"),re=z.filter(uq),U=z.filter(dq),W=z.filter(hq);P=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.options,children:a.map((J,G)=>u.jsx(Rd,{idx:G,active:l===G,label:J.label,numbered:!0,onClick:()=>T(G)},J.id))}),u.jsx("div",{className:Be.toolDetail,children:(le==null?void 0:le.id)==="all"?u.jsx("div",{className:Be.toolDetailBody,children:M}):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Be.toolDetailTitle,children:R("agent.create.tools.selected")}),u.jsx("div",{className:Be.toolList,children:z.length===0?M:u.jsxs(u.Fragment,{children:[re.length>0&&u.jsxs("div",{children:[R("agent.create.tools.readOnlyLabel")," ",re.join(", ")]}),U.length>0&&u.jsxs("div",{children:[R("agent.create.tools.editLabel")," ",U.join(", ")]}),W.length>0&&u.jsxs("div",{children:[R("agent.create.tools.executionLabel")," ",W.join(", ")]})]})})]})})]})}if(e===L){const le=o.length===0?"*":o.join(", ");P=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Be.summary,children:[u.jsxs("div",{className:Be.summaryRow,children:[u.jsx("span",{className:Be.summaryLabel,children:wl(R("agent.create.name"))}),u.jsx("span",{className:Be.summaryValue,children:s||"—"})]}),u.jsxs("div",{className:Be.summaryRow,children:[u.jsx("span",{className:Be.summaryLabel,children:wl(R("agent.location"))}),u.jsx("span",{className:Be.summaryValue,children:R(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),u.jsxs("div",{className:Be.summaryRow,children:[u.jsx("span",{className:Be.summaryLabel,children:wl(R("agent.toolsLabel"))}),u.jsx("span",{className:Be.summaryValue,children:le})]}),u.jsx("div",{className:Be.summaryBlockTitle,children:wl(R("agent.descriptionLabel"))}),u.jsx("div",{className:Be.summaryBlock,children:r||"—"}),u.jsx("div",{className:Be.summaryBlockTitle,children:wl(R("agent.systemPromptLabel"))}),u.jsx("div",{className:Be.summaryBlock,children:i||"—"})]})})}return u.jsxs("div",{className:Be.createWizard,children:[u.jsx("div",{className:Be.createSteps,children:$.map((le,z)=>{const M=z+1;return u.jsxs("div",{className:`${Be.createStepPill} ${M===Math.min(e,N)?Be.createStepPillActive:""} ${M<Math.min(e,N)?Be.createStepPillDone:""}`,children:[u.jsx("span",{className:Be.createStepNumber,children:M}),u.jsx("span",{className:Be.createStepLabel,children:le})]},`${M}:${le}`)})}),u.jsx("div",{className:Be.createBody,children:P}),u.jsxs("div",{className:Be.createActions,children:[u.jsx("button",{type:"button",className:Be.manageButton,onClick:Q,disabled:e<=1||d||c,children:R("common.previous")}),e===L?u.jsx("button",{type:"button",className:Be.manageButton,onClick:_,disabled:c,children:R(c?"agent.create.loading":"agent.create.save")}):u.jsx("button",{type:"button",className:Be.manageButton,onClick:Y,disabled:ne,children:R("common.next")})]})]})}const GCe="_page_1np31_1",KCe="_tabs_1np31_11",YCe="_memoryCard_1np31_19",QCe="_memoryCardActive_1np31_35",XCe="_memoryTitle_1np31_44",JCe="_detailPath_1np31_48",ZCe="_status_1np31_49",e9e="_actionButton_1np31_54",t9e="_primaryButton_1np31_55",n9e="_secondaryButton_1np31_56",s9e="_detail_1np31_48",r9e="_detailHeader_1np31_79",i9e="_detailTitleWrap_1np31_87",o9e="_actions_1np31_91",a9e="_content_1np31_105",l9e="_editor_1np31_106",c9e="_editorFooter_1np31_127",ai={page:GCe,tabs:KCe,memoryCard:YCe,memoryCardActive:QCe,memoryTitle:XCe,detailPath:JCe,status:ZCe,actionButton:e9e,primaryButton:t9e,secondaryButton:n9e,detail:s9e,detailHeader:r9e,detailTitleWrap:i9e,actions:o9e,content:a9e,editor:l9e,editorFooter:c9e};function KN(e,t){return e.find(n=>n.scope===t)}function YN(e,t){return t(e==="global"?"memory.global":"memory.project")}function u9e({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:s}){var P,le;const{t:r}=it(),{files:i,loading:o,error:a,readFile:l,reload:c,writeMemory:d}=KY({autoLoad:!0}),h=p.useRef(null),f=p.useRef(0),[m,g]=p.useState("workspace"),[y,b]=p.useState("view"),[w,v]=p.useState(""),[x,C]=p.useState(""),[A,T]=p.useState(!1),[_,R]=p.useState(!1),[I,k]=p.useState(null),j=p.useRef(0),N=p.useMemo(()=>{const z=KN(i,"global"),M=KN(i,"workspace");return[{scope:"workspace",title:r("memory.project"),description:r("memory.project.desc"),fallbackPath:"QWEN.md",file:M},{scope:"global",title:r("memory.global"),description:r("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:z}]},[i,r]),L=N.find(z=>z.scope===m)??N[0],$=p.useCallback((z,M)=>{const re=++f.current;if(b(M),k(null),v(""),C(""),!(z!=null&&z.file)){M==="edit"&&requestAnimationFrame(()=>{var U;return(U=h.current)==null?void 0:U.focus()});return}T(!0),l(z.file.path).then(U=>{re===f.current&&(v(U.content),C(U.content),U.truncated&&k(r("memory.fileTruncated")),requestAnimationFrame(()=>{var W;return(W=h.current)==null?void 0:W.focus()}))}).catch(U=>{if(re!==f.current)return;const W=U instanceof Error?U.message:String(U);k(W),z.scope!=="global"&&(s==null||s(W,"error"))}).finally(()=>{re===f.current&&T(!1)})},[s,l,r]);p.useEffect(()=>{L&&$(L,y)},[(P=L==null?void 0:L.file)==null?void 0:P.path,L==null?void 0:L.scope]),p.useEffect(()=>{a&&k(a.message)},[a]),p.useEffect(()=>{e<=0||c().then(()=>k(r("memory.refreshed"))).catch(z=>{const M=z instanceof Error?z.message:String(z);k(M),s==null||s(M,"error")})},[s,e,c,r]),p.useEffect(()=>{if(t<=0||j.current===t)return;j.current=t;const z=n==="global"?"global":"workspace";g(z);const M=N.find(re=>re.scope===z);$(M,"edit")},[n,t,N,$]);const F=z=>{g(z.scope),$(z,"view")},B=()=>{L&&$(L,"edit")},Q=()=>{if(L){if(!x.trim()){k(r("memory.contentEmpty"));return}R(!0),k(null),d({scope:L.scope,mode:"replace",content:x}).then(z=>{const M=r("memory.saved",{scope:YN(L.scope,r),bytes:z.bytesWritten,path:z.filePath});v(x),b("view"),k(M),s==null||s(M,"status"),c().catch(()=>{})}).catch(z=>{const M=z instanceof Error?z.message:String(z);k(M),s==null||s(M,"error")}).finally(()=>R(!1))}},Y=((le=L==null?void 0:L.file)==null?void 0:le.path)??(L==null?void 0:L.fallbackPath)??"",ne=I??(o?r("memory.loading"):null);return u.jsxs("div",{className:ai.page,children:[u.jsx("nav",{className:ai.tabs,"aria-label":r("memory.menu"),children:N.map(z=>{const M=z.scope===m;return u.jsx("button",{type:"button",className:`${ai.memoryCard} ${M?ai.memoryCardActive:""}`,onClick:()=>F(z),children:u.jsx("span",{className:ai.memoryTitle,children:z.title})},z.scope)})}),u.jsxs("section",{className:ai.detail,children:[u.jsxs("header",{className:ai.detailHeader,children:[u.jsx("div",{className:ai.detailTitleWrap,children:u.jsx("div",{className:ai.detailPath,children:Y})}),u.jsx("div",{className:ai.actions,children:u.jsx("button",{type:"button",className:ai.actionButton,onClick:B,children:r("settings.action.edit")})})]}),ne&&u.jsx("div",{className:ai.status,children:ne}),y==="edit"?u.jsxs(u.Fragment,{children:[u.jsx("textarea",{ref:h,className:ai.editor,value:x,disabled:_||A,onChange:z=>C(z.target.value),placeholder:r("memory.placeholder",{scope:L?YN(L.scope,r):""})}),u.jsxs("div",{className:ai.editorFooter,children:[u.jsx("button",{type:"button",className:ai.secondaryButton,disabled:_,onClick:()=>{C(w),b("view")},children:r("common.cancel")}),u.jsx("button",{type:"button",className:ai.primaryButton,disabled:_||A,onClick:Q,children:r(_?"memory.saving":"memory.save")})]})]}):u.jsx("pre",{className:ai.content,children:A?r("memory.loadingFile"):w||r("memory.noFiles")})]})]})}const d9e="_panel_cxp6w_1",h9e="_steps_cxp6w_10",f9e="_stepPill_cxp6w_18",m9e="_stepPillActive_cxp6w_29",p9e="_stepPillDone_cxp6w_34",g9e="_stepNumber_cxp6w_38",y9e="_stepLabel_cxp6w_49",b9e="_body_cxp6w_55",w9e="_text_cxp6w_59",v9e="_muted_cxp6w_64",x9e="_options_cxp6w_68",_9e="_option_cxp6w_68",k9e="_optionActive_cxp6w_90",S9e="_label_cxp6w_94",T9e="_optionText_cxp6w_98",C9e="_description_cxp6w_112",A9e="_input_cxp6w_119",E9e="_preview_cxp6w_135",M9e="_error_cxp6w_146",N9e="_link_cxp6w_150",I9e="_terms_cxp6w_161",j9e="_actions_cxp6w_169",R9e="_actionButton_cxp6w_177",os={panel:d9e,steps:h9e,stepPill:f9e,stepPillActive:m9e,stepPillDone:p9e,stepNumber:g9e,stepLabel:y9e,body:b9e,text:w9e,muted:v9e,options:x9e,option:_9e,optionActive:k9e,label:S9e,optionText:T9e,description:C9e,input:A9e,preview:E9e,error:M9e,link:N9e,terms:I9e,actions:j9e,actionButton:R9e};function L9e(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 c0(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function QN(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function D9e(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 O9e(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 X4(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function B9e({onMessage:e,onClose:t}){const{t:n}=it(),s=Sa(),[r,i]=p.useState("groups"),[o,a]=p.useState(0),[l,c]=p.useState(0),[d,h]=p.useState("providers"),[f,m]=p.useState(0),[g,y]=p.useState(),[b,w]=p.useState("alibaba"),[v,x]=p.useState(null),[C,A]=p.useState("openai"),[T,_]=p.useState(""),[R,I]=p.useState(""),[k,j]=p.useState(""),[N,L]=p.useState(!1),[$,F]=p.useState(!1),[B,Q]=p.useState(!0),[Y,ne]=p.useState(!0),[P,le]=p.useState(!1),[z,M]=p.useState(!1),[re,U]=p.useState(""),[W,J]=p.useState(!0),[G,te]=p.useState(!1),[H,ie]=p.useState(null);p.useEffect(()=>{s.getAuthProviders().then(Me=>{y(Me),J(!1)}).catch(Me=>{ie(Me instanceof Error?Me.message:String(Me)),J(!1)})},[s]);const fe=p.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),Ne=p.useMemo(()=>{var qe;return(((qe=fe.find(Fe=>Fe.id===b))==null?void 0:qe.providerIds)??[]).map(Fe=>g==null?void 0:g.providers.find(Ht=>Ht.id===Fe)).filter(Fe=>!!Fe)},[g,b,fe]),Ie=p.useMemo(()=>(v==null?void 0:v.steps)??[],[v==null?void 0:v.steps]),Ce=Ie[f],ve=(v==null?void 0:v.showAdvancedConfig)===!0,ut=p.useMemo(()=>$?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[$]),ae=ut.indexOf("context"),Ct=Ce==="apiKey"||Ce==="models"||Ce==="baseUrl"&&!Array.isArray(v==null?void 0:v.baseUrl),[Ke,on]=p.useState(0),qt=p.useCallback((Me,qe="providers")=>{var Ht,Mn;x(Me),h(qe);const Fe=((Ht=Me.protocolOptions)==null?void 0:Ht[0])??Me.protocol;A(Fe),typeof Me.baseUrl=="string"?_(Me.baseUrl):Array.isArray(Me.baseUrl)?_(((Mn=Me.baseUrl[0])==null?void 0:Mn.url)??""):_(c0(Fe)),I(""),j(QN(Me)),L(!1),F(!1),Q(!0),ne(!0),le(!1),M(!1),U(""),m(0),on(0),ie(null),i(Me.steps.length>0?"step":"review")},[]),gt=p.useCallback(()=>{if(ie(null),r==="groups"){t();return}if(r==="providers"){i("groups");return}if(r==="review"){if(Ie.length===0){i(d);return}i("step"),m(Math.max(0,Ie.length-1));return}if(f>0){m(Me=>Me-1),on(0);return}i(d)},[t,d,f,Ie.length,r]),St=p.useCallback(()=>{if(!v||G)return;te(!0),ie(null);const Me=Number(re);s.installAuthProvider({providerId:v.id,protocol:C,baseUrl:T,apiKey:R,modelIds:X4(k),advancedConfig:N||$||Number.isFinite(Me)&&Me>0?{...N?{enableThinking:!0}:{},...$?{multimodal:{...B?{image:!0}:{},...Y?{video:!0}:{},...P?{audio:!0}:{},...z?{pdf:!0}:{}}}:{},...Number.isFinite(Me)&&Me>0?{contextWindowSize:Me}:{}}:void 0}).then(qe=>{e(qe.message),t()}).catch(qe=>{const Fe=qe instanceof Error?qe.message:String(qe);ie(Fe),e(Fe,"error")}).finally(()=>te(!1))},[R,T,re,$,P,B,z,Y,k,t,e,C,v,G,N,s]),ft=p.useCallback(()=>{if(v){if(Ce==="baseUrl"){const Me=T.trim()||c0(C);if(!Me){ie(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(Me)){ie(n("auth.baseUrlInvalid"));return}T.trim()||_(Me)}if(Ce==="apiKey"&&R.trim().length===0){ie(n("auth.apiKeyRequired"));return}if(Ce==="models"&&X4(k).length===0){ie(n("auth.modelsRequired"));return}ie(null),f>=Ie.length-1?ve?i("review"):St():(m(Me=>Me+1),on(0))}},[R,T,Ce,k,C,v,St,ve,f,Ie.length,n]),de=p.useCallback(Me=>{switch(Me){case"thinking":L(qe=>!qe);return;case"modality":F(qe=>!qe);return;case"image":Q(qe=>!qe);return;case"video":ne(qe=>!qe);return;case"audio":le(qe=>!qe);return;case"pdf":M(qe=>!qe);return;case"context":ft();return;default:return}},[ft]),_e=p.useCallback(()=>{if(r==="groups"){const Me=fe[o];if(!Me)return;if(Me.id==="custom"){const qe=Me.providerIds.map(Fe=>g==null?void 0:g.providers.find(Ht=>Ht.id===Fe)).find(Fe=>!!Fe);qe&&qt(qe,"groups");return}w(Me.id),c(0),i("providers");return}if(r==="providers"){const Me=Ne[l];Me&&qt(Me,"providers");return}if(r==="review"){St();return}if(!(!v||!Ce)){if(Ce==="protocol"){const Me=(v.protocolOptions??[v.protocol])[Ke];Me&&(A(Me),v.baseUrl||_(c0(Me))),ft();return}if(Ce==="baseUrl"&&Array.isArray(v.baseUrl)){const Me=v.baseUrl[Ke];Me&&_(Me.url),ft();return}if(Ce==="advancedConfig"){de(ut[Ke]);return}ft()}},[Ce,g,ft,o,fe,Ke,v,l,Ne,St,qt,r,de,ut]),Ue=p.useCallback(Me=>{if(r==="groups"){const qe=fe[Me];if(!qe)return;if(qe.id==="custom"){const Fe=qe.providerIds.map(Ht=>g==null?void 0:g.providers.find(Mn=>Mn.id===Ht)).find(Ht=>!!Ht);Fe&&qt(Fe,"groups");return}w(qe.id),c(0),i("providers");return}if(r==="providers"){const qe=Ne[Me];qe&&qt(qe,"providers");return}if(!v||!Ce){r==="review"&&St();return}if(Ce==="protocol"){const qe=(v.protocolOptions??[v.protocol])[Me];qe&&(A(qe),v.baseUrl||_(c0(qe))),ft();return}if(Ce==="baseUrl"&&Array.isArray(v.baseUrl)){const qe=v.baseUrl[Me];qe&&_(qe.url),ft();return}Ce==="advancedConfig"&&de(ut[Me])},[Ce,g,ft,fe,de,ut,v,Ne,St,qt,r]),Xe=(Me,qe,Fe)=>u.jsx("div",{className:os.options,children:Me.map((Ht,Mn)=>u.jsx("button",{type:"button",className:`${os.option} ${qe===Mn?os.optionActive:""}`,onClick:()=>{Fe(Mn),Ue(Mn)},children:u.jsxs("div",{className:os.optionText,children:[u.jsx("div",{className:os.label,children:Ht.label}),Ht.description&&u.jsx("div",{className:os.description,children:Ht.description})]})},Ht.value))}),yt=()=>{if(!v||!Ce)return null;if(Ce==="protocol"){const Fe=v.protocolOptions??[v.protocol];return Xe(L9e(n).filter(Ht=>Fe.includes(Ht.value)),Ke,on)}if(Ce==="baseUrl")return Array.isArray(v.baseUrl)?Xe(v.baseUrl.map(Fe=>({value:Fe.url,label:Fe.label,description:Fe.url})),Ke,on):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:os.text,children:n("auth.baseUrlPrompt")}),u.jsx("input",{className:os.input,value:T,placeholder:c0(C),onChange:Fe=>{_(Fe.target.value),ie(null)},onKeyDown:Fe=>{Fe.key==="Enter"&&(Fe.preventDefault(),Fe.stopPropagation(),ft())},autoFocus:!0}),v.documentationUrl&&u.jsx("a",{className:os.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(Ce==="apiKey")return u.jsxs(u.Fragment,{children:[v.documentationUrl&&u.jsxs("a",{className:os.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",v.documentationUrl]}),u.jsx("input",{className:os.input,type:"password",value:R,placeholder:v.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:Fe=>{I(Fe.target.value),ie(null)},onKeyDown:Fe=>{Fe.key==="Enter"&&(Fe.preventDefault(),Fe.stopPropagation(),ft())},autoFocus:!0})]});if(Ce==="models"){const Fe=QN(v);return u.jsxs(u.Fragment,{children:[Fe&&u.jsx("div",{className:os.muted,children:n("auth.modelsPrompt",{modelIds:Fe})}),u.jsx("input",{className:os.input,value:k,placeholder:Fe||n("auth.modelsPlaceholder"),onChange:Ht=>{j(Ht.target.value),ie(null)},onKeyDown:Ht=>{Ht.key==="Enter"&&(Ht.preventDefault(),Ht.stopPropagation(),ft())},autoFocus:!0})]})}const Me=Fe=>Fe?"◉":"○",qe=[{value:"thinking",label:`${Me(N)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${Me($)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return $&&qe.push({value:"image",label:`${Me(B)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${Me(Y)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${Me(P)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${Me(z)} ${n("auth.advanced.modalityPdf")}`}),qe.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${re||"auto"}`,description:n("auth.advanced.contextDesc")}),u.jsxs(u.Fragment,{children:[u.jsx("div",{className:os.text,children:n("auth.advanced.prompt")}),Xe(qe,Ke,on),u.jsx("input",{className:os.input,value:re,placeholder:n("common.auto"),onChange:Fe=>U(Fe.target.value.replace(/[^0-9]/g,"")),onFocus:()=>on(ae),onKeyDown:Fe=>{Fe.key==="Enter"&&(Fe.preventDefault(),Fe.stopPropagation(),ft())}})]})},ye=p.useMemo(()=>{if(!v)return"";const Me=v.envKey??`${C.toUpperCase()}_API_KEY`,qe=X4(k),Fe={};if(N&&(Fe.extra_body={enable_thinking:!0}),$){const Rn={};B&&(Rn.image=!0),Y&&(Rn.video=!0),P&&(Rn.audio=!0),z&&(Rn.pdf=!0),Object.keys(Rn).length>0&&(Fe.modalities=Rn)}const Ht=Number(re);Number.isFinite(Ht)&&Ht>0&&(Fe.contextWindowSize=Ht);const Mn=Object.keys(Fe).length>0;return JSON.stringify({env:{[Me]:O9e(R,n)},modelProviders:{[C]:qe.map(Rn=>({id:Rn,name:Rn,baseUrl:T.trim(),envKey:Me,...Mn?{generationConfig:Fe}:{}}))},security:{auth:{selectedType:C}},model:{name:qe[0]}},null,2)},[R,T,re,$,P,B,z,Y,k,C,v,n,N]),Kt=p.useMemo(()=>{const Me=[n("auth.step.group"),n("auth.step.provider")];return v&&(Me.push(...Ie.map(qe=>D9e(qe,v,n))),ve&&Me.push(n("auth.review"))),Me},[v,ve,Ie,n]),Ee=p.useMemo(()=>r==="groups"?1:r==="providers"?2:r==="step"?Math.min(3+f,Kt.length):Kt.length,[f,Kt.length,r]),ct=W?u.jsx("div",{className:os.muted,children:n("common.loading")}):r==="groups"?u.jsxs(u.Fragment,{children:[Xe(fe.map(Me=>({value:Me.id,label:n(Me.label),description:n(Me.description)})),o,a),u.jsxs("div",{className:os.terms,children:[u.jsxs("div",{children:[n("auth.termsTitle"),":"]}),u.jsx("a",{className:os.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"?Xe(Ne.map(Me=>({value:Me.id,label:n(Me.label),description:n(Me.description)})),l,c):r==="step"?yt():u.jsxs(u.Fragment,{children:[u.jsx("div",{className:os.text,children:n("auth.reviewText")}),u.jsx("div",{className:os.preview,children:ye})]}),qn=()=>{if(r==="review"){St();return}if(Ct||Ce==="advancedConfig"){ft();return}_e()};return u.jsxs("div",{className:os.panel,children:[u.jsx("div",{className:os.steps,children:Kt.map((Me,qe)=>{const Fe=qe+1;return u.jsxs("div",{className:`${os.stepPill} ${Fe===Ee?os.stepPillActive:""} ${Fe<Ee?os.stepPillDone:""}`,children:[u.jsx("span",{className:os.stepNumber,children:Fe}),u.jsx("span",{className:os.stepLabel,children:Me})]},`${Fe}:${Me}`)})}),u.jsx("div",{className:os.body,children:ct}),H&&u.jsx("div",{className:os.error,children:H}),u.jsxs("div",{className:os.actions,children:[u.jsx("button",{type:"button",className:os.actionButton,onClick:gt,disabled:r==="groups"||W||G,children:n("common.previous")}),u.jsx("button",{type:"button",className:os.actionButton,onClick:qn,disabled:W||G,children:n(r==="review"?G?"auth.saving":"auth.save":"common.next")})]})]})}function P9e(e){return e.displayName||e.name}const fq="tools-list",XN=e=>`${fq}-opt-${e}`;function $9e(){const{t:e}=it(),{status:t,tools:n,loading:s,error:r}=TD({autoLoad:!0}),[i,o]=p.useState(0),[a,l]=p.useState(null),[c,d]=p.useState(()=>new Set),h=p.useRef(null);p.useEffect(()=>{var y,b;r?l(r.message):(b=(y=t==null?void 0:t.errors)==null?void 0:y[0])!=null&&b.error?l(t.errors[0].error):t&&l(null)},[t,r]);const f=p.useCallback(y=>{d(b=>b.has(y.name)?new Set:new Set([y.name]))},[]);p.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),p.useEffect(()=>{var b;const y=(b=h.current)==null?void 0:b.children[i];y==null||y.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:m}=od({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:y=>{const b=n[y];b!=null&&b.description&&f(b)}}),g=p.useMemo(()=>{if(!t)return"";const y=n.filter(b=>b.enabled).length;return e("tools.summary",{enabled:y,total:n.length})},[t,n,e]);return u.jsxs("div",{className:$e("picker","picker-in-shell"),children:[g&&u.jsx("div",{className:$e("picker-search"),children:u.jsx("span",{className:$e("picker-search-hint"),children:g})}),(a||s)&&u.jsx("div",{className:$e("picker-search"),children:u.jsx("span",{className:$e("picker-search-hint"),children:a||e("tools.loading")})}),u.jsx("div",{className:$e("picker-sep")}),u.jsxs("div",{id:fq,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?XN(i):void 0,className:$e("picker-list",m?"picker-keyboard-only":void 0),ref:h,children:[!s&&n.length===0&&u.jsx("div",{className:$e("picker-empty"),children:e("tools.empty")}),n.map((y,b)=>{const w=c.has(y.name),v=y.description??"";return u.jsxs("div",{id:XN(b),role:"option","aria-selected":!1,"aria-expanded":v?w:void 0,className:$e("picker-item","picker-session-item","tools-picker-item",b===i?"selected":void 0,w?"tools-picker-item-expanded":void 0),onClick:()=>{o(b),y.description&&f(y)},onMouseMove:()=>o(b),children:[u.jsxs("div",{className:$e("picker-item-row"),children:[u.jsx("span",{className:$e("tools-item-icon"),"aria-hidden":"true"}),u.jsx("span",{className:$e("picker-item-title"),children:P9e(y)}),u.jsx("span",{className:$e("tools-status-badge",y.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:y.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),v?u.jsx("svg",{className:$e("tools-item-chevron",w?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),w&&v&&u.jsx("div",{className:$e("tools-desc-expanded"),children:u.jsx("div",{className:$e("tools-desc-body"),children:v})})]},y.name)})]})]})}const z9e="_chart_1xbk4_1",F9e="_plot_1xbk4_8",q9e="_svg_1xbk4_13",H9e="_cursor_1xbk4_30",U9e="_tooltip_1xbk4_40",V9e="_tooltipBelow_1xbk4_62",W9e="_tooltipTime_1xbk4_67",G9e="_tooltipRow_1xbk4_73",K9e="_tooltipLabel_1xbk4_79",Y9e="_tooltipValue_1xbk4_83",Q9e="_axis_1xbk4_91",X9e="_legend_1xbk4_96",J9e="_legendItem_1xbk4_105",Z9e="_swatch_1xbk4_112",eAe="_legendLabel_1xbk4_118",tAe="_legendValue_1xbk4_123",nAe="_peak_1xbk4_131",Gr={chart:z9e,plot:F9e,svg:q9e,cursor:H9e,tooltip:U9e,tooltipBelow:V9e,tooltipTime:W9e,tooltipRow:G9e,tooltipLabel:K9e,tooltipValue:Y9e,axis:Q9e,legend:X9e,legendItem:J9e,swatch:Z9e,legendLabel:eAe,legendValue:tAe,peak:nAe},AS=320,C0=64,mo=3,ey=AS-mo*2,ty=C0-mo*2;function JN(e,t){return Number.isFinite(e)?e:t}const sAe=84;function rAe(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 iAe(e){return new Date(e).toLocaleTimeString()}function mq({series:e,timestamps:t,format:n=a=>String(Math.round(a)),formatTime:s=iAe,zeroBased:r=!0,ariaLabel:i,peakLabel:o="peak"}){const a=p.useRef(null),[l,c]=p.useState(null),[d,h]=p.useState(!1),f=p.useRef(void 0),{paths:m,maxV:g,maxLen:y,min:b,span:w}=p.useMemo(()=>{const k=e.reduce((Q,Y)=>Math.max(Q,Y.values.length),0);let j=0,N=r?0:Number.POSITIVE_INFINITY;for(const Q of e)for(const Y of Q.values)Number.isFinite(Y)&&(Y>j&&(j=Y),Y<N&&(N=Y));Number.isFinite(N)||(N=0);const L=j-N||1,$=Q=>k<=1?mo+ey/2:mo+Q/(k-1)*ey,F=Q=>mo+ty-(JN(Q,N)-N)/L*ty;return{paths:e.map(Q=>{const Y=Q.values.map((le,z)=>`${z===0?"M":"L"}${$(z).toFixed(1)},${F(le).toFixed(1)}`).join(" "),ne=Q.values.length-1,P=ne>=0?{cx:$(ne),cy:F(Q.values[ne]),color:Q.color}:void 0;return{key:Q.label,d:Y,color:Q.color,dot:P}}),maxV:j,maxLen:k,min:N,span:L}},[e,r]),v=y>0,x=k=>y<=1?mo+ey/2:mo+k/(y-1)*ey,C=k=>mo+ty-(JN(k,b)-b)/w*ty,A=k=>{const j=a.current;if(!j||y===0)return;const N=j.getBoundingClientRect();if(N.width===0)return;const L=(k.clientX-N.left)/N.width,$=Math.max(0,Math.min(y-1,Math.round(L*(y-1))));c($),f.current===void 0&&(f.current=rAe(j));const F=f.current,B=F?F.getBoundingClientRect().top:0;h(N.top-B<sAe)},T=()=>c(null),_=l!=null&&l>=0&&l<y?l:null,R=_!=null?x(_):0,I=_!=null&&y>1?_/(y-1)*100:50;return u.jsxs("div",{className:Gr.chart,children:[u.jsxs("div",{className:Gr.plot,children:[u.jsxs("svg",{ref:a,viewBox:`0 0 ${AS} ${C0}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:Gr.svg,onPointerMove:A,onPointerLeave:T,children:[u.jsx("line",{x1:mo,y1:C0-mo,x2:AS-mo,y2:C0-mo,className:Gr.axis,vectorEffect:"non-scaling-stroke"}),m.map(k=>u.jsx("path",{d:k.d,fill:"none",stroke:k.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},k.key)),_!=null&&u.jsxs(u.Fragment,{children:[u.jsx("line",{x1:R,y1:mo,x2:R,y2:C0-mo,className:Gr.cursor,vectorEffect:"non-scaling-stroke"}),e.map(k=>_<k.values.length?u.jsx("circle",{cx:R,cy:C(k.values[_]),r:2.5,fill:k.color,vectorEffect:"non-scaling-stroke"},`${k.label}-hover`):null)]}),_==null&&m.map(k=>k.dot?u.jsx("circle",{cx:k.dot.cx,cy:k.dot.cy,r:2,fill:k.dot.color,vectorEffect:"non-scaling-stroke"},`${k.key}-dot`):null)]}),_!=null&&u.jsxs("div",{className:`${Gr.tooltip} ${d?Gr.tooltipBelow:""}`,style:{left:`${I}%`},role:"tooltip",children:[t&&t[_]!=null&&u.jsx("div",{className:Gr.tooltipTime,children:s(t[_])}),e.map(k=>_<k.values.length?u.jsxs("div",{className:Gr.tooltipRow,children:[u.jsx("svg",{className:Gr.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:u.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:k.color})}),u.jsx("span",{className:Gr.tooltipLabel,children:k.label}),u.jsx("span",{className:Gr.tooltipValue,children:n(k.values[_])})]},k.label):null)]})]}),u.jsxs("div",{className:Gr.legend,children:[e.map(k=>{const j=k.values.length?k.values[k.values.length-1]:void 0;return u.jsxs("span",{className:Gr.legendItem,children:[u.jsx("svg",{className:Gr.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:u.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:k.color})}),u.jsx("span",{className:Gr.legendLabel,children:k.label}),j!==void 0&&u.jsx("span",{className:Gr.legendValue,children:n(j)})]},k.label)}),v&&u.jsx("span",{className:Gr.peak,children:`${o} ${n(g)}`})]})]})}const oAe="_wrap_1icv6_1",aAe="_tooltip_1icv6_11",lAe="_legend_1icv6_27",cAe="_legendLabel_1icv6_35",uAe="_scroll_1icv6_39",dAe="_grid_1icv6_44",hAe="_month_1icv6_51",fAe="_weekday_1icv6_59",mAe="_cell_1icv6_69",pAe="_legendCell_1icv6_75",gAe="_lvl0_1icv6_82",yAe="_lvl1_1icv6_85",bAe="_lvl2_1icv6_88",wAe="_lvl3_1icv6_91",vAe="_lvl4_1icv6_94",xAe="_today_1icv6_98",Ui={wrap:oAe,tooltip:aAe,legend:lAe,legendLabel:cAe,scroll:uAe,grid:dAe,month:hAe,weekday:fAe,cell:mAe,legendCell:pAe,lvl0:gAe,lvl1:yAe,lvl2:bAe,lvl3:wAe,lvl4:vAe,today:xAe},J4=864e5,_Ae=4;function Z4(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function ZN(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 kAe(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 SAe(e,[t,n,s]){return e<=0?0:e<=t?1:e<=n?2:e<=s?3:_Ae}function TAe(e,t,n){const s=Math.max(1,Math.floor(t)),r=Z4(Date.now()),i=Z4(r.getTime()-(s-1)*J4),o=(i.getDay()+6)%7,a=Z4(i.getTime()-o*J4),l=Math.round((r.getTime()-a.getTime())/J4)+1,c=[],d=[],h=ZN(r),f=new Date(a.getTime());for(let x=0;x<l;x++){const C=ZN(f),A=e[C],T=(A==null?void 0:A.tokens)??0;d.push(T),c.push({dateKey:C,tokens:T,cacheReadRate:(A==null?void 0:A.cacheReadRate)??0,isToday:C===h,weekday:x%7,week:Math.floor(x/7)}),f.setDate(f.getDate()+1)}const m=kAe(d),g=c.map(x=>({...x,level:SAe(x.tokens,m)})),y=Math.ceil(l/7),b=[];let w=-1;const v=new Date(a.getTime());for(let x=0;x<y;x++){const C=v.getMonth();C!==w&&(b.push({week:x,text:v.toLocaleDateString(n,{month:"short"})}),w=C),v.setDate(v.getDate()+7)}return{cells:g,months:b,weeks:y}}function CAe({heatmap:e,days:t}){const{t:n,language:s}=it(),r=p.useMemo(()=>TAe(e,t,s),[e,t,s]),i=p.useRef(null),[o,a]=p.useState(null),l={0:n("daemon.usage.dowMon"),2:n("daemon.usage.dowWed"),4:n("daemon.usage.dowFri")},c=d=>{const h=d.target.closest("[data-date]"),f=i.current;if(!h||!f)return;const m=h.dataset.date??"",g=Number(h.dataset.tokens??"0"),y=Number(h.dataset.cache??"0"),b=h.getBoundingClientRect(),w=f.getBoundingClientRect();a({left:b.left-w.left+b.width/2,top:b.top-w.top,text:n("daemon.usage.cellTokens",{date:m,tokens:wf(g),cache:Math.round(y*100)})})};return u.jsxs("div",{className:Ui.wrap,ref:i,children:[u.jsxs("div",{className:Ui.legend,children:[u.jsx("span",{className:Ui.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>u.jsx("span",{className:`${Ui.cell} ${Ui.legendCell} ${Ui[`lvl${d}`]}`},d)),u.jsx("span",{className:Ui.legendLabel,children:n("daemon.usage.high")})]}),u.jsx("div",{className:Ui.scroll,onMouseOver:c,onMouseLeave:()=>a(null),children:u.jsxs("div",{className:Ui.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${r.weeks}, var(--hm-cell))`},children:[r.months.map(d=>u.jsx("div",{className:Ui.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>u.jsx("div",{className:Ui.weekday,style:{gridColumn:1,gridRow:d+2},children:l[d]},`wd-${d}`)),r.cells.map(d=>u.jsx("div",{className:`${Ui.cell} ${Ui[`lvl${d.level}`]} ${d.isToday?Ui.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&&u.jsx("div",{className:Ui.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const AAe="_usage_1kfmt_1",EAe="_toolbar_1kfmt_9",MAe="_segmented_1kfmt_14",NAe="_segment_1kfmt_14",IAe="_segmentActive_1kfmt_41",jAe="_hero_1kfmt_48",RAe="_heroMain_1kfmt_59",LAe="_heroLabel_1kfmt_63",DAe="_heroNumber_1kfmt_71",OAe="_heroSub_1kfmt_82",BAe="_refresh_1kfmt_87",PAe="_stats_1kfmt_109",$Ae="_stat_1kfmt_109",zAe="_statValue_1kfmt_121",FAe="_statLabel_1kfmt_130",qAe="_section_1kfmt_139",HAe="_sectionTitle_1kfmt_145",UAe="_sectionSub_1kfmt_154",VAe="_breakdown_1kfmt_161",WAe="_metric_1kfmt_167",GAe="_metricHead_1kfmt_173",KAe="_tick_1kfmt_179",YAe="_tick_input_1kfmt_186",QAe="_tick_output_1kfmt_190",XAe="_tick_cache_1kfmt_198",JAe="_metricLabel_1kfmt_202",ZAe="_metricValue_1kfmt_209",eEe="_metricHint_1kfmt_219",tEe="_state_1kfmt_225",nEe="_modelList_1kfmt_233",sEe="_modelRow_1kfmt_239",rEe="_modelHead_1kfmt_245",iEe="_modelRank_1kfmt_251",oEe="_modelMeta_1kfmt_262",aEe="_modelName_1kfmt_267",lEe="_modelSub_1kfmt_277",cEe="_modelShare_1kfmt_282",uEe="_modelTrack_1kfmt_289",dEe="_modelFill_1kfmt_296",hEe="_modelFillCache_1kfmt_303",fEe="_skillTable_1kfmt_310",mEe="_right_1kfmt_334",pEe="_bars_1kfmt_339",gEe="_barsBody_1kfmt_345",yEe="_barCol_1kfmt_352",bEe="_bar_1kfmt_339",wEe="_barsCaption_1kfmt_371",Lt={usage:AAe,toolbar:EAe,segmented:MAe,segment:NAe,segmentActive:IAe,hero:jAe,heroMain:RAe,heroLabel:LAe,heroNumber:DAe,heroSub:OAe,refresh:BAe,stats:PAe,stat:$Ae,statValue:zAe,statLabel:FAe,section:qAe,sectionTitle:HAe,sectionSub:UAe,breakdown:VAe,metric:WAe,metricHead:GAe,tick:KAe,tick_input:YAe,tick_output:QAe,tick_cache:XAe,metricLabel:JAe,metricValue:ZAe,metricHint:eEe,state:tEe,modelList:nEe,modelRow:sEe,modelHead:rEe,modelRank:iEe,modelMeta:oEe,modelName:aEe,modelSub:lEe,modelShare:cEe,modelTrack:uEe,modelFill:dEe,modelFillCache:hEe,skillTable:fEe,right:mEe,bars:pEe,barsBody:gEe,barCol:yEe,bar:bEe,barsCaption:wEe},pq=12,vEe=Math.round(pq*30.44),xEe=["today","week","month"],_Ee={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},kEe={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},SEe={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},eI=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function TEe(e){return new Date(`${e}T00:00:00`).getTime()}function e_(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function CEe(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function ny({label:e,value:t}){return u.jsxs("div",{className:Lt.stat,children:[u.jsx("div",{className:Lt.statValue,children:t.toLocaleString()}),u.jsx("div",{className:Lt.statLabel,children:e})]})}function t_({accent:e,value:t,label:n,hint:s}){return u.jsxs("div",{className:Lt.metric,children:[u.jsxs("div",{className:Lt.metricHead,children:[u.jsx("span",{className:`${Lt.tick} ${Lt[`tick_${e}`]}`}),u.jsx("span",{className:Lt.metricLabel,children:n})]}),u.jsx("div",{className:Lt.metricValue,children:t}),u.jsx("div",{className:Lt.metricHint,children:s})]})}function AEe({rank:e,model:t,color:n}){const{t:s}=it(),r=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return u.jsxs("div",{className:Lt.modelRow,children:[u.jsxs("div",{className:Lt.modelHead,children:[u.jsx("span",{className:Lt.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),u.jsxs("div",{className:Lt.modelMeta,children:[u.jsx("div",{className:Lt.modelName,children:t.model}),u.jsx("div",{className:Lt.modelSub,children:s("daemon.usage.modelMeta",{tokens:wf(t.totalTokens),cache:Math.round(i)})})]}),u.jsxs("span",{className:Lt.modelShare,style:{color:n},children:[Math.round(r),"%"]})]}),u.jsx("div",{className:Lt.modelTrack,children:u.jsx("div",{className:Lt.modelFill,style:{width:`${r}%`,background:n},children:u.jsx("div",{className:Lt.modelFillCache,style:{width:`${i}%`}})})})]})}function EEe({points:e,format:t,locale:n}){const s=Math.max(1,...e.map(r=>r.value));return u.jsxs("div",{className:Lt.bars,children:[u.jsx("div",{className:Lt.barsBody,children:e.map((r,i)=>u.jsx("div",{className:Lt.barCol,title:`${e_(r.label,n)} · ${t(r.value)}`,children:u.jsx("div",{className:Lt.bar,style:{height:`${r.value/s*100}%`}})},`${r.label}-${i}`))}),e.length>1&&u.jsxs("div",{className:Lt.barsCaption,children:[u.jsx("span",{children:e_(e[0].label,n)}),u.jsx("span",{children:e_(e[e.length-1].label,n)})]})]})}function MEe(){const{t:e,language:t}=it(),[n,s]=p.useState("today"),{dashboard:r,loading:i,error:o,reload:a}=YY({range:n,heatmapDays:vEe,autoLoad:!0}),l=u.jsx("div",{className:Lt.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:xEe.map(v=>u.jsx("button",{type:"button",className:`${Lt.segment} ${v===n?Lt.segmentActive:""}`,"aria-pressed":v===n,onClick:()=>s(v),children:e(_Ee[v])},v))});if(!r)return u.jsxs("div",{className:Lt.usage,children:[u.jsx("div",{className:Lt.toolbar,children:l}),i?u.jsx("div",{className:Lt.state,children:e("daemon.usage.loading")}):o?u.jsxs("div",{className:Lt.state,children:[e("daemon.usage.failed"),": ",o.message]}):u.jsx("div",{className:Lt.state,children:e("daemon.usage.empty")})]});const{summary:c,models:d,skills:h,daily:f,heatmap:m,heatmapDays:g}=r,y=c.linesAdded+c.linesRemoved,b=c.totalTokens>0||Object.keys(m).length>0,w=e(SEe[r.range]);return u.jsxs("div",{className:Lt.usage,"aria-busy":i,children:[u.jsx("div",{className:Lt.toolbar,children:l}),u.jsxs("header",{className:Lt.hero,children:[u.jsxs("div",{className:Lt.heroMain,children:[u.jsx("div",{className:Lt.heroLabel,children:e(kEe[r.range])}),u.jsx("div",{className:Lt.heroNumber,children:wf(c.totalTokens)}),u.jsx("div",{className:Lt.heroSub,children:e("daemon.usage.tokensConsumed")})]}),u.jsx("button",{type:"button",className:Lt.refresh,onClick:()=>void a(),disabled:i,children:e("daemon.refresh")})]}),u.jsxs("div",{className:Lt.stats,children:[u.jsx(ny,{label:e("daemon.usage.sessions"),value:c.sessions}),u.jsx(ny,{label:e("daemon.usage.requests"),value:c.requests}),u.jsx(ny,{label:e("daemon.usage.tools"),value:c.toolCalls}),u.jsx(ny,{label:e("daemon.usage.changes"),value:y})]}),u.jsxs("section",{className:Lt.section,children:[u.jsx("h4",{className:Lt.sectionTitle,children:e("daemon.usage.breakdownTitle")}),u.jsxs("div",{className:Lt.breakdown,children:[u.jsx(t_,{accent:"input",value:wf(c.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),u.jsx(t_,{accent:"output",value:wf(c.outputTokens+c.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),u.jsx(t_,{accent:"cache",value:`${Math.round(c.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),u.jsxs("section",{className:Lt.section,children:[u.jsx("h4",{className:Lt.sectionTitle,children:e("daemon.usage.heatmapTitle")}),u.jsx("div",{className:Lt.sectionSub,children:e("daemon.usage.heatmapSub",{months:pq})}),b?u.jsx(CAe,{heatmap:m,days:g}):u.jsx("div",{className:Lt.state,children:e("daemon.usage.empty")})]}),d.length>0&&u.jsxs("section",{className:Lt.section,children:[u.jsxs("h4",{className:Lt.sectionTitle,children:[w," ",e("daemon.usage.modelShareTitle")]}),u.jsx("div",{className:Lt.sectionSub,children:e("daemon.usage.modelShareSub")}),u.jsx("div",{className:Lt.modelList,children:d.map((v,x)=>u.jsx(AEe,{rank:x+1,model:v,color:eI[x%eI.length]},v.model))})]}),h.length>0&&u.jsxs("section",{className:Lt.section,children:[u.jsxs("h4",{className:Lt.sectionTitle,children:[w," ",e("daemon.usage.skillTitle")]}),u.jsx("div",{className:Lt.sectionSub,children:e("daemon.usage.skillSub")}),u.jsxs("table",{className:Lt.skillTable,children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:e("daemon.usage.skillName")}),u.jsx("th",{className:Lt.right,children:e("daemon.usage.skillCount")})]})}),u.jsx("tbody",{children:h.map(v=>u.jsxs("tr",{children:[u.jsx("td",{children:v.name}),u.jsx("td",{className:Lt.right,children:v.count.toLocaleString()})]},v.name))})]})]}),f.length>1&&u.jsxs("section",{className:Lt.section,children:[u.jsxs("h4",{className:Lt.sectionTitle,children:[w," ",e("daemon.usage.dailyTokensTitle")]}),u.jsx("div",{className:Lt.sectionSub,children:e("daemon.usage.dailyTokensSub")}),u.jsx(mq,{series:[{label:e("daemon.usage.tokensConsumed"),values:f.map(v=>v.tokens),color:"var(--agent-blue-400)"}],timestamps:f.map(v=>TEe(v.date)),format:wf,formatTime:v=>CEe(v,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),f.length>1&&u.jsxs("section",{className:Lt.section,children:[u.jsxs("h4",{className:Lt.sectionTitle,children:[w," ",e("daemon.usage.dailySessionsTitle")]}),u.jsx("div",{className:Lt.sectionSub,children:e("daemon.usage.dailySessionsSub")}),u.jsx(EEe,{points:f.map(v=>({label:v.date,value:v.sessions})),format:v=>v.toLocaleString(),locale:t})]})]})}const NEe="_dialog_1c9dv_4",IEe="_toolbar_1c9dv_12",jEe="_toolbarActions_1c9dv_19",REe="_updatedAt_1c9dv_26",LEe="_refreshError_1c9dv_31",DEe="_refreshButton_1c9dv_36",OEe="_badge_1c9dv_51",BEe="_levelOk_1c9dv_61",PEe="_levelWarning_1c9dv_66",$Ee="_levelError_1c9dv_71",zEe="_levelUnavailable_1c9dv_76",FEe="_tabs_1c9dv_81",qEe="_tab_1c9dv_81",HEe="_tabActive_1c9dv_106",UEe="_grid_1c9dv_114",VEe="_chartsGrid_1c9dv_113",WEe="_card_1c9dv_128",GEe="_cardTitle_1c9dv_135",KEe="_row_1c9dv_144",YEe="_rowLabel_1c9dv_153",QEe="_rowValue_1c9dv_157",XEe="_pathRow_1c9dv_166",JEe="_pathValue_1c9dv_160",ZEe="_empty_1c9dv_187",eMe="_issueRow_1c9dv_192",tMe="_issueMessage_1c9dv_199",nMe="_featureChips_1c9dv_203",sMe="_featureChip_1c9dv_203",rMe="_summaryChip_1c9dv_224",iMe="_sessionRow_1c9dv_233",oMe="_sessionName_1c9dv_242",aMe="_sessionMeta_1c9dv_248",lMe="_activePrompt_1c9dv_257",cMe="_workspaceRow_1c9dv_261",uMe="_workspaceRowHead_1c9dv_270",dMe="_workspaceName_1c9dv_276",hMe="_workspaceDuration_1c9dv_280",fMe="_workspaceError_1c9dv_287",mMe="_workspaceSummary_1c9dv_294",pMe="_workspaceCell_1c9dv_301",gMe="_workspaceCellLabel_1c9dv_310",yMe="_workspaceCellMessage_1c9dv_315",Dt={dialog:NEe,toolbar:IEe,toolbarActions:jEe,updatedAt:REe,refreshError:LEe,refreshButton:DEe,badge:OEe,levelOk:BEe,levelWarning:PEe,levelError:$Ee,levelUnavailable:zEe,tabs:FEe,tab:qEe,tabActive:HEe,grid:UEe,chartsGrid:VEe,card:WEe,cardTitle:GEe,row:KEe,rowLabel:YEe,rowValue:QEe,pathRow:XEe,pathValue:JEe,empty:ZEe,issueRow:eMe,issueMessage:tMe,featureChips:nMe,featureChip:sMe,summaryChip:rMe,sessionRow:iMe,sessionName:oMe,sessionMeta:aMe,activePrompt:lMe,workspaceRow:cMe,workspaceRowHead:uMe,workspaceName:dMe,workspaceDuration:hMe,workspaceError:fMe,workspaceSummary:mMe,workspaceCell:pMe,workspaceCellLabel:gMe,workspaceCellMessage:yMe},bMe=5e3,qh=[{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 gq(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 ku(e){return e=Math.max(0,e),e>=6e4?gq(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function _w(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 sy(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function wMe(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function vMe(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function tI(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const xMe=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function _Me(e){if(!tI(e))return[];const t=[];for(const n of xMe){const s=e[n];if(Array.isArray(s))for(const r of s){if(!tI(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 ES(e){switch(e){case"ok":return Dt.levelOk;case"warning":return Dt.levelWarning;case"error":return Dt.levelError;default:return Dt.levelUnavailable}}function as({label:e,value:t}){return u.jsxs("div",{className:Dt.row,children:[u.jsx("span",{className:Dt.rowLabel,children:e}),u.jsx("span",{className:Dt.rowValue,children:t})]})}function sa({title:e,children:t}){return u.jsxs("section",{className:Dt.card,children:[u.jsx("h3",{className:Dt.cardTitle,children:e}),t]})}function kMe({name:e,section:t}){const{t:n}=it(),s=Object.entries(t.summary??{}),r=_Me(t.data);return u.jsxs("div",{className:Dt.workspaceRow,children:[u.jsxs("div",{className:Dt.workspaceRowHead,children:[u.jsx("span",{className:`${Dt.badge} ${ES(t.status)}`,children:n(`daemon.level.${t.status}`)}),u.jsx("span",{className:Dt.workspaceName,children:e}),u.jsx("span",{className:Dt.workspaceDuration,children:ku(t.durationMs)})]}),t.error&&u.jsx("div",{className:Dt.workspaceError,children:t.error.message}),r.map((i,o)=>u.jsxs("div",{className:Dt.workspaceCell,children:[u.jsx("span",{className:`${Dt.badge} ${ES(i.status)}`,children:n(`daemon.level.${i.status}`)}),u.jsx("span",{className:Dt.workspaceCellLabel,children:i.label}),i.message&&u.jsx("span",{className:Dt.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),s.length>0&&u.jsx("div",{className:Dt.workspaceSummary,children:s.map(([i,o])=>u.jsxs("span",{className:Dt.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function SMe({report:e}){const{t}=it(),n=e.full;if(!n)return null;const s=Object.entries(n.workspace).sort(([r],[i])=>r.localeCompare(i));return u.jsxs(u.Fragment,{children:[u.jsx(sa,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?u.jsx("div",{className:Dt.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(r=>u.jsxs("div",{className:Dt.sessionRow,children:[u.jsx("div",{className:Dt.sessionName,children:r.displayName||r.sessionId}),u.jsxs("div",{className:Dt.sessionMeta,children:[u.jsx("span",{children:t("common.clients",{count:r.clientCount})}),u.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:r.pendingPromptCount})}),u.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:r.pendingPermissionCount})}),r.hasActivePrompt&&u.jsx("span",{className:Dt.activePrompt,children:t("daemon.full.session.prompting")})]})]},r.sessionId))}),u.jsx(sa,{title:t("daemon.full.workspace.title"),children:s.length===0?u.jsx("div",{className:Dt.empty,children:t("daemon.full.workspace.empty")}):s.map(([r,i])=>u.jsx(kMe,{name:r,section:i},r))}),u.jsxs(sa,{title:t("daemon.full.auth.title"),children:[u.jsx(as,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),u.jsx(as,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),u.jsx(as,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function TMe({series:e}){const{t}=it();if(e.length===0)return u.jsx(sa,{title:t("daemon.charts.title"),children:u.jsx("div",{className:Dt.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),s=e.map(i=>i.t),r=(i,o,a)=>u.jsx(sa,{title:t(i),children:u.jsx(mq,{series:a,timestamps:s,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return u.jsxs("div",{className:`${Dt.grid} ${Dt.chartsGrid}`,children:[r("daemon.charts.concurrency",sy,[{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)"}]),r("daemon.charts.requests",sy,[{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)"}]),r("daemon.charts.apiLatency",ku,[{label:"p50",values:n(i=>i.latencyP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.latencyP95Ms),color:"var(--warning-color)"}]),r("daemon.charts.llmLatency",ku,[{label:"p50",values:n(i=>i.llmApiP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.llmApiP95Ms),color:"var(--primary)"}]),r("daemon.charts.promptLatency",ku,[{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)"}]),r("daemon.charts.eventLoop",ku,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}]),r("daemon.charts.cpu",wMe,[{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)"}]),r("daemon.charts.memory",_w,[{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)"}]),r("daemon.charts.pipe",_w,[{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)"}]),r("daemon.charts.connections",sy,[{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)"}]),r("daemon.charts.tokens",sy,[{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)"}])]})}function CMe(){var R;const{t:e}=it(),[t,n]=p.useState("overview"),s=p.useRef([]),r=(I,k)=>{var N;let j;if(I.key==="ArrowRight"||I.key==="ArrowDown")j=(k+1)%qh.length;else if(I.key==="ArrowLeft"||I.key==="ArrowUp")j=(k-1+qh.length)%qh.length;else if(I.key==="Home")j=0;else if(I.key==="End")j=qh.length-1;else return;I.preventDefault(),n(qh[j].id),(N=s.current[j])==null||N.focus()},i=Ek({autoLoad:!0,detail:"summary"}),o=Ek({autoLoad:!0,detail:"full"}),a=i.reload,l=o.reload,c=p.useRef(!1);p.useEffect(()=>{const I=window.setInterval(()=>{document.hidden||c.current||(c.current=!0,a().finally(()=>{c.current=!1}))},bMe);return()=>window.clearInterval(I)},[a]);const d=p.useCallback(()=>{a(),l()},[a,l]),h=i.report??o.report,f=o.report,m=i.loading||o.loading,g=i.error??o.error;if(!h)return u.jsx("div",{className:Dt.dialog,children:u.jsx("div",{className:Dt.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const y=f??h,{daemon:b,runtime:w,security:v,limits:x,capabilities:C}=h,A=w.transport.acp,T=Object.values(w.rateLimit.rejectedSinceStart).reduce((I,k)=>I+k,0),_=I=>I===null?e("daemon.limits.unlimited"):I;return u.jsxs("div",{className:Dt.dialog,children:[u.jsxs("div",{className:Dt.toolbar,children:[u.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${y.status}`)}`,className:`${Dt.badge} ${ES(y.status)}`,children:e(`daemon.level.${y.status}`)}),u.jsx("span",{className:Dt.updatedAt,children:e("daemon.updatedAt",{time:new Date(h.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&u.jsx("span",{className:Dt.refreshError,children:e("daemon.loadFailed")}),u.jsx("div",{className:Dt.toolbarActions,children:u.jsx("button",{type:"button",className:Dt.refreshButton,onClick:d,disabled:m,children:e("daemon.refresh")})})]}),y.issues.length>0&&u.jsx(sa,{title:e("daemon.issues.title"),children:y.issues.map((I,k)=>u.jsxs("div",{className:Dt.issueRow,children:[u.jsx("span",{className:`${Dt.badge} ${I.severity==="error"?Dt.levelError:Dt.levelWarning}`,children:I.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),u.jsx("span",{className:Dt.issueMessage,children:I.message})]},`${I.code}-${k}`))}),u.jsx("div",{className:Dt.tabs,role:"tablist","aria-label":e("daemon.title"),children:qh.map((I,k)=>u.jsx("button",{ref:j=>{s.current[k]=j},type:"button",role:"tab",id:`daemon-tab-${I.id}`,"aria-selected":I.id===t,"aria-controls":`daemon-tabpanel-${I.id}`,tabIndex:I.id===t?0:-1,className:`${Dt.tab} ${I.id===t?Dt.tabActive:""}`,onClick:()=>n(I.id),onKeyDown:j=>r(j,k),children:e(I.labelKey)},I.id))}),t==="overview"&&u.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:Dt.grid,children:[u.jsxs(sa,{title:e("daemon.overview.title"),children:[b.qwenCodeVersion&&u.jsx(as,{label:e("daemon.overview.version"),value:b.qwenCodeVersion}),u.jsx(as,{label:e("daemon.overview.pid"),value:b.pid}),u.jsx(as,{label:e("daemon.overview.mode"),value:b.mode}),u.jsx(as,{label:e("daemon.overview.uptime"),value:gq(b.uptimeMs)}),u.jsxs("div",{className:Dt.pathRow,children:[u.jsx("span",{className:Dt.rowLabel,children:e("daemon.overview.workspace")}),u.jsx("span",{className:Dt.pathValue,title:b.workspaceCwd,children:u.jsx("bdi",{children:b.workspaceCwd})})]})]}),u.jsxs(sa,{title:e("daemon.runtime.title"),children:[w.error?u.jsxs("div",{className:Dt.workspaceError,children:[e("daemon.runtime.startFailed"),": ",w.error]}):w.loading?u.jsx("div",{className:Dt.empty,children:e("daemon.runtime.startingUp")}):null,u.jsx(as,{label:e("daemon.runtime.activeSessions"),value:w.sessions.active}),w.activity&&u.jsxs(u.Fragment,{children:[u.jsx(as,{label:e("daemon.runtime.activePrompts"),value:w.activity.activePrompts}),u.jsx(as,{label:e("daemon.runtime.idle"),value:w.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):ku(w.activity.idleSinceMs)})]}),u.jsx(as,{label:e("daemon.runtime.pendingPermissions"),value:w.permissions.pending}),u.jsx(as,{label:e("daemon.runtime.permissionPolicy"),value:w.permissions.policy}),u.jsx(as,{label:e("daemon.runtime.channel"),value:w.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),w.channelWorker.enabled&&u.jsxs(u.Fragment,{children:[u.jsx(as,{label:e("daemon.runtime.channelWorker"),value:vMe(w.channelWorker)}),w.channelWorker.error&&u.jsx("div",{className:Dt.workspaceError,children:w.channelWorker.error}),(w.channelWorker.restartCount??0)>0&&u.jsx(as,{label:e("daemon.runtime.channelWorkerRestarts"),value:w.channelWorker.restartCount})]}),u.jsx(as,{label:e("daemon.runtime.memory"),value:`${_w(w.process.rss)} / ${_w(w.process.heapUsed)}`})]}),u.jsxs(sa,{title:e("daemon.transport.title"),children:[u.jsx(as,{label:e("daemon.transport.restSse"),value:w.transport.restSseActive}),A.enabled?u.jsxs(u.Fragment,{children:[u.jsx(as,{label:e("daemon.transport.acpConnections"),value:A.connections}),u.jsx(as,{label:e("daemon.transport.acpStreams"),value:`${A.sessionStreams} / ${A.sseStreams} / ${A.wsStreams}`}),u.jsx(as,{label:e("daemon.transport.pendingRequests"),value:A.pendingClientRequests})]}):u.jsx("div",{className:Dt.empty,children:e("daemon.transport.acpDisabled")}),u.jsx(as,{label:e("daemon.transport.rateLimitRejected"),value:w.rateLimit.enabled?T:e("common.disabled")})]}),u.jsxs(sa,{title:e("daemon.security.title"),children:[u.jsx(as,{label:e("daemon.security.token"),value:v.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),u.jsx(as,{label:e("daemon.security.requireAuth"),value:v.requireAuth?e("common.enabled"):e("common.disabled")}),u.jsx(as,{label:e("daemon.security.loopback"),value:v.loopbackBind?e("common.enabled"):e("common.disabled")}),u.jsx(as,{label:e("daemon.security.allowOrigin"),value:v.allowOriginMode}),u.jsx(as,{label:e("daemon.security.shell"),value:v.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),u.jsxs(sa,{title:e("daemon.limits.title"),children:[u.jsx(as,{label:e("daemon.limits.maxSessions"),value:_(x.maxSessions)}),u.jsx(as,{label:e("daemon.limits.maxPendingPrompts"),value:_(x.maxPendingPromptsPerSession)}),u.jsx(as,{label:e("daemon.limits.maxConnections"),value:_(x.listenerMaxConnections)}),u.jsx(as,{label:e("daemon.limits.eventRing"),value:x.eventRingSize}),u.jsx(as,{label:e("daemon.limits.promptDeadline"),value:x.promptDeadlineMs===null?e("daemon.limits.unlimited"):ku(x.promptDeadlineMs)}),u.jsx(as,{label:e("daemon.limits.sessionIdle"),value:ku(x.sessionIdleTimeoutMs)})]}),u.jsx(sa,{title:C.features.length?e("daemon.capabilities.titleCount",{count:C.features.length}):e("daemon.capabilities.title"),children:C.features.length===0?u.jsx("span",{className:Dt.empty,children:e("daemon.none")}):u.jsx("div",{className:Dt.featureChips,children:[...C.features].sort().map(I=>u.jsx("span",{className:Dt.featureChip,children:I},I))})})]}),t==="usage"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:u.jsx(Tc,{label:"daemon-usage",fallback:u.jsx("div",{className:Dt.empty,children:e("daemon.usage.failed")}),children:u.jsx(MEe,{})})}),t==="metrics"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:u.jsx(TMe,{series:((R=h.runtime.metrics)==null?void 0:R.series)??[]})}),t==="diagnostics"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:u.jsx(Tc,{label:"daemon-status-detail",fallback:u.jsx("div",{className:Dt.empty,children:e("daemon.details.failed")}),children:f!=null&&f.full?u.jsx(SMe,{report:f}):o.loading?u.jsx("div",{className:Dt.empty,children:e("daemon.details.loading")}):o.error?u.jsxs("div",{className:Dt.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):u.jsx("div",{className:Dt.empty,children:e("daemon.details.failed")})})})]})}function AMe(){const{t:e}=it();return u.jsx(Tc,{label:"daemon-status",fallback:t=>u.jsx("div",{className:Dt.dialog,children:u.jsxs("div",{className:Dt.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:u.jsx(CMe,{})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const yq="split",Of=6;function EMe(e,t,n){const s=new URL(t);return s.pathname="/",s.searchParams.set(yq,e.join(",")),n&&(s.hash=new URLSearchParams({token:n}).toString()),s.toString()}function MMe(e){const t=new URLSearchParams(e).get(yq);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}function NMe(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?DMe(e):""}let A0;const IMe="qwen-daemon-auth",jMe=2500;function bq(){return A0||(typeof window>"u"?void 0:(A0=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,A0))}function RMe(e=jMe){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),A0=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)!==IMe)return;const l=typeof a.token=="string"?a.token:"";s(l.trim()||void 0)},i=setTimeout(()=>s(void 0),e);window.addEventListener("message",r)})}function LMe(){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 DMe(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""}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const kw=1e3,V8="session_organization",OMe="_panel_1nily_1",BMe="_toolbar_1nily_9",PMe="_count_1nily_16",$Me="_selectAll_1nily_21",zMe="_actionButton_1nily_30",FMe="_refreshButton_1nily_50",qMe="_notice_1nily_61",HMe="_grid_1nily_71",UMe="_card_1nily_80",VMe="_cardCurrent_1nily_91",WMe="_cardTop_1nily_96",GMe="_cardCheckbox_1nily_103",KMe="_colorDot_1nily_108",YMe="_cardLabel_1nily_115",QMe="_currentBadge_1nily_135",XMe="_cardMeta_1nily_145",JMe="_metaItem_1nily_153",ZMe="_statusBadge_1nily_162",eNe="_statusApproval_1nily_172",tNe="_statusRunning_1nily_181",nNe="_statusIdle_1nily_190",sNe="_empty_1nily_199",rNe="_colorRed_1nily_207",iNe="_colorOrange_1nily_210",oNe="_colorYellow_1nily_213",aNe="_colorGreen_1nily_216",lNe="_colorBlue_1nily_219",cNe="_colorPurple_1nily_222",Un={panel:OMe,toolbar:BMe,count:PMe,selectAll:$Me,actionButton:zMe,refreshButton:FMe,notice:qMe,grid:HMe,card:UMe,cardCurrent:VMe,cardTop:WMe,cardCheckbox:GMe,colorDot:KMe,cardLabel:YMe,currentBadge:QMe,cardMeta:XMe,metaItem:JMe,statusBadge:ZMe,statusApproval:eNe,statusRunning:tNe,statusIdle:nNe,empty:sNe,colorRed:rNe,colorOrange:iNe,colorYellow:oNe,colorGreen:aNe,colorBlue:lNe,colorPurple:cNe},uNe=3e3,dNe=1e4,nI={needsApproval:0,running:1,idle:2};function hNe(e,t,n){const s=new Map(t.map(i=>[i.sessionId,i])),r=e.map(i=>{var c;const o=s.get(i.sessionId),a=i.hasActivePrompt??(o==null?void 0:o.hasActivePrompt)??!1,l=((o==null?void 0:o.pendingPermissionCount)??0)>0;return{sessionId:i.sessionId,label:((c=i.displayName)==null?void 0:c.trim())||i.sessionId.slice(0,8),status:l?"needsApproval":a?"running":"idle",clientCount:i.clientCount??(o==null?void 0:o.clientCount)??0,model:o==null?void 0:o.currentModelId,updatedAt:i.updatedAt||i.createdAt,color:i.color,isCurrent:i.sessionId===n}});return r.sort((i,o)=>{const a=nI[i.status]-nI[o.status];return a!==0?a:(o.updatedAt??"").localeCompare(i.updatedAt??"")}),r}function n_(...e){return e.filter(Boolean).join(" ")}function fNe(e){switch(e){case"red":return Un.colorRed;case"orange":return Un.colorOrange;case"yellow":return Un.colorYellow;case"green":return Un.colorGreen;case"blue":return Un.colorBlue;case"purple":return Un.colorPurple;default:return}}function sI(e){switch(e){case"needsApproval":return Un.statusApproval;case"running":return Un.statusRunning;default:return Un.statusIdle}}function mNe({onOpenSession:e,onOpenSplit:t}){var L,$;const{t:n}=it(),s=Ta(),r=s.sessionId,i=(($=(L=s.capabilities)==null?void 0:L.features)==null?void 0:$.includes(V8))??!1,{sessions:o,loading:a,error:l,reload:c}=nh({autoLoad:!0,pageSize:kw,archiveState:"active",...i?{view:"organized",group:"all"}:{}}),d=Ek({autoLoad:!0,detail:"full"}),h=d.reload,f=d.report,[m,g]=p.useState(()=>new Set),[y,b]=p.useState(!1),w=p.useRef(!1);p.useEffect(()=>{const F=window.setInterval(()=>{document.hidden||w.current||(w.current=!0,c().finally(()=>{w.current=!1}))},uNe);return()=>window.clearInterval(F)},[c]);const v=p.useRef(!1);p.useEffect(()=>{const F=window.setInterval(()=>{document.hidden||v.current||(v.current=!0,h().finally(()=>{v.current=!1}))},dNe);return()=>window.clearInterval(F)},[h]);const x=p.useMemo(()=>{var F;return hNe(o,((F=f==null?void 0:f.full)==null?void 0:F.sessions)??[],r)},[o,f,r]),C=p.useCallback(F=>{g(B=>{const Q=new Set(B);return Q.has(F)?Q.delete(F):Q.add(F),Q})},[]),A=x.map(F=>F.sessionId).filter(F=>m.has(F)),T=A.length,_=x.length>0&&T===x.length,R=A.slice(0,Of),I=T>Of,k=p.useCallback(()=>{g(F=>{const B=x.map(Y=>Y.sessionId);return B.length>0&&B.every(Y=>F.has(Y))?new Set:new Set(B)})},[x]);p.useEffect(()=>{g(F=>{if(F.size===0)return F;const B=new Set(x.map(ne=>ne.sessionId));let Q=!1;const Y=new Set;for(const ne of F)B.has(ne)?Y.add(ne):Q=!0;return Q?Y:F})},[x]);const j=p.useCallback(()=>{if(R.length===0)return;const F=EMe(R,window.location.href,bq()),B=window.open(F,"_blank");B&&(B.opener=null,B.focus()),b(!B)},[R]),N=p.useCallback(()=>{c(),h()},[c,h]);return x.length===0?u.jsx("div",{className:Un.panel,children:u.jsx("div",{className:Un.empty,children:a?n("sessionsOverview.loading"):l?`${n("sessionsOverview.loadFailed")}: ${l.message}`:n("sessionsOverview.empty")})}):u.jsxs("div",{className:Un.panel,children:[u.jsxs("div",{className:Un.toolbar,children:[u.jsx("span",{className:Un.count,children:n("sessionsOverview.count",{count:x.length})}),u.jsxs("label",{className:Un.selectAll,children:[u.jsx("input",{type:"checkbox",checked:_,onChange:k}),n("sessionsOverview.selectAll")]}),u.jsx("button",{type:"button",className:Un.actionButton,disabled:T===0,onClick:j,title:n("sessionsOverview.openInTabHint"),children:n("sessionsOverview.openInTab")}),t&&u.jsx("button",{type:"button",className:Un.actionButton,disabled:T===0,onClick:()=>t(R),title:n("sessionsOverview.openInSplitHint"),children:n("sessionsOverview.openInSplit")}),u.jsx("button",{type:"button",className:Un.refreshButton,onClick:N,children:n("sessionsOverview.refresh")})]}),I&&u.jsx("div",{className:Un.notice,role:"status",children:n("sessionsOverview.splitCap",{max:Of})}),y&&u.jsx("div",{className:Un.notice,role:"alert",children:n("sessionsOverview.popupBlocked")}),l&&u.jsxs("div",{className:Un.notice,role:"alert",children:[n("sessionsOverview.loadFailed"),": ",l.message]}),u.jsx("ul",{className:Un.grid,children:x.map(F=>u.jsxs("li",{className:n_(Un.card,sI(F.status),F.isCurrent&&Un.cardCurrent),children:[u.jsxs("div",{className:Un.cardTop,children:[u.jsx("input",{type:"checkbox",className:Un.cardCheckbox,checked:m.has(F.sessionId),onChange:()=>C(F.sessionId),"aria-label":n("sessionsOverview.selectSession",{name:F.label})}),F.color&&u.jsx("span",{className:n_(Un.colorDot,fNe(F.color)),"aria-hidden":"true"}),u.jsx("button",{type:"button",className:Un.cardLabel,onClick:()=>e(F.sessionId),title:F.label,children:F.label}),F.isCurrent&&u.jsx("span",{className:Un.currentBadge,children:n("sessionsOverview.current")})]}),u.jsxs("div",{className:Un.cardMeta,children:[u.jsx("span",{className:n_(Un.statusBadge,sI(F.status)),children:n(`sessionsOverview.status.${F.status}`)}),F.model&&u.jsx("span",{className:Un.metaItem,title:F.model,children:F.model}),F.clientCount>0&&u.jsx("span",{className:Un.metaItem,title:n("sessionsOverview.openElsewhere"),children:n("common.clients",{count:F.clientCount})}),F.updatedAt&&u.jsx("span",{className:Un.metaItem,children:xw(F.updatedAt,n)})]})]},F.sessionId))})]})}function pNe({onOpenSession:e,onOpenSplit:t}){const{t:n}=it();return u.jsx(Tc,{label:"session-overview",fallback:s=>u.jsx("div",{className:Un.panel,children:u.jsxs("div",{className:Un.empty,children:[n("sessionsOverview.loadFailed"),": ",s.message]})}),children:u.jsx(mNe,{onOpenSession:e,onOpenSplit:t})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function gNe(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function yNe(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 bNe(e,t){return e===void 0?{}:t?{data:{...Pi(e)??{value:e},errorKind:t}}:{data:e}}function wNe(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 vNe(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 xNe(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function _Ne(e){return xNe(e)||!e.text&&!e.usage?null:e}function rI(e){return e.text.length===0}function kNe(e){const t=e.flatMap((n,s)=>{const r=Pi(n),i=Yi(r,"content");return i?[{id:Yi(r,"id")??`plan-${s}`,content:i,status:MNe(Yi(r,"status")),...(()=>{const a=NNe(Yi(r,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function iI(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 SNe(e,t={}){var c,d,h;const n=[],s=((c=t.labels)==null?void 0:c.promptCancelled)??"Request cancelled.",r=new Map,i=new Map;let o=null,a=null,l=!1;for(let f=0;f<e.length;f++){const m=e[f],g=m.serverTimestamp??m.clientReceivedAt;switch(m.kind){case"user":{o=null,a=null,l=!1;const y=m,b=Pi(y.meta),w=Yi(b,"source"),v={id:m.id,role:"user",content:y.text,timestamp:g,...w?{source:w}:{}};y.images&&y.images.length>0&&(v.images=y.images.map(x=>({data:x.data,mimeType:x.mimeType||"image/*"}))),n.push(v);break}case"assistant":{const y=_Ne(m);if(!y)break;const b=y.parentToolCallId?r.get(y.parentToolCallId):void 0;if(b){oI(b,y.text);break}const w=HNe(y.text);if(w){let x=null,C=!1,A=0,T=0;for(const _ of w)_.kind==="insight"?_.data.type==="insight_progress"?x=_.data:_.data.type==="insight_ready"?(C=!0,n.push({id:`${m.id}-ir-${A++}`,role:"insight_ready",path:_.data.path,timestamp:g})):_.data.type==="insight_error"&&(C=!0,n.push({id:`${m.id}-ie-${T++}`,role:"insight_error",error:_.data.error,timestamp:g})):(n.push({id:`${m.id}-t-${n.length}`,role:"assistant",content:_.text,timestamp:g}),o=n.length-1,a=null);x&&!C&&n.push({id:`${m.id}-ip`,role:"insight_progress",stage:x.stage,progress:x.progress,detail:x.detail,timestamp:g}),l=!0;break}const v=o!==null?n[o]:void 0;if(v&&v.role==="assistant"&&!l&&!rI(y)){const x=iI(v.usage,y.usage);n[o]={...v,content:v.content+y.text,isStreaming:y.streaming,...x?{usage:x}:{}},l=!1,a=null}else if(!rI(y))n.push({id:m.id,role:"assistant",content:y.text,isStreaming:y.streaming,timestamp:g,...y.usage?{usage:y.usage}:{}}),o=n.length-1,a=null,l=!1;else if(y.usage&&v&&v.role==="assistant"){const x=iI(v.usage,y.usage);n[o]={...v,...x?{usage:x}:{}}}break}case"thought":{const y=m,b=y.parentToolCallId?r.get(y.parentToolCallId):void 0;if(b){oI(b,y.text);break}const w=a!==null?n[a]:void 0;w&&w.role==="thinking"&&!l?(n[a]={...w,content:w.content+y.text,isStreaming:y.streaming},l=!1):(n.push({id:m.id,role:"thinking",content:y.text,isStreaming:y.streaming,timestamp:g}),a=n.length-1,l=!1),o=null;break}case"tool":{const b=INe(m),w=i.get(b.callId);w!=null&&w.title&&(b.title=w.title),!b.args&&(w!=null&&w.args)&&(b.args=w.args);const v=b.parentToolCallId?r.get(b.parentToolCallId):void 0,x=r.get(b.callId);if(x){aI(x,b);break}if(v){TNe(v,b),r.set(b.callId,b);break}s_(n,m.id,b,g),r.set(b.callId,b),o=null,a=null,l=!0;break}case"shell":{const y=m,b=n[n.length-1];if(b&&b.role==="tool_group"){const w=CNe(b.tools),v=b.tools[w];if(v){const x=typeof v.rawOutput=="string"?v.rawOutput:"",C={...v,rawOutput:x+y.text};n[n.length-1]={...b,tools:[...b.tools.slice(0,w),C,...b.tools.slice(w+1)]},r.get(v.callId)===v&&r.set(v.callId,C)}}else n.push({id:m.id,role:"tool_group",tools:[{callId:m.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:y.text}],timestamp:g}),l=!0;break}case"user_shell":{const y=m;n.push({id:m.id,role:"user_shell",command:y.command,output:y.text,...y.cwd?{cwd:y.cwd}:{},timestamp:g}),l=!0;break}case"permission":{const y=m;RNe(y,i);const b=jNe(y);if(!b)break;const w=wq(b);if(!y.resolved)break;const v=r.get(b.callId);if(v){const x=v.status;b.toolName=v.toolName,y.resolved&&(r_(y.resolved)?b.status=w?b.status:"in_progress":(b.status="failed",b.endTime=y.updatedAt)),aI(v,b),y.resolved&&w&&r_(y.resolved)&&(v.status=x);break}if(y.resolved){r_(y.resolved)?(w||(b.status="in_progress"),s_(n,m.id,b,g),r.set(b.callId,b),l=!0):(b.status="failed",b.endTime=y.updatedAt,s_(n,m.id,b,g),r.set(b.callId,b),l=!0);break}break}case"status":case"debug":{const y=m,b=y.source==="session_branched"?wNe(y.data):null,w=y.source==="mid_turn_message_injected"?vNe(y.data):null,v=b&&((d=t.labels)!=null&&d.branchSuccess)?t.labels.branchSuccess(b):w&&((h=t.labels)!=null&&h.midTurnInserted)?t.labels.midTurnInserted(w):y.text;if(gNe(v))break;const x=ENe(v);if(x){n.push({id:m.id,role:"plan",todos:x,timestamp:g}),l=!0;break}n.push({id:m.id,role:"system",content:v,variant:"info",timestamp:g,...y.source?{source:y.source}:{},...y.data!==void 0?{data:y.data}:{}}),l=!0;break}case"error":{const y=m,b=y.errorKind;n.push({id:m.id,role:"system",content:yNe(y,t.labels),variant:"error",retryable:y.source==="turn_error",timestamp:g,...y.source?{source:y.source}:{},...bNe(y.data,b)}),l=!0;break}case"prompt_cancelled":n.push({id:m.id,role:"system",content:s,variant:"info",source:"prompt_cancelled",timestamp:g}),l=!0;break}}return n}function TNe(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function oI(e,t){e.subContent=(e.subContent||"")+t}function s_(e,t,n,s){const r=o=>wq(o)||Dc(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 CNe(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 aI(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 wq(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||ANe(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function ANe(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function ENe(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),s=Pi(n);return(s==null?void 0:s.sessionUpdate)!=="plan"||!Array.isArray(s.entries)?void 0:kNe(s.entries)}catch{return}}function Pi(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Yi(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function MNe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function NNe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function INe(e){const t=DNe(e),n=LNe(e,t),s=ONe(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:xq(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 jNe(e){const t=Pi(e.toolCall);if(!t)return;const n=vq(t);if(Array.isArray(n==null?void 0:n.questions))return;const s=Pi(t._meta),r=Yi(t,"kind"),i=Yi(s,"toolName")??Yi(t,"toolName")??Yi(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(r==="fetch"?"web_fetch":r),o=Yi(t,"toolCallId")??Yi(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:Yi(t,"title")??e.title,status:"pending",kind:xq(i,r),args:n,startTime:e.createdAt}}function RNe(e,t){const n=Pi(e.toolCall),s=Yi(n,"toolCallId")??Yi(n,"id");if(!s)return;const r=Yi(n,"title")??e.title,i=n?vq(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(s,{...r?{title:r}:{},...i?{args:i}:{}})}function r_(e){const[t="",n=""]=e.toLowerCase().split(":",2);return lI(t)?!0:t!=="selected"?!1:lI(n.trim())}function lI(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 vq(e){return Pi(e.rawInput)??Pi(e.input)??Pi(e.args)}function LNe(e,t){var r;const n=(r=e.toolName)==null?void 0:r.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const s=Pi(t);return(s==null?void 0:s.status)==="background"}function DNe(e){return BNe(e)&&e.status==="failed"?PNe(e)??e.details??e.rawOutput:!$Ne(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 ONe(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const s=Pi(n);if(!s)return[];const r=s.type;if(r==="content"){const i=Pi(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 BNe(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function PNe(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 $Ne(e){return e==="cancelled"||e==="canceled"}const zNe=['"insight_progress":','"insight_ready":','"insight_error":'];function FNe(e){try{const t=JSON.parse(e),n=Pi(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=Pi(t.insight_ready);if(s&&typeof s.path=="string")return{type:"insight_ready",path:s.path};const r=Pi(t.insight_error);if(r&&typeof r.error=="string")return{type:"insight_error",error:r.error}}catch{}return null}function qNe(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 HNe(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(!zNe.some(f=>a.startsWith(f))){s=o+1;continue}const c=qNe(e,o);if(!c){s=o+1;continue}const d=FNe(c);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+c.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 xq(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 _q(e){const t=hg();return p.useMemo(()=>SNe(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n}),modelStreamInterrupted:e("error.modelStreamInterrupted")}}),[t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function UNe(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 l=r.findIndex(c=>c.text===a&&(!c.images||c.images.length===0));l>=0&&(r.splice(l,1),i=!0)}return i?r:null}function VNe(e,t,n,s){return e?!0:(s.append(t),!1)}function kq(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const WNe=100;function cI(e,t){return e.length!==t.length?!1:e.every((n,s)=>{var i,o;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)})}function uI(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function Sq({connected:e,sessionId:t,clientId:n,streamingState:s,sessionActions:r,store:i,editorRef:o,reportError:a,notifySuccess:l,t:c}){const[d,h]=p.useState([]),f=p.useRef([]),m=p.useRef(1),g=p.useRef(t),y=p.useRef(null),b=p.useRef(new Set),w=p.useRef(new Set),v=p.useRef(new Set),x=p.useRef(new Map),C=p.useRef(new Set),A=p.useRef([]),T=p.useRef(s),_=p.useRef(0);g.current=t,T.current=s;const R=p.useMemo(()=>d.map(te=>te.text),[d]);p.useEffect(()=>{f.current=d},[d]),p.useEffect(()=>{var te;f.current=[],h([]),x.current.clear(),C.current.clear(),A.current=[];for(const H of b.current)H.abort();b.current.clear(),w.current.clear(),v.current.clear(),F.current=void 0,(te=y.current)==null||te.abort(),y.current=null},[t]);const I=p.useCallback((te,H)=>{const ie=f.current.filter(fe=>fe.serverPromptId?te.some(Ne=>Ne.promptId===fe.serverPromptId):!0);for(const fe of te){if(w.current.has(fe.promptId))continue;const Ne=ie.findIndex(ve=>ve.serverPromptId===fe.promptId),Ie=v.current.has(fe.promptId);if(Ne!==-1){if(Ie){ie.splice(Ne,1);continue}ie[Ne]={...ie[Ne],text:fe.text,serverState:fe.state};continue}const Ce=ie.filter(ve=>!ve.serverPromptId&&ve.serverState==="submitting"&&ve.text===fe.text);if(Ce.length===1){const ve=ie.indexOf(Ce[0]);if(Ie){ie.splice(ve,1);continue}ie[ve]={...Ce[0],serverPromptId:fe.promptId,serverState:fe.state};continue}fe.state==="running"||Ie||ie.push({id:m.current++,sessionId:H,text:fe.text,serverPromptId:fe.promptId,serverState:fe.state})}cI(f.current,ie)||(f.current=ie,h(ie))},[]),k=p.useCallback(async(te=t)=>{if(!e||!te||g.current!==te)return"skipped";const H=++_.current;try{const ie=await r.getPendingPrompts({sessionId:te});return H!==_.current?"superseded":g.current!==te?"skipped":(I(ie.pendingPrompts.filter(fe=>fe.state==="queued"||fe.state==="running"),te),"refreshed")}catch(ie){return console.warn("Failed to refresh pending prompts",ie),"failed"}},[e,r,t,I]),j=p.useCallback(te=>{const H=g.current,ie=te.filter(Ce=>Ce.sessionId===void 0||Ce.sessionId===H);if(ie.length===0)return;const fe=new Set(f.current.map(Ce=>Ce.id)),Ne=ie.filter(Ce=>!fe.has(Ce.id));if(Ne.length===0)return;const Ie=[...f.current,...Ne].sort((Ce,ve)=>Ce.id-ve.id);f.current=Ie,h(Ie)},[]),N=p.useCallback((te,H,ie)=>{var Ie,Ce,ve,ut;if(ie!==void 0&&g.current!==ie)return;const fe=((Ie=o.current)==null?void 0:Ie.getText())??"",Ne=fe.trim()?`${te}
${fe}`:te;(Ce=o.current)==null||Ce.setText(Ne),H&&H.length>0&&((ve=o.current)==null||ve.restoreImages(H)),(ut=o.current)==null||ut.focus()},[o]),L=p.useSyncExternalStore(kY,_Y),$=p.useRef(L),F=p.useRef(void 0);p.useEffect(()=>{if(!e||!t)return;const te=$.current!==L;if($.current=L,!te){if(f.current.length>0||s==="idle"||F.current===t)return;F.current=t}k()},[L,e,t,s,k]);const B=p.useSyncExternalStore(SY,UC,UC);p.useEffect(()=>{if(!t||B.length===0)return;const te=[];for(const H of B){if(H.data.sessionId!==t)continue;te.push(H);const ie=H.data.promptId;if(ie){if(H.type==="pending_prompt_started"){if(w.current.has(ie))continue;if((H.originatorClientId===void 0||H.originatorClientId===n)&&!v.current.has(ie)){const Ne=typeof H.data.text=="string"?H.data.text:"",Ie=f.current.find(ve=>ve.serverPromptId===ie)??f.current.find(ve=>!ve.serverPromptId&&ve.serverState==="submitting"&&ve.text===Ne),Ce=(Ie==null?void 0:Ie.text)??"";Ce&&(v.current.add(ie),i.appendLocalUserMessage(Ce,uI(Ie==null?void 0:Ie.images)))}k()}else if(H.type==="turn_complete"){v.current.delete(ie);const fe=x.current.get(ie);if(x.current.delete(ie),fe)fe();else if(!C.current.has(ie))for(C.current.add(ie),A.current.push(ie);A.current.length>WNe;){const Ne=A.current.shift();Ne&&C.current.delete(Ne)}}else if(H.type==="turn_error"||H.type==="pending_prompt_completed"&&H.data.state==="removed"){v.current.delete(ie);const fe=x.current.get(ie);x.current.delete(ie),fe==null||fe(),C.current.delete(ie),A.current=A.current.filter(Ne=>Ne!==ie)}}}CY(te)},[B,t,n,i,k]);const Q=p.useCallback((te,H)=>{if(C.current.delete(te)){A.current=A.current.filter(ie=>ie!==te),H();return}x.current.set(te,H)},[]),Y=p.useCallback((te,H,ie)=>{const fe=te.trim();if(!fe)return!0;const Ne=m.current++,Ie=g.current,Ce=new AbortController;b.current.add(Ce);const ve=H?[...H]:void 0,ut={id:Ne,sessionId:Ie,text:fe,images:ve,onComplete:ie,serverState:"submitting"};return f.current=[...f.current,ut],h(f.current),r.submitPrompt(fe,{images:H,optimisticUserMessage:!1,sessionId:Ie,signal:Ce.signal}).then(ae=>{if(b.current.delete(Ce),g.current!==Ie){r.removePendingPrompt(ae.promptId,{sessionId:Ie}).catch(qt=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:Ie,promptId:ae.promptId,error:qt})});return}if(T.current==="idle"){v.current.has(ae.promptId)||(v.current.add(ae.promptId),i.appendLocalUserMessage(fe,uI(ve)));const qt=f.current.filter(gt=>gt.id!==Ne);f.current=qt,h(qt),ie&&Q(ae.promptId,ie);return}const Ct=f.current,Ke=Ct.findIndex(qt=>qt.id===Ne);if(Ke===-1){r.removePendingPrompt(ae.promptId,{sessionId:Ie}).then(qt=>{qt.removed||k(Ie)},()=>{k(Ie)});return}const on=[...Ct];on[Ke]={...on[Ke],serverPromptId:ae.promptId,serverState:"queued"},f.current=on,h(on),ie&&Q(ae.promptId,ie)}).catch(ae=>{if(b.current.delete(Ce),g.current!==Ie||!f.current.some(Ke=>Ke.id===Ne))return;const Ct=f.current.filter(Ke=>Ke.id!==Ne);f.current=Ct,h(Ct),N(fe,ve,Ie),a(ae,c("queue.queueFailed"))}),!0},[k,a,N,r,Q,i,c]);p.useEffect(()=>{if(s!=="idle")return;const te=y.current;te&&(te.abort(),y.current=null)},[s]);const ne=p.useCallback(te=>{const H=f.current;if(H.length===0)return null;const ie=te===void 0?H.length-1:H.findIndex(Ie=>Ie.id===te);if(ie<0)return null;const fe=H[ie],Ne=H.filter((Ie,Ce)=>Ce!==ie);return f.current=Ne,h(Ne),(fe==null?void 0:fe.text)??null},[]),P=p.useCallback((te,H)=>{const ie=f.current.map(fe=>fe.id===te?{...fe,...H}:fe);cI(ie,f.current)||(f.current=ie,h(ie))},[]),le=p.useCallback(async(te,H,ie)=>{if(!te.serverPromptId)return!0;if(te.serverState!=="queued"||w.current.has(te.serverPromptId))return!1;const fe=te.sessionId;w.current.add(te.serverPromptId),P(te.id,H);try{const Ne=await r.removePendingPrompt(te.serverPromptId,{sessionId:fe});return w.current.delete(te.serverPromptId),Ne.removed?(x.current.delete(te.serverPromptId),await k(fe)==="failed"&&(P(te.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),ie)),!0):(P(te.id,{isEditing:!1,isRemoving:!1}),await k(fe),a(new Error("Prompt could not be removed from queue"),ie),!1)}catch(Ne){return w.current.delete(te.serverPromptId),P(te.id,{isEditing:!1,isRemoving:!1}),await k(fe)!=="refreshed"&&j([te]),a(Ne,ie),!1}},[k,a,j,r,P]),z=p.useCallback(te=>{const H=f.current.find(ie=>ie.id===te);if((H==null?void 0:H.serverState)!=="submitting"&&H){if(!H.serverPromptId){const ie=f.current.filter(fe=>fe.id!==te);f.current=ie,h(ie);return}le(H,{isRemoving:!0},c("queue.deleteFailed"))}},[le,c]),M=p.useCallback(async te=>{var Ce;const H=f.current.find(ve=>ve.id===te);if(!H||(((Ce=H.images)==null?void 0:Ce.length)??0)>0||H.serverState==="submitting"||H.isEditing||H.isRemoving||kq(H.text))return;const ie=H.serverPromptId?H.onComplete??x.current.get(H.serverPromptId):void 0,fe=()=>{H.serverPromptId&&x.current.delete(H.serverPromptId),ie==null||ie()};if(H.serverPromptId&&!await le(H,{isRemoving:!0},c("queue.insertFailed")))return;let Ne=y.current;Ne||(Ne=new AbortController,y.current=Ne);let Ie;try{Ie=await r.enqueueMidTurnMessage(H.text,{signal:Ne.signal})}catch(ve){H.serverPromptId&&(N(H.text,H.images,H.sessionId),fe()),a(ve,c("queue.insertFailed"));return}if(!Ie.accepted){H.serverPromptId&&(N(H.text,H.images,H.sessionId),fe()),a(new Error("Queued message was not accepted for insertion"),c("queue.insertFailed"));return}if(fe(),!H.serverPromptId){const ve=f.current.filter(ut=>ut.id!==te);f.current=ve,h(ve)}l(c("queue.inserted"))},[le,l,a,N,r,c]),re=p.useCallback(async te=>{const H=f.current.find(fe=>fe.id===te);if(!H||H.serverState==="submitting"||H.isEditing||H.isRemoving)return;if(H.serverPromptId){if(!await le(H,{isEditing:!0},c("queue.editFailed")))return;N(H.text,H.images,H.sessionId);return}const ie=ne(te);ie&&N(ie,H.images,H.sessionId)},[ne,le,N,c]),U=p.useCallback(()=>{const te=f.current;if(te.length===0)return!1;const H=te[te.length-1];if(!H)return!1;if(H.serverState==="submitting"||H.isEditing||H.isRemoving)return!0;if(!H.serverPromptId){const ie=ne(H.id);return ie?(N(ie,H.images,H.sessionId),!0):!1}return H.serverState!=="queued"?!1:((async()=>{await le(H,{isEditing:!0},c("queue.editFailed"))&&N(H.text,H.images,H.sessionId)})().catch(ie=>{a(ie,c("queue.editFailed"))}),!0)},[ne,le,a,N,c]),W=p.useCallback(()=>{if(f.current.length===0)return!1;const te=g.current,H=f.current.filter(ve=>ve.serverState==="submitting"),ie=f.current.filter(ve=>ve.serverState!=="submitting");for(const ve of[...H].reverse())N(ve.text,ve.images,ve.sessionId);for(const ve of b.current)ve.abort();const fe=ie.filter(ve=>ve.serverPromptId);if(fe.length===0)return f.current=[],h([]),i.dispatch([{type:"status",text:c("queue.cleared")}]),!0;const Ne=new Set(f.current.map(ve=>ve.id)),Ie=new Set(fe.map(ve=>ve.serverPromptId).filter(ve=>!!ve));for(const ve of Ie)w.current.add(ve);const Ce=f.current.filter(ve=>!Ne.has(ve.id)).concat(fe.map(ve=>({...ve,isRemoving:!0})));return f.current=Ce,h(Ce),(async()=>{var Ct;const ve=[];if(await Promise.all(fe.map(async Ke=>{const on=Ke.serverPromptId;try{if((await r.removePendingPrompt(on,{sessionId:Ke.sessionId})).removed){x.current.delete(on);return}ve.push(Ke)}catch{ve.push(Ke)}finally{w.current.delete(on)}})),g.current!==te)return;const ut=ve.map(Ke=>({...Ke,isRemoving:!1})),ae=f.current.filter(Ke=>Ke.serverPromptId?!Ie.has(Ke.serverPromptId):!Ne.has(Ke.id)).concat(ut);if(f.current=ae,h(ae),ve.length>0){a(new Error("Some prompts could not be removed from queue"),c("queue.deleteFailed")),k((Ct=ve[0])==null?void 0:Ct.sessionId);return}i.dispatch([{type:"status",text:c("queue.cleared")}])})(),!0},[k,a,N,i,c,r]),{batches:J,consume:G}=eQ();return p.useEffect(()=>{if(!t||J.length===0)return;const te=UNe(f.current,J,t,n);te&&(f.current=te,h(te)),G(J.filter(H=>H.sessionId===t))},[J,t,n,G]),{queuedPrompts:d,queuedTexts:R,enqueuePrompt:Y,removeQueuedPrompt:z,insertQueuedPrompt:M,editQueuedPrompt:re,editLastQueuedPrompt:U,clearQueuedPrompts:W}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function MS(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Fl(e.toolName):!0}function Sw(e){return Ww.includes(e)}async function GNe({sessionActions:e,modelId:t,modeId:n,workspaceCwd:s,warn:r=console.warn}){await e.createSession({workspaceCwd:s});try{await e.attachSession()}catch(i){throw r("[WebShell] failed to attach new session:",i),await e.closeSession().catch(o=>{r("[WebShell] failed to close unattached session:",o)}),await e.clearSession().catch(o=>{r("[WebShell] failed to clear unattached session:",o)}),i}await Promise.all([t?e.setModel(t).catch(i=>{r("[WebShell] failed to set model for new session:",i)}):Promise.resolve(),n&&Sw(n)?e.setApprovalMode(n).catch(i=>{r("[WebShell] failed to set approval mode for new session:",i)}):Promise.resolve()])}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const KNe=new Set(["coder-model(qwen-oauth)"]);function NS(e){return!KNe.has(e.id)}function Tq(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:"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 YNe={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"},QNe={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 Cq(e){return QNe[e]}function Aq(e,t){return e.map(n=>{const s=YNe[n.name];return!s||n.source&&n.source!=="builtin-command"?n:{...n,description:t(s)}})}function Eq(...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 XNe="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",JNe="/assets/insert-DmRbh9Rv.svg",ZNe="/assets/queue-DWpnpFgW.svg",eIe="_app_eicyb_1",tIe="_appChat_eicyb_36",nIe="_appChatEmpty_eicyb_42",sIe="_appShell_eicyb_47",rIe="_chatPane_eicyb_55",iIe="_chatPaneShowingPage_eicyb_67",oIe="_fullPage_eicyb_73",aIe="_fullPageHeader_eicyb_82",lIe="_splitApprovalNotice_eicyb_92",cIe="_fullPageBack_eicyb_118",uIe="_fullPageTitle_eicyb_135",dIe="_fullPageBody_eicyb_140",hIe="_mobileDrawer_eicyb_147",fIe="_mobileBackdrop_eicyb_151",mIe="_hamburgerButton_eicyb_155",pIe="_mobileDrawerOpen_eicyb_194",gIe="_hamburgerButtonFloating_eicyb_229",yIe="_appWithSidebar_eicyb_237",bIe="_themeDark_eicyb_277",wIe="_themeLight_eicyb_345",vIe="_content_eicyb_413",xIe="_contentHasMessages_eicyb_421",_Ie="_missingSessionState_eicyb_430",kIe="_missingSessionMessage_eicyb_443",SIe="_missingSessionButton_eicyb_450",TIe="_panelHost_eicyb_485",CIe="_panelHeader_eicyb_493",AIe="_panelBack_eicyb_503",EIe="_panelTitle_eicyb_529",MIe="_panelBody_eicyb_538",NIe="_chatViewWrap_eicyb_548",IIe="_chatViewHidden_eicyb_556",jIe="_chatSubtree_eicyb_560",RIe="_chatSubtreeHidden_eicyb_564",LIe="_footer_eicyb_577",DIe="_bottomPanels_eicyb_587",OIe="_approvalOverlay_eicyb_602",BIe="_scrollToBottomLayer_eicyb_616",PIe="_scrollToBottomLayerWithTodos_eicyb_627",$Ie="_scrollToBottomButton_eicyb_634",zIe="_scrollToBottomIcon_eicyb_663",FIe="_btwPanel_eicyb_669",qIe="_composer_eicyb_676",HIe="_escClearStatus_eicyb_683",UIe="_emptyWelcomeFooter_eicyb_690",VIe="_queuedPrompts_eicyb_694",WIe="_queuedPrompt_eicyb_694",GIe="_queuedPromptIcon_eicyb_724",KIe="_queuedPromptMaskIcon_eicyb_734",YIe="_queuedPromptActionIcon_eicyb_735",QIe="_queuedPromptText_eicyb_748",XIe="_queuedPromptState_eicyb_756",JIe="_queuedPromptSpinner_eicyb_764",ZIe="_queuedPromptActions_eicyb_779",eje="_queuedPromptAction_eicyb_735",tje="_queuedHint_eicyb_824",Rt={app:eIe,appChat:tIe,appChatEmpty:nIe,appShell:sIe,chatPane:rIe,chatPaneShowingPage:iIe,fullPage:oIe,fullPageHeader:aIe,splitApprovalNotice:lIe,fullPageBack:cIe,fullPageTitle:uIe,fullPageBody:dIe,mobileDrawer:hIe,mobileBackdrop:fIe,hamburgerButton:mIe,mobileDrawerOpen:pIe,hamburgerButtonFloating:gIe,appWithSidebar:yIe,themeDark:bIe,themeLight:wIe,content:vIe,contentHasMessages:xIe,missingSessionState:_Ie,missingSessionMessage:kIe,missingSessionButton:SIe,panelHost:TIe,panelHeader:CIe,panelBack:AIe,panelTitle:EIe,panelBody:MIe,chatViewWrap:NIe,chatViewHidden:IIe,chatSubtree:jIe,chatSubtreeHidden:RIe,footer:LIe,bottomPanels:DIe,approvalOverlay:OIe,scrollToBottomLayer:BIe,scrollToBottomLayerWithTodos:PIe,scrollToBottomButton:$Ie,scrollToBottomIcon:zIe,btwPanel:FIe,composer:qIe,escClearStatus:HIe,emptyWelcomeFooter:UIe,queuedPrompts:VIe,queuedPrompt:WIe,queuedPromptIcon:GIe,queuedPromptMaskIcon:KIe,queuedPromptActionIcon:YIe,queuedPromptText:QIe,queuedPromptState:XIe,queuedPromptSpinner:JIe,queuedPromptActions:ZIe,queuedPromptAction:eje,queuedHint:tje},dI=240;function Mq({prompts:e,t,onDelete:n,onInsert:s,onEdit:r}){return e.length===0?null:u.jsxs("div",{className:Rt.queuedPrompts,children:[e.map(i=>{var w;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>dI?`${o.slice(0,dI)}...`:o,l=((w=i.images)==null?void 0:w.length)??0,c=kq(i.text),d=i.serverState==="submitting",h=i.serverState==="running",f=i.isRemoving===!0,m=d||h||i.isEditing===!0||f;let g=t("queue.insertTip");m?g=t("queue.submittingDisabled"):c&&(g=t("queue.insertCommandDisabled"));let y=t("queue.editTip");m&&(y=t("queue.submittingDisabled"));const b=t(m?"queue.submittingDisabled":"queue.deleteTip");return u.jsxs("div",{className:Rt.queuedPrompt,children:[u.jsx("span",{className:Rt.queuedPromptIcon,"aria-hidden":"true",children:u.jsx("span",{className:Rt.queuedPromptMaskIcon,style:_u("--queued-icon-url",ZNe)})}),u.jsxs("span",{className:Rt.queuedPromptText,children:[a,l>0?` ${t("queue.imageCount",{count:l})}`:"",d||i.isEditing||f?u.jsxs("span",{className:Rt.queuedPromptState,children:[u.jsx("span",{className:Rt.queuedPromptSpinner}),f?t("queue.removing"):i.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),u.jsxs("span",{className:Rt.queuedPromptActions,children:[l===0&&u.jsxs("button",{type:"button",className:Rt.queuedPromptAction,onClick:()=>s(i.id),disabled:c||m,title:g,children:[u.jsx("span",{className:Rt.queuedPromptActionIcon,style:_u("--queued-icon-url",JNe),"aria-hidden":"true"}),t("queue.insert")]}),u.jsx("button",{type:"button",className:Rt.queuedPromptAction,onClick:()=>n(i.id),disabled:m,"aria-label":t("queue.delete"),title:b,children:u.jsx("span",{className:Rt.queuedPromptActionIcon,style:_u("--queued-icon-url",XNe),"aria-hidden":"true"})}),u.jsx("button",{type:"button",className:Rt.queuedPromptAction,onClick:()=>r(i.id),disabled:m,"aria-label":t("queue.edit"),title:y,children:u.jsx("span",{className:Rt.queuedPromptActionIcon,style:_u("--queued-icon-url",sq),"aria-hidden":"true"})})]})]},i.id)}),u.jsx("div",{className:Rt.queuedHint,children:t("queue.footer")})]})}const nje="_approval_j86la_1",sje="_floating_j86la_18",rje="_header_j86la_31",ije="_icon_j86la_41",oje="_name_j86la_56",aje="_desc_j86la_67",lje="_content_j86la_87",cje="_code_j86la_105",uje="_codeBlock_j86la_113",dje="_question_j86la_133",hje="_options_j86la_139",fje="_option_j86la_139",mje="_optionPlain_j86la_167",pje="_optionSecondary_j86la_177",gje="_optionPrimary_j86la_184",yje="_optionActive_j86la_195",bje="_pointer_j86la_199",wje="_num_j86la_203",vje="_label_j86la_207",hr={approval:nje,floating:sje,header:rje,icon:ije,name:oje,desc:aje,content:lje,code:cje,codeBlock:uje,question:dje,options:hje,option:fje,optionPlain:mje,optionSecondary:pje,optionPrimary:gje,optionActive:yje,pointer:bje,num:wje,label:vje};function xje(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 _je(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function kje(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 Sje(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 Tje(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function hI(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 fI(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 ry(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const s=fI(t.option)-fI(n.option);return s===0?t.index-n.index:s}).map(({option:t})=>t)}function Cje(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 Aje(e){return e.kind==="allow_once"?hr.optionPrimary:e.kind==="allow_always"?hr.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?hr.optionPlain:hr.optionSecondary}function Nq({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=it(),i=p.useMemo(()=>ry(e.options),[e.options]),[o,a]=p.useState(()=>hI(ry(e.options))),l=p.useRef(e);l.current=e;const c=p.useRef(o),d=p.useRef(!1),h=p.useRef(!1);p.useEffect(()=>{const T=hI(ry(l.current.options));d.current=!1,h.current=!1,c.current=T,a(T)},[e.id]);const f=xje(e.title),m=e.toolName||f.toolName||e.kind||"Tool",g=zl(m,r),y=Tje(e),b=_je(e),w=p.useCallback(T=>{d.current||(d.current=!0,t(l.current.id,T))},[t]),v=p.useCallback(T=>{if(T.defaultPrevented||Yp(T.target))return;const _=l.current,R=ry(_.options),I=R.length;if(T.key==="ArrowUp"||T.key==="k")T.preventDefault(),h.current=!0,a(k=>{const j=(k-1+I)%I;return c.current=j,j});else if(T.key==="ArrowDown"||T.key==="j")T.preventDefault(),h.current=!0,a(k=>{const j=(k+1)%I;return c.current=j,j});else if(T.key==="Enter"){if(T.preventDefault(),!h.current){h.current=!0;return}const k=R[c.current];k&&w(k.id)}else if(T.key==="Escape"){T.preventDefault();const k=_.options.find(j=>j.kind==="reject_once"||j.kind==="reject_always");k&&w(k.id)}else if(T.key>="1"&&T.key<="9"){const k=parseInt(T.key)-1;k<I&&(T.preventDefault(),h.current=!0,w(R[k].id))}},[w]);p.useEffect(()=>{if(!s)return;const T=setTimeout(()=>{window.addEventListener("keydown",v)},250);return()=>{clearTimeout(T),window.removeEventListener("keydown",v)}},[v,s]);const x=kje(e),C=HW(e.toolName),A=Sje(e);return u.jsxs("div",{className:n==="floating"?`${hr.approval} ${hr.floating}`:hr.approval,"data-web-shell-permission-panel":!0,children:[u.jsxs("div",{className:hr.header,children:[u.jsx("span",{className:hr.icon,children:"?"}),u.jsx("span",{className:hr.name,children:g})]}),y&&u.jsx("div",{className:hr.desc,title:y,children:y}),x&&A?u.jsx("div",{className:hr.code,children:u.jsx("pre",{className:hr.codeBlock,title:A,children:A})}):b&&b!==e.title?u.jsx("pre",{className:hr.content,title:b,children:b}):null,u.jsx("div",{className:hr.question,children:C?r("approval.launchAgentQuestion"):x?r("approval.execQuestion",{tool:g}):r("approval.changeQuestion")}),u.jsx("div",{className:hr.options,children:i.map((T,_)=>{const R=_===o,I=Cje(T),k=I?r(I):T.label;return u.jsxs("div",{className:`${hr.option} ${Aje(T)} ${R?hr.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":T.id,onClick:()=>w(T.id),children:[u.jsx("span",{className:hr.pointer,children:R?"›":" "}),u.jsxs("span",{className:hr.num,children:[_+1,"."]}),u.jsx("span",{className:hr.label,children:k})]},T.id)})})]})}const Eje="_question_14a07_1",Mje="_floating_14a07_18",Nje="_titleLine_14a07_30",Ije="_icon_14a07_38",jje="_toolName_14a07_42",Rje="_toolDesc_14a07_46",Lje="_tabs_14a07_53",Dje="_topRight_14a07_63",Oje="_collapseButton_14a07_70",Bje="_collapseIcon_14a07_89",Pje="_collapseIconCollapsed_14a07_95",$je="_collapsed_14a07_99",zje="_tab_14a07_53",Fje="_tabActive_14a07_118",qje="_text_14a07_135",Hje="_description_14a07_143",Uje="_multiHint_14a07_151",Vje="_options_14a07_157",Wje="_option_14a07_157",Gje="_optionActive_14a07_179",Kje="_optionSelected_14a07_180",Yje="_optionLabel_14a07_185",Qje="_pointer_14a07_190",Xje="_optionNum_14a07_194",Jje="_editIcon_14a07_211",Zje="_optionContent_14a07_243",eRe="_optionPlaceholder_14a07_259",tRe="_optionDesc_14a07_264",nRe="_customInput_14a07_271",sRe="_actions_14a07_288",rRe="_button_14a07_296",iRe="_submitButton_14a07_322",oRe="_ignoreButton_14a07_328",Ln={question:Eje,floating:Mje,titleLine:Nje,icon:Ije,toolName:jje,toolDesc:Rje,tabs:Lje,topRight:Dje,collapseButton:Oje,collapseIcon:Bje,collapseIconCollapsed:Pje,collapsed:$je,tab:zje,tabActive:Fje,text:qje,description:Hje,multiHint:Uje,options:Vje,option:Wje,optionActive:Gje,optionSelected:Kje,optionLabel:Yje,pointer:Qje,optionNum:Xje,editIcon:Jje,optionContent:Zje,optionPlaceholder:eRe,optionDesc:tRe,customInput:nRe,actions:sRe,button:rRe,submitButton:iRe,ignoreButton:oRe};function Iq({request:e,onConfirm:t,variant:n="inline"}){const{t:s}=it(),r=p.useMemo(()=>{var Y;return Array.isArray((Y=e.rawInput)==null?void 0:Y.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,o]=p.useState(0),[a,l]=p.useState(null),[c,d]=p.useState({}),[h,f]=p.useState({}),[m,g]=p.useState({}),[y,b]=p.useState(!1),[w,v]=p.useState(!1),x=p.useRef(!1);p.useEffect(()=>{const Y=r[0];x.current=!1,v(!1),o(0),l(Y!=null&&Y.options.length?0:null),d(Y&&!Y.multiSelect&&Y.options[0]?{0:Y.options[0].label}:{}),f({}),g(Y!=null&&Y.multiSelect&&Y.options[0]?{0:[Y.options[0].label]}:{}),b(!1)},[r,e.id]);const C=r[i],A=(C==null?void 0:C.multiSelect)??!1,T=p.useCallback(()=>{const Y={};for(let ne=0;ne<r.length;ne++){const P=r[ne];if(P)if(P.multiSelect){const le=m[ne]||[],z=h[ne],M=z?[...le,z]:le;Y[String(ne)]=M.join(", ")}else Y[String(ne)]=c[ne]||h[ne]||""}return Y},[r,m,h,c]),_=p.useCallback(()=>{if(x.current)return;const Y=e.options.find(ne=>ne.kind==="allow_once");Y&&(x.current=!0,t(e.id,Y.id,T()))},[T,e,t]),R=p.useCallback(()=>{if(x.current)return;const Y=e.options.find(ne=>ne.kind==="reject_once"||ne.kind==="reject_always");Y&&(x.current=!0,t(e.id,Y.id,void 0))},[e,t]),I=p.useCallback(Y=>{Y!==void 0&&f(ne=>({...ne,[i]:Y})),A||d(ne=>{if(!(i in ne))return ne;const P={...ne};return delete P[i],P}),b(!0)},[i,A]),k=p.useCallback(Y=>{if(!C)return;if(Y===C.options.length){I();return}const P=C.options[Y].label;if(A){const le=m[i]||[],z=le.includes(P)?le.filter(M=>M!==P):[...le,P];g({...m,[i]:z})}else{const le={...c,[i]:P};d(le),f(z=>{if(!(i in z))return z;const M={...z};return delete M[i],M})}},[C,i,A,m,c,I]),j=p.useCallback(Y=>{if(!C||!A)return;if(Y===C.options.length){I();return}const ne=C.options[Y].label,P=m[i]||[],le=P.includes(ne)?P.filter(z=>z!==ne):[...P,ne];g({...m,[i]:le})},[C,A,m,i,I]);if(r.length===0)return null;const N=Y=>{const ne=r[Y];return ne?ne.multiSelect?(m[Y]||[]).length>0||!!h[Y]:!!c[Y]||!!h[Y]:!1},L=r.every((Y,ne)=>N(ne)),$=Math.min(i,r.length-1),F=Y=>{const ne=r[Y];if(o(Y),b(!1),!(ne!=null&&ne.options.length)){l(null);return}if(l(0),ne.multiSelect){g(P=>(P[Y]||[]).length>0||h[Y]?P:{...P,[Y]:[ne.options[0].label]});return}d(P=>P[Y]||h[Y]?P:{...P,[Y]:ne.options[0].label})},B=()=>{i<=0||F(i-1)},Q=()=>{i>=r.length-1||F(i+1)};return u.jsxs("div",{className:`${Ln.question} ${n==="floating"?Ln.floating:""} ${w?Ln.collapsed:""}`,children:[u.jsxs("div",{className:Ln.titleLine,children:[u.jsx("span",{className:Ln.icon,children:"?"}),u.jsx("span",{className:Ln.toolName,children:zl("ask_user_question",s)}),u.jsx("span",{className:Ln.toolDesc,children:s("askUser.progress",{current:$+1,total:r.length})}),u.jsxs("div",{className:Ln.topRight,children:[u.jsx("div",{className:Ln.tabs,children:r.map((Y,ne)=>u.jsx("span",{className:`${Ln.tab} ${ne===i?Ln.tabActive:""}`,"aria-hidden":"true"},ne))}),u.jsx("button",{type:"button",className:Ln.collapseButton,onClick:()=>v(Y=>!Y),"aria-expanded":!w,"aria-label":s(w?"common.expand":"common.collapse"),title:s(w?"common.expand":"common.collapse"),children:u.jsx("svg",{viewBox:"0 0 16 16",className:`${Ln.collapseIcon} ${w?Ln.collapseIconCollapsed:""}`,children:u.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!w&&u.jsxs(u.Fragment,{children:[C?u.jsxs(u.Fragment,{children:[u.jsxs("p",{className:Ln.text,children:[C.question,A&&u.jsxs("span",{className:Ln.multiHint,children:[" ","(",s("askUser.multiHint"),")"]})]}),u.jsx("p",{className:Ln.description,children:s("askUser.selectAnswer")}),u.jsxs("div",{className:Ln.options,onMouseLeave:()=>l(null),children:[C.options.map((Y,ne)=>{const P=ne===a,le=A?(m[i]||[]).includes(Y.label):c[i]===Y.label;return u.jsxs("div",{className:`${Ln.option} ${P?Ln.optionActive:""} ${le?Ln.optionSelected:""}`,onClick:()=>{l(ne),A?j(ne):k(ne)},onMouseEnter:()=>l(ne),children:[u.jsx("span",{className:Ln.pointer,children:P?"›":" "}),u.jsx("span",{className:Ln.optionNum,children:ne+1}),u.jsxs("span",{className:Ln.optionContent,children:[u.jsx("span",{className:Ln.optionLabel,children:Y.label}),Y.description&&u.jsx("span",{className:Ln.optionDesc,children:Y.description})]})]},Y.label)}),(()=>{const Y=a===C.options.length,ne=!!h[i];return u.jsxs("div",{className:`${Ln.option} ${Y?Ln.optionActive:""} ${ne?Ln.optionSelected:""}`,onClick:()=>{l(C.options.length),I()},onMouseEnter:()=>l(C.options.length),children:[u.jsx("span",{className:Ln.pointer,children:Y?"›":" "}),u.jsx("span",{className:Ln.editIcon,"aria-hidden":"true",children:u.jsx("svg",{viewBox:"0 0 16 16",children:u.jsx("path",{d:"M3.2 10.9 4 7.8 10.8 1l3.2 3.2-6.8 6.8-3 .8zM10 1.8l3.2 3.2M3 14h10",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}),y?u.jsx("input",{type:"text",className:Ln.customInput,placeholder:s("askUser.typePlaceholder"),value:h[i]||"",onChange:P=>f({...h,[i]:P.target.value}),onBlur:()=>b(!1),autoFocus:!0}):u.jsx("span",{className:`${Ln.optionLabel} ${h[i]?"":Ln.optionPlaceholder}`,children:h[i]||s("askUser.typePlaceholder")})]})})()]})]}):null,u.jsxs("div",{className:Ln.actions,children:[u.jsx("button",{type:"button",className:Ln.ignoreButton,onClick:R,children:s("askUser.ignore")}),r.length>1&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:Ln.button,disabled:i<=0,onClick:B,children:s("common.previous")}),u.jsx("button",{type:"button",className:Ln.button,disabled:i>=r.length-1,onClick:Q,children:s("common.next")})]}),u.jsx("button",{type:"button",className:`${Ln.button} ${Ln.submitButton}`,disabled:!L,onClick:_,children:s("askUser.submit")})]})]})]})}const aRe="_pane_1w7yf_1",lRe="_header_1w7yf_13",cRe="_connectionError_1w7yf_25",uRe="_connectionErrorText_1w7yf_33",dRe="_title_1w7yf_40",hRe="_closeButton_1w7yf_51",fRe="_body_1w7yf_71",mRe="_footer_1w7yf_79",pRe="_approval_1w7yf_85",cl={pane:aRe,header:lRe,connectionError:cRe,connectionErrorText:uRe,title:dRe,closeButton:hRe,body:fRe,footer:mRe,approval:pRe},gRe=["approvalMode","model","voice"];function yRe({title:e,onClose:t,onError:n}){var W;const{t:s}=it(),r=Ta(),i=fg(),o=_q(s),a=hg(),l=Qw(),c=Xw(),d=p.useRef(c);d.current=c;const h=p.useRef(null),{followupState:f,onAcceptFollowup:m,onDismissFollowup:g,clear:y}=CD({onAccept:J=>{var G;(G=h.current)==null||G.insertText(J)}}),b=p.useCallback((J,G)=>{n?n(J,G):console.error(G,J)},[n]),w=p.useCallback(J=>l.dispatch([{type:"status",text:J}]),[l]),v=p.useMemo(()=>AD(a),[a]),x=MS(v),C=v&&!x?v:null,A=v&&x?v:null,T=p.useRef(C);T.current=C;const _=C!==null||A!==null,R=c!=="idle",{queuedPrompts:I,queuedTexts:k,enqueuePrompt:j,removeQueuedPrompt:N,insertQueuedPrompt:L,editQueuedPrompt:$,editLastQueuedPrompt:F,clearQueuedPrompts:B}=Sq({connected:r.status==="connected",sessionId:r.sessionId,clientId:r.clientId,streamingState:c,sessionActions:i,store:l,editorRef:h,reportError:b,notifySuccess:w,t:s}),Q=p.useMemo(()=>{if(R)for(let J=o.length-1;J>=0;J--){const G=o[J];if((G==null?void 0:G.role)==="user")return G.timestamp}},[o,R]),Y=p.useCallback((J,G,te)=>{const H=J.trim();return!H||r.status!=="connected"?!1:d.current==="idle"?(i.sendPrompt(H,{...G&&G.length?{images:G}:{},onAdmitted:()=>{y(),te==null||te()}}).catch(ie=>b(ie,"Failed to send prompt")),!1):j(H,G)},[i,y,r.status,j,b]),ne=p.useCallback((J,G,te)=>{i.submitPermission(J,G,te).catch(H=>b(H,"Failed to submit permission choice"))},[i,b]),P=p.useCallback(()=>{i.cancel().catch(J=>b(J,"Failed to cancel request"))},[i,b]),le=p.useMemo(()=>Aq(Eq(r.commands??[],Tq(s)),s).map(J=>{const G=Cq(J.name);return G?{...J,displayCategory:"skill",description:s(G)}:J}),[r.commands,s]),z=p.useMemo(()=>(r.models??[]).filter(NS).map(J=>({id:J.id,label:Jp(J.label||J.id)})),[r.models]),M=p.useCallback(J=>{if(!Sw(J)){b(new Error(`Unsupported approval mode: ${J}`),"Failed to set approval mode");return}i.setApprovalMode(J).then(()=>{const G=T.current;if(!G||!(J==="yolo"||J==="auto-edit"&&G.toolKind==="edit"))return;const H=G.options.find(ie=>ie.kind==="allow_once");H&&i.submitPermission(G.id,H.id).catch(ie=>b(ie,"Failed to auto-approve tool call"))}).catch(G=>b(G,"Failed to set approval mode"))},[i,b]),re=p.useCallback(J=>{i.setModel(J).catch(G=>b(G,"Failed to switch model"))},[i,b]),U=e||r.displayName||((W=r.sessionId)==null?void 0:W.slice(0,8))||"";return u.jsxs("section",{className:cl.pane,"data-testid":"chat-pane","aria-label":U,children:[u.jsxs("header",{className:cl.header,children:[u.jsx("span",{className:cl.title,title:U,children:U}),t&&u.jsx("button",{type:"button",className:cl.closeButton,onClick:t,"aria-label":s("splitView.closePane"),title:s("splitView.closePane"),children:u.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:u.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),r.error&&u.jsx("div",{className:cl.connectionError,role:"alert",children:u.jsxs("span",{className:cl.connectionErrorText,children:[s("splitView.paneConnectionError"),": ",r.error]})}),u.jsx("div",{className:cl.body,children:u.jsx(nq,{messages:o,pendingApproval:C,loadingTranscript:r.loadingTranscript,catchingUp:r.catchingUp,isResponding:R,workspaceCwd:r.workspaceCwd||"",hideSessionTimeline:!0})}),u.jsxs("div",{className:cl.footer,children:[C&&u.jsx("div",{className:cl.approval,"data-testid":"pane-approval",children:u.jsx(Nq,{request:C,onConfirm:ne,variant:"floating",keyboardActive:!1})}),A&&u.jsx("div",{className:cl.approval,"data-testid":"pane-approval",children:u.jsx(Iq,{request:A,onConfirm:ne,variant:"floating"})}),u.jsx(oq,{startedAt:Q,showPhrase:!1}),u.jsx(Mq,{prompts:I,t:s,onDelete:N,onInsert:L,onEdit:$}),u.jsx(iq,{ref:h,onSubmit:Y,onCancel:P,isRunning:R,commands:le,queuedMessages:k,onPopQueuedMessages:F,onClearQueuedMessages:B,visibleToolbarActions:gRe,currentMode:r.currentMode??"default",currentModel:r.currentModel??"",availableModels:z,onSelectMode:M,onSelectModel:re,dialogOpen:_,followupState:f,onAcceptFollowup:m,onDismissFollowup:g,placeholderText:s("splitView.composerPlaceholder")})]})]})}const bRe="_split_r3qp6_1",wRe="_toolbar_r3qp6_9",vRe="_backButton_r3qp6_18",xRe="_title_r3qp6_35",_Re="_count_r3qp6_40",kRe="_addWrap_r3qp6_45",SRe="_addButton_r3qp6_50",TRe="_picker_r3qp6_70",CRe="_pickerItem_r3qp6_87",ARe="_panes_r3qp6_109",ERe="_paneSlot_r3qp6_118",MRe="_empty_r3qp6_125",NRe="_paneError_r3qp6_134",IRe="_paneErrorTitle_r3qp6_147",jRe="_paneErrorMessage_r3qp6_152",RRe="_paneErrorClose_r3qp6_157",Ci={split:bRe,toolbar:wRe,backButton:vRe,title:xRe,count:_Re,addWrap:kRe,addButton:SRe,picker:TRe,pickerItem:CRe,panes:ARe,paneSlot:ERe,empty:MRe,paneError:NRe,paneErrorTitle:IRe,paneErrorMessage:jRe,paneErrorClose:RRe},i_=Of;function LRe({sessionIds:e,onPanesChange:t,onExit:n,onError:s,sessionListReloadToken:r}){var j,N;const{t:i}=it(),o=Ta(),a=o.sessionId,l=((N=(j=o.capabilities)==null?void 0:j.features)==null?void 0:N.includes(V8))??!1,{sessions:c,reload:d}=nh({autoLoad:!0,pageSize:kw,archiveState:"active",...l?{view:"organized",group:"all"}:{}}),h=e!==void 0,f=p.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,i_),[e]),[m,g]=p.useState(()=>f.length>0?f:a?[a]:[]),[y,b]=p.useState(!1),w=p.useRef(null),[v]=p.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));p.useEffect(()=>{h&&g(L=>L.length===f.length&&L.every(($,F)=>$===f[F])?L:f)},[f,h]);const x=p.useRef(m);x.current=m,p.useEffect(()=>{if(!y)return;const L=F=>{var B;(B=w.current)!=null&&B.contains(F.target)||b(!1)},$=F=>{F.key==="Escape"&&b(!1)};return document.addEventListener("mousedown",L),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",L),document.removeEventListener("keydown",$)}},[y]),p.useEffect(()=>{y&&d()},[y,d]);const C=p.useRef(r);p.useEffect(()=>{r!==void 0&&r!==C.current&&(C.current=r,d())},[r,d]);const A=p.useMemo(()=>{var $;const L=new Map;for(const F of c)L.set(F.sessionId,(($=F.displayName)==null?void 0:$.trim())||F.sessionId.slice(0,8));return L},[c]),T=p.useCallback(L=>{const $=x.current;if($.includes(L)||$.length>=i_){b(!1);return}const F=[...$,L];h?t==null||t(F):g(F),b(!1)},[t,h]),_=p.useRef(!1);p.useEffect(()=>{m.length>0?_.current=!0:_.current&&n()},[m,n]),p.useEffect(()=>{h||t==null||t(m)},[m,t,h]);const R=p.useCallback(L=>{const $=x.current;if(!$.includes(L))return;const F=$.filter(B=>B!==L);h?t==null||t(F):g(F)},[t,h]),I=p.useMemo(()=>c.filter(L=>!m.includes(L.sessionId)),[c,m]),k=m.length<i_&&I.length>0;return u.jsxs("div",{className:Ci.split,"data-testid":"split-view",children:[u.jsxs("header",{className:Ci.toolbar,children:[u.jsx("button",{type:"button",className:Ci.backButton,onClick:n,"aria-label":i("common.back"),title:i("common.back"),children:u.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:u.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),u.jsx("span",{className:Ci.title,children:i("splitView.title")}),u.jsx("span",{className:Ci.count,children:i("splitView.count",{count:m.length})}),u.jsxs("div",{className:Ci.addWrap,ref:w,children:[u.jsxs("button",{type:"button",className:Ci.addButton,disabled:!k,"aria-haspopup":"listbox","aria-expanded":y,onClick:()=>b(L=>!L),children:["+ ",i("splitView.addPane")]}),y&&I.length>0&&u.jsx("ul",{className:Ci.picker,role:"listbox",children:I.map(L=>u.jsx("li",{role:"option","aria-selected":"false",children:u.jsx("button",{type:"button",className:Ci.pickerItem,onClick:()=>T(L.sessionId),children:A.get(L.sessionId)??L.sessionId.slice(0,8)})},L.sessionId))})]})]}),u.jsx("div",{className:Ci.panes,children:m.length===0?u.jsx("div",{className:Ci.empty,children:i("splitView.empty")}):m.map(L=>u.jsx("div",{className:Ci.paneSlot,children:u.jsx(Tc,{label:`split-pane:${L}`,resetKeys:[L],fallback:$=>u.jsxs("div",{className:Ci.paneError,role:"alert",children:[u.jsx("div",{className:Ci.paneErrorTitle,children:A.get(L)??L.slice(0,8)}),u.jsxs("div",{className:Ci.paneErrorMessage,children:[i("splitView.paneError"),": ",$.message]}),u.jsx("button",{type:"button",className:Ci.paneErrorClose,onClick:()=>R(L),children:i("splitView.closePane")})]}),children:u.jsx(kD,{sessionId:L,clientId:`split-pane:${v}:${L}`,suppressOwnUserEcho:!0,children:u.jsx(yRe,{title:A.get(L),onClose:()=>R(L),onError:s})})})},L))})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const DRe="(min-width: 1024px)";function ORe(e=DRe){const[t,n]=p.useState(()=>BRe(e));return p.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 BRe(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function PRe(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 mI(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=PRe(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 pI(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[s,r,i,o,a]=n,l=d=>/^\d+$/.test(d),c=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(l(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.hourly",{min:c(s)});if(l(s)&&l(r)&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.daily",{time:`${c(r)}:${c(s)}`});if(l(s)&&l(r)&&i==="*"&&o==="*"&&a==="1-5")return t("scheduledTasks.human.weekdays",{time:`${c(r)}:${c(s)}`});if(l(s)&&l(r)&&i==="*"&&o==="*"&&l(a)&&Number(a)>=0&&Number(a)<=7){const d=t("scheduledTasks.weekdayNames").split(","),h=Number(a)===7?0:Number(a),f=d[h]??a;return t("scheduledTasks.human.weekly",{day:f,time:`${c(r)}:${c(s)}`})}return e}const pl={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function $Re(e){const t=e.trim(),n={...pl,frequency:"custom",customCron:t.length>0?t:pl.customCron},s=t.split(/\s+/);if(s.length!==5)return n;const[r,i,o,a,l]=s,c=y=>/^\d+$/.test(y),d=y=>String(y).padStart(2,"0"),h=o==="*"&&a==="*";if(/^\*\/\d+$/.test(r)&&i==="*"&&h&&l==="*"){const y=Number(r.slice(2));return Number.isInteger(y)&&y>=1&&y<=30&&60%y===0?{...pl,frequency:"minutes",minuteInterval:y}:n}if(!c(r))return n;const f=Number(r);if(f>59)return n;if(i==="*"&&h&&l==="*")return{...pl,frequency:"hourly",time:`00:${d(f)}`};if(!c(i))return n;const m=Number(i);if(m>23)return n;const g=`${d(m)}:${d(f)}`;if(h&&l==="*")return{...pl,frequency:"daily",time:g};if(h&&l==="1-5")return{...pl,frequency:"weekdays",time:g};if(h&&c(l)){const y=Number(l);if(y>=0&&y<=7)return{...pl,frequency:"weekly",time:g,weekday:y===7?0:y}}return n}function zRe(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=(c,d)=>`${d}${t(`scheduledTasks.dur.${c}`)}`;let l;return s>0?l=r>0?[a("d",s),a("h",r)]:[a("d",s)]:r>0?l=i>0?[a("h",r),a("m",i)]:[a("h",r)]:i>0?l=o>0?[a("m",i),a("s",o)]:[a("m",i)]:l=[a("s",o)],l.join(" ")}function FRe(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})}const qRe="_root_4glfp_1",HRe="_intro_4glfp_8",URe="_toolbar_4glfp_14",VRe="_count_4glfp_22",WRe="_toolbarActions_4glfp_28",GRe="_primaryButton_4glfp_34",KRe="_secondaryButton_4glfp_35",YRe="_formFields_4glfp_73",QRe="_field_4glfp_79",XRe="_fieldGrow_4glfp_86",JRe="_fieldLabel_4glfp_90",ZRe="_required_4glfp_96",eLe="_input_4glfp_107",tLe="_textarea_4glfp_108",nLe="_select_4glfp_109",sLe="_scheduleRow_4glfp_134",rLe="_preview_4glfp_146",iLe="_previewLabel_4glfp_154",oLe="_previewCron_4glfp_159",aLe="_previewInvalid_4glfp_169",lLe="_formError_4glfp_174",cLe="_loadError_4glfp_175",uLe="_formActions_4glfp_181",dLe="_empty_4glfp_189",hLe="_list_4glfp_196",fLe="_card_4glfp_204",mLe="_cardDisabled_4glfp_215",pLe="_cardHeader_4glfp_219",gLe="_cardTitle_4glfp_225",yLe="_cardMenu_4glfp_236",bLe="_iconAction_4glfp_243",wLe="_toggle_4glfp_269",vLe="_toggleOn_4glfp_288",xLe="_toggleKnob_4glfp_292",_Le="_cardPrompt_4glfp_307",kLe="_cardFooter_4glfp_320",SLe="_schedulePill_4glfp_329",TLe="_clockIcon_4glfp_341",CLe="_recurringTag_4glfp_346",ALe="_countdown_4glfp_351",ELe="_hourglassIcon_4glfp_362",MLe="_lastFired_4glfp_367",NLe="_runsToggle_4glfp_375",ILe="_runsList_4glfp_392",jLe="_runsItem_4glfp_406",jt={root:qRe,intro:HRe,toolbar:URe,count:VRe,toolbarActions:WRe,primaryButton:GRe,secondaryButton:KRe,formFields:YRe,field:QRe,fieldGrow:XRe,fieldLabel:JRe,required:ZRe,input:eLe,textarea:tLe,select:nLe,scheduleRow:sLe,preview:rLe,previewLabel:iLe,previewCron:oLe,previewInvalid:aLe,formError:lLe,loadError:cLe,formActions:uLe,empty:dLe,list:hLe,card:fLe,cardDisabled:mLe,cardHeader:pLe,cardTitle:gLe,cardMenu:yLe,iconAction:bLe,toggle:wLe,toggleOn:vLe,toggleKnob:xLe,cardPrompt:_Le,cardFooter:kLe,schedulePill:SLe,clockIcon:TLe,recurringTag:CLe,countdown:ALe,hourglassIcon:ELe,lastFired:MLe,runsToggle:NLe,runsList:ILe,runsItem:jLe};function jq(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function RLe(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`${jq(e.at)}${n}${s}`}const LLe=["daily","weekdays","weekly","hourly","minutes","custom"],DLe=[1,2,3,4,5,6,10,12,15,20,30],OLe=2147483647,BLe=3,PLe=3e4;function $Le({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,onError:s}){const{t:r}=it(),i=Sa(),[o,a]=p.useState(null),[l,c]=p.useState(null),[d,h]=p.useState(null),[f,m]=p.useState(null),[g,y]=p.useState(!1),[b,w]=p.useState(null),[v,x]=p.useState(""),[C,A]=p.useState(""),[T,_]=p.useState(pl),[R,I]=p.useState(!1),[k,j]=p.useState(null),[N,L]=p.useState(null),[$,F]=p.useState(()=>Date.now()),B=p.useRef(!0),Q=p.useRef(0);p.useEffect(()=>(B.current=!0,()=>{B.current=!1}),[]);const Y=p.useCallback(async()=>{const H=++Q.current;try{const ie=await i.listScheduledTasks();if(!B.current||H!==Q.current)return;const fe=[...ie].sort((Ne,Ie)=>Ie.createdAt-Ne.createdAt);a(fe),c(null)}catch(ie){if(!B.current||H!==Q.current)return;c(ie instanceof Error?ie.message:String(ie)),a(fe=>fe??[])}},[i]);p.useEffect(()=>{Y()},[Y]);const ne=!!(o!=null&&o.some(H=>H.nextRunAt!=null));p.useEffect(()=>{if(!ne)return;const H=window.setInterval(()=>F(Date.now()),1e3);return()=>window.clearInterval(H)},[ne]);const P=p.useRef(0);p.useEffect(()=>{if(!o)return;let H=1/0;for(const Ie of o)Ie.nextRunAt!=null&&Ie.nextRunAt<H&&(H=Ie.nextRunAt);if(!Number.isFinite(H))return;const ie=H-Date.now();let fe;ie>0?(P.current=0,fe=Math.min(ie+2e3,OLe)):fe=P.current++<BLe?1e3:PLe;const Ne=window.setTimeout(()=>void Y(),fe);return()=>window.clearTimeout(Ne)},[o,Y]);const le=mI(T),z=le?pI(le,r):null,M=p.useCallback(()=>{x(""),A(""),_(pl),j(null),y(!1),w(null)},[]),re=p.useCallback(()=>{w(null),x(""),A(""),_(pl),j(null),y(!0)},[]),U=p.useCallback(H=>{w(H.id),x(H.name??""),A(H.prompt),_($Re(H.cron)),j(null),y(!0)},[]),W=p.useCallback(async()=>{const H=mI(T);if(!H){j(r("scheduledTasks.error.invalidSchedule"));return}if(C.trim().length===0){j(r("scheduledTasks.error.emptyPrompt"));return}I(!0),j(null);try{if(b?await i.updateScheduledTask(b,{cron:H,prompt:C.trim(),name:v.trim()||null}):await i.createScheduledTask({cron:H,prompt:C.trim(),name:v.trim()||null,recurring:!0,enabled:!0}),!B.current)return;M(),await Y()}catch(ie){if(!B.current)return;j(ie instanceof Error?ie.message:String(ie))}finally{B.current&&I(!1)}},[i,T,b,v,C,Y,M,r]),J=p.useCallback(async H=>{h(H.id);try{await i.updateScheduledTask(H.id,{enabled:!H.enabled}),await Y()}catch(ie){s(ie,r("scheduledTasks.error.toggleFailed"))}finally{B.current&&h(null)}},[i,s,Y,r]),G=p.useCallback(async H=>{if(!(!H.enabled||f!==null)){m(H.id);try{const ie=(await i.listScheduledTasks()).find(fe=>fe.id===H.id);if(!ie||!ie.enabled){await Y().catch(()=>{}),s(new Error("This task is no longer runnable."),r("scheduledTasks.error.runFailed"));return}if(ie.recurring){await e(ie.prompt,ie.sessionId);try{await i.runScheduledTask(ie.id),await Y()}catch(fe){s(fe,r("scheduledTasks.error.runFailed"))}}else{await i.runScheduledTask(ie.id),await Y();try{await e(ie.prompt,ie.sessionId)}catch(fe){s(fe,r("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(ie){s(ie,r("scheduledTasks.error.runFailed"))}finally{m(null)}}},[i,s,e,Y,f,r]),te=p.useCallback(async H=>{const ie=H.name||H.prompt,fe=ie.length>60?`${ie.slice(0,57)}…`:ie;if(window.confirm(r("scheduledTasks.deleteConfirm",{name:fe}))){h(H.id);try{await i.deleteScheduledTask(H.id),await Y()}catch(Ne){s(Ne,r("scheduledTasks.error.deleteFailed"))}finally{B.current&&h(null)}}},[i,s,Y,r]);return u.jsxs("div",{className:jt.root,children:[u.jsx("div",{className:jt.intro,children:r("scheduledTasks.subtitle")}),u.jsxs("div",{className:jt.toolbar,children:[u.jsx("div",{className:jt.count,children:o===null?r("scheduledTasks.loading"):r("scheduledTasks.count",{count:o.length})}),u.jsxs("div",{className:jt.toolbarActions,children:[u.jsx("button",{type:"button",className:jt.secondaryButton,onClick:()=>void Y(),children:r("scheduledTasks.refresh")}),u.jsx("button",{type:"button",className:jt.secondaryButton,onClick:t,children:r("scheduledTasks.createViaChat")}),u.jsx("button",{type:"button",className:jt.primaryButton,onClick:re,children:r("scheduledTasks.new")})]})]}),g&&u.jsx(xr,{title:r(b?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:M,children:u.jsxs("div",{className:jt.formFields,children:[u.jsxs("label",{className:jt.field,children:[u.jsx("span",{className:jt.fieldLabel,children:r("scheduledTasks.name")}),u.jsx("input",{className:jt.input,type:"text",value:v,maxLength:200,placeholder:r("scheduledTasks.namePlaceholder"),onChange:H=>x(H.target.value)})]}),u.jsxs("label",{className:jt.field,children:[u.jsxs("span",{className:jt.fieldLabel,children:[r("scheduledTasks.prompt"),u.jsx("span",{className:jt.required,children:"*"})]}),u.jsx("textarea",{className:jt.textarea,value:C,rows:4,maxLength:1e5,placeholder:r("scheduledTasks.promptPlaceholder"),onChange:H=>A(H.target.value)})]}),u.jsxs("div",{className:jt.scheduleRow,children:[u.jsxs("label",{className:jt.field,children:[u.jsx("span",{className:jt.fieldLabel,children:r("scheduledTasks.frequency")}),u.jsx("select",{className:jt.select,value:T.frequency,onChange:H=>{const ie=H.target.value;_(fe=>({...fe,frequency:ie,...ie==="hourly"?{time:"00:00"}:{}}))},children:LLe.map(H=>u.jsx("option",{value:H,children:r(`scheduledTasks.freq.${H}`)},H))})]}),(T.frequency==="daily"||T.frequency==="weekdays"||T.frequency==="weekly")&&u.jsxs("label",{className:jt.field,children:[u.jsx("span",{className:jt.fieldLabel,children:r("scheduledTasks.time")}),u.jsx("input",{className:jt.input,type:"time",value:T.time,onChange:H=>_(ie=>({...ie,time:H.target.value}))})]}),T.frequency==="weekly"&&u.jsxs("label",{className:jt.field,children:[u.jsx("span",{className:jt.fieldLabel,children:r("scheduledTasks.weekday")}),u.jsx("select",{className:jt.select,value:T.weekday,onChange:H=>_(ie=>({...ie,weekday:Number(H.target.value)})),children:r("scheduledTasks.weekdayNames").split(",").map((H,ie)=>u.jsx("option",{value:ie,children:H},ie))})]}),T.frequency==="minutes"&&u.jsxs("label",{className:jt.field,children:[u.jsx("span",{className:jt.fieldLabel,children:r("scheduledTasks.interval")}),u.jsx("select",{className:jt.select,value:T.minuteInterval,onChange:H=>_(ie=>({...ie,minuteInterval:Number(H.target.value)})),children:DLe.map(H=>u.jsx("option",{value:H,children:H},H))})]}),T.frequency==="custom"&&u.jsxs("label",{className:`${jt.field} ${jt.fieldGrow}`,children:[u.jsx("span",{className:jt.fieldLabel,children:r("scheduledTasks.cron")}),u.jsx("input",{className:jt.input,type:"text",value:T.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:H=>_(ie=>({...ie,customCron:H.target.value}))})]})]}),u.jsx("div",{className:jt.preview,children:z?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:jt.previewLabel,children:z}),u.jsx("code",{className:jt.previewCron,children:le})]}):u.jsx("span",{className:jt.previewInvalid,children:r("scheduledTasks.error.invalidSchedule")})}),k&&u.jsx("div",{className:jt.formError,children:k}),u.jsxs("div",{className:jt.formActions,children:[u.jsx("button",{type:"button",className:jt.secondaryButton,onClick:M,disabled:R,children:r("scheduledTasks.cancel")}),u.jsx("button",{type:"button",className:jt.primaryButton,onClick:()=>void W(),disabled:R,children:r(R?b?"scheduledTasks.saving":"scheduledTasks.creating":b?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),l&&u.jsx("div",{className:jt.loadError,children:l}),o!==null&&o.length===0&&!l&&u.jsx("div",{className:jt.empty,children:r("scheduledTasks.empty")}),u.jsx("div",{className:jt.list,children:(o??[]).map(H=>{const ie=H.name||H.prompt,fe=d===H.id;return u.jsxs("div",{className:`${jt.card} ${H.enabled?"":jt.cardDisabled}`,children:[u.jsxs("div",{className:jt.cardHeader,children:[u.jsx("button",{type:"button",role:"switch","aria-checked":H.enabled,"aria-label":H.enabled?r("scheduledTasks.disable"):r("scheduledTasks.enable"),className:`${jt.toggle} ${H.enabled?jt.toggleOn:""}`,onClick:()=>void J(H),disabled:fe,children:u.jsx("span",{className:jt.toggleKnob})}),u.jsx("div",{className:jt.cardTitle,title:ie,children:ie}),u.jsxs("div",{className:jt.cardMenu,children:[u.jsx("button",{type:"button",className:jt.iconAction,onClick:()=>void G(H),disabled:!H.enabled||f!==null,title:r("scheduledTasks.runNow"),"aria-label":r("scheduledTasks.runNow"),children:"▶"}),u.jsx("button",{type:"button",className:jt.iconAction,onClick:()=>U(H),disabled:fe,title:r("scheduledTasks.edit"),"aria-label":r("scheduledTasks.edit"),children:"✎"}),u.jsx("button",{type:"button",className:jt.iconAction,onClick:()=>void te(H),disabled:fe,title:r("scheduledTasks.delete"),"aria-label":r("scheduledTasks.delete"),children:"✕"})]})]}),H.name&&u.jsx("div",{className:jt.cardPrompt,title:H.prompt,children:H.prompt}),u.jsxs("div",{className:jt.cardFooter,children:[u.jsxs("span",{className:jt.schedulePill,children:[u.jsx("span",{className:jt.clockIcon,"aria-hidden":"true",children:"◷"}),pI(H.cron,r)]}),u.jsx("span",{className:jt.recurringTag,children:r(H.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),H.nextRunAt!=null&&u.jsxs("span",{className:jt.countdown,"data-testid":"scheduled-task-next-run",title:r("scheduledTasks.nextRunTooltip",{when:jq(H.nextRunAt)}),children:[u.jsx("span",{className:jt.hourglassIcon,"aria-hidden":"true",children:"⏳"}),zRe(H.nextRunAt-$,r)]}),u.jsx("span",{className:jt.lastFired,children:FRe(H,r)}),H.sessionId&&n?u.jsx("button",{type:"button",className:jt.runsToggle,onClick:()=>n(H.sessionId),title:r("scheduledTasks.viewHistoryHint"),children:H.runs.length>0?r("scheduledTasks.viewHistory",{count:H.runs.length}):r("scheduledTasks.viewHistoryEmpty")}):H.runs.length>0&&u.jsx("button",{type:"button",className:jt.runsToggle,"aria-expanded":N===H.id,onClick:()=>L(Ne=>Ne===H.id?null:H.id),children:r("scheduledTasks.runHistory",{count:H.runs.length})})]}),N===H.id&&H.runs.length>0&&u.jsx("ul",{className:jt.runsList,children:[...H.runs].reverse().map((Ne,Ie)=>u.jsx("li",{className:jt.runsItem,children:RLe(Ne,r)},`${Ne.at}-${Ie}`))})]},H.id)})})]})}const Rq="update available";function zLe(e){return e.displayName||e.name}function Lq(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function FLe(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"error":return t("extensions.manage.updateError");default:return t("extensions.manage.unknownUpdate")}}function Hh(e){return e&&e.length>0?e.join(", "):"-"}const qLe=U8;function HLe(){const{t:e}=it(),t=Ta(),n=Sa(),s=vh(),[r,i]=p.useState([]),[o,a]=p.useState(null),[l,c]=p.useState(null),[d,h]=p.useState({}),[f,m]=p.useState(!1),[g,y]=p.useState(!1),[b,w]=p.useState(null),[v,x]=p.useState(null),C=p.useCallback(()=>(m(!0),n.loadExtensionsStatus().then(I=>{var j,N;const k=I.extensions??[];i(k),x(((N=(j=I.errors)==null?void 0:j[0])==null?void 0:N.error)??null),a(L=>L&&k.some($=>$.name===L)?L:null)}).catch(I=>{x(I instanceof Error?I.message:String(I))}).finally(()=>m(!1))),[n]),A=p.useCallback(()=>{const I=t.clientId;return I?(y(!0),n.checkExtensionUpdates(I).then(k=>h(k.states)).catch(k=>{x(k instanceof Error?k.message:String(k))}).finally(()=>y(!1))):(x(e("extensions.install.waitForSession")),Promise.resolve())},[n,t.clientId,e]),T=p.useCallback(()=>{const I=t.clientId;if(!I){x(e("extensions.install.waitForSession"));return}y(!0),n.refreshExtensions(I).then(async k=>{x(e("extensions.manage.refreshed",{refreshed:k.refreshed,failed:k.failed})),await C(),await A()}).catch(k=>{x(k instanceof Error?k.message:String(k))}).finally(()=>y(!1))},[n,A,t.clientId,C,e]);p.useEffect(()=>{C()},[C]),p.useEffect(()=>{r.length>0&&A()},[A,r.length]),p.useEffect(()=>{((s==null?void 0:s.extensionsVersion)??0)>0&&(h({}),C())},[C,s==null?void 0:s.extensionsVersion]);const _=p.useCallback((I,k,j={})=>{const N=t.clientId;if(!N&&!j.allowWithoutClientId){x(e("extensions.install.waitForSession"));return}w(I),x(null),k(N).then(()=>x(e("extensions.manage.queued",{name:I}))).catch(L=>{x(L instanceof Error?L.message:String(L))}).finally(()=>{w(null),C()})},[t.clientId,C,e]),R=p.useMemo(()=>f?e("extensions.manage.loading"):g?e("extensions.manage.checkingUpdates"):e("extensions.manage.count",{count:r.length}),[g,r.length,f,e]);return u.jsxs("div",{className:$e("picker","picker-in-shell"),children:[u.jsxs("div",{className:$e("picker-search","extensions-toolbar"),children:[u.jsx("span",{className:$e("picker-search-hint"),children:v||R}),u.jsx("button",{type:"button",className:$e("dialog-inline-button"),disabled:f||g,onClick:T,children:e("common.refresh")})]}),u.jsx("div",{className:$e("picker-sep")}),u.jsxs("div",{className:$e("picker-list"),children:[!f&&r.length===0&&u.jsx("div",{className:$e("picker-empty"),children:e("extensions.manage.empty")}),r.map(I=>{const k=d[I.name]??I.updateState,j=o===I.name,N=b===I.name;return u.jsxs("div",{className:$e("picker-item","picker-session-item","tools-picker-item",j?"selected":void 0,j?"tools-picker-item-expanded":void 0),children:[u.jsxs("button",{type:"button",className:$e("extensions-row-button"),onClick:()=>{a(j?null:I.name),c(null)},children:[u.jsx("span",{className:$e("tools-item-icon"),"aria-hidden":"true"}),u.jsx("span",{className:$e("picker-item-title"),children:zLe(I)}),u.jsxs("span",{className:$e("picker-item-badge"),children:["v",I.version]}),u.jsx("span",{className:$e("tools-status-badge",I.isActive?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:Lq(I,e)}),u.jsx("span",{className:$e("tools-status-badge",k===Rq?"tools-status-badge-busy":void 0),children:FLe(k,e)}),u.jsx("svg",{className:$e("tools-item-chevron",j?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),j&&u.jsx(ULe,{extension:I,updateState:k,busy:N,confirmingUninstall:l===I.name,onUpdate:()=>_(I.name,L=>n.updateExtension(I.name,L)),onToggleScope:(L,$)=>_(I.name,F=>L==="enable"?n.enableExtension(I.name,{scope:$},F):n.disableExtension(I.name,{scope:$},F),{allowWithoutClientId:!0}),onRequestUninstall:()=>c(I.name),onCancelUninstall:()=>c(null),onConfirmUninstall:()=>{_(I.name,L=>n.uninstallExtension(I.name,L)),c(null),a(null)}})]},I.id||I.name)})]})]})}function ULe({extension:e,updateState:t,busy:n,confirmingUninstall:s,onUpdate:r,onToggleScope:i,onRequestUninstall:o,onCancelUninstall:a,onConfirmUninstall:l}){const{t:c}=it(),d=e.details,h=e.isActive?"disable":"enable";return u.jsxs("div",{className:$e("extensions-detail"),children:[u.jsxs("div",{className:$e("extensions-detail-actions"),children:[u.jsx("button",{type:"button",className:$e("dialog-inline-button"),disabled:n||t!==Rq,onClick:r,children:c("extensions.manage.update")}),u.jsxs("button",{type:"button",className:$e("dialog-inline-button"),disabled:n,onClick:()=>i(h,"user"),children:[c(h==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.user")]}),u.jsxs("button",{type:"button",className:$e("dialog-inline-button"),disabled:n,onClick:()=>i(h,"workspace"),children:[c(h==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.workspace")]}),u.jsx("button",{type:"button",className:$e("dialog-danger-button"),disabled:n,onClick:o,children:c("extensions.manage.uninstallAction")})]}),s&&u.jsxs("div",{className:$e("extensions-confirm"),children:[u.jsx("span",{children:c("extensions.manage.uninstallConfirm",{name:e.name})}),u.jsxs("div",{className:$e("dialog-inline-actions"),children:[u.jsx("button",{type:"button",className:$e("dialog-danger-button"),disabled:n,onClick:l,children:c("extensions.manage.uninstallAction")}),u.jsx("button",{type:"button",className:$e("dialog-inline-button"),onClick:a,children:c("common.cancel")})]})]}),u.jsxs("div",{className:$e("extensions-detail-grid"),children:[u.jsx(Da,{label:c("extensions.manage.name"),value:e.name}),u.jsx(Da,{label:c("extensions.manage.version"),value:e.version}),u.jsx(Da,{label:c("extensions.manage.status"),value:Lq(e,c)}),u.jsx(Da,{label:c("extensions.manage.path"),value:e.path}),u.jsx(Da,{label:c("extensions.manage.source"),value:e.source??"-"}),u.jsx(Da,{label:c("extensions.manage.commands"),value:Hh(d==null?void 0:d.commands)}),u.jsx(Da,{label:c("extensions.manage.skills"),value:Hh(d==null?void 0:d.skills)}),u.jsx(Da,{label:c("extensions.manage.agents"),value:Hh(d==null?void 0:d.agents)}),u.jsx(Da,{label:c("extensions.manage.mcpServers"),value:Hh(d==null?void 0:d.mcpServers)}),u.jsx(Da,{label:c("extensions.manage.contextFiles"),value:Hh(d==null?void 0:d.contextFiles)}),u.jsx(Da,{label:c("extensions.manage.settings"),value:Hh(d==null?void 0:d.settings)})]})]})}function Da({label:e,value:t}){return u.jsxs("div",{className:$e("extensions-detail-field"),children:[u.jsx("span",{className:$e("extensions-detail-label"),children:qLe(e)}),u.jsx("span",{className:$e("extensions-detail-value"),children:t})]})}const VLe="_panel_1nmt9_1",WLe="_embeddedPanel_1nmt9_16",GLe="_header_1nmt9_26",KLe="_title_1nmt9_32",YLe="_secondary_1nmt9_36",QLe="_hint_1nmt9_37",XLe="_empty_1nmt9_38",JLe="_busy_1nmt9_39",ZLe="_scopeTabs_1nmt9_49",eDe="_scopeTab_1nmt9_49",tDe="_scopeTabActive_1nmt9_71",nDe="_settingsPage_1nmt9_76",sDe="_sidebar_1nmt9_83",rDe="_categoryButton_1nmt9_92",iDe="_categoryButtonActive_1nmt9_110",oDe="_categoryCount_1nmt9_115",aDe="_content_1nmt9_121",lDe="_card_1nmt9_128",cDe="_cardBody_1nmt9_142",uDe="_cardTitle_1nmt9_146",dDe="_cardDescription_1nmt9_155",hDe="_scopeHint_1nmt9_156",fDe="_scopeBadge_1nmt9_164",mDe="_cardControl_1nmt9_174",pDe="_select_1nmt9_180",gDe="_actionButton_1nmt9_181",yDe="_editInput_1nmt9_182",bDe="_editor_1nmt9_219",wDe="_switchOn_1nmt9_241",vDe="_switchKnob_1nmt9_246",xDe="_footer_1nmt9_261",An={panel:VLe,embeddedPanel:WLe,header:GLe,title:KLe,secondary:YLe,hint:QLe,empty:XLe,busy:JLe,scopeTabs:ZLe,scopeTab:eDe,scopeTabActive:tDe,settingsPage:nDe,sidebar:sDe,categoryButton:rDe,categoryButtonActive:iDe,categoryCount:oDe,content:aDe,card:lDe,cardBody:cDe,cardTitle:uDe,cardDescription:dDe,scopeHint:hDe,scopeBadge:fDe,cardControl:mDe,select:pDe,actionButton:gDe,editInput:yDe,editor:bDe,switch:"_switch_1nmt9_231",switchOn:wDe,switchKnob:vDe,footer:xDe},_De=new Set(["fastModel","visionModel"]),kDe=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline"]);function Kv(e,t,n){const s=e(t);return s===t?n:s}function SDe(e,t){return Kv(t,`settings.category.${e}`,e)}function TDe(e,t){return Kv(t,`settings.label.${e.key}`,e.label)}function CDe(e,t){if(e.description)return Kv(t,`settings.description.${e.key}`,e.description)}function Dq(e,t,n,s){return Kv(s,`settings.option.${e.key}.${String(t)}`,n)}function o_(e,t,n){const s=Bq(e,t);if(s==null)return"";if(e.key===Ed){const i=e5(s,Li.Dark);return n(`theme.${i}`)}if(e.key===K0){const i=J6(s);return i?Z6(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?Dq(e,i.value,i.label,n):String(s)}const r=String(s);return r.length>24?r.slice(0,21)+"...":r}function Oq(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function ADe(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return Oq(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function Bq(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function EDe(e,t){const n=new Map;for(const s of e){let r=n.get(s.category);r||(r=[],n.set(s.category,r)),r.push(s)}return Array.from(n.entries()).map(([s,r])=>({category:SDe(s,t),items:r}))}function MDe({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:s,chatWidthMode:r,onChatWidthModeChange:i,embedded:o=!1}){const{t:a}=it(),{status:l,settings:c,loading:d,error:h,reload:f,setValue:m}=e,[g,y]=p.useState("workspace"),[b,w]=p.useState(""),[v,x]=p.useState(null),[C,A]=p.useState(null),[T,_]=p.useState(null),R=p.useRef(null),[I,k]=p.useState(!1),j=d&&!l,N=c.find(z=>z.key===Ed),L=e5(N==null?void 0:N.values.effective),$=c.find(z=>z.key===K0),F=J6($==null?void 0:$.values.effective),B=p.useMemo(()=>{const z=c.filter(W=>!kDe.has(W.key)),M=EDe(z,a).map(W=>({id:W.category,label:W.category,items:W.items.map(J=>({type:"setting",setting:J}))})),re={type:"local",localKey:"chatWidth"},U=M.find(W=>W.items.some(J=>J.type==="setting"&&J.setting.key===Ed));if(U){const W=U.items.findIndex(J=>J.type==="setting"&&J.setting.key===Ed);U.items.splice(W+1,0,re)}else M.push({id:a("settings.category.UI"),label:a("settings.category.UI"),items:[re]});return M},[c,a]);p.useEffect(()=>{B.length!==0&&(B.some(z=>z.id===b)||w(B[0].id))},[b,B]),p.useEffect(()=>{var z;h?A(h.message):(z=l==null?void 0:l.warnings)!=null&&z.length?A(l.warnings.map(M=>a("settings.corrupted",{recovered:M.recovered?"true":"false"})).join("; ")):c.length>0&&!I&&A(null)},[h,c,l,a,I]),p.useEffect(()=>{T&&setTimeout(()=>{var z;return(z=R.current)==null?void 0:z.focus()},0)},[T]);const Q=p.useCallback((z,M)=>{I||A(null),x(z),m("workspace",z,M).then(async re=>{try{await f()}catch{}re!=null&&re.requiresRestart&&z!==K0&&(k(!0),A(a("settings.requiresRestart")))}).catch(re=>{A(re instanceof Error?re.message:String(re))}).finally(()=>x(null))},[f,I,m,a]),Y=p.useCallback(()=>{if(!T)return;const z=c.find(re=>re.key===T.key);if(!z){_(null);return}let M=T.draft;if(z.type==="number"){const re=T.draft.trim();if(re===""||!Number.isFinite(Number(re))){A(a("settings.invalidNumber"));return}M=Number(re)}_(null),Q(z.key,M)},[T,c,Q,a]),ne=B.find(z=>z.id===b)??B[0],P=(z,M,re,U=!1)=>u.jsx("select",{className:An.select,value:z,disabled:U,onChange:W=>M(W.target.value),children:re.map(W=>u.jsx("option",{value:W.value,children:W.label},W.value))}),le=z=>{var J;const M=Bq(z,g),re=v===z.key,U=(T==null?void 0:T.key)===z.key;if(g!=="workspace")return u.jsx("button",{type:"button",className:An.actionButton,disabled:!0,title:a("settings.readOnly"),children:o_(z,g,a)||a("settings.readOnly")});if(z.key===Ed)return P(L??Li.Dark,G=>{const te=G;s(te),Q(Ed,PQ(te))},LD.map(G=>({value:G,label:a(`theme.${G}`)})),re);if(z.key===K0)return P(F??"zh-CN",G=>t(G),xQ.map(G=>({value:G,label:Z6(G)})),re);if(_De.has(z.key))return u.jsx("button",{type:"button",className:An.actionButton,onClick:()=>n(z.key),children:o_(z,g,a)||a("settings.action.edit")});if(z.type==="boolean"){const G=M===!0;return u.jsx("button",{type:"button",className:`${An.switch} ${G?An.switchOn:""}`,disabled:re,onClick:()=>Q(z.key,!G),"aria-pressed":G,children:u.jsx("span",{className:An.switchKnob})})}if(z.type==="enum"&&((J=z.options)!=null&&J.length)){const G=z.options.findIndex(te=>te.value===M);return P(G>=0?String(G):"",te=>{var ie;const H=(ie=z.options)==null?void 0:ie[Number(te)];H&&Q(z.key,H.value)},z.options.map((te,H)=>({value:String(H),label:Dq(z,te.value,te.label,a)})),re)}return U?u.jsxs("div",{className:An.editor,children:[u.jsx("input",{ref:R,className:An.editInput,type:z.type==="number"?"number":"text",value:T.draft,onChange:G=>_({key:T.key,draft:G.target.value}),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),Y()),G.key==="Escape"&&(G.preventDefault(),_(null))}}),u.jsx("button",{type:"button",className:An.actionButton,onClick:Y,children:a("settings.action.save")})]}):u.jsx("button",{type:"button",className:An.actionButton,disabled:re,onClick:()=>_({key:z.key,draft:String(M??"")}),children:o_(z,g,a)||a("settings.action.edit")})};return u.jsxs("div",{className:`${An.panel} ${o?An.embeddedPanel:""}`,"data-keyboard-scope":!0,children:[!o&&u.jsxs("div",{className:An.header,children:[u.jsx("span",{className:An.title,children:a("settings.title")}),u.jsx("span",{className:An.secondary,children:a("settings.scope.workspace")})]}),(C||j)&&u.jsx("div",{className:An.hint,children:C||a("settings.loading")}),u.jsxs("div",{className:An.scopeTabs,role:"tablist",children:[u.jsx("button",{type:"button",role:"tab","aria-selected":g==="workspace",className:`${An.scopeTab} ${g==="workspace"?An.scopeTabActive:""}`,onClick:()=>y("workspace"),children:a("settings.scope.workspace")}),u.jsx("button",{type:"button",role:"tab","aria-selected":g==="user",className:`${An.scopeTab} ${g==="user"?An.scopeTabActive:""}`,onClick:()=>{_(null),y("user")},children:a("settings.scope.user")})]}),u.jsxs("div",{className:An.settingsPage,children:[u.jsx("nav",{className:An.sidebar,"aria-label":a("settings.title"),children:B.map(z=>u.jsxs("button",{type:"button",className:`${An.categoryButton} ${z.id===b?An.categoryButtonActive:""}`,onClick:()=>w(z.id),children:[u.jsx("span",{children:z.label}),u.jsx("span",{className:An.categoryCount,children:z.items.length})]},z.id))}),u.jsxs("section",{className:An.content,children:[!d&&!ne&&u.jsx("div",{className:An.empty,children:a("settings.empty")}),ne==null?void 0:ne.items.map(z=>{if(z.type==="local")return u.jsxs("div",{className:An.card,children:[u.jsxs("div",{className:An.cardBody,children:[u.jsx("div",{className:An.cardTitle,children:a("settings.label.ui.chatWidth")}),u.jsx("div",{className:An.cardDescription,children:a("settings.description.ui.chatWidth")})]}),u.jsx("div",{className:An.cardControl,children:P(r,J=>i(J),[{value:"1000",label:a("settings.option.ui.chatWidth.1000")},{value:"wide",label:a("settings.option.ui.chatWidth.wide")}])})]},z.localKey);const M=z.setting,re=CDe(M,a),U=ADe(M,g),W=Oq(M,g);return u.jsxs("div",{className:An.card,children:[u.jsxs("div",{className:An.cardBody,children:[u.jsxs("div",{className:An.cardTitle,children:[TDe(M,a),W&&u.jsx("span",{className:An.scopeBadge,children:a(g==="workspace"?"settings.scope.workspace":"settings.scope.user")})]}),re&&u.jsx("div",{className:An.cardDescription,children:re}),U&&u.jsx("div",{className:An.scopeHint,children:a(U,{scope:a(g==="workspace"?"settings.scope.user":"settings.scope.workspace")})})]}),u.jsx("div",{className:An.cardControl,children:v===M.key?u.jsx("span",{className:An.busy,children:"..."}):le(M)})]},M.key)})]})]}),!o&&u.jsx("div",{className:An.footer,children:a(T?"settings.footer.edit":"settings.footer")})]})}const NDe="_dialog_1ymqd_1",IDe="_toolbar_1ymqd_12",jDe="_tabs_1ymqd_21",RDe="_tab_1ymqd_21",LDe="_tabActive_1ymqd_39",DDe="_search_1ymqd_48",ODe="_general_1ymqd_60",BDe="_shortcuts_1ymqd_67",PDe="_shortcut_1ymqd_67",$De="_shortcutKey_1ymqd_87",zDe="_shortcutDesc_1ymqd_95",FDe="_commandList_1ymqd_101",qDe="_commandCard_1ymqd_108",HDe="_commandCardExpanded_1ymqd_115",UDe="_commandRow_1ymqd_119",VDe="_commandName_1ymqd_135",WDe="_commandTag_1ymqd_142",GDe="_chevron_1ymqd_152",KDe="_chevronExpanded_1ymqd_160",YDe="_commandDetail_1ymqd_164",QDe="_commandDescription_1ymqd_174",XDe="_commandSubcommands_1ymqd_175",JDe="_empty_1ymqd_182",ir={dialog:NDe,toolbar:IDe,tabs:jDe,tab:RDe,tabActive:LDe,search:DDe,general:ODe,shortcuts:BDe,shortcut:PDe,shortcutKey:$De,shortcutDesc:zDe,commandList:FDe,commandCard:qDe,commandCardExpanded:HDe,commandRow:UDe,commandName:VDe,commandTag:WDe,chevron:GDe,chevronExpanded:KDe,commandDetail:YDe,commandDescription:QDe,commandSubcommands:XDe,empty:JDe},ZDe=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],eOe=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"]),tOe=[["@","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 nOe(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function IS(e){return!eOe.has(e.name)}function sOe(e,t){return IS(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function rOe(e,t,n){const s=n.trim().toLowerCase();return e.filter(r=>r.name&&r.description!==void 0).filter(r=>t==="commands"?!IS(r):t==="custom-commands"?IS(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 iOe(){const{t:e}=it();return u.jsx("div",{className:ir.general,children:u.jsx("div",{className:ir.shortcuts,children:tOe.map(([t,n])=>u.jsxs("div",{className:ir.shortcut,children:[u.jsx("span",{className:ir.shortcutDesc,children:e(n)}),u.jsx("span",{className:ir.shortcutKey,children:t})]},t))})})}function oOe({commands:e,tab:t,query:n}){const{t:s}=it(),[r,i]=p.useState(null),o=p.useMemo(()=>rOe(e,t,n),[e,n,t]);return o.length===0?u.jsx("div",{className:ir.empty,children:s(t==="custom-commands"?"help.emptyCustom":"help.empty")}):u.jsx("div",{className:ir.commandList,children:o.map(a=>{var c;const l=r===a.name;return u.jsxs("article",{className:`${ir.commandCard} ${l?ir.commandCardExpanded:""}`,children:[u.jsxs("button",{type:"button",className:ir.commandRow,onClick:()=>i(l?null:a.name),"aria-expanded":l,children:[u.jsx("span",{className:ir.commandName,children:nOe(a)}),u.jsx("span",{className:ir.commandTag,children:sOe(a,s)}),u.jsx("svg",{className:`${ir.chevron} ${l?ir.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),l&&u.jsxs("div",{className:ir.commandDetail,children:[a.description&&u.jsx("div",{className:ir.commandDescription,children:a.description}),!!((c=a.subcommands)!=null&&c.length)&&u.jsxs("div",{className:ir.commandSubcommands,children:[s("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function aOe({commands:e}){const{t}=it(),[n,s]=p.useState("general"),{filterValue:r,inputProps:i}=Gv(),o=n!=="general";return u.jsxs("div",{className:ir.dialog,children:[u.jsxs("div",{className:ir.toolbar,children:[u.jsx("div",{className:ir.tabs,children:ZDe.map(a=>u.jsx("button",{type:"button",className:`${ir.tab} ${a.id===n?ir.tabActive:""}`,onClick:()=>s(a.id),children:t(a.labelKey)},a.id))}),o&&u.jsx("input",{className:ir.search,...i,placeholder:t("help.search")})]}),n==="general"?u.jsx(iOe,{}):u.jsx(oOe,{commands:e,tab:n,query:r})]})}function lOe({currentTheme:e,onSelect:t,onClose:n}){const{t:s}=it(),r=LD.map(d=>({id:d,label:s(`theme.${d}`),description:s(`theme.${d}.desc`)})),[i,o]=p.useState(()=>{const d=r.findIndex(h=>h.id===e);return d>=0?d:0}),a=p.useRef(null),l=d=>{const h=r[d];h&&(t(h.id),n())},{keyboardMode:c}=od({itemCount:r.length,activeIndex:i,onActiveIndexChange:o,onConfirm:l});return p.useEffect(()=>{var h;const d=(h=a.current)==null?void 0:h.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),u.jsx("div",{className:$e("picker-list","picker-list-compact",c?"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 f=d.id===e;return u.jsxs("div",{id:`theme-opt-${h}`,role:"option","aria-selected":f,className:$e("picker-item","picker-session-item",h===i?"selected":void 0,f?"dialog-current":void 0),"data-web-shell-theme-option":!0,"data-theme-id":d.id,onClick:()=>l(h),onMouseMove:()=>o(h),children:[u.jsx("div",{className:$e("picker-item-row"),children:u.jsx("span",{className:$e("picker-item-title"),children:d.label})}),u.jsx("div",{className:$e("picker-item-meta"),children:d.description})]},d.id)})})}const jS="delete-session-list",gI=e=>`${jS}-opt-${e}`;function cOe({onDeleted:e,onError:t,onClose:n}){const{t:s}=it(),r=Ta(),{sessions:i,loading:o,error:a,deleteSession:l,deleteSessions:c}=nh({autoLoad:!0}),d=r.sessionId,[h,f]=p.useState(!1),[m,g]=p.useState(-1),[y,b]=p.useState(new Set),{filterValue:w,inputProps:v}=Gv(()=>{g(-1),b(new Set)}),[x,C]=p.useState(null),A=p.useRef(null),T=p.useRef(null);p.useEffect(()=>{a&&C(a.message)},[a]);const _=p.useMemo(()=>w?i.filter(L=>{const $=w.toLowerCase();return(L.displayName||"").toLowerCase().includes($)||L.sessionId.toLowerCase().includes($)}):i,[i,w]),R=p.useCallback(L=>{L!==d&&b($=>{const F=new Set($);return F.has(L)?F.delete(L):F.add(L),F})},[d]);p.useEffect(()=>{if(y.size===0)return;const L=new Set(_.map($=>$.sessionId));b($=>{const F=new Set([...$].filter(B=>L.has(B)));return F.size===$.size?$:F})},[_,y.size]),p.useEffect(()=>{m>=_.length&&_.length>0&&g(_.length-1)},[_.length,m]),p.useEffect(()=>{var $;const L=($=A.current)==null?void 0:$.children[m];L==null||L.scrollIntoView({block:"nearest"})},[m]),p.useEffect(()=>{var L;(L=T.current)==null||L.focus()},[]);const{keyboardMode:I}=od({itemCount:_.length,activeIndex:m,onActiveIndexChange:g,onConfirm:L=>{const $=_[L];$&&R($.sessionId)}}),k=p.useCallback(()=>{if(h)return;if(y.size>0){const $=new Set(_.map(B=>B.sessionId)),F=Array.from(y).filter(B=>$.has(B));if(F.length===0)return;f(!0),c(F).then(B=>{const Q=B.removed.length+B.notFound.length,Y=B.errors.length;if(Y>0&&Q>0){t(new Error(s("delete.partialFail",{removed:Q,failed:Y,detail:B.errors[0].error}))),n();return}if(Y>0){C(s("delete.allFailed",{count:Y,reason:B.errors[0].error})),f(!1),b(new Set);return}if(Q===0){C(s("delete.nonRemoved")),f(!1),b(new Set);return}e([...B.removed,...B.notFound]),n()}).catch(B=>{t(B),f(!1)});return}const L=_[m];if(L){if(L.sessionId===d){C(s("delete.cannotCurrent"));return}f(!0),l(L.sessionId).then($=>{if(!$){C(s("delete.notFound")),f(!1);return}e([L.sessionId]),n()}).catch($=>{t($),f(!1)})}},[d,l,c,h,_,n,e,t,m,y,s]),j=y.size>0,N=!h&&!o&&j;return u.jsxs("div",{className:$e("picker","picker-in-shell"),children:[u.jsxs("div",{className:$e("picker-search"),children:[u.jsxs("span",{className:$e("picker-search-label"),children:[s("resume.search"),":"," "]}),u.jsx("input",{ref:T,className:$e("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":jS,"aria-activedescendant":m>=0&&m<_.length?gI(m):void 0,...v,placeholder:""}),u.jsx("span",{className:$e("picker-search-hint"),children:x||(h?s("delete.deleting"):o?s("common.loading"):j?s("delete.selected",{count:y.size}):w?s("delete.matches",{count:_.length}):"")})]}),u.jsx("div",{className:$e("picker-sep")}),u.jsxs("div",{id:jS,role:"listbox","aria-multiselectable":"true",className:$e("picker-list",I?"picker-keyboard-only":void 0),ref:A,children:[o&&u.jsx("div",{className:$e("picker-empty"),children:s("common.loading")}),!o&&a&&u.jsx("div",{className:$e("picker-empty"),children:a.message}),!o&&!a&&_.length===0&&u.jsx("div",{className:$e("picker-empty"),children:w?s("delete.noMatch",{query:w}):s("delete.none")}),!o&&_.map((L,$)=>{const F=L.sessionId===d,B=y.has(L.sessionId);return u.jsx(H8,{session:L,optionId:gI($),active:$===m,ariaSelected:B,current:!1,disabled:F,leading:u.jsx("span",{className:$e("picker-item-checkbox",B?"picker-item-checkbox-checked":void 0),children:B?"[x] ":"[ ] "}),trailing:F?u.jsx("span",{className:$e("picker-item-badge"),children:s("resume.current")}):void 0,onClick:()=>{g($),F||R(L.sessionId)},onActivate:()=>g($)},L.sessionId)})]}),u.jsx("div",{className:$e("picker-sep")}),u.jsxs("div",{className:$e("dialog-footer-actions"),children:[u.jsx("button",{type:"button",className:$e("dialog-inline-button"),onClick:n,disabled:h,children:s("common.cancel")}),u.jsx("button",{type:"button",className:$e("dialog-danger-button"),onClick:k,disabled:!N,children:s(h?"delete.deleting":"delete.action")})]})]})}const RS="release-session-list",yI=e=>`${RS}-opt-${e}`;function uOe({onReleased:e,onError:t,onClose:n}){const{t:s}=it(),r=Ta(),{sessions:i,loading:o,error:a,releaseSession:l}=nh({autoLoad:!0}),c=r.sessionId,[d,h]=p.useState(!1),[f,m]=p.useState(-1),[g,y]=p.useState(null),{filterValue:b,inputProps:w}=Gv(()=>{m(-1),y(null)}),[v,x]=p.useState(null),C=p.useRef(null),A=p.useRef(null);p.useEffect(()=>{a&&x(a.message)},[a]);const T=b?i.filter(L=>{const $=b.toLowerCase();return(L.displayName||"").toLowerCase().includes($)||L.sessionId.toLowerCase().includes($)}):i,_=L=>{const $=T[L];if(!$)return;const F=$.sessionId===c,B=($.clientCount??0)>0||$.hasActivePrompt===!0;F||!B||(m(L),y($.sessionId))};p.useEffect(()=>{f>=T.length&&T.length>0&&m(T.length-1)},[T.length,f]),p.useEffect(()=>{var $;const L=($=C.current)==null?void 0:$.children[f];L==null||L.scrollIntoView({block:"nearest"})},[f]),p.useEffect(()=>{var L;(L=A.current)==null||L.focus()},[]);const{keyboardMode:R}=od({itemCount:T.length,activeIndex:f,onActiveIndexChange:m,onConfirm:_}),I=p.useCallback(L=>{const $=L??T.find(B=>B.sessionId===g)??void 0;if(!$||d)return;if(!(($.clientCount??0)>0||$.hasActivePrompt===!0)){x(s("release.inactive"));return}if($.sessionId===c){x(s("release.cannotCurrent"));return}l&&(h(!0),l($.sessionId).then(()=>{e($.sessionId),n()}).catch(B=>{t(B),h(!1)}))},[c,d,T,n,t,e,l,g,s]),k=T.find(L=>L.sessionId===g)??void 0,j=k&&((k.clientCount??0)>0||k.hasActivePrompt===!0),N=!d&&!o&&!!k&&k.sessionId!==c&&!!j;return u.jsxs("div",{className:$e("picker","picker-in-shell"),children:[u.jsxs("div",{className:$e("picker-search"),children:[u.jsxs("span",{className:$e("picker-search-label"),children:[s("resume.search"),":"," "]}),u.jsx("input",{ref:A,className:$e("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":RS,"aria-activedescendant":f>=0&&f<T.length?yI(f):void 0,...w,placeholder:""}),u.jsx("span",{className:$e("picker-search-hint"),children:v||(d?s("release.releasing"):o?s("common.loading"):b?s("release.matches",{count:T.length}):"")})]}),u.jsx("div",{className:$e("picker-sep")}),u.jsxs("div",{id:RS,role:"listbox",className:$e("picker-list",R?"picker-keyboard-only":void 0),ref:C,children:[o&&u.jsx("div",{className:$e("picker-empty"),children:s("common.loading")}),!o&&T.length===0&&u.jsx("div",{className:$e("picker-empty"),children:b?s("release.noMatch",{query:b}):s("release.none")}),!o&&T.map((L,$)=>{const F=L.sessionId===c,B=(L.clientCount??0)>0||L.hasActivePrompt===!0,Q=F||!B;return u.jsx(H8,{session:L,optionId:yI($),active:$===f,confirmed:L.sessionId===g,ariaSelected:L.sessionId===g,current:!1,disabled:Q,trailing:F?u.jsx("span",{className:$e("picker-item-badge"),children:s("resume.current")}):B?void 0:u.jsx("span",{className:$e("picker-item-badge"),children:s("release.inactiveBadge")}),onClick:()=>_($),onActivate:()=>m($)},L.sessionId)})]}),u.jsx("div",{className:$e("picker-sep")}),u.jsxs("div",{className:$e("dialog-footer-actions"),children:[u.jsx("button",{type:"button",className:$e("dialog-inline-button"),onClick:n,disabled:d,children:s("common.cancel")}),u.jsx("button",{type:"button",className:$e("dialog-danger-button"),onClick:()=>I(),disabled:!N,children:s(d?"release.releasing":"release.action")})]})]})}const dOe="_root_ieg2d_1",hOe="_list_ieg2d_8",fOe="_item_ieg2d_21",mOe="_itemCursor_ieg2d_42",pOe="_itemSelected_ieg2d_49",gOe="_prompt_ieg2d_61",yOe="_keyboardOnly_ieg2d_68",bOe="_itemDisabled_ieg2d_77",wOe="_turn_ieg2d_91",vOe="_time_ieg2d_96",xOe="_footer_ieg2d_102",_Oe="_footerMessage_ieg2d_112",kOe="_dangerButton_ieg2d_118",Io={root:dOe,list:hOe,item:fOe,itemCursor:mOe,itemSelected:pOe,prompt:gOe,keyboardOnly:yOe,itemDisabled:bOe,turn:wOe,time:vOe,footer:xOe,footerMessage:_Oe,dangerButton:kOe},SOe="rewind-snapshot-list",bI=e=>`${SOe}-opt-${e}`;function TOe(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 COe(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function AOe({blocks:e,loadSnapshots:t,rewind:n,onError:s,onClose:r}){const{t:i}=it(),[o,a]=p.useState([]),[l,c]=p.useState(!0),[d,h]=p.useState(null),[f,m]=p.useState(0),[g,y]=p.useState(null),[b,w]=p.useState(null);p.useEffect(()=>{let R=!0;return c(!0),t().then(I=>{R&&a(I.snapshots)}).catch(I=>{R&&s(I)}).finally(()=>{R&&c(!1)}),()=>{R=!1}},[t,s]);const v=p.useMemo(()=>o.map(R=>({snapshot:R,promptText:TOe(e,R.turnIndex)})).sort((R,I)=>R.snapshot.turnIndex-I.snapshot.turnIndex),[e,o]);p.useEffect(()=>{f>=v.length&&v.length>0&&m(v.length-1)},[v.length,f]);const x=p.useRef(null),C=d!==null,A=R=>{!R||d||(h(R),w(null),n(R).then(()=>{r()}).catch(I=>{s(I),w(i("rewind.failed",{reason:I instanceof Error?I.message:String(I)})),h(null)}))},T=R=>{const I=v[R];I&&(m(R),y(I.snapshot.promptId))},{keyboardMode:_}=od({itemCount:v.length,activeIndex:f,onActiveIndexChange:m,onConfirm:T,enabled:!C});return p.useEffect(()=>{var I;const R=(I=x.current)==null?void 0:I.children[f];R==null||R.scrollIntoView({block:"nearest"})},[f]),p.useEffect(()=>{var I;if(l||v.length===0)return;const R=document.activeElement;(R==null?void 0:R.getAttribute("role"))==="dialog"&&((I=x.current)==null||I.focus())},[l,v.length]),l?u.jsx("div",{className:$e("picker-empty"),children:i("rewind.loading")}):v.length===0?u.jsx("div",{className:$e("picker-empty"),children:i("rewind.empty")}):u.jsxs("div",{className:Io.root,children:[u.jsx("div",{className:`${Io.list} ${_?Io.keyboardOnly:""}`,ref:x,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":v.length>0?bI(f):void 0,children:v.map(({snapshot:R,promptText:I},k)=>{const j=k===f,N=g===R.promptId,L=I||i("rewind.promptFallback",{id:R.promptId.slice(-8)});return u.jsxs("div",{id:bI(k),role:"option","aria-selected":N,"aria-disabled":C||void 0,className:`${Io.item} ${j?Io.itemCursor:""} ${N?Io.itemSelected:""} ${C?Io.itemDisabled:""}`,onClick:()=>{C||T(k)},onMouseMove:()=>m(k),children:[u.jsxs("div",{className:Io.prompt,title:L,children:[u.jsxs("span",{className:Io.turn,children:["#",R.turnIndex+1]})," ",L]}),u.jsx("div",{className:Io.time,children:COe(R.timestamp)})]},R.promptId)})}),u.jsxs("div",{className:Io.footer,children:[b&&u.jsx("span",{className:Io.footerMessage,role:"alert",children:b}),u.jsx("button",{type:"button",className:$e("dialog-inline-button"),onClick:r,disabled:d!==null,children:i("common.cancel")}),u.jsx("button",{type:"button",className:`${$e("dialog-danger-button")} ${Io.dangerButton}`,onClick:()=>A(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const EOe="_label_1wi0n_1",MOe="_input_1wi0n_7",NOe="_error_1wi0n_27",IOe="_cancelButton_1wi0n_33",iy={label:EOe,input:MOe,error:NOe,cancelButton:IOe};function jOe({onClose:e,onAdd:t}){const{t:n}=it(),[s,r]=p.useState(""),[i,o]=p.useState(null),[a,l]=p.useState(!1),c=p.useRef(null);p.useEffect(()=>{var h;(h=c.current)==null||h.focus()},[]);const d=p.useCallback(async h=>{h.preventDefault();const f=s.trim();if(f){if(!f.startsWith("/")&&!/^[A-Za-z]:[\\//]/.test(f)){o(n("sidebar.addWorkspaceAbsError"));return}o(null),l(!0);try{await t(f),e()}catch(m){o(m instanceof Error?m.message:n("sidebar.addWorkspaceError"))}finally{l(!1)}}},[s,t,e,n]);return u.jsx(xr,{title:n("sidebar.addWorkspaceTitle"),size:"sm",onClose:e,children:u.jsxs("form",{className:$e("dialog-form"),onSubmit:d,children:[u.jsxs("div",{className:$e("dialog-form-row"),children:[u.jsx("label",{className:iy.label,htmlFor:"add-workspace-path",children:n("sidebar.addWorkspacePath")}),u.jsx("input",{ref:c,id:"add-workspace-path",type:"text",className:iy.input,placeholder:"/absolute/path/to/project",value:s,onChange:h=>r(h.target.value),disabled:a})]}),i&&u.jsx("div",{className:iy.error,children:i}),u.jsxs("div",{className:$e("dialog-footer-actions"),children:[u.jsx("button",{type:"button",className:iy.cancelButton,onClick:e,disabled:a,children:n("sidebar.addWorkspaceCancel")}),u.jsx("button",{type:"submit",className:$e("dialog-primary-button"),disabled:a||!s.trim(),children:a?"...":n("sidebar.addWorkspaceRegister")})]})]})})}const ROe="_section_4eqno_1",LOe="_header_4eqno_6",DOe="_headerActive_4eqno_26",OOe="_headerDisabled_4eqno_31",BOe="_chevron_4eqno_36",POe="_folderIcon_4eqno_42",$Oe="_chevronOpen_4eqno_47",zOe="_name_4eqno_51",FOe="_badge_4eqno_58",qOe="_sessions_4eqno_66",HOe="_empty_4eqno_73",UOe="_sessionItem_4eqno_79",VOe="_sessionItemActive_4eqno_99",WOe="_sessionName_4eqno_103",GOe="_sessionTime_4eqno_110",Ei={section:ROe,header:LOe,headerActive:DOe,headerDisabled:OOe,chevron:BOe,folderIcon:POe,chevronOpen:$Oe,name:zOe,badge:FOe,sessions:qOe,empty:HOe,sessionItem:UOe,sessionItemActive:VOe,sessionName:WOe,sessionTime:GOe};function a_(...e){return e.filter(Boolean).join(" ")}function KOe(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function wI(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function YOe({open:e}){return u.jsx("svg",{className:Ei.folderIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e?u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3.25 8.6V7.4A2.4 2.4 0 0 1 5.65 5h4.1l2.1 2.1h6.5a2.4 2.4 0 0 1 2.4 2.4v1.1"}),u.jsx("path",{d:"M4.3 10.6h14.9a1.75 1.75 0 0 1 1.68 2.24l-1.32 4.5A2.4 2.4 0 0 1 17.25 19H5.05a2.4 2.4 0 0 1-2.34-2.94l.86-3.75A2.2 2.2 0 0 1 5.72 10.6"})]}):u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3.25 8.2V7.4A2.4 2.4 0 0 1 5.65 5h4.1l2.1 2.1h6.5a2.4 2.4 0 0 1 2.4 2.4v.7"}),u.jsx("path",{d:"M3.25 8.2h17.5v7.9a2.4 2.4 0 0 1-2.4 2.4H5.65a2.4 2.4 0 0 1-2.4-2.4V8.2Z"})]})})}function QOe({workspace:e,client:t,isActive:n,currentSessionId:s,reloadToken:r,primaryLabel:i,untrustedLabel:o,noSessionsLabel:a,formatTime:l,onSelectWorkspace:c,onLoadSession:d}){const[h,f]=p.useState([]),[m,g]=p.useState(e.primary);p.useEffect(()=>{g(e.primary)},[e.primary]);const y=p.useCallback(async()=>{if(e.trusted)try{const b=await t.listWorkspaceSessions(e.cwd,{archiveState:"active"});f(b)}catch(b){console.warn("[WorkspaceSection] session poll failed:",b),f([])}},[t,e.cwd,e.trusted]);return p.useEffect(()=>{if(!m)return;y();const b=setInterval(()=>void y(),1e4);return()=>clearInterval(b)},[m,y,r]),u.jsxs("div",{className:Ei.section,children:[u.jsxs("button",{className:a_(Ei.header,n&&Ei.headerActive,!e.trusted&&Ei.headerDisabled),disabled:!e.trusted,"aria-expanded":m,onClick:()=>{c(e.primary?void 0:e.cwd),g(b=>!b)},children:[u.jsx("span",{className:a_(Ei.chevron,m&&Ei.chevronOpen),children:u.jsx(YOe,{open:m})}),u.jsx("span",{className:Ei.name,children:KOe(e.cwd)}),e.primary&&u.jsx("span",{className:Ei.badge,children:i}),!e.trusted&&u.jsx("span",{className:Ei.badge,children:o})]}),m&&e.trusted&&u.jsx("div",{className:Ei.sessions,children:h.length===0?u.jsx("div",{className:Ei.empty,children:a}):h.map(b=>u.jsxs("button",{className:a_(Ei.sessionItem,b.sessionId===s&&Ei.sessionItemActive),onClick:()=>d(b.sessionId),title:wI(b),children:[u.jsx("span",{className:Ei.sessionName,children:wI(b)}),b.createdAt&&u.jsx("span",{className:Ei.sessionTime,children:l(b.createdAt)})]},b.sessionId))})]})}const XOe="_sidebar_geu9z_1",JOe="_resizing_geu9z_21",ZOe="_collapsed_geu9z_25",eBe="_newChatButton_geu9z_31",tBe="_footerButton_geu9z_32",nBe="_collapseButton_geu9z_33",sBe="_projectRow_geu9z_34",rBe="_sessionRow_geu9z_35",iBe="_sessionGroupHeader_geu9z_36",oBe="_sessionGroupActionButton_geu9z_37",aBe="_retry_geu9z_38",lBe="_projectIconButton_geu9z_40",cBe="_sessionActionButton_geu9z_41",uBe="_groupMenuItem_geu9z_42",dBe="_secondaryButton_geu9z_43",hBe="_dangerButton_geu9z_44",fBe="_navIcon_geu9z_110",mBe="_settingsIcon_geu9z_133",pBe="_projectFolderIcon_geu9z_139",gBe="_topRow_geu9z_143",yBe="_brandLogo_geu9z_156",bBe="_workspacePicker_geu9z_181",wBe="_workspacePickerLabel_geu9z_189",vBe="_workspacePickerHeader_geu9z_196",xBe="_workspaceAddIconButton_geu9z_203",_Be="_workspaceList_geu9z_223",kBe="_addWorkspaceButton_geu9z_229",SBe="_body_geu9z_249",TBe="_projectName_geu9z_296",CBe="_sessionText_geu9z_297",ABe="_sessionList_geu9z_312",EBe="_sessionGroupSection_geu9z_322",MBe="_sessionGroupHeaderRow_geu9z_328",NBe="_sessionGroupDot_geu9z_352",IBe="_sessionGroupTitle_geu9z_359",jBe="_sessionGroupCount_geu9z_366",RBe="_sessionGroupChevron_geu9z_371",LBe="_sessionPinnedIndicator_geu9z_382",DBe="_sessionGroupHeaderActions_geu9z_393",OBe="_sessionGroupList_geu9z_423",BBe="_groupedSessionRow_geu9z_441",PBe="_currentSession_geu9z_448",$Be="_pinnedSession_geu9z_458",zBe="_busySession_geu9z_462",FBe="_floatingTooltip_geu9z_467",qBe="_tooltipContent_geu9z_497",HBe="_tooltipTitle_geu9z_503",UBe="_tooltipTags_geu9z_510",VBe="_tooltipTag_geu9z_510",WBe="_tooltipTagRunning_geu9z_530",GBe="_tooltipTagNew_geu9z_535",KBe="_tooltipMeta_geu9z_540",YBe="_sessionStatusSlot_geu9z_555",QBe="_sessionStatusDot_geu9z_565",XBe="_sessionPinMarker_geu9z_575",JBe="_sessionMetaSlot_geu9z_601",ZBe="_sessionTime_geu9z_612",ePe="_sessionLoading_geu9z_619",tPe="_runningSession_geu9z_629",nPe="_sessionActions_geu9z_638",sPe="_activeSessionActionButton_geu9z_715",rPe="_searchInput_geu9z_734",iPe="_renameInput_geu9z_748",oPe="_dialogSelect_geu9z_754",aPe="_dialogInput_geu9z_764",lPe="_groupMenu_geu9z_42",cPe="_groupMenuItemActive_geu9z_806",uPe="_groupMenuName_geu9z_812",dPe="_groupMenuDot_geu9z_820",hPe="_groupMenuEmptyDot_geu9z_821",fPe="_groupMenuIcon_geu9z_822",mPe="_groupMenuCheck_geu9z_850",pPe="_groupMenuSeparator_geu9z_857",gPe="_groupColorRed_geu9z_863",yPe="_groupColorOrange_geu9z_867",bPe="_groupColorYellow_geu9z_871",wPe="_groupColorGreen_geu9z_875",vPe="_groupColorBlue_geu9z_879",xPe="_groupColorPurple_geu9z_883",_Pe="_renameForm_geu9z_892",kPe="_notice_geu9z_908",SPe="_confirmContent_geu9z_923",TPe="_confirmDescription_geu9z_929",CPe="_confirmActions_geu9z_936",APe="_groupForm_geu9z_942",EPe="_fieldStack_geu9z_949",MPe="_footer_geu9z_32",NPe="_footerButtonLabel_geu9z_1020",IPe="_footerCompact_geu9z_1027",jPe="_footerTight_geu9z_1028",RPe="_version_geu9z_1056",LPe="_resizeHandle_geu9z_1088",DPe="_sessionActionButtonActive_geu9z_1116",OPe="_menuActive_geu9z_1122",BPe="_actionMenu_geu9z_1126",PPe="_actionMenuItem_geu9z_1143",$Pe="_actionMenuItemDanger_geu9z_1174",zPe="_actionMenuIcon_geu9z_1184",FPe="_actionMenuLabel_geu9z_1203",qPe="_archivedSection_geu9z_1211",HPe="_archivedHeader_geu9z_1219",UPe="_archivedChevron_geu9z_1245",VPe="_archivedTitle_geu9z_1264",WPe="_archivedCount_geu9z_1273",GPe="_archivedList_geu9z_1288",KPe="_archivedRow_geu9z_1295",YPe="_mobileOpen_geu9z_1304",pe={sidebar:XOe,resizing:JOe,collapsed:ZOe,newChatButton:eBe,footerButton:tBe,collapseButton:nBe,projectRow:sBe,sessionRow:rBe,sessionGroupHeader:iBe,sessionGroupActionButton:oBe,retry:aBe,projectIconButton:lBe,sessionActionButton:cBe,groupMenuItem:uBe,secondaryButton:dBe,dangerButton:hBe,navIcon:fBe,settingsIcon:mBe,projectFolderIcon:pBe,topRow:gBe,brandLogo:yBe,workspacePicker:bBe,workspacePickerLabel:wBe,workspacePickerHeader:vBe,workspaceAddIconButton:xBe,workspaceList:_Be,addWorkspaceButton:kBe,body:SBe,projectName:TBe,sessionText:CBe,sessionList:ABe,sessionGroupSection:EBe,sessionGroupHeaderRow:MBe,sessionGroupDot:NBe,sessionGroupTitle:IBe,sessionGroupCount:jBe,sessionGroupChevron:RBe,sessionPinnedIndicator:LBe,sessionGroupHeaderActions:DBe,sessionGroupList:OBe,groupedSessionRow:BBe,currentSession:PBe,pinnedSession:$Be,busySession:zBe,floatingTooltip:FBe,tooltipContent:qBe,tooltipTitle:HBe,tooltipTags:UBe,tooltipTag:VBe,tooltipTagRunning:WBe,tooltipTagNew:GBe,tooltipMeta:KBe,sessionStatusSlot:YBe,sessionStatusDot:QBe,sessionPinMarker:XBe,sessionMetaSlot:JBe,sessionTime:ZBe,sessionLoading:ePe,runningSession:tPe,sessionActions:nPe,activeSessionActionButton:sPe,searchInput:rPe,renameInput:iPe,dialogSelect:oPe,dialogInput:aPe,groupMenu:lPe,groupMenuItemActive:cPe,groupMenuName:uPe,groupMenuDot:dPe,groupMenuEmptyDot:hPe,groupMenuIcon:fPe,groupMenuCheck:mPe,groupMenuSeparator:pPe,groupColorRed:gPe,groupColorOrange:yPe,groupColorYellow:bPe,groupColorGreen:wPe,groupColorBlue:vPe,groupColorPurple:xPe,renameForm:_Pe,notice:kPe,confirmContent:SPe,confirmDescription:TPe,confirmActions:CPe,groupForm:APe,fieldStack:EPe,footer:MPe,footerButtonLabel:NPe,footerCompact:IPe,footerTight:jPe,version:RPe,resizeHandle:LPe,sessionActionButtonActive:DPe,menuActive:OPe,actionMenu:BPe,actionMenuItem:PPe,actionMenuItemDanger:$Pe,actionMenuIcon:zPe,actionMenuLabel:FPe,archivedSection:qPe,archivedHeader:HPe,archivedChevron:UPe,archivedTitle:VPe,archivedCount:WPe,archivedList:GPe,archivedRow:KPe,mobileOpen:YPe},Pq="qwen-code-web-shell-sidebar-width",oy=260,QPe=220,$q=420,XPe=344,JPe=250,zq=200,ZPe=56,vI=zq-ZPe,e$e=2e3,t$e=3e4,xI=96,n$e="recent",l_=240,Uh=8,u0=["red","orange","yellow","green","blue","purple"];function Mi(...e){return e.filter(Boolean).join(" ")}function _I(e){return e instanceof DOMException&&e.name==="AbortError"}function s$e(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function E0(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function r$e(e){const t=E0(e).replace(/\s+/g," ").trim();return t.length<=xI?t:`${t.slice(0,xI-3).trimEnd()}...`}function i$e(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function c_(e){return e[0]??"blue"}function u_(e){switch(e){case"red":return pe.groupColorRed;case"orange":return pe.groupColorOrange;case"yellow":return pe.groupColorYellow;case"green":return pe.groupColorGreen;case"blue":return pe.groupColorBlue;case"purple":return pe.groupColorPurple}return e}function Tw(e){return Math.min($q,Math.max(QPe,e))}function o$e(e){return Math.min($q,Math.max(zq,e))}function a$e(){if(typeof window>"u")return oy;try{const e=window.localStorage.getItem(Pq),t=e?Number(e):oy;return Number.isFinite(t)?Tw(t):oy}catch{return oy}}function kI(e){try{window.localStorage.setItem(Pq,String(Tw(e)))}catch{}}function ay(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M12 5v14M5 12h14"})})}function l$e(){return u.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:u.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 c$e({expanded:e}){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3.25 8.6V7.4A2.4 2.4 0 0 1 5.65 5h4.1l2.1 2.1h6.5a2.4 2.4 0 0 1 2.4 2.4v1.1"}),u.jsx("path",{d:"M4.3 10.6h14.9a1.75 1.75 0 0 1 1.68 2.24l-1.32 4.5A2.4 2.4 0 0 1 17.25 19H5.05a2.4 2.4 0 0 1-2.34-2.94l.86-3.75A2.2 2.2 0 0 1 5.72 10.6"})]}):u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3.25 8.2V7.4A2.4 2.4 0 0 1 5.65 5h4.1l2.1 2.1h6.5a2.4 2.4 0 0 1 2.4 2.4v.7"}),u.jsx("path",{d:"M3.25 8.2h17.5v7.9a2.4 2.4 0 0 1-2.4 2.4H5.65a2.4 2.4 0 0 1-2.4-2.4V8.2Z"})]})})}function u$e(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m16.5 16.5 4 4"})]})}function d$e(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.9.3l-.1.1A2 2 0 1 1 4.2 17l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.9L4.2 7A2 2 0 1 1 7 4.2l.1.1a1.7 1.7 0 0 0 1.9.3h.1a1.7 1.7 0 0 0 .9-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1A2 2 0 1 1 19.8 7l-.1.1a1.7 1.7 0 0 0-.3 1.9v.1a1.7 1.7 0 0 0 1.5.9h.1a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1Z"})]})}function h$e(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M3 12h4l3-8 4 16 3-8h4"})})}function f$e(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("path",{d:"M12 7v5l3 2"})]})}function m$e(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function p$e(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"4",width:"8",height:"16",rx:"1"}),u.jsx("rect",{x:"13",y:"4",width:"8",height:"16",rx:"1"})]})}function SI(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M4 20h5l10-10a3 3 0 0 0-5-5L4 15v5Z"}),u.jsx("path",{d:"M13.5 5.5 18.5 10.5"})]})}function g$e(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M12 3v12"}),u.jsx("path",{d:"m7 10 5 5 5-5"}),u.jsx("path",{d:"M5 21h14"})]})}function d_(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3"})})}function ly(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"m14 4 6 6-4 1.5-3.5 3.5.5 4-8-8 4 .5 3.5-3.5L14 4Z"}),u.jsx("path",{d:"m5 19 4.5-4.5"})]})}function TI(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),u.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),u.jsx("path",{d:"M10 12h4"})]})}function CI(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M4 10.5 12 5l8 5.5V19a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 19v-8.5Z"}),u.jsx("path",{d:"M9 20.5v-6h6v6"})]})}function AI(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),u.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),u.jsx("path",{d:"M12 18v-6M9 15l3-3 3 3"})]})}function EI(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"5",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"12",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"19",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"})]})}function y$e({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?u.jsx("path",{d:"M9 6l6 6-6 6"}):u.jsx("path",{d:"M15 6l-6 6 6 6"})})}function h_({expanded:e}){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?u.jsx("path",{d:"m6 9 6 6 6-6"}):u.jsx("path",{d:"m9 6 6 6-6 6"})})}function b$e({anchorEl:e,items:t,onClose:n}){const s=p.useRef(null);p.useEffect(()=>{const l=d=>{var f;const h=d.target;h&&((f=s.current)!=null&&f.contains(h)||e.contains(h)||n())},c=d=>{d.key==="Escape"&&(d.stopPropagation(),n())};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",c,!0),window.addEventListener("scroll",n,!0),window.addEventListener("resize",n),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",c,!0),window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",n)}},[e,n]);const r=e.getBoundingClientRect(),i=t.length*34+8,o=r.bottom+i>window.innerHeight-8,a={right:Math.max(8,window.innerWidth-r.right),...o?{bottom:window.innerHeight-r.top+4}:{top:r.bottom+4}};return u.jsx("div",{ref:s,className:pe.actionMenu,role:"menu",style:a,children:t.map(l=>u.jsxs("button",{type:"button",role:"menuitem",className:Mi(pe.actionMenuItem,l.danger&&pe.actionMenuItemDanger),disabled:l.disabled,title:l.disabled?l.disabledTitle:void 0,onClick:()=>{l.disabled||(n(),l.onSelect())},children:[u.jsx("span",{className:pe.actionMenuIcon,"aria-hidden":"true",children:l.icon}),u.jsx("span",{className:pe.actionMenuLabel,children:l.label})]},l.key))})}function w$e({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenDaemonStatus:s,onOpenScheduledTasks:r,onOpenSessions:i,canOpenSessionsOverview:o,onOpenSplitView:a,canOpenSplitView:l,onNewSession:c,onLoadSession:d,onError:h,mobileOpen:f,sessionListReloadToken:m,selectedWorkspaceCwd:g,onSelectWorkspace:y}){var nn,Yt,mn,_n,Ks,dr;const{t:b}=it(),w=Ta(),v=fg(),x=Sa(),C=Yw(),A=!!((Yt=(nn=w.capabilities)==null?void 0:nn.features)!=null&&Yt.includes(V8)),T=((mn=C.capabilities)==null?void 0:mn.workspaces)??[],{sessions:_,loading:R,error:I,reload:k,deleteSession:j,exportSession:N,archiveSession:L}=nh({autoLoad:!0,pageSize:kw,archiveState:"active",...A?{view:"organized",group:"all"}:{}}),[$,F]=p.useState(!1),{sessions:B,loading:Q,error:Y,reload:ne,deleteSession:P,unarchiveSession:le}=nh({autoLoad:!0,enabled:$,pageSize:kw,archiveState:"archived",...A?{view:"organized",group:"all"}:{}}),[z,M]=p.useState(null),[re,U]=p.useState([]),[W,J]=p.useState([]),[G,te]=p.useState(!1),[H,ie]=p.useState(null),[fe,Ne]=p.useState(""),[Ie,Ce]=p.useState(()=>new Set),ve=p.useRef(new Set),[ut,ae]=p.useState(()=>new Set),Ct=p.useRef(new Set),[Ke,on]=p.useState(!1),qt=p.useRef(!1),[gt,St]=p.useState(null),[ft,de]=p.useState(null),[_e,Ue]=p.useState(null),[Xe,yt]=p.useState(""),[ye,Kt]=p.useState("blue"),[Ee,ct]=p.useState(null),[qn,Me]=p.useState(()=>new Set),[qe,Fe]=p.useState(a$e),[Ht,Mn]=p.useState(!0),[Rn,Bn]=p.useState(!1),[Hr,Ut]=p.useState(!1),[vn,tn]=p.useState(0),[Jt,Nn]=p.useState(""),[fn,Pn]=p.useState(!1),[Gn,Hn]=p.useState(null),[qs,br]=p.useState(()=>new Set),Dn=p.useRef(null),ln=p.useRef(null),Es=p.useRef(null),Te=p.useRef(!1),Ye=p.useRef(null),_t=w.sessionId,Bt=((Ks=(_n=w.capabilities)==null?void 0:_n.features)==null?void 0:Ks.includes("session_export"))??!1,bn=s$e(w.workspaceCwd)||b("sidebar.projectFallback"),ws=((dr=w.capabilities)==null?void 0:dr.qwenCodeVersion)||"",Zs=ws?/^\d/.test(ws)?`v${ws}`:ws:"",Ir=!e&&qe<XPe,Ur=!e&&qe<JPe,Bs={"--web-shell-sidebar-width":`${qe}px`},we=Ke,xe=p.useCallback((X,ke)=>{const Le=new Set(ve.current);ke?Le.add(X):Le.delete(X),ve.current=Le,Ce(Le)},[]),wt=p.useCallback(async()=>{if(!A){U([]),J([]);return}try{const X=await x.listSessionGroups();U(X.groups),J(X.colorOptions)}catch(X){h(X,b("sidebar.groupsLoadFailed"))}},[h,A,b,x]);p.useEffect(()=>{if(!A){U([]),J([]);return}wt()},[A,wt]),p.useEffect(()=>{if(!ft)return;const X=Le=>{var Xt;(Xt=Dn.current)!=null&&Xt.contains(Le.target)||de(null)},ke=Le=>{Le.key==="Escape"&&de(null)};return document.addEventListener("mousedown",X),document.addEventListener("keydown",ke),()=>{document.removeEventListener("mousedown",X),document.removeEventListener("keydown",ke)}},[ft]),p.useEffect(()=>{if(!ft)return;const X=window.requestAnimationFrame(()=>{var Xt;const ke=Array.from(((Xt=Dn.current)==null?void 0:Xt.querySelectorAll("button:not(:disabled)"))??[]),Le=ke.find(hn=>hn.getAttribute("aria-checked")==="true")??ke[0];Le==null||Le.focus()});return()=>window.cancelAnimationFrame(X)},[ft]);const oe=p.useCallback(X=>{var pn,cn;const ke=Array.from(((pn=Dn.current)==null?void 0:pn.querySelectorAll("button:not(:disabled)"))??[]);if(ke.length===0)return;const Le=ke.indexOf(document.activeElement),Xt=Le>=0?Le:-1;let hn;if(X.key==="ArrowDown")hn=(Xt+1)%ke.length;else if(X.key==="ArrowUp")hn=(Xt-1+ke.length)%ke.length;else if(X.key==="Home")hn=0;else if(X.key==="End")hn=ke.length-1;else if(X.key==="Escape"){X.preventDefault(),de(null);return}hn!==void 0&&(X.preventDefault(),(cn=ke[hn])==null||cn.focus())},[]),ue=p.useCallback(()=>{ln.current!==null&&(window.clearTimeout(ln.current),ln.current=null)},[]),be=p.useCallback(()=>{ue(),ln.current=window.setTimeout(()=>{Hn(null),ln.current=null},240)},[ue]);p.useEffect(()=>()=>{var X;ue(),(X=Ye.current)==null||X.call(Ye,!1)},[ue]),p.useEffect(()=>{Mn(!e),e&&(Bn(!1),Nn(""),Hn(null))},[e]);const lt=p.useMemo(()=>_.some(X=>X.hasActivePrompt),[_]);p.useEffect(()=>{if(!Ht&&!lt)return;const X=lt&&!I?e$e:t$e,ke=window.setInterval(()=>{document.hidden||Te.current||(Te.current=!0,k().finally(()=>{Te.current=!1}))},X);return()=>window.clearInterval(ke)},[I,lt,Ht,k]);const Re=p.useRef(m);p.useEffect(()=>{m!==void 0&&m!==Re.current&&!document.hidden&&!Te.current&&(Re.current=m,Te.current=!0,k().finally(()=>{Te.current=!1}))},[m,k]),p.useEffect(()=>{const X=new Map(_.map(Le=>[Le.sessionId,!!Le.hasActivePrompt])),ke=Es.current;Es.current=X,ke!==null&&br(Le=>{const Xt=new Set(Le);let hn=!1;for(const[pn,cn]of ke){const is=X.get(pn);cn&&is===!1&&pn!==_t&&!Xt.has(pn)&&(Xt.add(pn),hn=!0)}for(const pn of Xt)(pn===_t||!X.has(pn)||X.get(pn))&&(Xt.delete(pn),hn=!0);return hn?Xt:Le})},[_t,_]);const Nt=p.useCallback((X,ke)=>{ue();const Le=X.currentTarget.getBoundingClientRect();Hn({content:ke,top:Le.top+Le.height/2,left:Le.right+8})},[ue]),bt=p.useCallback(X=>{const ke=E0(X),Le=X.sessionId!==_t&&qs.has(X.sessionId);return u.jsxs("div",{className:pe.tooltipContent,children:[u.jsx("div",{className:pe.tooltipTitle,children:ke}),u.jsxs("div",{className:pe.tooltipTags,children:[X.hasActivePrompt&&u.jsx("span",{className:Mi(pe.tooltipTag,pe.tooltipTagRunning),children:b("sidebar.running")}),Le&&u.jsx("span",{className:Mi(pe.tooltipTag,pe.tooltipTagNew),children:b("sidebar.completedUnread")}),u.jsx("span",{className:pe.tooltipTag,children:b("sidebar.clients",{count:X.clientCount??0})})]}),u.jsx("div",{className:pe.tooltipMeta,children:X.sessionId})]})},[qs,_t,b]),rn=p.useCallback(async X=>{var ke;await x.addWorkspace(X);try{await((ke=C.refreshCapabilities)==null?void 0:ke.call(C))}catch{}},[x,C]),Kn=p.useCallback(()=>{qt.current||(qt.current=!0,on(!0),(async()=>{try{await c()&&(k().catch(()=>{}),tn(ke=>ke+1))}catch(X){_I(X)||h(X,b("sidebar.newSessionFailed"))}finally{qt.current=!1,on(!1)}})())},[h,c,k,b]),er=p.useCallback(X=>{X===_t||ve.current.has(X)||(br(ke=>{if(!ke.has(X))return ke;const Le=new Set(ke);return Le.delete(X),Le}),xe(X,!0),(async()=>{try{await d(X)}catch(ke){_I(ke)||h(ke,b("sidebar.switchFailed"))}finally{xe(X,!1)}})())},[_t,h,d,xe,b]),vs=p.useCallback(X=>{ie(X.sessionId),Ne(E0(X))},[]),tr=p.useCallback(()=>{ie(null),Ne("")},[]),ni=p.useCallback(()=>{const X=fe.trim();if(!X||H!==_t){tr();return}const ke=H;ve.current.has(ke)||(xe(ke,!0),v.renameSession(X).then(()=>{tr(),k()}).catch(Le=>{h(Le,b("sidebar.renameFailed")),tr()}).finally(()=>{xe(ke,!1)}))},[v,tr,_t,fe,H,h,k,xe,b]),ns=p.useCallback(X=>{X.sessionId!==_t&&St(X)},[_t]),bi=p.useCallback((X,ke)=>{const Le=new Set(Ct.current);ke?Le.add(X):Le.delete(X),Ct.current=Le,ae(Le)},[]),Aa=p.useCallback(X=>{const ke=X.sessionId;!Bt||Ct.current.has(ke)||(bi(ke,!0),(async()=>{try{const Le=await N(ke,"html"),Xt=new Blob([Le.content],{type:Le.mimeType||"text/html"}),hn=URL.createObjectURL(Xt);try{const pn=document.createElement("a");pn.href=hn,pn.download=Le.filename,document.body.appendChild(pn),pn.click(),pn.remove()}finally{URL.revokeObjectURL(hn)}}catch(Le){h(Le,b("sidebar.exportFailed"))}finally{bi(ke,!1)}})())},[Bt,N,h,bi,b]),Ao=p.useCallback(()=>{if(!gt)return;const X=gt.sessionId;if(X===_t){St(null);return}const ke=!!gt.isArchived;if(St(null),ve.current.has(X))return;xe(X,!0),(ke?P:j)(X).then(()=>{k(),ne()}).catch(Xt=>h(Xt,b("sidebar.deleteFailed"))).finally(()=>{xe(X,!1)})},[_t,P,gt,j,h,k,ne,xe,b]),Eo=p.useCallback(X=>{X.sessionId===_t&&vs(X)},[_t,vs]),io=p.useCallback(()=>{de(null),yt(""),Kt(c_(W)),Ue({mode:"create"})},[W]),Ea=p.useCallback(X=>{de(null),yt(""),Kt(c_(W)),Ue({mode:"create",targetSession:X})},[W]),oo=p.useCallback(X=>{yt(X.name),Kt(X.color),Ue({mode:"edit",group:X})},[]),wi=p.useCallback(()=>{G||(Ue(null),yt(""),Kt(c_(W)))},[W,G]),vi=p.useCallback(()=>{if(!_e)return;const X=Xe.trim();X&&(async()=>{te(!0);try{const ke=_e.mode==="create"?await x.createSessionGroup({name:X,color:ye}):await x.updateSessionGroup(_e.group.id,{name:X,color:ye});if(_e.mode==="create"&&_e.targetSession)try{await x.updateSessionOrganization(_e.targetSession.sessionId,{groupId:ke.id,color:null}),k().catch(()=>{})}catch(Le){Ue(null),yt(""),wt().catch(()=>{}),h(Le,b("sidebar.groupAssignFailedAfterCreate"));return}Ue(null),yt(""),wt().catch(()=>{})}catch(ke){h(ke,_e.mode==="create"?b("sidebar.groupCreateFailed"):b("sidebar.groupUpdateFailed"))}finally{te(!1)}})()},[ye,_e,Xe,h,k,wt,b,x]),xi=p.useCallback(X=>{ct(X)},[]),Ss=p.useCallback(()=>{Ee&&(te(!0),x.deleteSessionGroup(Ee.id).then(()=>{ct(null),k().catch(()=>{})}).catch(X=>h(X,b("sidebar.groupDeleteFailed"))).then(()=>wt().catch(()=>{})).finally(()=>te(!1)))},[Ee,h,k,wt,b,x]),ao=p.useCallback(X=>{const ke=X.sessionId;!A||ve.current.has(ke)||(xe(ke,!0),x.updateSessionOrganization(ke,{isPinned:!X.isPinned}).then(()=>{k().catch(()=>{})}).catch(Le=>h(Le,b("sidebar.organizationFailed"))).finally(()=>{xe(ke,!1)}))},[h,A,k,xe,b,x]),Mo=p.useCallback(X=>{const ke=X.sessionId;ke!==_t&&(ve.current.has(ke)||(xe(ke,!0),L(ke).then(()=>{ne()}).catch(Le=>h(Le,b("sidebar.archiveFailed"))).finally(()=>{xe(ke,!1)})))},[L,_t,h,ne,xe,b]),Ka=p.useCallback(X=>{const ke=X.sessionId;ve.current.has(ke)||(xe(ke,!0),le(ke).then(()=>{k()}).catch(Le=>h(Le,b("sidebar.unarchiveFailed"))).finally(()=>{xe(ke,!1)}))},[h,k,xe,b,le]),Oc=p.useCallback(()=>M(null),[]),Ma=p.useCallback((X,ke)=>{const Le=X.getBoundingClientRect(),Xt=typeof window>"u"?Le.right+l_:window.innerWidth,hn=typeof window>"u"?Le.top+320:window.innerHeight,pn=Math.min(320,34*(re.length+u0.length+2)+25),cn=Le.right+Uh+l_<=Xt?Le.right+Uh:Math.max(Uh,Le.left-l_-Uh),is=Math.max(Uh,Math.min(Le.top,hn-pn-Uh));Hn(null),de({session:ke,top:is,left:cn})},[re.length]),si=p.useCallback((X,ke)=>{X.stopPropagation(),Ma(X.currentTarget,ke)},[Ma]),se=p.useCallback((X,ke,Le)=>{X.stopPropagation();const Xt=X.currentTarget;M(hn=>hn&&hn.session.sessionId===ke.sessionId&&hn.isArchived===Le?null:{session:ke,isArchived:Le,anchorEl:Xt})},[]),me=p.useCallback((X,ke)=>{const Le=X.sessionId;!A||ve.current.has(Le)||(de(null),xe(Le,!0),x.updateSessionOrganization(Le,{groupId:ke,color:null}).then(()=>{k().catch(()=>{})}).catch(Xt=>h(Xt,b("sidebar.organizationFailed"))).finally(()=>{xe(Le,!1)}))},[h,A,k,xe,b,x]),Oe=p.useCallback((X,ke)=>{const Le=X.sessionId;!A||ve.current.has(Le)||(de(null),xe(Le,!0),x.updateSessionOrganization(Le,{color:ke,groupId:null}).then(()=>{k().catch(()=>{})}).catch(Xt=>h(Xt,b("sidebar.organizationFailed"))).finally(()=>{xe(Le,!1)}))},[h,A,k,xe,b,x]),et=p.useMemo(()=>{const X=Jt.trim().toLowerCase(),ke=X?_.filter(Xt=>E0(Xt).toLowerCase().includes(X)||Xt.sessionId.toLowerCase().includes(X)):_.slice();if(A)return ke;const Le=new Map(ke.map(Xt=>[Xt.sessionId,i$e(Xt)]));return ke.sort((Xt,hn)=>(Le.get(hn.sessionId)??0)-(Le.get(Xt.sessionId)??0))},[A,Jt,_]),Se=p.useMemo(()=>{if(!A)return[];const X=Jt.trim().length>0,ke=new Set(re.map(cn=>cn.id)),Le=new Map,Xt=new Map;for(const cn of re)Xt.set(cn.id,[]);const hn=[];for(const cn of et){if(cn.color&&u0.includes(cn.color)){const ri=Le.get(cn.color)??[];ri.push(cn),Le.set(cn.color,ri);continue}const is=cn.groupId&&ke.has(cn.groupId)?Xt.get(cn.groupId):void 0;is?is.push(cn):hn.push(cn)}const pn=[];for(const cn of u0){const is=Le.get(cn);!is||is.length===0||pn.push({id:`color:${cn}`,kind:"color",label:b(`sidebar.groupColor.${cn}`),countLabel:String(is.length),color:cn,sessions:is})}for(const cn of re){const is=Xt.get(cn.id)??[];X&&is.length===0||pn.push({id:`group:${cn.id}`,kind:"group",label:cn.name,countLabel:String(is.length),color:cn.color,group:cn,sessions:is})}return hn.length>0&&pn.push({id:n$e,kind:"recent",label:b("sidebar.groupRecent"),sessions:hn}),pn},[et,re,A,Jt,b]),dt=p.useCallback(X=>{Me(ke=>{const Le=new Set(ke);return Le.has(X)?Le.delete(X):Le.add(X),Le})},[]),$t=p.useCallback(X=>{var Pc;if(e)return;X.preventDefault(),(Pc=Ye.current)==null||Pc.call(Ye,!0),Pn(!0);const ke=X.clientX,Le=qe,Xt=document.body.style.cursor,hn=document.body.style.userSelect;let pn=!1,cn=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{X.currentTarget.setPointerCapture(X.pointerId)}catch{}function is(kn){return Le+kn-ke}function ri(){const kn=Tw(Le);Fe(kn),kI(kn)}function _i(){pn||(pn=!0,ri(),cn(!0),t(!0))}function Bc(kn){const Ia=is(kn.clientX);if(Ia<=vI){_i();return}Fe(o$e(Ia))}cn=function(Ia){document.body.style.cursor=Xt,document.body.style.userSelect=hn,window.removeEventListener("pointermove",Bc),window.removeEventListener("pointerup",wr),window.removeEventListener("pointercancel",Na),Ye.current=null,Ia&&Pn(!1)};function wr(kn){const Ia=is(kn.clientX);if(Ia<=vI){_i();return}const jm=Tw(Ia);Fe(jm),kI(jm),cn(!0)}function Na(){cn(!0)}Ye.current=cn,window.addEventListener("pointermove",Bc),window.addEventListener("pointerup",wr,{once:!0}),window.addEventListener("pointercancel",Na,{once:!0})},[e,t,qe]),Xn=gt?r$e(gt):"",Tn=ft!=null&&ft.session.color&&u0.includes(ft.session.color)?ft.session.color:null,ss=!Tn&&(ft!=null&&ft.session.groupId)&&re.some(X=>X.id===ft.session.groupId)?ft.session.groupId:null,Yn=W.length>0?W:u0,xn=ss===null&&Tn===null,jr=(Ee==null?void 0:Ee.name)??"",rs=Xe.trim().length>0&&!G,ms=(_e==null?void 0:_e.mode)==="create"?b("sidebar.groupCreate"):b("sidebar.groupRename"),es=W.length>0?W:["blue"],Vr=p.useCallback((X,ke={})=>{const{isArchived:Le=!1,grouped:Xt=!1}=ke,hn=E0(X),pn=X.updatedAt||X.createdAt,cn=pn?xw(pn,b):"",is=Ie.has(X.sessionId),ri=(z==null?void 0:z.session.sessionId)===X.sessionId&&z.isArchived===Le;if(Le)return u.jsxs("div",{className:Mi(pe.sessionRow,pe.archivedRow,is&&pe.busySession,ri&&pe.menuActive),title:hn,children:[u.jsx("span",{className:pe.sessionText,children:hn}),u.jsxs("div",{className:pe.sessionMetaSlot,children:[u.jsx("span",{className:pe.sessionTime,children:cn}),u.jsxs("div",{className:pe.sessionActions,onClick:kn=>kn.stopPropagation(),onKeyDown:kn=>kn.stopPropagation(),children:[u.jsx("button",{className:pe.sessionActionButton,type:"button",title:b("sidebar.unarchive"),"aria-label":b("sidebar.unarchive"),onClick:()=>Ka(X),children:u.jsx(AI,{})}),u.jsx("button",{className:Mi(pe.sessionActionButton,ri&&pe.sessionActionButtonActive),type:"button","aria-label":b("sidebar.moreActions"),"aria-haspopup":"menu","aria-expanded":ri,title:b("sidebar.moreActions"),onClick:kn=>se(kn,X,!0),children:u.jsx(EI,{})})]})]})]},X.sessionId);const _i=X.sessionId===_t,Bc=H===X.sessionId,wr=ut.has(X.sessionId),Na=!_i&&qs.has(X.sessionId),Pc=Xt&&X.isPinned&&!X.hasActivePrompt;return u.jsx("div",{className:Mi(pe.sessionRow,Xt&&pe.groupedSessionRow,_i&&pe.currentSession,X.isPinned&&pe.pinnedSession,X.hasActivePrompt&&pe.runningSession,is&&pe.busySession,ri&&pe.menuActive),role:"button",tabIndex:0,"aria-current":_i?"page":void 0,onMouseEnter:kn=>Nt(kn,bt(X)),onMouseLeave:be,onFocus:kn=>Nt(kn,bt(X)),onBlur:be,onClick:()=>er(X.sessionId),onDoubleClick:()=>{_i&&!e&&vs(X)},onKeyDown:kn=>{kn.key==="Enter"&&er(X.sessionId)},children:!e&&u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:pe.sessionStatusSlot,"aria-hidden":"true",children:[Na&&u.jsx("span",{className:pe.sessionStatusDot}),!Na&&X.isPinned&&!Xt&&u.jsx("span",{className:pe.sessionPinMarker,children:u.jsx(ly,{})})]}),Bc?u.jsx("form",{className:pe.renameForm,onClick:kn=>kn.stopPropagation(),onSubmit:kn=>{kn.preventDefault(),ni()},children:u.jsx("input",{autoFocus:!0,className:pe.renameInput,value:fe,onChange:kn=>Ne(kn.target.value),onBlur:tr,onKeyDown:kn=>{kn.key==="Escape"&&(kn.preventDefault(),tr())}})}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:pe.sessionText,children:hn}),u.jsxs("div",{className:pe.sessionMetaSlot,children:[X.hasActivePrompt?u.jsx("span",{className:pe.sessionLoading,"aria-label":b("sidebar.running")}):Pc?u.jsx("span",{className:pe.sessionPinnedIndicator,"aria-label":b("sidebar.pin"),children:u.jsx(ly,{})}):u.jsx("span",{className:pe.sessionTime,children:cn}),u.jsxs("div",{className:pe.sessionActions,onClick:kn=>kn.stopPropagation(),onKeyDown:kn=>kn.stopPropagation(),onMouseEnter:kn=>{kn.stopPropagation(),Hn(null)},children:[A&&u.jsxs(u.Fragment,{children:[u.jsx("button",{className:Mi(pe.sessionActionButton,X.isPinned&&pe.activeSessionActionButton),type:"button",disabled:is,title:X.isPinned?b("sidebar.unpin"):b("sidebar.pin"),"aria-label":X.isPinned?b("sidebar.unpin"):b("sidebar.pin"),onClick:()=>ao(X),children:u.jsx(ly,{})}),u.jsx("button",{className:pe.sessionActionButton,type:"button",disabled:is,title:b("sidebar.sessionGroup"),"aria-label":b("sidebar.sessionGroup"),onClick:kn=>si(kn,X),children:u.jsx(CI,{})})]}),u.jsx("button",{className:pe.sessionActionButton,type:"button",disabled:_i,title:b(_i?"sidebar.archiveCurrentDisabled":"sidebar.archive"),"aria-label":b("sidebar.archive"),onClick:()=>Mo(X),children:u.jsx(TI,{})}),Bt&&u.jsx("button",{className:pe.sessionActionButton,type:"button",disabled:wr,title:b("sidebar.export"),"aria-label":b("sidebar.export"),onClick:()=>Aa(X),children:u.jsx(g$e,{})}),u.jsx("button",{className:Mi(pe.sessionActionButton,ri&&pe.sessionActionButtonActive),type:"button","aria-label":b("sidebar.moreActions"),"aria-haspopup":"menu","aria-expanded":ri,title:b("sidebar.moreActions"),onClick:kn=>se(kn,X,!1),children:u.jsx(EI,{})})]})]})]})]})},X.sessionId)},[Ie,Bt,tr,e,qs,_t,fe,H,ut,Mo,Aa,er,ao,Ka,be,z,si,se,A,bt,ni,Nt,vs,b]),De=p.useMemo(()=>Ht?R&&_.length===0?u.jsx("div",{className:pe.notice,children:b("sidebar.loadingSessions")}):I&&_.length===0?u.jsx("button",{className:pe.retry,type:"button",onClick:k,children:b("sidebar.loadFailed")}):et.length===0&&(Jt.trim()||!A||Se.length===0)?u.jsx("div",{className:pe.notice,children:b("sidebar.searchEmpty")}):A?Se.map(X=>{const ke=!qn.has(X.id),Le=X.group;return u.jsxs("section",{className:pe.sessionGroupSection,"aria-label":X.label,children:[u.jsxs("div",{className:pe.sessionGroupHeaderRow,children:[u.jsxs("button",{type:"button",className:pe.sessionGroupHeader,"aria-expanded":ke,onClick:()=>dt(X.id),children:[X.color?u.jsx("span",{className:Mi(pe.sessionGroupDot,u_(X.color)),"aria-hidden":"true"}):null,u.jsx("span",{className:pe.sessionGroupTitle,children:X.label}),X.countLabel?u.jsxs("span",{className:pe.sessionGroupCount,children:["· ",X.countLabel]}):null,u.jsx("span",{className:pe.sessionGroupChevron,"aria-hidden":"true",children:u.jsx(h_,{expanded:ke})})]}),u.jsx("div",{className:pe.sessionGroupHeaderActions,children:X.kind==="group"&&Le?u.jsxs(u.Fragment,{children:[u.jsx("button",{className:pe.sessionGroupActionButton,type:"button",title:b("sidebar.groupCreate"),"aria-label":b("sidebar.groupCreate"),disabled:G,onClick:io,children:u.jsx(ay,{})}),u.jsx("button",{className:pe.sessionGroupActionButton,type:"button",title:b("sidebar.groupRename"),"aria-label":b("sidebar.groupRename"),disabled:G,onClick:()=>oo(Le),children:u.jsx(SI,{})}),u.jsx("button",{className:pe.sessionGroupActionButton,type:"button",title:b("sidebar.groupDelete"),"aria-label":b("sidebar.groupDelete"),disabled:G,onClick:()=>xi(Le),children:u.jsx(d_,{})})]}):X.kind==="recent"?u.jsx("button",{className:pe.sessionGroupActionButton,type:"button",title:b("sidebar.groupCreate"),"aria-label":b("sidebar.groupCreate"),disabled:G,onClick:io,children:u.jsx(ay,{})}):null})]}),ke&&u.jsx("div",{className:pe.sessionGroupList,children:X.sessions.map(Xt=>Vr(Xt,{grouped:!0}))})]},X.id)}):et.map(X=>Vr(X)):null,[qn,I,et,G,io,xi,oo,R,A,Ht,k,Vr,Jt,Se,_.length,b,dt]),vt=p.useMemo(()=>{if(e||!Ht||Jt.trim())return null;const X=u.jsxs("button",{type:"button",className:pe.archivedHeader,"aria-expanded":$,onClick:()=>F(Le=>!Le),children:[u.jsx("span",{className:pe.archivedChevron,"aria-hidden":"true",children:u.jsx(h_,{expanded:$})}),u.jsx("span",{className:pe.archivedTitle,children:b("sidebar.archivedTitle")}),$&&B.length>0&&u.jsx("span",{className:pe.archivedCount,children:B.length})]});if(!$)return u.jsx("div",{className:pe.archivedSection,children:X});let ke;return Q&&B.length===0?ke=u.jsx("div",{className:pe.notice,children:b("sidebar.loadingSessions")}):Y&&B.length===0?ke=u.jsx("button",{className:pe.retry,type:"button",onClick:()=>ne(),children:b("sidebar.loadFailed")}):B.length===0?ke=u.jsx("div",{className:pe.notice,children:b("sidebar.archivedEmpty")}):ke=B.map(Le=>Vr(Le,{isArchived:!0})),u.jsxs("div",{className:pe.archivedSection,children:[X,u.jsx("div",{className:pe.archivedList,children:ke})]})},[Y,$,Q,B,e,Ht,ne,Vr,Jt,b]),Vt=p.useMemo(()=>{if(!z)return[];const{session:X,isArchived:ke}=z;if(ke)return[{key:"unarchive",label:b("sidebar.unarchive"),icon:u.jsx(AI,{}),onSelect:()=>Ka(X)},{key:"delete",label:b("sidebar.delete"),icon:u.jsx(d_,{}),danger:!0,onSelect:()=>ns(X)}];const Le=X.sessionId===_t,Xt=Ie.has(X.sessionId);return[{key:"rename",label:b("sidebar.rename"),icon:u.jsx(SI,{}),disabled:!Le,disabledTitle:b("sidebar.renameCurrentOnly"),onSelect:()=>Eo(X)},...A?[{key:"pin",label:X.isPinned?b("sidebar.unpin"):b("sidebar.pin"),icon:u.jsx(ly,{}),disabled:Xt,onSelect:()=>ao(X)},{key:"group",label:b("sidebar.sessionGroup"),icon:u.jsx(CI,{}),disabled:Xt,onSelect:()=>Ma(z.anchorEl,X)}]:[],{key:"archive",label:b("sidebar.archive"),icon:u.jsx(TI,{}),disabled:Le,disabledTitle:b("sidebar.archiveCurrentDisabled"),onSelect:()=>Mo(X)},{key:"delete",label:b("sidebar.delete"),icon:u.jsx(d_,{}),danger:!0,disabled:Le,disabledTitle:b("sidebar.currentDeleteDisabled"),onSelect:()=>ns(X)}]},[Ie,_t,Mo,ns,Eo,ao,Ka,z,Ma,A,b]);return u.jsxs(u.Fragment,{children:[u.jsxs("aside",{className:Mi(pe.sidebar,e&&pe.collapsed,fn&&pe.resizing,f&&pe.mobileOpen),"aria-label":b("sidebar.label"),style:Bs,children:[Gn&&u.jsx("div",{className:pe.floatingTooltip,role:"tooltip",style:{top:Gn.top,left:Gn.left},onMouseEnter:ue,onMouseLeave:be,children:Gn.content}),ft&&u.jsxs("div",{ref:Dn,className:pe.groupMenu,role:"menu","aria-label":b("sidebar.sessionGroup"),style:{top:ft.top,left:ft.left},onClick:X=>X.stopPropagation(),onKeyDown:oe,onMouseDown:X=>X.stopPropagation(),children:[u.jsxs("button",{className:Mi(pe.groupMenuItem,xn&&pe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":xn,onClick:()=>me(ft.session,null),children:[u.jsx("span",{className:pe.groupMenuEmptyDot}),u.jsx("span",{className:pe.groupMenuName,children:b("sidebar.groupUngrouped")}),xn&&u.jsx("span",{className:pe.groupMenuCheck,children:"✓"})]}),Yn.map(X=>{const ke=Tn===X;return u.jsxs("button",{className:Mi(pe.groupMenuItem,ke&&pe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":ke,onClick:()=>Oe(ft.session,X),children:[u.jsx("span",{className:Mi(pe.groupMenuDot,u_(X))}),u.jsx("span",{className:pe.groupMenuName,children:b(`sidebar.groupColor.${X}`)}),ke&&u.jsx("span",{className:pe.groupMenuCheck,children:"✓"})]},`color:${X}`)}),re.map(X=>{const ke=ss===X.id;return u.jsxs("button",{className:Mi(pe.groupMenuItem,ke&&pe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":ke,onClick:()=>me(ft.session,X.id),children:[u.jsx("span",{className:Mi(pe.groupMenuDot,u_(X.color))}),u.jsx("span",{className:pe.groupMenuName,children:X.name}),ke&&u.jsx("span",{className:pe.groupMenuCheck,children:"✓"})]},X.id)}),u.jsx("div",{className:pe.groupMenuSeparator}),u.jsxs("button",{className:pe.groupMenuItem,type:"button",role:"menuitem",onClick:()=>Ea(ft.session),children:[u.jsx("span",{className:pe.groupMenuIcon,children:u.jsx(ay,{})}),u.jsx("span",{className:pe.groupMenuName,children:b("sidebar.groupCreate")})]})]}),z&&u.jsx(b$e,{anchorEl:z.anchorEl,items:Vt,onClose:Oc}),gt&&u.jsx(xr,{title:b("delete.title"),size:"sm",onClose:()=>St(null),children:u.jsxs("div",{className:pe.confirmContent,children:[u.jsx("p",{className:pe.confirmDescription,children:b("sidebar.deleteConfirmDescription",{name:Xn})}),u.jsxs("div",{className:pe.confirmActions,children:[u.jsx("button",{className:pe.secondaryButton,type:"button",onClick:()=>St(null),children:b("common.cancel")}),u.jsx("button",{className:pe.dangerButton,type:"button",onClick:Ao,children:b("sidebar.delete")})]})]})}),_e&&u.jsx(xr,{title:ms,size:"sm",onClose:wi,children:u.jsxs("form",{className:pe.groupForm,onSubmit:X=>{X.preventDefault(),vi()},children:[u.jsxs("label",{className:pe.fieldStack,children:[u.jsx("span",{children:b("sidebar.groupNamePrompt")}),u.jsx("input",{className:pe.dialogInput,value:Xe,autoFocus:!0,maxLength:64,onChange:X=>yt(X.target.value)})]}),u.jsxs("label",{className:pe.fieldStack,children:[u.jsx("span",{children:b("sidebar.groupColor")}),u.jsx("select",{className:pe.dialogSelect,value:ye,onChange:X=>Kt(X.target.value),children:es.map(X=>u.jsx("option",{value:X,children:b(`sidebar.groupColor.${X}`)},X))})]}),u.jsxs("div",{className:pe.confirmActions,children:[u.jsx("button",{className:pe.secondaryButton,type:"button",disabled:G,onClick:wi,children:b("common.cancel")}),u.jsx("button",{className:pe.secondaryButton,type:"submit",disabled:!rs,children:b("common.save")})]})]})}),Ee&&u.jsx(xr,{title:b("sidebar.groupDelete"),size:"sm",onClose:()=>{G||ct(null)},children:u.jsxs("div",{className:pe.confirmContent,children:[u.jsx("p",{className:pe.confirmDescription,children:b("sidebar.groupDeleteConfirm",{name:jr})}),u.jsxs("div",{className:pe.confirmActions,children:[u.jsx("button",{className:pe.secondaryButton,type:"button",disabled:G,onClick:()=>ct(null),children:b("common.cancel")}),u.jsx("button",{className:pe.dangerButton,type:"button",disabled:G,onClick:Ss,children:b("sidebar.groupDelete")})]})]})}),u.jsxs("div",{className:pe.topRow,children:[!e&&u.jsx("span",{className:pe.brandLogo,"aria-hidden":"true",children:u.jsx(l$e,{})}),u.jsxs("button",{className:pe.newChatButton,type:"button",title:b("sidebar.newChat"),"aria-label":b("sidebar.newChat"),disabled:we,onClick:Kn,children:[u.jsx("span",{className:pe.navIcon,children:u.jsx(ay,{})}),!e&&u.jsx("span",{children:b("sidebar.newChat")})]})]}),!e&&T.length>1&&u.jsxs("div",{className:pe.workspacePicker,children:[u.jsxs("div",{className:pe.workspacePickerHeader,children:[u.jsx("span",{className:pe.workspacePickerLabel,children:b("sidebar.workspaceSelectLabel")}),u.jsx("button",{className:pe.workspaceAddIconButton,type:"button",title:b("sidebar.addWorkspace"),"aria-label":b("sidebar.addWorkspace"),onClick:()=>Ut(!0),children:"+"})]}),u.jsx("div",{className:pe.workspaceList,children:T.map(X=>u.jsx(QOe,{workspace:X,client:C.client,isActive:X.primary?g===void 0:g===X.cwd,currentSessionId:_t,reloadToken:vn,primaryLabel:b("sidebar.workspacePrimary"),untrustedLabel:b("sidebar.workspaceUntrusted"),noSessionsLabel:b("sidebar.noSessions"),formatTime:ke=>xw(ke,b),onSelectWorkspace:ke=>y==null?void 0:y(ke),onLoadSession:er},X.id))})]}),!e&&T.length<=1&&u.jsxs("button",{type:"button",className:pe.addWorkspaceButton,title:b("sidebar.addWorkspace"),onClick:()=>Ut(!0),children:["+ ",b("sidebar.addWorkspace")]}),u.jsxs("div",{className:pe.body,children:[!e&&T.length<=1&&u.jsxs("div",{className:pe.projectRow,children:[u.jsx("span",{className:`${pe.navIcon} ${pe.projectFolderIcon}`,children:u.jsx(c$e,{expanded:Ht})}),u.jsx("span",{className:pe.projectName,title:w.workspaceCwd||bn,children:bn}),u.jsx("button",{className:pe.projectIconButton,type:"button","aria-label":b("sidebar.search"),onClick:()=>{Bn(X=>(X&&Nn(""),!X)),Mn(!0)},children:u.jsx(u$e,{})}),u.jsx("button",{className:pe.projectIconButton,type:"button","aria-label":b(Ht?"sidebar.collapseProject":"sidebar.expandProject"),onClick:()=>Mn(X=>!X),children:u.jsx(h_,{expanded:Ht})})]}),Rn&&!e&&u.jsx("input",{className:pe.searchInput,value:Jt,placeholder:b("sidebar.searchPlaceholder"),"aria-label":b("sidebar.search"),autoFocus:!0,onChange:X=>Nn(X.target.value),onKeyDown:X=>{X.key==="Escape"&&(Nn(""),Bn(!1))}}),u.jsxs("div",{className:pe.sessionList,children:[T.length<=1&&De,vt]})]}),u.jsxs("div",{className:Mi(pe.footer,Ir&&pe.footerCompact,Ur&&pe.footerTight),children:[u.jsxs("button",{className:pe.footerButton,type:"button",title:b("sidebar.settings"),"aria-label":b("sidebar.settings"),onClick:n,children:[u.jsx("span",{className:`${pe.navIcon} ${pe.settingsIcon}`,children:u.jsx(d$e,{})}),!e&&!Ir&&u.jsx("span",{className:pe.footerButtonLabel,children:b("sidebar.settings")})]}),!e&&!Ur&&Zs&&u.jsx("span",{className:pe.version,title:`Qwen Code ${Zs}`,children:Zs}),u.jsx("button",{className:pe.collapseButton,type:"button",title:b("sidebar.scheduledTasks"),"aria-label":b("sidebar.scheduledTasks"),onClick:r,children:u.jsx(f$e,{})}),o&&u.jsx("button",{className:pe.collapseButton,type:"button",title:b("sidebar.sessionsOverview"),"aria-label":b("sidebar.sessionsOverview"),onClick:i,children:u.jsx(m$e,{})}),l&&u.jsx("button",{className:pe.collapseButton,type:"button",title:b("sidebar.splitView"),"aria-label":b("sidebar.splitView"),onClick:a,children:u.jsx(p$e,{})}),u.jsx("button",{className:pe.collapseButton,type:"button",title:b("sidebar.daemonStatus"),"aria-label":b("sidebar.daemonStatus"),onClick:s,children:u.jsx(h$e,{})}),!f&&u.jsx("button",{className:pe.collapseButton,type:"button",title:b(e?"sidebar.expand":"sidebar.collapse"),"aria-label":b(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:u.jsx(y$e,{collapsed:e})})]}),u.jsx("div",{className:pe.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:$t})]}),Hr&&u.jsx(jOe,{onClose:()=>Ut(!1),onAdd:rn})]})}function v$e(e){const[t,n]=p.useState(e);return p.useEffect(()=>{const s=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(s)},[e]),t}const x$e=3e3,_$e=2;function MI(e){return e.some(t=>t.status==="running"||t.status==="paused")}function k$e(e,t,n=0){const s=fg(),[r,i]=p.useState([]),[o,a]=p.useState(!1),[l,c]=p.useState(!1),d=p.useRef(0),h=p.useRef(!1);p.useEffect(()=>{if(!t){i([]),a(!1),d.current=0;return}},[t]),p.useEffect(()=>{!t||!e||(d.current=0,a(!0))},[t,e]),p.useEffect(()=>{!t||n===0||(d.current=0,a(!0))},[t,n]),p.useEffect(()=>{if(l||!t||!o)return;let m=!1;const g=()=>{h.current||(h.current=!0,s.getTasks().then(b=>{if(!m){if(i(b.tasks),b.tasks.length===0){d.current+=1,d.current>=_$e&&a(!1);return}d.current=0,MI(b.tasks)||a(!1)}}).catch(b=>{m||console.warn("[web-shell] failed to refresh tasks:",b)}).finally(()=>{h.current=!1}))};g();const y=setInterval(g,x$e);return()=>{m=!0,clearInterval(y)}},[s,t,o,l]);const f=p.useRef(r);return f.current=r,p.useEffect(()=>{const m=g=>{const y=g.detail,b=(y==null?void 0:y.active)===!0;c(b),!b&&MI(f.current)&&a(!0)};return window.addEventListener(Xp,m),()=>window.removeEventListener(Xp,m)},[]),r}function S$e(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((l,c)=>l===a[c]):!1})}function T$e(e){const t=p.useRef(e);return S$e(t.current,e)||(t.current=e),t.current}function C$e(e,t){const n=p.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 Lr={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"},NI=1024,A$e=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${NI}}\S\$)([^$\n]{1,${NI}})\$(?![\w$])`,"g");function E$e(e){var c,d,h;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=new Map;let i=null,o=null,a=null,l=[];for(const f of n){const m=f.match(s);if(!i){if(m){if(i=m[1]??null,o=((d=(c=m[2])==null?void 0:c.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;l=[]}continue}if(m&&((h=m[1])!=null&&h.startsWith(i[0]??""))&&m[1].length>=i.length){t.push({lang:o,content:l.join(`
`),index:t.length+1,langIndex:a}),i=null,o=null,a=null,l=[];continue}l.push(f)}return t}function M$e(e){var l;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const c of n){const d=c.match(s);if(i){d&&((l=d[1])!=null&&l.startsWith(i[0]??""))&&d[1].length>=i.length&&(i=null);continue}if(!o){if(d){i=d[1]??null;continue}r.test(c)&&(o=!0,a=[]);continue}if(r.test(c)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(c)}return t}function N$e(e){var a;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1;for(const l of n){const c=l.match(s);if(i){c&&((a=c[1])!=null&&a.startsWith(i[0]??""))&&c[1].length>=i.length&&(i=null);continue}if(o){r.test(l)&&(o=!1);continue}if(c){i=c[1]??null;continue}if(r.test(l)){o=!0;continue}for(const d of l.matchAll(A$e)){const h=d[1];h&&t.push({content:h,index:t.length+1})}}return t}function II(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function I$e(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=E$e(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 l=i?r.filter(h=>h.lang===i):r;if(l.length===0)return null;if(o!==null){const h=i?l.find(f=>f.langIndex===o):r.find(f=>f.index===o);return h?{content:h.content,label:II(h,i)}:null}const c=l[l.length-1];return c?{content:c.content,label:II(c,i)}:null}function jI(e,t){const n=N$e(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 j$e(e,t){var c;const n=t.trim().split(/\s+/).filter(Boolean),s=(c=n[0])==null?void 0:c.toLowerCase();if(s!=="latex"&&s!=="math"&&s!=="inline-latex")return;if(s==="inline-latex")return jI(e,n.slice(1));const r=n.slice(1),i=r.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return jI(e,r.filter((d,h)=>h!==i));const o=M$e(e);if(o.length===0)return null;let a=null;for(const d of r)/^\d+$/.test(d)&&(a=Number(d));const l=a!==null?o.find(d=>d.index===a):o[o.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function R$e(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 L$e(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 D$e(e,t,n=L$e){const s=R$e(e);if(s===null)return{status:"info",message:Lr.NO_OUTPUT};if(!s)return{status:"info",message:Lr.NO_TEXT};try{const r=j$e(s,t);if(r===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Lr.INLINE_LATEX_MISSING:Lr.LATEX_MISSING};if(r!==void 0)return await n(r.content),{status:"info",message:`${r.label}${Lr.COPIED_SUFFIX}`};const i=I$e(s,t);if(i===null)return{status:"info",message:Lr.CODE_MISSING};const o=(i==null?void 0:i.content)??s;return await n(o),{status:"info",message:i?`${i.label}${Lr.COPIED_SUFFIX}`:Lr.OUTPUT_COPIED}}catch(r){const i=r instanceof Error?r.message:String(r);return{status:"error",message:`${Lr.CLIPBOARD_PREFIX}${i}`}}}function O$e(e){return typeof e=="object"&&e!==null}function Fq(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function W8(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function B$e(e){if(!W8(e)||!O$e(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function P$e(e){const t=new Set;for(const n of e){if(!W8(n))continue;const s=B$e(n);s&&t.add(s)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const s=Fq(n.content);return!s||!t.has(s)})}function $$e(e){return e.role!=="system"||e.variant!=="info"?!1:Fq(e.content)!==null||W8(e)}function z$e(e){const t=e.findIndex(n=>!$$e(n));return t<0?[]:e.slice(t)}function RI(e){return z$e(P$e(e))}function F$e(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 LI(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 q$e(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function H$e(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function U$e(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 V$e="_layout_ghraz_1",W$e="_muted_ghraz_8",G$e="_notice_ghraz_13",K$e="_list_ghraz_20",Y$e="_group_ghraz_26",Q$e="_groupTitle_ghraz_33",X$e="_server_ghraz_39",J$e="_serverCard_ghraz_44",Z$e="_serverCardExpanded_ghraz_50",eze="_row_ghraz_55",tze="_expandedRow_ghraz_72",nze="_serverRow_ghraz_76",sze="_rowMain_ghraz_81",rze="_rowIcon_ghraz_96",ize="_chevronCell_ghraz_125",oze="_toolRow_ghraz_135",aze="_chevron_ghraz_125",lze="_chevronExpanded_ghraz_150",cze="_disabled_ghraz_154",uze="_name_ghraz_158",dze="_serverName_ghraz_166",hze="_status_ghraz_170",fze="_badge_ghraz_171",mze="_toolCount_ghraz_185",pze="_resourceCount_ghraz_190",gze="_promptCount_ghraz_191",yze="_success_ghraz_196",bze="_warning_ghraz_200",wze="_error_ghraz_204",vze="_serverDetail_ghraz_208",xze="_serverDetailHeader_ghraz_218",_ze="_serverActions_ghraz_223",kze="_field_ghraz_230",Sze="_label_ghraz_238",Tze="_value_ghraz_244",Cze="_button_ghraz_249",Aze="_message_ghraz_269",Eze="_schema_ghraz_270",Mze="_tools_ghraz_281",Nze="_tool_ghraz_135",Ize="_resources_ghraz_292",jze="_sectionTitle_ghraz_301",Rze="_resourceUri_ghraz_306",Lze="_resourceLabel_ghraz_314",Dze="_toolDetail_ghraz_324",Oze="_section_ghraz_301",Bze="_description_ghraz_347",Pze="_parameter_ghraz_353",$ze="_empty_ghraz_359",zze="_emptyTools_ghraz_360",pt={layout:V$e,muted:W$e,notice:G$e,list:K$e,group:Y$e,groupTitle:Q$e,server:X$e,serverCard:J$e,serverCardExpanded:Z$e,row:eze,expandedRow:tze,serverRow:nze,rowMain:sze,rowIcon:rze,chevronCell:ize,toolRow:oze,chevron:aze,chevronExpanded:lze,disabled:cze,name:uze,serverName:dze,status:hze,badge:fze,toolCount:mze,resourceCount:pze,promptCount:gze,success:yze,warning:bze,error:wze,serverDetail:vze,serverDetailHeader:xze,serverActions:_ze,field:kze,label:Sze,value:Tze,button:Cze,message:Aze,schema:Eze,tools:Mze,tool:Nze,resources:Ize,sectionTitle:jze,resourceUri:Rze,resourceLabel:Lze,toolDetail:Dze,section:Oze,description:Bze,parameter:Pze,empty:$ze,emptyTools:zze};function DI(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)}function Fze(e,t){if(e.disabled)return{text:t("mcp.status.disabled"),className:pt.error};switch(e.mcpStatus){case"connected":return{text:t("mcp.status.connected"),className:pt.success};case"connecting":return{text:t("mcp.status.starting"),className:pt.warning};case"disconnected":default:return{text:t("mcp.status.disconnectedTitle"),className:pt.error}}}function qze(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function f_(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function Hze(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 Uze(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 OI(e,t){return`${e}:${t}`}function BI(e,t){return`${e}\0${t}`}const du=U8;function m_({expanded:e}){return u.jsx("svg",{className:`${pt.chevron} ${e?pt.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vze(e,t){const n=[];return!e.disabled&&e.mcpStatus==="disconnected"&&n.push({id:"reconnect",label:t("mcp.action.reconnect")}),n.push({id:e.disabled?"enable":"disable",label:e.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),e.disabled||(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")})),n}function Wze({tool:e,t}){const n=Hze(e);if(!n)return u.jsx("div",{className:pt.muted,children:t("mcp.noSchema")});const s=n.properties,r=Array.isArray(n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!s||typeof s!="object")return u.jsx("pre",{className:pt.schema,children:JSON.stringify(n,null,2)});const i=Object.entries(s);return i.length===0?null:u.jsxs("div",{className:pt.section,children:[u.jsx("div",{className:pt.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",d=typeof l.description=="string"?l.description:"";return u.jsx("div",{className:pt.parameter,children:`- ${o}${r.has(o)?t("mcp.required"):""}: ${c}${d?` - ${d}`:""}`},o)})]})}function M0({label:e,value:t}){return u.jsxs("div",{className:pt.field,children:[u.jsx("span",{className:pt.label,children:e}),u.jsx("span",{className:pt.value,children:t})]})}function Gze({tool:e,t}){const n=Uze(e,t);return u.jsxs("div",{className:pt.toolDetail,children:[e.isValid?null:u.jsxs("div",{className:pt.section,children:[u.jsx("div",{className:`${pt.sectionTitle} ${pt.error}`,children:t("mcp.invalidToolWarning")}),u.jsxs("div",{className:pt.muted,children:[du(t("mcp.invalidReasonLabel"))," ",e.invalidReason||t("mcp.status.unknown")]}),u.jsx("div",{className:pt.muted,children:t("mcp.invalidToolHelp")})]}),e.description?u.jsxs("div",{className:pt.section,children:[u.jsx("div",{className:pt.sectionTitle,children:du(t("mcp.description"))}),u.jsx("div",{className:pt.description,children:e.description.trim()})]}):u.jsx("div",{className:pt.muted,children:t("mcp.noDescription")}),n?u.jsx(M0,{label:du(t("mcp.annotations")),value:n}):null,u.jsx(Wze,{tool:e,t})]})}function Kze({resource:e,t}){const n=e.title||e.name||"",s=n!==""&&n!==e.uri;return u.jsxs("div",{className:pt.toolDetail,children:[u.jsx(M0,{label:du(t("mcp.resource.uriLabel")),value:e.uri}),s?u.jsx(M0,{label:du(t("mcp.resource.nameLabel")),value:n}):null,e.mimeType?u.jsx(M0,{label:du(t("mcp.resource.mimeTypeLabel")),value:e.mimeType}):null,typeof e.size=="number"?u.jsx(M0,{label:du(t("mcp.resource.sizeLabel")),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?u.jsxs("div",{className:pt.section,children:[u.jsx("div",{className:pt.sectionTitle,children:du(t("mcp.description"))}),u.jsx("div",{className:pt.description,children:e.description.trim()})]}):null]})}function Yze({message:e}){const{t}=it(),n=SD({autoLoad:!1}),[s,r]=p.useState(e.status),[i,o]=p.useState(e.toolsByServer),[a,l]=p.useState(e.resourcesByServer??{}),c=p.useMemo(()=>s.servers??[],[s.servers]),[d,h]=p.useState(new Set),[f,m]=p.useState(new Set),[g,y]=p.useState(new Set),[b,w]=p.useState(null),[v,x]=p.useState(null);p.useEffect(()=>{h(j=>{const N=new Set(c.map(L=>L.name));return new Set([...j].filter(L=>N.has(L)))})},[c]);const C=c.filter(j=>!j.disabled&&j.mcpStatus==="connecting").length,A=p.useMemo(()=>{var N,L;const j=[];for(const $ of c){const F=qze($,t),B={server:$,tools:((N=i[$.name])==null?void 0:N.tools)??[],resources:((L=a[$.name])==null?void 0:L.resources)??[]},Q=j.find(Y=>Y.label===F);Q?Q.items.push(B):j.push({label:F,items:[B]})}return j},[c,t,i,a]),T=p.useCallback(async j=>{var F;const N=await n.reload();if(!N)return;r(N);const L=(F=N.servers)==null?void 0:F.find(B=>B.name===j);if(!L)return;const $=await n.loadTools(L.name);if(o(B=>({...B,[L.name]:$})),L.resourceCount)try{const B=await n.loadResources(L.name);l(Q=>({...Q,[L.name]:B}))}catch{}else l(B=>{if(!(L.name in B))return B;const Q={...B};return delete Q[L.name],Q})},[n]),_=p.useCallback(async(j,N)=>{if(!v){h(new Set([j.name])),x(j.name),w({serverName:j.name,text:N.id==="authenticate"?f_(j.name,t):t("mcp.action.running",{action:N.label})});try{let L=null;if(N.id==="reconnect")await n.restartServer(j.name);else{const $=await n.manageServer(j.name,N.id),F=[...$.messages??[],...$.authUrl?[$.authUrl]:[]].join(`
`);F&&(L=N.id==="authenticate"?f_(j.name,t,F):F)}await T(j.name),w({serverName:j.name,text:L??t("mcp.action.done",{action:N.label})})}catch(L){w({serverName:j.name,text:N.id==="authenticate"?f_(j.name,t,DI(L)):t("mcp.action.failed",{error:DI(L)})})}finally{x(null)}}},[v,n,T,t]),R=p.useCallback(j=>{h(N=>N.has(j)?new Set:new Set([j])),m(new Set),y(new Set)},[]),I=p.useCallback((j,N)=>{const L=OI(j,N);m($=>$.has(L)?new Set:new Set([L]))},[]),k=p.useCallback((j,N)=>{const L=BI(j,N);y($=>$.has(L)?new Set:new Set([L]))},[]);return u.jsxs("div",{className:pt.layout,"data-keyboard-scope":!0,children:[C>0?u.jsxs("div",{className:pt.notice,children:[t("mcp.starting",{count:C}),u.jsx("div",{className:pt.muted,children:t("mcp.startingNote")})]}):null,c.length===0?u.jsx("div",{className:pt.empty,children:t("mcp.empty")}):u.jsx("div",{className:pt.list,children:A.map(j=>u.jsxs("div",{className:pt.group,children:[j.label!==t("mcp.extensionMcp")?u.jsx("div",{className:pt.groupTitle,children:j.label}):null,j.items.map(({server:N,tools:L,resources:$})=>{var le;const F=Fze(N,t),B=d.has(N.name),Q=Vze(N,t),Y=((le=i[N.name])==null?void 0:le.tools.length)??0,ne=N.resourceCount??0,P=N.promptCount??0;return u.jsx("div",{className:pt.server,children:u.jsxs("div",{className:`${pt.serverCard} ${B?pt.serverCardExpanded:""}`,children:[u.jsxs("button",{type:"button",className:`${pt.row} ${pt.serverRow} ${B?pt.expandedRow:""}`,onClick:()=>R(N.name),"aria-label":t(B?"mcp.collapse":"mcp.expand"),children:[u.jsxs("span",{className:pt.rowMain,children:[u.jsx("span",{className:pt.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:`${pt.name} ${pt.serverName}`,children:N.name})]}),u.jsx("span",{className:`${pt.status} ${F.className}`,children:F.text}),u.jsx("span",{className:`${pt.badge} ${pt.toolCount}`,children:t(Y===1?"mcp.toolCount":"mcp.toolsCount",{count:Y})}),ne>0?u.jsx("span",{className:`${pt.badge} ${pt.resourceCount}`,children:t("mcp.resourceCount",{count:ne})}):null,P>0?u.jsx("span",{className:`${pt.badge} ${pt.promptCount}`,children:t("mcp.promptCount",{count:P})}):null,u.jsx("span",{className:pt.chevronCell,"aria-hidden":"true",children:u.jsx(m_,{expanded:B})})]}),B?u.jsxs("div",{className:pt.serverDetail,children:[Q.length>0?u.jsx("div",{className:pt.serverDetailHeader,children:u.jsx("div",{className:pt.serverActions,children:Q.map(z=>u.jsx("button",{type:"button",className:pt.button,onClick:()=>void _(N,z),disabled:v!==null,children:z.label},z.id))})}):null,(b==null?void 0:b.serverName)===N.name?u.jsx("pre",{className:pt.message,children:b.text}):null,L.length===0?u.jsx("div",{className:pt.emptyTools,children:t("mcp.emptyTools")}):u.jsx("div",{className:pt.tools,children:L.map(z=>{const M=OI(N.name,z.name),re=f.has(M);return u.jsxs("div",{className:pt.tool,children:[u.jsxs("button",{type:"button",className:`${pt.row} ${pt.toolRow} ${re?pt.expandedRow:""} ${z.isValid?"":pt.disabled}`,onClick:()=>I(N.name,z.name),children:[u.jsx("span",{className:pt.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:pt.name,children:z.name}),u.jsx(m_,{expanded:re})]}),re?u.jsx(Gze,{tool:z,t}):null]},z.name)})}),ne>0?u.jsxs("div",{className:pt.resources,children:[u.jsx("div",{className:pt.sectionTitle,children:t("mcp.resources")}),$.length===0?u.jsx("div",{className:pt.emptyTools,children:t("mcp.resourcesUnavailable")}):null,$.map(z=>{const M=BI(N.name,z.uri),re=g.has(M),U=z.title||z.name||"";return u.jsxs("div",{className:pt.tool,children:[u.jsxs("button",{type:"button",className:`${pt.row} ${pt.toolRow} ${re?pt.expandedRow:""}`,onClick:()=>k(N.name,z.uri),children:[u.jsx("span",{className:pt.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:`${pt.name} ${pt.resourceUri}`,children:z.uri}),U&&U!==z.uri?u.jsx("span",{className:pt.resourceLabel,children:U}):null,u.jsx(m_,{expanded:re})]}),re?u.jsx(Kze,{resource:z,t}):null]},z.uri)})]}):null]}):null]})},N.name)})]},j.label))})]})}function Qze({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function Xze({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"common.loading":t||n?"editor.processing":"editor.placeholder"}function Jze({connectionStatus:e}){return e==="disconnected"||e==="error"}const fh=p.createContext(!1),G8=p.createContext(new Map),qq=p.createContext(new Map);function Zze({timeline:e,details:t,children:n}){return u.jsx(G8.Provider,{value:e,children:u.jsx(qq.Provider,{value:t,children:n})})}const cy=Ww,eFe=3e4;function PI(e){return(e.skills??[]).filter(t=>t.status==="ok").map(t=>({name:t.name,description:t.description??""})).sort((t,n)=>t.name.localeCompare(n.name))}const tFe="ui.compactMode",nFe="ui.hideTips",sFe={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function p_(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const Hq=new Set(["clear","stop","off","reset","none","cancel"]);function rFe(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return Hq.has(t)}function iFe(e){const t=e;return t.source!=="goal"?null:yw(t.data)??yw(t.text)}function oFe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const s=iFe(n);if(s)return s.kind==="set"||s.kind==="checking"?{condition:s.condition,setAt:s.setAt??n.serverTimestamp??n.createdAt}:null}return null}const $I={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},aFe=[],Uq=1e3,zI=6,FI=40,Vq="qwen-code-web-shell-chat-width",lFe=40,Wq="qwen-code-web-shell-sidebar-collapsed";function cFe(e){return e===!0?{enabled:!0,defaultCollapsed:!1}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1}:{enabled:!1,defaultCollapsed:!1}}function uFe(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Wq);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function dFe(e){try{window.localStorage.setItem(Wq,String(e))}catch{}}function Vy(){return`${Uq}`}function hFe(){if(typeof window>"u")return Vy();try{return window.localStorage.getItem(Vq)==="wide"?"wide":Vy()}catch{return Vy()}}function fFe(e){try{window.localStorage.setItem(Vq,e)}catch{}}function Gq(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:Uq}function mFe(e,t){const n=`${Gq(t)}px`,s=`calc(${n} + ${lFe}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 qI(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function HI(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function pFe(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function gFe(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return Lu(e.get("language")??e.get("lang")??navigator.language)}function yFe(e,t){return e instanceof Error?e.message:t}function g_(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Vh(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function bFe(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function wFe(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function y_(e){return typeof e=="object"&&e!==null}function vFe(e){if(!y_(e))return null;const t=e._meta;if(!y_(t))return null;const n=t.qwenModelSwitch;if(!y_(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 xFe(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function _Fe(e){return e.toolKind==="edit"}function kFe(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 SFe(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 TFe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)(ND(s)||SFe(s))&&t.push(`${s.callId}:${s.status}`);return t.join("|")}function CFe(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 AFe(e,t){return e===Lr.NO_OUTPUT?t("copy.noOutput"):e===Lr.NO_TEXT?t("copy.noText"):e===Lr.CODE_MISSING?t("copy.codeMissing"):e===Lr.LATEX_MISSING?t("copy.latexMissing"):e===Lr.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Lr.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Lr.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Lr.CLIPBOARD_PREFIX.length)}`:e.endsWith(Lr.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Lr.COPIED_SUFFIX.length)}):e}function EFe({onSessionIdChange:e,theme:t,onThemeChange:n,language:s,onLanguageChange:r,className:i,style:o,onConnectionChange:a,onStreamingStateChange:l,onError:c,onBugReport:d,hiddenSlashCommands:h,slashCommandCategoryOrder:f,builtinAtProviders:m,atProviders:g,composerTagIcons:y,renderToolHeaderExtra:b,renderWelcomeHeader:w,renderWelcomeFooter:v,parseUserMessageContent:x,renderUserMessageContent:C,renderComposerTag:A,renderComposerTagTooltip:T,onComposerTagClick:_,renderAssistantTurnFooter:R,renderComposerToolbarStart:I,renderComposerToolbarEnd:k,renderComposerToolbarRight:j,renderFooter:N,bottomStatusItems:L,chatMaxWidth:$,sidebar:F,splitSessionIds:B,onSplitSessionIdsChange:Q,shellRef:Y,composerToolbarActions:ne,compactThinking:P=!1,collapseCompletedTurns:le=!0,markdownTableMode:z="basic",virtualScrollThreshold:M,markdown:re,loadingPhrases:U,onTranscriptChange:W,onToast:J,composerRef:G,onComposerReady:te,composerInput:H,composerInputVersion:ie,onSessionChange:fe,onSubmitBefore:Ne}={}){var O7;const[Ie,Ce]=p.useState(hFe),[ve,ut]=p.useState(()=>s===void 0?gFe():Lu(s)),ae=p.useMemo(()=>RD(ve),[ve]),Ct=p.useMemo(()=>cFe(F),[F]),[Ke,on]=p.useState(()=>uFe(Ct.defaultCollapsed)),[qt,gt]=p.useState(null),[St,ft]=p.useState(!1),de=p.useCallback(()=>ft(!1),[]),_e=ORe();p.useEffect(()=>{const D=window.matchMedia("(max-width: 760px)"),V=he=>{he.matches||ft(!1)};return D.addEventListener("change",V),()=>D.removeEventListener("change",V)},[]),p.useEffect(()=>{if(!St)return;const D=Ve=>{if(Ve.key!=="Escape"||Ur.current)return;const At=Ve.target;Yp(At)&&!(At!=null&&At.closest("[data-sidebar-shell]"))||(Ve.stopPropagation(),Ve.preventDefault(),de())},V=document.body.style.overflow;document.body.style.overflow="hidden";const he=Ve=>{const At=Ve.target;At!=null&&At.closest("[data-sidebar-shell]")&&!At.closest(`.${Rt.mobileBackdrop}`)||Ve.preventDefault()};return document.addEventListener("touchmove",he,{passive:!1}),window.addEventListener("keydown",D,!0),()=>{document.body.style.overflow=V,document.removeEventListener("touchmove",he),window.removeEventListener("keydown",D,!0)}},[St,de]);const Ue=p.useCallback(D=>{on(D),dFe(D)},[]),Xe=p.useMemo(()=>({renderToolHeaderExtra:b,renderWelcomeHeader:w,renderWelcomeFooter:v,parseUserMessageContent:x,renderUserMessageContent:C,composerTagIcons:y,renderComposerTag:A,renderComposerTagTooltip:T,onComposerTagClick:_,renderAssistantTurnFooter:R,renderComposerToolbarStart:I,renderComposerToolbarEnd:k,renderComposerToolbarRight:j,renderFooter:N,compactThinking:P,collapseCompletedTurns:le,markdownTableMode:z,markdown:re,loadingPhrases:U}),[b,w,v,x,C,y,A,T,_,R,I,k,j,N,P,le,z,re,U]),yt=N,ye=Qw(),Kt=hg(),Ee=Ta(),ct=fg(),{notices:qn,dismissNotice:Me}=FY(),qe=Sa(),[Fe,Ht]=p.useState(void 0),Mn=p.useRef(Fe);Mn.current=Fe;const Rn=p.useRef(J);Rn.current=J;const Bn=p.useRef(0),[Hr,Ut]=p.useState([]),vn=p.useCallback(D=>{Ut(V=>V.filter(he=>he.id!==D))},[]),tn=p.useCallback((D,V)=>{if(Rn.current){Rn.current(D,V);return}const he={id:`web-shell-toast-${Date.now()}-${++Bn.current}`,tone:D,message:V};Ut(Ve=>[...Ve.filter(Zt=>Zt.tone!==D||Zt.message!==V),he].slice(-4))},[]),Jt=_q(ae),Nn=p.useRef(Jt);Nn.current=Jt;const[fn,Pn]=p.useState(null),[Gn,Hn]=p.useState(null),qs=p.useRef(1),br=p.useRef(1),Dn=p.useRef(null),ln=p.useRef(Ee.sessionId),Es=p.useRef(void 0),Te=p.useRef(Ee.sessionId),Ye=p.useMemo(()=>{const D=[fn].filter(he=>he!==null);if(D.length===0)return RI(Jt);const V=[...Jt];for(const he of D.sort((Ve,At)=>Ve.anchorIndex-At.anchorIndex)){const Ve=he.anchorAfterId?V.findIndex(Zt=>Zt.id===he.anchorAfterId):-1,At=Ve>=0?Ve+1:Math.min(he.anchorIndex,V.length);V.splice(At,0,he.message)}return RI(V)},[Jt,fn]),_t=v$e(Kt),Bt=p.useMemo(()=>AD(_t),[_t]),bn=T$e(Bt),ws=!(Ee.catchingUp&&qt!==null),Zs=MS(bn)&&ws?bn:null,Ir=bn&&!MS(bn)&&ws?bn:null,Ur=p.useRef(bn);Ur.current=ws?bn:null;const Bs=Ir!==null||Zs!==null,we=p.useMemo(()=>Qxe(Jt),[Jt]),xe=p.useRef(null),wt=p.useMemo(()=>{const D=Jxe(Jt),V=xe.current;if(V&&V.signature===D)return V.timeline;const he=Xxe(Jt);return xe.current={signature:D,timeline:he},he},[Jt]),oe=p.useRef(null),ue=p.useMemo(()=>{const D=Zxe(Jt),V=oe.current;if(V&&V.signature===D)return V.details;const he=i4e(Jt);return oe.current={signature:D,details:he},he},[Jt]),be=C$e(we.todos,D=>`${D.id}:${D.status}:${D.content}`),lt=we.allCompleted,[Re,Nt]=p.useState("hidden"),bt=Ee.catchingUp||be.length===0||lt?"hidden":"active";bt!==Re&&Nt(bt);const rn=bt!=="hidden",Kn=L??aFe,er=rn||Kn.length>0,vs=p.useRef(null),tr=p.useRef(null),[ni,ns]=p.useState(0),[bi,Aa]=p.useState(0);p.useLayoutEffect(()=>{if(!er){ns(0),Aa(0);return}const D=tr.current;if(!D){ns(FI),Aa(0);return}const V=()=>{const Ve=vs.current,At=D.getBoundingClientRect(),Zt=Ve==null?void 0:Ve.getBoundingClientRect(),Gt=Math.ceil(At.height),Qt=Zt?Math.max(0,Zt.top-At.top):Gt+zI;Aa(Gt),ns(Math.max(FI,Math.ceil(Qt)))};if(V(),typeof ResizeObserver>"u")return;const he=new ResizeObserver(V);return he.observe(D),vs.current&&he.observe(vs.current),()=>he.disconnect()},[er]);const Ao=p.useMemo(()=>({"--web-shell-bottom-panel-inset":`${ni}px`,"--web-shell-bottom-panel-height":`${bi}px`,"--web-shell-bottom-panel-gap":`${zI}px`}),[bi,ni]),Eo=p.useMemo(()=>TFe(Jt),[Jt]),[io,Ea]=p.useState(0),oo=k$e(Eo,Ee.status==="connected",io),wi=p.useMemo(()=>N?oo.map(CFe):[],[oo,N]),vi=p.useRef(null),xi=p.useRef(null),Ss=p.useRef(null),ao=p.useRef(null),[Mo,Ka]=p.useState(!1),Oc=p.useRef(null),Ma=p.useRef(!1),si=p.useCallback((D="smooth")=>{requestAnimationFrame(()=>{var V;(V=xi.current)==null||V.scrollToBottom(D),requestAnimationFrame(()=>{var he;(he=xi.current)==null||he.scrollToBottom(D)})})},[]),se=p.useCallback(D=>{Ss.current=D,qI(G,D??$I),D&&ao.current!==D&&(ao.current=D,te==null||te(D))},[G,te]);p.useEffect(()=>{qI(G,Ss.current??$I)},[G]);const[me,Oe]=p.useState(null),[et,Se]=p.useState(!1),dt=p.useRef(!1),$t=p.useRef(null);$t.current=me;const{followupState:Xn,onAcceptFollowup:Tn,onDismissFollowup:ss,clear:Yn}=CD({onAccept:D=>{var V;(V=Ss.current)==null||V.insertText(D)}}),xn=Xw(),jr=p.useRef(xn),rs=p.useRef(Date.now()),ms=p.useRef(xn);ms.current==="idle"&&xn!=="idle"&&(rs.current=Date.now()),ms.current=xn;const es=p.useMemo(()=>{if(xn!=="idle"){for(let D=Ye.length-1;D>=0;D--){const V=Ye[D];if((V==null?void 0:V.role)==="user")return V.timestamp??rs.current}return rs.current}},[Ye,xn]),Vr=p.useRef(""),De=p.useRef(void 0),vt=p.useRef(null),Vt=p.useRef(null),[nn,Yt]=p.useState(!1),mn=p.useRef(nn);mn.current=nn;const _n=Ee.status==="connected",[Ks,dr]=p.useState([]);p.useEffect(()=>{_n&&qe.loadSkillsStatus().then(D=>{dr(PI(D))}).catch(()=>{})},[_n,qe]);const[X,ke]=p.useState(null),[Le,Xt]=p.useState([]),[hn,pn]=p.useState(!1),[cn,is]=p.useState(!1),[ri,_i]=p.useState(!1),[Bc,wr]=p.useState(!1),[Na,Pc]=p.useState(!1),[kn,Ia]=p.useState(!1),[jm,Yv]=p.useState(!1),[K8,Y8]=p.useState(!1),[ii,ki]=p.useState("chat"),[Ig,Qv]=p.useState([]),[Q8,X8]=p.useState(!1),[Xv,Jv]=p.useState(null),[Ps,ad]=p.useState(null),Jo=p.useCallback(()=>ad(null),[]),Ya=p.useCallback(D=>{ki("chat"),ad(D)},[]),Zv=p.useCallback(()=>{ad(null),ki("scheduledTasks")},[]),Ch=p.useCallback(D=>{ad(null),Qv(V=>{const he=Array.from(new Set((D??[]).filter(Boolean))).slice(0,Of);return he.length>0?he:V.length>0?V:Ee.sessionId?[Ee.sessionId]:[]}),ki("split")},[Ee.sessionId]),e2=p.useMemo(()=>Array.from(new Set((B??[]).filter(Boolean))).slice(0,Of).join("\0"),[B]),Qa=B!==void 0,Xa=p.useRef(Q);Xa.current=Q;const J8=p.useCallback(()=>{var V;if(!Qa){Ch();return}const D=Ig.length>0?Ig:Ee.sessionId?[Ee.sessionId]:[];(V=Xa.current)==null||V.call(Xa,D)},[Ee.sessionId,Qa,Ch,Ig]),Z8=p.useMemo(()=>({openSplitView:()=>J8(),openSessionOverview:()=>Ya("sessions")}),[Ya,J8]);p.useEffect(()=>{HI(Y,Z8)},[Z8,Y]),p.useEffect(()=>()=>{HI(Y,null)},[Y]),p.useEffect(()=>{if(!Qa)return;const D=e2?e2.split("\0"):[];Qv(V=>pFe(V,D)?V:D),D.length>0?(ad(V=>V===null?V:null),ki(V=>V==="split"?V:"split")):ki(V=>V==="split"?"chat":V)},[Qa,e2]);const Xq=p.useCallback(D=>{var V;Qa||Qv(D),(V=Xa.current)==null||V.call(Xa,D)},[Qa]),jg=p.useCallback(()=>{var D;Qa&&((D=Xa.current)==null||D.call(Xa,[]))},[Qa]),Jq=p.useCallback(()=>{jg(),Ya("sessions")},[jg,Ya]);p.useEffect(()=>{const D=MMe(window.location.search);if(D.length===0)return;const V=new URL(window.location.href);V.searchParams.delete("split"),window.history.replaceState(null,"",V),Qa||Ch(D)},[Qa,Ch]);const t2=p.useRef(!1);p.useEffect(()=>{!_e&&Ps==="sessions"&&ad(null),!_e&&ii==="split"&&(jg(),ki("chat"),t2.current=!0)},[_e,Ps,ii,jg]),p.useEffect(()=>{var D;ii!=="chat"||!t2.current||(t2.current=!1,!Ps&&!Bs&&((D=Ss.current)==null||D.focus()))},[ii,Ps,Bs]);const e7=p.useRef(null),t7=p.useRef(Ps),n7=p.useRef(Bs);p.useEffect(()=>{var he,Ve,At;const D=t7.current,V=n7.current;t7.current=Ps,n7.current=Bs,Ps?(he=e7.current)==null||he.focus():D?Bs||(Ve=Ss.current)==null||Ve.focus():V&&!Bs&&((At=Ss.current)==null||At.focus())},[Ps,Bs]),p.useEffect(()=>{Bs&&(Ps&&ad(null),X&&ke(null),hn&&pn(!1),ii==="scheduledTasks"&&ki("chat"))},[Bs,Ps,X,hn,ii]);const n2=p.useRef(null),Rg=Ir!==null&&!Ps&&X===null&&!hn&&ii==="chat",s7=p.useRef(Rg);p.useEffect(()=>{var V;const D=s7.current;s7.current=Rg,Rg&&!D&&((V=n2.current)==null||V.focus())},[Rg]);const[r7,i7]=p.useState(!1),[o7,s2]=p.useState(!1),[Zq,eH]=p.useState(0),[tH,nH]=p.useState(0),Fi=vh(),a7=p.useRef((Fi==null?void 0:Fi.extensionsVersion)??0);p.useEffect(()=>{const D=(Fi==null?void 0:Fi.extensionsVersion)??0;if(D!==a7.current){a7.current=D;const V=Fi==null?void 0:Fi.lastExtensionChange;if((V==null?void 0:V.status)==="failed"){ye.dispatch([{type:"error",text:ae("extensions.action.failed",{name:V.name??"",source:V.source??"",error:V.error??ae("error.unknown")})}]);return}if((V==null?void 0:V.status)==="installed"){const he=V.name??V.source??ae("extensions.label");ye.dispatch([{type:"status",text:V.version?ae("extensions.install.installedWithVersion",{name:he,version:V.version}):ae("extensions.install.installed",{name:he})}])}else if(V!=null&&V.status){const he=V.name??V.source??ae("extensions.label"),Ve=V.status==="updated"&&V.version?"extensions.manage.updatedWithVersion":`extensions.manage.${V.status}`;ye.dispatch([{type:"status",text:ae(Ve,{name:he,version:V.version??""})}])}ct.refreshCommands().catch(()=>{ye.dispatch([{type:"error",text:ae("extensions.commands.refreshFailed")}])})}},[Fi==null?void 0:Fi.extensionsVersion,Fi==null?void 0:Fi.lastExtensionChange,ct,ye,ae]);const[sH,rH]=p.useState("workspace"),[Rm,r2]=p.useState(null),[iH,l7]=p.useState(!1),[oH,c7]=p.useState(!1),Lg=p.useRef(null),Ah=p.useRef(null),[i2,Dg]=p.useState(null),[o2,a2]=p.useState(t??Li.Dark),[Eh,u7]=p.useState(""),Og=p.useRef(Eh);Og.current=Eh;const Mh=p.useCallback(D=>{Og.current=D,u7(D)},[]),Ms=p.useRef(Ee);Ms.current=Ee;const Wr=p.useCallback(()=>Ms.current.sessionId?!0:(tn("info",ae("localCommand.noSession")),!1),[tn,ae]),aH=Ee.displayName,[Ja,l2]=p.useState("default"),c2=p.useRef(Ja);c2.current=Ja;const Lm=p.useCallback(D=>{c2.current=D,l2(D)},[]),[u2,ld]=p.useState(!1),Dm=p.useRef(null);p.useEffect(()=>{Ee.sessionId&&(Dm.current=null)},[Ee.sessionId]);const d7=p.useCallback(()=>Ms.current.sessionId?Promise.resolve():(Dm.current||(Dm.current=(async()=>{const D=Og.current||Ms.current.currentModel,V=c2.current||Ms.current.currentMode;await GNe({sessionActions:ct,modelId:D,modeId:V,workspaceCwd:Mn.current}),Ht(void 0)})().catch(D=>{throw Dm.current=null,D})),Dm.current),[ct]),ql=p.useRef(Ne);ql.current=Ne;const[h7,f7]=p.useState(0),Om=p.useRef(null);p.useEffect(()=>()=>{Om.current!==null&&clearTimeout(Om.current)},[]);const m7=p.useCallback(D=>{fe==null||fe(D),f7(V=>V+1)},[fe]),Si=p.useRef(m7);Si.current=m7;const lo=p.useCallback(async(D,V,he)=>{var ps,nr;const Ve=!D.trimStart().startsWith("/"),At=Vr.current,Zt=De.current,Gt=Vt.current,Qt=mn.current;!(he!=null&&he.retry)&&Ve&&(Vr.current=D,De.current=V,Vt.current=null),Yt(!1);const We=!Ms.current.sessionId;if(ql.current){ld(!0);try{await ql.current({sessionId:Ms.current.sessionId,prompt:D})}catch(oi){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",oi),ld(!1),Vr.current=At,De.current=Zt,Vt.current=Gt,Yt(Qt);return}We||ld(!1)}!ql.current&&We&&ld(!0),Yn();try{await d7()}finally{We&&ld(!1)}const Pe={images:V,optimisticUserMessage:he==null?void 0:he.optimisticUserMessage,retry:he==null?void 0:he.retry,...he!=null&&he.onAdmitted?{onAdmitted:he.onAdmitted}:{}};he!=null&&he.commitComposerAccepted?he.commitComposerAccepted():he!=null&&he.clearComposerOnPromptStart&&((ps=Ss.current)==null||ps.clear());const wn=Ms.current.sessionId;return wn&&D.trim()&&((nr=Si.current)==null||nr.call(Si,{type:"submit",sessionId:wn,prompt:D,queued:!1}),Om.current!==null&&clearTimeout(Om.current),Om.current=setTimeout(()=>{f7(oi=>oi+1)},2e3)),await ct.sendPrompt(D,Pe)},[Yn,d7,ct]),lH=p.useMemo(()=>(Ee.models??[]).filter(NS).map(D=>({id:D.id,label:Jp(D.label||D.id)})),[Ee.models]),Hl=cn||ri||Bc||Na||kn||jm||K8||Q8||X!==null||hn||i2!==null||Xv!==null||Rm!==null||r7||o7||Ps!==null||ii!=="chat",zt=p.useCallback((D,V)=>{if(g_(D)||KL(D)||Vh(D))return;const he=yFe(D,V);console.error("[web-shell]",he,D),tn("error",he)},[tn]),cH=p.useCallback(D=>tn("success",D),[tn]),{queuedPrompts:uH,queuedTexts:dH,enqueuePrompt:d2,removeQueuedPrompt:hH,insertQueuedPrompt:fH,editQueuedPrompt:mH,editLastQueuedPrompt:pH,clearQueuedPrompts:gH}=Sq({connected:_n,sessionId:Ee.sessionId,clientId:Ee.clientId,streamingState:xn,sessionActions:ct,store:ye,editorRef:Ss,reportError:zt,notifySuccess:cH,t:ae}),cd=p.useCallback((D,V,he,Ve)=>{var Gt;if(ql.current)return ql.current({sessionId:Ms.current.sessionId,prompt:D}).then(()=>{var Pe,wn;d2(D,V,he)!==!1&&(Ve?Ve():(Pe=Ss.current)==null||Pe.clear());const We=Ms.current.sessionId;We&&D.trim()&&((wn=Si.current)==null||wn.call(Si,{type:"submit",sessionId:We,prompt:D,queued:!0}))}).catch(Qt=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",Qt)}),!1;const At=d2(D,V,he),Zt=Ms.current.sessionId;return Zt&&D.trim()&&((Gt=Si.current)==null||Gt.call(Si,{type:"submit",sessionId:Zt,prompt:D,queued:!0})),At},[d2]);p.useEffect(()=>{for(const D of qn)bFe(D)?tn(wFe(D),D.message):D.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",D),Me(D.id)},[Me,qn,tn]);const h2=p.useRef(d);h2.current=d,p.useEffect(()=>{var D;ln.current=Ee.sessionId,(D=Dn.current)==null||D.abort(),Dn.current=null,Pn(null),Hn(null),Dg(null),Fg.current=0},[Ee.sessionId]);const p7=p.useCallback(()=>{var At;if(!Wr())return;const D=`local-recap-${qs.current++}`,V=Jt.length,he=(At=Jt.at(-1))==null?void 0:At.id,Ve=Ee.sessionId;Pn({anchorAfterId:he,anchorIndex:V,message:{id:D,role:"system",content:`※ ${ae("recap.label")}: ${ae("recap.loading")}`,variant:"info",source:"recap"}}),ct.recapSession().then(Zt=>{ln.current===Ve&&Pn({anchorAfterId:he,anchorIndex:V,message:{id:D,role:"system",content:Zt.recap?`※ ${ae("recap.label")}: ${Zt.recap}`:ae("recap.empty"),variant:"info",source:"recap"}})},Zt=>{ln.current===Ve&&(Pn(null),!g_(Zt)&&!Vh(Zt)&&console.warn("[web-shell] unhandled recap failure",Zt))})},[Ee.sessionId,Jt,Wr,ct,ae]),g7=p.useCallback(D=>{var Zt;const V=D.trim();if(!V){tn("error",ae("btw.empty"));return}if(!Wr())return;const he=`local-btw-${br.current++}`,Ve=Ee.sessionId;(Zt=Dn.current)==null||Zt.abort();const At=new AbortController;Dn.current=At,Hn({id:he,role:"btw",question:V,answer:"",isPending:!0}),ct.btwSession(V,{signal:At.signal}).then(Gt=>{ln.current===Ve&&Dn.current===At&&(Dn.current=null,Hn({id:he,role:"btw",question:V,answer:Gt.answer||ae("btw.emptyAnswer"),isPending:!1}))},Gt=>{ln.current===Ve&&Dn.current===At&&(Dn.current=null,Hn(null),!g_(Gt)&&!Vh(Gt)&&console.warn("[web-shell] unhandled btw failure",Gt))})},[Ee.sessionId,tn,Wr,ct,ae]),y7=p.useCallback(()=>{var D;(D=Dn.current)==null||D.abort(),Dn.current=null,Hn(null)},[]);p.useEffect(()=>{const D=V=>{var Gt;if(Hl||bn)return;const he=Gn;if(!he||he.role!=="btw")return;const Ve=V.key.toLowerCase(),At=V.key==="Escape"&&!V.ctrlKey&&!V.metaKey&&!V.altKey&&!V.shiftKey,Zt=V.ctrlKey&&!V.metaKey&&!V.altKey&&!V.shiftKey&&(Ve==="c"||Ve==="d");if(he.isPending){if(!At&&!Zt)return}else{const Qt=((Gt=Ss.current)==null?void 0:Gt.hasInput())??!1;if(!(!V.ctrlKey&&!V.metaKey&&!V.altKey&&!V.shiftKey&&(V.key==="Escape"||!Qt&&(V.key==="Enter"||V.key===" "))))return}V.preventDefault(),V.stopPropagation(),y7()};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[Hl,Gn,y7,bn]);const Za=p.useCallback((D,V)=>VNe(jr.current!=="idle",D,V,{append:he=>ye.appendLocalUserMessage(he)}),[ye]),el=p.useCallback(()=>(tn("error",ae("queue.commandBlocked")),!1),[tn,ae]),Bg=p.useCallback(D=>{a2(D),n==null||n(D)},[n]),Nh=p.useCallback(D=>{ut(D),r==null||r(D)},[r]),b7=p.useCallback(()=>{Ia(!0)},[]),w7=QY({autoLoad:!0}),{settings:Ih,setValue:Ul,reload:Pg}=w7,jh=Ih.find(D=>D.key===Ed),Rh=Ih.find(D=>D.key===nFe),Lh=Ih.find(D=>D.key===K0),yH=(()=>{var V;const D=(V=Ih.find(he=>he.key==="voiceModel"))==null?void 0:V.values.effective;return typeof D=="string"&&D.trim()?D.trim():void 0})(),bH=(()=>{var V;const D=(V=Ih.find(he=>he.key==="visionModel"))==null?void 0:V.values.effective;if(!(typeof D!="string"||!D.trim()))return U$e(D.trim())})(),wH=(()=>{var V;const D=(V=Ih.find(he=>he.key==="fastModel"))==null?void 0:V.values.effective;return typeof D=="string"&&D.trim()?D.trim():void 0})(),[$g,v7]=p.useState(!1),f2=p.useRef($g);f2.current=$g,p.useEffect(()=>{if(t){a2(t);return}const D=e5(jh==null?void 0:jh.values.effective);D&&a2(D)},[t,jh==null?void 0:jh.values.effective]),p.useEffect(()=>{if(s!==void 0){ut(Lu(s));return}const D=J6(Lh==null?void 0:Lh.values.effective);D&&ut(D)},[s,Lh==null?void 0:Lh.values.effective]);const vH=p.useCallback(D=>{const V=ve,he=`/language ui ${D}`;Nh(D);const Ve=()=>Promise.all([ct.refreshCommands(),Pg()]);if(jr.current!=="idle"){Nh(V),el();return}lo(he,void 0).then(Ve).catch(At=>{Nh(V),zt(At,"Failed to sync /language command")})},[el,Nh,Pg,zt,lo,ve,ct]),x7=p.useCallback(()=>{if(jr.current!=="idle"){ye.dispatch([{type:"status",text:ae("clear.blocked")}]);return}ye.reset()},[ye,ae]),_7=p.useCallback(()=>{const D=f2.current,V=!f2.current;v7(V),Ul("workspace",tFe,V).catch(he=>{v7(D),zt(he,ae("compact.saveFailed"))})},[zt,Ul,ae]),ud=p.useCallback(D=>{if(!Sw(D)){zt(new Error(`Unsupported approval mode: ${D}`),ae("local.approvalMode"));return}if(!Ms.current.sessionId){Lm(D);return}ct.setApprovalMode(D).then(V=>{const he=V.mode||D;l2(he);const Ve=Ur.current;if(!Ve)return;if(D==="yolo"||D==="auto-edit"&&_Fe(Ve)){const Zt=Ve.options.find(Gt=>Gt.kind==="allow_once");if(Zt){const Gt=Ve.title||"";ye.dispatch([{type:"status",text:ae("mode.autoApproved",{tool:Gt})}]),ct.submitPermission(Ve.id,Zt.id).catch(Qt=>{zt(Qt,"Failed to auto-approve tool call")})}}}).catch(V=>{zt(V,ae("local.approvalMode"))})},[ct,zt,ye,ae,Lm]);p.useEffect(()=>{jr.current=xn},[xn]),p.useEffect(()=>{let D=null;for(let he=Kt.length-1;he>=0;he--){const Ve=Kt[he];if((Ve==null?void 0:Ve.kind)==="user")break;if((Ve==null?void 0:Ve.kind)==="error"&&Ve.source==="turn_error"){D=Ve.id;break}if((Ve==null?void 0:Ve.kind)!=="debug")break}const V=_n&&D!==null&&D!==Vt.current&&Vr.current.length>0;vt.current=V?D:null,Yt(V)},[Kt,_n]),p.useEffect(()=>{l==null||l(xn)},[xn,l]);const k7=p.useRef(xn),S7=p.useRef(void 0);p.useEffect(()=>{var V;const D=k7.current;if(k7.current=xn,xn!=="idle"&&(S7.current=Ms.current.sessionId),D!=="idle"&&xn==="idle"){const he=Ms.current.sessionId;if(!he||he!==S7.current)return;const Ve=vt.current!=null?new Error(`Turn error (block ${vt.current})`):void 0;(V=Si.current)==null||V.call(Si,{type:"turn_complete",sessionId:he,error:Ve})}},[xn]),p.useEffect(()=>{a==null||a(Ee.status)},[Ee.status,a]),p.useEffect(()=>{W==null||W(Kt)},[Kt,W]),p.useEffect(()=>{if(Ee.error){const D=new Error(Ee.error);c==null||c(D)}},[Ee.error,c]),p.useEffect(()=>{u7(Ee.currentModel??"")},[Ee.currentModel,Ee.sessionId]),p.useEffect(()=>{l2(Ee.currentMode??"default")},[Ee.currentMode,Ee.sessionId]),p.useEffect(()=>{const D=Te.current;if(Ee.sessionId&&Ee.sessionId!==D&&Oe(null),Te.current=Ee.sessionId,!Ee.sessionId&&Ee.missingSession){Es.current=Ee.sessionId;return}Es.current!==Ee.sessionId&&(Es.current=Ee.sessionId,e==null||e(Ee.sessionId))},[Ee.missingSession,Ee.sessionId,e]);const T7=p.useRef(void 0),m2=p.useRef(void 0);p.useEffect(()=>{var he;const D=Ee.sessionId,V=Ee.displayName;if(!(!D||!V)){if(D!==T7.current){T7.current=D,m2.current=V;return}V!==m2.current&&(m2.current=V,(he=Si.current)==null||he.call(Si,{type:"rename",sessionId:D,newName:V}))}},[Ee.sessionId,Ee.displayName]),p.useEffect(()=>{const D=oFe(Kt);Oe(V=>D?(V==null?void 0:V.condition)===D.condition&&V.setAt===D.setAt?V:D:V&&null)},[Kt]),p.useEffect(()=>{const D=V=>{const he=V.detail;if(!(he!=null&&he.active)){Oe(null);return}he.condition&&Oe({condition:he.condition,setAt:he.setAt??Date.now()})};return window.addEventListener(wS,D),()=>window.removeEventListener(wS,D)},[]);const zg=p.useRef(null),Fg=p.useRef(0);p.useEffect(()=>{Fg.current=0},[Ee.sessionId]),p.useEffect(()=>{function he(){if(document.hidden){zg.current===null&&(zg.current=Date.now());return}const Ve=zg.current;if(zg.current=null,Ve===null||Date.now()-Ve<18e4||jr.current!=="idle"||!Ee.sessionId)return;const At=ye.getSnapshot().blocks.length;At-Fg.current<4||(Fg.current=At,ct.recapSession().then(Zt=>{Zt.recap&&ye.dispatch([{type:"status",text:`※ ${ae("recap.label")}: ${Zt.recap}`,source:"recap"}])},Zt=>{console.error("[auto-recap] failed:",Zt)}))}return document.addEventListener("visibilitychange",he),()=>document.removeEventListener("visibilitychange",he)},[Ee.sessionId,ct,ye,ae]);const p2=p.useCallback(()=>{const D=Sw(Ja)?cy.indexOf(Ja):-1,V=cy[(D+1)%cy.length];ud(V)},[Ja,ud]),Bm=p.useCallback((D,V)=>{Wr()&&(Za(D)||ct.getContextUsage({detail:V}).then(he=>{ye.dispatch([{type:"status",text:Hye(he)}]),si("smooth")}).catch(he=>{zt(he,"Failed to load context usage")}))},[Za,ye,Wr,ct,zt,si]),xH=p.useCallback(()=>{Bm("/context detail",!0)},[Bm]),qg=p.useCallback(D=>{Wr()&&ct.branchSession(D||void 0).then(V=>{ye.dispatch([{type:"status",text:ae("branch.success",{name:V.displayName})}])}).catch(V=>{zt(V,ae("branch.failed"))})},[zt,Wr,ct,ye,ae]),_H=p.useCallback(()=>{qg()},[qg]),dd=p.useCallback(async()=>{de(),Jo();try{return await ct.clearSession(),!0}catch(D){return zt(D,"Failed to start a new chat"),!1}},[de,Jo,zt,ct]),kH=p.useCallback(async()=>{if(!dt.current){dt.current=!0,Se(!0),ki("chat");try{await dd()&&(e==null||e(void 0))}finally{dt.current=!1,Se(!1)}}},[dd,e]),Dh=p.useCallback(async D=>{gt(D),de(),Jo();try{await ct.loadSession(D)}catch(V){throw gt(he=>he===D?null:he),V}},[de,Jo,ct]),g2=p.useCallback(D=>{ki("chat"),Dh(D).catch(V=>{zt(V,"Failed to open session")})},[Dh,zt]);p.useEffect(()=>{const D=V=>{const he=V.detail;typeof he=="string"&&he&&g2(he)};return window.addEventListener("qwen:open-session",D),()=>window.removeEventListener("qwen:open-session",D)},[g2]),p.useEffect(()=>{qt!==null&&Ee.sessionId===qt&&!Ee.loadingTranscript&&!Ee.catchingUp&&gt(null)},[Ee.catchingUp,Ee.loadingTranscript,Ee.sessionId,qt]);const hd=p.useRef(null),y2=p.useCallback(D=>{const V=hd.current;V&&V.sessionId===D&&(clearTimeout(V.timer),hd.current=null)},[]),Hg=p.useCallback(D=>new Promise((V,he)=>{let Ve=!1;lo(D,void 0,{onAdmitted:()=>{Ve||(Ve=!0,V())}}).then(()=>{Ve||he(new Error("Run was cancelled before it started"))},Zt=>{Ve||he(Zt)})}),[lo]),Ug=p.useCallback(()=>{const D=hd.current,V=Ms.current;!D||V.sessionId!==D.sessionId||V.loadingTranscript||V.catchingUp||(clearTimeout(D.timer),hd.current=null,Hg(D.prompt).then(()=>D.resolve(),he=>D.reject(he)))},[Hg]),SH=p.useCallback((D,V)=>{if(ki("chat"),!V)return Hg(D);const he=hd.current;return he&&(clearTimeout(he.timer),hd.current=null,he.reject(new Error("superseded by another run"))),new Promise((Ve,At)=>{const Zt=setTimeout(()=>{y2(V),At(new Error("Timed out switching to the task session"))},eFe);hd.current={sessionId:V,prompt:D,resolve:Ve,reject:At,timer:Zt},Dh(V).then(()=>Ug()).catch(Gt=>{y2(V),At(Gt)})})},[Hg,Dh,y2,Ug]);p.useEffect(()=>{Ug()},[Ee.sessionId,Ee.loadingTranscript,Ee.catchingUp,Ug]);const b2=p.useCallback(()=>{Wr()&&ct.getTasks().then(D=>{Dg({snapshot:D})}).catch(D=>{zt(D,"Failed to load tasks")})},[zt,Wr,ct]),C7=p.useCallback((D,V)=>{Oe({condition:D,setAt:V}),ye.dispatch([{type:"status",text:pN({kind:"set",condition:D,setAt:V})}])},[ye]),A7=p.useCallback(D=>{D&&(ye.dispatch([{type:"status",text:pN({kind:"cleared",condition:D.condition,durationMs:Date.now()-D.setAt})}]),Oe(null))},[ye]),Vg=p.useCallback(D=>Wr()?(ye.appendLocalUserMessage(D),ct.clearGoal().catch(V=>{zt(V,"Failed to clear /goal")}),!0):!1,[zt,Wr,ct,ye]),TH=p.useCallback(()=>ct.getRewindSnapshots(),[ct]),CH=p.useCallback(D=>ct.rewindSession(D,{rewindFiles:!1}).then(()=>{}),[ct]),AH=p.useCallback(D=>{if(Vh(D))return;const V=D instanceof Error?D.message:String(D);tn("error",ae("rewind.failed",{reason:V}))},[tn,ae]),E7=p.useCallback((D,V,he)=>{const Ve=D.replace(/^\/goal\b/i,"").trim(),At=Ve.toLowerCase(),Zt=(he==null?void 0:he.sendToDaemon)??!0,Gt=()=>{const Qt=!!ql.current,We=!Ms.current.sessionId||Qt;return lo(D,V,{clearComposerOnPromptStart:We,commitComposerAccepted:Qt?he==null?void 0:he.commitComposerAccepted:void 0}).catch(Pe=>{zt(Pe,"Failed to send /goal command")}),!We};return Ve&&Hq.has(At)?Zt?Vg(D):(ye.appendLocalUserMessage(D),A7($t.current),!0):Ve?Zt?Gt():(ye.appendLocalUserMessage(D),C7(Ve,Date.now()),!0):Zt?Gt():(ye.appendLocalUserMessage(D),!0)},[A7,C7,Vg,zt,lo,ye,Ms]),Pm=p.useMemo(()=>new Set((h??[]).map(p_).filter(Boolean)),[h]),EH=Pm.has("settings"),M7=p.useCallback((D,V,he)=>{var Zt;if(Ms.current.loadingTranscript)return tn("warning",ae("editor.sessionLoading")),!1;if(Jze({connectionStatus:Ms.current.status}))return tn("warning",ae("editor.connectionDisconnected")),!1;const Ve=jr.current!=="idle",At=(Gt,Qt,We,Pe)=>{const wn=!!ql.current,Cn=!Ms.current.sessionId||wn;return lo(Gt,Qt,{...Pe,clearComposerOnPromptStart:Cn,commitComposerAccepted:wn?he:void 0}).catch(ps=>zt(ps,We)),!Cn};if(D.startsWith("/")){const Gt=D.match(/^\/([\w-]+)/);if(Gt){const Qt=Gt[1];if(Pm.has(p_(Qt)))return Ve?cd(D,V,void 0,he):At(D,V,"Failed to send hidden slash command");if(Qt==="help")return Ia(!0),!0;if(Qt==="tasks")return b2(),!0;if(Qt==="goal")return Ve?rFe(D)?Vg(D):el():E7(D,V,{commitComposerAccepted:he});if(Qt==="theme"){const We=D.slice(Gt[0].length).trim().toLowerCase();return We==="dark"||We==="light"?Bg(We):We?tn("error",ae("error.unsupportedTheme")):Yv(!0),!0}if(Qt==="language"){const We=D.slice(Gt[0].length).trim(),[Pe,wn]=We.split(/\s+/);if(!We)return ye.dispatch([{type:"status",text:[ae("language.current",{language:Z6(ve)}),ae("language.usage"),ae("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Pe==null?void 0:Pe.toLowerCase())==="ui"){if(!wn)return ye.dispatch([{type:"status",text:[ae("language.set"),"",ae("language.usage"),"",ae("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const Cn=wn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(Cn))return tn("error",ae("language.invalid")),!0;const nr=Lu(wn);if(Nh(nr),!Ve){const oi=!!ql.current,tl=!Ms.current.sessionId||oi;return lo(`/language ui ${nr}`,void 0,{clearComposerOnPromptStart:tl,commitComposerAccepted:oi?he:void 0}).then(()=>ct.refreshCommands()).catch(Zo=>{zt(Zo,"Failed to sync /language command")}),!tl}return!0}}if(Qt==="copy"){const We=D.slice(Gt[0].length).trim();return D$e(Nn.current,We).then(Pe=>{ye.dispatch([{type:Pe.status==="error"?"error":"status",text:AFe(Pe.message,ae)}])}).catch(Pe=>{zt(Pe,ae("copy.failedFallback"))}),!0}if(Qt==="delete")return _i(!0),!0;if(Qt==="release")return wr(!0),!0;if(Qt==="rewind")return Wr()?(Pc(!0),!0):!1;if(Qt==="branch"){if(Ve)return el();const We=D.slice(Gt[0].length).trim();return qg(We||void 0),!0}if(Qt==="fork"){if(Ve)return el();if(!Wr())return!1;const We=D.slice(Gt[0].length).trim();return We?(ct.forkSession(We).then(Pe=>{if(!Pe.launched){tn("warning",ae("fork.notStarted"));return}Ea(wn=>wn+1),tn("success",ae("fork.started",{name:Pe.description}))}).catch(Pe=>{const wn=Pe instanceof Error?Pe.message:String(Pe);zt(Pe,ae("fork.failed",{reason:wn}))}),!0):(tn("error",ae("fork.empty")),!0)}if(Qt==="auth")return s2(!0),!0;if(Qt==="model"){const We=D.slice(Gt[0].length).trim();if(We==="--fast")return ke("fast"),!0;if(We.startsWith("--fast "))return Ve?cd(D,V,void 0,he):At(D,V,"Failed to send /model --fast");if(We==="--voice")return Za(D,V)||qe.loadProviders().then(Pe=>{Xt(oSe(Pe)),ke("voice")}).catch(Pe=>zt(Pe,ae("model.setVoice"))),!0;if(We.startsWith("--voice ")){const Pe=We.replace(/^--voice\s+/,"");return Ul("workspace","voiceModel",Pe).catch(wn=>zt(wn,ae("model.setVoice"))),!0}if(We==="--vision")return ke("vision"),!0;if(We.startsWith("--vision ")){const Pe=We.replace(/^--vision\s+/,"");return Ul("workspace","visionModel",Pe).catch(wn=>zt(wn,ae("model.setVision"))),!0}if(We){if(!Ms.current.sessionId)return Mh(We),!0;ct.setModel(We).then(()=>{Mh(We)}).catch(Pe=>{zt(Pe,ae("model.switch"))})}else ke("main");return!0}if(Qt==="plan"){if(Ve)return el();const We=D.slice(Gt[0].length).trim();return Ms.current.sessionId?(We&&ld(!0),ct.setApprovalMode("plan").then(()=>{if(Lm("plan"),We)return lo(We,V,{clearComposerOnPromptStart:!0}).catch(Pe=>zt(Pe,"Failed to send plan prompt"))}).catch(Pe=>{zt(Pe,ae("mode.plan"))}).finally(()=>{We&&ld(!1)}),!We):(Lm("plan"),We?At(We,V,"Failed to send plan prompt"):!0)}if(Qt==="approval-mode"){const We=D.slice(Gt[0].length).trim();return We?ud(We):pn(!0),!0}if(Qt==="mcp"){const We=D.slice(Gt[0].length).trim().toLowerCase();return qe.loadMcpStatus().then(async Pe=>{const wn={},Cn={};await Promise.all(((Pe==null?void 0:Pe.servers)??[]).map(async ps=>{await Promise.all([(async()=>{try{wn[ps.name]=await qe.loadMcpTools(ps.name)}catch{}})(),(async()=>{if(ps.resourceCount)try{Cn[ps.name]=await qe.loadMcpResources(ps.name)}catch{}})()])})),Jv({status:Pe,toolsByServer:wn,resourcesByServer:Cn,showDescriptions:We==="desc",showSchema:We==="schema",showTips:!We})}).catch(Pe=>{zt(Pe,"Failed to load MCP status")}),!0}if(Qt==="skills")return D.slice(Gt[0].length).trim()?Ve?cd(D,V,void 0,he):At(D,V,"Failed to send /skills command"):(Za(D,V)||qe.loadSkillsStatus().then(Pe=>{const wn=PI(Pe);if(dr(wn),wn.length===0)ye.dispatch([{type:"status",text:ae("skills.none")}]);else{const Cn=wn.map(ps=>`- ${ps.name}`).join(`
`);ye.dispatch([{type:"status",text:`${ae("skills.available")}

${Cn}`}])}si("smooth")}).catch(Pe=>{zt(Pe,"Failed to load skills")}),!0);if(Qt==="tools"){const We=D.slice(Gt[0].length).trim().toLowerCase();if(We==="desc"||We==="descriptions")Y8(!0);else{if(Za(D,V))return!0;qe.loadToolsStatus().then(Pe=>{const wn=(Pe==null?void 0:Pe.tools)??[];if(wn.length===0)ye.dispatch([{type:"status",text:ae("tools.none")}]);else{const Cn=wn.map(ps=>`- ${ps.displayName||ps.name}`).join(`
`);ye.dispatch([{type:"status",text:`${ae("tools.available")}

${Cn}`}])}si("smooth")}).catch(Pe=>{zt(Pe,"Failed to load tools")})}return!0}if(Qt==="settings")return Ya("settings"),!0;if(Qt==="schedule")return Zv(),!0;if(Qt==="context"){const We=D.slice(Gt[0].length).trim().toLowerCase();if(We===""||We==="detail"||We==="-d")return Bm(D,We==="detail"||We==="-d"),!0}if(Qt==="memory"){const We=D.slice(Gt[0].length).trim().toLowerCase();if(We==="refresh")eH(Pe=>Pe+1);else if(We==="add"||We.startsWith("add ")){const Pe=We.slice(3).trim();rH(Pe==="user"||Pe==="global"?"global":"workspace"),nH(wn=>wn+1)}return i7(!0),!0}if(Qt==="agents"){const We=D.slice(Gt[0].length).trim().toLowerCase();let Pe="menu";return We==="create"?Pe="create":We==="create user"||We==="create global"?Pe="create-user":We==="create project"||We==="create workspace"?Pe="create-project":We==="manage"&&(Pe="manage"),r2(Pe),!0}if(Qt==="extensions"){const We=D.slice(Gt[0].length).trim(),Pe=(Zt=We.split(/\s+/)[0])==null?void 0:Zt.toLowerCase();if(!Pe||Pe==="manage")return X8(!0),!0;if(Pe==="install"){if(Ve)return el();const wn=We.slice(7).trim().split(/\s+/);let Cn="",ps,nr,oi,tl,Zo=null;for(let ea=0;ea<wn.length;ea++){const qi=wn[ea];if(qi)if(qi==="--auto-update")oi=!0;else if(qi==="--pre-release"||qi==="--allow-pre-release")tl=!0;else if(qi==="--ref"||qi==="--registry"){const fd=wn[ea+1];if(!fd||fd.startsWith("--")){Zo=ae("extensions.install.missingOptionValue",{option:qi});break}qi==="--ref"?ps=fd:nr=fd,ea+=1}else if(qi.startsWith("--")){Zo=ae("extensions.install.unknownOption",{option:qi});break}else if(!Cn)Cn=qi;else{Zo=ae("extensions.install.usage");break}}if(Zo)return ye.appendLocalUserMessage(D),ye.dispatch([{type:"error",text:Zo}]),!0;if(!Cn)return ye.appendLocalUserMessage(D),ye.dispatch([{type:"error",text:ae("extensions.install.usage")}]),!0;const nl=Ms.current.clientId;return nl?(ye.appendLocalUserMessage(D),ye.dispatch([{type:"status",text:ae("extensions.install.started",{source:Cn})}]),qe.installExtension({source:Cn,...ps?{ref:ps}:{},...nr?{registry:nr}:{},...oi!==void 0?{autoUpdate:oi}:{},...tl!==void 0?{allowPreRelease:tl}:{},consent:!0},nl).then(()=>{}).catch(ea=>{zt(ea,ae("extensions.install.requestFailed"))}),!0):(tn("warning",ae("extensions.install.waitForSession")),!0)}return Za(D,V)||ye.dispatch([{type:"error",text:ae("extensions.install.usage")}]),!0}if(Qt==="clear"||Qt==="new"||Qt==="reset")return dd(),!0;if(Qt==="rename"){const We=kFe(D.slice(Gt[0].length));if(We.type==="auto"||We.type==="delegate")return Ve?cd(D,V,void 0,he):At(D,V,"Failed to send /rename command");const Pe=We.displayName;return Pe?Wr()?(ct.renameSession(Pe).then(()=>{ye.dispatch([{type:"status",text:ae("rename.success",{name:Pe})}])}).catch(wn=>{zt(wn,"Failed to rename session")}),!0):!1:(tn("error",ae("rename.empty")),!0)}if(Qt==="resume"){const We=D.slice(Gt[0].length).trim();return We?(de(),Jo(),ct.loadSession(We).catch(Pe=>{zt(Pe,"Failed to load session")})):(de(),is(!0)),!0}if(Qt==="recap")return p7(),!0;if(Qt==="btw")return g7(D.slice(Gt[0].length)),!0;if(Qt==="stats"){const We=D.slice(Gt[0].length).trim().toLowerCase();let Pe="overview";return We==="model"?Pe="model":We==="tools"&&(Pe="tools"),Wr()?(Za(D,V)||ct.getStats().then(wn=>{ye.dispatch([{type:"status",text:Nbe(wn,Pe)}]),si("smooth")}).catch(()=>{}),!0):!1}if(Qt==="status"||Qt==="about")return Za(D,V)||Promise.all([qe.loadPreflight().catch(()=>null),qe.loadProviders().catch(()=>null),qe.loadEnv().catch(()=>null)]).then(([We,Pe,wn])=>{var fd,B7,P7,$7,z7,F7;const Cn=LI(We,wn);let ps=Cn.authSource;!ps&&((fd=Pe==null?void 0:Pe.current)!=null&&fd.authType)&&(ps=Pe.current.authType);const nr=[];Cn.nodeVersion&&nr.push(`Node.js v${Cn.nodeVersion}`),Cn.npmVersion&&nr.push(`npm ${Cn.npmVersion}`);let oi="";ps&&(ps.startsWith("oauth")||ps==="qwen-oauth"?oi="Qwen OAuth":oi=`API Key - ${ps}`);const tl=`${Cn.platform} ${Cn.arch}`.trim(),Zo=Og.current,nl=Ms.current,qi={cliVersion:((B7=nl.capabilities)==null?void 0:B7.qwenCodeVersion)||"",runtime:nr.join(" / "),platform:tl,auth:oi,baseUrl:((P7=Pe==null?void 0:Pe.current)==null?void 0:P7.baseUrl)||"",model:Zo||nl.currentModel||(($7=Pe==null?void 0:Pe.current)==null?void 0:$7.modelId)||"",fastModel:((z7=Pe==null?void 0:Pe.current)==null?void 0:z7.fastModelId)||Zo||nl.currentModel||((F7=Pe==null?void 0:Pe.current)==null?void 0:F7.modelId)||"",sessionId:nl.sessionId||"",sandbox:Cn.sandbox,proxy:Cn.proxy,memoryUsage:Cn.memoryUsage};ye.dispatch([{type:"status",text:Gbe(qi)}]),si("smooth")}),!0;if(Qt==="bug"){const We=D.slice(Gt[0].length).trim();return Za(D,V)||Promise.all([qe.loadPreflight().catch(()=>null),qe.loadEnv().catch(()=>null)]).then(([Pe,wn])=>{var oi;const Cn=LI(Pe,wn),ps=((oi=Ms.current.capabilities)==null?void 0:oi.qwenCodeVersion)||"",nr={};if(ps&&(nr.cliVersion=ps),Cn.nodeVersion&&(nr.nodeVersion=Cn.nodeVersion),Cn.npmVersion&&(nr.npmVersion=Cn.npmVersion),Cn.platform&&(nr.platform=Cn.platform),Cn.arch&&(nr.arch=Cn.arch),Cn.sandbox&&(nr.sandbox=Cn.sandbox),Cn.memoryUsage&&(nr.memoryUsage=Cn.memoryUsage),h2.current)h2.current({title:We,systemInfo:nr}),ye.dispatch([{type:"status",text:ae("bug.submitted")}]);else{const tl=Object.entries(nr).filter(([,ea])=>ea).map(([ea,qi])=>`${ea}: ${qi}`).join(`
`),Zo=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(We)}&info=${encodeURIComponent(`
`+tl+`
`)}`,nl=window.open(Zo,"_blank");nl?(nl.opener=null,ye.dispatch([{type:"status",text:ae("bug.submitted")}])):tn("error",ae("bug.popupBlocked"))}}).catch(Pe=>{zt(Pe,ae("bug.failed"))}),!0}}return Ve?cd(D,V,void 0,he):At(D,V,"Failed to send command")}else if(D.startsWith("!")){if(Ve)return tn("error",ae("queue.shellBlocked")),!1;const Gt=D.slice(1).trim();return!Gt||!Wr()?!1:(ct.sendShellCommand(Gt).catch(Qt=>{zt(Qt,"Failed to execute shell command")}),!0)}else return Ve?cd(D,V,void 0,he):At(D,V,"Failed to send message")},[lo,ct,ye,cd,Za,qg,de,Jo,Ya,Zv,dd,Vg,E7,Bg,ud,Nh,el,b2,Pm,tn,zt,p7,g7,Wr,si,ve,Mh,Lm,Ul,Bm,ae,qe]),MH=p.useCallback((D,V,he)=>{const Ve=M7(D,V,he);return Ve!==!1&&si("smooth"),Ve},[M7,si]),N7=p.useCallback((D,V,he)=>{ct.submitPermission(D,V,he).catch(Ve=>{zt(Ve,"Failed to submit permission choice")})},[ct,zt]),w2=p.useCallback(()=>{ct.cancel().catch(D=>{zt(D,"Failed to cancel request")})},[ct,zt]),NH=p.useCallback(()=>{var D;return Hl?!1:((D=vi.current)==null?void 0:D.focusTaskPill())??!1},[Hl]),IH=p.useCallback(D=>{var V,he;if(D){(V=Ss.current)==null||V.insertText(D);return}(he=Ss.current)==null||he.focus()},[]),jH=p.useCallback(D=>{Ka(D)},[]),v2=p.useCallback(()=>{mn.current&&_n&&jr.current==="idle"&&vt.current&&Vr.current?(Vt.current=vt.current,Yt(!1),lo(Vr.current,De.current,{optimisticUserMessage:!1,retry:!0}).catch(D=>zt(D,"Failed to retry prompt"))):ye.dispatch([{type:"status",text:ae("retry.none")}])},[_n,lo,zt,ye,ae]);p.useEffect(()=>{const D=V=>{if(!Hl&&V.ctrlKey&&!V.metaKey&&!V.altKey&&!V.shiftKey){if(V.key==="l"){V.preventDefault(),x7();return}if(V.key==="o"){V.preventDefault(),_7();return}if(V.key==="y"){V.preventDefault(),v2();return}}};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[Hl,x7,_7,v2,ye,ae]);const $c=p.useCallback(()=>{Lg.current=null,l7(!1),c7(!1),Ah.current&&(clearTimeout(Ah.current),Ah.current=null)},[]),I7=p.useRef({streamingState:xn,pendingApproval:bn,interactionBlocked:Hl,activePanel:Ps,closePanel:Jo,handleCancel:w2,handleCycleMode:p2});I7.current={streamingState:xn,pendingApproval:bn,interactionBlocked:Hl,activePanel:Ps,closePanel:Jo,handleCancel:w2,handleCycleMode:p2};const RH=xn!=="idle";p.useEffect(()=>{$c()},[RH,$c]),p.useEffect(()=>{const he=(At,Zt)=>{Lg.current=At,At==="cancel"?c7(!0):l7(!0),Ah.current&&clearTimeout(Ah.current),Ah.current=setTimeout($c,Zt)},Ve=At=>{var Qt,We;if(At.defaultPrevented||At.isComposing)return;const Zt=I7.current;if(At.key==="Escape"&&Zt.activePanel){const Pe=At.target;Pe!=null&&Pe.closest("[data-sidebar-shell]")||(At.preventDefault(),Zt.closePanel());return}if(At.key!=="Escape"){Lg.current!==null&&$c(),At.key==="Tab"&&At.shiftKey&&!Zt.interactionBlocked&&(At.preventDefault(),Zt.handleCycleMode());return}const Gt=F$e({blocked:!!Zt.pendingApproval||Zt.interactionBlocked,streaming:Zt.streamingState!=="idle",hasInput:!!((Qt=Ss.current)!=null&&Qt.hasInput()),armed:Lg.current});if(Gt.kind!=="ignore")switch(At.preventDefault(),Gt.kind){case"cancel":Zt.handleCancel(),$c();break;case"clear":(We=Ss.current)==null||We.clear(),$c();break;case"arm":he(Gt.action,Gt.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",Ve),()=>{window.removeEventListener("keydown",Ve),$c()}},[$c]);const LH=Qze({catchingUp:!!Ee.catchingUp,pendingApproval:bn!==null,isPreparingPrompt:u2}),x2=p.useCallback(D=>{if(!Ms.current.sessionId){Mh(D);return}ct.setModel(D).then(V=>{const he=vFe(V);Mh((he==null?void 0:he.modelId)??D),he&&ye.dispatch({type:"debug",text:xFe(he,ae),source:"model_switch_summary",data:he})}).catch(V=>{zt(V,ae("model.switch"))})},[ct,ye,zt,ae,Mh]),DH=p.useCallback(D=>{if(xn!=="idle"){el();return}Jo(),lo(`/model --fast ${D}`).then(()=>{Pg().catch(V=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",V)})}).catch(V=>{zt(V,"Failed to switch fast model")})},[el,Jo,lo,xn,zt,Pg]),OH=p.useCallback(D=>{const V=H$e(D);Ul("workspace","voiceModel",V).catch(he=>zt(he,ae("model.setVoice")))},[zt,Ul,ae]),BH=p.useCallback(D=>{const V=q$e(D);Ul("workspace","visionModel",V).catch(he=>zt(he,ae("model.setVision")))},[zt,Ul,ae]),PH={main:x2,fast:DH,voice:OH,vision:BH},j7=p.useMemo(()=>Aq(Eq(Ee.commands??[],Tq(ae)),ae).filter(D=>!Pm.has(p_(D.name))).map(D=>{const V=Cq(D.name);return V?{...D,displayCategory:"skill",description:ae(V)}:D}),[Ee.commands,Pm,ae]),$m=p.useMemo(()=>{var D;return{version:((D=Ee.capabilities)==null?void 0:D.qwenCodeVersion)||"",cwd:Ee.workspaceCwd||"",currentModel:Eh,currentMode:Ja,hideTips:(Rh==null?void 0:Rh.values.effective)===!0}},[(O7=Ee.capabilities)==null?void 0:O7.qwenCodeVersion,Ee.workspaceCwd,Eh,Ja,Rh==null?void 0:Rh.values.effective]),$H=p.useMemo(()=>w?w($m):u.jsx(M7e,{...$m}),[w,$m]),R7=p.useMemo(()=>v==null?void 0:v($m),[v,$m]),Vl=!Ee.sessionId&&Ye.length===0&&!rn&&!bn&&!Gn,L7=Ee.status!=="connecting"&&!Ee.sessionId&&Ee.missingSession===!0&&!Ps&&ii==="chat",_2=Vl?Vy():Ie,zH=Gq($),FH=[Rt.app,Rt.appChat,Vl?Rt.appChatEmpty:void 0,Ct.enabled?Rt.appWithSidebar:void 0,o2===Li.Light?Rt.themeLight:Rt.themeDark,i].filter(Boolean).join(" "),qH=p.useMemo(()=>({...o,...mFe(_2,$)}),[$,_2,o]),D7=p.useCallback(D=>{Ce(D),fFe(D)},[]);return p.useLayoutEffect(()=>{const D=vs.current;if(!D)return;const V=Oc.current,he=Ma.current,Ve=D.getBoundingClientRect();if(he&&!Vl&&V){const At=V.top-Ve.top;Math.abs(At)>1&&(D.style.transition="width 320ms ease",D.style.transform=`translateY(${At}px)`,requestAnimationFrame(()=>{D.style.transition="width 320ms ease, transform 280ms ease",D.style.transform=""}),window.setTimeout(()=>{D.style.transition=""},320))}Oc.current=Ve,Ma.current=Vl},[Vl]),u.jsx(BQ,{value:o2,children:u.jsx(TQ,{language:ve,children:u.jsxs("div",{className:FH,style:qH,"data-web-shell-root":!0,children:[!J&&u.jsx(s7e,{toasts:Hr,onDismiss:vn}),cn&&u.jsx(xr,{title:ae("resume.title"),size:"lg",onClose:()=>is(!1),children:u.jsx(uTe,{onSelect:D=>{de(),Jo(),ct.loadSession(D).catch(V=>{zt(V,"Failed to load session")})},onClose:()=>is(!1)})}),X&&u.jsx(xr,{title:ae(sFe[X]),size:"lg",onClose:()=>ke(null),children:u.jsx(ITe,{mode:X,models:X==="voice"?Le:void 0,currentModelId:X==="voice"?yH:X==="vision"?bH:X==="fast"?wH:void 0,onSelect:D=>{X&&PH[X](D),ke(null)}})}),hn&&u.jsx(xr,{title:ae("mode.select"),size:"sm",onClose:()=>pn(!1),children:u.jsx(cTe,{currentMode:Ja,onSelect:D=>{ud(D),pn(!1)}})}),K8&&u.jsx(xr,{title:ae("tools.title"),size:"lg",onClose:()=>Y8(!1),children:u.jsx($9e,{})}),Q8&&u.jsx(xr,{title:ae("extensions.manage.title"),size:"lg",onClose:()=>X8(!1),children:u.jsx(HLe,{})}),Xv&&u.jsx(xr,{title:ae("mcp.manageServers"),size:"lg",onClose:()=>Jv(null),children:u.jsx(Yze,{message:Xv,onClose:()=>Jv(null)})}),i2&&u.jsx(xr,{title:ae("tasks.title"),size:"lg",onClose:()=>Dg(null),children:u.jsx(DF,{message:i2,embedded:!0,manageActiveEvent:!1,onClose:()=>Dg(null)})}),Rm&&u.jsx(xr,{title:ae(Rm==="manage"?"agent.manage":Rm==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>r2(null),children:u.jsx(UCe,{mode:Rm,embedded:!0,onMessage:D=>ye.dispatch([{type:"status",text:D}]),onClose:()=>r2(null)})}),r7&&u.jsx(xr,{title:ae("memory.menu"),size:"lg",onClose:()=>i7(!1),children:u.jsx(u9e,{refreshSignal:Zq,addSignal:tH,addScope:sH,onMessage:(D,V="status")=>{ye.dispatch([{type:V,text:D}])}})}),kn&&u.jsx(xr,{title:ae("help.title"),size:"md",onClose:()=>Ia(!1),children:u.jsx(aOe,{commands:j7})}),jm&&u.jsx(xr,{title:ae("theme.title"),size:"sm",onClose:()=>Yv(!1),children:u.jsx(lOe,{currentTheme:o2,onSelect:Bg,onClose:()=>Yv(!1)})}),o7&&u.jsx(xr,{title:ae("auth.title"),size:"lg",onClose:()=>s2(!1),children:u.jsx(B9e,{onMessage:(D,V="status")=>{ye.dispatch([V==="error"?{type:"error",text:D}:{type:"status",text:D}])},onClose:()=>s2(!1)})}),ri&&u.jsx(xr,{title:ae("delete.title"),size:"lg",onClose:()=>_i(!1),children:u.jsx(cOe,{onDeleted:D=>{ye.dispatch([{type:"status",text:D.length===1?`${ae("delete.deleted")} (${D[0].slice(0,8)})`:ae("delete.deletedCount",{count:D.length})}])},onError:D=>{if(Vh(D))return;const V=D instanceof Error?D.message:String(D);tn("error",ae("delete.failed",{reason:V}))},onClose:()=>_i(!1)})}),Bc&&u.jsx(xr,{title:ae("release.title"),size:"lg",onClose:()=>wr(!1),children:u.jsx(uOe,{onReleased:D=>{ye.dispatch([{type:"status",text:`${ae("release.released")} (${D.slice(0,8)})`}])},onError:D=>{if(Vh(D))return;const V=D instanceof Error?D.message:String(D);tn("error",ae("release.failed",{reason:V}))},onClose:()=>wr(!1)})}),Na&&u.jsx(xr,{title:ae("rewind.title"),subtitle:ae("rewind.subtitle"),size:"lg",onClose:()=>Pc(!1),children:u.jsx(AOe,{blocks:Kt,loadSnapshots:TH,rewind:CH,onError:AH,onClose:()=>Pc(!1)})}),u.jsxs("div",{className:Rt.appShell,children:[Ct.enabled&&u.jsxs("div",{"data-sidebar-shell":"",...St?{role:"dialog","aria-modal":"true"}:{},"aria-label":ae("sidebar.label"),className:[Rt.mobileDrawer,St?Rt.mobileDrawerOpen:void 0].filter(Boolean).join(" "),children:[u.jsx("div",{className:Rt.mobileBackdrop,onClick:de,"aria-hidden":"true"}),u.jsx(w$e,{collapsed:Ke&&!St,onCollapsedChange:Ue,onOpenSettings:()=>{de(),Ya("settings")},onOpenDaemonStatus:()=>{de(),Ya("status")},onOpenScheduledTasks:()=>{de(),Zv()},onOpenSessions:()=>{de(),Ya("sessions")},canOpenSessionsOverview:_e,onOpenSplitView:()=>{de(),Ch()},canOpenSplitView:_e,onNewSession:()=>(ki("chat"),dd()),onLoadSession:D=>(ki("chat"),Dh(D)),onError:zt,mobileOpen:St,sessionListReloadToken:h7,selectedWorkspaceCwd:Fe,onSelectWorkspace:Ht})]}),u.jsxs("div",{className:ii!=="chat"?`${Rt.chatPane} ${Rt.chatPaneShowingPage}`:Rt.chatPane,children:[Ct.enabled&&!Ps&&ii==="chat"&&u.jsx("button",{type:"button",className:[Rt.hamburgerButton,Vl?Rt.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>ft(D=>!D),"aria-label":ae("sidebar.toggleMenu"),"aria-expanded":St,children:u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),u.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),u.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),Ps&&u.jsxs("section",{className:Rt.panelHost,role:"region","data-testid":"inline-panel","aria-label":ae(Ps==="settings"?"settings.title":Ps==="status"?"daemon.title":"sessionsOverview.title"),children:[u.jsxs("div",{className:Rt.panelHeader,children:[u.jsx("button",{ref:e7,type:"button",className:Rt.panelBack,"data-testid":"panel-back",onClick:Jo,"aria-label":ae("common.back"),title:ae("common.back"),children:u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),u.jsx("div",{className:Rt.panelTitle,children:ae(Ps==="settings"?"settings.title":Ps==="status"?"daemon.title":"sessionsOverview.title")})]}),u.jsx("div",{className:Rt.panelBody,children:Ps==="settings"?u.jsx(MDe,{settingsState:w7,embedded:!0,onLanguageChange:vH,onThemeChange:Bg,chatWidthMode:Ie,onChatWidthModeChange:D7,onSubDialog:D=>{D==="fastModel"?ke("fast"):D==="visionModel"?ke("vision"):D==="tools.approvalMode"&&pn(!0)}}):Ps==="status"?u.jsx(AMe,{}):u.jsx(pNe,{onOpenSession:g2,onOpenSplit:Ch})},Ps)]}),ii==="scheduledTasks"&&u.jsxs("div",{className:Rt.fullPage,"data-testid":"scheduled-tasks-page",children:[u.jsxs("div",{className:Rt.fullPageHeader,children:[u.jsx("button",{type:"button",className:Rt.fullPageBack,onClick:()=>ki("chat"),"aria-label":ae("common.back"),title:ae("common.back"),children:u.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:u.jsx("path",{d:"M15 18l-6-6 6-6"})})}),u.jsx("div",{className:Rt.fullPageTitle,children:ae("scheduledTasks.title")})]}),u.jsx("div",{className:Rt.fullPageBody,children:u.jsx($Le,{onRunPrompt:SH,onCreateViaChat:()=>{ki("chat"),dd().then(D=>{D&&(e==null||e(void 0),window.setTimeout(()=>{var V,he;(V=Ss.current)==null||V.insertText(ae("scheduledTasks.chatStarter"),{mode:"replace"}),(he=Ss.current)==null||he.focus()},0))})},onOpenSession:D=>{ki("chat"),Dh(D).catch(V=>{zt(V,"Failed to open session")})},onError:zt})})]}),ii==="split"&&u.jsxs("div",{className:Rt.fullPage,"data-testid":"split-view-page",children:[Bs&&u.jsxs("div",{className:Rt.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[u.jsx("span",{children:ae("splitView.outerApprovalPending")}),u.jsx("button",{type:"button",onClick:()=>ki("chat"),children:ae("splitView.goToApproval")})]}),u.jsx(JC,{value:Xe,children:u.jsx(fh.Provider,{value:$g,children:u.jsx(LRe,{sessionIds:Ig,onPanesChange:Xq,sessionListReloadToken:h7,onExit:Jq,onError:zt})})})]}),u.jsxs("div",{className:Ps||ii!=="chat"?`${Rt.chatViewWrap} ${Rt.chatViewHidden}`:Rt.chatViewWrap,"aria-hidden":Ps||ii!=="chat"?!0:void 0,children:[L7&&u.jsxs("div",{className:Rt.missingSessionState,children:[u.jsx("div",{className:Rt.missingSessionMessage,children:ae("session.missing")}),u.jsx("button",{type:"button",className:Rt.missingSessionButton,disabled:et,onClick:kH,children:ae("session.new")})]}),u.jsx("div",{className:L7?Rt.chatSubtreeHidden:Rt.chatSubtree,children:u.jsxs(JC,{value:Xe,children:[u.jsx(fh.Provider,{value:$g,children:u.jsx(Zze,{timeline:wt,details:ue,children:u.jsxs("div",{style:Ao,className:[Rt.content,rn||Ye.length>0||bn?Rt.contentHasMessages:void 0].filter(Boolean).join(" "),children:[u.jsx(nq,{ref:xi,messages:Ye,pendingApproval:Ir,onShowContextDetail:xH,loadingTranscript:Ee.loadingTranscript,catchingUp:Ee.catchingUp,isResponding:xn!=="idle",activeTurnStartedAt:es,workspaceCwd:Ee.workspaceCwd||"",hideSessionTimeline:_2==="wide",showRetryHint:nn,onRetryClick:v2,onBranchSession:_H,bottomOverlayInset:ni,welcomeHeader:Vl?$H:void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:jH,virtualScrollThreshold:M}),(Gn==null?void 0:Gn.role)==="btw"&&u.jsx("div",{className:Rt.btwPanel,children:u.jsx(GF,{question:Gn.question,answer:Gn.answer,isPending:Gn.isPending})})]})})}),u.jsxs("div",{ref:vs,style:Ao,className:Rt.footer,children:[Mo&&u.jsx("div",{className:er?`${Rt.scrollToBottomLayer} ${Rt.scrollToBottomLayerWithTodos}`:Rt.scrollToBottomLayer,children:u.jsx("button",{type:"button",className:Rt.scrollToBottomButton,"aria-label":ae("chat.scrollToBottom"),onClick:()=>si("smooth"),children:u.jsx("svg",{className:Rt.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),er&&u.jsx("div",{ref:tr,className:Rt.bottomPanels,children:u.jsx(S7e,{todos:rn?be:[],statusItems:Kn})}),Ir&&ii==="chat"&&u.jsx("div",{ref:n2,tabIndex:-1,"data-testid":"approval-overlay",className:Rt.approvalOverlay,children:u.jsx(Nq,{request:Ir,onConfirm:N7,variant:"floating"})}),Zs&&ii==="chat"&&u.jsx("div",{ref:n2,tabIndex:-1,"data-testid":"approval-overlay",className:Rt.approvalOverlay,children:u.jsx(Iq,{request:Zs,onConfirm:N7,variant:"floating"})}),u.jsxs("div",{className:Rt.composer,children:[u.jsx(oq,{startedAt:es}),iH&&xn==="idle"&&u.jsx("div",{className:Rt.escClearStatus,role:"status",children:ae("editor.escClearHint")}),u.jsx(Mq,{prompts:uH,t:ae,onDelete:hH,onInsert:fH,onEdit:mH}),u.jsx(iq,{ref:se,onSubmit:MH,onCycleMode:p2,onToggleShortcuts:b7,onCancel:w2,isRunning:xn!=="idle",isPreparing:u2,cancelArmed:oH,disabled:LH,commands:j7,skills:Ks,slashCommandCategoryOrder:f,builtinAtProviders:m,atProviders:g,composerTagIcons:y,queuedMessages:dH,onFocusFooter:NH,onPopQueuedMessages:pH,onClearQueuedMessages:gH,currentMode:Ja,currentModel:Eh,chatWidthMode:Ie,showChatWidthToggle:!Vl,chatWidthToggleMin:zH,visibleToolbarActions:ne,availableModels:lH,onSelectMode:ud,onSelectModel:x2,onChatWidthModeChange:D7,sessionName:aH,dialogOpen:Hl||Bs,followupState:Xn,onAcceptFollowup:Tn,onDismissFollowup:ss,composerInput:H,composerInputVersion:ie,placeholderText:ae(Xze({catchingUp:!!Ee.catchingUp,isPreparingPrompt:u2,isStreaming:xn!=="idle"}))})]}),yt?u.jsx(yt,{connected:_n,mode:Ja,model:Eh,streamingState:xn,contextUsageRatio:(Ee.contextWindow??0)>0?(Ee.tokenCount??0)/(Ee.contextWindow??0):0,activeGoal:me,tasks:wi,availableModes:cy,availableModels:(Ee.models??[]).filter(NS).map(D=>({id:D.id,label:Jp(D.label||D.id),contextWindow:D.contextWindow})),skills:Ks,onSelectMode:ud,onSelectModel:x2}):u.jsx(B8e,{onSelectMode:()=>pn(D=>!D),onSelectModel:()=>ke(D=>D?null:"main"),onShowContext:()=>Bm("/context",!1),onOpenSettings:()=>Ya("settings"),ref:vi,onOpenTasks:()=>b2(),onReturnToInput:IH,tasks:oo,activeGoal:me,hideSettings:EH,onToggleShortcuts:b7,compact:!0}),Vl&&R7&&u.jsx("div",{className:Rt.emptyWelcomeFooter,children:R7})]})]})})]})]})]})]})})})}const UI={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:"重试"}},MFe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},NFe={margin:0,fontSize:"1rem",fontWeight:600},IFe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},jFe={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 RFe({error:e,onRetry:t,language:n="en"}){const s=UI[n]??UI.en;return u.jsxs("div",{role:"alert",style:MFe,"data-web-shell-error":!0,children:[u.jsx("p",{style:NFe,children:s.title}),u.jsx("p",{style:IFe,children:s.body}),!1,u.jsx("button",{type:"button",style:jFe,onClick:t,children:s.retry})]})}const LFe=NMe(),Kq="qwen-code-web-shell-language",Yq="qwen-code-web-shell-theme";function Qq(e){if(e===Li.Dark||e===Li.Light)return e}function DFe(){const e=new URLSearchParams(window.location.search).get("theme");return Qq(e)}function OFe(){try{return Qq(window.localStorage.getItem(Yq))}catch{return}}function BFe(e){try{window.localStorage.setItem(Yq,e)}catch{}}function PFe(){return DFe()??OFe()??Li.Dark}function $Fe(){try{const e=window.localStorage.getItem(Kq);return e?Lu(e):void 0}catch{return}}function zFe(e){try{window.localStorage.setItem(Kq,e)}catch{}}function FFe(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return Lu(t||($Fe()??navigator.language))}function qFe(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function HFe(e){const t=new URL(window.location.href);t.pathname=e?`/session/${encodeURIComponent(e)}`:"/",t.searchParams.delete("theme"),t.searchParams.delete("language"),t.searchParams.delete("lang"),t.searchParams.delete("token"),t.searchParams.delete("daemon"),window.history.replaceState(null,"",t)}function UFe({daemonToken:e}){const[t,n]=p.useState(()=>PFe()),[s,r]=p.useState(()=>FFe()),[i]=p.useState(()=>qFe()),o=LFe||window.location.origin;p.useEffect(()=>{const d=document.documentElement;d.classList.remove("theme-dark","theme-light"),d.classList.add(`theme-${t}`);const h=document.querySelector('meta[name="theme-color"]');h&&h.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const a=p.useCallback(d=>{n(d),BFe(d)},[]),l=p.useCallback(d=>{r(d),zFe(d)},[]),c=p.useCallback(d=>{HFe(d)},[]);return u.jsx(Tc,{label:"web-shell-root",fallback:(d,h)=>u.jsx(RFe,{error:d,onRetry:h,language:s}),children:u.jsx(hY,{baseUrl:o,token:e,children:u.jsx(kD,{sessionId:i,suppressOwnUserEcho:!0,children:u.jsx(EFe,{theme:t,onThemeChange:a,language:s,onLanguageChange:l,onSessionIdChange:c,sidebar:!0,compactThinking:!0})},i??"new")})})}async function VFe(){const e=bq()??await RMe();LMe(),FW.createRoot(document.getElementById("root")).render(u.jsx(cU.StrictMode,{children:u.jsx(UFe,{daemonToken:e})}))}VFe();export{K as _,Wy as c,Cw as g,QFe as k};
